diff --git "a/trackio/frontend/dist/assets/index-Ct_2eJQ1.js" "b/trackio/frontend/dist/assets/index-Ct_2eJQ1.js" new file mode 100644--- /dev/null +++ "b/trackio/frontend/dist/assets/index-Ct_2eJQ1.js" @@ -0,0 +1,250 @@ +var SU=Object.defineProperty;var xF=e=>{throw TypeError(e)};var kU=(e,t,n)=>t in e?SU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Gi=(e,t,n)=>kU(e,typeof t!="symbol"?t+"":t,n),Ib=(e,t,n)=>t.has(e)||xF("Cannot "+n);var Y=(e,t,n)=>(Ib(e,t,"read from private field"),n?n.call(e):t.get(e)),Je=(e,t,n)=>t.has(e)?xF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ye=(e,t,n,r)=>(Ib(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Qt=(e,t,n)=>(Ib(e,t,"access private method"),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const CU="5";var H6;typeof window<"u"&&((H6=window.__svelte??(window.__svelte={})).v??(H6.v=new Set)).add(CU);const FU=1,$U=2,V6=4,DU=8,MU=16,RU=1,TU=2,NU=4,OU=8,LU=16,IU=1,PU=2,Cn=Symbol(),X6="http://www.w3.org/1999/xhtml",BU="http://www.w3.org/2000/svg",zU="http://www.w3.org/1998/Math/MathML",jU=!1;var K6=Array.isArray,UU=Array.prototype.indexOf,Sf=Array.prototype.includes,mv=Array.from,qU=Object.defineProperty,rf=Object.getOwnPropertyDescriptor,Z6=Object.getOwnPropertyDescriptors,WU=Object.prototype,HU=Array.prototype,RE=Object.getPrototypeOf,_F=Object.isExtensible;const GU=()=>{};function YU(e){return e()}function jx(e){for(var t=0;t{e=r,t=i});return{promise:n,resolve:e,reject:t}}function VU(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const wn=2,kf=4,Xp=8,Q6=1<<24,wu=16,gs=32,Ml=64,Ux=128,Fi=512,pn=1024,Bn=2048,ms=4096,si=8192,$i=16384,ac=32768,qx=1<<25,Rl=65536,wF=1<<17,XU=1<<18,dd=1<<19,e8=1<<20,Zs=1<<25,Tl=65536,Wx=1<<21,TE=1<<22,Xa=1<<23,ml=Symbol("$state"),KU=Symbol("legacy props"),ZU=Symbol(""),Bo=new class extends Error{constructor(){super(...arguments);Gi(this,"name","StaleReactionError");Gi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function JU(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function QU(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function eq(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function tq(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function nq(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function rq(e){throw new Error("https://svelte.dev/e/effect_orphan")}function iq(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function sq(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function oq(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function aq(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function uq(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function lq(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function cq(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function t8(e){return e===this.v}function n8(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function r8(e){return!n8(e,this.v)}let hd=!1,fq=!1;function dq(){hd=!0}let qt=null;function Cf(e){qt=e}function Gt(e,t=!1,n){qt={p:qt,i:!1,c:null,e:null,s:e,x:null,r:Qe,l:hd&&!t?{s:null,u:null,$:[]}:null}}function Yt(e){var t=qt,n=t.e;if(n!==null){t.e=null;for(var r of n)k8(r)}return t.i=!0,qt=t.p,{}}function Kp(){return!hd||qt!==null&&qt.l===null}let ol=[];function i8(){var e=ol;ol=[],jx(e)}function Ka(e){if(ol.length===0&&!Hh){var t=ol;queueMicrotask(()=>{t===ol&&i8()})}ol.push(e)}function hq(){for(;ol.length>0;)i8()}function s8(e){var t=Qe;if(t===null)return Xe.f|=Xa,e;if((t.f&ac)===0&&(t.f&kf)===0)throw e;Ba(e,t)}function Ba(e,t){for(;t!==null;){if((t.f&Ux)!==0){if((t.f&ac)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const pq=-7169;function Xt(e,t){e.f=e.f&pq|t}function NE(e){(e.f&Fi)!==0||e.deps===null?Xt(e,pn):Xt(e,ms)}function o8(e){if(e!==null)for(const t of e)(t.f&wn)===0||(t.f&Tl)===0||(t.f^=Tl,o8(t.deps))}function a8(e,t,n){(e.f&Bn)!==0?t.add(e):(e.f&ms)!==0&&n.add(e),o8(e.deps),Xt(e,pn)}let Jg=!1;function gq(e){var t=Jg;try{return Jg=!1,[e(),Jg]}finally{Jg=t}}const Wd=new Set;let Ge=null,$n=null,Hx=null,Hh=!1,Pb=!1,Xc=null,V0=null;var EF=0;let mq=1;var mf,vf,yf,bf,Gp,yi,xf,Ia,qs,_f,sr,Gx,Yx,Vx,Xx,u8;const hv=class hv{constructor(){Je(this,sr);Gi(this,"id",mq++);Gi(this,"current",new Map);Gi(this,"previous",new Map);Je(this,mf,new Set);Je(this,vf,new Set);Je(this,yf,0);Je(this,bf,0);Je(this,Gp,null);Je(this,yi,[]);Je(this,xf,new Set);Je(this,Ia,new Set);Je(this,qs,new Map);Gi(this,"is_fork",!1);Je(this,_f,!1)}skip_effect(t){Y(this,qs).has(t)||Y(this,qs).set(t,{d:[],m:[]})}unskip_effect(t){var n=Y(this,qs).get(t);if(n){Y(this,qs).delete(t);for(var r of n.d)Xt(r,Bn),this.schedule(r);for(r of n.m)Xt(r,ms),this.schedule(r)}}capture(t,n){n!==Cn&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Xa)===0&&(this.current.set(t,t.v),$n==null||$n.set(t,t.v))}activate(){Ge=this}deactivate(){Ge=null,$n=null}flush(){try{if(Pb=!0,Ge=this,!Qt(this,sr,Gx).call(this)){for(const t of Y(this,xf))Y(this,Ia).delete(t),Xt(t,Bn),this.schedule(t);for(const t of Y(this,Ia))Xt(t,ms),this.schedule(t)}Qt(this,sr,Yx).call(this)}finally{EF=0,Hx=null,Xc=null,V0=null,Pb=!1,Ge=null,$n=null,Za.clear()}}discard(){for(const t of Y(this,vf))t(this);Y(this,vf).clear()}increment(t){Ye(this,yf,Y(this,yf)+1),t&&Ye(this,bf,Y(this,bf)+1)}decrement(t,n){Ye(this,yf,Y(this,yf)-1),t&&Ye(this,bf,Y(this,bf)-1),!(Y(this,_f)||n)&&(Ye(this,_f,!0),Ka(()=>{Ye(this,_f,!1),this.flush()}))}oncommit(t){Y(this,mf).add(t)}ondiscard(t){Y(this,vf).add(t)}settled(){return(Y(this,Gp)??Ye(this,Gp,J6())).promise}static ensure(){if(Ge===null){const t=Ge=new hv;Pb||(Wd.add(Ge),Hh||Ka(()=>{Ge===t&&t.flush()}))}return Ge}apply(){}schedule(t){var i;if(Hx=t,(i=t.b)!=null&&i.is_pending&&(t.f&(kf|Xp|Q6))!==0&&(t.f&ac)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(Xc!==null&&n===Qe&&(Xe===null||(Xe.f&wn)===0))return;if((r&(Ml|gs))!==0){if((r&pn)===0)return;n.f^=pn}}Y(this,yi).push(n)}};mf=new WeakMap,vf=new WeakMap,yf=new WeakMap,bf=new WeakMap,Gp=new WeakMap,yi=new WeakMap,xf=new WeakMap,Ia=new WeakMap,qs=new WeakMap,_f=new WeakMap,sr=new WeakSet,Gx=function(){return this.is_fork||Y(this,bf)>0},Yx=function(){var a,u;EF++>1e3&&yq();const t=Y(this,yi);Ye(this,yi,[]),this.apply();var n=Xc=[],r=[],i=V0=[];for(const l of t)Qt(this,sr,Vx).call(this,l,n,r);if(Ge=null,i.length>0){var s=hv.ensure();for(const l of i)s.schedule(l)}if(Xc=null,V0=null,Qt(this,sr,Gx).call(this)){Qt(this,sr,Xx).call(this,r),Qt(this,sr,Xx).call(this,n);for(const[l,c]of Y(this,qs))f8(l,c)}else{Y(this,xf).clear(),Y(this,Ia).clear();for(const l of Y(this,mf))l(this);Y(this,mf).clear(),AF(r),AF(n),Y(this,yf)===0&&Qt(this,sr,u8).call(this),(a=Y(this,Gp))==null||a.resolve()}var o=Ge;if(Y(this,yi).length>0){const l=o??(o=this);Y(l,yi).push(...Y(this,yi).filter(c=>!Y(l,yi).includes(c)))}o!==null&&(Wd.add(o),Qt(u=o,sr,Yx).call(u))},Vx=function(t,n,r){t.f^=pn;for(var i=t.first;i!==null;){var s=i.f,o=(s&(gs|Ml))!==0,a=o&&(s&pn)!==0,u=a||(s&si)!==0||Y(this,qs).has(i);if(!u&&i.fn!==null){o?i.f^=pn:(s&kf)!==0?n.push(i):eg(i)&&((s&wu)!==0&&Y(this,Ia).add(i),$f(i));var l=i.first;if(l!==null){i=l;continue}}for(;i!==null;){var c=i.next;if(c!==null){i=c;break}i=i.parent}}},Xx=function(t){for(var n=0;n1){this.previous.clear();var t=Ge,n=$n,r=!0;for(const s of Wd){if(s===this){r=!1;continue}const o=[];for(const[u,l]of this.current){if(s.current.has(u))if(r&&l!==s.current.get(u))s.current.set(u,l);else continue;o.push(u)}if(o.length===0)continue;const a=[...s.current.keys()].filter(u=>!this.current.has(u));if(a.length>0){s.activate();const u=new Set,l=new Map;for(const c of o)l8(c,a,u,l);if(Y(s,yi).length>0){s.apply();for(const c of Y(s,yi))Qt(i=s,sr,Vx).call(i,c,[],[])}s.deactivate()}}Ge=t,$n=n}Y(this,qs).clear(),Wd.delete(this)};let Nl=hv;function vq(e){var t=Hh;Hh=!0;try{for(var n;;){if(hq(),Ge===null)return n;Ge.flush()}}finally{Hh=t}}function yq(){try{iq()}catch(e){Ba(e,Hx)}}let Ki=null;function AF(e){var t=e.length;if(t!==0){for(var n=0;n0)){Za.clear();for(const i of Ki){if((i.f&($i|si))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ki.has(o)&&(Ki.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const u=s[a];(u.f&($i|si))===0&&$f(u)}}Ki.clear()}}Ki=null}}function l8(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const s=i.f;(s&wn)!==0?l8(i,t,n,r):(s&(TE|wu))!==0&&(s&Bn)===0&&c8(i,t,r)&&(Xt(i,Bn),OE(i))}}function c8(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const i of e.deps){if(Sf.call(t,i))return!0;if((i.f&wn)!==0&&c8(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function OE(e){Ge.schedule(e)}function f8(e,t){if(!((e.f&gs)!==0&&(e.f&pn)!==0)){(e.f&Bn)!==0?t.d.push(e):(e.f&ms)!==0&&t.m.push(e),Xt(e,pn);for(var n=e.first;n!==null;)f8(n,t),n=n.next}}function bq(e){let t=0,n=Ol(0),r;return()=>{PE()&&(w(n),Qp(()=>(t===0&&(r=Eu(()=>e(()=>Gh(n)))),t+=1,()=>{Ka(()=>{t-=1,t===0&&(r==null||r(),r=void 0,Gh(n))})})))}}var xq=Rl|dd;function _q(e,t,n,r){new wq(e,t,n,r)}var bi,ME,Ws,hl,$r,Hs,Zr,Zi,qo,pl,Pa,wf,Ef,Af,Wo,pv,ln,Eq,Aq,Sq,Kx,X0,K0,Zx;class wq{constructor(t,n,r,i){Je(this,ln);Gi(this,"parent");Gi(this,"is_pending",!1);Gi(this,"transform_error");Je(this,bi);Je(this,ME,null);Je(this,Ws);Je(this,hl);Je(this,$r);Je(this,Hs,null);Je(this,Zr,null);Je(this,Zi,null);Je(this,qo,null);Je(this,pl,0);Je(this,Pa,0);Je(this,wf,!1);Je(this,Ef,new Set);Je(this,Af,new Set);Je(this,Wo,null);Je(this,pv,bq(()=>(Ye(this,Wo,Ol(Y(this,pl))),()=>{Ye(this,Wo,null)})));var s;Ye(this,bi,t),Ye(this,Ws,n),Ye(this,hl,o=>{var a=Qe;a.b=this,a.f|=Ux,r(o)}),this.parent=Qe.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Ye(this,$r,yv(()=>{Qt(this,ln,Kx).call(this)},xq))}defer_effect(t){a8(t,Y(this,Ef),Y(this,Af))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!Y(this,Ws).pending}update_pending_count(t,n){Qt(this,ln,Zx).call(this,t,n),Ye(this,pl,Y(this,pl)+t),!(!Y(this,Wo)||Y(this,wf))&&(Ye(this,wf,!0),Ka(()=>{Ye(this,wf,!1),Y(this,Wo)&&Ff(Y(this,Wo),Y(this,pl))}))}get_effect_pending(){return Y(this,pv).call(this),w(Y(this,Wo))}error(t){var n=Y(this,Ws).onerror;let r=Y(this,Ws).failed;if(!n&&!r)throw t;Y(this,Hs)&&(Ir(Y(this,Hs)),Ye(this,Hs,null)),Y(this,Zr)&&(Ir(Y(this,Zr)),Ye(this,Zr,null)),Y(this,Zi)&&(Ir(Y(this,Zi)),Ye(this,Zi,null));var i=!1,s=!1;const o=()=>{if(i){cq();return}i=!0,s&&lq(),Y(this,Zi)!==null&&vl(Y(this,Zi),()=>{Ye(this,Zi,null)}),Qt(this,ln,K0).call(this,()=>{Qt(this,ln,Kx).call(this)})},a=u=>{try{s=!0,n==null||n(u,o),s=!1}catch(l){Ba(l,Y(this,$r)&&Y(this,$r).parent)}r&&Ye(this,Zi,Qt(this,ln,K0).call(this,()=>{try{return xi(()=>{var l=Qe;l.b=this,l.f|=Ux,r(Y(this,bi),()=>u,()=>o)})}catch(l){return Ba(l,Y(this,$r).parent),null}}))};Ka(()=>{var u;try{u=this.transform_error(t)}catch(l){Ba(l,Y(this,$r)&&Y(this,$r).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(a,l=>Ba(l,Y(this,$r)&&Y(this,$r).parent)):a(u)})}}bi=new WeakMap,ME=new WeakMap,Ws=new WeakMap,hl=new WeakMap,$r=new WeakMap,Hs=new WeakMap,Zr=new WeakMap,Zi=new WeakMap,qo=new WeakMap,pl=new WeakMap,Pa=new WeakMap,wf=new WeakMap,Ef=new WeakMap,Af=new WeakMap,Wo=new WeakMap,pv=new WeakMap,ln=new WeakSet,Eq=function(){try{Ye(this,Hs,xi(()=>Y(this,hl).call(this,Y(this,bi))))}catch(t){this.error(t)}},Aq=function(t){const n=Y(this,Ws).failed;n&&Ye(this,Zi,xi(()=>{n(Y(this,bi),()=>t,()=>()=>{})}))},Sq=function(){const t=Y(this,Ws).pending;if(t){this.is_pending=!0,Ye(this,Zr,xi(()=>t(Y(this,bi))));var n=Ge;Ka(()=>{var r=Ye(this,qo,document.createDocumentFragment()),i=Ja();r.append(i),Ye(this,Hs,Qt(this,ln,K0).call(this,()=>xi(()=>Y(this,hl).call(this,i)))),Y(this,Pa)===0&&(Y(this,bi).before(r),Ye(this,qo,null),vl(Y(this,Zr),()=>{Ye(this,Zr,null)}),Qt(this,ln,X0).call(this,n))})}},Kx=function(){var t=Ge;try{if(this.is_pending=this.has_pending_snippet(),Ye(this,Pa,0),Ye(this,pl,0),Ye(this,Hs,xi(()=>{Y(this,hl).call(this,Y(this,bi))})),Y(this,Pa)>0){var n=Ye(this,qo,document.createDocumentFragment());jE(Y(this,Hs),n);const r=Y(this,Ws).pending;Ye(this,Zr,xi(()=>r(Y(this,bi))))}else Qt(this,ln,X0).call(this,t)}catch(r){this.error(r)}},X0=function(t){this.is_pending=!1;for(const n of Y(this,Ef))Xt(n,Bn),t.schedule(n);for(const n of Y(this,Af))Xt(n,ms),t.schedule(n);Y(this,Ef).clear(),Y(this,Af).clear()},K0=function(t){var n=Qe,r=Xe,i=qt;ao(Y(this,$r)),Ti(Y(this,$r)),Cf(Y(this,$r).ctx);try{return Nl.ensure(),t()}catch(s){return s8(s),null}finally{ao(n),Ti(r),Cf(i)}},Zx=function(t,n){var r;if(!this.has_pending_snippet()){this.parent&&Qt(r=this.parent,ln,Zx).call(r,t,n);return}Ye(this,Pa,Y(this,Pa)+t),Y(this,Pa)===0&&(Qt(this,ln,X0).call(this,n),Y(this,Zr)&&vl(Y(this,Zr),()=>{Ye(this,Zr,null)}),Y(this,qo)&&(Y(this,bi).before(Y(this,qo)),Ye(this,qo,null)))};function kq(e,t,n,r){const i=Kp()?Zp:LE;var s=e.filter(d=>!d.settled);if(n.length===0&&s.length===0){r(t.map(i));return}var o=Qe,a=Cq(),u=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function l(d){a();try{r(d)}catch(h){(o.f&$i)===0&&Ba(h,o)}Fm()}if(n.length===0){u.then(()=>l(t.map(i)));return}var c=d8();function f(){Promise.all(n.map(d=>Fq(d))).then(d=>l([...t.map(i),...d])).catch(d=>Ba(d,o)).finally(()=>c())}u?u.then(()=>{a(),f(),Fm()}):f()}function Cq(){var e=Qe,t=Xe,n=qt,r=Ge;return function(s=!0){ao(e),Ti(t),Cf(n),s&&(e.f&$i)===0&&(r==null||r.activate(),r==null||r.apply())}}function Fm(e=!0){ao(null),Ti(null),Cf(null),e&&(Ge==null||Ge.deactivate())}function d8(){var e=Qe.b,t=Ge,n=e.is_rendered();return e.update_pending_count(1,t),t.increment(n),(r=!1)=>{e.update_pending_count(-1,t),t.decrement(n,r)}}function Zp(e){var t=wn|Bn,n=Xe!==null&&(Xe.f&wn)!==0?Xe:null;return Qe!==null&&(Qe.f|=dd),{ctx:qt,deps:null,effects:null,equals:t8,f:t,fn:e,reactions:null,rv:0,v:Cn,wv:0,parent:n??Qe,ac:null}}function Fq(e,t,n){let r=Qe;r===null&&QU();var i=void 0,s=Ol(Cn),o=!Xe,a=new Map;return zq(()=>{var h;var u=Qe,l=J6();i=l.promise;try{Promise.resolve(e()).then(l.resolve,l.reject).finally(Fm)}catch(p){l.reject(p),Fm()}var c=Ge;if(o){if((u.f&ac)!==0)var f=d8();if(r.b.is_rendered())(h=a.get(c))==null||h.reject(Bo),a.delete(c);else{for(const p of a.values())p.reject(Bo);a.clear()}a.set(c,l)}const d=(p,g=void 0)=>{if(f){var m=g===Bo;f(m)}if(!(g===Bo||(u.f&$i)!==0)){if(c.activate(),g)s.f|=Xa,Ff(s,g);else{(s.f&Xa)!==0&&(s.f^=Xa),Ff(s,p);for(const[v,y]of a){if(a.delete(v),v===c)break;y.reject(Bo)}}c.deactivate()}};l.promise.then(d,p=>d(null,p||"unknown"))}),S8(()=>{for(const u of a.values())u.reject(Bo)}),new Promise(u=>{function l(c){function f(){c===i?u(s):l(i)}c.then(f,f)}l(i)})}function Be(e){const t=Zp(e);return T8(t),t}function LE(e){const t=Zp(e);return t.equals=r8,t}function $q(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!g8&&Tq()}return t}function Tq(){g8=!1;for(const e of Jx)(e.f&pn)!==0&&Xt(e,ms),eg(e)&&$f(e);Jx.clear()}function m8(e,t=1){var n=w(e),r=t===1?n++:n--;return z(e,n),r}function Gh(e){z(e,e.v+1)}function v8(e,t,n){var r=e.reactions;if(r!==null)for(var i=Kp(),s=r.length,o=0;o{if(yl===s)return a();var u=Xe,l=yl;Ti(null),CF(s);var c=a();return Ti(u),CF(l),c};return r&&n.set("length",fe(e.length)),new Proxy(e,{defineProperty(a,u,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&oq();var c=n.get(u);return c===void 0?o(()=>{var f=fe(l.value);return n.set(u,f),f}):z(c,l.value,!0),!0},deleteProperty(a,u){var l=n.get(u);if(l===void 0){if(u in a){const c=o(()=>fe(Cn));n.set(u,c),Gh(i)}}else z(l,Cn),Gh(i);return!0},get(a,u,l){var h;if(u===ml)return e;var c=n.get(u),f=u in a;if(c===void 0&&(!f||(h=rf(a,u))!=null&&h.writable)&&(c=o(()=>{var p=st(f?a[u]:Cn),g=fe(p);return g}),n.set(u,c)),c!==void 0){var d=w(c);return d===Cn?void 0:d}return Reflect.get(a,u,l)},getOwnPropertyDescriptor(a,u){var l=Reflect.getOwnPropertyDescriptor(a,u);if(l&&"value"in l){var c=n.get(u);c&&(l.value=w(c))}else if(l===void 0){var f=n.get(u),d=f==null?void 0:f.v;if(f!==void 0&&d!==Cn)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return l},has(a,u){var d;if(u===ml)return!0;var l=n.get(u),c=l!==void 0&&l.v!==Cn||Reflect.has(a,u);if(l!==void 0||Qe!==null&&(!c||(d=rf(a,u))!=null&&d.writable)){l===void 0&&(l=o(()=>{var h=c?st(a[u]):Cn,p=fe(h);return p}),n.set(u,l));var f=w(l);if(f===Cn)return!1}return c},set(a,u,l,c){var b;var f=n.get(u),d=u in a;if(r&&u==="length")for(var h=l;hfe(Cn)),n.set(h+"",p))}if(f===void 0)(!d||(b=rf(a,u))!=null&&b.writable)&&(f=o(()=>fe(void 0)),z(f,st(l)),n.set(u,f));else{d=f.v!==Cn;var g=o(()=>st(l));z(f,g)}var m=Reflect.getOwnPropertyDescriptor(a,u);if(m!=null&&m.set&&m.set.call(c,l),!d){if(r&&typeof u=="string"){var v=n.get("length"),y=Number(u);Number.isInteger(y)&&y>=v.v&&z(v,y+1)}Gh(i)}return!0},ownKeys(a){w(i);var u=Reflect.ownKeys(a).filter(f=>{var d=n.get(f);return d===void 0||d.v!==Cn});for(var[l,c]of n)c.v!==Cn&&!(l in a)&&u.push(l);return u},setPrototypeOf(){aq()}})}var $m,y8,b8,x8;function Nq(){if($m===void 0){$m=window,y8=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;b8=rf(t,"firstChild").get,x8=rf(t,"nextSibling").get,_F(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),_F(n)&&(n.__t=void 0)}}function Ja(e=""){return document.createTextNode(e)}function Js(e){return b8.call(e)}function Jp(e){return x8.call(e)}function I(e,t){return Js(e)}function Ct(e,t=!1){{var n=Js(e);return n instanceof Comment&&n.data===""?Jp(n):n}}function H(e,t=1,n=!1){let r=e;for(;t--;)r=Jp(r);return r}function Oq(e){e.textContent=""}function _8(){return!1}function w8(e,t,n){return document.createElementNS(t??X6,e,void 0)}let SF=!1;function Lq(){SF||(SF=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function vv(e){var t=Xe,n=Qe;Ti(null),ao(null);try{return e()}finally{Ti(t),ao(n)}}function E8(e,t,n,r=n){e.addEventListener(t,()=>vv(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),Lq()}function A8(e){Qe===null&&(Xe===null&&rq(),nq()),su&&tq()}function Iq(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function yo(e,t){var n=Qe;n!==null&&(n.f&si)!==0&&(e|=si);var r={ctx:qt,deps:null,nodes:null,f:e|Bn|Fi,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},i=r;if((e&kf)!==0)Xc!==null?Xc.push(r):Nl.ensure().schedule(r);else if(t!==null){try{$f(r)}catch(o){throw Ir(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&dd)===0&&(i=i.first,(e&wu)!==0&&(e&Rl)!==0&&i!==null&&(i.f|=Rl))}if(i!==null&&(i.parent=n,n!==null&&Iq(i,n),Xe!==null&&(Xe.f&wn)!==0&&(e&Ml)===0)){var s=Xe;(s.effects??(s.effects=[])).push(i)}return r}function PE(){return Xe!==null&&!os}function S8(e){const t=yo(Xp,null);return Xt(t,pn),t.teardown=e,t}function Ht(e){A8();var t=Qe.f,n=!Xe&&(t&gs)!==0&&(t&ac)===0;if(n){var r=qt;(r.e??(r.e=[])).push(e)}else return k8(e)}function k8(e){return yo(kf|e8,e)}function Pq(e){return A8(),yo(Xp|e8,e)}function Bq(e){Nl.ensure();const t=yo(Ml|dd,e);return(n={})=>new Promise(r=>{n.outro?vl(t,()=>{Ir(t),r(void 0)}):(Ir(t),r(void 0))})}function C8(e){return yo(kf,e)}function zq(e){return yo(TE|dd,e)}function Qp(e,t=0){return yo(Xp|t,e)}function ke(e,t=[],n=[],r=[]){kq(r,t,n,i=>{yo(Xp,()=>e(...i.map(w)))})}function yv(e,t=0){var n=yo(wu|t,e);return n}function xi(e){return yo(gs|dd,e)}function F8(e){var t=e.teardown;if(t!==null){const n=su,r=Xe;kF(!0),Ti(null);try{t.call(null)}finally{kF(n),Ti(r)}}}function BE(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&vv(()=>{i.abort(Bo)});var r=n.next;(n.f&Ml)!==0?n.parent=null:Ir(n,t),n=r}}function jq(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&gs)===0&&Ir(t),t=n}}function Ir(e,t=!0){var n=!1;(t||(e.f&XU)!==0)&&e.nodes!==null&&e.nodes.end!==null&&($8(e.nodes.start,e.nodes.end),n=!0),Xt(e,qx),BE(e,t&&!n),up(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();F8(e),e.f^=qx,e.f|=$i;var i=e.parent;i!==null&&i.first!==null&&D8(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function $8(e,t){for(;e!==null;){var n=e===t?null:Jp(e);e.remove(),e=n}}function D8(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function vl(e,t,n=!0){var r=[];M8(e,r,!0);var i=()=>{n&&Ir(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function M8(e,t,n){if((e.f&si)===0){e.f^=si;var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&t.push(a);for(var i=e.first;i!==null;){var s=i.next,o=(i.f&Rl)!==0||(i.f&gs)!==0&&(e.f&wu)!==0;M8(i,t,o?n:!1),i=s}}}function zE(e){R8(e,!0)}function R8(e,t){if((e.f&si)!==0){e.f^=si,(e.f&pn)===0&&(Xt(e,Bn),Nl.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&Rl)!==0||(n.f&gs)!==0;R8(n,i?t:!1),n=r}var s=e.nodes&&e.nodes.t;if(s!==null)for(const o of s)(o.is_global||t)&&o.in()}}function jE(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Jp(n);t.append(n),n=i}}let Z0=!1,su=!1;function kF(e){su=e}let Xe=null,os=!1;function Ti(e){Xe=e}let Qe=null;function ao(e){Qe=e}let Di=null;function T8(e){Xe!==null&&(Di===null?Di=[e]:Di.push(e))}let Dr=null,Xr=0,vi=null;function Uq(e){vi=e}let N8=1,al=0,yl=al;function CF(e){yl=e}function O8(){return++N8}function eg(e){var t=e.f;if((t&Bn)!==0)return!0;if(t&wn&&(e.f&=~Tl),(t&ms)!==0){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}(t&Fi)!==0&&$n===null&&Xt(e,pn)}return!1}function L8(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Di!==null&&Sf.call(Di,e)))for(var i=0;i{e.ac.abort(Bo)}),e.ac=null);try{e.f|=Wx;var c=e.fn,f=c();e.f|=ac;var d=e.deps,h=Ge==null?void 0:Ge.is_fork;if(Dr!==null){var p;if(h||up(e,Xr),d!==null&&Xr>0)for(d.length=Xr+Dr.length,p=0;pn==null?void 0:n.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ka(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function as(e,t,n,r,i){var s={capture:r,passive:i},o=Wq(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&S8(()=>{t.removeEventListener(e,o,s)})}function je(e,t,n){(t[ul]??(t[ul]={}))[e]=n}function hi(e){for(var t=0;t{throw y});throw d}}finally{e[ul]=t,delete e.currentTarget,Ti(c),ao(f)}}}var G6;const Bb=((G6=globalThis==null?void 0:globalThis.window)==null?void 0:G6.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Hq(e){return(Bb==null?void 0:Bb.createHTML(e))??e}function U8(e){var t=w8("template");return t.innerHTML=Hq(e.replaceAll("","")),t.content}function Df(e,t){var n=Qe;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function ee(e,t){var n=(t&IU)!==0,r=(t&PU)!==0,i,s=!e.startsWith("");return()=>{i===void 0&&(i=U8(s?e:""+e),n||(i=Js(i)));var o=r||y8?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Js(o),u=o.lastChild;Df(a,u)}else Df(o,o);return o}}function Gq(e,t,n="svg"){var r=!e.startsWith(""),i=`<${n}>${r?e:""+e}`,s;return()=>{if(!s){var o=U8(i),a=Js(o);s=Js(a)}var u=s.cloneNode(!0);return Df(u,u),u}}function q8(e,t){return Gq(e,t,"svg")}function rs(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ja();return e.append(t,n),Df(t,n),e}function V(e,t){e!==null&&e.before(t)}const Yq=["touchstart","touchmove"];function Vq(e){return Yq.includes(e)}function Me(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=`${n}`)}function Xq(e,t){return Kq(e,t)}const Qg=new Map;function Kq(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){Nq();var u=void 0,l=Bq(()=>{var c=n??t.appendChild(Ja());_q(c,{pending:()=>{}},h=>{Gt({});var p=qt;s&&(p.c=s),i&&(r.$$events=i),u=e(h,r)||{},Yt()},a);var f=new Set,d=h=>{for(var p=0;p{var m;for(var h of f)for(const v of[t,document]){var p=Qg.get(v),g=p.get(h);--g==0?(v.removeEventListener(h,t_),p.delete(h),p.size===0&&Qg.delete(v)):p.set(h,g)}e_.delete(d),c!==n&&((m=c.parentNode)==null||m.removeChild(c))}});return Zq.set(u,l),u}let Zq=new WeakMap;var Ji,Gs,Jr,gl,Yp,Vp,gv;class W8{constructor(t,n=!0){Gi(this,"anchor");Je(this,Ji,new Map);Je(this,Gs,new Map);Je(this,Jr,new Map);Je(this,gl,new Set);Je(this,Yp,!0);Je(this,Vp,t=>{if(Y(this,Ji).has(t)){var n=Y(this,Ji).get(t),r=Y(this,Gs).get(n);if(r)zE(r),Y(this,gl).delete(n);else{var i=Y(this,Jr).get(n);i&&(Y(this,Gs).set(n,i.effect),Y(this,Jr).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of Y(this,Ji)){if(Y(this,Ji).delete(s),s===t)break;const a=Y(this,Jr).get(o);a&&(Ir(a.effect),Y(this,Jr).delete(o))}for(const[s,o]of Y(this,Gs)){if(s===n||Y(this,gl).has(s))continue;const a=()=>{if(Array.from(Y(this,Ji).values()).includes(s)){var l=document.createDocumentFragment();jE(o,l),l.append(Ja()),Y(this,Jr).set(s,{effect:o,fragment:l})}else Ir(o);Y(this,gl).delete(s),Y(this,Gs).delete(s)};Y(this,Yp)||!r?(Y(this,gl).add(s),vl(o,a,!1)):a()}}});Je(this,gv,t=>{Y(this,Ji).delete(t);const n=Array.from(Y(this,Ji).values());for(const[r,i]of Y(this,Jr))n.includes(r)||(Ir(i.effect),Y(this,Jr).delete(r))});this.anchor=t,Ye(this,Yp,n)}ensure(t,n){var r=Ge,i=_8();if(n&&!Y(this,Gs).has(t)&&!Y(this,Jr).has(t))if(i){var s=document.createDocumentFragment(),o=Ja();s.append(o),Y(this,Jr).set(t,{effect:xi(()=>n(o)),fragment:s})}else Y(this,Gs).set(t,xi(()=>n(this.anchor)));if(Y(this,Ji).set(r,t),i){for(const[a,u]of Y(this,Gs))a===t?r.unskip_effect(u):r.skip_effect(u);for(const[a,u]of Y(this,Jr))a===t?r.unskip_effect(u.effect):r.skip_effect(u.effect);r.oncommit(Y(this,Vp)),r.ondiscard(Y(this,gv))}else Y(this,Vp).call(this,r)}}Ji=new WeakMap,Gs=new WeakMap,Jr=new WeakMap,gl=new WeakMap,Yp=new WeakMap,Vp=new WeakMap,gv=new WeakMap;function $F(e,t,...n){var r=new W8(e);yv(()=>{const i=t()??null;r.ensure(i,i&&(s=>i(s,...n)))},Rl)}function pd(e){qt===null&&JU(),hd&&qt.l!==null?Jq(qt).m.push(e):Ht(()=>{const t=Eu(e);if(typeof t=="function")return t})}function Jq(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function Ae(e,t,n=!1){var r=new W8(e),i=n?Rl:0;function s(o,a){r.ensure(o,a)}yv(()=>{var o=!1;t((a,u=0)=>{o=!0,s(u,a)}),o||s(-1,null)},i)}function At(e,t){return t}function Qq(e,t,n){for(var r=[],i=t.length,s,o=t.length,a=0;a{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var d=e.outrogroups;n_(e,mv(s.done)),d.delete(s),d.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var u=r.length===0&&n!==null;if(u){var l=n,c=l.parentNode;Oq(c),c.append(l),e.items.clear()}n_(e,t,!u)}else s={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(s)}function n_(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const o of e.pending.values())for(const a of o)r.add(e.items.get(a).e)}for(var i=0;i{var b=n();return K6(b)?b:b==null?[]:mv(b)}),d,h=new Map,p=!0;function g(b){(y.effect.f&$i)===0&&(y.pending.delete(b),y.fallback=c,eW(y,d,o,t,r),c!==null&&(d.length===0?(c.f&Zs)===0?zE(c):(c.f^=Zs,vh(c,null,o)):vl(c,()=>{c=null})))}function m(b){y.pending.delete(b)}var v=yv(()=>{d=w(f);for(var b=d.length,x=new Set,_=Ge,A=_8(),E=0;Es(o)):(c=xi(()=>s(DF??(DF=Ja()))),c.f|=Zs)),b>x.size&&eq(),!p)if(h.set(_,x),A){for(const[D,M]of a)x.has(D)||_.skip_effect(M.e);_.oncommit(g),_.ondiscard(m)}else g(_);w(f)}),y={effect:v,items:a,pending:h,outrogroups:null,fallback:c};p=!1}function Hd(e){for(;e!==null&&(e.f&gs)===0;)e=e.next;return e}function eW(e,t,n,r,i){var F,D,M,T,$,C,R,L,O;var s=(r&DU)!==0,o=t.length,a=e.items,u=Hd(e.effect.first),l,c=null,f,d=[],h=[],p,g,m,v;if(s)for(v=0;v0){var k=(r&V6)!==0&&o===0?n:null;if(s){for(v=0;v{var N,B;if(f!==void 0)for(m of f)(B=(N=m.nodes)==null?void 0:N.a)==null||B.apply()})}function tW(e,t,n,r,i,s,o,a){var u=(o&FU)!==0?(o&MU)===0?Rq(n,!1,!1):Ol(n):null,l=(o&$U)!==0?Ol(i):null;return{v:u,i:l,e:xi(()=>(s(t,u??n,l??i,a),()=>{e.delete(r)}))}}function vh(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,s=t&&(t.f&Zs)===0?t.nodes.start:n;r!==null;){var o=Jp(r);if(s.before(r),r===i)return;r=o}}function ka(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function nW(e,t,n=!1,r=!1,i=!1,s=!1){var o=e,a="";if(n)var u=e;ke(()=>{var l=Qe;if(a!==(a=t()??"")){if(n){l.nodes=null,u.innerHTML=a,a!==""&&Df(Js(u),u.lastChild);return}if(l.nodes!==null&&($8(l.nodes.start,l.nodes.end),l.nodes=null),a!==""){var c=r?BU:i?zU:void 0,f=w8(r?"svg":i?"math":"template",c);f.innerHTML=a;var d=r||i?f:f.content;if(Df(Js(d),d.lastChild),r||i)for(;Js(d);)o.before(Js(d));else o.before(d)}}})}function rW(e,t,n){C8(()=>{var r=Eu(()=>t(e,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};Qp(()=>{var o=n();z8(o),i&&n8(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}const MF=[...` +\r\fย \v\uFEFF`];function iW(e,t,n){var r=e==null?"":""+e;if(n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;(o===0||MF.includes(r[o-1]))&&(a===r.length||MF.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function RF(e,t=!1){var n=t?" !important;":";",r="";for(var i of Object.keys(e)){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function zb(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function sW(e,t){if(t){var n="",r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,u=[];r&&u.push(...Object.keys(r).map(zb)),i&&u.push(...Object.keys(i).map(zb));var l=0,c=-1;const g=e.length;for(var f=0;f{var s=i?e.defaultValue:e.value;if(s=Ub(e)?qb(s):s,n(s),Ge!==null&&r.add(Ge),await wi(),s!==(s=t())){var o=e.selectionStart,a=e.selectionEnd,u=e.value.length;if(e.value=s??"",a!==null){var l=e.value.length;o===a&&a===u&&l>u?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(a,l))}}}),Eu(t)==null&&e.value&&(n(Ub(e)?qb(e.value):e.value),Ge!==null&&r.add(Ge)),Qp(()=>{var i=t();if(e===document.activeElement){var s=Ge;if(r.has(s))return}Ub(e)&&i===qb(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function lW(e,t,n=t){E8(e,"change",r=>{var i=r?e.defaultChecked:e.checked;n(i)}),Eu(t)==null&&n(e.checked),Qp(()=>{var r=t();e.checked=!!r})}function Ub(e){var t=e.type;return t==="number"||t==="range"}function qb(e){return e===""?null:+e}function NF(e,t){return e===t||(e==null?void 0:e[ml])===t}function us(e={},t,n,r){var i=qt.r,s=Qe;return C8(()=>{var o,a;return Qp(()=>{o=a,a=[],Eu(()=>{e!==n(...a)&&(t(e,...a),o&&NF(n(...o),e)&&t(null,...o))})}),()=>{let u=s;for(;u!==i&&u.parent!==null&&u.parent.f&qx;)u=u.parent;const l=()=>{a&&NF(n(...a),e)&&t(null,...a)},c=u.teardown;u.teardown=()=>{l(),c==null||c()}}}),e}function cW(e=!1){const t=qt,n=t.l.u;if(!n)return;let r=()=>z8(t.s);if(e){let i=0,s={};const o=Zp(()=>{let a=!1;const u=t.s;for(const l in u)u[l]!==s[l]&&(s[l]=u[l],a=!0);return a&&i++,i});r=()=>w(o)}n.b.length&&Pq(()=>{OF(t,r),jx(n.b)}),Ht(()=>{const i=Eu(()=>n.m.map(YU));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&Ht(()=>{OF(t,r),jx(n.a)})}function OF(e,t){if(e.l.s)for(const n of e.l.s)w(n);t()}function ne(e,t,n,r){var b;var i=!hd||(n&TU)!==0,s=(n&OU)!==0,o=(n&LU)!==0,a=r,u=!0,l=()=>(u&&(u=!1,a=o?Eu(r):r),a);let c;if(s){var f=ml in e||KU in e;c=((b=rf(e,t))==null?void 0:b.set)??(f&&t in e?x=>e[t]=x:void 0)}var d,h=!1;s?[d,h]=gq(()=>e[t]):d=e[t],d===void 0&&r!==void 0&&(d=l(),c&&(i&&sq(),c(d)));var p;if(i?p=()=>{var x=e[t];return x===void 0?l():(u=!0,x)}:p=()=>{var x=e[t];return x!==void 0&&(a=void 0),x===void 0?a:x},i&&(n&NU)===0)return p;if(c){var g=e.$$legacy;return(function(x,_){return arguments.length>0?((!i||!_||g||h)&&c(_?p():x),x):p()})}var m=!1,v=((n&RU)!==0?Zp:LE)(()=>(m=!1,p()));s&&w(v);var y=Qe;return(function(x,_){if(arguments.length>0){const A=_?w(v):i&&s?st(x):x;return z(v,A),m=!0,a!==void 0&&(a=A),x}return su&&m||(y.f&$i)!==0?v.v:w(v)})}var fW=ee(""),dW=ee('');function hW(e,t){Gt(t,!0);let n=ne(t,"currentPage",3,"metrics");const r=[{id:"metrics",label:"Metrics"},{id:"system",label:"System Metrics"},{id:"media",label:"Media & Tables"},{id:"reports",label:"Alerts & Reports"},{id:"runs",label:"Runs"},{id:"files",label:"Files"}];function i(a){var u;(u=t.onNavigate)==null||u.call(t,a)}var s=dW(),o=H(I(s),2);St(o,21,()=>r,At,(a,u)=>{var l=fW();let c;var f=I(l);ke(()=>{c=Tt(l,1,"nav-link svelte-d8j1hi",null,c,{active:n()===w(u).id}),Me(f,w(u).label)}),je("click",l,()=>i(w(u).id)),V(a,l)}),V(e,s),Yt()}hi(["click"]);var pW=ee(''),gW=ee('
');function mW(e,t){Gt(t,!0);let n=ne(t,"choices",19,()=>[]),r=ne(t,"selected",31,()=>st([])),i=ne(t,"colors",19,()=>[]),s=ne(t,"ontoggle",3,null);function o(u){var l;r().includes(u)?r(r().filter(c=>c!==u)):r([...r(),u]),(l=s())==null||l()}var a=gW();St(a,21,n,At,(u,l,c)=>{var f=pW(),d=I(f),h=H(d,2),p=H(h,2),g=I(p);ke(m=>{lp(d,m),Ll(h,`background: ${(i()[c]||"#999")??""}`),Nt(p,"title",w(l)),Me(g,w(l))},[()=>r().includes(w(l))]),je("change",d,()=>o(w(l))),V(u,f)}),V(e,a),Yt()}hi(["change"]);var vW=ee(' '),yW=ee(' '),bW=ee('
  • โœ“
  • '),xW=ee('
      '),_W=ee('');function LF(e,t){Gt(t,!0);let n=ne(t,"label",3,"Dropdown"),r=ne(t,"info",3,""),i=ne(t,"value",15,null),s=ne(t,"choices",19,()=>[]),o=ne(t,"filterable",3,!0),a=ne(t,"showLabel",3,!0),u,l,c=fe(!1),f=fe(""),d=fe(null),h=fe(st([])),p=fe(0),g=fe(null),m=fe(null),v=fe(300),y=Be(()=>i()!==null?s().indexOf(i()):-1);Ht(()=>{i()!==null&&s().includes(i())?z(f,i(),!0):z(f,"")}),Ht(()=>{z(h,s().map((B,q)=>q),!0)});function b(B){if(!B)return s().map((X,le)=>le);const q=B.toLowerCase();return s().map((X,le)=>X.toLowerCase().includes(q)?le:-1).filter(X=>X>=0)}function x(){var B;if(z(h,s().map((q,X)=>X),!0),z(c,!0),u){const q=(B=u.closest(".wrap"))==null?void 0:B.getBoundingClientRect();if(q){z(p,q.width,!0);const X=window.innerHeight-q.bottom,le=q.top;X>=200||X>le?(z(g,`${q.bottom}px`),z(m,null),z(v,X-16)):(z(m,`${window.innerHeight-q.top}px`),z(g,null),z(v,le-16))}}}function _(){s().includes(w(f))?i(w(f)):i()!==null?z(f,i(),!0):z(f,""),z(c,!1),z(d,null),z(h,s().map((B,q)=>q),!0)}function A(B){const q=parseInt(B);isNaN(q)||(i(s()[q]),z(f,s()[q],!0),z(c,!1),z(d,null),u==null||u.blur())}async function E(B){if(await wi(),z(h,b(w(f)),!0),w(h).length>0&&w(d)===null&&z(d,w(h)[0],!0),B.key==="ArrowDown")if(B.preventDefault(),w(d)===null)z(d,w(h)[0]??null,!0);else{const q=w(h).indexOf(w(d));q0&&z(d,w(h)[q-1],!0)}}else B.key==="Enter"?w(d)!==null&&A(w(d)):B.key==="Escape"&&(z(c,!1),u==null||u.blur())}var S=_W(),k=I(S);{var F=B=>{var q=vW(),X=I(q);ke(()=>Me(X,n())),V(B,q)};Ae(k,B=>{a()&&B(F)})}var D=H(k,2);{var M=B=>{var q=yW(),X=I(q);ke(()=>Me(X,r())),V(B,q)};Ae(D,B=>{r()&&B(M)})}var T=H(D,2);let $;var C=I(T),R=I(C),L=I(R);us(L,B=>u=B,()=>u);var O=H(T,2);{var N=B=>{var q=xW(),X=I(q);let le;St(X,21,()=>w(h),At,(de,se)=>{var Ce=bW();let me;var W=I(Ce);let j;var te=H(W);ke(()=>{me=Tt(Ce,1,"item svelte-kgylqb",null,me,{selected:w(se)===w(y),active:w(se)===w(d)}),Nt(Ce,"data-index",w(se)),Nt(Ce,"aria-selected",w(se)===w(y)),j=Tt(W,1,"check-mark svelte-kgylqb",null,j,{hide:w(se)!==w(y)}),Me(te,` ${s()[w(se)]??""}`)}),V(de,Ce)}),us(X,de=>l=de,()=>l),ke(()=>le=Ll(X,"",le,{top:w(g),bottom:w(m),"max-height":`${w(v)??""}px`,width:`${w(p)??""}px`})),je("mousedown",X,de=>{var Ce;de.preventDefault();const se=(Ce=de.target.closest("li"))==null?void 0:Ce.dataset.index;se!==void 0&&A(se)}),V(B,q)};Ae(O,B=>{w(c)&&B(N)})}ke(()=>{$=Tt(T,1,"wrap svelte-kgylqb",null,$,{focused:w(c)}),Nt(L,"aria-label",n()),L.readOnly=!o(),Nt(L,"placeholder",i()===null?"Select...":"")}),je("keydown",L,E),as("blur",L,_),as("focus",L,x),bv(L,()=>w(f),B=>z(f,B)),V(e,S),Yt()}hi(["keydown","mousedown"]);var wW=ee(' '),EW=ee('');function e0(e,t){Gt(t,!0);let n=ne(t,"label",3,""),r=ne(t,"checked",15,!1),i=ne(t,"showLabel",3,!0);function s(c){r(c.currentTarget.checked)}var o=EW(),a=I(o),u=H(a,2);{var l=c=>{var f=wW(),d=I(f);ke(()=>Me(d,n())),V(c,f)};Ae(u,c=>{i()&&n()&&c(l)})}je("input",a,s),lW(a,r),V(e,o),Yt()}hi(["input"]);var AW=ee(' '),SW=ee(' '),kW=ee('
      ');function CW(e,t){Gt(t,!0);let n=ne(t,"label",3,"Slider"),r=ne(t,"info",3,""),i=ne(t,"value",15,0),s=ne(t,"min",3,0),o=ne(t,"max",3,100),a=ne(t,"step",3,1),u=ne(t,"showLabel",3,!0),l,c=Be(()=>i()>o()?100:i(){l&&l.style.setProperty("--range_progress",`${w(c)}%`)});var f=kW(),d=I(f),h=I(d);{var p=E=>{var S=AW(),k=I(S);ke(()=>Me(k,n())),V(E,S)};Ae(h,E=>{u()&&E(p)})}var g=H(d,2);{var m=E=>{var S=SW(),k=I(S);ke(()=>Me(k,r())),V(E,S)};Ae(g,E=>{r()&&E(m)})}var v=H(g,2),y=I(v),b=I(y),x=H(y,2);us(x,E=>l=E,()=>l);var _=H(x,2),A=I(_);ke(()=>{Me(b,s()),Nt(x,"min",s()),Nt(x,"max",o()),Nt(x,"step",a()),Me(A,o())}),bv(x,i),V(e,f),Yt()}var FW=ee(' '),$W=ee(' '),DW=ee('
      ');function IF(e,t){Gt(t,!0);let n=ne(t,"label",3,""),r=ne(t,"info",3,""),i=ne(t,"value",15,""),s=ne(t,"placeholder",3,""),o=ne(t,"showLabel",3,!0);var a=DW(),u=I(a);{var l=p=>{var g=FW(),m=I(g);ke(()=>Me(m,n())),V(p,g)};Ae(u,p=>{o()&&n()&&p(l)})}var c=H(u,2);{var f=p=>{var g=$W(),m=I(g);ke(()=>Me(m,r())),V(p,g)};Ae(c,p=>{r()&&p(f)})}var d=H(c,2),h=I(d);ke(()=>Nt(h,"placeholder",s())),bv(h,i),V(e,a),Yt()}const MW=["#A8769B","#E89957","#3B82F6","#10B981","#EF4444","#8B5CF6","#14B8A6","#F59E0B","#EC4899","#06B6D4"];let r_=MW;function RW(e){Array.isArray(e)&&e.length>0&&(r_=e)}function G8(e){return r_[e%r_.length]}function xv(e){const t={};return e.forEach((n,r)=>{t[n]=G8(r)}),t}const PF={"--neutral-50":"#fafafa","--neutral-100":"#f4f4f5","--neutral-200":"#e4e4e7","--neutral-300":"#d4d4d8","--neutral-400":"#bbbbc2","--neutral-500":"#71717a","--neutral-600":"#52525b","--neutral-700":"#3f3f46","--neutral-800":"#27272a","--neutral-900":"#18181b","--neutral-950":"#0f0f11","--background-fill-primary":"#0f0f11","--background-fill-secondary":"#18181b","--body-text-color":"#f4f4f5","--body-text-color-subdued":"#bbbbc2","--border-color-primary":"#3f3f46","--color-accent":"#f97316","--color-accent-soft":"#3f3f46","--input-background-fill":"#27272a","--input-background-fill-focus":"#f97316","--input-border-color":"#3f3f46","--input-border-color-focus":"#3f3f46","--input-placeholder-color":"#71717a","--input-shadow":"none","--input-shadow-focus":"none","--checkbox-background-color":"#27272a","--checkbox-background-color-focus":"#27272a","--checkbox-background-color-hover":"#27272a","--checkbox-background-color-selected":"#f97316","--checkbox-border-color":"#3f3f46","--checkbox-border-color-focus":"#f97316","--checkbox-border-color-hover":"#52525b","--checkbox-border-color-selected":"#f97316","--table-even-background-fill":"#0f0f11","--table-odd-background-fill":"#18181b","--slider-color":"#f97316","--shadow-drop":"rgba(0,0,0,0.15) 0px 1px 2px 0px","--shadow-drop-lg":"0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.2)","--shadow-inset":"rgba(0,0,0,0.15) 0px 2px 4px 0px inset","--block-title-text-color":"#bbbbc2","--block-info-text-color":"#71717a","--primary-50":"#3f3f46"};function TW(e){const t=document.documentElement;e==="dark"?(t.dataset.theme="dark",Object.entries(PF).forEach(([n,r])=>{t.style.setProperty(n,r)})):(delete t.dataset.theme,Object.keys(PF).forEach(n=>{t.style.removeProperty(n)}))}function Y8(){return document.documentElement.dataset.theme==="dark"}function V8(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"default"}var NW=q8(''),OW=q8(''),LW=ee('
      ',1),IW=ee('
      ',1),PW=ee('
      ',1),BW=ee(''),zW=ee('

      Signed in, but this account does not have write access to this Space.

      '),jW=ee('

      Required to delete or rename runs (Space owner or collaborator with write access).

      ',1),UW=ee(''),qW=ee(''),WW=ee(''),HW=ee('
      ');function GW(e,t){Gt(t,!0);let n=ne(t,"open",15,!0),r=ne(t,"variant",3,"full"),i=ne(t,"currentPage",3,"metrics"),s=ne(t,"projects",19,()=>[]),o=ne(t,"selectedProject",15,null),a=ne(t,"runs",19,()=>[]),u=ne(t,"selectedRuns",31,()=>st([])),l=ne(t,"smoothing",15,10),c=ne(t,"xAxis",15,"step"),f=ne(t,"logScaleX",15,!1),d=ne(t,"logScaleY",15,!1),h=ne(t,"metricFilter",15,""),p=ne(t,"realtimeEnabled",15,!0),g=ne(t,"showHeaders",15,!0),m=ne(t,"filterText",15,""),v=ne(t,"spacesMode",3,!1),y=ne(t,"runMutationAllowed",3,!0),b=ne(t,"mutationAuth",3,"local"),x=ne(t,"readOnlySource",3,null),_=ne(t,"projectLocked",3,!1),A=ne(t,"logoUrls",19,()=>({light:"/static/trackio/trackio_logo_type_light_transparent.png",dark:"/static/trackio/trackio_logo_type_dark_transparent.png"})),E=fe(0);pd(()=>{const de=()=>{m8(E)};return window.addEventListener("popstate",de),()=>window.removeEventListener("popstate",de)});let S=Be(()=>(w(E),`${window.location.origin}/oauth/hf/start`)),k=Be(()=>["step","time"]);function F(){n(!n())}function D(de,se){return de.indeterminate=se,{update(Ce){de.indeterminate=Ce}}}let M=Be(()=>m()?a().filter(de=>de.toLowerCase().includes(m().toLowerCase())):a()),T=Be(()=>xv(a())),$=fe(!1);function C(){z($,!w($)),w($)&&w(M).length>0?u([w(M)[w(M).length-1]]):w($)||u([...w(M)])}var R=HW();let L;var O=I(R),N=I(O);{var B=de=>{var se=NW();V(de,se)},q=de=>{var se=OW();V(de,se)};Ae(N,de=>{n()?de(B):de(q,-1)})}var X=H(O,2);{var le=de=>{var se=WW(),Ce=I(se),me=I(Ce),W=I(me),j=H(me,2),te=I(j);{var U=Ee=>{var ae=LW(),ye=H(Ct(ae),2),it=I(ye);ke(()=>Me(it,o()??"โ€”")),V(Ee,ae)},P=Ee=>{LF(Ee,{label:"Project",get choices(){return s()},filterable:!0,get value(){return o()},set value(ae){o(ae)}})};Ae(te,Ee=>{_()?Ee(U):Ee(P,-1)})}var we=H(j,2);{var he=Ee=>{var ae=PW(),ye=Ct(ae),it=I(ye),pt=I(it),Se=I(pt);rW(Se,(kr,Cr)=>D==null?void 0:D(kr,Cr),()=>u().length>0&&u().lengthw(M).map(Cr=>w(T)[Cr]??G8(Math.max(0,a().indexOf(Cr)))));mW(Ts,{get choices(){return w(M)},get colors(){return w(kr)},ontoggle:()=>{z($,!1)},get selected(){return u()},set selected(Cr){u(Cr)}})}var To=H(ye,2);{var Ea=kr=>{var Cr=IW(),Aa=H(Ct(Cr),2),Vr=I(Aa);e0(Vr,{label:"Refresh metrics realtime",get checked(){return p()},set checked(or){p(or)}});var Ns=H(Vr,2);e0(Ns,{label:"Show section headers",get checked(){return g()},set checked(or){g(or)}});var Sa=H(Aa,2),Ud=I(Sa);CW(Ud,{label:"Smoothing Factor (0 = no smoothing)",min:0,max:20,step:1,get value(){return l()},set value(or){l(or)}});var pi=H(Sa,2),kn=I(pi);LF(kn,{label:"X-axis",get choices(){return w(k)},filterable:!1,get value(){return c()},set value(or){c(or)}});var Kg=H(kn,2);e0(Kg,{label:"Log scale X-axis",get checked(){return f()},set checked(or){f(or)}});var Lb=H(Kg,2);e0(Lb,{label:"Log scale Y-axis",get checked(){return d()},set checked(or){d(or)}});var qd=H(pi,2),Zg=I(qd);IF(Zg,{label:"Metric Filter",info:"Filter metrics using regex patterns. Leave empty to show all metrics.",placeholder:"e.g., loss|ndcg@10|gpu",get value(){return h()},set value(or){h(or)}}),V(kr,Cr)};Ae(To,kr=>{(i()==="metrics"||i()==="system")&&kr(Ea)})}ke(()=>{lp(Se,u().length===w(M).length&&w(M).length>0),Me(tn,`Runs (${w(M).length??""})`),lp(nn,w($))}),je("change",Se,()=>{u().length===w(M).length?u([]):u([...w(M)]),z($,!1)}),je("change",nn,C),V(Ee,ae)};Ae(we,Ee=>{r()==="full"&&Ee(he)})}var Le=H(Ce,2);{var Re=Ee=>{var ae=BW(),ye=H(I(ae),2),it=I(ye);ke(()=>{Nt(ye,"href",x().url),Me(it,x().url)}),V(Ee,ae)},qe=Ee=>{var ae=UW(),ye=I(ae);{var it=Se=>{var dt=zW();V(Se,dt)},pt=Se=>{var dt=jW(),tn=Ct(dt);ke(()=>Nt(tn,"href",w(S))),V(Se,dt)};Ae(ye,Se=>{b()==="oauth_insufficient"?Se(it):Se(pt,-1)})}V(Ee,ae)},ft=Ee=>{var ae=qW(),ye=H(I(ae),2);je("click",ye,()=>{sessionStorage.removeItem("trackio_oauth_session")}),V(Ee,ae)};Ae(Le,Ee=>{x()?Ee(Re):v()&&!y()?Ee(qe,1):v()&&y()&&b()==="oauth"&&Ee(ft,2)})}ke(Ee=>Nt(W,"src",Ee),[()=>Y8()?A().dark:A().light]),V(de,se)};Ae(X,de=>{n()&&de(le)})}ke(()=>L=Tt(R,1,"sidebar svelte-181dlmc",null,L,{collapsed:!n()})),je("click",O,F),V(e,R),Yt()}hi(["click","change"]);var YW=ee('
      '),VW=ee('
      '),XW=ee('
      '),KW=ee('
      '),ZW=ee('
      ');function JW(e,t){Gt(t,!0);let n=ne(t,"alerts",19,()=>[]);const r={info:"๐Ÿ”ต",warn:"๐ŸŸก",error:"๐Ÿ”ด"};let i=fe(st({})),s=fe(null),o=fe(!1),a=Be(()=>w(s)?n().filter(d=>d.level===w(s)):n());function u(d){z(i,{...w(i),[d]:!w(i)[d]},!0)}var l=rs(),c=Ct(l);{var f=d=>{var h=ZW();let p;var g=I(h),m=I(g),v=I(m),y=H(m,2);{var b=S=>{var k=YW(),F=I(k);let D;var M=H(F,2);let T;var $=H(M,2);let C;var R=H($,2);let L;ke(()=>{D=Tt(F,1,"pill svelte-x5aqew",null,D,{active:w(s)===null}),T=Tt(M,1,"pill svelte-x5aqew",null,T,{active:w(s)==="info"}),C=Tt($,1,"pill svelte-x5aqew",null,C,{active:w(s)==="warn"}),L=Tt(R,1,"pill svelte-x5aqew",null,L,{active:w(s)==="error"})}),je("click",k,O=>O.stopPropagation()),je("click",F,()=>z(s,null)),je("click",M,()=>z(s,"info")),je("click",$,()=>z(s,"warn")),je("click",R,()=>z(s,"error")),V(S,k)};Ae(y,S=>{w(o)||S(b)})}var x=H(y,2);let _;var A=H(g,2);{var E=S=>{var k=KW();St(k,21,()=>w(a),At,(F,D,M)=>{var T=XW();let $;var C=I(T),R=I(C),L=I(R),O=H(R,2),N=I(O),B=H(O,2),q=I(B),X=H(C,2);{var le=de=>{var se=VW(),Ce=I(se);ke(()=>Me(Ce,w(D).text)),V(de,se)};Ae(X,de=>{w(i)[M]&&w(D).text&&de(le)})}ke(()=>{$=Tt(T,1,"alert-item svelte-x5aqew",null,$,{expanded:w(i)[M]}),Me(L,r[w(D).level]||""),Me(N,w(D).title),Me(q,w(D).meta||"")}),je("click",C,()=>u(M)),V(F,T)}),V(S,k)};Ae(A,S=>{w(o)||S(E)})}ke(()=>{p=Tt(h,1,"alert-panel svelte-x5aqew",null,p,{collapsed:w(o)}),Me(v,`Alerts (${n().length??""})`),_=Tt(x,0,"collapse-icon svelte-x5aqew",null,_,{rotated:w(o)})}),je("click",g,()=>z(o,!w(o))),je("keydown",g,S=>S.key==="Enter"&&z(o,!w(o))),V(d,h)};Ae(c,d=>{n().length>0&&d(f)})}V(e,l),Yt()}hi(["click","keydown"]);function BF(){const e=window.location.pathname.replace(/\/+$/,"")||"/";switch(e==="/"?"":e.replace(/^\//,"").split("/")[0]){case"":case"metrics":return"metrics";case"system":return"system";case"media":return"media";case"reports":return"reports";case"runs":return"runs";case"run":return"run-detail";case"files":return"files";default:return"metrics"}}function X8(e){const t=new URLSearchParams(window.location.search),r={metrics:"/",system:"/system",media:"/media",reports:"/reports",runs:"/runs","run-detail":"/run",files:"/files"}[e]||"/",i=t.toString(),s=i?`${r}?${i}`:r;window.history.pushState({},"",s),window.dispatchEvent(new PopStateEvent("popstate"))}function zs(e){return new URLSearchParams(window.location.search).get(e)}function QW(e,t){const n=new URLSearchParams(window.location.search);t!=null&&t!==""?n.set(e,t):n.delete(e);const r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState({},"",i)}const eH=/("(?:[^\\"]|\\.)*")|[:,]/g;function Wb(e,t={}){const n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=n===""?1/0:t.maxLength===void 0?80:t.maxLength;let{replacer:i}=t;return(function s(o,a,u){o&&typeof o.toJSON=="function"&&(o=o.toJSON());const l=JSON.stringify(o,i);if(l===void 0)return l;const c=r-a.length-u;if(l.length<=c){const f=l.replace(eH,(d,h)=>h||`${d} `);if(f.length<=c)return f}if(i!=null&&(o=JSON.parse(l),i=void 0),typeof o=="object"&&o!==null){const f=a+n,d=[];let h=0,p,g;if(Array.isArray(o)){p="[",g="]";const{length:m}=o;for(;h0)return[p,n+d.join(`, +${f}`),g].join(` +${a}`)}return l})(e,"",0)}function Gr(e,t,n){return e.fields=t||[],e.fname=n,e}function Wt(e){return e==null?null:e.fname}function Zn(e){return e==null?null:e.fields}function K8(e){return e.length===1?tH(e[0]):nH(e)}const tH=e=>function(t){return t[e]},nH=e=>{const t=e.length;return function(n){for(let r=0;ro?l():o=a+1:u==="["?(a>o&&l(),i=o=a+1):u==="]"&&(i||K("Access path missing open bracket: "+e),i>0&&l(),i=0,o=a+1)}return i&&K("Access path missing closing bracket: "+e),r&&K("Access path missing closing quote: "+e),a>o&&(a++,l()),t}function Ni(e,t,n){const r=bo(e);return e=r.length===1?r[0]:e,Gr((n&&n.get||K8)(r),[e],t||e)}const tg=Ni("id"),rr=Gr(e=>e,[],"identity"),La=Gr(()=>0,[],"zero"),gd=Gr(()=>1,[],"one"),Oi=Gr(()=>!0,[],"true"),Fa=Gr(()=>!1,[],"false"),UE=new Set(Object.getOwnPropertyNames(Object.prototype));function rH(e,t,n){const r=[t].concat([].slice.call(n));console[e].apply(console,r)}const Z8=0,qE=1,WE=2,J8=3,Q8=4;function HE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rH,r=e||Z8;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=qE&&n(t||"error","ERROR",arguments),this},warn(){return r>=WE&&n(t||"warn","WARN",arguments),this},info(){return r>=J8&&n(t||"log","INFO",arguments),this},debug(){return r>=Q8&&n(t||"log","DEBUG",arguments),this}}}var Q=Array.isArray;function ve(e){return e===Object(e)}const zF=e=>e!=="__proto__";function md(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const s in i)if(s==="signals")r.signals=iH(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;vd(r,s,i[s],o)}return r},{})}function vd(e,t,n,r){if(!zF(t))return;let i,s;if(ve(n)&&!Q(n)){s=ve(e[t])?e[t]:e[t]={};for(i in n)r&&(r===!0||r[i])?vd(s,i,n[i]):zF(i)&&(s[i]=n[i])}else e[t]=n}function iH(e,t){if(e==null)return t;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return t.forEach(i),e.forEach(i),r}function nt(e){return e[e.length-1]}function Xn(e){return e==null||e===""?null:+e}const eR=e=>t=>e*Math.exp(t),tR=e=>t=>Math.log(e*t),nR=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),rR=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Dm=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function _v(e,t,n,r){const i=n(e[0]),s=n(nt(e)),o=(s-i)*t;return[r(i-o),r(s-o)]}function iR(e,t){return _v(e,t,Xn,rr)}function sR(e,t){var n=Math.sign(e[0]);return _v(e,t,tR(n),eR(n))}function oR(e,t,n){return _v(e,t,Dm(n),Dm(1/n))}function aR(e,t,n){return _v(e,t,nR(n),rR(n))}function wv(e,t,n,r,i){const s=r(e[0]),o=r(nt(e)),a=t!=null?r(t):(s+o)/2;return[i(a+(s-a)*n),i(a+(o-a)*n)]}function GE(e,t,n){return wv(e,t,n,Xn,rr)}function YE(e,t,n){const r=Math.sign(e[0]);return wv(e,t,n,tR(r),eR(r))}function Mm(e,t,n,r){return wv(e,t,n,Dm(r),Dm(1/r))}function VE(e,t,n,r){return wv(e,t,n,nR(r),rR(r))}function uR(e){return 1+~~(new Date(e).getMonth()/3)}function lR(e){return 1+~~(new Date(e).getUTCMonth()/3)}function xe(e){return e!=null?Q(e)?e:[e]:[]}function cR(e,t,n){let r=e[0],i=e[1],s;return i=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-s),r+s]}function He(e){return typeof e=="function"}const sH="descending";function XE(e,t,n){n=n||{},t=xe(t)||[];const r=[],i=[],s={},o=n.comparator||oH;return xe(e).forEach((a,u)=>{a!=null&&(r.push(t[u]===sH?-1:1),i.push(a=He(a)?a:Ni(a,null,n)),(Zn(a)||[]).forEach(l=>s[l]=1))}),i.length===0?null:Gr(o(i,r),Object.keys(s))}const yd=(e,t)=>(et||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),oH=(e,t)=>e.length===1?aH(e[0],t[0]):uH(e,t,e.length),aH=(e,t)=>function(n,r){return yd(e(n),e(r))*t},uH=(e,t,n)=>(t.push(0),function(r,i){let s,o=0,a=-1;for(;o===0&&++ae}function KE(e,t){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}function We(e){for(let t,n,r=1,i=arguments.length;ro&&(o=i))}else{for(i=t(e[n]);no&&(o=i))}return[s,o]}function fR(e,t){const n=e.length;let r=-1,i,s,o,a,u;if(t==null){for(;++r=s){i=o=s;break}if(r===n)return[-1,-1];for(a=u=r;++rs&&(i=s,a=r),o=s){i=o=s;break}if(r===n)return[-1,-1];for(a=u=r;++rs&&(i=s,a=r),o{i.set(s,e[s])}),i}function dR(e,t,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let a=e[0],u=nt(e),l;us&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=e:ia.replace(/\\(.)/g,"$1")):xe(e));const r=e&&e.length,i=n&&n.get||K8,s=a=>i(t?[a]:bo(a));let o;if(!r)o=function(){return""};else if(r===1){const a=s(e[0]);o=function(u){return""+a(u)}}else{const a=e.map(s);o=function(u){let l=""+a[0](u),c=0;for(;++c{t={},n={},r=0},s=(o,a)=>(++r>e&&(n=t,t={},r=1),t[o]=a);return i(),{clear:i,has:o=>_e(t,o)||_e(n,o),get:o=>_e(t,o)?t[o]:_e(n,o)?s(o,n[o]):void 0,set:(o,a)=>_e(t,o)?t[o]=a:s(o,a)}}function mR(e,t,n,r){const i=t.length,s=n.length;if(!s)return t;if(!i)return n;const o=r||new t.constructor(i+s);let a=0,u=0,l=0;for(;a0?n[u++]:t[a++];for(;a=0;)n+=e;return n}function vR(e,t,n,r){const i=n||" ",s=e+"",o=t-s.length;return o<=0?s:r==="left"?yh(i,o)+s:r==="center"?yh(i,~~(o/2))+s+yh(i,Math.ceil(o/2)):s+yh(i,o)}function ng(e){return e&&nt(e)-e[0]||0}function ce(e){return Q(e)?"["+e.map(ce)+"]":ve(e)||be(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function QE(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const cH=e=>ut(e)||Qa(e)?e:Date.parse(e);function eA(e,t){return t=t||cH,e==null||e===""?null:t(e)}function tA(e){return e==null||e===""?null:e+""}function vs(e){const t={},n=e.length;for(let r=0;r9999?"+"+Fr(e,6):Fr(e,4)}function hH(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":dH(e.getUTCFullYear())+"-"+Fr(e.getUTCMonth()+1,2)+"-"+Fr(e.getUTCDate(),2)+(i?"T"+Fr(t,2)+":"+Fr(n,2)+":"+Fr(r,2)+"."+Fr(i,3)+"Z":r?"T"+Fr(t,2)+":"+Fr(n,2)+":"+Fr(r,2)+"Z":n||t?"T"+Fr(t,2)+":"+Fr(n,2)+"Z":"")}function pH(e){var t=new RegExp('["'+e+` +\r]`),n=e.charCodeAt(0);function r(f,d){var h,p,g=i(f,function(m,v){if(h)return h(m,v-1);p=m,h=d?fH(m,d):bR(m)});return g.columns=p||[],g}function i(f,d){var h=[],p=f.length,g=0,m=0,v,y=p<=0,b=!1;f.charCodeAt(p-1)===Gd&&--p,f.charCodeAt(p-1)===Yb&&--p;function x(){if(y)return Hb;if(b)return b=!1,jF;var A,E=g,S;if(f.charCodeAt(E)===Gb){for(;g++=p?y=!0:(S=f.charCodeAt(g++))===Gd?b=!0:S===Yb&&(b=!0,f.charCodeAt(g)===Gd&&++g),f.slice(E+1,A-1).replace(/""/g,'"')}for(;g1)r=wH(e,t,n);else for(i=0,r=new Array(s=e.arcs.length);it?1:e>=t?0:NaN}function EH(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function xd(e){let t,n,r;e.length!==2?(t=Qo,n=(a,u)=>Qo(e(a),u),r=(a,u)=>e(a)-u):(t=e===Qo||e===EH?e:AH,n=e,r=e);function i(a,u,l=0,c=a.length){if(l>>1;n(a[f],u)<0?l=f+1:c=f}while(l>>1;n(a[f],u)<=0?l=f+1:c=f}while(ll&&r(a[f-1],u)>-r(a[f],u)?f-1:f}return{left:i,center:o,right:s}}function AH(){return 0}function _R(e){return e===null?NaN:+e}function*SH(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const wR=xd(Qo),ou=wR.right,kH=wR.left;xd(_R).center;function CH(e,t){let n=0,r,i=0,s=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(r=o-i,i+=r/++n,s+=r*(o-i));else{let o=-1;for(let a of e)(a=t(a,++o,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,s+=r*(a-i))}if(n>1)return s/(n-1)}function FH(e,t){const n=CH(e,t);return n&&Math.sqrt(n)}class vr{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let i=0;i0){for(o=t[--n];n>0&&(r=o,i=t[--n],o=r+i,s=i-(o-r),!s););n>0&&(s<0&&t[n-1]<0||s>0&&t[n-1]>0)&&(i=s*2,r=o+i,i==r-o&&(o=r))}return o}}class WF extends Map{constructor(t,n=SR){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(i_(this,t))}has(t){return super.has(i_(this,t))}set(t,n){return super.set(ER(this,t),n)}delete(t){return super.delete(AR(this,t))}}class Rm extends Set{constructor(t,n=SR){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const r of t)this.add(r)}has(t){return super.has(i_(this,t))}add(t){return super.add(ER(this,t))}delete(t){return super.delete(AR(this,t))}}function i_({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function ER({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function AR({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function SR(e){return e!==null&&typeof e=="object"?e.valueOf():e}function $H(e,t){return Array.from(t,n=>e[n])}function DH(e=Qo){if(e===Qo)return kR;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function kR(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const MH=Math.sqrt(50),RH=Math.sqrt(10),TH=Math.sqrt(2);function Tm(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=MH?10:s>=RH?5:s>=TH?2:1;let a,u,l;return i<0?(l=Math.pow(10,-i)/o,a=Math.round(e*l),u=Math.round(t*l),a/lt&&--u,l=-l):(l=Math.pow(10,i)*o,a=Math.round(e/l),u=Math.round(t/l),a*lt&&--u),u0))return[];if(e===t)return[e];const r=t=i))return[];const a=s-i+1,u=new Array(a);if(r)if(o<0)for(let l=0;l=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function a_(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function CR(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?kR:DH(i);r>n;){if(r-n>600){const u=r-n+1,l=t-n+1,c=Math.log(u),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(u-f)/u)*(l-u/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/u+d)),p=Math.min(r,Math.floor(t+(u-l)*f/u+d));CR(e,t,h,p,i)}const s=e[t];let o=n,a=r;for(Yd(e,n,t),i(e[r],s)>0&&Yd(e,n,r);o0;)--a}i(e[n],s)===0?Yd(e,n,a):(++a,Yd(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Yd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function u_(e,t,n){if(e=Float64Array.from(SH(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return a_(e);if(t>=1)return bl(e);var r,i=(r-1)*t,s=Math.floor(i),o=bl(CR(e,s).subarray(0,s+1)),a=a_(e.subarray(s+1));return o+(a-o)*(i-s)}}function FR(e,t,n=_R){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),a=+n(e[s+1],s+1,e);return o+(a-o)*(i-s)}}function NH(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let s of e)(s=t(s,++i,e))!=null&&(s=+s)>=s&&(++n,r+=s)}if(n)return r/n}function $R(e,t){return u_(e,.5,t)}function*OH(e){for(const t of e)yield*t}function DR(e){return Array.from(OH(e))}function ni(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Nm(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Mf(e){return e=Nm(Math.abs(e)),e?e[1]:NaN}function zH(e,t){return function(n,r){for(var i=n.length,s=[],o=0,a=e[0],u=0;i>0&&a>0&&(u+a+1>r&&(a=Math.max(1,r-u)),s.push(n.substring(i-=a,i+a)),!((u+=a+1)>r));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function jH(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var UH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Il(e){if(!(t=UH.exec(e)))throw new Error("invalid format: "+e);var t;return new nA({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Il.prototype=nA.prototype;function nA(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}nA.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function qH(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Om;function WH(e,t){var n=Nm(e,t);if(!n)return Om=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(Om=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Nm(e,Math.max(0,t+s-1))[0]}function HF(e,t){var n=Nm(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const GF={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:BH,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>HF(e*100,t),r:HF,s:WH,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function YF(e){return e}var VF=Array.prototype.map,XF=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"];function RR(e){var t=e.grouping===void 0||e.thousands===void 0?YF:zH(VF.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?YF:jH(VF.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"โˆ’":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function l(f,d){f=Il(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,v=f.zero,y=f.width,b=f.comma,x=f.precision,_=f.trim,A=f.type;A==="n"?(b=!0,A="g"):GF[A]||(x===void 0&&(x=12),_=!0,A="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var E=(d&&d.prefix!==void 0?d.prefix:"")+(m==="$"?n:m==="#"&&/[boxX]/.test(A)?"0"+A.toLowerCase():""),S=(m==="$"?r:/[%p]/.test(A)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),k=GF[A],F=/[defgprs%]/.test(A);x=x===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function D(M){var T=E,$=S,C,R,L;if(A==="c")$=k(M)+$,M="";else{M=+M;var O=M<0||1/M<0;if(M=isNaN(M)?u:k(Math.abs(M),x),_&&(M=qH(M)),O&&+M==0&&g!=="+"&&(O=!1),T=(O?g==="("?g:a:g==="-"||g==="("?"":g)+T,$=(A==="s"&&!isNaN(M)&&Om!==void 0?XF[8+Om/3]:"")+$+(O&&g==="("?")":""),F){for(C=-1,R=M.length;++CL||L>57){$=(L===46?i+M.slice(C+1):M.slice(C))+$,M=M.slice(0,C);break}}}b&&!v&&(M=t(M,1/0));var N=T.length+M.length+$.length,B=N>1)+T+M+$+B.slice(N);break;default:M=B+T+M+$;break}return s(M)}return D.toString=function(){return f+""},D}function c(f,d){var h=Math.max(-8,Math.min(8,Math.floor(Mf(d)/3)))*3,p=Math.pow(10,-h),g=l((f=Il(f),f.type="f",f),{suffix:XF[8+h/3]});return function(m){return g(p*m)}}return{format:l,formatPrefix:c}}var n0,Ev,rA;HH({thousands:",",grouping:[3],currency:["$",""]});function HH(e){return n0=RR(e),Ev=n0.format,rA=n0.formatPrefix,n0}function TR(e){return Math.max(0,-Mf(Math.abs(e)))}function NR(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mf(t)/3)))*3-Mf(Math.abs(e)))}function OR(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Mf(t)-Mf(e))+1}const Vb=new Date,Xb=new Date;function cn(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const u=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return u;let l;do u.push(l=new Date(+s)),t(s,a),e(s);while(lcn(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!s(o););else for(;--a>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(Vb.setTime(+s),Xb.setTime(+o),e(Vb),e(Xb),Math.floor(n(Vb,Xb))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Rf=cn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Rf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?cn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Rf);Rf.range;const Yo=1e3,Ai=Yo*60,Vo=Ai*60,ua=Vo*24,iA=ua*7,KF=ua*30,Kb=ua*365,Xo=cn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Yo)},(e,t)=>(t-e)/Yo,e=>e.getUTCSeconds());Xo.range;const Av=cn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Yo)},(e,t)=>{e.setTime(+e+t*Ai)},(e,t)=>(t-e)/Ai,e=>e.getMinutes());Av.range;const Sv=cn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ai)},(e,t)=>(t-e)/Ai,e=>e.getUTCMinutes());Sv.range;const kv=cn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Yo-e.getMinutes()*Ai)},(e,t)=>{e.setTime(+e+t*Vo)},(e,t)=>(t-e)/Vo,e=>e.getHours());kv.range;const Cv=cn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Vo)},(e,t)=>(t-e)/Vo,e=>e.getUTCHours());Cv.range;const ea=cn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ai)/ua,e=>e.getDate()-1);ea.range;const eu=cn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ua,e=>e.getUTCDate()-1);eu.range;const LR=cn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ua,e=>Math.floor(e/ua));LR.range;function uc(e){return cn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ai)/iA)}const _d=uc(0),Lm=uc(1),GH=uc(2),YH=uc(3),Tf=uc(4),VH=uc(5),XH=uc(6);_d.range;Lm.range;GH.range;YH.range;Tf.range;VH.range;XH.range;function lc(e){return cn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/iA)}const wd=lc(0),Im=lc(1),KH=lc(2),ZH=lc(3),Nf=lc(4),JH=lc(5),QH=lc(6);wd.range;Im.range;KH.range;ZH.range;Nf.range;JH.range;QH.range;const cp=cn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());cp.range;const fp=cn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());fp.range;const lo=cn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());lo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:cn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});lo.range;const co=cn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());co.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:cn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});co.range;function IR(e,t,n,r,i,s){const o=[[Xo,1,Yo],[Xo,5,5*Yo],[Xo,15,15*Yo],[Xo,30,30*Yo],[s,1,Ai],[s,5,5*Ai],[s,15,15*Ai],[s,30,30*Ai],[i,1,Vo],[i,3,3*Vo],[i,6,6*Vo],[i,12,12*Vo],[r,1,ua],[r,2,2*ua],[n,1,iA],[t,1,KF],[t,3,3*KF],[e,1,Kb]];function a(l,c,f){const d=cm).right(o,d);if(h===o.length)return e.every(au(l/Kb,c/Kb,f));if(h===0)return Rf.every(Math.max(au(l,c,f),1));const[p,g]=o[d/o[h-1][2](e[t]=1+n,e),{});function oA(e){const t=xe(e).slice(),n={};return t.length||K("Missing time unit."),t.forEach(i=>{_e(Zb,i)?n[i]=1:K(`Invalid time unit: ${i}.`)}),(n[on]||n[Vn]?1:0)+(n[zr]||n[Jn]||n[jr]?1:0)+(n[fo]?1:0)>1&&K(`Incompatible time units: ${e}`),t.sort((i,s)=>Zb[i]-Zb[s]),t}const iG={[In]:"%Y ",[zr]:"Q%q ",[Jn]:"%b ",[jr]:"%d ",[on]:"W%U ",[Vn]:"%a ",[fo]:"%j ",[li]:"%H:00",[ci]:"00:%M",[Li]:":%S",[ys]:".%L",[`${In}-${Jn}`]:"%Y-%m ",[`${In}-${Jn}-${jr}`]:"%Y-%m-%d ",[`${li}-${ci}`]:"%H:%M"};function PR(e,t){const n=We({},iG,t),r=oA(e),i=r.length;let s="",o=0,a,u;for(o=0;oo;--a)if(u=r.slice(o,a).join("-"),n[u]!=null){s+=n[u],o=a;break}return s.trim()}const el=new Date;function aA(e){return el.setFullYear(e),el.setMonth(0),el.setDate(1),el.setHours(0,0,0,0),el}function BR(e){return jR(new Date(e))}function zR(e){return l_(new Date(e))}function jR(e){return ea.count(aA(e.getFullYear())-1,e)}function l_(e){return _d.count(aA(e.getFullYear())-1,e)}function c_(e){return aA(e).getDay()}function sG(e,t,n,r,i,s,o){if(0<=e&&e<100){const a=new Date(-1,t,n,r,i,s,o);return a.setFullYear(e),a}return new Date(e,t,n,r,i,s,o)}function UR(e){return WR(new Date(e))}function qR(e){return f_(new Date(e))}function WR(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return eu.count(t-1,e)}function f_(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return wd.count(t-1,e)}function d_(e){return el.setTime(Date.UTC(e,0,1)),el.getUTCDay()}function oG(e,t,n,r,i,s,o){if(0<=e&&e<100){const a=new Date(Date.UTC(-1,t,n,r,i,s,o));return a.setUTCFullYear(n.y),a}return new Date(Date.UTC(e,t,n,r,i,s,o))}function HR(e,t,n,r,i){const s=t||1,o=nt(e),a=(v,y,b)=>(b=b||v,aG(n[b],r[b],v===o&&s,y)),u=new Date,l=vs(e),c=l[In]?a(In):ir(2012),f=l[Jn]?a(Jn):l[zr]?a(zr):La,d=l[on]&&l[Vn]?a(Vn,1,on+Vn):l[on]?a(on,1):l[Vn]?a(Vn,1):l[jr]?a(jr,1):l[fo]?a(fo,1):gd,h=l[li]?a(li):La,p=l[ci]?a(ci):La,g=l[Li]?a(Li):La,m=l[ys]?a(ys):La;return function(v){u.setTime(+v);const y=c(u);return i(y,f(u),d(u,y),h(u),p(u),g(u),m(u))}}function aG(e,t,n,r){const i=n<=1?e:r?(s,o)=>r+n*Math.floor((e(s,o)-r)/n):(s,o)=>n*Math.floor(e(s,o)/n);return t?(s,o)=>t(i(s,o),o):i}function Of(e,t,n){return t+e*7-(n+6)%7}const uG={[In]:e=>e.getFullYear(),[zr]:e=>Math.floor(e.getMonth()/3),[Jn]:e=>e.getMonth(),[jr]:e=>e.getDate(),[li]:e=>e.getHours(),[ci]:e=>e.getMinutes(),[Li]:e=>e.getSeconds(),[ys]:e=>e.getMilliseconds(),[fo]:e=>jR(e),[on]:e=>l_(e),[on+Vn]:(e,t)=>Of(l_(e),e.getDay(),c_(t)),[Vn]:(e,t)=>Of(1,e.getDay(),c_(t))},lG={[zr]:e=>3*e,[on]:(e,t)=>Of(e,0,c_(t))};function GR(e,t){return HR(e,t||1,uG,lG,sG)}const cG={[In]:e=>e.getUTCFullYear(),[zr]:e=>Math.floor(e.getUTCMonth()/3),[Jn]:e=>e.getUTCMonth(),[jr]:e=>e.getUTCDate(),[li]:e=>e.getUTCHours(),[ci]:e=>e.getUTCMinutes(),[Li]:e=>e.getUTCSeconds(),[ys]:e=>e.getUTCMilliseconds(),[fo]:e=>WR(e),[on]:e=>f_(e),[Vn]:(e,t)=>Of(1,e.getUTCDay(),d_(t)),[on+Vn]:(e,t)=>Of(f_(e),e.getUTCDay(),d_(t))},fG={[zr]:e=>3*e,[on]:(e,t)=>Of(e,0,d_(t))};function YR(e,t){return HR(e,t||1,cG,fG,oG)}const dG={[In]:lo,[zr]:cp.every(3),[Jn]:cp,[on]:_d,[jr]:ea,[Vn]:ea,[fo]:ea,[li]:kv,[ci]:Av,[Li]:Xo,[ys]:Rf},hG={[In]:co,[zr]:fp.every(3),[Jn]:fp,[on]:wd,[jr]:eu,[Vn]:eu,[fo]:eu,[li]:Cv,[ci]:Sv,[Li]:Xo,[ys]:Rf};function Ed(e){return dG[e]}function Ad(e){return hG[e]}function VR(e,t,n){return e?e.offset(t,n):void 0}function XR(e,t,n){return VR(Ed(e),t,n)}function KR(e,t,n){return VR(Ad(e),t,n)}function ZR(e,t,n,r){return e?e.range(t,n,r):void 0}function JR(e,t,n,r){return ZR(Ed(e),t,n,r)}function QR(e,t,n,r){return ZR(Ad(e),t,n,r)}const bh=1e3,xh=bh*60,_h=xh*60,Fv=_h*24,pG=Fv*7,ZF=Fv*30,h_=Fv*365,eT=[In,Jn,jr,li,ci,Li,ys],wh=eT.slice(0,-1),Eh=wh.slice(0,-1),Ah=Eh.slice(0,-1),gG=Ah.slice(0,-1),mG=[In,on],JF=[In,Jn],tT=[In],Vd=[[wh,1,bh],[wh,5,5*bh],[wh,15,15*bh],[wh,30,30*bh],[Eh,1,xh],[Eh,5,5*xh],[Eh,15,15*xh],[Eh,30,30*xh],[Ah,1,_h],[Ah,3,3*_h],[Ah,6,6*_h],[Ah,12,12*_h],[gG,1,Fv],[mG,1,pG],[JF,1,ZF],[JF,3,3*ZF],[tT,1,h_]];function nT(e){const t=e.extent,n=e.maxbins||40,r=Math.abs(ng(t))/n;let i=xd(a=>a[2]).right(Vd,r),s,o;return i===Vd.length?(s=tT,o=au(t[0]/h_,t[1]/h_,n)):i?(i=Vd[r/Vd[i-1][2]53)return null;"w"in P||(P.w=1),"Z"in P?(he=Qb(Xd(P.y,0,1)),Le=he.getUTCDay(),he=Le>4||Le===0?Im.ceil(he):Im(he),he=eu.offset(he,(P.V-1)*7),P.y=he.getUTCFullYear(),P.m=he.getUTCMonth(),P.d=he.getUTCDate()+(P.w+6)%7):(he=Jb(Xd(P.y,0,1)),Le=he.getDay(),he=Le>4||Le===0?Lm.ceil(he):Lm(he),he=ea.offset(he,(P.V-1)*7),P.y=he.getFullYear(),P.m=he.getMonth(),P.d=he.getDate()+(P.w+6)%7)}else("W"in P||"U"in P)&&("w"in P||(P.w="u"in P?P.u%7:"W"in P?1:0),Le="Z"in P?Qb(Xd(P.y,0,1)).getUTCDay():Jb(Xd(P.y,0,1)).getDay(),P.m=0,P.d="W"in P?(P.w+6)%7+P.W*7-(Le+5)%7:P.w+P.U*7-(Le+6)%7);return"Z"in P?(P.H+=P.Z/100|0,P.M+=P.Z%100,Qb(P)):Jb(P)}}function S(j,te,U,P){for(var we=0,he=te.length,Le=U.length,Re,qe;we=Le)return-1;if(Re=te.charCodeAt(we++),Re===37){if(Re=te.charAt(we++),qe=_[Re in QF?te.charAt(we++):Re],!qe||(P=qe(j,U,P))<0)return-1}else if(Re!=U.charCodeAt(P++))return-1}return P}function k(j,te,U){var P=l.exec(te.slice(U));return P?(j.p=c.get(P[0].toLowerCase()),U+P[0].length):-1}function F(j,te,U){var P=h.exec(te.slice(U));return P?(j.w=p.get(P[0].toLowerCase()),U+P[0].length):-1}function D(j,te,U){var P=f.exec(te.slice(U));return P?(j.w=d.get(P[0].toLowerCase()),U+P[0].length):-1}function M(j,te,U){var P=v.exec(te.slice(U));return P?(j.m=y.get(P[0].toLowerCase()),U+P[0].length):-1}function T(j,te,U){var P=g.exec(te.slice(U));return P?(j.m=m.get(P[0].toLowerCase()),U+P[0].length):-1}function $(j,te,U){return S(j,t,te,U)}function C(j,te,U){return S(j,n,te,U)}function R(j,te,U){return S(j,r,te,U)}function L(j){return o[j.getDay()]}function O(j){return s[j.getDay()]}function N(j){return u[j.getMonth()]}function B(j){return a[j.getMonth()]}function q(j){return i[+(j.getHours()>=12)]}function X(j){return 1+~~(j.getMonth()/3)}function le(j){return o[j.getUTCDay()]}function de(j){return s[j.getUTCDay()]}function se(j){return u[j.getUTCMonth()]}function Ce(j){return a[j.getUTCMonth()]}function me(j){return i[+(j.getUTCHours()>=12)]}function W(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var te=A(j+="",b);return te.toString=function(){return j},te},parse:function(j){var te=E(j+="",!1);return te.toString=function(){return j},te},utcFormat:function(j){var te=A(j+="",x);return te.toString=function(){return j},te},utcParse:function(j){var te=E(j+="",!0);return te.toString=function(){return j},te}}}var QF={"-":"",_:" ",0:"0"},An=/^\s*\d+/,vG=/^%/,yG=/[\\^$*+?|[\]().{}]/g;function lt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function xG(e,t,n){var r=An.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function _G(e,t,n){var r=An.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function wG(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function EG(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function AG(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function e$(e,t,n){var r=An.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function t$(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function SG(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function kG(e,t,n){var r=An.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function CG(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function n$(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function FG(e,t,n){var r=An.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function r$(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function $G(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function DG(e,t,n){var r=An.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function MG(e,t,n){var r=An.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function RG(e,t,n){var r=An.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function TG(e,t,n){var r=vG.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function NG(e,t,n){var r=An.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function OG(e,t,n){var r=An.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function i$(e,t){return lt(e.getDate(),t,2)}function LG(e,t){return lt(e.getHours(),t,2)}function IG(e,t){return lt(e.getHours()%12||12,t,2)}function PG(e,t){return lt(1+ea.count(lo(e),e),t,3)}function iT(e,t){return lt(e.getMilliseconds(),t,3)}function BG(e,t){return iT(e,t)+"000"}function zG(e,t){return lt(e.getMonth()+1,t,2)}function jG(e,t){return lt(e.getMinutes(),t,2)}function UG(e,t){return lt(e.getSeconds(),t,2)}function qG(e){var t=e.getDay();return t===0?7:t}function WG(e,t){return lt(_d.count(lo(e)-1,e),t,2)}function sT(e){var t=e.getDay();return t>=4||t===0?Tf(e):Tf.ceil(e)}function HG(e,t){return e=sT(e),lt(Tf.count(lo(e),e)+(lo(e).getDay()===4),t,2)}function GG(e){return e.getDay()}function YG(e,t){return lt(Lm.count(lo(e)-1,e),t,2)}function VG(e,t){return lt(e.getFullYear()%100,t,2)}function XG(e,t){return e=sT(e),lt(e.getFullYear()%100,t,2)}function KG(e,t){return lt(e.getFullYear()%1e4,t,4)}function ZG(e,t){var n=e.getDay();return e=n>=4||n===0?Tf(e):Tf.ceil(e),lt(e.getFullYear()%1e4,t,4)}function JG(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+lt(t/60|0,"0",2)+lt(t%60,"0",2)}function s$(e,t){return lt(e.getUTCDate(),t,2)}function QG(e,t){return lt(e.getUTCHours(),t,2)}function eY(e,t){return lt(e.getUTCHours()%12||12,t,2)}function tY(e,t){return lt(1+eu.count(co(e),e),t,3)}function oT(e,t){return lt(e.getUTCMilliseconds(),t,3)}function nY(e,t){return oT(e,t)+"000"}function rY(e,t){return lt(e.getUTCMonth()+1,t,2)}function iY(e,t){return lt(e.getUTCMinutes(),t,2)}function sY(e,t){return lt(e.getUTCSeconds(),t,2)}function oY(e){var t=e.getUTCDay();return t===0?7:t}function aY(e,t){return lt(wd.count(co(e)-1,e),t,2)}function aT(e){var t=e.getUTCDay();return t>=4||t===0?Nf(e):Nf.ceil(e)}function uY(e,t){return e=aT(e),lt(Nf.count(co(e),e)+(co(e).getUTCDay()===4),t,2)}function lY(e){return e.getUTCDay()}function cY(e,t){return lt(Im.count(co(e)-1,e),t,2)}function fY(e,t){return lt(e.getUTCFullYear()%100,t,2)}function dY(e,t){return e=aT(e),lt(e.getUTCFullYear()%100,t,2)}function hY(e,t){return lt(e.getUTCFullYear()%1e4,t,4)}function pY(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Nf(e):Nf.ceil(e),lt(e.getUTCFullYear()%1e4,t,4)}function gY(){return"+0000"}function o$(){return"%"}function a$(e){return+e}function u$(e){return Math.floor(+e/1e3)}var Mc,uA,uT,lA,lT;mY({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function mY(e){return Mc=rT(e),uA=Mc.format,uT=Mc.parse,lA=Mc.utcFormat,lT=Mc.utcParse,Mc}function Sh(e){const t={};return n=>t[n]||(t[n]=e(n))}function vY(e,t){return n=>{const r=e(n),i=r.indexOf(t);if(i<0)return r;let s=yY(r,i);const o=si;)if(r[s]!=="0"){++s;break}return r.slice(0,s)+o}}function yY(e,t){let n=e.lastIndexOf("e"),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function cT(e){const t=Sh(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(r){const i=Il(r||",");if(i.precision==null){switch(i.precision=12,i.type){case"%":i.precision-=2;break;case"e":i.precision-=1;break}return vY(t(i),t(".1f")(1)[1])}else return t(i)},formatSpan(r,i,s,o){o=Il(o??",f");const a=au(r,i,s),u=Math.max(Math.abs(r),Math.abs(i));let l;if(o.precision==null)switch(o.type){case"s":return isNaN(l=NR(a,u))||(o.precision=l),n(o,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=OR(a,u))||(o.precision=l-(o.type==="e"));break}case"f":case"%":{isNaN(l=TR(a))||(o.precision=l-(o.type==="%")*2);break}}return t(o)}}}let p_;fT();function fT(){return p_=cT({format:Ev,formatPrefix:rA})}function dT(e){return cT(RR(e))}function Pm(e){return arguments.length?p_=dT(e):p_}function l$(e,t,n){n=n||{},ve(n)||K(`Invalid time multi-format specifier: ${n}`);const r=t(Li),i=t(ci),s=t(li),o=t(jr),a=t(on),u=t(Jn),l=t(zr),c=t(In),f=e(n[ys]||".%L"),d=e(n[Li]||":%S"),h=e(n[ci]||"%I:%M"),p=e(n[li]||"%I %p"),g=e(n[jr]||n[Vn]||"%a %d"),m=e(n[on]||"%b %d"),v=e(n[Jn]||"%B"),y=e(n[zr]||"%B"),b=e(n[In]||"%Y");return x=>(r(x)be(r)?t(r):l$(t,Ed,r),utcFormat:r=>be(r)?n(r):l$(n,Ad,r),timeParse:Sh(e.parse),utcParse:Sh(e.utcParse)}}let g_;pT();function pT(){return g_=hT({format:uA,parse:uT,utcFormat:lA,utcParse:lT})}function gT(e){return hT(rT(e))}function dp(e){return arguments.length?g_=gT(e):g_}const m_=(e,t)=>We({},e,t);function mT(e,t){const n=e?dT(e):Pm(),r=t?gT(t):dp();return m_(n,r)}function cA(e,t){const n=arguments.length;return n&&n!==2&&K("defaultLocale expects either zero or two arguments."),n?m_(Pm(e),dp(t)):m_(Pm(),dp())}function bY(){return fT(),pT(),cA()}const xY=/^(data:|([A-Za-z]+:)?\/\/)/,_Y=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,wY=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,c$="file://";function EY(e,t){return n=>({options:n||{},sanitize:SY,load:AY,fileAccess:!1,file:kY(),http:FY(e)})}async function AY(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function SY(e,t){t=We({},this.options,t);const n=this.fileAccess,r={href:null};let i,s,o;const a=_Y.test(e.replace(wY,""));(e==null||typeof e!="string"||!a)&&K("Sanitize failure, invalid URI: "+ce(e));const u=xY.test(e);return(o=t.baseURL)&&!u&&(!e.startsWith("/")&&!o.endsWith("/")&&(e="/"+e),e=o+e),s=(i=e.startsWith(c$))||t.mode==="file"||t.mode!=="http"&&!u&&n,i?e=e.slice(c$.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!s}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+""),r}function kY(e){return CY}async function CY(){K("No file system access.")}function FY(e){return e?async function(t,n){const r=We({},this.options.http,n),i=n&&n.response,s=await e(t,r);return s.ok?He(s[i])?s[i]():s.text():K(s.status+""+s.statusText)}:$Y}async function $Y(){K("No HTTP fetch method available.")}const DY=e=>e!=null&&e===e,MY=e=>e==="true"||e==="false"||e===!0||e===!1,RY=e=>!Number.isNaN(Date.parse(e)),vT=e=>!Number.isNaN(+e)&&!(e instanceof Date),TY=e=>vT(e)&&Number.isInteger(+e),v_={boolean:QE,integer:Xn,number:Xn,date:eA,string:tA,unknown:rr},r0=[MY,TY,vT,RY],NY=["boolean","integer","number","date"];function yT(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=r0.length,i=r0.map((s,o)=>o+1);for(let s=0,o=0,a,u;ss===0?o:s,0)-1]}function bT(e,t){return t.reduce((n,r)=>(n[r]=yT(e,r),n),{})}function f$(e){const t=function(n,r){const i={delimiter:e};return fA(n,r?We(r,i):i)};return t.responseType="text",t}function fA(e,t){return t.header&&(e=t.header.map(ce).join(t.delimiter)+` +`+e),pH(t.delimiter).parse(e+"")}fA.responseType="text";function OY(e){return typeof Buffer=="function"&&He(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function dA(e,t){const n=t&&t.property?Ni(t.property):rr;return ve(e)&&!OY(e)?LY(n(e),t):n(JSON.parse(e))}dA.responseType="json";function LY(e,t){return!Q(e)&&hR(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const IY={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function xT(e,t){let n,r,i,s;return e=dA(e,t),t&&t.feature?(n=yH,i=t.feature):t&&t.mesh?(n=xH,i=t.mesh,s=IY[t.filter]):K("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,s):K("Invalid TopoJSON object: "+i),r&&r.features||[r]}xT.responseType="json";const J0={dsv:fA,csv:f$(","),tsv:f$(" "),json:dA,topojson:xT};function hA(e,t){return arguments.length>1?(J0[e]=t,this):_e(J0,e)?J0[e]:null}function _T(e){const t=hA(e);return t&&t.responseType||"text"}function wT(e,t,n,r){t=t||{};const i=hA(t.type||"json");return i||K("Unknown data format type: "+t.type),e=i(e,t),t.parse&&PY(e,t.parse,n,r),_e(e,"columns")&&delete e.columns,e}function PY(e,t,n,r){if(!e.length)return;const i=dp();n=n||i.timeParse,r=r||i.utcParse;let s=e.columns||Object.keys(e[0]),o,a,u,l,c,f;t==="auto"&&(t=bT(e,s)),s=Object.keys(t);const d=s.map(h=>{const p=t[h];let g,m;if(p&&(p.startsWith("date:")||p.startsWith("utc:")))return g=p.split(/:(.+)?/,2),m=g[1],(m[0]==="'"&&m[m.length-1]==="'"||m[0]==='"'&&m[m.length-1]==='"')&&(m=m.slice(1,-1)),(g[0]==="utc"?r:n)(m);if(!v_[p])throw Error("Illegal format pattern: "+h+":"+p);return v_[p]});for(u=0,c=e.length,f=s.length;u{const s=t(i);return r[s]||(r[s]=1,n.push(i)),n},n.remove=i=>{const s=t(i);if(r[s]){r[s]=0;const o=n.indexOf(i);o>=0&&n.splice(o,1)}return n},n}async function Q0(e,t){try{await t(e)}catch(n){e.error(n)}}const ET=Symbol("vega_id");let BY=1;function Mv(e){return!!(e&&Ne(e))}function Ne(e){return e[ET]}function AT(e,t){return e[ET]=t,e}function ht(e){const t=e===Object(e)?e:{data:e};return Ne(t)?t:AT(t,BY++)}function pA(e){return Rv(e,ht({}))}function Rv(e,t){for(const n in e)t[n]=e[n];return t}function ST(e,t){return AT(t,Ne(e))}function cc(e,t){return e?t?(n,r)=>e(n,r)||Ne(t(n))-Ne(t(r)):(n,r)=>e(n,r)||Ne(n)-Ne(r):null}function kT(e){return e&&e.constructor===fc}function fc(){const e=[],t=[],n=[],r=[],i=[];let s=null,o=!1;return{constructor:fc,insert(a){const u=xe(a),l=u.length;for(let c=0;c{p(y)&&(l[Ne(y)]=-1)});for(f=0,d=e.length;f0&&(v(g,p,h.value),a.modifies(p));for(f=0,d=i.length;f{p(y)&&l[Ne(y)]>0&&v(y,h.field,h.value)}),a.modifies(h.field);if(o)a.mod=t.length||r.length?u.filter(y=>l[Ne(y)]>0):u.slice();else for(m in c)a.mod.push(c[m]);return(s||s==null&&(t.length||r.length))&&a.clean(!0),a}}}const em="_:mod:_";function Tv(){Object.defineProperty(this,em,{writable:!0,value:{}})}Tv.prototype={set(e,t,n,r){const i=this,s=i[e],o=i[em];return t!=null&&t>=0?(s[t]!==n||r)&&(s[t]=n,o[t+":"+e]=-1,o[e]=-1):(s!==n||r)&&(i[e]=n,o[e]=Q(n)?1+n.length:-1),i},modified(e,t){const n=this[em];if(arguments.length){if(Q(e)){for(let r=0;r=0?t+1{h instanceof kt?(h!==this&&(t&&h.targets().add(this),s.push(h)),i.push({op:h,name:f,index:d})):r.set(f,d,h)};for(o in e)if(a=e[o],o===jY)xe(a).forEach(f=>{f instanceof kt?f!==this&&(f.targets().add(this),s.push(f)):K("Pulse parameters must be operator instances.")}),this.source=a;else if(Q(a))for(r.set(o,-1,Array(u=a.length)),l=0;l{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=$a();return this.targets().add($a(null,null,KE(e,n=>{const r=n.dataflow;t.receive(n),r&&r.run&&r.run()}))),t},between(e,t){let n=!1;return e.targets().add($a(null,null,()=>n=!0)),t.targets().add($a(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Oi,this._targets=null}};function VY(e,t,n,r){const i=this,s=$a(n,r),o=function(l){l.dataflow=i;try{s.receive(l)}catch(c){i.error(c)}finally{i.run()}};let a;typeof e=="string"&&typeof document<"u"?a=document.querySelectorAll(e):a=xe(e);const u=a.length;for(let l=0;lt=r);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}const eV={skip:!0};function tV(e,t,n,r,i){return(e instanceof kt?rV:nV)(this,e,t,n,r,i),this}function nV(e,t,n,r,i,s){const o=We({},s,eV);let a,u;He(n)||(n=ir(n)),r===void 0?a=l=>e.touch(n(l)):He(r)?(u=new kt(null,r,i,!1),a=l=>{u.evaluate(l);const c=n(l),f=u.value;kT(f)?e.pulse(c,f,s):e.update(c,f,o)}):a=l=>e.update(n(l),r,o),t.apply(a)}function rV(e,t,n,r,i,s){if(r===void 0)t.targets().add(n);else{const o=s||{},a=new kt(null,iV(n,r),i,!1);a.modified(o.force),a.rank=t.rank,t.targets().add(a),n&&(a.skip(!0),a.value=n.value,a.targets().add(n),e.connect(n,[a]))}}function iV(e,t){return t=He(t)?t:ir(t),e?function(n,r){const i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function sV(e){e.rank=++this._rank}function oV(e){const t=[e];let n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&K("Cycle detected in dataflow graph.")}const Bm={},js=1,Ra=2,Po=4,aV=js|Ra,h$=js|Po,Rc=js|Ra|Po,p$=8,Jd=16,g$=32,m$=64;function tu(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function e2(e,t){const n=[];return Ma(e,t,r=>n.push(r)),n}function v$(e,t){const n={};return e.visit(t,r=>{n[Ne(r)]=1}),r=>n[Ne(r)]?null:r}function i0(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}tu.prototype={StopPropagation:Bm,ADD:js,REM:Ra,MOD:Po,ADD_REM:aV,ADD_MOD:h$,ALL:Rc,REFLOW:p$,SOURCE:Jd,NO_SOURCE:g$,NO_FIELDS:m$,fork(e){return new tu(this.dataflow).init(this,e)},clone(){const e=this.fork(Rc);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(Rc|Jd)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new tu(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&m$)&&(n.fields=e.fields),t&js?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Ra?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Po?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&g$?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||Rc;return t&js&&this.add.length||t&Ra&&this.rem.length||t&Po&&this.mod.length},reflow(e){if(e)return this.fork(Rc).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Po,v$(this,js))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return Q(e)?e.forEach(n=>t[n]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return(t||this.mod.length)&&n?arguments.length?Q(e)?e.some(r=>n[r]):n[e]:!!n:!1},filter(e,t){const n=this;return e&js&&(n.addF=i0(n.addF,t)),e&Ra&&(n.remF=i0(n.remF,t)),e&Po&&(n.modF=i0(n.modF,t)),e&Jd&&(n.srcF=i0(n.srcF,t)),n},materialize(e){e=e||Rc;const t=this;return e&js&&t.addF&&(t.add=e2(t.add,t.addF),t.addF=null),e&Ra&&t.remF&&(t.rem=e2(t.rem,t.remF),t.remF=null),e&Po&&t.modF&&(t.mod=e2(t.mod,t.modF),t.modF=null),e&Jd&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,r=t;if(e&Jd)return Ma(n.source,n.srcF,r),n;e&js&&Ma(n.add,n.addF,r),e&Ra&&Ma(n.rem,n.remF,r),e&Po&&Ma(n.mod,n.modF,r);const i=n.source;if(e&p$&&i){const s=n.add.length+n.mod.length;s===i.length||(s?Ma(i,v$(n,h$),r):Ma(i,n.srcF,r))}return n}};function gA(e,t,n,r){const i=this;let s=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(const o of n)if(o.stamp===t){if(o.fields){const a=i.fields||(i.fields={});for(const u in o.fields)a[u]=1}o.changed(i.ADD)&&(s|=i.ADD),o.changed(i.REM)&&(s|=i.REM),o.changed(i.MOD)&&(s|=i.MOD)}this.changes=s}pe(gA,tu,{fork(e){const t=new tu(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,n=>t.add.push(n)),e&t.REM&&this.visit(t.REM,n=>t.rem.push(n)),e&t.MOD&&this.visit(t.MOD,n=>t.mod.push(n))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?Q(e)?e.some(r=>n[r]):n[e]:0},filter(){K("MultiPulse does not support filtering.")},materialize(){K("MultiPulse does not support materialization.")},visit(e,t){const n=this,r=n.pulses,i=r.length;let s=0;if(e&n.SOURCE)for(;sr._enqueue(c,!0)),r._touched=Dv(tg);let o=0,a,u,l;try{for(;r._heap.size()>0;){if(a=r._heap.pop(),a.rank!==a.qrank){r._enqueue(a,!0);continue}u=a.run(r._getPulse(a,e)),u.then?u=await u:u.async&&(i.push(u.async),u=Bm),u!==Bm&&a._targets&&a._targets.forEach(c=>r._enqueue(c)),++o}}catch(c){r._heap.clear(),l=c}if(r._input={},r._pulse=null,r.debug(`Pulse ${s}: ${o} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){const c=r._postrun.sort((f,d)=>d.priority-f.priority);r._postrun=[];for(let f=0;fr.runAsync(null,()=>{c.forEach(f=>{try{f(r)}catch(d){r.error(d)}})})),r}async function lV(e,t,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function cV(e,t,n){return this._pulse?CT(this):(this.evaluate(e,t,n),this)}function fV(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(r){this.error(r)}}function CT(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function dV(e,t){const n=e.stampi.pulse),t):this._input[e.id]||pV(this._pulse,n&&n.pulse)}function pV(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==Bm&&(e.source=t.source),e)}const mA={skip:!1,force:!1};function gV(e,t){const n=t||mA;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function mV(e,t,n){const r=n||mA;return(e.set(t)||r.force)&&this.touch(e,r),this}function vV(e,t,n){this.touch(e,n||mA);const r=new tu(this,this._clock+(this._pulse?0:1)),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function yV(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),FT(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let r;return t.length?(r=t[0],t[0]=n,bV(t,0,e)):r=n,r}}}function FT(e,t,n,r){let i,s;const o=e[n];for(;n>t;){if(s=n-1>>1,i=e[s],r(o,i)<0){e[n]=i,n=s;continue}break}return e[n]=o}function bV(e,t,n){const r=t,i=e.length,s=e[t];let o=(t<<1)+1,a;for(;o=0&&(o=a),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=s,FT(e,r,t,n)}function sf(){this.logger(HE()),this.logLevel(qE),this._clock=0,this._rank=0,this._locale=cA();try{this._loader=$v()}catch{}this._touched=Dv(tg),this._input={},this._pulse=null,this._heap=yV((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Qd(e){return function(){return this._log[e].apply(this,arguments)}}sf.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Qd("error"),warn:Qd("warn"),info:Qd("info"),debug:Qd("debug"),logLevel:Qd("level"),cleanThreshold:1e4,add:HY,connect:GY,rank:sV,rerank:oV,pulse:vV,touch:gV,update:mV,changeset:fc,ingest:KY,parse:XY,preload:JY,request:ZY,events:VY,on:tV,evaluate:uV,run:cV,runAsync:lV,runAfter:fV,_enqueue:dV,_getPulse:hV};function G(e,t){kt.call(this,e,null,t)}pe(G,kt,{run(e){if(e.stampthis.pulse=n):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Lf={};function $T(e){const t=DT(e);return t&&t.Definition||null}function DT(e){return e=e&&e.toLowerCase(),_e(Lf,e)?Lf[e]:null}function*MT(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==""&&(r=+r)>=r&&(yield r)}}function vA(e,t,n){const r=Float64Array.from(MT(e,n));return r.sort(Qo),t.map(i=>FR(r,i))}function yA(e,t){return vA(e,[.25,.5,.75],t)}function bA(e,t){const n=e.length,r=FH(e,t),i=yA(e,t),s=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,s)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function RT(e){const t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2];let s=e.extent[0],o=e.extent[1],a,u,l,c,f,d;const h=e.span||o-s||Math.abs(s)||1;if(e.step)a=e.step;else if(e.steps){for(c=h/t,f=0,d=e.steps.length;ft;)a*=n;for(f=0,d=i.length;f=l&&h/c<=t&&(a=c)}c=Math.log(a);const p=c>=0?0:~~(-c/r)+1,g=Math.pow(n,-p-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(s/a+g)*a,s=sd);const i=e.length,s=new Float64Array(i);let o=0,a=1,u=r(e[0]),l=u,c=u+t,f;for(;a=c){for(l=(u+l)/2;o>1);oi;)e[o--]=e[r]}r=i,i=s}return e}function wV(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function EV(e,t){t==null&&(t=e,e=0);let n,r,i;const s={min(o){return arguments.length?(n=o||0,i=r-n,s):n},max(o){return arguments.length?(r=o||0,i=r-n,s):r},sample(){return n+Math.floor(i*Ii())},pdf(o){return o===Math.floor(o)&&o>=n&&o=r?1:(a-n+1)/i},icdf(o){return o>=0&&o<=1?n-1+Math.floor(o*i):NaN}};return s.min(e).max(t)}const OT=Math.sqrt(2*Math.PI),AV=Math.SQRT2;let eh=NaN;function Ov(e,t){e=e||0,t=t??1;let n=0,r=0,i,s;if(eh===eh)n=eh,eh=NaN;else{do n=Ii()*2-1,r=Ii()*2-1,i=n*n+r*r;while(i===0||i>1);s=Math.sqrt(-2*Math.log(i)/i),n*=s,eh=r*s}return e+n*t}function xA(e,t,n){n=n??1;const r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*OT)}function Lv(e,t,n){t=t||0,n=n??1;const r=(e-t)/n,i=Math.abs(r);let s;if(i>37)s=0;else{const o=Math.exp(-i*i/2);let a;i<7.07106781186547?(a=.0352624965998911*i+.700383064443688,a=a*i+6.37396220353165,a=a*i+33.912866078383,a=a*i+112.079291497871,a=a*i+221.213596169931,a=a*i+220.206867912376,s=o*a,a=.0883883476483184*i+1.75566716318264,a=a*i+16.064177579207,a=a*i+86.7807322029461,a=a*i+296.564248779674,a=a*i+637.333633378831,a=a*i+793.826512519948,a=a*i+440.413735824752,s=s/a):(a=i+.65,a=i+4/a,a=i+3/a,a=i+2/a,a=i+1/a,s=o/a/2.506628274631)}return r>0?1-s:s}function Iv(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*AV*SV(2*e-1)}function SV(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function _A(e,t){let n,r;const i={mean(s){return arguments.length?(n=s||0,i):n},stdev(s){return arguments.length?(r=s??1,i):r},sample:()=>Ov(n,r),pdf:s=>xA(s,n,r),cdf:s=>Lv(s,n,r),icdf:s=>Iv(s,n,r)};return i.mean(e).stdev(t)}function wA(e,t){const n=_A();let r=0;const i={data(s){return arguments.length?(e=s,r=s?s.length:0,i.bandwidth(t)):e},bandwidth(s){return arguments.length?(t=s,!t&&e&&(t=bA(e)),i):t},sample(){return e[~~(Ii()*r)]+t*n.sample()},pdf(s){let o=0,a=0;for(;aEA(n,r),pdf:s=>AA(s,n,r),cdf:s=>SA(s,n,r),icdf:s=>kA(s,n,r)};return i.mean(e).stdev(t)}function IT(e,t){let n=0,r;function i(o){const a=[];let u=0,l;for(l=0;l=t&&e<=n?1/(n-t):0}function $A(e,t,n){return n==null&&(n=t??1,t=0),en?1:(e-t)/(n-t)}function DA(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function PT(e,t){let n,r;const i={min(s){return arguments.length?(n=s||0,i):n},max(s){return arguments.length?(r=s??1,i):r},sample:()=>CA(n,r),pdf:s=>FA(s,n,r),cdf:s=>$A(s,n,r),icdf:s=>DA(s,n,r)};return t==null&&(t=e??1,e=0),i.min(e).max(t)}function MA(e,t,n){let r=0,i=0;for(const s of e){const o=n(s);t(s)==null||o==null||isNaN(o)||(r+=(o-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function rg(e,t,n,r){const i=r-e*e,s=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-s*e,s]}function Pv(e,t,n,r){e=e.filter(h=>{let p=t(h),g=n(h);return p!=null&&(p=+p)>=p&&g!=null&&(g=+g)>=g}),r&&e.sort((h,p)=>t(h)-t(p));const i=e.length,s=new Float64Array(i),o=new Float64Array(i);let a=0,u=0,l=0,c,f,d;for(d of e)s[a]=c=+t(d),o[a]=f=+n(d),++a,u+=(c-u)/a,l+=(f-l)/a;for(a=0;a=s&&o!=null&&(o=+o)>=o&&r(s,o,++i)}function Sd(e,t,n,r,i){let s=0,o=0;return ig(e,t,n,(a,u)=>{const l=u-i(a),c=u-r;s+=l*l,o+=c*c}),1-s/o}function RA(e,t,n){let r=0,i=0,s=0,o=0,a=0;ig(e,t,n,(c,f)=>{++a,r+=(c-r)/a,i+=(f-i)/a,s+=(c*f-s)/a,o+=(c*c-o)/a});const u=rg(r,i,s,o),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Sd(e,t,n,i,l)}}function BT(e,t,n){let r=0,i=0,s=0,o=0,a=0;ig(e,t,n,(c,f)=>{++a,c=Math.log(c),r+=(c-r)/a,i+=(f-i)/a,s+=(c*f-s)/a,o+=(c*c-o)/a});const u=rg(r,i,s,o),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Sd(e,t,n,i,l)}}function zT(e,t,n){const[r,i,s,o]=Pv(e,t,n);let a=0,u=0,l=0,c=0,f=0,d,h,p;ig(e,t,n,(y,b)=>{d=r[f++],h=Math.log(b),p=d*b,a+=(b*h-a)/f,u+=(p-u)/f,l+=(p*h-l)/f,c+=(d*p-c)/f});const[g,m]=rg(u/o,a/o,l/o,c/o),v=y=>Math.exp(g+m*(y-s));return{coef:[Math.exp(g-m*s),m],predict:v,rSquared:Sd(e,t,n,o,v)}}function jT(e,t,n){let r=0,i=0,s=0,o=0,a=0,u=0;ig(e,t,n,(f,d)=>{const h=Math.log(f),p=Math.log(d);++u,r+=(h-r)/u,i+=(p-i)/u,s+=(h*p-s)/u,o+=(h*h-o)/u,a+=(d-a)/u});const l=rg(r,i,s,o),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Sd(e,t,n,a,c)}}function TA(e,t,n){const[r,i,s,o]=Pv(e,t,n),a=r.length;let u=0,l=0,c=0,f=0,d=0,h,p,g,m;for(h=0;h(E=E-s,b*E*E+x*E+_+o);return{coef:[_-x*s+b*s*s+o,x-2*b*s,b],predict:A,rSquared:Sd(e,t,n,o,A)}}function UT(e,t,n,r){if(r===0)return MA(e,t,n);if(r===1)return RA(e,t,n);if(r===2)return TA(e,t,n);const[i,s,o,a]=Pv(e,t,n),u=i.length,l=[],c=[],f=r+1;let d,h,p,g,m;for(d=0;d{b-=o;let x=a+v[0]+v[1]*b+v[2]*b*b;for(d=3;d=0;--s)for(a=t[s],u=1,i[s]+=a,o=1;o<=s;++o)u*=(s+1-o)/o,i[s-o]+=a*Math.pow(n,o)*u;return i[0]+=r,i}function CV(e){const t=e.length-1,n=[];let r,i,s,o,a;for(r=0;rMath.abs(e[r][o])&&(o=i);for(s=r;s=r;s--)e[s][i]-=e[s][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(a=0,s=i+1;si[b]-v?y:b;let _=0,A=0,E=0,S=0,k=0;const F=1/Math.abs(i[x]-v||1);for(let T=y;T<=b;++T){const $=i[T],C=s[T],R=FV(Math.abs(v-$)*F)*d[T],L=$*R;_+=R,A+=L,E+=C*R,S+=C*L,k+=$*L}const[D,M]=rg(A/_,E/_,S/_,k/_);c[m]=D+M*v,f[m]=Math.abs(s[m]-c[m]),$V(i,m+1,p)}if(h===y$)break;const g=$R(f);if(Math.abs(g)=1?b$:(y=1-v*v)*y}return DV(i,c,o,a)}function FV(e){return(e=1-e*e*e)*e*e}function $V(e,t,n){const r=e[t];let i=n[0],s=n[1]+1;if(!(s>=e.length))for(;t>i&&e[s]-r<=r-e[i];)n[0]=++i,n[1]=s,++s}function DV(e,t,n,r){const i=e.length,s=[];let o=0,a=0,u=[],l;for(;o[g,e(g)],s=t[0],o=t[1],a=o-s,u=a/r,l=[i(s)],c=[];if(n===r){for(let g=1;g0;)c.push(i(s+g/n*a))}let f=l[0],d=c[c.length-1];const h=1/a,p=RV(f[1],c);for(;d;){const g=i((f[0]+d[0])/2);g[0]-f[0]>=u&&TV(f,g,d,h,p)>MV?c.push(g):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function RV(e,t){let n=e,r=e;const i=t.length;for(let s=0;sr&&(r=o)}return 1/(r-n)}function TV(e,t,n,r,i){const s=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),o=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(s-o)}function NV(e){return t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r{},OV={init:t2,add:t2,rem:t2,idx:0},hp={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},sg=Object.keys(hp).filter(e=>e!=="__count__");function LV(e,t){return(n,r)=>We({name:e,aggregate_param:r,out:n||e},OV,t)}[...sg,"__count__"].forEach(e=>{hp[e]=LV(e,hp[e])});function HT(e,t,n){return hp[e](n,t)}function GT(e,t){return e.idx-t.idx}function IV(e){const t={};e.forEach(r=>t[r.name]=r);const n=r=>{r.req&&r.req.forEach(i=>{t[i]||n(t[i]=hp[i]())})};return e.forEach(n),Object.values(t).sort(GT)}function PV(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function BV(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function zV(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function jV(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function YT(e,t){const n=t||rr,r=IV(e),i=e.slice().sort(GT);function s(o){this._ops=r,this._out=i,this.cell=o,this.init()}return s.prototype.init=PV,s.prototype.add=BV,s.prototype.rem=zV,s.prototype.set=jV,s.prototype.get=n,s.fields=e.map(o=>o.out),s}function NA(e){this._key=e?Ni(e):Ne,this.reset()}const jn=NA.prototype;jn.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};jn.add=function(e){this._add.push(e)};jn.rem=function(e){this._rem.push(e)};jn.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,s=Array(r-i),o={};let a,u,l;for(a=0;a=0;)s=e(t[r])+"",_e(n,s)||(n[s]=1,++i);return i};jn.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=fR(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext};jn.argmin=function(e){return this.extent(e)[0]||{}};jn.argmax=function(e){return this.extent(e)[1]||{}};jn.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0};jn.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0};jn.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=yA(this.values(),e),this._get=e),this._q};jn.q1=function(e){return this.quartile(e)[0]};jn.q2=function(e){return this.quartile(e)[1]};jn.q3=function(e){return this.quartile(e)[2]};jn.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=TT(this.values(),1e3,.05,e),this._get=e),this._ci};jn.ci0=function(e){return this.ci(e)[0]};jn.ci1=function(e){return this.ci(e)[1]};function uu(e){G.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}uu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:sg},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};pe(uu,G,{transform(e,t){const n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,s=>n.add(s))):(n.value=n.value||n.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){const e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function s(a){let u,l,c,f;for(u in a)for(c=a[u].tuple,l=0;l{const b=Wt(y);return i(y),n.push(b),b}),this.cellkey=e.key?e.key:y_(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const s=e.fields||[null],o=e.ops||["count"],a=e.aggregate_params||[null],u=e.as||[],l=s.length,c={};let f,d,h,p,g,m,v;for(l!==o.length&&K("Unmatched number of fields and aggregate ops."),v=0;vYT(y,y.field)),Object.create(null)},cellkey:y_(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{const f=r(c);c[a]=f,c[u]=f==null?null:i+s*(1+(f-i)/s)}:c=>c[a]=r(c)),t.modifies(n?o:a)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=RT(e),r=n.step;let i=n.start,s=i+Math.ceil((n.stop-i)/r)*r,o,a;(o=e.anchor)!=null&&(a=o-(i+r*Math.floor((o-i)/r)),i+=a,s+=a);const u=function(l){let c=Xn(t(l));return c==null?null:cs?1/0:(c=Math.max(i,Math.min(c,s-r)),i+r*Math.floor(UV+(c-i)/r))};return u.start=i,u.stop=n.stop,u.step=r,this.value=Gr(u,Zn(t),e.name||"bin_"+Wt(t))}});function VT(e,t,n){const r=e;let i=t||[],s=n||[],o={},a=0;return{add:u=>s.push(u),remove:u=>o[r(u)]=++a,size:()=>i.length,data:(u,l)=>(a&&(i=i.filter(c=>!o[r(c)]),o={},a=0),l&&u&&i.sort(u),s.length&&(i=u?mR(u,i,s.sort(u)):i.concat(s),s=[]),i)}}function LA(e){G.call(this,[],e)}LA.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};pe(LA,G,{transform(e,t){const n=t.fork(t.ALL),r=VT(Ne,this.value,n.materialize(n.ADD).add),i=e.sort,s=t.changed()||i&&(e.modified("sort")||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(s),this.value=n.source=r.data(cc(i),s),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function XT(e){kt.call(this,null,qV,e)}pe(XT,kt);function qV(e){return this.value&&!e.modified()?this.value:XE(e.fields,e.orders)}function IA(e){G.call(this,null,e)}IA.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function WV(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}pe(IA,G,{transform(e,t){const n=f=>d=>{for(var h=WV(a(d),e.case,s)||[],p,g=0,m=h.length;gi[f]=1+(i[f]||0)),c=n(f=>i[f]-=1);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,r=this._tuples||(this._tuples={}),i=t[0],s=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS);let a,u,l;for(a in n)u=r[a],l=n[a]||0,!u&&l?(r[a]=u=ht({}),u[i]=a,u[s]=l,o.add.push(u)):l===0?(u&&o.rem.push(u),n[a]=null,r[a]=null):u[s]!==l&&(u[s]=l,o.mod.push(u));return o.modifies(t)}});function PA(e){G.call(this,null,e)}PA.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};pe(PA,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.as||["a","b"],i=r[0],s=r[1],o=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let a=this.value;return o?(a&&(n.rem=a),a=t.materialize(t.SOURCE).source,n.add=this.value=HV(a,i,s,e.filter||Oi)):n.mod=a,n.source=this.value,n.modifies(r)}});function HV(e,t,n,r){for(var i=[],s={},o=e.length,a=0,u,l;aKT(s,t))):typeof r[i]===_$&&r[i](e[i]);return r}function BA(e){G.call(this,null,e)}const ZT=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],VV={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ZT},{name:"weights",type:"number",array:!0}]};BA.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:ZT.concat(VV)},{name:"as",type:"string",array:!0,default:["value","density"]}]};pe(BA,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=KT(e.distribution,XV(t)),i=e.steps||e.minsteps||25,s=e.steps||e.maxsteps||200;let o=e.method||"pdf";o!=="pdf"&&o!=="cdf"&&K("Invalid density method: "+o),!e.extent&&!r.data&&K("Missing density extent parameter."),o=r[o];const a=e.as||["value","density"],u=e.extent||uo(r.data()),l=Bv(o,u,i,s).map(c=>{const f={};return f[a[0]]=c[0],f[a[1]]=c[1],ht(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function XV(e){return()=>e.materialize(e.SOURCE).source}function JT(e,t){return e?e.map((n,r)=>t[r]||Wt(n)):null}function zA(e,t,n){const r=[],i=f=>f(u);let s,o,a,u,l,c;if(t==null)r.push(e.map(n));else for(s={},o=0,a=e.length;ong(uo(e,t))/30;pe(jA,G,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,r=zA(t.source,e.groupby,rr),i=e.smooth||!1,s=e.field,o=e.step||KV(n,s),a=cc((p,g)=>s(p)-s(g)),u=e.as||QT,l=r.length;let c=1/0,f=-1/0,d=0,h;for(;df&&(f=g),p[++h][u]=g}return this.value={start:c,stop:f,step:o},t.reflow(!0).modifies(u)}});function eN(e){kt.call(this,null,ZV,e),this.modified(!0)}pe(eN,kt);function ZV(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Gr(n=>t(n,e),Zn(t),Wt(t))}function UA(e){G.call(this,[void 0,void 0],e)}UA.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};pe(UA,G,{transform(e,t){const n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified("field");let s=n[0],o=n[1];if((i||s==null)&&(s=1/0,o=-1/0),t.visit(i?t.SOURCE:t.ADD,a=>{const u=Xn(r(a));u!=null&&(uo&&(o=u))}),!Number.isFinite(s)||!Number.isFinite(o)){let a=Wt(r);a&&(a=` for field "${a}"`),t.dataflow.warn(`Infinite extent${a}: [${s}, ${o}]`),s=o=void 0}this.value=[s,o]}});function qA(e,t){kt.call(this,e),this.parent=t,this.count=0}pe(qA,kt,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function zv(e){G.call(this,{},e),this._keys=bd();const t=this._targets=[];t.active=0,t.forEach=n=>{for(let r=0,i=t.active;rr&&r.count>0);this.initTargets(n)}},initTargets(e){const t=this._targets,n=t.length,r=e?e.length:0;let i=0;for(;ithis.subflow(u,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,u=>{const l=Ne(u),c=s.get(l);c!==void 0&&(s.delete(l),a(c).rem(u))}),t.visit(t.ADD,u=>{const l=r(u);s.set(Ne(u),l),a(l).add(u)}),o||t.modified(r.fields)?t.visit(t.MOD,u=>{const l=Ne(u),c=s.get(l),f=r(u);c===f?a(f).mod(u):(s.set(l,f),a(c).rem(u),a(f).add(u))}):t.changed(t.MOD)&&t.visit(t.MOD,u=>{a(s.get(Ne(u))).mod(u)}),o&&t.visit(t.REFLOW,u=>{const l=Ne(u),c=s.get(l),f=r(u);c!==f&&(s.set(l,f),a(c).rem(u),a(f).add(u))}),t.clean()?n.runAfter(()=>{this.clean(),s.clean()}):s.empty>n.cleanThreshold&&n.runAfter(s.clean),t}});function tN(e){kt.call(this,null,JV,e)}pe(tN,kt);function JV(e){return this.value&&!e.modified()?this.value:Q(e.name)?xe(e.name).map(t=>Ni(t)):Ni(e.name,e.as)}function WA(e){G.call(this,bd(),e)}WA.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};pe(WA,G,{transform(e,t){const n=t.dataflow,r=this.value,i=t.fork(),s=i.add,o=i.rem,a=i.mod,u=e.expr;let l=!0;t.visit(t.REM,f=>{const d=Ne(f);r.has(d)?r.delete(d):o.push(f)}),t.visit(t.ADD,f=>{u(f,e)?s.push(f):r.set(Ne(f),1)});function c(f){const d=Ne(f),h=u(f,e),p=r.get(d);h&&p?(r.delete(d),s.push(f)):!h&&!p?(r.set(d,1),o.push(f)):l&&h&&!p&&a.push(f)}return t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}});function HA(e){G.call(this,[],e)}HA.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]};pe(HA,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=JT(r,e.as||[]),s=e.index||null,o=i.length;return n.rem=this.value,t.visit(t.SOURCE,a=>{const u=r.map(p=>p(a)),l=u.reduce((p,g)=>Math.max(p,g.length),0);let c=0,f,d,h;for(;c{for(let c=0,f;co[r]=n(o,e))}});function nN(e){G.call(this,[],e)}pe(nN,G,{transform(e,t){const n=t.fork(t.ALL),r=e.generator;let i=this.value,s=e.size-i.length,o,a,u;if(s>0){for(o=[];--s>=0;)o.push(u=ht(r(e))),i.push(u);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else a=i.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(a):a,i=i.slice(-s);return n.source=this.value=i,n}});const s0={value:"value",median:$R,mean:NH,min:a_,max:bl},QV=[];function VA(e){G.call(this,[],e)}VA.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function eX(e){var t=e.method||s0.value,n;if(s0[t]==null)K("Unrecognized imputation method: "+t);else return t===s0.value?(n=e.value!==void 0?e.value:0,()=>n):s0[t]}function tX(e){const t=e.field;return n=>n?t(n):NaN}pe(VA,G,{transform(e,t){var n=t.fork(t.ALL),r=eX(e),i=tX(e),s=Wt(e.field),o=Wt(e.key),a=(e.groupby||[]).map(Wt),u=nX(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,h,p,g,m,v,y,b,x,_;for(m=0,b=u.length;mv(m),s=[],o=r?r.slice():[],a={},u={},l,c,f,d,h,p,g,m;for(o.forEach((v,y)=>a[v]=y+1),d=0,g=e.length;dn.add(s))):(i=n.value=n.value||this.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),n.changes(),t.visit(t.SOURCE,s=>{We(s,i[n.cellkey(s)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,r;for(n=0,r=this._alen;n{const p=wA(h,o)[a],g=e.counts?h.length:1,m=c||uo(h);Bv(p,m,f,d).forEach(v=>{const y={};for(let b=0;b(this._pending=xe(i.data),s=>s.touch(this)))}:n.request(e.url,e.format).then(r=>n2(this,t,xe(r.data)))}});function iX(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function n2(e,t,n){n.forEach(ht);const r=t.fork(t.NO_FIELDS&t.NO_SOURCE);return r.rem=e.value,e.value=r.source=r.add=n,e._pending=null,r.rem.length&&r.clean(!0),r}function ZA(e){G.call(this,{},e)}ZA.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]};pe(ZA,G,{transform(e,t){const n=e.fields,r=e.index,i=e.values,s=e.default==null?null:e.default,o=e.modified(),a=n.length;let u=o?t.SOURCE:t.ADD,l=t,c=e.as,f,d,h;return i?(d=i.length,a>1&&!c&&K('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==a*d&&K('The "as" parameter has too few output field names.'),c=c||i.map(Wt),f=function(p){for(var g=0,m=0,v,y;gt.modified(p.fields)),u|=h?t.MOD:0),t.visit(u,f),l.modifies(c)}});function sN(e){kt.call(this,null,sX,e)}pe(sN,kt);function sX(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let r=1/0,i=-1/0,s,o;for(s=0;si&&(i=o[1]);return[r,i]}function oN(e){kt.call(this,null,oX,e)}pe(oN,kt);function oX(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function aN(e){G.call(this,null,e)}pe(aN,G,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function JA(e){uu.call(this,e)}JA.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:sg,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};pe(JA,uu,{_transform:uu.prototype.transform,transform(e,t){return this._transform(aX(e,t),t)}});function aX(e,t){const n=e.field,r=e.value,i=(e.op==="count"?"__count__":e.op)||"sum",s=Zn(n).concat(Zn(r)),o=lX(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>i),fields:o.map(a=>uX(a,n,r,s)),as:o.map(a=>a+""),modified:e.modified.bind(e)}}function uX(e,t,n,r){return Gr(i=>t(i)===e?n(i):NaN,r,e+"")}function lX(e,t,n){const r={},i=[];return n.visit(n.SOURCE,s=>{const o=e(s);r[o]||(r[o]=1,i.push(o))}),i.sort(yd),t?i.slice(0,t):i}function uN(e){zv.call(this,e)}pe(uN,zv,{transform(e,t){const n=e.subflow,r=e.field,i=s=>this.subflow(Ne(s),n,t,s);return(e.modified("field")||r&&t.modified(Zn(r)))&&K("PreFacet does not support field modification."),this.initTargets(),r?(t.visit(t.MOD,s=>{const o=i(s);r(s).forEach(a=>o.mod(a))}),t.visit(t.ADD,s=>{const o=i(s);r(s).forEach(a=>o.add(ht(a)))}),t.visit(t.REM,s=>{const o=i(s);r(s).forEach(a=>o.rem(a))})):(t.visit(t.MOD,s=>i(s).mod(s)),t.visit(t.ADD,s=>i(s).add(s)),t.visit(t.REM,s=>i(s).rem(s))),t.clean()&&t.runAfter(()=>this.clean()),t}});function QA(e){G.call(this,null,e)}QA.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};pe(QA,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=JT(e.fields,e.as||[]),s=r?(a,u)=>cX(a,u,r,i):Rv;let o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,a=>{const u=Ne(a);n.rem.push(o[u]),o[u]=null}),t.visit(t.ADD,a=>{const u=s(a,ht({}));o[Ne(a)]=u,n.add.push(u)}),t.visit(t.MOD,a=>{n.mod.push(s(a,o[Ne(a)]))}),n}});function cX(e,t,n,r){for(let i=0,s=n.length;i{const d=vA(f,l);for(let h=0;h{const s=Ne(i);n.rem.push(r[s]),r[s]=null}),t.visit(t.ADD,i=>{const s=pA(i);r[Ne(i)]=s,n.add.push(s)}),t.visit(t.MOD,i=>{const s=r[Ne(i)];for(const o in i)s[o]=i[o],n.modifies(o);n.mod.push(s)})),n}});function tS(e){G.call(this,[],e),this.count=0}tS.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};pe(tS,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.modified("size"),i=e.size,s=this.value.reduce((c,f)=>(c[Ne(f)]=1,c),{});let o=this.value,a=this.count,u=0;function l(c){let f,d;o.length=u&&(f=o[d],s[Ne(f)]&&n.rem.push(f),o[d]=c)),++a}if(t.rem.length&&(t.visit(t.REM,c=>{const f=Ne(c);s[f]&&(s[f]=-1,n.rem.push(c)),--a}),o=o.filter(c=>s[Ne(c)]!==-1)),(t.rem.length||r)&&o.length{s[Ne(c)]||l(c)}),u=-1),r&&o.length>i){const c=o.length-i;for(let f=0;f{s[Ne(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=o.filter(c=>!s[Ne(c)])),this.count=a,this.value=n.source=o,n}});function nS(e){G.call(this,null,e)}nS.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]};pe(nS,G,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),r=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=ni(e.start,e.stop,e.step||1).map(i=>{const s={};return s[r]=i,ht(s)}),n.add=t.add.concat(this.value),n}});function fN(e){G.call(this,null,e),this.modified(!0)}pe(fN,G,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function rS(e){G.call(this,null,e)}const dN=["unit0","unit1"];rS.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:sA,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:dN}]};pe(rS,G,{transform(e,t){const n=e.field,r=e.interval!==!1,i=e.timezone==="utc",s=this._floor(e,t),o=(i?Ad:Ed)(s.unit).offset,a=e.as||dN,u=a[0],l=a[1],c=s.step;let f=s.start||1/0,d=s.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(Zn(n)))&&(t=t.reflow(!0),h=t.SOURCE,f=1/0,d=-1/0),t.visit(h,p=>{const g=n(p);let m,v;g==null?(p[u]=null,r&&(p[l]=null)):(p[u]=m=v=s(g),r&&(p[l]=v=o(m,c)),md&&(d=v))}),s.start=f,s.stop=d,t.modifies(r?a:u)},_floor(e,t){const n=e.timezone==="utc",{units:r,step:i}=e.units?{units:e.units,step:e.step||1}:nT({extent:e.extent||uo(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),s=oA(r),o=this.value||{},a=(n?YR:GR)(s,i);return a.unit=nt(s),a.units=s,a.step=i,a.start=o.start,a.stop=o.stop,this.value=a}});function hN(e){G.call(this,bd(),e)}pe(hN,G,{transform(e,t){const n=t.dataflow,r=e.field,i=this.value,s=a=>i.set(r(a),a);let o=!0;return e.modified("field")||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,s)):t.changed()?(t.visit(t.REM,a=>i.delete(r(a))),t.visit(t.ADD,s)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}});function pN(e){G.call(this,null,e)}pe(pN,G,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(cc(e.sort)):t.source).map(e.field))}});function dX(e,t,n,r){const i=pp[e](t,n);return{init:i.init||La,update:function(s,o){o[r]=i.next(s)}}}const pp={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){const e=pp.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,r=t.compare;let i=t.index;if(e0||K("ntile num must be greater than zero.");const n=pp.cume_dist(),r=n.next;return{init:n.init,next:i=>Math.ceil(t*r(i))}},lag:function(e,t){return t=+t||1,{next:n=>{const r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const r=n.index+t,i=n.data;return re(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||K("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(t-1);return rt=null,next:n=>{const r=e(n.data[n.index]);return r!=null?t=r:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{const i=r.data;return r.index<=n?t:(n=hX(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}};function hX(e,t,n){for(let r=t.length;nu[g]=1)}h(e.sort),t.forEach((p,g)=>{const m=n[g],v=r[g],y=i[g]||null,b=Wt(m),x=WT(p,b,s[g]);if(h(m),o.push(x),_e(pp,p))a.push(dX(p,m,v,x));else{if(m==null&&p!=="count"&&K("Null aggregate field specified."),p==="count"){c.push(x);return}d=!1;let _=l[b];_||(_=l[b]=[],_.field=m,f.push(_)),_.push(HT(p,y,x))}}),(c.length||f.length)&&(this.cell=gX(f,c,d)),this.inputs=Object.keys(u)}const mN=gN.prototype;mN.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};mN.update=function(e,t){const n=this.cell,r=this.windows,i=e.data,s=r&&r.length;let o;if(n){for(o=e.p0;oYT(u,u.field));const r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,s=r.agg=Array(i),o=0;othis.group(i(a));let o=this.state;(!o||n)&&(o=this.state=new gN(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,a=>s(a).add(a))):(t.visit(t.REM,a=>s(a).remove(a)),t.visit(t.ADD,a=>s(a).add(a)));for(let a=0,u=this._mlen;a0&&!i(s[n],s[n-1])&&(e.i0=t.left(s,s[n])),r1?0:e<-1?If:Math.acos(e)}function E$(e){return e>=1?zm:e<=-1?-zm:Math.asin(e)}const b_=Math.PI,x_=2*b_,Zu=1e-6,wX=x_-Zu;function yN(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return yN;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iZu)if(!(Math.abs(f*u-l*c)>Zu)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,p=i-a,g=u*u+l*l,m=h*h+p*p,v=Math.sqrt(g),y=Math.sqrt(d),b=s*Math.tan((b_-Math.acos((g+d-m)/(2*v*y)))/2),x=b/y,_=b/v;Math.abs(x-1)>Zu&&this._append`L${t+x*c},${n+x*f}`,this._append`A${s},${s},0,0,${+(f*h>c*p)},${this._x1=t+_*u},${this._y1=n+_*l}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),u=r*Math.sin(i),l=t+a,c=n+u,f=1^o,d=o?i-s:s-i;this._x1===null?this._append`M${l},${c}`:(Math.abs(this._x1-l)>Zu||Math.abs(this._y1-c)>Zu)&&this._append`L${l},${c}`,r&&(d<0&&(d=d%x_+x_),d>wX?this._append`A${r},${r},0,1,${f},${t-a},${n-u}A${r},${r},0,1,${f},${this._x1=l},${this._y1=c}`:d>Zu&&this._append`A${r},${r},0,${+(d>=b_)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function jv(){return new sS}jv.prototype=sS.prototype;function Uv(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new sS(t)}function AX(e){return e.innerRadius}function SX(e){return e.outerRadius}function kX(e){return e.startAngle}function CX(e){return e.endAngle}function FX(e){return e&&e.padAngle}function $X(e,t,n,r,i,s,o,a){var u=n-e,l=r-t,c=o-i,f=a-s,d=f*u-c*l;if(!(d*d$*$+C*C&&(S=F,k=D),{cx:S,cy:k,x01:-c,y01:-f,x11:S*(i/_-1),y11:k*(i/_-1)}}function DX(){var e=AX,t=SX,n=gt(0),r=null,i=kX,s=CX,o=FX,a=null,u=Uv(l);function l(){var c,f,d=+e.apply(this,arguments),h=+t.apply(this,arguments),p=i.apply(this,arguments)-zm,g=s.apply(this,arguments)-zm,m=w$(g-p),v=g>p;if(a||(a=c=u()),hHn))a.moveTo(0,0);else if(m>vN-Hn)a.moveTo(h*zu(p),h*Os(p)),a.arc(0,0,h,p,g,!v),d>Hn&&(a.moveTo(d*zu(g),d*Os(g)),a.arc(0,0,d,g,p,v));else{var y=p,b=g,x=p,_=g,A=m,E=m,S=o.apply(this,arguments)/2,k=S>Hn&&(r?+r.apply(this,arguments):ll(d*d+h*h)),F=r2(w$(h-d)/2,+n.apply(this,arguments)),D=F,M=F,T,$;if(k>Hn){var C=E$(k/d*Os(S)),R=E$(k/h*Os(S));(A-=C*2)>Hn?(C*=v?1:-1,x+=C,_-=C):(A=0,x=_=(p+g)/2),(E-=R*2)>Hn?(R*=v?1:-1,y+=R,b-=R):(E=0,y=b=(p+g)/2)}var L=h*zu(y),O=h*Os(y),N=d*zu(_),B=d*Os(_);if(F>Hn){var q=h*zu(b),X=h*Os(b),le=d*zu(x),de=d*Os(x),se;if(mHn?M>Hn?(T=o0(le,de,L,O,h,M,v),$=o0(q,X,N,B,h,M,v),a.moveTo(T.cx+T.x01,T.cy+T.y01),MHn)||!(A>Hn)?a.lineTo(N,B):D>Hn?(T=o0(N,B,q,X,d,-D,v),$=o0(L,O,le,de,d,-D,v),a.lineTo(T.cx+T.x01,T.cy+T.y01),D=h;--p)a.point(b[p],x[p]);a.lineEnd(),a.areaEnd()}v&&(b[d]=+e(m,d,f),x[d]=+t(m,d,f),a.point(r?+r(m,d,f):b[d],n?+n(m,d,f):x[d]))}if(y)return a=null,y+""||null}function c(){return EN().defined(i).curve(o).context(s)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:gt(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:gt(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:gt(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:gt(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:gt(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:gt(+f),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:gt(!!f),l):i},l.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),l):o},l.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),l):s},l}const MX={draw(e,t){const n=ll(t/If);e.moveTo(n,0),e.arc(0,0,n,0,vN)}};function RX(e,t){let n=null,r=Uv(i);e=typeof e=="function"?e:gt(e||MX),t=typeof t=="function"?t:gt(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:gt(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:gt(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function lu(){}function jm(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function qv(e){this._context=e}qv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:jm(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:jm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function TX(e){return new qv(e)}function SN(e){this._context=e}SN.prototype={areaStart:lu,areaEnd:lu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:jm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NX(e){return new SN(e)}function kN(e){this._context=e}kN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:jm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function OX(e){return new kN(e)}function CN(e,t){this._basis=new qv(e),this._beta=t}CN.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],s=e[n]-r,o=t[n]-i,a=-1,u;++a<=n;)u=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+u*s),this._beta*t[a]+(1-this._beta)*(i+u*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const LX=(function e(t){function n(r){return t===1?new qv(r):new CN(r,t)}return n.beta=function(r){return e(+r)},n})(.85);function Um(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function aS(e,t){this._context=e,this._k=(1-t)/6}aS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Um(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Um(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const IX=(function e(t){function n(r){return new aS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function uS(e,t){this._context=e,this._k=(1-t)/6}uS.prototype={areaStart:lu,areaEnd:lu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Um(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const PX=(function e(t){function n(r){return new uS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function lS(e,t){this._context=e,this._k=(1-t)/6}lS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Um(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const BX=(function e(t){function n(r){return new lS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function cS(e,t,n){var r=e._x1,i=e._y1,s=e._x2,o=e._y2;if(e._l01_a>Hn){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>Hn){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*l+e._x1*e._l23_2a-t*e._l12_2a)/c,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(r,i,s,o,e._x2,e._y2)}function FN(e,t){this._context=e,this._alpha=t}FN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:cS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const zX=(function e(t){function n(r){return t?new FN(r,t):new aS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function $N(e,t){this._context=e,this._alpha=t}$N.prototype={areaStart:lu,areaEnd:lu,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:cS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const jX=(function e(t){function n(r){return t?new $N(r,t):new uS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function DN(e,t){this._context=e,this._alpha=t}DN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:cS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const UX=(function e(t){function n(r){return t?new DN(r,t):new lS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function MN(e){this._context=e}MN.prototype={areaStart:lu,areaEnd:lu,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function qX(e){return new MN(e)}function A$(e){return e<0?-1:1}function S$(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(A$(s)+A$(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function k$(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function i2(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,a=(s-r)/3;e._context.bezierCurveTo(r+a,i+a*t,s-a,o-a*n,s,o)}function qm(e){this._context=e}qm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:i2(this,this._t0,k$(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,i2(this,k$(this,n=S$(this,e,t)),n);break;default:i2(this,this._t0,n=S$(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function RN(e){this._context=new TN(e)}(RN.prototype=Object.create(qm.prototype)).point=function(e,t){qm.prototype.point.call(this,t,e)};function TN(e){this._context=e}TN.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function WX(e){return new qm(e)}function HX(e){return new RN(e)}function NN(e){this._context=e}NN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=C$(e),i=C$(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function YX(e){return new Wv(e,.5)}function VX(e){return new Wv(e,0)}function XX(e){return new Wv(e,1)}function nu(e,t){if(typeof document<"u"&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}const KX=()=>typeof Image<"u"?Image:null;function xo(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Su(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const __=Symbol("implicit");function fS(){var e=new WF,t=[],n=[],r=__;function i(s){let o=e.get(s);if(o===void 0){if(r!==__)return r;e.set(s,o=t.push(s)-1)}return n[o%n.length]}return i.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new WF;for(const o of s)e.has(o)||e.set(o,t.push(o)-1);return i},i.range=function(s){return arguments.length?(n=Array.from(s),i):n.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return fS(t,n).unknown(r)},xo.apply(i,arguments),i}function kd(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function og(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ku(){}var Pl=.7,Pf=1/Pl,of="\\s*([+-]?\\d+)\\s*",gp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",to="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ZX=/^#([0-9a-f]{3,8})$/,JX=new RegExp(`^rgb\\(${of},${of},${of}\\)$`),QX=new RegExp(`^rgb\\(${to},${to},${to}\\)$`),eK=new RegExp(`^rgba\\(${of},${of},${of},${gp}\\)$`),tK=new RegExp(`^rgba\\(${to},${to},${to},${gp}\\)$`),nK=new RegExp(`^hsl\\(${gp},${to},${to}\\)$`),rK=new RegExp(`^hsla\\(${gp},${to},${to},${gp}\\)$`),F$={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kd(ku,mp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$$,formatHex:$$,formatHex8:iK,formatHsl:sK,formatRgb:D$,toString:D$});function $$(){return this.rgb().formatHex()}function iK(){return this.rgb().formatHex8()}function sK(){return ON(this).formatHsl()}function D$(){return this.rgb().formatRgb()}function mp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ZX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?M$(t):n===3?new gn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?a0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?a0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=JX.exec(e))?new gn(t[1],t[2],t[3],1):(t=QX.exec(e))?new gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eK.exec(e))?a0(t[1],t[2],t[3],t[4]):(t=tK.exec(e))?a0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nK.exec(e))?N$(t[1],t[2]/100,t[3]/100,1):(t=rK.exec(e))?N$(t[1],t[2]/100,t[3]/100,t[4]):F$.hasOwnProperty(e)?M$(F$[e]):e==="transparent"?new gn(NaN,NaN,NaN,0):null}function M$(e){return new gn(e>>16&255,e>>8&255,e&255,1)}function a0(e,t,n,r){return r<=0&&(e=t=n=NaN),new gn(e,t,n,r)}function dS(e){return e instanceof ku||(e=mp(e)),e?(e=e.rgb(),new gn(e.r,e.g,e.b,e.opacity)):new gn}function cu(e,t,n,r){return arguments.length===1?dS(e):new gn(e,t,n,r??1)}function gn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}kd(gn,cu,og(ku,{brighter(e){return e=e==null?Pf:Math.pow(Pf,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Pl:Math.pow(Pl,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gn(xl(this.r),xl(this.g),xl(this.b),Wm(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:R$,formatHex:R$,formatHex8:oK,formatRgb:T$,toString:T$}));function R$(){return`#${cl(this.r)}${cl(this.g)}${cl(this.b)}`}function oK(){return`#${cl(this.r)}${cl(this.g)}${cl(this.b)}${cl((isNaN(this.opacity)?1:this.opacity)*255)}`}function T$(){const e=Wm(this.opacity);return`${e===1?"rgb(":"rgba("}${xl(this.r)}, ${xl(this.g)}, ${xl(this.b)}${e===1?")":`, ${e})`}`}function Wm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function xl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function cl(e){return e=xl(e),(e<16?"0":"")+e.toString(16)}function N$(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new is(e,t,n,r)}function ON(e){if(e instanceof is)return new is(e.h,e.s,e.l,e.opacity);if(e instanceof ku||(e=mp(e)),!e)return new is;if(e instanceof is)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,u=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&u<1?0:o,new is(o,a,u,e.opacity)}function Hm(e,t,n,r){return arguments.length===1?ON(e):new is(e,t,n,r??1)}function is(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}kd(is,Hm,og(ku,{brighter(e){return e=e==null?Pf:Math.pow(Pf,e),new is(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Pl:Math.pow(Pl,e),new is(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new gn(s2(e>=240?e-240:e+120,i,r),s2(e,i,r),s2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new is(O$(this.h),u0(this.s),u0(this.l),Wm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Wm(this.opacity);return`${e===1?"hsl(":"hsla("}${O$(this.h)}, ${u0(this.s)*100}%, ${u0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function O$(e){return e=(e||0)%360,e<0?e+360:e}function u0(e){return Math.max(0,Math.min(1,e||0))}function s2(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const LN=Math.PI/180,IN=180/Math.PI,Gm=18,PN=.96422,BN=1,zN=.82521,jN=4/29,af=6/29,UN=3*af*af,aK=af*af*af;function qN(e){if(e instanceof no)return new no(e.l,e.a,e.b,e.opacity);if(e instanceof Ko)return WN(e);e instanceof gn||(e=dS(e));var t=l2(e.r),n=l2(e.g),r=l2(e.b),i=o2((.2225045*t+.7168786*n+.0606169*r)/BN),s,o;return t===n&&n===r?s=o=i:(s=o2((.4360747*t+.3850649*n+.1430804*r)/PN),o=o2((.0139322*t+.0971045*n+.7141733*r)/zN)),new no(116*i-16,500*(s-i),200*(i-o),e.opacity)}function Ym(e,t,n,r){return arguments.length===1?qN(e):new no(e,t,n,r??1)}function no(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}kd(no,Ym,og(ku,{brighter(e){return new no(this.l+Gm*(e??1),this.a,this.b,this.opacity)},darker(e){return new no(this.l-Gm*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=PN*a2(t),e=BN*a2(e),n=zN*a2(n),new gn(u2(3.1338561*t-1.6168667*e-.4906146*n),u2(-.9787684*t+1.9161415*e+.033454*n),u2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function o2(e){return e>aK?Math.pow(e,1/3):e/UN+jN}function a2(e){return e>af?e*e*e:UN*(e-jN)}function u2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function l2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function uK(e){if(e instanceof Ko)return new Ko(e.h,e.c,e.l,e.opacity);if(e instanceof no||(e=qN(e)),e.a===0&&e.b===0)return new Ko(NaN,0=1?(n=1,t-1):Math.floor(n*t),i=e[r],s=e[r+1],o=r>0?e[r-1]:2*i-s,a=r()=>e;function XN(e,t){return function(n){return e+n*t}}function cK(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Yv(e,t){var n=t-e;return n?XN(e,n>180||n<-180?n-360*Math.round(n/360):n):Gv(isNaN(e)?t:e)}function fK(e){return(e=+e)==1?mn:function(t,n){return n-t?cK(t,n,e):Gv(isNaN(t)?n:t)}}function mn(e,t){var n=t-e;return n?XN(e,n):Gv(isNaN(e)?t:e)}const E_=(function e(t){var n=fK(t);function r(i,s){var o=n((i=cu(i)).r,(s=cu(s)).r),a=n(i.g,s.g),u=n(i.b,s.b),l=mn(i.opacity,s.opacity);return function(c){return i.r=o(c),i.g=a(c),i.b=u(c),i.opacity=l(c),i+""}}return r.gamma=e,r})(1);function KN(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),s=new Array(n),o,a;for(o=0;on&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,u.push({i:o,x:ts(r,i)})),n=c2.lastIndex;return n180?c+=360:c-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:ts(l,c)})):c&&f.push(i(f)+"rotate("+c+r)}function a(l,c,f,d){l!==c?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:ts(l,c)}):c&&f.push(i(f)+"skewX("+c+r)}function u(l,c,f,d,h,p){if(l!==f||c!==d){var g=h.push(i(h)+"scale(",null,",",null,")");p.push({i:g-4,x:ts(l,f)},{i:g-2,x:ts(c,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,c){var f=[],d=[];return l=e(l),c=e(c),s(l.translateX,l.translateY,c.translateX,c.translateY,f,d),o(l.rotate,c.rotate,f,d),a(l.skewX,c.skewX,f,d),u(l.scaleX,l.scaleY,c.scaleX,c.scaleY,f,d),l=c=null,function(h){for(var p=-1,g=d.length,m;++pt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function PK(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?BK:PK,u=l=null,f}function f(d){return d==null||isNaN(d=+d)?s:(u||(u=a(e.map(r),t,n)))(r(o(d)))}return f.invert=function(d){return o(i((l||(l=a(t,e.map(r),ts)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,k_),c()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=ag,c()},f.clamp=function(d){return arguments.length?(o=d?!0:Lr,c()):o!==Lr},f.interpolate=function(d){return arguments.length?(n=d,c()):n},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,h){return r=d,i=h,c()}}function aO(){return Vv()(Lr,Lr)}function uO(e,t,n,r){var i=au(e,t,n),s;switch(r=Il(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=NR(i,o))&&(r.precision=s),rA(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=OR(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=TR(i))&&(r.precision=s-(r.type==="%")*2);break}}return Ev(r)}function dc(e){var t=e.domain;return e.ticks=function(n){var r=t();return s_(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return uO(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],a=r[s],u,l,c=10;for(a0;){if(l=o_(o,a,n),l===u)return r[i]=o,r[s]=a,t(r);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;u=l}return e},e}function lO(){var e=aO();return e.copy=function(){return ug(e,lO())},xo.apply(e,arguments),dc(e)}function cO(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,k_),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return cO(e).unknown(t)},e=arguments.length?Array.from(e,k_):[0,1],dc(n)}function fO(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function WK(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function W$(e){return(t,n)=>-e(-t,n)}function vS(e){const t=e(U$,q$),n=t.domain;let r=10,i,s;function o(){return i=WK(r),s=qK(r),n()[0]<0?(i=W$(i),s=W$(s),e(zK,jK)):e(U$,q$),t}return t.base=function(a){return arguments.length?(r=+a,o()):r},t.domain=function(a){return arguments.length?(n(a),o()):n()},t.ticks=a=>{const u=n();let l=u[0],c=u[u.length-1];const f=c0){for(;d<=h;++d)for(p=1;pc)break;v.push(g)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(g=d>0?p/s(-d):p*s(d),!(gc)break;v.push(g)}v.length*2{if(a==null&&(a=10),u==null&&(u=r===10?"s":","),typeof u!="function"&&(!(r%1)&&(u=Il(u)).precision==null&&(u.trim=!0),u=Ev(u)),a===1/0)return u;const l=Math.max(1,r*a/t.ticks().length);return c=>{let f=c/s(Math.round(i(c)));return f*rn(fO(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),t}function dO(){const e=vS(Vv()).domain([1,10]);return e.copy=()=>ug(e,dO()).base(e.base()),xo.apply(e,arguments),e}function H$(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function G$(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function yS(e){var t=1,n=e(H$(t),G$(t));return n.constant=function(r){return arguments.length?e(H$(t=+r),G$(t)):t},dc(n)}function hO(){var e=yS(Vv());return e.copy=function(){return ug(e,hO()).constant(e.constant())},xo.apply(e,arguments)}function Y$(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function HK(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function GK(e){return e<0?-e*e:e*e}function bS(e){var t=e(Lr,Lr),n=1;function r(){return n===1?e(Lr,Lr):n===.5?e(HK,GK):e(Y$(n),Y$(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},dc(t)}function xS(){var e=bS(Vv());return e.copy=function(){return ug(e,xS()).exponent(e.exponent())},xo.apply(e,arguments),e}function YK(){return xS.apply(null,arguments).exponent(.5)}function pO(){var e=[],t=[],n=[],r;function i(){var o=0,a=Math.max(1,t.length);for(n=new Array(a-1);++o0?n[a-1]:e[0],a=n?[r[n-1],t]:[r[l-1],r[l]]},o.unknown=function(u){return arguments.length&&(s=u),o},o.thresholds=function(){return r.slice()},o.copy=function(){return gO().domain([e,t]).range(i).unknown(s)},xo.apply(dc(o),arguments)}function mO(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[ou(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return mO().domain(e).range(t).unknown(n)},xo.apply(i,arguments)}function VK(e){return new Date(e)}function XK(e){return e instanceof Date?+e:+new Date(+e)}function _S(e,t,n,r,i,s,o,a,u,l){var c=aO(),f=c.invert,d=c.domain,h=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),v=l("%a %d"),y=l("%b %d"),b=l("%B"),x=l("%Y");function _(A){return(u(A)0?r:1:0}const cZ="identity",Bf="linear",la="log",lg="pow",cg="sqrt",Zv="symlog",Bl="time",zl="utc",ro="sequential",Cd="diverging",zf="quantile",Jv="quantize",Qv="threshold",kS="ordinal",F_="point",wO="band",CS="bin-ordinal",fn="continuous",fg="discrete",dg="discretizing",ji="interpolating",FS="temporal";function fZ(e){return function(t){let n=t[0],r=t[1],i;return r=r&&n[u]<=i&&(s<0&&(s=u),o=u);if(!(s<0))return r=e.invertExtent(n[s]),i=e.invertExtent(n[o]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function $S(){const e=fS().unknown(void 0),t=e.domain,n=e.range;let r=[0,1],i,s,o=!1,a=0,u=0,l=.5;delete e.unknown;function c(){const f=t().length,d=r[1]g+i*v);return n(d?m.reverse():m)}return e.domain=function(f){return arguments.length?(t(f),c()):t()},e.range=function(f){return arguments.length?(r=[+f[0],+f[1]],c()):r.slice()},e.rangeRound=function(f){return r=[+f[0],+f[1]],o=!0,c()},e.bandwidth=function(){return s},e.step=function(){return i},e.round=function(f){return arguments.length?(o=!!f,c()):o},e.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),a=u,c()):a},e.paddingInner=function(f){return arguments.length?(a=Math.max(0,Math.min(1,f)),c()):a},e.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},e.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},e.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=r[1]r[1-d])))return v=Math.max(0,ou(h,g)-1),y=g===m?v:ou(h,m)-1,g-h[v]>s+1e-10&&++v,d&&(b=v,v=p-y,y=p-b),v>y?void 0:t().slice(v,y+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return $S().domain(t()).range(r).round(o).paddingInner(a).paddingOuter(u).align(l)},c()}function EO(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return EO(t())},e}function hZ(){return EO($S().paddingInner(1))}var pZ=Array.prototype.map;function gZ(e){return pZ.call(e,Xn)}const mZ=Array.prototype.slice;function AO(){let e=[],t=[];function n(r){return r==null||r!==r?void 0:t[(ou(e,r)-1)%t.length]}return n.domain=function(r){return arguments.length?(e=gZ(r),n):e.slice()},n.range=function(r){return arguments.length?(t=mZ.call(r),n):t.slice()},n.tickFormat=function(r,i){return uO(e[0],nt(e),r??10,i)},n.copy=function(){return AO().domain(n.domain()).range(n.range())},n}const Xm=new Map,SO=Symbol("vega_scale");function kO(e){return e[SO]=!0,e}function V$(e){return e&&e[SO]===!0}function vZ(e,t,n){const r=function(){const s=t();return s.invertRange||(s.invertRange=s.invert?fZ(s):s.invertExtent?dZ(s):void 0),s.type=e,kO(s)};return r.metadata=vs(xe(n)),r}function ct(e,t,n){return arguments.length>1?(Xm.set(e,vZ(e,t,n)),this):CO(e)?Xm.get(e):void 0}ct(cZ,cO);ct(Bf,lO,fn);ct(la,dO,[fn,la]);ct(lg,xS,fn);ct(cg,YK,fn);ct(Zv,hO,fn);ct(Bl,KK,[fn,FS]);ct(zl,ZK,[fn,FS]);ct(ro,wS,[fn,ji]);ct(`${ro}-${Bf}`,wS,[fn,ji]);ct(`${ro}-${la}`,vO,[fn,ji,la]);ct(`${ro}-${lg}`,ES,[fn,ji]);ct(`${ro}-${cg}`,JK,[fn,ji]);ct(`${ro}-${Zv}`,yO,[fn,ji]);ct(`${Cd}-${Bf}`,bO,[fn,ji]);ct(`${Cd}-${la}`,xO,[fn,ji,la]);ct(`${Cd}-${lg}`,AS,[fn,ji]);ct(`${Cd}-${cg}`,QK,[fn,ji]);ct(`${Cd}-${Zv}`,_O,[fn,ji]);ct(zf,pO,[dg,zf]);ct(Jv,gO,dg);ct(Qv,mO,dg);ct(CS,AO,[fg,dg]);ct(kS,fS,fg);ct(wO,$S,fg);ct(F_,hZ,fg);function CO(e){return Xm.has(e)}function hc(e,t){const n=Xm.get(e);return n&&n.metadata[t]}function DS(e){return hc(e,fn)}function jf(e){return hc(e,fg)}function $_(e){return hc(e,dg)}function FO(e){return hc(e,la)}function yZ(e){return hc(e,FS)}function $O(e){return hc(e,ji)}function DO(e){return hc(e,zf)}const bZ=["clamp","base","constant","exponent"];function MO(e,t){const n=t[0],r=nt(t)-n;return function(i){return e(n+i*r)}}function ey(e,t,n){return mS(MS(t||"rgb",n),e)}function RO(e,t){const n=new Array(t),r=t+1;for(let i=0;ie[a]?o[a](e[a]()):0),o)}function MS(e,t){const n=OK[xZ(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function xZ(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const _Z={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},wZ={accent:tZ,category10:eZ,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:nZ,observable10:rZ,paired:iZ,pastel1:sZ,pastel2:oZ,set1:aZ,set2:uZ,set3:lZ,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function NO(e){if(Q(e))return e;const t=e.length/6|0,n=new Array(t);for(let r=0;rey(NO(e)));function RS(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(X$[e]=t,this):X$[e]}const tm="symbol",EZ="discrete",AZ="gradient",SZ=e=>Q(e)?e.map(t=>String(t)):String(e),kZ=(e,t)=>e[1]-t[1],CZ=(e,t)=>t[1]-e[1];function TS(e,t,n){let r;return ut(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(ng(e.domain())/n||1)+1))),ve(t)&&(r=t.step,t=t.interval),be(t)&&(t=e.type===Bl?Ed(t):e.type==zl?Ad(t):K("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function LO(e,t,n){let r=e.range(),i=r[0],s=nt(r),o=kZ;if(i>s&&(r=s,s=i,i=r,o=CZ),i=Math.floor(i),s=Math.ceil(s),t=t.map(a=>[a,e(a)]).filter(a=>i<=a[1]&&a[1]<=s).sort(o).map(a=>a[0]),n>0&&t.length>1){const a=[t[0],nt(t)];for(;t.length>n&&t.length>=3;)t=t.filter((u,l)=>!(l%2));t.length<3&&(t=a)}return t}function NS(e,t){return e.bins?LO(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function IO(e,t,n,r,i,s){const o=t.type;let a=SZ;if(o===Bl||i===Bl)a=e.timeFormat(r);else if(o===zl||i===zl)a=e.utcFormat(r);else if(FO(o)){const u=e.formatFloat(r);if(s||t.bins)a=u;else{const l=PO(t,n,!1);a=c=>l(c)?u(c):""}}else if(t.tickFormat){const u=t.domain();a=e.formatSpan(u[0],u[u.length-1],n,r)}else r&&(a=e.format(r));return a}function PO(e,t,n){const r=NS(e,t),i=e.base(),s=Math.log(i),o=Math.max(1,i*t/r.length),a=u=>{let l=u/Math.pow(i,Math.round(Math.log(u)/s));return l*i1?r[1]-r[0]:r[0],o;for(o=1;oD_[e.type]||e.bins;function jO(e,t,n,r,i,s,o){const a=BO[t.type]&&s!==Bl&&s!==zl?FZ(e,t,i):IO(e,t,n,i,s,o);return r===tm&&MZ(t)?RZ(a):r===EZ?TZ(a):NZ(a)}const RZ=e=>(t,n,r)=>{const i=K$(r[n+1],K$(r.max,1/0)),s=Z$(t,e),o=Z$(i,e);return s&&o?s+" โ€“ "+o:o?"< "+o:"โ‰ฅ "+s},K$=(e,t)=>e??t,TZ=e=>(t,n)=>n?e(t):null,NZ=e=>t=>e(t),Z$=(e,t)=>Number.isFinite(e)?t(e):null;function OZ(e){const t=e.domain(),n=t.length-1;let r=+t[0],i=+nt(t),s=i-r;if(e.type===Qv){const o=n?s/n:.1;r-=o,i+=o,s=i-r}return o=>(o-r)/s}function LZ(e,t,n,r){const i=r||t.type;return be(n)&&yZ(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&i===Bl?e.timeFormat("%A, %d %B %Y, %X"):!n&&i===zl?e.utcFormat("%A, %d %B %Y, %X UTC"):jO(e,t,5,null,n,r,!0)}function UO(e,t,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=LZ(e,t,n.format,n.formatType);if($_(t.type)){const s=zO(t).slice(1).map(i),o=s.length;return`${o} boundar${o===1?"y":"ies"}: ${s.join(", ")}`}else if(jf(t.type)){const s=t.domain(),o=s.length,a=o>r?s.slice(0,r-2).map(i).join(", ")+", ending with "+s.slice(-1).map(i):s.map(i).join(", ");return`${o} value${o===1?"":"s"}: ${a}`}else{const s=t.domain();return`values from ${i(s[0])} to ${i(nt(s))}`}}let qO=0;function IZ(){qO=0}const Km="p_";function OS(e){return e&&e.gradient}function WO(e,t,n){const r=e.gradient;let i=e.id,s=r==="radial"?Km:"";return i||(i=e.id="gradient_"+qO++,r==="radial"?(e.x1=Ls(e.x1,.5),e.y1=Ls(e.y1,.5),e.r1=Ls(e.r1,0),e.x2=Ls(e.x2,.5),e.y2=Ls(e.y2,.5),e.r2=Ls(e.r2,.5),s=Km):(e.x1=Ls(e.x1,0),e.y1=Ls(e.y1,0),e.x2=Ls(e.x2,1),e.y2=Ls(e.y2,0))),t[i]=e,"url("+(n||"")+"#"+s+i+")"}function Ls(e,t){return e??t}function HO(e,t){var n=[],r;return r={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(i,s){return n.push({offset:i,color:s}),r}}}const J$={basis:{curve:TX},"basis-closed":{curve:NX},"basis-open":{curve:OX},bundle:{curve:LX,tension:"beta",value:.85},cardinal:{curve:IX,tension:"tension",value:0},"cardinal-open":{curve:BX,tension:"tension",value:0},"cardinal-closed":{curve:PX,tension:"tension",value:0},"catmull-rom":{curve:zX,tension:"alpha",value:.5},"catmull-rom-closed":{curve:jX,tension:"alpha",value:.5},"catmull-rom-open":{curve:UX,tension:"alpha",value:.5},linear:{curve:oS},"linear-closed":{curve:qX},monotone:{horizontal:HX,vertical:WX},natural:{curve:GX},step:{curve:YX},"step-after":{curve:XX},"step-before":{curve:VX}};function LS(e,t,n){var r=_e(J$,e)&&J$[e],i=null;return r&&(i=r.curve||r[t||"vertical"],r.tension&&n!=null&&(i=i[r.tension](n))),i}const PZ={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},BZ=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,zZ=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,jZ=/^((\s+,?\s*)|(,\s*))/,UZ=/^[01]/;function Uf(e){const t=[];return(e.match(BZ)||[]).forEach(r=>{let i=r[0];const s=i.toLowerCase(),o=PZ[s],a=qZ(s,o,r.slice(1).trim()),u=a.length;if(u1&&(g=Math.sqrt(g),n*=g,r*=g);const m=d/n,v=f/n,y=-f/r,b=d/r,x=m*a+v*u,_=y*a+b*u,A=m*e+v*t,E=y*e+b*t;let k=1/((A-x)*(A-x)+(E-_)*(E-_))-.25;k<0&&(k=0);let F=Math.sqrt(k);s==i&&(F=-F);const D=.5*(x+A)-F*(E-_),M=.5*(_+E)+F*(A-x),T=Math.atan2(_-M,x-D);let C=Math.atan2(E-M,A-D)-T;C<0&&s===1?C+=Vs:C>0&&s===0&&(C-=Vs);const R=Math.ceil(Math.abs(C/(tl+.001))),L=[];for(let O=0;O+e}function c0(e,t,n){return Math.max(t,Math.min(e,n))}function VO(){var e=XZ,t=KZ,n=ZZ,r=JZ,i=No(0),s=i,o=i,a=i,u=null;function l(c,f,d){var h,p=f??+e.call(this,c),g=d??+t.call(this,c),m=+n.call(this,c),v=+r.call(this,c),y=Math.min(m,v)/2,b=c0(+i.call(this,c),0,y),x=c0(+s.call(this,c),0,y),_=c0(+o.call(this,c),0,y),A=c0(+a.call(this,c),0,y);if(u||(u=h=jv()),b<=0&&x<=0&&_<=0&&A<=0)u.rect(p,g,m,v);else{var E=p+m,S=g+v;u.moveTo(p+b,g),u.lineTo(E-x,g),u.bezierCurveTo(E-Ca*x,g,E,g+Ca*x,E,g+x),u.lineTo(E,S-A),u.bezierCurveTo(E,S-Ca*A,E-Ca*A,S,E-A,S),u.lineTo(p+_,S),u.bezierCurveTo(p+Ca*_,S,p,S-Ca*_,p,S-_),u.lineTo(p,g+b),u.bezierCurveTo(p,g+Ca*b,p+Ca*b,g,p+b,g),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(e=No(c),l):e},l.y=function(c){return arguments.length?(t=No(c),l):t},l.width=function(c){return arguments.length?(n=No(c),l):n},l.height=function(c){return arguments.length?(r=No(c),l):r},l.cornerRadius=function(c,f,d,h){return arguments.length?(i=No(c),s=f!=null?No(f):i,a=d!=null?No(d):i,o=h!=null?No(h):s,l):i},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function XO(){var e,t,n,r,i=null,s,o,a,u;function l(f,d,h){const p=h/2;if(s){var g=a-d,m=f-o;if(g||m){var v=Math.hypot(g,m),y=(g/=v)*u,b=(m/=v)*u,x=Math.atan2(m,g);i.moveTo(o-y,a-b),i.lineTo(f-g*p,d-m*p),i.arc(f,d,p,x-Math.PI,x),i.lineTo(o+y,a+b),i.arc(o,a,u,x,x+Math.PI)}else i.arc(f,d,p,0,Vs);i.closePath()}else s=1;o=f,a=d,u=p}function c(f){var d,h=f.length,p,g=!1,m;for(i==null&&(i=m=jv()),d=0;d<=h;++d)!(de.x||0,gg=e=>e.y||0,QZ=e=>e.width||0,eJ=e=>e.height||0,tJ=e=>(e.x||0)+(e.width||0),nJ=e=>(e.y||0)+(e.height||0),rJ=e=>e.startAngle||0,iJ=e=>e.endAngle||0,sJ=e=>e.padAngle||0,oJ=e=>e.innerRadius||0,aJ=e=>e.outerRadius||0,uJ=e=>e.cornerRadius||0,lJ=e=>hg(e.cornerRadiusTopLeft,e.cornerRadius)||0,cJ=e=>hg(e.cornerRadiusTopRight,e.cornerRadius)||0,fJ=e=>hg(e.cornerRadiusBottomRight,e.cornerRadius)||0,dJ=e=>hg(e.cornerRadiusBottomLeft,e.cornerRadius)||0,hJ=e=>hg(e.size,64),pJ=e=>e.size||1,ty=e=>e.defined!==!1,gJ=e=>YO(e.shape||"circle"),mJ=DX().startAngle(rJ).endAngle(iJ).padAngle(sJ).innerRadius(oJ).outerRadius(aJ).cornerRadius(uJ),vJ=AN().x(pg).y1(gg).y0(nJ).defined(ty),yJ=AN().y(gg).x1(pg).x0(tJ).defined(ty),bJ=EN().x(pg).y(gg).defined(ty),xJ=VO().x(pg).y(gg).width(QZ).height(eJ).cornerRadius(lJ,cJ,fJ,dJ),_J=RX().type(gJ).size(hJ),wJ=XO().x(pg).y(gg).defined(ty).size(pJ);function IS(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function EJ(e,t){return mJ.context(e)(t)}function AJ(e,t){const n=t[0],r=n.interpolate||"linear";return(n.orient==="horizontal"?yJ:vJ).curve(LS(r,n.orient,n.tension)).context(e)(t)}function SJ(e,t){const n=t[0],r=n.interpolate||"linear";return bJ.curve(LS(r,n.orient,n.tension)).context(e)(t)}function Fd(e,t,n,r){return xJ.context(e)(t,n,r)}function kJ(e,t){return(t.mark.shape||t.shape).context(e)(t)}function CJ(e,t){return _J.context(e)(t)}function FJ(e,t){return wJ.context(e)(t)}var KO=1;function ZO(){KO=1}function PS(e,t,n){var r=t.clip,i=e._defs,s=t.clip_id||(t.clip_id="clip"+KO++),o=i.clipping[s]||(i.clipping[s]={id:s});return He(r)?o.path=r(null):IS(n)?o.path=Fd(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+s+")"}function en(e){this.clear(),e&&this.union(e)}en.prototype={clone(){return new en(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:s,y2:o}=this,a=Math.cos(e),u=Math.sin(e),l=t-t*a+n*u,c=n-t*u-n*a;return[a*r-u*i+l,u*r+a*i+c,a*r-u*o+l,u*r+a*o+c,a*s-u*i+l,u*s+a*i+c,a*s-u*o+l,u*s+a*o+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function ny(e){this.mark=e,this.bounds=this.bounds||new en}function ry(e){ny.call(this,e),this.items=this.items||[]}pe(ry,ny);class JO{constructor(t){this._pending=0,this._loader=t||$v()}pending(){return this._pending}sanitizeURL(t){const n=this;return n5(n),n._loader.sanitize(t,{context:"href"}).then(r=>(th(n),r)).catch(()=>(th(n),null))}loadImage(t){const n=this,r=KX();return n5(n),n._loader.sanitize(t,{context:"image"}).then(i=>{const s=i.href;if(!s||!r)throw{url:s};const o=new r,a=_e(i,"crossOrigin")?i.crossOrigin:"anonymous";return a!=null&&(o.crossOrigin=a),o.onload=()=>th(n),o.onerror=()=>th(n),o.src=s,o}).catch(i=>(th(n),{complete:!1,width:0,height:0,src:i&&i.url||""}))}ready(){const t=this;return new Promise(n=>{function r(i){t.pending()?setTimeout(()=>{r(!0)},10):n(i)}r(!1)})}}function n5(e){e._pending+=1}function th(e){e._pending-=1}function pa(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const r=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(r+(n?$J(t,r):0))}return e}function $J(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const DJ=Vs-1e-8;let iy,nm,rm,fl,M_,im,R_,T_;const za=(e,t)=>iy.add(e,t),sm=(e,t)=>za(nm=e,rm=t),r5=e=>za(e,iy.y1),i5=e=>za(iy.x1,e),nl=(e,t)=>M_*e+R_*t,rl=(e,t)=>im*e+T_*t,p2=(e,t)=>za(nl(e,t),rl(e,t)),g2=(e,t)=>sm(nl(e,t),rl(e,t));function mg(e,t){return iy=e,t?(fl=t*fu,M_=T_=Math.cos(fl),im=Math.sin(fl),R_=-im):(M_=T_=1,fl=im=R_=0),MJ}const MJ={beginPath(){},closePath(){},moveTo:g2,lineTo:g2,rect(e,t,n,r){fl?(p2(e+n,t),p2(e+n,t+r),p2(e,t+r),g2(e,t)):(za(e+n,t+r),sm(e,t))},quadraticCurveTo(e,t,n,r){const i=nl(e,t),s=rl(e,t),o=nl(n,r),a=rl(n,r);s5(nm,i,o,r5),s5(rm,s,a,i5),sm(o,a)},bezierCurveTo(e,t,n,r,i,s){const o=nl(e,t),a=rl(e,t),u=nl(n,r),l=rl(n,r),c=nl(i,s),f=rl(i,s);o5(nm,o,u,c,r5),o5(rm,a,l,f,i5),sm(c,f)},arc(e,t,n,r,i,s){if(r+=fl,i+=fl,nm=n*Math.cos(i)+e,rm=n*Math.sin(i)+t,Math.abs(i-r)>DJ)za(e-n,t-n),za(e+n,t+n);else{const o=l=>za(n*Math.cos(l)+e,n*Math.sin(l)+t);let a,u;if(o(r),o(i),i!==r)if(r=r%Vs,r<0&&(r+=Vs),i=i%Vs,i<0&&(i+=Vs),ii;++u,a-=tl)o(a);else for(a=r-r%tl+tl,u=0;u<4&&aWZ?(c=o*o+a*s,c>=0&&(c=Math.sqrt(c),u=(-o+c)/s,l=(-o-c)/s)):u=.5*a/o,0d)return!1;g>f&&(f=g)}else if(h>0){if(g0?(e.globalAlpha=n,e.fillStyle=t7(e,t,t.fill),!0):!1}var TJ=[];function Wf(e,t,n){var r=(r=t.strokeWidth)!=null?r:1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=t7(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||TJ),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function NJ(e,t){return e.zindex-t.zindex||e.index-t.index}function jS(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,s;for(i=0,s=t.length;i=0;)if(r=t(n[i]))return r;if(n===s){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function US(e){return function(t,n,r){bs(n,i=>{(!r||r.intersects(i.bounds))&&n7(e,t,i,i)})}}function OJ(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&n7(e,t,n.items[0],n.items)}}function n7(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(qf(t,n),n.fill&&Zm(t,n,i)&&t.fill(),n.stroke&&Wf(t,n,i)&&t.stroke()))}function sy(e){return e=e||Oi,function(t,n,r,i,s,o){return r*=t.pixelRatio,i*=t.pixelRatio,Jm(n,a=>{const u=a.bounds;if(!(u&&!u.contains(s,o)||!u)&&e(t,a,r,i,s,o))return a})}}function vg(e,t){return function(n,r,i,s){var o=Array.isArray(r)?r[0]:r,a=t??o.fill,u=o.stroke&&n.isPointInStroke,l,c;return u&&(l=o.strokeWidth,c=o.strokeCap,n.lineWidth=l??1,n.lineCap=c??"butt"),e(n,r)?!1:a&&n.isPointInPath(i,s)||u&&n.isPointInStroke(i,s)}}function qS(e){return sy(vg(e))}function wl(e,t){return"translate("+e+","+t+")"}function WS(e){return"rotate("+e+")"}function LJ(e,t){return"scale("+e+","+t+")"}function r7(e){return wl(e.x||0,e.y||0)}function IJ(e){return wl(e.x||0,e.y||0)+(e.angle?" "+WS(e.angle):"")}function PJ(e){return wl(e.x||0,e.y||0)+(e.angle?" "+WS(e.angle):"")+(e.scaleX||e.scaleY?" "+LJ(e.scaleX||1,e.scaleY||1):"")}function HS(e,t,n){function r(o,a){o("transform",IJ(a)),o("d",t(null,a))}function i(o,a){return t(mg(o,a.angle),a),pa(o,a).translate(a.x||0,a.y||0)}function s(o,a){var u=a.x||0,l=a.y||0,c=a.angle||0;o.translate(u,l),c&&o.rotate(c*=fu),o.beginPath(),t(o,a),c&&o.rotate(-c),o.translate(-u,-l)}return{type:e,tag:"path",nested:!1,attr:r,bound:i,draw:US(s),pick:qS(s),isect:n||BS(s)}}var BJ=HS("arc",EJ);function zJ(e,t){for(var n=e[0].orient==="horizontal"?t[1]:t[0],r=e[0].orient==="horizontal"?"y":"x",i=e.length,s=1/0,o,a;--i>=0;)e[i].defined!==!1&&(a=Math.abs(e[i][r]-n),a=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],s=e[r].y-t[1],o=i*i+s*s,o=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],s=r*r+i*i,r=e[n].size||1,s.5&&t<1.5?.5-Math.abs(t-1):0}function HJ(e,t){e("transform",r7(t))}function o7(e,t){const n=s7(t);e("d",Fd(null,t,n,n))}function GJ(e,t){e("class","background"),e("aria-hidden",!0),o7(e,t)}function YJ(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?o7(e,t):e("d","")}function VJ(e,t,n){const r=t.clip?PS(n,t,t):null;e("clip-path",r)}function XJ(e,t){if(!t.clip&&t.items){const n=t.items,r=n.length;for(let i=0;i{const s=i.x||0,o=i.y||0,a=i.strokeForeground,u=i.opacity==null?1:i.opacity;(i.stroke||i.fill)&&u&&(bp(e,i,s,o),qf(e,i),i.fill&&Zm(e,i,u)&&e.fill(),i.stroke&&!a&&Wf(e,i,u)&&e.stroke()),e.save(),e.translate(s,o),i.clip&&i7(e,i),n&&n.translate(-s,-o),bs(i,l=>{(l.marktype==="group"||r==null||r.includes(l.marktype))&&this.draw(e,l,n,r)}),n&&n.translate(s,o),e.restore(),a&&i.stroke&&u&&(bp(e,i,s,o),qf(e,i),Wf(e,i,u)&&e.stroke())})}function eQ(e,t,n,r,i,s){if(t.bounds&&!t.bounds.contains(i,s)||!t.items)return null;const o=n*e.pixelRatio,a=r*e.pixelRatio;return Jm(t,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(i,s))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),g=u.clip;if(g&&(ih||sp))return;if(e.save(),e.translate(c,f),c=i-c,f=s-f,g&&IS(u)&&!JJ(e,u,o,a))return e.restore(),null;const m=u.strokeForeground,v=t.interactive!==!1;return v&&m&&u.stroke&&ZJ(e,u,o,a)?(e.restore(),u):(l=Jm(u,y=>tQ(y,c,f)?this.pick(y,n,r,c,f):null),!l&&v&&(u.fill||!m&&u.stroke)&&KJ(e,u,o,a)&&(l=u),e.restore(),l||null)})}function tQ(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var nQ={type:"group",tag:"g",nested:!1,attr:HJ,bound:XJ,draw:QJ,pick:eQ,isect:QO,content:VJ,background:GJ,foreground:YJ},xp={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function YS(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(r=>{e.image=r,e.image.url=e.url})),n}function VS(e,t){return e.width!=null?e.width:!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width}function XS(e,t){return e.height!=null?e.height:!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height}function oy(e,t){return e==="center"?t/2:e==="right"?t:0}function ay(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function rQ(e,t,n){const r=YS(t,n),i=VS(t,r),s=XS(t,r),o=(t.x||0)-oy(t.align,i),a=(t.y||0)-ay(t.baseline,s),u=!r.src&&r.toDataURL?r.toDataURL():r.src||"";e("href",u,xp["xmlns:xlink"],"xlink:href"),e("transform",wl(o,a)),e("width",i),e("height",s),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function iQ(e,t){const n=t.image,r=VS(t,n),i=XS(t,n),s=(t.x||0)-oy(t.align,r),o=(t.y||0)-ay(t.baseline,i);return e.set(s,o,s+r,o+i)}function sQ(e,t,n){bs(t,r=>{if(n&&!n.intersects(r.bounds))return;const i=YS(r,this);let s=VS(r,i),o=XS(r,i);if(s===0||o===0)return;let a=(r.x||0)-oy(r.align,s),u=(r.y||0)-ay(r.baseline,o),l,c,f,d;r.aspect!==!1&&(c=i.width/i.height,f=r.width/r.height,c===c&&f===f&&c!==f&&(f{if(!(n&&!n.intersects(r.bounds))){var i=r.opacity==null?1:r.opacity;i&&a7(e,r,i)&&(qf(e,r),e.stroke())}})}function vQ(e,t,n,r){return e.isPointInStroke?a7(e,t,1)&&e.isPointInStroke(n,r):!1}var yQ={type:"rule",tag:"line",nested:!1,attr:pQ,bound:gQ,draw:mQ,pick:sy(vQ),isect:e7},bQ=HS("shape",kJ),xQ=HS("symbol",CJ,zS);const c5=gR();var oi={height:wo,measureWidth:KS,estimateWidth:Qm,width:Qm,canvas:u7};u7(!0);function u7(e){oi.width=e&&ru?KS:Qm}function Qm(e,t){return l7(hu(e,t),wo(e))}function l7(e,t){return~~(.8*e.length*t)}function KS(e,t){return wo(e)<=0||!(t=hu(e,t))?0:c7(t,uy(e))}function c7(e,t){const n=`(${t}) ${e}`;let r=c5.get(n);return r===void 0&&(ru.font=t,r=ru.measureText(e).width,c5.set(n,r)),r}function wo(e){return e.fontSize!=null?+e.fontSize||0:11}function du(e){return e.lineHeight!=null?e.lineHeight:wo(e)+2}function _Q(e){return Q(e)?e.length>1?e:e[0]:e}function yg(e){return _Q(e.lineBreak&&e.text&&!Q(e.text)?e.text.split(e.lineBreak):e.text)}function ZS(e){const t=yg(e);return(Q(t)?t.length-1:0)*du(e)}function hu(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?EQ(e,n):n}function wQ(e){if(oi.width===KS){const t=uy(e);return n=>c7(n,t)}else if(oi.width===Qm){const t=wo(e);return n=>l7(n,t)}else return t=>oi.width(e,t)}function EQ(e,t){var n=+e.limit,r=wQ(e);if(r(t)>>1,r(t.slice(u))>n?o=u+1:a=u;return i+t.slice(o)}else{for(;o>>1),r(t.slice(0,u))Math.max(d,oi.width(t,h)),0)):f=oi.width(t,c),i==="center"?u-=f/2:i==="right"&&(u-=f),e.set(u+=o,l+=a,u+f,l+r),t.angle&&!n)e.rotate(t.angle*fu,o,a);else if(n===2)return e.rotatedPoints(t.angle*fu,o,a);return e}function kQ(e,t,n){bs(t,r=>{var i=r.opacity==null?1:r.opacity,s,o,a,u,l,c,f;if(!(n&&!n.intersects(r.bounds)||i===0||r.fontSize<=0||r.text==null||r.text.length===0)){if(e.font=uy(r),e.textAlign=r.align||"left",s=ly(r),o=s.x1,a=s.y1,r.angle&&(e.save(),e.translate(o,a),e.rotate(r.angle*fu),o=a=0),o+=r.dx||0,a+=(r.dy||0)+JS(r),c=yg(r),qf(e,r),Q(c))for(l=du(r),u=0;ut;)e.removeChild(n[--r]);return e}function m7(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function cy(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function RQ(e,t,n,r){var i=e&&e.mark,s,o;if(i&&(s=fi[i.marktype]).tip){for(o=cy(t,n),o[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=s.tip(i.items,o)}return e}let tk=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||$v(),this._tooltip=n||TQ}initialize(t,n,r){return this._el=t,this._obj=r||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,r){for(let i=t?t.length:0;--i>=0;)if(t[i].type===n&&(!r||t[i].handler===r))return i;return-1}handlers(t){const n=this._handlers,r=[];if(t)r.push(...n[this.eventName(t)]);else for(const i in n)r.push(...n[i]);return r}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,r){this._loader.sanitize(r,{context:"href"}).then(i=>{const s=new MouseEvent(t.type,t),o=ja(null,"a");for(const a in i)o.setAttribute(a,i[a]);o.dispatchEvent(s)}).catch(()=>{})}handleTooltip(t,n,r){if(n&&n.tooltip!=null){n=RQ(n,t,this.canvas(),this._origin);const i=r&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,i)}}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const r=n.getBoundingClientRect(),i=this._origin,s=t.bounds,o=s.width(),a=s.height();let u=s.x1+i[0]+r.left,l=s.y1+i[1]+r.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,l+=t.y||0;return{x:u,y:l,width:o,height:a,left:u,top:l,right:u+o,bottom:l+a}}};function TQ(e,t,n,r){e.element().setAttribute("title",r||"")}class xg{constructor(t){this._el=null,this._bgcolor=null,this._loader=new JO(t)}initialize(t,n,r,i,s){return this._el=t,this.resize(n,r,i,s)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return arguments.length===0?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,r,i){return this._width=t,this._height=n,this._origin=r||[0,0],this._scale=i||1,this}dirty(){}render(t,n){const r=this;return r._call=function(){r._render(t,n)},r._call(),r._call=null,r}_render(){}renderAsync(t,n){const r=this.render(t,n);return this._ready?this._ready.then(()=>r):Promise.resolve(r)}_load(t,n){var r=this,i=r._loader[t](n);if(!r._ready){const s=r._call;r._ready=r._loader.ready().then(o=>{o&&s(),r._ready=null})}return i}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const NQ="keydown",OQ="keypress",LQ="keyup",v7="dragenter",am="dragleave",y7="dragover",L_="pointerdown",IQ="pointerup",e1="pointermove",um="pointerout",b7="pointerover",I_="mousedown",PQ="mouseup",x7="mousemove",t1="mouseout",_7="mouseover",n1="click",BQ="dblclick",zQ="wheel",w7="mousewheel",r1="touchstart",i1="touchmove",s1="touchend",jQ=[NQ,OQ,LQ,v7,am,y7,L_,IQ,e1,um,b7,I_,PQ,x7,t1,_7,n1,BQ,zQ,w7,r1,i1,s1],P_=e1,Vh=t1,B_=n1;class _g extends tk{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=jQ,this.pointermove=p5([e1,x7],[b7,_7],[um,t1]),this.dragover=p5([y7],[v7],[am]),this.pointerout=g5([um,t1]),this.dragleave=g5([am])}initialize(t,n,r){return this._canvas=t&&ek(t,"canvas"),[n1,I_,L_,e1,um,am].forEach(i=>h5(this,i)),super.initialize(t,n,r)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(w7,t)}pointerdown(t){this._down=this._active,this.fire(L_,t)}mousedown(t){this._down=this._active,this.fire(I_,t)}click(t){this._down===this._active&&(this.fire(n1,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(r1,t,!0)}touchmove(t){this.fire(i1,t,!0)}touchend(t){this.fire(s1,t,!0),this._touch=null}fire(t,n,r){const i=r?this._touch:this._active,s=this._handlers[t];if(n.vegaType=t,t===B_&&i&&i.href?this.handleHref(n,i,i.href):(t===P_||t===Vh)&&this.handleTooltip(n,i,t!==Vh),s)for(let o=0,a=s.length;o=0&&i.splice(s,1),this}pickEvent(t){const n=cy(t,this._canvas),r=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-r[0],n[1]-r[1])}pick(t,n,r,i,s){const o=this.context();return fi[t.marktype].pick.call(this,o,t,n,r,i,s)}}const UQ=e=>e===r1||e===i1||e===s1?[r1,i1,s1]:[e];function h5(e,t){UQ(t).forEach(n=>qQ(e,n))}function qQ(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?r=>e[t](r):r=>e.fire(t,r)))}function kh(e,t,n){t.forEach(r=>e.fire(r,n))}function p5(e,t,n){return function(r){const i=this._active,s=this.pickEvent(r);s===i?kh(this,e,r):((!i||!i.exit)&&kh(this,n,r),this._active=s,kh(this,t,r),kh(this,e,r))}}function g5(e){return function(t){kh(this,e,t),this._active=null}}function WQ(){return typeof window<"u"&&window.devicePixelRatio||1}function HQ(e,t,n,r,i,s){const o=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,a=e.getContext("2d"),u=o?WQ():i;e.width=t*u,e.height=n*u;for(const l in s)a[l]=s[l];return o&&u!==1&&(e.style.width=t+"px",e.style.height=n+"px"),a.pixelRatio=u,a.setTransform(u,0,0,u,u*r[0],u*r[1]),e}class o1 extends xg{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new en,this._tempb=new en}initialize(t,n,r,i,s,o){return this._options=o||{},this._canvas=this._options.externalContext?null:nu(1,1,this._options.type),t&&this._canvas&&(_i(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,r,i,s)}resize(t,n,r,i){if(super.resize(t,n,r,i),this._canvas)HQ(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const s=this._options.externalContext;s||K("CanvasRenderer is missing a valid canvas or context"),s.scale(this._scale,this._scale),s.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let r=t.mark.group;for(;r;)n.translate(r.x||0,r.y||0),r=r.mark.group;this._dirty.union(n)}_render(t,n){const r=this.context(),i=this._origin,s=this._width,o=this._height,a=this._dirty,u=GQ(i,s,o);r.save();const l=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):YQ(r,u.intersect(a),i);return this.clear(-i[0],-i[1],s,o),this.draw(r,t,l,n),r.restore(),a.clear(),this}draw(t,n,r,i){if(n.marktype!=="group"&&i!=null&&!i.includes(n.marktype))return;const s=fi[n.marktype];n.clip&&WJ(t,n),s.draw.call(this,t,n,r,i),n.clip&&t.restore()}clear(t,n,r,i){const s=this._options,o=this.context();s.type!=="pdf"&&!s.externalContext&&o.clearRect(t,n,r,i),this._bgcolor!=null&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,r,i))}}const GQ=(e,t,n)=>new en().set(0,0,t,n).translate(-e[0],-e[1]);function YQ(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}class E7 extends tk{constructor(t,n){super(t,n);const r=this;r._hrefHandler=m2(r,(i,s)=>{s&&s.href&&r.handleHref(i,s,s.href)}),r._tooltipHandler=m2(r,(i,s)=>{r.handleTooltip(i,s,i.type!==Vh)})}initialize(t,n,r){let i=this._svg;return i&&(i.removeEventListener(B_,this._hrefHandler),i.removeEventListener(P_,this._tooltipHandler),i.removeEventListener(Vh,this._tooltipHandler)),this._svg=i=t&&ek(t,"svg"),i&&(i.addEventListener(B_,this._hrefHandler),i.addEventListener(P_,this._tooltipHandler),i.addEventListener(Vh,this._tooltipHandler)),super.initialize(t,n,r)}canvas(){return this._svg}on(t,n){const r=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[r],t,n)<0){const o={type:t,handler:n,listener:m2(this,n)};(i[r]||(i[r]=[])).push(o),this._svg&&this._svg.addEventListener(r,o.listener)}return this}off(t,n){const r=this.eventName(t),i=this._handlers[r],s=this._handlerIndex(i,t,n);return s>=0&&(this._svg&&this._svg.removeEventListener(r,i[s].listener),i.splice(s,1)),this}}const m2=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},A7="aria-hidden",nk="aria-label",rk="role",ik="aria-roledescription",S7="graphics-object",sk="graphics-symbol",k7=(e,t,n)=>({[rk]:e,[ik]:t,[nk]:n||void 0}),VQ=vs(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),m5={axis:{desc:"axis",caption:ZQ},legend:{desc:"legend",caption:JQ},"title-text":{desc:"title",caption:e=>`Title text '${y5(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${y5(e)}'`}},v5={ariaRole:rk,ariaRoleDescription:ik,description:nk};function C7(e,t){const n=t.aria===!1;if(e(A7,n||void 0),n||t.description==null)for(const r in v5)e(v5[r],void 0);else{const r=t.mark.marktype;e(nk,t.description),e(rk,t.ariaRole||(r==="group"?S7:sk)),e(ik,t.ariaRoleDescription||`${r} mark`)}}function F7(e){return e.aria===!1?{[A7]:!0}:VQ[e.role]?null:m5[e.role]?KQ(e,m5[e.role]):XQ(e)}function XQ(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(r=>r.description!=null&&r.aria!==!1);return k7(n?S7:sk,`${t} mark container`,e.description)}function KQ(e,t){try{const n=e.items[0],r=t.caption||(()=>"");return k7(t.role||sk,t.desc,n.description||r(n))}catch{return null}}function y5(e){return xe(e.text).join(" ")}function ZQ(e){const t=e.datum,n=e.orient,r=t.title?$7(e):null,i=e.context,s=i.scales[t.scale].value,o=i.dataflow.locale(),a=s.type;return`${n==="left"||n==="right"?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${jf(a)?"discrete":a} scale with ${UO(o,s,e)}`}function JQ(e){const t=e.datum,n=t.title?$7(e):null,r=`${t.type||""} legend`.trim(),i=t.scales,s=Object.keys(i),o=e.context,a=o.scales[i[s[0]]].value,u=o.dataflow.locale();return eee(r)+(n?` titled '${n}'`:"")+` for ${QQ(s)} with ${UO(u,a,e)}`}function $7(e){try{return xe(nt(e.items).items[0].text).join(" ")}catch{return null}}function QQ(e){return e=e.map(t=>t+(t==="fill"||t==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+nt(e)}function eee(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const D7=e=>(e+"").replace(/&/g,"&").replace(//g,">"),tee=e=>D7(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function ok(){let e="",t="",n="";const r=[],i=()=>t=n="",s=u=>{t&&(e+=`${t}>${n}`,i()),r.push(u)},o=(u,l)=>(l!=null&&(t+=` ${u}="${tee(l)}"`),a),a={open(u){s(u),t="<"+u;for(var l=arguments.length,c=new Array(l>1?l-1:0),f=1;f${n}`:"/>"):e+=``,i(),a},attr:o,text:u=>(n+=D7(u),a),toString:()=>e};return a}const M7=e=>R7(ok(),e)+"";function R7(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,r=n.length;for(let i=0;i{c.dirty=n})),!i.zdirty){if(r.exit){o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):r._svg&&(l=r._svg.parentNode,l&&l.removeChild(r._svg)),r._svg=null;continue}r=o.nested?i.items[0]:r,r._update!==n&&(!r._svg||!r._svg.ownerSVGElement?(this._dirtyAll=!1,x5(r,n)):this._update(o,r._svg,r),r._update=n)}return!this._dirtyAll}mark(t,n,r,i){if(!this.isDirty(n))return n._svg;const s=this._svg,o=n.marktype,a=fi[o],u=n.interactive===!1?"none":null,l=a.tag==="g",c=_5(n,t,r,"g",s);if(o!=="group"&&i!=null&&!i.includes(o))return _i(c,0),n._svg;c.setAttribute("class",m7(n));const f=F7(n);for(const g in f)lr(c,g,f[g]);l||lr(c,"pointer-events",u),lr(c,"clip-path",n.clip?PS(this,n,n.group):null);let d=null,h=0;const p=g=>{const m=this.isDirty(g),v=_5(g,c,d,a.tag,s);m&&(this._update(a,v,g),l&&iee(this,v,g,i)),d=v,++h};return a.nested?n.items.length&&p(n.items[0]):bs(n,p),_i(c,h),c}_update(t,n,r){Zo=n,Yn=n.__values__,C7(Xh,r),t.attr(Xh,r,this);const i=oee[t.type];i&&i.call(this,t,n,r),Zo&&this.style(Zo,r)}style(t,n){if(n!=null){for(const r in a1){let i=r==="font"?bg(n):n[r];if(i===Yn[r])continue;const s=a1[r];i==null?t.removeAttribute(s):(OS(i)&&(i=WO(i,this._defs.gradient,N7())),t.setAttribute(s,i+"")),Yn[r]=i}for(const r in u1)lm(t,u1[r],n[r])}}defs(){const t=this._svg,n=this._defs;let r=n.el,i=0;for(const s in n.gradient)r||(n.el=r=sn(t,nh+1,"defs",rn)),i=nee(r,n.gradient[s],i);for(const s in n.clipping)r||(n.el=r=sn(t,nh+1,"defs",rn)),i=ree(r,n.clipping[s],i);r&&(i===0?(t.removeChild(r),n.el=null):_i(r,i))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function x5(e,t){for(;e&&e.dirty!==t;e=e.mark.group)if(e.dirty=t,e.mark&&e.mark.dirty!==t)e.mark.dirty=t;else return}function nee(e,t,n){let r,i,s;if(t.gradient==="radial"){let o=sn(e,n++,"pattern",rn);Ua(o,{id:Km+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=sn(o,0,"rect",rn),Ua(o,{width:1,height:1,fill:`url(${N7()}#${t.id})`}),e=sn(e,n++,"radialGradient",rn),Ua(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=sn(e,n++,"linearGradient",rn),Ua(e,{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(r=0,i=t.stops.length;r{i=e.mark(t,o,i,r),++s}),_i(t,1+s)}function _5(e,t,n,r,i){let s=e._svg,o;if(!s&&(o=t.ownerDocument,s=ja(o,r,rn),e._svg=s,e.mark&&(s.__data__=e,s.__values__={fill:"default"},r==="g"))){const a=ja(o,"path",rn);s.appendChild(a),a.__data__=e;const u=ja(o,"g",rn);s.appendChild(u),u.__data__=e;const l=ja(o,"path",rn);s.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(s.ownerSVGElement!==i||see(s,n))&&t.insertBefore(s,n?n.nextSibling:t.firstChild),s}function see(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let Zo=null,Yn=null;const oee={group(e,t,n){const r=Zo=t.childNodes[2];Yn=r.__values__,e.foreground(Xh,n,this),Yn=t.__values__,Zo=t.childNodes[1],e.content(Xh,n,this);const i=Zo=t.childNodes[0];e.background(Xh,n,this);const s=n.mark.interactive===!1?"none":null;if(s!==Yn.events&&(lr(r,"pointer-events",s),lr(i,"pointer-events",s),Yn.events=s),n.strokeForeground&&n.stroke){const o=n.fill;lr(r,"display",null),this.style(i,n),lr(i,"stroke",null),o&&(n.fill=null),Yn=r.__values__,this.style(r,n),o&&(n.fill=o),Zo=null}else lr(r,"display","none")},image(e,t,n){n.smooth===!1?(lm(t,"image-rendering","optimizeSpeed"),lm(t,"image-rendering","pixelated")):lm(t,"image-rendering",null)},text(e,t,n){const r=yg(n);let i,s,o,a;Q(r)?(s=r.map(u=>hu(n,u)),i=s.join(` +`),i!==Yn.text&&(_i(t,0),o=t.ownerDocument,a=du(n),s.forEach((u,l)=>{const c=ja(o,"tspan",rn);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",a)),t.appendChild(c)}),Yn.text=i)):(s=hu(n,r),s!==Yn.text&&(t.textContent=s,Yn.text=s)),lr(t,"font-family",bg(n)),lr(t,"font-size",wo(n)+"px"),lr(t,"font-style",n.fontStyle),lr(t,"font-variant",n.fontVariant),lr(t,"font-weight",n.fontWeight)}};function Xh(e,t,n){t!==Yn[e]&&(n?aee(Zo,e,t,n):lr(Zo,e,t),Yn[e]=t)}function lm(e,t,n){n!==Yn[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),Yn[t]=n)}function Ua(e,t){for(const n in t)lr(e,n,t[n])}function lr(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function aee(e,t,n,r){n!=null?e.setAttributeNS(r,t,n):e.removeAttributeNS(r,t)}function N7(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class O7 extends xg{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=ok();n.open("svg",We({},xp,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const r=this._bgcolor;return r&&r!=="transparent"&&r!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:r}).close(),n.open("g",T7,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const r=fi[n.marktype],i=r.tag,s=[C7,r.attr];t.open("g",{class:m7(n),"clip-path":n.clip?PS(this,n,n.group):null},F7(n),{"pointer-events":i!=="g"&&n.interactive===!1?"none":null});const o=a=>{const u=this.href(a);if(u&&t.open("a",u),t.open(i,this.attr(n,a,s,i!=="g"?i:null)),i==="text"){const l=yg(a);if(Q(l)){const c={x:0,dy:du(a)};for(let f=0;fthis.mark(t,d)),t.close(),l&&f?(c&&(a.fill=null),a.stroke=f,t.open("path",this.attr(n,a,r.foreground,"bgrect")).close(),c&&(a.fill=c)):t.open("path",this.attr(n,a,r.foreground,"bgfore")).close()}t.close(),u&&t.close()};return r.nested?n.items&&n.items.length&&o(n.items[0]):bs(n,o),t.close()}href(t){const n=t.href;let r;if(n){if(r=this._hrefs&&this._hrefs[n])return r;this.sanitizeURL(n).then(i=>{i["xlink:href"]=i.href,i.href=null,(this._hrefs||(this._hrefs={}))[n]=i})}return null}attr(t,n,r,i){const s={},o=(a,u,l,c)=>{s[c||a]=u};return Array.isArray(r)?r.forEach(a=>a(o,n,this)):r(o,n,this),i&&uee(s,n,t,i,this._defs),s}defs(t){const n=this._defs.gradient,r=this._defs.clipping;if(Object.keys(n).length+Object.keys(r).length!==0){t.open("defs");for(const s in n){const o=n[s],a=o.stops;o.gradient==="radial"?(t.open("pattern",{id:Km+s,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+s+")"}).close(),t.close(),t.open("radialGradient",{id:s,fx:o.x1,fy:o.y1,fr:o.r1,cx:o.x2,cy:o.y2,r:o.r2})):t.open("linearGradient",{id:s,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2});for(let u=0;u!Qi.svgMarkTypes.includes(s));this._svgRenderer.render(t,Qi.svgMarkTypes),this._canvasRenderer.render(t,i)}resize(t,n,r,i){return super.resize(t,n,r,i),this._svgRenderer.resize(t,n,r,i),this._canvasRenderer.resize(t,n,r,i),this}background(t){return Qi.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class L7 extends _g{constructor(t,n){super(t,n)}initialize(t,n,r){const i=sn(sn(t,0,"div"),Qi.svgOnTop?0:1,"div");return super.initialize(i,n,r)}}const I7="canvas",P7="hybrid",B7="png",z7="svg",j7="none",qa={Canvas:I7,PNG:B7,SVG:z7,Hybrid:P7,None:j7},jl={};jl[I7]=jl[B7]={renderer:o1,headless:o1,handler:_g};jl[z7]={renderer:ak,headless:O7,handler:E7};jl[P7]={renderer:z_,headless:z_,handler:L7};jl[j7]={};function fy(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(jl[e]=t,this):jl[e]}function U7(e,t,n){const r=[],i=new en().union(t),s=e.marktype;return s?q7(e,i,n,r):s==="group"?W7(e,i,n,r):K("Intersect scene must be mark node or group item.")}function q7(e,t,n,r){if(cee(e,t,n)){const i=e.items,s=e.marktype,o=i.length;let a=0;if(s==="group")for(;a=0;s--)if(n[s]!=r[s])return!1;for(s=n.length-1;s>=0;s--)if(i=n[s],!uk(e[i],t[i],i))return!1;return typeof e==typeof t}function hee(){ZO(),IZ()}const Hf="top",ss="left",ls="right",pu="bottom",pee="top-left",gee="top-right",mee="bottom-left",vee="bottom-right",lk="start",j_="middle",cr="end",yee="x",bee="y",dy="group",ck="axis",fk="title",xee="frame",_ee="scope",dk="legend",V7="row-header",X7="row-footer",K7="row-title",Z7="column-header",J7="column-footer",Q7="column-title",wee="padding",Eee="symbol",e9="fit",t9="fit-x",n9="fit-y",Aee="pad",hk="none",f0="all",U_="each",pk="flush",Wa="column",Ha="row";function r9(e){G.call(this,null,e)}pe(r9,G,{transform(e,t){const n=t.dataflow,r=e.mark,i=r.marktype,s=fi[i],o=s.bound;let a=r.bounds,u;if(s.nested)r.items.length&&n.dirty(r.items[0]),a=d0(r,o),r.items.forEach(l=>{l.bounds.clear().union(a)});else if(i===dy||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),a.clear(),r.items.forEach(l=>a.union(d0(l,o))),r.role){case ck:case dk:case fk:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{a.union(d0(l,o))}),t.visit(t.MOD,l=>{u=u||a.alignsWith(l.bounds),n.dirty(l),a.union(d0(l,o))}),u&&(a.clear(),r.items.forEach(l=>a.union(l.bounds)));return G7(r),t.modifies("bounds")}});function d0(e,t,n){return t(e.bounds.clear(),e,n)}const w5=":vega_identifier:";function gk(e){G.call(this,0,e)}gk.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};pe(gk,G,{transform(e,t){const n=See(t.dataflow),r=e.as;let i=n.value;return t.visit(t.ADD,s=>s[r]=s[r]||++i),n.set(this.value=i),t}});function See(e){return e._signals[w5]||(e._signals[w5]=e.add(0))}function i9(e){G.call(this,null,e)}pe(i9,G,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,kee(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const r=n.marktype===dy?ry:ny;return t.visit(t.ADD,i=>r.call(i,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});function kee(e){const t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function s9(e){G.call(this,null,e)}const E5={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((r,i)=>!i||!o9(n.bounds,r.bounds,t)?(n=r,1):r.opacity=0)}},o9=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),A5=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,s;n{const t=e.bounds;return t.width()>1&&t.height()>1},Fee=(e,t,n)=>{var r=e.range(),i=new en;return t===Hf||t===pu?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),s=>i.encloses(s.bounds)},S5=e=>(e.forEach(t=>t.opacity=1),e),k5=(e,t)=>e.reflow(t.modified()).modifies("opacity");pe(s9,G,{transform(e,t){const n=E5[e.method]||E5.parity,r=e.separation||0;let i=t.materialize(t.SOURCE).source,s,o;if(!i||!i.length)return;if(!e.method)return e.modified("method")&&(S5(i),t=k5(t,e)),t;if(i=i.filter(Cee),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),s=S5(i),t=k5(t,e),s.length>=3&&A5(s,r)){do s=n(s,r);while(s.length>=3&&A5(s,r));s.length<3&&!nt(i).opacity&&(s.length>1&&(nt(s).opacity=0),nt(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=Fee(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(u=>{o(u)||(u.opacity=0)}));const a=s[0].mark.bounds.clear();return i.forEach(u=>{u.opacity&&a.union(u.bounds)}),t}});function a9(e){G.call(this,null,e)}pe(a9,G,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,r=>n.dirty(r)),t.fields&&t.fields.zindex){const r=t.source&&t.source[0];r&&(r.mark.zdirty=!0)}}});const Gn=new en;function Jc(e,t,n){return e[t]===n?0:(e[t]=n,1)}function $ee(e){var t=e.items[0].orient;return t===ss||t===ls}function Dee(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function Mee(e,t,n,r){var i=t.items[0],s=i.datum,o=i.translate!=null?i.translate:.5,a=i.orient,u=Dee(s),l=i.range,c=i.offset,f=i.position,d=i.minExtent,h=i.maxExtent,p=s.title&&i.items[u[2]].items[0],g=i.titlePadding,m=i.bounds,v=p&&ZS(p),y=0,b=0,x,_;switch(Gn.clear().union(m),m.clear(),(x=u[0])>-1&&m.union(i.items[x].bounds),(x=u[1])>-1&&m.union(i.items[x].bounds),a){case Hf:y=f||0,b=-c,_=Math.max(d,Math.min(h,-m.y1)),m.add(0,-_).add(l,0),p&&h0(e,p,_,g,v,0,-1,m);break;case ss:y=-c,b=f||0,_=Math.max(d,Math.min(h,-m.x1)),m.add(-_,0).add(0,l),p&&h0(e,p,_,g,v,1,-1,m);break;case ls:y=n+c,b=f||0,_=Math.max(d,Math.min(h,m.x2)),m.add(0,0).add(_,l),p&&h0(e,p,_,g,v,1,1,m);break;case pu:y=f||0,b=r+c,_=Math.max(d,Math.min(h,m.y2)),m.add(0,0).add(l,_),p&&h0(e,p,_,g,0,0,1,m);break;default:y=i.x,b=i.y}return pa(m.translate(y,b),i),Jc(i,"x",y+o)|Jc(i,"y",b+o)&&(i.bounds=Gn,e.dirty(i),i.bounds=m,e.dirty(i)),i.mark.bounds.clear().union(m)}function h0(e,t,n,r,i,s,o,a){const u=t.bounds;if(t.auto){const l=o*(n+i+r);let c=0,f=0;e.dirty(t),s?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(u.translate(-c,-f)),e.dirty(t)}a.union(u)}const C5=(e,t)=>Math.floor(Math.min(e,t)),F5=(e,t)=>Math.ceil(Math.max(e,t));function Ree(e){var t=e.items,n=t.length,r=0,i,s;const o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r1)for(E=0;E0&&(b[E]+=$/2);if(a&&Rt(n.center,Ha)&&c!==1)for(E=0;E0&&(x[E]+=C/2);for(E=0;Ei&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),g+=s,y=0,x=t.length;y=0&&(E=n[b])==null;b-=d);a?(S=h==null?E.x:Math.round(E.bounds.x1+h*E.bounds.width()),k=g):(S=g,k=h==null?E.y:Math.round(E.bounds.y1+h*E.bounds.height())),_.union(A.bounds.translate(S-(A.x||0),k-(A.y||0))),A.x=S,A.y=k,e.dirty(A),m=o(m,_[l])}return m}function D5(e,t,n,r,i,s){if(t){e.dirty(t);var o=n,a=n;r?o=Math.round(i.x1+s*i.width()):a=Math.round(i.y1+s*i.height()),t.bounds.translate(o-(t.x||0),a-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=a,e.dirty(t)}}function Pee(e,t){const n=e[t]||{};return(r,i)=>n[r]!=null?n[r]:e[r]!=null?e[r]:i}function Bee(e,t){let n=-1/0;return e.forEach(r=>{r.offset!=null&&(n=Math.max(n,r.offset))}),n>-1/0?n:t}function zee(e,t,n,r,i,s,o){const a=Pee(n,t),u=Bee(e,a("offset",0)),l=a("anchor",lk),c=l===cr?1:l===j_?.5:0,f={align:U_,bounds:a("bounds",pk),columns:a("direction")==="vertical"?1:e.length,padding:a("margin",8),center:a("center"),nodirty:!0};switch(t){case ss:f.anchor={x:Math.floor(r.x1)-u,column:cr,y:c*(o||r.height()+2*r.y1),row:l};break;case ls:f.anchor={x:Math.ceil(r.x2)+u,y:c*(o||r.height()+2*r.y1),row:l};break;case Hf:f.anchor={y:Math.floor(i.y1)-u,row:cr,x:c*(s||i.width()+2*i.x1),column:l};break;case pu:f.anchor={y:Math.ceil(i.y2)+u,x:c*(s||i.width()+2*i.x1),column:l};break;case pee:f.anchor={x:u,y:u};break;case gee:f.anchor={x:s-u,y:u,column:cr};break;case mee:f.anchor={x:u,y:o-u,row:cr};break;case vee:f.anchor={x:s-u,y:o-u,column:cr,row:cr};break}return f}function jee(e,t){var n=t.items[0],r=n.datum,i=n.orient,s=n.bounds,o=n.x,a=n.y,u,l;return n._bounds?n._bounds.clear().union(s):n._bounds=s.clone(),s.clear(),qee(e,n,n.items[0].items[0]),s=Uee(n,s),u=2*n.padding,l=2*n.padding,s.empty()||(u=Math.ceil(s.width()+u),l=Math.ceil(s.height()+l)),r.type===Eee&&Wee(n.items[0].items[0].items[0].items),i!==hk&&(n.x=o=0,n.y=a=0),n.width=u,n.height=l,pa(s.set(o,a,o+u,a+l),n),n.mark.bounds.clear().union(s),n}function Uee(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function qee(e,t,n){var r=t.padding,i=r-n.x,s=r-n.y;if(!t.datum.title)(i||s)&&rh(e,n,i,s);else{var o=t.items[1].items[0],a=o.anchor,u=t.titlePadding||0,l=r-o.x,c=r-o.y;switch(o.orient){case ss:i+=Math.ceil(o.bounds.width())+u;break;case ls:case pu:break;default:s+=o.bounds.height()+u}switch((i||s)&&rh(e,n,i,s),o.orient){case ss:c+=Nc(t,n,o,a,1,1);break;case ls:l+=Nc(t,n,o,cr,0,0)+u,c+=Nc(t,n,o,a,1,1);break;case pu:l+=Nc(t,n,o,a,0,0),c+=Nc(t,n,o,cr,-1,0,1)+u;break;default:l+=Nc(t,n,o,a,0,0)}(l||c)&&rh(e,o,l,c),(l=Math.round(o.bounds.x1-r))<0&&(rh(e,n,-l,0),rh(e,o,-l,0))}}function Nc(e,t,n,r,i,s,o){const a=e.datum.type!=="symbol",u=n.datum.vgrad,l=a&&(s||!u)&&!o?t.items[0]:t,c=l.bounds[i?"y2":"x2"]-e.padding,f=u&&s?c:0,d=u&&s?0:c,h=i<=0?0:ZS(n);return Math.round(r===lk?f:r===cr?d-h:.5*(c-h))}function rh(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function Wee(e){const t=e.reduce((n,r)=>(n[r.column]=Math.max(r.bounds.x2-r.x,n[r.column]||0),n),{});e.forEach(n=>{n.width=t[n.column],n.height=n.bounds.y2-n.y})}function Hee(e,t,n,r,i){var s=t.items[0],o=s.frame,a=s.orient,u=s.anchor,l=s.offset,c=s.padding,f=s.items[0].items[0],d=s.items[1]&&s.items[1].items[0],h=a===ss||a===ls?r:n,p=0,g=0,m=0,v=0,y=0,b;if(o!==dy?a===ss?(p=i.y2,h=i.y1):a===ls?(p=i.y1,h=i.y2):(p=i.x1,h=i.x2):a===ss&&(p=r,h=0),b=u===lk?p:u===cr?h:(p+h)/2,d&&d.text){switch(a){case Hf:case pu:y=f.bounds.height()+c;break;case ss:v=f.bounds.width()+c;break;case ls:v=-f.bounds.width()-c;break}Gn.clear().union(d.bounds),Gn.translate(v-(d.x||0),y-(d.y||0)),Jc(d,"x",v)|Jc(d,"y",y)&&(e.dirty(d),d.bounds.clear().union(Gn),d.mark.bounds.clear().union(Gn),e.dirty(d)),Gn.clear().union(d.bounds)}else Gn.clear();switch(Gn.union(f.bounds),a){case Hf:g=b,m=i.y1-Gn.height()-l;break;case ss:g=i.x1-Gn.width()-l,m=b;break;case ls:g=i.x2+Gn.width()+l,m=b;break;case pu:g=b,m=i.y2+l;break;default:g=s.x,m=s.y}return Jc(s,"x",g)|Jc(s,"y",m)&&(Gn.translate(g,m),e.dirty(s),s.bounds.clear().union(Gn),t.bounds.clear().union(Gn),e.dirty(s)),s.bounds}function l9(e){G.call(this,null,e)}pe(l9,G,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(r=>{e.layout&&Oee(n,r,e.layout),Yee(n,r,e)}),Gee(e.mark.group)?t.reflow():t}});function Gee(e){return e&&e.mark.role!=="legend-entry"}function Yee(e,t,n){var r=t.items,i=Math.max(0,t.width||0),s=Math.max(0,t.height||0),o=new en().set(0,0,i,s),a=o.clone(),u=o.clone(),l=[],c,f,d,h,p,g;for(p=0,g=r.length;p{d=v.orient||ls,d!==hk&&(m[d]||(m[d]=[])).push(v)});for(const v in m){const y=m[v];u9(e,y,zee(y,v,n.legends,a,u,i,s))}l.forEach(v=>{const y=v.bounds;if(y.equals(v._bounds)||(v.bounds=v._bounds,e.dirty(v),v.bounds=y,e.dirty(v)),n.autosize&&(n.autosize.type===e9||n.autosize.type===t9||n.autosize.type===n9))switch(v.orient){case ss:case ls:o.add(y.x1,0).add(y.x2,0);break;case Hf:case pu:o.add(0,y.y1).add(0,y.y2)}else o.union(y)})}o.union(a).union(u),c&&o.union(Hee(e,c,i,s,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),Vee(e,t,o,n)}function Vee(e,t,n,r){const i=r.autosize||{},s=i.type;if(e._autosize<1||!s)return;let o=e._width,a=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),h=Math.max(0,Math.ceil(n.y2-c));if(i.contains===wee){const p=e.padding();o-=p.left+p.right,a-=p.top+p.bottom}s===hk?(l=0,f=0,u=o,c=a):s===e9?(u=Math.max(0,o-l-d),c=Math.max(0,a-f-h)):s===t9?(u=Math.max(0,o-l-d),a=c+f+h):s===n9?(o=u+l+d,c=Math.max(0,a-f-h)):s===Aee&&(o=u+l+d,a=c+f+h),e._resizeView(o,a,u,c,[l,f],i.resize)}const Xee=Object.freeze(Object.defineProperty({__proto__:null,bound:r9,identifier:gk,mark:i9,overlap:s9,render:a9,viewlayout:l9},Symbol.toStringTag,{value:"Module"}));function c9(e){G.call(this,null,e)}pe(c9,G,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,s=e.scale,o=e.count==null?e.values?e.values.length:10:e.count,a=TS(s,o,e.minstep),u=e.format||IO(n,s,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?LO(s,e.values,a):NS(s,a);return i&&(r.rem=i),i=l.map((c,f)=>ht({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&i.length&&i.push(ht({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}});function f9(e){G.call(this,null,e)}function Kee(){return ht({})}function Zee(e){const t=bd().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}pe(f9,G,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||Kee,s=e.key||Ne,o=this.value;return Q(r.encode)&&(r.encode=null),o&&(e.modified("key")||t.modified(s))&&K("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=Zee(s)),t.visit(t.ADD,a=>{const u=s(a);let l=o.get(u);l?l.exit?(o.empty--,r.add.push(l)):r.mod.push(l):(l=i(a),o.set(u,l),r.add.push(l)),l.datum=a,l.exit=!1}),t.visit(t.MOD,a=>{const u=s(a),l=o.get(u);l&&(l.datum=a,r.mod.push(l))}),t.visit(t.REM,a=>{const u=s(a),l=o.get(u);a===l.datum&&!l.exit&&(r.rem.push(l),l.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&r.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r}});function d9(e){G.call(this,null,e)}pe(d9,G,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,s=t.encode;if(Q(s))if(n.changed()||s.every(f=>i[f]))s=s[0],n.encode=null;else return t.StopPropagation;var o=s==="enter",a=i.update||Fa,u=i.enter||Fa,l=i.exit||Fa,c=(s&&!o?i[s]:a)||Fa;if(t.changed(t.ADD)&&(t.visit(t.ADD,f=>{u(f,e),a(f,e)}),n.modifies(u.output),n.modifies(a.output),c!==Fa&&c!==a&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==Fa&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),o||c!==Fa){const f=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(f,d=>{const h=u(d,e)||r;(c(d,e)||h)&&n.mod.push(d)}),n.mod.length&&n.modifies(u.output)):t.visit(f,d=>{(c(d,e)||r)&&n.mod.push(d)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}});function h9(e){G.call(this,[],e)}pe(h9,G,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,s=e.type||tm,o=e.scale,a=+e.limit,u=TS(o,e.count==null?5:e.count,e.minstep),l=!!e.values||s===tm,c=e.format||jO(n,o,u,s,e.formatSpecifier,e.formatType,l),f=e.values||zO(o,u),d,h,p,g,m;return i&&(r.rem=i),s===tm?(a&&f.length>a?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),i=f.slice(0,a-1),m=!0):i=f,He(p=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),g=i.reduce((v,y)=>Math.max(v,p(y,e)),0)):p=ir(g=p||8),i=i.map((v,y)=>ht({index:y,label:c(v,y,i),value:v,offset:g,size:p(v,e)})),m&&(m=f[i.length],i.push(ht({index:i.length,label:`โ€ฆ${f.length-i.length} entries`,value:m,offset:g,size:p(m,e)})))):s===AZ?(d=o.domain(),h=TO(o,d[0],nt(d)),f.length<3&&!e.values&&d[0]!==nt(d)&&(f=[d[0],nt(d)]),i=f.map((v,y)=>ht({index:y,label:c(v,y,f),value:v,perc:h(v)}))):(p=f.length-1,h=OZ(o),i=f.map((v,y)=>ht({index:y,label:c(v,y,f),value:v,perc:y?h(v):0,perc2:y===p?1:h(f[y+1])}))),r.source=i,r.add=i,this.value=i,r}});const Jee=e=>e.source.x,Qee=e=>e.source.y,ete=e=>e.target.x,tte=e=>e.target.y;function mk(e){G.call(this,{},e)}mk.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]};pe(mk,G,{transform(e,t){var n=e.sourceX||Jee,r=e.sourceY||Qee,i=e.targetX||ete,s=e.targetY||tte,o=e.as||"path",a=e.orient||"vertical",u=e.shape||"line",l=M5.get(u+"-"+a)||M5.get(u);return l||K("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,c=>{c[o]=l(n(c),r(c),i(c),s(c))}),t.reflow(e.modified()).modifies(o)}});const p9=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,nte=(e,t,n,r)=>p9(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),g9=(e,t,n,r)=>{var i=n-e,s=r-t,o=Math.hypot(i,s)/2,a=180*Math.atan2(s,i)/Math.PI;return"M"+e+","+t+"A"+o+","+o+" "+a+" 0 1 "+n+","+r},rte=(e,t,n,r)=>g9(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),m9=(e,t,n,r)=>{const i=n-e,s=r-t,o=.2*(i+s),a=.2*(s-i);return"M"+e+","+t+"C"+(e+o)+","+(t+a)+" "+(n+a)+","+(r-o)+" "+n+","+r},ite=(e,t,n,r)=>m9(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),ste=(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,ote=(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,ate=(e,t,n,r)=>{const i=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n),u=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*s+"A"+t+","+t+" 0 0,"+(u?1:0)+" "+t*o+","+t*a+"L"+r*o+","+r*a},ute=(e,t,n,r)=>{const i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},lte=(e,t,n,r)=>{const i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},cte=(e,t,n,r)=>{const i=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n),u=(t+r)/2;return"M"+t*i+","+t*s+"C"+u*i+","+u*s+" "+u*o+","+u*a+" "+r*o+","+r*a},M5=bd({line:p9,"line-radial":nte,arc:g9,"arc-radial":rte,curve:m9,"curve-radial":ite,"orthogonal-horizontal":ste,"orthogonal-vertical":ote,"orthogonal-radial":ate,"diagonal-horizontal":ute,"diagonal-vertical":lte,"diagonal-radial":cte});function vk(e){G.call(this,null,e)}vk.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]};pe(vk,G,{transform(e,t){var n=e.as||["startAngle","endAngle"],r=n[0],i=n[1],s=e.field||gd,o=e.startAngle||0,a=e.endAngle!=null?e.endAngle:2*Math.PI,u=t.source,l=u.map(s),c=l.length,f=o,d=(a-o)/MR(l),h=ni(c),p,g,m;for(e.sort&&h.sort((v,y)=>l[v]-l[y]),p=0;p-1)return r;var i=t.domain,s=e.type,o=t.zero||t.zero===void 0&&dte(e),a,u;if(!i)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(a=(i=i.slice()).length-1||1,o&&(i[0]>0&&(i[0]=0),i[a]<0&&(i[a]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[a]=t.domainMax),t.domainMid!=null)){u=t.domainMid;const l=u>i[a]?a+1:ui+(s<0?-1:s>0?1:0),0));r!==t.length&&n.warn("Log scale domain includes zero: "+ce(t))}return t}function bte(e,t,n){let r=t.bins;if(r&&!Q(r)){const i=e.domain(),s=i[0],o=nt(i),a=r.step;let u=r.start==null?s:r.start,l=r.stop==null?o:r.stop;a||K("Scale bins parameter missing step property."),uo&&(l=a*Math.floor(o/a)),r=ni(u,l+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===CS&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function xte(e,t,n){var r=e.type,i=t.round||!1,s=t.range;if(t.rangeStep!=null)s=_te(r,t,n);else if(t.scheme&&(s=wte(r,t,n),He(s))){if(e.interpolator)return e.interpolator(s);K(`Scale type ${r} does not support interpolating color schemes.`)}if(s&&$O(r))return e.interpolator(ey(q_(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(MS(t.interpolate,t.interpolateGamma)):He(e.round)?e.round(i):He(e.rangeRound)&&e.interpolate(i?ag:Cu),s&&e.range(q_(s,t.reverse))}function _te(e,t,n){e!==wO&&e!==F_&&K("Only band and point scales support rangeStep.");var r=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,i=e===F_?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*SS(n,i,r)]}function wte(e,t,n){var r=t.schemeExtent,i,s;return Q(t.scheme)?s=ey(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),s=RS(i),s||K(`Unrecognized scheme name: ${t.scheme}`)),n=e===Qv?n+1:e===CS?n-1:e===zf||e===Jv?+t.schemeCount||fte:n,$O(e)?R5(s,r,t.reverse):He(s)?RO(R5(s,r),n):e===kS?s:s.slice(0,n)}function R5(e,t,n){return He(e)&&(t||n)?MO(e,q_(t||[0,1],n)):e}function q_(e,t){return t?e.slice().reverse():e}function x9(e){G.call(this,null,e)}pe(x9,G,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(cc(e.sort)),this.modified(n),t}});const T5="zero",_9="center",w9="normalize",E9=["y0","y1"];function yk(e){G.call(this,null,e)}yk.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:T5,values:[T5,_9,w9]},{name:"as",type:"string",array:!0,length:2,default:E9}]};pe(yk,G,{transform(e,t){var n=e.as||E9,r=n[0],i=n[1],s=cc(e.sort),o=e.field||gd,a=e.offset===_9?Ete:e.offset===w9?Ate:Ste,u,l,c,f;for(u=kte(t.source,e.groupby,s,o),l=0,c=u.length,f=u.max;lg(c),o,a,u,l,c,f,d,h,p;if(t==null)i.push(e.slice());else for(o={},a=0,u=e.length;ap&&(p=h),n&&d.sort(n)}return i.max=p,i}const Cte=Object.freeze(Object.defineProperty({__proto__:null,axisticks:c9,datajoin:f9,encode:d9,legendentries:h9,linkpath:mk,pie:vk,scale:y9,sortitems:x9,stack:yk},Symbol.toStringTag,{value:"Module"}));var Ie=1e-6,l1=1e-12,Ke=Math.PI,Ut=Ke/2,c1=Ke/4,br=Ke*2,Vt=180/Ke,Ve=Ke/180,tt=Math.abs,$d=Math.atan,Pi=Math.atan2,Pe=Math.cos,g0=Math.ceil,A9=Math.exp,W_=Math.hypot,f1=Math.log,y2=Math.pow,Oe=Math.sin,Si=Math.sign||function(e){return e>0?1:e<0?-1:0},xr=Math.sqrt,bk=Math.tan;function S9(e){return e>1?0:e<-1?Ke:Math.acos(e)}function Ur(e){return e>1?Ut:e<-1?-Ut:Math.asin(e)}function Tn(){}function d1(e,t){e&&O5.hasOwnProperty(e.type)&&O5[e.type](e,t)}var N5={Feature:function(e,t){d1(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,s=Pe(t),o=Oe(t),a=V_*o,u=Y_*s+a*Pe(i),l=a*r*Oe(i);h1.add(Pi(l,u)),G_=e,Y_=s,V_=o}function Mte(e){return p1=new vr,Ho(e,ho),p1*2}function g1(e){return[Pi(e[1],e[0]),Ur(e[2])]}function Ul(e){var t=e[0],n=e[1],r=Pe(n);return[r*Pe(t),r*Oe(t),Oe(n)]}function m0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gf(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function b2(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function v0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function m1(e){var t=xr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var It,Tr,zt,ei,Ju,$9,D9,uf,Kh,Ta,ca,zo={point:X_,lineStart:I5,lineEnd:P5,polygonStart:function(){zo.point=R9,zo.lineStart=Rte,zo.lineEnd=Tte,Kh=new vr,ho.polygonStart()},polygonEnd:function(){ho.polygonEnd(),zo.point=X_,zo.lineStart=I5,zo.lineEnd=P5,h1<0?(It=-(zt=180),Tr=-(ei=90)):Kh>Ie?ei=90:Kh<-Ie&&(Tr=-90),ca[0]=It,ca[1]=zt},sphere:function(){It=-(zt=180),Tr=-(ei=90)}};function X_(e,t){Ta.push(ca=[It=e,zt=e]),tei&&(ei=t)}function M9(e,t){var n=Ul([e*Ve,t*Ve]);if(uf){var r=Gf(uf,n),i=[r[1],-r[0],0],s=Gf(i,r);m1(s),s=g1(s);var o=e-Ju,a=o>0?1:-1,u=s[0]*Vt*a,l,c=tt(o)>180;c^(a*Juei&&(ei=l)):(u=(u+360)%360-180,c^(a*Juei&&(ei=t))),c?eQr(It,zt)&&(zt=e):Qr(e,zt)>Qr(It,zt)&&(It=e):zt>=It?(ezt&&(zt=e)):e>Ju?Qr(It,e)>Qr(It,zt)&&(zt=e):Qr(e,zt)>Qr(It,zt)&&(It=e)}else Ta.push(ca=[It=e,zt=e]);tei&&(ei=t),uf=n,Ju=e}function I5(){zo.point=M9}function P5(){ca[0]=It,ca[1]=zt,zo.point=X_,uf=null}function R9(e,t){if(uf){var n=e-Ju;Kh.add(tt(n)>180?n+(n>0?360:-360):n)}else $9=e,D9=t;ho.point(e,t),M9(e,t)}function Rte(){ho.lineStart()}function Tte(){R9($9,D9),ho.lineEnd(),tt(Kh)>Ie&&(It=-(zt=180)),ca[0]=It,ca[1]=zt,uf=null}function Qr(e,t){return(t-=e)<0?t+360:t}function Nte(e,t){return e[0]-t[0]}function B5(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tQr(r[0],r[1])&&(r[1]=i[1]),Qr(i[0],r[1])>Qr(r[0],r[1])&&(r[0]=i[0])):s.push(r=i);for(o=-1/0,n=s.length-1,t=0,r=s[n];t<=n;r=i,++t)i=s[t],(a=Qr(r[1],i[0]))>o&&(o=a,It=i[0],zt=r[1])}return Ta=ca=null,It===1/0||Tr===1/0?[[NaN,NaN],[NaN,NaN]]:[[It,Tr],[zt,ei]]}var Ch,v1,y1,b1,x1,_1,w1,E1,K_,Z_,J_,T9,N9,fr,dr,hr,cs={sphere:Tn,point:xk,lineStart:z5,lineEnd:j5,polygonStart:function(){cs.lineStart=Pte,cs.lineEnd=Bte},polygonEnd:function(){cs.lineStart=z5,cs.lineEnd=j5}};function xk(e,t){e*=Ve,t*=Ve;var n=Pe(t);wg(n*Pe(e),n*Oe(e),Oe(t))}function wg(e,t,n){++Ch,y1+=(e-y1)/Ch,b1+=(t-b1)/Ch,x1+=(n-x1)/Ch}function z5(){cs.point=Lte}function Lte(e,t){e*=Ve,t*=Ve;var n=Pe(t);fr=n*Pe(e),dr=n*Oe(e),hr=Oe(t),cs.point=Ite,wg(fr,dr,hr)}function Ite(e,t){e*=Ve,t*=Ve;var n=Pe(t),r=n*Pe(e),i=n*Oe(e),s=Oe(t),o=Pi(xr((o=dr*s-hr*i)*o+(o=hr*r-fr*s)*o+(o=fr*i-dr*r)*o),fr*r+dr*i+hr*s);v1+=o,_1+=o*(fr+(fr=r)),w1+=o*(dr+(dr=i)),E1+=o*(hr+(hr=s)),wg(fr,dr,hr)}function j5(){cs.point=xk}function Pte(){cs.point=zte}function Bte(){O9(T9,N9),cs.point=xk}function zte(e,t){T9=e,N9=t,e*=Ve,t*=Ve,cs.point=O9;var n=Pe(t);fr=n*Pe(e),dr=n*Oe(e),hr=Oe(t),wg(fr,dr,hr)}function O9(e,t){e*=Ve,t*=Ve;var n=Pe(t),r=n*Pe(e),i=n*Oe(e),s=Oe(t),o=dr*s-hr*i,a=hr*r-fr*s,u=fr*i-dr*r,l=W_(o,a,u),c=Ur(l),f=l&&-c/l;K_.add(f*o),Z_.add(f*a),J_.add(f*u),v1+=c,_1+=c*(fr+(fr=r)),w1+=c*(dr+(dr=i)),E1+=c*(hr+(hr=s)),wg(fr,dr,hr)}function jte(e){Ch=v1=y1=b1=x1=_1=w1=E1=0,K_=new vr,Z_=new vr,J_=new vr,Ho(e,cs);var t=+K_,n=+Z_,r=+J_,i=W_(t,n,r);return iKe&&(e-=Math.round(e/br)*br),[e,t]}ew.invert=ew;function L9(e,t,n){return(e%=br)?t||n?Q_(q5(e),W5(t,n)):q5(e):t||n?W5(t,n):ew}function U5(e){return function(t,n){return t+=e,tt(t)>Ke&&(t-=Math.round(t/br)*br),[t,n]}}function q5(e){var t=U5(e);return t.invert=U5(-e),t}function W5(e,t){var n=Pe(e),r=Oe(e),i=Pe(t),s=Oe(t);function o(a,u){var l=Pe(u),c=Pe(a)*l,f=Oe(a)*l,d=Oe(u),h=d*n+c*r;return[Pi(f*i-h*s,c*n-d*r),Ur(h*i+f*s)]}return o.invert=function(a,u){var l=Pe(u),c=Pe(a)*l,f=Oe(a)*l,d=Oe(u),h=d*i-f*s;return[Pi(f*i+d*s,c*n+h*r),Ur(h*n-c*r)]},o}function Ute(e){e=L9(e[0]*Ve,e[1]*Ve,e.length>2?e[2]*Ve:0);function t(n){return n=e(n[0]*Ve,n[1]*Ve),n[0]*=Vt,n[1]*=Vt,n}return t.invert=function(n){return n=e.invert(n[0]*Ve,n[1]*Ve),n[0]*=Vt,n[1]*=Vt,n},t}function qte(e,t,n,r,i,s){if(n){var o=Pe(t),a=Oe(t),u=r*n;i==null?(i=t+r*br,s=t-u/2):(i=H5(o,i),s=H5(o,s),(r>0?is)&&(i+=r*br));for(var l,c=i;r>0?c>s:c1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function cm(e,t){return tt(e[0]-t[0])=0;--a)i.point((f=c[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,h=!h}while(!d.v);i.lineEnd()}}}function G5(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n=0?1:-1,F=k*S,D=F>Ke,M=m*A;if(u.add(Pi(M*k*Oe(F),v*E+M*Pe(F))),o+=D?S+k*br:S,D^p>=n^x>=n){var T=Gf(Ul(h),Ul(b));m1(T);var $=Gf(s,T);m1($);var C=(D^S>=0?-1:1)*Ur($[2]);(r>C||r===C&&(T[0]||T[1]))&&(a+=D^S>=0?1:-1)}}return(o<-Ie||o0){for(u||(i.polygonStart(),u=!0),i.lineStart(),A=0;A1&&x&2&&_.push(_.pop().concat(_.shift())),c.push(_.filter(Hte))}}return d}}function Hte(e){return e.length>1}function Gte(e,t){return((e=e.x)[0]<0?e[1]-Ut-Ie:Ut-e[1])-((t=t.x)[0]<0?t[1]-Ut-Ie:Ut-t[1])}const Y5=B9(function(){return!0},Yte,Xte,[-Ke,-Ut]);function Yte(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(s,o){var a=s>0?Ke:-Ke,u=tt(s-t);tt(u-Ke)0?Ut:-Ut),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(s,n),i=0):r!==a&&u>=Ke&&(tt(t-r)Ie?$d((Oe(t)*(s=Pe(r))*Oe(n)-Oe(r)*(i=Pe(t))*Oe(e))/(i*s*o)):(t+r)/2}function Xte(e,t,n,r){var i;if(e==null)i=n*Ut,r.point(-Ke,i),r.point(0,i),r.point(Ke,i),r.point(Ke,0),r.point(Ke,-i),r.point(0,-i),r.point(-Ke,-i),r.point(-Ke,0),r.point(-Ke,i);else if(tt(e[0]-t[0])>Ie){var s=e[0]0,i=tt(t)>Ie;function s(c,f,d,h){qte(h,e,n,d,c,f)}function o(c,f){return Pe(c)*Pe(f)>t}function a(c){var f,d,h,p,g;return{lineStart:function(){p=h=!1,g=1},point:function(m,v){var y=[m,v],b,x=o(m,v),_=r?x?0:l(m,v):x?l(m+(m<0?Ke:-Ke),v):0;if(!f&&(p=h=x)&&c.lineStart(),x!==h&&(b=u(f,y),(!b||cm(f,b)||cm(y,b))&&(y[2]=1)),x!==h)g=0,x?(c.lineStart(),b=u(y,f),c.point(b[0],b[1])):(b=u(f,y),c.point(b[0],b[1],2),c.lineEnd()),f=b;else if(i&&f&&r^x){var A;!(_&d)&&(A=u(y,f,!0))&&(g=0,r?(c.lineStart(),c.point(A[0][0],A[0][1]),c.point(A[1][0],A[1][1]),c.lineEnd()):(c.point(A[1][0],A[1][1]),c.lineEnd(),c.lineStart(),c.point(A[0][0],A[0][1],3)))}x&&(!f||!cm(f,y))&&c.point(y[0],y[1]),f=y,h=x,d=_},lineEnd:function(){h&&c.lineEnd(),f=null},clean:function(){return g|(p&&h)<<1}}}function u(c,f,d){var h=Ul(c),p=Ul(f),g=[1,0,0],m=Gf(h,p),v=m0(m,m),y=m[0],b=v-y*y;if(!b)return!d&&c;var x=t*v/b,_=-t*y/b,A=Gf(g,m),E=v0(g,x),S=v0(m,_);b2(E,S);var k=A,F=m0(E,k),D=m0(k,k),M=F*F-D*(m0(E,E)-1);if(!(M<0)){var T=xr(M),$=v0(k,(-F-T)/D);if(b2($,E),$=g1($),!d)return $;var C=c[0],R=f[0],L=c[1],O=f[1],N;R0^$[1]<(tt($[0]-C)Ke^(C<=$[0]&&$[0]<=R)){var le=v0(k,(-F+T)/D);return b2(le,E),[$,g1(le)]}}}function l(c,f){var d=r?e:Ke-e,h=0;return c<-d?h|=1:c>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return B9(o,a,s,r?[0,-e]:[-Ke,e-Ke])}function Zte(e,t,n,r,i,s){var o=e[0],a=e[1],u=t[0],l=t[1],c=0,f=1,d=u-o,h=l-a,p;if(p=n-o,!(!d&&p>0)){if(p/=d,d<0){if(p0){if(p>f)return;p>c&&(c=p)}if(p=i-o,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>c&&(c=p)}else if(d>0){if(p0)){if(p/=h,h<0){if(p0){if(p>f)return;p>c&&(c=p)}if(p=s-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>c&&(c=p)}else if(h>0){if(p0&&(e[0]=o+c*d,e[1]=a+c*h),f<1&&(t[0]=o+f*d,t[1]=a+f*h),!0}}}}}var Fh=1e9,b0=-Fh;function z9(e,t,n,r){function i(l,c){return e<=l&&l<=n&&t<=c&&c<=r}function s(l,c,f,d){var h=0,p=0;if(l==null||(h=o(l,f))!==(p=o(c,f))||u(l,c)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(c[0],c[1])}function o(l,c){return tt(l[0]-e)0?0:3:tt(l[0]-n)0?2:1:tt(l[1]-t)0?1:0:c>0?3:2}function a(l,c){return u(l.x,c.x)}function u(l,c){var f=o(l,1),d=o(c,1);return f!==d?f-d:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c=l,f=I9(),d,h,p,g,m,v,y,b,x,_,A,E={point:S,lineStart:M,lineEnd:T,polygonStart:F,polygonEnd:D};function S(C,R){i(C,R)&&c.point(C,R)}function k(){for(var C=0,R=0,L=h.length;Rr&&(de-X)*(r-le)>(se-le)*(e-X)&&++C:se<=r&&(de-X)*(r-le)<(se-le)*(e-X)&&--C;return C}function F(){c=f,d=[],h=[],A=!0}function D(){var C=k(),R=A&&C,L=(d=DR(d)).length;(R||L)&&(l.polygonStart(),R&&(l.lineStart(),s(null,null,1,l),l.lineEnd()),L&&P9(d,a,C,s,l),l.polygonEnd()),c=l,d=h=p=null}function M(){E.point=$,h&&h.push(p=[]),_=!0,x=!1,y=b=NaN}function T(){d&&($(g,m),v&&x&&f.rejoin(),d.push(f.result())),E.point=S,x&&c.lineEnd()}function $(C,R){var L=i(C,R);if(h&&p.push([C,R]),_)g=C,m=R,v=L,_=!1,L&&(c.lineStart(),c.point(C,R));else if(L&&x)c.point(C,R);else{var O=[y=Math.max(b0,Math.min(Fh,y)),b=Math.max(b0,Math.min(Fh,b))],N=[C=Math.max(b0,Math.min(Fh,C)),R=Math.max(b0,Math.min(Fh,R))];Zte(O,N,e,t,n,r)?(x||(c.lineStart(),c.point(O[0],O[1])),c.point(N[0],N[1]),L||c.lineEnd(),A=!1):L&&(c.lineStart(),c.point(C,R),A=!1)}y=C,b=R,x=L}return E}}function V5(e,t,n){var r=ni(e,t-Ie,n).concat(t);return function(i){return r.map(function(s){return[i,s]})}}function X5(e,t,n){var r=ni(e,t-Ie,n).concat(t);return function(i){return r.map(function(s){return[s,i]})}}function Jte(){var e,t,n,r,i,s,o,a,u=10,l=u,c=90,f=360,d,h,p,g,m=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return ni(g0(r/c)*c,n,c).map(p).concat(ni(g0(a/f)*f,o,f).map(g)).concat(ni(g0(t/u)*u,e,u).filter(function(b){return tt(b%c)>Ie}).map(d)).concat(ni(g0(s/l)*l,i,l).filter(function(b){return tt(b%f)>Ie}).map(h))}return v.lines=function(){return y().map(function(b){return{type:"LineString",coordinates:b}})},v.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(g(o).slice(1),p(n).reverse().slice(1),g(a).reverse().slice(1))]}},v.extent=function(b){return arguments.length?v.extentMajor(b).extentMinor(b):v.extentMinor()},v.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],o=+b[1][1],r>n&&(b=r,r=n,n=b),a>o&&(b=a,a=o,o=b),v.precision(m)):[[r,a],[n,o]]},v.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],s=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),s>i&&(b=s,s=i,i=b),v.precision(m)):[[t,s],[e,i]]},v.step=function(b){return arguments.length?v.stepMajor(b).stepMinor(b):v.stepMinor()},v.stepMajor=function(b){return arguments.length?(c=+b[0],f=+b[1],v):[c,f]},v.stepMinor=function(b){return arguments.length?(u=+b[0],l=+b[1],v):[u,l]},v.precision=function(b){return arguments.length?(m=+b,d=V5(s,i,90),h=X5(t,e,m),p=V5(a,o,90),g=X5(r,n,m),v):m},v.extentMajor([[-180,-90+Ie],[180,90-Ie]]).extentMinor([[-180,-80-Ie],[180,80+Ie]])}const _p=e=>e;var _2=new vr,tw=new vr,j9,U9,nw,rw,Go={point:Tn,lineStart:Tn,lineEnd:Tn,polygonStart:function(){Go.lineStart=Qte,Go.lineEnd=tne},polygonEnd:function(){Go.lineStart=Go.lineEnd=Go.point=Tn,_2.add(tt(tw)),tw=new vr},result:function(){var e=_2/2;return _2=new vr,e}};function Qte(){Go.point=ene}function ene(e,t){Go.point=q9,j9=nw=e,U9=rw=t}function q9(e,t){tw.add(rw*e-nw*t),nw=e,rw=t}function tne(){q9(j9,U9)}var Yf=1/0,A1=Yf,wp=-Yf,S1=wp,k1={point:nne,lineStart:Tn,lineEnd:Tn,polygonStart:Tn,polygonEnd:Tn,result:function(){var e=[[Yf,A1],[wp,S1]];return wp=S1=-(A1=Yf=1/0),e}};function nne(e,t){ewp&&(wp=e),tS1&&(S1=t)}var iw=0,sw=0,$h=0,C1=0,F1=0,Qc=0,ow=0,aw=0,Dh=0,W9,H9,Xs,Ks,Ei={point:ql,lineStart:K5,lineEnd:Z5,polygonStart:function(){Ei.lineStart=sne,Ei.lineEnd=one},polygonEnd:function(){Ei.point=ql,Ei.lineStart=K5,Ei.lineEnd=Z5},result:function(){var e=Dh?[ow/Dh,aw/Dh]:Qc?[C1/Qc,F1/Qc]:$h?[iw/$h,sw/$h]:[NaN,NaN];return iw=sw=$h=C1=F1=Qc=ow=aw=Dh=0,e}};function ql(e,t){iw+=e,sw+=t,++$h}function K5(){Ei.point=rne}function rne(e,t){Ei.point=ine,ql(Xs=e,Ks=t)}function ine(e,t){var n=e-Xs,r=t-Ks,i=xr(n*n+r*r);C1+=i*(Xs+e)/2,F1+=i*(Ks+t)/2,Qc+=i,ql(Xs=e,Ks=t)}function Z5(){Ei.point=ql}function sne(){Ei.point=ane}function one(){G9(W9,H9)}function ane(e,t){Ei.point=G9,ql(W9=Xs=e,H9=Ks=t)}function G9(e,t){var n=e-Xs,r=t-Ks,i=xr(n*n+r*r);C1+=i*(Xs+e)/2,F1+=i*(Ks+t)/2,Qc+=i,i=Ks*e-Xs*t,ow+=i*(Xs+e),aw+=i*(Ks+t),Dh+=i*3,ql(Xs=e,Ks=t)}function Y9(e){this._context=e}Y9.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,br);break}}},result:Tn};var uw=new vr,w2,V9,X9,Mh,Rh,Ep={point:Tn,lineStart:function(){Ep.point=une},lineEnd:function(){w2&&K9(V9,X9),Ep.point=Tn},polygonStart:function(){w2=!0},polygonEnd:function(){w2=null},result:function(){var e=+uw;return uw=new vr,e}};function une(e,t){Ep.point=K9,V9=Mh=e,X9=Rh=t}function K9(e,t){Mh-=e,Rh-=t,uw.add(xr(Mh*Mh+Rh*Rh)),Mh=e,Rh=t}let J5,$1,Q5,eD;class tD{constructor(t){this._append=t==null?Z9:lne(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==Q5||this._append!==$1){const r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,Q5=r,$1=this._append,eD=this._,this._=i}this._+=eD;break}}}result(){const t=this._;return this._="",t.length?t:null}}function Z9(e){let t=1;this._+=e[0];for(const n=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Z9;if(t!==J5){const n=10**t;J5=t,$1=function(i){let s=1;this._+=i[0];for(const o=i.length;s=0))throw new RangeError(`invalid digits: ${a}`);n=u}return t===null&&(s=new tD(n)),o},o.projection(e).digits(n).context(t)}function hy(e){return function(t){var n=new lw;for(var r in e)n[r]=e[r];return n.stream=t,n}}function lw(){}lw.prototype={constructor:lw,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function _k(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ho(n,e.stream(k1)),t(k1.result()),r!=null&&e.clipExtent(r),e}function py(e,t,n){return _k(e,function(r){var i=t[1][0]-t[0][0],s=t[1][1]-t[0][1],o=Math.min(i/(r[1][0]-r[0][0]),s/(r[1][1]-r[0][1])),a=+t[0][0]+(i-o*(r[1][0]+r[0][0]))/2,u=+t[0][1]+(s-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([a,u])},n)}function wk(e,t,n){return py(e,[[0,0],t],n)}function Ek(e,t,n){return _k(e,function(r){var i=+t,s=i/(r[1][0]-r[0][0]),o=(i-s*(r[1][0]+r[0][0]))/2,a=-s*r[0][1];e.scale(150*s).translate([o,a])},n)}function Ak(e,t,n){return _k(e,function(r){var i=+t,s=i/(r[1][1]-r[0][1]),o=-s*r[0][0],a=(i-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([o,a])},n)}var nD=16,cne=Pe(30*Ve);function rD(e,t){return+t?dne(e,t):fne(e)}function fne(e){return hy({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function dne(e,t){function n(r,i,s,o,a,u,l,c,f,d,h,p,g,m){var v=l-r,y=c-i,b=v*v+y*y;if(b>4*t&&g--){var x=o+d,_=a+h,A=u+p,E=xr(x*x+_*_+A*A),S=Ur(A/=E),k=tt(tt(A)-1)t||tt((v*T+y*$)/b-.5)>.3||o*d+a*h+u*p2?C[2]%360*Ve:0,T()):[a*Vt,u*Vt,l*Vt]},D.angle=function(C){return arguments.length?(f=C%360*Ve,T()):f*Vt},D.reflectX=function(C){return arguments.length?(d=C?-1:1,T()):d<0},D.reflectY=function(C){return arguments.length?(h=C?-1:1,T()):h<0},D.precision=function(C){return arguments.length?(A=rD(E,_=C*C),$()):xr(_)},D.fitExtent=function(C,R){return py(D,C,R)},D.fitSize=function(C,R){return wk(D,C,R)},D.fitWidth=function(C,R){return Ek(D,C,R)},D.fitHeight=function(C,R){return Ak(D,C,R)};function T(){var C=iD(n,0,0,d,h,f).apply(null,t(s,o)),R=iD(n,r-C[0],i-C[1],d,h,f);return c=L9(a,u,l),E=Q_(t,R),S=Q_(c,E),A=rD(E,_),$()}function $(){return k=F=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&M,T()}}function Sk(e){var t=0,n=Ke/3,r=Q9(e),i=r(t,n);return i.parallels=function(s){return arguments.length?r(t=s[0]*Ve,n=s[1]*Ve):[t*Vt,n*Vt]},i}function mne(e){var t=Pe(e);function n(r,i){return[r*t,Oe(i)/t]}return n.invert=function(r,i){return[r/t,Ur(i*t)]},n}function vne(e,t){var n=Oe(e),r=(n+Oe(t))/2;if(tt(r)=.12&&m<.234&&g>=-.425&&g<-.214?i:m>=.166&&m<.234&&g>=-.214&&g<-.115?o:n).invert(d)},c.stream=function(d){return e&&t===d?e:e=yne([n.stream(t=d),i.stream(d),o.stream(d)])},c.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),o.precision(d),f()):n.precision()},c.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),o.scale(d),c.translate(n.translate())):n.scale()},c.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],g=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,g-.238*h],[p+.455*h,g+.238*h]]).stream(l),s=i.translate([p-.307*h,g+.201*h]).clipExtent([[p-.425*h+Ie,g+.12*h+Ie],[p-.214*h-Ie,g+.234*h-Ie]]).stream(l),a=o.translate([p-.205*h,g+.212*h]).clipExtent([[p-.214*h+Ie,g+.166*h+Ie],[p-.115*h-Ie,g+.234*h-Ie]]).stream(l),f()},c.fitExtent=function(d,h){return py(c,d,h)},c.fitSize=function(d,h){return wk(c,d,h)},c.fitWidth=function(d,h){return Ek(c,d,h)},c.fitHeight=function(d,h){return Ak(c,d,h)};function f(){return e=t=null,c}return c.scale(1070)}function tL(e){return function(t,n){var r=Pe(t),i=Pe(n),s=e(r*i);return s===1/0?[2,0]:[s*i*Oe(t),s*Oe(n)]}}function Eg(e){return function(t,n){var r=xr(t*t+n*n),i=e(r),s=Oe(i),o=Pe(i);return[Pi(t*s,r*o),Ur(r&&n*s/r)]}}var nL=tL(function(e){return xr(2/(1+e))});nL.invert=Eg(function(e){return 2*Ur(e/2)});function xne(){return Eo(nL).scale(124.75).clipAngle(180-.001)}var rL=tL(function(e){return(e=S9(e))&&e/Oe(e)});rL.invert=Eg(function(e){return e});function _ne(){return Eo(rL).scale(79.4188).clipAngle(180-.001)}function gy(e,t){return[e,f1(bk((Ut+t)/2))]}gy.invert=function(e,t){return[e,2*$d(A9(t))-Ut]};function wne(){return iL(gy).scale(961/br)}function iL(e){var t=Eo(e),n=t.center,r=t.scale,i=t.translate,s=t.clipExtent,o=null,a,u,l;t.scale=function(f){return arguments.length?(r(f),c()):r()},t.translate=function(f){return arguments.length?(i(f),c()):i()},t.center=function(f){return arguments.length?(n(f),c()):n()},t.clipExtent=function(f){return arguments.length?(f==null?o=a=u=l=null:(o=+f[0][0],a=+f[0][1],u=+f[1][0],l=+f[1][1]),c()):o==null?null:[[o,a],[u,l]]};function c(){var f=Ke*r(),d=t(Ute(t.rotate()).invert([0,0]));return s(o==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===gy?[[Math.max(d[0]-f,o),a],[Math.min(d[0]+f,u),l]]:[[o,Math.max(d[1]-f,a)],[u,Math.min(d[1]+f,l)]])}return c()}function x0(e){return bk((Ut+e)/2)}function Ene(e,t){var n=Pe(e),r=e===t?Oe(e):f1(n/Pe(t))/f1(x0(t)/x0(e)),i=n*y2(x0(e),r)/r;if(!r)return gy;function s(o,a){i>0?a<-Ut+Ie&&(a=-Ut+Ie):a>Ut-Ie&&(a=Ut-Ie);var u=i/y2(x0(a),r);return[u*Oe(r*o),i-u*Pe(r*o)]}return s.invert=function(o,a){var u=i-a,l=Si(r)*xr(o*o+u*u),c=Pi(o,tt(u))*Si(u);return u*r<0&&(c-=Ke*Si(o)*Si(u)),[c/r,2*$d(y2(i/l,1/r))-Ut]},s}function Ane(){return Sk(Ene).scale(109.5).parallels([30,30])}function M1(e,t){return[e,t]}M1.invert=M1;function Sne(){return Eo(M1).scale(152.63)}function kne(e,t){var n=Pe(e),r=e===t?Oe(e):(n-Pe(t))/(t-e),i=n/r+e;if(tt(r)Ie&&--r>0);return[e/(.8707+(s=n*n)*(-.131979+s*(-.013791+s*s*s*(.003971-.001529*s)))),n]};function Rne(){return Eo(aL).scale(175.295)}function uL(e,t){return[Pe(t)*Oe(e),Oe(t)]}uL.invert=Eg(Ur);function Tne(){return Eo(uL).scale(249.5).clipAngle(90+Ie)}function lL(e,t){var n=Pe(t),r=1+Pe(e)*n;return[n*Oe(e)/r,Oe(t)/r]}lL.invert=Eg(function(e){return 2*$d(e)});function Nne(){return Eo(lL).scale(250).clipAngle(142)}function cL(e,t){return[f1(bk((Ut+t)/2)),-e]}cL.invert=function(e,t){return[-t,2*$d(A9(e))-Ut]};function One(){var e=iL(cL),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}var Lne=Math.abs,cw=Math.cos,T1=Math.sin,Ine=1e-6,fL=Math.PI,fw=fL/2,sD=Pne(2);function oD(e){return e>1?fw:e<-1?-fw:Math.asin(e)}function Pne(e){return e>0?Math.sqrt(e):0}function Bne(e,t){var n=e*T1(t),r=30,i;do t-=i=(t+T1(t)-n)/(1+cw(t));while(Lne(i)>Ine&&--r>0);return t/2}function zne(e,t,n){function r(i,s){return[e*i*cw(s=Bne(n,s)),t*T1(s)]}return r.invert=function(i,s){return s=oD(s/t),[i/(e*cw(s)),oD((2*s+T1(2*s))/n)]},r}var jne=zne(sD/fw,sD,fL);function Une(){return Eo(jne).scale(169.529)}const qne=J9(),dw=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Wne(e,t){return function n(){const r=t();return r.type=e,r.path=J9().projection(r),r.copy=r.copy||function(){const i=n();return dw.forEach(s=>{r[s]&&i[s](r[s]())}),i.path.pointRadius(r.path.pointRadius()),i},kO(r)}}function kk(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(N1[e]=Wne(e,t),this):N1[e]||null}function dL(e){return e&&e.path||qne}const N1={albers:eL,albersusa:bne,azimuthalequalarea:xne,azimuthalequidistant:_ne,conicconformal:Ane,conicequalarea:D1,conicequidistant:Cne,equalEarth:$ne,equirectangular:Sne,gnomonic:Dne,identity:Mne,mercator:wne,mollweide:Une,naturalEarth1:Rne,orthographic:Tne,stereographic:Nne,transversemercator:One};for(const e in N1)kk(e,N1[e]);function Hne(){}const Oo=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function hL(){var e=1,t=1,n=a;function r(u,l){return l.map(c=>i(u,c))}function i(u,l){var c=[],f=[];return s(u,l,d=>{n(d,u,l),Gne(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var h=0,p=c.length,g;h=l,Oo[m<<1].forEach(b);++h=l,Oo[g|m<<1].forEach(b);for(Oo[m<<0].forEach(b);++p=l,v=u[p*e]>=l,Oo[m<<1|v<<2].forEach(b);++h=l,y=v,v=u[p*e+h+1]>=l,Oo[g|m<<1|v<<2|y<<3].forEach(b);Oo[m|v<<3].forEach(b)}for(h=-1,v=u[p*e]>=l,Oo[v<<2].forEach(b);++h=l,Oo[v<<2|y<<3].forEach(b);Oo[v<<3].forEach(b);function b(x){var _=[x[0][0]+h,x[0][1]+p],A=[x[1][0]+h,x[1][1]+p],E=o(_),S=o(A),k,F;(k=d[E])?(F=f[S])?(delete d[k.end],delete f[F.start],k===F?(k.ring.push(A),c(k.ring)):f[k.start]=d[F.end]={start:k.start,end:F.end,ring:k.ring.concat(F.ring)}):(delete d[k.end],k.ring.push(A),d[k.end=S]=k):(k=f[S])?(F=d[E])?(delete f[k.start],delete d[F.end],k===F?(k.ring.push(A),c(k.ring)):f[F.start]=d[k.end]={start:F.start,end:k.end,ring:F.ring.concat(k.ring)}):(delete f[k.start],k.ring.unshift(_),f[k.start=E]=k):f[E]=d[S]={start:E,end:S,ring:[_,A]}}}function o(u){return u[0]*2+u[1]*(e+1)*4}function a(u,l,c){u.forEach(f=>{var d=f[0],h=f[1],p=d|0,g=h|0,m,v=l[g*e+p];d>0&&d0&&h=0&&c>=0||K("invalid size"),e=l,t=c,r},r.smooth=function(u){return arguments.length?(n=u?a:Hne,r):n===a},r}function Gne(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++tr!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function Xne(e,t,n){var r;return Kne(e,t,n)&&Zne(e[r=+(e[0]===t[0])],n[r],t[r])}function Kne(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Zne(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function pL(e,t,n){return function(r){var i=uo(r),s=n?Math.min(i[0],0):i[0],o=i[1],a=o-s,u=t?au(s,o,e):a/(e+1);return ni(s+u,o,u)}}function Ck(e){G.call(this,null,e)}Ck.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]};pe(Ck,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||rr,s=hL().smooth(e.smooth!==!1),o=e.thresholds||Jne(r,i,e),a=e.as===null?null:e.as||"contour",u=[];return r.forEach(l=>{const c=i(l),f=s.size([c.width,c.height])(c.values,Q(o)?o:o(c.values));Qne(f,c,l,e),f.forEach(d=>{u.push(Rv(l,ht(a!=null?{[a]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function Jne(e,t,n){const r=pL(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?r:r(e.map(i=>bl(t(i).values)))}function Qne(e,t,n,r){let i=r.scale||t.scale,s=r.translate||t.translate;if(He(i)&&(i=i(n,r)),He(s)&&(s=s(n,r)),(i===1||i==null)&&!s)return;const o=(ut(i)?i:i[0])||1,a=(ut(i)?i:i[1])||1,u=s&&s[0]||0,l=s&&s[1]||0;e.forEach(gL(t,o,a,u,l))}function gL(e,t,n,r,i){const s=e.x1||0,o=e.y1||0,a=t*n<0;function u(f){f.forEach(l)}function l(f){a&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-s)*t+r,f[1]=(f[1]-o)*n+i}return function(f){return f.coordinates.forEach(u),f}}function aD(e,t,n){const r=e>=0?e:bA(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function E2(e){return He(e)?e:ir(+e)}function mL(){var e=u=>u[0],t=u=>u[1],n=gd,r=[-1,-1],i=960,s=500,o=2;function a(u,l){const c=aD(r[0],u,e)>>o,f=aD(r[1],u,t)>>o,d=c?c+2:0,h=f?f+2:0,p=2*d+(i>>o),g=2*h+(s>>o),m=new Float32Array(p*g),v=new Float32Array(p*g);let y=m;u.forEach(x=>{const _=d+(+e(x)>>o),A=h+(+t(x)>>o);_>=0&&_=0&&A0&&f>0?(Oc(p,g,m,v,c),Lc(p,g,v,m,f),Oc(p,g,m,v,c),Lc(p,g,v,m,f),Oc(p,g,m,v,c),Lc(p,g,v,m,f)):c>0?(Oc(p,g,m,v,c),Oc(p,g,v,m,c),Oc(p,g,m,v,c),y=v):f>0&&(Lc(p,g,m,v,f),Lc(p,g,v,m,f),Lc(p,g,m,v,f),y=v);const b=l?Math.pow(2,-2*o):1/MR(y);for(let x=0,_=p*g;x<_;++x)y[x]*=b;return{values:y,scale:1<>o),y2:h+(s>>o)}}return a.x=function(u){return arguments.length?(e=E2(u),a):e},a.y=function(u){return arguments.length?(t=E2(u),a):t},a.weight=function(u){return arguments.length?(n=E2(u),a):n},a.size=function(u){if(!arguments.length)return[i,s];var l=+u[0],c=+u[1];return l>=0&&c>=0||K("invalid size"),i=l,s=c,a},a.cellSize=function(u){return arguments.length?((u=+u)>=1||K("invalid cell size"),o=Math.floor(Math.log(u)/Math.LN2),a):1<=i&&(a>=s&&(u-=n[a-s+o*e]),r[a-i+o*e]=u/Math.min(a+1,e-1+s-a,s))}function Lc(e,t,n,r,i){const s=(i<<1)+1;for(let o=0;o=i&&(a>=s&&(u-=n[o+(a-s)*e]),r[o+(a-i)*e]=u/Math.min(a+1,t-1+s-a,s))}function Fk(e){G.call(this,null,e)}Fk.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const ere=["x","y","weight","size","cellSize","bandwidth"];function vL(e,t){return ere.forEach(n=>t[n]!=null?e[n](t[n]):0),e}pe(Fk,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=tre(r,e.groupby),s=(e.groupby||[]).map(Wt),o=vL(mL(),e),a=e.as||"grid",u=[];function l(c,f){for(let d=0;dht(l({[a]:o(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function tre(e,t){var n=[],r=c=>c(a),i,s,o,a,u,l;if(t==null)n.push(e);else for(i={},s=0,o=e.length;sn.push(a(c))),s&&o&&(t.visit(u,c=>{var f=s(c),d=o(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&r.push([f,d])}),n=n.concat({type:hw,geometry:{type:nre,coordinates:r}})),this.value={type:Dk,features:n}}});function Rk(e){G.call(this,null,e)}Rk.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]};pe(Rk,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||rr,s=e.as||"path",o=n.SOURCE;!r||e.modified()?(this.value=r=dL(e.projection),n.materialize().reflow()):o=i===rr||t.modified(i.fields)?n.ADD_MOD:n.ADD;const a=rre(r,e.pointRadius);return n.visit(o,u=>u[s]=r(i(u))),r.pointRadius(a),n.modifies(s)}});function rre(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function Tk(e){G.call(this,null,e)}Tk.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]};pe(Tk,G,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],s=e.as||["x","y"],o=s[0],a=s[1],u;function l(c){const f=n([r(c),i(c)]);f?(c[o]=f[0],c[a]=f[1]):(c[o]=void 0,c[a]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(u=t.modified(r.fields)||t.modified(i.fields),t.visit(u?t.ADD_MOD:t.ADD,l)),t.modifies(s)}});function Nk(e){G.call(this,null,e)}Nk.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]};pe(Nk,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||"shape",s=n.ADD;return(!r||e.modified())&&(this.value=r=ire(dL(e.projection),e.field||Ni("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,o=>o[i]=r),n.modifies(i)}});function ire(e,t,n){const r=n==null?i=>e(t(i)):i=>{var s=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(s),o};return r.context=i=>(e.context(i),r),r}function Ok(e){G.call(this,[],e),this.generator=Jte()}Ok.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]};pe(Ok,G,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(const s in e)He(r[s])&&r[s](e[s]);return i=r(),n.length?t.mod.push(ST(n[0],i)):t.add.push(ht(i)),n[0]=i,t}});function Lk(e){G.call(this,null,e)}Lk.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]};pe(Lk,G,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve==="shared",i=e.field||rr,s=ore(e.opacity,e),o=sre(e.color,e),a=e.as||"image",u={$x:0,$y:0,$value:0,$max:r?bl(n.map(l=>bl(i(l).values))):0};return n.forEach(l=>{const c=i(l),f=We({},l,u);r||(f.$max=bl(c.values||[])),l[a]=are(c,f,o.dep?o:ir(o(f)),s.dep?s:ir(s(f)))}),t.reflow(!0).modifies(a)}});function sre(e,t){let n;return He(e)?(n=r=>cu(e(r,t)),n.dep=yL(e)):n=ir(cu(e||"#888")),n}function ore(e,t){let n;return He(e)?(n=r=>e(r,t),n.dep=yL(e)):e?n=ir(e):(n=r=>r.$value/r.$max||0,n.dep=!0),n}function yL(e){if(!He(e))return!1;const t=vs(Zn(e));return t.$x||t.$y||t.$value||t.$max}function are(e,t,n,r){const i=e.width,s=e.height,o=e.x1||0,a=e.y1||0,u=e.x2||i,l=e.y2||s,c=e.values,f=c?m=>c[m]:La,d=nu(u-o,l-a),h=d.getContext("2d"),p=h.getImageData(0,0,u-o,l-a),g=p.data;for(let m=a,v=0;m{e[r]!=null&&uD(n,r,e[r])})):dw.forEach(r=>{e.modified(r)&&uD(n,r,e[r])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&ure(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function ure(e,t){const n=cre(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function lre(e){const t=kk((e||"mercator").toLowerCase());return t||K("Unrecognized projection type: "+e),t()}function uD(e,t,n){He(e[t])&&e[t](n)}function cre(e){return e=xe(e),e.length===1?e[0]:{type:Dk,features:e.reduce((t,n)=>t.concat(fre(n)),[])}}function fre(e){return e.type===Dk?e.features:xe(e).filter(t=>t!=null).map(t=>t.type===hw?t:{type:hw,geometry:t})}const dre=Object.freeze(Object.defineProperty({__proto__:null,contour:$k,geojson:Mk,geopath:Rk,geopoint:Tk,geoshape:Nk,graticule:Ok,heatmap:Lk,isocontour:Ck,kde2d:Fk,projection:bL},Symbol.toStringTag,{value:"Module"}));function hre(e,t){var n,r=1;e==null&&(e=0),t==null&&(t=0);function i(){var s,o=n.length,a,u=0,l=0;for(s=0;s=(f=(a+l)/2))?a=f:l=f,(m=n>=(d=(u+c)/2))?u=d:c=d,i=s,!(s=s[v=m<<1|g]))return i[v]=o,e;if(h=+e._x.call(null,s.data),p=+e._y.call(null,s.data),t===h&&n===p)return o.next=s,i?i[v]=o:e._root=o,e;do i=i?i[v]=new Array(4):e._root=new Array(4),(g=t>=(f=(a+l)/2))?a=f:l=f,(m=n>=(d=(u+c)/2))?u=d:c=d;while((v=m<<1|g)===(y=(p>=d)<<1|h>=f));return i[y]=s,i[v]=o,e}function gre(e){var t,n,r=e.length,i,s,o=new Array(r),a=new Array(r),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),sf&&(f=s));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;ne||e>=i||r>t||t>=s;)switch(l=(tc||(a=p.y0)>f||(u=p.x1)=v)<<1|e>=m)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-g],d[d.length-1-g]=p)}else{var y=e-+this._x.call(null,h.data),b=t-+this._y.call(null,h.data),x=y*y+b*b;if(x=(d=(o+u)/2))?o=d:u=d,(g=f>=(h=(a+l)/2))?a=h:l=h,t=n,!(n=n[m=g<<1|p]))return this;if(!n.length)break;(t[m+1&3]||t[m+2&3]||t[m+3&3])&&(r=t,v=m)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,i?(s?i.next=s:delete i.next,this):t?(s?t[m]=s:delete t[m],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[v]=n:this._root=n),this):(this._root=s,this)}function _re(e){for(var t=0,n=e.length;td.index){var D=h-S.x-S.vx,M=p-S.y-S.vy,T=D*D+M*M;Th+F||Ap+F||El.r&&(l.r=l[c].r)}function u(){if(t){var l,c=t.length,f;for(n=new Array(c),l=0;l[t(_,A,o),_])),x;for(m=0,a=new Array(v);m{}};function _L(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}fm.prototype=_L.prototype={constructor:fm,on:function(e,t){var n=this._,r=Lre(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&e._call.call(void 0,t),e=e._next;--Vf}function dD(){Wl=(L1=Ap.now())+my,Vf=Th=0;try{Bre()}finally{Vf=0,jre(),Wl=0}}function zre(){var e=Ap.now(),t=e-L1;t>wL&&(my-=t,L1=e)}function jre(){for(var e,t=O1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:O1=n);Nh=e,pw(r)}function pw(e){if(!Vf){Th&&(Th=clearTimeout(Th));var t=e-Wl;t>24?(e<1/0&&(Th=setTimeout(dD,e-Ap.now()-my)),ih&&(ih=clearInterval(ih))):(ih||(L1=Ap.now(),ih=setInterval(zre,wL)),Vf=1,EL(dD))}}function Ure(e,t,n){var r=new I1,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(s,o,a){o=+o,a=a==null?Bk():+a,r._restart(function u(l){l+=i,r._restart(u,i+=o,a),s(l)},o,a)},r.restart(e,t,n),r)}const qre=1664525,Wre=1013904223,hD=4294967296;function Hre(){let e=1;return()=>(e=(qre*e+Wre)%hD)/hD}function Gre(e){return e.x}function Yre(e){return e.y}var Vre=10,Xre=Math.PI*(3-Math.sqrt(5));function Kre(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,u=AL(f),l=_L("tick","end"),c=Hre();e==null&&(e=[]);function f(){d(),l.call("tick",t),n1?(m==null?a.delete(g):a.set(g,p(m)),t):a.get(g)},find:function(g,m,v){var y=0,b=e.length,x,_,A,E,S;for(v==null?v=1/0:v*=v,y=0;y1?(l.on(g,m),t):l.on(g)}}}function Zre(){var e,t,n,r,i=gr(-30),s,o=1,a=1/0,u=.81;function l(h){var p,g=e.length,m=Ik(e,Gre,Yre).visitAfter(f);for(r=h,p=0;p=a)return;(h.data!==t||h.next)&&(v===0&&(v=Ga(n),x+=v*v),y===0&&(y=Ga(n),x+=y*y),x=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let a=this._argops,u=0,l=a.length,c;ue.touch(t).run()}function nie(e,t){const n=Kre(e),r=n.stop,i=n.restart;let s=!1;return n.stopped=()=>s,n.restart=()=>(s=!1,i()),n.stop=()=>(s=!0,r()),kL(n,t,!0).on("end",()=>s=!0)}function kL(e,t,n,r){var i=xe(t.forces),s,o,a,u;for(s=0,o=gw.length;st(r,n):t)}const oie=Object.freeze(Object.defineProperty({__proto__:null,force:zk},Symbol.toStringTag,{value:"Module"}));function aie(e,t){return e.parent===t.parent?1:2}function uie(e){return e.reduce(lie,0)/e.length}function lie(e,t){return e+t.x}function cie(e){return 1+e.reduce(fie,0)}function fie(e,t){return Math.max(e,t.y)}function die(e){for(var t;t=e.children;)e=t[0];return e}function hie(e){for(var t;t=e.children;)e=t[t.length-1];return e}function pie(){var e=aie,t=1,n=1,r=!1;function i(s){var o,a=0;s.eachAfter(function(d){var h=d.children;h?(d.x=uie(h),d.y=cie(h)):(d.x=o?a+=e(d,o):0,d.y=0,o=d)});var u=die(s),l=hie(s),c=u.x-e(u,l)/2,f=l.x+e(l,u)/2;return s.eachAfter(r?function(d){d.x=(d.x-s.x)*t,d.y=(s.y-d.y)*n}:function(d){d.x=(d.x-c)/(f-c)*t,d.y=(1-(s.y?d.y/s.y:1))*n})}return i.separation=function(s){return arguments.length?(e=s,i):e},i.size=function(s){return arguments.length?(r=!1,t=+s[0],n=+s[1],i):r?null:[t,n]},i.nodeSize=function(s){return arguments.length?(r=!0,t=+s[0],n=+s[1],i):r?[t,n]:null},i}function gie(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function mie(){return this.eachAfter(gie)}function vie(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function yie(e,t){for(var n=this,r=[n],i,s,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(s=i.length-1;s>=0;--s)r.push(i[s]);return this}function bie(e,t){for(var n=this,r=[n],i=[],s,o,a,u=-1;n=r.pop();)if(i.push(n),s=n.children)for(o=0,a=s.length;o=0;)n+=r[i].value;t.value=n})}function wie(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Eie(e){for(var t=this,n=Aie(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function Aie(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function Sie(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function kie(){return Array.from(this)}function Cie(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Fie(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*$ie(){var e=this,t,n=[e],r,i,s;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,s=r.length;i=0;--a)i.push(s=o[a]=new Xf(o[a])),s.parent=r,s.depth=r.depth+1;return n.eachBefore(CL)}function Die(){return jk(this).eachBefore(Tie)}function Mie(e){return e.children}function Rie(e){return Array.isArray(e)?e[1]:null}function Tie(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function CL(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Xf(e){this.data=e,this.depth=this.height=0,this.parent=null}Xf.prototype=jk.prototype={constructor:Xf,count:mie,each:vie,eachAfter:bie,eachBefore:yie,find:xie,sum:_ie,sort:wie,path:Eie,ancestors:Sie,descendants:kie,leaves:Cie,links:Fie,copy:Die,[Symbol.iterator]:$ie};function dm(e){return e==null?null:FL(e)}function FL(e){if(typeof e!="function")throw new Error;return e}function il(){return 0}function Gc(e){return function(){return e}}const Nie=1664525,Oie=1013904223,gD=4294967296;function Lie(){let e=1;return()=>(e=(Nie*e+Oie)%gD)/gD}function Iie(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Pie(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}function Bie(e,t){for(var n=0,r=(e=Pie(Array.from(e),t)).length,i=[],s,o;n0&&n*n>r*r+i*i}function A2(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*F*M))/(2*F):M/D);return{x:r+A+E*T,y:i+S+k*T,r:T}}function mD(e,t,n){var r=e.x-t.x,i,s,o=e.y-t.y,a,u,l=r*r+o*o;l?(s=t.r+n.r,s*=s,u=e.r+n.r,u*=u,s>u?(i=(l+u-s)/(2*l),a=Math.sqrt(Math.max(0,u/l-i*i)),n.x=e.x-i*r-a*o,n.y=e.y-i*o+a*r):(i=(l+s-u)/(2*l),a=Math.sqrt(Math.max(0,s/l-i*i)),n.x=t.x+i*r-a*o,n.y=t.y+i*o+a*r)):(n.x=t.x+n.r,n.y=t.y)}function vD(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function yD(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,s=(t.y*n.r+n.y*t.r)/r;return i*i+s*s}function w0(e){this._=e,this.next=null,this.previous=null}function qie(e,t){if(!(s=(e=Iie(e)).length))return 0;var n,r,i,s,o,a,u,l,c,f,d;if(n=e[0],n.x=0,n.y=0,!(s>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(s>2))return n.r+r.r;mD(r,n,i=e[2]),n=new w0(n),r=new w0(r),i=new w0(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;e:for(u=3;uKie(n(x,_,i))),y=v.map(ED),b=new Set(v).add("");for(const x of y)b.has(x)||(b.add(x),v.push(x),y.push(ED(x)),s.push(k2));o=(x,_)=>v[_],a=(x,_)=>y[_]}for(c=0,u=s.length;c=0&&(h=s[v],h.data===k2);--v)h.data=null}if(f.parent=Yie,f.eachBefore(function(v){v.depth=v.parent.depth+1,--u}).eachBefore(CL),f.parent=null,u>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=dm(i),r):e},r.parentId=function(i){return arguments.length?(t=dm(i),r):t},r.path=function(i){return arguments.length?(n=dm(i),r):n},r}function Kie(e){e=`${e}`;let t=e.length;return mw(e,t-1)&&!mw(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function ED(e){let t=e.length;if(t<2)return"";for(;--t>1&&!mw(e,t););return e.slice(0,t)}function mw(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function Zie(e,t){return e.parent===t.parent?1:2}function C2(e){var t=e.children;return t?t[0]:e.t}function F2(e){var t=e.children;return t?t[t.length-1]:e.t}function Jie(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Qie(e){for(var t=0,n=0,r=e.children,i=r.length,s;--i>=0;)s=r[i],s.z+=t,s.m+=t,t+=s.s+(n+=s.c)}function ese(e,t,n){return e.a.parent===t.parent?e.a:n}function hm(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}hm.prototype=Object.create(Xf.prototype);function tse(e){for(var t=new hm(e,0),n,r=[t],i,s,o,a;n=r.pop();)if(s=n._.children)for(n.children=new Array(a=s.length),o=a-1;o>=0;--o)r.push(i=n.children[o]=new hm(s[o],o)),i.parent=n;return(t.parent=new hm(null,0)).children=[t],t}function nse(){var e=Zie,t=1,n=1,r=null;function i(l){var c=tse(l);if(c.eachAfter(s),c.parent.m=-c.z,c.eachBefore(o),r)l.eachBefore(u);else{var f=l,d=l,h=l;l.eachBefore(function(y){y.xd.x&&(d=y),y.depth>h.depth&&(h=y)});var p=f===d?1:e(f,d)/2,g=p-f.x,m=t/(d.x+p+g),v=n/(h.depth||1);l.eachBefore(function(y){y.x=(y.x+g)*m,y.y=y.depth*v})}return l}function s(l){var c=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(c){Qie(l);var h=(c[0].z+c[c.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function o(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,c,f){if(c){for(var d=l,h=l,p=c,g=d.parent.children[0],m=d.m,v=h.m,y=p.m,b=g.m,x;p=F2(p),d=C2(d),p&&d;)g=C2(g),h=F2(h),h.a=l,x=p.z+y-d.z-m+e(p._,d._),x>0&&(Jie(ese(p,l,f),l,x),m+=x,v+=x),y+=p.m,m+=d.m,b+=g.m,v+=h.m;p&&!F2(h)&&(h.t=p,h.m+=y-v),d&&!C2(g)&&(g.t=d,g.m+=m-b,f=l)}return f}function u(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}function vy(e,t,n,r,i){for(var s=e.children,o,a=-1,u=s.length,l=e.value&&(i-n)/e.value;++ay&&(y=l),A=m*m*_,b=Math.max(y/A,A/v),b>x){m-=l;break}x=b}o.push(u={value:m,dice:h1?r:1)},n})(RL);function rse(){var e=NL,t=!1,n=1,r=1,i=[0],s=il,o=il,a=il,u=il,l=il;function c(d){return d.x0=d.y0=0,d.x1=n,d.y1=r,d.eachBefore(f),i=[0],t&&d.eachBefore(ML),d}function f(d){var h=i[d.depth],p=d.x0+h,g=d.y0+h,m=d.x1-h,v=d.y1-h;m=d-1){var y=s[f];y.x0=p,y.y0=g,y.x1=m,y.y1=v;return}for(var b=l[f],x=h/2+b,_=f+1,A=d-1;_>>1;l[E]v-g){var F=h?(p*k+m*S)/h:m;c(f,_,S,p,g,F,v),c(_,d,k,F,g,m,v)}else{var D=h?(g*k+v*S)/h:v;c(f,_,S,p,g,m,D),c(_,d,k,p,D,m,v)}}}function sse(e,t,n,r,i){(e.depth&1?vy:Ag)(e,t,n,r,i)}const ose=(function e(t){function n(r,i,s,o,a){if((u=r._squarify)&&u.ratio===t)for(var u,l,c,f,d=-1,h,p=u.length,g=r.value;++d1?r:1)},n})(RL);function vw(e,t,n){const r={};return e.each(i=>{const s=i.data;n(s)&&(r[t(s)]=i)}),e.lookup=r,e}function Uk(e){G.call(this,null,e)}Uk.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const ase=e=>e.values;pe(Uk,G,{transform(e,t){t.source||K("Nest transform requires an upstream data source.");var n=e.generate,r=e.modified(),i=t.clone(),s=this.value;return(!s||r||t.changed())&&(s&&s.each(o=>{o.children&&Mv(o.data)&&i.rem.push(o.data)}),this.value=s=jk({values:xe(e.keys).reduce((o,a)=>(o.key(a),o),use()).entries(i.source)},ase),n&&s.each(o=>{o.children&&(o=ht(o.data),i.add.push(o),i.source.push(o))}),vw(s,Ne,Ne)),i.source.root=s,i}});function use(){const e=[],t={entries:i=>r(n(i,0),0),key:i=>(e.push(i),t)};function n(i,s){if(s>=e.length)return i;const o=i.length,a=e[s++],u={},l={};let c=-1,f,d,h;for(;++ce.length)return i;const o=[];for(const a in i)o.push({key:a,values:r(i[a],s)});return o}return t}function ga(e){G.call(this,null,e)}const lse=(e,t)=>e.parent===t.parent?1:2;pe(ga,G,{transform(e,t){(!t.source||!t.source.root)&&K(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),r=this.fields,i=t.source.root,s=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(cc(e.sort,o=>o.data)),cse(n,this.params,e),n.separation&&n.separation(e.separation!==!1?lse:gd);try{this.value=n(i)}catch(o){K(o)}return i.each(o=>fse(o,r,s)),t.reflow(e.modified()).modifies(s).modifies("leaf")}});function cse(e,t,n){for(let r,i=0,s=t.length;is[Ne(o)]=1),r.each(o=>{const a=o.data,u=o.parent&&o.parent.data;u&&s[Ne(a)]&&s[Ne(u)]&&i.add.push(ht({source:u,target:a}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,o=>s[Ne(o)]=1),n.forEach(o=>{(s[Ne(o.source)]||s[Ne(o.target)])&&i.mod.push(o)})),i}});const SD={binary:ise,dice:Ag,slice:vy,slicedice:sse,squarify:NL,resquarify:ose},_w=["x0","y0","x1","y1","depth","children"];function Vk(e){ga.call(this,e)}Vk.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:_w.length,default:_w}]};pe(Vk,ga,{layout(){const e=rse();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{_e(SD,t)?e.tile(SD[t]):K("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:_w});const dse=Object.freeze(Object.defineProperty({__proto__:null,nest:Uk,pack:qk,partition:Wk,stratify:Hk,tree:Gk,treelinks:Yk,treemap:Vk},Symbol.toStringTag,{value:"Module"})),$2=4278190080;function hse(e,t){const n=e.bitmap();return(t||[]).forEach(r=>n.set(e(r.boundary[0]),e(r.boundary[3]))),[n,void 0]}function pse(e,t,n,r,i){const s=e.width,o=e.height,a=r||i,u=nu(s,o).getContext("2d"),l=nu(s,o).getContext("2d"),c=a&&nu(s,o).getContext("2d");n.forEach(S=>pm(u,S,!1)),pm(l,t,!1),a&&pm(c,t,!0);const f=D2(u,s,o),d=D2(l,s,o),h=a&&D2(c,s,o),p=e.bitmap(),g=a&&e.bitmap();let m,v,y,b,x,_,A,E;for(v=0;v{i.items.forEach(s=>pm(e,s.items,n))}):fi[r].draw(e,{items:n?t.map(gse):t})}function gse(e){const t=Rv(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const Lo=5,ar=31,Sp=32,Na=new Uint32Array(Sp+1),ns=new Uint32Array(Sp+1);ns[0]=0;Na[0]=~ns[0];for(let e=1;e<=Sp;++e)ns[e]=ns[e-1]<<1|1,Na[e]=~ns[e];function mse(e,t){const n=new Uint32Array(~~((e*t+Sp)/Sp));function r(s,o){n[s]|=o}function i(s,o){n[s]&=o}return{array:n,get:(s,o)=>{const a=o*e+s;return n[a>>>Lo]&1<<(a&ar)},set:(s,o)=>{const a=o*e+s;r(a>>>Lo,1<<(a&ar))},clear:(s,o)=>{const a=o*e+s;i(a>>>Lo,~(1<<(a&ar)))},getRange:(s,o,a,u)=>{let l=u,c,f,d,h;for(;l>=o;--l)if(c=l*e+s,f=l*e+a,d=c>>>Lo,h=f>>>Lo,d===h){if(n[d]&Na[c&ar]&ns[(f&ar)+1])return!0}else{if(n[d]&Na[c&ar]||n[h]&ns[(f&ar)+1])return!0;for(let p=d+1;p{let l,c,f,d,h;for(;o<=u;++o)if(l=o*e+s,c=o*e+a,f=l>>>Lo,d=c>>>Lo,f===d)r(f,Na[l&ar]&ns[(c&ar)+1]);else for(r(f,Na[l&ar]),r(d,ns[(c&ar)+1]),h=f+1;h{let l,c,f,d,h;for(;o<=u;++o)if(l=o*e+s,c=o*e+a,f=l>>>Lo,d=c>>>Lo,f===d)i(f,ns[l&ar]|Na[(c&ar)+1]);else for(i(f,ns[l&ar]),i(d,Na[(c&ar)+1]),h=f+1;hs<0||o<0||u>=t||a>=e}}function vse(e,t,n){const r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),s=~~((t+2*n+r)/r),o=a=>~~((a+n)/r);return o.invert=a=>a*r-n,o.bitmap=()=>mse(i,s),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function yse(e,t,n,r){const i=e.width,s=e.height;return function(o){const a=o.datum.datum.items[r].items,u=a.length,l=o.datum.fontSize,c=oi.width(o.datum,o.datum.text);let f=0,d,h,p,g,m,v,y;for(let b=0;b=f&&(f=y,o.x=m,o.y=v);return m=c/2,v=l/2,d=o.x-m,h=o.x+m,p=o.y-v,g=o.y+v,o.align="center",d<0&&h<=i?o.align="left":0<=d&&ii||t-(o=r/2)<0||t+o>s}function Ya(e,t,n,r,i,s,o,a){const u=i*s/(r*2),l=e(t-u),c=e(t+u),f=e(n-(s=s/2)),d=e(n+s);return o.outOfBounds(l,f,c,d)||o.getRange(l,f,c,d)||a&&a.getRange(l,f,c,d)}function bse(e,t,n,r){const i=e.width,s=e.height,o=t[0],a=t[1];function u(l,c,f,d,h){const p=e.invert(l),g=e.invert(c);let m=f,v=s,y;if(!P1(p,g,d,h,i,s)&&!Ya(e,p,g,h,d,m,o,a)&&!Ya(e,p,g,h,d,h,o,null)){for(;v-m>=1;)y=(m+v)/2,Ya(e,p,g,h,d,y,o,a)?v=y:m=y;if(m>f)return[p,g,m,!0]}}return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=oi.width(l.datum,l.datum.text);let p=n?d:0,g=!1,m=!1,v=0,y,b,x,_,A,E,S,k,F,D,M,T,$,C,R,L,O;for(let N=0;Nb&&(O=y,y=b,b=O),x>_&&(O=x,x=_,_=O),F=e(y),M=e(b),D=~~((F+M)/2),T=e(x),C=e(_),$=~~((T+C)/2),S=D;S>=F;--S)for(k=$;k>=T;--k)L=u(S,k,p,h,d),L&&([l.x,l.y,p,g]=L);for(S=D;S<=M;++S)for(k=$;k<=C;++k)L=u(S,k,p,h,d),L&&([l.x,l.y,p,g]=L);!g&&!n&&(R=Math.abs(b-y+_-x),A=(y+b)/2,E=(x+_)/2,R>=v&&!P1(A,E,h,d,i,s)&&!Ya(e,A,E,d,h,d,o,null)&&(v=R,l.x=A,l.y=E,m=!0))}return g||m?(A=h/2,E=d/2,o.setRange(e(l.x-A),e(l.y-E),e(l.x+A),e(l.y+E)),l.align="center",l.baseline="middle",!0):!1}}const xse=[-1,-1,1,1],_se=[-1,1,-1,1];function wse(e,t,n,r){const i=e.width,s=e.height,o=t[0],a=t[1],u=e.bitmap();return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=oi.width(l.datum,l.datum.text),p=[];let g=n?d:0,m=!1,v=!1,y=0,b,x,_,A,E,S,k,F,D,M,T,$;for(let C=0;C=1;)T=(D+M)/2,Ya(e,E,S,d,h,T,o,a)?M=T:D=T;D>g&&(l.x=E,l.y=S,g=D,m=!0)}}!m&&!n&&($=Math.abs(x-b+A-_),E=(b+x)/2,S=(_+A)/2,$>=y&&!P1(E,S,h,d,i,s)&&!Ya(e,E,S,d,h,d,o,null)&&(y=$,l.x=E,l.y=S,v=!0))}return m||v?(E=h/2,S=d/2,o.setRange(e(l.x-E),e(l.y-S),e(l.x+E),e(l.y+S)),l.align="center",l.baseline="middle",!0):!1}}const Ese=["right","center","left"],Ase=["bottom","middle","top"];function Sse(e,t,n,r){const i=e.width,s=e.height,o=t[0],a=t[1],u=r.length;return function(l){const c=l.boundary,f=l.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>s)return!1;let d=l.textWidth??0,h,p,g,m,v,y,b,x,_,A,E,S,k,F,D;for(let M=0;M>>2&3)-1,g=h===0&&p===0||r[M]<0,m=h&&p?Math.SQRT1_2:1,v=r[M]<0?-1:1,y=c[1+h]+r[M]*h*m,E=c[4+p]+v*f*p/2+r[M]*p*m,x=E-f/2,_=E+f/2,S=e(y),F=e(x),D=e(_),!d)if(kD(S,S,F,D,o,a,y,y,x,_,c,g))d=oi.width(l.datum,l.datum.text);else continue;if(A=y+v*d*h/2,y=A-d/2,b=A+d/2,S=e(y),k=e(b),kD(S,k,F,D,o,a,y,b,x,_,c,g))return l.x=h?h*v<0?b:y:A,l.y=p?p*v<0?_:x:E,l.align=Ese[h*v+1],l.baseline=Ase[p*v+1],o.setRange(S,F,k,D),!0}return!1}}function kD(e,t,n,r,i,s,o,a,u,l,c,f){return!(i.outOfBounds(e,n,t,r)||(f&&s||i).getRange(e,n,t,r))}const M2=0,R2=4,T2=8,N2=0,O2=1,L2=2,kse={"top-left":M2+N2,top:M2+O2,"top-right":M2+L2,left:R2+N2,middle:R2+O2,right:R2+L2,"bottom-left":T2+N2,bottom:T2+O2,"bottom-right":T2+L2},Cse={naive:yse,"reduced-search":bse,floodfill:wse};function Fse(e,t,n,r,i,s,o,a,u,l,c){if(!e.length)return e;const f=Math.max(r.length,i.length),d=$se(r,f),h=Dse(i,f),p=Mse(e[0].datum),g=p==="group"&&e[0].datum.items[u].marktype,m=g==="area",v=Rse(p,g,a,u),y=l===null||l===1/0,b=m&&c==="naive";let x=-1,_=-1;const A=e.map(F=>{const D=y?oi.width(F,F.text):void 0;return x=Math.max(x,D),_=Math.max(_,F.fontSize),{datum:F,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v(F),textWidth:D}});l=l===null||l===1/0?Math.max(x,_)+Math.max(...r):l;const E=vse(t[0],t[1],l);let S;if(!b){n&&A.sort((M,T)=>n(M.datum,T.datum));let F=!1;for(let M=0;MM.datum);S=s.length||D?pse(E,D||[],s,F,m):hse(E,o&&A)}const k=m?Cse[c](E,S,o,u):Sse(E,S,h,d);return A.forEach(F=>F.opacity=+k(F)),A}function $se(e,t){const n=new Float64Array(t),r=e.length;for(let i=0;i[s.x,s.x,s.x,s.y,s.y,s.y];return e?e==="line"||e==="area"?s=>i(s.datum):t==="line"?s=>{const o=s.datum.items[r].items;return i(o.length?o[n==="start"?0:o.length-1]:{x:NaN,y:NaN})}:s=>{const o=s.datum.bounds;return[o.x1,(o.x1+o.x2)/2,o.x2,o.y1,(o.y1+o.y2)/2,o.y2]}:i}const ww=["x","y","opacity","align","baseline"],OL=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function Xk(e){G.call(this,null,e)}Xk.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:OL},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:ww.length,default:ww}]};pe(Xk,G,{transform(e,t){function n(s){const o=e[s];return He(o)&&t.modified(o.fields)}const r=e.modified();if(!(r||t.changed(t.ADD_REM)||n("sort")))return;(!e.size||e.size.length!==2)&&K("Size parameter should be specified as a [width, height] array.");const i=e.as||ww;return Fse(t.materialize(t.SOURCE).source||[],e.size,e.sort,xe(e.offset==null?1:e.offset),xe(e.anchor||OL),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(s=>{const o=s.datum;o[i[0]]=s.x,o[i[1]]=s.y,o[i[2]]=s.opacity,o[i[3]]=s.align,o[i[4]]=s.baseline}),t.reflow(r).modifies(i)}});const Tse=Object.freeze(Object.defineProperty({__proto__:null,label:Xk},Symbol.toStringTag,{value:"Module"}));function LL(e,t){var n=[],r=function(c){return c(a)},i,s,o,a,u,l;if(t==null)n.push(e);else for(i={},s=0,o=e.length;s{qT(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;de==="poly"?t:e==="quad"?2:1;function Zk(e){G.call(this,null,e)}Zk.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(Ew)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]};pe(Zk,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=t.materialize(t.SOURCE).source,i=LL(r,e.groupby),s=(e.groupby||[]).map(Wt),o=e.method||"linear",a=e.order==null?3:e.order,u=Nse(o,a),l=e.as||[Wt(e.x),Wt(e.y)],c=Ew[o],f=[];let d=e.extent;_e(Ew,o)||K("Invalid regression method: "+o),d!=null&&o==="log"&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach(h=>{if(h.length<=u){t.dataflow.warn("Skipping regression with more parameters than data points.");return}const g=c(h,e.x,e.y,a);if(e.params){f.push(ht({keys:h.dims,coef:g.coef,rSquared:g.rSquared}));return}const m=d||uo(h,e.x),v=y=>{const b={};for(let x=0;xv([y,g.predict(y)])):Bv(g.predict,m,25,200).forEach(v)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const Ose=Object.freeze(Object.defineProperty({__proto__:null,loess:Kk,regression:Zk},Symbol.toStringTag,{value:"Module"})),ta=11102230246251565e-32,Wn=134217729,Lse=(3+8*ta)*ta;function I2(e,t,n,r,i){let s,o,a,u,l=t[0],c=r[0],f=0,d=0;c>l==c>-l?(s=l,l=t[++f]):(s=c,c=r[++d]);let h=0;if(fl==c>-l?(o=l+s,a=s-(o-l),l=t[++f]):(o=c+s,a=s-(o-c),c=r[++d]),s=o,a!==0&&(i[h++]=a);fl==c>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=t[++f]):(o=s+c,u=o-s,a=s-(o-u)+(c-u),c=r[++d]),s=o,a!==0&&(i[h++]=a);for(;f=$||-T>=$||(f=e-k,a=e-(k+f)+(f-i),f=n-F,l=n-(F+f)+(f-i),f=t-D,u=t-(D+f)+(f-s),f=r-M,c=r-(M+f)+(f-s),a===0&&u===0&&l===0&&c===0)||($=zse*o+Lse*Math.abs(T),T+=k*c+M*a-(D*l+F*u),T>=$||-T>=$))return T;x=a*M,d=Wn*a,h=d-(d-a),p=a-h,d=Wn*M,g=d-(d-M),m=M-g,_=p*m-(x-h*g-p*g-h*m),A=u*F,d=Wn*u,h=d-(d-u),p=u-h,d=Wn*F,g=d-(d-F),m=F-g,E=p*m-(A-h*g-p*g-h*m),v=_-E,f=_-v,ur[0]=_-(v+f)+(f-E),y=x+v,f=y-x,b=x-(y-f)+(v-f),v=b-A,f=b-v,ur[1]=b-(v+f)+(f-A),S=y+v,f=S-y,ur[2]=y-(S-f)+(v-f),ur[3]=S;const C=I2(4,Ic,4,ur,CD);x=k*c,d=Wn*k,h=d-(d-k),p=k-h,d=Wn*c,g=d-(d-c),m=c-g,_=p*m-(x-h*g-p*g-h*m),A=D*l,d=Wn*D,h=d-(d-D),p=D-h,d=Wn*l,g=d-(d-l),m=l-g,E=p*m-(A-h*g-p*g-h*m),v=_-E,f=_-v,ur[0]=_-(v+f)+(f-E),y=x+v,f=y-x,b=x-(y-f)+(v-f),v=b-A,f=b-v,ur[1]=b-(v+f)+(f-A),S=y+v,f=S-y,ur[2]=y-(S-f)+(v-f),ur[3]=S;const R=I2(C,CD,4,ur,FD);x=a*c,d=Wn*a,h=d-(d-a),p=a-h,d=Wn*c,g=d-(d-c),m=c-g,_=p*m-(x-h*g-p*g-h*m),A=u*l,d=Wn*u,h=d-(d-u),p=u-h,d=Wn*l,g=d-(d-l),m=l-g,E=p*m-(A-h*g-p*g-h*m),v=_-E,f=_-v,ur[0]=_-(v+f)+(f-E),y=x+v,f=y-x,b=x-(y-f)+(v-f),v=b-A,f=b-v,ur[1]=b-(v+f)+(f-A),S=y+v,f=S-y,ur[2]=y-(S-f)+(v-f),ur[3]=S;const L=I2(R,FD,4,ur,$D);return $D[L-1]}function E0(e,t,n,r,i,s){const o=(t-s)*(n-i),a=(e-i)*(r-s),u=o-a,l=Math.abs(o+a);return Math.abs(u)>=Pse*l?u:-jse(e,t,n,r,i,s,l)}const DD=Math.pow(2,-52),A0=new Uint32Array(512);class B1{static from(t,n=Gse,r=Yse){const i=t.length,s=new Float64Array(i*2);for(let o=0;o>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:s}=this,o=t.length>>1;let a=1/0,u=1/0,l=-1/0,c=-1/0;for(let k=0;kl&&(l=F),D>c&&(c=D),this._ids[k]=k}const f=(a+l)/2,d=(u+c)/2;let h,p,g;for(let k=0,F=1/0;k0&&(p=k,F=D)}let y=t[2*p],b=t[2*p+1],x=1/0;for(let k=0;kM&&(k[F++]=T,M=$)}this.hull=k.subarray(0,F),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(E0(m,v,y,b,_,A)<0){const k=p,F=y,D=b;p=g,y=_,b=A,g=k,_=F,A=D}const E=Hse(m,v,y,b,_,A);this._cx=E.x,this._cy=E.y;for(let k=0;k0&&Math.abs(T-F)<=DD&&Math.abs($-D)<=DD||(F=T,D=$,M===h||M===p||M===g))continue;let C=0;for(let B=0,q=this._hashKey(T,$);B=0;)if(R=L,R===C){R=-1;break}if(R===-1)continue;let O=this._addTriangle(R,M,r[R],-1,-1,i[R]);i[M]=this._legalize(O+2),i[R]=O,S++;let N=r[R];for(;L=r[N],E0(T,$,t[2*N],t[2*N+1],t[2*L],t[2*L+1])<0;)O=this._addTriangle(N,M,L,i[M],-1,i[N]),i[M]=this._legalize(O+2),r[N]=N,S--,N=L;if(R===C)for(;L=n[R],E0(T,$,t[2*L],t[2*L+1],t[2*R],t[2*R+1])<0;)O=this._addTriangle(L,M,R,-1,i[R],i[L]),this._legalize(O+2),i[L]=O,r[R]=R,S--,R=L;this._hullStart=n[M]=R,r[R]=n[N]=M,r[M]=N,s[this._hashKey(T,$)]=M,s[this._hashKey(t[2*R],t[2*R+1])]=R}this.hull=new Uint32Array(S);for(let k=0,F=this._hullStart;k0?3-n:1+n)/4}function P2(e,t,n,r){const i=e-n,s=t-r;return i*i+s*s}function qse(e,t,n,r,i,s,o,a){const u=e-o,l=t-a,c=n-o,f=r-a,d=i-o,h=s-a,p=u*u+l*l,g=c*c+f*f,m=d*d+h*h;return u*(f*m-g*h)-l*(c*m-g*d)+p*(c*h-f*d)<0}function Wse(e,t,n,r,i,s){const o=n-e,a=r-t,u=i-e,l=s-t,c=o*o+a*a,f=u*u+l*l,d=.5/(o*l-a*u),h=(l*c-a*f)*d,p=(o*f-u*c)*d;return h*h+p*p}function Hse(e,t,n,r,i,s){const o=n-e,a=r-t,u=i-e,l=s-t,c=o*o+a*a,f=u*u+l*l,d=.5/(o*l-a*u),h=e+(l*c-a*f)*d,p=t+(o*f-u*c)*d;return{x:h,y:p}}function ef(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const s=e[i],o=t[s];let a=i-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=s}else{const i=n+r>>1;let s=n+1,o=r;sh(e,i,s),t[e[n]]>t[e[r]]&&sh(e,n,r),t[e[s]]>t[e[r]]&&sh(e,s,r),t[e[n]]>t[e[s]]&&sh(e,n,s);const a=e[s],u=t[a];for(;;){do s++;while(t[e[s]]u);if(o=o-n?(ef(e,t,s,r),ef(e,t,n,o-1)):(ef(e,t,n,o-1),ef(e,t,s,r))}}function sh(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Gse(e){return e[0]}function Yse(e){return e[1]}const MD=1e-6;class dl{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,s=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${s}`:(Math.abs(this._x1-i)>MD||Math.abs(this._y1-s)>MD)&&(this._+="L"+i+","+s),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=s}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class Aw{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let Vse=class{constructor(t,[n,r,i,s]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((s=+s)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=s,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let s,o;const a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let g=0,m=0,v=r.length,y,b;g1;)s-=2;for(let o=2;o0){if(n>=this.ymax)return null;(o=(this.ymax-n)/i)0){if(t>=this.xmax)return null;(o=(this.xmax-t)/r)this.xmax?2:0)|(nthis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n1e-10)return!1}return!0}function Qse(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class Jk{static from(t,n=Kse,r=Zse,i){return new Jk("length"in t?eoe(t,n,r,i):Float64Array.from(toe(t,n,r,i)))}constructor(t){this._delaunator=new B1(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&Jse(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);const u=this.collinear[0],l=this.collinear[this.collinear.length-1],c=[n[2*u],n[2*u+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(c[3]-c[1],c[2]-c[0]);for(let d=0,h=n.length/2;d0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Vse(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:s,triangles:o,collinear:a}=this;if(a){const f=a.indexOf(t);f>0&&(yield a[f-1]),f=0&&s!==r&&s!==i;)r=s;return s}_step(t,n,r){const{inedges:i,hull:s,_hullIndex:o,halfedges:a,triangles:u,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let c=t,f=Pc(n-l[t*2],2)+Pc(r-l[t*2+1],2);const d=i[t];let h=d;do{let p=u[h];const g=Pc(n-l[p*2],2)+Pc(r-l[p*2+1],2);if(g>5)*e[1]),m=null,v=l.length,y=-1,b=[],x=l.map(A=>({text:t(A),font:n(A),style:i(A),weight:s(A),rotate:o(A),size:~~(r(A)+1e-14),padding:a(A),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:A})).sort((A,E)=>E.size-A.size);++y>1,_.y=e[1]*(c()+.5)>>1,aoe(p,_,x,y),_.hasText&&h(g,_,m)&&(b.push(_),m?loe(m,_):m=[{x:_.x+_.x0,y:_.y+_.y0},{x:_.x+_.x1,y:_.y+_.y1}],_.x-=e[0]>>1,_.y-=e[1]>>1)}return b};function d(p){p.width=p.height=1;var g=Math.sqrt(p.getContext("2d").getImageData(0,0,1,1).data.length>>2);p.width=(Ih<<5)/g,p.height=gm/g;var m=p.getContext("2d");return m.fillStyle=m.strokeStyle="red",m.textAlign="center",{context:m,ratio:g}}function h(p,g,m){for(var v=g.x,y=g.y,b=Math.hypot(e[0],e[1]),x=u(e),_=c()<.5?1:-1,A=-_,E,S,k;(E=x(A+=_))&&(S=~~E[0],k=~~E[1],!(Math.min(Math.abs(S),Math.abs(k))>=b));)if(g.x=v+S,g.y=y+k,!(g.x+g.x0<0||g.y+g.y0<0||g.x+g.x1>e[0]||g.y+g.y1>e[1])&&(!m||!uoe(g,p,e[0]))&&(!m||coe(g,m))){for(var F=g.sprite,D=g.width>>5,M=e[0]>>5,T=g.x-(D<<4),$=T&127,C=32-$,R=g.y1-g.y0,L=(g.y+g.y0)*M+(T>>5),O,N=0;N>>$:0);L+=M}return g.sprite=null,!0}return!1}return f.words=function(p){return arguments.length?(l=p,f):l},f.size=function(p){return arguments.length?(e=[+p[0],+p[1]],f):e},f.font=function(p){return arguments.length?(n=ju(p),f):n},f.fontStyle=function(p){return arguments.length?(i=ju(p),f):i},f.fontWeight=function(p){return arguments.length?(s=ju(p),f):s},f.rotate=function(p){return arguments.length?(o=ju(p),f):o},f.text=function(p){return arguments.length?(t=ju(p),f):t},f.spiral=function(p){return arguments.length?(u=hoe[p]||p,f):u},f.fontSize=function(p){return arguments.length?(r=ju(p),f):r},f.padding=function(p){return arguments.length?(a=ju(p),f):a},f.random=function(p){return arguments.length?(c=p,f):c},f}function aoe(e,t,n,r){if(!t.sprite){var i=e.context,s=e.ratio;i.clearRect(0,0,(Ih<<5)/s,gm/s);var o=0,a=0,u=0,l=n.length,c,f,d,h,p;for(--r;++r>5<<5,d=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else c=c+31>>5<<5;if(d>u&&(u=d),o+c>=Ih<<5&&(o=0,a+=u,u=0),a+d>=gm)break;i.translate((o+(c>>1))/s,(a+(d>>1))/s),t.rotate&&i.rotate(t.rotate*B2),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=c,t.height=d,t.xoff=o,t.yoff=a,t.x1=c>>1,t.y1=d>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=c}for(var _=i.getImageData(0,0,(Ih<<5)/s,gm/s).data,A=[];--r>=0;)if(t=n[r],!!t.hasText){for(c=t.width,f=c>>5,d=t.y1-t.y0,h=0;h>5),F=_[(a+p)*(Ih<<5)+(o+h)<<2]?1<<31-h%32:0;A[k]|=F,E|=F}E?S=p:(t.y0++,d--,p--,a++)}t.y1=t.y0+S,t.sprite=A.slice(0,(t.y1-t.y0)*f)}}}function uoe(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,s=e.x-(i<<4),o=s&127,a=32-o,u=e.y1-e.y0,l=(e.y+e.y0)*n+(s>>5),c,f=0;f>>o:0))&t[l+d])return!0;l+=n}return!1}function loe(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function coe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0g(p(m))}i.forEach(p=>{p[o[0]]=NaN,p[o[1]]=NaN,p[o[3]]=0});const l=s.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(a).random(Ii).layout(),c=s.size(),f=c[0]>>1,d=c[1]>>1,h=l.length;for(let p=0,g,m;pnew Uint8Array(e),voe=e=>new Uint16Array(e),tp=e=>new Uint32Array(e);function yoe(){let e=8,t=[],n=tp(0),r=S0(0,e),i=S0(0,e);return{data:()=>t,seen:()=>n=boe(n,t.length),add(s){for(let o=0,a=t.length,u=s.length,l;ot.length,curr:()=>r,prev:()=>i,reset:s=>i[s]=r[s],all:()=>e<257?255:e<65537?65535:4294967295,set(s,o){r[s]|=o},clear(s,o){r[s]&=~o},resize(s,o){const a=r.length;(s>a||o>e)&&(e=Math.max(o,e),r=S0(s,e,r),i=S0(s,e))}}}function boe(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function S0(e,t,n){const r=(t<257?moe:t<65537?voe:tp)(e);return n&&r.set(n),r}function RD(e,t,n){const r=1<0)for(m=0;me,size:()=>n}}function xoe(e,t){return e.sort.call(t,(n,r)=>{const i=e[n],s=e[r];return is?1:0}),$H(e,t)}function _oe(e,t,n,r,i,s,o,a,u){let l=0,c=0,f;for(f=0;lt.modified(r.fields));return n?this.reinit(e,t):this.eval(e,t)}else return this.init(e,t)},init(e,t){const n=e.fields,r=e.query,i=this._indices={},s=this._dims=[],o=r.length;let a=0,u,l;for(;a{const s=i.remove(t,n);for(const o in r)r[o].reindex(s)})},update(e,t,n){const r=this._dims,i=e.query,s=t.stamp,o=r.length;let a=0,u,l;for(n.filters=0,l=0;lh)for(m=h,v=Math.min(f,p);mp)for(m=Math.max(f,p),v=d;mf)for(p=f,g=Math.min(l,d);pd)for(p=Math.max(l,d),g=c;pa[c]&n?null:o[c];return s.filter(s.MOD,l),i&i-1?(s.filter(s.ADD,c=>{const f=a[c]&n;return!f&&f^u[c]&n?o[c]:null}),s.filter(s.REM,c=>{const f=a[c]&n;return f&&!(f^(f^u[c]&n))?o[c]:null})):(s.filter(s.ADD,l),s.filter(s.REM,c=>(a[c]&n)===i?o[c]:null)),s.filter(s.SOURCE,c=>l(c._index))}});const woe=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:tC,resolvefilter:nC},Symbol.toStringTag,{value:"Module"})),Eoe="RawCode",Hl="Literal",Aoe="Property",Soe="Identifier",koe="ArrayExpression",Coe="BinaryExpression",BL="CallExpression",Foe="ConditionalExpression",$oe="LogicalExpression",Doe="MemberExpression",Moe="ObjectExpression",Roe="UnaryExpression";function As(e){this.type=e}As.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=Toe(this),n=0,r=t.length;n";Ao[Gl]="Identifier";Ao[$u]="Keyword";Ao[by]="Null";Ao[pc]="Numeric";Ao[Mr]="Punctuator";Ao[Cg]="String";Ao[Noe]="RegularExpression";var Ooe="ArrayExpression",Loe="BinaryExpression",Ioe="CallExpression",Poe="ConditionalExpression",zL="Identifier",Boe="Literal",zoe="LogicalExpression",joe="MemberExpression",Uoe="ObjectExpression",qoe="Property",Woe="UnaryExpression",vn="Unexpected token %0",Hoe="Unexpected number",Goe="Unexpected string",Yoe="Unexpected identifier",Voe="Unexpected reserved word",Xoe="Unexpected end of input",Sw="Invalid regular expression",z2="Invalid regular expression: missing /",jL="Octal literals are not allowed in strict mode.",Koe="Duplicate data property in object literal not allowed in strict mode",Nn="ILLEGAL",kp="Disabled.",Zoe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Joe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function xy(e,t){if(!e)throw new Error("ASSERT: "+t)}function jo(e){return e>=48&&e<=57}function rC(e){return"0123456789abcdefABCDEF".includes(e)}function np(e){return"01234567".includes(e)}function Qoe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function Cp(e){return e===10||e===13||e===8232||e===8233}function Fg(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Zoe.test(String.fromCharCode(e))}function z1(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Joe.test(String.fromCharCode(e))}const eae={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function UL(){for(;Z1114111||e!=="}")&&ot({},vn,Nn),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function qL(){var e,t;for(e=Fe.charCodeAt(Z++),t=String.fromCharCode(e),e===92&&(Fe.charCodeAt(Z)!==117&&ot({},vn,Nn),++Z,e=kw("u"),(!e||e==="\\"||!Fg(e.charCodeAt(0)))&&ot({},vn,Nn),t=e);Z>>=")return Z+=4,{type:Mr,value:o,start:e,end:Z};if(s=o.substr(0,3),s===">>>"||s==="<<="||s===">>=")return Z+=3,{type:Mr,value:s,start:e,end:Z};if(i=s.substr(0,2),r===i[1]&&"+-<>&|".includes(r)||i==="=>")return Z+=2,{type:Mr,value:i,start:e,end:Z};if(i==="//"&&ot({},vn,Nn),"<>=!+-*%&|^/".includes(r))return++Z,{type:Mr,value:r,start:e,end:Z};ot({},vn,Nn)}function iae(e){let t="";for(;Z{if(parseInt(i,16)<=1114111)return"x";ot({},Sw)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{ot({},Sw)}try{return new RegExp(e,t)}catch{return null}}function uae(){var e,t,n,r,i;for(e=Fe[Z],xy(e==="/","Regular expression literal must start with a slash"),t=Fe[Z++],n=!1,r=!1;Z=0&&ot({},Sw,n),{value:n,literal:t}}function cae(){var e,t,n,r;return vt=null,UL(),e=Z,t=uae(),n=lae(),r=aae(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Z}}function fae(e){return e.type===Gl||e.type===$u||e.type===yy||e.type===by}function WL(){if(UL(),Z>=Qn)return{type:kg,start:Z,end:Z};const e=Fe.charCodeAt(Z);return Fg(e)?rae():e===40||e===41||e===59?j2():e===39||e===34?oae():e===46?jo(Fe.charCodeAt(Z+1))?ND():j2():jo(e)?ND():j2()}function Nr(){const e=vt;return Z=e.end,vt=WL(),Z=e.end,e}function HL(){const e=Z;vt=WL(),Z=e}function dae(e){const t=new As(Ooe);return t.elements=e,t}function OD(e,t,n){const r=new As(e==="||"||e==="&&"?zoe:Loe);return r.operator=e,r.left=t,r.right=n,r}function hae(e,t){const n=new As(Ioe);return n.callee=e,n.arguments=t,n}function pae(e,t,n){const r=new As(Poe);return r.test=e,r.consequent=t,r.alternate=n,r}function iC(e){const t=new As(zL);return t.name=e,t}function Ph(e){const t=new As(Boe);return t.value=e.value,t.raw=Fe.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function LD(e,t,n){const r=new As(joe);return r.computed=e==="[",r.object=t,r.property=n,r.computed||(n.member=!0),r}function gae(e){const t=new As(Uoe);return t.properties=e,t}function ID(e,t,n){const r=new As(qoe);return r.key=t,r.value=n,r.kind=e,r}function mae(e,t){const n=new As(Woe);return n.operator=e,n.argument=t,n.prefix=!0,n}function ot(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(s,o)=>(xy(o":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function Fae(){var e,t,n,r,i,s,o,a,u,l;if(e=vt,u=mm(),r=vt,i=zD(r),i===0)return u;for(r.prec=i,Nr(),t=[e,vt],o=mm(),s=[u,r,o];(i=zD(vt))>0;){for(;s.length>2&&i<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,u=s.pop(),t.pop(),n=OD(a,u,o),s.push(n);r=Nr(),r.prec=i,s.push(r),t.push(vt),n=mm(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=OD(s[l-1].value,s[l-2],n),l-=2;return n}function Yl(){var e,t,n;return e=Fae(),$t("?")&&(Nr(),t=Yl(),er(":"),n=Yl(),e=pae(e,t,n)),e}function sC(){const e=Yl();if($t(","))throw new Error(kp);return e}function GL(e){Fe=e,Z=0,Qn=Fe.length,vt=null,HL();const t=sC();if(vt.type!==kg)throw new Error("Unexpect token after expression.");return t}var YL={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function VL(e){function t(o,a,u,l){let c=e(a[0]);return u&&(c=u+"("+c+")",u.lastIndexOf("new ",0)===0&&(c="("+c+")")),c+"."+o+(l<0?"":l===0?"()":"("+a.slice(1).map(e).join(",")+")")}function n(o,a,u){return l=>t(o,l,a,u)}const r="new Date",i="String",s="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(o){o.length<3&&K("Missing arguments to clamp function."),o.length>3&&K("Too many arguments to clamp function.");const a=o.map(e);return"Math.max("+a[1]+", Math.min("+a[2]+","+a[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",i,0),lower:n("toLowerCase",i,0),substring:n("substring",i),split:n("split",i),trim:n("trim",i,0),btoa:"btoa",atob:"atob",regexp:s,test:n("test",s),if:function(o){o.length<3&&K("Missing arguments to if function."),o.length>3&&K("Too many arguments to if function.");const a=o.map(e);return"("+a[0]+"?"+a[1]+":"+a[2]+")"}}}function $ae(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function XL(e){e=e||{};const t=e.allowed?vs(e.allowed):{},n=e.forbidden?vs(e.forbidden):{},r=e.constants||YL,i=(e.functions||VL)(f),s=e.globalvar,o=e.fieldvar,a=He(s)?s:p=>`${s}["${p}"]`;let u={},l={},c=0;function f(p){if(be(p))return p;const g=d[p.type];return g==null&&K("Unsupported type: "+p.type),g(p)}const d={Literal:p=>p.raw,Identifier:p=>{const g=p.name;return c>0?g:_e(n,g)?K("Illegal identifier: "+g):_e(r,g)?r[g]:_e(t,g)?g:(u[g]=1,a(g))},MemberExpression:p=>{const g=!p.computed,m=f(p.object);g&&(c+=1);const v=f(p.property);return m===o&&(l[$ae(v)]=1),g&&(c-=1),m+(g?"."+v:"["+v+"]")},CallExpression:p=>{p.callee.type!=="Identifier"&&K("Illegal callee type: "+p.callee.type);const g=p.callee.name,m=p.arguments,v=_e(i,g)&&i[g];return v||K("Unrecognized function: "+g),He(v)?v(m):v+"("+m.map(f).join(",")+")"},ArrayExpression:p=>"["+p.elements.map(f).join(",")+"]",BinaryExpression:p=>"("+f(p.left)+" "+p.operator+" "+f(p.right)+")",UnaryExpression:p=>"("+p.operator+f(p.argument)+")",ConditionalExpression:p=>"("+f(p.test)+"?"+f(p.consequent)+":"+f(p.alternate)+")",LogicalExpression:p=>"("+f(p.left)+p.operator+f(p.right)+")",ObjectExpression:p=>{for(const g of p.properties){const m=g.key.name;UE.has(m)&&K("Illegal property: "+m)}return"{"+p.properties.map(f).join(",")+"}"},Property:p=>{c+=1;const g=f(p.key);return c-=1,g+":"+f(p.value)}};function h(p){const g={code:f(p),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},g}return h.functions=i,h.constants=r,h}const jD=Symbol("vega_selection_getter");function KL(e){return(!e.getter||!e.getter[jD])&&(e.getter=Ni(e.field),e.getter[jD]=!0),e.getter}const oC="intersect",UD="union",Dae="vlMulti",Mae="vlPoint",qD="or",Rae="and",Ys="_vgsid_",Fp=Ni(Ys),Tae="E",Nae="R",Oae="R-E",Lae="R-LE",Iae="R-RE",Pae="E-LT",Bae="E-LTE",zae="E-GT",jae="E-GTE",Uae="E-VALID",qae="E-ONE",j1="index:unit";function WD(e,t){for(var n=t.fields,r=t.values,i=n.length,s=0,o,a;s=r[s])return!1}else if(a.type===Bae){if(o>r[s])return!1}else if(a.type===zae){if(o<=r[s])return!1}else if(a.type===jae){if(oWe(t.fields?{values:t.fields.map(r=>KL(r)(n.datum))}:{[Ys]:Fp(n.datum)},t))}function Xae(e,t,n,r){for(var i=this.context.data[e],s=i?i.values.value:[],o={},a={},u={},l,c,f,d,h,p,g,m,v,y,b=s.length,x=0,_,A;x(E[c[k].field]=S,E),{})))}else h=Ys,p=Fp(l),g=o[h]||(o[h]={}),m=g[d]||(g[d]=[]),m.push(p),n&&(m=a[d]||(a[d]=[]),m.push({[Ys]:p}));if(t=t||UD,o[Ys]?o[Ys]=q2[`${Ys}_${t}`](...Object.values(o[Ys])):Object.keys(o).forEach(E=>{o[E]=Object.keys(o[E]).map(S=>o[E][S]).reduce((S,k)=>S===void 0?k:q2[`${u[E]}_${t}`](S,k))}),s=Object.keys(a),n&&s.length){const E=r?Mae:Dae;o[E]=t===UD?{[qD]:s.reduce((S,k)=>(S.push(...a[k]),S),[])}:{[Rae]:s.map(S=>({[qD]:a[S]}))}}return o}var q2={[`${Ys}_union`]:PH,[`${Ys}_intersect`]:LH,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;nt.includes(n)):t},R_union:function(e,t){var n=Xn(t[0]),r=Xn(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}};const Kae=":",Zae="@";function aC(e,t,n,r){t[0].type!==Hl&&K("First argument to selection functions must be a string literal.");const i=t[0].value,s=t.length>=2&&nt(t).value,o="unit",a=Zae+o,u=Kae+i;s===oC&&!_e(r,a)&&(r[a]=n.getData(i).indataRef(n,o)),_e(r,u)||(r[u]=n.getData(i).tuplesRef())}function JL(e){const t=this.context.data[e];return t?t.values.value:[]}function Jae(e,t,n){const r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i&&i.count}function Qae(e,t){const n=this.context.dataflow,r=this.context.data[e],i=r.input;return n.pulse(i,n.changeset().remove(Oi).insert(t)),1}function eue(e,t,n){if(e){const r=this.context.dataflow,i=e.mark.source;r.pulse(i,r.changeset().encode(e,t))}return n!==void 0?n:e}const $g=e=>function(t,n){const r=this.context.dataflow.locale();return t===null?"null":r[e](n)(t)},tue=$g("format"),QL=$g("timeFormat"),nue=$g("utcFormat"),rue=$g("timeParse"),iue=$g("utcParse"),k0=new Date(2e3,0,1);function wy(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(k0.setYear(2e3),k0.setMonth(e),k0.setDate(t),QL.call(this,k0,n))}function sue(e){return wy.call(this,e,1,"%B")}function oue(e){return wy.call(this,e,1,"%b")}function aue(e){return wy.call(this,0,2+e,"%A")}function uue(e){return wy.call(this,0,2+e,"%a")}const lue=":",cue="@",Cw="%",eI="$";function uC(e,t,n,r){t[0].type!==Hl&&K("First argument to data functions must be a string literal.");const i=t[0].value,s=lue+i;if(!_e(s,r))try{r[s]=n.getData(i).tuplesRef()}catch{}}function fue(e,t,n,r){t[0].type!==Hl&&K("First argument to indata must be a string literal."),t[1].type!==Hl&&K("Second argument to indata must be a string literal.");const i=t[0].value,s=t[1].value,o=cue+s;_e(o,r)||(r[o]=n.getData(i).indataRef(n,s))}function yr(e,t,n,r){if(t[0].type===Hl)HD(n,r,t[0].value);else for(e in n.scales)HD(n,r,e)}function HD(e,t,n){const r=Cw+n;if(!_e(t,r))try{t[r]=e.scaleRef(n)}catch{}}function So(e,t){if(be(e)){const n=t.scales[e];return n&&V$(n.value)?n.value:void 0}else if(He(e))return V$(e)?e:void 0}function due(e,t,n){t.__bandwidth=i=>i&&i.bandwidth?i.bandwidth():0,n._bandwidth=yr,n._range=yr,n._scale=yr;const r=i=>"_["+(i.type===Hl?ce(Cw+i.value):ce(Cw)+"+"+e(i))+"]";return{_bandwidth:i=>`this.__bandwidth(${r(i[0])})`,_range:i=>`${r(i[0])}.range()`,_scale:i=>`${r(i[0])}(${e(i[1])})`}}function lC(e,t){return function(n,r,i){if(n){const s=So(n,(i||this).context);return s&&s.path[e](r)}else return t(r)}}const hue=lC("area",Mte),pue=lC("bounds",Ote),gue=lC("centroid",jte);function mue(e,t){const n=So(e,(t||this).context);return n&&n.scale()}function vue(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function cC(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(r){e.warn(r)}return n[n.length-1]}function yue(){return cC(this.context.dataflow,"warn",arguments)}function bue(){return cC(this.context.dataflow,"info",arguments)}function xue(){return cC(this.context.dataflow,"debug",arguments)}function W2(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Fw(e){const t=cu(e),n=W2(t.r),r=W2(t.g),i=W2(t.b);return .2126*n+.7152*r+.0722*i}function _ue(e,t){const n=Fw(e),r=Fw(t),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}function wue(){const e=[].slice.call(arguments);return e.unshift({}),We(...e)}function tI(e,t){return e===t||e!==e&&t!==t?!0:Q(e)?Q(t)&&e.length===t.length?Eue(e,t):!1:ve(e)&&ve(t)?nI(e,t):!1}function Eue(e,t){for(let n=0,r=e.length;nnI(e,t)}function Aue(e,t,n,r,i,s){const o=this.context.dataflow,a=this.context.data[e],u=a.input,l=o.stamp();let c=a.changes,f,d;if(o._trigger===!1||!(u.value.length||t||r))return 0;if((!c||c.stamp{a.modified=!0,o.pulse(u,c).run()},!0,1)),n&&(f=n===!0?Oi:Q(n)||Mv(n)?n:GD(n),c.remove(f)),t&&c.insert(t),r&&(f=GD(r),u.value.some(f)?c.remove(f):c.insert(r)),i)for(d in s)c.modify(i,d,s[d]);return 1}function Sue(e){const t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function kue(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const YD={};function Cue(e,t){const n=YD[t]||(YD[t]=Ni(t));return Q(e)?e.map(n):n(e)}function Ey(e){return Q(e)||ArrayBuffer.isView(e)?e:null}function fC(e){return Ey(e)||(be(e)?e:null)}function Fue(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rs.stop(l(c),e(c))),s}function que(e,t,n){const r=So(e,(n||this).context);return function(i){return r?r.path.context(i)(t):""}}function Wue(e){let t=null;return function(n){return n?yp(n,t=t||Uf(e)):e}}const rI=e=>e.data;function iI(e,t){const n=JL.call(t,e);return n.root&&n.root.lookup||{}}function Hue(e,t,n){const r=iI(e,this),i=r[t],s=r[n];return i&&s?i.path(s).map(rI):void 0}function Gue(e,t){const n=iI(e,this)[t];return n?n.ancestors().map(rI):void 0}const sI=()=>typeof window<"u"&&window||null;function Yue(){const e=sI();return e?e.screen:{}}function Vue(){const e=sI();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function Xue(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function oI(e,t,n){if(!e)return[];const[r,i]=e,s=new en().set(r[0],r[1],i[0],i[1]),o=n||this.context.dataflow.scenegraph().root;return U7(o,s,Kue(t))}function Kue(e){let t=null;if(e){const n=xe(e.marktype),r=xe(e.markname);t=i=>(!n.length||n.some(s=>i.marktype===s))&&(!r.length||r.some(s=>i.name===s))}return t}function Zue(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;e=xe(e);const i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function Jue(e){return xe(e).reduce((t,n,r)=>{let[i,s]=n;return t+=r==0?`M ${i},${s} `:r===e.length-1?" Z":`L ${i},${s} `},"")}function Que(e,t,n){const{x:r,y:i,mark:s}=n,o=new en().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[u,l]of t)uo.x2&&(o.x2=u),lo.y2&&(o.y2=l);return o.translate(r,i),oI([[o.x1,o.y1],[o.x2,o.y2]],e,s).filter(u=>ele(u.x,u.y,t))}function ele(e,t,n){let r=0;for(let i=0,s=n.length-1;it!=a>t&&e<(o-u)*(t-l)/(a-l)+u&&r++}return r&1}const $p={random(){return Ii()},cumulativeNormal:Lv,cumulativeLogNormal:SA,cumulativeUniform:$A,densityNormal:xA,densityLogNormal:AA,densityUniform:FA,quantileNormal:Iv,quantileLogNormal:kA,quantileUniform:DA,sampleNormal:Ov,sampleLogNormal:EA,sampleUniform:CA,isArray:Q,isBoolean:Au,isDate:Qa,isDefined(e){return e!==void 0},isNumber:ut,isObject:ve,isRegExp:ZE,isString:be,isTuple:Mv,isValid(e){return e!=null&&e===e},toBoolean:QE,toDate(e){return eA(e)},toNumber:Xn,toString:tA,indexof:$ue,join:Fue,lastindexof:Due,replace:Rue,reverse:Tue,sort:Nue,slice:Mue,flush:dR,lerp:pR,merge:wue,pad:vR,peek:nt,pluck:Cue,span:ng,inrange:Kc,truncate:yR,rgb:cu,lab:Ym,hcl:Vm,hsl:Hm,luminance:Fw,contrast:_ue,sequence:ni,format:tue,utcFormat:nue,utcParse:iue,utcOffset:KR,utcSequence:QR,timeFormat:QL,timeParse:rue,timeOffset:XR,timeSequence:JR,timeUnitSpecifier:PR,monthFormat:sue,monthAbbrevFormat:oue,dayFormat:aue,dayAbbrevFormat:uue,quarter:uR,utcquarter:lR,week:zR,utcweek:qR,dayofyear:BR,utcdayofyear:UR,warn:yue,info:bue,debug:xue,extent(e){return uo(e)},inScope:vue,intersect:oI,clampRange:cR,pinchDistance:Sue,pinchAngle:kue,screen:Yue,containerSize:Xue,windowSize:Vue,bandspace:Oue,setdata:Qae,pathShape:Wue,panLinear:iR,panLog:sR,panPow:oR,panSymlog:aR,zoomLinear:GE,zoomLog:YE,zoomPow:Mm,zoomSymlog:VE,encode:eue,modify:Aue,lassoAppend:Zue,lassoPath:Jue,intersectLasso:Que},tle=["view","item","group","xy","x","y"],nle="event.vega.",aI="this.",dC={},uI={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${ce(eI+e)}]`,functions:rle,constants:YL,visitors:dC},$w=XL(uI);function rle(e){const t=VL(e);tle.forEach(n=>t[n]=nle+n);for(const n in $p)t[n]=aI+n;return We(t,due(e,$p,dC)),t}function Jt(e,t,n){return arguments.length===1?$p[e]:($p[e]=t,n&&(dC[e]=n),$w&&($w.functions[e]=aI+e),this)}Jt("bandwidth",Lue,yr);Jt("copy",Iue,yr);Jt("domain",Pue,yr);Jt("range",zue,yr);Jt("invert",Bue,yr);Jt("scale",jue,yr);Jt("gradient",Uue,yr);Jt("geoArea",hue,yr);Jt("geoBounds",pue,yr);Jt("geoCentroid",gue,yr);Jt("geoShape",que,yr);Jt("geoScale",mue,yr);Jt("indata",Jae,fue);Jt("data",JL,uC);Jt("treePath",Hue,uC);Jt("treeAncestors",Gue,uC);Jt("vlSelectionTest",Wae,aC);Jt("vlSelectionIdTest",Yae,aC);Jt("vlSelectionResolve",Xae,aC);Jt("vlSelectionTuples",Vae);function po(e,t){const n={};let r;try{e=be(e)?e:ce(e)+"",r=GL(e)}catch{K("Expression parse error: "+e)}r.visit(s=>{if(s.type!==BL)return;const o=s.callee.name,a=uI.visitors[o];a&&a(o,s.arguments,t,n)});const i=$w(r);return i.globals.forEach(s=>{const o=eI+s;!_e(n,o)&&t.getSignal(s)&&(n[o]=t.signalRef(s))}),{$expr:We({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}function ile(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(r=>t.parseOperator(r)),n.forEach(r=>t.parseOperatorParameters(r)),(e.streams||[]).forEach(r=>t.parseStream(r)),(e.updates||[]).forEach(r=>t.parseUpdate(r)),t.resolve()}const sle=vs(["rule"]),VD=vs(["group","image","rect"]);function ole(e,t){let n="";return sle[t]||(e.x2&&(e.x?(VD[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(VD[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}function hC(e){return(e+"").toLowerCase()}function ale(e){return hC(e)==="operator"}function ule(e){return hC(e)==="collect"}function oh(e,t,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function lle(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} + : (u > v || v == null) && u != null ? ${r} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} + : v !== v && u === u ? ${r} : `}var cle={operator:(e,t)=>oh(e,["_"],t.code),parameter:(e,t)=>oh(e,["datum","_"],t.code),event:(e,t)=>oh(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return oh(e,["_","event"],n)},encode:(e,t)=>{const{marktype:n,channels:r}=t;let i="var o=item,datum=o.datum,m=0,$;";for(const s in r){const o="o["+ce(s)+"]";i+=`$=${r[s].code};if(${o}!==$)${o}=$,m=1;`}return i+=ole(r,n),i+="return m;",oh(e,["item","_"],i)},codegen:{get(e){const t=`[${e.map(ce).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const r=(s,o)=>{const a=t[o];let u,l;return s.path?(u=`a${s.path}`,l=`b${s.path}`):((n=n||{})["f"+o]=s,u=`this.f${o}(a)`,l=`this.f${o}(b)`),lle(u,l,-a,a)},i=Function("a","b","var u, v; return "+e.map(r).join("")+"0;");return n?i.bind(n):i}}};function fle(e){const t=this;ale(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function dle(e){const t=this;if(e.params){const n=t.get(e.id);n||K("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function hle(e,t){t=t||{};const n=this;for(const r in e){const i=e[r];t[r]=Q(i)?i.map(s=>XD(s,n,t)):XD(i,n,t)}return t}function XD(e,t,n){if(!e||!ve(e))return e;for(let r=0,i=KD.length,s;ri&&i.$tupleid?Ne:i);return t.fn[n]||(t.fn[n]=XE(r,e.$order,t.expr.codegen))}function ble(e,t){const n=e.$encode,r={};for(const i in n){const s=n[i];r[i]=Gr(t.encodeExpression(s.$expr),s.$fields),r[i].output=s.$output}return r}function xle(e,t){return t}function _le(e,t){const n=e.$subflow;return function(r,i,s){const o=t.fork().parse(n),a=o.get(n.operators[0].id),u=o.signals.parent;return u&&u.set(s),a.detachSubflow=()=>t.detach(o),a}}function wle(){return Ne}function Ele(e){var t=this,n=e.filter!=null?t.eventExpression(e.filter):void 0,r=e.stream!=null?t.get(e.stream):void 0,i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(s=>t.get(s)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(s=>t.get(s)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r==null&&K("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function Ale(e){var t=this,n=ve(n=e.source)?n.$ref:n,r=t.get(n),i=null,s=e.update,o=void 0;r||K("Source not defined: "+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),s&&s.$expr&&(s.$params&&(o=t.parseParameters(s.$params)),s=t.handlerExpression(s.$expr)),t.update(e,r,i,s,o)}const Sle={skip:!0};function kle(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(s=>{const o=t.signals[s];e.signals(s,o)&&(r[s]=o.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(s=>{const o=t.data[s];e.data(s,o)&&(i[s]=o.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(s=>s.getState(e))),n}function Cle(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(s=>{n.update(t.signals[s],i[s],Sle)}),Object.keys(r||{}).forEach(s=>{n.pulse(t.data[s].input,n.changeset().remove(Oi).insert(r[s]))}),(e.subcontext||[]).forEach((s,o)=>{const a=t.subcontext[o];a&&a.setState(s)})}function lI(e,t,n,r){return new cI(e,t,n,r)}function cI(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||cle,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function ZD(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}cI.prototype=ZD.prototype={fork(){const e=new ZD(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(n=>n!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),ule(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let s=n.get(e.parent.$ref);s?(r.connect(s,[t]),t.targets().add(s)):(n.unresolved=n.unresolved||[]).push(()=>{s=n.get(e.parent.$ref),r.connect(s,[t]),t.targets().add(s)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const s in e.data){const o=n.data[s]||(n.data[s]={});e.data[s].forEach(a=>o[a]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[hC(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:ile,parseOperator:fle,parseOperatorParameters:dle,parseParameters:hle,parseStream:Ele,parseUpdate:Ale,getState:kle,setState:Cle};function Fle(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),fI(t,e.description()))}function fI(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function $le(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const H2="default";function Dle(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:H2,item:null}));e.on(e.events("view","pointermove"),t,(n,r)=>{const i=t.value,s=i?be(i)?i:i.user:H2,o=r.item&&r.item.cursor||null;return i&&s===i.user&&o==i.item?i:{user:s,item:o}}),e.add(null,function(n){let r=n.cursor,i=this.value;return be(r)||(i=r.item,r=r.user),Dw(e,r&&r!==H2?r:i||r),i},{cursor:t})}function Dw(e,t){const n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function U1(e,t){var n=e._runtime.data;return _e(n,t)||K("Unrecognized data set: "+t),n[t]}function Mle(e,t){return arguments.length<2?U1(this,e).values.value:Ay.call(this,e,fc().remove(Oi).insert(t))}function Ay(e,t){kT(t)||K("Second argument to changes must be a changeset.");const n=U1(this,e);return n.modified=!0,this.pulse(n.input,t)}function Rle(e,t){return Ay.call(this,e,fc().insert(t))}function Tle(e,t){return Ay.call(this,e,fc().remove(t))}function dI(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function hI(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function Sy(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function Nle(e){var t=Sy(e),n=dI(e),r=hI(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(i=>{try{i(n,r)}catch(s){e.error(s)}})}function Ole(e,t,n){var r=e._renderer,i=r&&r.canvas(),s,o,a;return i&&(a=Sy(e),o=t.changedTouches?t.changedTouches[0]:t,s=cy(o,i),s[0]-=a[0],s[1]-=a[1]),t.dataflow=e,t.item=n,t.vega=Lle(e,n,s),t}function Lle(e,t,n){const r=t?t.mark.marktype==="group"?t:t.mark.group:null;function i(o){var a=r,u;if(o){for(u=t;u;u=u.mark.group)if(u.mark.name===o){a=u;break}}return a&&a.mark&&a.mark.interactive?a:{}}function s(o){if(!o)return n;be(o)&&(o=i(o));const a=n.slice();for(;o;)a[0]-=o.x||0,a[1]-=o.y||0,o=o.mark&&o.mark.group;return a}return{view:ir(e),item:ir(t||{}),group:i,xy:s,x:o=>s(o)[0],y:o=>s(o)[1]}}const JD="view",Ile="timer",Ple="window",Ble={trap:!1};function zle(e){const t=We({defaults:{}},e),n=(r,i)=>{i.forEach(s=>{Q(r[s])&&(r[s]=vs(r[s]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function pI(e,t,n,r){e._eventListeners.push({type:n,sources:xe(t),handler:r})}function jle(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function C0(e,t,n){const r=e._eventConfig&&e._eventConfig[t];return r===!1||ve(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function Ule(e,t,n){var r=this,i=new Nv(n),s=function(l,c){r.runAsync(null,()=>{e===JD&&jle(r,t)&&l.preventDefault(),i.receive(Ole(r,l,c))})},o;if(e===Ile)C0(r,"timer",t)&&r.timer(s,t);else if(e===JD)C0(r,"view",t)&&r.addEventListener(t,s,Ble);else if(e===Ple?C0(r,"window",t)&&typeof window<"u"&&(o=[window]):typeof document<"u"&&C0(r,"selector",t)&&(o=Array.from(document.querySelectorAll(e))),!o)r.warn("Can not resolve event source: "+e);else{for(var a=0,u=o.length;a=0;)t[i].stop();for(i=r.length;--i>=0;)for(o=r[i],s=o.sources.length;--s>=0;)o.sources[s].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)u=n[i].type,a=n[i].handler,this._handler.off(u,a);return this}function ai(e,t,n){const r=document.createElement(e);for(const i in t)r.setAttribute(i,t[i]);return n!=null&&(r.textContent=n),r}const Hle="vega-bind",Gle="vega-bind-name",Yle="vega-bind-radio";function Vle(e,t,n){if(!t)return;const r=n.param;let i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:o=>{o!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,o)})}},r.debounce&&(i.update=KE(r.debounce,i.update))),(r.input==null&&r.element?Xle:Zle)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function Xle(e,t,n,r){const i=n.event||"input",s=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,s),pI(r,t,i,s),e.set=o=>{t.value=o,t.dispatchEvent(Kle(i))}}function Kle(e){return typeof Event<"u"?new Event(e):{type:e}}function Zle(e,t,n,r){const i=r.signal(n.signal),s=ai("div",{class:Hle}),o=n.input==="radio"?s:s.appendChild(ai("label"));o.appendChild(ai("span",{class:Gle},n.name||n.signal)),t.appendChild(s);let a=Jle;switch(n.input){case"checkbox":a=Qle;break;case"select":a=ece;break;case"radio":a=tce;break;case"range":a=nce;break}a(e,o,n,i)}function Jle(e,t,n,r){const i=ai("input");for(const s in n)s!=="signal"&&s!=="element"&&i.setAttribute(s==="input"?"type":s,n[s]);i.setAttribute("name",n.signal),i.value=r,t.appendChild(i),i.addEventListener("input",()=>e.update(i.value)),e.elements=[i],e.set=s=>i.value=s}function Qle(e,t,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const s=ai("input",i);t.appendChild(s),s.addEventListener("change",()=>e.update(s.checked)),e.elements=[s],e.set=o=>s.checked=!!o||null}function ece(e,t,n,r){const i=ai("select",{name:n.signal}),s=n.labels||[];n.options.forEach((o,a)=>{const u={value:o};q1(o,r)&&(u.selected=!0),i.appendChild(ai("option",u,(s[a]||o)+""))}),t.appendChild(i),i.addEventListener("change",()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=o=>{for(let a=0,u=n.options.length;a{const u={type:"radio",name:n.signal,value:o};q1(o,r)&&(u.checked=!0);const l=ai("input",u);l.addEventListener("change",()=>e.update(o));const c=ai("label",{},(s[a]||o)+"");return c.prepend(l),i.appendChild(c),l}),e.set=o=>{const a=e.elements,u=a.length;for(let l=0;l{u.textContent=a.value,e.update(+a.value)};a.addEventListener("input",l),a.addEventListener("change",l),e.elements=[a],e.set=c=>{a.value=c,u.textContent=c}}function q1(e,t){return e===t||e+""==t+""}function gI(e,t,n,r,i,s){return t=t||new r(e.loader()),t.initialize(n,dI(e),hI(e),Sy(e),i,s).background(e.background())}function pC(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function rce(e,t,n,r){const i=new r(e.loader(),pC(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,Sy(e),e);return t&&t.handlers().forEach(s=>{i.on(s.type,s.handler)}),i}function ice(e,t){const n=this,r=n._renderType,i=n._eventConfig.bind,s=fy(r);e=n._el=e?G2(n,e,!0):null,Fle(n),s||n.error("Unrecognized renderer type: "+r);const o=s.handler||_g,a=e?s.renderer:s.headless;return n._renderer=a?gI(n,n._renderer,e,a):null,n._handler=rce(n,n._handler,e,o),n._redraw=!0,e&&i!=="none"&&(t=t?n._elBind=G2(n,t,!0):e.appendChild(ai("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&i!=="container"&&(u.element=G2(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{Vle(n,u.element||t,u)})),n}function G2(e,t,n){if(typeof t=="string")if(typeof document<"u"){if(t=document.querySelector(t),!t)return e.error("Signal bind element not found: "+t),null}else return e.error("DOM document instance not found."),null;if(t&&n)try{t.textContent=""}catch(r){t=null,e.error(r)}return t}const ah=e=>+e||0,sce=e=>({top:e,bottom:e,left:e,right:e});function nM(e){return ve(e)?{top:ah(e.top),bottom:ah(e.bottom),left:ah(e.left),right:ah(e.right)}:sce(ah(e))}async function gC(e,t,n,r){const i=fy(t),s=i&&i.headless;return s||K("Unrecognized renderer type: "+t),await e.runAsync(),gI(e,null,null,s,n,r).renderAsync(e._scenegraph.root)}async function oce(e,t){e!==qa.Canvas&&e!==qa.SVG&&e!==qa.PNG&&K("Unrecognized image type: "+e);const n=await gC(this,e,t);return e===qa.SVG?ace(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function ace(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function uce(e,t){return(await gC(this,qa.Canvas,e,t)).canvas()}async function lce(e){return(await gC(this,qa.SVG,e)).svg()}function cce(e,t,n){return lI(e,Lf,$p,n).parse(t)}function fce(e){var t=this._runtime.scales;return _e(t,e)||K("Unrecognized scale or projection: "+e),t[e].value}var mI="width",vI="height",mC="padding",rM={skip:!0};function yI(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===mC?r.left+r.right:0)}function bI(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===mC?r.top+r.bottom:0)}function dce(e){var t=e._signals,n=t[mI],r=t[vI],i=t[mC];function s(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,a=>{e._width=a.size,e._viewWidth=yI(e,a.size),s()},{size:n}),e._resizeHeight=e.add(null,a=>{e._height=a.size,e._viewHeight=bI(e,a.size),s()},{size:r});const o=e.add(null,s,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}function hce(e,t,n,r,i,s){this.runAfter(o=>{let a=0;o._autosize=0,o.width()!==n&&(a=1,o.signal(mI,n,rM),o._resizeWidth.skip(!0)),o.height()!==r&&(a=1,o.signal(vI,r,rM),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==i[0]||o._origin[1]!==i[1])&&(o._resize=1,o._origin=i),a&&o.run("enter"),s&&o.runAfter(u=>u.resize())},!1,1)}function pce(e){return this._runtime.getState(e||{data:gce,signals:mce,recurse:!0})}function gce(e,t){return t.modified&&Q(t.input.value)&&!e.startsWith("_:vega:_")}function mce(e,t){return!(e==="parent"||t instanceof Lf.proxy)}function vce(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function yce(e,t){function n(r){e({timestamp:Date.now(),elapsed:r})}this._timers.push(Ure(n,t))}function bce(e,t,n,r){const i=e.element();i&&i.setAttribute("title",xce(r))}function xce(e){return e==null?"":Q(e)?xI(e):ve(e)&&!Qa(e)?_ce(e):e+""}function _ce(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(Q(n)?xI(n):_I(n))}).join(` +`)}function xI(e){return"["+e.map(_I).join(", ")+"]"}function _I(e){return Q(e)?"[โ€ฆ]":ve(e)&&!Qa(e)?"{โ€ฆ}":e}function wce(){if(this.renderer()==="canvas"&&this._renderer._canvas){let e=null;const t=()=>{e!=null&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function wI(e,t){const n=this;if(t=t||{},sf.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){const s=We({},e.locale,t.locale);n.locale(mT(s.number,s.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||qa.Canvas,n._scenegraph=new g7;const r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||bce,n._redraw=!0,n._handler=new _g().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=zle(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=cce(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(s=>({state:null,param:We({},s)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=yI(n,n._width),n._viewHeight=bI(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,dce(n),$le(n),Dle(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function F0(e,t){return _e(e._signals,t)?e._signals[t]:K("Unrecognized signal name: "+ce(t))}function EI(e,t){const n=(e._targets||[]).filter(r=>r._update&&r._update.handler===t);return n.length?n[0]:null}function iM(e,t,n,r){let i=EI(n,r);return i||(i=pC(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function sM(e,t,n){const r=EI(t,n);return r&&t._targets.remove(r),e}pe(wI,sf,{async evaluate(e,t,n){if(await sf.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,Nle(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(r){this.error(r)}return n&&Q0(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&fI(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const r=F0(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",nM(e)):nM(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(fy(e)||K("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(sf.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(F0(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:hce,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=pC(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,s;--r>=0;)if(s=n[r].type,i=n[r].handler,e===s&&(t===i||t===i.raw)){this._handler.off(s,i);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return iM(this,e,F0(this,e),t)},removeSignalListener(e,t){return sM(this,F0(this,e),t)},addDataListener(e,t){return iM(this,e,U1(this,e).values,t)},removeDataListener(e,t){return sM(this,U1(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=Dw(this,null);this._globalCursor=!!e,t&&Dw(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:yce,events:Ule,finalize:Wle,hover:qle,data:Mle,change:Ay,insert:Rle,remove:Tle,scale:fce,initialize:ice,toImageURL:oce,toCanvas:uce,toSVG:lce,getState:pce,setState:vce,_watchPixelRatio:wce});const Ece="view",W1="[",H1="]",AI="{",SI="}",Ace=":",kI=",",Sce="@",kce=">",Cce=/[[\]{}]/,Fce={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let CI,FI;function Du(e,t,n){return CI=t||Ece,FI=n||Fce,$I(e.trim()).map(Mw)}function $ce(e){return FI[e]}function rp(e,t,n,r,i){const s=e.length;let o=0,a;for(;t=0?--o:r&&r.indexOf(a)>=0&&++o}return t}function $I(e){const t=[],n=e.length;let r=0,i=0;for(;i' after between selector: "+e;r=r.map(Mw);const i=Mw(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function Mce(e){const t={source:CI},n=[];let r=[0,0],i=0,s=0,o=e.length,a=0,u,l;if(e[o-1]===SI){if(a=e.lastIndexOf(AI),a>=0){try{r=Rce(e.substring(a+1,o-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,a).trim(),o=e.length}else throw"Unmatched right brace: "+e;a=0}if(!o)throw e;if(e[0]===Sce&&(i=++a),u=rp(e,a,Ace),u1?(t.type=n[1],i?t.markname=n[0].slice(1):$ce(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)==="!"&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function Rce(e){const t=e.split(kI);if(!e.length||t.length>2)throw e;return t.map(n=>{const r=+n;if(r!==r)throw e;return r})}function Tce(e){return ve(e)?e:{type:e||"pad"}}const uh=e=>+e||0,Nce=e=>({top:e,bottom:e,left:e,right:e});function Oce(e){return ve(e)?e.signal?e:{top:uh(e.top),bottom:uh(e.bottom),left:uh(e.left),right:uh(e.right)}:Nce(uh(e))}const yn=e=>ve(e)&&!Q(e)?We({},e):{value:e};function oM(e,t,n,r){return n!=null?(ve(n)&&!Q(n)||Q(n)&&n.length&&ve(n[0])?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function zn(e,t,n){for(const r in t)oM(e,r,t[r]);for(const r in n)oM(e,r,n[r],"update")}function Dd(e,t,n){for(const r in t)n&&_e(n,r)||(e[r]=We(e[r]||{},t[r]));return e}function Yc(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const vC="mark",yC="frame",bC="scope",Lce="axis",Ice="axis-domain",Pce="axis-grid",Bce="axis-label",zce="axis-tick",jce="axis-title",Uce="legend",qce="legend-band",Wce="legend-entry",Hce="legend-gradient",DI="legend-label",Gce="legend-symbol",Yce="legend-title",Vce="title",Xce="title-text",Kce="title-subtitle";function Zce(e,t,n,r,i){const s={},o={};let a,u,l,c;u="lineBreak",t==="text"&&i[u]!=null&&!Yc(u,e)&&Y2(s,u,i[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===yC?i.group:n===vC?We({},i.mark,i[t]):null;for(u in c)l=Yc(u,e)||(u==="fill"||u==="stroke")&&(Yc("fill",e)||Yc("stroke",e)),l||Y2(s,u,c[u]);xe(r).forEach(f=>{const d=i.style&&i.style[f];for(const h in d)Yc(h,e)||Y2(s,h,d[h])}),e=We({},e);for(u in s)c=s[u],c.signal?(a=a||{})[u]=c:o[u]=c;return e.enter=We(o,e.enter),a&&(e.update=We(a,e.update)),e}function Y2(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const MI=e=>be(e)?ce(e):e.signal?`(${e.signal})`:RI(e);function ky(e){if(e.gradient!=null)return Qce(e);let t=e.signal?`(${e.signal})`:e.color?Jce(e.color):e.field!=null?RI(e.field):e.value!==void 0?ce(e.value):void 0;return e.scale!=null&&(t=efe(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${vm(e.exponent)})`),e.mult!=null&&(t+=`*${vm(e.mult)}`),e.offset!=null&&(t+=`+${vm(e.offset)}`),e.round&&(t=`round(${t})`),t}const $0=(e,t,n,r)=>`(${e}(${[t,n,r].map(ky).join(",")})+'')`;function Jce(e){return e.c?$0("hcl",e.h,e.c,e.l):e.h||e.s?$0("hsl",e.h,e.s,e.l):e.l||e.a?$0("lab",e.l,e.a,e.b):e.r||e.g||e.b?$0("rgb",e.r,e.g,e.b):null}function Qce(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:ce(n));for(;t.length&&nt(t)==null;)t.pop();return t.unshift(MI(e.gradient)),`gradient(${t.join(",")})`}function vm(e){return ve(e)?"("+ky(e)+")":e}function RI(e){return TI(ve(e)?e:{datum:e})}function TI(e){let t,n,r;if(e.signal)t="datum",r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(r=e.parent,t+=".datum"):r=e.group}else e.datum?(t="datum",r=e.datum):K("Invalid field reference: "+ce(e));return e.signal||(r=be(r)?bo(r).map(ce).join("]["):TI(r)),t+"["+r+"]"}function efe(e,t){const n=MI(e.scale);return e.range!=null?t=`lerp(_range(${n}), ${+e.range})`:(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(+e.band==1?"":"*"+vm(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function tfe(e){let t="";return e.forEach(n=>{const r=ky(n);t+=n.test?`(${n.test})?${r}:`:r}),nt(t)===":"&&(t+="null"),t}function NI(e,t,n,r,i,s){const o={};s=s||{},s.encoders={$encode:o},e=Zce(e,t,n,r,i.config);for(const a in e)o[a]=nfe(e[a],t,s,i);return s}function nfe(e,t,n,r){const i={},s={};for(const o in e)e[o]!=null&&(i[o]=ife(rfe(e[o]),r,n,s));return{$expr:{marktype:t,channels:i},$fields:Object.keys(s),$output:Object.keys(e)}}function rfe(e){return Q(e)?tfe(e):ky(e)}function ife(e,t,n,r){const i=po(e,t);return i.$fields.forEach(s=>r[s]=1),We(n,i.$params),i.$expr}const sfe="outer",ofe=["value","update","init","react","bind"];function aM(e,t){K(e+' for "outer" push: '+ce(t))}function OI(e,t){const n=e.name;if(e.push===sfe)t.signals[n]||aM("No prior signal definition",n),ofe.forEach(r=>{e[r]!==void 0&&aM("Invalid property ",r)});else{const r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function Rw(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function Cy(e,t,n,r){return new Rw(e,t,n,r)}function G1(e,t){return Cy("operator",e,t)}function Te(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Dp(e,t){return t?{$field:e,$name:t}:{$field:e}}const Tw=Dp("key");function uM(e,t){return{$compare:e,$order:t}}function afe(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const ufe="ascending",lfe="descending";function cfe(e){return ve(e)?(e.order===lfe?"-":"+")+Fy(e.op,e.field):""}function Fy(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const xC="scope",Nw="view";function un(e){return e&&e.signal}function ffe(e){return e&&e.expr}function ym(e){if(un(e))return!0;if(ve(e)){for(const t in e)if(ym(e[t]))return!0}return!1}function es(e,t){return e??t}function El(e){return e&&e.signal||e}const lM="timer";function Mp(e,t){return(e.merge?hfe:e.stream?pfe:e.type?gfe:K("Invalid stream specification: "+ce(e)))(e,t)}function dfe(e){return e===xC?Nw:e||Nw}function hfe(e,t){const n=e.merge.map(i=>Mp(i,t)),r=_C({merge:n},e,t);return t.addStream(r).id}function pfe(e,t){const n=Mp(e.stream,t),r=_C({stream:n},e,t);return t.addStream(r).id}function gfe(e,t){let n;e.type===lM?(n=t.event(lM,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(dfe(e.source),e.type);const r=_C({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function _C(e,t,n){let r=t.between;return r&&(r.length!==2&&K('Stream "between" parameter must have 2 entries: '+ce(t)),e.between=[Mp(r[0],n),Mp(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(mfe(t.marktype,t.markname,t.markrole)),t.source===xC&&r.push("inScope(event.item)"),r.length&&(e.filter=po("("+r.join(")&&(")+")",n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function mfe(e,t,n){const r="event.item";return r+(e&&e!=="*"?"&&"+r+".mark.marktype==='"+e+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(t?"&&"+r+".mark.name==='"+t+"'":"")}const vfe={code:"_.$value",ast:{type:"Identifier",value:"value"}};function yfe(e,t,n){const r=e.encode,i={target:n};let s=e.events,o=e.update,a=[];s||K("Signal update missing events specification."),be(s)&&(s=Du(s,t.isSubscope()?xC:Nw)),s=xe(s).filter(u=>u.signal||u.scale?(a.push(u),0):1),a.length>1&&(a=[xfe(a)]),s.length&&a.push(s.length>1?{merge:s}:s[0]),r!=null&&(o&&K("Signal encode and update are mutually exclusive."),o="encode(item(),"+ce(r)+")"),i.update=be(o)?po(o,t):o.expr!=null?po(o.expr,t):o.value!=null?o.value:o.signal!=null?{$expr:vfe,$params:{$value:t.signalRef(o.signal)}}:K("Invalid signal update specification."),e.force&&(i.options={force:!0}),a.forEach(u=>t.addUpdate(We(bfe(u,t),i)))}function bfe(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Mp(e,t)}}function xfe(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function _fe(e,t){const n=t.getSignal(e.name);let r=e.update;e.init&&(r?K("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=po(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(i=>yfe(i,t,n.id))}const Et=e=>(t,n,r)=>Cy(e,n,t||void 0,r),LI=Et("aggregate"),wfe=Et("axisticks"),II=Et("bound"),Ss=Et("collect"),cM=Et("compare"),Efe=Et("datajoin"),PI=Et("encode"),Afe=Et("expression"),Sfe=Et("facet"),kfe=Et("field"),Cfe=Et("key"),Ffe=Et("legendentries"),$fe=Et("load"),Dfe=Et("mark"),Mfe=Et("multiextent"),Rfe=Et("multivalues"),Tfe=Et("overlap"),Nfe=Et("params"),BI=Et("prefacet"),Ofe=Et("projection"),Lfe=Et("proxy"),Ife=Et("relay"),zI=Et("render"),Pfe=Et("scale"),gc=Et("sieve"),Bfe=Et("sortitems"),jI=Et("viewlayout"),zfe=Et("values");let jfe=0;const UI={min:"min",max:"max",count:"sum"};function Ufe(e,t){const n=e.type||"linear";CO(n)||K("Unrecognized scale type: "+ce(n)),t.addScale(e.name,{type:n,domain:void 0})}function qfe(e,t){const n=t.getScale(e.name).params;let r;n.domain=qI(e.domain,e,t),e.range!=null&&(n.range=HI(e,t,n)),e.interpolate!=null&&Qfe(e.interpolate,n),e.nice!=null&&(n.nice=Jfe(e.nice,t)),e.bins!=null&&(n.bins=Zfe(e.bins,t));for(r in e)_e(n,r)||r==="name"||(n[r]=ki(e[r],t))}function ki(e,t){return ve(e)?e.signal?t.signalRef(e.signal):K("Unsupported object: "+ce(e)):e}function bm(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>ki(n,t))}function $y(e){K("Can not find data set: "+ce(e))}function qI(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&K("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(Q(e)?Wfe:e.fields?Gfe:Hfe)(e,t,n)}function Wfe(e,t,n){return e.map(r=>ki(r,n))}function Hfe(e,t,n){const r=n.getData(e.data);return r||$y(e.data),jf(t.type)?r.valuesRef(n,e.field,WI(e.sort,!1)):DO(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function Gfe(e,t,n){const r=e.data,i=e.fields.reduce((s,o)=>(o=be(o)?{data:r,field:o}:Q(o)||o.signal?Yfe(o,n):o,s.push(o),s),[]);return(jf(t.type)?Vfe:DO(t.type)?Xfe:Kfe)(e,n,i)}function Yfe(e,t){const n="_:vega:_"+jfe++,r=Ss({});if(Q(e))r.value={$ingest:e};else if(e.signal){const i="setdata("+ce(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,gc({})]),{data:n,field:"data"}}function Vfe(e,t,n){const r=WI(e.sort,!0);let i,s;const o=n.map(l=>{const c=t.getData(l.data);return c||$y(l.data),c.countsRef(t,l.field,r)}),a={groupby:Tw,pulse:o};r&&(i=r.op||"count",s=r.field?Fy(i,r.field):"count",a.ops=[UI[i]],a.fields=[t.fieldRef(s)],a.as=[s]),i=t.add(LI(a));const u=t.add(Ss({pulse:Te(i)}));return s=t.add(zfe({field:Tw,sort:t.sortRef(r),pulse:Te(u)})),Te(s)}function WI(e,t){return e&&(!e.field&&!e.op?ve(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?K("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!UI[e.op]&&K("Multiple domain scales can not be sorted using "+e.op)),e}function Xfe(e,t,n){const r=n.map(i=>{const s=t.getData(i.data);return s||$y(i.data),s.domainRef(t,i.field)});return Te(t.add(Rfe({values:r})))}function Kfe(e,t,n){const r=n.map(i=>{const s=t.getData(i.data);return s||$y(i.data),s.extentRef(t,i.field)});return Te(t.add(Mfe({extents:r})))}function Zfe(e,t){return e.signal||Q(e)?bm(e,t):t.objectProperty(e)}function Jfe(e,t){return e.signal?t.signalRef(e.signal):ve(e)?{interval:ki(e.interval),step:ki(e.step)}:ki(e)}function Qfe(e,t){t.interpolate=ki(e.type||e),e.gamma!=null&&(t.interpolateGamma=ki(e.gamma))}function HI(e,t,n){const r=t.config.range;let i=e.range;if(i.signal)return t.signalRef(i.signal);if(be(i)){if(r&&_e(r,i))return e=We({},e,{range:r[i]}),HI(e,t,n);i==="width"?i=[0,{signal:"width"}]:i==="height"?i=jf(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:K("Unrecognized scale range value: "+ce(i))}else if(i.scheme){n.scheme=Q(i.scheme)?bm(i.scheme,t):ki(i.scheme,t),i.extent&&(n.schemeExtent=bm(i.extent,t)),i.count&&(n.schemeCount=ki(i.count,t));return}else if(i.step){n.rangeStep=ki(i.step,t);return}else{if(jf(e.type)&&!Q(i))return qI(i,e,t);Q(i)||K("Unsupported range type: "+ce(i))}return i.map(s=>(Q(s)?bm:ki)(s,t))}function ede(e,t){const n=t.config.projection||{},r={};for(const i in e)i!=="name"&&(r[i]=Ow(e[i],i,t));for(const i in n)r[i]==null&&(r[i]=Ow(n[i],i,t));t.addProjection(e.name,r)}function Ow(e,t,n){return Q(e)?e.map(r=>Ow(r,t,n)):ve(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:K("Unsupported parameter object: "+ce(e)):e}const ks="top",Md="left",Rd="right",gu="bottom",GI="center",tde="vertical",nde="start",rde="middle",ide="end",Lw="index",wC="label",sde="offset",Kf="perc",ode="perc2",Mi="value",Dg="guide-label",EC="guide-title",ade="group-title",ude="group-subtitle",fM="symbol",xm="gradient",Iw="discrete",Pw="size",lde="shape",cde="fill",fde="stroke",dde="strokeWidth",hde="strokeDash",pde="opacity",AC=[Pw,lde,cde,fde,dde,hde,pde],Mg={name:1,style:1,interactive:1},rt={value:0},Ri={value:1},Dy="group",YI="rect",SC="rule",gde="symbol",mc="text";function Rp(e){return e.type=Dy,e.interactive=e.interactive||!1,e}function Yr(e,t){const n=(r,i)=>es(e[r],es(t[r],i));return n.isVertical=r=>tde===es(e.direction,t.direction||(r?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>es(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>es(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>es(e.columns,es(t.columns,+n.isVertical(!0))),n}function VI(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function mde(e,t,n){const r=t.config.style[n];return r&&r[e]}function My(e,t,n){return`item.anchor === '${nde}' ? ${e} : item.anchor === '${ide}' ? ${t} : ${n}`}const kC=My(ce(Md),ce(Rd),ce(GI));function vde(e){const t=e("tickBand");let n=e("tickOffset"),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},ve(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t==="extent"?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e("bandPosition"),i=e("tickExtra")),{extra:i,band:r,offset:n}}function XI(e,t){return t?e?ve(e)?Object.assign({},e,{offset:XI(e.offset,t)}):{value:e,offset:t}:t:e}function di(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=Dd(e.encode,t,Mg)):e.interactive=!1,e}function yde(e,t,n,r){const i=Yr(e,n),s=i.isVertical(),o=i.gradientThickness(),a=i.gradientLength();let u,l,c,f,d;s?(l=[0,1],c=[0,0],f=o,d=a):(l=[0,0],c=[1,0],f=a,d=o);const h={enter:u={opacity:rt,x:rt,y:rt,width:yn(f),height:yn(d)},update:We({},u,{opacity:Ri,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:rt}};return zn(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),di({type:YI,role:Hce,encode:h},r)}function bde(e,t,n,r,i){const s=Yr(e,n),o=s.isVertical(),a=s.gradientThickness(),u=s.gradientLength();let l,c,f,d,h="";o?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:rt,fill:{scale:t,field:Mi}};p[l]={signal:h+"datum."+Kf,mult:u},p[c]=rt,p[f]={signal:h+"datum."+ode,mult:u},p[d]=yn(a);const g={enter:p,update:We({},p,{opacity:Ri}),exit:{opacity:rt}};return zn(g,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),di({type:YI,role:qce,key:Mi,from:i,encode:g},r)}const xde=`datum.${Kf}<=0?"${Md}":datum.${Kf}>=1?"${Rd}":"${GI}"`,_de=`datum.${Kf}<=0?"${gu}":datum.${Kf}>=1?"${ks}":"${rde}"`;function dM(e,t,n,r){const i=Yr(e,t),s=i.isVertical(),o=yn(i.gradientThickness()),a=i.gradientLength();let u=i("labelOverlap"),l,c,f,d,h="";const p={enter:l={opacity:rt},update:c={opacity:Ri,text:{field:wC}},exit:{opacity:rt}};return zn(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:es(e.labelLimit,t.gradientLabelLimit)}),s?(l.align={value:"left"},l.baseline=c.baseline={signal:_de},f="y",d="x",h="1-"):(l.align=c.align={signal:xde},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:h+"datum."+Kf,mult:a},l[d]=c[d]=o,o.offset=es(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:i("labelSeparation"),method:u,order:"datum."+Lw}:void 0,di({type:mc,role:DI,style:Dg,key:Mi,from:r,encode:p,overlap:u},n)}function wde(e,t,n,r,i){const s=Yr(e,t),o=n.entries,a=!!(o&&o.interactive),u=o?o.name:void 0,l=s("clipHeight"),c=s("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.${sde} : datum.${Pw}`,h=l?yn(l):{field:Pw},p=`datum.${Lw}`,g=`max(1, ${i})`;let m,v,y,b,x;h.mult=.5,m={enter:v={opacity:rt,x:{signal:d,mult:.5,offset:c},y:h},update:y={opacity:Ri,x:v.x,y:v.y},exit:{opacity:rt}};let _=null,A=null;e.fill||(_=t.symbolBaseFillColor,A=t.symbolBaseStrokeColor),zn(m,{fill:s("symbolFillColor",_),shape:s("symbolType"),size:s("symbolSize"),stroke:s("symbolStrokeColor",A),strokeDash:s("symbolDash"),strokeDashOffset:s("symbolDashOffset"),strokeWidth:s("symbolStrokeWidth")},{opacity:s("symbolOpacity")}),AC.forEach(F=>{e[F]&&(y[F]=v[F]={scale:e[F],field:Mi})});const E=di({type:gde,role:Gce,key:Mi,from:f,clip:l?!0:void 0,encode:m},n.symbols),S=yn(c);S.offset=s("labelOffset"),m={enter:v={opacity:rt,x:{signal:d,offset:S},y:h},update:y={opacity:Ri,text:{field:wC},x:v.x,y:v.y},exit:{opacity:rt}},zn(m,{align:s("labelAlign"),baseline:s("labelBaseline"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontStyle:s("labelFontStyle"),fontWeight:s("labelFontWeight"),limit:s("labelLimit")});const k=di({type:mc,role:DI,style:Dg,key:Mi,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:rt,height:l?yn(l):rt,opacity:rt},exit:{opacity:rt},update:y={opacity:Ri,row:{signal:null},column:{signal:null}}},s.isVertical(!0)?(b=`ceil(item.mark.items.length / ${g})`,y.row.signal=`${p}%${b}`,y.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(y.row.signal=`floor(${p} / ${g})`,y.column.signal=`${p} % ${g}`,x={field:p}),y.column.signal=`(${i})?${y.column.signal}:${p}`,r={facet:{data:r,name:"value",groupby:Lw}},Rp({role:bC,from:r,encode:Dd(m,o,Mg),marks:[E,k],name:u,interactive:a,sort:x})}function Ede(e,t){const n=Yr(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const CC='item.orient === "left"',FC='item.orient === "right"',Ry=`(${CC} || ${FC})`,Ade=`datum.vgrad && ${Ry}`,Sde=My('"top"','"bottom"','"middle"'),kde=My('"right"','"left"','"center"'),Cde=`datum.vgrad && ${FC} ? (${kde}) : (${Ry} && !(datum.vgrad && ${CC})) ? "left" : ${kC}`,Fde=`item._anchor || (${Ry} ? "middle" : "start")`,$de=`${Ade} ? (${CC} ? -90 : 90) : 0`,Dde=`${Ry} ? (datum.vgrad ? (${FC} ? "bottom" : "top") : ${Sde}) : "top"`;function Mde(e,t,n,r){const i=Yr(e,t),s={enter:{opacity:rt},update:{opacity:Ri,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:rt}};return zn(s,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:Fde},angle:{signal:$de},align:{signal:Cde},baseline:{signal:Dde},text:e.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),di({type:mc,role:Yce,style:EC,from:r,encode:s},n)}function Rde(e,t){let n;return ve(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+hM(e.path)+")":e.sphere&&(n="geoShape("+hM(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function hM(e){return ve(e)&&e.signal?e.signal:ce(e)}function KI(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===Dy?bC:t||vC}function Tde(e){return{marktype:e.type,name:e.name||void 0,role:e.role||KI(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function Nde(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function $C(e,t){const n=$T(e.type);n||K("Unrecognized transform type: "+ce(e.type));const r=Cy(n.type.toLowerCase(),null,ZI(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function ZI(e,t,n){const r={},i=e.params.length;for(let s=0;spM(e,s,n)):pM(e,i,n)}function pM(e,t,n){const r=e.type;if(un(t))return mM(r)?K("Expression references can not be signals."):V2(r)?n.fieldRef(t):vM(r)?n.compareRef(t):n.signalRef(t.signal);{const i=e.expr||V2(r);return i&&Pde(t)?n.exprRef(t.expr,t.as):i&&Bde(t)?Dp(t.field,t.as):mM(r)?po(t,n):zde(r)?Te(n.getData(t).values):V2(r)?Dp(t):vM(r)?n.compareRef(t):t}}function Lde(e,t,n){return be(t.from)||K('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function Ide(e,t,n){const r=t[e.name];return e.array?(Q(r)||K("Expected an array of sub-parameters. Instead: "+ce(r)),r.map(i=>gM(e,i,n))):gM(e,r,n)}function gM(e,t,n){const r=e.params.length;let i;for(let o=0;oe&&e.expr,Bde=e=>e&&e.field,zde=e=>e==="data",mM=e=>e==="expr",V2=e=>e==="field",vM=e=>e==="compare";function jde(e,t,n){let r,i,s,o,a;return e?(r=e.facet)&&(t||K("Only group marks can be faceted."),r.field!=null?o=a=_m(r,n):(e.data?a=Te(n.getData(e.data).aggregate):(s=$C(We({type:"aggregate",groupby:xe(r.groupby)},r.aggregate),n),s.params.key=n.keyRef(r.groupby),s.params.pulse=_m(r,n),o=a=Te(n.add(s))),i=n.keyRef(r.groupby,!0))):o=Te(n.add(Ss(null,[{}]))),o||(o=_m(e,n)),{key:i,pulse:o,parent:a}}function _m(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Te(t.getData(e.data).output)}function Vl(e,t,n,r,i){this.scope=e,this.input=t,this.output=n,this.values=r,this.aggregate=i,this.index={}}Vl.fromEntries=function(e,t){const n=t.length,r=t[n-1],i=t[n-2];let s=t[0],o=null,a=1;for(s&&s.type==="load"&&(s=t[1]),e.add(t[0]);af??"null").join(",")+"),0)",c=po(l,t);u.update=c.$expr,u.params=c.$params}function Ty(e,t){const n=KI(e),r=e.type===Dy,i=e.from&&e.from.facet,s=e.overlap;let o=e.layout||n===bC||n===yC,a,u,l,c,f,d,h;const p=n===vC||o||i,g=jde(e.from,r,t);u=t.add(Efe({key:g.key||(e.key?Dp(e.key):void 0),pulse:g.pulse,clean:!r}));const m=Te(u);u=l=t.add(Ss({pulse:m})),u=t.add(Dfe({markdef:Tde(e),interactive:Nde(e.interactive,t),clip:Rde(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Te(u)}));const v=Te(u);u=c=t.add(PI(NI(e.encode,e.type,n,e.style,t,{mod:!1,pulse:v}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach(A=>{const E=$C(A,t),S=E.metadata;(S.generates||S.changes)&&K("Mark transforms should not generate new data."),S.nomod||(c.params.mod=!0),E.params.pulse=Te(u),t.add(u=E)}),e.sort&&(u=t.add(Bfe({sort:t.compareRef(e.sort),pulse:Te(u)})));const y=Te(u);(i||o)&&(o=t.add(jI({layout:t.objectProperty(e.layout),legends:t.legends,mark:v,pulse:y})),d=Te(o));const b=t.add(II({mark:v,pulse:d||y}));h=Te(b),r&&(p&&(a=t.operators,a.pop(),o&&a.pop()),t.pushState(y,d||h,m),i?Ude(e,t,g):p?qde(e,t,g):t.parse(e),t.popState(),p&&(o&&a.push(o),a.push(b))),s&&(h=Wde(s,h,t));const x=t.add(zI({pulse:h})),_=t.add(gc({pulse:Te(x)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new Vl(t,l,x,_)),e.on&&e.on.forEach(A=>{(A.insert||A.remove||A.toggle)&&K("Marks only support modify triggers."),QI(A,t,f)}))}function Wde(e,t,n){const r=e.method,i=e.bound,s=e.separation,o={separation:un(s)?n.signalRef(s.signal):s,method:un(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),i){const a=i.tolerance;o.boundTolerance=un(a)?n.signalRef(a.signal):+a,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return Te(n.add(Tfe(o)))}function Hde(e,t){const n=t.config.legend,r=e.encode||{},i=Yr(e,n),s=r.legend||{},o=s.name||void 0,a=s.interactive,u=s.style,l={};let c=0,f,d,h;AC.forEach(b=>e[b]?(l[b]=e[b],c=c||e[b]):0),c||K("Missing valid scale for legend.");const p=Gde(e,t.scaleType(c)),g={title:e.title!=null,scales:l,type:p,vgrad:p!=="symbol"&&i.isVertical()},m=Te(t.add(Ss(null,[g]))),v={enter:{x:{value:0},y:{value:0}}},y=Te(t.add(Ffe(d={type:p,scale:t.scaleRef(c),count:t.objectProperty(i("tickCount")),limit:t.property(i("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return p===xm?(h=[yde(e,c,n,r.gradient),dM(e,n,r.labels,y)],d.count=d.count||t.signalRef(`max(2,2*floor((${El(i.gradientLength())})/100))`)):p===Iw?h=[bde(e,c,n,r.gradient,y),dM(e,n,r.labels,y)]:(f=Ede(e,n),h=[wde(e,n,r,y,El(f.columns))],d.size=Xde(e,t,h[0].marks)),h=[Rp({role:Wce,from:m,encode:v,marks:h,layout:f,interactive:a})],g.title&&h.push(Mde(e,n,r.title,m)),Ty(Rp({role:Uce,from:m,encode:Dd(Vde(i,e,n),s,Mg),marks:h,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:o,interactive:a,style:u}),t)}function Gde(e,t){let n=e.type||fM;return!e.type&&Yde(e)===1&&(e.fill||e.stroke)&&(n=DS(t)?xm:$_(t)?Iw:fM),n!==xm?n:$_(t)?Iw:xm}function Yde(e){return AC.reduce((t,n)=>t+(e[n]?1:0),0)}function Vde(e,t,n){const r={enter:{},update:{}};return zn(r,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),r}function Xde(e,t,n){const r=El(bM("size",e,n)),i=El(bM("strokeWidth",e,n)),s=El(Kde(n[1].encode,t,Dg));return po(`max(ceil(sqrt(${r})+${i}),${s})`,t)}function bM(e,t,n){return t[e]?`scale("${t[e]}",datum)`:VI(e,n[0].encode)}function Kde(e,t,n){return VI("fontSize",e)||mde("fontSize",t,n)}const Zde=`item.orient==="${Md}"?-90:item.orient==="${Rd}"?90:0`;function Jde(e,t){e=be(e)?{text:e}:e;const n=Yr(e,t.config.title),r=e.encode||{},i=r.group||{},s=i.name||void 0,o=i.interactive,a=i.style,u=[],l={},c=Te(t.add(Ss(null,[l])));return u.push(the(e,n,Qde(e),c)),e.subtitle&&u.push(nhe(e,n,r.subtitle,c)),Ty(Rp({role:Vce,from:c,encode:ehe(n,i),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:s,interactive:o,style:a}),t)}function Qde(e){const t=e.encode;return t&&t.title||We({name:e.name,interactive:e.interactive,style:e.style},t)}function ehe(e,t){const n={enter:{},update:{}};return zn(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:kC},angle:{signal:Zde},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),Dd(n,t,Mg)}function the(e,t,n,r){const i={value:0},s=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return zn(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),di({type:mc,role:Xce,style:ade,from:r,encode:o},n)}function nhe(e,t,n,r){const i={value:0},s=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return zn(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),di({type:mc,role:Kce,style:ude,from:r,encode:o},n)}function rhe(e,t){const n=[];e.transform&&e.transform.forEach(r=>{n.push($C(r,t))}),e.on&&e.on.forEach(r=>{QI(r,t,e.name)}),t.addDataPipeline(e.name,ihe(e,t,n))}function ihe(e,t,n){const r=[];let i=null,s=!1,o=!1,a,u,l,c,f;for(e.values?un(e.values)||ym(e.format)?(r.push(xM(t,e)),r.push(i=Uu())):r.push(i=Uu({$ingest:e.values,$format:e.format})):e.url?ym(e.url)||ym(e.format)?(r.push(xM(t,e)),r.push(i=Uu())):r.push(i=Uu({$request:e.url,$format:e.format})):e.source&&(i=a=xe(e.source).map(d=>Te(t.getData(d).output)),r.push(null)),u=0,l=n.length;ue===gu||e===ks,Ny=(e,t,n)=>un(e)?uhe(e.signal,t,n):e===Md||e===ks?t:n,bn=(e,t,n)=>un(e)?ohe(e.signal,t,n):eP(e)?t:n,hs=(e,t,n)=>un(e)?ahe(e.signal,t,n):eP(e)?n:t,tP=(e,t,n)=>un(e)?lhe(e.signal,t,n):e===ks?{value:t}:{value:n},she=(e,t,n)=>un(e)?che(e.signal,t,n):e===Rd?{value:t}:{value:n},ohe=(e,t,n)=>nP(`${e} === '${ks}' || ${e} === '${gu}'`,t,n),ahe=(e,t,n)=>nP(`${e} !== '${ks}' && ${e} !== '${gu}'`,t,n),uhe=(e,t,n)=>DC(`${e} === '${Md}' || ${e} === '${ks}'`,t,n),lhe=(e,t,n)=>DC(`${e} === '${ks}'`,t,n),che=(e,t,n)=>DC(`${e} === '${Rd}'`,t,n),nP=(e,t,n)=>(t=t!=null?yn(t):t,n=n!=null?yn(n):n,_M(t)&&_M(n)?(t=t?t.signal||ce(t.value):null,n=n?n.signal||ce(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[We({test:e},t)].concat(n||[])),_M=e=>e==null||Object.keys(e).length===1,DC=(e,t,n)=>({signal:`${e} ? (${tf(t)}) : (${tf(n)})`}),fhe=(e,t,n,r,i)=>({signal:(r!=null?`${e} === '${Md}' ? (${tf(r)}) : `:"")+(n!=null?`${e} === '${gu}' ? (${tf(n)}) : `:"")+(i!=null?`${e} === '${Rd}' ? (${tf(i)}) : `:"")+(t!=null?`${e} === '${ks}' ? (${tf(t)}) : `:"")+"(null)"}),tf=e=>un(e)?e.signal:e==null?null:ce(e),dhe=(e,t)=>t===0?0:un(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},lf=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Bc(e,t,n,r){let i;if(t&&_e(t,e))return t[e];if(_e(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=e[5].toLowerCase()+e.slice(6)}return r[EC][i]}else if(e.startsWith("label")){switch(e){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=e[5].toLowerCase()+e.slice(6)}return r[Dg][i]}return null}function wM(e){const t={};for(const n of e)if(n)for(const r in n)t[r]=1;return Object.keys(t)}function hhe(e,t){var n=t.config,r=n.style,i=n.axis,s=t.scaleType(e.scale)==="band"&&n.axisBand,o=e.orient,a,u,l;if(un(o)){const f=wM([n.axisX,n.axisY]),d=wM([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);a={};for(l of f)a[l]=bn(o,Bc(l,n.axisX,i,r),Bc(l,n.axisY,i,r));u={};for(l of d)u[l]=fhe(o.signal,Bc(l,n.axisTop,i,r),Bc(l,n.axisBottom,i,r),Bc(l,n.axisLeft,i,r),Bc(l,n.axisRight,i,r))}else a=o===ks||o===gu?n.axisX:n.axisY,u=n["axis"+o[0].toUpperCase()+o.slice(1)];return a||u||s?We({},i,a,u,s):i}function phe(e,t,n,r){const i=Yr(e,t),s=e.orient;let o,a;const u={enter:o={opacity:rt},update:a={opacity:Ri},exit:{opacity:rt}};zn(u,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=EM(e,0),c=EM(e,1);return o.x=a.x=bn(s,l,rt),o.x2=a.x2=bn(s,c),o.y=a.y=hs(s,l,rt),o.y2=a.y2=hs(s,c),di({type:SC,role:Ice,from:r,encode:u},n)}function EM(e,t){return{scale:e.scale,range:t}}function ghe(e,t,n,r,i){const s=Yr(e,t),o=e.orient,a=e.gridScale,u=Ny(o,1,-1),l=mhe(e.offset,u);let c,f,d;const h={enter:c={opacity:rt},update:d={opacity:Ri},exit:f={opacity:rt}};zn(h,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const p={scale:e.scale,field:Mi,band:i.band,extra:i.extra,offset:i.offset,round:s("tickRound")},g=bn(o,{signal:"height"},{signal:"width"}),m=a?{scale:a,range:0,mult:u,offset:l}:{value:0,offset:l},v=a?{scale:a,range:1,mult:u,offset:l}:We(g,{mult:u,offset:l});return c.x=d.x=bn(o,p,m),c.y=d.y=hs(o,p,m),c.x2=d.x2=hs(o,v),c.y2=d.y2=bn(o,v),f.x=bn(o,p),f.y=hs(o,p),di({type:SC,role:Pce,key:Mi,from:r,encode:h},n)}function mhe(e,t){if(t!==1)if(!ve(e))e=un(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=We({},e);for(;n.mult!=null;)if(ve(n.mult))n=n.mult=We({},n.mult);else return n.mult=un(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function vhe(e,t,n,r,i,s){const o=Yr(e,t),a=e.orient,u=Ny(a,-1,1);let l,c,f;const d={enter:l={opacity:rt},update:f={opacity:Ri},exit:c={opacity:rt}};zn(d,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const h=yn(i);h.mult=u;const p={scale:e.scale,field:Mi,band:s.band,extra:s.extra,offset:s.offset,round:o("tickRound")};return f.y=l.y=bn(a,rt,p),f.y2=l.y2=bn(a,h),c.x=bn(a,p),f.x=l.x=hs(a,rt,p),f.x2=l.x2=hs(a,h),c.y=hs(a,p),di({type:SC,role:zce,key:Mi,from:r,encode:d},n)}function X2(e,t,n,r,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+r+","+i+")"}}function yhe(e,t,n,r,i,s){const o=Yr(e,t),a=e.orient,u=e.scale,l=Ny(a,-1,1),c=El(o("labelFlush")),f=El(o("labelFlushOffset")),d=o("labelAlign"),h=o("labelBaseline");let p=c===0||!!c,g;const m=yn(i);m.mult=l,m.offset=yn(o("labelPadding")||0),m.offset.mult=l;const v={scale:u,field:Mi,band:.5,offset:XI(s.offset,o("labelOffset"))},y=bn(a,p?X2(u,c,'"left"','"right"','"center"'):{value:"center"},she(a,"left","right")),b=bn(a,tP(a,"bottom","top"),p?X2(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=X2(u,c,`-(${f})`,f,0);p=p&&f;const _={opacity:rt,x:bn(a,v,m),y:hs(a,v,m)},A={enter:_,update:g={opacity:Ri,text:{field:wC},x:_.x,y:_.y,align:y,baseline:b},exit:{opacity:rt,x:_.x,y:_.y}};zn(A,{dx:!d&&p?bn(a,x):null,dy:!h&&p?hs(a,x):null}),zn(A,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:d,baseline:h});const E=o("labelBound");let S=o("labelOverlap");return S=S||E?{separation:o("labelSeparation"),method:S,order:"datum.index",bound:E?{scale:u,orient:a,tolerance:E}:null}:void 0,g.align!==y&&(g.align=lf(g.align,y)),g.baseline!==b&&(g.baseline=lf(g.baseline,b)),di({type:mc,role:Bce,style:Dg,key:Mi,from:r,encode:A,overlap:S},n)}function bhe(e,t,n,r){const i=Yr(e,t),s=e.orient,o=Ny(s,-1,1);let a,u;const l={enter:a={opacity:rt,anchor:yn(i("titleAnchor",null)),align:{signal:kC}},update:u=We({},a,{opacity:Ri,text:yn(e.title)}),exit:{opacity:rt}},c={signal:`lerp(range("${e.scale}"), ${My(0,1,.5)})`};return u.x=bn(s,c),u.y=hs(s,c),a.angle=bn(s,rt,dhe(o,90)),a.baseline=bn(s,tP(s,gu,ks),{value:gu}),u.angle=a.angle,u.baseline=a.baseline,zn(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),xhe(i,s,l,n),l.update.align=lf(l.update.align,a.align),l.update.angle=lf(l.update.angle,a.angle),l.update.baseline=lf(l.update.baseline,a.baseline),di({type:mc,role:jce,style:EC,from:r,encode:l},n)}function xhe(e,t,n,r){const i=(a,u)=>a!=null?(n.update[u]=lf(yn(a),n.update[u]),!1):!Yc(u,r),s=i(e("titleX"),"x"),o=i(e("titleY"),"y");n.enter.auto=o===s?yn(o):bn(t,yn(o),yn(s))}function _he(e,t){const n=hhe(e,t),r=e.encode||{},i=r.axis||{},s=i.name||void 0,o=i.interactive,a=i.style,u=Yr(e,n),l=vde(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=Te(t.add(Ss({},[c]))),d=Te(t.add(wfe({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(ghe(e,n,r.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(vhe(e,n,r.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(yhe(e,n,r.labels,d,p,l))),c.domain&&h.push(phe(e,n,r.domain,f)),c.title&&h.push(bhe(e,n,r.title,f)),Ty(Rp({role:Lce,from:f,encode:Dd(whe(u,e),i,Mg),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:o,style:a}),t)}function whe(e,t){const n={enter:{},update:{}};return zn(n,{orient:e("orient"),offset:e("offset")||0,position:es(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function rP(e,t,n){const r=xe(e.signals),i=xe(e.scales);return n||r.forEach(s=>OI(s,t)),xe(e.projections).forEach(s=>ede(s,t)),i.forEach(s=>Ufe(s,t)),xe(e.data).forEach(s=>rhe(s,t)),i.forEach(s=>qfe(s,t)),(n||r).forEach(s=>_fe(s,t)),xe(e.axes).forEach(s=>_he(s,t)),xe(e.marks).forEach(s=>Ty(s,t)),xe(e.legends).forEach(s=>Hde(s,t)),e.title&&Jde(e.title,t),t.parseLambdas(),t}const Ehe=e=>Dd({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function Ahe(e,t){const n=t.config,r=Te(t.root=t.add(G1())),i=She(e,n);i.forEach(l=>OI(l,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const s=t.add(Ss()),o=t.add(PI(NI(Ehe(e.encode),Dy,yC,e.style,t,{pulse:Te(s)}))),a=t.add(jI({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:r,pulse:Te(o)}));t.operators.pop(),t.pushState(Te(o),Te(a),null),rP(e,t,i),t.operators.push(a);let u=t.add(II({mark:r,pulse:Te(a)}));return u=t.add(zI({pulse:Te(u)})),u=t.add(gc({pulse:Te(u)})),t.addData("root",new Vl(t,s,s,u)),t}function ch(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function She(e,t){const n=o=>es(e[o],t[o]),r=[ch("background",n("background")),ch("autosize",Tce(n("autosize"))),ch("padding",Oce(n("padding"))),ch("width",n("width")||0),ch("height",n("height")||0)],i=r.reduce((o,a)=>(o[a.name]=a,o),{}),s={};return xe(e.signals).forEach(o=>{_e(i,o.name)?o=We(i[o.name],o):r.push(o),s[o.name]=o}),xe(t.signals).forEach(o=>{!_e(s,o.name)&&!_e(i,o.name)&&r.push(o)}),r}function iP(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function AM(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}iP.prototype=AM.prototype={parse(e){return rP(e,this)},fork(){return new AM(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof Rw?Te(e):e;return this.add(Lfe({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(r,i,s){let o,a;r&&(o=r.data||(r.data={}),a=o[i]||(o[i]=[]),a.push(s))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const r in t.index)n(t.index[r],e,"index:"+r)}return this},pushState(e,t,n){this._encode.push(Te(this.add(gc({pulse:e})))),this._parent.push(t),this._lookup.push(n?Te(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return nt(this._parent)},encode(){return nt(this._encode)},lookup(){return nt(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(be(e))return Dp(e,t);e.signal||K("Unsupported field reference: "+ce(e));const n=e.signal;let r=this.field[n];if(!r){const i={name:this.signalRef(n)};t&&(i.as=t),this.field[n]=r=Te(this.add(kfe(i)))}return r},compareRef(e){let t=!1;const n=s=>un(s)?(t=!0,this.signalRef(s.signal)):ffe(s)?(t=!0,this.exprRef(s.expr)):s,r=xe(e.field).map(n),i=xe(e.order).map(n);return t?Te(this.add(cM({fields:r,orders:i}))):uM(r,i)},keyRef(e,t){let n=!1;const r=s=>un(s)?(n=!0,Te(i[s.signal])):s,i=this.signals;return e=xe(e).map(r),n?Te(this.add(Cfe({fields:e,flat:t}))):afe(e,t)},sortRef(e){if(!e)return e;const t=Fy(e.op,e.field),n=e.order||ufe;return n.signal?Te(this.add(cM({fields:t,orders:this.signalRef(n.signal)}))):uM(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return _e(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&K("Duplicate signal name: "+ce(e));const n=t instanceof Rw?t:this.add(G1(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||K("Unrecognized signal name: "+ce(e)),this.signals[e]},signalRef(e){return this.signals[e]?Te(this.signals[e]):(_e(this.lambdas,e)||(this.lambdas[e]=this.add(G1(null))),Te(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t0?",":"")+(ve(i)?i.signal||MC(i):ce(i))}return n+"]"}function Che(e){let t="{",n=0,r,i;for(r in e)i=e[r],t+=(++n>1?",":"")+ce(r)+":"+(ve(i)?i.signal||MC(i):ce(i));return t+"}"}function Fhe(){const e="sans-serif",r="#4c78a8",i="#000",s="#888",o="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:r},area:{fill:r},image:null,line:{stroke:r,strokeWidth:2},path:{stroke:r},rect:{fill:r},rule:{stroke:i},shape:{stroke:r},symbol:{fill:r,size:64},text:{fill:i,font:e,fontSize:11},trail:{fill:r,size:2},style:{"guide-label":{fill:i,font:e,fontSize:10},"guide-title":{fill:i,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:i,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:i,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:o},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:s,grid:!1,gridWidth:1,gridColor:o,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:s,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:o,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:s,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function $he(e,t,n){return ve(e)||K("Input Vega specification must be an object."),t=md(Fhe(),t,e.config),Ahe(e,new iP(t,n)).toRuntime()}var Dhe="5.33.1";We(Lf,bX,Xee,Cte,dre,oie,Tse,dse,Ose,soe,goe,woe);const Mhe=Object.freeze(Object.defineProperty({__proto__:null,Bounds:en,CanvasHandler:_g,CanvasRenderer:o1,DATE:jr,DAY:Vn,DAYOFYEAR:fo,Dataflow:sf,Debug:Q8,DisallowedObjectProperties:UE,Error:qE,EventStream:Nv,Gradient:HO,GroupItem:ry,HOURS:li,Handler:tk,HybridHandler:L7,HybridRenderer:z_,Info:J8,Item:ny,MILLISECONDS:ys,MINUTES:ci,MONTH:Jn,Marks:fi,MultiPulse:gA,None:Z8,Operator:kt,Parameters:Tv,Pulse:tu,QUARTER:zr,RenderType:qa,Renderer:xg,ResourceLoader:JO,SECONDS:Li,SVGHandler:E7,SVGRenderer:ak,SVGStringRenderer:O7,Scenegraph:g7,TIME_UNITS:sA,Transform:G,View:wI,WEEK:on,Warn:WE,YEAR:In,accessor:Gr,accessorFields:Zn,accessorName:Wt,array:xe,ascending:yd,bandwidthNRD:bA,bin:RT,bootstrapCI:TT,boundClip:G7,boundContext:mg,boundItem:O_,boundMark:f7,boundStroke:pa,changeset:fc,clampRange:cR,codegenExpression:XL,compare:XE,constant:ir,cumulativeLogNormal:SA,cumulativeNormal:Lv,cumulativeUniform:$A,dayofyear:BR,debounce:KE,defaultLocale:cA,definition:$T,densityLogNormal:AA,densityNormal:xA,densityUniform:FA,domChild:sn,domClear:_i,domCreate:ja,domFind:ek,dotbin:NT,error:K,expressionFunction:Jt,extend:We,extent:uo,extentIndex:fR,falsy:Fa,fastmap:bd,field:Ni,flush:dR,font:uy,fontFamily:bg,fontSize:wo,format:J0,formatLocale:Pm,formats:hA,hasOwnProperty:_e,id:tg,identity:rr,inferType:yT,inferTypes:bT,ingest:ht,inherits:pe,inrange:Kc,interpolate:MS,interpolateColors:ey,interpolateRange:MO,intersect:U7,intersectBoxLine:Zc,intersectPath:BS,intersectPoint:zS,intersectRule:e7,isArray:Q,isBoolean:Au,isDate:Qa,isFunction:He,isIterable:hR,isNumber:ut,isObject:ve,isRegExp:ZE,isString:be,isTuple:Mv,key:JE,lerp:pR,lineHeight:du,loader:$v,locale:mT,logger:HE,lruCache:gR,markup:ok,merge:mR,mergeConfig:md,multiLineOffset:ZS,one:gd,pad:vR,panLinear:iR,panLog:sR,panPow:oR,panSymlog:aR,parse:$he,parseExpression:GL,parseSelector:Du,path:jv,pathCurves:LS,pathEqual:Y7,pathParse:Uf,pathRectangle:VO,pathRender:yp,pathSymbols:YO,pathTrail:XO,peek:nt,point:cy,projection:kk,quantileLogNormal:kA,quantileNormal:Iv,quantileUniform:DA,quantiles:vA,quantizeInterpolator:RO,quarter:uR,quartiles:yA,get random(){return Ii},randomInteger:EV,randomKDE:wA,randomLCG:wV,randomLogNormal:LT,randomMixture:IT,randomNormal:_A,randomUniform:PT,read:wT,regressionConstant:MA,regressionExp:zT,regressionLinear:RA,regressionLoess:qT,regressionLog:BT,regressionPoly:UT,regressionPow:jT,regressionQuad:TA,renderModule:fy,repeat:yh,resetDefaultLocale:bY,resetSVGClipId:ZO,resetSVGDefIds:hee,responseType:_T,runtimeContext:lI,sampleCurve:Bv,sampleLogNormal:EA,sampleNormal:Ov,sampleUniform:CA,scale:ct,sceneEqual:uk,sceneFromJSON:h7,scenePickVisit:Jm,sceneToJSON:d7,sceneVisit:bs,sceneZOrder:jS,scheme:RS,serializeXML:M7,setHybridRendererOptions:lee,setRandom:xV,span:ng,splitAccessPath:bo,stringValue:ce,textMetrics:oi,timeBin:nT,timeFloor:GR,timeFormatLocale:dp,timeInterval:Ed,timeOffset:XR,timeSequence:JR,timeUnitSpecifier:PR,timeUnits:oA,toBoolean:QE,toDate:eA,toNumber:Xn,toSet:vs,toString:tA,transform:DT,transforms:Lf,truncate:yR,truthy:Oi,tupleid:Ne,typeParsers:v_,utcFloor:YR,utcInterval:Ad,utcOffset:KR,utcSequence:QR,utcdayofyear:UR,utcquarter:lR,utcweek:qR,version:Dhe,visitArray:Ma,week:zR,writeConfig:vd,zero:La,zoomLinear:GE,zoomLog:YE,zoomPow:Mm,zoomSymlog:VE},Symbol.toStringTag,{value:"Module"}));function Rhe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var The={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Nhe={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},Ohe={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const Lhe=Array.prototype.slice,qu=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,Lhe.call(t,1))},Ihe=(e,t,n,r,i,s,o)=>new Date(e,t||0,n??1,r||0,i||0,s||0,o||0);var Phe={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:Ihe,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return qu("join",arguments)},indexof:function(){return qu("indexOf",arguments)},lastindexof:function(){return qu("lastIndexOf",arguments)},slice:function(){return qu("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(yd),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return qu("substring",arguments,String)},split:function(){return qu("split",arguments,String)},replace:function(){return qu("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Bhe=["view","item","group","xy","x","y"],Bw=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&Bw.add(setImmediate);const zhe={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:The[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),Bw.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),r==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||Phe[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Nhe[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>Ohe[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,r)=>{e.memberDepth+=1;const i=e(r.key);e.memberDepth-=1;const s=e(r.value);return UE.has(i)?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):Bw.has(s)?console.error(`Prevented interpretation of method "${s}" which could lead to insecure code execution`):n[i]=s,n},{})};function fh(e,t,n,r,i,s){const o=a=>zhe[a.type](o,a);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=r,o.event=i,o.item=s,Bhe.forEach(a=>o.fn[a]=function(){return i.vega[a](...arguments)}),o(e)}var jhe={operator(e,t){const n=t.ast,r=e.functions;return i=>fh(n,r,i)},parameter(e,t){const n=t.ast,r=e.functions;return(i,s)=>fh(n,r,s,i)},event(e,t){const n=t.ast,r=e.functions;return i=>fh(n,r,void 0,void 0,i)},handler(e,t){const n=t.ast,r=e.functions;return(i,s)=>{const o=s.item&&s.item.datum;return fh(n,r,i,o,s)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,s=n==="group"||n==="image"||n==="rect";return(o,a)=>{const u=o.datum;let l=0,c;for(const f in r)c=fh(r[f].ast,i,a,u,void 0,o),o[f]!==c&&(o[f]=c,l=1);return n!=="rule"&&Rhe(o,r,s),l}}};const Uhe="5.23.0",qhe={version:Uhe};function RC(e){return ie(e,"or")}function TC(e){return ie(e,"and")}function NC(e){return ie(e,"not")}function wm(e,t){if(NC(e))wm(e.not,t);else if(TC(e))for(const n of e.and)wm(n,t);else if(RC(e))for(const n of e.or)wm(n,t);else t(e)}function cf(e,t){return NC(e)?{not:cf(e.not,t)}:TC(e)?{and:e.and.map(n=>cf(n,t))}:RC(e)?{or:e.or.map(n=>cf(n,t))}:t(e)}const ze=structuredClone;function sP(e){throw new Error(e)}function Zf(e,t){const n={};for(const r of t)_e(e,r)&&(n[r]=e[r]);return n}function Pr(e,t){const n={...e};for(const r of t)delete n[r];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>wt(e)).join(",")})`};function et(e){if(ut(e))return e;const t=be(e)?e:wt(e);if(t.length<250)return t;let n=0;for(let r=0;ra===0?o:`[${o}]`),s=i.map((o,a)=>i.slice(0,a+1).join(""));for(const o of s)t.add(o)}return t}function IC(e,t){return e===void 0||t===void 0?!0:LC(jw(e),jw(t))}function _t(e){return re(e).length===0}const re=Object.keys,Pn=Object.values,mu=Object.entries;function Tp(e){return e===!0||e===!1}function Ot(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function ip(e,t){return NC(e)?`!(${ip(e.not,t)})`:TC(e)?`(${e.and.map(n=>ip(n,t)).join(") && (")})`:RC(e)?`(${e.or.map(n=>ip(n,t)).join(") || (")})`:t(e)}function Y1(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&Y1(e[n],t)&&delete e[n],_t(e)}function Rg(e){return e.charAt(0).toUpperCase()+e.substr(1)}function PC(e,t="datum"){const n=bo(e),r=[];for(let i=1;i<=n.length;i++){const s=`[${n.slice(0,i).map(ce).join("][")}]`;r.push(`${t}${s}`)}return r.join(" && ")}function uP(e,t="datum"){return`${t}[${ce(bo(e).join("."))}]`}function mt(e){return`datum['${e.replaceAll("'","\\'")}']`}function Ghe(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function Bi(e){return`${bo(e).map(Ghe).join("\\.")}`}function Xl(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function Td(e){return`${bo(e).join(".")}`}function Qf(e){return e?bo(e).length:0}function Kt(...e){return e.find(t=>t!==void 0)}let lP=42;function cP(e){const t=++lP;return e?String(e)+t:t}function Yhe(){lP=42}function fP(e){return dP(e)?e:`__${e}`}function dP(e){return e.startsWith("__")}function Np(e){if(e!==void 0)return(e%360+360)%360}function Oy(e){return ut(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const SM=Object.getPrototypeOf(structuredClone({}));function ri(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ri(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;for(const s of e.entries())if(!ri(s[1],t.get(s[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==SM.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==SM.toString)return e.toString()===t.toString();const i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!ri(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function wt(e){const t=[];return(function n(r){if(r&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?""+r:"null";if(typeof r!="object")return JSON.stringify(r);let i,s;if(Array.isArray(r)){for(s="[",i=0;iqy(e[t])?Ot(`_${t}_${mu(e[t])}`):Ot(`_${t}_${e[t]}`)).join("")}function Ft(e){return e===!0||bc(e)&&!e.binned}function Fn(e){return e==="binned"||bc(e)&&e.binned===!0}function bc(e){return ve(e)}function qy(e){return ie(e,"param")}function kM(e){switch(e){case na:case ra:case ya:case qr:case Co:case Fo:case Ou:case ba:case Tu:case Nu:case Wr:return 6;case Lu:return 4;default:return 10}}function Lg(e){return ie(e,"expr")}function Dn(e,{level:t}={level:0}){const n=re(e||{}),r={};for(const i of n)r[i]=t===0?ti(e[i]):Dn(e[i],{level:t-1});return r}function kP(e){const{anchor:t,frame:n,offset:r,orient:i,angle:s,limit:o,color:a,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...g}=e,m={...g,...a?{fill:a}:{}},v={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...s!==void 0?{angle:s}:{},...o!==void 0?{limit:o}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}},b=Zf(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:m,subtitleMarkConfig:b,nonMarkTitleProperties:v,subtitle:y}}function Oa(e){return be(e)||Q(e)&&be(e[0])}function De(e){return ie(e,"signal")}function xc(e){return ie(e,"step")}function ype(e){return Q(e)?!1:ie(e,"fields")&&!ie(e,"data")}function bpe(e){return Q(e)?!1:ie(e,"fields")&&ie(e,"data")}function Jo(e){return Q(e)?!1:ie(e,"field")&&ie(e,"data")}const xpe={aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1},_pe=re(xpe),wpe={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},Uw=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function CP(e){const t=Q(e.condition)?e.condition.map(CM):CM(e.condition);return{...ti(e),condition:t}}function ti(e){if(Lg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function CM(e){if(Lg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Dt(e){if(Lg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return De(e)?e:e!==void 0?{value:e}:void 0}function Epe(e){return De(e)?e.signal:ce(e)}function FM(e){return De(e)?e.signal:ce(e.value)}function fs(e){return De(e)?e.signal:e==null?null:ce(e)}function Ape(e,t,n){for(const r of n){const i=go(r,t.markDef,t.config);i!==void 0&&(e[r]=Dt(i))}return e}function FP(e){return[].concat(e.type,e.style??[])}function xt(e,t,n,r={}){const{vgChannel:i,ignoreVgConfig:s}=r;return i&&ie(t,i)?t[i]:t[e]!==void 0?t[e]:s&&(!i||i===e)?void 0:go(e,t,n,r)}function go(e,t,n,{vgChannel:r}={}){const i=qw(e,t,n.style);return Kt(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function qw(e,t,n){return $P(e,FP(t),n)}function $P(e,t,n){t=xe(t);let r;for(const i of t){const s=n[i];ie(s,e)&&(r=s[e])}return r}function DP(e,t){return xe(e).reduce((n,r)=>(n.field.push(ge(r,t)),n.order.push(r.sort??"ascending"),n),{field:[],order:[]})}function MP(e,t){const n=[...e];return t.forEach(r=>{for(const i of n)if(ri(i,r))return;n.push(r)}),n}function RP(e,t){return ri(e,t)||!t?e:e?[...xe(e),...xe(t)].join(", "):t}function TP(e,t){const n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((Oa(n)||De(n))&&(Oa(r)||De(r)))return{explicit:e.explicit,value:RP(n,r)};if(Oa(n)||De(n))return{explicit:e.explicit,value:n};if(Oa(r)||De(r))return{explicit:e.explicit,value:r};if(!Oa(n)&&!De(n)&&!Oa(r)&&!De(r))return{explicit:e.explicit,value:MP(n,r)};throw new Error("It should never reach here")}function VC(e){return`Invalid specification ${wt(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Spe='Autosize "fit" only works for single views and layered views.';function $M(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function DM(e){const t=e=="width"?"Width":"Height",n=e=="width"?"x":"y";return`${t} "container" only works well with autosize "fit" or "fit-${n}".`}function MM(e){return e?`Dropping "fit-${e}" because spec has discrete ${Hr(e)}.`:'Dropping "fit" because spec has discrete size.'}function XC(e){return`Unknown field for ${e}. Cannot calculate view size.`}function RM(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function kpe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Cpe(e){return`The "nearest" transform is not supported for ${e} marks.`}function NP(e){return`Selection not supported for ${e} yet.`}function Fpe(e){return`Cannot find a selection named "${e}".`}const $pe="Scale bindings are currently only supported for scales with unbinned, continuous domains.",Dpe="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",Mpe="Legend bindings are only supported for selections over an individual field or encoding channel.";function Rpe(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function Tpe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const Npe="The same selection must be used to override scale domains in a layered view.",Ope='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function Lpe(e){return`Unknown repeated value "${e}".`}function TM(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const Ipe="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",KC="Animation involving facet, layer, or concat is currently unsupported.";function Ppe(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${ce(e)}.`}function Bpe(e,t,n,r){return(e.length?"Multiple ":"No ")+`matching ${ce(t)} encoding found for selection ${ce(n.param)}. Using "field": ${ce(r)}.`}const zpe="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function jpe(e){return`Unrecognized parse "${e}".`}function NM(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const Upe="Attempt to add the same child twice.";function qpe(e){return`Ignoring an invalid transform: ${wt(e)}.`}const Wpe='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function OM(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Hpe(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${wt(t)} is overridden by a child projection ${wt(n)}.`}const Gpe="Arc marks uses theta channel rather than angle, replacing angle with theta.";function Ype(e){return`${e}Offset dropped because ${e} is continuous`}function Vpe(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${wt(n)}}.`}function OP(e){return`Invalid field type "${e}".`}function Xpe(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function Kpe(e){return`Invalid aggregation operator "${e}".`}function LP(e,t){const{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?"fill and stroke":n?"fill":"stroke"}.`}function Zpe(e){return`Position range does not support relative band size for ${e}.`}function Ww(e,t){return`Dropping ${wt(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const Jpe="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function Wy(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function Qpe(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function ege(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function tge(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function nge(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function J2(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function rge(e){return`The ${e} for range marks cannot be an expression`}function ige(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function sge(e,t){return`Specified orient "${e}" overridden with "${t}".`}function oge(e){return`Cannot use the scale property "${e}" with non-color channel.`}function age(e){return`Cannot use the relative band size with ${e} scale.`}function uge(e){return`Using unaggregated domain with raw field has no effect (${wt(e)}).`}function lge(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function cge(e){return`Unaggregated domain is currently unsupported for log scale (${wt(e)}).`}function fge(e){return`Cannot apply size to non-oriented mark "${e}".`}function dge(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function hge(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function IP(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function PP(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function pge(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${wt(n)} and ${wt(r)}). Using ${wt(n)}.`}function gge(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${wt(n)} and ${wt(r)}). Using the union of the two domains.`}function mge(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function vge(e){return`Dropping sort property ${wt(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const LM="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",yge="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",bge="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",xge="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function _ge(e){return`Cannot stack "${e}" if there is already "${e}2".`}function wge(e){return`Stack is applied to a non-linear scale (${e}).`}function Ege(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function V1(e,t){return`Invalid ${e}: ${wt(t)}.`}function Age(e){return`Dropping day from datetime ${wt(e)} as day cannot be combined with other units.`}function Sge(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function kge(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function Cge(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function IM(e){return`1D error band does not support ${e}.`}function BP(e){return`Channel ${e} is required for "binned" bin.`}function Fge(e){return`Channel ${e} should not be used with "binned" bin.`}function $ge(e){return`Domain for ${e} is required for threshold scale.`}const zP=HE(WE);let Zl=zP;function Dge(e){return Zl=e,Zl}function Mge(){return Zl=zP,Zl}function ZC(...e){Zl.error(...e)}function oe(...e){Zl.warn(...e)}function Rge(...e){Zl.debug(...e)}function _c(e){if(e&&ve(e)){for(const t of QC)if(ie(e,t))return!0}return!1}const jP=["january","february","march","april","may","june","july","august","september","october","november","december"],Tge=jP.map(e=>e.substr(0,3)),UP=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Nge=UP.map(e=>e.substr(0,3));function Oge(e){if(Oy(e)&&(e=+e),ut(e))return e>4&&oe(V1("quarter",e)),e-1;throw new Error(V1("quarter",e))}function Lge(e){if(Oy(e)&&(e=+e),ut(e))return e-1;{const t=e.toLowerCase(),n=jP.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=Tge.indexOf(r);if(i!==-1)return i;throw new Error(V1("month",e))}}function Ige(e){if(Oy(e)&&(e=+e),ut(e))return e%7;{const t=e.toLowerCase(),n=UP.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=Nge.indexOf(r);if(i!==-1)return i;throw new Error(V1("day",e))}}function JC(e,t){const n=[];if(t&&e.day!==void 0&&re(e).length>1&&(oe(Age(e)),e=ze(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const r=t?Lge(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){const r=t?Oge(e.quarter):e.quarter;n.push(ut(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){const r=t?Ige(e.day):e.day;n.push(ut(r)?r+1:`${r}+1`)}else n.push(1);for(const r of["hours","minutes","seconds","milliseconds"]){const i=e[r];n.push(typeof i>"u"?0:i)}return n}function Jl(e){const n=JC(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function Pge(e){const n=JC(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function Bge(e){const t=JC(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const qP={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},QC=re(qP);function zge(e){return _e(qP,e)}function wc(e){return ve(e)?e.binned:WP(e)}function WP(e){return e&&e.startsWith("binned")}function e3(e){return e.startsWith("utc")}function jge(e){return e.substring(3)}const Uge={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Hy(e){return QC.filter(t=>GP(e,t))}function HP(e){const t=Hy(e);return t[t.length-1]}function GP(e,t){const n=e.indexOf(t);return!(n<0||n>0&&t==="seconds"&&e.charAt(n-1)==="i"||e.length>n+3&&t==="day"&&e.charAt(n+3)==="o"||n>0&&t==="year"&&e.charAt(n-1)==="f")}function qge(e,t,{end:n}={end:!1}){const r=PC(t),i=e3(e)?"utc":"";function s(u){return u==="quarter"?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`}let o;const a={};for(const u of QC)GP(e,u)&&(a[u]=s(u),o=u);return n&&(a[o]+="+1"),Pge(a)}function YP(e){if(!e)return;const t=Hy(e);return`timeUnitSpecifier(${wt(t)}, ${wt(Uge)})`}function Wge(e,t,n){if(!e)return;const r=YP(e);return`${n||e3(e)?"utc":"time"}Format(${t}, ${r})`}function _n(e){if(!e)return;let t;return be(e)?WP(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:ve(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),e3(t.unit)&&(t.utc=!0,t.unit=jge(t.unit)),t}function Hge(e){const{utc:t,...n}=_n(e);return n.unit?(t?"utc":"")+re(n).map(r=>Ot(`${r==="unit"?"":`_${r}_`}${n[r]}`)).join(""):(t?"utc":"")+"timeunit"+re(n).map(r=>Ot(`_${r}_${n[r]}`)).join("")}function VP(e,t=n=>n){const n=_n(e),r=HP(n.unit);if(r&&r!=="day"){const i={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:s,part:o}=XP(r,n.step),a={...i,[o]:+i[o]+s};return`${t(Jl(a))} - ${t(Jl(i))}`}}const Gge={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Yge(e){return _e(Gge,e)}function XP(e,t=1){if(Yge(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:t*3};case"week":return{part:"date",step:t*7}}}function Vge(e){return ie(e,"param")}function t3(e){return!!(e!=null&&e.field)&&e.equal!==void 0}function n3(e){return!!(e!=null&&e.field)&&e.lt!==void 0}function r3(e){return!!(e!=null&&e.field)&&e.lte!==void 0}function i3(e){return!!(e!=null&&e.field)&&e.gt!==void 0}function s3(e){return!!(e!=null&&e.field)&&e.gte!==void 0}function o3(e){if(e!=null&&e.field){if(Q(e.range)&&e.range.length===2)return!0;if(De(e.range))return!0}return!1}function a3(e){return!!(e!=null&&e.field)&&(Q(e.oneOf)||Q(e.in))}function Xge(e){return!!(e!=null&&e.field)&&e.valid!==void 0}function KP(e){return a3(e)||t3(e)||o3(e)||n3(e)||i3(e)||r3(e)||s3(e)}function Is(e,t){return tb(e,{timeUnit:t,wrapTime:!0})}function Kge(e,t){return e.map(n=>Is(n,t))}function ZP(e,t=!0){const{field:n}=e,r=_n(e.timeUnit),{unit:i,binned:s}=r||{},o=ge(e,{expr:"datum"}),a=i?`time(${s?o:qge(i,n)})`:o;if(t3(e))return`${a}===${Is(e.equal,i)}`;if(n3(e)){const u=e.lt;return`${a}<${Is(u,i)}`}else if(i3(e)){const u=e.gt;return`${a}>${Is(u,i)}`}else if(r3(e)){const u=e.lte;return`${a}<=${Is(u,i)}`}else if(s3(e)){const u=e.gte;return`${a}>=${Is(u,i)}`}else{if(a3(e))return`indexof([${Kge(e.oneOf,i).join(",")}], ${a}) !== -1`;if(Xge(e))return Gy(a,e.valid);if(o3(e)){const{range:u}=Dn(e),l=De(u)?{signal:`${u.signal}[0]`}:u[0],c=De(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return"inrange("+a+", ["+Is(l,i)+", "+Is(c,i)+"])";const f=[];return l!==null&&f.push(`${a} >= ${Is(l,i)}`),c!==null&&f.push(`${a} <= ${Is(c,i)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${wt(e)}`)}function Gy(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Zge(e){return KP(e)&&e.timeUnit?{...e,timeUnit:_n(e.timeUnit)}:e}const Ig={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function Jge(e){return e==="quantitative"||e==="temporal"}function JP(e){return e==="ordinal"||e==="nominal"}const Ql=Ig.quantitative,u3=Ig.ordinal,td=Ig.temporal,l3=Ig.nominal,Od=Ig.geojson;function Qge(e){if(e)switch(e=e.toLowerCase(),e){case"q":case Ql:return"quantitative";case"t":case td:return"temporal";case"o":case u3:return"ordinal";case"n":case l3:return"nominal";case Od:return"geojson"}}const Mn={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},Hw={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function e0e(e,t){const n=Hw[e],r=Hw[t];return n===r||n==="ordinal-position"&&r==="time"||r==="ordinal-position"&&n==="time"}const t0e={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function PM(e){return t0e[e]}const QP=new Set(["linear","log","pow","sqrt","symlog"]),eB=new Set([...QP,"time","utc"]);function tB(e){return QP.has(e)}const nB=new Set(["quantile","quantize","threshold"]),n0e=new Set([...eB,...nB,"sequential","identity"]),r0e=new Set(["ordinal","bin-ordinal","point","band"]);function En(e){return r0e.has(e)}function xs(e){return n0e.has(e)}function eo(e){return eB.has(e)}function nd(e){return nB.has(e)}const i0e={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5};function s0e(e){return!be(e)&&ie(e,"name")}function rB(e){return ie(e,"param")}function o0e(e){return ie(e,"unionWith")}function a0e(e){return ve(e)&&"field"in e}const u0e={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:wke,domain:Eke,range:Ake,rangeMax:Ske,rangeMin:kke,scheme:Cke,...l0e}=u0e,c0e=re(l0e);function Gw(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return eo(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return eo(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return eo(e);case"nice":return eo(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return xs(e)&&!Ze(["log","time","utc","threshold","quantile"],e)}}function iB(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return ff(e)?void 0:oge(t);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function f0e(e,t){return Ze([u3,l3],t)?e===void 0||En(e):t===td?Ze([Mn.TIME,Mn.UTC,void 0],e):t===Ql?tB(e)||nd(e)||e===void 0:!0}function d0e(e,t,n=!1){if(!Do(e))return!1;switch(e){case Lt:case Sn:case Mu:case Nd:case Ui:case Fs:return eo(t)||t==="band"?!0:t==="point"?!n:!1;case Ru:return Ze(["linear","band"],t);case ya:case Ou:case ba:case Tu:case Nu:case vc:return eo(t)||nd(t)||Ze(["band","point","ordinal"],t);case qr:case Co:case Fo:return t!=="band";case Lu:case Wr:return t==="ordinal"||nd(t)}}function h0e(e){return ve(e)&&"value"in e}const Er={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},sB=Er.arc,Yy=Er.area,Vy=Er.bar,p0e=Er.image,Xy=Er.line,Ky=Er.point,g0e=Er.rect,X1=Er.rule,oB=Er.text,c3=Er.tick,m0e=Er.trail,f3=Er.circle,d3=Er.square,aB=Er.geoshape;function Pu(e){return["line","area","trail"].includes(e)}function Op(e){return["rect","bar","image","arc","tick"].includes(e)}const v0e=new Set(re(Er));function mo(e){return ie(e,"type")}const y0e=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],b0e=["fill","fillOpacity"],x0e=[...y0e,...b0e],_0e={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},BM=re(_0e),Q2=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],w0e={area:["line","point"],bar:Q2,rect:Q2,line:["point"],tick:["bandSize","thickness",...Q2]},E0e={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},A0e={mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1},uB=re(A0e);function ec(e){return ie(e,"band")}const S0e={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},k0e=5,h3={binSpacing:0,continuousBandSize:k0e,minBandSize:.25,timeUnitBandPosition:.5},C0e={...h3,binSpacing:1},F0e={...h3,thickness:1};function $0e(e){return mo(e)?e.type:e}function lB(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function p3({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){var a,u;if(!r||!xs(r)||i)return"always-valid";const s=lB(xt("invalid",e,t),{isPath:Pu(e.type)});return((u=(a=t.scale)==null?void 0:a.invalid)==null?void 0:u[n])!==void 0?"show":s}function D0e(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function cB({scaleName:e,scale:t,mode:n}){const r=`domain('${e}')`;if(!t||!e)return;const i=`${r}[0]`,s=`peek(${r})`,o=t.domainHasZero();return o==="definitely"?{scale:e,value:0}:o==="maybe"?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n==="zeroOrMin"?i:s})`}:{signal:`scale('${e}', ${n==="zeroOrMin"?i:s})`}}function fB({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:s}){var c;const o=n==null?void 0:n.get("type"),a=ws(t),u=Uy(a==null?void 0:a.aggregate),l=p3({scaleChannel:e,markDef:i,config:s,scaleType:o,isCountAggregate:u});if(a&&l==="show"){const f=((c=s.scale.invalid)==null?void 0:c[e])??"zero-or-min";return{test:Gy(ge(a,{expr:"datum"}),!1),...M0e(f,n,r)}}}function M0e(e,t,n){if(h0e(e)){const{value:r}=e;return De(r)?{signal:r.signal}:{value:r}}return cB({scale:t,scaleName:n,mode:"zeroOrMin"})}function g3(e){const{channel:t,channelDef:n,markDef:r,scale:i,scaleName:s,config:o}=e,a=yc(t),u=m3(e),l=fB({scaleChannel:a,channelDef:n,scale:i,scaleName:s,markDef:r,config:o});return l!==void 0?[l,u]:u}function R0e(e){const{datum:t}=e;return _c(t)?Jl(t):`${wt(t)}`}function Al(e,t,n,r){const i={};if(t&&(i.scale=t),Mo(e)){const{datum:s}=e;_c(s)?i.signal=Jl(s):De(s)?i.signal=s.signal:Lg(s)?i.signal=s.expr:i.value=s}else i.field=ge(e,n);if(r){const{offset:s,band:o}=r;s&&(i.offset=s),o&&(i.band=o)}return i}function K1({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:s="end",bandPosition:o=.5}){const a=!De(o)&&0{switch(t.fieldTitle){case"plain":return e.field;case"functional":return Y0e(e);default:return G0e(e,t)}};let AB=EB;function SB(e){AB=e}function V0e(){SB(EB)}function df(e,t,{allowDisabling:n,includeDefault:r=!0}){var a;const i=(a=x3(e))==null?void 0:a.title;if(!ue(e))return i??e.title;const s=e,o=r?_3(s,t):void 0;return n?Kt(i,s.title,o):i??s.title??o}function x3(e){if(id(e)&&e.axis)return e.axis;if(_B(e)&&e.legend)return e.legend;if(y3(e)&&e.header)return e.header}function _3(e,t){return AB(e,t)}function Q1(e){if(wB(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=x3(e)??{},{format:n,formatType:r}=t;return{format:n,formatType:r}}}function X0e(e,t){var s;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(b3(e)&&Q(e.sort))return"ordinal";const{aggregate:n,bin:r,timeUnit:i}=e;if(i)return"temporal";if(r||n&&!Iu(n)&&!fa(n))return"quantitative";if(Ec(e)&&((s=e.scale)!=null&&s.type))switch(Hw[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function ws(e){if(ue(e))return e;if(Qy(e))return e.condition}function an(e){if(Ue(e))return e;if(jg(e))return e.condition}function kB(e,t,n,r={}){if(be(e)||ut(e)||Au(e)){const i=be(e)?"string":ut(e)?"number":"boolean";return oe(Vpe(t,i,e)),{value:e}}return Ue(e)?ev(e,t,n,r):jg(e)?{...e,condition:ev(e.condition,t,n,r)}:e}function ev(e,t,n,r){if(wB(e)){const{format:i,formatType:s,...o}=e;if(tc(s)&&!n.customFormatTypes)return oe(OM(t)),ev(o,t,n,r)}else{const i=id(e)?"axis":_B(e)?"legend":y3(e)?"header":null;if(i&&e[i]){const{format:s,formatType:o,...a}=e[i];if(tc(o)&&!n.customFormatTypes)return oe(OM(t)),ev({...e,[i]:a},t,n,r)}}return ue(e)?w3(e,t,r):K0e(e)}function K0e(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=ut(n)?"quantitative":be(n)?"nominal":_c(n)?"temporal":void 0,{...e,type:t}}function w3(e,t,{compositeMark:n=!1}={}){const{aggregate:r,timeUnit:i,bin:s,field:o}=e,a={...e};if(!n&&r&&!YC(r)&&!Iu(r)&&!fa(r)&&(oe(Kpe(r)),delete a.aggregate),i&&(a.timeUnit=_n(i)),o&&(a.field=`${o}`),Ft(s)&&(a.bin=eb(s,t)),Fn(s)&&!Zt(t)&&oe(Fge(t)),_r(a)){const{type:u}=a,l=Qge(u);u!==l&&(a.type=l),u!=="quantitative"&&Uy(r)&&(oe(Xpe(u,r)),a.type="quantitative")}else if(!bP(t)){const u=X0e(a,t);a.type=u}if(_r(a)){const{compatible:u,warning:l}=Z0e(a,t)||{};u===!1&&oe(l)}if(b3(a)&&be(a.sort)){const{sort:u}=a;if(jM(u))return{...a,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&jM(l))return{...a,sort:{encoding:l,order:"descending"}}}if(y3(a)){const{header:u}=a;if(u){const{orient:l,...c}=u;if(l)return{...a,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return a}function eb(e,t){return Au(e)?{maxbins:kM(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:kM(t)}:e}const zc={compatible:!0};function Z0e(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case na:case ra:case Ly:return J1(e)?zc:{compatible:!1,warning:ege(t)};case Lt:case Sn:case Mu:case Nd:case qr:case Co:case Fo:case Tg:case Ng:case Iy:case Kl:case Py:case By:case vc:case Ui:case Fs:case zy:return zc;case Ds:case zi:case $s:case Ms:return n!==Ql?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:zc;case ba:case Tu:case Nu:case Ou:case ya:case va:case ma:case Cs:case ko:case Ru:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:zc;case Wr:case Lu:return!J1(e)&&!W0e(e)?{compatible:!1,warning:tge(t)}:zc;case ed:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:zc}}function sd(e){const{formatType:t}=Q1(e);return t==="time"||!t&&J0e(e)}function J0e(e){return e&&(e.type==="temporal"||ue(e)&&!!e.timeUnit)}function tb(e,{timeUnit:t,type:n,wrapTime:r,undefinedIfExprNotRequired:i}){var u;const s=t&&((u=_n(t))==null?void 0:u.unit);let o=s||n==="temporal",a;return Lg(e)?a=e.expr:De(e)?a=e.signal:_c(e)?(o=!0,a=Jl(e)):(be(e)||ut(e))&&o&&(a=`datetime(${wt(e)})`,zge(s)&&(ut(e)&&e<1e4||be(e)&&isNaN(Date.parse(e)))&&(a=Jl({[s]:e}))),a?r&&o?`time(${a})`:a:i?void 0:wt(e)}function CB(e,t){const{type:n}=e;return t.map(r=>{const i=ue(e)&&!wc(e.timeUnit)?e.timeUnit:void 0,s=tb(r,{timeUnit:i,type:n,undefinedIfExprNotRequired:!0});return s!==void 0?{signal:s}:r})}function Ug(e,t){return Ft(e.bin)?Do(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const WM={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function qg(e){return e==null?void 0:e.condition}const FB=["domain","grid","labels","ticks","title"],Q0e={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},$B={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},eme={...$B,style:1,labelExpr:1,encoding:1};function HM(e){return _e(eme,e)}const tme={axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1},DB=re(tme);function _a(e){return ie(e,"mark")}class nb{constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return _a(t)?$0e(t.mark)===this.name:!1}}function Sl(e,t){const n=e&&e[t];return n?Q(n)?Jf(n,r=>!!r.field):ue(n)||Qy(n):!1}function MB(e,t){const n=e&&e[t];return n?Q(n)?Jf(n,r=>!!r.field):ue(n)||Mo(n)||jg(n):!1}function RB(e,t){if(Zt(t)){const n=e[t];if((ue(n)||Mo(n))&&(JP(n.type)||ue(n)&&n.timeUnit)){const r=UC(t);return MB(e,r)}}return!1}function TB(e){return Jf(Khe,t=>{if(Sl(e,t)){const n=e[t];if(Q(n))return Jf(n,r=>!!r.aggregate);{const r=ws(n);return r&&!!r.aggregate}}return!1})}function NB(e,t){const n=[],r=[],i=[],s=[],o={};return E3(e,(a,u)=>{if(ue(a)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=a;if(c||d||f){const p=x3(a),g=p==null?void 0:p.title;let m=ge(a,{forAs:!0});const v={...g?[]:{title:df(a,t,{allowDisabling:!0})},...h,field:m};if(c){let y;if(Iu(c)?(y="argmax",m=ge({op:"argmax",field:c.argmax},{forAs:!0}),v.field=`${m}.${l}`):fa(c)?(y="argmin",m=ge({op:"argmin",field:c.argmin},{forAs:!0}),v.field=`${m}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(y=c),y){const b={op:y,as:m};l&&(b.field=l),s.push(b)}}else if(n.push(m),_r(a)&&Ft(f)){if(r.push({bin:f,field:l,as:m}),n.push(ge(a,{binSuffix:"end"})),Ug(a,u)&&n.push(ge(a,{binSuffix:"range"})),Zt(u)){const y={field:`${m}_end`};o[`${u}2`]=y}v.bin="binned",bP(u)||(v.type=Ql)}else if(d&&!wc(d)){i.push({timeUnit:d,field:l,as:m});const y=_r(a)&&a.type!==td&&"time";y&&(u===Tg||u===Kl?v.formatType=y:ape(u)?v.legend={formatType:y,...v.legend}:Zt(u)&&(v.axis={formatType:y,...v.axis}))}o[u]=v}else n.push(l),o[u]=e[u]}else o[u]=e[u]}),{bins:r,timeUnits:i,aggregate:s,groupby:n,encoding:o}}function nme(e,t,n){const r=lpe(t,n);if(r){if(r==="binned"){const i=e[t===Cs?Lt:Sn];return!!(ue(i)&&ue(e[t])&&Fn(i.bin))}}else return!1;return!0}function rme(e,t,n,r){const i={};for(const s of re(e))yP(s)||oe(Qpe(s));for(let s of npe){if(!e[s])continue;const o=e[s];if(Og(s)){const a=tpe(s),u=i[a];if(ue(u)&&Jge(u.type)&&ue(o)&&!u.timeUnit){oe(Ype(a));continue}}if(s==="angle"&&t==="arc"&&!e.theta&&(oe(Gpe),s=Ui),!nme(e,s,t)){oe(Wy(s,t));continue}if(s===ya&&t==="line"){const a=ws(e[s]);if(a!=null&&a.aggregate){oe(Jpe);continue}}if(s===qr&&(n?"fill"in e:"stroke"in e)){oe(LP("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(s===Ng||s===ed&&!Q(o)&&!_s(o)||s===Kl&&Q(o)){if(o){if(s===ed){const a=e[s];if(xB(a)){i[s]=a;continue}}i[s]=xe(o).reduce((a,u)=>(ue(u)?a.push(w3(u,s)):oe(Ww(u,s)),a),[])}}else{if(s===Kl&&o===null)i[s]=null;else if(!ue(o)&&!Mo(o)&&!_s(o)&&!zg(o)&&!De(o)){oe(Ww(o,s));continue}i[s]=kB(o,s,r)}}return i}function rb(e,t){const n={};for(const r of re(e)){const i=kB(e[r],r,t,{compositeMark:!0});n[r]=i}return n}function ime(e){const t=[];for(const n of re(e))if(Sl(e,n)){const r=e[n],i=xe(r);for(const s of i)ue(s)?t.push(s):Qy(s)&&t.push(s.condition)}return t}function E3(e,t,n){if(e)for(const r of re(e)){const i=e[r];if(Q(i))for(const s of i)t.call(n,s,r);else t.call(n,i,r)}}function sme(e,t,n,r){return e?re(e).reduce((i,s)=>{const o=e[s];return Q(o)?o.reduce((a,u)=>t.call(r,a,u,s),i):t.call(r,i,o,s)},n):n}function OB(e,t){return re(t).reduce((n,r)=>{switch(r){case Lt:case Sn:case Py:case zy:case By:case Cs:case ko:case Mu:case Nd:case Ui:case va:case Fs:case ma:case Ru:case $s:case Ds:case Ms:case zi:case Tg:case Wr:case vc:case Kl:return n;case ed:if(e==="line"||e==="trail")return n;case Ng:case Iy:{const i=t[r];if(Q(i)||ue(i))for(const s of xe(i))s.aggregate||n.push(ge(s,{}));return n}case ya:if(e==="trail")return n;case qr:case Co:case Fo:case ba:case Tu:case Nu:case Lu:case Ou:{const i=ws(t[r]);return i&&!i.aggregate&&n.push(ge(i,{})),n}}},[])}function ome(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(Q(t)){for(const s of t)s.aggregate?(r||(r=[]),r.push(s)):(i||(i=[]),i.push(s));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return Q(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function Vw(e,t,n,r=!0){if("tooltip"in n)return{tooltip:n.tooltip};const i=e.map(({fieldPrefix:o,titlePrefix:a})=>{const u=r?` of ${A3(t)}`:"";return{field:o+t.field,type:t.type,title:De(a)?{signal:`${a}"${escape(u)}"`}:a+u}}),s=ime(n).map(U0e);return{tooltip:[...i,...Qs(s,et)]}}function A3(e){const{title:t,field:n}=e;return Kt(t,n)}function S3(e,t,n,r,i){const{scale:s,axis:o}=n;return({partName:a,mark:u,positionPrefix:l,endPositionPrefix:c=void 0,extraEncoding:f={}})=>{const d=A3(n);return LB(e,a,i,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...d!==void 0?{title:d}:{},...s!==void 0?{scale:s}:{},...o!==void 0?{axis:o}:{}},...be(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...r,...f}})}}function LB(e,t,n,r){const{clip:i,color:s,opacity:o}=e,a=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...s?{color:s}:{},...o?{opacity:o}:{},...mo(r.mark)?r.mark:{type:r.mark},style:`${a}-${String(t)}`,...Au(e[t])?{}:e[t]}}]:[]}function IB(e,t,n){const{encoding:r}=e,i=t==="vertical"?"y":"x",s=r[i],o=r[`${i}2`],a=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:D0(s,n),continuousAxisChannelDef2:D0(o,n),continuousAxisChannelDefError:D0(a,n),continuousAxisChannelDefError2:D0(u,n),continuousAxis:i}}function D0(e,t){if(e!=null&&e.aggregate){const{aggregate:n,...r}=e;return n!==t&&oe(Cge(n,t)),r}else return e}function PB(e,t){const{mark:n,encoding:r}=e,{x:i,y:s}=r;if(mo(n)&&n.orient)return n.orient;if(Va(i)){if(Va(s)){const o=ue(i)&&i.aggregate,a=ue(s)&&s.aggregate;if(!o&&a===t)return"vertical";if(!a&&o===t)return"horizontal";if(o===t&&a===t)throw new Error("Both x and y cannot have aggregate");return sd(s)&&!sd(i)?"horizontal":"vertical"}return"horizontal"}else{if(Va(s))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const tv="boxplot",ame=["box","median","outliers","rule","ticks"],ume=new nb(tv,zB);function BB(e){return ut(e)?"tukey":e}function zB(e,{config:t}){e={...e,encoding:rb(e.encoding,t)};const{mark:n,encoding:r,params:i,projection:s,...o}=e,a=mo(n)?n:{type:n};i&&oe(NP("boxplot"));const u=a.extent??t.boxplot.extent,l=xt("size",a,t),c=a.invalid,f=BB(u),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:g,continuousAxis:m,groupby:v,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:A}=lme(e,u,t),E=Td(g.field),{color:S,size:k,...F}=b,D=ft=>S3(a,m,g,ft,t.boxplot),M=D(F),T=D(b),$=(ve(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",C=D({...F,...k?{size:k}:{},color:{condition:{test:`${mt(`lower_box_${g.field}`)} >= ${mt(`upper_box_${g.field}`)}`,...S||{value:$}}}}),R=Vw([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],g,b),L={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O=f==="min-max"?R:Vw([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,b),N=[...M({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...M({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...M({partName:"ticks",mark:L,positionPrefix:"lower_whisker",extraEncoding:O}),...M({partName:"ticks",mark:L,positionPrefix:"upper_whisker",extraEncoding:O})],B=[...f!=="tukey"?N:[],...T({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:R}),...C({partName:"median",mark:{type:"tick",invalid:c,...ve(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:R})];if(f==="min-max")return{...o,transform:(o.transform??[]).concat(p),layer:B};const q=mt(`lower_box_${g.field}`),X=mt(`upper_box_${g.field}`),le=`(${X} - ${q})`,de=`${q} - ${u} * ${le}`,se=`${X} + ${u} * ${le}`,Ce=mt(g.field),me={joinaggregate:jB(g.field),groupby:v},W={transform:[{filter:`(${de} <= ${Ce}) && (${Ce} <= ${se})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${E}`},{op:"max",field:g.field,as:`upper_whisker_${E}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${E}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${E}`},...y],groupby:v}],layer:N},{tooltip:j,...te}=F,{scale:U,axis:P}=g,we=A3(g),he=Pr(P,["title"]),Le=LB(a,"outliers",t.boxplot,{transform:[{filter:`(${Ce} < ${de}) || (${Ce} > ${se})`}],mark:"point",encoding:{[m]:{field:g.field,type:g.type,...we!==void 0?{title:we}:{},...U!==void 0?{scale:U}:{},..._t(he)?{}:{axis:he}},...te,...S?{color:S}:{},...A?{tooltip:A}:{}}})[0];let Re;const qe=[...d,...h,me];return Le?Re={transform:qe,layer:[Le,W]}:(Re=W,Re.transform.unshift(...qe)),{...o,layer:[Re,{transform:p,layer:B}]}}function jB(e){const t=Td(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function lme(e,t,n){const r=PB(e,tv),{continuousAxisChannelDef:i,continuousAxis:s}=IB(e,r,tv),o=i.field,a=Td(o),u=BB(t),l=[...jB(o),{op:"median",field:o,as:`mid_box_${a}`},{op:"min",field:o,as:(u==="min-max"?"lower_whisker_":"min_")+a},{op:"max",field:o,as:(u==="min-max"?"upper_whisker_":"max_")+a}],c=u==="min-max"||u==="tukey"?[]:[{calculate:`${mt(`upper_box_${a}`)} - ${mt(`lower_box_${a}`)}`,as:`iqr_${a}`},{calculate:`min(${mt(`upper_box_${a}`)} + ${mt(`iqr_${a}`)} * ${t}, ${mt(`max_${a}`)})`,as:`upper_whisker_${a}`},{calculate:`max(${mt(`lower_box_${a}`)} - ${mt(`iqr_${a}`)} * ${t}, ${mt(`min_${a}`)})`,as:`lower_whisker_${a}`}],{[s]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:p}=ome(d),{bins:g,timeUnits:m,aggregate:v,groupby:y,encoding:b}=NB(p,n),x=r==="vertical"?"horizontal":"vertical",_=r,A=[...g,...m,{aggregate:[...v,...l],groupby:y},...c];return{bins:g,timeUnits:m,transform:A,groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:s,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:h}}const k3="errorbar",cme=["ticks","rule"],fme=new nb(k3,UB);function UB(e,{config:t}){e={...e,encoding:rb(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:s,ticksOrient:o,markDef:a,outerSpec:u,tooltipEncoding:l}=qB(e,k3,t);delete s.size;const c=S3(a,i,r,s,t.errorbar),f=a.thickness,d=a.size,h={type:"tick",orient:o,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function dme(e,t){const{encoding:n}=e;if(hme(n))return{orient:PB(e,t),inputType:"raw"};const r=pme(n),i=gme(n),s=n.x,o=n.y;if(r){if(i)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const a=n.x2,u=n.y2;if(Ue(a)&&Ue(u))throw new Error(`${t} cannot have both x2 and y2`);if(Ue(a)){if(Va(s))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(Ue(u)){if(Va(o))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}else{const a=n.xError,u=n.xError2,l=n.yError,c=n.yError2;if(Ue(u)&&!Ue(a))throw new Error(`${t} cannot have xError2 without xError`);if(Ue(c)&&!Ue(l))throw new Error(`${t} cannot have yError2 without yError`);if(Ue(a)&&Ue(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(Ue(a)){if(Va(s))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(Ue(l)){if(Va(o))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function hme(e){return(Ue(e.x)||Ue(e.y))&&!Ue(e.x2)&&!Ue(e.y2)&&!Ue(e.xError)&&!Ue(e.xError2)&&!Ue(e.yError)&&!Ue(e.yError2)}function pme(e){return Ue(e.x2)||Ue(e.y2)}function gme(e){return Ue(e.xError)||Ue(e.xError2)||Ue(e.yError)||Ue(e.yError2)}function qB(e,t,n){const{mark:r,encoding:i,params:s,projection:o,...a}=e,u=mo(r)?r:{type:r};s&&oe(NP(t));const{orient:l,inputType:c}=dme(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:g}=IB(e,l,t),{errorBarSpecificAggregate:m,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:b}=mme(u,f,d,h,p,c,t,n),{[g]:x,[g==="x"?"x2":"y2"]:_,[g==="x"?"xError":"yError"]:A,[g==="x"?"xError2":"yError2"]:E,...S}=i,{bins:k,timeUnits:F,aggregate:D,groupby:M,encoding:T}=NB(S,n),$=[...D,...m],C=c!=="raw"?[]:M,R=Vw(y,f,T,b);return{transform:[...a.transform??[],...k,...F,...$.length===0?[]:[{aggregate:$,groupby:C}],...v],groupby:C,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:T,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:a,tooltipEncoding:R}}function mme(e,t,n,r,i,s,o,a){let u=[],l=[];const c=t.field;let f,d=!1;if(s==="raw"){const h=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":a.errorbar.center,p=e.extent?e.extent:h==="mean"?"stderr":"iqr";if(h==="median"!=(p==="iqr")&&oe(kge(h,p,o)),p==="stderr"||p==="stdev")u=[{op:p,field:c,as:`extent_${c}`},{op:h,field:c,as:`center_${c}`}],l=[{calculate:`${mt(`center_${c}`)} + ${mt(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${mt(`center_${c}`)} - ${mt(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:Rg(h)},{fieldPrefix:"upper_",titlePrefix:GM(h,p,"+")},{fieldPrefix:"lower_",titlePrefix:GM(h,p,"-")}],d=!0;else{let g,m,v;p==="ci"?(g="mean",m="ci0",v="ci1"):(g="median",m="q1",v="q3"),u=[{op:m,field:c,as:`lower_${c}`},{op:v,field:c,as:`upper_${c}`},{op:g,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:df({field:c,aggregate:v,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:df({field:c,aggregate:m,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:df({field:c,aggregate:g,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&oe(Sge(e.center,e.extent)),s==="aggregated-upper-lower"?(f=[],l=[{calculate:mt(n.field),as:`upper_${c}`},{calculate:mt(c),as:`lower_${c}`}]):s==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${mt(c)} + ${mt(r.field)}`,as:`upper_${c}`}],i?l.push({calculate:`${mt(c)} + ${mt(i.field)}`,as:`lower_${c}`}):l.push({calculate:`${mt(c)} - ${mt(r.field)}`,as:`lower_${c}`}));for(const h of l)f.push({fieldPrefix:h.as.substring(0,6),titlePrefix:Xl(Xl(h.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function GM(e,t,n){return`${Rg(e)} ${n} ${t}`}const C3="errorband",vme=["band","borders"],yme=new nb(C3,WB);function WB(e,{config:t}){e={...e,encoding:rb(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:s,markDef:o,outerSpec:a,tooltipEncoding:u}=qB(e,C3,t),l=o,c=S3(l,i,r,s,t.errorband),f=e.encoding.x!==void 0&&e.encoding.y!==void 0;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?oe(IM("interpolate")):l.tension&&oe(IM("tension")),{...a,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const HB={};function F3(e,t,n){const r=new nb(e,t);HB[e]={normalizer:r,parts:n}}function bme(){return re(HB)}F3(tv,zB,ame);F3(k3,UB,cme);F3(C3,WB,vme);const xme=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],GB={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},YB={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},_me=re(GB),wme=re(YB),Eme={header:1,headerRow:1,headerColumn:1,headerFacet:1},VB=re(Eme),XB=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Ame={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},Sme={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},Es="_vgsid_",kme={point:{on:"click",fields:[Es],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function $3(e){return e==="legend"||!!(e!=null&&e.legend)}function ex(e){return $3(e)&&ve(e)}function D3(e){return!!(e!=null&&e.select)}function KB(e){const t=[];for(const n of e||[]){if(D3(n))continue;const{expr:r,bind:i,...s}=n;if(i&&r){const o={...s,bind:i,init:r};t.push(o)}else{const o={...s,...r?{update:r}:{},...i?{bind:i}:{}};t.push(o)}}return t}function Cme(e){return ib(e)||R3(e)||M3(e)}function M3(e){return ie(e,"concat")}function ib(e){return ie(e,"vconcat")}function R3(e){return ie(e,"hconcat")}function ZB({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function vo(e){return ie(e,"step")}function YM(e){return ie(e,"view")||ie(e,"width")||ie(e,"height")}const VM=20,Fme={align:1,bounds:1,center:1,columns:1,spacing:1},$me=re(Fme);function Dme(e,t,n){const r=n[t],i={},{spacing:s,columns:o}=r;s!==void 0&&(i.spacing=s),o!==void 0&&(Jy(e)&&!Bg(e.facet)||M3(e))&&(i.columns=o),ib(e)&&(i.columns=1);for(const a of $me)if(e[a]!==void 0)if(a==="spacing"){const u=e[a];i[a]=ut(u)?u:{row:u.row??s,column:u.column??s}}else i[a]=e[a];return i}function Xw(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function Kw(e,t){const n=nv(e,t);return vo(n)?n.step:JB}function nv(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return Kt(n,{step:e.step})}const JB=20,Mme={continuousWidth:200,continuousHeight:200,step:JB},Rme={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:Mme,mark:E0e,arc:{},area:{},bar:C0e,circle:{},geoshape:{},image:{},line:{},point:{},rect:h3,rule:{color:"black"},square:{},text:{color:"black"},tick:F0e,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:i0e,projection:{},legend:Ame,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:kme,style:{},title:{},facet:{spacing:VM},concat:{spacing:VM},normalizedNumberFormat:".0%"},Io=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],XM={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},KM={blue:Io[0],orange:Io[1],red:Io[2],teal:Io[3],green:Io[4],yellow:Io[5],purple:Io[6],pink:Io[7],brown:Io[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Tme(e={}){return{signals:[{name:"color",value:ve(e)?{...KM,...e}:KM}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function Nme(e){return{signals:[{name:"fontSize",value:ve(e)?{...XM,...e}:XM}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function Ome(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function QB(e){const t=re(e||{}),n={};for(const r of t){const i=e[r];n[r]=qg(i)?CP(i):ti(i)}return n}function Lme(e){const t=re(e),n={};for(const r of t)n[r]=QB(e[r]);return n}const Ime=[...uB,...DB,...VB,"background","padding","legend","lineBreak","scale","style","title","view"];function ez(e={}){const{color:t,font:n,fontSize:r,selection:i,...s}=e,o=md({},ze(Rme),n?Ome(n):{},t?Tme(t):{},r?Nme(r):{},s||{});i&&vd(o,"selection",i,!0);const a=Pr(o,Ime);for(const u of["background","lineBreak","padding"])o[u]&&(a[u]=ti(o[u]));for(const u of uB)o[u]&&(a[u]=Dn(o[u]));for(const u of DB)o[u]&&(a[u]=QB(o[u]));for(const u of VB)o[u]&&(a[u]=Dn(o[u]));if(o.legend&&(a.legend=Dn(o.legend)),o.scale){const{invalid:u,...l}=o.scale,c=Dn(u,{level:1});a.scale={...Dn(l),...re(c).length>0?{invalid:c}:{}}}return o.style&&(a.style=Lme(o.style)),o.title&&(a.title=Dn(o.title)),o.view&&(a.view=Dn(o.view)),a}const Pme=new Set(["view",...v0e]),Bme=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],zme={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...w0e};function jme(e){e=ze(e);for(const t of Bme)delete e[t];if(e.axis)for(const t in e.axis)qg(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of xme)delete e.legend[t];if(e.mark){for(const t of BM)delete e.mark[t];e.mark.tooltip&&ve(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(KB(e.params)),delete e.params);for(const t of Pme){for(const r of BM)delete e[t][r];const n=zme[t];if(n)for(const r of n)delete e[t][r];qme(e,t)}for(const t of bme())delete e[t];Ume(e);for(const t in e)ve(e[t])&&_t(e[t])&&delete e[t];return _t(e)?void 0:e}function Ume(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=kP(e.title);_t(t)||(e.style["group-title"]={...e.style["group-title"],...t}),_t(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),_t(r)?delete e.title:e.title=r}function qme(e,t,n,r){const i=e[t];t==="view"&&(n="cell");const s={...i,...e.style[n??t]};_t(s)||(e.style[n??t]=s),delete e[t]}function sb(e){return ie(e,"layer")}function Wme(e){return ie(e,"repeat")}function Hme(e){return!Q(e.repeat)&&ie(e.repeat,"layer")}class T3{map(t,n){return Jy(t)?this.mapFacet(t,n):Wme(t)?this.mapRepeat(t,n):R3(t)?this.mapHConcat(t,n):ib(t)?this.mapVConcat(t,n):M3(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(sb(t))return this.mapLayer(t,n);if(_a(t))return this.mapUnit(t,n);throw new Error(VC(t))}mapLayer(t,n){return{...t,layer:t.layer.map(r=>this.mapLayerOrUnit(r,n))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map(r=>this.map(r,n))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map(r=>this.map(r,n))}}mapConcat(t,n){const{concat:r,...i}=t;return{...i,concat:r.map(s=>this.map(s,n))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const Gme={zero:1,center:1,normalize:1};function Yme(e){return _e(Gme,e)}const Vme=new Set([sB,Vy,Yy,X1,Ky,f3,d3,Xy,oB,c3]),Xme=new Set([Vy,Yy,sB]);function jc(e){return ue(e)&&rd(e)==="quantitative"&&!e.bin}function ZM(e,t,{orient:n,type:r}){const i=t==="x"?"y":"radius",s=t==="x"&&["bar","area"].includes(r),o=e[t],a=e[i];if(ue(o)&&ue(a))if(jc(o)&&jc(a)){if(o.stack)return t;if(a.stack)return i;const u=ue(o)&&!!o.aggregate,l=ue(a)&&!!a.aggregate;if(u!==l)return u?t:i;if(s){if(n==="vertical")return i;if(n==="horizontal")return t}}else{if(jc(o))return t;if(jc(a))return i}else{if(jc(o))return s&&n==="vertical"?void 0:t;if(jc(a))return s&&n==="horizontal"?void 0:i}}function Kme(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function tz(e,t){var g,m;const n=mo(e)?e:{type:e},r=n.type;if(!Vme.has(r))return null;const i=ZM(t,"x",n)||ZM(t,"theta",n);if(!i)return null;const s=t[i],o=ue(s)?ge(s,{}):void 0,a=Kme(i),u=[],l=new Set;if(t[a]){const v=t[a],y=ue(v)?ge(v,{}):void 0;y&&y!==o&&(u.push(a),l.add(y))}const c=a==="x"?"xOffset":"yOffset",f=t[c],d=ue(f)?ge(f,{}):void 0;d&&d!==o&&(u.push(c),l.add(d));const h=rpe.reduce((v,y)=>{if(y!=="tooltip"&&Sl(t,y)){const b=t[y];for(const x of xe(b)){const _=ws(x);if(_.aggregate)continue;const A=ge(_,{});(!A||!l.has(A))&&v.push({channel:y,fieldDef:_})}}return v},[]);let p;return s.stack!==void 0?Au(s.stack)?p=s.stack?"zero":null:p=s.stack:Xme.has(r)&&(p="zero"),!p||!Yme(p)||TB(t)&&h.length===0?null:((g=s==null?void 0:s.scale)!=null&&g.type&&((m=s==null?void 0:s.scale)==null?void 0:m.type)!==Mn.LINEAR&&s!=null&&s.stack&&oe(wge(s.scale.type)),Ue(t[$o(i)])?(s.stack!==void 0&&oe(_ge(i)),null):(ue(s)&&s.aggregate&&!mpe.has(s.aggregate)&&oe(Ege(s.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:i,impute:s.impute===null?!1:Pu(r),stackBy:h,offset:p}))}function nz(e,t,n){const r=Dn(e),i=xt("orient",r,n);if(r.orient=e1e(r.type,t,i),i!==void 0&&i!==r.orient&&oe(sge(r.orient,i)),r.type==="bar"&&r.orient){const u=xt("cornerRadiusEnd",r,n);if(u!==void 0){const l=r.orient==="horizontal"&&t.x2||r.orient==="vertical"&&t.y2?["cornerRadius"]:S0e[r.orient];for(const c of l)r[c]=u;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}const s=xt("opacity",r,n),o=xt("fillOpacity",r,n);return s===void 0&&o===void 0&&(r.opacity=Jme(r.type,t)),xt("cursor",r,n)===void 0&&(r.cursor=Zme(r,t,n)),r}function Zme(e,t,n){return t.href||e.href||xt("href",e,n)?"pointer":e.cursor}function Jme(e,t){if(Ze([Ky,c3,f3,d3],e)&&!TB(t))return .7}function Qme(e,t,{graticule:n}){if(n)return!1;const r=go("filled",e,t),i=e.type;return Kt(r,i!==Ky&&i!==Xy&&i!==X1)}function e1e(e,t,n){switch(e){case Ky:case f3:case d3:case oB:case g0e:case p0e:return}const{x:r,y:i,x2:s,y2:o}=t;switch(e){case Vy:if(ue(r)&&(Fn(r.bin)||ue(i)&&i.aggregate&&!r.aggregate))return"vertical";if(ue(i)&&(Fn(i.bin)||ue(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(o||s){if(n)return n;if(!s)return(ue(r)&&r.type===Ql&&!Ft(r.bin)||Z1(r))&&ue(i)&&Fn(i.bin)?"horizontal":"vertical";if(!o)return(ue(i)&&i.type===Ql&&!Ft(i.bin)||Z1(i))&&ue(r)&&Fn(r.bin)?"vertical":"horizontal"}case X1:if(s&&!(ue(r)&&Fn(r.bin))&&o&&!(ue(i)&&Fn(i.bin)))return;case Yy:if(o)return ue(i)&&Fn(i.bin)?"horizontal":"vertical";if(s)return ue(r)&&Fn(r.bin)?"vertical":"horizontal";if(e===X1){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case Xy:case c3:{const a=qM(r),u=qM(i);if(n)return n;if(a&&!u)return e!=="tick"?"horizontal":"vertical";if(!a&&u)return e!=="tick"?"vertical":"horizontal";if(a&&u)return"vertical";{const l=_r(r)&&r.type===td,c=_r(i)&&i.type===td;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function t1e(e){const{point:t,line:n,...r}=e;return re(r).length>1?r:r.type}function n1e(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:Pr(e[t],["point","line"])});return e}function tx(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?ve(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?ve(t.point)?t.point:{}:void 0}function JM(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class r1e{constructor(){this.name="path-overlay"}hasMatchingType(t,n){if(_a(t)){const{mark:r,encoding:i}=t,s=mo(r)?r:{type:r};switch(s.type){case"line":case"rule":case"trail":return!!tx(s,n[s.type],i);case"area":return!!tx(s,n[s.type],i)||!!JM(s,n[s.type])}}return!1}run(t,n,r){const{config:i}=n,{params:s,projection:o,mark:a,name:u,encoding:l,...c}=t,f=rb(l,i),d=mo(a)?a:{type:a},h=tx(d,i[d.type],f),p=d.type==="area"&&JM(d,i[d.type]),g=[{name:u,...s?{params:s}:{},mark:t1e({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:Pr(f,["shape"])}],m=tz(nz(d,f,i),f);let v=f;if(m){const{fieldChannel:y,offset:b}=m;v={...f,[y]:{...f[y],...b?{stack:b}:{}}}}return v=Pr(v,["y2","x2"]),p&&g.push({...o?{projection:o}:{},mark:{type:"line",...Zf(d,["clip","interpolate","tension","tooltip"]),...p},encoding:v}),h&&g.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...Zf(d,["clip","tooltip"]),...h},encoding:v}),r({...c,layer:g},{...n,config:n1e(i)})}}function i1e(e,t){return t?Bg(e)?iz(e,t):rz(e,t):e}function nx(e,t){return t?iz(e,t):e}function Zw(e,t,n){const r=t[e];if(z0e(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};oe(Lpe(r.repeat));return}return t}function rz(e,t){if(e=Zw("field",e,t),e!==void 0){if(e===null)return null;if(b3(e)&&ia(e.sort)){const n=Zw("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function QM(e,t){if(ue(e))return rz(e,t);{const n=Zw("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function e4(e,t){if(Ue(e)){const n=QM(e,t);if(n)return n;if(zg(e))return{condition:e.condition}}else{if(jg(e)){const n=QM(e.condition,t);if(n)return{...e,condition:n};{const{condition:r,...i}=e;return i}}return e}}function iz(e,t){const n={};for(const r in e)if(ie(e,r)){const i=e[r];if(Q(i))n[r]=i.map(s=>e4(s,t)).filter(s=>s);else{const s=e4(i,t);s!==void 0&&(n[r]=s)}}return n}class s1e{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(_a(t)){const{encoding:n,mark:r}=t;if(r==="line"||mo(r)&&r.type==="line")for(const i of epe){const s=yc(i),o=n[s];if(n[i]&&(ue(o)&&!Fn(o.bin)||Mo(o)))return!0}}return!1}run(t,n,r){const{encoding:i,mark:s}=t;return oe(ige(!!i.x2,!!i.y2)),r({...t,mark:ve(s)?{...s,type:"rule"}:"rule"},n)}}class o1e extends T3{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[ume,fme,yme,new r1e,new s1e]}map(t,n){if(_a(t)){const r=Sl(t.encoding,na),i=Sl(t.encoding,ra),s=Sl(t.encoding,Ly);if(r||i||s)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:r,parentProjection:i}=n,s=nx(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter(u=>u).join("_")}:{},...s?{encoding:s}:{}};if(r||i)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const u of this.nonFacetUnitNormalizers)if(u.hasMatchingType(o,n.config))return u.run(o,n,a);return o}mapRepeat(t,n){return Hme(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:r,spec:i,...s}=t,{row:o,column:a,layer:u}=r,{repeater:l={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:i}},n):{...s,layer:u.map(f=>{const d={...l,layer:f},h=`${(i.name?`${i.name}_`:"")+c}child__layer_${Ot(f)}`,p=this.mapLayerOrUnit(i,{...n,repeater:d,repeaterPrefix:h});return p.name=h,p})}}mapNonLayerRepeat(t,n){const{repeat:r,spec:i,data:s,...o}=t;!Q(r)&&t.columns&&(t=Pr(t,["columns"]),oe(TM("repeat")));const a=[],{repeater:u={},repeaterPrefix:l=""}=n,c=!Q(r)&&r.row||[u?u.row:null],f=!Q(r)&&r.column||[u?u.column:null],d=Q(r)&&r||[u?u.repeat:null];for(const p of d)for(const g of c)for(const m of f){const v={repeat:p,row:g,column:m,layer:u.layer},y=(i.name?`${i.name}_`:"")+l+"child__"+(Q(r)?`${Ot(p)}`:(r.row?`row_${Ot(g)}`:"")+(r.column?`column_${Ot(m)}`:"")),b=this.map(i,{...n,repeater:v,repeaterPrefix:y});b.name=y,a.push(Pr(b,["data"]))}const h=Q(r)?t.columns:r.column?r.column.length:1;return{data:i.data??s,align:"all",...o,columns:h,concat:a}}mapFacet(t,n){const{facet:r}=t;return Bg(r)&&t.columns&&(t=Pr(t,["columns"]),oe(TM("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:r,projection:i}=t,{parentEncoding:s,parentProjection:o,config:a}=n,u=n4({parentProjection:o,projection:i}),l=t4({parentEncoding:s,encoding:nx(r,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(t,n){const{row:r,column:i,facet:s,...o}=t.encoding,{mark:a,width:u,projection:l,height:c,view:f,params:d,encoding:h,...p}=t,{facetMapping:g,layout:m}=this.getFacetMappingAndLayout({row:r,column:i,facet:s},n),v=nx(o,n.repeater);return this.mapFacet({...p,...m,facet:g,spec:{...u?{width:u}:{},...c?{height:c}:{},...f?{view:f}:{},...l?{projection:l}:{},mark:a,encoding:v,...d?{params:d}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:r,column:i,facet:s}=t;if(r||i){s&&oe(nge([...r?[na]:[],...i?[ra]:[]]));const o={},a={};for(const u of[na,ra]){const l=t[u];if(l){const{align:c,center:f,spacing:d,columns:h,...p}=l;o[u]=p;for(const g of["align","center","spacing"])l[g]!==void 0&&(a[g]??(a[g]={}),a[g][u]=l[g])}}return{facetMapping:o,layout:a}}else{const{align:o,center:a,spacing:u,columns:l,...c}=s;return{facetMapping:i1e(c,n.repeater),layout:{...o?{align:o}:{},...a?{center:a}:{},...u?{spacing:u}:{},...l?{columns:l}:{}}}}}mapLayer(t,{parentEncoding:n,parentProjection:r,...i}){const{encoding:s,projection:o,...a}=t,u={...i,parentEncoding:t4({parentEncoding:n,encoding:s,layer:!0}),parentProjection:n4({parentProjection:r,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter(l=>l).join("_")}:{}},u)}}function t4({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){const i=new Set([...re(e),...re(t)]);for(const s of i){const o=t[s],a=e[s];if(Ue(o)){const u={...a,...o};r[s]=u}else jg(o)?r[s]={...o,condition:{...a,...o.condition}}:o||o===null?r[s]=o:(n||_s(a)||De(a)||Ue(a)||Q(a))&&(r[s]=a)}}else r=t;return!r||_t(r)?void 0:r}function n4(e){const{parentProjection:t,projection:n}=e;return t&&n&&oe(Hpe({parentProjection:t,projection:n})),n??t}function N3(e){return ie(e,"filter")}function a1e(e){return ie(e,"stop")}function sz(e){return ie(e,"lookup")}function u1e(e){return ie(e,"data")}function l1e(e){return ie(e,"param")}function c1e(e){return ie(e,"pivot")}function f1e(e){return ie(e,"density")}function d1e(e){return ie(e,"quantile")}function h1e(e){return ie(e,"regression")}function p1e(e){return ie(e,"loess")}function g1e(e){return ie(e,"sample")}function m1e(e){return ie(e,"window")}function v1e(e){return ie(e,"joinaggregate")}function y1e(e){return ie(e,"flatten")}function b1e(e){return ie(e,"calculate")}function oz(e){return ie(e,"bin")}function x1e(e){return ie(e,"impute")}function _1e(e){return ie(e,"timeUnit")}function w1e(e){return ie(e,"aggregate")}function E1e(e){return ie(e,"stack")}function A1e(e){return ie(e,"fold")}function S1e(e){return ie(e,"extent")&&!ie(e,"density")&&!ie(e,"regression")}function k1e(e){return e.map(t=>N3(t)?{filter:cf(t.filter,Zge)}:t)}class C1e extends T3{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=r4(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=r4(t,n),t.encoding){const r={};for(const[i,s]of mu(t.encoding))r[i]=az(s,n);t={...t,encoding:r}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:r,...i}=t;return r?{...i,params:mu(r).map(([s,o])=>{const{init:a,bind:u,empty:l,...c}=o;c.type==="single"?(c.type="point",c.toggle=!1):c.type==="multi"&&(c.type="point"),n.emptySelections[s]=l!=="none";for(const f of Pn(n.selectionPredicates[s]??{}))f.empty=l!=="none";return{name:s,value:a,select:c,bind:u}})}:t}}function r4(e,t){const{transform:n,...r}=e;if(n){const i=n.map(s=>{if(N3(s))return{filter:Jw(s,t)};if(oz(s)&&bc(s.bin))return{...s,bin:uz(s.bin)};if(sz(s)){const{selection:o,...a}=s.from;return o?{...s,from:{param:o,...a}}:s}return s});return{...r,transform:i}}return e}function az(e,t){var r,i;const n=ze(e);if(ue(n)&&bc(n.bin)&&(n.bin=uz(n.bin)),Ec(n)&&((i=(r=n.scale)==null?void 0:r.domain)!=null&&i.selection)){const{selection:s,...o}=n.scale.domain;n.scale.domain={...o,...s?{param:s}:{}}}if(zg(n))if(Q(n.condition))n.condition=n.condition.map(s=>{const{selection:o,param:a,test:u,...l}=s;return a?s:{...l,test:Jw(s,t)}});else{const{selection:s,param:o,test:a,...u}=az(n.condition,t);n.condition=o?n.condition:{...u,test:Jw(n.condition,t)}}return n}function uz(e){const t=e.extent;if(t!=null&&t.selection){const{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function Jw(e,t){const n=r=>cf(r,i=>{var s;const o=t.emptySelections[i]??!0,a={param:i,empty:o};return(s=t.selectionPredicates)[i]??(s[i]=[]),t.selectionPredicates[i].push(a),a});return e.selection?n(e.selection):cf(e.test||e.filter,r=>r.selection?n(r.selection):r)}class Qw extends T3{map(t,n){const r=n.selections??[];if(t.params&&!_a(t)){const i=[];for(const s of t.params)D3(s)?r.push(s):i.push(s);t.params=i}return n.selections=r,super.map(t,n)}mapUnit(t,n){const r=n.selections;if(!r||!r.length)return t;const i=(n.path??[]).concat(t.name),s=[];for(const o of r)if(!o.views||!o.views.length)s.push(o);else for(const a of o.views)(be(a)&&(a===t.name||i.includes(a))||Q(a)&&a.map(u=>i.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&s.push(o);return s.length&&(t.params=s),t}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=Qw.prototype[e];Qw.prototype[e]=function(n,r){return t.call(this,n,F1e(n,r))}}function F1e(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function lz(e,t){t===void 0&&(t=ez(e.config));const n=R1e(e,t),{width:r,height:i}=e,s=T1e(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...s?{autosize:s}:{}}}const $1e=new o1e,D1e=new C1e,M1e=new Qw;function R1e(e,t={}){const n={config:t};return M1e.map($1e.map(D1e.map(e,n),n),n)}function i4(e){return be(e)?{type:e}:e??{}}function T1e(e,t,n){let{width:r,height:i}=t;const s=_a(e)||sb(e),o={};s?r=="container"&&i=="container"?(o.type="fit",o.contains="padding"):r=="container"?(o.type="fit-x",o.contains="padding"):i=="container"&&(o.type="fit-y",o.contains="padding"):(r=="container"&&(oe($M("width")),r=void 0),i=="container"&&(oe($M("height")),i=void 0));const a={type:"pad",...o,...n?i4(n.autosize):{},...i4(e.autosize)};if(a.type==="fit"&&!s&&(oe(Spe),a.type="pad"),r=="container"&&!(a.type=="fit"||a.type=="fit-x")&&oe(DM("width")),i=="container"&&!(a.type=="fit"||a.type=="fit-y")&&oe(DM("height")),!ri(a,{type:"pad"}))return a}function N1e(e){return["fit","fit-x","fit-y"].includes(e)}function O1e(e){return e?`fit-${jy(e)}`:"fit"}const L1e=["background","padding"];function s4(e,t){const n={};for(const r of L1e)e&&e[r]!==void 0&&(n[r]=ti(e[r]));return t&&(n.params=e.params),n}class wa{constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new wa(ze(this.explicit),ze(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return Kt(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:r}){n!==void 0&&this.set(t,n,r)}set(t,n,r){return delete this[r?"implicit":"explicit"][t],this[r?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:r}){n[t]!==void 0?this.set(t,n[t],!0):r[t]!==void 0&&this.set(t,r[t],!1)}copyKeyFromObject(t,n){n[t]!==void 0&&this.set(t,n[t],!0)}copyAll(t){for(const n of re(t.combine())){const r=t.getWithExplicit(n);this.setWithExplicit(n,r)}}}function Us(e){return{explicit:!0,value:e}}function Kr(e){return{explicit:!1,value:e}}function cz(e){return(t,n,r,i)=>{const s=e(t.value,n.value);return s>0?t:s<0?n:ob(t,n,r,i)}}function ob(e,t,n,r){return e.explicit&&t.explicit&&oe(pge(n,r,e.value,t.value)),e}function bu(e,t,n,r,i=ob){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:ri(e.value,t.value)?e:i(e,t,n,r)}class I1e extends wa{constructor(t={},n={},r=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=r}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function od(e){return ie(e,"url")}function Lp(e){return ie(e,"values")}function fz(e){return ie(e,"name")&&!od(e)&&!Lp(e)&&!iu(e)}function iu(e){return e&&(dz(e)||hz(e)||O3(e))}function dz(e){return ie(e,"sequence")}function hz(e){return ie(e,"sphere")}function O3(e){return ie(e,"graticule")}var Bt;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"})(Bt||(Bt={}));function pz({invalid:e,isPath:t}){switch(lB(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function P1e(e){const{marks:t,scales:n}=pz(e);return t===n?Bt.Main:n==="include-invalid-values"?Bt.PreFilterInvalid:Bt.PostFilterInvalid}class bt{constructor(t,n){this.debugName=n,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){if(this._children.includes(t)){oe(Upe);return}n!==void 0?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const i of this._children)i.parent=t;this._children=[],t.removeChild(this);const r=t.parent.removeChild(t);this._parent=n,n.addChild(this,r),t.parent=this}}class Br extends bt{clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,r,i){super(t,n),this.type=r,this.refCounts=i,this._source=this._name=n,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${cP()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function rx(e){return e.as!==void 0}function o4(e){return`${e}_end`}class io extends bt{clone(){return new io(null,ze(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const r=n.reduceFieldDef((i,s,o)=>{const{field:a,timeUnit:u}=s;if(u){let l;if(wc(u)){if(Pt(n)){const{mark:c,markDef:f,config:d}=n,h=yu({fieldDef:s,markDef:f,config:d});(Op(c)||h)&&(l={timeUnit:_n(u),field:a})}}else l={as:ge(s,{forAs:!0}),field:a,timeUnit:u};if(Pt(n)){const{mark:c,markDef:f,config:d}=n,h=yu({fieldDef:s,markDef:f,config:d});Op(c)&&Zt(o)&&h!==.5&&(l.rectBandPosition=h)}l&&(i[et(l)]=l)}return i},{});return _t(r)?null:new io(t,r)}static makeFromTransform(t,n){const{timeUnit:r,...i}={...n},s=_n(r),o={...i,timeUnit:s};return new io(t,{[et(o)]:o})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[r,i]of mu(this.timeUnits)){const s=rx(i)?i.as:`${i.field}_end`;t.has(s)||(n[r]=i)}this.timeUnits=n}producedFields(){return new Set(Pn(this.timeUnits).map(t=>rx(t)?t.as:o4(t.field)))}dependentFields(){return new Set(Pn(this.timeUnits).map(t=>t.field))}hash(){return`TimeUnit ${et(this.timeUnits)}`}assemble(){const t=[];for(const n of Pn(this.timeUnits)){const{rectBandPosition:r}=n,i=_n(n.timeUnit);if(rx(n)){const{field:s,as:o}=n,{unit:a,utc:u,...l}=i,c=[o,`${o}_end`];t.push({field:Bi(s),type:"timeunit",...a?{units:Hy(a)}:{},...u?{timezone:"utc"}:{},...l,as:c}),t.push(...a4(c,r,i))}else if(n){const{field:s}=n,o=s.replaceAll("\\.","."),a=gz({timeUnit:i,field:o}),u=o4(o);t.push({type:"formula",expr:a,as:u}),t.push(...a4([o,u],r,i))}}return t}}const ab="offsetted_rect_start",ub="offsetted_rect_end";function gz({timeUnit:e,field:t,reverse:n}){const{unit:r,utc:i}=e,s=HP(r),{part:o,step:a}=XP(s,e.step);return`${i?"utcOffset":"timeOffset"}('${o}', ${mt(t)}, ${n?-a:a})`}function a4([e,t],n,r){if(n!==void 0&&n!==.5){const i=mt(e),s=mt(t);return[{type:"formula",expr:u4([gz({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${ab}`},{type:"formula",expr:u4([i,s],n+.5),as:`${e}_${ub}`}]}return[]}function u4([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const Wg="_tuple_fields";class B1e{constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const z1e={defined:()=>!0,parse:(e,t,n)=>{const r=t.name,i=t.project??(t.project=new B1e),s={},o={},a=new Set,u=(p,g)=>{const m=g==="visual"?p.channel:p.field;let v=Ot(`${r}_${m}`);for(let y=1;a.has(v);y++)v=Ot(`${r}_${m}_${y}`);return a.add(v),{[g]:v}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?xe(n.value):null;let{fields:d,encodings:h}=ve(n.select)?n.select:{};if(!d&&!h&&f){for(const p of f)if(ve(p))for(const g of re(p))Qhe(g)?(h||(h=[])).push(g):l==="interval"?(oe(Ope),h=c.encodings):(d??(d=[])).push(g)}!d&&!h&&(h=c.encodings,"fields"in c&&(d=c.fields));for(const p of h??[]){const g=e.fieldDef(p);if(g){let m=g.field;if(g.aggregate){oe(kpe(p,g.aggregate));continue}else if(!m){oe(RM(p));continue}if(g.timeUnit&&!wc(g.timeUnit)){m=e.vgField(p);const v={timeUnit:g.timeUnit,as:m,field:g.field};o[et(v)]=v}if(!s[m]){const v=l==="interval"&&Do(p)&&xs(e.getScaleComponent(p).get("type"))?"R":g.bin?"R-RE":"E",y={field:m,channel:p,type:v,index:i.items.length};y.signals={...u(y,"data"),...u(y,"visual")},i.items.push(s[m]=y),i.hasField[m]=s[m],i.hasSelectionId=i.hasSelectionId||m===Es,mP(p)?(y.geoChannel=p,y.channel=gP(p),i.hasChannel[y.channel]=s[m]):i.hasChannel[p]=s[m]}}else oe(RM(p))}for(const p of d??[]){if(i.hasField[p])continue;const g={type:"E",field:p,index:i.items.length};g.signals={...u(g,"data")},i.items.push(g),i.hasField[p]=g,i.hasSelectionId=i.hasSelectionId||p===Es}f&&(t.init=f.map(p=>i.items.map(g=>ve(p)?p[g.geoChannel||g.channel]!==void 0?p[g.geoChannel||g.channel]:p[g.field]:p))),_t(o)||(i.timeUnit=new io(null,o))},signals:(e,t,n)=>{const r=t.name+Wg;return n.filter(s=>s.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(bz)})}},mz="_curr",Em="anim_value",Vc="anim_clock",eE="eased_anim_clock",vz="min_extent",yz="max_range_extent",ix="last_tick_at",sx="is_playing",j1e=1/60*1e3,U1e=(e,t)=>[{name:eE,update:Vc},{name:`${e}_domain`,init:`domain('${t}')`},{name:vz,init:`extent(${e}_domain)[0]`},{name:yz,init:`extent(range('${t}'))[1]`},{name:Em,update:`invert('${t}', ${eE})`}],q1e={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(so(t)&&(n=n.concat([{name:Vc,init:"0",on:[{events:{type:"timer",throttle:j1e},update:`${sx} ? (${Vc} + (now() - ${ix}) > ${yz} ? 0 : ${Vc} + (now() - ${ix})) : ${Vc}`}]},{name:ix,init:"now()",on:[{events:[{signal:Vc},{signal:sx}],update:"now()"}]},{name:sx,init:"true"}])),n),signals:(e,t,n)=>{const r=t.name,i=r+Wg,s=t.project,o="(item().isVoronoi ? datum.datum : datum)",a=Pn(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+hf):c,[]).map(c=>`indexof(item().mark.name, '${c}') < 0`).join(" && "),u=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${a?` && ${a}`:""}`;let l=`unit: ${kl(e)}, `;if(t.project.hasSelectionId)l+=`${Es}: ${o}[${ce(Es)}]`;else if(so(t))l+=`fields: ${i}, values: [${Em} ? ${Em} : ${vz}]`;else{const c=s.items.map(f=>{const d=e.fieldDef(f.channel);return d!=null&&d.bin?`[${o}[${ce(e.vgField(f.channel,{}))}], ${o}[${ce(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${o}[${ce(f.field)}]`}).join(", ");l+=`fields: ${i}, values: [${c}]`}if(so(t))return n.concat(U1e(t.name,e.scaleName(Ru)),[{name:r+ha,on:[{events:[{signal:eE},{signal:Em}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:r+ha,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function bz(e){const{signals:t,hasLegend:n,index:r,...i}=e;return i.field=Bi(i.field),i}function nc(e,t=!0,n=rr){if(Q(e)){const r=e.map(i=>nc(i,t,n));return t?`[${r.join(", ")}]`:r}else if(_c(e))return n(t?Jl(e):Bge(e));return t?n(wt(e)):e}function W1e(e,t){for(const n of Pn(e.component.selection??{})){const r=n.name;let i=`${r}${ha}, ${n.resolve==="global"?"true":`{unit: ${kl(e)}}`}`;for(const s of cb)s.defined(n)&&(s.signals&&(t=s.signals(e,n,t)),s.modifyExpr&&(i=s.modifyExpr(e,n,i)));t.push({name:r+vve,on:[{events:{signal:n.name+ha},update:`modify(${ce(n.name+rc)}, ${i})`}]})}return L3(t)}function H1e(e,t){if(e.component.selection&&re(e.component.selection).length){const n=ce(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:Du("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return L3(t)}function G1e(e,t){let n=!1;for(const r of Pn(e.component.selection??{})){const i=r.name,s=ce(i+rc);if(t.filter(a=>a.name===i).length===0){const a=r.resolve==="global"?"union":r.resolve,u=r.type==="point"?", true, true)":")";t.push({name:r.name,update:`${Lz}(${s}, ${ce(a)}${u}`})}n=!0;for(const a of cb)a.defined(r)&&a.topLevelSignals&&(t=a.topLevelSignals(e,r,t))}return n&&t.filter(i=>i.name==="unit").length===0&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),L3(t)}function Y1e(e,t){const n=[],r=[],i=kl(e,{escape:!1});for(const s of Pn(e.component.selection??{})){const o={name:s.name+rc};if(s.project.hasSelectionId&&(o.transform=[{type:"collect",sort:{field:Es}}]),s.init){const u=s.project.items.map(bz);o.values=s.project.hasSelectionId?s.init.map(l=>({unit:i,[Es]:nc(l,!1)[0]})):s.init.map(l=>({unit:i,fields:u,values:nc(l,!1)}))}if([...n,...t].filter(u=>u.name===s.name+rc).length||n.push(o),so(s)&&t.length){const u=e.lookupDataSource(e.getDataName(Bt.Main)),l=t.find(f=>f.name===u),c=l.transform.find(f=>f.type==="filter"&&f.expr.includes("vlSelectionTest"));if(c){l.transform=l.transform.filter(d=>d!==c);const f={name:l.name+mz,source:l.name,transform:[c]};r.push(f)}}}return n.concat(t,r)}function xz(e,t){for(const n of Pn(e.component.selection??{}))for(const r of cb)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function V1e(e,t){for(const n of e.children)Pt(n)&&(t=xz(n,t));return t}function X1e(e,t,n,r){const i=Yz(e,t.param,t);return{signal:xs(n.get("type"))&&Q(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function L3(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const sa={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const n=t.scales=[];for(const r of t.project.items){const i=r.channel;if(!Do(i))continue;const s=e.getScaleComponent(i),o=s?s.get("type"):void 0;if(o=="sequential"&&oe(Dpe),!s||!xs(o)){oe($pe);continue}s.set("selectionExtent",{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{const r=t.scales.filter(o=>n.filter(a=>a.name===o.signals.data).length===0);if(!e.parent||nE(e)||r.length===0)return n;const i=n.find(o=>o.name===t.name);let s=i.update;if(s.includes(Lz))i.update=`{${r.map(o=>`${ce(Bi(o.field))}: ${o.signals.data}`).join(", ")}}`;else{for(const o of r){const a=`${ce(Bi(o.field))}: ${o.signals.data}`;s.includes(a)||(s=`${s.substring(0,s.length-1)}, ${a}}`)}i.update=s}return n.concat(r.map(o=>({name:o.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!nE(e))for(const r of t.scales){const i=n.find(s=>s.name===r.signals.data);i.push="outer",delete i.value,delete i.update}return n}};function tE(e,t){return`domain(${ce(e.scaleName(t))})`}function nE(e){return e.parent&&zd(e.parent)&&(!e.parent.parent||nE(e.parent.parent))}const hf="_brush",_z="_scale_trigger",dh="geo_interval_init_tick",wz="_init",K1e="_center",Z1e={defined:e=>e.type==="interval",parse:(e,t,n)=>{var r;if(e.hasProjection){const i={...ve(n.select)?n.select:{}};i.fields=[Es],i.encodings||(i.encodings=n.value?re(n.value):[Ds,$s]),n.select={type:"interval",...i}}if(t.translate&&!sa.defined(t)){const i=`!event.item || event.item.mark.name !== ${ce(t.name+hf)}`;for(const s of t.events){if(!s.between){oe(`${s} is not an ordered event stream for interval selections.`);continue}const o=xe((r=s.between[0]).filter??(r.filter=[]));o.includes(i)||o.push(i)}}},signals:(e,t,n)=>{const r=t.name,i=r+ha,s=Pn(t.project.hasChannel).filter(a=>a.channel===Lt||a.channel===Sn),o=t.init?t.init[0]:null;if(n.push(...s.reduce((a,u)=>a.concat(J1e(e,t,u,o&&o[u.index])),[])),e.hasProjection){const a=ce(e.projectionName()),u=e.projectionName()+K1e,{x:l,y:c}=t.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,h=l?o&&o[l.index]:`${u}[0]`,p=c?o&&o[c.index]:`${u}[1]`,g=_=>e.getSizeSignalRef(_).signal,m=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":g("width")}, ${d?d+"[1]":g("height")}]]`;o&&(n.unshift({name:r+wz,init:`[scale(${a}, [${l?h[0]:h}, ${c?p[0]:p}]), scale(${a}, [${l?h[1]:h}, ${c?p[1]:p}])]`}),(!l||!c)&&(n.find(A=>A.name===u)||n.unshift({name:u,update:`invert(${a}, [${g("width")}/2, ${g("height")}/2])`})));const v=`intersect(${m}, {markname: ${ce(e.getName("marks"))}}, unit.mark)`,y=`{unit: ${kl(e)}}`,b=`vlSelectionTuples(${v}, ${y})`,x=s.map(_=>_.signals.visual);return n.concat({name:i,on:[{events:[...x.length?[{signal:x.join(" || ")}]:[],...o?[{signal:dh}]:[]],update:b}]})}else{if(!sa.defined(t)){const l=r+_z,c=s.map(f=>{const d=f.channel,{data:h,visual:p}=f.signals,g=ce(e.scaleName(d)),m=e.getScaleComponent(d).get("type"),v=xs(m)?"+":"";return`(!isArray(${h}) || (${v}invert(${g}, ${p})[0] === ${v}${h}[0] && ${v}invert(${g}, ${p})[1] === ${v}${h}[1]))`});c.length&&n.push({name:l,value:{},on:[{events:s.map(f=>({scale:e.scaleName(f.channel)})),update:c.join(" && ")+` ? ${l} : {}`}]})}const a=s.map(l=>l.signals.data),u=`unit: ${kl(e)}, fields: ${r+Wg}, values`;return n.concat({name:i,...o?{init:`{${u}: ${nc(o)}}`}:{},...a.length?{on:[{events:[{signal:a.join(" || ")}],update:`${a.join(" && ")} ? {${u}: [${a}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(Pt(e)&&e.hasProjection&&t.init&&(n.filter(i=>i.name===dh).length||n.unshift({name:dh,value:null,on:[{events:"timer{1}",update:`${dh} === null ? {} : ${dh}`}]})),n),marks:(e,t,n)=>{const r=t.name,{x:i,y:s}=t.project.hasChannel,o=i==null?void 0:i.signals.visual,a=s==null?void 0:s.signals.visual,u=`data(${ce(t.name+rc)})`;if(sa.defined(t)||!i&&!s)return n;const l={x:i!==void 0?{signal:`${o}[0]`}:{value:0},y:s!==void 0?{signal:`${a}[0]`}:{value:0},x2:i!==void 0?{signal:`${o}[1]`}:{field:{group:"width"}},y2:s!==void 0?{signal:`${a}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const m of re(l))l[m]=[{test:`${u}.length && ${u}[0].unit === ${kl(e)}`,...l[m]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=re(h).reduce((m,v)=>(m[v]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,s!==void 0&&`${a}[0] !== ${a}[1]`].filter(y=>y).join(" && "),value:h[v]},{value:null}],m),{}),g=d??(t.translate?"move":null);return[{name:`${r+hf}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:r+hf,type:"rect",clip:!0,encode:{enter:{...g?{cursor:{value:g}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function J1e(e,t,n,r){const i=!e.hasProjection,s=n.channel,o=n.signals.visual,a=ce(i?e.scaleName(s):e.projectionName()),u=d=>`scale(${a}, ${d})`,l=e.getSizeSignalRef(s===Lt?"width":"height").signal,c=`${s}(unit)`,f=t.events.reduce((d,h)=>[...d,{events:h.between[0],update:`[${c}, ${c}]`},{events:h,update:`[${o}[0], clamp(${c}, 0, ${l})]`}],[]);if(i){const d=n.signals.data,h=sa.defined(t),p=e.getScaleComponent(s),g=p?p.get("type"):void 0,m=r?{init:nc(r,!0,u)}:{value:[]};return f.push({events:{signal:t.name+_z},update:xs(g)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),h?[{name:d,on:[]}]:[{name:o,...m,on:f},{name:d,...r?{init:nc(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${a}, ${o})`}]}]}else{const d=s===Lt?0:1,h=t.name+wz,p=r?{init:`[${h}[0][${d}], ${h}[1][${d}]]`}:{value:[]};return[{name:o,...p,on:f}]}}function Ld({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){const s=zg(t)&&t.condition;let o=[];s&&(o=xe(s).map(l=>{const c=i(l);if(B0e(l)){const{param:f,empty:d}=l;return{test:Gz(e,{param:f,empty:d}),...c}}else return{test:ov(e,l.test),...c}})),r!==void 0&&o.push(r);const a=i(t);return a!==void 0&&o.push(a),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function I3(e,t="text"){const n=e.encoding[t];return Ld({model:e,channelDef:n,vgChannel:t,mainRefFn:r=>lb(r,e.config),invalidValueRef:void 0})}function lb(e,t,n="datum"){if(e){if(_s(e))return Dt(e.value);if(Ue(e)){const{format:r,formatType:i}=Q1(e);return v3({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function Ez(e,t={}){const{encoding:n,markDef:r,config:i,stack:s}=e,o=n.tooltip;if(Q(o))return{tooltip:l4({tooltip:o},s,i,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return Ld({model:e,channelDef:o,vgChannel:"tooltip",mainRefFn:l=>{const c=lb(l,i,a);if(c)return c;if(l===null)return;let f=xt("tooltip",r,i);if(f===!0&&(f={content:"encoding"}),be(f))return{value:f};if(ve(f))return De(f)?f:f.content==="encoding"?l4(n,s,i,t):{signal:a}},invalidValueRef:void 0})}}function Az(e,t,n,{reactiveGeom:r}={}){const i={...n,...n.tooltipFormat},s=new Set,o=r?"datum.datum":"datum",a=[];function u(c,f){const d=yc(f),h=_r(c)?c:{...c,type:e[d].type},p=h.title||_3(h,i),g=xe(p).join(", ").replaceAll(/"/g,'\\"');let m;if(Zt(f)){const v=f==="x"?"x2":"y2",y=ws(e[v]);if(Fn(h.bin)&&y){const b=ge(h,{expr:o}),x=ge(y,{expr:o}),{format:_,formatType:A}=Q1(h);m=Pg(b,x,_,A,i),s.add(v)}}if((Zt(f)||f===Ui||f===Fs)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:v,formatType:y}=Q1(h);m=v3({fieldOrDatumDef:h,format:v,formatType:y,expr:o,config:i,normalizeStack:!0}).signal}m??(m=lb(h,i,o).signal),a.push({channel:f,key:g,value:m})}E3(e,(c,f)=>{ue(c)?u(c,f):Qy(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of a)!s.has(c)&&!l[f]&&(l[f]=d);return l}function l4(e,t,n,{reactiveGeom:r}={}){const i=Az(e,t,n,{reactiveGeom:r}),s=mu(i).map(([o,a])=>`"${o}": ${a}`);return s.length>0?{signal:`{${s.join(", ")}}`}:void 0}function Q1e(e){const{markDef:t,config:n}=e,r=xt("aria",t,n);return r===!1?{}:{...r?{aria:r}:{},...eve(e),...tve(e)}}function eve(e){const{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};const i=xt("ariaRoleDescription",n,r);return i!=null?{ariaRoleDescription:{value:i}}:_e(wpe,t)?{}:{ariaRoleDescription:{value:t}}}function tve(e){const{encoding:t,markDef:n,config:r,stack:i}=e,s=t.description;if(s)return Ld({model:e,channelDef:s,vgChannel:"description",mainRefFn:u=>lb(u,e.config),invalidValueRef:void 0});const o=xt("description",n,r);if(o!=null)return{description:Dt(o)};if(r.aria===!1)return{};const a=Az(t,i,r);if(!_t(a))return{description:{signal:mu(a).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function Rn(e,t,n={}){const{markDef:r,encoding:i,config:s}=t,{vgChannel:o}=n;let{defaultRef:a,defaultValue:u}=n;const l=i[e];a===void 0&&(u??(u=xt(e,r,s,{vgChannel:o,ignoreVgConfig:!zg(l)})),u!==void 0&&(a=Dt(u)));const c={markDef:r,config:s,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=fB({...c,scaleChannel:e,channelDef:l});return Ld({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:f,mainRefFn:h=>m3({...c,channel:e,channelDef:h,stack:null,defaultRef:a})})}function Sz(e,t={filled:void 0}){const{markDef:n,encoding:r,config:i}=e,{type:s}=n,o=t.filled??xt("filled",n,i),a=Ze(["bar","point","circle","square","geoshape"],s)?"transparent":void 0,u=xt(o===!0?"color":void 0,n,i,{vgChannel:"fill"})??i.mark[o===!0&&"color"]??a,l=xt(o===!1?"color":void 0,n,i,{vgChannel:"stroke"})??i.mark[o===!1&&"color"],c=o?"fill":"stroke",f={...u?{fill:Dt(u)}:{},...l?{stroke:Dt(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&oe(LP("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...Rn("color",e,{vgChannel:c,defaultValue:o?u:l}),...Rn("fill",e,{defaultValue:r.fill?u:void 0}),...Rn("stroke",e,{defaultValue:r.stroke?l:void 0})}}function nve(e){const{encoding:t,mark:n}=e,r=t.order;return!Pu(n)&&_s(r)?Ld({model:e,channelDef:r,vgChannel:"zindex",mainRefFn:i=>Dt(i.value),invalidValueRef:void 0}):{}}function ad({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){const s=`${e}Offset`,o=t[s],a=n[s];if((s==="xOffset"||s==="yOffset")&&a)return{offsetType:"encoding",offset:m3({channel:s,channelDef:a,markDef:t,config:r==null?void 0:r.config,scaleName:r.scaleName(s),scale:r.getScaleComponent(s),stack:null,defaultRef:Dt(o),bandPosition:i})};const u=t[s];return u?{offsetType:"visual",offset:u}:{}}function mr(e,t,{defaultPos:n,vgChannel:r}){const{encoding:i,markDef:s,config:o,stack:a}=t,u=i[e],l=i[$o(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=ad({channel:e,markDef:s,encoding:i,model:t,bandPosition:.5}),p=P3({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),g=!u&&Zt(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:rve({channel:e,channelDef:u,channel2Def:l,markDef:s,config:o,scaleName:c,scale:f,stack:a,offset:d,defaultRef:p,bandPosition:h==="encoding"?0:void 0});return g?{[r||e]:g}:void 0}function rve(e){const{channel:t,channelDef:n,scaleName:r,stack:i,offset:s,markDef:o}=e;if(Ue(n)&&i&&t===i.fieldChannel){if(ue(n)){let a=n.bandPosition;if(a===void 0&&o.type==="text"&&(t==="radius"||t==="theta")&&(a=.5),a!==void 0)return K1({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",bandPosition:a,offset:s})}return Al(n,r,{suffix:"end"},{offset:s})}return g3(e)}function P3({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){const{markDef:s,config:o}=e;return()=>{const a=yc(n),u=vu(n),l=xt(n,s,o,{vgChannel:u});if(l!==void 0)return sp(n,l);switch(t){case"zeroOrMin":return c4({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:a,config:o});case"zeroOrMax":return c4({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:a,config:o});case"mid":return{...e[Hr(n)],mult:.5}}}}function c4({mainChannel:e,config:t,...n}){const r=cB(n),{mode:i}=n;if(r)return r;switch(e){case"radius":{if(i==="zeroOrMin")return{value:0};const{widthSignal:s,heightSignal:o}=i.zeroOrMax;return{signal:`min(${s},${o})/2`}}case"theta":return i==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return i==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return i==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const ive={left:"x",center:"xc",right:"x2"},sve={top:"y",middle:"yc",bottom:"y2"};function kz(e,t,n,r="middle"){if(e==="radius"||e==="theta")return vu(e);const i=e==="x"?"align":"baseline",s=xt(i,t,n);let o;return De(s)?(oe(rge(i)),o=void 0):o=s,e==="x"?ive[o||(r==="top"?"left":"center")]:sve[o||r]}function rv(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?Cz(e,t,{defaultPos:n,defaultPos2:r}):mr(e,t,{defaultPos:n})}function Cz(e,t,{defaultPos:n,defaultPos2:r}){const{markDef:i,config:s}=t,o=$o(e),a=Hr(e),u=ove(t,r,o),l=u[a]?kz(e,i,s):vu(e);return{...mr(e,t,{defaultPos:n,vgChannel:l}),...u}}function ove(e,t,n){const{encoding:r,mark:i,markDef:s,stack:o,config:a}=e,u=yc(n),l=Hr(n),c=vu(n),f=r[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:p}=n in r||n in s?ad({channel:n,markDef:s,encoding:r,model:e}):ad({channel:u,markDef:s,encoding:r,model:e});if(!f&&(n==="x2"||n==="y2")&&(r.latitude||r.longitude)){const m=Hr(n),v=e.markDef[m];return v!=null?{[m]:{value:v}}:{[c]:{field:e.getName(n)}}}const g=ave({channel:n,channelDef:f,channel2Def:r[n],markDef:s,config:a,scaleName:d,scale:h,stack:o,offset:p,defaultRef:void 0});return g!==void 0?{[c]:g}:M0(n,s)||M0(n,{[n]:qw(n,s,a.style),[l]:qw(l,s,a.style)})||M0(n,a[i])||M0(n,a.mark)||{[c]:P3({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}function ave({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:s,scale:o,stack:a,offset:u,defaultRef:l}){return Ue(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0)?Al(t,s,{suffix:"start"},{offset:u}):g3({channel:e,channelDef:n,scaleName:s,scale:o,stack:a,markDef:r,config:i,offset:u,defaultRef:l})}function M0(e,t){const n=Hr(e),r=vu(e);if(t[r]!==void 0)return{[r]:sp(e,t[r])};if(t[e]!==void 0)return{[r]:sp(e,t[e])};if(t[n]){const i=t[n];if(ec(i))oe(Zpe(n));else return{[n]:sp(e,i)}}}function da(e,t){const{config:n,encoding:r,markDef:i}=e,s=i.type,o=$o(t),a=Hr(t),u=r[t],l=r[o],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=i.orient,h=r[a]??r.size??xt("size",i,n,{vgChannel:a}),p=xP(t),g=s==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||s==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return ue(u)&&(Ft(u.bin)||Fn(u.bin)||u.timeUnit&&!l)&&!(h&&!ec(h))&&!r[p]&&!En(f)?cve({fieldDef:u,fieldDef2:l,channel:t,model:e}):(Ue(u)&&En(f)||g)&&!l?lve(u,t,e):Cz(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function uve(e,t,n,r,i,s,o){if(ec(i))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;i.band!==1&&(l=`${i.band} * ${l}`);const c=go("minBandSize",{type:o},r);return{signal:c?`max(${fs(c)}, ${l})`:l}}else i.band!==1&&(oe(age(u)),i=void 0)}else return{mult:i.band,field:{group:e}};else{if(De(i))return i;if(i)return{value:i}}if(n){const u=n.get("range");if(xc(u)&&ut(u.step))return{value:u.step-2}}if(!s){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=r.scale,d=Kt(u,o==="tick"?f:o==="bar"?l:c);if(De(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(ut(d))return{signal:`${1-d} * ${e}`}}return{value:Kw(r.view,e)-2}}function lve(e,t,n){var k,F;const{markDef:r,encoding:i,config:s,stack:o}=n,a=r.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=Hr(t),f=$o(t),d=xP(t),h=n.scaleName(d),p=n.getScaleComponent(UC(t)),g=r.type==="tick"||a==="horizontal"&&t==="y"||a==="vertical"&&t==="x";let m;(i.size||r.size)&&(g?m=Rn("size",n,{vgChannel:c,defaultRef:Dt(r.size)}):oe(fge(r.type)));const v=!!m,y=yB({channel:t,fieldDef:e,markDef:r,config:s,scaleType:(k=l||p)==null?void 0:k.get("type"),useVlSizeChannel:g});m=m||{[c]:uve(c,h||u,p||l,s,y,!!e,r.type)};const b=((F=l||p)==null?void 0:F.get("type"))==="band"&&ec(y)&&!v?"top":"middle",x=kz(t,r,s,b),_=x==="xc"||x==="yc",{offset:A,offsetType:E}=ad({channel:t,markDef:r,encoding:i,model:n,bandPosition:_?.5:0}),S=g3({channel:t,channelDef:e,markDef:r,config:s,scaleName:u,scale:l,stack:o,offset:A,defaultRef:P3({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:_?E==="encoding"?0:.5:De(y)?{signal:`(1-${y})/2`}:ec(y)?(1-y.band)/2:0});if(c)return{[x]:S,...m};{const D=vu(f),M=m[c],T=A?{...M,offset:A}:M;return{[x]:S,[D]:Q(S)?[S[0],{...S[1],offset:T}]:{...S,offset:T}}}}function f4(e,t,n,r,i,s,o){if(pP(e))return 0;const a=e==="x"||e==="y2",u=a?-t/2:t/2;if(De(n)||De(i)||De(r)||s){const l=fs(n),c=fs(i),f=fs(r),d=fs(s),p=s?`(${o} < ${d} ? ${a?"":"-"}0.5 * (${d} - (${o})) : ${u})`:u,g=f?`${f} + `:"",m=l?`(${l} ? -1 : 1) * `:"",v=c?`(${c} + ${p})`:p;return{signal:g+m+v}}else return i=i||0,r+(n?-i-u:+i+u)}function cve({fieldDef:e,fieldDef2:t,channel:n,model:r}){var F;const{config:i,markDef:s,encoding:o}=r,a=r.getScaleComponent(n),u=r.scaleName(n),l=a?a.get("type"):void 0,c=a.get("reverse"),f=yB({channel:n,fieldDef:e,markDef:s,config:i,scaleType:l}),d=(F=r.component.axes[n])==null?void 0:F[0],h=(d==null?void 0:d.get("translate"))??.5,p=Zt(n)?xt("binSpacing",s,i)??0:0,g=$o(n),m=vu(n),v=vu(g),y=go("minBandSize",s,i),{offset:b}=ad({channel:n,markDef:s,encoding:o,model:r,bandPosition:0}),{offset:x}=ad({channel:g,markDef:s,encoding:o,model:r,bandPosition:0}),_=T0e({fieldDef:e,scaleName:u}),A=f4(n,p,c,h,b,y,_),E=f4(g,p,c,h,x??b,y,_),S=De(f)?{signal:`(1-${f.signal})/2`}:ec(f)?(1-f.band)/2:.5,k=yu({fieldDef:e,fieldDef2:t,markDef:s,config:i});if(Ft(e.bin)||e.timeUnit){const D=e.timeUnit&&k!==.5;return{[v]:d4({fieldDef:e,scaleName:u,bandPosition:S,offset:E,useRectOffsetField:D}),[m]:d4({fieldDef:e,scaleName:u,bandPosition:De(S)?{signal:`1-${S.signal}`}:1-S,offset:A,useRectOffsetField:D})}}else if(Fn(e.bin)){const D=Al(e,u,{},{offset:E});if(ue(t))return{[v]:D,[m]:Al(t,u,{},{offset:A})};if(bc(e.bin)&&e.bin.step)return{[v]:D,[m]:{signal:`scale("${u}", ${ge(e,{expr:"datum"})} + ${e.bin.step})`,offset:A}}}oe(BP(g))}function d4({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return K1({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:ab,endSuffix:ub}:{}})}const fve=new Set(["aria","width","height"]);function qi(e,t){const{fill:n=void 0,stroke:r=void 0}=t.color==="include"?Sz(e):{};return{...dve(e.markDef,t),...h4("fill",n),...h4("stroke",r),...Rn("opacity",e),...Rn("fillOpacity",e),...Rn("strokeOpacity",e),...Rn("strokeWidth",e),...Rn("strokeDash",e),...nve(e),...Ez(e),...I3(e,"href"),...Q1e(e)}}function h4(e,t){return t?{[e]:t}:{}}function dve(e,t){return _pe.reduce((n,r)=>(!fve.has(r)&&ie(e,r)&&t[r]!=="ignore"&&(n[r]=Dt(e[r])),n),{})}function B3(e){const{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,s)=>{var l;let o;if(!Do(s)||!(o=e.getScaleType(s)))return;const a=Uy(i.aggregate),u=p3({scaleChannel:s,markDef:n,config:t,scaleType:o,isCountAggregate:a});if(D0e(u)){const c=e.vgField(s,{expr:"datum",binSuffix:(l=e.stack)!=null&&l.impute?"mid":void 0});c&&r.add(c)}}),r.size>0)return{defined:{signal:[...r].map(s=>Gy(s,!0)).join(" && ")}}}function p4(e,t){if(t!==void 0)return{[e]:Dt(t)}}const ox="voronoi",Fz={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(ox)},marks:(e,t,n)=>{const{x:r,y:i}=t.project.hasChannel,s=e.mark;if(Pu(s))return oe(Cpe(s)),n;const o={name:e.getName(ox),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Ez(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((l,c)=>{const f=l.name??"";f===e.component.mark[0].name?a=c:f.includes(ox)&&(u=!0)}),u||n.splice(a+1,0,o),n}},$z={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!$3(e.bind),parse:(e,t,n)=>Iz(t,n),topLevelSignals:(e,t,n)=>{const r=t.name,i=t.project,s=t.bind,o=t.init&&t.init[0],a=Fz.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((u,l)=>{const c=Ot(`${r}_${u.field}`);n.filter(d=>d.name===c).length||n.unshift({name:c,...o?{init:nc(o[l])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${ce(u.field)}] : null`}]:[],bind:s[u.field]??s[u.channel]??s})}),n},signals:(e,t,n)=>{const r=t.name,i=t.project,s=n.find(l=>l.name===r+ha),o=r+Wg,a=i.items.map(l=>Ot(`${r}_${l.field}`)),u=a.map(l=>`${l} !== null`).join(" && ");return a.length&&(s.update=`${u} ? {fields: ${o}, values: [${a.join(", ")}]} : null`),delete s.value,delete s.on,n}},iv="_toggle",Dz={defined:e=>e.type==="point"&&!so(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+iv,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+ha,r=t.name+iv;return`${r} ? null : ${n}, `+(t.resolve==="global"?`${r} ? null : true, `:`${r} ? null : {unit: ${kl(e)}}, `)+`${r} ? ${n} : null`}},hve={defined:e=>e.clear!==void 0&&e.clear!==!1&&!so(e),parse:(e,t)=>{t.clear&&(t.clear=be(t.clear)?Du(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if($z.defined(t))for(const r of t.project.items){const i=n.findIndex(s=>s.name===Ot(`${t.name}_${r.field}`));i!==-1&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function r(i,s){i!==-1&&n[i].on&&n[i].on.push({events:t.clear,update:s})}if(t.type==="interval")for(const i of t.project.items){const s=n.findIndex(o=>o.name===i.signals.visual);if(r(s,"[0, 0]"),s===-1){const o=n.findIndex(a=>a.name===i.signals.data);r(o,"null")}}else{let i=n.findIndex(s=>s.name===t.name+ha);r(i,"null"),Dz.defined(t)&&(i=n.findIndex(s=>s.name===t.name+iv),r(i,"false"))}return n}},Mz={defined:e=>{const t=e.resolve==="global"&&e.bind&&$3(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==Es;return t&&!n&&oe(Mpe),t&&n},parse:(e,t,n)=>{const r=ze(n);if(r.select=be(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},Iz(t,r),ve(n.select)&&(n.select.on||n.select.clear)){const o='event.item && indexof(event.item.mark.role, "legend") < 0';for(const a of t.events)a.filter=xe(a.filter??[]),a.filter.includes(o)||a.filter.push(o)}const i=ex(t.bind)?t.bind.legend:"click",s=be(i)?Du(i,"view"):xe(i);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const r=t.name,i=ex(t.bind)&&t.bind.legend,s=o=>a=>{const u=ze(a);return u.markname=o,u};for(const o of t.project.items){if(!o.hasLegend)continue;const a=`${Ot(o.field)}_legend`,u=`${r}_${a}`;if(n.filter(c=>c.name===u).length===0){const c=i.merge.map(s(`${a}_symbols`)).concat(i.merge.map(s(`${a}_labels`))).concat(i.merge.map(s(`${a}_entries`)));n.unshift({name:u,...t.init?{}:{value:null},on:[{events:c,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return n},signals:(e,t,n)=>{const r=t.name,i=t.project,s=n.find(d=>d.name===r+ha),o=r+Wg,a=i.items.filter(d=>d.hasLegend).map(d=>Ot(`${r}_${Ot(d.field)}_legend`)),l=`${a.map(d=>`${d} !== null`).join(" && ")} ? {fields: ${o}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?s.on.push({events:a.map(d=>({signal:d})),update:l}):a.length>0&&(s.update=l,delete s.value,delete s.on);const c=n.find(d=>d.name===r+iv),f=ex(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function pve(e,t,n){var i;const r=(i=e.fieldDef(t))==null?void 0:i.field;for(const s of Pn(e.component.selection??{})){const o=s.project.hasField[r]??s.project.hasChannel[t];if(o&&Mz.defined(s)){const a=n.get("selections")??[];a.push(s.name),n.set("selections",a,!1),o.hasLegend=!0}}}const Rz="_translate_anchor",Tz="_translate_delta",gve={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const r=t.name,i=sa.defined(t),s=r+Rz,{x:o,y:a}=t.project.hasChannel;let u=Du(t.translate,"scope");return i||(u=u.map(l=>(l.between[0].markname=r+hf,l))),n.push({name:s,value:{},on:[{events:u.map(l=>l.between[0]),update:"{x: x(unit), y: y(unit)"+(o!==void 0?`, extent_x: ${i?tE(e,Lt):`slice(${o.signals.visual})`}`:"")+(a!==void 0?`, extent_y: ${i?tE(e,Sn):`slice(${a.signals.visual})`}`:"")+"}"}]},{name:r+Tz,value:{},on:[{events:u,update:`{x: ${s}.x - x(unit), y: ${s}.y - y(unit)}`}]}),o!==void 0&&g4(e,t,o,"width",n),a!==void 0&&g4(e,t,a,"height",n),n}};function g4(e,t,n,r,i){const s=t.name,o=s+Rz,a=s+Tz,u=n.channel,l=sa.defined(t),c=i.find(_=>_.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(r).signal,d=e.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),g=l?u===Lt?p?"":"-":p?"-":"":"",m=`${o}.extent_${u}`,v=`${g}${a}.${u} / ${l?`${f}`:`span(${m})`}`,y=!l||!d?"panLinear":h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear",b=l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":"",x=`${y}(${m}, ${v}${b})`;c.on.push({events:{signal:a},update:l?x:`clampRange(${x}, 0, ${f})`})}const Nz="_zoom_anchor",Oz="_zoom_delta",mve={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const r=t.name,i=sa.defined(t),s=r+Oz,{x:o,y:a}=t.project.hasChannel,u=ce(e.scaleName(Lt)),l=ce(e.scaleName(Sn));let c=Du(t.zoom,"scope");return i||(c=c.map(f=>(f.markname=r+hf,f))),n.push({name:r+Nz,on:[{events:c,update:i?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:s,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),o!==void 0&&m4(e,t,o,"width",n),a!==void 0&&m4(e,t,a,"height",n),n}};function m4(e,t,n,r,i){const s=t.name,o=n.channel,a=sa.defined(t),u=i.find(y=>y.name===n.signals[a?"data":"visual"]),l=e.getSizeSignalRef(r).signal,c=e.getScaleComponent(o),f=c&&c.get("type"),d=a?tE(e,o):u.name,h=s+Oz,p=`${s}${Nz}.${o}`,g=!a||!c?"zoomLinear":f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear",m=a?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":"",v=`${g}(${d}, ${p}, ${h}${m})`;u.on.push({events:{signal:h},update:a?v:`clampRange(${v}, 0, ${l})`})}const rc="_store",ha="_tuple",vve="_modify",Lz="vlSelectionResolve",cb=[q1e,Z1e,z1e,Dz,$z,sa,Mz,hve,gve,mve,Fz];function yve(e){let t=e.parent;for(;t&&!ui(t);)t=t.parent;return t}function kl(e,{escape:t}={escape:!0}){let n=t?ce(e.name):e.name;const r=yve(e);if(r){const{facet:i}=r;for(const s of Ci)i[s]&&(n+=` + '__facet_${s}_' + (facet[${ce(r.vgField(s))}])`)}return n}function z3(e){return Pn(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function Iz(e,t){(be(t.select)||!t.select.on)&&delete e.events,(be(t.select)||!t.select.clear)&&delete e.clear,(be(t.select)||!t.select.toggle)&&delete e.toggle}function so(e){var t;return(t=e.events)==null?void 0:t.find(n=>"type"in n&&n.type==="timer")}const bve="RawCode",xve="Literal",_ve="Property",wve="Identifier",Eve="ArrayExpression",Ave="BinaryExpression",Sve="CallExpression",kve="ConditionalExpression",Cve="LogicalExpression",Fve="MemberExpression",$ve="ObjectExpression",Dve="UnaryExpression";function Rs(e){this.type=e}Rs.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=Mve(this),n=0,r=t.length;n";Ro[ic]="Identifier";Ro[Bu]="Keyword";Ro[db]="Null";Ro[Ac]="Numeric";Ro[Rr]="Punctuator";Ro[Gg]="String";Ro[Rve]="RegularExpression";var Tve="ArrayExpression",Nve="BinaryExpression",Ove="CallExpression",Lve="ConditionalExpression",Pz="Identifier",Ive="Literal",Pve="LogicalExpression",Bve="MemberExpression",zve="ObjectExpression",jve="Property",Uve="UnaryExpression",xn="Unexpected token %0",qve="Unexpected number",Wve="Unexpected string",Hve="Unexpected identifier",Gve="Unexpected reserved word",Yve="Unexpected end of input",rE="Invalid regular expression",ax="Invalid regular expression: missing /",Bz="Octal literals are not allowed in strict mode.",Vve="Duplicate data property in object literal not allowed in strict mode",On="ILLEGAL",Ip="Disabled.",Xve=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Kve=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function hb(e,t){if(!e)throw new Error("ASSERT: "+t)}function Uo(e){return e>=48&&e<=57}function j3(e){return"0123456789abcdefABCDEF".includes(e)}function op(e){return"01234567".includes(e)}function Zve(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function Pp(e){return e===10||e===13||e===8232||e===8233}function Yg(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Xve.test(String.fromCharCode(e))}function sv(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Kve.test(String.fromCharCode(e))}const Jve={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function zz(){for(;J1114111||e!=="}")&&at({},xn,On),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function jz(){var e,t;for(e=$e.charCodeAt(J++),t=String.fromCharCode(e),e===92&&($e.charCodeAt(J)!==117&&at({},xn,On),++J,e=iE("u"),(!e||e==="\\"||!Yg(e.charCodeAt(0)))&&at({},xn,On),t=e);J>>=")return J+=4,{type:Rr,value:o,start:e,end:J};if(s=o.substr(0,3),s===">>>"||s==="<<="||s===">>=")return J+=3,{type:Rr,value:s,start:e,end:J};if(i=s.substr(0,2),r===i[1]&&"+-<>&|".includes(r)||i==="=>")return J+=2,{type:Rr,value:i,start:e,end:J};if(i==="//"&&at({},xn,On),"<>=!+-*%&|^/".includes(r))return++J,{type:Rr,value:r,start:e,end:J};at({},xn,On)}function nye(e){let t="";for(;J{if(parseInt(i,16)<=1114111)return"x";at({},rE)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{at({},rE)}try{return new RegExp(e,t)}catch{return null}}function oye(){var e,t,n,r,i;for(e=$e[J],hb(e==="/","Regular expression literal must start with a slash"),t=$e[J++],n=!1,r=!1;J=0&&at({},rE,n),{value:n,literal:t}}function uye(){var e,t,n,r;return yt=null,zz(),e=J,t=oye(),n=aye(),r=sye(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:J}}function lye(e){return e.type===ic||e.type===Bu||e.type===fb||e.type===db}function Uz(){if(zz(),J>=tr)return{type:Hg,start:J,end:J};const e=$e.charCodeAt(J);return Yg(e)?tye():e===40||e===41||e===59?ux():e===39||e===34?iye():e===46?Uo($e.charCodeAt(J+1))?v4():ux():Uo(e)?v4():ux()}function Or(){const e=yt;return J=e.end,yt=Uz(),J=e.end,e}function qz(){const e=J;yt=Uz(),J=e}function cye(e){const t=new Rs(Tve);return t.elements=e,t}function y4(e,t,n){const r=new Rs(e==="||"||e==="&&"?Pve:Nve);return r.operator=e,r.left=t,r.right=n,r}function fye(e,t){const n=new Rs(Ove);return n.callee=e,n.arguments=t,n}function dye(e,t,n){const r=new Rs(Lve);return r.test=e,r.consequent=t,r.alternate=n,r}function U3(e){const t=new Rs(Pz);return t.name=e,t}function Bh(e){const t=new Rs(Ive);return t.value=e.value,t.raw=$e.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function b4(e,t,n){const r=new Rs(Bve);return r.computed=e==="[",r.object=t,r.property=n,r.computed||(n.member=!0),r}function hye(e){const t=new Rs(zve);return t.properties=e,t}function x4(e,t,n){const r=new Rs(jve);return r.key=t,r.value=n,r.kind=e,r}function pye(e,t){const n=new Rs(Uve);return n.operator=e,n.argument=t,n.prefix=!0,n}function at(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(s,o)=>(hb(o":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function kye(){var e,t,n,r,i,s,o,a,u,l;if(e=yt,u=Am(),r=yt,i=E4(r),i===0)return u;for(r.prec=i,Or(),t=[e,yt],o=Am(),s=[u,r,o];(i=E4(yt))>0;){for(;s.length>2&&i<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,u=s.pop(),t.pop(),n=y4(a,u,o),s.push(n);r=Or(),r.prec=i,s.push(r),t.push(yt),n=Am(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=y4(s[l-1].value,s[l-2],n),l-=2;return n}function sc(){var e,t,n;return e=kye(),Mt("?")&&(Or(),t=sc(),nr(":"),n=sc(),e=dye(e,t,n)),e}function q3(){const e=sc();if(Mt(","))throw new Error(Ip);return e}function Cye(e){$e=e,J=0,tr=$e.length,yt=null,qz();const t=q3();if(yt.type!==Hg)throw new Error("Unexpect token after expression.");return t}function sE(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...sE(e.object)),t.push(...sE(e.property))),t)}function Wz(e){return e.object.type==="MemberExpression"?Wz(e.object):e.object.name==="datum"}function Hz(e){const t=Cye(e),n=new Set;return t.visit(r=>{r.type==="MemberExpression"&&Wz(r)&&n.add(sE(r).slice(1).join("."))}),n}class Id extends bt{clone(){return new Id(null,this.model,ze(this.filter))}constructor(t,n,r){super(t),this.model=n,this.filter=r,this.expr=ov(this.model,this.filter,this),this._dependentFields=Hz(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Fye(e,t){const n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(const s of t){const o=Ot(s.name),a=s.select,u=be(a)?a:a.type,l=ve(a)?ze(a):{type:u},c=r[u];for(const h in c)h==="fields"||h==="encodings"||(h==="mark"&&(l.mark={...c.mark,...l.mark}),(l[h]===void 0||l[h]===!0)&&(l[h]=ze(c[h]??l[h])));const f=n[o]={...l,name:o,type:u,init:s.value,bind:s.bind,events:be(l.on)?Du(l.on,"scope"):xe(ze(l.on))};if(so(f)&&(i++,i>1)){delete n[o];continue}const d=ze(s);for(const h of cb)h.defined(f)&&h.parse&&h.parse(e,f,d)}return i>1&&oe(Ipe),n}function Gz(e,t,n,r="datum"){const i=be(t)?t:t.param,s=Ot(i),o=ce(s+rc);let a;try{a=e.getSelectionComponent(s,i)}catch{return`!!${s}`}if(a.project.timeUnit){const d=n??e.component.data.raw,h=a.project.timeUnit.clone();d.parent?h.insertAsParentOf(d):d.parent=h}const u=a.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",l=a.resolve==="global"?")":`, ${ce(a.resolve)})`,c=`${u}${o}, ${r}${l}`,f=`length(data(${o}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function Yz(e,t,n){const r=Ot(t),i=n.encoding;let s=n.field,o;try{o=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!s)s=o.project.items[0].field,o.project.items.length>1&&oe(Ppe(s));else if(i&&!s){const a=o.project.items.filter(u=>u.channel===i);!a.length||a.length>1?(s=o.project.items[0].field,oe(Bpe(a,i,n,s))):s=a[0].field}return`${o.name}[${ce(Bi(s))}]`}function $ye(e,t){for(const[n,r]of mu(e.component.selection??{})){const i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new Br(new Id(t,e,{param:n}),i,Bt.Lookup,e.component.data.outputNodeRefCounts)}}function ov(e,t,n){return ip(t,r=>be(r)?r:Vge(r)?Gz(e,r,n):ZP(r))}function Dye(e,t){if(e)return Q(e)&&!Oa(e)?e.map(n=>_3(n,t)).join(", "):e}function cx(e,t,n,r){var i,s;e.encode??(e.encode={}),(i=e.encode)[t]??(i[t]={}),(s=e.encode[t]).update??(s.update={}),e.encode[t].update[n]=r}function zh(e,t,n,r={header:!1}){var f,d;const{disable:i,orient:s,scale:o,labelExpr:a,title:u,zindex:l,...c}=e.combine();if(!i){for(const h in c){const p=h,g=Q0e[p],m=c[p];if(g&&g!==t&&g!=="both")delete c[p];else if(qg(m)){const{condition:v,...y}=m,b=xe(v),x=WM[p];if(x){const{vgProp:_,part:A}=x,E=[...b.map(S=>{const{test:k,...F}=S;return{test:ov(null,k),...F}}),y];cx(c,A,_,E),delete c[p]}else if(x===null){const _={signal:b.map(A=>{const{test:E,...S}=A;return`${ov(null,E)} ? ${FM(S)} : `}).join("")+FM(y)};c[p]=_}}else if(De(m)){const v=WM[p];if(v){const{vgProp:y,part:b}=v;cx(c,b,y,m),delete c[p]}}Ze(["labelAlign","labelBaseline"],p)&&c[p]===null&&delete c[p]}if(t==="grid"){if(!c.grid)return;if(c.encode){const{grid:h}=c.encode;c.encode={...h?{grid:h}:{}},_t(c.encode)&&delete c.encode}return{scale:o,orient:s,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Kt(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(a!==void 0){let p=a;(d=(f=c.encode)==null?void 0:f.labels)!=null&&d.update&&De(c.encode.labels.update.text)&&(p=Xl(a,"datum.label",c.encode.labels.update.text.signal)),cx(c,"labels","text",{signal:p})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const p of FB)e.hasAxisPart(p)||delete c.encode[p];_t(c.encode)&&delete c.encode}const h=Dye(u,n);return{scale:o,orient:s,grid:!1,...h?{title:h}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:Kt(l,0)}}}}function Vz(e){const{axes:t}=e.component,n=[];for(const r of xa)if(t[r]){for(const i of t[r])if(!i.get("disable")&&!i.get("gridScale")){const s=r==="x"?"height":"width",o=e.getSizeSignalRef(s).signal;s!==o&&n.push({name:s,update:o})}}return n}function Mye(e,t){const{x:n=[],y:r=[]}=e;return[...n.map(i=>zh(i,"grid",t)),...r.map(i=>zh(i,"grid",t)),...n.map(i=>zh(i,"main",t)),...r.map(i=>zh(i,"main",t))].filter(i=>i)}function A4(e,t,n,r){return Object.assign.apply(null,[{},...e.map(i=>{if(i==="axisOrient"){const s=n==="x"?"bottom":"left",o=t[n==="x"?"axisBottom":"axisLeft"]||{},a=t[n==="x"?"axisTop":"axisRight"]||{},u=new Set([...re(o),...re(a)]),l={};for(const c of u.values())l[c]={signal:`${r.signal} === "${s}" ? ${fs(o[c])} : ${fs(a[c])}`};return l}return t[i]})])}function Rye(e,t,n,r){const i=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:tB(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],s=e==="x"?"axisX":"axisY",o=De(n)?"axisOrient":`axis${Rg(n)}`,a=[...i,...i.map(l=>s+l.substr(4))],u=["axis",o,s];return{vlOnlyAxisConfig:A4(a,r,e,n),vgAxisConfig:A4(u,r,e,n),axisConfigStyle:Tye([...u,...a],r)}}function Tye(e,t){var r;const n=[{}];for(const i of e){let s=(r=t[i])==null?void 0:r.style;if(s){s=xe(s);for(const o of s)n.push(t.style[o])}}return Object.assign.apply(null,n)}function oE(e,t,n,r={}){var s;const i=$P(e,n,t);if(i!==void 0)return{configFrom:"style",configValue:i};for(const o of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((s=r[o])==null?void 0:s[e])!==void 0)return{configFrom:o,configValue:r[o][e]};return{}}const S4={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??Nye(n,e),gridScale:({model:e,channel:t})=>Oye(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||Kz(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||Xz(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??Iye(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??Pye(t.type,n,ue(t)&&!!t.timeUnit,ue(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{const s=e==="x"?"width":e==="y"?"height":void 0,o=s?t.getSizeSignalRef(s):void 0;return n.tickCount??zye({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:jye,title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const r=Zz(t,n);if(r!==void 0)return r;const i=t.typedFieldDef(n),s=n==="x"?"x2":"y2",o=t.fieldDef(s);return MP(i?[UM(i)]:[],ue(o)?[UM(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>Uye(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??qye(n,t)};function Nye(e,t){return!En(e)&&ue(t)&&!Ft(t==null?void 0:t.bin)&&!Fn(t==null?void 0:t.bin)}function Oye(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function Lye(e,t,n,r,i){const s=t==null?void 0:t.labelAngle;if(s!==void 0)return De(s)?s:Np(s);{const{configValue:o}=oE("labelAngle",r,t==null?void 0:t.style,i);return o!==void 0?Np(o):n===Lt&&Ze([l3,u3],e.type)&&!(ue(e)&&e.timeUnit)?270:void 0}}function aE(e){return`(((${e.signal} % 360) + 360) % 360)`}function Xz(e,t,n,r){if(e!==void 0)if(n==="x"){if(De(e)){const i=aE(e),s=De(t)?`(${t.signal} === "top")`:t==="top";return{signal:`(45 < ${i} && ${i} < 135) || (225 < ${i} && ${i} < 315) ? "middle" :(${i} <= 45 || 315 <= ${i}) === ${s} ? "bottom" : "top"`}}if(45{if(Ec(r)&&vB(r.sort)){const{field:s,timeUnit:o}=r,a=r.sort,u=a.map((l,c)=>`${ZP({field:s,timeUnit:o,equal:l})} ? ${c} : `).join("")+a.length;t=new ud(t,{calculate:u,as:ld(r,i,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${et(this.transform)}`}}function ld(e,t,n){return ge(e,{prefix:t,suffix:"sort_index",...n})}function gb(e,t){return Ze(["top","bottom"],t)?"column":Ze(["left","right"],t)||e==="row"?"row":"column"}function cd(e,t,n,r){const i=r==="row"?n.headerRow:r==="column"?n.headerColumn:n.headerFacet;return Kt((t||{})[e],i[e],n.header[e])}function mb(e,t,n,r){const i={};for(const s of e){const o=cd(s,t||{},n,r);o!==void 0&&(i[s]=o)}return i}const W3=["row","column"],H3=["header","footer"];function Wye(e,t){const n=e.component.layoutHeaders[t].title,r=e.config?e.config:void 0,i=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:s,titleAngle:o,titleOrient:a}=mb(["titleAnchor","titleAngle","titleOrient"],i.header,r,t),u=gb(t,a),l=Np(o);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...Qz(l,u),...Jz(u,l,s),...ej(r,i,t,_me,GB)}}}function Jz(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const r=Kz(t,e==="row"?"left":"top",e==="row"?"y":"x");return r?{align:r}:{}}function Qz(e,t){const n=Xz(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function Hye(e,t){const n=e.component.layoutHeaders[t],r=[];for(const i of H3)if(n[i])for(const s of n[i]){const o=Yye(e,t,i,n,s);o!=null&&r.push(o)}return r}function Gye(e,t){const{sort:n}=e;return ia(n)?{field:ge(n,{expr:"datum"}),order:n.order??"ascending"}:Q(n)?{field:ld(e,t,{expr:"datum"}),order:"ascending"}:{field:ge(e,{expr:"datum"}),order:n??"ascending"}}function uE(e,t,n){const{format:r,formatType:i,labelAngle:s,labelAnchor:o,labelOrient:a,labelExpr:u}=mb(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=v3({fieldOrDatumDef:e,format:r,formatType:i,expr:"parent",config:n}).signal,c=gb(t,a);return{text:{signal:u?Xl(Xl(u,"datum.label",l),"datum.value",ge(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...Qz(s,c),...Jz(c,s,o),...ej(n,e,t,wme,YB)}}function Yye(e,t,n,r,i){if(i){let s=null;const{facetFieldDef:o}=r,a=e.config?e.config:void 0;if(o&&i.labels){const{labelOrient:f}=mb(["labelOrient"],o.header,a,t);(t==="row"&&!Ze(["top","bottom"],f)||t==="column"&&!Ze(["left","right"],f))&&(s=uE(o,t,a))}const u=ui(e)&&!Bg(e.facet),l=i.axes,c=(l==null?void 0:l.length)>0;if(s||c){const f=t==="row"?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:Gye(o,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...s?{title:s}:{},...i.sizeSignal?{encode:{update:{[f]:i.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const Vye={column:{start:0,end:1},row:{start:1,end:0}};function Xye(e,t){return Vye[t][e]}function Kye(e,t){const n={};for(const r of Ci){const i=e[r];if(i!=null&&i.facetFieldDef){const{titleAnchor:s,titleOrient:o}=mb(["titleAnchor","titleOrient"],i.facetFieldDef.header,t,r),a=gb(r,o),u=Xye(s,a);u!==void 0&&(n[a]=u)}}return _t(n)?void 0:n}function ej(e,t,n,r,i){const s={};for(const o of r){if(!i[o])continue;const a=cd(o,t==null?void 0:t.header,e,n);a!==void 0&&(s[i[o]]=a)}return s}function G3(e){return[...R0(e,"width"),...R0(e,"height"),...R0(e,"childWidth"),...R0(e,"childHeight")]}function R0(e,t){const n=t==="width"?"x":"y",r=e.component.layoutSize.get(t);if(!r||r==="merged")return[];const i=e.getSizeSignalRef(t).signal;if(r==="step"){const s=e.getScaleComponent(n);if(s){const o=s.get("type"),a=s.get("range");if(En(o)&&xc(a)){const u=e.scaleName(n);return ui(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[k4(u,a)]:[k4(u,a),{name:i,update:tj(u,s,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(r=="container"){const s=i.endsWith("width"),o=s?"containerSize()[0]":"containerSize()[1]",a=Xw(e.config.view,s?"width":"height"),u=`isFinite(${o}) ? ${o} : ${a}`;return[{name:i,init:u,on:[{update:u,events:"window:resize"}]}]}else return[{name:i,value:r}]}function k4(e,t){const n=`${e}_step`;return De(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function tj(e,t,n){const r=t.get("type"),i=t.get("padding"),s=Kt(t.get("paddingOuter"),i);let o=t.get("paddingInner");return o=r==="band"?o!==void 0?o:i:1,`bandspace(${n}, ${fs(o)}, ${fs(s)}) * ${e}_step`}function nj(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function rj(e,t){return re(e).reduce((n,r)=>({...n,...Ld({model:t,channelDef:e[r],vgChannel:r,mainRefFn:i=>Dt(i.value),invalidValueRef:void 0})}),{})}function ij(e,t){if(ui(t))return e==="theta"?"independent":"shared";if(zd(t))return"shared";if(Q3(t))return Zt(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function Y3(e,t){const n=e.scale[t],r=Zt(t)?"axis":"legend";return n==="independent"?(e[r][t]==="shared"&&oe(mge(t)),"independent"):e[r][t]||"shared"}const Zye={...Sme,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},sj=re(Zye);class Jye extends wa{}const C4={symbols:Qye,gradient:ebe,labels:tbe,entries:nbe};function Qye(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:s}){if(s!=="symbol")return;const{markDef:o,encoding:a,config:u,mark:l}=n,c=o.filled&&l!=="trail";let f={...Ape({},n,x0e),...Sz(n,{filled:c})};const d=i.get("symbolOpacity")??u.legend.symbolOpacity,h=i.get("symbolFillColor")??u.legend.symbolFillColor,p=i.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=d===void 0?oj(a.opacity)??o.opacity:void 0;if(f.fill){if(r==="fill"||c&&r===qr)delete f.fill;else if(ie(f.fill,"field"))h?delete f.fill:(f.fill=Dt(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Dt(g??1));else if(Q(f.fill)){const m=lE(a.fill??a.color)??o.fill??(c&&o.color);m&&(f.fill=Dt(m))}}if(f.stroke){if(r==="stroke"||!c&&r===qr)delete f.stroke;else if(ie(f.stroke,"field")||p)delete f.stroke;else if(Q(f.stroke)){const m=Kt(lE(a.stroke||a.color),o.stroke,c?o.color:void 0);m&&(f.stroke={value:m})}}if(r!==ba){const m=ue(t)&&uj(n,i,t);m?f.opacity=[{test:m,...Dt(g??1)},Dt(u.legend.unselectedOpacity)]:g&&(f.opacity=Dt(g))}return f={...f,...e},_t(f)?void 0:f}function ebe(e,{model:t,legendType:n,legendCmpt:r}){if(n!=="gradient")return;const{config:i,markDef:s,encoding:o}=t;let a={};const l=(r.get("gradientOpacity")??i.legend.gradientOpacity)===void 0?oj(o.opacity)||s.opacity:void 0;return l&&(a.opacity=Dt(l)),a={...a,...e},_t(a)?void 0:a}function tbe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){const s=n.legend(r)||{},o=n.config,a=ue(t)?uj(n,i,t):void 0,u=a?[{test:a,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=s;let f;tc(c)?f=ds({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:o}):l===void 0&&c===void 0&&o.customFormatTypes&&(t.type==="quantitative"&&o.numberFormatType?f=ds({fieldOrDatumDef:t,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type==="temporal"&&o.timeFormatType&&ue(t)&&t.timeUnit===void 0&&(f=ds({fieldOrDatumDef:t,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return _t(d)?void 0:d}function nbe(e,{legendCmpt:t}){const n=t.get("selections");return n!=null&&n.length?{...e,fill:{value:"transparent"}}:e}function oj(e){return aj(e,(t,n)=>Math.max(t,n.value))}function lE(e){return aj(e,(t,n)=>Kt(t,n.value))}function aj(e,t){if(j0e(e))return xe(e.condition).reduce(t,e.value);if(_s(e))return e.value}function uj(e,t,n){const r=t.get("selections");if(!(r!=null&&r.length))return;const i=ce(n.field);return r.map(s=>`(!length(data(${ce(Ot(s)+rc)})) || (${s}[${i}] && indexof(${s}[${i}], datum.value) >= 0))`).join(" || ")}const F4={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:r,formatType:i}=t;return pB(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:r}=e;return gB(r,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??lbe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??cbe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??ibe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>df(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(ff(n)&&eo(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>rbe(t,e)};function rbe(e,t){const n=e.values;if(Q(n))return CB(t,n);if(De(n))return n}function ibe(e,t,n,r){if(t!=="shape"){const i=lE(n)??r;if(i)return i}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function sbe(e){const{legend:t}=e;return Kt(t.type,obe(e))}function obe({channel:e,timeUnit:t,scaleType:n}){if(ff(e)){if(Ze(["quarter","month","day"],t))return"symbol";if(eo(n))return"gradient"}return"symbol"}function abe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?"gradientDirection":"symbolDirection"]??ube(n,t)}function ube(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return t==="gradient"?"horizontal":void 0}}function lbe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:s,gradientHorizontalMinLength:o,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(eo(i))return n==="horizontal"?r==="top"||r==="bottom"?$4(t,"width",o,s):o:$4(t,"height",u,a)}function $4(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function cbe(e){if(Ze(["quantile","threshold","log","symlog"],e))return"greedy"}function lj(e){const t=Pt(e)?fbe(e):gbe(e);return e.component.legends=t,t}function fbe(e){const{encoding:t}=e,n={};for(const r of[qr,...XB]){const i=an(t[r]);!i||!e.getScaleComponent(r)||r===Wr&&ue(i)&&i.type===Od||(n[r]=pbe(e,r))}return n}function dbe(e,t){const n=e.scaleName(t);if(e.mark==="trail"){if(t==="color")return{stroke:n};if(t==="size")return{strokeWidth:n}}return t==="color"?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function hbe(e,t,n,r){switch(t){case"disable":return n!==void 0;case"values":return!!(n!=null&&n.values);case"title":if(t==="title"&&e===(r==null?void 0:r.title))return!0}return e===(n||{})[t]}function pbe(e,t){var x;let n=e.legend(t);const{markDef:r,encoding:i,config:s}=e,o=s.legend,a=new Jye({},dbe(e,t));pve(e,t,a);const u=n!==void 0?!n:o.disable;if(a.set("disable",u,n!==void 0),u)return a;n=n||{};const l=e.getScaleComponent(t).get("type"),c=an(i[t]),f=ue(c)?(x=_n(c.timeUnit))==null?void 0:x.unit:void 0,d=n.orient||s.legend.orient||"right",h=sbe({legend:n,channel:t,timeUnit:f,scaleType:l}),p=abe({legend:n,legendType:h,orient:d,legendConfig:o}),g={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:c,legendConfig:o,config:s,scaleType:l,orient:d,legendType:h,direction:p};for(const _ of sj){if(h==="gradient"&&_.startsWith("symbol")||h==="symbol"&&_.startsWith("gradient"))continue;const A=_ in F4?F4[_](g):n[_];if(A!==void 0){const E=hbe(A,_,n,e.fieldDef(t));(E||s.legend[_]===void 0)&&a.set(_,A,E)}}const m=(n==null?void 0:n.encoding)??{},v=a.get("selections"),y={},b={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:a,legendType:h};for(const _ of["labels","legend","title","symbols","gradient","entries"]){const A=rj(m[_]??{},e),E=_ in C4?C4[_](A,b):A;E!==void 0&&!_t(E)&&(y[_]={...v!=null&&v.length&&ue(c)?{name:`${Ot(c.field)}_legend_${_}`}:{},...v!=null&&v.length?{interactive:!!v}:{},update:E})}return _t(y)||a.set("encode",y,!!(n!=null&&n.encoding)),a}function gbe(e){const{legends:t,resolve:n}=e.component;for(const r of e.children){lj(r);for(const i of re(r.component.legends))n.legend[i]=Y3(e.component.resolve,i),n.legend[i]==="shared"&&(t[i]=cj(t[i],r.component.legends[i]),t[i]||(n.legend[i]="independent",delete t[i]))}for(const r of re(t))for(const i of e.children)i.component.legends[r]&&n.legend[r]==="shared"&&delete i.component.legends[r];return t}function cj(e,t){var s,o,a,u;if(!e)return t.clone();const n=e.getWithExplicit("orient"),r=t.getWithExplicit("orient");if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(const l of sj){const c=bu(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return mbe(f,d);case"title":return TP(f,d);case"type":return i=!0,Kr("symbol")}return ob(f,d,l,"legend")});e.setWithExplicit(l,c)}return i&&((o=(s=e.implicit)==null?void 0:s.encode)!=null&&o.gradient&&Y1(e.implicit,["encode","gradient"]),(u=(a=e.explicit)==null?void 0:a.encode)!=null&&u.gradient&&Y1(e.explicit,["encode","gradient"])),e}function mbe(e,t){return t.value==="circle"?t:e}function vbe(e,t,n,r){var i,s;e.encode??(e.encode={}),(i=e.encode)[t]??(i[t]={}),(s=e.encode[t]).update??(s.update={}),e.encode[t].update[n]=r}function fj(e){const t=e.component.legends,n={};for(const i of re(t)){const s=e.getScaleComponent(i),o=wt(s.get("domains"));if(n[o])for(const a of n[o])cj(a,t[i])||n[o].push(t[i]);else n[o]=[t[i].clone()]}return Pn(n).flat().map(i=>ybe(i,e.config)).filter(i=>i!==void 0)}function ybe(e,t){var o,a,u;const{disable:n,labelExpr:r,selections:i,...s}=e.combine();if(!n){if(t.aria===!1&&s.aria==null&&(s.aria=!1),(o=s.encode)!=null&&o.symbols){const l=s.encode.symbols.update;l.fill&&l.fill.value!=="transparent"&&!l.stroke&&!s.stroke&&(l.stroke={value:"transparent"});for(const c of XB)s[c]&&delete l[c]}if(s.title||delete s.title,r!==void 0){let l=r;(u=(a=s.encode)==null?void 0:a.labels)!=null&&u.update&&De(s.encode.labels.update.text)&&(l=Xl(r,"datum.label",s.encode.labels.update.text.signal)),vbe(s,"labels","text",{signal:l})}return s}}function bbe(e){return zd(e)||Q3(e)?xbe(e):dj(e)}function xbe(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),dj(e))}function dj(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:r}=n;if(t.data){const i={signal:`[${t.size.map(o=>o.signal).join(", ")}]`},s=t.data.reduce((o,a)=>{const u=De(a)?a.signal:`data('${e.lookupDataSource(a)}')`;return Ze(o,u)||o.push(u),o},[]);if(s.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:s.length>1?`[${s.join(", ")}]`:s[0]},...n}]}else return[{name:r,translate:{signal:"[width / 2, height / 2]"},...n}]}const _be=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class hj extends wa{constructor(t,n,r,i){super({...n},{name:t}),this.specifiedProjection=n,this.size=r,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function pj(e){e.component.projection=Pt(e)?wbe(e):Sbe(e)}function wbe(e){if(e.hasProjection){const t=Dn(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,i=n?Ebe(e):void 0,s=new hj(e.projectionName(!0),{...Dn(e.config.projection),...t},r,i);return s.get("type")||s.set("type","equalEarth",!1),s}}function Ebe(e){const t=[],{encoding:n}=e;for(const r of[[Ds,$s],[zi,Ms]])(an(n[r[0]])||an(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Wr)&&e.typedFieldDef(Wr).type===Od&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Bt.Main)),t}function Abe(e,t){const n=OC(_be,i=>!!(!_e(e.explicit,i)&&!_e(t.explicit,i)||_e(e.explicit,i)&&_e(t.explicit,i)&&ri(e.get(i),t.get(i))));if(ri(e.size,t.size)){if(n)return e;if(ri(e.explicit,{}))return t;if(ri(t.explicit,{}))return e}return null}function Sbe(e){if(e.children.length===0)return;let t;for(const r of e.children)pj(r);const n=OC(e.children,r=>{const i=r.component.projection;if(i)if(t){const s=Abe(t,i);return s&&(t=s),!!s}else return t=i,!0;else return!0});if(t&&n){const r=e.projectionName(!0),i=new hj(r,t.specifiedProjection,t.size,ze(t.data));for(const s of e.children){const o=s.component.projection;o&&(o.isFit&&i.data.push(...s.component.projection.data),s.renameProjection(o.get("name"),r),o.merged=!0)}return i}}function kbe(e,t,n,r){if(Ug(t,n)){const i=Pt(e)?e.axis(n)??e.legend(n)??{}:{},s=ge(t,{expr:"datum"}),o=ge(t,{expr:"datum",binSuffix:"end"});return{formulaAs:ge(t,{binSuffix:"range",forAs:!0}),formula:Pg(s,o,i.format,i.formatType,r)}}return{}}function gj(e,t){return`${SP(e)}_${t}`}function Cbe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function V3(e,t,n){const r=eb(n,void 0)??{},i=gj(r,t);return e.getName(`${i}_bins`)}function Fbe(e){return"as"in e}function D4(e,t,n){let r,i;Fbe(e)?r=be(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:r=[ge(e,{forAs:!0}),ge(e,{binSuffix:"end",forAs:!0})];const s={...eb(t,void 0)},o=gj(s,e.field),{signal:a,extentSignal:u}=Cbe(n,o);if(qy(s.extent)){const c=s.extent;i=Yz(n,c.param,c),delete s.extent}const l={bin:s,field:e.field,as:[r],...a?{signal:a}:{},...u?{extentSignal:u}:{},...i?{span:i}:{}};return{key:o,binComponent:l}}class oo extends bt{clone(){return new oo(null,ze(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const r=n.reduceFieldDef((i,s,o)=>{if(_r(s)&&Ft(s.bin)){const{key:a,binComponent:u}=D4(s,s.bin,n);i[a]={...u,...i[a],...kbe(n,s,o,n.config)}}return i},{});return _t(r)?null:new oo(t,r)}static makeFromTransform(t,n,r){const{key:i,binComponent:s}=D4(n,n.bin,r);return new oo(t,{[i]:s})}merge(t,n){for(const r of re(t.bins))r in this.bins?(n(t.bins[r].signal,this.bins[r].signal),this.bins[r].as=Qs([...this.bins[r].as,...t.bins[r].as],et)):this.bins[r]=t.bins[r];for(const r of t.children)t.removeChild(r),r.parent=this;t.remove()}producedFields(){return new Set(Pn(this.bins).map(t=>t.as).flat(2))}dependentFields(){return new Set(Pn(this.bins).map(t=>t.field))}hash(){return`Bin ${et(this.bins)}`}assemble(){return Pn(this.bins).flatMap(t=>{const n=[],[r,...i]=t.as,{extent:s,...o}=t.bin,a={type:"bin",field:Bi(t.field),as:r,signal:t.signal,...qy(s)?{extent:null}:{extent:s},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!s&&t.extentSignal&&(n.push({type:"extent",field:Bi(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const u of i)for(let l=0;l<2;l++)n.push({type:"formula",expr:ge({field:r[l]},{expr:"datum"}),as:u[l]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n})}}function $be(e,t,n,r){var s;const i=Pt(r)?r.encoding[$o(t)]:void 0;if(_r(n)&&Pt(r)&&bB(n,i,r.markDef,r.config)){e.add(ge(n,{})),e.add(ge(n,{suffix:"end"}));const{mark:o,markDef:a,config:u}=r,l=yu({fieldDef:n,markDef:a,config:u});Op(o)&&l!==.5&&Zt(t)&&(e.add(ge(n,{suffix:ab})),e.add(ge(n,{suffix:ub}))),n.bin&&Ug(n,t)&&e.add(ge(n,{binSuffix:"range"}))}else if(mP(t)){const o=gP(t);e.add(r.getName(o))}else e.add(ge(n));return Ec(n)&&a0e((s=n.scale)==null?void 0:s.range)&&e.add(n.scale.range.field),e}function Dbe(e,t){for(const n of re(t)){const r=t[n];for(const i of re(r))n in e?e[n][i]=new Set([...e[n][i]??[],...r[i]]):e[n]={[i]:r[i]}}}class ps extends bt{clone(){return new ps(null,new Set(this.dimensions),ze(this.measures))}constructor(t,n,r){super(t),this.dimensions=n,this.measures=r}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let r=!1;n.forEachFieldDef(o=>{o.aggregate&&(r=!0)});const i={},s=new Set;return!r||(n.forEachFieldDef((o,a)=>{const{aggregate:u,field:l}=o;if(u)if(u==="count")i["*"]??(i["*"]={}),i["*"].count=new Set([ge(o,{forAs:!0})]);else{if(fa(u)||Iu(u)){const c=fa(u)?"argmin":"argmax",f=u[c];i[f]??(i[f]={}),i[f][c]=new Set([ge({op:c,field:f},{forAs:!0})])}else i[l]??(i[l]={}),i[l][u]=new Set([ge(o,{forAs:!0})]);Do(a)&&n.scaleDomain(a)==="unaggregated"&&(i[l]??(i[l]={}),i[l].min=new Set([ge({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([ge({field:l,aggregate:"max"},{forAs:!0})]))}else $be(s,a,o,n)}),s.size+re(i).length===0)?null:new ps(t,s,i)}static makeFromTransform(t,n){var r;const i=new Set,s={};for(const o of n.aggregate){const{op:a,field:u,as:l}=o;a&&(a==="count"?(s["*"]??(s["*"]={}),s["*"].count=new Set([l||ge(o,{forAs:!0})])):(s[u]??(s[u]={}),(r=s[u])[a]??(r[a]=new Set),s[u][a].add(l||ge(o,{forAs:!0}))))}for(const o of n.groupby??[])i.add(o);return i.size+re(s).length===0?null:new ps(t,i,s)}merge(t){return aP(this.dimensions,t.dimensions)?(Dbe(this.measures,t.measures),!0):(Rge("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...re(this.measures)])}producedFields(){const t=new Set;for(const n of re(this.measures))for(const r of re(this.measures[n])){const i=this.measures[n][r];i.size===0?t.add(`${r}_${n}`):i.forEach(t.add,t)}return t}hash(){return`Aggregate ${et({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],r=[];for(const s of re(this.measures))for(const o of re(this.measures[s]))for(const a of this.measures[s][o])r.push(a),t.push(o),n.push(s==="*"?null:Bi(s));return{type:"aggregate",groupby:[...this.dimensions].map(Bi),ops:t,fields:n,as:r}}}class Pd extends bt{constructor(t,n,r,i){super(t),this.model=n,this.name=r,this.data=i;for(const s of Ci){const o=n.facet[s];if(o){const{bin:a,sort:u}=o;this[s]={name:n.getName(`${s}_domain`),fields:[ge(o),...Ft(a)?[ge(o,{binSuffix:"end"})]:[]],...ia(u)?{sortField:u}:Q(u)?{sortIndexField:ld(o,s)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of Ci)this[n]&&(t+=` ${n.charAt(0)}:${et(this[n])}`);return t}get fields(){var n;const t=[];for(const r of Ci)(n=this[r])!=null&&n.fields&&t.push(...this[r].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of Ci)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of xa){const r=this.childModel.component.scales[n];if(r&&!r.merged){const i=r.get("type"),s=r.get("range");if(En(i)&&xc(s)){const o=vb(this.childModel,n),a=J3(o);a?t[n]=a:oe(XC(n))}}}return t}assembleRowColumnHeaderData(t,n,r){const i={row:"y",column:"x",facet:void 0}[t],s=[],o=[],a=[];i&&r&&r[i]&&(n?(s.push(`distinct_${r[i]}`),o.push("max")):(s.push(r[i]),o.push("distinct")),a.push(`distinct_${r[i]}`));const{sortField:u,sortIndexField:l}=this[t];if(u){const{op:c=Zy,field:f}=u;s.push(f),o.push(c),a.push(ge(u,{forAs:!0}))}else l&&(s.push(l),o.push("max"),a.push(l));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...s.length?{fields:s,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){var u;const{columns:n}=this.model.layout,{layoutHeaders:r}=this.model.component,i=[],s={};for(const l of W3){for(const c of H3){const f=(r[l]&&r[l][c])??[];for(const d of f)if(((u=d.axes)==null?void 0:u.length)>0){s[l]=!0;break}}if(s[l]){const c=`length(data("${this.facet.name}"))`,f=l==="row"?n?{signal:`ceil(${c} / ${n})`}:1:n?{signal:`min(${c}, ${n})`}:{signal:c};i.push({name:`${this.facet.name}_${l}`,transform:[{type:"sequence",start:0,stop:f}]})}}const{row:o,column:a}=s;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,t)),i}assemble(){const t=[];let n=null;const r=this.getChildIndependentFieldsWithStep(),{column:i,row:s,facet:o}=this;if(i&&s&&(r.x||r.y)){n=`cross_${this.column.name}_${this.row.name}`;const a=[].concat(r.x??[],r.y??[]),u=a.map(()=>"distinct");t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:a,ops:u}]})}for(const a of[ra,na])this[a]&&t.push(this.assembleRowColumnHeaderData(a,n,r));if(o){const a=this.assembleFacetHeaderData(r);a&&t.push(...a)}return t}}function M4(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Mbe(e,t){const n=PC(e);if(t==="number")return`toNumber(${n})`;if(t==="boolean")return`toBoolean(${n})`;if(t==="string")return`toString(${n})`;if(t==="date")return`toDate(${n})`;if(t==="flatten")return n;if(t.startsWith("date:")){const r=M4(t.slice(5,t.length));return`timeParse(${n},'${r}')`}else if(t.startsWith("utc:")){const r=M4(t.slice(4,t.length));return`utcParse(${n},'${r}')`}else return oe(jpe(t)),null}function Rbe(e){const t={};return wm(e.filter,n=>{if(KP(n)){let r=null;t3(n)?r=ti(n.equal):r3(n)?r=ti(n.lte):n3(n)?r=ti(n.lt):i3(n)?r=ti(n.gt):s3(n)?r=ti(n.gte):o3(n)?r=n.range[0]:a3(n)&&(r=(n.oneOf??n.in)[0]),r&&(_c(r)?t[n.field]="date":ut(r)?t[n.field]="number":be(r)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function Tbe(e){const t={};function n(r){sd(r)?t[r.field]="date":r.type==="quantitative"&&gpe(r.aggregate)?t[r.field]="number":Qf(r.field)>1?r.field in t||(t[r.field]="flatten"):Ec(r)&&ia(r.sort)&&Qf(r.sort.field)>1&&(r.sort.field in t||(t[r.sort.field]="flatten"))}if((Pt(e)||ui(e))&&e.forEachFieldDef((r,i)=>{if(_r(r))n(r);else{const s=yc(i),o=e.fieldDef(s);n({...r,type:o.type})}}),Pt(e)){const{mark:r,markDef:i,encoding:s}=e;if(Pu(r)&&!e.encoding.order){const o=i.orient==="horizontal"?"y":"x",a=s[o];ue(a)&&a.type==="quantitative"&&!(a.field in t)&&(t[a.field]="number")}}return t}function Nbe(e){const t={};if(Pt(e)&&e.component.selection)for(const n of re(e.component.selection)){const r=e.component.selection[n];for(const i of r.project.items)!i.channel&&Qf(i.field)>1&&(t[i.field]="flatten")}return t}class Kn extends bt{clone(){return new Kn(null,ze(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${et(this._parse)}`}static makeExplicit(t,n,r){var o;let i={};const s=n.data;return!iu(s)&&((o=s==null?void 0:s.format)!=null&&o.parse)&&(i=s.format.parse),this.makeWithAncestors(t,i,{},r)}static makeWithAncestors(t,n,r,i){for(const a of re(r)){const u=i.getWithExplicit(a);u.value!==void 0&&(u.explicit||u.value===r[a]||u.value==="derived"||r[a]==="flatten"?delete r[a]:oe(NM(a,r[a],u.value)))}for(const a of re(n)){const u=i.get(a);u!==void 0&&(u===n[a]?delete n[a]:oe(NM(a,n[a],u)))}const s=new wa(n,r);i.copyAll(s);const o={};for(const a of re(s.combine())){const u=s.get(a);u!==null&&(o[a]=u)}return re(o).length===0||i.parseNothing?null:new Kn(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of re(this._parse)){const r=this._parse[n];Qf(n)===1&&(t[n]=r)}return t}producedFields(){return new Set(re(this._parse))}dependentFields(){return new Set(re(this._parse))}assembleTransforms(t=!1){return re(this._parse).filter(n=>t?Qf(n)>1:!0).map(n=>{const r=Mbe(n,this._parse[n]);return r?{type:"formula",expr:r,as:Td(n)}:null}).filter(n=>n!==null)}}class xu extends bt{clone(){return new xu(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([Es])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Es}}}class Vg extends bt{clone(){return new Vg(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${et(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Xg extends bt{clone(){return new Xg(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${et(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class oc extends bt{constructor(t){super(null),t??(t={name:"source"});let n;if(iu(t)||(n=t.format?{...Pr(t.format,["parse"])}:{}),Lp(t))this._data={values:t.values};else if(od(t)){if(this._data={url:t.url},!n.type){let r=/(?:\.([^.]+))?$/.exec(t.url)[1];Ze(["json","csv","tsv","dsv","topojson"],r)||(r="json"),n.type=r}}else hz(t)?this._data={values:[{type:"Sphere"}]}:(fz(t)||iu(t))&&(this._data={});this._generator=iu(t),t.name&&(this._name=t.name),n&&!_t(n)&&(this._data.format=n)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(t){this._name=t}set parent(t){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var R4=function(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n},Obe=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},jh;function X3(e){return e instanceof oc||e instanceof Vg||e instanceof Xg}class K3{constructor(){jh.set(this,void 0),R4(this,jh,!1,"f")}setModified(){R4(this,jh,!0,"f")}get modifiedFlag(){return Obe(this,jh,"f")}}jh=new WeakMap;class Sc extends K3{getNodeDepths(t,n,r){r.set(t,n);for(const i of t.children)this.getNodeDepths(i,n+1,r);return r}optimize(t){const r=[...this.getNodeDepths(t,0,new Map).entries()].sort((i,s)=>s[1]-i[1]);for(const i of r)this.run(i[0]);return this.modifiedFlag}}class Z3 extends K3{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class Lbe extends Z3{mergeNodes(t,n){const r=n.shift();for(const i of n)t.removeChild(i),i.parent=r,i.remove()}run(t){const n=t.children.map(i=>i.hash()),r={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(t,r[i]))}}class Ibe extends Z3{constructor(t){super(),this.requiresSelectionId=t&&z3(t)}run(t){t instanceof xu&&(this.requiresSelectionId&&(X3(t.parent)||t.parent instanceof ps||t.parent instanceof Kn)||(this.setModified(),t.remove()))}}class Pbe extends K3{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let r=new Set;t instanceof io&&(r=t.producedFields(),LC(r,n)&&(this.setModified(),t.removeFormulas(n),t.producedFields.length===0&&t.remove()));for(const i of t.children)this.run(i,new Set([...n,...r]))}}class Bbe extends Z3{constructor(){super()}run(t){t instanceof Br&&!t.isRequired()&&(this.setModified(),t.remove())}}class zbe extends Sc{run(t){if(!X3(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof Kn)if(t instanceof Kn)this.setModified(),t.merge(n);else{if(IC(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class jbe extends Sc{run(t){const n=[...t.children],r=t.children.filter(i=>i instanceof Kn);if(t.numChildren()>1&&r.length>=1){const i={},s=new Set;for(const o of r){const a=o.parse;for(const u of re(a))u in i?i[u]!==a[u]&&s.add(u):i[u]=a[u]}for(const o of s)delete i[o];if(!_t(i)){this.setModified();const o=new Kn(t,i);for(const a of n){if(a instanceof Kn)for(const u of re(i))delete a.parse[u];t.removeChild(a),a.parent=o,a instanceof Kn&&re(a.parse).length===0&&a.remove()}}}}}class Ube extends Sc{run(t){t instanceof Br||t.numChildren()>0||t instanceof Pd||t instanceof oc||(this.setModified(),t.remove())}}class qbe extends Sc{run(t){const n=t.children.filter(i=>i instanceof io),r=n.pop();for(const i of n)this.setModified(),r.merge(i)}}class Wbe extends Sc{run(t){const n=t.children.filter(i=>i instanceof ps),r={};for(const i of n){const s=et(i.groupBy);s in r||(r[s]=[]),r[s].push(i)}for(const i of re(r)){const s=r[i];if(s.length>1){const o=s.pop();for(const a of s)o.merge(a)&&(t.removeChild(a),a.parent=o,a.remove(),this.setModified())}}}}class Hbe extends Sc{constructor(t){super(),this.model=t}run(t){const n=!(X3(t)||t instanceof Id||t instanceof Kn||t instanceof xu),r=[],i=[];for(const s of t.children)s instanceof oo&&(n&&!IC(t.producedFields(),s.dependentFields())?r.push(s):i.push(s));if(r.length>0){const s=r.pop();for(const o of r)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof oo?t.merge(s,this.model.renameSignal.bind(this.model)):s.swapWithParent()}if(i.length>1){const s=i.pop();for(const o of i)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified()}}}class Gbe extends Sc{run(t){const n=[...t.children];if(!Jf(n,o=>o instanceof Br)||t.numChildren()<=1)return;const i=[];let s;for(const o of n)if(o instanceof Br){let a=o;for(;a.numChildren()===1;){const[u]=a.children;if(u instanceof Br)a=u;else break}i.push(...a.children),s?(t.removeChild(o),o.parent=s.parent,s.parent.removeChild(s),s.parent=a,this.setModified()):s=a}else i.push(o);if(i.length){this.setModified();for(const o of i)o.parent.removeChild(o),o.parent=s}}}class kc extends bt{clone(){return new kc(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Qs(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??ge(t)}hash(){return`JoinAggregateTransform ${et(this.transform)}`}assemble(){const t=[],n=[],r=[];for(const s of this.transform.joinaggregate)n.push(s.op),r.push(this.getDefaultName(s)),t.push(s.field===void 0?null:s.field);const i=this.transform.groupby;return{type:"joinaggregate",as:r,ops:n,fields:t,...i!==void 0?{groupby:i}:{}}}}class fd extends bt{clone(){return new fd(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,r){const{config:i,markDef:s}=n,{marks:o,scales:a}=r;if(o==="include-invalid-values"&&a==="include-invalid-values")return null;const u=n.reduceFieldDef((l,c,f)=>{const d=Do(f)&&n.getScaleComponent(f);if(d){const h=d.get("type"),{aggregate:p}=c,g=p3({scaleChannel:f,markDef:s,config:i,scaleType:h,isCountAggregate:Uy(p)});g!=="show"&&g!=="always-valid"&&(l[c.field]=c)}return l},{});return re(u).length?new fd(t,u):null}dependentFields(){return new Set(re(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${et(this.filter)}`}assemble(){const t=re(this.filter).reduce((n,r)=>{const i=this.filter[r],s=ge(i,{expr:"datum"});return i!==null&&(i.type==="temporal"?n.push(`(isDate(${s}) || (${cE(s)}))`):i.type==="quantitative"&&n.push(cE(s))),n},[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function cE(e){return`isValid(${e}) && isFinite(+${e})`}function Ybe(e){return e.stack.stackBy.reduce((t,n)=>{const r=n.fieldDef,i=ge(r);return i&&t.push(i),t},[])}function Vbe(e){return Q(e)&&e.every(t=>be(t))&&e.length>1}class oa extends bt{clone(){return new oa(null,ze(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:r,groupby:i,as:s,offset:o="zero"}=n,a=[],u=[];if(n.sort!==void 0)for(const f of n.sort)a.push(f.field),u.push(Kt(f.order,"ascending"));const l={field:a,order:u};let c;return Vbe(s)?c=s:be(s)?c=[s,`${s}_end`]:c=[`${n.stack}_start`,`${n.stack}_end`],new oa(t,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:c})}static makeFromEncoding(t,n){const r=n.stack,{encoding:i}=n;if(!r)return null;const{groupbyChannels:s,fieldChannel:o,offset:a,impute:u}=r,l=s.map(h=>{const p=i[h];return ws(p)}).filter(h=>!!h),c=Ybe(n),f=n.encoding.order;let d;if(Q(f)||ue(f))d=DP(f);else{const h=xB(f)?f.sort:o==="y"?"descending":"ascending";d=c.reduce((p,g)=>(p.field.includes(g)||(p.field.push(g),p.order.push(h)),p),{field:[],order:[]})}return new oa(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:c,sort:d,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${et(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:r}=this._stack;return t.length>0?t.map(i=>i.bin?n?[ge(i,{binSuffix:"mid"})]:[ge(i,{}),ge(i,{binSuffix:"end"})]:[ge(i)]).flat():r??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:r,stackField:i,stackby:s,sort:o,offset:a,impute:u,as:l}=this._stack;if(u)for(const c of r){const{bandPosition:f=.5,bin:d}=c;if(d){const h=ge(c,{expr:"datum"}),p=ge(c,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${cE(h)} ? ${f}*${h}+${1-f}*${p} : ${h}`,as:ge(c,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:i,groupby:[...s,...n],key:ge(c,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:i,sort:o,as:l,offset:a}),t}}class Bd extends bt{clone(){return new Bd(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Qs(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach(n=>t.add(n.field)),this.transform.window.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??ge(t)}hash(){return`WindowTransform ${et(this.transform)}`}assemble(){const t=[],n=[],r=[],i=[];for(const f of this.transform.window)n.push(f.op),r.push(this.getDefaultName(f)),i.push(f.param===void 0?null:f.param),t.push(f.field===void 0?null:f.field);const s=this.transform.frame,o=this.transform.groupby;if(s&&s[0]===null&&s[1]===null&&n.every(f=>YC(f)))return{type:"joinaggregate",as:r,ops:n,fields:t,...o!==void 0?{groupby:o}:{}};const a=[],u=[];if(this.transform.sort!==void 0)for(const f of this.transform.sort)a.push(f.field),u.push(f.order??"ascending");const l={field:a,order:u},c=this.transform.ignorePeers;return{type:"window",params:i,as:r,ops:n,fields:t,sort:l,...c!==void 0?{ignorePeers:c}:{},...o!==void 0?{groupby:o}:{},...s!==void 0?{frame:s}:{}}}}function Xbe(e){function t(n){if(!(n instanceof Pd)){const r=n.clone();if(r instanceof Br){const i=dE+r.getSource();r.setSource(i),e.model.component.data.outputNodes[i]=r}else(r instanceof ps||r instanceof oa||r instanceof Bd||r instanceof kc)&&r.addDimensions(e.fields);for(const i of n.children.flatMap(t))i.parent=r;return[r]}return n.children.flatMap(t)}return t}function fE(e){if(e instanceof Pd)if(e.numChildren()===1&&!(e.children[0]instanceof Br)){const t=e.children[0];(t instanceof ps||t instanceof oa||t instanceof Bd||t instanceof kc)&&t.addDimensions(e.fields),t.swapWithParent(),fE(e)}else{const t=e.model.component.data.main;mj(t);const n=Xbe(e),r=e.children.map(n).flat();for(const i of r)i.parent=t}else e.children.map(fE)}function mj(e){if(e instanceof Br&&e.type===Bt.Main&&e.numChildren()===1){const t=e.children[0];t instanceof Pd||(t.swapWithParent(),mj(e))}}const dE="scale_",T0=5;function hE(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!hE(t.children))return!1}return!0}function Yi(e,t){let n=!1;for(const r of t)n=e.optimize(r)||n;return n}function T4(e,t,n){let r=e.sources,i=!1;return i=Yi(new Bbe,r)||i,i=Yi(new Ibe(t),r)||i,r=r.filter(s=>s.numChildren()>0),i=Yi(new Ube,r)||i,r=r.filter(s=>s.numChildren()>0),n||(i=Yi(new zbe,r)||i,i=Yi(new Hbe(t),r)||i,i=Yi(new Pbe,r)||i,i=Yi(new jbe,r)||i,i=Yi(new Wbe,r)||i,i=Yi(new qbe,r)||i,i=Yi(new Lbe,r)||i,i=Yi(new Gbe,r)||i),e.sources=r,i}function Kbe(e,t){hE(e.sources);let n=0,r=0;for(let i=0;it(n))}}function vj(e){Pt(e)?Zbe(e):Jbe(e)}function Zbe(e){const t=e.component.scales;for(const n of re(t)){const r=e2e(e,n);if(t[n].setWithExplicit("domains",r),n2e(e,n),e.component.data.isFaceted){let s=e;for(;!ui(s)&&s.parent;)s=s.parent;if(s.component.resolve.scale[n]==="shared")for(const a of r.value)Jo(a)&&(a.data=dE+a.data.replace(dE,""))}}}function Jbe(e){for(const n of e.children)vj(n);const t=e.component.scales;for(const n of re(t)){let r,i=null;for(const s of e.children){const o=s.component.scales[n];if(o){r===void 0?r=o.getWithExplicit("domains"):r=bu(r,o.getWithExplicit("domains"),"domains","scale",pE);const a=o.get("selectionExtent");i&&a&&i.param!==a.param&&oe(Npe),i=a}}t[n].setWithExplicit("domains",r),i&&t[n].set("selectionExtent",i,!0)}}function Qbe(e,t,n,r){if(e==="unaggregated"){const{valid:i,reason:s}=N4(t,n);if(!i){oe(s);return}}else if(e===void 0&&r.useUnaggregatedDomain){const{valid:i}=N4(t,n);if(i)return"unaggregated"}return e}function e2e(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:r}=e,i=Qbe(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return i!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:i}),t==="x"&&an(r.x2)?an(r.x)?bu(Da(n,i,e,"x"),Da(n,i,e,"x2"),"domain","scale",pE):Da(n,i,e,"x2"):t==="y"&&an(r.y2)?an(r.y)?bu(Da(n,i,e,"y"),Da(n,i,e,"y2"),"domain","scale",pE):Da(n,i,e,"y2"):Da(n,i,e,t)}function t2e(e,t,n){return e.map(r=>({signal:`{data: ${tb(r,{timeUnit:n,type:t})}}`}))}function fx(e,t,n){var i;const r=(i=_n(n))==null?void 0:i.unit;return t==="temporal"||r?t2e(e,t,r):[e]}function Da(e,t,n,r){const{encoding:i,markDef:s,mark:o,config:a,stack:u}=n,l=an(i[r]),{type:c}=l,f=l.timeUnit,d=P1e({invalid:go("invalid",s,a),isPath:Pu(o)});if(o0e(t)){const g=Da(e,void 0,n,r),m=fx(t.unionWith,c,f);return Us([...m,...g.value])}else{if(De(t))return Us([t]);if(t&&t!=="unaggregated"&&!rB(t))return Us(fx(t,c,f))}if(u&&r===u.fieldChannel){if(u.offset==="normalize")return Kr([[0,1]]);const g=n.requestDataName(d);return Kr([{data:g,field:n.vgField(r,{suffix:"start"})},{data:g,field:n.vgField(r,{suffix:"end"})}])}const h=Do(r)&&ue(l)?r2e(n,r,e):void 0;if(Mo(l)){const g=fx([l.datum],c,f);return Kr(g)}const p=l;if(t==="unaggregated"){const{field:g}=l;return Kr([{data:n.requestDataName(d),field:ge({field:g,aggregate:"min"})},{data:n.requestDataName(d),field:ge({field:g,aggregate:"max"})}])}else if(Ft(p.bin)){if(En(e))return Kr(e==="bin-ordinal"?[]:[{data:Tp(h)?n.requestDataName(d):n.requestDataName(Bt.Raw),field:n.vgField(r,Ug(p,r)?{binSuffix:"range"}:{}),sort:h===!0||!ve(h)?{field:n.vgField(r,{}),op:"min"}:h}]);{const{bin:g}=p;if(Ft(g)){const m=V3(n,p.field,g);return Kr([new hn(()=>{const v=n.getSignalName(m);return`[${v}.start, ${v}.stop]`})])}else return Kr([{data:n.requestDataName(d),field:n.vgField(r,{})}])}}else if(p.timeUnit&&Ze(["time","utc"],e)){const g=i[$o(r)];if(bB(p,g,s,a)){const m=n.requestDataName(d),v=yu({fieldDef:p,fieldDef2:g,markDef:s,config:a}),y=Op(o)&&v!==.5&&Zt(r);return Kr([{data:m,field:n.vgField(r,y?{suffix:ab}:{})},{data:m,field:n.vgField(r,{suffix:y?ub:"end"})}])}}return Kr(h?[{data:Tp(h)?n.requestDataName(d):n.requestDataName(Bt.Raw),field:n.vgField(r),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(r)}])}function dx(e,t){const{op:n,field:r,order:i}=e;return{op:n??(t?"sum":Zy),...r?{field:Bi(r)}:{},...i?{order:i}:{}}}function n2e(e,t){var a;const n=e.component.scales[t],r=e.specifiedScales[t].domain,i=(a=e.fieldDef(t))==null?void 0:a.bin,s=rB(r)?r:void 0,o=bc(i)&&qy(i.extent)?i.extent:void 0;(s||o)&&n.set("selectionExtent",s??o,!0)}function r2e(e,t,n){if(!En(n))return;const r=e.fieldDef(t),i=r.sort;if(vB(i))return{op:"min",field:ld(r,t),order:"ascending"};const{stack:s}=e,o=s?new Set([...s.groupbyFields,...s.stackBy.map(a=>a.fieldDef.field)]):void 0;if(ia(i)){const a=s&&!o.has(i.field);return dx(i,a)}else if(P0e(i)){const{encoding:a,order:u}=i,l=e.fieldDef(a),{aggregate:c,field:f}=l,d=s&&!o.has(f);if(fa(c)||Iu(c))return dx({field:ge(l),order:u},d);if(YC(c)||!c)return dx({op:c,field:f,order:u},d)}else{if(i==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(Ze(["ascending",void 0],i))return!0}}function N4(e,t){const{aggregate:n,type:r}=e;return n?be(n)&&!vpe.has(n)?{valid:!1,reason:lge(n)}:r==="quantitative"&&t==="log"?{valid:!1,reason:cge(e)}:{valid:!0}:{valid:!1,reason:uge(e)}}function pE(e,t,n,r){return e.explicit&&t.explicit&&oe(gge(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function i2e(e){const t=Qs(e.map(o=>{if(Jo(o)){const{sort:a,...u}=o;return u}return o}),et),n=Qs(e.map(o=>{if(Jo(o)){const a=o.sort;return a!==void 0&&!Tp(a)&&("op"in a&&a.op==="count"&&delete a.field,a.order==="ascending"&&delete a.order),a}}).filter(o=>o!==void 0),et);if(t.length===0)return;if(t.length===1){const o=e[0];if(Jo(o)&&n.length>0){let a=n[0];if(n.length>1){oe(LM);const u=n.filter(l=>ve(l)&&"op"in l&&l.op!=="min");n.every(l=>ve(l)&&"op"in l)&&u.length===1?a=u[0]:a=!0}else if(ve(a)&&"field"in a){const u=a.field;o.field===u&&(a=a.order?{order:a.order}:!0)}return{...o,sort:a}}return o}const r=Qs(n.map(o=>Tp(o)||!("op"in o)||be(o.op)&&_e(hpe,o.op)?o:(oe(vge(o)),!0)),et);let i;r.length===1?i=r[0]:r.length>1&&(oe(LM),i=!0);const s=Qs(e.map(o=>Jo(o)?o.data:null),o=>o);return s.length===1&&s[0]!==null?{data:s[0],fields:t.map(a=>a.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function J3(e){if(Jo(e)&&be(e.field))return e.field;if(ype(e)){let t;for(const n of e.fields)if(Jo(n)&&be(n.field)){if(!t)t=n.field;else if(t!==n.field)return oe(yge),t}return oe(bge),t}else if(bpe(e)){oe(xge);const t=e.fields[0];return be(t)?t:void 0}}function vb(e,t){const r=e.component.scales[t].get("domains").map(i=>(Jo(i)&&(i.data=e.lookupDataSource(i.data)),i));return i2e(r)}function yj(e){return zd(e)||Q3(e)?e.children.reduce((t,n)=>t.concat(yj(n)),O4(e)):O4(e)}function O4(e){return re(e.component.scales).reduce((t,n)=>{const r=e.component.scales[n];if(r.merged)return t;const i=r.combine(),{name:s,type:o,selectionExtent:a,domains:u,range:l,reverse:c,...f}=i,d=s2e(i.range,s,n,e),h=vb(e,n),p=a?X1e(e,a,r,h):null;return t.push({name:s,type:o,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),t},[])}function s2e(e,t,n,r){if(Zt(n)){if(xc(e))return{step:{signal:`${t}_step`}}}else if(ve(e)&&Jo(e))return{...e,data:r.lookupDataSource(e.data)};return e}class bj extends wa{constructor(t,n){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(Ze([Mn.LOG,Mn.TIME,Mn.UTC],t))return"definitely-not";const n=this.get("zero");if(n===!0||n===void 0&&Ze([Mn.LINEAR,Mn.SQRT,Mn.POW],t))return"definitely";const r=this.get("domains");if(r.length>0){let i=!1,s=!1,o=!1;for(const a of r){if(Q(a)){const u=a[0],l=a[a.length-1];if(ut(u)&&ut(l))if(u<=0&&l>=0){i=!0;continue}else{s=!0;continue}}o=!0}if(i)return"definitely";if(s&&!o)return"definitely-not"}return"maybe"}}const o2e=["range","scheme"];function a2e(e){const t=e.component.scales;for(const n of GC){const r=t[n];if(!r)continue;const i=u2e(n,e);r.setWithExplicit("range",i)}}function L4(e,t){const n=e.fieldDef(t);if(n!=null&&n.bin){const{bin:r,field:i}=n,s=Hr(t),o=e.getName(s);if(ve(r)&&r.binned&&r.step!==void 0)return new hn(()=>{const a=e.scaleName(t),u=`(domain("${a}")[1] - domain("${a}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${u})`});if(Ft(r)){const a=V3(e,i,r);return new hn(()=>{const u=e.getSignalName(a),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(o)} / (${l})`})}}}function u2e(e,t){const n=t.specifiedScales[e],{size:r}=t,s=t.getScaleComponent(e).get("type");for(const f of o2e)if(n[f]!==void 0){const d=Gw(s,f),h=iB(e,f);if(!d)oe(IP(s,f,e));else if(h)oe(h);else switch(f){case"range":{const p=n.range;if(Q(p)){if(Zt(e))return Us(p.map(g=>{if(g==="width"||g==="height"){const m=t.getName(g),v=t.getSignalName.bind(t);return hn.fromName(v,m)}return g}))}else if(ve(p))return Us({data:t.requestDataName(Bt.Main),field:p.field,sort:{op:"min",field:t.vgField(e)}});return Us(p)}case"scheme":return Us(l2e(n[f]))}}const o=e===Lt||e==="xOffset"?"width":"height",a=r[o];if(vo(a)){if(Zt(e))if(En(s)){const f=_j(a,t,e);if(f)return Us({step:f})}else oe(PP(o));else if(Og(e)){const f=e===Mu?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const p=wj(a,s);if(p)return Us(p)}}}const{rangeMin:u,rangeMax:l}=n,c=c2e(e,t);return(u!==void 0||l!==void 0)&&Gw(s,"rangeMin")&&Q(c)&&c.length===2?Us([u??c[0],l??c[1]]):Kr(c)}function l2e(e){return s0e(e)?{scheme:e.name,...Pr(e,["name"])}:{scheme:e}}function xj(e,t,n,{center:r}={}){const i=Hr(e),s=t.getName(i),o=t.getSignalName.bind(t);return e===Sn&&xs(n)?r?[hn.fromName(a=>`${o(a)}/2`,s),hn.fromName(a=>`-${o(a)}/2`,s)]:[hn.fromName(o,s),0]:r?[hn.fromName(a=>`-${o(a)}/2`,s),hn.fromName(a=>`${o(a)}/2`,s)]:[0,hn.fromName(o,s)]}function c2e(e,t){const{size:n,config:r,mark:i,encoding:s}=t,{type:o}=an(s[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case Lt:case Sn:{if(Ze(["point","band"],u)){const f=Ej(e,n,r.view);if(vo(f))return{step:_j(f,t,e)}}return xj(e,t,u)}case Mu:case Nd:return f2e(e,t,u);case ya:{const f=p2e(i,r),d=g2e(i,n,t,r);return nd(u)?h2e(f,d,d2e(u,r,l,e)):[f,d]}case Ui:return[0,Math.PI*2];case vc:return[0,360];case Fs:return[0,new hn(()=>{const f=t.getSignalName(ui(t.parent)?"child_width":"width"),d=t.getSignalName(ui(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case Ru:return{step:1e3/r.scale.framesPerSecond};case Ou:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case Lu:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Wr:return"symbol";case qr:case Co:case Fo:return u==="ordinal"?o==="nominal"?"category":"ordinal":c!==void 0?"diverging":i==="rect"||i==="geoshape"?"heatmap":"ramp";case ba:case Tu:case Nu:return[r.scale.minOpacity,r.scale.maxOpacity]}}function _j(e,t,n){const{encoding:r}=t,i=t.getScaleComponent(n),s=UC(n),o=r[s];if(ZB({step:e,offsetIsDiscrete:Ue(o)&&JP(o.type)})==="offset"&&MB(r,s)){const u=t.getScaleComponent(s);let c=`domain('${t.scaleName(s)}').length`;if(u.get("type")==="band"){const d=u.get("paddingInner")??u.get("padding")??0,h=u.get("paddingOuter")??u.get("padding")??0;c=`bandspace(${c}, ${d}, ${h})`}const f=i.get("paddingInner")??i.get("padding");return{signal:`${e.step} * ${c} / (1-${Epe(f)})`}}else return e.step}function wj(e,t){if(ZB({step:e,offsetIsDiscrete:En(t)})==="offset")return{step:e.step}}function f2e(e,t,n){const r=e===Mu?"x":"y",i=t.getScaleComponent(r);if(!i)return xj(r,t,n,{center:!0});const s=i.get("type"),o=t.scaleName(r),{markDef:a,config:u}=t;if(s==="band"){const l=Ej(r,t.size,t.config.view);if(vo(l)){const c=wj(l,n);if(c)return c}return[0,{signal:`bandwidth('${o}')`}]}else{const l=t.encoding[r];if(ue(l)&&l.timeUnit){const c=VP(l.timeUnit,p=>`scale('${o}', ${p})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=yu({fieldDef:l,markDef:a,config:u})-.5,h=d!==0?` + ${d}`:"";if(f){const p=De(f)?`${f.signal}/2`+h:`${f/2+d}`,g=De(f)?`(1 - ${f.signal}/2)`+h:`${1-f/2+d}`;return[{signal:`${p} * (${c})`},{signal:`${g} * (${c})`}]}return[0,{signal:c}]}return sP(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function Ej(e,t,n){const r=e===Lt?"width":"height",i=t[r];return i||nv(n,r)}function d2e(e,t,n,r){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&Q(n)?n.length+1:(oe($ge(r)),3)}}function h2e(e,t,n){const r=()=>{const i=fs(t),s=fs(e),o=`(${i} - ${s}) / (${n} - 1)`;return`sequence(${s}, ${i} + ${o}, ${o})`};return De(t)?new hn(r):{signal:r()}}function p2e(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(Wy("size",e))}const I4=.95;function g2e(e,t,n,r){const i={x:L4(n,"x"),y:L4(n,"y")};switch(e){case"bar":case"tick":{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;const s=P4(t,i,r.view);return ut(s)?s-1:new hn(()=>`${s.signal} - 1`)}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const s=P4(t,i,r.view);return ut(s)?Math.pow(I4*s,2):new hn(()=>`pow(${I4} * ${s.signal}, 2)`)}}throw new Error(Wy("size",e))}function P4(e,t,n){const r=vo(e.width)?e.width.step:Kw(n,"width"),i=vo(e.height)?e.height.step:Kw(n,"height");return t.x||t.y?new hn(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(", ")})`):Math.min(r,i)}function Aj(e,t){Pt(e)?m2e(e,t):kj(e,t)}function m2e(e,t){const n=e.component.scales,{config:r,encoding:i,markDef:s,specifiedScales:o}=e;for(const a of re(n)){const u=o[a],l=n[a],c=e.getScaleComponent(a),f=an(i[a]),d=u[t],h=c.get("type"),p=c.get("padding"),g=c.get("paddingInner"),m=Gw(h,t),v=iB(a,t);if(d!==void 0&&(m?v&&oe(v):oe(IP(h,t,a))),m&&v===void 0)if(d!==void 0){const y=f.timeUnit,b=f.type;switch(t){case"domainMax":case"domainMin":_c(u[t])||b==="temporal"||y?l.set(t,{signal:tb(u[t],{type:b,timeUnit:y})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const y=ie(B4,t)?B4[t]({model:e,channel:a,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:g,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:s,config:r,hasNestedOffsetScale:RB(i,a),hasSecondaryRangeChannel:!!i[$o(a)]}):r.scale[t];y!==void 0&&l.set(t,y,!1)}}}const B4={bins:({model:e,fieldOrDatumDef:t})=>ue(t)?v2e(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>y2e(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:s})=>b2e(e,t,n,r,i,s),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>x2e(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:s})=>_2e(e,t,n.type,r,i.scale,s),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:s})=>w2e(e,t,n,r,i.scale,s),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>{const i=ue(e)?e.sort:void 0;return E2e(t,i,n,r.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:s,hasSecondaryRangeChannel:o})=>A2e(e,t,n,r,i,s.scale,o)};function Sj(e){Pt(e)?a2e(e):kj(e,"range")}function kj(e,t){const n=e.component.scales;for(const r of e.children)t==="range"?Sj(r):Aj(r,t);for(const r of re(n)){let i;for(const s of e.children){const o=s.component.scales[r];if(o){const a=o.getWithExplicit(t);i=bu(i,a,t,"scale",cz((u,l)=>{switch(t){case"range":return u.step&&l.step?u.step-l.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function v2e(e,t){const n=t.bin;if(Ft(n)){const r=V3(e,t.field,n);return new hn(()=>e.getSignalName(r))}else if(Fn(n)&&bc(n)&&n.step!==void 0)return{step:n.step}}function y2e(e,t){if(Ze([qr,Co,Fo],e)&&t!=="nominal")return"hcl"}function b2e(e,t,n,r,i,s){var o;if(!((o=ws(s))!=null&&o.bin||Q(n)||i!=null||r!=null||Ze([Mn.TIME,Mn.UTC],e)))return Zt(t)?!0:void 0}function x2e(e,t,n,r,i,s){if(Zt(e)){if(eo(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:o,orient:a}=i;if(o==="bar"&&!(ue(r)&&(r.bin||r.timeUnit))&&(a==="vertical"&&e==="x"||a==="horizontal"&&e==="y"))return s.continuousBandSize}if(t===Mn.POINT)return n.pointPadding}}function _2e(e,t,n,r,i,s=!1){if(e===void 0){if(Zt(t)){const{bandPaddingInner:o,barBandPaddingInner:a,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=i;return s?c:Kt(o,n==="bar"?a:n==="tick"?l:u)}else if(Og(t)&&r===Mn.BAND)return i.offsetBandPaddingInner}}function w2e(e,t,n,r,i,s=!1){if(e===void 0){if(Zt(t)){const{bandPaddingOuter:o,bandWithNestedOffsetPaddingOuter:a}=i;if(s)return a;if(n===Mn.BAND)return Kt(o,De(r)?{signal:`${r.signal}/2`}:r/2)}else if(Og(t)){if(n===Mn.POINT)return .5;if(n===Mn.BAND)return i.offsetBandPaddingOuter}}}function E2e(e,t,n,r){if(n==="x"&&r.xReverse!==void 0)return xs(e)&&t==="descending"?De(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(xs(e)&&t==="descending")return!0}function A2e(e,t,n,r,i,s,o){if(!!n&&n!=="unaggregated"&&xs(i)){if(Q(n)){const u=n[0],l=n[n.length-1];if(ut(u)&&u<=0&&ut(l)&&l>=0)return!0}return!1}if(e==="size"&&t.type==="quantitative"&&!nd(i))return!0;if(!(ue(t)&&t.bin)&&Ze([...xa,...ipe],e)){const{orient:u,type:l}=r;return Ze(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:Ze(["bar","area"],l)&&!o?!0:s==null?void 0:s.zero}return!1}function S2e(e,t,n,r,i=!1){const s=k2e(t,n,r,i),{type:o}=e;return Do(t)?o!==void 0?d0e(t,o)?ue(n)&&!f0e(o,n.type)?(oe(hge(o,s)),s):o:(oe(dge(t,o,s)),s):s:null}function k2e(e,t,n,r){var i;switch(t.type){case"nominal":case"ordinal":{if(ff(e)||Z2(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&oe(J2(e,"ordinal")),"ordinal";if(K2(e))return"band";if(Zt(e)||Og(e)){if(Ze(["rect","bar","image","rule","tick"],n.type)||r)return"band"}else if(n.type==="arc"&&e in HC)return"band";const s=n[Hr(e)];return ec(s)||id(t)&&((i=t.axis)!=null&&i.tickBand)?"band":"point"}case"temporal":return ff(e)?"time":Z2(e)==="discrete"?(oe(J2(e,"temporal")),"ordinal"):ue(t)&&t.timeUnit&&_n(t.timeUnit).utc?"utc":K2(e)?"band":"time";case"quantitative":return ff(e)?ue(t)&&Ft(t.bin)?"bin-ordinal":"linear":Z2(e)==="discrete"?(oe(J2(e,"quantitative")),"ordinal"):K2(e)?"band":"linear";case"geojson":return}throw new Error(OP(t.type))}function C2e(e,{ignoreRange:t}={}){Cj(e),vj(e);for(const n of c0e)Aj(e,n);t||Sj(e)}function Cj(e){Pt(e)?e.component.scales=F2e(e):e.component.scales=D2e(e)}function F2e(e){const{encoding:t,mark:n,markDef:r}=e,i={};for(const s of GC){const o=an(t[s]);if(o&&n===aB&&s===Wr&&o.type===Od)continue;let a=o&&o.scale;if(o&&a!==null&&a!==!1){a??(a={});const u=RB(t,s),l=S2e(a,s,o,r,u);i[s]=new bj(e.scaleName(`${s}`,!0),{value:l,explicit:a.type===l})}}return i}const $2e=cz((e,t)=>PM(e)-PM(t));function D2e(e){var t;const n=e.component.scales={},r={},i=e.component.resolve;for(const s of e.children){Cj(s);for(const o of re(s.component.scales))if((t=i.scale)[o]??(t[o]=ij(o,e)),i.scale[o]==="shared"){const a=r[o],u=s.component.scales[o].getWithExplicit("type");a?e0e(a.value,u.value)?r[o]=bu(a,u,"type","scale",$2e):(i.scale[o]="independent",delete r[o]):r[o]=u}}for(const s of re(r)){const o=e.scaleName(s,!0),a=r[s];n[s]=new bj(o,a);for(const u of e.children){const l=u.component.scales[s];l&&(u.renameScale(l.get("name"),o),l.merged=!0)}}return n}class hx{constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Pt(e){return(e==null?void 0:e.type)==="unit"}function ui(e){return(e==null?void 0:e.type)==="facet"}function Q3(e){return(e==null?void 0:e.type)==="concat"}function zd(e){return(e==null?void 0:e.type)==="layer"}class eF{constructor(t,n,r,i,s,o,a){this.type=n,this.parent=r,this.config=s,this.parent=r,this.config=s,this.view=Dn(a),this.name=t.name??i,this.title=Oa(t.title)?{text:t.title}:t.title?Dn(t.title):void 0,this.scaleNameMap=r?r.scaleNameMap:new hx,this.projectionNameMap=r?r.projectionNameMap:new hx,this.signalNameMap=r?r.signalNameMap:new hx,this.data=t.data,this.description=t.description,this.transforms=k1e(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:Dme(t,n,s),this.component={data:{sources:r?r.component.data.sources:[],outputNodes:r?r.component.data.outputNodes:{},outputNodeRefCounts:r?r.component.data.outputNodeRefCounts:{},isFaceted:Jy(t)||(r==null?void 0:r.component.data.isFaceted)&&t.data===void 0},layoutSize:new wa,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?ze(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){C2e(this)}parseProjection(){pj(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){lj(this)}assembleEncodeFromView(t){const{style:n,...r}=t,i={};for(const s of re(r)){const o=r[s];o!==void 0&&(i[s]=Dt(o))}return i}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=Dt(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:_t(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:r,config:i}=this,s=Kye(r.layoutHeaders,i);return{padding:t,...this.assembleDefaultLayout(),...n,...s?{titleBand:s}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const r of Ci)t[r].title&&n.push(Wye(this,r));for(const r of W3)n=n.concat(Hye(this,r));return n}assembleAxes(){return Mye(this.component.axes,this.config)}assembleLegends(){return fj(this)}assembleProjections(){return bbe(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},r={...kP(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(r.text)return Ze(["unit","layer"],this.type)?Ze(["middle",void 0],r.anchor)&&(r.frame??(r.frame="group")):r.anchor??(r.anchor="start"),_t(r)?void 0:r}assembleGroup(t=[]){const n={};t=t.concat(this.assembleSignals()),t.length>0&&(n.signals=t);const r=this.assembleLayout();r&&(n.layout=r),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||ui(this.parent)?yj(this):[];i.length>0&&(n.scales=i);const s=this.assembleAxes();s.length>0&&(n.axes=s);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return Ot((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Bt[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),r=this.component.data.outputNodeRefCounts;return r[n]=(r[n]||0)+1,n}getSizeSignalRef(t){if(ui(this.parent)){const n=nj(t),r=jy(n),i=this.component.scales[r];if(i&&!i.merged){const s=i.get("type"),o=i.get("range");if(En(s)&&xc(o)){const a=i.get("name"),u=vb(this,r),l=J3(u);if(l){const c=ge({aggregate:"distinct",field:l},{expr:"datum"});return{signal:tj(a,i,c)}}else return oe(XC(r)),null}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){if(n)return this.getName(t);if(yP(t)&&Do(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t)))return this.scaleNameMap.get(this.getName(t))}projectionName(t){if(t)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let r=this.component.selection[t];if(!r&&this.parent&&(r=this.parent.getSelectionComponent(t,n)),!r)throw new Error(Fpe(n));return r}hasAxisOrientSignalRef(){var t,n;return((t=this.component.axes.x)==null?void 0:t.some(r=>r.hasOrientSignalRef()))||((n=this.component.axes.y)==null?void 0:n.some(r=>r.hasOrientSignalRef()))}}class Fj extends eF{vgField(t,n={}){const r=this.fieldDef(t);if(r)return ge(r,n)}reduceFieldDef(t,n){return sme(this.getMapping(),(r,i,s)=>{const o=ws(i);return o?t(r,o,s):r},n)}forEachFieldDef(t,n){E3(this.getMapping(),(r,i)=>{const s=ws(r);s&&t(s,i)},n)}}class yb extends bt{clone(){return new yb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"value",r[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${et(this.transform)}`}assemble(){const{density:t,...n}=this.transform,r={type:"kde",field:t,...n};return r.resolve=this.transform.resolve,r}}class bb extends bt{clone(){return new bb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${et(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class xb extends bt{clone(){return new xb(this.parent,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const{flatten:r,as:i=[]}=this.transform;this.transform.as=r.map((s,o)=>i[o]??s)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${et(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class _b extends bt{clone(){return new _b(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"key",r[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${et(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class pf extends bt{clone(){return new pf(null,ze(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let r=0;for(const i of[[Ds,$s],[zi,Ms]]){const s=i.map(o=>{const a=an(n.encoding[o]);return ue(a)?a.field:Mo(a)?{expr:`${a.datum}`}:_s(a)?{expr:`${a.value}`}:void 0});(s[0]||s[1])&&(t=new pf(t,s,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(Wr)){const i=n.typedFieldDef(Wr);i.type===Od&&(t=new pf(t,null,i.field,n.getName(`geojson_${r++}`)))}return t}constructor(t,n,r,i){super(t),this.fields=n,this.geojson=r,this.signal=i}dependentFields(){const t=(this.fields??[]).filter(be);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${et(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Bp extends bt{clone(){return new Bp(null,this.projection,ze(this.fields),ze(this.as))}constructor(t,n,r,i){super(t),this.projection=n,this.fields=r,this.as=i}static parseAll(t,n){if(!n.projectionName())return t;for(const r of[[Ds,$s],[zi,Ms]]){const i=r.map(o=>{const a=an(n.encoding[o]);return ue(a)?a.field:Mo(a)?{expr:`${a.datum}`}:_s(a)?{expr:`${a.value}`}:void 0}),s=r[0]===zi?"2":"";(i[0]||i[1])&&(t=new Bp(t,n.projectionName(),i,[n.getName(`x${s}`),n.getName(`y${s}`)]))}return t}dependentFields(){return new Set(this.fields.filter(be))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${et(this.fields)} ${et(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Cl extends bt{clone(){return new Cl(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:r,step:i}=t;return{signal:`sequence(${[n,r,...i?[i]:[]].join(",")})`}}static makeFromTransform(t,n){return new Cl(t,n)}static makeFromEncoding(t,n){const r=n.encoding,i=r.x,s=r.y;if(ue(i)&&ue(s)){const o=i.impute?i:s.impute?s:void 0;if(o===void 0)return;const a=i.impute?s:s.impute?i:void 0,{method:u,value:l,frame:c,keyvals:f}=o.impute,d=OB(n.mark,r);return new Cl(t,{impute:o.field,key:a.field,...u?{method:u}:{},...l!==void 0?{value:l}:{},...c?{frame:c}:{},...f!==void 0?{keyvals:f}:{},...d.length?{groupby:d}:{}})}return null}hash(){return`Impute ${et(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:r,method:i,groupby:s,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...r?{keyvals:a1e(r)?this.processSequence(r):r}:{},method:"value",...s?{groupby:s}:{},value:!i||i==="value"?o:null};if(i&&i!=="value"){const l={type:"window",as:[`imputed_${t}_value`],ops:[i],fields:[t],frame:a,ignorePeers:!1,...s?{groupby:s}:{}},c={type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t};return[u,l,c]}else return[u]}}class wb extends bt{clone(){return new wb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??n.on,r[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${et(this.transform)}`}assemble(){const{loess:t,on:n,...r}=this.transform;return{type:"loess",x:n,y:t,...r}}}class zp extends bt{clone(){return new zp(null,ze(this.transform),this.secondary)}constructor(t,n,r){super(t),this.transform=n,this.secondary=r}static make(t,n,r,i){const s=n.component.data.sources,{from:o}=r;let a=null;if(u1e(o)){let u=Mj(o.data,s);u||(u=new oc(o.data),s.push(u));const l=n.getName(`lookup_${i}`);a=new Br(u,l,Bt.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[l]=a}else if(l1e(o)){const u=o.param;r={as:u,...r};let l;try{l=n.getSelectionComponent(Ot(u),u)}catch{throw new Error(Rpe(u))}if(a=l.materialized,!a)throw new Error(Tpe(u))}return new zp(t,r,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?xe(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${et({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:xe(this.transform.as)}:{}};else{let n=this.transform.as;be(n)||(oe(Wpe),n="_lookup"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class Eb extends bt{clone(){return new Eb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"prob",r[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${et(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class Ab extends bt{clone(){return new Ab(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ze(n);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??n.on,r[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${et(this.transform)}`}assemble(){const{regression:t,on:n,...r}=this.transform;return{type:"regression",x:n,y:t,...r}}}class Sb extends bt{clone(){return new Sb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Qs((this.transform.groupby??[]).concat(t),n=>n)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${et(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:r,limit:i,op:s}=this.transform;return{type:"pivot",field:t,value:n,...i!==void 0?{limit:i}:{},...s!==void 0?{op:s}:{},...r!==void 0?{groupby:r}:{}}}}class kb extends bt{clone(){return new kb(null,ze(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${et(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function $j(e){let t=0;function n(r,i){if(r instanceof oc&&!r.isGenerator&&!od(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof Kn&&(r.parent instanceof oc&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof Pd){i.name||(i.name=`data_${t++}`),!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof Vg||r instanceof Xg||r instanceof fd||r instanceof Id||r instanceof ud||r instanceof Bp||r instanceof ps||r instanceof zp||r instanceof Bd||r instanceof kc||r instanceof _b||r instanceof xb||r instanceof yb||r instanceof wb||r instanceof Eb||r instanceof Ab||r instanceof xu||r instanceof kb||r instanceof Sb||r instanceof bb)&&i.transform.push(r.assemble()),(r instanceof oo||r instanceof io||r instanceof Cl||r instanceof oa||r instanceof pf)&&i.transform.push(...r.assemble()),r instanceof Br&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof Br?r.setSource(i.name):(i.name||(i.name=`data_${t++}`),r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof Br&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||(i.name=`data_${t++}`);let s=i.name;!i.source||i.transform.length>0?e.push(i):s=i.source;for(const o of r.children)n(o,{name:null,source:s,transform:[]});break}}}return n}function M2e(e){const t=[],n=$j(t);for(const r of e.children)n(r,{source:e.name,name:null,transform:[]});return t}function R2e(e,t){const n=[],r=$j(n);let i=0;for(const o of e.sources){o.hasName()||(o.dataName=`source_${i++}`);const a=o.assemble();r(o,a)}for(const o of n)o.transform.length===0&&delete o.transform;let s=0;for(const[o,a]of n.entries())(a.transform??[]).length===0&&!a.source&&n.splice(s++,0,n.splice(o,1)[0]);for(const o of n)for(const a of o.transform??[])a.type==="lookup"&&(a.from=e.outputNodes[a.from].getSource());for(const o of n)o.name in t&&(o.values=t[o.name]);return n}function T2e(e){return e==="top"||e==="left"||De(e)?"header":"footer"}function N2e(e){for(const t of Ci)O2e(e,t);z4(e,"x"),z4(e,"y")}function O2e(e,t){var o;const{facet:n,config:r,child:i,component:s}=e;if(e.channelHasField(t)){const a=n[t],u=cd("title",null,r,t);let l=df(a,r,{allowDisabling:!0,includeDefault:u===void 0||!!u});i.component.layoutHeaders[t].title&&(l=Q(l)?l.join(", "):l,l+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);const c=cd("labelOrient",a.header,r,t),f=a.header!==null?Kt((o=a.header)==null?void 0:o.labels,r.header.labels,!0):!1,d=Ze(["bottom","right"],c)?"footer":"header";s.layoutHeaders[t]={title:a.header!==null?l:null,facetFieldDef:a,[d]:t==="facet"?[]:[Dj(e,t,f)]}}}function Dj(e,t,n){const r=t==="row"?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function z4(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=Y3(i,t),i.axis[t]==="shared"){const s=t==="x"?"column":"row",o=r[s];for(const a of n.component.axes[t]){const u=T2e(a.get("orient"));o[u]??(o[u]=[Dj(e,s,!1)]);const l=zh(a,"main",e.config,{header:!0});l&&o[u][0].axes.push(l),a.mainExtracted=!0}}}}function L2e(e){tF(e),av(e,"width"),av(e,"height")}function I2e(e){tF(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";av(e,t),av(e,n)}function tF(e){for(const t of e.children)t.parseLayoutSize()}function av(e,t){const n=nj(t),r=jy(n),i=e.component.resolve,s=e.component.layoutSize;let o;for(const a of e.children){const u=a.component.layoutSize.getWithExplicit(n),l=i.scale[r]??ij(r,e);if(l==="independent"&&u.value==="step"){o=void 0;break}if(o){if(l==="independent"&&o.value!==u.value){o=void 0;break}o=bu(o,u,n,"")}else o=u}if(o){for(const a of e.children)e.renameSignal(a.getName(n),e.getName(t)),a.component.layoutSize.set(n,"merged",!1);s.setWithExplicit(t,o)}else s.setWithExplicit(t,{explicit:!1,value:void 0})}function P2e(e){const{size:t,component:n}=e;for(const r of xa){const i=Hr(r);if(t[i]){const s=t[i];n.layoutSize.set(i,vo(s)?"step":s,!0)}else{const s=B2e(e,i);n.layoutSize.set(i,s,!1)}}}function B2e(e,t){const n=t==="width"?"x":"y",r=e.config,i=e.getScaleComponent(n);if(i){const s=i.get("type"),o=i.get("range");if(En(s)){const a=nv(r.view,t);return xc(o)||vo(a)?"step":a}else return Xw(r.view,t)}else{if(e.hasProjection||e.mark==="arc")return Xw(r.view,t);{const s=nv(r.view,t);return vo(s)?s.step:s}}}function gE(e,t,n){return ge(t,{suffix:`by_${ge(e)}`,...n})}class ap extends Fj{constructor(t,n,r,i){super(t,"facet",n,r,i,t.resolve),this.child=oF(t.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!Bg(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=re(t),r={};for(const i of n){if(![na,ra].includes(i)){oe(Wy(i,"facet"));break}const s=t[i];if(s.field===void 0){oe(Ww(s,i));break}r[i]=this.initFacetFieldDef(s,i)}return r}initFacetFieldDef(t,n){const r=w3(t,n);return r.header?r.header=Dn(r.header):r.header===null&&(r.header=null),r}channelHasField(t){return ie(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=Cb(this),this.child.parseData()}parseLayoutSize(){tF(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some(t=>so(t))&&ZC(KC)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),N2e(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of Ci)for(const r of H3){const i=this.component.layoutHeaders[n],s=i[r],{facetFieldDef:o}=i;if(o){const a=cd("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(a)){const u=gb(n,a);t.titleAnchor??(t.titleAnchor={}),t.titleAnchor[u]="end"}}if(s!=null&&s[0]){const a=n==="row"?"height":"width",u=r==="header"?"headerBand":"footerBand";n!=="facet"&&!this.child.component.layoutSize.get(a)&&(t[u]??(t[u]={}),t[u][n]=.5),i.title&&(t.offset??(t.offset={}),t.offset[n==="row"?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,r=t?this.columnDistinctSignal():n?1:void 0;let i="all";return(!n&&this.component.resolve.scale.x==="independent"||!t&&this.component.resolve.scale.y==="independent")&&(i="none"),{...this.getHeaderLayoutMixins(),...r?{columns:r}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof ap))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof ap?{...this.channelHasField("column")?{encode:{update:{columns:{field:ge(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],r=[];if(this.child instanceof ap){if(this.child.channelHasField("column")){const i=ge(this.child.facet.column);t.push(i),n.push("distinct"),r.push(`distinct_${i}`)}}else for(const i of xa){const s=this.child.component.scales[i];if(s&&!s.merged){const o=s.get("type"),a=s.get("range");if(En(o)&&xc(a)){const u=vb(this.child,i),l=J3(u);l?(t.push(l),n.push("distinct"),r.push(`distinct_${l}`)):oe(XC(i))}}}return{fields:t,ops:n,as:r}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:r,column:i}=this.facet,{fields:s,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const c of Ci){const f=this.facet[c];if(f){u.push(ge(f));const{bin:d,sort:h}=f;if(Ft(d)&&u.push(ge(f,{binSuffix:"end"})),ia(h)){const{field:p,op:g=Zy}=h,m=gE(f,h);r&&i?(s.push(m),o.push("max"),a.push(m)):(s.push(p),o.push(g),a.push(m))}else if(Q(h)){const p=ld(f,c);s.push(p),o.push("max"),a.push(p)}}}const l=!!r&&!!i;return{name:t,data:n,groupby:u,...l||s.length>0?{aggregate:{...l?{cross:l}:{},...s.length?{fields:s,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,r=n[t];return r?ia(r.sort)?[gE(r,r.sort,{expr:"datum"})]:Q(r.sort)?[ld(r,t,{expr:"datum"})]:[ge(r,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,r=n[t];if(r){const{sort:i}=r;return[(ia(i)?i.order:!Q(i)&&i)||"ascending"]}return[]}assembleLabelTitle(){var i;const{facet:t,config:n}=this;if(t.facet)return uE(t.facet,"facet",n);const r={row:["top","bottom"],column:["left","right"]};for(const s of W3)if(t[s]){const o=cd("labelOrient",(i=t[s])==null?void 0:i.header,n,s);if(r[s].includes(o))return uE(t[s],s,n)}}assembleMarks(){const{child:t}=this,n=this.component.data.facetRoot,r=M2e(n),i=t.assembleGroupEncodeEntry(!1),s=this.assembleLabelTitle()||t.assembleTitle(),o=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...s?{title:s}:{},...o?{style:o}:{},from:{facet:this.assembleFacet()},sort:{field:Ci.map(u=>this.facetSortFields(u)).flat(),order:Ci.map(u=>this.facetSortOrder(u)).flat()},...r.length>0?{data:r}:{},...i?{encode:{update:i}}:{},...t.assembleGroup(H1e(this,[]))}]}getMapping(){return this.facet}}function z2e(e,t){const{row:n,column:r}=t;if(n&&r){let i=null;for(const s of[n,r])if(ia(s.sort)){const{field:o,op:a=Zy}=s.sort;e=i=new kc(e,{joinaggregate:[{op:a,field:o,as:gE(s,s.sort,{forAs:!0})}],groupby:[ge(s)]})}return i}return null}function Mj(e,t){var n,r,i,s;for(const o of t){const a=o.data;if(e.name&&o.hasName()&&e.name!==o.dataName)continue;const u=(n=e.format)==null?void 0:n.mesh,l=(r=a.format)==null?void 0:r.feature;if(u&&l)continue;const c=(i=e.format)==null?void 0:i.feature;if((c||l)&&c!==l)continue;const f=(s=a.format)==null?void 0:s.mesh;if(!((u||f)&&u!==f)){if(Lp(e)&&Lp(a)){if(ri(e.values,a.values))return o}else if(od(e)&&od(a)){if(e.url===a.url)return o}else if(fz(e)&&e.name===o.dataName)return o}}return null}function j2e(e,t){if(e.data||!e.parent){if(e.data===null){const r=new oc({values:[]});return t.push(r),r}const n=Mj(e.data,t);if(n)return iu(e.data)||(n.data.format=oP({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const r=new oc(e.data);return t.push(r),r}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function U2e(e,t,n){let r=0;for(const i of t.transforms){let s,o;if(b1e(i))o=e=new ud(e,i),s="derived";else if(N3(i)){const a=Rbe(i);o=e=Kn.makeWithAncestors(e,{},a,n)??e,e=new Id(e,t,i.filter)}else if(oz(i))o=e=oo.makeFromTransform(e,i,t),s="number";else if(_1e(i))s="date",n.getWithExplicit(i.field).value===void 0&&(e=new Kn(e,{[i.field]:s}),n.set(i.field,s,!1)),o=e=io.makeFromTransform(e,i);else if(w1e(i))o=e=ps.makeFromTransform(e,i),s="number",z3(t)&&(e=new xu(e));else if(sz(i))o=e=zp.make(e,t,i,r++),s="derived";else if(m1e(i))o=e=new Bd(e,i),s="number";else if(v1e(i))o=e=new kc(e,i),s="number";else if(E1e(i))o=e=oa.makeFromTransform(e,i),s="derived";else if(A1e(i))o=e=new _b(e,i),s="derived";else if(S1e(i))o=e=new bb(e,i),s="derived";else if(y1e(i))o=e=new xb(e,i),s="derived";else if(c1e(i))o=e=new Sb(e,i),s="derived";else if(g1e(i))e=new kb(e,i);else if(x1e(i))o=e=Cl.makeFromTransform(e,i),s="derived";else if(f1e(i))o=e=new yb(e,i),s="derived";else if(d1e(i))o=e=new Eb(e,i),s="derived";else if(h1e(i))o=e=new Ab(e,i),s="derived";else if(p1e(i))o=e=new wb(e,i),s="derived";else{oe(qpe(i));continue}if(o&&s!==void 0)for(const a of o.producedFields()??[])n.set(a,s,!1)}return e}function Cb(e){var m;let t=j2e(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,o=!(i&&(iu(i)||od(i)||Lp(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new I1e;iu(i)?(dz(i)?t=new Xg(t,i.sequence):O3(i)&&(t=new Vg(t,i.graticule)),o.parseNothing=!0):((m=i==null?void 0:i.format)==null?void 0:m.parse)===null&&(o.parseNothing=!0),t=Kn.makeExplicit(t,e,o)??t,t=new xu(t);const a=e.parent&&zd(e.parent);(Pt(e)||ui(e))&&a&&(t=oo.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=U2e(t,e,o));const u=Nbe(e),l=Tbe(e);t=Kn.makeWithAncestors(t,{},{...u,...l},o)??t,Pt(e)&&(t=pf.parseAll(t,e),t=Bp.parseAll(t,e)),(Pt(e)||ui(e))&&(a||(t=oo.makeFromEncoding(t,e)??t),t=io.makeFromEncoding(t,e)??t,t=ud.parseAllForSortIndex(t,e));const c=t=N0(Bt.Raw,e,t);if(Pt(e)){const v=ps.makeFromEncoding(t,e);v&&(t=v,z3(e)&&(t=new xu(t))),t=Cl.makeFromEncoding(t,e)??t,t=oa.makeFromEncoding(t,e)??t}let f,d;if(Pt(e)){const{markDef:v,mark:y,config:b}=e,x=xt("invalid",v,b),{marks:_,scales:A}=d=pz({invalid:x,isPath:Pu(y)});_!==A&&A==="include-invalid-values"&&(f=t=N0(Bt.PreFilterInvalid,e,t)),_==="exclude-invalid-values"&&(t=fd.make(t,e,d)??t)}const h=t=N0(Bt.Main,e,t);let p;if(Pt(e)&&d){const{marks:v,scales:y}=d;v==="include-invalid-values"&&y==="exclude-invalid-values"&&(t=fd.make(t,e,d)??t,p=t=N0(Bt.PostFilterInvalid,e,t))}Pt(e)&&$ye(e,h);let g=null;if(ui(e)){const v=e.getName("facet");t=z2e(t,e.facet)??t,g=new Pd(t,e,v,h.getSource()),n[v]=g}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:c,main:h,facetRoot:g,ancestorParse:o,preFilterInvalid:f,postFilterInvalid:p}}function N0(e,t,n){const{outputNodes:r,outputNodeRefCounts:i}=t.component.data,s=t.getDataName(e),o=new Br(n,s,e,i);return r[s]=o,o}class q2e extends eF{constructor(t,n,r,i){var s,o,a,u;super(t,"concat",n,r,i,t.resolve),(((o=(s=t.resolve)==null?void 0:s.axis)==null?void 0:o.x)==="shared"||((u=(a=t.resolve)==null?void 0:a.axis)==null?void 0:u.y)==="shared")&&oe(zpe),this.children=this.getChildren(t).map((l,c)=>oF(l,this,this.getName(`concat_${c}`),void 0,i))}parseData(){this.component.data=Cb(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of re(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>so(t))&&ZC(KC)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return ib(t)?t.vconcat:R3(t)?t.hconcat:t.concat}parseLayoutSize(){I2e(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,r)=>r.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.forEach(t=>t.assembleSignals()),[]}assembleLayoutSignals(){const t=G3(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce((n,r)=>r.assembleSelectionData(n),t)}assembleMarks(){return this.children.map(t=>{const n=t.assembleTitle(),r=t.assembleGroupStyle(),i=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...r?{style:r}:{},...i?{encode:{update:i}}:{},...t.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...t!=null?{columns:t}:{},bounds:"full",align:"each"}}}function W2e(e){return e===!1||e===null}const H2e={disable:1,gridScale:1,scale:1,...$B,labelExpr:1,encode:1},Rj=re(H2e);class nF extends wa{constructor(t={},n={},r=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=r}clone(){return new nF(ze(this.explicit),ze(this.implicit),this.mainExtracted)}hasAxisPart(t){return t==="axis"?!0:t==="grid"||t==="title"?!!this.get(t):!W2e(this.get(t))}hasOrientSignalRef(){return De(this.explicit.orient)}}function G2e(e,t,n){const{encoding:r,config:i}=e,s=an(r[t])??an(r[$o(t)]),o=e.axis(t)||{},{format:a,formatType:u}=o;if(tc(u))return{text:ds({fieldOrDatumDef:s,field:"datum.value",format:a,formatType:u,config:i}),...n};if(a===void 0&&u===void 0&&i.customFormatTypes){if(rd(s)==="quantitative"){if(id(s)&&s.stack==="normalize"&&i.normalizedNumberFormatType)return{text:ds({fieldOrDatumDef:s,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:ds({fieldOrDatumDef:s,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(rd(s)==="temporal"&&i.timeFormatType&&ue(s)&&!s.timeUnit)return{text:ds({fieldOrDatumDef:s,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function Y2e(e){return xa.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[exe(n,e)]),t),{})}const V2e={bottom:"top",top:"bottom",left:"right",right:"left"};function X2e(e){const{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const s of re(i.component.axes))n.axis[s]=Y3(e.component.resolve,s),n.axis[s]==="shared"&&(t[s]=K2e(t[s],i.component.axes[s]),t[s]||(n.axis[s]="independent",delete t[s]))}for(const i of xa){for(const s of e.children)if(s.component.axes[i]){if(n.axis[i]==="independent"){t[i]=(t[i]??[]).concat(s.component.axes[i]);for(const o of s.component.axes[i]){const{value:a,explicit:u}=o.getWithExplicit("orient");if(!De(a)){if(r[a]>0&&!u){const l=V2e[a];r[a]>r[l]&&o.set("orient",l,!1)}r[a]++}}}delete s.component.axes[i]}if(n.axis[i]==="independent"&&t[i]&&t[i].length>1)for(const[s,o]of(t[i]||[]).entries())s>0&&o.get("grid")&&!o.explicit.grid&&(o.implicit.grid=!1)}}function K2e(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let r=0;rn.clone());return e}function Z2e(e,t){for(const n of Rj){const r=bu(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(i,s)=>{switch(n){case"title":return TP(i,s);case"gridScale":return{explicit:i.explicit,value:Kt(i.value,s.value)}}return ob(i,s,n,"axis")});e.setWithExplicit(n,r)}return e}function J2e(e,t,n,r,i){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(De(n.labelAngle)?n.labelAngle:Np(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===Zz(r,i))return!0}return e===n[t]}const Q2e=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function exe(e,t){var v,y;let n=t.axis(e);const r=new nF,i=an(t.encoding[e]),{mark:s,config:o}=t,a=(n==null?void 0:n.orient)||((v=o[e==="x"?"axisX":"axisY"])==null?void 0:v.orient)||((y=o.axis)==null?void 0:y.orient)||Bye(e),u=t.getScaleComponent(e).get("type"),l=Rye(e,u,a,t.config),c=n!==void 0?!n:oE("disable",o.style,n==null?void 0:n.style,l).configValue;if(r.set("disable",c,n!==void 0),c)return r;n=n||{};const f=Lye(i,n,e,o.style,l),d=gB(n.formatType,i,u),h=pB(i,i.type,n.format,n.formatType,o,!0),p={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:u,orient:a,labelAngle:f,format:h,formatType:d,mark:s,config:o};for(const b of Rj){const x=b in S4?S4[b](p):HM(b)?n[b]:void 0,_=x!==void 0,A=J2e(x,b,n,t,e);if(_&&A)r.set(b,x,A);else{const{configValue:E=void 0,configFrom:S=void 0}=HM(b)&&b!=="values"?oE(b,o.style,n.style,l):{},k=E!==void 0;_&&!k?r.set(b,x,A):(S!=="vgAxisConfig"||Q2e.has(b)&&k||qg(E)||De(E))&&r.set(b,E,!1)}}const g=n.encoding??{},m=FB.reduce((b,x)=>{if(!r.hasAxisPart(x))return b;const _=rj(g[x]??{},t),A=x==="labels"?G2e(t,e,_):_;return A!==void 0&&!_t(A)&&(b[x]={update:A}),b},{});return _t(m)||r.set("encode",m,!!n.encoding||n.labelAngle!==void 0),r}function txe({encoding:e,size:t}){for(const n of xa){const r=Hr(n);vo(t[r])&&Va(e[n])&&(delete t[r],oe(PP(r)))}return t}const nxe={vgMark:"arc",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...mr("x",e,{defaultPos:"mid"}),...mr("y",e,{defaultPos:"mid"}),...da(e,"radius"),...da(e,"theta")})},rxe={vgMark:"area",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...rv("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...rv("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...B3(e)})},ixe={vgMark:"rect",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...da(e,"x"),...da(e,"y")})},sxe={vgMark:"shape",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&ue(n)&&n.type===Od?{field:ge(n,{expr:"datum"})}:{}}]}},oxe={vgMark:"image",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...da(e,"x"),...da(e,"y"),...I3(e,"url")})},axe={vgMark:"line",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...mr("x",e,{defaultPos:"mid"}),...mr("y",e,{defaultPos:"mid"}),...Rn("size",e,{vgChannel:"strokeWidth"}),...B3(e)})},uxe={vgMark:"trail",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...mr("x",e,{defaultPos:"mid"}),...mr("y",e,{defaultPos:"mid"}),...Rn("size",e),...B3(e)})};function rF(e,t){const{config:n}=e;return{...qi(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...mr("x",e,{defaultPos:"mid"}),...mr("y",e,{defaultPos:"mid"}),...Rn("size",e),...Rn("angle",e),...lxe(e,n,t)}}function lxe(e,t,n){return n?{shape:{value:n}}:Rn("shape",e)}const cxe={vgMark:"symbol",encodeEntry:e=>rF(e)},fxe={vgMark:"symbol",encodeEntry:e=>rF(e,"circle")},dxe={vgMark:"symbol",encodeEntry:e=>rF(e,"square")},hxe={vgMark:"rect",encodeEntry:e=>({...qi(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...da(e,"x"),...da(e,"y")})},pxe={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...qi(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...rv("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...rv("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...Rn("size",e,{vgChannel:"strokeWidth"})}}},gxe={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...qi(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...mr("x",e,{defaultPos:"mid"}),...mr("y",e,{defaultPos:"mid"}),...I3(e),...Rn("size",e,{vgChannel:"fontSize"}),...Rn("angle",e),...p4("align",mxe(e.markDef,n,t)),...p4("baseline",vxe(e.markDef,n,t)),...mr("radius",e,{defaultPos:null}),...mr("theta",e,{defaultPos:null})}}};function mxe(e,t,n){if(xt("align",e,n)===void 0)return"center"}function vxe(e,t,n){if(xt("baseline",e,n)===void 0)return"middle"}const yxe={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,r=n.orient,i=r==="horizontal"?"x":"y",s=r==="horizontal"?"y":"x",o=r==="horizontal"?"height":"width";return{...qi(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...da(e,i),...mr(s,e,{defaultPos:"mid",vgChannel:s==="y"?"yc":"xc"}),[o]:Dt(xt("thickness",n,t))}}},O0={arc:nxe,area:rxe,bar:ixe,circle:fxe,geoshape:sxe,image:oxe,line:axe,point:cxe,rect:hxe,rule:pxe,square:dxe,text:gxe,tick:yxe,trail:uxe};function bxe(e){if(Ze([Xy,Yy,m0e],e.mark)){const t=OB(e.mark,e.encoding);if(t.length>0)return xxe(e,t)}else if(e.mark===Vy){const t=Uw.some(n=>xt(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return _xe(e)}return iF(e)}const j4="faceted_path_";function xxe(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:j4+e.requestDataName(Bt.Main),data:e.requestDataName(Bt.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:iF(e,{fromPrefix:j4})}]}const U4="stack_group_";function _xe(e){var l;const[t]=iF(e,{fromPrefix:U4}),n=e.scaleName(e.stack.fieldChannel),r=(c={})=>e.vgField(e.stack.fieldChannel,c),i=(c,f)=>{const d=[r({prefix:"min",suffix:"start",expr:f}),r({prefix:"max",suffix:"start",expr:f}),r({prefix:"min",suffix:"end",expr:f}),r({prefix:"max",suffix:"end",expr:f})];return`${c}(${d.map(h=>`scale('${n}',${h})`).join(",")})`};let s,o;e.stack.fieldChannel==="x"?(s={...Zf(t.encode.update,["y","yc","y2","height",...Uw]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},o={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...Pr(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...Zf(t.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},o={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...Pr(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const c of Uw){const f=go(c,e.markDef,e.config);t.encode.update[c]?(s[c]=t.encode.update[c],delete t.encode.update[c]):f&&(s[c]=Dt(f)),f&&(t.encode.update[c]={value:0})}const a=[];if(((l=e.stack.groupbyChannels)==null?void 0:l.length)>0)for(const c of e.stack.groupbyChannels){const f=e.fieldDef(c),d=ge(f);d&&a.push(d),(f!=null&&f.bin||f!=null&&f.timeUnit)&&a.push(ge(f,{binSuffix:"end"}))}return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((c,f)=>{if(t.encode.update[f])return{...c,[f]:t.encode.update[f]};{const d=go(f,e.markDef,e.config);return d!==void 0?{...c,[f]:Dt(d)}:c}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Bt.Main),name:U4+e.requestDataName(Bt.Main),groupby:a,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:o},marks:[t]}]}]}function wxe(e){const{encoding:t,stack:n,mark:r,markDef:i,config:s}=e,o=t.order;if(!(!Q(o)&&_s(o)&&zw(o.value)||!o&&zw(xt("order",i,s)))){if((Q(o)||ue(o))&&!n)return DP(o,{expr:"datum"});if(Pu(r)){const a=i.orient==="horizontal"?"y":"x",u=t[a];if(ue(u))return{field:a}}}}function iF(e,t={fromPrefix:""}){const{mark:n,markDef:r,encoding:i,config:s}=e,o=Kt(r.clip,Exe(e),Axe(e)),a=FP(r),u=i.key,l=wxe(e),c=Sxe(e),f=xt("aria",r,s),d=O0[n].postEncodingTransform?O0[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:O0[n].vgMark,...o?{clip:o}:{},...a?{style:a}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(Bt.Main)},encode:{update:O0[n].encodeEntry(e)},...d?{transform:d}:{}}]}function Exe(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return t!=null&&t.get("selectionExtent")||n!=null&&n.get("selectionExtent")?!0:void 0}function Axe(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function Sxe(e){if(!e.component.selection)return null;const t=re(e.component.selection).length;let n=t,r=e.parent;for(;r&&n===0;)n=re(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class Tj extends Fj{constructor(t,n,r,i={},s){super(t,"unit",n,r,s,void 0,YM(t)?t.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=l=>{var c,f,d;return(c=l.from)!=null&&c.data&&(l.from.data=this.lookupDataSource(l.from.data),"time"in this.encoding&&(l.from.data=l.from.data+mz)),(d=(f=l.from)==null?void 0:f.facet)!=null&&d.data&&(l.from.facet.data=this.lookupDataSource(l.from.facet.data)),l};const o=mo(t.mark)?{...t.mark}:{type:t.mark},a=o.type;o.filled===void 0&&(o.filled=Qme(o,s,{graticule:t.data&&O3(t.data)}));const u=this.encoding=rme(t.encoding||{},a,o.filled,s);this.markDef=nz(o,u,s),this.size=txe({encoding:u,size:YM(t)?{...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}}:i}),this.stack=tz(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter(l=>D3(l))}get hasProjection(){const{encoding:t}=this,n=this.mark===aB,r=t&&Xhe.some(i=>Ue(t[i]));return n||r}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return GC.reduce((r,i)=>{const s=an(n[i]);return s&&(r[i]=this.initScale(s.scale??{})),r},{})}initScale(t){const{domain:n,range:r}=t,i=Dn(t);return Q(n)&&(i.domain=n.map(ti)),Q(r)&&(i.range=r.map(ti)),i}initAxes(t){return xa.reduce((n,r)=>{const i=t[r];if(Ue(i)||r===Lt&&Ue(t.x2)||r===Sn&&Ue(t.y2)){const s=Ue(i)?i.axis:void 0;n[r]=s&&this.initAxis({...s})}return n},{})}initAxis(t){const n=re(t),r={};for(const i of n){const s=t[i];r[i]=qg(s)?CP(s):ti(s)}return r}initLegends(t){return ope.reduce((n,r)=>{const i=an(t[r]);if(i&&upe(r)){const s=i.legend;n[r]=s&&Dn(s)}return n},{})}parseData(){this.component.data=Cb(this)}parseLayoutSize(){P2e(this)}parseSelections(){this.component.selection=Fye(this,this.selection)}parseMarkGroup(){this.component.mark=bxe(this)}parseAxesAndHeaders(){this.component.axes=Y2e(this)}assembleSelectionTopLevelSignals(t){return G1e(this,t)}assembleSignals(){return[...Vz(this),...W1e(this,[])]}assembleSelectionData(t){return Y1e(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return G3(this)}assembleMarks(){let t=this.component.mark??[];return(!this.parent||!zd(this.parent))&&(t=xz(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return t!==void 0?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return Sl(this.encoding,t)}fieldDef(t){const n=this.encoding[t];return ws(n)}typedFieldDef(t){const n=this.fieldDef(t);return _r(n)?n:null}}class sF extends eF{constructor(t,n,r,i,s){super(t,"layer",n,r,s,t.resolve,t.view);const o={...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((a,u)=>{if(sb(a))return new sF(a,this,this.getName(`layer_${u}`),o,s);if(_a(a))return new Tj(a,this,this.getName(`layer_${u}`),o,s);throw new Error(VC(a))})}parseData(){this.component.data=Cb(this);for(const t of this.children)t.parseData()}parseLayoutSize(){L2e(this)}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of re(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>so(t))&&ZC(KC)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){X2e(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,r)=>r.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleSignals()),Vz(this))}assembleLayoutSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleLayoutSignals()),G3(this))}assembleSelectionData(t){return this.children.reduce((n,r)=>r.assembleSelectionData(n),t)}assembleGroupStyle(){const t=new Set;for(const r of this.children)for(const i of xe(r.assembleGroupStyle()))t.add(i);const n=Array.from(t);return n.length>1?n:n.length===1?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return V1e(this,this.children.flatMap(t=>t.assembleMarks()))}assembleLegends(){return this.children.reduce((t,n)=>t.concat(n.assembleLegends()),fj(this))}}function oF(e,t,n,r,i){if(Jy(e))return new ap(e,t,n,i);if(sb(e))return new sF(e,t,n,r,i);if(_a(e))return new Tj(e,t,n,r,i);if(Cme(e))return new q2e(e,t,n,i);throw new Error(VC(e))}function kxe(e,t={}){t.logger&&Dge(t.logger),t.fieldTitle&&SB(t.fieldTitle);try{const n=ez(md(t.config,e.config)),r=lz(e,n),i=oF(r,null,"",void 0,n);return i.parse(),Kbe(i.component.data,i),{spec:Fxe(i,Cxe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&Mge(),t.fieldTitle&&V0e()}}function Cxe(e,t,n,r){const i=r.component.layoutSize.get("width"),s=r.component.layoutSize.get("height");if(t===void 0?(t={type:"pad"},r.hasAxisOrientSignalRef()&&(t.resize=!0)):be(t)&&(t={type:t}),i&&s&&N1e(t.type)){if(i==="step"&&s==="step")oe(MM()),t.type="pad";else if(i==="step"||s==="step"){const o=i==="step"?"width":"height";oe(MM(jy(o)));const a=o==="width"?"height":"width";t.type=O1e(a)}}return{...re(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...s4(n,!1),...s4(e,!0)}}function Fxe(e,t,n={},r){const i=e.config?jme(e.config):void 0,s=R2e(e.component.data,n),o=e.assembleSelectionData(s),a=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(p=>(p.name==="width"||p.name==="height")&&p.value!==void 0?(t[p.name]=+p.value,!1):!0);const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...KB(d)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}const $xe=qhe.version,Dxe=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:Qf,accessPathWithDatum:PC,accessWithDatumToUnescapedPath:mt,compile:kxe,contains:Ze,deepEqual:ri,deleteNestedProperty:Y1,duplicate:ze,entries:mu,every:OC,fieldIntersection:IC,flatAccessWithDatum:uP,getFirstDefined:Kt,hasIntersection:LC,hasProperty:ie,hash:et,internalField:fP,isBoolean:Tp,isEmpty:_t,isEqual:Hhe,isInternalField:dP,isNullOrFalse:zw,isNumeric:Oy,keys:re,logicalExpr:ip,mergeDeep:oP,never:sP,normalize:lz,normalizeAngle:Np,omit:Pr,pick:Zf,prefixGenerator:jw,removePathFromField:Td,replaceAll:Xl,replacePathInField:Bi,resetIdCounter:Yhe,setEqual:aP,some:Jf,stringify:wt,titleCase:Rg,unique:Qs,uniqueId:cP,vals:Pn,varName:Ot,version:$xe},Symbol.toStringTag,{value:"Module"}));function Nj(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var Mxe="2.15.0",Rxe={version:Mxe};const Uc="#fff",q4="#888",Txe={background:"#333",view:{stroke:q4},title:{color:Uc,subtitleColor:Uc},style:{"guide-label":{fill:Uc},"guide-title":{fill:Uc}},axis:{domainColor:Uc,gridColor:q4,tickColor:Uc}},Wu="#4572a7",Nxe={background:"#fff",arc:{fill:Wu},area:{fill:Wu},line:{stroke:Wu,strokeWidth:2},path:{stroke:Wu},rect:{fill:Wu},shape:{stroke:Wu},symbol:{fill:Wu,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Hu="#30a2da",px="#cbcbcb",Oxe="#999",Lxe="#333",W4="#f0f0f0",H4="#333",Ixe={arc:{fill:Hu},area:{fill:Hu},axis:{domainColor:px,grid:!0,gridColor:px,gridWidth:1,labelColor:Oxe,labelFontSize:10,titleColor:Lxe,tickColor:px,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:W4,group:{fill:W4},legend:{labelColor:H4,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:H4,titleFontSize:14,titlePadding:10},line:{stroke:Hu,strokeWidth:2},path:{stroke:Hu,strokeWidth:.5},rect:{fill:Hu},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Hu},bar:{binSpacing:2,fill:Hu,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Gu="#000",Pxe={group:{fill:"#e5e5e5"},arc:{fill:Gu},area:{fill:Gu},line:{stroke:Gu},path:{stroke:Gu},rect:{fill:Gu},shape:{stroke:Gu},symbol:{fill:Gu,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},Bxe=22,zxe="normal",G4="Benton Gothic, sans-serif",Y4=11.5,jxe="normal",Yu="#82c6df",gx="Benton Gothic Bold, sans-serif",V4="normal",X4=13,hh={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},Uxe={background:"#ffffff",title:{anchor:"start",color:"#000000",font:gx,fontSize:Bxe,fontWeight:zxe},arc:{fill:Yu},area:{fill:Yu},line:{stroke:Yu,strokeWidth:2},path:{stroke:Yu},rect:{fill:Yu},shape:{stroke:Yu},symbol:{fill:Yu,size:30},axis:{labelFont:G4,labelFontSize:Y4,labelFontWeight:jxe,titleFont:gx,titleFontSize:X4,titleFontWeight:V4},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:G4,labelFontSize:Y4,symbolType:"square",titleFont:gx,titleFontSize:X4,titleFontWeight:V4},range:{category:hh["category-6"],diverging:hh["fireandice-6"],heatmap:hh["fire-7"],ordinal:hh["fire-7"],ramp:hh["fire-7"]}},Vu="#ab5787",L0="#979797",qxe={background:"#f9f9f9",arc:{fill:Vu},area:{fill:Vu},line:{stroke:Vu},path:{stroke:Vu},rect:{fill:Vu},shape:{stroke:Vu},symbol:{fill:Vu,size:30},axis:{domainColor:L0,domainWidth:.5,gridWidth:.2,labelColor:L0,tickColor:L0,tickWidth:.2,titleColor:L0},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},Xu="#3e5c69",Wxe={background:"#fff",arc:{fill:Xu},area:{fill:Xu},line:{stroke:Xu},path:{stroke:Xu},rect:{fill:Xu},shape:{stroke:Xu},symbol:{fill:Xu},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},mi="#1696d2",K4="#000000",Hxe="#FFFFFF",I0="Lato",mx="Lato",Gxe="Lato",Yxe="#DEDDDD",Vxe=18,ph={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Xxe={background:Hxe,title:{anchor:"start",fontSize:Vxe,font:I0},axisX:{domain:!0,domainColor:K4,domainWidth:1,grid:!1,labelFontSize:12,labelFont:mx,labelAngle:0,tickColor:K4,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:I0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:Yxe,gridWidth:1,labelFontSize:12,labelFont:mx,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:I0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:mx,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:I0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:ph["six-groups-cat-1"],diverging:ph["diverging-colors"],heatmap:ph["diverging-colors"],ordinal:ph["six-groups-seq"],ramp:ph["shades-blue"]},area:{fill:mi},rect:{fill:mi},line:{color:mi,stroke:mi,strokeWidth:5},trail:{color:mi,stroke:mi,strokeWidth:0,size:1},path:{stroke:mi,strokeWidth:.5},point:{filled:!0},text:{font:Gxe,color:mi,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:mi,stroke:null}},arc:{fill:mi},shape:{stroke:mi},symbol:{fill:mi,size:30}},Ku="#3366CC",Z4="#ccc",P0="Arial, sans-serif",Kxe={arc:{fill:Ku},area:{fill:Ku},path:{stroke:Ku},rect:{fill:Ku},shape:{stroke:Ku},symbol:{stroke:Ku},circle:{fill:Ku},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:P0,fontSize:12},"guide-title":{font:P0,fontSize:12},"group-title":{font:P0,fontSize:12}},title:{font:P0,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:Z4,tickColor:Z4,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},aF=e=>e*(1/3+1),J4=aF(9),Q4=aF(10),e6=aF(12),gh="Segoe UI",t6="wf_standard-font, helvetica, arial, sans-serif",n6="#252423",mh="#605E5C",r6="transparent",Zxe="#C8C6C4",Xi="#118DFF",Jxe="#12239E",Qxe="#E66C37",e_e="#6B007B",t_e="#E044A7",n_e="#744EC2",r_e="#D9B300",i_e="#D64550",Oj=Xi,Lj="#DEEFFF",i6=[Lj,Oj],s_e=[Lj,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",Oj],o_e={view:{stroke:r6},background:r6,font:gh,header:{titleFont:t6,titleFontSize:e6,titleColor:n6,labelFont:gh,labelFontSize:Q4,labelColor:mh},axis:{ticks:!1,grid:!1,domain:!1,labelColor:mh,labelFontSize:J4,titleFont:t6,titleColor:n6,titleFontSize:e6,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:Zxe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Xi},line:{stroke:Xi,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:gh,fontSize:J4,fill:mh},arc:{fill:Xi},area:{fill:Xi,line:!0,opacity:.6},path:{stroke:Xi},rect:{fill:Xi},point:{fill:Xi,filled:!0,size:75},shape:{stroke:Xi},symbol:{fill:Xi,strokeWidth:1.5,size:50},legend:{titleFont:gh,titleFontWeight:"bold",titleColor:mh,labelFont:gh,labelFontSize:Q4,labelColor:mh,symbolType:"circle",symbolSize:75},range:{category:[Xi,Jxe,Qxe,e_e,t_e,n_e,r_e,i_e],diverging:i6,heatmap:i6,ordinal:s_e}},vx='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',a_e='IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',yx=400,B0={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},u_e=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],l_e=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Fb({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",r=B0.gridBg[e],i=B0.textPrimary[e],s=B0.textSecondary[e],o=n==="dark"?u_e:l_e,a=n==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:vx,fontWeight:600},axis:{labelColor:s,labelFontSize:12,labelFont:a_e,labelFontWeight:yx,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:B0.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:vx,fill:s,fontWeight:yx},"guide-title":{font:vx,fill:s,fontWeight:yx}},range:{category:o,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const c_e=Fb({theme:"white",background:"#ffffff"}),f_e=Fb({theme:"g10",background:"#f4f4f4"}),d_e=Fb({theme:"g90",background:"#262626"}),h_e=Fb({theme:"g100",background:"#161616"}),p_e=Rxe.version,g_e=Object.freeze(Object.defineProperty({__proto__:null,carbong10:f_e,carbong100:h_e,carbong90:d_e,carbonwhite:c_e,dark:Txe,excel:Nxe,fivethirtyeight:Ixe,ggplot2:Pxe,googlecharts:Kxe,latimes:Uxe,powerbi:o_e,quartz:qxe,urbaninstitute:Xxe,version:p_e,vox:Wxe},Symbol.toStringTag,{value:"Module"}));function m_e(e,t,n,r){if(Q(e))return`[${e.map(i=>t(be(i)?i:s6(i,n))).join(", ")}]`;if(ve(e)){let i="";const{title:s,image:o,...a}=e;s&&(i+=`

      ${t(s)}

      `),o&&(i+=``);const u=Object.keys(a);if(u.length>0){i+="";for(const l of u){let c=a[l];c!==void 0&&(ve(c)&&(c=s6(c,n)),i+=``)}i+="
      ${t(l)}${t(c)}
      "}return i||"{}"}return t(e)}function v_e(e){const t=[];return function(n,r){if(typeof r!="object"||r===null)return r;const i=t.indexOf(this)+1;return t.length=i,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}function s6(e,t){return JSON.stringify(e,v_e(t))}var y_e=`#vg-tooltip-element { + visibility: hidden; + padding: 8px; + position: fixed; + z-index: 1000; + font-family: sans-serif; + font-size: 11px; + border-radius: 3px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + /* The default theme is the light theme. */ + background-color: rgba(255, 255, 255, 0.95); + border: 1px solid #d9d9d9; + color: black; +} +#vg-tooltip-element.visible { + visibility: visible; +} +#vg-tooltip-element h2 { + margin-top: 0; + margin-bottom: 10px; + font-size: 13px; +} +#vg-tooltip-element table { + border-spacing: 0; +} +#vg-tooltip-element table tr { + border: none; +} +#vg-tooltip-element table tr td { + overflow: hidden; + text-overflow: ellipsis; + padding-top: 2px; + padding-bottom: 2px; +} +#vg-tooltip-element table tr td.key { + color: #808080; + max-width: 150px; + text-align: right; + padding-right: 4px; +} +#vg-tooltip-element table tr td.value { + display: block; + max-width: 300px; + max-height: 7em; + text-align: left; +} +#vg-tooltip-element.dark-theme { + background-color: rgba(32, 32, 32, 0.9); + border: 1px solid #f5f5f5; + color: white; +} +#vg-tooltip-element.dark-theme td.key { + color: #bfbfbf; +} +`;const Ij="vg-tooltip-element",b_e={offsetX:10,offsetY:10,id:Ij,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:x_e,maxDepth:2,formatTooltip:m_e,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function x_e(e){return String(e).replace(/&/g,"&").replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function A_e(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class S_e{constructor(t){this.options={...b_e,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const r=document.createElement("style");r.setAttribute("id",this.options.styleId),r.innerHTML=__e(n);const i=document.head;i.childNodes.length>0?i.insertBefore(r,i.childNodes[0]):i.appendChild(r)}}tooltipHandler(t,n,r,i){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),i==null||i===""){this.el.classList.remove("visible",`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:s,y:o}=this.options.anchor==="mark"?w_e(t,n,r,this.el.getBoundingClientRect(),this.options):Pj(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${s}px`}}var bx={};/*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + */var k_e=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),C_e=Object.prototype.hasOwnProperty;function mE(e,t){return C_e.call(e,t)}function vE(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function Qu(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function jj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function bE(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&u[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(l[h]===void 0?d=u.slice(0,c).join("/"):c==f-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),c++,Array.isArray(l)){if(h==="-")h=l.length;else{if(n&&!yE(h))throw new jt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);yE(h)&&(h=~~h)}if(c>=f){if(n&&t.op==="add"&&h>l.length)throw new jt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var o=$_e[t.op].call(t,l,h,e);if(o.test===!1)throw new jt("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}}else if(c>=f){var o=nf[t.op].call(t,l,h,e);if(o.test===!1)throw new jt("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}if(l=l[h],n&&c0)throw new jt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new jt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new jt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&bE(e.value))throw new jt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var i=e.path.split("/").length,s=r.split("/").length;if(i!==s+1&&i!==s)throw new jt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==r)throw new jt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var o={op:"_get",path:e.from,value:void 0},a=qj([o],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new jt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new jt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function qj(e,t,n){try{if(!Array.isArray(e))throw new jt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)$b(ii(t),ii(e),n||!0);else{n=n||lv;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function lF(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=vE(t),o=vE(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(mE(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?lF(c,f,n,r+"/"+Qu(l),i):c!==f&&(i&&n.push({op:"test",path:r+"/"+Qu(l),value:ii(c)}),n.push({op:"replace",path:r+"/"+Qu(l),value:ii(f)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+Qu(l),value:ii(c)}),n.push({op:"remove",path:r+"/"+Qu(l)}),a=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}))}if(!(!a&&s.length==o.length))for(var u=0;u=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(n,r)}return this}}return xx=e,xx}var _x,u6;function cF(){if(u6)return _x;u6=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return _x=r=>r?typeof r!="object"?e:r:t,_x}var z0={exports:{}},wx,l6;function fF(){if(l6)return wx;l6=1;const e="2.0.0",t=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,r=16,i=t-6;return wx={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},wx}var Ex,c6;function Db(){return c6||(c6=1,Ex=typeof process=="object"&&bx&&bx.NODE_DEBUG&&/\bsemver\b/i.test(bx.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Ex}var f6;function dF(){return f6||(f6=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=fF(),s=Db();t=e.exports={};const o=t.re=[],a=t.safeRe=[],u=t.src=[],l=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[f,r]],h=g=>{for(const[m,v]of d)g=g.split(`${m}*`).join(`${m}{0,${v}}`).split(`${m}+`).join(`${m}{1,${v}}`);return g},p=(g,m,v)=>{const y=h(m),b=c++;s(g,b,m),l[g]=b,u[b]=m,o[b]=new RegExp(m,v?"g":void 0),a[b]=new RegExp(y,v?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),p("MAINVERSION",`(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${u[l.NUMERICIDENTIFIER]}|${u[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${u[l.NUMERICIDENTIFIERLOOSE]}|${u[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${u[l.PRERELEASEIDENTIFIER]}(?:\\.${u[l.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${u[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[l.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${f}+`),p("BUILD",`(?:\\+(${u[l.BUILDIDENTIFIER]}(?:\\.${u[l.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${u[l.MAINVERSION]}${u[l.PRERELEASE]}?${u[l.BUILD]}?`),p("FULL",`^${u[l.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${u[l.MAINVERSIONLOOSE]}${u[l.PRERELEASELOOSE]}?${u[l.BUILD]}?`),p("LOOSE",`^${u[l.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${u[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${u[l.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:${u[l.PRERELEASE]})?${u[l.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:${u[l.PRERELEASELOOSE]})?${u[l.BUILD]}?)?)?`),p("XRANGE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),p("COERCE",`${u[l.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",u[l.COERCEPLAIN]+`(?:${u[l.PRERELEASE]})?(?:${u[l.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",u[l.COERCE],!0),p("COERCERTLFULL",u[l.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${u[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${u[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${u[l.LONECARET]}${u[l.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${u[l.LONECARET]}${u[l.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${u[l.GTLT]}\\s*(${u[l.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]}|${u[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${u[l.XRANGEPLAIN]})\\s+-\\s+(${u[l.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${u[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[l.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(z0,z0.exports)),z0.exports}var Ax,d6;function q_e(){if(d6)return Ax;d6=1;const e=/^[0-9]+$/,t=(r,i)=>{const s=e.test(r),o=e.test(i);return s&&o&&(r=+r,i=+i),r===i?0:s&&!o?-1:o&&!s?1:rt(i,r)},Ax}var Sx,h6;function hF(){if(h6)return Sx;h6=1;const e=Db(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=fF(),{safeRe:r,t:i}=dF(),s=cF(),{compareIdentifiers:o}=q_e();class a{constructor(l,c){if(c=s(c),l instanceof a){if(l.loose===!!c.loose&&l.includePrerelease===!!c.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const f=l.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const h=+d;if(h>=0&&h=0;)typeof this.prerelease[h]=="number"&&(this.prerelease[h]++,h=-2);if(h===-1){if(c===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(c){let h=[c,d];f===!1&&(h=[c]),o(this.prerelease[0],c)===0?isNaN(this.prerelease[1])&&(this.prerelease=h):this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Sx=a,Sx}var kx,p6;function jd(){if(p6)return kx;p6=1;const e=hF();return kx=(n,r,i)=>new e(n,i).compare(new e(r,i)),kx}var Cx,g6;function W_e(){if(g6)return Cx;g6=1;const e=jd();return Cx=(n,r,i)=>e(n,r,i)===0,Cx}var Fx,m6;function H_e(){if(m6)return Fx;m6=1;const e=jd();return Fx=(n,r,i)=>e(n,r,i)!==0,Fx}var $x,v6;function G_e(){if(v6)return $x;v6=1;const e=jd();return $x=(n,r,i)=>e(n,r,i)>0,$x}var Dx,y6;function Y_e(){if(y6)return Dx;y6=1;const e=jd();return Dx=(n,r,i)=>e(n,r,i)>=0,Dx}var Mx,b6;function V_e(){if(b6)return Mx;b6=1;const e=jd();return Mx=(n,r,i)=>e(n,r,i)<0,Mx}var Rx,x6;function X_e(){if(x6)return Rx;x6=1;const e=jd();return Rx=(n,r,i)=>e(n,r,i)<=0,Rx}var Tx,_6;function K_e(){if(_6)return Tx;_6=1;const e=W_e(),t=H_e(),n=G_e(),r=Y_e(),i=V_e(),s=X_e();return Tx=(a,u,l,c)=>{switch(u){case"===":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a===l;case"!==":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return r(a,l,c);case"<":return i(a,l,c);case"<=":return s(a,l,c);default:throw new TypeError(`Invalid operator: ${u}`)}},Tx}var Nx,w6;function Z_e(){if(w6)return Nx;w6=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=n(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),o("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(c){const f=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],d=c.match(f);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(o("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new a(c,this.options)}catch{return!1}return s(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new u(this.value,f).test(c.semver):(f=n(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||s(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||s(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}Nx=t;const n=cF(),{safeRe:r,t:i}=dF(),s=K_e(),o=Db(),a=hF(),u=Wj();return Nx}var Ox,E6;function Wj(){if(E6)return Ox;E6=1;const e=/\s+/g;class t{constructor(C,R){if(R=i(R),C instanceof t)return C.loose===!!R.loose&&C.includePrerelease===!!R.includePrerelease?C:new t(C.raw,R);if(C instanceof s)return this.raw=C.value,this.set=[[C]],this.formatted=void 0,this;if(this.options=R,this.loose=!!R.loose,this.includePrerelease=!!R.includePrerelease,this.raw=C.trim().replace(e," "),this.set=this.raw.split("||").map(L=>this.parseRange(L.trim())).filter(L=>L.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const L=this.set[0];if(this.set=this.set.filter(O=>!g(O[0])),this.set.length===0)this.set=[L];else if(this.set.length>1){for(const O of this.set)if(O.length===1&&m(O[0])){this.set=[O];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let C=0;C0&&(this.formatted+="||");const R=this.set[C];for(let L=0;L0&&(this.formatted+=" "),this.formatted+=R[L].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(C){const L=((this.options.includePrerelease&&h)|(this.options.loose&&p))+":"+C,O=r.get(L);if(O)return O;const N=this.options.loose,B=N?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];C=C.replace(B,M(this.options.includePrerelease)),o("hyphen replace",C),C=C.replace(u[l.COMPARATORTRIM],c),o("comparator trim",C),C=C.replace(u[l.TILDETRIM],f),o("tilde trim",C),C=C.replace(u[l.CARETTRIM],d),o("caret trim",C);let q=C.split(" ").map(se=>y(se,this.options)).join(" ").split(/\s+/).map(se=>D(se,this.options));N&&(q=q.filter(se=>(o("loose invalid filter",se,this.options),!!se.match(u[l.COMPARATORLOOSE])))),o("range list",q);const X=new Map,le=q.map(se=>new s(se,this.options));for(const se of le){if(g(se))return[se];X.set(se.value,se)}X.size>1&&X.has("")&&X.delete("");const de=[...X.values()];return r.set(L,de),de}intersects(C,R){if(!(C instanceof t))throw new TypeError("a Range is required");return this.set.some(L=>v(L,R)&&C.set.some(O=>v(O,R)&&L.every(N=>O.every(B=>N.intersects(B,R)))))}test(C){if(!C)return!1;if(typeof C=="string")try{C=new a(C,this.options)}catch{return!1}for(let R=0;R$.value==="<0.0.0-0",m=$=>$.value==="",v=($,C)=>{let R=!0;const L=$.slice();let O=L.pop();for(;R&&L.length;)R=L.every(N=>O.intersects(N,C)),O=L.pop();return R},y=($,C)=>(o("comp",$,C),$=A($,C),o("caret",$),$=x($,C),o("tildes",$),$=S($,C),o("xrange",$),$=F($,C),o("stars",$),$),b=$=>!$||$.toLowerCase()==="x"||$==="*",x=($,C)=>$.trim().split(/\s+/).map(R=>_(R,C)).join(" "),_=($,C)=>{const R=C.loose?u[l.TILDELOOSE]:u[l.TILDE];return $.replace(R,(L,O,N,B,q)=>{o("tilde",$,L,O,N,B,q);let X;return b(O)?X="":b(N)?X=`>=${O}.0.0 <${+O+1}.0.0-0`:b(B)?X=`>=${O}.${N}.0 <${O}.${+N+1}.0-0`:q?(o("replaceTilde pr",q),X=`>=${O}.${N}.${B}-${q} <${O}.${+N+1}.0-0`):X=`>=${O}.${N}.${B} <${O}.${+N+1}.0-0`,o("tilde return",X),X})},A=($,C)=>$.trim().split(/\s+/).map(R=>E(R,C)).join(" "),E=($,C)=>{o("caret",$,C);const R=C.loose?u[l.CARETLOOSE]:u[l.CARET],L=C.includePrerelease?"-0":"";return $.replace(R,(O,N,B,q,X)=>{o("caret",$,O,N,B,q,X);let le;return b(N)?le="":b(B)?le=`>=${N}.0.0${L} <${+N+1}.0.0-0`:b(q)?N==="0"?le=`>=${N}.${B}.0${L} <${N}.${+B+1}.0-0`:le=`>=${N}.${B}.0${L} <${+N+1}.0.0-0`:X?(o("replaceCaret pr",X),N==="0"?B==="0"?le=`>=${N}.${B}.${q}-${X} <${N}.${B}.${+q+1}-0`:le=`>=${N}.${B}.${q}-${X} <${N}.${+B+1}.0-0`:le=`>=${N}.${B}.${q}-${X} <${+N+1}.0.0-0`):(o("no pr"),N==="0"?B==="0"?le=`>=${N}.${B}.${q}${L} <${N}.${B}.${+q+1}-0`:le=`>=${N}.${B}.${q}${L} <${N}.${+B+1}.0-0`:le=`>=${N}.${B}.${q} <${+N+1}.0.0-0`),o("caret return",le),le})},S=($,C)=>(o("replaceXRanges",$,C),$.split(/\s+/).map(R=>k(R,C)).join(" ")),k=($,C)=>{$=$.trim();const R=C.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return $.replace(R,(L,O,N,B,q,X)=>{o("xRange",$,L,O,N,B,q,X);const le=b(N),de=le||b(B),se=de||b(q),Ce=se;return O==="="&&Ce&&(O=""),X=C.includePrerelease?"-0":"",le?O===">"||O==="<"?L="<0.0.0-0":L="*":O&&Ce?(de&&(B=0),q=0,O===">"?(O=">=",de?(N=+N+1,B=0,q=0):(B=+B+1,q=0)):O==="<="&&(O="<",de?N=+N+1:B=+B+1),O==="<"&&(X="-0"),L=`${O+N}.${B}.${q}${X}`):de?L=`>=${N}.0.0${X} <${+N+1}.0.0-0`:se&&(L=`>=${N}.${B}.0${X} <${N}.${+B+1}.0-0`),o("xRange return",L),L})},F=($,C)=>(o("replaceStars",$,C),$.trim().replace(u[l.STAR],"")),D=($,C)=>(o("replaceGTE0",$,C),$.trim().replace(u[C.includePrerelease?l.GTE0PRE:l.GTE0],"")),M=$=>(C,R,L,O,N,B,q,X,le,de,se,Ce)=>(b(L)?R="":b(O)?R=`>=${L}.0.0${$?"-0":""}`:b(N)?R=`>=${L}.${O}.0${$?"-0":""}`:B?R=`>=${R}`:R=`>=${R}${$?"-0":""}`,b(le)?X="":b(de)?X=`<${+le+1}.0.0-0`:b(se)?X=`<${le}.${+de+1}.0-0`:Ce?X=`<=${le}.${de}.${se}-${Ce}`:$?X=`<${le}.${de}.${+se+1}-0`:X=`<=${X}`,`${R} ${X}`.trim()),T=($,C,R)=>{for(let L=0;L<$.length;L++)if(!$[L].test(C))return!1;if(C.prerelease.length&&!R.includePrerelease){for(let L=0;L<$.length;L++)if(o($[L].semver),$[L].semver!==s.ANY&&$[L].semver.prerelease.length>0){const O=$[L].semver;if(O.major===C.major&&O.minor===C.minor&&O.patch===C.patch)return!0}return!1}return!0};return Ox}var Lx,A6;function J_e(){if(A6)return Lx;A6=1;const e=Wj();return Lx=(n,r,i)=>{try{r=new e(r,i)}catch{return!1}return r.test(n)},Lx}var Q_e=J_e(),Hj=j_e(Q_e);function ewe(e,t,n){const r=e.open(t),i=250,{origin:s}=new URL(t);let o=40;function a(l){l.source===r&&(o=0,e.removeEventListener("message",a,!1))}e.addEventListener("message",a,!1);function u(){o<=0||(r.postMessage(n,s),setTimeout(u,i),o-=1)}setTimeout(u,i)}var twe=`.vega-embed { + position: relative; + display: inline-block; + box-sizing: border-box; +} +.vega-embed.has-actions { + padding-right: 38px; +} +.vega-embed details:not([open]) > :not(summary) { + display: none !important; +} +.vega-embed summary { + list-style: none; + position: absolute; + top: 0; + right: 0; + padding: 6px; + z-index: 1000; + background: white; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); + color: #1b1e23; + border: 1px solid #aaa; + border-radius: 999px; + opacity: 0.2; + transition: opacity 0.4s ease-in; + cursor: pointer; + line-height: 0px; +} +.vega-embed summary::-webkit-details-marker { + display: none; +} +.vega-embed summary:active { + box-shadow: #aaa 0px 0px 0px 1px inset; +} +.vega-embed summary svg { + width: 14px; + height: 14px; +} +.vega-embed details[open] summary { + opacity: 0.7; +} +.vega-embed:hover summary, .vega-embed:focus-within summary { + opacity: 1 !important; + transition: opacity 0.2s ease; +} +.vega-embed .vega-actions { + position: absolute; + z-index: 1001; + top: 35px; + right: -9px; + display: flex; + flex-direction: column; + padding-bottom: 8px; + padding-top: 8px; + border-radius: 4px; + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); + border: 1px solid #d9d9d9; + background: white; + animation-duration: 0.15s; + animation-name: scale-in; + animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); + text-align: left; +} +.vega-embed .vega-actions a { + padding: 8px 16px; + font-family: sans-serif; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + color: #434a56; + text-decoration: none; +} +.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { + background-color: #f7f7f9; + color: black; +} +.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { + content: ""; + display: inline-block; + position: absolute; +} +.vega-embed .vega-actions::before { + left: auto; + right: 14px; + top: -16px; + border: 8px solid rgba(0, 0, 0, 0); + border-bottom-color: #d9d9d9; +} +.vega-embed .vega-actions::after { + left: auto; + right: 15px; + top: -14px; + border: 7px solid rgba(0, 0, 0, 0); + border-bottom-color: #fff; +} +.vega-embed .chart-wrapper.fit-x { + width: 100%; +} +.vega-embed .chart-wrapper.fit-y { + height: 100%; +} + +.vega-embed-wrapper { + max-width: 100%; + overflow: auto; + padding-right: 14px; +} + +@keyframes scale-in { + from { + opacity: 0; + transform: scale(0.6); + } + to { + opacity: 1; + transform: scale(1); + } +} +`;function Gj(e,...t){for(const n of t)nwe(e,n);return e}function nwe(e,t){for(const n of Object.keys(t))vd(e,n,t[n],!0)}const Ps=Mhe;let Up=Dxe;const j0=typeof window<"u"?window:void 0;var Y6;Up===void 0&&((Y6=j0==null?void 0:j0.vl)!=null&&Y6.compile)&&(Up=j0.vl);const rwe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},iwe={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Uh={vega:"Vega","vega-lite":"Vega-Lite"},cv={vega:Ps.version,"vega-lite":Up?Up.version:"not available"},swe={vega:e=>e,"vega-lite":(e,t)=>Up.compile(e,{config:t}).spec},owe=` + + + + +`,awe="chart-wrapper";function uwe(e){return typeof e=="function"}function S6(e,t,n,r){const i=`${t}
      `,s=`
      ${n}`,o=window.open("");o.document.write(i+e+s),o.document.title=`${Uh[r]} JSON Source`}function lwe(e,t){if(e.$schema){const n=Nj(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${Uh[n.library]}, but mode argument sets ${Uh[t]??t}.`);const r=n.library;return Hj(cv[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${Uh[r]} ${n.version}, but the current version of ${Uh[r]} is v${cv[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function Yj(e){return!!(e&&"load"in e)}function k6(e){return Yj(e)?e:Ps.loader(e)}function cwe(e){var n;const t=((n=e.usermeta)==null?void 0:n.embedOptions)??{};return be(t.defaultStyle)&&(t.defaultStyle=!1),t}async function Vj(e,t,n={}){let r,i;be(t)?(i=k6(n.loader),r=JSON.parse(await i.load(t))):r=t;const s=cwe(r),o=s.loader;(!i||o)&&(i=k6(n.loader??o));const a=await C6(s,i),u=await C6(n,i),l={...Gj(u,a),config:md(u.config??{},a.config??{})};return await dwe(e,r,l,i)}async function C6(e,t){const n=be(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=be(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function fwe(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function dwe(e,t,n={},r){const i=n.theme?md(g_e[n.theme],n.config??{}):n.config,s=Au(n.actions)?n.actions:Gj({},rwe,n.actions??{}),o={...iwe,...n.i18n},a=n.renderer??"canvas",u=n.logLevel??Ps.Warn,l=n.downloadFileName??"visualization",c=typeof e=="string"?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){const _="vega-embed-style",{root:A,rootContainer:E}=fwe(c);if(!A.getElementById(_)){const S=document.createElement("style");S.id=_,S.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?twe.toString():n.defaultStyle,E.appendChild(S)}}const f=lwe(t,n.mode);let d=swe[f](t,i);if(f==="vega-lite"&&d.$schema){const _=Nj(d.$schema);Hj(cv.vega,`^${_.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${_.version}, but current version is v${cv.vega}.`)}c.classList.add("vega-embed"),s&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(s){const _=document.createElement("div");_.classList.add(awe),c.appendChild(_),h=_}const p=n.patch;if(p&&(d=p instanceof Function?p(d):$b(d,p,!0,!1).newDocument),n.formatLocale&&Ps.formatLocale(n.formatLocale),n.timeFormatLocale&&Ps.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const _ in n.expressionFunctions){const A=n.expressionFunctions[_];"fn"in A?Ps.expressionFunction(_,A.fn,A.visitor):A instanceof Function&&Ps.expressionFunction(_,A)}const{ast:g}=n,m=Ps.parse(d,f==="vega-lite"?{}:i,{ast:g}),v=new(n.viewClass||Ps.View)(m,{loader:r,logLevel:u,renderer:a,...g?{expr:Ps.expressionInterpreter??n.expr??jhe}:{}});if(v.addSignalListener("autosize",(_,A)=>{const{type:E}=A;E=="fit-x"?(h.classList.add("fit-x"),h.classList.remove("fit-y")):E=="fit-y"?(h.classList.remove("fit-x"),h.classList.add("fit-y")):E=="fit"?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){const{loader:_,tooltip:A}=n,E=_&&!Yj(_)?_==null?void 0:_.baseURL:void 0,S=uwe(A)?A:new S_e({baseURL:E,...A===!0?{}:A}).call;v.tooltip(S)}let{hover:y}=n;if(y===void 0&&(y=f==="vega"),y){const{hoverSet:_,updateSet:A}=typeof y=="boolean"?{}:y;v.hover(_,A)}n&&(n.width!=null&&v.width(n.width),n.height!=null&&v.height(n.height),n.padding!=null&&v.padding(n.padding)),await v.initialize(h,n.bind).runAsync();let b;if(s!==!1){let _=c;if(n.defaultStyle!==!1||n.forceActionsMenu){const E=document.createElement("details");E.title=o.CLICK_TO_VIEW_ACTIONS,c.append(E),_=E;const S=document.createElement("summary");S.innerHTML=owe,E.append(S),b=k=>{E.contains(k.target)||E.removeAttribute("open")},document.addEventListener("click",b)}const A=document.createElement("div");if(_.append(A),A.classList.add("vega-actions"),s===!0||s.export!==!1){for(const E of["svg","png"])if(s===!0||s.export===!0||s.export[E]){const S=o[`${E.toUpperCase()}_ACTION`],k=document.createElement("a"),F=ve(n.scaleFactor)?n.scaleFactor[E]:n.scaleFactor;k.text=S,k.href="#",k.target="_blank",k.download=`${l}.${E}`,k.addEventListener("mousedown",async function(D){D.preventDefault();const M=await v.toImageURL(E,F);this.href=M}),A.append(k)}}if(s===!0||s.source!==!1){const E=document.createElement("a");E.text=o.SOURCE_ACTION,E.href="#",E.addEventListener("click",function(S){S6(Wb(t),n.sourceHeader??"",n.sourceFooter??"",f),S.preventDefault()}),A.append(E)}if(f==="vega-lite"&&(s===!0||s.compiled!==!1)){const E=document.createElement("a");E.text=o.COMPILED_ACTION,E.href="#",E.addEventListener("click",function(S){S6(Wb(d),n.sourceHeader??"",n.sourceFooter??"","vega"),S.preventDefault()}),A.append(E)}if(s===!0||s.editor!==!1){const E=n.editorUrl??"https://vega.github.io/editor/",S=document.createElement("a");S.text=o.EDITOR_ACTION,S.href="#",S.addEventListener("click",function(k){ewe(window,E,{config:i,mode:p?"vega":f,renderer:a,spec:Wb(p?d:t)}),k.preventDefault()}),A.append(S)}}function x(){b&&document.removeEventListener("click",b),v.finalize()}return{view:v,spec:t,vgSpec:d,finalize:x,embedOptions:n}}var hwe=ee('
      '),pwe=ee(''),gwe=ee(' '),mwe=ee('
      '),vwe=ee('
      ',1),ywe=ee(''),bwe=ee(' '),xwe=ee('
      '),_we=ee('
      '),wwe=ee('
      ',1);function _E(e,t){Gt(t,!0);let n=ne(t,"data",19,()=>[]),r=ne(t,"x",3,"step"),i=ne(t,"y",3,""),s=ne(t,"colorField",3,"run"),o=ne(t,"colorMap",19,()=>({})),a=ne(t,"title",3,""),u=ne(t,"xLim",3,null),l=ne(t,"onSelect",3,null),c=ne(t,"onResetZoom",3,null),f=ne(t,"draggable",3,!1),d=ne(t,"ondragstart",3,null),h=ne(t,"ondragover",3,null),p=ne(t,"ondrop",3,null),g=fe(null),m=fe(null),v=fe(null),y=fe(null),b=fe(!1),x=Be(()=>{if(!s()||!n()||n().length===0)return[];const U=new Set,P=[];for(const we of n()){const he=we[s()];he&&!U.has(he)&&(U.add(he),P.push({name:he,color:o()[he]||"#999"}))}return P});function _(U,P){return getComputedStyle(document.documentElement).getPropertyValue(U).trim()||P}function A(){const U=s()&&n().length>0&&Object.hasOwn(n()[0],s()),P=U?[...new Set(n().map(Se=>Se[s()]))]:[],we=[...new Set(P)],he=we,Le=we.map(Se=>o()[Se]||"#999"),Re=n().filter(Se=>Se.data_type==="original"||!Se.data_type),qe=n().filter(Se=>Se.data_type==="smoothed"),ft=qe.length>0,Ee={field:r(),type:"quantitative",scale:{zero:!1,...u()?{domain:[u()[0],u()[1]]}:{}}},ae={field:i(),type:"quantitative"},ye=U?{color:{field:s(),type:"nominal",scale:{domain:he,range:Le},legend:null}}:{},it=[];ft?(it.push({data:{values:Re},mark:{type:"line",clip:!0,strokeWidth:1,opacity:.3,point:{size:20,opacity:.3}},encoding:{x:Ee,y:ae,...ye},name:"original"}),it.push({data:{values:qe},mark:{type:"line",clip:!0,strokeWidth:2,point:{size:20}},encoding:{x:Ee,y:ae,...ye},name:"plot"})):it.push({data:{values:n()},mark:{type:"line",clip:!0,strokeWidth:2,point:{size:20}},encoding:{x:Ee,y:ae,...ye},name:"plot"});const pt=i().includes("/")?i().split("/").pop():i();return{$schema:"https://vega.github.io/schema/vega-lite/v5.json",title:{text:a(),fontSize:13,color:_("--body-text-color","#374151")},width:"container",height:w(b)?"container":250,autosize:{type:"fit",contains:"padding"},layer:it,...l()?{params:[{name:"brush",select:{type:"interval",encodings:["x"],mark:{fill:"gray",fillOpacity:.3,stroke:"none"}},views:["plot"]}]}:{},config:{background:"transparent",axis:{labelColor:_("--body-text-color-subdued","#6b7280"),titleColor:_("--body-text-color","#374151"),gridColor:_("--border-color-primary","#f3f4f6")},view:{stroke:"transparent"},mark:{cursor:l()?"crosshair":void 0}},encoding:{y:{title:pt}}}}async function E(){if(await wi(),!w(g)||!n()||n().length===0||!i())return;const U=A();try{w(y)&&(w(y).finalize(),z(y,null));const P=await Vj(w(g),U,{actions:!1,renderer:"svg"});if(z(y,P.view,!0),requestAnimationFrame(()=>{P.view.resize()}),l()){let we=0,he=null;P.view.addSignalListener("brush",(Le,Re)=>{if(Date.now()-we<1e3||!Re||Object.keys(Re).length===0)return;clearTimeout(he);const qe=Re[Object.keys(Re)[0]];!qe||qe.length!==2||(he=setTimeout(()=>{we=Date.now(),l()(qe)},250))})}}catch(P){console.error("Vega render error:",P)}}function S(){if(!n()||n().length===0)return;const U=n().filter(Ee=>Ee.data_type==="original"||!Ee.data_type);if(U.length===0)return;const P=Object.keys(U[0]).filter(Ee=>Ee!=="data_type"),we=P.map(Ee=>/[,"]/.test(Ee)?`"${Ee.replace(/"/g,'""')}"`:Ee).join(","),he=U.map(Ee=>P.map(ae=>{const ye=Ee[ae];return ye==null?"":typeof ye=="string"&&(ye.includes(",")||ye.includes('"'))?`"${ye.replace(/"/g,'""')}"`:ye}).join(",")),Le=[we,...he].join(` +`),Re=new Blob([Le],{type:"text/csv"}),qe=URL.createObjectURL(Re),ft=document.createElement("a");ft.href=qe,ft.download=`${(i()||"data").replace(/\//g,"_")}.csv`,document.body.appendChild(ft),ft.click(),document.body.removeChild(ft),URL.revokeObjectURL(qe)}async function k(){if(w(y))try{const U=await w(y).toImageURL("png",2),P=document.createElement("a");P.href=U,P.download=`${(i()||"chart").replace(/\//g,"_")}.png`,document.body.appendChild(P),P.click(),document.body.removeChild(P)}catch(U){console.error("Failed to export image:",U)}}function F(U){if(!U)return Promise.reject(new Error("no element"));const P=U.requestFullscreen||U.webkitRequestFullscreen||U.mozRequestFullScreen||U.msRequestFullscreen;return P?P.call(U):Promise.reject(new Error("no fullscreen"))}function D(){const U=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;return U?U.call(document):Promise.resolve()}async function M(){var U;z(b,!0),document.body.style.overflow="hidden",await wi(),await wi();try{await F(w(v)),await wi(),(U=w(y))==null||U.resize()}catch{document.body.style.overflow="",z(b,!1)}}async function T(){try{await D()}catch{}document.body.style.overflow="",z(b,!1)}async function $(){w(b)?await T():await M()}function C(){const U=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;!U&&w(b)&&(document.body.style.overflow="",z(b,!1)),U&&w(b)&&wi().then(()=>{var P;return(P=w(y))==null?void 0:P.resize()})}function R(U){U.key==="Escape"&&w(b)&&T()}Ht(()=>{n(),i(),r(),o(),u(),a(),w(b),w(g),E()}),Ht(()=>{if(!w(g))return;const U=new ResizeObserver(()=>{queueMicrotask(()=>{var P;(P=w(y))==null||P.resize()})});return U.observe(w(g)),()=>U.disconnect()}),pd(()=>(document.addEventListener("fullscreenchange",C),document.addEventListener("webkitfullscreenchange",C),document.addEventListener("mozfullscreenchange",C),document.addEventListener("MSFullscreenChange",C),()=>{document.removeEventListener("fullscreenchange",C),document.removeEventListener("webkitfullscreenchange",C),document.removeEventListener("mozfullscreenchange",C),document.removeEventListener("MSFullscreenChange",C),w(y)&&w(y).finalize(),document.body.style.overflow=""}));function L(U){d()&&d()(U)}var O=wwe();as("keydown",$m,R);var N=Ct(O);let B;var q=I(N),X=I(q),le=H(X,2),de=H(le,2),se=H(q,2);{var Ce=U=>{var P=hwe();V(U,P)};Ae(se,U=>{f()&&U(Ce)})}var me=H(se,2);{var W=U=>{var P=vwe(),we=Ct(P),he=I(we);us(he,Ee=>z(g,Ee),()=>w(g));var Le=H(he,2);{var Re=Ee=>{var ae=pwe();je("click",ae,ye=>{ye.stopPropagation(),c()()}),V(Ee,ae)};Ae(Le,Ee=>{u()&&c()&&Ee(Re)})}var qe=H(we,2);{var ft=Ee=>{var ae=mwe(),ye=I(ae),it=I(ye),pt=H(ye,2);St(pt,17,()=>w(x),At,(Se,dt)=>{var tn=gwe(),Sr=I(tn),nn=H(Sr,2),dn=I(nn);ke(()=>{Ll(Sr,`background: ${w(dt).color??""}`),Me(dn,w(dt).name)}),V(Se,tn)}),ke(()=>Me(it,s())),V(Ee,ae)};Ae(qe,Ee=>{w(x).length>0&&Ee(ft)})}V(U,P)};Ae(me,U=>{w(b)||U(W)})}us(N,U=>z(m,U),()=>w(m));var j=H(N,2);{var te=U=>{var P=_we(),we=I(P),he=I(we),Le=H(he,2),Re=H(Le,2),qe=H(we,2),ft=I(qe),Ee=I(ft);us(Ee,Se=>z(g,Se),()=>w(g));var ae=H(Ee,2);{var ye=Se=>{var dt=ywe();je("click",dt,tn=>{tn.stopPropagation(),c()()}),V(Se,dt)};Ae(ae,Se=>{u()&&c()&&Se(ye)})}var it=H(qe,2);{var pt=Se=>{var dt=xwe(),tn=I(dt),Sr=I(tn),nn=H(tn,2);St(nn,17,()=>w(x),At,(dn,Un)=>{var Ts=bwe(),To=I(Ts),Ea=H(To,2),kr=I(Ea);ke(()=>{Ll(To,`background: ${w(Un).color??""}`),Me(kr,w(Un).name)}),V(dn,Ts)}),ke(()=>Me(Sr,s())),V(Se,dt)};Ae(it,Se=>{w(x).length>0&&Se(pt)})}us(P,Se=>z(v,Se),()=>w(v)),je("click",he,S),je("click",Le,k),je("click",Re,()=>T()),V(U,P)};Ae(j,U=>{w(b)&&U(te)})}ke(()=>{B=Tt(N,1,"plot-container svelte-9thu1j",null,B,{"hidden-plot":w(b)}),Nt(N,"draggable",f()?"true":void 0)}),as("dragstart",N,function(...U){var P;(P=f()?L:void 0)==null||P.apply(this,U)}),as("dragover",N,function(...U){var P;(P=f()?h():void 0)==null||P.apply(this,U)}),as("drop",N,function(...U){var P;(P=f()?p():void 0)==null||P.apply(this,U)}),je("click",X,S),je("click",le,k),je("click",de,$),V(e,O),Yt()}hi(["click"]);var Ewe=ee('
      '),Awe=ee(' '),Swe=ee('
      '),kwe=ee('
      ',1),Cwe=ee(' '),Fwe=ee('
      '),$we=ee(`
      `),Dwe=ee(`
      `,1);function F6(e,t){Gt(t,!0);let n=ne(t,"data",19,()=>[]),r=ne(t,"y",3,""),i=ne(t,"colorField",3,"run"),s=ne(t,"colorMap",19,()=>({})),o=ne(t,"title",3,""),a=ne(t,"draggable",3,!1),u=ne(t,"ondragstart",3,null),l=ne(t,"ondragover",3,null),c=ne(t,"ondrop",3,null),f=fe(null),d=fe(null),h=fe(null),p=fe(null),g=fe(!1),m=Be(()=>{if(!i()||!n()||n().length===0)return[];const W=new Set,j=[];for(const te of n()){const U=te[i()];U&&!W.has(U)&&(W.add(U),j.push({name:U,color:s()[U]||"#999"}))}return j});function v(){const W=new Map;for(const j of n()){if(j.data_type==="smoothed")continue;const te=j[i()];te&&j[r()]!=null&&W.set(te,j[r()])}return Array.from(W,([j,te])=>({run:j,value:te}))}function y(W,j){return getComputedStyle(document.documentElement).getPropertyValue(W).trim()||j}function b(W){const j=W.map(P=>P.run),te=j.map(P=>s()[P]||"#999"),U=r().includes("/")?r().split("/").pop():r();return{$schema:"https://vega.github.io/schema/vega-lite/v5.json",title:{text:o(),fontSize:13,color:y("--body-text-color","#374151")},width:"container",height:w(g)?"container":250,autosize:{type:"fit",contains:"padding"},data:{values:W},mark:{type:"bar",cornerRadiusTopLeft:3,cornerRadiusTopRight:3},encoding:{x:{field:"run",type:"nominal",sort:j,axis:{labelAngle:j.length>4?-45:0,labelLimit:120},title:null},y:{field:"value",type:"quantitative",title:U,scale:{zero:!0}},color:{field:"run",type:"nominal",scale:{domain:j,range:te},legend:null},tooltip:[{field:"run",type:"nominal",title:"Run"},{field:"value",type:"quantitative",title:U}]},config:{background:"transparent",axis:{labelColor:y("--body-text-color-subdued","#6b7280"),titleColor:y("--body-text-color","#374151"),gridColor:y("--border-color-primary","#f3f4f6")},view:{stroke:"transparent"}}}}async function x(){if(await wi(),!w(f)||!n()||n().length===0||!r())return;const W=v();if(W.length===0)return;const j=b(W);try{w(p)&&(w(p).finalize(),z(p,null));const te=await Vj(w(f),j,{actions:!1,renderer:"svg"});z(p,te.view,!0),requestAnimationFrame(()=>{te.view.resize()})}catch(te){console.error("Vega render error:",te)}}function _(){const W=v();if(W.length===0)return;const te="run,"+(/[,"]/.test(r())?`"${r().replace(/"/g,'""')}"`:r()),U=W.map(Re=>`${typeof Re.run=="string"&&(Re.run.includes(",")||Re.run.includes('"'))?`"${Re.run.replace(/"/g,'""')}"`:Re.run},${Re.value}`),P=[te,...U].join(` +`),we=new Blob([P],{type:"text/csv"}),he=URL.createObjectURL(we),Le=document.createElement("a");Le.href=he,Le.download=`${(r()||"data").replace(/\//g,"_")}.csv`,document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),URL.revokeObjectURL(he)}async function A(){if(w(p))try{const W=await w(p).toImageURL("png",2),j=document.createElement("a");j.href=W,j.download=`${(r()||"chart").replace(/\//g,"_")}.png`,document.body.appendChild(j),j.click(),document.body.removeChild(j)}catch(W){console.error("Failed to export image:",W)}}function E(W){if(!W)return Promise.reject(new Error("no element"));const j=W.requestFullscreen||W.webkitRequestFullscreen||W.mozRequestFullScreen||W.msRequestFullscreen;return j?j.call(W):Promise.reject(new Error("no fullscreen"))}function S(){const W=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;return W?W.call(document):Promise.resolve()}async function k(){var W;z(g,!0),document.body.style.overflow="hidden",await wi(),await wi();try{await E(w(h)),await wi(),(W=w(p))==null||W.resize()}catch{document.body.style.overflow="",z(g,!1)}}async function F(){try{await S()}catch{}document.body.style.overflow="",z(g,!1)}async function D(){w(g)?await F():await k()}function M(){const W=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;!W&&w(g)&&(document.body.style.overflow="",z(g,!1)),W&&w(g)&&wi().then(()=>{var j;return(j=w(p))==null?void 0:j.resize()})}function T(W){W.key==="Escape"&&w(g)&&F()}Ht(()=>{n(),r(),s(),o(),w(g),w(f),x()}),Ht(()=>{if(!w(f))return;const W=new ResizeObserver(()=>{queueMicrotask(()=>{var j;(j=w(p))==null||j.resize()})});return W.observe(w(f)),()=>W.disconnect()}),pd(()=>(document.addEventListener("fullscreenchange",M),document.addEventListener("webkitfullscreenchange",M),document.addEventListener("mozfullscreenchange",M),document.addEventListener("MSFullscreenChange",M),()=>{document.removeEventListener("fullscreenchange",M),document.removeEventListener("webkitfullscreenchange",M),document.removeEventListener("mozfullscreenchange",M),document.removeEventListener("MSFullscreenChange",M),w(p)&&w(p).finalize(),document.body.style.overflow=""}));function $(W){u()&&u()(W)}var C=Dwe();as("keydown",$m,T);var R=Ct(C);let L;var O=I(R),N=I(O),B=H(N,2),q=H(B,2),X=H(O,2);{var le=W=>{var j=Ewe();V(W,j)};Ae(X,W=>{a()&&W(le)})}var de=H(X,2);{var se=W=>{var j=kwe(),te=Ct(j),U=I(te);us(U,he=>z(f,he),()=>w(f));var P=H(te,2);{var we=he=>{var Le=Swe(),Re=I(Le),qe=I(Re),ft=H(Re,2);St(ft,17,()=>w(m),At,(Ee,ae)=>{var ye=Awe(),it=I(ye),pt=H(it,2),Se=I(pt);ke(()=>{Ll(it,`background: ${w(ae).color??""}`),Me(Se,w(ae).name)}),V(Ee,ye)}),ke(()=>Me(qe,i())),V(he,Le)};Ae(P,he=>{w(m).length>0&&he(we)})}V(W,j)};Ae(de,W=>{w(g)||W(se)})}us(R,W=>z(d,W),()=>w(d));var Ce=H(R,2);{var me=W=>{var j=$we(),te=I(j),U=I(te),P=H(U,2),we=H(P,2),he=H(te,2),Le=I(he),Re=I(Le);us(Re,Ee=>z(f,Ee),()=>w(f));var qe=H(he,2);{var ft=Ee=>{var ae=Fwe(),ye=I(ae),it=I(ye),pt=H(ye,2);St(pt,17,()=>w(m),At,(Se,dt)=>{var tn=Cwe(),Sr=I(tn),nn=H(Sr,2),dn=I(nn);ke(()=>{Ll(Sr,`background: ${w(dt).color??""}`),Me(dn,w(dt).name)}),V(Se,tn)}),ke(()=>Me(it,i())),V(Ee,ae)};Ae(qe,Ee=>{w(m).length>0&&Ee(ft)})}us(j,Ee=>z(h,Ee),()=>w(h)),je("click",U,_),je("click",P,A),je("click",we,()=>F()),V(W,j)};Ae(Ce,W=>{w(g)&&W(me)})}ke(()=>{L=Tt(R,1,"plot-container bar-plot svelte-1swghqy",null,L,{"hidden-plot":w(g)}),Nt(R,"draggable",a()?"true":void 0)}),as("dragstart",R,function(...W){var j;(j=a()?$:void 0)==null||j.apply(this,W)}),as("dragover",R,function(...W){var j;(j=a()?l():void 0)==null||j.apply(this,W)}),as("drop",R,function(...W){var j;(j=a()?c():void 0)==null||j.apply(this,W)}),je("click",N,_),je("click",B,A),je("click",q,D),V(e,C),Yt()}hi(["click"]);var Mwe=ee('
      '),Rwe=ee('
      '),Twe=ee('
      ');function wE(e,t){Gt(t,!0);let n=ne(t,"label",3,""),r=ne(t,"open",15,!0),i=ne(t,"hidden",3,!1);function s(){r(!r())}var o=rs(),a=Ct(o);{var u=c=>{var f=Mwe(),d=I(f);{var h=p=>{var g=rs(),m=Ct(g);$F(m,()=>t.children),V(p,g)};Ae(d,p=>{t.children&&p(h)})}V(c,f)},l=c=>{var f=Twe(),d=I(f),h=I(d);let p;var g=H(h,2),m=I(g),v=H(d,2);{var y=b=>{var x=Rwe(),_=I(x);{var A=E=>{var S=rs(),k=Ct(S);$F(k,()=>t.children),V(E,S)};Ae(_,E=>{t.children&&E(A)})}V(b,x)};Ae(v,b=>{r()&&b(y)})}ke(()=>{p=Tt(h,1,"arrow svelte-1jep0a",null,p,{rotated:r()}),Me(m,n())}),je("click",d,s),V(c,f)};Ae(a,c=>{i()?c(u):c(l,-1)})}V(e,o),Yt()}hi(["click"]);dq();var Nwe=ee('
      Loading
      ');function Cc(e,t){Gt(t,!1);const r=Y8()||new URLSearchParams(window.location.search).get("__theme")==="dark"||V8()==="dark"?"/static/trackio/trackio_logo_dark.png":"/static/trackio/trackio_logo_light.png";cW();var i=Nwe(),s=I(i),o=I(s),a=I(o),u=H(o,2),l=I(u);ke(()=>{Nt(a,"src",r),Nt(l,"src",r)}),V(e,i),Yt()}const $6=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],sl=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],Owe=["REQUIRED","OPTIONAL","REPEATED"],Lwe=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],Iwe=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],Xj=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],Pwe=["SPHERICAL","VINCENTY","THOMAS","ANDOYER","KARNEY"];function EE(e){const t=U0(e);if(t.type===1)return{type:"Point",coordinates:AE(e,t)};if(t.type===2)return{type:"LineString",coordinates:SE(e,t)};if(t.type===3)return{type:"Polygon",coordinates:D6(e,t)};if(t.type===4){const n=[];for(let r=0;r1&&i<=7&&(o=t.getUint32(e.offset,n),e.offset+=4);let a=2;return s&&a++,s===3&&a++,{littleEndian:n,type:i,dim:a,count:o}}function AE(e,t){const n=[];for(let r=0;r{var d;return((d=f.element.logical_type)==null?void 0:d.type)==="VARIANT"}))&&o==="BYTE_ARRAY"&&a!=="UTF8"&&(u==null?void 0:u.type)!=="STRING")return e;if(a==="DECIMAL"){const d=10**-(n.scale||0),h=new Array(e.length);for(let p=0;pr.timestampFromNanoseconds(Bwe(f)));if(a==="DATE")return Array.from(e).map(f=>r.dateFromDays(f));if(a==="TIMESTAMP_MILLIS")return Array.from(e).map(f=>r.timestampFromMilliseconds(f));if(a==="TIMESTAMP_MICROS")return Array.from(e).map(f=>r.timestampFromMicroseconds(f));if(a==="JSON")return e.map(f=>JSON.parse(Kj.decode(f)));if(a==="BSON")throw new Error("parquet bson not supported");if(a==="INTERVAL")throw new Error("parquet interval not supported");if((u==null?void 0:u.type)==="GEOMETRY")return e.map(f=>r.geometryFromBytes(f));if((u==null?void 0:u.type)==="GEOGRAPHY")return e.map(f=>r.geographyFromBytes(f));if(a==="UTF8"||(u==null?void 0:u.type)==="STRING"||i&&o==="BYTE_ARRAY")return e.map(f=>r.stringFromBytes(f));if(a==="UINT_64"||(u==null?void 0:u.type)==="INTEGER"&&u.bitWidth===64&&!u.isSigned){if(e instanceof BigInt64Array)return new BigUint64Array(e.buffer,e.byteOffset,e.length);const f=l?new Array(e.length):new BigUint64Array(e.length);for(let d=0;d=2n**BigInt(n-1)&&(t-=2n**BigInt(n)),Number(t)}function Bwe(e){const t=(e>>64n)-2440588n,n=e&0xffffffffffffffffn;return t*86400000000000n+n}function Qj(e){if(!e)return;const t=e[1]<<8|e[0],n=t>>15?-1:1,r=t>>10&31,i=t&1023;return r===0?n*2**-14*(i/1024):r===31?i?NaN:n*(1/0):n*2**(r-15)*(1+i/1024)}function eU(e,t,n){const r=e[t],i=[];let s=1;if(r.num_children)for(;i.lengtho.element.name===i);if(!s)throw new Error(`parquet schema element not found: ${t}`);r.push(s),n=s}return r}function zwe(e){const t=[];function n(r){if(r.children.length)for(const i of r.children)n(i);else t.push(r.path.join("."))}return n(e),t}function nU(e){let t=0;for(const{element:n}of e)n.repetition_type==="REPEATED"&&t++;return t}function pF(e){let t=0;for(const{element:n}of e.slice(1))n.repetition_type!=="REQUIRED"&&t++;return t}function jwe(e){if(!e||e.element.converted_type!=="LIST"||e.children.length>1)return!1;const t=e.children[0];return!(t.children.length>1||t.element.repetition_type!=="REPEATED")}function Uwe(e){if(!e||e.element.converted_type!=="MAP"||e.children.length>1)return!1;const t=e.children[0];if(t.children.length!==2||t.element.repetition_type!=="REPEATED")return!1;const n=t.children.find(i=>i.element.name==="key");if((n==null?void 0:n.element.repetition_type)==="REPEATED")return!1;const r=t.children.find(i=>i.element.name==="value");return(r==null?void 0:r.element.repetition_type)!=="REPEATED"}function rU(e){if(e.length!==2)return!1;const[,t]=e;return!(t.element.repetition_type==="REPEATED"||t.children.length)}const qwe=0,R6=1,T6=2,N6=3,Wwe=4,Hwe=5,Gwe=6,Ywe=7,Vwe=8,Xwe=9,Kwe=12;function Rb(e){const t={};let n=0;for(;e.offset>4;n=s?n+s:iU(e),t[`field_${n}`]=kE(e,i)}return t}function kE(e,t){switch(t){case R6:return!0;case T6:return!1;case N6:return e.view.getInt8(e.offset++);case Wwe:case Hwe:return iU(e);case Gwe:return CE(e);case Ywe:{const n=e.view.getFloat64(e.offset,!0);return e.offset+=8,n}case Vwe:{const n=$l(e),r=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n);return e.offset+=n,r}case Xwe:{const n=e.view.getUint8(e.offset++),r=n&15;let i=n>>4;i===15&&(i=$l(e));const s=r===R6||r===T6,o=new Array(i);for(let a=0;a>>1^-(t&1)}function CE(e){const t=Zwe(e);return t>>1n^-(t&1n)}function Jwe(e,t){var s,o,a,u,l;const n=new Map,r=(s=t==null?void 0:t.find(({key:c})=>c==="geo"))==null?void 0:s.value,i=(r&&((o=JSON.parse(r))==null?void 0:o.columns))??{};for(const[c,f]of Object.entries(i)){if(f.encoding!=="WKB")continue;const d=f.edges==="spherical"?"GEOGRAPHY":"GEOMETRY",h=((a=f.crs)==null?void 0:a.id)??((l=(u=f.crs)==null?void 0:u.ids)==null?void 0:l[0]),p=h?`${h.authority}:${h.code.toString()}`:void 0;n.set(c,{type:d,crs:p})}for(let c=1;c=0))throw new Error("parquet expected AsyncBuffer");const i=Math.max(0,e.byteLength-n),s=await e.slice(i,e.byteLength),o=new DataView(s);if(o.getUint32(s.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const a=o.getUint32(s.byteLength-8,!0);if(a>e.byteLength-8)throw new Error(`parquet metadata length ${a} exceeds available buffer ${e.byteLength-8}`);if(a+8>n){const u=e.byteLength-a-8,l=await e.slice(u,i),c=new ArrayBuffer(a+8),f=new Uint8Array(c);return f.set(new Uint8Array(l)),f.set(new Uint8Array(s),i-u),O6(c,{parsers:t,geoparquet:r})}else return O6(s,{parsers:t,geoparquet:r})}function O6(e,{parsers:t,geoparquet:n=!0}={}){var m;if(!(e instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const r=new DataView(e);if(t={...Mb,...t},r.byteLength<8)throw new Error("parquet file is too short");if(r.getUint32(r.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const i=r.byteLength-8,s=r.getUint32(i,!0);if(s>r.byteLength-8)throw new Error(`parquet metadata length ${s} exceeds available buffer ${r.byteLength-8}`);const o=i-s,u=Rb({view:r,offset:o}),l=u.field_1,c=u.field_2.map(v=>({type:$6[v.field_1],type_length:v.field_2,repetition_type:Owe[v.field_3],name:Bs(v.field_4),num_children:v.field_5,converted_type:Lwe[v.field_6],scale:v.field_7,precision:v.field_8,field_id:v.field_9,logical_type:nEe(v.field_10)})),f=c.filter(v=>v.type),d=u.field_3,h=u.field_4.map(v=>{var y;return{columns:v.field_1.map((b,x)=>{var _,A,E;return{file_path:Bs(b.field_1),file_offset:b.field_2,meta_data:b.field_3&&{type:$6[b.field_3.field_1],encodings:(_=b.field_3.field_2)==null?void 0:_.map(S=>sl[S]),path_in_schema:b.field_3.field_3.map(Bs),codec:Iwe[b.field_3.field_4],num_values:b.field_3.field_5,total_uncompressed_size:b.field_3.field_6,total_compressed_size:b.field_3.field_7,key_value_metadata:(A=b.field_3.field_8)==null?void 0:A.map(S=>({key:Bs(S.field_1),value:Bs(S.field_2)})),data_page_offset:b.field_3.field_9,index_page_offset:b.field_3.field_10,dictionary_page_offset:b.field_3.field_11,statistics:rEe(b.field_3.field_12,f[x],t),encoding_stats:(E=b.field_3.field_13)==null?void 0:E.map(S=>({page_type:Xj[S.field_1],encoding:sl[S.field_2],count:S.field_3})),bloom_filter_offset:b.field_3.field_14,bloom_filter_length:b.field_3.field_15,size_statistics:b.field_3.field_16&&{unencoded_byte_array_data_bytes:b.field_3.field_16.field_1,repetition_level_histogram:b.field_3.field_16.field_2,definition_level_histogram:b.field_3.field_16.field_3},geospatial_statistics:b.field_3.field_17&&{bbox:b.field_3.field_17.field_1&&{xmin:b.field_3.field_17.field_1.field_1,xmax:b.field_3.field_17.field_1.field_2,ymin:b.field_3.field_17.field_1.field_3,ymax:b.field_3.field_17.field_1.field_4,zmin:b.field_3.field_17.field_1.field_5,zmax:b.field_3.field_17.field_1.field_6,mmin:b.field_3.field_17.field_1.field_7,mmax:b.field_3.field_17.field_1.field_8},geospatial_types:b.field_3.field_17.field_2}},offset_index_offset:b.field_4,offset_index_length:b.field_5,column_index_offset:b.field_6,column_index_length:b.field_7,crypto_metadata:b.field_8,encrypted_column_metadata:b.field_9}}),total_byte_size:v.field_2,num_rows:v.field_3,sorting_columns:(y=v.field_4)==null?void 0:y.map(b=>({column_idx:b.field_1,descending:b.field_2,nulls_first:b.field_3})),file_offset:v.field_5,total_compressed_size:v.field_6,ordinal:v.field_7}}),p=(m=u.field_5)==null?void 0:m.map(v=>({key:Bs(v.field_1),value:Bs(v.field_2)})),g=Bs(u.field_6);return n&&Jwe(c,p),{version:l,schema:c,num_rows:d,row_groups:h,key_value_metadata:p,created_by:g,metadata_length:s}}function FE({schema:e}){return tU(e,[])[0]}function nEe(e){return e!=null&&e.field_1?{type:"STRING"}:e!=null&&e.field_2?{type:"MAP"}:e!=null&&e.field_3?{type:"LIST"}:e!=null&&e.field_4?{type:"ENUM"}:e!=null&&e.field_5?{type:"DECIMAL",scale:e.field_5.field_1,precision:e.field_5.field_2}:e!=null&&e.field_6?{type:"DATE"}:e!=null&&e.field_7?{type:"TIME",isAdjustedToUTC:e.field_7.field_1,unit:L6(e.field_7.field_2)}:e!=null&&e.field_8?{type:"TIMESTAMP",isAdjustedToUTC:e.field_8.field_1,unit:L6(e.field_8.field_2)}:e!=null&&e.field_10?{type:"INTEGER",bitWidth:e.field_10.field_1,isSigned:e.field_10.field_2}:e!=null&&e.field_11?{type:"NULL"}:e!=null&&e.field_12?{type:"JSON"}:e!=null&&e.field_13?{type:"BSON"}:e!=null&&e.field_14?{type:"UUID"}:e!=null&&e.field_15?{type:"FLOAT16"}:e!=null&&e.field_16?{type:"VARIANT",specification_version:e.field_16.field_1}:e!=null&&e.field_17?{type:"GEOMETRY",crs:Bs(e.field_17.field_1)}:e!=null&&e.field_18?{type:"GEOGRAPHY",crs:Bs(e.field_18.field_1),algorithm:Pwe[e.field_18.field_2]}:e}function L6(e){if(e.field_1)return"MILLIS";if(e.field_2)return"MICROS";if(e.field_3)return"NANOS";throw new Error("parquet time unit required")}function rEe(e,t,n){return e&&{max:q0(e.field_1,t,n),min:q0(e.field_2,t,n),null_count:e.field_3,distinct_count:e.field_4,max_value:q0(e.field_5,t,n),min_value:q0(e.field_6,t,n),is_max_value_exact:e.field_7,is_min_value_exact:e.field_8}}function q0(e,t,n){const{type:r,converted_type:i,logical_type:s}=t;if(e===void 0)return e;if(r==="BOOLEAN")return e[0]===1;if(r==="BYTE_ARRAY")return n.stringFromBytes(e);const o=new DataView(e.buffer,e.byteOffset,e.byteLength);return r==="FLOAT"&&o.byteLength===4?o.getFloat32(0,!0):r==="DOUBLE"&&o.byteLength===8?o.getFloat64(0,!0):r==="INT32"&&i==="DATE"?n.dateFromDays(o.getInt32(0,!0)):r==="INT64"&&i==="TIMESTAMP_MILLIS"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT64"&&i==="TIMESTAMP_MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&(s==null?void 0:s.type)==="TIMESTAMP"&&(s==null?void 0:s.unit)==="NANOS"?n.timestampFromNanoseconds(o.getBigInt64(0,!0)):r==="INT64"&&(s==null?void 0:s.type)==="TIMESTAMP"&&(s==null?void 0:s.unit)==="MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&(s==null?void 0:s.type)==="TIMESTAMP"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT32"&&o.byteLength===4?o.getInt32(0,!0):r==="INT64"&&o.byteLength===8?o.getBigInt64(0,!0):i==="DECIMAL"?Jj(e)*10**-(t.scale||0):(s==null?void 0:s.type)==="FLOAT16"?Qj(e):e}function iEe(e){const t=Rb(e);return{page_locations:t.field_1.map(sEe),unencoded_byte_array_data_bytes:t.field_2}}function sEe(e){return{offset:e.field_1,compressed_page_size:e.field_2,first_row_index:e.field_3}}function sU(e,t){for(let r=0;rn.split(".")[0])),[...new Set(t)]}function qh(e,t,n=!0){return"$and"in t&&Array.isArray(t.$and)?t.$and.every(r=>qh(e,r,n)):"$or"in t&&Array.isArray(t.$or)?t.$or.some(r=>qh(e,r,n)):"$nor"in t&&Array.isArray(t.$nor)?!t.$nor.some(r=>qh(e,r,n)):Object.entries(t).every(([r,i])=>{const s=oEe(e,r);return typeof i!="object"||i===null||Array.isArray(i)?aa(s,i,n):Object.entries(i||{}).every(([o,a])=>o==="$gt"?s>a:o==="$gte"?s>=a:o==="$lt"?s$E({rowGroup:e,physicalColumns:t,filter:s,strict:r}));if("$or"in n&&Array.isArray(n.$or))return n.$or.every(s=>$E({rowGroup:e,physicalColumns:t,filter:s,strict:r}));if("$nor"in n&&Array.isArray(n.$nor))return!1;for(const[s,o]of Object.entries(n)){const a=t.indexOf(s);if(a===-1)continue;const u=(i=e.columns[a].meta_data)==null?void 0:i.statistics;if(!u)continue;const{min:l,max:c,min_value:f,max_value:d}=u,h=f!==void 0?f:l,p=d!==void 0?d:c;if(!(h===void 0||p===void 0)){for(const[g,m]of Object.entries(o||{}))if(g==="$gt"&&p<=m||g==="$gte"&&p=m||g==="$lte"&&h>m||g==="$eq"&&(mp)||g==="$ne"&&aa(h,p,r)&&aa(h,m,r)||g==="$in"&&Array.isArray(m)&&m.every(v=>vp)||g==="$nin"&&Array.isArray(m)&&aa(h,p,r)&&m.includes(h))return!0}}return!1}function oEe(e,t){let n=e;for(const r of t.split("."))n=n==null?void 0:n[r];return n}const aEe=1<<21;function uEe({metadata:e,rowStart:t=0,rowEnd:n=1/0,columns:r,filter:i,filterStrict:s=!0,useOffsetIndex:o=!1}){if(!e)throw new Error("parquetPlan requires metadata");const a=[],u=[],l=[],c=zwe(FE(e));let f=0;for(const d of e.row_groups){const h=Number(d.num_rows),p=f+h;if(h>0&&p>t&&fe.slice(r,i));return{byteLength:e.byteLength,slice(r,i=e.byteLength){const s=t.findIndex(({startByte:o,endByte:a})=>o<=r&&i<=a);if(s<0)return e.slice(r,i);if(t[s].startByte!==r||t[s].endByte!==i){const o=r-t[s].startByte,a=i-t[s].startByte;return n[s]instanceof Promise?n[s].then(u=>u.slice(o,a)):n[s].slice(o,a)}else return n[s]}}}const gF=new TextDecoder,I6=new WeakMap;function aU(e,t=Mb){if(Array.isArray(e))return e.map(n=>aU(n,t));if(typeof e!="object")return e;if("metadata"in e){const n=cEe(e.metadata),r=e.typed_value&&km(e.typed_value,n,t),i=e.value&&qp(fv(e.value),n,t);return r&&i?{...i,...r}:r??i}return e}function km(e,t,n){if(e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Uint8Array)){if("typed_value"in e)return km(e.typed_value,t,n);if("value"in e&&e.value instanceof Uint8Array)return qp(fv(e.value),t,n);const r={};for(const[i,s]of Object.entries(e))r[i]=km(s,t,n);return r}return e instanceof Uint8Array?qp(fv(e),t,n):Array.isArray(e)?e.map(r=>km(r,t,n)):e}function fv(e){return{view:new DataView(e.buffer,e.byteOffset,e.byteLength),offset:0}}function cEe(e){let t=I6.get(e.buffer);t||(t=new Map,I6.set(e.buffer,t));const n=`${e.byteOffset}:${e.byteLength}`,r=t.get(n);if(r)return r;const i=fv(e),s=i.view.getUint8(i.offset++),o=s&15;if(o!==1)throw new Error(`parquet unsupported variant metadata version: ${o}`);const a=(s>>4&1)===1,u=(s>>6&3)+1,l=Dl(i,u),c=new Array(l+1);for(let p=0;p>2;if(i===0)return fEe(e,s,n);if(i===2)return dEe(e,s,t,n);if(i===3)return hEe(e,s,t,n);const o=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,s);return e.offset+=s,gF.decode(o)}function fEe(e,t,n){switch(t){case 0:return null;case 1:return!0;case 2:return!1;case 3:{const r=e.view.getInt8(e.offset);return e.offset+=1,r}case 4:{const r=e.view.getInt16(e.offset,!0);return e.offset+=2,r}case 5:{const r=e.view.getInt32(e.offset,!0);return e.offset+=4,r}case 6:{const r=e.view.getBigInt64(e.offset,!0);return e.offset+=8,r}case 7:{const r=e.view.getFloat64(e.offset,!0);return e.offset+=8,r}case 8:return Ix(e,4);case 9:return Ix(e,8);case 10:return Ix(e,16);case 11:{const r=e.view.getInt32(e.offset,!0);return e.offset+=4,n.dateFromDays(r)}case 12:case 13:{const r=e.view.getBigInt64(e.offset,!0);return e.offset+=8,n.timestampFromMicroseconds(r)}case 14:{const r=e.view.getFloat32(e.offset,!0);return e.offset+=4,r}case 15:return P6(e);case 16:{const r=P6(e);return gF.decode(r)}case 17:{const r=e.view.getBigInt64(e.offset,!0);return e.offset+=8,r}case 18:case 19:{const r=e.view.getBigInt64(e.offset,!0);return e.offset+=8,n.timestampFromNanoseconds(r)}case 20:{const r=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,16);e.offset+=16;const i=Array.from(r,s=>s.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}default:throw new Error(`parquet unsupported variant primitive type: ${t}`)}}function dEe(e,t,n,r){const i=(t&3)+1,s=(t>>2&3)+1,a=t>>4&1?Dl(e,4):e.view.getUint8(e.offset++),u=new Array(a);for(let f=0;f>2&1,o=i+1,a=Dl(e,s?4:1),u=new Array(a+1);for(let f=0;fp.repetition_type);let u=0;const l=[e];let c=e,f=0,d=0,h=0;if(n[0])for(;f>h&g;for(h+=d;h>=8;)h-=8n,e.offset++,h&&(m|=BigInt(e.view.getUint8(e.offset))<>>1;gEe(e,a,t,n,s),s+=a}}e.offset=i+r}function gEe(e,t,n,r,i){const s=n+7>>3;let o=0;for(let a=0;a>1<<3;const o=(1<8?(l-=8,u-=8,a>>>=8):u-l>l&o),s--,l+=n);return i}function fU(e,t,n,r){const i=vEe(n,r),s=new Uint8Array(t*i);for(let o=0;o=n)throw new Error("invalid snappy length header");for(;i=n)throw new Error("missing eof marker");if((o&3)===0){let u=(o>>>2)+1;if(u>60){if(i+3>=n)throw new Error("snappy error literal pos + 3 >= inputLength");const l=u-60;u=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),u=(u&kEe[l])+1,i+=l}if(i+u>n)throw new Error("snappy error literal exceeds input length");z6(e,i,t,s,u),i+=u,s+=u}else{let u=0;switch(o&3){case 1:a=(o>>>2&7)+4,u=e[i]+(o>>>5<<8),i++;break;case 2:if(n<=i+1)throw new Error("snappy error end of input");a=(o>>>2)+1,u=e[i]+(e[i+1]<<8),i+=2;break;case 3:if(n<=i+3)throw new Error("snappy error end of input");a=(o>>>2)+1,u=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),i+=4;break}if(u===0||isNaN(u))throw new Error(`invalid offset ${u} pos ${i} inputLength ${n}`);if(u>s)throw new Error("cannot copy from before start of buffer");z6(t,s-u,t,s,a),s+=a}}if(s!==r)throw new Error("premature end of input")}function FEe(e,t,{type:n,element:r,schemaPath:i}){const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o={view:s,offset:0};let a;const u=$Ee(o,t,i),{definitionLevels:l,numNulls:c}=DEe(o,t,i),f=t.num_values-c;if(t.encoding==="PLAIN")a=mF(o,n,f,r.type_length);else if(t.encoding==="PLAIN_DICTIONARY"||t.encoding==="RLE_DICTIONARY"||t.encoding==="RLE"){const d=n==="BOOLEAN"?1:s.getUint8(o.offset++);d?(a=new Array(f),n==="BOOLEAN"?(_u(o,d,a),a=a.map(h=>!!h)):_u(o,d,a,s.byteLength-o.offset)):a=new Uint8Array(f)}else if(t.encoding==="BYTE_STREAM_SPLIT")a=fU(o,f,n,r.type_length);else if(t.encoding==="DELTA_BINARY_PACKED")a=n==="INT32"?new Int32Array(f):new BigInt64Array(f),Wp(o,f,a);else if(t.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(f),cU(o,f,a);else throw new Error(`parquet unsupported encoding: ${t.encoding}`);return{definitionLevels:l,repetitionLevels:u,dataPage:a}}function $Ee(e,t,n){if(n.length>1){const r=nU(n);if(r){const i=new Array(t.num_values);return _u(e,Tb(r),i),i}}return[]}function DEe(e,t,n){const r=pF(n);if(!r)return{definitionLevels:[],numNulls:0};const i=new Array(t.num_values);_u(e,Tb(r),i);let s=t.num_values;for(const o of i)o===r&&s--;return s===0&&(i.length=0),{definitionLevels:i,numNulls:s}}function DE(e,t,n,r){let i;const s=r==null?void 0:r[n];if(n==="UNCOMPRESSED")i=e;else if(s)i=s(e,t);else if(n==="SNAPPY")i=new Uint8Array(t),CEe(e,i);else throw new Error(`parquet unsupported compression codec: ${n}`);if((i==null?void 0:i.length)!==t)throw new Error(`parquet decompressed page length ${i==null?void 0:i.length} does not match header ${t}`);return i}function MEe(e,t,n){const i={view:new DataView(e.buffer,e.byteOffset,e.byteLength),offset:0},{type:s,element:o,schemaPath:a,codec:u,compressors:l}=n,c=t.data_page_header_v2;if(!c)throw new Error("parquet data page header v2 is undefined");const f=REe(i,c,a);i.offset=c.repetition_levels_byte_length;const d=TEe(i,c,a),h=t.uncompressed_page_size-c.definition_levels_byte_length-c.repetition_levels_byte_length;let p=e.subarray(i.offset);c.is_compressed!==!1&&(p=DE(p,h,u,l));const g=new DataView(p.buffer,p.byteOffset,p.byteLength),m={view:g,offset:0};let v;const y=c.num_values-c.num_nulls;if(c.encoding==="PLAIN")v=mF(m,s,y,o.type_length);else if(c.encoding==="RLE")v=new Array(y),_u(m,1,v),v=v.map(b=>!!b);else if(c.encoding==="PLAIN_DICTIONARY"||c.encoding==="RLE_DICTIONARY"){const b=g.getUint8(m.offset++);v=new Array(y),_u(m,b,v,h-1)}else if(c.encoding==="DELTA_BINARY_PACKED")v=s==="INT32"?new Int32Array(y):new BigInt64Array(y),Wp(m,y,v);else if(c.encoding==="DELTA_LENGTH_BYTE_ARRAY")v=new Array(y),cU(m,y,v);else if(c.encoding==="DELTA_BYTE_ARRAY")v=new Array(y),pEe(m,y,v);else if(c.encoding==="BYTE_STREAM_SPLIT")v=fU(m,y,s,o.type_length);else throw new Error(`parquet unsupported encoding: ${c.encoding}`);return{definitionLevels:d,repetitionLevels:f,dataPage:v}}function REe(e,t,n){const r=nU(n);if(!r)return[];const i=new Array(t.num_values);return _u(e,Tb(r),i,t.repetition_levels_byte_length),i}function TEe(e,t,n){const r=pF(n);if(r){const i=new Array(t.num_values);return _u(e,Tb(r),i,t.definition_levels_byte_length),i}}function j6(e,{groupStart:t,selectStart:n,selectEnd:r},i,s){const{pathInSchema:o,schemaPath:a}=i,u=rU(a),l=[];let c,f,d=0,h=0;const p=s&&(()=>{f&&s({pathInSchema:o,columnData:f,rowStart:t+d-f.length,rowEnd:t+d})});for(;(u?d=e.view.byteLength-1);){const g=NEe(e);if(g.type==="DICTIONARY_PAGE"){const{data:m}=U6(e,g,i,c,void 0,0);m&&(c=Zj(m,i))}else{const m=(f==null?void 0:f.length)||0,v=U6(e,g,i,c,f,n-d);v.skipped?(l.length||(h+=v.skipped),d+=v.skipped):v.data&&f===v.data?d+=v.data.length-m:v.data&&v.data.length&&(p==null||p(),l.push(v.data),d+=v.data.length,f=v.data)}}return p==null||p(),{data:l,skipped:h}}function U6(e,t,n,r,i,s){const{type:o,element:a,schemaPath:u,codec:l,compressors:c}=n,f=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,t.compressed_page_size);if(e.offset+=t.compressed_page_size,t.type==="DATA_PAGE"){const d=t.data_page_header;if(!d)throw new Error("parquet data page header is undefined");if(s>d.num_values&&rU(u))return{skipped:d.num_values};const h=DE(f,Number(t.uncompressed_page_size),l,c),{definitionLevels:p,repetitionLevels:g,dataPage:m}=FEe(h,d,n),v=M6(m,r,d.encoding,n),y=Array.isArray(i)?i:[];return{skipped:0,data:B6(y,p,g,v,u)}}else if(t.type==="DATA_PAGE_V2"){const d=t.data_page_header_v2;if(!d)throw new Error("parquet data page header v2 is undefined");if(s>d.num_rows)return{skipped:d.num_values};const{definitionLevels:h,repetitionLevels:p,dataPage:g}=MEe(f,t,n),m=M6(g,r,d.encoding,n),v=Array.isArray(i)?i:[];return{skipped:0,data:B6(v,h,p,m,u)}}else if(t.type==="DICTIONARY_PAGE"){const d=t.dictionary_page_header;if(!d)throw new Error("parquet dictionary page header is undefined");const h=DE(f,Number(t.uncompressed_page_size),l,c),p={view:new DataView(h.buffer,h.byteOffset,h.byteLength),offset:0};return{skipped:0,data:mF(p,o,d.num_values,a.type_length)}}else throw new Error(`parquet unsupported page type: ${t.type}`)}function NEe(e){const t=Rb(e),n=Xj[t.field_1],r=t.field_2,i=t.field_3,s=t.field_4,o=t.field_5&&{num_values:t.field_5.field_1,encoding:sl[t.field_5.field_2],definition_level_encoding:sl[t.field_5.field_3],repetition_level_encoding:sl[t.field_5.field_4],statistics:t.field_5.field_5&&{max:t.field_5.field_5.field_1,min:t.field_5.field_5.field_2,null_count:t.field_5.field_5.field_3,distinct_count:t.field_5.field_5.field_4,max_value:t.field_5.field_5.field_5,min_value:t.field_5.field_5.field_6}},a=t.field_6,u=t.field_7&&{num_values:t.field_7.field_1,encoding:sl[t.field_7.field_2],is_sorted:t.field_7.field_3},l=t.field_8&&{num_values:t.field_8.field_1,num_nulls:t.field_8.field_2,num_rows:t.field_8.field_3,encoding:sl[t.field_8.field_4],definition_levels_byte_length:t.field_8.field_5,repetition_levels_byte_length:t.field_8.field_6,is_compressed:t.field_8.field_7===void 0?!0:t.field_8.field_7,statistics:t.field_8.field_8};return{type:n,uncompressed_page_size:r,compressed_page_size:i,crc:s,data_page_header:o,index_page_header:a,dictionary_page_header:u,data_page_header_v2:l}}function OEe(e,{metadata:t},n){const{file:r,compressors:i,utf8:s}=e,o=[],a={...Mb,...e.parsers};for(const u of n.chunks){const{columnMetadata:l}=u,c=tU(t.schema,l.path_in_schema),f={pathInSchema:l.path_in_schema,type:l.type,element:c[c.length-1].element,schemaPath:c,codec:l.codec,parsers:a,compressors:i,utf8:s};if(!("offsetIndex"in u)){o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(r.slice(u.range.startByte,u.range.endByte)).then(d=>{const h={view:new DataView(d),offset:0};return j6(h,n,f,e.onPage)})});continue}o.push({pathInSchema:l.path_in_schema,data:Promise.resolve(r.slice(u.offsetIndex.startByte,u.offsetIndex.endByte)).then(async d=>{const h=iEe({view:new DataView(d),offset:0}),{selectStart:p,selectEnd:g}=n,m=h.page_locations;let v=NaN,y=NaN,b=0;for(let k=0;kp&&(Number.isNaN(v)&&(v=Number(F.offset),b=D),y=Number(F.offset)+F.compressed_page_size)}const x=await r.slice(v,y),_={view:new DataView(x),offset:0},A=b?{...n,groupStart:n.groupStart+b,selectStart:n.selectStart-b,selectEnd:n.selectEnd-b}:n,{data:E,skipped:S}=j6(_,A,f,e.onPage);return{data:E,skipped:b+S}})})}return{groupStart:n.groupStart,groupRows:n.groupRows,asyncColumns:o}}async function q6({asyncColumns:e},t,n,r,i){const s=await Promise.all(e.map(async({data:f})=>{const d=await f;return{...d,data:oU(d.data)}})),o=e.map(f=>f.pathInSchema[0]).filter(f=>!r||r.includes(f)),a=r??o,u=a.map(f=>e.findIndex(d=>d.pathInSchema[0]===f)),l=n-t;if(i==="object"){const f=Array(l);for(let d=0;d=0){const{data:m,skipped:v}=s[g];h[p]=m[d-v]}}c[f]=h}return c}function LEe(e,t,n){const{asyncColumns:r}=e;n={...Mb,...n};const i=[];for(const s of t.children)if(s.children.length){const o=r.filter(l=>l.pathInSchema[0]===s.element.name);if(!o.length)continue;const a=new Map,u=Promise.all(o.map(l=>l.data.then(({data:c})=>{a.set(l.pathInSchema.join("."),oU(c))}))).then(()=>{Wh(a,s,n);const l=a.get(s.path.join("."));if(!l)throw new Error("parquet column data not assembled");return{data:[l],skipped:0}});i.push({pathInSchema:s.path,data:u})}else{const o=r.find(a=>a.pathInSchema[0]===s.element.name);o&&i.push(o)}return{...e,asyncColumns:i}}async function IEe(e){e.metadata??(e.metadata=await tEe(e.file,e));const{rowStart:t=0,rowEnd:n,columns:r,onChunk:i,onComplete:s,rowFormat:o,filter:a,filterStrict:u=!0}=e;if(a&&o!=="object")throw new Error('parquet filter requires rowFormat: "object"');const l=Sm(a);if(l.length){const m=FE(e.metadata).children.map(y=>y.element.name),v=l.filter(y=>!m.includes(y));if(v.length)throw new Error(`parquet filter columns not found: ${v.join(", ")}`)}let c=r,f=!1;if(r&&a){const m=l.filter(v=>!r.includes(v));m.length&&(c=[...r,...m],f=!0)}const d=c!==r?{...e,columns:c}:e,h=PEe(d);if(!s&&!i){for(const{asyncColumns:m}of h)for(const{data:v}of m)await v;return}const p=FE(e.metadata),g=h.map(m=>LEe(m,p,e.parsers));if(i)for(const m of g)for(const v of m.asyncColumns)v.data.then(({data:y,skipped:b})=>{let x=m.groupStart+b;for(const _ of y)i({columnName:v.pathInSchema[0],columnData:_,rowStart:x,rowEnd:x+_.length}),x+=_.length});if(s){const m=[];for(const v of g){const y=Math.max(t-v.groupStart,0),b=Math.min((n??1/0)-v.groupStart,v.groupRows),x=o==="object"?await q6(v,y,b,c,"object"):await q6(v,y,b,r,"array");if(a){for(const _ of x)if(qh(_,a,u)){if(f&&r)for(const A of l)r.includes(A)||delete _[A];m.push(_)}}else sU(m,x)}s(m)}else for(const{asyncColumns:m}of g)for(const{data:v}of m)await v}function PEe(e){if(!e.metadata)throw new Error("parquet requires metadata");const t=uEe(e);return e.file=lEe(e.file,t),t.groups.map(n=>OEe(e,t,n))}const W0=new Map;function BEe(e){const t={};for(const n in e){const r=e[n];t[n]=typeof r=="bigint"?Number(r):r}return t}async function vF(e,t={}){if(W0.has(e))return W0.get(e);const n=await fetch(e,{headers:t});if(!n.ok){if(n.status===404)return W0.set(e,[]),[];throw new Error(`Failed to fetch ${e}: ${n.status}`)}const r=await n.arrayBuffer();let i=[];return await IEe({file:r,rowFormat:"object",onComplete:s=>{i=s.map(BEe)}}),W0.set(e,i),i}let Ln=null,H0=null,G0=null,Y0=null,qc=null,Wc=null,Hc=null;function Fc(e){return`https://huggingface.co/datasets/${Ln.dataset_id}/resolve/main/${e}`}function $c(){return Ln.hf_token?{Authorization:`Bearer ${Ln.hf_token}`}:{}}async function zEe(e){Ln=e}function jEe(){return!Ln||Ln.mode!=="static"||!Ln.dataset_id?null:{url:`https://huggingface.co/datasets/${Ln.dataset_id}`}}async function dU(){return H0||(H0=await vF(Fc("metrics.parquet"),$c()),H0)}async function UEe(){return G0||(G0=await vF(Fc("aux/system_metrics.parquet"),$c()),G0)}async function qEe(){return Y0||(Y0=await vF(Fc("aux/configs.parquet"),$c()),Y0)}async function yF(){if(qc)return qc;const e=await fetch(Fc("runs.json"),{headers:$c()});return e.ok?(qc=await e.json(),qc):(qc=[],qc)}async function WEe(){if(Wc)return Wc;const e=await fetch(Fc("settings.json"),{headers:$c()});return e.ok?(Wc=await e.json(),Wc):(Wc={},Wc)}const bF=new Set(["id","run_name","timestamp","step","log_id","space_id","created_at"]);function Ob(e){return!e||e.length===0?{rows:[],columns:[]}:{rows:e,columns:Object.keys(e[0])}}async function HEe(){return[Ln.project]}async function GEe(){return(await yF()).map(t=>t.name)}async function YEe(e,t){const n=await dU(),{rows:r,columns:i}=Ob(n),s=i.filter(u=>!bF.has(u)),o=r.filter(u=>u.run_name===t),a=new Set;for(const u of o)for(const l of s)u[l]!==null&&u[l]!==void 0&&a.add(l);return[...a]}async function VEe(e,t){const n=await dU(),{rows:r}=Ob(n);return r.filter(s=>s.run_name===t).map(s=>{const o={};for(const[a,u]of Object.entries(s))if(!bF.has(a)&&u!=null)if(typeof u=="string"&&u.startsWith("{")&&u.includes("_type"))try{o[a]=JSON.parse(u)}catch{o[a]=u}else o[a]=u;return o.timestamp=s.timestamp,o.step=s.step,o})}async function XEe(){const e=await yF(),t=e.map(r=>r.name),n=e.map(r=>r.last_step||0);return{project:Ln.project,num_runs:e.length,runs:t,last_activity:n.length?Math.max(...n):null}}async function KEe(e,t){const r=(await yF()).find(l=>l.name===t);if(!r)return{project:Ln.project,run:t,num_logs:0,metrics:[],config:null,last_step:null};const i=await YEe(Ln.project,t);let s=null;const o=await qEe(),{rows:a}=Ob(o),u=a.find(l=>l.run_name===t);if(u){s={};for(const[l,c]of Object.entries(u))l!=="id"&&l!=="run_name"&&l!=="created_at"&&(s[l]=c)}return{project:Ln.project,run:t,num_logs:r.log_count||0,metrics:i,config:s,last_step:r.last_step}}async function ZEe(){return[]}async function JEe(e,t){const n=await UEe(),{rows:r}=Ob(n);return r.filter(s=>s.run_name===t).map(s=>{const o={};for(const[a,u]of Object.entries(s))bF.has(a)||u!=null&&(o[a]=u);return o.timestamp=s.timestamp,o})}async function QEe(){const e=await WEe();return{logo_urls:{light:"/assets/trackio_logo_type_light_transparent.png",dark:"/assets/trackio_logo_type_dark_transparent.png"},color_palette:e.color_palette||[],plot_order:e.plot_order||[],table_truncate_length:250}}async function eAe(){if(Hc)return Hc;const e=await fetch(`https://huggingface.co/api/datasets/${Ln.dataset_id}`,{headers:$c()});if(!e.ok)return Hc=[],Hc;const t=await e.json();return Hc=(Array.isArray(t==null?void 0:t.siblings)?t.siblings:[]).map(r=>r==null?void 0:r.rfilename).filter(r=>typeof r=="string"&&r.startsWith("media/files/")).map(r=>({name:r.split("/").at(-1)??r,path:r.slice(6)})),Hc}async function tAe(){return{allowed:!1}}async function nAe(){throw new Error("Not supported in static mode")}async function rAe(){throw new Error("Not supported in static mode")}function hU(e){return Ln.project&&e.startsWith(Ln.project+"/")?e.slice(Ln.project.length+1):e}const Px=new Map;async function iAe(e){const t=hU(e),n=Fc(`media/${t}`);if(Px.has(n))return Px.get(n);const r=await fetch(n,{headers:$c()});if(!r.ok)return n;const i=await r.blob(),s=URL.createObjectURL(i);return Px.set(n,s),s}function pU(e){const t=hU(e);return Fc(`media/${t}`)}const Hp=window.__trackio_base||"";let gf=null,Bx=null,gU="";async function sAe(){try{const e=await fetch(`${Hp}/config.json`);if(e.ok){const t=await e.json();if(t.mode==="static")return await zEe(t),!0}}catch{}return!1}async function Ar(){return gf!==null?gf:(Bx||(Bx=sAe().then(e=>(gf=e,e))),Bx)}function oAe(){const e=sessionStorage.getItem("trackio_oauth_session");return e?{"x-trackio-oauth-session":e}:{}}async function Wi(e,t={}){const n=`${Hp}/gradio_api/call${e}`,r=await fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...oAe()},body:JSON.stringify({data:Object.values(t)})});if(!r.ok)throw new Error(`API call ${e} failed: ${r.status}`);const s=(await r.json()).event_id,o=await fetch(`${Hp}/gradio_api/call${e}/${s}`,{credentials:"include"});if(!o.ok)throw new Error(`API result ${e} failed: ${o.status}`);const u=(await o.text()).trim().split(` +`);for(let l=0;l({...c}));Object.hasOwn(o[0],"step")||o.forEach((c,f)=>c.step=f);let a="step";if(r==="time"&&Object.hasOwn(o[0],"timestamp")){const c=new Date(o[0].timestamp).getTime();o.forEach(f=>{f.time=(new Date(f.timestamp).getTime()-c)/1e3}),a="time"}else r!=="step"&&(a=r);i&&o.forEach(c=>{if(c[a]!=null){const f=c[a];c[a]=f<=0?Math.log10(Math.max(f,0)+1):Math.log10(f)}});const l=xU(o).filter(c=>!bU.includes(c)&&c!==a);if(s&&o.forEach(c=>{l.forEach(f=>{if(c[f]!=null&&typeof c[f]=="number"){const d=c[f];c[f]=d<=0?Math.log10(Math.max(d,0)+1):Math.log10(d)}})}),n>0){const c=o.map(d=>({...d,run:t,data_type:"original"})),f=bAe(o,l,n).map(d=>({...d,run:t,data_type:"smoothed"}));return{rows:[...c,...f],xColumn:a}}return{rows:o.map(c=>({...c,run:t,data_type:"original"})),xColumn:a}}function bAe(e,t,n){const r=Math.max(3,Math.min(n,e.length)),i=Math.floor(r/2);return e.map((s,o)=>{const a={...s};return t.forEach(u=>{const l=Math.max(0,o-i),c=Math.min(e.length,o+i+1);let f=0,d=0;for(let h=l;h0?f/d:s[u]}),a})}function xU(e){if(!e||e.length===0)return[];const t=new Set;return e.forEach(n=>{Object.keys(n).forEach(r=>{typeof n[r]=="number"&&isFinite(n[r])&&t.add(r)})}),Array.from(t)}function xAe(e){return xU(e).filter(t=>!bU.includes(t))}function _U(e,t,n,r,i){if(!e||e.length===0)return{data:e,xLim:i};const s=[t,n];Object.hasOwn(e[0],r)&&s.push(r);let o=e.map(h=>{const p={};return s.forEach(g=>p[g]=h[g]),h.data_type&&(p.data_type=h.data_type),h.run&&(p.run=h.run),p});const a=Math.min(...o.map(h=>h[t]).filter(h=>h!=null)),u=Math.max(...o.map(h=>h[t]).filter(h=>h!=null));let l=i;if(i){const[h,p]=[i[0]??a,i[1]??u];l=[h,p]}const c={};o.forEach(h=>{const p=h[r]||"__default";c[p]||(c[p]=[]),c[p].push(h)});const f=[],d=100;return Object.values(c).forEach(h=>{if(h.sort((y,b)=>(y[t]||0)-(b[t]||0)),h.length<500){f.push(...h);return}const p=l?l[0]:a,g=l?l[1]:u;if(p===g){f.push(...h);return}const m=(g-p)/d,v=new Map;h.forEach(y=>{const b=y[t];if(b==null)return;const x=Math.min(Math.floor((b-p)/m),d-1);v.has(x)||v.set(x,[]),v.get(x).push(y)}),v.forEach(y=>{if(y.length===0)return;let b=y[0],x=y[0];y.forEach(_=>{_[n]x[n]&&(x=_)}),f.push(b),b!==x&&f.push(x)})}),f.sort((h,p)=>(h[t]||0)-(p[t]||0)),{data:f,xLim:l}}function wU(e,t=[]){const n=[],r={};e.forEach(l=>{if(l.includes("/")){const c=l.split("/"),f=c[0];if(r[f]||(r[f]={direct:[],subgroups:{}}),c.length===2)r[f].direct.push(l);else{const d=c[1];r[f].subgroups[d]||(r[f].subgroups[d]=[]),r[f].subgroups[d].push(l)}}else n.push(l)});function i(l){if(!t||t.length===0)return l.sort();const c=[],f=[...l];for(const d of t)for(let h=f.length-1;h>=0;h--)s(f[h],d)&&(c.push(f[h]),f.splice(h,1));return f.sort(),[...c,...f]}function s(l,c){return c===l||c.endsWith("/*")&&l.startsWith(c.slice(0,-1))?!0:c.includes("*")?new RegExp("^"+c.replace(/\*/g,".*")+"$").test(l):!1}function o(l){if(!t||t.length===0)return 1/0;for(let c=0;c0&&(a.charts={direct:i(n),subgroups:{}});const u=Object.keys(r);if(u.sort((l,c)=>{const f=o(l),d=o(c);return f!==d?f-d:l.localeCompare(c)}),u.forEach(l=>{const c=r[l];c.direct=i(c.direct),Object.keys(c.subgroups).forEach(f=>{c.subgroups[f]=i(c.subgroups[f])}),a[l]=c}),"charts"in a){const l=o("charts");if(l<1/0){const c=Object.entries(a);c.sort(([d],[h])=>{const p=d==="charts"?l:o(d),g=h==="charts"?l:o(h);return p!==g?p-g:d.localeCompare(h)});const f={};return c.forEach(([d,h])=>{f[d]=h}),f}}return a}function _Ae(e,t){if(!t||!t.trim())return e;try{const n=new RegExp(t,"i");return e.filter(r=>n.test(r))}catch{return e.filter(n=>n.toLowerCase().includes(t.toLowerCase()))}}var wAe=ee('

      No projects

      Create a project by calling trackio.init(project="โ€ฆ") in your training script.

      '),EAe=ee('

      No run selected

      Select one or more runs in the sidebar.

      '),AAe=ee('

      Start logging with Trackio

      You can create a new project by calling trackio.init():

      Then call trackio.log() to log metrics:

      Finally, call trackio.finish() to finish the run:

      '),SAe=ee('
      '),kAe=ee('
      '),CAe=ee(" ",1),FAe=ee('
      ');function $Ae(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=ne(t,"selectedRuns",19,()=>[]),i=ne(t,"allRuns",19,()=>[]),s=ne(t,"smoothing",3,10),o=ne(t,"xAxis",3,"step"),a=ne(t,"logScaleX",3,!1),u=ne(t,"logScaleY",3,!1),l=ne(t,"metricFilter",3,""),c=ne(t,"showHeaders",3,!0),f=ne(t,"appBootstrapReady",3,!1),d=ne(t,"plotOrder",19,()=>[]),h=fe(st([])),p=fe("step"),g=fe(st([])),m=fe(st(new Set)),v=fe(null),y=fe(!1),b=fe(st({})),x=fe(st({group:null,index:-1})),_=new Map,A=null,E=Be(()=>xv(i())),S=Be(()=>{let me=l()?_Ae(w(g),l()):w(g);return wU(me,d())}),k=Be(()=>Object.keys(w(S)));function F(me,W){const j=w(b)[me];if(!j)return W;const te=[];for(const U of j)W.includes(U)&&te.push(U);for(const U of W)te.includes(U)||te.push(U);return te}function D(me,W,j){z(x,{group:me,index:W},!0),j.dataTransfer.effectAllowed="move",j.dataTransfer.setData("text/plain","")}function M(me,W,j){w(x).group===me&&(j.preventDefault(),j.dataTransfer.dropEffect="move")}function T(me,W,j,te){if(te.preventDefault(),w(x).group!==me||w(x).index===W){z(x,{group:null,index:-1},!0);return}const U=[...j],[P]=U.splice(w(x).index,1);U.splice(W,0,P),z(b,{...w(b),[me]:U},!0),z(x,{group:null,index:-1},!0)}function $(){if(!n()||r().length===0){z(h,[],!0),z(g,[],!0);return}const me=[];for(const P of r()){const we=_.get(P);if(!we)continue;const he=yAe(we,P,s(),o(),a(),u());he&&(me.push(...he.rows),z(p,he.xColumn,!0))}z(h,me,!0);const W=me.filter(P=>P.data_type==="original"||!P.data_type),j=xAe(W).filter(P=>P!==w(p)&&P!=="run"&&P!=="data_type"&&P!=="x_axis");z(g,j,!0);const te=new Map;for(const P of W){const we=P.run;for(const he of j){if(P[he]==null)continue;const Le=`${he}\0${we}`;te.set(Le,(te.get(Le)||0)+1)}}const U=new Set(j);for(const[P,we]of te)we>1&&U.delete(P.split("\0")[0]);z(m,U,!0)}async function C(){if(!f()){z(y,!1);return}if(!n()||r().length===0){z(h,[],!0),z(g,[],!0),z(y,!0);return}let me=!1;for(const W of r())if(!_.has(W)){const j=await dv(n(),W);_.set(W,j),me=!0}(me||!w(y))&&$(),z(y,!0)}async function R(){if(!n()||r().length===0)return;let me=!1;for(const W of r()){const j=await dv(n(),W),te=_.get(W);(!te||j.length!==te.length)&&(_.set(W,j),me=!0)}me&&$()}Ht(()=>{n(),r(),f(),_=n()?_:new Map,C()}),Ht(()=>{s(),o(),a(),u(),w(y)&&$()}),pd(()=>{const me=zs("xmin"),W=zs("xmax");if(me!=null&&me!==""&&W!=null&&W!==""){const j=parseFloat(me),te=parseFloat(W);!Number.isNaN(j)&&!Number.isNaN(te)&&j{A&&clearInterval(A)}});function L(me){me&&me.length===2&&z(v,me,!0)}function O(){z(v,null)}function N(me){let W=w(h).filter(te=>te[me]!=null&&te[me]!==void 0);if(w(v)){const te=W.sort((we,he)=>we[w(p)]-he[w(p)]);let U=0,P=te.length-1;for(;U=0&&te[P][w(p)]>w(v)[1];)P--;U=Math.max(0,U-1),P=Math.min(te.length-1,P+1),W=te.slice(U,P+1)}return _U(W,w(p),me,"run",w(v)).data}var B=FAe(),q=I(B);{var X=me=>{Cc(me,{})},le=me=>{var W=wAe();V(me,W)},de=me=>{var W=EAe();V(me,W)},se=me=>{var W=AAe(),j=H(I(W),4),te=I(j);te.textContent=`import trackio +trackio.init(project="my-project")`;var U=H(j,4),P=I(U);P.textContent=`for i in range(10): + trackio.log({"loss": 1/(i+1)})`;var we=H(U,4),he=I(we);he.textContent="trackio.finish()",V(me,W)},Ce=me=>{var W=rs(),j=Ct(W);St(j,17,()=>w(k),At,(te,U)=>{const P=Be(()=>w(S)[w(U)]),we=Be(()=>`${w(U)}:direct`),he=Be(()=>F(w(we),w(P).direct)),Le=Be(()=>w(P).direct.length),Re=Be(()=>Object.values(w(P).subgroups).reduce((ft,Ee)=>ft+Ee.length,0)),qe=Be(()=>w(Le)+w(Re));{let ft=Be(()=>!c());wE(te,{get label(){return`${w(U)??""} (${w(qe)??""})`},open:!0,get hidden(){return w(ft)},children:(Ee,ae)=>{var ye=CAe(),it=Ct(ye);{var pt=dt=>{var tn=SAe();St(tn,21,()=>w(he),At,(Sr,nn,dn)=>{const Un=Be(()=>N(w(nn))),Ts=Be(()=>w(m).has(w(nn))),To=Be(()=>c()&&w(nn).split("/").slice(1).join("/")||w(nn));var Ea=rs(),kr=Ct(Ea);{var Cr=Aa=>{var Vr=rs(),Ns=Ct(Vr);{var Sa=pi=>{F6(pi,{get data(){return w(Un)},get y(){return w(nn)},get title(){return w(To)},get colorMap(){return w(E)},draggable:!0,ondragstart:kn=>D(w(we),dn,kn),ondragover:kn=>M(w(we),dn,kn),ondrop:kn=>T(w(we),dn,w(he),kn)})},Ud=pi=>{_E(pi,{get data(){return w(Un)},get x(){return w(p)},get y(){return w(nn)},get title(){return w(To)},get colorMap(){return w(E)},get xLim(){return w(v)},onSelect:L,onResetZoom:O,draggable:!0,ondragstart:kn=>D(w(we),dn,kn),ondragover:kn=>M(w(we),dn,kn),ondrop:kn=>T(w(we),dn,w(he),kn)})};Ae(Ns,pi=>{w(Ts)?pi(Sa):pi(Ud,-1)})}V(Aa,Vr)};Ae(kr,Aa=>{w(Un).length>0&&Aa(Cr)})}V(Sr,Ea)}),V(dt,tn)};Ae(it,dt=>{w(he).length>0&&dt(pt)})}var Se=H(it,2);St(Se,17,()=>Object.entries(w(P).subgroups),At,(dt,tn)=>{var Sr=Be(()=>VU(w(tn),2));let nn=()=>w(Sr)[0],dn=()=>w(Sr)[1];const Un=Be(()=>`${w(U)}:${nn()}`),Ts=Be(()=>F(w(Un),dn()));{let To=Be(()=>!c());wE(dt,{get label(){return`${nn()??""} (${dn().length??""})`},open:!0,get hidden(){return w(To)},children:(Ea,kr)=>{var Cr=kAe();St(Cr,21,()=>w(Ts),At,(Aa,Vr,Ns)=>{const Sa=Be(()=>N(w(Vr))),Ud=Be(()=>w(m).has(w(Vr))),pi=Be(()=>c()&&w(Vr).split("/").slice(2).join("/")||w(Vr));var kn=rs(),Kg=Ct(kn);{var Lb=qd=>{var Zg=rs(),or=Ct(Zg);{var EU=Dc=>{F6(Dc,{get data(){return w(Sa)},get y(){return w(Vr)},get title(){return w(pi)},get colorMap(){return w(E)},draggable:!0,ondragstart:Hi=>D(w(Un),Ns,Hi),ondragover:Hi=>M(w(Un),Ns,Hi),ondrop:Hi=>T(w(Un),Ns,w(Ts),Hi)})},AU=Dc=>{_E(Dc,{get data(){return w(Sa)},get x(){return w(p)},get y(){return w(Vr)},get title(){return w(pi)},get colorMap(){return w(E)},get xLim(){return w(v)},onSelect:L,onResetZoom:O,draggable:!0,ondragstart:Hi=>D(w(Un),Ns,Hi),ondragover:Hi=>M(w(Un),Ns,Hi),ondrop:Hi=>T(w(Un),Ns,w(Ts),Hi)})};Ae(or,Dc=>{w(Ud)?Dc(EU):Dc(AU,-1)})}V(qd,Zg)};Ae(Kg,qd=>{w(Sa).length>0&&qd(Lb)})}V(Aa,kn)}),V(Ea,Cr)},$$slots:{default:!0}})}}),V(Ee,ye)},$$slots:{default:!0}})}}),V(me,W)};Ae(q,me=>{!f()||!w(y)?me(X):n()?r().length===0?me(de,2):w(h).length===0?me(se,3):me(Ce,-1):me(le,1)})}V(e,B),Yt()}var DAe=ee('

      No projects

      Create a project by calling trackio.init(project="โ€ฆ") in your training script.

      '),MAe=ee('

      No run selected

      Select one or more runs in the sidebar.

      '),RAe=ee('

      No System Metrics Available

      System metrics will appear here once logged. To enable automatic logging:

      Setup:

      • NVIDIA GPU: pip install trackio[gpu] (requires nvidia-ml-py)
      • Apple Silicon: pip install trackio[apple-gpu] (requires psutil)
      '),TAe=ee('
      '),NAe=ee('
      ');function OAe(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=ne(t,"selectedRuns",19,()=>[]),i=ne(t,"smoothing",3,5),s=ne(t,"appBootstrapReady",3,!1),o=fe(st([])),a=fe(st([])),u=fe(null),l=fe(!1),c=fe(st({})),f=fe(st({group:null,index:-1})),d=new Map,h=null,p=Be(()=>xv(r())),g=Be(()=>wU(w(a))),m=Be(()=>Object.keys(w(g)));function v(O,N){const B=w(c)[O];if(!B)return N;const q=[];for(const X of B)N.includes(X)&&q.push(X);for(const X of N)q.includes(X)||q.push(X);return q}function y(O,N,B){z(f,{group:O,index:N},!0),B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain","")}function b(O,N,B){w(f).group===O&&(B.preventDefault(),B.dataTransfer.dropEffect="move")}function x(O,N,B,q){if(q.preventDefault(),w(f).group!==O||w(f).index===N){z(f,{group:null,index:-1},!0);return}const X=[...B],[le]=X.splice(w(f).index,1);X.splice(N,0,le),z(c,{...w(c),[O]:X},!0),z(f,{group:null,index:-1},!0)}function _(){if(!n()||r().length===0){z(o,[],!0),z(a,[],!0);return}const O=[],N=new Set;for(const B of r()){const q=d.get(B);if(!q||q.length===0)continue;const X=new Date(q[0].timestamp).getTime();q.forEach(le=>{const de=(new Date(le.timestamp).getTime()-X)/1e3;Object.keys(le).forEach(se=>{typeof le[se]=="number"&&se!=="step"&&se!=="time"&&N.add(se)}),O.push({...le,time:de,run:B,data_type:"original"})})}z(a,Array.from(N).sort(),!0),z(o,O,!0)}async function A(){if(!s()){z(l,!1);return}if(!n()||r().length===0){z(o,[],!0),z(a,[],!0),z(l,!0);return}let O=!1;for(const N of r())if(!d.has(N)){const B=await W6(n(),N);d.set(N,B),O=!0}(O||!w(l))&&_(),z(l,!0)}async function E(){if(!n()||r().length===0)return;let O=!1;for(const N of r()){const B=await W6(n(),N),q=d.get(N);(!q||B.length!==q.length)&&(d.set(N,B),O=!0)}O&&_()}Ht(()=>{n(),r(),s(),d=n()?d:new Map,A()}),Ht(()=>{i(),w(l)&&_()}),pd(()=>(h=setInterval(E,1e3),()=>{h&&clearInterval(h)}));function S(O){O&&O.length===2&&z(u,O,!0)}function k(){z(u,null)}function F(O){let N=w(o).filter(q=>q[O]!=null&&q[O]!==void 0);if(w(u)){const q=N.sort((de,se)=>de.time-se.time);let X=0,le=q.length-1;for(;X=0&&q[le].time>w(u)[1];)le--;X=Math.max(0,X-1),le=Math.min(q.length-1,le+1),N=q.slice(X,le+1)}return _U(N,"time",O,"run",w(u)).data}var D=NAe(),M=I(D);{var T=O=>{Cc(O,{})},$=O=>{var N=DAe();V(O,N)},C=O=>{var N=MAe();V(O,N)},R=O=>{var N=RAe(),B=H(I(N),4),q=I(B);q.textContent=`import trackio + +# Auto-enabled when hardware is detected (NVIDIA GPU or Apple Silicon) +run = trackio.init(project="my-project") + +# Or explicitly enable it: +run = trackio.init(project="my-project", auto_log_gpu=True) + +# You can also manually log system metrics: +trackio.log_gpu()`,V(O,N)},L=O=>{var N=rs(),B=Ct(N);St(B,17,()=>w(m),At,(q,X)=>{const le=Be(()=>w(g)[w(X)]),de=Be(()=>`sys:${w(X)}`),se=Be(()=>v(w(de),w(le).direct));wE(q,{get label(){return w(X)},open:!0,children:(Ce,me)=>{var W=TAe();St(W,21,()=>w(se),At,(j,te,U)=>{const P=Be(()=>F(w(te)));var we=rs(),he=Ct(we);{var Le=Re=>{_E(Re,{get data(){return w(P)},x:"time",get y(){return w(te)},get title(){return w(te)},get colorMap(){return w(p)},get xLim(){return w(u)},onSelect:S,onResetZoom:k,draggable:!0,ondragstart:qe=>y(w(de),U,qe),ondragover:qe=>b(w(de),U,qe),ondrop:qe=>x(w(de),U,w(se),qe)})};Ae(he,Re=>{w(P).length>0&&Re(Le)})}V(j,we)}),V(Ce,W)},$$slots:{default:!0}})}),V(O,N)};Ae(M,O=>{!s()||!w(l)?O(T):n()?r().length===0?O(C,2):w(o).length===0?O(R,3):O(L,-1):O($,1)})}V(e,D),Yt()}var LAe=ee('

      '),IAe=ee(''),PAe=ee('
      '),BAe=ee(''),zAe=ee(" "),jAe=ee(""),UAe=ee('
      ');function qAe(e,t){Gt(t,!0);let n=ne(t,"headers",19,()=>[]),r=ne(t,"rows",19,()=>[]),i=ne(t,"selectable",3,!1),s=ne(t,"selectedIndices",31,()=>st(new Set)),o=ne(t,"onrowclick",3,null),a=ne(t,"label",3,""),u=fe(null),l=fe("asc");function c(k){w(u)===k?z(l,w(l)==="asc"?"desc":"asc",!0):(z(u,k,!0),z(l,"asc"))}let f=Be(()=>{if(w(u)===null)return r();const k=n().indexOf(w(u));return k===-1?r():[...r()].sort((F,D)=>{const M=F[k],T=D[k];if(M==null&&T==null)return 0;if(M==null)return 1;if(T==null)return-1;if(typeof M=="number"&&typeof T=="number")return w(l)==="asc"?M-T:T-M;const $=String(M),C=String(T);return w(l)==="asc"?$.localeCompare(C):C.localeCompare($)})});function d(){s().size===r().length?s(new Set):s(new Set(r().map((k,F)=>F)))}function h(k){const F=new Set(s());F.has(k)?F.delete(k):F.add(k),s(F)}var p=UAe(),g=I(p);{var m=k=>{var F=LAe(),D=I(F),M=I(D);ke(()=>Me(M,a())),V(k,F)};Ae(g,k=>{a()&&k(m)})}var v=H(g,2),y=I(v),b=I(y),x=I(b),_=I(x);{var A=k=>{var F=IAe(),D=I(F);ke(()=>lp(D,s().size===r().length&&r().length>0)),je("change",D,d),V(k,F)};Ae(_,k=>{i()&&k(A)})}var E=H(_);St(E,17,n,At,(k,F,D)=>{var M=PAe();let T;var $=I(M),C=I($),R=I(C),L=H(C,2);let O;var N=I(L);ke(()=>{T=Tt(M,1,"svelte-1cp60rw",null,T,{first:D===0&&!i(),last:D===n().length-1}),Me(R,w(F)),O=Tt(L,1,"sort-arrow svelte-1cp60rw",null,O,{visible:w(u)===w(F)}),Me(N,w(u)===w(F)?w(l)==="asc"?"โ†‘":"โ†“":"โ†‘")}),je("click",M,()=>c(w(F))),V(k,M)});var S=H(b);St(S,21,()=>w(f),At,(k,F,D)=>{var M=jAe();let T;var $=I(M);{var C=L=>{var O=BAe(),N=I(O);ke(B=>lp(N,B),[()=>s().has(D)]),je("click",O,B=>B.stopPropagation()),je("change",N,()=>h(D)),V(L,O)};Ae($,L=>{i()&&L(C)})}var R=H($);St(R,17,()=>w(F),At,(L,O,N)=>{var B=zAe();let q;var X=I(B);ke(()=>{q=Tt(B,1,"svelte-1cp60rw",null,q,{first:N===0&&!i(),last:N===w(F).length-1}),Me(X,w(O)??"")}),V(L,B)}),ke(L=>T=Tt(M,1,"svelte-1cp60rw",null,T,L),[()=>({"row-odd":D%2===1,selected:s().has(D)})]),je("click",M,()=>{var L;return(L=o())==null?void 0:L(w(F),D)}),V(k,M)}),V(e,p),Yt()}hi(["change","click"]);var WAe=ee('

      Select a project

      Pick a project in the sidebar to browse media and tables for a run.

      ',1),HAe=ee('

      No runs selected

      Select runs in the sidebar to browse media and tables.

      ',1),GAe=ee('

      No media or tables in this run

      Log images, video, audio, and tables by passing Trackio objects to trackio.log():

      Each type appears in its own section here once logged.

      ',1),YAe=ee('
      '),VAe=ee('
      '),XAe=ee(''),KAe=ee('

      '),ZAe=ee('',2),JAe=ee('

      '),QAe=ee('
      '),eSe=ee('

      '),tSe=ee('
      '),nSe=ee('

      '),rSe=ee(" ",1),iSe=ee('
      ');function sSe(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=ne(t,"selectedRuns",19,()=>[]),i=ne(t,"tableTruncateLength",3,250),s=fe(st({images:[],videos:[],audios:[],tables:[]})),o=fe(!1);async function a(){if(!n()||r().length===0){z(s,{images:[],videos:[],audios:[],tables:[]},!0);return}z(o,!0);try{const p=r(),g=[];for(const _ of p){const A=await dv(n(),_);A&&g.push(...A.map(E=>({...E,_run:_})))}const m=g,v=[],y=[],b=[],x=[];if(m&&m.forEach((_,A)=>{Object.entries(_).forEach(([E,S])=>{if(S&&typeof S=="object"&&S._type){const k={key:E,step:_.step||A,...S};switch(S._type){case"trackio.image":v.push(k);break;case"trackio.video":y.push(k);break;case"trackio.audio":b.push(k);break;case"trackio.table":x.push(k);break}}})}),await Ar()){const _=A=>Promise.all(A.map(async E=>(E.file_path&&(E._resolvedUrl=await vAe(E.file_path)),E)));await Promise.all([_(v),_(y),_(b)])}z(s,{images:v,videos:y,audios:b,tables:x},!0)}catch(p){console.error("Failed to load media:",p)}finally{z(o,!1)}}Ht(()=>{n(),r(),a()});function u(p){return p._resolvedUrl?p._resolvedUrl:p.file_path?yU(p.file_path):""}var l=iSe(),c=I(l);{var f=p=>{Cc(p,{})},d=p=>{var g=YAe(),m=I(g);{var v=x=>{var _=WAe();V(x,_)},y=x=>{var _=HAe(),A=H(Ct(_),4),E=I(A);E.textContent=`import trackio +trackio.init(project="my-project") +trackio.log({"loss": 0.5}) +trackio.finish()`,V(x,_)},b=x=>{var _=GAe(),A=H(Ct(_),4),E=I(A);E.textContent=`import trackio + +trackio.init(project="my-project") +trackio.log({"plot": trackio.Image("figure.png")}) +trackio.log({"clip": trackio.Video("output.mp4")}) +trackio.log({"audio": trackio.Audio("speech.wav")}) + +import pandas as pd +df = pd.DataFrame({"epoch": [0, 1], "acc": [0.9, 0.95]}) +trackio.log({"samples": trackio.Table(dataframe=df)})`,V(x,_)};Ae(m,x=>{n()?r().length===0?x(y,1):x(b,-1):x(v)})}V(p,g)},h=p=>{var g=rSe(),m=Ct(g);{var v=S=>{var k=KAe(),F=I(k),D=I(F),M=H(F,2);St(M,21,()=>w(s).images,At,(T,$)=>{var C=XAe(),R=I(C),L=H(R,2);{var O=q=>{var X=VAe(),le=I(X);ke(()=>Me(le,w($).caption)),V(q,X)};Ae(L,q=>{w($).caption&&q(O)})}var N=H(L,2),B=I(N);ke(q=>{Nt(R,"src",q),Nt(R,"alt",w($).caption||w($).key),Me(B,`Step ${w($).step??""}`)},[()=>u(w($))]),V(T,C)}),ke(()=>Me(D,`Images (${w(s).images.length??""})`)),V(S,k)};Ae(m,S=>{w(s).images.length>0&&S(v)})}var y=H(m,2);{var b=S=>{var k=JAe(),F=I(k),D=I(F),M=H(F,2);St(M,21,()=>w(s).videos,At,(T,$)=>{var C=ZAe(),R=I(C),L=H(R,2),O=I(L);ke(N=>{Nt(R,"src",N),Me(O,`Step ${w($).step??""}`)},[()=>u(w($))]),V(T,C)}),ke(()=>Me(D,`Videos (${w(s).videos.length??""})`)),V(S,k)};Ae(y,S=>{w(s).videos.length>0&&S(b)})}var x=H(y,2);{var _=S=>{var k=eSe(),F=I(k),D=I(F),M=H(F,2);St(M,21,()=>w(s).audios,At,(T,$)=>{var C=QAe(),R=I(C),L=I(R),O=H(R,2);ke(N=>{Me(L,`${w($).key??""} (step ${w($).step??""})`),Nt(O,"src",N)},[()=>u(w($))]),V(T,C)}),ke(()=>Me(D,`Audio (${w(s).audios.length??""})`)),V(S,k)};Ae(x,S=>{w(s).audios.length>0&&S(_)})}var A=H(x,2);{var E=S=>{var k=nSe(),F=I(k),D=I(F),M=H(F,2);St(M,17,()=>w(s).tables,At,(T,$)=>{var C=tSe(),R=I(C);{var L=O=>{{let N=Be(()=>Object.keys(w($)._value[0])),B=Be(()=>w($)._value.map(q=>Object.values(q).map(X=>typeof X=="string"&&X.length>i()?X.slice(0,i())+"โ€ฆ":X)));qAe(O,{get label(){return`${w($).key??""} (step ${w($).step??""})`},get headers(){return w(N)},get rows(){return w(B)}})}};Ae(R,O=>{w($)._value&&w($)._value.length>0&&O(L)})}V(T,C)}),ke(()=>Me(D,`Tables (${w(s).tables.length??""})`)),V(S,k)};Ae(A,S=>{w(s).tables.length>0&&S(E)})}V(p,g)};Ae(c,p=>{w(o)?p(f):w(s).images.length===0&&w(s).videos.length===0&&w(s).audios.length===0&&w(s).tables.length===0?p(d,1):p(h,-1)})}V(e,l),Yt()}var oSe=ee(`

      No alerts or reports yet

      Alerts are recorded when your training script calls trackio.alert(). + Reports are logged as Markdown via trackio.log().

      `),aSe=ee('
      '),uSe=ee('

      '),lSe=ee('

      No alerts for this level.

      '),cSe=ee(' '),fSe=ee(' '),dSe=ee(''),hSe=ee('
      '),pSe=ee('

      '),gSe=ee(" ",1),mSe=ee('
      ');function vSe(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=ne(t,"selectedRuns",19,()=>[]),i=fe(st([])),s=fe(st([])),o=fe(null),a=fe(!1);const u={info:"๐Ÿ”ต",warn:"๐ŸŸก",error:"๐Ÿ”ด"};function l(x){if(!x)return"";let _=x.replace(/&/g,"&").replace(//g,">");return _=_.replace(/^### (.+)$/gm,"

      $1

      "),_=_.replace(/^## (.+)$/gm,"

      $1

      "),_=_.replace(/^# (.+)$/gm,"

      $1

      "),_=_.replace(/\*\*(.+?)\*\*/g,"$1"),_=_.replace(/`([^`]+)`/g,"$1"),_=_.replace(/^- (.+)$/gm,"
    • $1
    • "),_=_.replace(/(
    • .*<\/li>\n?)+/gs,A=>`
        ${A}
      `),_=_.replace(/\n{2,}/g,"

      "),_=`

      ${_}

      `,_=_.replace(/

      \s*()/g,"$1"),_=_.replace(/(<\/h[234]>)\s*<\/p>/g,"$1"),_=_.replace(/

      \s*(

        )/g,"$1"),_=_.replace(/(<\/ul>)\s*<\/p>/g,"$1"),_=_.replace(/

        \s*<\/p>/g,""),_}let c=Be(()=>w(o)?w(i).filter(x=>x.level===w(o)):w(i));async function f(){if(!n()){z(i,[],!0),z(s,[],!0);return}z(a,!0);try{const x=await vU(n(),null,null,null),_=new Set(r());z(i,(x||[]).filter(S=>!S.run||_.has(S.run)),!0);const A=r(),E=[];for(const S of A)try{const k=await dv(n(),S);if(k)for(const F of k)for(const[D,M]of Object.entries(F))M&&typeof M=="object"&&M._type==="trackio.markdown"&&E.push({key:D,run:S,step:F.step,content:M._value||""})}catch{}z(s,E,!0)}catch(x){console.error("Failed to load alerts:",x),z(i,[],!0)}finally{z(a,!1)}}Ht(()=>{n(),r(),f()});function d(x){if(!x)return"";try{return new Date(x).toLocaleString()}catch{return x}}let h=["Level","Run","Title","Text","Step","Time"],p=Be(()=>w(c).map(x=>[`${u[x.level]||""} ${x.level}`,x.run||"",x.title,x.text||"",x.step??"",d(x.timestamp)]));var g=mSe(),m=I(g);{var v=x=>{Cc(x,{})},y=x=>{var _=oSe(),A=H(I(_),4),E=I(A);E.textContent=`import trackio +from trackio import AlertLevel + +trackio.init(project="my-project") +trackio.alert("Low validation loss", text="Consider saving a checkpoint.", level=AlertLevel.INFO) +trackio.log({"reports/summary": trackio.Markdown("# My Report\\nResults look good.")})`,V(x,_)},b=x=>{var _=gSe(),A=Ct(_);{var E=F=>{var D=uSe(),M=I(D),T=I(M),$=H(M,2);St($,17,()=>w(s),At,(C,R)=>{var L=aSe(),O=I(L),N=I(O),B=H(O,2);nW(B,()=>l(w(R).content),!0),ke(()=>Me(N,`${w(R).key??""} ยท ${w(R).run??""} ยท step ${w(R).step??""}`)),V(C,L)}),ke(()=>Me(T,`Reports (${w(s).length??""})`)),V(F,D)};Ae(A,F=>{w(s).length>0&&F(E)})}var S=H(A,2);{var k=F=>{var D=pSe(),M=I(D),T=I(M),$=H(M,2),C=I($),R=I(C),L=I(R);let O;var N=H(L,2);let B;var q=H(N,2);let X;var le=H(q,2);let de;var se=H($,2);{var Ce=W=>{var j=lSe();V(W,j)},me=W=>{var j=hSe(),te=I(j),U=I(te);St(U,21,()=>h,At,(we,he)=>{var Le=cSe(),Re=I(Le);ke(()=>Me(Re,w(he))),V(we,Le)});var P=H(te);St(P,21,()=>w(p),At,(we,he)=>{var Le=dSe();St(Le,21,()=>w(he),At,(Re,qe)=>{var ft=fSe(),Ee=I(ft);ke(()=>Me(Ee,w(qe))),V(Re,ft)}),V(we,Le)}),V(W,j)};Ae(se,W=>{w(c).length===0?W(Ce):W(me,-1)})}ke(()=>{Me(T,`Alerts (${w(i).length??""})`),O=Tt(L,1,"pill svelte-iufsej",null,O,{active:w(o)===null}),B=Tt(N,1,"pill svelte-iufsej",null,B,{active:w(o)==="info"}),X=Tt(q,1,"pill svelte-iufsej",null,X,{active:w(o)==="warn"}),de=Tt(le,1,"pill svelte-iufsej",null,de,{active:w(o)==="error"})}),je("click",L,()=>z(o,null)),je("click",N,()=>z(o,"info")),je("click",q,()=>z(o,"warn")),je("click",le,()=>z(o,"error")),V(F,D)};Ae(S,F=>{w(i).length>0&&F(k)})}V(x,_)};Ae(m,x=>{w(a)?x(v):w(i).length===0&&w(s).length===0?x(y,1):x(b,-1)})}V(e,g),Yt()}hi(["click"]);var ySe=ee('

        No runs in this project

        Runs are created when you call trackio.init() and log at least one step. Example:

        Refresh this page or wait for the dashboard to poll; new runs appear in the table with step counts.

        '),bSe=ee(''),xSe=ee('
        '),_Se=ee(' '),wSe=ee('
        ActionsRun NameStepsLast Step
        '),ESe=ee('
        ');function ASe(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=ne(t,"runs",19,()=>[]),i=ne(t,"onRunsChanged",3,null),s=ne(t,"runMutationAllowed",3,!0),o=Be(s),a=Be(()=>xv(r())),u=fe(st([])),l=fe(!1),c=fe(-1),f=fe("");async function d(){if(!n()){z(u,[],!0);return}z(l,!0);try{const E=(await lAe(n())).runs||[],k=(await Promise.all(E.map(F=>mU(n(),F)))).map((F,D)=>({name:E[D],numSteps:F.num_logs||0,lastStep:F.last_step||0}));z(u,k,!0)}catch(A){console.error("Failed to load runs:",A)}finally{z(l,!1)}}Ht(()=>{n(),d()});async function h(A){if(w(o)&&confirm(`Delete run "${A}"? This cannot be undone.`))try{await hAe(n(),A),await d(),i()&&i()()}catch(E){console.error("Failed to delete run:",E)}}function p(A,E){w(o)&&(z(c,A,!0),z(f,E,!0))}async function g(A){if(!w(o))return;const E=w(f).trim();if(!E||E===A){z(c,-1);return}try{await pAe(n(),A,E),z(c,-1),await d(),i()&&i()()}catch(S){console.error("Failed to rename run:",S)}}function m(A,E){A.key==="Enter"&&g(E),A.key==="Escape"&&z(c,-1)}var v=ESe(),y=I(v);{var b=A=>{Cc(A,{})},x=A=>{var E=ySe(),S=H(I(E),4),k=I(S);k.textContent=`import trackio +trackio.init(project="my-project") +for i in range(10): + trackio.log({"loss": 1 / (i + 1)}) +trackio.finish()`,V(A,E)},_=A=>{var E=wSe(),S=H(I(E));St(S,21,()=>w(u),At,(k,F,D)=>{var M=_Se(),T=I(M),$=I(T),C=H($,2),R=H(T),L=I(R);{var O=de=>{var se=bSe();je("keydown",se,Ce=>m(Ce,w(F).name)),as("blur",se,()=>g(w(F).name)),bv(se,()=>w(f),Ce=>z(f,Ce)),V(de,se)},N=de=>{var se=xSe(),Ce=I(se);let me;var W=H(Ce,2),j=I(W);ke(()=>{me=Ll(Ce,"",me,{background:w(a)[w(F).name]??"#9ca3af"}),Me(j,w(F).name)}),je("click",W,()=>{QW("selected_run",w(F).name),X8("run-detail")}),V(de,se)};Ae(L,de=>{w(c)===D?de(O):de(N,-1)})}var B=H(R),q=I(B),X=H(B),le=I(X);ke(()=>{Nt($,"title",w(o)?"Rename":"Sign in with Hugging Face (write access) to rename runs"),$.disabled=!w(o),Nt(C,"title",w(o)?"Delete":"Sign in with Hugging Face (write access) to delete runs"),C.disabled=!w(o),Me(q,w(F).numSteps),Me(le,w(F).lastStep)}),je("click",$,()=>p(D,w(F).name)),je("click",C,()=>h(w(F).name)),V(k,M)}),V(A,E)};Ae(y,A=>{w(l)?A(b):w(u).length===0?A(x,1):A(_,-1)})}V(e,v),Yt()}hi(["click","keydown"]);var SSe=ee(`

        Open a run

        Choose a run from the Runs page or follow a run name from the sidebar. This view shows the + project name, log count, last step, metric keys, and any logged config.

        Config passed to trackio.init() appears under Configuration when present.

        `),kSe=ee('

        Configuration

         
        ',1),CSe=ee('

        Project
        Total Logs
        Last Step
        Metrics
        '),FSe=ee('
        ');function $Se(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=fe(null),i=fe(null),s=fe(!1);Ht(()=>{z(r,zs("selected_run"),!0)});async function o(){if(!n()||!w(r)){z(i,null);return}z(s,!0);try{z(i,await mU(n(),w(r)),!0)}catch(d){console.error("Failed to load run detail:",d)}finally{z(s,!1)}}Ht(()=>{n(),w(r),o()});var a=FSe(),u=I(a);{var l=d=>{Cc(d,{})},c=d=>{var h=SSe(),p=H(I(h),4),g=I(p);g.textContent=`import trackio +trackio.init(project="my-project", config={"lr": 1e-3}) +trackio.log({"loss": 0.5}) +trackio.finish()`,V(d,h)},f=d=>{var h=CSe(),p=I(h),g=I(p),m=H(p,2),v=I(m),y=H(I(v),2),b=I(y),x=H(v,2),_=H(I(x),2),A=I(_),E=H(x,2),S=H(I(E),2),k=I(S),F=H(E,2),D=H(I(F),2),M=I(D),T=H(m,2);{var $=C=>{var R=kSe(),L=H(Ct(R),2),O=I(L);ke(N=>Me(O,N),[()=>JSON.stringify(w(i).config,null,2)]),V(C,R)};Ae(T,C=>{w(i).config&&C($)})}ke(C=>{Me(g,w(i).run),Me(b,w(i).project),Me(A,w(i).num_logs),Me(k,w(i).last_step??"N/A"),Me(M,C)},[()=>w(i).metrics?w(i).metrics.join(", "):"None"]),V(d,h)};Ae(u,d=>{w(s)?d(l):w(i)?d(f,-1):d(c,1)})}V(e,a),Yt()}var DSe=ee('

        No project files yet

        Files are stored at the project level (not tied to a single run). After trackio.init(), copy artifacts into the project with trackio.save():

        Paths can be a single file or a glob. Saved files will list here for download.

        '),MSe=ee(' '),RSe=ee('
        Loading preview...
        '),TSe=ee('
         
        '),NSe=ee('
        Preview not available. Download the file instead.
        '),OSe=ee('
        '),LSe=ee('
        '),ISe=ee('

        Files

        Showing files saved across all runs in this project.

        ',1),PSe=ee('
        ');function BSe(e,t){Gt(t,!0);let n=ne(t,"project",3,null),r=fe(st([])),i=fe(!1),s=fe(null),o=fe(null),a=fe(!1);const u=new Set(["txt","md","json","yml","yaml","toml","ini","cfg","csv","tsv","xml","html","css","js","py","sh","log","conf","env","gitignore","dockerfile"]);function l(y){const b=y.split(".").pop().toLowerCase();return u.has(b)}function c(y){return y==null?"":y<1024?`${y} B`:y<1024*1024?`${(y/1024).toFixed(1)} KB`:`${(y/(1024*1024)).toFixed(1)} MB`}async function f(y){if(w(s)===y.name){z(s,null),z(o,null);return}if(z(s,y.name,!0),!l(y.name)){z(o,null);return}z(a,!0);try{const b=zx(y.path),x=await fetch(b);if(!x.ok)throw new Error("fetch failed");const _=await x.text();z(o,_.length>5e4?_.slice(0,5e4)+` + +โ€ฆ (truncated)`:_,!0)}catch{z(o,null)}finally{z(a,!1)}}async function d(){if(!n()){z(r,[],!0);return}z(i,!0);try{z(r,await fAe(n()),!0)}catch{z(r,[],!0)}finally{z(i,!1)}}Ht(()=>{n(),d()});var h=PSe(),p=I(h);{var g=y=>{Cc(y,{})},m=y=>{var b=DSe(),x=H(I(b),4),_=I(x);_.textContent=`import trackio + +trackio.init(project="my-project") +trackio.save("config.yaml") +trackio.save("checkpoints/*.pt")`,V(y,b)},v=y=>{var b=ISe(),x=H(Ct(b),4);St(x,21,()=>w(r),At,(_,A)=>{var E=LSe();let S;var k=I(E),F=I(k),D=I(F),M=I(D),T=H(D),$=H(F,2),C=I($);{var R=B=>{var q=MSe(),X=I(q);ke(le=>Me(X,le),[()=>c(w(A).size)]),V(B,q)};Ae(C,B=>{w(A).size!=null&&B(R)})}var L=H(C,2),O=H(k,2);{var N=B=>{var q=OSe(),X=I(q);{var le=Ce=>{var me=RSe();V(Ce,me)},de=Ce=>{var me=TSe(),W=I(me);ke(()=>Me(W,w(o))),V(Ce,me)},se=Ce=>{var me=NSe(),W=H(I(me));ke(j=>Nt(W,"href",j),[()=>zx(w(A).path)]),V(Ce,me)};Ae(X,Ce=>{w(a)?Ce(le):w(o)!=null?Ce(de,1):Ce(se,-1)})}V(B,q)};Ae(O,B=>{w(s)===w(A).name&&B(N)})}ke((B,q)=>{S=Tt(E,1,"file-item svelte-1xvfk9n",null,S,{expanded:w(s)===w(A).name}),Me(M,B),Me(T,` ${w(A).name??""}`),Nt(L,"href",q)},[()=>l(w(A).name)?"๐Ÿ“„":"๐Ÿ“ฆ",()=>zx(w(A).path)]),je("click",F,()=>f(w(A))),V(_,E)}),V(y,b)};Ae(p,y=>{w(i)?y(g):w(r).length===0?y(m,1):y(v,-1)})}V(e,h),Yt()}hi(["click"]);var zSe=ee('
        ');function jSe(e,t){Gt(t,!0),TW(zs("__theme")||V8());let n=fe("metrics"),r=fe(st([])),i=fe(null),s=fe(st([])),o=fe(st([])),a=fe(10),u=fe("step"),l=fe(!1),c=fe(!1),f=fe(""),d=fe(!0),h=fe(!0),p=fe(""),g=fe(!0),m=fe(!1),v=fe(0),y=fe(st([])),b=fe(null),x=fe(st({spaces:!1,allowed:!0,auth:"local"})),_=fe(null),A=fe(!1),E=fe(st({light:"/static/trackio/trackio_logo_type_light_transparent.png",dark:"/static/trackio/trackio_logo_type_dark_transparent.png"})),S=fe(st([])),k=fe(250),F=fe(null);function D(ae){z(n,ae,!0),X8(ae)}function M(){return zs("project")||zs("selected_project")}function T(){const ae=M();ae&&w(r).includes(ae)&&z(i,ae,!0)}async function $(){try{const ae=await aAe();if(z(r,ae||[],!0),w(r).length>0&&!w(i)){const ye=M();z(i,ye&&w(r).includes(ye)?ye:w(r)[0],!0)}T()}catch(ae){console.error("Failed to load projects:",ae)}}async function C(){await R(),await B()}async function R(){if(!w(i)){z(s,[],!0),z(o,[],!0);return}try{const ye=await uAe(w(i))||[],it=new Set(ye);if(JSON.stringify(w(s))!==JSON.stringify(ye)){const pt=new Set(w(o));z(s,ye,!0);const Se=w(o).filter(dt=>it.has(dt));Se.length===0&&w(o).length===0?z(o,[...ye],!0):z(o,[...Se,...ye.filter(dt=>!new Set([...Se,...Array.from(pt)]).has(dt))],!0)}}catch(ae){console.error("Failed to load runs:",ae)}}async function L(){if(w(i))try{const ae=await vU(w(i),null,null,null);z(y,(ae||[]).slice(-20),!0)}catch{}}function O(){w(b)&&clearInterval(w(b)),z(b,setInterval(async()=>{w(d)&&(await R(),await L())},1e3),!0)}function N(){const ae=new URLSearchParams(window.location.search);let ye=!1;const it=ae.get("write_token");it&&(document.cookie=`trackio_write_token=${encodeURIComponent(it)}; path=/; max-age=604800; SameSite=Lax`,ae.delete("write_token"),ye=!0);const pt=ae.get("oauth_session");if(pt&&(sessionStorage.setItem("trackio_oauth_session",pt),ae.delete("oauth_session"),ye=!0),ye){const Se=ae.toString(),dt=window.location.pathname+(Se?`?${Se}`:"");window.history.replaceState({},"",dt)}}async function B(){try{const ae=await dAe();z(x,{spaces:!!ae.spaces,allowed:!!ae.allowed,auth:ae.auth??"none"},!0)}catch{z(x,{spaces:!1,allowed:!0,auth:"local"},!0)}}function q(){w(_)&&clearInterval(w(_)),z(_,setInterval(()=>{B()},15e3),!0)}Ht(()=>{w(i),R()}),pd(()=>{const ae=zs("sidebar");ae==="hidden"?(z(m,!0),z(g,!1)):ae==="collapsed"?(z(m,!1),z(g,!1)):z(m,!1);const ye=zs("smoothing");if(ye){const pt=parseInt(ye,10);Number.isNaN(pt)||z(a,pt,!0)}const it=zs("metrics");if(it){const pt=it.split(",").map(Se=>Se.trim()).filter(Boolean);pt.length&&z(f,pt.map(Se=>`^${Se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`).join("|"),!0)}return zs("accordion")==="hidden"&&z(h,!1),z(n,BF(),!0),window.addEventListener("popstate",()=>{z(n,BF(),!0),m8(v),T()}),N(),(async()=>{const pt=await Ar();pt?(z(d,!1),z(x,{spaces:!1,allowed:!1,auth:"static"},!0),z(F,await mAe(),!0)):(B(),q(),window.addEventListener("focus",B));try{try{const Se=await cAe();Se&&(Se.logo_urls&&z(E,Se.logo_urls,!0),Se.color_palette&&RW(Se.color_palette),Se.plot_order&&z(S,Se.plot_order,!0),Se.table_truncate_length&&z(k,Se.table_truncate_length,!0),Se.media_dir&&gAe(Se.media_dir))}catch{}await $(),await R(),await L()}catch(Se){console.error("Failed to load projects:",Se)}finally{z(A,!0)}pt||O()})(),()=>{w(b)&&clearInterval(w(b)),w(_)&&clearInterval(w(_)),window.removeEventListener("focus",B)}});let X=Be(()=>{w(v);const ae=M();return!!(ae&&w(r).includes(ae))});Ht(()=>{w(r),w(v),w(X)&&T()});let le=Be(()=>w(n)==="metrics"||w(n)==="system"||w(n)==="media"||w(n)==="reports"||w(n)==="runs"||w(n)==="run-detail"||w(n)==="files"),de=Be(()=>w(n)==="runs"||w(n)==="files"?"compact":"full");var se=zSe(),Ce=I(se);{var me=ae=>{GW(ae,{get variant(){return w(de)},get currentPage(){return w(n)},get spacesMode(){return w(x).spaces},get runMutationAllowed(){return w(x).allowed},get mutationAuth(){return w(x).auth},get readOnlySource(){return w(F)},get projects(){return w(r)},get projectLocked(){return w(X)},get runs(){return w(s)},get logoUrls(){return w(E)},get open(){return w(g)},set open(ye){z(g,ye,!0)},get selectedProject(){return w(i)},set selectedProject(ye){z(i,ye,!0)},get selectedRuns(){return w(o)},set selectedRuns(ye){z(o,ye,!0)},get smoothing(){return w(a)},set smoothing(ye){z(a,ye,!0)},get xAxis(){return w(u)},set xAxis(ye){z(u,ye,!0)},get logScaleX(){return w(l)},set logScaleX(ye){z(l,ye,!0)},get logScaleY(){return w(c)},set logScaleY(ye){z(c,ye,!0)},get metricFilter(){return w(f)},set metricFilter(ye){z(f,ye,!0)},get realtimeEnabled(){return w(d)},set realtimeEnabled(ye){z(d,ye,!0)},get showHeaders(){return w(h)},set showHeaders(ye){z(h,ye,!0)},get filterText(){return w(p)},set filterText(ye){z(p,ye,!0)}})};Ae(Ce,ae=>{w(le)&&!w(m)&&ae(me)})}var W=H(Ce,2),j=I(W);hW(j,{get currentPage(){return w(n)},onNavigate:D});var te=H(j,2),U=I(te);{var P=ae=>{$Ae(ae,{get project(){return w(i)},get selectedRuns(){return w(o)},get allRuns(){return w(s)},get smoothing(){return w(a)},get xAxis(){return w(u)},get logScaleX(){return w(l)},get logScaleY(){return w(c)},get metricFilter(){return w(f)},get showHeaders(){return w(h)},get appBootstrapReady(){return w(A)},get plotOrder(){return w(S)}})},we=ae=>{OAe(ae,{get project(){return w(i)},get selectedRuns(){return w(o)},get smoothing(){return w(a)},get appBootstrapReady(){return w(A)}})},he=ae=>{sSe(ae,{get project(){return w(i)},get selectedRuns(){return w(o)},get tableTruncateLength(){return w(k)}})},Le=ae=>{vSe(ae,{get project(){return w(i)},get selectedRuns(){return w(o)}})},Re=ae=>{ASe(ae,{get project(){return w(i)},get runs(){return w(s)},onRunsChanged:C,get runMutationAllowed(){return w(x).allowed}})},qe=ae=>{$Se(ae,{get project(){return w(i)}})},ft=ae=>{BSe(ae,{get project(){return w(i)}})};Ae(U,ae=>{w(n)==="metrics"?ae(P):w(n)==="system"?ae(we,1):w(n)==="media"?ae(he,2):w(n)==="reports"?ae(Le,3):w(n)==="runs"?ae(Re,4):w(n)==="run-detail"?ae(qe,5):w(n)==="files"&&ae(ft,6)})}var Ee=H(W,2);JW(Ee,{get alerts(){return w(y)}}),V(e,se),Yt()}Xq(jSe,{target:document.getElementById("app")});