var Lq=Object.defineProperty;var xF=e=>{throw TypeError(e)};var Iq=(e,t,n)=>t in e?Lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Os=(e,t,n)=>Iq(e,typeof t!="symbol"?t+"":t,n),x2=(e,t,n)=>t.has(e)||xF("Cannot "+n);var ee=(e,t,n)=>(x2(e,t,"read from private field"),n?n.call(e):t.get(e)),Ct=(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),vt=(e,t,n,r)=>(x2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Bn=(e,t,n)=>(x2(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 Pq="5";var Q8;typeof window<"u"&&((Q8=window.__svelte??(window.__svelte={})).v??(Q8.v=new Set)).add(Pq);const Bq=1,zq=2,rT=4,jq=8,Uq=16,qq=1,Wq=2,Hq=4,Gq=8,Yq=16,Vq=1,Xq=2,dr=Symbol(),iT="http://www.w3.org/1999/xhtml",Kq="http://www.w3.org/2000/svg",Zq="http://www.w3.org/1998/Math/MathML",Jq=!1;var vA=Array.isArray,Qq=Array.prototype.indexOf,ad=Array.prototype.includes,Qv=Array.from,eW=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,sT=Object.getOwnPropertyDescriptors,tW=Object.prototype,nW=Array.prototype,yA=Object.getPrototypeOf,_F=Object.isExtensible;const oT=()=>{};function rW(e){return e()}function k_(e){for(var t=0;t{e=r,t=i});return{promise:n,resolve:e,reject:t}}function uT(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 ar=2,ud=4,Dg=8,lT=1<<24,ol=16,to=32,yc=64,S_=128,ys=512,Qn=1024,Ar=2048,no=4096,Xi=8192,bs=16384,Vc=32768,C_=1<<25,bc=65536,wF=1<<17,iW=1<<18,Yd=1<<19,cT=1<<20,Io=1<<25,xc=65536,$_=1<<21,bA=1<<22,Tu=1<<23,Ia=Symbol("$state"),sW=Symbol("legacy props"),oW=Symbol(""),Ea=new class extends Error{constructor(){super(...arguments);Os(this,"name","StaleReactionError");Os(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var eT;const aW=!!((eT=globalThis.document)!=null&&eT.contentType)&&globalThis.document.contentType.includes("xml");function uW(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function lW(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function cW(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function fW(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function dW(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function hW(e){throw new Error("https://svelte.dev/e/effect_orphan")}function pW(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function gW(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function mW(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function vW(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function yW(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function bW(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function xW(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function _W(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function fT(e){return e===this.v}function dT(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function hT(e){return!dT(e,this.v)}let Vd=!1,wW=!1;function EW(){Vd=!0}let Mn=null;function ld(e){Mn=e}function xn(e,t=!1,n){Mn={p:Mn,i:!1,c:null,e:null,s:e,x:null,r:$t,l:Vd&&!t?{s:null,u:null,$:[]}:null}}function _n(e){var t=Mn,n=t.e;if(n!==null){t.e=null;for(var r of n)NT(r)}return t.i=!0,Mn=t.p,{}}function Mg(){return!Vd||Mn!==null&&Mn.l===null}let Vl=[];function pT(){var e=Vl;Vl=[],k_(e)}function Ru(e){if(Vl.length===0&&!kp){var t=Vl;queueMicrotask(()=>{t===Vl&&pT()})}Vl.push(e)}function AW(){for(;Vl.length>0;)pT()}function gT(e){var t=$t;if(t===null)return _t.f|=Tu,e;if((t.f&Vc)===0&&(t.f&ud)===0)throw e;wu(e,t)}function wu(e,t){for(;t!==null;){if((t.f&S_)!==0){if((t.f&Vc)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const kW=-7169;function Nn(e,t){e.f=e.f&kW|t}function xA(e){(e.f&ys)!==0||e.deps===null?Nn(e,Qn):Nn(e,no)}function mT(e){if(e!==null)for(const t of e)(t.f&ar)===0||(t.f&xc)===0||(t.f^=xc,mT(t.deps))}function vT(e,t,n){(e.f&Ar)!==0?t.add(e):(e.f&no)!==0&&n.add(e),mT(e.deps),Nn(e,Qn)}let R0=!1;function SW(e){var t=R0;try{return R0=!1,[e(),R0]}finally{R0=t}}const Eh=new Set;let ct=null,pr=null,F_=null,kp=!1,_2=!1,Tf=null,Dm=null;var EF=0;let CW=1;var Jf,Qf,ed,td,Cg,ls,nd,xu,Fo,rd,Wr,D_,M_,T_,R_,yT;const Kv=class Kv{constructor(){Ct(this,Wr);Os(this,"id",CW++);Os(this,"current",new Map);Os(this,"previous",new Map);Ct(this,Jf,new Set);Ct(this,Qf,new Set);Ct(this,ed,0);Ct(this,td,0);Ct(this,Cg,null);Ct(this,ls,[]);Ct(this,nd,new Set);Ct(this,xu,new Set);Ct(this,Fo,new Map);Os(this,"is_fork",!1);Ct(this,rd,!1)}skip_effect(t){ee(this,Fo).has(t)||ee(this,Fo).set(t,{d:[],m:[]})}unskip_effect(t){var n=ee(this,Fo).get(t);if(n){ee(this,Fo).delete(t);for(var r of n.d)Nn(r,Ar),this.schedule(r);for(r of n.m)Nn(r,no),this.schedule(r)}}capture(t,n){n!==dr&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Tu)===0&&(this.current.set(t,t.v),pr==null||pr.set(t,t.v))}activate(){ct=this}deactivate(){ct=null,pr=null}flush(){try{if(_2=!0,ct=this,!Bn(this,Wr,D_).call(this)){for(const t of ee(this,nd))ee(this,xu).delete(t),Nn(t,Ar),this.schedule(t);for(const t of ee(this,xu))Nn(t,no),this.schedule(t)}Bn(this,Wr,M_).call(this)}finally{EF=0,F_=null,Tf=null,Dm=null,_2=!1,ct=null,pr=null,Nu.clear()}}discard(){for(const t of ee(this,Qf))t(this);ee(this,Qf).clear()}increment(t){vt(this,ed,ee(this,ed)+1),t&&vt(this,td,ee(this,td)+1)}decrement(t,n){vt(this,ed,ee(this,ed)-1),t&&vt(this,td,ee(this,td)-1),!(ee(this,rd)||n)&&(vt(this,rd,!0),Ru(()=>{vt(this,rd,!1),this.flush()}))}oncommit(t){ee(this,Jf).add(t)}ondiscard(t){ee(this,Qf).add(t)}settled(){return(ee(this,Cg)??vt(this,Cg,aT())).promise}static ensure(){if(ct===null){const t=ct=new Kv;_2||(Eh.add(ct),kp||Ru(()=>{ct===t&&t.flush()}))}return ct}apply(){}schedule(t){var i;if(F_=t,(i=t.b)!=null&&i.is_pending&&(t.f&(ud|Dg|lT))!==0&&(t.f&Vc)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(Tf!==null&&n===$t&&(_t===null||(_t.f&ar)===0))return;if((r&(yc|to))!==0){if((r&Qn)===0)return;n.f^=Qn}}ee(this,ls).push(n)}};Jf=new WeakMap,Qf=new WeakMap,ed=new WeakMap,td=new WeakMap,Cg=new WeakMap,ls=new WeakMap,nd=new WeakMap,xu=new WeakMap,Fo=new WeakMap,rd=new WeakMap,Wr=new WeakSet,D_=function(){return this.is_fork||ee(this,td)>0},M_=function(){var a,u;EF++>1e3&&FW();const t=ee(this,ls);vt(this,ls,[]),this.apply();var n=Tf=[],r=[],i=Dm=[];for(const l of t)Bn(this,Wr,T_).call(this,l,n,r);if(ct=null,i.length>0){var s=Kv.ensure();for(const l of i)s.schedule(l)}if(Tf=null,Dm=null,Bn(this,Wr,D_).call(this)){Bn(this,Wr,R_).call(this,r),Bn(this,Wr,R_).call(this,n);for(const[l,c]of ee(this,Fo))_T(l,c)}else{ee(this,nd).clear(),ee(this,xu).clear();for(const l of ee(this,Jf))l(this);ee(this,Jf).clear(),AF(r),AF(n),ee(this,ed)===0&&Bn(this,Wr,yT).call(this),(a=ee(this,Cg))==null||a.resolve()}var o=ct;if(ee(this,ls).length>0){const l=o??(o=this);ee(l,ls).push(...ee(this,ls).filter(c=>!ee(l,ls).includes(c)))}o!==null&&(Eh.add(o),Bn(u=o,Wr,M_).call(u))},T_=function(t,n,r){t.f^=Qn;for(var i=t.first;i!==null;){var s=i.f,o=(s&(to|yc))!==0,a=o&&(s&Qn)!==0,u=a||(s&Xi)!==0||ee(this,Fo).has(i);if(!u&&i.fn!==null){o?i.f^=Qn:(s&ud)!==0?n.push(i):Og(i)&&((s&ol)!==0&&ee(this,xu).add(i),fd(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}}},R_=function(t){for(var n=0;n1){this.previous.clear();var t=ct,n=pr,r=!0;for(const s of Eh){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)bT(c,a,u,l);if(ee(s,ls).length>0){s.apply();for(const c of ee(s,ls))Bn(i=s,Wr,T_).call(i,c,[],[])}s.deactivate()}}ct=t,pr=n}ee(this,Fo).clear(),Eh.delete(this)};let _c=Kv;function $W(e){var t=kp;kp=!0;try{for(var n;;){if(AW(),ct===null)return n;ct.flush()}}finally{kp=t}}function FW(){try{pW()}catch(e){wu(e,F_)}}let Bs=null;function AF(e){var t=e.length;if(t!==0){for(var n=0;n0)){Nu.clear();for(const i of Bs){if((i.f&(bs|Xi))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Bs.has(o)&&(Bs.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const u=s[a];(u.f&(bs|Xi))===0&&fd(u)}}Bs.clear()}}Bs=null}}function bT(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&ar)!==0?bT(i,t,n,r):(s&(bA|ol))!==0&&(s&Ar)===0&&xT(i,t,r)&&(Nn(i,Ar),_A(i))}}function xT(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(ad.call(t,i))return!0;if((i.f&ar)!==0&&xT(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function _A(e){ct.schedule(e)}function _T(e,t){if(!((e.f&to)!==0&&(e.f&Qn)!==0)){(e.f&Ar)!==0?t.d.push(e):(e.f&no)!==0&&t.m.push(e),Nn(e,Qn);for(var n=e.first;n!==null;)_T(n,t),n=n.next}}function DW(e){let t=0,n=wc(0),r;return()=>{kA()&&(y(n),Ng(()=>(t===0&&(r=al(()=>e(()=>Sp(n)))),t+=1,()=>{Ru(()=>{t-=1,t===0&&(r==null||r(),r=void 0,Sp(n))})})))}}var MW=bc|Yd;function TW(e,t,n,r){new RW(e,t,n,r)}var cs,mA,Do,tc,pi,Mo,Bi,zs,Ca,nc,_u,id,sd,od,$a,Zv,Yn,NW,OW,LW,N_,Mm,Tm,O_;class RW{constructor(t,n,r,i){Ct(this,Yn);Os(this,"parent");Os(this,"is_pending",!1);Os(this,"transform_error");Ct(this,cs);Ct(this,mA,null);Ct(this,Do);Ct(this,tc);Ct(this,pi);Ct(this,Mo,null);Ct(this,Bi,null);Ct(this,zs,null);Ct(this,Ca,null);Ct(this,nc,0);Ct(this,_u,0);Ct(this,id,!1);Ct(this,sd,new Set);Ct(this,od,new Set);Ct(this,$a,null);Ct(this,Zv,DW(()=>(vt(this,$a,wc(ee(this,nc))),()=>{vt(this,$a,null)})));var s;vt(this,cs,t),vt(this,Do,n),vt(this,tc,o=>{var a=$t;a.b=this,a.f|=S_,r(o)}),this.parent=$t.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),vt(this,pi,ty(()=>{Bn(this,Yn,N_).call(this)},MW))}defer_effect(t){vT(t,ee(this,sd),ee(this,od))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!ee(this,Do).pending}update_pending_count(t,n){Bn(this,Yn,O_).call(this,t,n),vt(this,nc,ee(this,nc)+t),!(!ee(this,$a)||ee(this,id))&&(vt(this,id,!0),Ru(()=>{vt(this,id,!1),ee(this,$a)&&cd(ee(this,$a),ee(this,nc))}))}get_effect_pending(){return ee(this,Zv).call(this),y(ee(this,$a))}error(t){var n=ee(this,Do).onerror;let r=ee(this,Do).failed;if(!n&&!r)throw t;ee(this,Mo)&&(Ei(ee(this,Mo)),vt(this,Mo,null)),ee(this,Bi)&&(Ei(ee(this,Bi)),vt(this,Bi,null)),ee(this,zs)&&(Ei(ee(this,zs)),vt(this,zs,null));var i=!1,s=!1;const o=()=>{if(i){_W();return}i=!0,s&&bW(),ee(this,zs)!==null&&ic(ee(this,zs),()=>{vt(this,zs,null)}),Bn(this,Yn,Tm).call(this,()=>{Bn(this,Yn,N_).call(this)})},a=u=>{try{s=!0,n==null||n(u,o),s=!1}catch(l){wu(l,ee(this,pi)&&ee(this,pi).parent)}r&&vt(this,zs,Bn(this,Yn,Tm).call(this,()=>{try{return fs(()=>{var l=$t;l.b=this,l.f|=S_,r(ee(this,cs),()=>u,()=>o)})}catch(l){return wu(l,ee(this,pi).parent),null}}))};Ru(()=>{var u;try{u=this.transform_error(t)}catch(l){wu(l,ee(this,pi)&&ee(this,pi).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(a,l=>wu(l,ee(this,pi)&&ee(this,pi).parent)):a(u)})}}cs=new WeakMap,mA=new WeakMap,Do=new WeakMap,tc=new WeakMap,pi=new WeakMap,Mo=new WeakMap,Bi=new WeakMap,zs=new WeakMap,Ca=new WeakMap,nc=new WeakMap,_u=new WeakMap,id=new WeakMap,sd=new WeakMap,od=new WeakMap,$a=new WeakMap,Zv=new WeakMap,Yn=new WeakSet,NW=function(){try{vt(this,Mo,fs(()=>ee(this,tc).call(this,ee(this,cs))))}catch(t){this.error(t)}},OW=function(t){const n=ee(this,Do).failed;n&&vt(this,zs,fs(()=>{n(ee(this,cs),()=>t,()=>()=>{})}))},LW=function(){const t=ee(this,Do).pending;if(t){this.is_pending=!0,vt(this,Bi,fs(()=>t(ee(this,cs))));var n=ct;Ru(()=>{var r=vt(this,Ca,document.createDocumentFragment()),i=Pa();r.append(i),vt(this,Mo,Bn(this,Yn,Tm).call(this,()=>fs(()=>ee(this,tc).call(this,i)))),ee(this,_u)===0&&(ee(this,cs).before(r),vt(this,Ca,null),ic(ee(this,Bi),()=>{vt(this,Bi,null)}),Bn(this,Yn,Mm).call(this,n))})}},N_=function(){var t=ct;try{if(this.is_pending=this.has_pending_snippet(),vt(this,_u,0),vt(this,nc,0),vt(this,Mo,fs(()=>{ee(this,tc).call(this,ee(this,cs))})),ee(this,_u)>0){var n=vt(this,Ca,document.createDocumentFragment());DA(ee(this,Mo),n);const r=ee(this,Do).pending;vt(this,Bi,fs(()=>r(ee(this,cs))))}else Bn(this,Yn,Mm).call(this,t)}catch(r){this.error(r)}},Mm=function(t){this.is_pending=!1;for(const n of ee(this,sd))Nn(n,Ar),t.schedule(n);for(const n of ee(this,od))Nn(n,no),t.schedule(n);ee(this,sd).clear(),ee(this,od).clear()},Tm=function(t){var n=$t,r=_t,i=Mn;Yo(ee(this,pi)),Es(ee(this,pi)),ld(ee(this,pi).ctx);try{return _c.ensure(),t()}catch(s){return gT(s),null}finally{Yo(n),Es(r),ld(i)}},O_=function(t,n){var r;if(!this.has_pending_snippet()){this.parent&&Bn(r=this.parent,Yn,O_).call(r,t,n);return}vt(this,_u,ee(this,_u)+t),ee(this,_u)===0&&(Bn(this,Yn,Mm).call(this,n),ee(this,Bi)&&ic(ee(this,Bi),()=>{vt(this,Bi,null)}),ee(this,Ca)&&(ee(this,cs).before(ee(this,Ca)),vt(this,Ca,null)))};function IW(e,t,n,r){const i=Mg()?Tg:wA;var s=e.filter(d=>!d.settled);if(n.length===0&&s.length===0){r(t.map(i));return}var o=$t,a=PW(),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&bs)===0&&wu(h,o)}f1()}if(n.length===0){u.then(()=>l(t.map(i)));return}var c=wT();function f(){Promise.all(n.map(d=>BW(d))).then(d=>l([...t.map(i),...d])).catch(d=>wu(d,o)).finally(()=>c())}u?u.then(()=>{a(),f(),f1()}):f()}function PW(){var e=$t,t=_t,n=Mn,r=ct;return function(s=!0){Yo(e),Es(t),ld(n),s&&(e.f&bs)===0&&(r==null||r.activate(),r==null||r.apply())}}function f1(e=!0){Yo(null),Es(null),ld(null),e&&(ct==null||ct.deactivate())}function wT(){var e=$t.b,t=ct,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 Tg(e){var t=ar|Ar,n=_t!==null&&(_t.f&ar)!==0?_t:null;return $t!==null&&($t.f|=Yd),{ctx:Mn,deps:null,effects:null,equals:fT,f:t,fn:e,reactions:null,rv:0,v:dr,wv:0,parent:n??$t,ac:null}}function BW(e,t,n){let r=$t;r===null&&lW();var i=void 0,s=wc(dr),o=!_t,a=new Map;return JW(()=>{var h;var u=$t,l=aT();i=l.promise;try{Promise.resolve(e()).then(l.resolve,l.reject).finally(f1)}catch(p){l.reject(p),f1()}var c=ct;if(o){if((u.f&Vc)!==0)var f=wT();if(r.b.is_rendered())(h=a.get(c))==null||h.reject(Ea),a.delete(c);else{for(const p of a.values())p.reject(Ea);a.clear()}a.set(c,l)}const d=(p,g=void 0)=>{if(f){var m=g===Ea;f(m)}if(!(g===Ea||(u.f&bs)!==0)){if(c.activate(),g)s.f|=Tu,cd(s,g);else{(s.f&Tu)!==0&&(s.f^=Tu),cd(s,p);for(const[v,b]of a){if(a.delete(v),v===c)break;b.reject(Ea)}}c.deactivate()}};l.promise.then(d,p=>d(null,p||"unknown"))}),SA(()=>{for(const u of a.values())u.reject(Ea)}),new Promise(u=>{function l(c){function f(){c===i?u(s):l(i)}c.then(f,f)}l(i)})}function _e(e){const t=Tg(e);return zT(t),t}function wA(e){const t=Tg(e);return t.equals=hT,t}function zW(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!kT&&WW()}return t}function WW(){kT=!1;for(const e of L_)(e.f&Qn)!==0&&Nn(e,no),Og(e)&&fd(e);L_.clear()}function ST(e,t=1){var n=y(e),r=t===1?n++:n--;return R(e,n),r}function Sp(e){R(e,e.v+1)}function CT(e,t,n){var r=e.reactions;if(r!==null)for(var i=Mg(),s=r.length,o=0;o{if(sc===s)return a();var u=_t,l=sc;Es(null),$F(s);var c=a();return Es(u),$F(l),c};return r&&n.set("length",ae(e.length)),new Proxy(e,{defineProperty(a,u,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&mW();var c=n.get(u);return c===void 0?o(()=>{var f=ae(l.value);return n.set(u,f),f}):R(c,l.value,!0),!0},deleteProperty(a,u){var l=n.get(u);if(l===void 0){if(u in a){const c=o(()=>ae(dr));n.set(u,c),Sp(i)}}else R(l,dr),Sp(i);return!0},get(a,u,l){var h;if(u===Ia)return e;var c=n.get(u),f=u in a;if(c===void 0&&(!f||(h=zf(a,u))!=null&&h.writable)&&(c=o(()=>{var p=ft(f?a[u]:dr),g=ae(p);return g}),n.set(u,c)),c!==void 0){var d=y(c);return d===dr?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=y(c))}else if(l===void 0){var f=n.get(u),d=f==null?void 0:f.v;if(f!==void 0&&d!==dr)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return l},has(a,u){var d;if(u===Ia)return!0;var l=n.get(u),c=l!==void 0&&l.v!==dr||Reflect.has(a,u);if(l!==void 0||$t!==null&&(!c||(d=zf(a,u))!=null&&d.writable)){l===void 0&&(l=o(()=>{var h=c?ft(a[u]):dr,p=ae(h);return p}),n.set(u,l));var f=y(l);if(f===dr)return!1}return c},set(a,u,l,c){var x;var f=n.get(u),d=u in a;if(r&&u==="length")for(var h=l;hae(dr)),n.set(h+"",p))}if(f===void 0)(!d||(x=zf(a,u))!=null&&x.writable)&&(f=o(()=>ae(void 0)),R(f,ft(l)),n.set(u,f));else{d=f.v!==dr;var g=o(()=>ft(l));R(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"),b=Number(u);Number.isInteger(b)&&b>=v.v&&R(v,b+1)}Sp(i)}return!0},ownKeys(a){y(i);var u=Reflect.ownKeys(a).filter(f=>{var d=n.get(f);return d===void 0||d.v!==dr});for(var[l,c]of n)c.v!==dr&&!(l in a)&&u.push(l);return u},setPrototypeOf(){vW()}})}function kF(e){try{if(e!==null&&typeof e=="object"&&Ia in e)return e[Ia]}catch{}return e}function HW(e,t){return Object.is(kF(e),kF(t))}var Wp,$T,FT,DT;function GW(){if(Wp===void 0){Wp=window,$T=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;FT=zf(t,"firstChild").get,DT=zf(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 Pa(e=""){return document.createTextNode(e)}function Po(e){return FT.call(e)}function Rg(e){return DT.call(e)}function D(e,t){return Po(e)}function Tt(e,t=!1){{var n=Po(e);return n instanceof Comment&&n.data===""?Rg(n):n}}function P(e,t=1,n=!1){let r=e;for(;t--;)r=Rg(r);return r}function YW(e){e.textContent=""}function MT(){return!1}function TT(e,t,n){return document.createElementNS(t??iT,e,void 0)}let SF=!1;function VW(){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 ey(e){var t=_t,n=$t;Es(null),Yo(null);try{return e()}finally{Es(t),Yo(n)}}function AA(e,t,n,r=n){e.addEventListener(t,()=>ey(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),VW()}function RT(e){$t===null&&(_t===null&&hW(),dW()),ju&&fW()}function XW(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function ra(e,t){var n=$t;n!==null&&(n.f&Xi)!==0&&(e|=Xi);var r={ctx:Mn,deps:null,nodes:null,f:e|Ar|ys,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&ud)!==0)Tf!==null?Tf.push(r):_c.ensure().schedule(r);else if(t!==null){try{fd(r)}catch(o){throw Ei(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Yd)===0&&(i=i.first,(e&ol)!==0&&(e&bc)!==0&&i!==null&&(i.f|=bc))}if(i!==null&&(i.parent=n,n!==null&&XW(i,n),_t!==null&&(_t.f&ar)!==0&&(e&yc)===0)){var s=_t;(s.effects??(s.effects=[])).push(i)}return r}function kA(){return _t!==null&&!Vs}function SA(e){const t=ra(Dg,null);return Nn(t,Qn),t.teardown=e,t}function Kt(e){RT();var t=$t.f,n=!_t&&(t&to)!==0&&(t&Vc)===0;if(n){var r=Mn;(r.e??(r.e=[])).push(e)}else return NT(e)}function NT(e){return ra(ud|cT,e)}function KW(e){return RT(),ra(Dg|cT,e)}function ZW(e){_c.ensure();const t=ra(yc|Yd,e);return(n={})=>new Promise(r=>{n.outro?ic(t,()=>{Ei(t),r(void 0)}):(Ei(t),r(void 0))})}function CA(e){return ra(ud,e)}function JW(e){return ra(bA|Yd,e)}function Ng(e,t=0){return ra(Dg|t,e)}function ye(e,t=[],n=[],r=[]){IW(r,t,n,i=>{ra(Dg,()=>e(...i.map(y)))})}function ty(e,t=0){var n=ra(ol|t,e);return n}function fs(e){return ra(to|Yd,e)}function OT(e){var t=e.teardown;if(t!==null){const n=ju,r=_t;CF(!0),Es(null);try{t.call(null)}finally{CF(n),Es(r)}}}function $A(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&ey(()=>{i.abort(Ea)});var r=n.next;(n.f&yc)!==0?n.parent=null:Ei(n,t),n=r}}function QW(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&to)===0&&Ei(t),t=n}}function Ei(e,t=!0){var n=!1;(t||(e.f&iW)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(LT(e.nodes.start,e.nodes.end),n=!0),Nn(e,C_),$A(e,t&&!n),Hp(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();OT(e),e.f^=C_,e.f|=bs;var i=e.parent;i!==null&&i.first!==null&&IT(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function LT(e,t){for(;e!==null;){var n=e===t?null:Rg(e);e.remove(),e=n}}function IT(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 ic(e,t,n=!0){var r=[];PT(e,r,!0);var i=()=>{n&&Ei(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function PT(e,t,n){if((e.f&Xi)===0){e.f^=Xi;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&bc)!==0||(i.f&to)!==0&&(e.f&ol)!==0;PT(i,t,o?n:!1),i=s}}}function FA(e){BT(e,!0)}function BT(e,t){if((e.f&Xi)!==0){e.f^=Xi,(e.f&Qn)===0&&(Nn(e,Ar),_c.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&bc)!==0||(n.f&to)!==0;BT(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 DA(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Rg(n);t.append(n),n=i}}let Rm=!1,ju=!1;function CF(e){ju=e}let _t=null,Vs=!1;function Es(e){_t=e}let $t=null;function Yo(e){$t=e}let xs=null;function zT(e){_t!==null&&(xs===null?xs=[e]:xs.push(e))}let mi=null,Ii=0,us=null;function eH(e){us=e}let jT=1,Xl=0,sc=Xl;function $F(e){sc=e}function UT(){return++jT}function Og(e){var t=e.f;if((t&Ar)!==0)return!0;if(t&ar&&(e.f&=~xc),(t&no)!==0){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}(t&ys)!==0&&pr===null&&Nn(e,Qn)}return!1}function qT(e,t,n=!0){var r=e.reactions;if(r!==null&&!(xs!==null&&ad.call(xs,e)))for(var i=0;i{e.ac.abort(Ea)}),e.ac=null);try{e.f|=$_;var c=e.fn,f=c();e.f|=Vc;var d=e.deps,h=ct==null?void 0:ct.is_fork;if(mi!==null){var p;if(h||Hp(e,Ii),d!==null&&Ii>0)for(d.length=Ii+mi.length,p=0;pn==null?void 0:n.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ru(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function mr(e,t,n,r,i){var s={capture:r,passive:i},o=nH(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&SA(()=>{t.removeEventListener(e,o,s)})}function We(e,t,n){(t[Kl]??(t[Kl]={}))[e]=n}function ui(e){for(var t=0;t{throw b});throw d}}finally{e[Kl]=t,delete e.currentTarget,Es(c),Yo(f)}}}var tT;const w2=((tT=globalThis==null?void 0:globalThis.window)==null?void 0:tT.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function rH(e){return(w2==null?void 0:w2.createHTML(e))??e}function XT(e){var t=TT("template");return t.innerHTML=rH(e.replaceAll("","")),t.content}function Ec(e,t){var n=$t;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var n=(t&Vq)!==0,r=(t&Xq)!==0,i,s=!e.startsWith("");return()=>{i===void 0&&(i=XT(s?e:""+e),n||(i=Po(i)));var o=r||$T?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Po(o),u=o.lastChild;Ec(a,u)}else Ec(o,o);return o}}function iH(e,t,n="svg"){var r=!e.startsWith(""),i=`<${n}>${r?e:""+e}`,s;return()=>{if(!s){var o=XT(i),a=Po(o);s=Po(a)}var u=s.cloneNode(!0);return Ec(u,u),u}}function li(e,t){return iH(e,t,"svg")}function z_(e=""){{var t=Pa(e+"");return Ec(t,t),t}}function Qr(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Pa();return e.append(t,n),Ec(t,n),e}function z(e,t){e!==null&&e.before(t)}const sH=["touchstart","touchmove"];function oH(e){return sH.includes(e)}function we(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 aH(e,t){return uH(e,t)}const N0=new Map;function uH(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){GW();var u=void 0,l=ZW(()=>{var c=n??t.appendChild(Pa());TW(c,{pending:()=>{}},h=>{xn({});var p=Mn;s&&(p.c=s),i&&(r.$$events=i),u=e(h,r)||{},_n()},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=N0.get(v),g=p.get(h);--g==0?(v.removeEventListener(h,B_),p.delete(h),p.size===0&&N0.delete(v)):p.set(h,g)}P_.delete(d),c!==n&&((m=c.parentNode)==null||m.removeChild(c))}});return lH.set(u,l),u}let lH=new WeakMap;var js,To,zi,rc,$g,Fg,Jv;class KT{constructor(t,n=!0){Os(this,"anchor");Ct(this,js,new Map);Ct(this,To,new Map);Ct(this,zi,new Map);Ct(this,rc,new Set);Ct(this,$g,!0);Ct(this,Fg,t=>{if(ee(this,js).has(t)){var n=ee(this,js).get(t),r=ee(this,To).get(n);if(r)FA(r),ee(this,rc).delete(n);else{var i=ee(this,zi).get(n);i&&(ee(this,To).set(n,i.effect),ee(this,zi).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of ee(this,js)){if(ee(this,js).delete(s),s===t)break;const a=ee(this,zi).get(o);a&&(Ei(a.effect),ee(this,zi).delete(o))}for(const[s,o]of ee(this,To)){if(s===n||ee(this,rc).has(s))continue;const a=()=>{if(Array.from(ee(this,js).values()).includes(s)){var l=document.createDocumentFragment();DA(o,l),l.append(Pa()),ee(this,zi).set(s,{effect:o,fragment:l})}else Ei(o);ee(this,rc).delete(s),ee(this,To).delete(s)};ee(this,$g)||!r?(ee(this,rc).add(s),ic(o,a,!1)):a()}}});Ct(this,Jv,t=>{ee(this,js).delete(t);const n=Array.from(ee(this,js).values());for(const[r,i]of ee(this,zi))n.includes(r)||(Ei(i.effect),ee(this,zi).delete(r))});this.anchor=t,vt(this,$g,n)}ensure(t,n){var r=ct,i=MT();if(n&&!ee(this,To).has(t)&&!ee(this,zi).has(t))if(i){var s=document.createDocumentFragment(),o=Pa();s.append(o),ee(this,zi).set(t,{effect:fs(()=>n(o)),fragment:s})}else ee(this,To).set(t,fs(()=>n(this.anchor)));if(ee(this,js).set(r,t),i){for(const[a,u]of ee(this,To))a===t?r.unskip_effect(u):r.skip_effect(u);for(const[a,u]of ee(this,zi))a===t?r.unskip_effect(u.effect):r.skip_effect(u.effect);r.oncommit(ee(this,Fg)),r.ondiscard(ee(this,Jv))}else ee(this,Fg).call(this,r)}}js=new WeakMap,To=new WeakMap,zi=new WeakMap,rc=new WeakMap,$g=new WeakMap,Fg=new WeakMap,Jv=new WeakMap;function DF(e,t,...n){var r=new KT(e);ty(()=>{const i=t()??null;r.ensure(i,i&&(s=>i(s,...n)))},bc)}function Xd(e){Mn===null&&uW(),Vd&&Mn.l!==null?cH(Mn).m.push(e):Kt(()=>{const t=al(e);if(typeof t=="function")return t})}function cH(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function he(e,t,n=!1){var r=new KT(e),i=n?bc:0;function s(o,a){r.ensure(o,a)}ty(()=>{var o=!1;t((a,u=0)=>{o=!0,s(u,a)}),o||s(-1,null)},i)}function pt(e,t){return t}function fH(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;j_(e,Qv(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;YW(c),c.append(l),e.items.clear()}j_(e,t,!u)}else s={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(s)}function j_(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 x=n();return vA(x)?x:x==null?[]:Qv(x)}),d,h=new Map,p=!0;function g(x){(b.effect.f&bs)===0&&(b.pending.delete(x),b.fallback=c,dH(b,d,o,t,r),c!==null&&(d.length===0?(c.f&Io)===0?FA(c):(c.f^=Io,Kh(c,null,o)):ic(c,()=>{c=null})))}function m(x){b.pending.delete(x)}var v=ty(()=>{d=y(f);for(var x=d.length,_=new Set,w=ct,A=MT(),E=0;Es(o)):(c=fs(()=>s(MF??(MF=Pa()))),c.f|=Io)),x>_.size&&cW(),!p)if(h.set(w,_),A){for(const[M,N]of a)_.has(M)||w.skip_effect(N.e);w.oncommit(g),w.ondiscard(m)}else g(w);y(f)}),b={effect:v,items:a,pending:h,outrogroups:null,fallback:c};p=!1}function Ah(e){for(;e!==null&&(e.f&to)===0;)e=e.next;return e}function dH(e,t,n,r,i){var $,M,N,L,T,k,F,I,B;var s=(r&jq)!==0,o=t.length,a=e.items,u=Ah(e.effect.first),l,c=null,f,d=[],h=[],p,g,m,v;if(s)for(v=0;v0){var C=(r&rT)!==0&&o===0?n:null;if(s){for(v=0;v{var O,j;if(f!==void 0)for(m of f)(j=(O=m.nodes)==null?void 0:O.a)==null||j.apply()})}function hH(e,t,n,r,i,s,o,a){var u=(o&Bq)!==0?(o&Uq)===0?qW(n,!1,!1):wc(n):null,l=(o&zq)!==0?wc(i):null;return{v:u,i:l,e:fs(()=>(s(t,u??n,l??i,a),()=>{e.delete(r)}))}}function Kh(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,s=t&&(t.f&Io)===0?t.nodes.start:n;r!==null;){var o=Rg(r);if(s.before(r),r===i)return;r=o}}function lu(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function pH(e,t,n=!1,r=!1,i=!1,s=!1){var o=e,a="";if(n)var u=e;ye(()=>{var l=$t;if(a!==(a=t()??"")){if(n){l.nodes=null,u.innerHTML=a,a!==""&&Ec(Po(u),u.lastChild);return}if(l.nodes!==null&&(LT(l.nodes.start,l.nodes.end),l.nodes=null),a!==""){var c=r?Kq:i?Zq:void 0,f=TT(r?"svg":i?"math":"template",c);f.innerHTML=a;var d=r||i?f:f.content;if(Ec(Po(d),d.lastChild),r||i)for(;Po(d);)o.before(Po(d));else o.before(d)}}})}function TF(e,t,n){CA(()=>{var r=al(()=>t(e,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};Ng(()=>{var o=n();YT(o),i&&dT(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}const RF=[...` \r\f \v\uFEFF`];function gH(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||RF.includes(r[o-1]))&&(a===r.length||RF.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function NF(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 E2(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function mH(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(E2)),i&&u.push(...Object.keys(i).map(E2));var l=0,c=-1;const g=e.length;for(var f=0;f{ZT(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),SA(()=>{t.disconnect()})}function JT(e,t,n=t){var r=new WeakSet,i=!0;AA(e,"change",s=>{var o=s?"[selected]":":checked",a;if(e.multiple)a=[].map.call(e.querySelectorAll(o),Cp);else{var u=e.querySelector(o)??e.querySelector("option:not([disabled])");a=u&&Cp(u)}n(a),ct!==null&&r.add(ct)}),CA(()=>{var s=t();if(e===document.activeElement){var o=ct;if(r.has(o))return}if(ZT(e,s,i),i&&s===void 0){var a=e.querySelector(":checked");a!==null&&(s=Cp(a),n(s))}e.__value=s,i=!1}),vH(e)}function Cp(e){return"__value"in e?e.__value:e.value}const yH=Symbol("is custom element"),bH=Symbol("is html"),xH=aW?"progress":"PROGRESS";function OF(e,t){var n=MA(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==xH)||(e.value=t??"")}function Zh(e,t){var n=MA(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Et(e,t,n,r){var i=MA(e);i[t]!==(i[t]=n)&&(t==="loading"&&(e[oW]=n),n==null?e.removeAttribute(t):typeof n!="string"&&_H(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function MA(e){return e.__attributes??(e.__attributes={[yH]:e.nodeName.includes("-"),[bH]:e.namespaceURI===iT})}var LF=new Map;function _H(e){var t=e.getAttribute("is")||e.nodeName,n=LF.get(t);if(n)return n;LF.set(t,n=[]);for(var r,i=e,s=Element.prototype;s!==i;){r=sT(i);for(var o in r)r[o].set&&n.push(o);i=yA(i)}return n}function Lg(e,t,n=t){var r=new WeakSet;AA(e,"input",async i=>{var s=i?e.defaultValue:e.value;if(s=k2(e)?S2(s):s,n(s),ct!==null&&r.add(ct),await qi(),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))}}}),al(t)==null&&e.value&&(n(k2(e)?S2(e.value):e.value),ct!==null&&r.add(ct)),Ng(()=>{var i=t();if(e===document.activeElement){var s=ct;if(r.has(s))return}k2(e)&&i===S2(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function wH(e,t,n=t){AA(e,"change",r=>{var i=r?e.defaultChecked:e.checked;n(i)}),al(t)==null&&n(e.checked),Ng(()=>{var r=t();e.checked=!!r})}function k2(e){var t=e.type;return t==="number"||t==="range"}function S2(e){return e===""?null:+e}function IF(e,t){return e===t||(e==null?void 0:e[Ia])===t}function Hi(e={},t,n,r){var i=Mn.r,s=$t;return CA(()=>{var o,a;return Ng(()=>{o=a,a=[],al(()=>{e!==n(...a)&&(t(e,...a),o&&IF(n(...o),e)&&t(null,...o))})}),()=>{let u=s;for(;u!==i&&u.parent!==null&&u.parent.f&C_;)u=u.parent;const l=()=>{a&&IF(n(...a),e)&&t(null,...a)},c=u.teardown;u.teardown=()=>{l(),c==null||c()}}}),e}function EH(e=!1){const t=Mn,n=t.l.u;if(!n)return;let r=()=>YT(t.s);if(e){let i=0,s={};const o=Tg(()=>{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=()=>y(o)}n.b.length&&KW(()=>{PF(t,r),k_(n.b)}),Kt(()=>{const i=al(()=>n.m.map(rW));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&Kt(()=>{PF(t,r),k_(n.a)})}function PF(e,t){if(e.l.s)for(const n of e.l.s)y(n);t()}function re(e,t,n,r){var x;var i=!Vd||(n&Wq)!==0,s=(n&Gq)!==0,o=(n&Yq)!==0,a=r,u=!0,l=()=>(u&&(u=!1,a=o?al(r):r),a);let c;if(s){var f=Ia in e||sW in e;c=((x=zf(e,t))==null?void 0:x.set)??(f&&t in e?_=>e[t]=_:void 0)}var d,h=!1;s?[d,h]=SW(()=>e[t]):d=e[t],d===void 0&&r!==void 0&&(d=l(),c&&(i&&gW(),c(d)));var p;if(i?p=()=>{var _=e[t];return _===void 0?l():(u=!0,_)}:p=()=>{var _=e[t];return _!==void 0&&(a=void 0),_===void 0?a:_},i&&(n&Hq)===0)return p;if(c){var g=e.$$legacy;return(function(_,w){return arguments.length>0?((!i||!w||g||h)&&c(w?p():_),_):p()})}var m=!1,v=((n&qq)!==0?Tg:wA)(()=>(m=!1,p()));s&&y(v);var b=$t;return(function(_,w){if(arguments.length>0){const A=w?y(v):i&&s?ft(_):_;return R(v,A),m=!0,a!==void 0&&(a=A),_}return ju&&m||(b.f&bs)!==0?v.v:y(v)})}var AH=q(""),kH=q('');function SH(e,t){xn(t,!0);let n=re(t,"currentPage",3,"metrics");const r=[{id:"metrics",label:"Metrics"},{id:"system",label:"System Metrics"},{id:"traces",label:"Traces"},{id:"media",label:"Media & Tables"},{id:"reports",label:"Alerts & Reports"},{id:"runs",label:"Runs"},{id:"files",label:"Files"}];function i(c){var f;(f=t.onNavigate)==null||f.call(t,c)}var s=kH(),o=P(D(s),2),a=D(o);gt(a,17,()=>r,pt,(c,f)=>{var d=AH();let h;var p=D(d);ye(()=>{h=rn(d,1,"nav-link svelte-d8j1hi",null,h,{active:n()===y(f).id}),we(p,y(f).label)}),We("click",d,()=>i(y(f).id)),z(c,d)});var u=P(a,2);let l;ye(()=>l=rn(u,1,"nav-link settings-btn svelte-d8j1hi",null,l,{active:n()==="settings"})),We("click",u,()=>i("settings")),z(e,s),_n()}ui(["click"]);var CH=q(''),$H=q('
');function FH(e,t){xn(t,!0);let n=re(t,"choices",19,()=>[]),r=re(t,"selected",31,()=>ft([])),i=re(t,"colors",19,()=>[]),s=re(t,"ontoggle",3,null),o=re(t,"getKey",3,c=>c),a=re(t,"getLabel",3,c=>c);function u(c){var d;const f=o()(c);r().includes(f)?r(r().filter(h=>h!==f)):r([...r(),f]),(d=s())==null||d()}var l=$H();gt(l,21,n,pt,(c,f,d)=>{var h=CH(),p=D(h),g=P(p,2),m=P(g,2),v=D(m);ye((b,x,_)=>{Zh(p,b),Uu(g,`background: ${(i()[d]||"#999")??""}`),Et(m,"title",x),we(v,_)},[()=>r().includes(o()(y(f))),()=>a()(y(f)),()=>a()(y(f))]),We("change",p,()=>u(y(f))),z(c,h)}),z(e,l),_n()}ui(["change"]);var DH=q(' '),MH=q(' '),TH=q('
  • '),RH=q('
      '),NH=q('');function BF(e,t){xn(t,!0);let n=re(t,"label",3,"Dropdown"),r=re(t,"info",3,""),i=re(t,"value",15,null),s=re(t,"choices",19,()=>[]),o=re(t,"filterable",3,!0),a=re(t,"showLabel",3,!0),u,l=ae(!1),c=ae(""),f=ae(null),d=ae(ft([])),h=ae(0),p=ae(null),g=ae(null),m=ae(300),v=_e(()=>i()!==null?s().indexOf(i()):-1);Kt(()=>{y(l)||(i()!==null&&s().includes(i())?R(c,i(),!0):R(c,""))}),Kt(()=>{R(d,y(l)?b(y(c)):s().map((O,j)=>j),!0)});function b(O){if(!O)return s().map((Y,te)=>te);const j=O.toLowerCase();return s().map((Y,te)=>Y.toLowerCase().includes(j)?te:-1).filter(Y=>Y>=0)}function x(){var O;if(R(c,""),R(d,s().map((j,Y)=>Y),!0),R(l,!0),u){const j=(O=u.closest(".wrap"))==null?void 0:O.getBoundingClientRect();if(j){R(h,j.width,!0);const Y=window.innerHeight-j.bottom,te=j.top;Y>=200||Y>te?(R(p,`${j.bottom}px`),R(g,null),R(m,Y-16)):(R(g,`${window.innerHeight-j.top}px`),R(p,null),R(m,te-16))}}}function _(){s().includes(y(c))?i(y(c)):i()!==null?R(c,i(),!0):R(c,""),R(l,!1),R(f,null),R(d,s().map((O,j)=>j),!0)}function w(O){const j=parseInt(O);isNaN(j)||(i(s()[j]),R(c,s()[j],!0),R(l,!1),R(f,null),u==null||u.blur())}async function A(O){if(await qi(),R(d,b(y(c)),!0),y(d).length>0&&y(f)===null&&R(f,y(d)[0],!0),O.key==="ArrowDown")if(O.preventDefault(),y(f)===null)R(f,y(d)[0]??null,!0);else{const j=y(d).indexOf(y(f));j0&&R(f,y(d)[j-1],!0)}}else O.key==="Enter"?y(f)!==null&&w(y(f)):O.key==="Escape"&&(R(l,!1),u==null||u.blur())}var E=NH(),S=D(E);{var C=O=>{var j=DH(),Y=D(j);ye(()=>we(Y,n())),z(O,j)};he(S,O=>{a()&&O(C)})}var $=P(S,2);{var M=O=>{var j=MH(),Y=D(j);ye(()=>we(Y,r())),z(O,j)};he($,O=>{r()&&O(M)})}var N=P($,2);let L;var T=D(N),k=D(T),F=D(k);Hi(F,O=>u=O,()=>u);var I=P(N,2);{var B=O=>{var j=RH(),Y=D(j);let te;gt(Y,21,()=>y(d),pt,(ce,Ae)=>{var ge=TH();let Ie;var tt=D(ge);let nt;var ue=P(tt);ye(()=>{Ie=rn(ge,1,"item svelte-kgylqb",null,Ie,{selected:y(Ae)===y(v),active:y(Ae)===y(f)}),Et(ge,"data-index",y(Ae)),Et(ge,"aria-selected",y(Ae)===y(v)),nt=rn(tt,1,"check-mark svelte-kgylqb",null,nt,{hide:y(Ae)!==y(v)}),we(ue,` ${s()[y(Ae)]??""}`)}),z(ce,ge)}),ye(()=>te=Uu(Y,"",te,{top:y(p),bottom:y(g),"max-height":`${y(m)??""}px`,width:`${y(h)??""}px`})),We("mousedown",Y,ce=>{var ge;ce.preventDefault();const Ae=(ge=ce.target.closest("li"))==null?void 0:ge.dataset.index;Ae!==void 0&&w(Ae)}),z(O,j)};he(I,O=>{y(l)&&O(B)})}ye(()=>{L=rn(N,1,"wrap svelte-kgylqb",null,L,{focused:y(l)}),Et(F,"aria-label",n()),F.readOnly=!o(),Et(F,"placeholder",i()===null?"Select...":"")}),We("keydown",F,A),mr("blur",F,_),mr("focus",F,x),Lg(F,()=>y(c),O=>R(c,O)),z(e,E),_n()}ui(["keydown","mousedown"]);var OH=q(' '),LH=q('');function O0(e,t){xn(t,!0);let n=re(t,"label",3,""),r=re(t,"checked",15,!1),i=re(t,"showLabel",3,!0);function s(c){r(c.currentTarget.checked)}var o=LH(),a=D(o),u=P(a,2);{var l=c=>{var f=OH(),d=D(f);ye(()=>we(d,n())),z(c,f)};he(u,c=>{i()&&n()&&c(l)})}We("input",a,s),wH(a,r),z(e,o),_n()}ui(["input"]);var IH=q(' '),PH=q(' '),BH=q('
      ');function zH(e,t){xn(t,!0);let n=re(t,"label",3,"Slider"),r=re(t,"info",3,""),i=re(t,"value",15,0),s=re(t,"min",3,0),o=re(t,"max",3,100),a=re(t,"step",3,1),u=re(t,"showLabel",3,!0),l,c=_e(()=>i()>o()?100:i(){l&&l.style.setProperty("--range_progress",`${y(c)}%`)});var f=BH(),d=D(f),h=D(d);{var p=E=>{var S=IH(),C=D(S);ye(()=>we(C,n())),z(E,S)};he(h,E=>{u()&&E(p)})}var g=P(d,2);{var m=E=>{var S=PH(),C=D(S);ye(()=>we(C,r())),z(E,S)};he(g,E=>{r()&&E(m)})}var v=P(g,2),b=D(v),x=D(b),_=P(b,2);Hi(_,E=>l=E,()=>l);var w=P(_,2),A=D(w);ye(()=>{we(x,s()),Et(_,"min",s()),Et(_,"max",o()),Et(_,"step",a()),we(A,o())}),Lg(_,i),z(e,f),_n()}var jH=q(' '),UH=q(' '),qH=q('
      ');function C2(e,t){xn(t,!0);let n=re(t,"label",3,""),r=re(t,"info",3,""),i=re(t,"value",15,""),s=re(t,"placeholder",3,""),o=re(t,"showLabel",3,!0);var a=qH(),u=D(a);{var l=p=>{var g=jH(),m=D(g);ye(()=>we(m,n())),z(p,g)};he(u,p=>{o()&&n()&&p(l)})}var c=P(u,2);{var f=p=>{var g=UH(),m=D(g);ye(()=>we(m,r())),z(p,g)};he(c,p=>{r()&&p(f)})}var d=P(c,2),h=D(d);ye(()=>Et(h,"placeholder",s())),Lg(h,i),z(e,a),_n()}const WH=["#A8769B","#E89957","#3B82F6","#10B981","#EF4444","#8B5CF6","#14B8A6","#F59E0B","#EC4899","#06B6D4"];let U_=WH;function HH(e){Array.isArray(e)&&e.length>0&&(U_=e)}function QT(e){return U_[e%U_.length]}function Ig(e){const t={};return e.forEach((n,r)=>{const i=typeof n=="string"?n:(n==null?void 0:n.id)??(n==null?void 0:n.name)??String(r);t[i]=QT(r)}),t}function zF(e){return!e||e.length===0?[]:[e[0]]}function GH(e,t,n){const r=e??[],i=t??[],s=n??[],o=new Set(i),a=r.filter(l=>o.has(l));if(r.length===0||a.length===0)return[...i];if(s.length>0&&r.length===s.length){const l=new Set(a),c=i.filter(f=>!l.has(f));return[...a,...c]}return a}const eR=["project","run","timestamp","step","time","metrics"];function YH(e,t,n,r,i,s){if(!e||e.length===0)return null;let o=e.map(d=>({...d}));Object.hasOwn(o[0],"step")||o.forEach((d,h)=>d.step=h);let a="step";if(r==="time"&&Object.hasOwn(o[0],"timestamp")){const d=new Date(o[0].timestamp).getTime();o.forEach(h=>{h.time=(new Date(h.timestamp).getTime()-d)/1e3}),a="time"}else r!=="step"&&(a=r);i&&o.forEach(d=>{if(d[a]!=null){const h=d[a];d[a]=h<=0?Math.log10(Math.max(h,0)+1):Math.log10(h)}});const l=tR(o).filter(d=>!eR.includes(d)&&d!==a);s&&o.forEach(d=>{l.forEach(h=>{if(d[h]!=null&&typeof d[h]=="number"){const p=d[h];d[h]=p<=0?Math.log10(Math.max(p,0)+1):Math.log10(p)}})});const c=typeof t=="string"?t:(t==null?void 0:t.id)??(t==null?void 0:t.name),f=typeof t=="string"?t:(t==null?void 0:t.name)??(t==null?void 0:t.id);if(n>0){const d=o.map(p=>({...p,run:f,run_id:c,series_key:c,data_type:"original"})),h=VH(o,l,n).map(p=>({...p,run:f,run_id:c,series_key:c,data_type:"smoothed"}));return{rows:[...d,...h],xColumn:a}}return{rows:o.map(d=>({...d,run:f,run_id:c,series_key:c,data_type:"original"})),xColumn:a}}function VH(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 tR(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 XH(e){return tR(e).filter(t=>!eR.includes(t))}function d1(e,t,n,r){let i=e.filter(a=>a[n]!=null&&a[n]!==void 0);if(r){const a=new Map;for(const l of i){const c=`${l.series_key||l.run||""}\0${l.data_type||"original"}`;a.has(c)||a.set(c,[]),a.get(c).push(l)}const u=[];for(const[,l]of a){l.sort((d,h)=>d[t]-h[t]);let c=0,f=l.length-1;for(;c=0&&l[f][t]>r[1];)f--;c=Math.max(0,c-1),f=Math.min(l.length-1,f+1),u.push(...l.slice(c,f+1))}i=u}const s=i.filter(a=>a.data_type==="original"||!a.data_type);let o;if(s.length>0){let a=1/0,u=-1/0;for(const l of s){const c=l[n];c!=null&&(cu&&(u=c))}a!==1/0&&(o=[a,u])}return{data:nR(i,t,n,"series_key",r,["run","series_key"]).data,yExtent:o}}function jF(e,t,n,r,i,s=[]){const o=[t,n];r&&Object.hasOwn(e[0],r)&&o.push(r),o.push(...s);let a=e.map(p=>{const g={};return[...new Set(o)].forEach(m=>g[m]=p[m]),p.data_type&&(g.data_type=p.data_type),p.run&&(g.run=p.run),g});const u=Math.min(...a.map(p=>p[t]).filter(p=>p!=null)),l=Math.max(...a.map(p=>p[t]).filter(p=>p!=null));let c=i;if(i){const[p,g]=[i[0]??u,i[1]??l];c=[p,g]}const f={};r?a.forEach(p=>{const g=p[r]||"__default";f[g]||(f[g]=[]),f[g].push(p)}):f.__default=a;const d=[],h=100;return Object.values(f).forEach(p=>{if(p.sort((x,_)=>(x[t]||0)-(_[t]||0)),p.length<500){d.push(...p);return}const g=c?c[0]:u,m=c?c[1]:l;if(g===m){d.push(...p);return}const v=(m-g)/h,b=new Map;p.forEach(x=>{const _=x[t];if(_==null)return;const w=Math.min(Math.floor((_-g)/v),h-1);b.has(w)||b.set(w,[]),b.get(w).push(x)}),b.forEach(x=>{if(x.length===0)return;let _=x[0],w=x[0];x.forEach(A=>{A[n]<_[n]&&(_=A),A[n]>w[n]&&(w=A)}),d.push(_),_!==w&&d.push(w)})}),d.sort((p,g)=>(p[t]||0)-(g[t]||0)),{data:d,xLim:c}}function nR(e,t,n,r,i,s=[]){if(!e||e.length===0)return{data:e,xLim:i};if(e.some(a=>a.data_type)&&r&&e[0]&&Object.hasOwn(e[0],r)){const a=new Map;for(const c of e){const f=`${c[r]??"__default"}\0${c.data_type??"original"}`;a.has(f)||a.set(f,[]),a.get(f).push(c)}const u=[];let l=i;for(const c of a.values()){const f=jF(c,t,n,r,i,s);u.push(...f.data),l=f.xLim}return u.sort((c,f)=>(c[t]||0)-(f[t]||0)),{data:u,xLim:l}}return jF(e,t,n,r,i,s)}function rR(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 iR(e,t,n){if(!t||!e||e.length===0)return"";const r=new Set,i=[];for(const s of e){const o=s[t];o&&!r.has(o)&&(r.add(o),i.push(`${o}:${n[o]??"#999"}`))}return i.sort(),i.join("|")}function UF(e){if(!e)return null;const t=typeof e.step=="number"?e.step:null,n=e.timestamp??null;return{step:t,ts:n}}function sR(e,t){if(!e||!t)return!!t;if(t.length!==e.length)return!0;if(t.length===0)return!1;const n=UF(e[e.length-1]),r=UF(t[t.length-1]);return!n||!r?!0:n.step!==r.step||n.ts!==r.ts}function TA(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 KH=li(''),ZH=li(''),JH=q('
      ',1),QH=q('
      '),eG=li(''),tG=q(''),nG=q(''),rG=q(''),iG=li(''),sG=q(''),oG=q(''),aG=q(''),uG=q('
      '),lG=q(''),cG=q('
      '),fG=q('
      ',1),dG=q('
      ',1),hG=q(''),pG=q('

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

      '),gG=q('

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

      ',1),mG=q(''),vG=q(''),yG=q(''),bG=q('
      ');function xG(e,t){xn(t,!0);let n=re(t,"open",15,!0),r=re(t,"variant",3,"full"),i=re(t,"currentPage",3,"metrics"),s=re(t,"projects",19,()=>[]),o=re(t,"selectedProject",15,null),a=re(t,"runs",19,()=>[]),u=re(t,"selectedRuns",31,()=>ft([])),l=re(t,"availableSystemDevices",19,()=>[]),c=re(t,"selectedSystemDevices",31,()=>ft([])),f=re(t,"smoothing",15,10),d=re(t,"xAxis",15,"step"),h=re(t,"logScaleX",15,!1),p=re(t,"logScaleY",15,!1),g=re(t,"metricFilter",15,""),m=re(t,"realtimeEnabled",15,!0),v=re(t,"showHeaders",15,!0),b=re(t,"filterText",15,""),x=re(t,"metricColumns",19,()=>[]),_=re(t,"spacesMode",3,!1),w=re(t,"runMutationAllowed",3,!0),A=re(t,"mutationAuth",3,"local"),E=re(t,"readOnlySource",3,null),S=re(t,"projectLocked",3,!1),C=re(t,"spaceId",3,null),$=re(t,"logoUrls",19,()=>({light:"/static/trackio/trackio_logo_type_light_transparent.png",dark:"/static/trackio/trackio_logo_type_dark_transparent.png"})),M=re(t,"darkMode",3,!1),N=ae(0),L=null;Xd(()=>{const U=()=>{ST(N)};return window.addEventListener("popstate",U),()=>{window.removeEventListener("popstate",U),L&&(clearTimeout(L),L=null)}});let T=_e(()=>(y(N),`${window.location.origin}/oauth/hf/start`)),k=_e(()=>["step","time",...x()]);function F(){n(!n())}function I(U,V){return U.indeterminate=V,{update(K){U.indeterminate=K}}}let B=_e(()=>{if(!b()||!b().trim())return a();const U=new Set(TA(a().map(V=>V.name),b()));return a().filter(V=>U.has(V.name))}),O=_e(()=>Ig(a())),j=_e(()=>y(B).map(U=>U.id??U.name)),Y=ae(!1),te=ae("share"),ce=ae(null);function Ae(){R(Y,!y(Y)),y(Y)&&y(B).length>0?u(zF(y(j))):y(Y)||u([...y(j)])}Kt(()=>{if(!y(Y)||y(j).length===0)return;const U=zF(y(j));(u().length!==U.length||u()[0]!==U[0])&&u(U)});function ge(U){c().includes(U)?c(c().filter(V=>V!==U)):c([...c(),U])}function Ie(U){if(!U||!U.includes("/"))return"";const[V,K]=U.split("/",2);return!V||!K?"":`${V}-${K}.hf.space`}function tt(){const U=Ie(C());if(U)return`https://${U}`;const V=window.__trackio_base||"/",K=new URL(V,window.location.origin);let de=K.href;return de.endsWith("/")&&(de=de.slice(0,-1)),de||K.origin}function nt(U,V){const K=new Set(V.map(de=>de.id??de.name));return U.filter(de=>K.has(de))}let ue=_e(()=>{var $e;if(y(N),i()!=="metrics"||!_()||!o())return"";const U=new URLSearchParams;U.set("project",o()),($e=g())!=null&&$e.trim()&&U.set("metric_filter",g().trim());const V=nt(u(),a());V.length&&U.set("run_ids",V.join(",")),f()!=null&&f()!==10&&U.set("smoothing",f().toString()),v()||U.set("accordion","hidden"),U.set("sidebar","hidden"),U.set("navbar","hidden");const K=tt(),de=U.toString();return de?`${K}/?${de}`:`${K}/`}),Ne=_e(()=>y(ue)?``:"");async function Q(U,V){if(U){try{await navigator.clipboard.writeText(U)}catch{const K=document.createElement("textarea");K.value=U,K.style.position="fixed",K.style.opacity="0",document.body.appendChild(K),K.focus(),K.select(),document.execCommand("copy"),document.body.removeChild(K)}R(ce,V,!0),L&&clearTimeout(L),L=setTimeout(()=>{R(ce,null),L=null},2e3)}}var W=bG();let xe;var ke=D(W),Te=D(ke);{var G=U=>{var V=KH();z(U,V)},H=U=>{var V=ZH();z(U,V)};he(Te,U=>{n()?U(G):U(H,-1)})}var fe=P(ke,2);{var Pe=U=>{var V=yG(),K=D(V),de=D(K),$e=D(de),Je=P(de,2),Qe=D(Je);{var Oe=Z=>{var X=JH(),Be=P(Tt(X),2),rt=D(Be);ye(()=>we(rt,o()??"—")),z(Z,X)},et=Z=>{BF(Z,{label:"Project",get choices(){return s()},filterable:!0,get value(){return o()},set value(X){o(X)}})};he(Qe,Z=>{S()?Z(Oe):Z(et,-1)})}var Xe=P(Je,2);{var st=Z=>{var X=QH(),Be=D(X);C2(Be,{label:"Run Filter",info:"Filter runs using regex patterns. Leave empty to show all runs.",placeholder:"e.g., baseline|exp-.*|v2",get value(){return b()},set value(rt){b(rt)}}),z(Z,X)};he(Xe,Z=>{r()==="compact"&&i()==="runs"&&Z(st)})}var mt=P(Xe,2);{var Dt=Z=>{var X=dG(),Be=Tt(X);{var rt=St=>{var He=uG(),gn=D(He),mn=D(gn);let Cr;var Ni=P(mn,2);let is;var It=P(gn,2);{var Mt=En=>{var Kn=rG(),Oi=P(D(Kn),2);{var Vt=jn=>{var Zn=tG(),ss=D(Zn),Ns=P(ss,2),Sl=D(Ns);{var y2=Li=>{var Cl=eG();z(Li,Cl)},b2=Li=>{var Cl=z_("Copy");z(Li,Cl)};he(Sl,Li=>{y(ce)==="share"?Li(y2):Li(b2,-1)})}ye(()=>{OF(ss,y(ue)),Et(Ns,"aria-label",y(ce)==="share"?"Copied":"Copy share link")}),We("click",Ns,()=>Q(y(ue),"share")),z(jn,Zn)},Rs=jn=>{var Zn=nG();z(jn,Zn)};he(Oi,jn=>{y(ue)?jn(Vt):jn(Rs,-1)})}z(En,Kn)},Hr=En=>{var Kn=aG(),Oi=P(D(Kn),2);{var Vt=jn=>{var Zn=sG(),ss=D(Zn),Ns=P(ss,2),Sl=D(Ns);{var y2=Li=>{var Cl=iG();z(Li,Cl)},b2=Li=>{var Cl=z_("Copy");z(Li,Cl)};he(Sl,Li=>{y(ce)==="embed"?Li(y2):Li(b2,-1)})}ye(()=>{OF(ss,y(Ne)),Et(Ns,"aria-label",y(ce)==="embed"?"Copied":"Copy embed code")}),We("click",Ns,()=>Q(y(Ne),"embed")),z(jn,Zn)},Rs=jn=>{var Zn=oG();z(jn,Zn)};he(Oi,jn=>{y(Ne)?jn(Vt):jn(Rs,-1)})}z(En,Kn)};he(It,En=>{y(te)==="share"?En(Mt):En(Hr,-1)})}ye(()=>{Cr=rn(mn,1,"share-tab-btn svelte-181dlmc",null,Cr,{active:y(te)==="share"}),is=rn(Ni,1,"share-tab-btn svelte-181dlmc",null,is,{active:y(te)==="embed"})}),We("click",mn,()=>{R(te,"share")}),We("click",Ni,()=>{R(te,"embed")}),z(St,He)};he(Be,St=>{i()==="metrics"&&_()&&St(rt)})}var kt=P(Be,2),ut=D(kt),bt=D(ut),Pt=D(bt);TF(Pt,(St,He)=>I==null?void 0:I(St,He),()=>u().length>0&&u().lengthy(B).map(He=>y(O)[He.id??He.name]??QT(Math.max(0,a().indexOf(He)))));FH(Ot,{get choices(){return y(B)},getKey:He=>He.id??He.name,getLabel:He=>He.name,get colors(){return y(St)},ontoggle:()=>{R(Y,!1)},get selected(){return u()},set selected(He){u(He)}})}var xt=P(wn,2);{var Zt=St=>{var He=cG(),gn=D(He),mn=D(gn);TF(mn,(It,Mt)=>I==null?void 0:I(It,Mt),()=>c().length>0&&c().length{var Hr=lG(),En=D(Hr),Kn=P(En,2),Oi=D(Kn);ye(Vt=>{Zh(En,Vt),Et(Kn,"title",y(Mt)),we(Oi,y(Mt))},[()=>c().includes(y(Mt))]),We("change",En,()=>ge(y(Mt))),z(It,Hr)}),ye(()=>{Zh(mn,c().length===l().length&&l().length>0),we(Ni,`Devices (${l().length??""})`)}),We("change",mn,()=>{c().length===l().length?c([]):c([...l()])}),z(St,He)};he(xt,St=>{i()==="system"&&l().length>0&&St(Zt)})}var Bt=P(kt,2);{var Pn=St=>{var He=fG(),gn=P(Tt(He),2),mn=D(gn);O0(mn,{label:"Refresh metrics realtime",get checked(){return m()},set checked(Vt){m(Vt)}});var Cr=P(mn,2);O0(Cr,{label:"Show section headers",get checked(){return v()},set checked(Vt){v(Vt)}});var Ni=P(gn,2),is=D(Ni);zH(is,{label:"Smoothing Factor (0 = no smoothing)",min:0,max:20,step:1,get value(){return f()},set value(Vt){f(Vt)}});var It=P(Ni,2),Mt=D(It);BF(Mt,{label:"X-axis",get choices(){return y(k)},filterable:!1,get value(){return d()},set value(Vt){d(Vt)}});var Hr=P(Mt,2);O0(Hr,{label:"Log scale X-axis",get checked(){return h()},set checked(Vt){h(Vt)}});var En=P(Hr,2);O0(En,{label:"Log scale Y-axis",get checked(){return p()},set checked(Vt){p(Vt)}});var Kn=P(It,2),Oi=D(Kn);C2(Oi,{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 g()},set value(Vt){g(Vt)}}),z(St,He)};he(Bt,St=>{(i()==="metrics"||i()==="system")&&St(Pn)})}ye(()=>{Zh(Pt,u().length===y(j).length&&y(j).length>0),we(pn,`Runs (${y(j).length??""})`),Zh(ot,y(Y))}),We("change",Pt,()=>{u().length===y(j).length?u([]):u([...y(j)]),R(Y,!1)}),We("change",ot,Ae),z(Z,X)};he(mt,Z=>{r()==="full"&&Z(Dt)})}var le=P(K,2);{var Re=Z=>{var X=hG(),Be=P(D(X),2),rt=D(Be);ye(()=>{Et(Be,"href",E().url),we(rt,E().url)}),z(Z,X)},lt=Z=>{var X=mG(),Be=D(X);{var rt=ut=>{var bt=pG();z(ut,bt)},kt=ut=>{var bt=gG(),Pt=Tt(bt);ye(()=>Et(Pt,"href",y(T))),z(ut,bt)};he(Be,ut=>{A()==="oauth_insufficient"?ut(rt):ut(kt,-1)})}z(Z,X)},nn=Z=>{var X=vG(),Be=P(D(X),2);We("click",Be,()=>{sessionStorage.removeItem("trackio_oauth_session")}),z(Z,X)};he(le,Z=>{E()?Z(Re):_()&&!w()?Z(lt,1):_()&&w()&&A()==="oauth"&&Z(nn,2)})}ye(()=>Et($e,"src",M()?$().dark:$().light)),z(U,V)};he(fe,U=>{n()&&U(Pe)})}ye(()=>xe=rn(W,1,"sidebar svelte-181dlmc",null,xe,{collapsed:!n()})),We("click",ke,F),z(e,W),_n()}ui(["click","change"]);var _G=q('
      '),wG=q('
      '),EG=q('
      '),AG=q('
      '),kG=q('
      ');function SG(e,t){xn(t,!0);let n=re(t,"alerts",19,()=>[]);const r={info:"🔵",warn:"🟡",error:"🔴"};let i=ae(ft({})),s=ae(null),o=ae(!1),a=_e(()=>y(s)?n().filter(d=>d.level===y(s)):n());function u(d){R(i,{...y(i),[d]:!y(i)[d]},!0)}var l=Qr(),c=Tt(l);{var f=d=>{var h=kG();let p;var g=D(h),m=D(g),v=D(m),b=P(m,2);{var x=S=>{var C=_G(),$=D(C);let M;var N=P($,2);let L;var T=P(N,2);let k;var F=P(T,2);let I;ye(()=>{M=rn($,1,"pill svelte-x5aqew",null,M,{active:y(s)===null}),L=rn(N,1,"pill svelte-x5aqew",null,L,{active:y(s)==="info"}),k=rn(T,1,"pill svelte-x5aqew",null,k,{active:y(s)==="warn"}),I=rn(F,1,"pill svelte-x5aqew",null,I,{active:y(s)==="error"})}),We("click",$,B=>{B.stopPropagation(),R(s,null)}),We("click",N,B=>{B.stopPropagation(),R(s,"info")}),We("click",T,B=>{B.stopPropagation(),R(s,"warn")}),We("click",F,B=>{B.stopPropagation(),R(s,"error")}),z(S,C)};he(b,S=>{y(o)||S(x)})}var _=P(b,2);let w;var A=P(g,2);{var E=S=>{var C=AG();gt(C,21,()=>y(a),pt,($,M,N)=>{var L=EG();let T;var k=D(L),F=D(k),I=D(F),B=P(F,2),O=D(B),j=P(B,2),Y=D(j),te=P(k,2);{var ce=Ae=>{var ge=wG(),Ie=D(ge);ye(()=>we(Ie,y(M).text)),z(Ae,ge)};he(te,Ae=>{y(i)[N]&&y(M).text&&Ae(ce)})}ye(()=>{T=rn(L,1,"alert-item svelte-x5aqew",null,T,{expanded:y(i)[N]}),we(I,r[y(M).level]||""),we(O,y(M).title),we(Y,y(M).meta||"")}),We("click",k,()=>u(N)),z($,L)}),z(S,C)};he(A,S=>{y(o)||S(E)})}ye(()=>{p=rn(h,1,"alert-panel svelte-x5aqew",null,p,{collapsed:y(o)}),we(v,`Alerts (${n().length??""})`),w=rn(_,0,"collapse-icon svelte-x5aqew",null,w,{rotated:y(o)})}),We("click",g,()=>R(o,!y(o))),We("keydown",g,S=>S.key==="Enter"&&R(o,!y(o))),z(d,h)};he(c,d=>{n().length>0&&d(f)})}z(e,l),_n()}ui(["click","keydown"]);function qF(){const e=window.location.pathname.replace(/\/+$/,"")||"/";switch(e==="/"?"":e.replace(/^\//,"").split("/")[0]){case"":case"metrics":return"metrics";case"system":return"system";case"traces":return"traces";case"media":return"media";case"reports":return"reports";case"runs":return"runs";case"run":return"run-detail";case"files":return"files";case"settings":return"settings";default:return"metrics"}}function oR(e){const t=new URLSearchParams(window.location.search),r={metrics:"/",traces:"/traces",system:"/system",media:"/media",reports:"/reports",runs:"/runs","run-detail":"/run",files:"/files",settings:"/settings"}[e]||"/",i=t.toString(),s=i?`${r}?${i}`:r;window.history.pushState({},"",s),window.dispatchEvent(new PopStateEvent("popstate"))}function gi(e){return new URLSearchParams(window.location.search).get(e)}function WF(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 CG=/("(?:[^\\"]|\\.)*")|[:,]/g;function $2(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(CG,(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 Ti(e,t,n){return e.fields=t||[],e.fname=n,e}function Tn(e){return e==null?null:e.fname}function Lr(e){return e==null?null:e.fields}function aR(e){return e.length===1?$G(e[0]):FG(e)}const $G=e=>function(t){return t[e]},FG=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||ne("Access path missing open bracket: "+e),i>0&&l(),i=0,o=a+1)}return i&&ne("Access path missing closing bracket: "+e),r&&ne("Access path missing closing quote: "+e),a>o&&(a++,l()),t}function As(e,t,n){const r=ia(e);return e=r.length===1?r[0]:e,Ti((n&&n.get||aR)(r),[e],t||e)}const Pg=As("id"),Ur=Ti(e=>e,[],"identity"),bu=Ti(()=>0,[],"zero"),Kd=Ti(()=>1,[],"one"),Qi=Ti(()=>!0,[],"true"),fu=Ti(()=>!1,[],"false"),RA=new Set(Object.getOwnPropertyNames(Object.prototype));function DG(e,t,n){const r=[t].concat([].slice.call(n));console[e].apply(console,r)}const uR=0,NA=1,OA=2,lR=3,cR=4;function LA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:DG,r=e||uR;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=NA&&n(t||"error","ERROR",arguments),this},warn(){return r>=OA&&n(t||"warn","WARN",arguments),this},info(){return r>=lR&&n(t||"log","INFO",arguments),this},debug(){return r>=cR&&n(t||"log","DEBUG",arguments),this}}}var oe=Array.isArray;function Fe(e){return e===Object(e)}const HF=e=>e!=="__proto__";function Zd(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const s in i)if(s==="signals")r.signals=MG(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;Jd(r,s,i[s],o)}return r},{})}function Jd(e,t,n,r){if(!HF(t))return;let i,s;if(Fe(n)&&!oe(n)){s=Fe(e[t])?e[t]:e[t]={};for(i in n)r&&(r===!0||r[i])?Jd(s,i,n[i]):HF(i)&&(s[i]=n[i])}else e[t]=n}function MG(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 Nr(e){return e==null||e===""?null:+e}const fR=e=>t=>e*Math.exp(t),dR=e=>t=>Math.log(e*t),hR=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),pR=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,h1=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function ny(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 gR(e,t){return ny(e,t,Nr,Ur)}function mR(e,t){var n=Math.sign(e[0]);return ny(e,t,dR(n),fR(n))}function vR(e,t,n){return ny(e,t,h1(n),h1(1/n))}function yR(e,t,n){return ny(e,t,hR(n),pR(n))}function ry(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 IA(e,t,n){return ry(e,t,n,Nr,Ur)}function PA(e,t,n){const r=Math.sign(e[0]);return ry(e,t,n,dR(r),fR(r))}function p1(e,t,n,r){return ry(e,t,n,h1(r),h1(1/r))}function BA(e,t,n,r){return ry(e,t,n,hR(r),pR(r))}function bR(e){return 1+~~(new Date(e).getMonth()/3)}function xR(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Me(e){return e!=null?oe(e)?e:[e]:[]}function _R(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 ht(e){return typeof e=="function"}const TG="descending";function zA(e,t,n){n=n||{},t=Me(t)||[];const r=[],i=[],s={},o=n.comparator||RG;return Me(e).forEach((a,u)=>{a!=null&&(r.push(t[u]===TG?-1:1),i.push(a=ht(a)?a:As(a,null,n)),(Lr(a)||[]).forEach(l=>s[l]=1))}),i.length===0?null:Ti(o(i,r),Object.keys(s))}const Qd=(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),RG=(e,t)=>e.length===1?NG(e[0],t[0]):OG(e,t,e.length),NG=(e,t)=>function(n,r){return Qd(e(n),e(r))*t},OG=(e,t,n)=>(t.push(0),function(r,i){let s,o=0,a=-1;for(;o===0&&++ae}function jA(e,t){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}function dt(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 wR(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 ER(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")):Me(e));const r=e&&e.length,i=n&&n.get||aR,s=a=>i(t?[a]:ia(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=>Le(t,o)||Le(n,o),get:o=>Le(t,o)?t[o]:Le(n,o)?s(o,n[o]):void 0,set:(o,a)=>Le(t,o)?t[o]=a:s(o,a)}}function CR(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 $R(e,t,n,r){const i=n||" ",s=e+"",o=t-s.length;return o<=0?s:r==="left"?Jh(i,o)+s:r==="center"?Jh(i,~~(o/2))+s+Jh(i,Math.ceil(o/2)):s+Jh(i,o)}function Bg(e){return e&&Nt(e)-e[0]||0}function Ee(e){return oe(e)?"["+e.map(Ee)+"]":Fe(e)||De(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function WA(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const IG=e=>Ut(e)||Ou(e)?e:Date.parse(e);function HA(e,t){return t=t||IG,e==null||e===""?null:t(e)}function GA(e){return e==null||e===""?null:e+""}function ro(e){const t={},n=e.length;for(let r=0;r9999?"+"+hi(e,6):hi(e,4)}function zG(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":BG(e.getUTCFullYear())+"-"+hi(e.getUTCMonth()+1,2)+"-"+hi(e.getUTCDate(),2)+(i?"T"+hi(t,2)+":"+hi(n,2)+":"+hi(r,2)+"."+hi(i,3)+"Z":r?"T"+hi(t,2)+":"+hi(n,2)+":"+hi(r,2)+"Z":n||t?"T"+hi(t,2)+":"+hi(n,2)+"Z":"")}function jG(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?PG(m,d):DR(m)});return g.columns=p||[],g}function i(f,d){var h=[],p=f.length,g=0,m=0,v,b=p<=0,x=!1;f.charCodeAt(p-1)===kh&&--p,f.charCodeAt(p-1)===M2&&--p;function _(){if(b)return F2;if(x)return x=!1,GF;var A,E=g,S;if(f.charCodeAt(E)===D2){for(;g++=p?b=!0:(S=f.charCodeAt(g++))===kh?x=!0:S===M2&&(x=!0,f.charCodeAt(g)===kh&&++g),f.slice(E+1,A-1).replace(/""/g,'"')}for(;g1)r=XG(e,t,n);else for(i=0,r=new Array(s=e.arcs.length);it?1:e>=t?0:NaN}function KG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function th(e){let t,n,r;e.length!==2?(t=Ba,n=(a,u)=>Ba(e(a),u),r=(a,u)=>e(a)-u):(t=e===Ba||e===KG?e:ZG,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 ZG(){return 0}function TR(e){return e===null?NaN:+e}function*JG(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 RR=th(Ba),qu=RR.right,QG=RR.left;th(TR).center;function eY(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 tY(e,t){const n=eY(e,t);return n&&Math.sqrt(n)}class ri{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 XF extends Map{constructor(t,n=LR){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(q_(this,t))}has(t){return super.has(q_(this,t))}set(t,n){return super.set(NR(this,t),n)}delete(t){return super.delete(OR(this,t))}}class g1 extends Set{constructor(t,n=LR){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(q_(this,t))}add(t){return super.add(NR(this,t))}delete(t){return super.delete(OR(this,t))}}function q_({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function NR({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function OR({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function LR(e){return e!==null&&typeof e=="object"?e.valueOf():e}function nY(e,t){return Array.from(t,n=>e[n])}function rY(e=Ba){if(e===Ba)return IR;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 IR(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const iY=Math.sqrt(50),sY=Math.sqrt(10),oY=Math.sqrt(2);function m1(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>=iY?10:s>=sY?5:s>=oY?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 G_(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 PR(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?IR:rY(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));PR(e,t,h,p,i)}const s=e[t];let o=n,a=r;for(Sh(e,n,t),i(e[r],s)>0&&Sh(e,n,r);o0;)--a}i(e[n],s)===0?Sh(e,n,a):(++a,Sh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Sh(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Y_(e,t,n){if(e=Float64Array.from(JG(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return G_(e);if(t>=1)return oc(e);var r,i=(r-1)*t,s=Math.floor(i),o=oc(PR(e,s).subarray(0,s+1)),a=G_(e.subarray(s+1));return o+(a-o)*(i-s)}}function BR(e,t,n=TR){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 aY(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 zR(e,t){return Y_(e,.5,t)}function*uY(e){for(const t of e)yield*t}function jR(e){return Array.from(uY(e))}function Gi(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 v1(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 dd(e){return e=v1(Math.abs(e)),e?e[1]:NaN}function hY(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 pY(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var gY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ac(e){if(!(t=gY.exec(e)))throw new Error("invalid format: "+e);var t;return new YA({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]})}Ac.prototype=YA.prototype;function YA(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+""}YA.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 mY(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 y1;function vY(e,t){var n=v1(e,t);if(!n)return y1=void 0,e.toPrecision(t);var r=n[0],i=n[1],s=i-(y1=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")+v1(e,Math.max(0,t+s-1))[0]}function KF(e,t){var n=v1(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 ZF={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:dY,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)=>KF(e*100,t),r:KF,s:vY,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function JF(e){return e}var QF=Array.prototype.map,e5=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function qR(e){var t=e.grouping===void 0||e.thousands===void 0?JF:hY(QF.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?JF:pY(QF.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=Ac(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,v=f.zero,b=f.width,x=f.comma,_=f.precision,w=f.trim,A=f.type;A==="n"?(x=!0,A="g"):ZF[A]||(_===void 0&&(_=12),w=!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:""),C=ZF[A],$=/[defgprs%]/.test(A);_=_===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function M(N){var L=E,T=S,k,F,I;if(A==="c")T=C(N)+T,N="";else{N=+N;var B=N<0||1/N<0;if(N=isNaN(N)?u:C(Math.abs(N),_),w&&(N=mY(N)),B&&+N==0&&g!=="+"&&(B=!1),L=(B?g==="("?g:a:g==="-"||g==="("?"":g)+L,T=(A==="s"&&!isNaN(N)&&y1!==void 0?e5[8+y1/3]:"")+T+(B&&g==="("?")":""),$){for(k=-1,F=N.length;++kI||I>57){T=(I===46?i+N.slice(k+1):N.slice(k))+T,N=N.slice(0,k);break}}}x&&!v&&(N=t(N,1/0));var O=L.length+N.length+T.length,j=O>1)+L+N+T+j.slice(O);break;default:N=j+L+N+T;break}return s(N)}return M.toString=function(){return f+""},M}function c(f,d){var h=Math.max(-8,Math.min(8,Math.floor(dd(d)/3)))*3,p=Math.pow(10,-h),g=l((f=Ac(f),f.type="f",f),{suffix:e5[8+h/3]});return function(m){return g(p*m)}}return{format:l,formatPrefix:c}}var I0,iy,VA;yY({thousands:",",grouping:[3],currency:["$",""]});function yY(e){return I0=qR(e),iy=I0.format,VA=I0.formatPrefix,I0}function WR(e){return Math.max(0,-dd(Math.abs(e)))}function HR(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dd(t)/3)))*3-dd(Math.abs(e)))}function GR(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,dd(t)-dd(e))+1}const T2=new Date,R2=new Date;function Vn(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(lVn(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)=>(T2.setTime(+s),R2.setTime(+o),e(T2),e(R2),Math.floor(n(T2,R2))),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 hd=Vn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);hd.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Vn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):hd);hd.range;const Ma=1e3,ps=Ma*60,Ta=ps*60,Va=Ta*24,XA=Va*7,t5=Va*30,N2=Va*365,Ra=Vn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ma)},(e,t)=>(t-e)/Ma,e=>e.getUTCSeconds());Ra.range;const sy=Vn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ma)},(e,t)=>{e.setTime(+e+t*ps)},(e,t)=>(t-e)/ps,e=>e.getMinutes());sy.range;const oy=Vn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ps)},(e,t)=>(t-e)/ps,e=>e.getUTCMinutes());oy.range;const ay=Vn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ma-e.getMinutes()*ps)},(e,t)=>{e.setTime(+e+t*Ta)},(e,t)=>(t-e)/Ta,e=>e.getHours());ay.range;const uy=Vn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ta)},(e,t)=>(t-e)/Ta,e=>e.getUTCHours());uy.range;const za=Vn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ps)/Va,e=>e.getDate()-1);za.range;const Lu=Vn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Va,e=>e.getUTCDate()-1);Lu.range;const YR=Vn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Va,e=>Math.floor(e/Va));YR.range;function Xc(e){return Vn(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())*ps)/XA)}const nh=Xc(0),b1=Xc(1),bY=Xc(2),xY=Xc(3),pd=Xc(4),_Y=Xc(5),wY=Xc(6);nh.range;b1.range;bY.range;xY.range;pd.range;_Y.range;wY.range;function Kc(e){return Vn(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)/XA)}const rh=Kc(0),x1=Kc(1),EY=Kc(2),AY=Kc(3),gd=Kc(4),kY=Kc(5),SY=Kc(6);rh.range;x1.range;EY.range;AY.range;gd.range;kY.range;SY.range;const Gp=Vn(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());Gp.range;const Yp=Vn(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());Yp.range;const Xo=Vn(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());Xo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Vn(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)});Xo.range;const Ko=Vn(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());Ko.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Vn(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)});Ko.range;function VR(e,t,n,r,i,s){const o=[[Ra,1,Ma],[Ra,5,5*Ma],[Ra,15,15*Ma],[Ra,30,30*Ma],[s,1,ps],[s,5,5*ps],[s,15,15*ps],[s,30,30*ps],[i,1,Ta],[i,3,3*Ta],[i,6,6*Ta],[i,12,12*Ta],[r,1,Va],[r,2,2*Va],[n,1,XA],[t,1,t5],[t,3,3*t5],[e,1,N2]];function a(l,c,f){const d=cm).right(o,d);if(h===o.length)return e.every(Wu(l/N2,c/N2,f));if(h===0)return hd.every(Math.max(Wu(l,c,f),1));const[p,g]=o[d/o[h-1][2](e[t]=1+n,e),{});function ZA(e){const t=Me(e).slice(),n={};return t.length||ne("Missing time unit."),t.forEach(i=>{Le(O2,i)?n[i]=1:ne(`Invalid time unit: ${i}.`)}),(n[Wn]||n[Rr]?1:0)+(n[Si]||n[Ir]||n[Ci]?1:0)+(n[Zo]?1:0)>1&&ne(`Incompatible time units: ${e}`),t.sort((i,s)=>O2[i]-O2[s]),t}const MY={[wr]:"%Y ",[Si]:"Q%q ",[Ir]:"%b ",[Ci]:"%d ",[Wn]:"W%U ",[Rr]:"%a ",[Zo]:"%j ",[es]:"%H:00",[ts]:"00:%M",[ks]:":%S",[io]:".%L",[`${wr}-${Ir}`]:"%Y-%m ",[`${wr}-${Ir}-${Ci}`]:"%Y-%m-%d ",[`${es}-${ts}`]:"%H:%M"};function XR(e,t){const n=dt({},MY,t),r=ZA(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 Ul=new Date;function JA(e){return Ul.setFullYear(e),Ul.setMonth(0),Ul.setDate(1),Ul.setHours(0,0,0,0),Ul}function KR(e){return JR(new Date(e))}function ZR(e){return V_(new Date(e))}function JR(e){return za.count(JA(e.getFullYear())-1,e)}function V_(e){return nh.count(JA(e.getFullYear())-1,e)}function X_(e){return JA(e).getDay()}function TY(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 QR(e){return tN(new Date(e))}function eN(e){return K_(new Date(e))}function tN(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Lu.count(t-1,e)}function K_(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return rh.count(t-1,e)}function Z_(e){return Ul.setTime(Date.UTC(e,0,1)),Ul.getUTCDay()}function RY(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 nN(e,t,n,r,i){const s=t||1,o=Nt(e),a=(v,b,x)=>(x=x||v,NY(n[x],r[x],v===o&&s,b)),u=new Date,l=ro(e),c=l[wr]?a(wr):qr(2012),f=l[Ir]?a(Ir):l[Si]?a(Si):bu,d=l[Wn]&&l[Rr]?a(Rr,1,Wn+Rr):l[Wn]?a(Wn,1):l[Rr]?a(Rr,1):l[Ci]?a(Ci,1):l[Zo]?a(Zo,1):Kd,h=l[es]?a(es):bu,p=l[ts]?a(ts):bu,g=l[ks]?a(ks):bu,m=l[io]?a(io):bu;return function(v){u.setTime(+v);const b=c(u);return i(b,f(u),d(u,b),h(u),p(u),g(u),m(u))}}function NY(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 md(e,t,n){return t+e*7-(n+6)%7}const OY={[wr]:e=>e.getFullYear(),[Si]:e=>Math.floor(e.getMonth()/3),[Ir]:e=>e.getMonth(),[Ci]:e=>e.getDate(),[es]:e=>e.getHours(),[ts]:e=>e.getMinutes(),[ks]:e=>e.getSeconds(),[io]:e=>e.getMilliseconds(),[Zo]:e=>JR(e),[Wn]:e=>V_(e),[Wn+Rr]:(e,t)=>md(V_(e),e.getDay(),X_(t)),[Rr]:(e,t)=>md(1,e.getDay(),X_(t))},LY={[Si]:e=>3*e,[Wn]:(e,t)=>md(e,0,X_(t))};function rN(e,t){return nN(e,t||1,OY,LY,TY)}const IY={[wr]:e=>e.getUTCFullYear(),[Si]:e=>Math.floor(e.getUTCMonth()/3),[Ir]:e=>e.getUTCMonth(),[Ci]:e=>e.getUTCDate(),[es]:e=>e.getUTCHours(),[ts]:e=>e.getUTCMinutes(),[ks]:e=>e.getUTCSeconds(),[io]:e=>e.getUTCMilliseconds(),[Zo]:e=>tN(e),[Wn]:e=>K_(e),[Rr]:(e,t)=>md(1,e.getUTCDay(),Z_(t)),[Wn+Rr]:(e,t)=>md(K_(e),e.getUTCDay(),Z_(t))},PY={[Si]:e=>3*e,[Wn]:(e,t)=>md(e,0,Z_(t))};function iN(e,t){return nN(e,t||1,IY,PY,RY)}const BY={[wr]:Xo,[Si]:Gp.every(3),[Ir]:Gp,[Wn]:nh,[Ci]:za,[Rr]:za,[Zo]:za,[es]:ay,[ts]:sy,[ks]:Ra,[io]:hd},zY={[wr]:Ko,[Si]:Yp.every(3),[Ir]:Yp,[Wn]:rh,[Ci]:Lu,[Rr]:Lu,[Zo]:Lu,[es]:uy,[ts]:oy,[ks]:Ra,[io]:hd};function ih(e){return BY[e]}function sh(e){return zY[e]}function sN(e,t,n){return e?e.offset(t,n):void 0}function oN(e,t,n){return sN(ih(e),t,n)}function aN(e,t,n){return sN(sh(e),t,n)}function uN(e,t,n,r){return e?e.range(t,n,r):void 0}function lN(e,t,n,r){return uN(ih(e),t,n,r)}function cN(e,t,n,r){return uN(sh(e),t,n,r)}const Qh=1e3,ep=Qh*60,tp=ep*60,ly=tp*24,jY=ly*7,n5=ly*30,J_=ly*365,fN=[wr,Ir,Ci,es,ts,ks,io],np=fN.slice(0,-1),rp=np.slice(0,-1),ip=rp.slice(0,-1),UY=ip.slice(0,-1),qY=[wr,Wn],r5=[wr,Ir],dN=[wr],Ch=[[np,1,Qh],[np,5,5*Qh],[np,15,15*Qh],[np,30,30*Qh],[rp,1,ep],[rp,5,5*ep],[rp,15,15*ep],[rp,30,30*ep],[ip,1,tp],[ip,3,3*tp],[ip,6,6*tp],[ip,12,12*tp],[UY,1,ly],[qY,1,jY],[r5,1,n5],[r5,3,3*n5],[dN,1,J_]];function hN(e){const t=e.extent,n=e.maxbins||40,r=Math.abs(Bg(t))/n;let i=th(a=>a[2]).right(Ch,r),s,o;return i===Ch.length?(s=dN,o=Wu(t[0]/J_,t[1]/J_,n)):i?(i=Ch[r/Ch[i-1][2]53)return null;"w"in W||(W.w=1),"Z"in W?(ke=I2($h(W.y,0,1)),Te=ke.getUTCDay(),ke=Te>4||Te===0?x1.ceil(ke):x1(ke),ke=Lu.offset(ke,(W.V-1)*7),W.y=ke.getUTCFullYear(),W.m=ke.getUTCMonth(),W.d=ke.getUTCDate()+(W.w+6)%7):(ke=L2($h(W.y,0,1)),Te=ke.getDay(),ke=Te>4||Te===0?b1.ceil(ke):b1(ke),ke=za.offset(ke,(W.V-1)*7),W.y=ke.getFullYear(),W.m=ke.getMonth(),W.d=ke.getDate()+(W.w+6)%7)}else("W"in W||"U"in W)&&("w"in W||(W.w="u"in W?W.u%7:"W"in W?1:0),Te="Z"in W?I2($h(W.y,0,1)).getUTCDay():L2($h(W.y,0,1)).getDay(),W.m=0,W.d="W"in W?(W.w+6)%7+W.W*7-(Te+5)%7:W.w+W.U*7-(Te+6)%7);return"Z"in W?(W.H+=W.Z/100|0,W.M+=W.Z%100,I2(W)):L2(W)}}function S(ue,Ne,Q,W){for(var xe=0,ke=Ne.length,Te=Q.length,G,H;xe=Te)return-1;if(G=Ne.charCodeAt(xe++),G===37){if(G=Ne.charAt(xe++),H=w[G in i5?Ne.charAt(xe++):G],!H||(W=H(ue,Q,W))<0)return-1}else if(G!=Q.charCodeAt(W++))return-1}return W}function C(ue,Ne,Q){var W=l.exec(Ne.slice(Q));return W?(ue.p=c.get(W[0].toLowerCase()),Q+W[0].length):-1}function $(ue,Ne,Q){var W=h.exec(Ne.slice(Q));return W?(ue.w=p.get(W[0].toLowerCase()),Q+W[0].length):-1}function M(ue,Ne,Q){var W=f.exec(Ne.slice(Q));return W?(ue.w=d.get(W[0].toLowerCase()),Q+W[0].length):-1}function N(ue,Ne,Q){var W=v.exec(Ne.slice(Q));return W?(ue.m=b.get(W[0].toLowerCase()),Q+W[0].length):-1}function L(ue,Ne,Q){var W=g.exec(Ne.slice(Q));return W?(ue.m=m.get(W[0].toLowerCase()),Q+W[0].length):-1}function T(ue,Ne,Q){return S(ue,t,Ne,Q)}function k(ue,Ne,Q){return S(ue,n,Ne,Q)}function F(ue,Ne,Q){return S(ue,r,Ne,Q)}function I(ue){return o[ue.getDay()]}function B(ue){return s[ue.getDay()]}function O(ue){return u[ue.getMonth()]}function j(ue){return a[ue.getMonth()]}function Y(ue){return i[+(ue.getHours()>=12)]}function te(ue){return 1+~~(ue.getMonth()/3)}function ce(ue){return o[ue.getUTCDay()]}function Ae(ue){return s[ue.getUTCDay()]}function ge(ue){return u[ue.getUTCMonth()]}function Ie(ue){return a[ue.getUTCMonth()]}function tt(ue){return i[+(ue.getUTCHours()>=12)]}function nt(ue){return 1+~~(ue.getUTCMonth()/3)}return{format:function(ue){var Ne=A(ue+="",x);return Ne.toString=function(){return ue},Ne},parse:function(ue){var Ne=E(ue+="",!1);return Ne.toString=function(){return ue},Ne},utcFormat:function(ue){var Ne=A(ue+="",_);return Ne.toString=function(){return ue},Ne},utcParse:function(ue){var Ne=E(ue+="",!0);return Ne.toString=function(){return ue},Ne}}}var i5={"-":"",_:" ",0:"0"},lr=/^\s*\d+/,WY=/^%/,HY=/[\\^$*+?|[\]().{}]/g;function qt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function YY(e,t,n){var r=lr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function VY(e,t,n){var r=lr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function XY(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function KY(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function ZY(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function s5(e,t,n){var r=lr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function o5(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function JY(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 QY(e,t,n){var r=lr.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function eV(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function a5(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function tV(e,t,n){var r=lr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function u5(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nV(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rV(e,t,n){var r=lr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function iV(e,t,n){var r=lr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function sV(e,t,n){var r=lr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oV(e,t,n){var r=WY.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function aV(e,t,n){var r=lr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function uV(e,t,n){var r=lr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function l5(e,t){return qt(e.getDate(),t,2)}function lV(e,t){return qt(e.getHours(),t,2)}function cV(e,t){return qt(e.getHours()%12||12,t,2)}function fV(e,t){return qt(1+za.count(Xo(e),e),t,3)}function gN(e,t){return qt(e.getMilliseconds(),t,3)}function dV(e,t){return gN(e,t)+"000"}function hV(e,t){return qt(e.getMonth()+1,t,2)}function pV(e,t){return qt(e.getMinutes(),t,2)}function gV(e,t){return qt(e.getSeconds(),t,2)}function mV(e){var t=e.getDay();return t===0?7:t}function vV(e,t){return qt(nh.count(Xo(e)-1,e),t,2)}function mN(e){var t=e.getDay();return t>=4||t===0?pd(e):pd.ceil(e)}function yV(e,t){return e=mN(e),qt(pd.count(Xo(e),e)+(Xo(e).getDay()===4),t,2)}function bV(e){return e.getDay()}function xV(e,t){return qt(b1.count(Xo(e)-1,e),t,2)}function _V(e,t){return qt(e.getFullYear()%100,t,2)}function wV(e,t){return e=mN(e),qt(e.getFullYear()%100,t,2)}function EV(e,t){return qt(e.getFullYear()%1e4,t,4)}function AV(e,t){var n=e.getDay();return e=n>=4||n===0?pd(e):pd.ceil(e),qt(e.getFullYear()%1e4,t,4)}function kV(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+qt(t/60|0,"0",2)+qt(t%60,"0",2)}function c5(e,t){return qt(e.getUTCDate(),t,2)}function SV(e,t){return qt(e.getUTCHours(),t,2)}function CV(e,t){return qt(e.getUTCHours()%12||12,t,2)}function $V(e,t){return qt(1+Lu.count(Ko(e),e),t,3)}function vN(e,t){return qt(e.getUTCMilliseconds(),t,3)}function FV(e,t){return vN(e,t)+"000"}function DV(e,t){return qt(e.getUTCMonth()+1,t,2)}function MV(e,t){return qt(e.getUTCMinutes(),t,2)}function TV(e,t){return qt(e.getUTCSeconds(),t,2)}function RV(e){var t=e.getUTCDay();return t===0?7:t}function NV(e,t){return qt(rh.count(Ko(e)-1,e),t,2)}function yN(e){var t=e.getUTCDay();return t>=4||t===0?gd(e):gd.ceil(e)}function OV(e,t){return e=yN(e),qt(gd.count(Ko(e),e)+(Ko(e).getUTCDay()===4),t,2)}function LV(e){return e.getUTCDay()}function IV(e,t){return qt(x1.count(Ko(e)-1,e),t,2)}function PV(e,t){return qt(e.getUTCFullYear()%100,t,2)}function BV(e,t){return e=yN(e),qt(e.getUTCFullYear()%100,t,2)}function zV(e,t){return qt(e.getUTCFullYear()%1e4,t,4)}function jV(e,t){var n=e.getUTCDay();return e=n>=4||n===0?gd(e):gd.ceil(e),qt(e.getUTCFullYear()%1e4,t,4)}function UV(){return"+0000"}function f5(){return"%"}function d5(e){return+e}function h5(e){return Math.floor(+e/1e3)}var gf,QA,bN,ek,xN;qV({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 qV(e){return gf=pN(e),QA=gf.format,bN=gf.parse,ek=gf.utcFormat,xN=gf.utcParse,gf}function sp(e){const t={};return n=>t[n]||(t[n]=e(n))}function WV(e,t){return n=>{const r=e(n),i=r.indexOf(t);if(i<0)return r;let s=HV(r,i);const o=si;)if(r[s]!=="0"){++s;break}return r.slice(0,s)+o}}function HV(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 _N(e){const t=sp(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(r){const i=Ac(r||",");if(i.precision==null){switch(i.precision=12,i.type){case"%":i.precision-=2;break;case"e":i.precision-=1;break}return WV(t(i),t(".1f")(1)[1])}else return t(i)},formatSpan(r,i,s,o){o=Ac(o??",f");const a=Wu(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=HR(a,u))||(o.precision=l),n(o,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=GR(a,u))||(o.precision=l-(o.type==="e"));break}case"f":case"%":{isNaN(l=WR(a))||(o.precision=l-(o.type==="%")*2);break}}return t(o)}}}let Q_;wN();function wN(){return Q_=_N({format:iy,formatPrefix:VA})}function EN(e){return _N(qR(e))}function _1(e){return arguments.length?Q_=EN(e):Q_}function p5(e,t,n){n=n||{},Fe(n)||ne(`Invalid time multi-format specifier: ${n}`);const r=t(ks),i=t(ts),s=t(es),o=t(Ci),a=t(Wn),u=t(Ir),l=t(Si),c=t(wr),f=e(n[io]||".%L"),d=e(n[ks]||":%S"),h=e(n[ts]||"%I:%M"),p=e(n[es]||"%I %p"),g=e(n[Ci]||n[Rr]||"%a %d"),m=e(n[Wn]||"%b %d"),v=e(n[Ir]||"%B"),b=e(n[Si]||"%B"),x=e(n[wr]||"%Y");return _=>(r(_)<_?f:i(_)<_?d:s(_)<_?h:o(_)<_?p:u(_)<_?a(_)<_?g:m:c(_)<_?l(_)<_?v:b:x)(_)}function AN(e){const t=sp(e.format),n=sp(e.utcFormat);return{timeFormat:r=>De(r)?t(r):p5(t,ih,r),utcFormat:r=>De(r)?n(r):p5(n,sh,r),timeParse:sp(e.parse),utcParse:sp(e.utcParse)}}let ew;kN();function kN(){return ew=AN({format:QA,parse:bN,utcFormat:ek,utcParse:xN})}function SN(e){return AN(pN(e))}function Vp(e){return arguments.length?ew=SN(e):ew}const tw=(e,t)=>dt({},e,t);function CN(e,t){const n=e?EN(e):_1(),r=t?SN(t):Vp();return tw(n,r)}function tk(e,t){const n=arguments.length;return n&&n!==2&&ne("defaultLocale expects either zero or two arguments."),n?tw(_1(e),Vp(t)):tw(_1(),Vp())}function GV(){return wN(),kN(),tk()}const YV=/^(data:|([A-Za-z]+:)?\/\/)/,VV=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,XV=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,g5="file://";function KV(e,t){return n=>({options:n||{},sanitize:JV,load:ZV,fileAccess:!1,file:QV(),http:tX(e)})}async function ZV(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function JV(e,t){t=dt({},this.options,t);const n=this.fileAccess,r={href:null};let i,s,o;const a=VV.test(e.replace(XV,""));(e==null||typeof e!="string"||!a)&&ne("Sanitize failure, invalid URI: "+Ee(e));const u=YV.test(e);return(o=t.baseURL)&&!u&&(!e.startsWith("/")&&!o.endsWith("/")&&(e="/"+e),e=o+e),s=(i=e.startsWith(g5))||t.mode==="file"||t.mode!=="http"&&!u&&n,i?e=e.slice(g5.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 QV(e){return eX}async function eX(){ne("No file system access.")}function tX(e){return e?async function(t,n){const r=dt({},this.options.http,n),i=n&&n.response,s=await e(t,r);return s.ok?ht(s[i])?s[i]():s.text():ne(s.status+""+s.statusText)}:nX}async function nX(){ne("No HTTP fetch method available.")}const rX=e=>e!=null&&e===e,iX=e=>e==="true"||e==="false"||e===!0||e===!1,sX=e=>!Number.isNaN(Date.parse(e)),$N=e=>!Number.isNaN(+e)&&!(e instanceof Date),oX=e=>$N(e)&&Number.isInteger(+e),nw={boolean:WA,integer:Nr,number:Nr,date:HA,string:GA,unknown:Ur},P0=[iX,oX,$N,sX],aX=["boolean","integer","number","date"];function FN(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=P0.length,i=P0.map((s,o)=>o+1);for(let s=0,o=0,a,u;ss===0?o:s,0)-1]}function DN(e,t){return t.reduce((n,r)=>(n[r]=FN(e,r),n),{})}function m5(e){const t=function(n,r){const i={delimiter:e};return nk(n,r?dt(r,i):i)};return t.responseType="text",t}function nk(e,t){return t.header&&(e=t.header.map(Ee).join(t.delimiter)+` `+e),jG(t.delimiter).parse(e+"")}nk.responseType="text";function uX(e){return typeof Buffer=="function"&&ht(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function rk(e,t){const n=t&&t.property?As(t.property):Ur;return Fe(e)&&!uX(e)?lX(n(e),t):n(JSON.parse(e))}rk.responseType="json";function lX(e,t){return!oe(e)&&AR(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const cX={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function MN(e,t){let n,r,i,s;return e=rk(e,t),t&&t.feature?(n=HG,i=t.feature):t&&t.mesh?(n=YG,i=t.mesh,s=cX[t.filter]):ne("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,s):ne("Invalid TopoJSON object: "+i),r&&r.features||[r]}MN.responseType="json";const Nm={dsv:nk,csv:m5(","),tsv:m5(" "),json:rk,topojson:MN};function ik(e,t){return arguments.length>1?(Nm[e]=t,this):Le(Nm,e)?Nm[e]:null}function TN(e){const t=ik(e);return t&&t.responseType||"text"}function RN(e,t,n,r){t=t||{};const i=ik(t.type||"json");return i||ne("Unknown data format type: "+t.type),e=i(e,t),t.parse&&fX(e,t.parse,n,r),Le(e,"columns")&&delete e.columns,e}function fX(e,t,n,r){if(!e.length)return;const i=Vp();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=DN(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(!nw[p])throw Error("Illegal format pattern: "+h+":"+p);return nw[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 Om(e,t){try{await t(e)}catch(n){e.error(n)}}const NN=Symbol("vega_id");let dX=1;function dy(e){return!!(e&&Ye(e))}function Ye(e){return e[NN]}function ON(e,t){return e[NN]=t,e}function Gt(e){const t=e===Object(e)?e:{data:e};return Ye(t)?t:ON(t,dX++)}function sk(e){return hy(e,Gt({}))}function hy(e,t){for(const n in e)t[n]=e[n];return t}function LN(e,t){return ON(t,Ye(e))}function Zc(e,t){return e?t?(n,r)=>e(n,r)||Ye(t(n))-Ye(t(r)):(n,r)=>e(n,r)||Ye(n)-Ye(r):null}function IN(e){return e&&e.constructor===ll}function ll(){const e=[],t=[],n=[],r=[],i=[];let s=null,o=!1;return{constructor:ll,insert(a){const u=Me(a),l=u.length;for(let c=0;c{p(b)&&(l[Ye(b)]=-1)});for(f=0,d=e.length;f0&&(v(g,p,h.value),a.modifies(p));for(f=0,d=i.length;f{p(b)&&l[Ye(b)]>0&&v(b,h.field,h.value)}),a.modifies(h.field);if(o)a.mod=t.length||r.length?u.filter(b=>l[Ye(b)]>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 Lm="_:mod:_";function py(){Object.defineProperty(this,Lm,{writable:!0,value:{}})}py.prototype={set(e,t,n,r){const i=this,s=i[e],o=i[Lm];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]=oe(n)?1+n.length:-1),i},modified(e,t){const n=this[Lm];if(arguments.length){if(oe(e)){for(let r=0;r=0?t+1{h instanceof ln?(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===pX)Me(a).forEach(f=>{f instanceof ln?f!==this&&(f.targets().add(this),s.push(f)):ne("Pulse parameters must be operator instances.")}),this.source=a;else if(oe(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=du();return this.targets().add(du(null,null,jA(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(du(null,null,()=>n=!0)),t.targets().add(du(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Qi,this._targets=null}};function _X(e,t,n,r){const i=this,s=du(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=Me(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 CX={skip:!0};function $X(e,t,n,r,i){return(e instanceof ln?DX:FX)(this,e,t,n,r,i),this}function FX(e,t,n,r,i,s){const o=dt({},s,CX);let a,u;ht(n)||(n=qr(n)),r===void 0?a=l=>e.touch(n(l)):ht(r)?(u=new ln(null,r,i,!1),a=l=>{u.evaluate(l);const c=n(l),f=u.value;IN(f)?e.pulse(c,f,s):e.update(c,f,o)}):a=l=>e.update(n(l),r,o),t.apply(a)}function DX(e,t,n,r,i,s){if(r===void 0)t.targets().add(n);else{const o=s||{},a=new ln(null,MX(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 MX(e,t){return t=ht(t)?t:qr(t),e?function(n,r){const i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function TX(e){e.rank=++this._rank}function RX(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&&ne("Cycle detected in dataflow graph.")}const w1={},Co=1,gu=2,wa=4,NX=Co|gu,y5=Co|wa,mf=Co|gu|wa,b5=8,Mh=16,x5=32,_5=64;function Iu(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function P2(e,t){const n=[];return pu(e,t,r=>n.push(r)),n}function w5(e,t){const n={};return e.visit(t,r=>{n[Ye(r)]=1}),r=>n[Ye(r)]?null:r}function B0(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}Iu.prototype={StopPropagation:w1,ADD:Co,REM:gu,MOD:wa,ADD_REM:NX,ADD_MOD:y5,ALL:mf,REFLOW:b5,SOURCE:Mh,NO_SOURCE:x5,NO_FIELDS:_5,fork(e){return new Iu(this.dataflow).init(this,e)},clone(){const e=this.fork(mf);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(mf|Mh)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Iu(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&_5)&&(n.fields=e.fields),t&Co?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&gu?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&wa?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&x5?(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||mf;return t&Co&&this.add.length||t&gu&&this.rem.length||t&wa&&this.mod.length},reflow(e){if(e)return this.fork(mf).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(wa,w5(this,Co))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return oe(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?oe(e)?e.some(r=>n[r]):n[e]:!!n:!1},filter(e,t){const n=this;return e&Co&&(n.addF=B0(n.addF,t)),e&gu&&(n.remF=B0(n.remF,t)),e&wa&&(n.modF=B0(n.modF,t)),e&Mh&&(n.srcF=B0(n.srcF,t)),n},materialize(e){e=e||mf;const t=this;return e&Co&&t.addF&&(t.add=P2(t.add,t.addF),t.addF=null),e&gu&&t.remF&&(t.rem=P2(t.rem,t.remF),t.remF=null),e&wa&&t.modF&&(t.mod=P2(t.mod,t.modF),t.modF=null),e&Mh&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,r=t;if(e&Mh)return pu(n.source,n.srcF,r),n;e&Co&&pu(n.add,n.addF,r),e&gu&&pu(n.rem,n.remF,r),e&wa&&pu(n.mod,n.modF,r);const i=n.source;if(e&b5&&i){const s=n.add.length+n.mod.length;s===i.length||(s?pu(i,w5(n,y5),r):pu(i,n.srcF,r))}return n}};function ok(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}Se(ok,Iu,{fork(e){const t=new Iu(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?oe(e)?e.some(r=>n[r]):n[e]:0},filter(){ne("MultiPulse does not support filtering.")},materialize(){ne("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=fy(Pg);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=w1),u!==w1&&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 LX(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 IX(e,t,n){return this._pulse?PN(this):(this.evaluate(e,t,n),this)}function PX(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 PN(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function BX(e,t){const n=e.stampi.pulse),t):this._input[e.id]||jX(this._pulse,n&&n.pulse)}function jX(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==w1&&(e.source=t.source),e)}const ak={skip:!1,force:!1};function UX(e,t){const n=t||ak;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function qX(e,t,n){const r=n||ak;return(e.set(t)||r.force)&&this.touch(e,r),this}function WX(e,t,n){this.touch(e,n||ak);const r=new Iu(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 HX(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),BN(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let r;return t.length?(r=t[0],t[0]=n,GX(t,0,e)):r=n,r}}}function BN(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 GX(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,BN(e,r,t,n)}function jf(){this.logger(LA()),this.logLevel(NA),this._clock=0,this._rank=0,this._locale=tk();try{this._loader=cy()}catch{}this._touched=fy(Pg),this._input={},this._pulse=null,this._heap=HX((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Th(e){return function(){return this._log[e].apply(this,arguments)}}jf.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:Th("error"),warn:Th("warn"),info:Th("info"),debug:Th("debug"),logLevel:Th("level"),cleanThreshold:1e4,add:yX,connect:bX,rank:TX,rerank:RX,pulse:WX,touch:UX,update:qX,changeset:ll,ingest:EX,parse:wX,preload:kX,request:AX,events:_X,on:$X,evaluate:OX,run:IX,runAsync:LX,runAfter:PX,_enqueue:BX,_getPulse:zX};function J(e,t){ln.call(this,e,null,t)}Se(J,ln,{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 vd={};function zN(e){const t=jN(e);return t&&t.Definition||null}function jN(e){return e=e&&e.toLowerCase(),Le(vd,e)?vd[e]:null}function*UN(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 uk(e,t,n){const r=Float64Array.from(UN(e,n));return r.sort(Ba),t.map(i=>BR(r,i))}function lk(e,t){return uk(e,[.25,.5,.75],t)}function ck(e,t){const n=e.length,r=tY(e,t),i=lk(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 qN(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 XX(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function KX(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*Ss())},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 GN=Math.sqrt(2*Math.PI),ZX=Math.SQRT2;let Rh=NaN;function my(e,t){e=e||0,t=t??1;let n=0,r=0,i,s;if(Rh===Rh)n=Rh,Rh=NaN;else{do n=Ss()*2-1,r=Ss()*2-1,i=n*n+r*r;while(i===0||i>1);s=Math.sqrt(-2*Math.log(i)/i),n*=s,Rh=r*s}return e+n*t}function fk(e,t,n){n=n??1;const r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*GN)}function vy(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 yy(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*ZX*JX(2*e-1)}function JX(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 dk(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:()=>my(n,r),pdf:s=>fk(s,n,r),cdf:s=>vy(s,n,r),icdf:s=>yy(s,n,r)};return i.mean(e).stdev(t)}function hk(e,t){const n=dk();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=ck(e)),i):t},sample(){return e[~~(Ss()*r)]+t*n.sample()},pdf(s){let o=0,a=0;for(;apk(n,r),pdf:s=>gk(s,n,r),cdf:s=>mk(s,n,r),icdf:s=>vk(s,n,r)};return i.mean(e).stdev(t)}function VN(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 xk(e,t,n){return n==null&&(n=t??1,t=0),en?1:(e-t)/(n-t)}function _k(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function XN(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:()=>yk(n,r),pdf:s=>bk(s,n,r),cdf:s=>xk(s,n,r),icdf:s=>_k(s,n,r)};return t==null&&(t=e??1,e=0),i.min(e).max(t)}function wk(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 zg(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 by(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 oh(e,t,n,r,i){let s=0,o=0;return jg(e,t,n,(a,u)=>{const l=u-i(a),c=u-r;s+=l*l,o+=c*c}),1-s/o}function Ek(e,t,n){let r=0,i=0,s=0,o=0,a=0;jg(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=zg(r,i,s,o),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:oh(e,t,n,i,l)}}function KN(e,t,n){let r=0,i=0,s=0,o=0,a=0;jg(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=zg(r,i,s,o),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:oh(e,t,n,i,l)}}function ZN(e,t,n){const[r,i,s,o]=by(e,t,n);let a=0,u=0,l=0,c=0,f=0,d,h,p;jg(e,t,n,(b,x)=>{d=r[f++],h=Math.log(x),p=d*x,a+=(x*h-a)/f,u+=(p-u)/f,l+=(p*h-l)/f,c+=(d*p-c)/f});const[g,m]=zg(u/o,a/o,l/o,c/o),v=b=>Math.exp(g+m*(b-s));return{coef:[Math.exp(g-m*s),m],predict:v,rSquared:oh(e,t,n,o,v)}}function JN(e,t,n){let r=0,i=0,s=0,o=0,a=0,u=0;jg(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=zg(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:oh(e,t,n,a,c)}}function Ak(e,t,n){const[r,i,s,o]=by(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,x*E*E+_*E+w+o);return{coef:[w-_*s+x*s*s+o,_-2*x*s,x],predict:A,rSquared:oh(e,t,n,o,A)}}function QN(e,t,n,r){if(r===0)return wk(e,t,n);if(r===1)return Ek(e,t,n);if(r===2)return Ak(e,t,n);const[i,s,o,a]=by(e,t,n),u=i.length,l=[],c=[],f=r+1;let d,h,p,g,m;for(d=0;d{x-=o;let _=a+v[0]+v[1]*x+v[2]*x*x;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 eK(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[x]-v?b:x;let w=0,A=0,E=0,S=0,C=0;const $=1/Math.abs(i[_]-v||1);for(let L=b;L<=x;++L){const T=i[L],k=s[L],F=tK(Math.abs(v-T)*$)*d[L],I=T*F;w+=F,A+=I,E+=k*F,S+=k*I,C+=T*I}const[M,N]=zg(A/w,E/w,S/w,C/w);c[m]=M+N*v,f[m]=Math.abs(s[m]-c[m]),nK(i,m+1,p)}if(h===E5)break;const g=zR(f);if(Math.abs(g)=1?A5:(b=1-v*v)*b}return rK(i,c,o,a)}function tK(e){return(e=1-e*e*e)*e*e}function nK(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 rK(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=sK(f[1],c);for(;d;){const g=i((f[0]+d[0])/2);g[0]-f[0]>=u&&oK(f,g,d,h,p)>iK?c.push(g):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function sK(e,t){let n=e,r=e;const i=t.length;for(let s=0;sr&&(r=o)}return 1/(r-n)}function oK(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 aK(e){return t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r{},uK={init:B2,add:B2,rem:B2,idx:0},Xp={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}},Ug=Object.keys(Xp).filter(e=>e!=="__count__");function lK(e,t){return(n,r)=>dt({name:e,aggregate_param:r,out:n||e},uK,t)}[...Ug,"__count__"].forEach(e=>{Xp[e]=lK(e,Xp[e])});function nO(e,t,n){return Xp[e](n,t)}function rO(e,t){return e.idx-t.idx}function cK(e){const t={};e.forEach(r=>t[r.name]=r);const n=r=>{r.req&&r.req.forEach(i=>{t[i]||n(t[i]=Xp[i]())})};return e.forEach(n),Object.values(t).sort(rO)}function fK(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function dK(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function hK(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function pK(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function iO(e,t){const n=t||Ur,r=cK(e),i=e.slice().sort(rO);function s(o){this._ops=r,this._out=i,this.cell=o,this.init()}return s.prototype.init=fK,s.prototype.add=dK,s.prototype.rem=hK,s.prototype.set=pK,s.prototype.get=n,s.fields=e.map(o=>o.out),s}function kk(e){this._key=e?As(e):Ye,this.reset()}const Sr=kk.prototype;Sr.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};Sr.add=function(e){this._add.push(e)};Sr.rem=function(e){this._rem.push(e)};Sr.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])+"",Le(n,s)||(n[s]=1,++i);return i};Sr.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=wR(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext};Sr.argmin=function(e){return this.extent(e)[0]||{}};Sr.argmax=function(e){return this.extent(e)[1]||{}};Sr.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0};Sr.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0};Sr.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=lk(this.values(),e),this._get=e),this._q};Sr.q1=function(e){return this.quartile(e)[0]};Sr.q2=function(e){return this.quartile(e)[1]};Sr.q3=function(e){return this.quartile(e)[2]};Sr.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=WN(this.values(),1e3,.05,e),this._get=e),this._ci};Sr.ci0=function(e){return this.ci(e)[0]};Sr.ci1=function(e){return this.ci(e)[1]};function Hu(e){J.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}Hu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ug},{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"}]};Se(Hu,J,{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 x=Tn(b);return i(b),n.push(x),x}),this.cellkey=e.key?e.key:rw(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&&ne("Unmatched number of fields and aggregate ops."),v=0;viO(b,b.field)),Object.create(null)},cellkey:rw(),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=qN(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=Nr(t(l));return c==null?null:cs?1/0:(c=Math.max(i,Math.min(c,s-r)),i+r*Math.floor(gK+(c-i)/r))};return u.start=i,u.stop=n.stop,u.step=r,this.value=Ti(u,Lr(t),e.name||"bin_"+Tn(t))}});function sO(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?CR(u,i,s.sort(u)):i.concat(s),s=[]),i)}}function Ck(e){J.call(this,[],e)}Ck.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};Se(Ck,J,{transform(e,t){const n=t.fork(t.ALL),r=sO(Ye,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(Zc(i),s),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function oO(e){ln.call(this,null,mK,e)}Se(oO,ln);function mK(e){return this.value&&!e.modified()?this.value:zA(e.fields,e.orders)}function $k(e){J.call(this,null,e)}$k.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 vK(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}Se($k,J,{transform(e,t){const n=f=>d=>{for(var h=vK(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=Gt({}),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 Fk(e){J.call(this,null,e)}Fk.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};Se(Fk,J,{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=yK(a,i,s,e.filter||Qi)):n.mod=a,n.source=this.value,n.modifies(r)}});function yK(e,t,n,r){for(var i=[],s={},o=e.length,a=0,u,l;aaO(s,t))):typeof r[i]===S5&&r[i](e[i]);return r}function Dk(e){J.call(this,null,e)}const uO=[{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}]}],_K={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:uO},{name:"weights",type:"number",array:!0}]};Dk.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:uO.concat(_K)},{name:"as",type:"string",array:!0,default:["value","density"]}]};Se(Dk,J,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=aO(e.distribution,wK(t)),i=e.steps||e.minsteps||25,s=e.steps||e.maxsteps||200;let o=e.method||"pdf";o!=="pdf"&&o!=="cdf"&&ne("Invalid density method: "+o),!e.extent&&!r.data&&ne("Missing density extent parameter."),o=r[o];const a=e.as||["value","density"],u=e.extent||Vo(r.data()),l=xy(o,u,i,s).map(c=>{const f={};return f[a[0]]=c[0],f[a[1]]=c[1],Gt(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function wK(e){return()=>e.materialize(e.SOURCE).source}function lO(e,t){return e?e.map((n,r)=>t[r]||Tn(n)):null}function Mk(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;oBg(Vo(e,t))/30;Se(Tk,J,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,r=Mk(t.source,e.groupby,Ur),i=e.smooth||!1,s=e.field,o=e.step||EK(n,s),a=Zc((p,g)=>s(p)-s(g)),u=e.as||cO,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 fO(e){ln.call(this,null,AK,e),this.modified(!0)}Se(fO,ln);function AK(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Ti(n=>t(n,e),Lr(t),Tn(t))}function Rk(e){J.call(this,[void 0,void 0],e)}Rk.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};Se(Rk,J,{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=Nr(r(a));u!=null&&(uo&&(o=u))}),!Number.isFinite(s)||!Number.isFinite(o)){let a=Tn(r);a&&(a=` for field "${a}"`),t.dataflow.warn(`Infinite extent${a}: [${s}, ${o}]`),s=o=void 0}this.value=[s,o]}});function Nk(e,t){ln.call(this,e),this.parent=t,this.count=0}Se(Nk,ln,{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 _y(e){J.call(this,{},e),this._keys=eh();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=Ye(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(Ye(u),l),a(l).add(u)}),o||t.modified(r.fields)?t.visit(t.MOD,u=>{const l=Ye(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(Ye(u))).mod(u)}),o&&t.visit(t.REFLOW,u=>{const l=Ye(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 dO(e){ln.call(this,null,kK,e)}Se(dO,ln);function kK(e){return this.value&&!e.modified()?this.value:oe(e.name)?Me(e.name).map(t=>As(t)):As(e.name,e.as)}function Ok(e){J.call(this,eh(),e)}Ok.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};Se(Ok,J,{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=Ye(f);r.has(d)?r.delete(d):o.push(f)}),t.visit(t.ADD,f=>{u(f,e)?s.push(f):r.set(Ye(f),1)});function c(f){const d=Ye(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 Lk(e){J.call(this,[],e)}Lk.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}]};Se(Lk,J,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=lO(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 hO(e){J.call(this,[],e)}Se(hO,J,{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=Gt(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 z0={value:"value",median:zR,mean:aY,min:G_,max:oc},SK=[];function Bk(e){J.call(this,[],e)}Bk.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 CK(e){var t=e.method||z0.value,n;if(z0[t]==null)ne("Unrecognized imputation method: "+t);else return t===z0.value?(n=e.value!==void 0?e.value:0,()=>n):z0[t]}function $K(e){const t=e.field;return n=>n?t(n):NaN}Se(Bk,J,{transform(e,t){var n=t.fork(t.ALL),r=CK(e),i=$K(e),s=Tn(e.field),o=Tn(e.key),a=(e.groupby||[]).map(Tn),u=FK(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,h,p,g,m,v,b,x,_,w;for(m=0,x=u.length;mv(m),s=[],o=r?r.slice():[],a={},u={},l,c,f,d,h,p,g,m;for(o.forEach((v,b)=>a[v]=b+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=>{dt(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=hk(h,o)[a],g=e.counts?h.length:1,m=c||Vo(h);xy(p,m,f,d).forEach(v=>{const b={};for(let x=0;x(this._pending=Me(i.data),s=>s.touch(this)))}:n.request(e.url,e.format).then(r=>z2(this,t,Me(r.data)))}});function MK(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function z2(e,t,n){n.forEach(Gt);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 Uk(e){J.call(this,{},e)}Uk.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}]};Se(Uk,J,{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&&ne('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==a*d&&ne('The "as" parameter has too few output field names.'),c=c||i.map(Tn),f=function(p){for(var g=0,m=0,v,b;gt.modified(p.fields)),u|=h?t.MOD:0),t.visit(u,f),l.modifies(c)}});function mO(e){ln.call(this,null,TK,e)}Se(mO,ln);function TK(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 vO(e){ln.call(this,null,RK,e)}Se(vO,ln);function RK(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function yO(e){J.call(this,null,e)}Se(yO,J,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function qk(e){Hu.call(this,e)}qk.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:Ug,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};Se(qk,Hu,{_transform:Hu.prototype.transform,transform(e,t){return this._transform(NK(e,t),t)}});function NK(e,t){const n=e.field,r=e.value,i=(e.op==="count"?"__count__":e.op)||"sum",s=Lr(n).concat(Lr(r)),o=LK(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=>OK(a,n,r,s)),as:o.map(a=>a+""),modified:e.modified.bind(e)}}function OK(e,t,n,r){return Ti(i=>t(i)===e?n(i):NaN,r,e+"")}function LK(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(Qd),t?i.slice(0,t):i}function bO(e){_y.call(this,e)}Se(bO,_y,{transform(e,t){const n=e.subflow,r=e.field,i=s=>this.subflow(Ye(s),n,t,s);return(e.modified("field")||r&&t.modified(Lr(r)))&&ne("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(Gt(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 Wk(e){J.call(this,null,e)}Wk.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};Se(Wk,J,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=lO(e.fields,e.as||[]),s=r?(a,u)=>IK(a,u,r,i):hy;let o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,a=>{const u=Ye(a);n.rem.push(o[u]),o[u]=null}),t.visit(t.ADD,a=>{const u=s(a,Gt({}));o[Ye(a)]=u,n.add.push(u)}),t.visit(t.MOD,a=>{n.mod.push(s(a,o[Ye(a)]))}),n}});function IK(e,t,n,r){for(let i=0,s=n.length;i{const d=uk(f,l);for(let h=0;h{const s=Ye(i);n.rem.push(r[s]),r[s]=null}),t.visit(t.ADD,i=>{const s=sk(i);r[Ye(i)]=s,n.add.push(s)}),t.visit(t.MOD,i=>{const s=r[Ye(i)];for(const o in i)s[o]=i[o],n.modifies(o);n.mod.push(s)})),n}});function Gk(e){J.call(this,[],e),this.count=0}Gk.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};Se(Gk,J,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.modified("size"),i=e.size,s=this.value.reduce((c,f)=>(c[Ye(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[Ye(f)]&&n.rem.push(f),o[d]=c)),++a}if(t.rem.length&&(t.visit(t.REM,c=>{const f=Ye(c);s[f]&&(s[f]=-1,n.rem.push(c)),--a}),o=o.filter(c=>s[Ye(c)]!==-1)),(t.rem.length||r)&&o.length{s[Ye(c)]||l(c)}),u=-1),r&&o.length>i){const c=o.length-i;for(let f=0;f{s[Ye(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=o.filter(c=>!s[Ye(c)])),this.count=a,this.value=n.source=o,n}});function Yk(e){J.call(this,null,e)}Yk.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"}]};Se(Yk,J,{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=Gi(e.start,e.stop,e.step||1).map(i=>{const s={};return s[r]=i,Gt(s)}),n.add=t.add.concat(this.value),n}});function wO(e){J.call(this,null,e),this.modified(!0)}Se(wO,J,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function Vk(e){J.call(this,null,e)}const EO=["unit0","unit1"];Vk.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:KA,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:EO}]};Se(Vk,J,{transform(e,t){const n=e.field,r=e.interval!==!1,i=e.timezone==="utc",s=this._floor(e,t),o=(i?sh:ih)(s.unit).offset,a=e.as||EO,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(Lr(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}:hN({extent:e.extent||Vo(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),s=ZA(r),o=this.value||{},a=(n?iN:rN)(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 AO(e){J.call(this,eh(),e)}Se(AO,J,{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 kO(e){J.call(this,null,e)}Se(kO,J,{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(Zc(e.sort)):t.source).map(e.field))}});function BK(e,t,n,r){const i=Kp[e](t,n);return{init:i.init||bu,update:function(s,o){o[r]=i.next(s)}}}const Kp={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=Kp.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||ne("ntile num must be greater than zero.");const n=Kp.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||ne("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=zK(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}};function zK(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],b=i[g]||null,x=Tn(m),_=tO(p,x,s[g]);if(h(m),o.push(_),Le(Kp,p))a.push(BK(p,m,v,_));else{if(m==null&&p!=="count"&&ne("Null aggregate field specified."),p==="count"){c.push(_);return}d=!1;let w=l[x];w||(w=l[x]=[],w.field=m,f.push(w)),w.push(nO(p,b,_))}}),(c.length||f.length)&&(this.cell=UK(f,c,d)),this.inputs=Object.keys(u)}const CO=SO.prototype;CO.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};CO.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;oiO(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 SO(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?yd:Math.acos(e)}function $5(e){return e>=1?E1:e<=-1?-E1:Math.asin(e)}const iw=Math.PI,sw=2*iw,Bl=1e-6,XK=sw-Bl;function FO(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return FO;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iBl)if(!(Math.abs(f*u-l*c)>Bl)||!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),b=Math.sqrt(d),x=s*Math.tan((iw-Math.acos((g+d-m)/(2*v*b)))/2),_=x/b,w=x/v;Math.abs(_-1)>Bl&&this._append`L${t+_*c},${n+_*f}`,this._append`A${s},${s},0,0,${+(f*h>c*p)},${this._x1=t+w*u},${this._y1=n+w*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)>Bl||Math.abs(this._y1-c)>Bl)&&this._append`L${l},${c}`,r&&(d<0&&(d=d%sw+sw),d>XK?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>Bl&&this._append`A${r},${r},0,${+(d>=iw)},${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 wy(){return new Kk}wy.prototype=Kk.prototype;function Ey(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 Kk(t)}function ZK(e){return e.innerRadius}function JK(e){return e.outerRadius}function QK(e){return e.startAngle}function eZ(e){return e.endAngle}function tZ(e){return e&&e.padAngle}function nZ(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*dT*T+k*k&&(S=$,C=M),{cx:S,cy:C,x01:-c,y01:-f,x11:S*(i/w-1),y11:C*(i/w-1)}}function rZ(){var e=ZK,t=JK,n=Xt(0),r=null,i=QK,s=eZ,o=tZ,a=null,u=Ey(l);function l(){var c,f,d=+e.apply(this,arguments),h=+t.apply(this,arguments),p=i.apply(this,arguments)-E1,g=s.apply(this,arguments)-E1,m=C5(g-p),v=g>p;if(a||(a=c=u()),hDr))a.moveTo(0,0);else if(m>$O-Dr)a.moveTo(h*$l(p),h*_o(p)),a.arc(0,0,h,p,g,!v),d>Dr&&(a.moveTo(d*$l(g),d*_o(g)),a.arc(0,0,d,g,p,v));else{var b=p,x=g,_=p,w=g,A=m,E=m,S=o.apply(this,arguments)/2,C=S>Dr&&(r?+r.apply(this,arguments):Zl(d*d+h*h)),$=j2(C5(h-d)/2,+n.apply(this,arguments)),M=$,N=$,L,T;if(C>Dr){var k=$5(C/d*_o(S)),F=$5(C/h*_o(S));(A-=k*2)>Dr?(k*=v?1:-1,_+=k,w-=k):(A=0,_=w=(p+g)/2),(E-=F*2)>Dr?(F*=v?1:-1,b+=F,x-=F):(E=0,b=x=(p+g)/2)}var I=h*$l(b),B=h*_o(b),O=d*$l(w),j=d*_o(w);if($>Dr){var Y=h*$l(x),te=h*_o(x),ce=d*$l(_),Ae=d*_o(_),ge;if(mDr?N>Dr?(L=j0(ce,Ae,I,B,h,N,v),T=j0(Y,te,O,j,h,N,v),a.moveTo(L.cx+L.x01,L.cy+L.y01),N<$?a.arc(L.cx,L.cy,N,$r(L.y01,L.x01),$r(T.y01,T.x01),!v):(a.arc(L.cx,L.cy,N,$r(L.y01,L.x01),$r(L.y11,L.x11),!v),a.arc(0,0,h,$r(L.cy+L.y11,L.cx+L.x11),$r(T.cy+T.y11,T.cx+T.x11),!v),a.arc(T.cx,T.cy,N,$r(T.y11,T.x11),$r(T.y01,T.x01),!v))):(a.moveTo(I,B),a.arc(0,0,h,b,x,!v)):a.moveTo(I,B),!(d>Dr)||!(A>Dr)?a.lineTo(O,j):M>Dr?(L=j0(O,j,Y,te,d,-M,v),T=j0(I,B,ce,Ae,d,-M,v),a.lineTo(L.cx+L.x01,L.cy+L.y01),M<$?a.arc(L.cx,L.cy,M,$r(L.y01,L.x01),$r(T.y01,T.x01),!v):(a.arc(L.cx,L.cy,M,$r(L.y01,L.x01),$r(L.y11,L.x11),!v),a.arc(0,0,d,$r(L.cy+L.y11,L.cx+L.x11),$r(T.cy+T.y11,T.cx+T.x11),v),a.arc(T.cx,T.cy,M,$r(T.y11,T.x11),$r(T.y01,T.x01),!v))):a.arc(0,0,d,w,_,v)}if(a.closePath(),c)return a=null,c+""||null}return l.centroid=function(){var c=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,f=(+i.apply(this,arguments)+ +s.apply(this,arguments))/2-yd/2;return[$l(f)*c,_o(f)*c]},l.innerRadius=function(c){return arguments.length?(e=typeof c=="function"?c:Xt(+c),l):e},l.outerRadius=function(c){return arguments.length?(t=typeof c=="function"?c:Xt(+c),l):t},l.cornerRadius=function(c){return arguments.length?(n=typeof c=="function"?c:Xt(+c),l):n},l.padRadius=function(c){return arguments.length?(r=c==null?null:typeof c=="function"?c:Xt(+c),l):r},l.startAngle=function(c){return arguments.length?(i=typeof c=="function"?c:Xt(+c),l):i},l.endAngle=function(c){return arguments.length?(s=typeof c=="function"?c:Xt(+c),l):s},l.padAngle=function(c){return arguments.length?(o=typeof c=="function"?c:Xt(+c),l):o},l.context=function(c){return arguments.length?(a=c??null,l):a},l}function DO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function MO(e){this._context=e}MO.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(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;default:this._context.lineTo(e,t);break}}};function Zk(e){return new MO(e)}function TO(e){return e[0]}function RO(e){return e[1]}function NO(e,t){var n=Xt(!0),r=null,i=Zk,s=null,o=Ey(a);e=typeof e=="function"?e:e===void 0?TO:Xt(e),t=typeof t=="function"?t:t===void 0?RO:Xt(t);function a(u){var l,c=(u=DO(u)).length,f,d=!1,h;for(r==null&&(s=i(h=o())),l=0;l<=c;++l)!(l=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}v&&(x[d]=+e(m,d,f),_[d]=+t(m,d,f),a.point(r?+r(m,d,f):x[d],n?+n(m,d,f):_[d]))}if(b)return a=null,b+""||null}function c(){return NO().defined(i).curve(o).context(s)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Xt(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Xt(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Xt(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Xt(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Xt(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Xt(+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:Xt(!!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 iZ={draw(e,t){const n=Zl(t/yd);e.moveTo(n,0),e.arc(0,0,n,0,$O)}};function sZ(e,t){let n=null,r=Ey(i);e=typeof e=="function"?e:Xt(e||iZ),t=typeof t=="function"?t:Xt(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:Xt(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:Xt(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function Gu(){}function A1(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 Ay(e){this._context=e}Ay.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:A1(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:A1(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oZ(e){return new Ay(e)}function LO(e){this._context=e}LO.prototype={areaStart:Gu,areaEnd:Gu,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:A1(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function aZ(e){return new LO(e)}function IO(e){this._context=e}IO.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:A1(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function uZ(e){return new IO(e)}function PO(e,t){this._basis=new Ay(e),this._beta=t}PO.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 lZ=(function e(t){function n(r){return t===1?new Ay(r):new PO(r,t)}return n.beta=function(r){return e(+r)},n})(.85);function k1(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 Jk(e,t){this._context=e,this._k=(1-t)/6}Jk.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:k1(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:k1(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 cZ=(function e(t){function n(r){return new Jk(r,t)}return n.tension=function(r){return e(+r)},n})(0);function Qk(e,t){this._context=e,this._k=(1-t)/6}Qk.prototype={areaStart:Gu,areaEnd:Gu,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:k1(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 fZ=(function e(t){function n(r){return new Qk(r,t)}return n.tension=function(r){return e(+r)},n})(0);function eS(e,t){this._context=e,this._k=(1-t)/6}eS.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:k1(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 dZ=(function e(t){function n(r){return new eS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function tS(e,t,n){var r=e._x1,i=e._y1,s=e._x2,o=e._y2;if(e._l01_a>Dr){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>Dr){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 BO(e,t){this._context=e,this._alpha=t}BO.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:tS(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 hZ=(function e(t){function n(r){return t?new BO(r,t):new Jk(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function zO(e,t){this._context=e,this._alpha=t}zO.prototype={areaStart:Gu,areaEnd:Gu,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:tS(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 pZ=(function e(t){function n(r){return t?new zO(r,t):new Qk(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function jO(e,t){this._context=e,this._alpha=t}jO.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:tS(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 gZ=(function e(t){function n(r){return t?new jO(r,t):new eS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function UO(e){this._context=e}UO.prototype={areaStart:Gu,areaEnd:Gu,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 mZ(e){return new UO(e)}function F5(e){return e<0?-1:1}function D5(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(F5(s)+F5(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function M5(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function U2(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 S1(e){this._context=e}S1.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:U2(this,this._t0,M5(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,U2(this,M5(this,n=D5(this,e,t)),n);break;default:U2(this,this._t0,n=D5(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function qO(e){this._context=new WO(e)}(qO.prototype=Object.create(S1.prototype)).point=function(e,t){S1.prototype.point.call(this,t,e)};function WO(e){this._context=e}WO.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 vZ(e){return new S1(e)}function yZ(e){return new qO(e)}function HO(e){this._context=e}HO.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=T5(e),i=T5(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 xZ(e){return new ky(e,.5)}function _Z(e){return new ky(e,0)}function wZ(e){return new ky(e,1)}function Pu(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 EZ=()=>typeof Image<"u"?Image:null;function sa(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function cl(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 ow=Symbol("implicit");function nS(){var e=new XF,t=[],n=[],r=ow;function i(s){let o=e.get(s);if(o===void 0){if(r!==ow)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 XF;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 nS(t,n).unknown(r)},sa.apply(i,arguments),i}function ah(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qg(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function fl(){}var kc=.7,bd=1/kc,Uf="\\s*([+-]?\\d+)\\s*",Zp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",AZ=/^#([0-9a-f]{3,8})$/,kZ=new RegExp(`^rgb\\(${Uf},${Uf},${Uf}\\)$`),SZ=new RegExp(`^rgb\\(${jo},${jo},${jo}\\)$`),CZ=new RegExp(`^rgba\\(${Uf},${Uf},${Uf},${Zp}\\)$`),$Z=new RegExp(`^rgba\\(${jo},${jo},${jo},${Zp}\\)$`),FZ=new RegExp(`^hsl\\(${Zp},${jo},${jo}\\)$`),DZ=new RegExp(`^hsla\\(${Zp},${jo},${jo},${Zp}\\)$`),R5={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};ah(fl,Jp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:N5,formatHex:N5,formatHex8:MZ,formatHsl:TZ,formatRgb:O5,toString:O5});function N5(){return this.rgb().formatHex()}function MZ(){return this.rgb().formatHex8()}function TZ(){return GO(this).formatHsl()}function O5(){return this.rgb().formatRgb()}function Jp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=AZ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?L5(t):n===3?new er(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?U0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?U0(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=kZ.exec(e))?new er(t[1],t[2],t[3],1):(t=SZ.exec(e))?new er(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=CZ.exec(e))?U0(t[1],t[2],t[3],t[4]):(t=$Z.exec(e))?U0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=FZ.exec(e))?B5(t[1],t[2]/100,t[3]/100,1):(t=DZ.exec(e))?B5(t[1],t[2]/100,t[3]/100,t[4]):R5.hasOwnProperty(e)?L5(R5[e]):e==="transparent"?new er(NaN,NaN,NaN,0):null}function L5(e){return new er(e>>16&255,e>>8&255,e&255,1)}function U0(e,t,n,r){return r<=0&&(e=t=n=NaN),new er(e,t,n,r)}function rS(e){return e instanceof fl||(e=Jp(e)),e?(e=e.rgb(),new er(e.r,e.g,e.b,e.opacity)):new er}function Yu(e,t,n,r){return arguments.length===1?rS(e):new er(e,t,n,r??1)}function er(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ah(er,Yu,qg(fl,{brighter(e){return e=e==null?bd:Math.pow(bd,e),new er(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kc:Math.pow(kc,e),new er(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new er(ac(this.r),ac(this.g),ac(this.b),C1(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:I5,formatHex:I5,formatHex8:RZ,formatRgb:P5,toString:P5}));function I5(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}`}function RZ(){return`#${Jl(this.r)}${Jl(this.g)}${Jl(this.b)}${Jl((isNaN(this.opacity)?1:this.opacity)*255)}`}function P5(){const e=C1(this.opacity);return`${e===1?"rgb(":"rgba("}${ac(this.r)}, ${ac(this.g)}, ${ac(this.b)}${e===1?")":`, ${e})`}`}function C1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ac(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jl(e){return e=ac(e),(e<16?"0":"")+e.toString(16)}function B5(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Gs(e,t,n,r)}function GO(e){if(e instanceof Gs)return new Gs(e.h,e.s,e.l,e.opacity);if(e instanceof fl||(e=Jp(e)),!e)return new Gs;if(e instanceof Gs)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 Gs(o,a,u,e.opacity)}function $1(e,t,n,r){return arguments.length===1?GO(e):new Gs(e,t,n,r??1)}function Gs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ah(Gs,$1,qg(fl,{brighter(e){return e=e==null?bd:Math.pow(bd,e),new Gs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kc:Math.pow(kc,e),new Gs(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 er(q2(e>=240?e-240:e+120,i,r),q2(e,i,r),q2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Gs(z5(this.h),q0(this.s),q0(this.l),C1(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=C1(this.opacity);return`${e===1?"hsl(":"hsla("}${z5(this.h)}, ${q0(this.s)*100}%, ${q0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function z5(e){return e=(e||0)%360,e<0?e+360:e}function q0(e){return Math.max(0,Math.min(1,e||0))}function q2(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 YO=Math.PI/180,VO=180/Math.PI,F1=18,XO=.96422,KO=1,ZO=.82521,JO=4/29,qf=6/29,QO=3*qf*qf,NZ=qf*qf*qf;function e7(e){if(e instanceof Uo)return new Uo(e.l,e.a,e.b,e.opacity);if(e instanceof Na)return t7(e);e instanceof er||(e=rS(e));var t=Y2(e.r),n=Y2(e.g),r=Y2(e.b),i=W2((.2225045*t+.7168786*n+.0606169*r)/KO),s,o;return t===n&&n===r?s=o=i:(s=W2((.4360747*t+.3850649*n+.1430804*r)/XO),o=W2((.0139322*t+.0971045*n+.7141733*r)/ZO)),new Uo(116*i-16,500*(s-i),200*(i-o),e.opacity)}function D1(e,t,n,r){return arguments.length===1?e7(e):new Uo(e,t,n,r??1)}function Uo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ah(Uo,D1,qg(fl,{brighter(e){return new Uo(this.l+F1*(e??1),this.a,this.b,this.opacity)},darker(e){return new Uo(this.l-F1*(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=XO*H2(t),e=KO*H2(e),n=ZO*H2(n),new er(G2(3.1338561*t-1.6168667*e-.4906146*n),G2(-.9787684*t+1.9161415*e+.033454*n),G2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function W2(e){return e>NZ?Math.pow(e,1/3):e/QO+JO}function H2(e){return e>qf?e*e*e:QO*(e-JO)}function G2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Y2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function OZ(e){if(e instanceof Na)return new Na(e.h,e.c,e.l,e.opacity);if(e instanceof Uo||(e=e7(e)),e.a===0&&e.b===0)return new Na(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 o7(e,t){return function(n){return e+n*t}}function IZ(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 $y(e,t){var n=t-e;return n?o7(e,n>180||n<-180?n-360*Math.round(n/360):n):Cy(isNaN(e)?t:e)}function PZ(e){return(e=+e)==1?tr:function(t,n){return n-t?IZ(t,n,e):Cy(isNaN(t)?n:t)}}function tr(e,t){var n=t-e;return n?o7(e,n):Cy(isNaN(e)?t:e)}const uw=(function e(t){var n=PZ(t);function r(i,s){var o=n((i=Yu(i)).r,(s=Yu(s)).r),a=n(i.g,s.g),u=n(i.b,s.b),l=tr(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 a7(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:Ws(r,i)})),n=V2.lastIndex;return n180?c+=360:c-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ws(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:Ws(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:Ws(l,f)},{i:g-2,x:Ws(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 fJ(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?dJ:fJ,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),Ws)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,fw),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=Wg,c()},f.clamp=function(d){return arguments.length?(o=d?!0:wi,c()):o!==wi},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 y7(){return Fy()(wi,wi)}function b7(e,t,n,r){var i=Wu(e,t,n),s;switch(r=Ac(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=HR(i,o))&&(r.precision=s),VA(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=GR(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=WR(i))&&(r.precision=s-(r.type==="%")*2);break}}return iy(r)}function Jc(e){var t=e.domain;return e.ticks=function(n){var r=t();return W_(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return b7(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=H_(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 x7(){var e=y7();return e.copy=function(){return Hg(e,x7())},sa.apply(e,arguments),Jc(e)}function _7(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,fw),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return _7(e).unknown(t)},e=arguments.length?Array.from(e,fw):[0,1],Jc(n)}function w7(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 vJ(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 X5(e){return(t,n)=>-e(-t,n)}function uS(e){const t=e(Y5,V5),n=t.domain;let r=10,i,s;function o(){return i=vJ(r),s=mJ(r),n()[0]<0?(i=X5(i),s=X5(s),e(hJ,pJ)):e(Y5,V5),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=Ac(u)).precision==null&&(u.trim=!0),u=iy(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(w7(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),t}function E7(){const e=uS(Fy()).domain([1,10]);return e.copy=()=>Hg(e,E7()).base(e.base()),sa.apply(e,arguments),e}function K5(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Z5(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function lS(e){var t=1,n=e(K5(t),Z5(t));return n.constant=function(r){return arguments.length?e(K5(t=+r),Z5(t)):t},Jc(n)}function A7(){var e=lS(Fy());return e.copy=function(){return Hg(e,A7()).constant(e.constant())},sa.apply(e,arguments)}function J5(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function yJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function bJ(e){return e<0?-e*e:e*e}function cS(e){var t=e(wi,wi),n=1;function r(){return n===1?e(wi,wi):n===.5?e(yJ,bJ):e(J5(n),J5(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Jc(t)}function fS(){var e=cS(Fy());return e.copy=function(){return Hg(e,fS()).exponent(e.exponent())},sa.apply(e,arguments),e}function xJ(){return fS.apply(null,arguments).exponent(.5)}function k7(){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 S7().domain([e,t]).range(i).unknown(s)},sa.apply(Jc(o),arguments)}function C7(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[qu(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 C7().domain(e).range(t).unknown(n)},sa.apply(i,arguments)}function _J(e){return new Date(e)}function wJ(e){return e instanceof Date?+e:+new Date(+e)}function dS(e,t,n,r,i,s,o,a,u,l){var c=y7(),f=c.invert,d=c.domain,h=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),v=l("%a %d"),b=l("%b %d"),x=l("%B"),_=l("%Y");function w(A){return(u(A)0?r:1:0}const IJ="identity",xd="linear",Xa="log",Gg="pow",Yg="sqrt",Ty="symlog",Sc="time",Cc="utc",qo="sequential",uh="diverging",_d="quantile",Ry="quantize",Ny="threshold",vS="ordinal",hw="point",R7="band",yS="bin-ordinal",Xn="continuous",Vg="discrete",Xg="discretizing",Ds="interpolating",bS="temporal";function PJ(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 xS(){const e=nS().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,qu(h,g)-1),b=g===m?v:qu(h,m)-1,g-h[v]>s+1e-10&&++v,d&&(x=v,v=p-b,b=p-x),v>b?void 0:t().slice(v,b+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return xS().domain(t()).range(r).round(o).paddingInner(a).paddingOuter(u).align(l)},c()}function N7(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return N7(t())},e}function zJ(){return N7(xS().paddingInner(1))}var jJ=Array.prototype.map;function UJ(e){return jJ.call(e,Nr)}const qJ=Array.prototype.slice;function O7(){let e=[],t=[];function n(r){return r==null||r!==r?void 0:t[(qu(e,r)-1)%t.length]}return n.domain=function(r){return arguments.length?(e=UJ(r),n):e.slice()},n.range=function(r){return arguments.length?(t=qJ.call(r),n):t.slice()},n.tickFormat=function(r,i){return b7(e[0],Nt(e),r??10,i)},n.copy=function(){return O7().domain(n.domain()).range(n.range())},n}const T1=new Map,L7=Symbol("vega_scale");function I7(e){return e[L7]=!0,e}function Q5(e){return e&&e[L7]===!0}function WJ(e,t,n){const r=function(){const s=t();return s.invertRange||(s.invertRange=s.invert?PJ(s):s.invertExtent?BJ(s):void 0),s.type=e,I7(s)};return r.metadata=ro(Me(n)),r}function Wt(e,t,n){return arguments.length>1?(T1.set(e,WJ(e,t,n)),this):P7(e)?T1.get(e):void 0}Wt(IJ,_7);Wt(xd,x7,Xn);Wt(Xa,E7,[Xn,Xa]);Wt(Gg,fS,Xn);Wt(Yg,xJ,Xn);Wt(Ty,A7,Xn);Wt(Sc,EJ,[Xn,bS]);Wt(Cc,AJ,[Xn,bS]);Wt(qo,hS,[Xn,Ds]);Wt(`${qo}-${xd}`,hS,[Xn,Ds]);Wt(`${qo}-${Xa}`,$7,[Xn,Ds,Xa]);Wt(`${qo}-${Gg}`,pS,[Xn,Ds]);Wt(`${qo}-${Yg}`,kJ,[Xn,Ds]);Wt(`${qo}-${Ty}`,F7,[Xn,Ds]);Wt(`${uh}-${xd}`,D7,[Xn,Ds]);Wt(`${uh}-${Xa}`,M7,[Xn,Ds,Xa]);Wt(`${uh}-${Gg}`,gS,[Xn,Ds]);Wt(`${uh}-${Yg}`,SJ,[Xn,Ds]);Wt(`${uh}-${Ty}`,T7,[Xn,Ds]);Wt(_d,k7,[Xg,_d]);Wt(Ry,S7,Xg);Wt(Ny,C7,Xg);Wt(yS,O7,[Vg,Xg]);Wt(vS,nS,Vg);Wt(R7,xS,Vg);Wt(hw,zJ,Vg);function P7(e){return T1.has(e)}function Qc(e,t){const n=T1.get(e);return n&&n.metadata[t]}function _S(e){return Qc(e,Xn)}function wd(e){return Qc(e,Vg)}function pw(e){return Qc(e,Xg)}function B7(e){return Qc(e,Xa)}function HJ(e){return Qc(e,bS)}function z7(e){return Qc(e,Ds)}function j7(e){return Qc(e,_d)}const GJ=["clamp","base","constant","exponent"];function U7(e,t){const n=t[0],r=Nt(t)-n;return function(i){return e(n+i*r)}}function Oy(e,t,n){return aS(wS(t||"rgb",n),e)}function q7(e,t){const n=new Array(t),r=t+1;for(let i=0;ie[a]?o[a](e[a]()):0),o)}function wS(e,t){const n=uJ[YJ(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function YJ(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const VJ={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"},XJ={accent:$J,category10:CJ,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:FJ,observable10:DJ,paired:MJ,pastel1:TJ,pastel2:RJ,set1:NJ,set2:OJ,set3:LJ,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function H7(e){if(oe(e))return e;const t=e.length/6|0,n=new Array(t);for(let r=0;rOy(H7(e)));function ES(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(eD[e]=t,this):eD[e]}const Im="symbol",KJ="discrete",ZJ="gradient",JJ=e=>oe(e)?e.map(t=>String(t)):String(e),QJ=(e,t)=>e[1]-t[1],eQ=(e,t)=>t[1]-e[1];function AS(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(Bg(e.domain())/n||1)+1))),Fe(t)&&(r=t.step,t=t.interval),De(t)&&(t=e.type===Sc?ih(t):e.type==Cc?sh(t):ne("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function Y7(e,t,n){let r=e.range(),i=r[0],s=Nt(r),o=QJ;if(i>s&&(r=s,s=i,i=r,o=eQ),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 kS(e,t){return e.bins?Y7(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function V7(e,t,n,r,i,s){const o=t.type;let a=JJ;if(o===Sc||i===Sc)a=e.timeFormat(r);else if(o===Cc||i===Cc)a=e.utcFormat(r);else if(B7(o)){const u=e.formatFloat(r);if(s||t.bins)a=u;else{const l=X7(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 X7(e,t,n){const r=kS(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;ogw[e.type]||e.bins;function J7(e,t,n,r,i,s,o){const a=K7[t.type]&&s!==Sc&&s!==Cc?tQ(e,t,i):V7(e,t,n,i,s,o);return r===Im&&iQ(t)?sQ(a):r===KJ?oQ(a):aQ(a)}const sQ=e=>(t,n,r)=>{const i=tD(r[n+1],tD(r.max,1/0)),s=nD(t,e),o=nD(i,e);return s&&o?s+" – "+o:o?"< "+o:"≥ "+s},tD=(e,t)=>e??t,oQ=e=>(t,n)=>n?e(t):null,aQ=e=>t=>e(t),nD=(e,t)=>Number.isFinite(e)?t(e):null;function uQ(e){const t=e.domain(),n=t.length-1;let r=+t[0],i=+Nt(t),s=i-r;if(e.type===Ny){const o=n?s/n:.1;r-=o,i+=o,s=i-r}return o=>(o-r)/s}function lQ(e,t,n,r){const i=r||t.type;return De(n)&&HJ(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&i===Sc?e.timeFormat("%A, %d %B %Y, %X"):!n&&i===Cc?e.utcFormat("%A, %d %B %Y, %X UTC"):J7(e,t,5,null,n,r,!0)}function Q7(e,t,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=lQ(e,t,n.format,n.formatType);if(pw(t.type)){const s=Z7(t).slice(1).map(i),o=s.length;return`${o} boundar${o===1?"y":"ies"}: ${s.join(", ")}`}else if(wd(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 e9=0;function cQ(){e9=0}const R1="p_";function SS(e){return e&&e.gradient}function t9(e,t,n){const r=e.gradient;let i=e.id,s=r==="radial"?R1:"";return i||(i=e.id="gradient_"+e9++,r==="radial"?(e.x1=wo(e.x1,.5),e.y1=wo(e.y1,.5),e.r1=wo(e.r1,0),e.x2=wo(e.x2,.5),e.y2=wo(e.y2,.5),e.r2=wo(e.r2,.5),s=R1):(e.x1=wo(e.x1,0),e.y1=wo(e.y1,0),e.x2=wo(e.x2,1),e.y2=wo(e.y2,0))),t[i]=e,"url("+(n||"")+"#"+s+i+")"}function wo(e,t){return e??t}function n9(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 rD={basis:{curve:oZ},"basis-closed":{curve:aZ},"basis-open":{curve:uZ},bundle:{curve:lZ,tension:"beta",value:.85},cardinal:{curve:cZ,tension:"tension",value:0},"cardinal-open":{curve:dZ,tension:"tension",value:0},"cardinal-closed":{curve:fZ,tension:"tension",value:0},"catmull-rom":{curve:hZ,tension:"alpha",value:.5},"catmull-rom-closed":{curve:pZ,tension:"alpha",value:.5},"catmull-rom-open":{curve:gZ,tension:"alpha",value:.5},linear:{curve:Zk},"linear-closed":{curve:mZ},monotone:{horizontal:yZ,vertical:vZ},natural:{curve:bZ},step:{curve:xZ},"step-after":{curve:wZ},"step-before":{curve:_Z}};function CS(e,t,n){var r=Le(rD,e)&&rD[e],i=null;return r&&(i=r.curve||r[t||"vertical"],r.tension&&n!=null&&(i=i[r.tension](n))),i}const fQ={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},dQ=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,hQ=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,pQ=/^((\s+,?\s*)|(,\s*))/,gQ=/^[01]/;function Ed(e){const t=[];return(e.match(dQ)||[]).forEach(r=>{let i=r[0];const s=i.toLowerCase(),o=fQ[s],a=mQ(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,b=-f/r,x=d/r,_=m*a+v*u,w=b*a+x*u,A=m*e+v*t,E=b*e+x*t;let C=1/((A-_)*(A-_)+(E-w)*(E-w))-.25;C<0&&(C=0);let $=Math.sqrt(C);s==i&&($=-$);const M=.5*(_+A)-$*(E-w),N=.5*(w+E)+$*(A-_),L=Math.atan2(w-N,_-M);let k=Math.atan2(E-N,A-M)-L;k<0&&s===1?k+=No:k>0&&s===0&&(k-=No);const F=Math.ceil(Math.abs(k/(ql+.001))),I=[];for(let B=0;B+e}function H0(e,t,n){return Math.max(t,Math.min(e,n))}function s9(){var e=wQ,t=EQ,n=AQ,r=kQ,i=ya(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),b=Math.min(m,v)/2,x=H0(+i.call(this,c),0,b),_=H0(+s.call(this,c),0,b),w=H0(+o.call(this,c),0,b),A=H0(+a.call(this,c),0,b);if(u||(u=h=wy()),x<=0&&_<=0&&w<=0&&A<=0)u.rect(p,g,m,v);else{var E=p+m,S=g+v;u.moveTo(p+x,g),u.lineTo(E-_,g),u.bezierCurveTo(E-cu*_,g,E,g+cu*_,E,g+_),u.lineTo(E,S-A),u.bezierCurveTo(E,S-cu*A,E-cu*A,S,E-A,S),u.lineTo(p+w,S),u.bezierCurveTo(p+cu*w,S,p,S-cu*w,p,S-w),u.lineTo(p,g+x),u.bezierCurveTo(p,g+cu*x,p+cu*x,g,p+x,g),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(e=ya(c),l):e},l.y=function(c){return arguments.length?(t=ya(c),l):t},l.width=function(c){return arguments.length?(n=ya(c),l):n},l.height=function(c){return arguments.length?(r=ya(c),l):r},l.cornerRadius=function(c,f,d,h){return arguments.length?(i=ya(c),s=f!=null?ya(f):i,a=d!=null?ya(d):i,o=h!=null?ya(h):s,l):i},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function o9(){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),b=(g/=v)*u,x=(m/=v)*u,_=Math.atan2(m,g);i.moveTo(o-b,a-x),i.lineTo(f-g*p,d-m*p),i.arc(f,d,p,_-Math.PI,_),i.lineTo(o+b,a+x),i.arc(o,a,u,_,_+Math.PI)}else i.arc(f,d,p,0,No);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=wy()),d=0;d<=h;++d)!(de.x||0,Jg=e=>e.y||0,SQ=e=>e.width||0,CQ=e=>e.height||0,$Q=e=>(e.x||0)+(e.width||0),FQ=e=>(e.y||0)+(e.height||0),DQ=e=>e.startAngle||0,MQ=e=>e.endAngle||0,TQ=e=>e.padAngle||0,RQ=e=>e.innerRadius||0,NQ=e=>e.outerRadius||0,OQ=e=>e.cornerRadius||0,LQ=e=>Kg(e.cornerRadiusTopLeft,e.cornerRadius)||0,IQ=e=>Kg(e.cornerRadiusTopRight,e.cornerRadius)||0,PQ=e=>Kg(e.cornerRadiusBottomRight,e.cornerRadius)||0,BQ=e=>Kg(e.cornerRadiusBottomLeft,e.cornerRadius)||0,zQ=e=>Kg(e.size,64),jQ=e=>e.size||1,Ly=e=>e.defined!==!1,UQ=e=>i9(e.shape||"circle"),qQ=rZ().startAngle(DQ).endAngle(MQ).padAngle(TQ).innerRadius(RQ).outerRadius(NQ).cornerRadius(OQ),WQ=OO().x(Zg).y1(Jg).y0(FQ).defined(Ly),HQ=OO().y(Jg).x1(Zg).x0($Q).defined(Ly),GQ=NO().x(Zg).y(Jg).defined(Ly),YQ=s9().x(Zg).y(Jg).width(SQ).height(CQ).cornerRadius(LQ,IQ,PQ,BQ),VQ=sZ().type(UQ).size(zQ),XQ=o9().x(Zg).y(Jg).defined(Ly).size(jQ);function $S(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function KQ(e,t){return qQ.context(e)(t)}function ZQ(e,t){const n=t[0],r=n.interpolate||"linear";return(n.orient==="horizontal"?HQ:WQ).curve(CS(r,n.orient,n.tension)).context(e)(t)}function JQ(e,t){const n=t[0],r=n.interpolate||"linear";return GQ.curve(CS(r,n.orient,n.tension)).context(e)(t)}function lh(e,t,n,r){return YQ.context(e)(t,n,r)}function QQ(e,t){return(t.mark.shape||t.shape).context(e)(t)}function eee(e,t){return VQ.context(e)(t)}function tee(e,t){return XQ.context(e)(t)}var a9=1;function u9(){a9=1}function FS(e,t,n){var r=t.clip,i=e._defs,s=t.clip_id||(t.clip_id="clip"+a9++),o=i.clipping[s]||(i.clipping[s]={id:s});return ht(r)?o.path=r(null):$S(n)?o.path=lh(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+s+")"}function zn(e){this.clear(),e&&this.union(e)}zn.prototype={clone(){return new zn(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 Iy(e){this.mark=e,this.bounds=this.bounds||new zn}function Py(e){Iy.call(this,e),this.items=this.items||[]}Se(Py,Iy);class l9{constructor(t){this._pending=0,this._loader=t||cy()}pending(){return this._pending}sanitizeURL(t){const n=this;return aD(n),n._loader.sanitize(t,{context:"href"}).then(r=>(Nh(n),r)).catch(()=>(Nh(n),null))}loadImage(t){const n=this,r=EZ();return aD(n),n._loader.sanitize(t,{context:"image"}).then(i=>{const s=i.href;if(!s||!r)throw{url:s};const o=new r,a=Le(i,"crossOrigin")?i.crossOrigin:"anonymous";return a!=null&&(o.crossOrigin=a),o.onload=()=>Nh(n),o.onerror=()=>Nh(n),o.src=s,o}).catch(i=>(Nh(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 aD(e){e._pending+=1}function Nh(e){e._pending-=1}function eu(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const r=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(r+(n?nee(t,r):0))}return e}function nee(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const ree=No-1e-8;let By,Pm,Bm,Ql,mw,zm,vw,yw;const Eu=(e,t)=>By.add(e,t),jm=(e,t)=>Eu(Pm=e,Bm=t),uD=e=>Eu(e,By.y1),lD=e=>Eu(By.x1,e),Wl=(e,t)=>mw*e+vw*t,Hl=(e,t)=>zm*e+yw*t,J2=(e,t)=>Eu(Wl(e,t),Hl(e,t)),Q2=(e,t)=>jm(Wl(e,t),Hl(e,t));function Qg(e,t){return By=e,t?(Ql=t*Vu,mw=yw=Math.cos(Ql),zm=Math.sin(Ql),vw=-zm):(mw=yw=1,Ql=zm=vw=0),iee}const iee={beginPath(){},closePath(){},moveTo:Q2,lineTo:Q2,rect(e,t,n,r){Ql?(J2(e+n,t),J2(e+n,t+r),J2(e,t+r),Q2(e,t)):(Eu(e+n,t+r),jm(e,t))},quadraticCurveTo(e,t,n,r){const i=Wl(e,t),s=Hl(e,t),o=Wl(n,r),a=Hl(n,r);cD(Pm,i,o,uD),cD(Bm,s,a,lD),jm(o,a)},bezierCurveTo(e,t,n,r,i,s){const o=Wl(e,t),a=Hl(e,t),u=Wl(n,r),l=Hl(n,r),c=Wl(i,s),f=Hl(i,s);fD(Pm,o,u,c,uD),fD(Bm,a,l,f,lD),jm(c,f)},arc(e,t,n,r,i,s){if(r+=Ql,i+=Ql,Pm=n*Math.cos(i)+e,Bm=n*Math.sin(i)+t,Math.abs(i-r)>ree)Eu(e-n,t-n),Eu(e+n,t+n);else{const o=l=>Eu(n*Math.cos(l)+e,n*Math.sin(l)+t);let a,u;if(o(r),o(i),i!==r)if(r=r%No,r<0&&(r+=No),i=i%No,i<0&&(i+=No),ii;++u,a-=ql)o(a);else for(a=r-r%ql+ql,u=0;u<4&&avQ?(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=d9(e,t,t.fill),!0):!1}var oee=[];function kd(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=d9(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||oee),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function aee(e,t){return e.zindex-t.zindex||e.index-t.index}function TS(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 RS(e){return function(t,n,r){so(n,i=>{(!r||r.intersects(i.bounds))&&h9(e,t,i,i)})}}function uee(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&h9(e,t,n.items[0],n.items)}}function h9(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(Ad(t,n),n.fill&&N1(t,n,i)&&t.fill(),n.stroke&&kd(t,n,i)&&t.stroke()))}function zy(e){return e=e||Qi,function(t,n,r,i,s,o){return r*=t.pixelRatio,i*=t.pixelRatio,O1(n,a=>{const u=a.bounds;if(!(u&&!u.contains(s,o)||!u)&&e(t,a,r,i,s,o))return a})}}function e0(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 NS(e){return zy(e0(e))}function lc(e,t){return"translate("+e+","+t+")"}function OS(e){return"rotate("+e+")"}function lee(e,t){return"scale("+e+","+t+")"}function p9(e){return lc(e.x||0,e.y||0)}function cee(e){return lc(e.x||0,e.y||0)+(e.angle?" "+OS(e.angle):"")}function fee(e){return lc(e.x||0,e.y||0)+(e.angle?" "+OS(e.angle):"")+(e.scaleX||e.scaleY?" "+lee(e.scaleX||1,e.scaleY||1):"")}function LS(e,t,n){function r(o,a){o("transform",cee(a)),o("d",t(null,a))}function i(o,a){return t(Qg(o,a.angle),a),eu(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*=Vu),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:RS(s),pick:NS(s),isect:n||DS(s)}}var dee=LS("arc",KQ);function hee(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 yee(e,t){e("transform",p9(t))}function v9(e,t){const n=m9(t);e("d",lh(null,t,n,n))}function bee(e,t){e("class","background"),e("aria-hidden",!0),v9(e,t)}function xee(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?v9(e,t):e("d","")}function _ee(e,t,n){const r=t.clip?FS(n,t,t):null;e("clip-path",r)}function wee(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&&(tg(e,i,s,o),Ad(e,i),i.fill&&N1(e,i,u)&&e.fill(),i.stroke&&!a&&kd(e,i,u)&&e.stroke()),e.save(),e.translate(s,o),i.clip&&g9(e,i),n&&n.translate(-s,-o),so(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&&(tg(e,i,s,o),Ad(e,i),kd(e,i,u)&&e.stroke())})}function Cee(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 O1(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&&$S(u)&&!kee(e,u,o,a))return e.restore(),null;const m=u.strokeForeground,v=t.interactive!==!1;return v&&m&&u.stroke&&Aee(e,u,o,a)?(e.restore(),u):(l=O1(u,b=>$ee(b,c,f)?this.pick(b,n,r,c,f):null),!l&&v&&(u.fill||!m&&u.stroke)&&Eee(e,u,o,a)&&(l=u),e.restore(),l||null)})}function $ee(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var Fee={type:"group",tag:"g",nested:!1,attr:yee,bound:wee,draw:See,pick:Cee,isect:c9,content:_ee,background:bee,foreground:xee},ng={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function PS(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 BS(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 zS(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 jy(e,t){return e==="center"?t/2:e==="right"?t:0}function Uy(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function Dee(e,t,n){const r=PS(t,n),i=BS(t,r),s=zS(t,r),o=(t.x||0)-jy(t.align,i),a=(t.y||0)-Uy(t.baseline,s),u=!r.src&&r.toDataURL?r.toDataURL():r.src||"";e("href",u,ng["xmlns:xlink"],"xlink:href"),e("transform",lc(o,a)),e("width",i),e("height",s),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function Mee(e,t){const n=t.image,r=BS(t,n),i=zS(t,n),s=(t.x||0)-jy(t.align,r),o=(t.y||0)-Uy(t.baseline,i);return e.set(s,o,s+r,o+i)}function Tee(e,t,n){so(t,r=>{if(n&&!n.intersects(r.bounds))return;const i=PS(r,this);let s=BS(r,i),o=zS(r,i);if(s===0||o===0)return;let a=(r.x||0)-jy(r.align,s),u=(r.y||0)-Uy(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&&y9(e,r,i)&&(Ad(e,r),e.stroke())}})}function Wee(e,t,n,r){return e.isPointInStroke?y9(e,t,1)&&e.isPointInStroke(n,r):!1}var Hee={type:"rule",tag:"line",nested:!1,attr:jee,bound:Uee,draw:qee,pick:zy(Wee),isect:f9},Gee=LS("shape",QQ),Yee=LS("symbol",eee,MS);const gD=SR();var Ki={height:aa,measureWidth:jS,estimateWidth:L1,width:L1,canvas:b9};b9(!0);function b9(e){Ki.width=e&&Bu?jS:L1}function L1(e,t){return x9(Ku(e,t),aa(e))}function x9(e,t){return~~(.8*e.length*t)}function jS(e,t){return aa(e)<=0||!(t=Ku(e,t))?0:_9(t,qy(e))}function _9(e,t){const n=`(${t}) ${e}`;let r=gD.get(n);return r===void 0&&(Bu.font=t,r=Bu.measureText(e).width,gD.set(n,r)),r}function aa(e){return e.fontSize!=null?+e.fontSize||0:11}function Xu(e){return e.lineHeight!=null?e.lineHeight:aa(e)+2}function Vee(e){return oe(e)?e.length>1?e:e[0]:e}function t0(e){return Vee(e.lineBreak&&e.text&&!oe(e.text)?e.text.split(e.lineBreak):e.text)}function US(e){const t=t0(e);return(oe(t)?t.length-1:0)*Xu(e)}function Ku(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?Kee(e,n):n}function Xee(e){if(Ki.width===jS){const t=qy(e);return n=>_9(n,t)}else if(Ki.width===L1){const t=aa(e);return n=>x9(n,t)}else return t=>Ki.width(e,t)}function Kee(e,t){var n=+e.limit,r=Xee(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,Ki.width(t,h)),0)):f=Ki.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*Vu,o,a);else if(n===2)return e.rotatedPoints(t.angle*Vu,o,a);return e}function Qee(e,t,n){so(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=qy(r),e.textAlign=r.align||"left",s=Wy(r),o=s.x1,a=s.y1,r.angle&&(e.save(),e.translate(o,a),e.rotate(r.angle*Vu),o=a=0),o+=r.dx||0,a+=(r.dy||0)+qS(r),c=t0(r),Ad(e,r),oe(c))for(l=Xu(r),u=0;ut;)e.removeChild(n[--r]);return e}function C9(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Hy(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function ste(e,t,n,r){var i=e&&e.mark,s,o;if(i&&(s=ns[i.marktype]).tip){for(o=Hy(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 GS=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||cy(),this._tooltip=n||ote}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=Au(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=ste(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 ote(e,t,n,r){e.element().setAttribute("title",r||"")}class r0{constructor(t){this._el=null,this._bgcolor=null,this._loader=new l9(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 ate="keydown",ute="keypress",lte="keyup",$9="dragenter",qm="dragleave",F9="dragover",_w="pointerdown",cte="pointerup",I1="pointermove",Wm="pointerout",D9="pointerover",ww="mousedown",fte="mouseup",M9="mousemove",P1="mouseout",T9="mouseover",B1="click",dte="dblclick",hte="wheel",R9="mousewheel",z1="touchstart",j1="touchmove",U1="touchend",pte=[ate,ute,lte,$9,qm,F9,_w,cte,I1,Wm,D9,ww,fte,M9,P1,T9,B1,dte,hte,R9,z1,j1,U1],Ew=I1,Fp=P1,Aw=B1;class i0 extends GS{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=pte,this.pointermove=bD([I1,M9],[D9,T9],[Wm,P1]),this.dragover=bD([F9],[$9],[qm]),this.pointerout=xD([Wm,P1]),this.dragleave=xD([qm])}initialize(t,n,r){return this._canvas=t&&HS(t,"canvas"),[B1,ww,_w,I1,Wm,qm].forEach(i=>yD(this,i)),super.initialize(t,n,r)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(R9,t)}pointerdown(t){this._down=this._active,this.fire(_w,t)}mousedown(t){this._down=this._active,this.fire(ww,t)}click(t){this._down===this._active&&(this.fire(B1,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(z1,t,!0)}touchmove(t){this.fire(j1,t,!0)}touchend(t){this.fire(U1,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===Aw&&i&&i.href?this.handleHref(n,i,i.href):(t===Ew||t===Fp)&&this.handleTooltip(n,i,t!==Fp),s)for(let o=0,a=s.length;o=0&&i.splice(s,1),this}pickEvent(t){const n=Hy(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 ns[t.marktype].pick.call(this,o,t,n,r,i,s)}}const gte=e=>e===z1||e===j1||e===U1?[z1,j1,U1]:[e];function yD(e,t){gte(t).forEach(n=>mte(e,n))}function mte(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 op(e,t,n){t.forEach(r=>e.fire(r,n))}function bD(e,t,n){return function(r){const i=this._active,s=this.pickEvent(r);s===i?op(this,e,r):((!i||!i.exit)&&op(this,n,r),this._active=s,op(this,t,r),op(this,e,r))}}function xD(e){return function(t){op(this,e,t),this._active=null}}function vte(){return typeof window<"u"&&window.devicePixelRatio||1}function yte(e,t,n,r,i,s){const o=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,a=e.getContext("2d"),u=o?vte():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 q1 extends r0{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new zn,this._tempb=new zn}initialize(t,n,r,i,s,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Pu(1,1,this._options.type),t&&this._canvas&&(ds(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)yte(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const s=this._options.externalContext;s||ne("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=bte(i,s,o);r.save();const l=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):xte(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=ns[n.marktype];n.clip&&vee(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 bte=(e,t,n)=>new zn().set(0,0,t,n).translate(-e[0],-e[1]);function xte(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 N9 extends GS{constructor(t,n){super(t,n);const r=this;r._hrefHandler=ex(r,(i,s)=>{s&&s.href&&r.handleHref(i,s,s.href)}),r._tooltipHandler=ex(r,(i,s)=>{r.handleTooltip(i,s,i.type!==Fp)})}initialize(t,n,r){let i=this._svg;return i&&(i.removeEventListener(Aw,this._hrefHandler),i.removeEventListener(Ew,this._tooltipHandler),i.removeEventListener(Fp,this._tooltipHandler)),this._svg=i=t&&HS(t,"svg"),i&&(i.addEventListener(Aw,this._hrefHandler),i.addEventListener(Ew,this._tooltipHandler),i.addEventListener(Fp,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:ex(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 ex=(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)},O9="aria-hidden",YS="aria-label",VS="role",XS="aria-roledescription",L9="graphics-object",KS="graphics-symbol",I9=(e,t,n)=>({[VS]:e,[XS]:t,[YS]:n||void 0}),_te=ro(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),_D={axis:{desc:"axis",caption:Ate},legend:{desc:"legend",caption:kte},"title-text":{desc:"title",caption:e=>`Title text '${ED(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${ED(e)}'`}},wD={ariaRole:VS,ariaRoleDescription:XS,description:YS};function P9(e,t){const n=t.aria===!1;if(e(O9,n||void 0),n||t.description==null)for(const r in wD)e(wD[r],void 0);else{const r=t.mark.marktype;e(YS,t.description),e(VS,t.ariaRole||(r==="group"?L9:KS)),e(XS,t.ariaRoleDescription||`${r} mark`)}}function B9(e){return e.aria===!1?{[O9]:!0}:_te[e.role]?null:_D[e.role]?Ete(e,_D[e.role]):wte(e)}function wte(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(r=>r.description!=null&&r.aria!==!1);return I9(n?L9:KS,`${t} mark container`,e.description)}function Ete(e,t){try{const n=e.items[0],r=t.caption||(()=>"");return I9(t.role||KS,t.desc,n.description||r(n))}catch{return null}}function ED(e){return Me(e.text).join(" ")}function Ate(e){const t=e.datum,n=e.orient,r=t.title?z9(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 ${wd(a)?"discrete":a} scale with ${Q7(o,s,e)}`}function kte(e){const t=e.datum,n=t.title?z9(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 Cte(r)+(n?` titled '${n}'`:"")+` for ${Ste(s)} with ${Q7(u,a,e)}`}function z9(e){try{return Me(Nt(e.items).items[0].text).join(" ")}catch{return null}}function Ste(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 Cte(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const j9=e=>(e+"").replace(/&/g,"&").replace(//g,">"),$te=e=>j9(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function ZS(){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}="${$te(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+=j9(u),a),toString:()=>e};return a}const U9=e=>q9(ZS(),e)+"";function q9(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,kD(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=ns[o],u=n.interactive===!1?"none":null,l=a.tag==="g",c=SD(n,t,r,"g",s);if(o!=="group"&&i!=null&&!i.includes(o))return ds(c,0),n._svg;c.setAttribute("class",C9(n));const f=B9(n);for(const g in f)Vr(c,g,f[g]);l||Vr(c,"pointer-events",u),Vr(c,"clip-path",n.clip?FS(this,n,n.group):null);let d=null,h=0;const p=g=>{const m=this.isDirty(g),v=SD(g,c,d,a.tag,s);m&&(this._update(a,v,g),l&&Mte(this,v,g,i)),d=v,++h};return a.nested?n.items.length&&p(n.items[0]):so(n,p),ds(c,h),c}_update(t,n,r){Oa=n,Tr=n.__values__,P9(Dp,r),t.attr(Dp,r,this);const i=Rte[t.type];i&&i.call(this,t,n,r),Oa&&this.style(Oa,r)}style(t,n){if(n!=null){for(const r in W1){let i=r==="font"?n0(n):n[r];if(i===Tr[r])continue;const s=W1[r];i==null?t.removeAttribute(s):(SS(i)&&(i=t9(i,this._defs.gradient,H9())),t.setAttribute(s,i+"")),Tr[r]=i}for(const r in H1)Hm(t,H1[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=qn(t,Oh+1,"defs",Un)),i=Fte(r,n.gradient[s],i);for(const s in n.clipping)r||(n.el=r=qn(t,Oh+1,"defs",Un)),i=Dte(r,n.clipping[s],i);r&&(i===0?(t.removeChild(r),n.el=null):ds(r,i))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function kD(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 Fte(e,t,n){let r,i,s;if(t.gradient==="radial"){let o=qn(e,n++,"pattern",Un);ku(o,{id:R1+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=qn(o,0,"rect",Un),ku(o,{width:1,height:1,fill:`url(${H9()}#${t.id})`}),e=qn(e,n++,"radialGradient",Un),ku(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=qn(e,n++,"linearGradient",Un),ku(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}),ds(t,1+s)}function SD(e,t,n,r,i){let s=e._svg,o;if(!s&&(o=t.ownerDocument,s=Au(o,r,Un),e._svg=s,e.mark&&(s.__data__=e,s.__values__={fill:"default"},r==="g"))){const a=Au(o,"path",Un);s.appendChild(a),a.__data__=e;const u=Au(o,"g",Un);s.appendChild(u),u.__data__=e;const l=Au(o,"path",Un);s.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(s.ownerSVGElement!==i||Tte(s,n))&&t.insertBefore(s,n?n.nextSibling:t.firstChild),s}function Tte(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let Oa=null,Tr=null;const Rte={group(e,t,n){const r=Oa=t.childNodes[2];Tr=r.__values__,e.foreground(Dp,n,this),Tr=t.__values__,Oa=t.childNodes[1],e.content(Dp,n,this);const i=Oa=t.childNodes[0];e.background(Dp,n,this);const s=n.mark.interactive===!1?"none":null;if(s!==Tr.events&&(Vr(r,"pointer-events",s),Vr(i,"pointer-events",s),Tr.events=s),n.strokeForeground&&n.stroke){const o=n.fill;Vr(r,"display",null),this.style(i,n),Vr(i,"stroke",null),o&&(n.fill=null),Tr=r.__values__,this.style(r,n),o&&(n.fill=o),Oa=null}else Vr(r,"display","none")},image(e,t,n){n.smooth===!1?(Hm(t,"image-rendering","optimizeSpeed"),Hm(t,"image-rendering","pixelated")):Hm(t,"image-rendering",null)},text(e,t,n){const r=t0(n);let i,s,o,a;oe(r)?(s=r.map(u=>Ku(n,u)),i=s.join(` `),i!==Tr.text&&(ds(t,0),o=t.ownerDocument,a=Xu(n),s.forEach((u,l)=>{const c=Au(o,"tspan",Un);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",a)),t.appendChild(c)}),Tr.text=i)):(s=Ku(n,r),s!==Tr.text&&(t.textContent=s,Tr.text=s)),Vr(t,"font-family",n0(n)),Vr(t,"font-size",aa(n)+"px"),Vr(t,"font-style",n.fontStyle),Vr(t,"font-variant",n.fontVariant),Vr(t,"font-weight",n.fontWeight)}};function Dp(e,t,n){t!==Tr[e]&&(n?Nte(Oa,e,t,n):Vr(Oa,e,t),Tr[e]=t)}function Hm(e,t,n){n!==Tr[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),Tr[t]=n)}function ku(e,t){for(const n in t)Vr(e,n,t[n])}function Vr(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function Nte(e,t,n,r){n!=null?e.setAttributeNS(r,t,n):e.removeAttributeNS(r,t)}function H9(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class G9 extends r0{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=ZS();n.open("svg",dt({},ng,{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",W9,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const r=ns[n.marktype],i=r.tag,s=[P9,r.attr];t.open("g",{class:C9(n),"clip-path":n.clip?FS(this,n,n.group):null},B9(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=t0(a);if(oe(l)){const c={x:0,dy:Xu(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]):so(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&&Ote(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:R1+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!Us.svgMarkTypes.includes(s));this._svgRenderer.render(t,Us.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 Us.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class Y9 extends i0{constructor(t,n){super(t,n)}initialize(t,n,r){const i=qn(qn(t,0,"div"),Us.svgOnTop?0:1,"div");return super.initialize(i,n,r)}}const V9="canvas",X9="hybrid",K9="png",Z9="svg",J9="none",Su={Canvas:V9,PNG:K9,SVG:Z9,Hybrid:X9,None:J9},$c={};$c[V9]=$c[K9]={renderer:q1,headless:q1,handler:i0};$c[Z9]={renderer:JS,headless:G9,handler:N9};$c[X9]={renderer:kw,headless:kw,handler:Y9};$c[J9]={};function Gy(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?($c[e]=t,this):$c[e]}function Q9(e,t,n){const r=[],i=new zn().union(t),s=e.marktype;return s?eL(e,i,n,r):s==="group"?tL(e,i,n,r):ne("Intersect scene must be mark node or group item.")}function eL(e,t,n,r){if(Ite(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],!QS(e[i],t[i],i))return!1;return typeof e==typeof t}function zte(){u9(),cQ()}const Sd="top",Ys="left",Xs="right",Zu="bottom",jte="top-left",Ute="top-right",qte="bottom-left",Wte="bottom-right",e3="start",Sw="middle",Xr="end",Hte="x",Gte="y",Yy="group",t3="axis",n3="title",Yte="frame",Vte="scope",r3="legend",sL="row-header",oL="row-footer",aL="row-title",uL="column-header",lL="column-footer",cL="column-title",Xte="padding",Kte="symbol",fL="fit",dL="fit-x",hL="fit-y",Zte="pad",i3="none",G0="all",Cw="each",s3="flush",Cu="column",$u="row";function pL(e){J.call(this,null,e)}Se(pL,J,{transform(e,t){const n=t.dataflow,r=e.mark,i=r.marktype,s=ns[i],o=s.bound;let a=r.bounds,u;if(s.nested)r.items.length&&n.dirty(r.items[0]),a=Y0(r,o),r.items.forEach(l=>{l.bounds.clear().union(a)});else if(i===Yy||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),a.clear(),r.items.forEach(l=>a.union(Y0(l,o))),r.role){case t3:case r3:case n3:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{a.union(Y0(l,o))}),t.visit(t.MOD,l=>{u=u||a.alignsWith(l.bounds),n.dirty(l),a.union(Y0(l,o))}),u&&(a.clear(),r.items.forEach(l=>a.union(l.bounds)));return rL(r),t.modifies("bounds")}});function Y0(e,t,n){return t(e.bounds.clear(),e,n)}const CD=":vega_identifier:";function o3(e){J.call(this,0,e)}o3.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};Se(o3,J,{transform(e,t){const n=Jte(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 Jte(e){return e._signals[CD]||(e._signals[CD]=e.add(0))}function gL(e){J.call(this,null,e)}Se(gL,J,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,Qte(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===Yy?Py:Iy;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 Qte(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 mL(e){J.call(this,null,e)}const $D={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((r,i)=>!i||!vL(n.bounds,r.bounds,t)?(n=r,1):r.opacity=0)}},vL=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),FD=(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},tne=(e,t,n)=>{var r=e.range(),i=new zn;return t===Sd||t===Zu?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)},DD=e=>(e.forEach(t=>t.opacity=1),e),MD=(e,t)=>e.reflow(t.modified()).modifies("opacity");Se(mL,J,{transform(e,t){const n=$D[e.method]||$D.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")&&(DD(i),t=MD(t,e)),t;if(i=i.filter(ene),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),s=DD(i),t=MD(t,e),s.length>=3&&FD(s,r)){do s=n(s,r);while(s.length>=3&&FD(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=tne(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 yL(e){J.call(this,null,e)}Se(yL,J,{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 Mr=new zn;function Of(e,t,n){return e[t]===n?0:(e[t]=n,1)}function nne(e){var t=e.items[0].orient;return t===Ys||t===Xs}function rne(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function ine(e,t,n,r){var i=t.items[0],s=i.datum,o=i.translate!=null?i.translate:.5,a=i.orient,u=rne(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&&US(p),b=0,x=0,_,w;switch(Mr.clear().union(m),m.clear(),(_=u[0])>-1&&m.union(i.items[_].bounds),(_=u[1])>-1&&m.union(i.items[_].bounds),a){case Sd:b=f||0,x=-c,w=Math.max(d,Math.min(h,-m.y1)),m.add(0,-w).add(l,0),p&&V0(e,p,w,g,v,0,-1,m);break;case Ys:b=-c,x=f||0,w=Math.max(d,Math.min(h,-m.x1)),m.add(-w,0).add(0,l),p&&V0(e,p,w,g,v,1,-1,m);break;case Xs:b=n+c,x=f||0,w=Math.max(d,Math.min(h,m.x2)),m.add(0,0).add(w,l),p&&V0(e,p,w,g,v,1,1,m);break;case Zu:b=f||0,x=r+c,w=Math.max(d,Math.min(h,m.y2)),m.add(0,0).add(l,w),p&&V0(e,p,w,g,0,0,1,m);break;default:b=i.x,x=i.y}return eu(m.translate(b,x),i),Of(i,"x",b+o)|Of(i,"y",x+o)&&(i.bounds=Mr,e.dirty(i),i.bounds=m,e.dirty(i)),i.mark.bounds.clear().union(m)}function V0(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 TD=(e,t)=>Math.floor(Math.min(e,t)),RD=(e,t)=>Math.ceil(Math.max(e,t));function sne(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&&(x[E]+=T/2);if(a&&vn(n.center,$u)&&c!==1)for(E=0;E0&&(_[E]+=k/2);for(E=0;Ei&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),g+=s,b=0,_=t.length;b<_;++b)e.dirty(t[b]),t[b].mark.bounds.clear();for(v=c,b=0,_=t.length;b<_;++b,v+=f){for(A=t[b],w=A.mark.bounds,x=v;x>=0&&(E=n[x])==null;x-=d);a?(S=h==null?E.x:Math.round(E.bounds.x1+h*E.bounds.width()),C=g):(S=g,C=h==null?E.y:Math.round(E.bounds.y1+h*E.bounds.height())),w.union(A.bounds.translate(S-(A.x||0),C-(A.y||0))),A.x=S,A.y=C,e.dirty(A),m=o(m,w[l])}return m}function OD(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 fne(e,t){const n=e[t]||{};return(r,i)=>n[r]!=null?n[r]:e[r]!=null?e[r]:i}function dne(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 hne(e,t,n,r,i,s,o){const a=fne(n,t),u=dne(e,a("offset",0)),l=a("anchor",e3),c=l===Xr?1:l===Sw?.5:0,f={align:Cw,bounds:a("bounds",s3),columns:a("direction")==="vertical"?1:e.length,padding:a("margin",8),center:a("center"),nodirty:!0};switch(t){case Ys:f.anchor={x:Math.floor(r.x1)-u,column:Xr,y:c*(o||r.height()+2*r.y1),row:l};break;case Xs:f.anchor={x:Math.ceil(r.x2)+u,y:c*(o||r.height()+2*r.y1),row:l};break;case Sd:f.anchor={y:Math.floor(i.y1)-u,row:Xr,x:c*(s||i.width()+2*i.x1),column:l};break;case Zu:f.anchor={y:Math.ceil(i.y2)+u,x:c*(s||i.width()+2*i.x1),column:l};break;case jte:f.anchor={x:u,y:u};break;case Ute:f.anchor={x:s-u,y:u,column:Xr};break;case qte:f.anchor={x:u,y:o-u,row:Xr};break;case Wte:f.anchor={x:s-u,y:o-u,column:Xr,row:Xr};break}return f}function pne(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(),mne(e,n,n.items[0].items[0]),s=gne(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===Kte&&vne(n.items[0].items[0].items[0].items),i!==i3&&(n.x=o=0,n.y=a=0),n.width=u,n.height=l,eu(s.set(o,a,o+u,a+l),n),n.mark.bounds.clear().union(s),n}function gne(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function mne(e,t,n){var r=t.padding,i=r-n.x,s=r-n.y;if(!t.datum.title)(i||s)&&Lh(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 Ys:i+=Math.ceil(o.bounds.width())+u;break;case Xs:case Zu:break;default:s+=o.bounds.height()+u}switch((i||s)&&Lh(e,n,i,s),o.orient){case Ys:c+=yf(t,n,o,a,1,1);break;case Xs:l+=yf(t,n,o,Xr,0,0)+u,c+=yf(t,n,o,a,1,1);break;case Zu:l+=yf(t,n,o,a,0,0),c+=yf(t,n,o,Xr,-1,0,1)+u;break;default:l+=yf(t,n,o,a,0,0)}(l||c)&&Lh(e,o,l,c),(l=Math.round(o.bounds.x1-r))<0&&(Lh(e,n,-l,0),Lh(e,o,-l,0))}}function yf(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:US(n);return Math.round(r===e3?f:r===Xr?d-h:.5*(c-h))}function Lh(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 vne(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 yne(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===Ys||a===Xs?r:n,p=0,g=0,m=0,v=0,b=0,x;if(o!==Yy?a===Ys?(p=i.y2,h=i.y1):a===Xs?(p=i.y1,h=i.y2):(p=i.x1,h=i.x2):a===Ys&&(p=r,h=0),x=u===e3?p:u===Xr?h:(p+h)/2,d&&d.text){switch(a){case Sd:case Zu:b=f.bounds.height()+c;break;case Ys:v=f.bounds.width()+c;break;case Xs:v=-f.bounds.width()-c;break}Mr.clear().union(d.bounds),Mr.translate(v-(d.x||0),b-(d.y||0)),Of(d,"x",v)|Of(d,"y",b)&&(e.dirty(d),d.bounds.clear().union(Mr),d.mark.bounds.clear().union(Mr),e.dirty(d)),Mr.clear().union(d.bounds)}else Mr.clear();switch(Mr.union(f.bounds),a){case Sd:g=x,m=i.y1-Mr.height()-l;break;case Ys:g=i.x1-Mr.width()-l,m=x;break;case Xs:g=i.x2+Mr.width()+l,m=x;break;case Zu:g=x,m=i.y2+l;break;default:g=s.x,m=s.y}return Of(s,"x",g)|Of(s,"y",m)&&(Mr.translate(g,m),e.dirty(s),s.bounds.clear().union(Mr),t.bounds.clear().union(Mr),e.dirty(s)),s.bounds}function xL(e){J.call(this,null,e)}Se(xL,J,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(r=>{e.layout&&une(n,r,e.layout),xne(n,r,e)}),bne(e.mark.group)?t.reflow():t}});function bne(e){return e&&e.mark.role!=="legend-entry"}function xne(e,t,n){var r=t.items,i=Math.max(0,t.width||0),s=Math.max(0,t.height||0),o=new zn().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||Xs,d!==i3&&(m[d]||(m[d]=[])).push(v)});for(const v in m){const b=m[v];bL(e,b,hne(b,v,n.legends,a,u,i,s))}l.forEach(v=>{const b=v.bounds;if(b.equals(v._bounds)||(v.bounds=v._bounds,e.dirty(v),v.bounds=b,e.dirty(v)),n.autosize&&(n.autosize.type===fL||n.autosize.type===dL||n.autosize.type===hL))switch(v.orient){case Ys:case Xs:o.add(b.x1,0).add(b.x2,0);break;case Sd:case Zu:o.add(0,b.y1).add(0,b.y2)}else o.union(b)})}o.union(a).union(u),c&&o.union(yne(e,c,i,s,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),_ne(e,t,o,n)}function _ne(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===Xte){const p=e.padding();o-=p.left+p.right,a-=p.top+p.bottom}s===i3?(l=0,f=0,u=o,c=a):s===fL?(u=Math.max(0,o-l-d),c=Math.max(0,a-f-h)):s===dL?(u=Math.max(0,o-l-d),a=c+f+h):s===hL?(o=u+l+d,c=Math.max(0,a-f-h)):s===Zte&&(o=u+l+d,a=c+f+h),e._resizeView(o,a,u,c,[l,f],i.resize)}const wne=Object.freeze(Object.defineProperty({__proto__:null,bound:pL,identifier:o3,mark:gL,overlap:mL,render:yL,viewlayout:xL},Symbol.toStringTag,{value:"Module"}));function _L(e){J.call(this,null,e)}Se(_L,J,{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=AS(s,o,e.minstep),u=e.format||V7(n,s,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Y7(s,e.values,a):kS(s,a);return i&&(r.rem=i),i=l.map((c,f)=>Gt({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&i.length&&i.push(Gt({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}});function wL(e){J.call(this,null,e)}function Ene(){return Gt({})}function Ane(e){const t=eh().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}Se(wL,J,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||Ene,s=e.key||Ye,o=this.value;return oe(r.encode)&&(r.encode=null),o&&(e.modified("key")||t.modified(s))&&ne("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=Ane(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 EL(e){J.call(this,null,e)}Se(EL,J,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,s=t.encode;if(oe(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||fu,u=i.enter||fu,l=i.exit||fu,c=(s&&!o?i[s]:a)||fu;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!==fu&&c!==a&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==fu&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),o||c!==fu){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 AL(e){J.call(this,[],e)}Se(AL,J,{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||Im,o=e.scale,a=+e.limit,u=AS(o,e.count==null?5:e.count,e.minstep),l=!!e.values||s===Im,c=e.format||J7(n,o,u,s,e.formatSpecifier,e.formatType,l),f=e.values||Z7(o,u),d,h,p,g,m;return i&&(r.rem=i),s===Im?(a&&f.length>a?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),i=f.slice(0,a-1),m=!0):i=f,ht(p=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),g=i.reduce((v,b)=>Math.max(v,p(b,e)),0)):p=qr(g=p||8),i=i.map((v,b)=>Gt({index:b,label:c(v,b,i),value:v,offset:g,size:p(v,e)})),m&&(m=f[i.length],i.push(Gt({index:i.length,label:`…${f.length-i.length} entries`,value:m,offset:g,size:p(m,e)})))):s===ZJ?(d=o.domain(),h=W7(o,d[0],Nt(d)),f.length<3&&!e.values&&d[0]!==Nt(d)&&(f=[d[0],Nt(d)]),i=f.map((v,b)=>Gt({index:b,label:c(v,b,f),value:v,perc:h(v)}))):(p=f.length-1,h=uQ(o),i=f.map((v,b)=>Gt({index:b,label:c(v,b,f),value:v,perc:b?h(v):0,perc2:b===p?1:h(f[b+1])}))),r.source=i,r.add=i,this.value=i,r}});const kne=e=>e.source.x,Sne=e=>e.source.y,Cne=e=>e.target.x,$ne=e=>e.target.y;function a3(e){J.call(this,{},e)}a3.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"}]};Se(a3,J,{transform(e,t){var n=e.sourceX||kne,r=e.sourceY||Sne,i=e.targetX||Cne,s=e.targetY||$ne,o=e.as||"path",a=e.orient||"vertical",u=e.shape||"line",l=LD.get(u+"-"+a)||LD.get(u);return l||ne("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 kL=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,Fne=(e,t,n,r)=>kL(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),SL=(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},Dne=(e,t,n,r)=>SL(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),CL=(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},Mne=(e,t,n,r)=>CL(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),Tne=(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,Rne=(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,Nne=(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},One=(e,t,n,r)=>{const i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},Lne=(e,t,n,r)=>{const i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},Ine=(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},LD=eh({line:kL,"line-radial":Fne,arc:SL,"arc-radial":Dne,curve:CL,"curve-radial":Mne,"orthogonal-horizontal":Tne,"orthogonal-vertical":Rne,"orthogonal-radial":Nne,"diagonal-horizontal":One,"diagonal-vertical":Lne,"diagonal-radial":Ine});function u3(e){J.call(this,null,e)}u3.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"]}]};Se(u3,J,{transform(e,t){var n=e.as||["startAngle","endAngle"],r=n[0],i=n[1],s=e.field||Kd,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)/UR(l),h=Gi(c),p,g,m;for(e.sort&&h.sort((v,b)=>l[v]-l[b]),p=0;p-1)return r;var i=t.domain,s=e.type,o=t.zero||t.zero===void 0&&Bne(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: "+Ee(t))}return t}function Gne(e,t,n){let r=t.bins;if(r&&!oe(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||ne("Scale bins parameter missing step property."),uo&&(l=a*Math.floor(o/a)),r=Gi(u,l+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===yS&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function Yne(e,t,n){var r=e.type,i=t.round||!1,s=t.range;if(t.rangeStep!=null)s=Vne(r,t,n);else if(t.scheme&&(s=Xne(r,t,n),ht(s))){if(e.interpolator)return e.interpolator(s);ne(`Scale type ${r} does not support interpolating color schemes.`)}if(s&&z7(r))return e.interpolator(Oy($w(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(wS(t.interpolate,t.interpolateGamma)):ht(e.round)?e.round(i):ht(e.rangeRound)&&e.interpolate(i?Wg:dl),s&&e.range($w(s,t.reverse))}function Vne(e,t,n){e!==R7&&e!==hw&&ne("Only band and point scales support rangeStep.");var r=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,i=e===hw?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*mS(n,i,r)]}function Xne(e,t,n){var r=t.schemeExtent,i,s;return oe(t.scheme)?s=Oy(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),s=ES(i),s||ne(`Unrecognized scheme name: ${t.scheme}`)),n=e===Ny?n+1:e===yS?n-1:e===_d||e===Ry?+t.schemeCount||Pne:n,z7(e)?ID(s,r,t.reverse):ht(s)?q7(ID(s,r),n):e===vS?s:s.slice(0,n)}function ID(e,t,n){return ht(e)&&(t||n)?U7(e,$w(t||[0,1],n)):e}function $w(e,t){return t?e.slice().reverse():e}function ML(e){J.call(this,null,e)}Se(ML,J,{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(Zc(e.sort)),this.modified(n),t}});const PD="zero",TL="center",RL="normalize",NL=["y0","y1"];function l3(e){J.call(this,null,e)}l3.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:PD,values:[PD,TL,RL]},{name:"as",type:"string",array:!0,length:2,default:NL}]};Se(l3,J,{transform(e,t){var n=e.as||NL,r=n[0],i=n[1],s=Zc(e.sort),o=e.field||Kd,a=e.offset===TL?Kne:e.offset===RL?Zne:Jne,u,l,c,f;for(u=Qne(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 ere=Object.freeze(Object.defineProperty({__proto__:null,axisticks:_L,datajoin:wL,encode:EL,legendentries:AL,linkpath:a3,pie:u3,scale:FL,sortitems:ML,stack:l3},Symbol.toStringTag,{value:"Module"}));var Ke=1e-6,G1=1e-12,wt=Math.PI,Dn=wt/2,Y1=wt/4,si=wt*2,Rn=180/wt,yt=wt/180,Rt=Math.abs,ch=Math.atan,Cs=Math.atan2,Ze=Math.cos,K0=Math.ceil,OL=Math.exp,Fw=Math.hypot,V1=Math.log,nx=Math.pow,Ve=Math.sin,gs=Math.sign||function(e){return e>0?1:e<0?-1:0},oi=Math.sqrt,c3=Math.tan;function LL(e){return e>1?0:e<-1?wt:Math.acos(e)}function $i(e){return e>1?Dn:e<-1?-Dn:Math.asin(e)}function br(){}function X1(e,t){e&&zD.hasOwnProperty(e.type)&&zD[e.type](e,t)}var BD={Feature:function(e,t){X1(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=Ze(t),o=Ve(t),a=Rw*o,u=Tw*s+a*Ze(i),l=a*r*Ve(i);K1.add(Cs(l,u)),Mw=e,Tw=s,Rw=o}function ire(e){return Z1=new ri,Fa(e,Jo),Z1*2}function J1(e){return[Cs(e[1],e[0]),$i(e[2])]}function Fc(e){var t=e[0],n=e[1],r=Ze(n);return[r*Ze(t),r*Ve(t),Ve(n)]}function Z0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Cd(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 rx(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function J0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Q1(e){var t=oi(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var An,bi,$n,Ui,zl,zL,jL,Wf,Mp,mu,Ka,Aa={point:Nw,lineStart:UD,lineEnd:qD,polygonStart:function(){Aa.point=qL,Aa.lineStart=sre,Aa.lineEnd=ore,Mp=new ri,Jo.polygonStart()},polygonEnd:function(){Jo.polygonEnd(),Aa.point=Nw,Aa.lineStart=UD,Aa.lineEnd=qD,K1<0?(An=-($n=180),bi=-(Ui=90)):Mp>Ke?Ui=90:Mp<-Ke&&(bi=-90),Ka[0]=An,Ka[1]=$n},sphere:function(){An=-($n=180),bi=-(Ui=90)}};function Nw(e,t){mu.push(Ka=[An=e,$n=e]),tUi&&(Ui=t)}function UL(e,t){var n=Fc([e*yt,t*yt]);if(Wf){var r=Cd(Wf,n),i=[r[1],-r[0],0],s=Cd(i,r);Q1(s),s=J1(s);var o=e-zl,a=o>0?1:-1,u=s[0]*Rn*a,l,c=Rt(o)>180;c^(a*zlUi&&(Ui=l)):(u=(u+360)%360-180,c^(a*zlUi&&(Ui=t))),c?eji(An,$n)&&($n=e):ji(e,$n)>ji(An,$n)&&(An=e):$n>=An?(e$n&&($n=e)):e>zl?ji(An,e)>ji(An,$n)&&($n=e):ji(e,$n)>ji(An,$n)&&(An=e)}else mu.push(Ka=[An=e,$n=e]);tUi&&(Ui=t),Wf=n,zl=e}function UD(){Aa.point=UL}function qD(){Ka[0]=An,Ka[1]=$n,Aa.point=Nw,Wf=null}function qL(e,t){if(Wf){var n=e-zl;Mp.add(Rt(n)>180?n+(n>0?360:-360):n)}else zL=e,jL=t;Jo.point(e,t),UL(e,t)}function sre(){Jo.lineStart()}function ore(){qL(zL,jL),Jo.lineEnd(),Rt(Mp)>Ke&&(An=-($n=180)),Ka[0]=An,Ka[1]=$n,Wf=null}function ji(e,t){return(t-=e)<0?t+360:t}function are(e,t){return e[0]-t[0]}function WD(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tji(r[0],r[1])&&(r[1]=i[1]),ji(i[0],r[1])>ji(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=ji(r[1],i[0]))>o&&(o=a,An=i[0],$n=r[1])}return mu=Ka=null,An===1/0||bi===1/0?[[NaN,NaN],[NaN,NaN]]:[[An,bi],[$n,Ui]]}var ap,ev,tv,nv,rv,iv,sv,ov,Ow,Lw,Iw,WL,HL,Kr,Zr,Jr,Ks={sphere:br,point:f3,lineStart:HD,lineEnd:GD,polygonStart:function(){Ks.lineStart=fre,Ks.lineEnd=dre},polygonEnd:function(){Ks.lineStart=HD,Ks.lineEnd=GD}};function f3(e,t){e*=yt,t*=yt;var n=Ze(t);s0(n*Ze(e),n*Ve(e),Ve(t))}function s0(e,t,n){++ap,tv+=(e-tv)/ap,nv+=(t-nv)/ap,rv+=(n-rv)/ap}function HD(){Ks.point=lre}function lre(e,t){e*=yt,t*=yt;var n=Ze(t);Kr=n*Ze(e),Zr=n*Ve(e),Jr=Ve(t),Ks.point=cre,s0(Kr,Zr,Jr)}function cre(e,t){e*=yt,t*=yt;var n=Ze(t),r=n*Ze(e),i=n*Ve(e),s=Ve(t),o=Cs(oi((o=Zr*s-Jr*i)*o+(o=Jr*r-Kr*s)*o+(o=Kr*i-Zr*r)*o),Kr*r+Zr*i+Jr*s);ev+=o,iv+=o*(Kr+(Kr=r)),sv+=o*(Zr+(Zr=i)),ov+=o*(Jr+(Jr=s)),s0(Kr,Zr,Jr)}function GD(){Ks.point=f3}function fre(){Ks.point=hre}function dre(){GL(WL,HL),Ks.point=f3}function hre(e,t){WL=e,HL=t,e*=yt,t*=yt,Ks.point=GL;var n=Ze(t);Kr=n*Ze(e),Zr=n*Ve(e),Jr=Ve(t),s0(Kr,Zr,Jr)}function GL(e,t){e*=yt,t*=yt;var n=Ze(t),r=n*Ze(e),i=n*Ve(e),s=Ve(t),o=Zr*s-Jr*i,a=Jr*r-Kr*s,u=Kr*i-Zr*r,l=Fw(o,a,u),c=$i(l),f=l&&-c/l;Ow.add(f*o),Lw.add(f*a),Iw.add(f*u),ev+=c,iv+=c*(Kr+(Kr=r)),sv+=c*(Zr+(Zr=i)),ov+=c*(Jr+(Jr=s)),s0(Kr,Zr,Jr)}function pre(e){ap=ev=tv=nv=rv=iv=sv=ov=0,Ow=new ri,Lw=new ri,Iw=new ri,Fa(e,Ks);var t=+Ow,n=+Lw,r=+Iw,i=Fw(t,n,r);return iwt&&(e-=Math.round(e/si)*si),[e,t]}Bw.invert=Bw;function YL(e,t,n){return(e%=si)?t||n?Pw(VD(e),XD(t,n)):VD(e):t||n?XD(t,n):Bw}function YD(e){return function(t,n){return t+=e,Rt(t)>wt&&(t-=Math.round(t/si)*si),[t,n]}}function VD(e){var t=YD(e);return t.invert=YD(-e),t}function XD(e,t){var n=Ze(e),r=Ve(e),i=Ze(t),s=Ve(t);function o(a,u){var l=Ze(u),c=Ze(a)*l,f=Ve(a)*l,d=Ve(u),h=d*n+c*r;return[Cs(f*i-h*s,c*n-d*r),$i(h*i+f*s)]}return o.invert=function(a,u){var l=Ze(u),c=Ze(a)*l,f=Ve(a)*l,d=Ve(u),h=d*i-f*s;return[Cs(f*i+d*s,c*n+h*r),$i(h*n-c*r)]},o}function gre(e){e=YL(e[0]*yt,e[1]*yt,e.length>2?e[2]*yt:0);function t(n){return n=e(n[0]*yt,n[1]*yt),n[0]*=Rn,n[1]*=Rn,n}return t.invert=function(n){return n=e.invert(n[0]*yt,n[1]*yt),n[0]*=Rn,n[1]*=Rn,n},t}function mre(e,t,n,r,i,s){if(n){var o=Ze(t),a=Ve(t),u=r*n;i==null?(i=t+r*si,s=t-u/2):(i=KD(o,i),s=KD(o,s),(r>0?is)&&(i+=r*si));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 Gm(e,t){return Rt(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 ZD(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n=0?1:-1,$=C*S,M=$>wt,N=m*A;if(u.add(Cs(N*C*Ve($),v*E+N*Ze($))),o+=M?S+C*si:S,M^p>=n^_>=n){var L=Cd(Fc(h),Fc(x));Q1(L);var T=Cd(s,L);Q1(T);var k=(M^S>=0?-1:1)*$i(T[2]);(r>k||r===k&&(L[0]||L[1]))&&(a+=M^S>=0?1:-1)}}return(o<-Ke||o0){for(u||(i.polygonStart(),u=!0),i.lineStart(),A=0;A1&&_&2&&w.push(w.pop().concat(w.shift())),c.push(w.filter(yre))}}return d}}function yre(e){return e.length>1}function bre(e,t){return((e=e.x)[0]<0?e[1]-Dn-Ke:Dn-e[1])-((t=t.x)[0]<0?t[1]-Dn-Ke:Dn-t[1])}const JD=KL(function(){return!0},xre,wre,[-wt,-Dn]);function xre(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(s,o){var a=s>0?wt:-wt,u=Rt(s-t);Rt(u-wt)0?Dn:-Dn),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(s,n),i=0):r!==a&&u>=wt&&(Rt(t-r)Ke?ch((Ve(t)*(s=Ze(r))*Ve(n)-Ve(r)*(i=Ze(t))*Ve(e))/(i*s*o)):(t+r)/2}function wre(e,t,n,r){var i;if(e==null)i=n*Dn,r.point(-wt,i),r.point(0,i),r.point(wt,i),r.point(wt,0),r.point(wt,-i),r.point(0,-i),r.point(-wt,-i),r.point(-wt,0),r.point(-wt,i);else if(Rt(e[0]-t[0])>Ke){var s=e[0]0,i=Rt(t)>Ke;function s(c,f,d,h){mre(h,e,n,d,c,f)}function o(c,f){return Ze(c)*Ze(f)>t}function a(c){var f,d,h,p,g;return{lineStart:function(){p=h=!1,g=1},point:function(m,v){var b=[m,v],x,_=o(m,v),w=r?_?0:l(m,v):_?l(m+(m<0?wt:-wt),v):0;if(!f&&(p=h=_)&&c.lineStart(),_!==h&&(x=u(f,b),(!x||Gm(f,x)||Gm(b,x))&&(b[2]=1)),_!==h)g=0,_?(c.lineStart(),x=u(b,f),c.point(x[0],x[1])):(x=u(f,b),c.point(x[0],x[1],2),c.lineEnd()),f=x;else if(i&&f&&r^_){var A;!(w&d)&&(A=u(b,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)))}_&&(!f||!Gm(f,b))&&c.point(b[0],b[1]),f=b,h=_,d=w},lineEnd:function(){h&&c.lineEnd(),f=null},clean:function(){return g|(p&&h)<<1}}}function u(c,f,d){var h=Fc(c),p=Fc(f),g=[1,0,0],m=Cd(h,p),v=Z0(m,m),b=m[0],x=v-b*b;if(!x)return!d&&c;var _=t*v/x,w=-t*b/x,A=Cd(g,m),E=J0(g,_),S=J0(m,w);rx(E,S);var C=A,$=Z0(E,C),M=Z0(C,C),N=$*$-M*(Z0(E,E)-1);if(!(N<0)){var L=oi(N),T=J0(C,(-$-L)/M);if(rx(T,E),T=J1(T),!d)return T;var k=c[0],F=f[0],I=c[1],B=f[1],O;F0^T[1]<(Rt(T[0]-k)wt^(k<=T[0]&&T[0]<=F)){var ce=J0(C,(-$+L)/M);return rx(ce,E),[T,J1(ce)]}}}function l(c,f){var d=r?e:wt-e,h=0;return c<-d?h|=1:c>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return KL(o,a,s,r?[0,-e]:[-wt,e-wt])}function Are(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 up=1e9,em=-up;function ZL(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 Rt(l[0]-e)0?0:3:Rt(l[0]-n)0?2:1:Rt(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=VL(),d,h,p,g,m,v,b,x,_,w,A,E={point:S,lineStart:N,lineEnd:L,polygonStart:$,polygonEnd:M};function S(k,F){i(k,F)&&c.point(k,F)}function C(){for(var k=0,F=0,I=h.length;Fr&&(Ae-te)*(r-ce)>(ge-ce)*(e-te)&&++k:ge<=r&&(Ae-te)*(r-ce)<(ge-ce)*(e-te)&&--k;return k}function $(){c=f,d=[],h=[],A=!0}function M(){var k=C(),F=A&&k,I=(d=jR(d)).length;(F||I)&&(l.polygonStart(),F&&(l.lineStart(),s(null,null,1,l),l.lineEnd()),I&&XL(d,a,k,s,l),l.polygonEnd()),c=l,d=h=p=null}function N(){E.point=T,h&&h.push(p=[]),w=!0,_=!1,b=x=NaN}function L(){d&&(T(g,m),v&&_&&f.rejoin(),d.push(f.result())),E.point=S,_&&c.lineEnd()}function T(k,F){var I=i(k,F);if(h&&p.push([k,F]),w)g=k,m=F,v=I,w=!1,I&&(c.lineStart(),c.point(k,F));else if(I&&_)c.point(k,F);else{var B=[b=Math.max(em,Math.min(up,b)),x=Math.max(em,Math.min(up,x))],O=[k=Math.max(em,Math.min(up,k)),F=Math.max(em,Math.min(up,F))];Are(B,O,e,t,n,r)?(_||(c.lineStart(),c.point(B[0],B[1])),c.point(O[0],O[1]),I||c.lineEnd(),A=!1):I&&(c.lineStart(),c.point(k,F),A=!1)}b=k,x=F,_=I}return E}}function QD(e,t,n){var r=Gi(e,t-Ke,n).concat(t);return function(i){return r.map(function(s){return[i,s]})}}function e4(e,t,n){var r=Gi(e,t-Ke,n).concat(t);return function(i){return r.map(function(s){return[s,i]})}}function kre(){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:b()}}function b(){return Gi(K0(r/c)*c,n,c).map(p).concat(Gi(K0(a/f)*f,o,f).map(g)).concat(Gi(K0(t/u)*u,e,u).filter(function(x){return Rt(x%c)>Ke}).map(d)).concat(Gi(K0(s/l)*l,i,l).filter(function(x){return Rt(x%f)>Ke}).map(h))}return v.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},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(x){return arguments.length?v.extentMajor(x).extentMinor(x):v.extentMinor()},v.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],o=+x[1][1],r>n&&(x=r,r=n,n=x),a>o&&(x=a,a=o,o=x),v.precision(m)):[[r,a],[n,o]]},v.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],s=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),s>i&&(x=s,s=i,i=x),v.precision(m)):[[t,s],[e,i]]},v.step=function(x){return arguments.length?v.stepMajor(x).stepMinor(x):v.stepMinor()},v.stepMajor=function(x){return arguments.length?(c=+x[0],f=+x[1],v):[c,f]},v.stepMinor=function(x){return arguments.length?(u=+x[0],l=+x[1],v):[u,l]},v.precision=function(x){return arguments.length?(m=+x,d=QD(s,i,90),h=e4(t,e,m),p=QD(a,o,90),g=e4(r,n,m),v):m},v.extentMajor([[-180,-90+Ke],[180,90-Ke]]).extentMinor([[-180,-80-Ke],[180,80+Ke]])}const rg=e=>e;var sx=new ri,zw=new ri,JL,QL,jw,Uw,Da={point:br,lineStart:br,lineEnd:br,polygonStart:function(){Da.lineStart=Sre,Da.lineEnd=$re},polygonEnd:function(){Da.lineStart=Da.lineEnd=Da.point=br,sx.add(Rt(zw)),zw=new ri},result:function(){var e=sx/2;return sx=new ri,e}};function Sre(){Da.point=Cre}function Cre(e,t){Da.point=eI,JL=jw=e,QL=Uw=t}function eI(e,t){zw.add(Uw*e-jw*t),jw=e,Uw=t}function $re(){eI(JL,QL)}var $d=1/0,av=$d,ig=-$d,uv=ig,lv={point:Fre,lineStart:br,lineEnd:br,polygonStart:br,polygonEnd:br,result:function(){var e=[[$d,av],[ig,uv]];return ig=uv=-(av=$d=1/0),e}};function Fre(e,t){e<$d&&($d=e),e>ig&&(ig=e),tuv&&(uv=t)}var qw=0,Ww=0,lp=0,cv=0,fv=0,Lf=0,Hw=0,Gw=0,cp=0,tI,nI,Oo,Lo,hs={point:Dc,lineStart:t4,lineEnd:n4,polygonStart:function(){hs.lineStart=Tre,hs.lineEnd=Rre},polygonEnd:function(){hs.point=Dc,hs.lineStart=t4,hs.lineEnd=n4},result:function(){var e=cp?[Hw/cp,Gw/cp]:Lf?[cv/Lf,fv/Lf]:lp?[qw/lp,Ww/lp]:[NaN,NaN];return qw=Ww=lp=cv=fv=Lf=Hw=Gw=cp=0,e}};function Dc(e,t){qw+=e,Ww+=t,++lp}function t4(){hs.point=Dre}function Dre(e,t){hs.point=Mre,Dc(Oo=e,Lo=t)}function Mre(e,t){var n=e-Oo,r=t-Lo,i=oi(n*n+r*r);cv+=i*(Oo+e)/2,fv+=i*(Lo+t)/2,Lf+=i,Dc(Oo=e,Lo=t)}function n4(){hs.point=Dc}function Tre(){hs.point=Nre}function Rre(){rI(tI,nI)}function Nre(e,t){hs.point=rI,Dc(tI=Oo=e,nI=Lo=t)}function rI(e,t){var n=e-Oo,r=t-Lo,i=oi(n*n+r*r);cv+=i*(Oo+e)/2,fv+=i*(Lo+t)/2,Lf+=i,i=Lo*e-Oo*t,Hw+=i*(Oo+e),Gw+=i*(Lo+t),cp+=i*3,Dc(Oo=e,Lo=t)}function iI(e){this._context=e}iI.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,si);break}}},result:br};var Yw=new ri,ox,sI,oI,fp,dp,sg={point:br,lineStart:function(){sg.point=Ore},lineEnd:function(){ox&&aI(sI,oI),sg.point=br},polygonStart:function(){ox=!0},polygonEnd:function(){ox=null},result:function(){var e=+Yw;return Yw=new ri,e}};function Ore(e,t){sg.point=aI,sI=fp=e,oI=dp=t}function aI(e,t){fp-=e,dp-=t,Yw.add(oi(fp*fp+dp*dp)),fp=e,dp=t}let r4,dv,i4,s4;class o4{constructor(t){this._append=t==null?uI:Lre(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!==i4||this._append!==dv){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`,i4=r,dv=this._append,s4=this._,this._=i}this._+=s4;break}}}result(){const t=this._;return this._="",t.length?t:null}}function uI(e){let t=1;this._+=e[0];for(const n=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return uI;if(t!==r4){const n=10**t;r4=t,dv=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 o4(n)),o},o.projection(e).digits(n).context(t)}function Vy(e){return function(t){var n=new Vw;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Vw(){}Vw.prototype={constructor:Vw,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 d3(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Fa(n,e.stream(lv)),t(lv.result()),r!=null&&e.clipExtent(r),e}function Xy(e,t,n){return d3(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 h3(e,t,n){return Xy(e,[[0,0],t],n)}function p3(e,t,n){return d3(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 g3(e,t,n){return d3(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 a4=16,Ire=Ze(30*yt);function u4(e,t){return+t?Bre(e,t):Pre(e)}function Pre(e){return Vy({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Bre(e,t){function n(r,i,s,o,a,u,l,c,f,d,h,p,g,m){var v=l-r,b=c-i,x=v*v+b*b;if(x>4*t&&g--){var _=o+d,w=a+h,A=u+p,E=oi(_*_+w*w+A*A),S=$i(A/=E),C=Rt(Rt(A)-1)t||Rt((v*L+b*T)/x-.5)>.3||o*d+a*h+u*p2?k[2]%360*yt:0,L()):[a*Rn,u*Rn,l*Rn]},M.angle=function(k){return arguments.length?(f=k%360*yt,L()):f*Rn},M.reflectX=function(k){return arguments.length?(d=k?-1:1,L()):d<0},M.reflectY=function(k){return arguments.length?(h=k?-1:1,L()):h<0},M.precision=function(k){return arguments.length?(A=u4(E,w=k*k),T()):oi(w)},M.fitExtent=function(k,F){return Xy(M,k,F)},M.fitSize=function(k,F){return h3(M,k,F)},M.fitWidth=function(k,F){return p3(M,k,F)},M.fitHeight=function(k,F){return g3(M,k,F)};function L(){var k=l4(n,0,0,d,h,f).apply(null,t(s,o)),F=l4(n,r-k[0],i-k[1],d,h,f);return c=YL(a,u,l),E=Pw(t,F),S=Pw(c,E),A=u4(E,w),T()}function T(){return C=$=null,M}return function(){return t=e.apply(this,arguments),M.invert=t.invert&&N,L()}}function m3(e){var t=0,n=wt/3,r=cI(e),i=r(t,n);return i.parallels=function(s){return arguments.length?r(t=s[0]*yt,n=s[1]*yt):[t*Rn,n*Rn]},i}function qre(e){var t=Ze(e);function n(r,i){return[r*t,Ve(i)/t]}return n.invert=function(r,i){return[r/t,$i(i*t)]},n}function Wre(e,t){var n=Ve(e),r=(n+Ve(t))/2;if(Rt(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=Hre([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+Ke,g+.12*h+Ke],[p-.214*h-Ke,g+.234*h-Ke]]).stream(l),a=o.translate([p-.205*h,g+.212*h]).clipExtent([[p-.214*h+Ke,g+.166*h+Ke],[p-.115*h-Ke,g+.234*h-Ke]]).stream(l),f()},c.fitExtent=function(d,h){return Xy(c,d,h)},c.fitSize=function(d,h){return h3(c,d,h)},c.fitWidth=function(d,h){return p3(c,d,h)},c.fitHeight=function(d,h){return g3(c,d,h)};function f(){return e=t=null,c}return c.scale(1070)}function dI(e){return function(t,n){var r=Ze(t),i=Ze(n),s=e(r*i);return s===1/0?[2,0]:[s*i*Ve(t),s*Ve(n)]}}function o0(e){return function(t,n){var r=oi(t*t+n*n),i=e(r),s=Ve(i),o=Ze(i);return[Cs(t*s,r*o),$i(r&&n*s/r)]}}var hI=dI(function(e){return oi(2/(1+e))});hI.invert=o0(function(e){return 2*$i(e/2)});function Yre(){return ua(hI).scale(124.75).clipAngle(180-.001)}var pI=dI(function(e){return(e=LL(e))&&e/Ve(e)});pI.invert=o0(function(e){return e});function Vre(){return ua(pI).scale(79.4188).clipAngle(180-.001)}function Ky(e,t){return[e,V1(c3((Dn+t)/2))]}Ky.invert=function(e,t){return[e,2*ch(OL(t))-Dn]};function Xre(){return gI(Ky).scale(961/si)}function gI(e){var t=ua(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=wt*r(),d=t(gre(t.rotate()).invert([0,0]));return s(o==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Ky?[[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 tm(e){return c3((Dn+e)/2)}function Kre(e,t){var n=Ze(e),r=e===t?Ve(e):V1(n/Ze(t))/V1(tm(t)/tm(e)),i=n*nx(tm(e),r)/r;if(!r)return Ky;function s(o,a){i>0?a<-Dn+Ke&&(a=-Dn+Ke):a>Dn-Ke&&(a=Dn-Ke);var u=i/nx(tm(a),r);return[u*Ve(r*o),i-u*Ze(r*o)]}return s.invert=function(o,a){var u=i-a,l=gs(r)*oi(o*o+u*u),c=Cs(o,Rt(u))*gs(u);return u*r<0&&(c-=wt*gs(o)*gs(u)),[c/r,2*ch(nx(i/l,1/r))-Dn]},s}function Zre(){return m3(Kre).scale(109.5).parallels([30,30])}function pv(e,t){return[e,t]}pv.invert=pv;function Jre(){return ua(pv).scale(152.63)}function Qre(e,t){var n=Ze(e),r=e===t?Ve(e):(n-Ze(t))/(t-e),i=n/r+e;if(Rt(r)Ke&&--r>0);return[e/(.8707+(s=n*n)*(-.131979+s*(-.013791+s*s*s*(.003971-.001529*s)))),n]};function sie(){return ua(yI).scale(175.295)}function bI(e,t){return[Ze(t)*Ve(e),Ve(t)]}bI.invert=o0($i);function oie(){return ua(bI).scale(249.5).clipAngle(90+Ke)}function xI(e,t){var n=Ze(t),r=1+Ze(e)*n;return[n*Ve(e)/r,Ve(t)/r]}xI.invert=o0(function(e){return 2*ch(e)});function aie(){return ua(xI).scale(250).clipAngle(142)}function _I(e,t){return[V1(c3((Dn+t)/2)),-e]}_I.invert=function(e,t){return[-t,2*ch(OL(e))-Dn]};function uie(){var e=gI(_I),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 lie=Math.abs,Xw=Math.cos,mv=Math.sin,cie=1e-6,wI=Math.PI,Kw=wI/2,c4=fie(2);function f4(e){return e>1?Kw:e<-1?-Kw:Math.asin(e)}function fie(e){return e>0?Math.sqrt(e):0}function die(e,t){var n=e*mv(t),r=30,i;do t-=i=(t+mv(t)-n)/(1+Xw(t));while(lie(i)>cie&&--r>0);return t/2}function hie(e,t,n){function r(i,s){return[e*i*Xw(s=die(n,s)),t*mv(s)]}return r.invert=function(i,s){return s=f4(s/t),[i/(e*Xw(s)),f4((2*s+mv(2*s))/n)]},r}var pie=hie(c4/Kw,c4,wI);function gie(){return ua(pie).scale(169.529)}const mie=lI(),Zw=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function vie(e,t){return function n(){const r=t();return r.type=e,r.path=lI().projection(r),r.copy=r.copy||function(){const i=n();return Zw.forEach(s=>{r[s]&&i[s](r[s]())}),i.path.pointRadius(r.path.pointRadius()),i},I7(r)}}function v3(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(vv[e]=vie(e,t),this):vv[e]||null}function EI(e){return e&&e.path||mie}const vv={albers:fI,albersusa:Gre,azimuthalequalarea:Yre,azimuthalequidistant:Vre,conicconformal:Zre,conicequalarea:hv,conicequidistant:eie,equalEarth:nie,equirectangular:Jre,gnomonic:rie,identity:iie,mercator:Xre,mollweide:gie,naturalEarth1:sie,orthographic:oie,stereographic:aie,transversemercator:uie};for(const e in vv)v3(e,vv[e]);function yie(){}const ba=[[],[[[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 AI(){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),bie(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var h=0,p=c.length,g;h=l,ba[m<<1].forEach(x);++h=l,ba[g|m<<1].forEach(x);for(ba[m<<0].forEach(x);++p=l,v=u[p*e]>=l,ba[m<<1|v<<2].forEach(x);++h=l,b=v,v=u[p*e+h+1]>=l,ba[g|m<<1|v<<2|b<<3].forEach(x);ba[m|v<<3].forEach(x)}for(h=-1,v=u[p*e]>=l,ba[v<<2].forEach(x);++h=l,ba[v<<2|b<<3].forEach(x);ba[v<<3].forEach(x);function x(_){var w=[_[0][0]+h,_[0][1]+p],A=[_[1][0]+h,_[1][1]+p],E=o(w),S=o(A),C,$;(C=d[E])?($=f[S])?(delete d[C.end],delete f[$.start],C===$?(C.ring.push(A),c(C.ring)):f[C.start]=d[$.end]={start:C.start,end:$.end,ring:C.ring.concat($.ring)}):(delete d[C.end],C.ring.push(A),d[C.end=S]=C):(C=f[S])?($=d[E])?(delete f[C.start],delete d[$.end],C===$?(C.ring.push(A),c(C.ring)):f[$.start]=d[C.end]={start:$.start,end:C.end,ring:$.ring.concat(C.ring)}):(delete f[C.start],C.ring.unshift(w),f[C.start=E]=C):f[E]=d[S]={start:E,end:S,ring:[w,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||ne("invalid size"),e=l,t=c,r},r.smooth=function(u){return arguments.length?(n=u?a:yie,r):n===a},r}function bie(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 wie(e,t,n){var r;return Eie(e,t,n)&&Aie(e[r=+(e[0]===t[0])],n[r],t[r])}function Eie(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Aie(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function kI(e,t,n){return function(r){var i=Vo(r),s=n?Math.min(i[0],0):i[0],o=i[1],a=o-s,u=t?Wu(s,o,e):a/(e+1);return Gi(s+u,o,u)}}function y3(e){J.call(this,null,e)}y3.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"}]};Se(y3,J,{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||Ur,s=AI().smooth(e.smooth!==!1),o=e.thresholds||kie(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,oe(o)?o:o(c.values));Sie(f,c,l,e),f.forEach(d=>{u.push(hy(l,Gt(a!=null?{[a]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function kie(e,t,n){const r=kI(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?r:r(e.map(i=>oc(t(i).values)))}function Sie(e,t,n,r){let i=r.scale||t.scale,s=r.translate||t.translate;if(ht(i)&&(i=i(n,r)),ht(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(SI(t,o,a,u,l))}function SI(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 d4(e,t,n){const r=e>=0?e:ck(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function ax(e){return ht(e)?e:qr(+e)}function CI(){var e=u=>u[0],t=u=>u[1],n=Kd,r=[-1,-1],i=960,s=500,o=2;function a(u,l){const c=d4(r[0],u,e)>>o,f=d4(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 b=m;u.forEach(_=>{const w=d+(+e(_)>>o),A=h+(+t(_)>>o);w>=0&&w=0&&A0&&f>0?(bf(p,g,m,v,c),xf(p,g,v,m,f),bf(p,g,m,v,c),xf(p,g,v,m,f),bf(p,g,m,v,c),xf(p,g,v,m,f)):c>0?(bf(p,g,m,v,c),bf(p,g,v,m,c),bf(p,g,m,v,c),b=v):f>0&&(xf(p,g,m,v,f),xf(p,g,v,m,f),xf(p,g,m,v,f),b=v);const x=l?Math.pow(2,-2*o):1/UR(b);for(let _=0,w=p*g;_>o),y2:h+(s>>o)}}return a.x=function(u){return arguments.length?(e=ax(u),a):e},a.y=function(u){return arguments.length?(t=ax(u),a):t},a.weight=function(u){return arguments.length?(n=ax(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||ne("invalid size"),i=l,s=c,a},a.cellSize=function(u){return arguments.length?((u=+u)>=1||ne("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 xf(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 b3(e){J.call(this,null,e)}b3.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 Cie=["x","y","weight","size","cellSize","bandwidth"];function $I(e,t){return Cie.forEach(n=>t[n]!=null?e[n](t[n]):0),e}Se(b3,J,{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=$ie(r,e.groupby),s=(e.groupby||[]).map(Tn),o=$I(CI(),e),a=e.as||"grid",u=[];function l(c,f){for(let d=0;dGt(l({[a]:o(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function $ie(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:Jw,geometry:{type:Fie,coordinates:r}})),this.value={type:_3,features:n}}});function E3(e){J.call(this,null,e)}E3.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"}]};Se(E3,J,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||Ur,s=e.as||"path",o=n.SOURCE;!r||e.modified()?(this.value=r=EI(e.projection),n.materialize().reflow()):o=i===Ur||t.modified(i.fields)?n.ADD_MOD:n.ADD;const a=Die(r,e.pointRadius);return n.visit(o,u=>u[s]=r(i(u))),r.pointRadius(a),n.modifies(s)}});function Die(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function A3(e){J.call(this,null,e)}A3.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"]}]};Se(A3,J,{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 k3(e){J.call(this,null,e)}k3.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"}]};Se(k3,J,{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=Mie(EI(e.projection),e.field||As("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,o=>o[i]=r),n.modifies(i)}});function Mie(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 S3(e){J.call(this,[],e),this.generator=kre()}S3.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}]};Se(S3,J,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(const s in e)ht(r[s])&&r[s](e[s]);return i=r(),n.length?t.mod.push(LN(n[0],i)):t.add.push(Gt(i)),n[0]=i,t}});function C3(e){J.call(this,null,e)}C3.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"}]};Se(C3,J,{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||Ur,s=Rie(e.opacity,e),o=Tie(e.color,e),a=e.as||"image",u={$x:0,$y:0,$value:0,$max:r?oc(n.map(l=>oc(i(l).values))):0};return n.forEach(l=>{const c=i(l),f=dt({},l,u);r||(f.$max=oc(c.values||[])),l[a]=Nie(c,f,o.dep?o:qr(o(f)),s.dep?s:qr(s(f)))}),t.reflow(!0).modifies(a)}});function Tie(e,t){let n;return ht(e)?(n=r=>Yu(e(r,t)),n.dep=FI(e)):n=qr(Yu(e||"#888")),n}function Rie(e,t){let n;return ht(e)?(n=r=>e(r,t),n.dep=FI(e)):e?n=qr(e):(n=r=>r.$value/r.$max||0,n.dep=!0),n}function FI(e){if(!ht(e))return!1;const t=ro(Lr(e));return t.$x||t.$y||t.$value||t.$max}function Nie(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]:bu,d=Pu(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&&h4(n,r,e[r])})):Zw.forEach(r=>{e.modified(r)&&h4(n,r,e[r])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&Oie(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function Oie(e,t){const n=Iie(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function Lie(e){const t=v3((e||"mercator").toLowerCase());return t||ne("Unrecognized projection type: "+e),t()}function h4(e,t,n){ht(e[t])&&e[t](n)}function Iie(e){return e=Me(e),e.length===1?e[0]:{type:_3,features:e.reduce((t,n)=>t.concat(Pie(n)),[])}}function Pie(e){return e.type===_3?e.features:Me(e).filter(t=>t!=null).map(t=>t.type===Jw?t:{type:Jw,geometry:t})}const Bie=Object.freeze(Object.defineProperty({__proto__:null,contour:x3,geojson:w3,geopath:E3,geopoint:A3,geoshape:k3,graticule:S3,heatmap:C3,isocontour:y3,kde2d:b3,projection:DI},Symbol.toStringTag,{value:"Module"}));function zie(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)===(b=(p>=d)<<1|h>=f));return i[b]=s,i[v]=o,e}function Uie(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 b=e-+this._x.call(null,h.data),x=t-+this._y.call(null,h.data),_=b*b+x*x;if(_=(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 Vie(e){for(var t=0,n=e.length;td.index){var M=h-S.x-S.vx,N=p-S.y-S.vy,L=M*M+N*N;L<$*$&&(M===0&&(M=Fu(r),L+=M*M),N===0&&(N=Fu(r),L+=N*N),L=($-(L=Math.sqrt(L)))/L*i,d.vx+=(M*=L)*($=(C*=C)/(m+C)),d.vy+=(N*=L)*$,S.vx-=M*($=1-$),S.vy-=N*$)}return}return _>h+$||Ap+$||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(w,A,o),w])),_;for(m=0,a=new Array(v);m{}};function TI(){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}})}Ym.prototype=TI.prototype={constructor:Ym,on:function(e,t){var n=this._,r=lse(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;--Fd}function v4(){Mc=(bv=og.now())+Zy,Fd=hp=0;try{dse()}finally{Fd=0,pse(),Mc=0}}function hse(){var e=og.now(),t=e-bv;t>RI&&(Zy-=t,bv=e)}function pse(){for(var e,t=yv,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:yv=n);pp=e,Qw(r)}function Qw(e){if(!Fd){hp&&(hp=clearTimeout(hp));var t=e-Mc;t>24?(e<1/0&&(hp=setTimeout(v4,e-og.now()-Zy)),Ih&&(Ih=clearInterval(Ih))):(Ih||(bv=og.now(),Ih=setInterval(hse,RI)),Fd=1,NI(v4))}}function gse(e,t,n){var r=new xv,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?D3():+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 mse=1664525,vse=1013904223,y4=4294967296;function yse(){let e=1;return()=>(e=(mse*e+vse)%y4)/y4}function bse(e){return e.x}function xse(e){return e.y}var _se=10,wse=Math.PI*(3-Math.sqrt(5));function Ese(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,u=OI(f),l=TI("tick","end"),c=yse();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 b=0,x=e.length,_,w,A,E,S;for(v==null?v=1/0:v*=v,b=0;b1?(l.on(g,m),t):l.on(g)}}}function Ase(){var e,t,n,r,i=ti(-30),s,o=1,a=1/0,u=.81;function l(h){var p,g=e.length,m=$3(e,bse,xse).visitAfter(f);for(r=h,p=0;p=a)return;(h.data!==t||h.next)&&(v===0&&(v=Fu(n),_+=v*v),b===0&&(b=Fu(n),_+=b*b),_=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 Fse(e,t){const n=Ese(e),r=n.stop,i=n.restart;let s=!1;return n.stopped=()=>s,n.restart=()=>(s=!1,i()),n.stop=()=>(s=!0,r()),II(n,t,!0).on("end",()=>s=!0)}function II(e,t,n,r){var i=Me(t.forces),s,o,a,u;for(s=0,o=eE.length;st(r,n):t)}const Rse=Object.freeze(Object.defineProperty({__proto__:null,force:M3},Symbol.toStringTag,{value:"Module"}));function Nse(e,t){return e.parent===t.parent?1:2}function Ose(e){return e.reduce(Lse,0)/e.length}function Lse(e,t){return e+t.x}function Ise(e){return 1+e.reduce(Pse,0)}function Pse(e,t){return Math.max(e,t.y)}function Bse(e){for(var t;t=e.children;)e=t[0];return e}function zse(e){for(var t;t=e.children;)e=t[t.length-1];return e}function jse(){var e=Nse,t=1,n=1,r=!1;function i(s){var o,a=0;s.eachAfter(function(d){var h=d.children;h?(d.x=Ose(h),d.y=Ise(h)):(d.x=o?a+=e(d,o):0,d.y=0,o=d)});var u=Bse(s),l=zse(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 Use(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 qse(){return this.eachAfter(Use)}function Wse(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function Hse(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 Gse(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 Xse(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Kse(e){for(var t=this,n=Zse(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 Zse(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 Jse(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Qse(){return Array.from(this)}function eoe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function toe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*noe(){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 Dd(o[a])),s.parent=r,s.depth=r.depth+1;return n.eachBefore(PI)}function roe(){return T3(this).eachBefore(ooe)}function ioe(e){return e.children}function soe(e){return Array.isArray(e)?e[1]:null}function ooe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function PI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Dd(e){this.data=e,this.depth=this.height=0,this.parent=null}Dd.prototype=T3.prototype={constructor:Dd,count:qse,each:Wse,eachAfter:Gse,eachBefore:Hse,find:Yse,sum:Vse,sort:Xse,path:Kse,ancestors:Jse,descendants:Qse,leaves:eoe,links:toe,copy:roe,[Symbol.iterator]:noe};function Vm(e){return e==null?null:BI(e)}function BI(e){if(typeof e!="function")throw new Error;return e}function Gl(){return 0}function Ff(e){return function(){return e}}const aoe=1664525,uoe=1013904223,x4=4294967296;function loe(){let e=1;return()=>(e=(aoe*e+uoe)%x4)/x4}function coe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function foe(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 doe(e,t){for(var n=0,r=(e=foe(Array.from(e),t)).length,i=[],s,o;n0&&n*n>r*r+i*i}function ux(e,t){for(var n=0;n1e-6?(M+Math.sqrt(M*M-4*$*N))/(2*$):N/M);return{x:r+A+E*L,y:i+S+C*L,r:L}}function _4(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 w4(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 E4(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 rm(e){this._=e,this.next=null,this.previous=null}function moe(e,t){if(!(s=(e=coe(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;_4(r,n,i=e[2]),n=new rm(n),r=new rm(r),i=new rm(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;e:for(u=3;uEoe(n(_,w,i))),b=v.map($4),x=new Set(v).add("");for(const _ of b)x.has(_)||(x.add(_),v.push(_),b.push($4(_)),s.push(cx));o=(_,w)=>v[w],a=(_,w)=>b[w]}for(c=0,u=s.length;c=0&&(h=s[v],h.data===cx);--v)h.data=null}if(f.parent=xoe,f.eachBefore(function(v){v.depth=v.parent.depth+1,--u}).eachBefore(PI),f.parent=null,u>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Vm(i),r):e},r.parentId=function(i){return arguments.length?(t=Vm(i),r):t},r.path=function(i){return arguments.length?(n=Vm(i),r):n},r}function Eoe(e){e=`${e}`;let t=e.length;return tE(e,t-1)&&!tE(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function $4(e){let t=e.length;if(t<2)return"";for(;--t>1&&!tE(e,t););return e.slice(0,t)}function tE(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function Aoe(e,t){return e.parent===t.parent?1:2}function fx(e){var t=e.children;return t?t[0]:e.t}function dx(e){var t=e.children;return t?t[t.length-1]:e.t}function koe(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 Soe(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 Coe(e,t,n){return e.a.parent===t.parent?e.a:n}function Xm(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}Xm.prototype=Object.create(Dd.prototype);function $oe(e){for(var t=new Xm(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 Xm(s[o],o)),i.parent=n;return(t.parent=new Xm(null,0)).children=[t],t}function Foe(){var e=Aoe,t=1,n=1,r=null;function i(l){var c=$oe(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(b){b.xd.x&&(d=b),b.depth>h.depth&&(h=b)});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(b){b.x=(b.x+g)*m,b.y=b.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){Soe(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,b=p.m,x=g.m,_;p=dx(p),d=fx(d),p&&d;)g=fx(g),h=dx(h),h.a=l,_=p.z+b-d.z-m+e(p._,d._),_>0&&(koe(Coe(p,l,f),l,_),m+=_,v+=_),b+=p.m,m+=d.m,x+=g.m,v+=h.m;p&&!dx(h)&&(h.t=p,h.m+=b-v),d&&!fx(g)&&(g.t=d,g.m+=m-x,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 Jy(e,t,n,r,i){for(var s=e.children,o,a=-1,u=s.length,l=e.value&&(i-n)/e.value;++ab&&(b=l),A=m*m*w,x=Math.max(b/A,A/v),x>_){m-=l;break}_=x}o.push(u={value:m,dice:h1?r:1)},n})(qI);function Doe(){var e=HI,t=!1,n=1,r=1,i=[0],s=Gl,o=Gl,a=Gl,u=Gl,l=Gl;function c(d){return d.x0=d.y0=0,d.x1=n,d.y1=r,d.eachBefore(f),i=[0],t&&d.eachBefore(UI),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 b=s[f];b.x0=p,b.y0=g,b.x1=m,b.y1=v;return}for(var x=l[f],_=h/2+x,w=f+1,A=d-1;w>>1;l[E]<_?w=E+1:A=E}_-l[w-1]v-g){var $=h?(p*C+m*S)/h:m;c(f,w,S,p,g,$,v),c(w,d,C,$,g,m,v)}else{var M=h?(g*C+v*S)/h:v;c(f,w,S,p,g,m,M),c(w,d,C,p,M,m,v)}}}function Toe(e,t,n,r,i){(e.depth&1?Jy:a0)(e,t,n,r,i)}const Roe=(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})(qI);function nE(e,t,n){const r={};return e.each(i=>{const s=i.data;n(s)&&(r[t(s)]=i)}),e.lookup=r,e}function R3(e){J.call(this,null,e)}R3.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const Noe=e=>e.values;Se(R3,J,{transform(e,t){t.source||ne("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&&dy(o.data)&&i.rem.push(o.data)}),this.value=s=T3({values:Me(e.keys).reduce((o,a)=>(o.key(a),o),Ooe()).entries(i.source)},Noe),n&&s.each(o=>{o.children&&(o=Gt(o.data),i.add.push(o),i.source.push(o))}),nE(s,Ye,Ye)),i.source.root=s,i}});function Ooe(){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 tu(e){J.call(this,null,e)}const Loe=(e,t)=>e.parent===t.parent?1:2;Se(tu,J,{transform(e,t){(!t.source||!t.source.root)&&ne(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(Zc(e.sort,o=>o.data)),Ioe(n,this.params,e),n.separation&&n.separation(e.separation!==!1?Loe:Kd);try{this.value=n(i)}catch(o){ne(o)}return i.each(o=>Poe(o,r,s)),t.reflow(e.modified()).modifies(s).modifies("leaf")}});function Ioe(e,t,n){for(let r,i=0,s=t.length;is[Ye(o)]=1),r.each(o=>{const a=o.data,u=o.parent&&o.parent.data;u&&s[Ye(a)]&&s[Ye(u)]&&i.add.push(Gt({source:u,target:a}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,o=>s[Ye(o)]=1),n.forEach(o=>{(s[Ye(o.source)]||s[Ye(o.target)])&&i.mod.push(o)})),i}});const D4={binary:Moe,dice:a0,slice:Jy,slicedice:Toe,squarify:HI,resquarify:Roe},oE=["x0","y0","x1","y1","depth","children"];function B3(e){tu.call(this,e)}B3.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:oE.length,default:oE}]};Se(B3,tu,{layout(){const e=Doe();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{Le(D4,t)?e.tile(D4[t]):ne("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:oE});const Boe=Object.freeze(Object.defineProperty({__proto__:null,nest:R3,pack:N3,partition:O3,stratify:L3,tree:I3,treelinks:P3,treemap:B3},Symbol.toStringTag,{value:"Module"})),hx=4278190080;function zoe(e,t){const n=e.bitmap();return(t||[]).forEach(r=>n.set(e(r.boundary[0]),e(r.boundary[3]))),[n,void 0]}function joe(e,t,n,r,i){const s=e.width,o=e.height,a=r||i,u=Pu(s,o).getContext("2d"),l=Pu(s,o).getContext("2d"),c=a&&Pu(s,o).getContext("2d");n.forEach(S=>Km(u,S,!1)),Km(l,t,!1),a&&Km(c,t,!0);const f=px(u,s,o),d=px(l,s,o),h=a&&px(c,s,o),p=e.bitmap(),g=a&&e.bitmap();let m,v,b,x,_,w,A,E;for(v=0;v{i.items.forEach(s=>Km(e,s.items,n))}):ns[r].draw(e,{items:n?t.map(Uoe):t})}function Uoe(e){const t=hy(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const xa=5,Gr=31,ag=32,vu=new Uint32Array(ag+1),Hs=new Uint32Array(ag+1);Hs[0]=0;vu[0]=~Hs[0];for(let e=1;e<=ag;++e)Hs[e]=Hs[e-1]<<1|1,vu[e]=~Hs[e];function qoe(e,t){const n=new Uint32Array(~~((e*t+ag)/ag));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>>>xa]&1<<(a&Gr)},set:(s,o)=>{const a=o*e+s;r(a>>>xa,1<<(a&Gr))},clear:(s,o)=>{const a=o*e+s;i(a>>>xa,~(1<<(a&Gr)))},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>>>xa,h=f>>>xa,d===h){if(n[d]&vu[c&Gr]&Hs[(f&Gr)+1])return!0}else{if(n[d]&vu[c&Gr]||n[h]&Hs[(f&Gr)+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>>>xa,d=c>>>xa,f===d)r(f,vu[l&Gr]&Hs[(c&Gr)+1]);else for(r(f,vu[l&Gr]),r(d,Hs[(c&Gr)+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>>>xa,d=c>>>xa,f===d)i(f,Hs[l&Gr]|vu[(c&Gr)+1]);else for(i(f,Hs[l&Gr]),i(d,vu[(c&Gr)+1]),h=f+1;hs<0||o<0||u>=t||a>=e}}function Woe(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=()=>qoe(i,s),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function Hoe(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=Ki.width(o.datum,o.datum.text);let f=0,d,h,p,g,m,v,b;for(let x=0;x=f&&(f=b,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 Du(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 Goe(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,b;if(!_v(p,g,d,h,i,s)&&!Du(e,p,g,h,d,m,o,a)&&!Du(e,p,g,h,d,h,o,null)){for(;v-m>=1;)b=(m+v)/2,Du(e,p,g,h,d,b,o,a)?v=b:m=b;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=Ki.width(l.datum,l.datum.text);let p=n?d:0,g=!1,m=!1,v=0,b,x,_,w,A,E,S,C,$,M,N,L,T,k,F,I,B;for(let O=0;Ox&&(B=b,b=x,x=B),_>w&&(B=_,_=w,w=B),$=e(b),N=e(x),M=~~(($+N)/2),L=e(_),k=e(w),T=~~((L+k)/2),S=M;S>=$;--S)for(C=T;C>=L;--C)I=u(S,C,p,h,d),I&&([l.x,l.y,p,g]=I);for(S=M;S<=N;++S)for(C=T;C<=k;++C)I=u(S,C,p,h,d),I&&([l.x,l.y,p,g]=I);!g&&!n&&(F=Math.abs(x-b+w-_),A=(b+x)/2,E=(_+w)/2,F>=v&&!_v(A,E,h,d,i,s)&&!Du(e,A,E,d,h,d,o,null)&&(v=F,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 Yoe=[-1,-1,1,1],Voe=[-1,1,-1,1];function Xoe(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=Ki.width(l.datum,l.datum.text),p=[];let g=n?d:0,m=!1,v=!1,b=0,x,_,w,A,E,S,C,$,M,N,L,T;for(let k=0;k=1;)L=(M+N)/2,Du(e,E,S,d,h,L,o,a)?N=L:M=L;M>g&&(l.x=E,l.y=S,g=M,m=!0)}}!m&&!n&&(T=Math.abs(_-x+A-w),E=(x+_)/2,S=(w+A)/2,T>=b&&!_v(E,S,h,d,i,s)&&!Du(e,E,S,d,h,d,o,null)&&(b=T,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 Koe=["right","center","left"],Zoe=["bottom","middle","top"];function Joe(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,b,x,_,w,A,E,S,C,$,M;for(let N=0;N>>2&3)-1,g=h===0&&p===0||r[N]<0,m=h&&p?Math.SQRT1_2:1,v=r[N]<0?-1:1,b=c[1+h]+r[N]*h*m,E=c[4+p]+v*f*p/2+r[N]*p*m,_=E-f/2,w=E+f/2,S=e(b),$=e(_),M=e(w),!d)if(M4(S,S,$,M,o,a,b,b,_,w,c,g))d=Ki.width(l.datum,l.datum.text);else continue;if(A=b+v*d*h/2,b=A-d/2,x=A+d/2,S=e(b),C=e(x),M4(S,C,$,M,o,a,b,x,_,w,c,g))return l.x=h?h*v<0?x:b:A,l.y=p?p*v<0?w:_:E,l.align=Koe[h*v+1],l.baseline=Zoe[p*v+1],o.setRange(S,$,C,M),!0}return!1}}function M4(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 gx=0,mx=4,vx=8,yx=0,bx=1,xx=2,Qoe={"top-left":gx+yx,top:gx+bx,"top-right":gx+xx,left:mx+yx,middle:mx+bx,right:mx+xx,"bottom-left":vx+yx,bottom:vx+bx,"bottom-right":vx+xx},eae={naive:Hoe,"reduced-search":Goe,floodfill:Xoe};function tae(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=nae(r,f),h=rae(i,f),p=iae(e[0].datum),g=p==="group"&&e[0].datum.items[u].marktype,m=g==="area",v=sae(p,g,a,u),b=l===null||l===1/0,x=m&&c==="naive";let _=-1,w=-1;const A=e.map($=>{const M=b?Ki.width($,$.text):void 0;return _=Math.max(_,M),w=Math.max(w,$.fontSize),{datum:$,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v($),textWidth:M}});l=l===null||l===1/0?Math.max(_,w)+Math.max(...r):l;const E=Woe(t[0],t[1],l);let S;if(!x){n&&A.sort((N,L)=>n(N.datum,L.datum));let $=!1;for(let N=0;NN.datum);S=s.length||M?joe(E,M||[],s,$,m):zoe(E,o&&A)}const C=m?eae[c](E,S,o,u):Joe(E,S,h,d);return A.forEach($=>$.opacity=+C($)),A}function nae(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 aE=["x","y","opacity","align","baseline"],GI=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function z3(e){J.call(this,null,e)}z3.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:GI},{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:aE.length,default:aE}]};Se(z3,J,{transform(e,t){function n(s){const o=e[s];return ht(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)&&ne("Size parameter should be specified as a [width, height] array.");const i=e.as||aE;return tae(t.materialize(t.SOURCE).source||[],e.size,e.sort,Me(e.offset==null?1:e.offset),Me(e.anchor||GI),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 oae=Object.freeze(Object.defineProperty({__proto__:null,label:z3},Symbol.toStringTag,{value:"Module"}));function YI(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{eO(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;de==="poly"?t:e==="quad"?2:1;function U3(e){J.call(this,null,e)}U3.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(uE)},{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}]};Se(U3,J,{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=YI(r,e.groupby),s=(e.groupby||[]).map(Tn),o=e.method||"linear",a=e.order==null?3:e.order,u=aae(o,a),l=e.as||[Tn(e.x),Tn(e.y)],c=uE[o],f=[];let d=e.extent;Le(uE,o)||ne("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(Gt({keys:h.dims,coef:g.coef,rSquared:g.rSquared}));return}const m=d||Vo(h,e.x),v=b=>{const x={};for(let _=0;_v([b,g.predict(b)])):xy(g.predict,m,25,200).forEach(v)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const uae=Object.freeze(Object.defineProperty({__proto__:null,loess:j3,regression:U3},Symbol.toStringTag,{value:"Module"})),ja=11102230246251565e-32,Fr=134217729,lae=(3+8*ja)*ja;function _x(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||-L>=T||(f=e-C,a=e-(C+f)+(f-i),f=n-$,l=n-($+f)+(f-i),f=t-M,u=t-(M+f)+(f-s),f=r-N,c=r-(N+f)+(f-s),a===0&&u===0&&l===0&&c===0)||(T=hae*o+lae*Math.abs(L),L+=C*c+N*a-(M*l+$*u),L>=T||-L>=T))return L;_=a*N,d=Fr*a,h=d-(d-a),p=a-h,d=Fr*N,g=d-(d-N),m=N-g,w=p*m-(_-h*g-p*g-h*m),A=u*$,d=Fr*u,h=d-(d-u),p=u-h,d=Fr*$,g=d-(d-$),m=$-g,E=p*m-(A-h*g-p*g-h*m),v=w-E,f=w-v,Yr[0]=w-(v+f)+(f-E),b=_+v,f=b-_,x=_-(b-f)+(v-f),v=x-A,f=x-v,Yr[1]=x-(v+f)+(f-A),S=b+v,f=S-b,Yr[2]=b-(S-f)+(v-f),Yr[3]=S;const k=_x(4,_f,4,Yr,T4);_=C*c,d=Fr*C,h=d-(d-C),p=C-h,d=Fr*c,g=d-(d-c),m=c-g,w=p*m-(_-h*g-p*g-h*m),A=M*l,d=Fr*M,h=d-(d-M),p=M-h,d=Fr*l,g=d-(d-l),m=l-g,E=p*m-(A-h*g-p*g-h*m),v=w-E,f=w-v,Yr[0]=w-(v+f)+(f-E),b=_+v,f=b-_,x=_-(b-f)+(v-f),v=x-A,f=x-v,Yr[1]=x-(v+f)+(f-A),S=b+v,f=S-b,Yr[2]=b-(S-f)+(v-f),Yr[3]=S;const F=_x(k,T4,4,Yr,R4);_=a*c,d=Fr*a,h=d-(d-a),p=a-h,d=Fr*c,g=d-(d-c),m=c-g,w=p*m-(_-h*g-p*g-h*m),A=u*l,d=Fr*u,h=d-(d-u),p=u-h,d=Fr*l,g=d-(d-l),m=l-g,E=p*m-(A-h*g-p*g-h*m),v=w-E,f=w-v,Yr[0]=w-(v+f)+(f-E),b=_+v,f=b-_,x=_-(b-f)+(v-f),v=x-A,f=x-v,Yr[1]=x-(v+f)+(f-A),S=b+v,f=S-b,Yr[2]=b-(S-f)+(v-f),Yr[3]=S;const I=_x(F,R4,4,Yr,N4);return N4[I-1]}function im(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)>=fae*l?u:-pae(e,t,n,r,i,s,l)}const O4=Math.pow(2,-52),sm=new Uint32Array(512);class wv{static from(t,n=bae,r=xae){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 C=0;Cl&&(l=$),M>c&&(c=M),this._ids[C]=C}const f=(a+l)/2,d=(u+c)/2;let h,p,g;for(let C=0,$=1/0;C0&&(p=C,$=M)}let b=t[2*p],x=t[2*p+1],_=1/0;for(let C=0;CN&&(C[$++]=L,N=T)}this.hull=C.subarray(0,$),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(im(m,v,b,x,w,A)<0){const C=p,$=b,M=x;p=g,b=w,x=A,g=C,w=$,A=M}const E=yae(m,v,b,x,w,A);this._cx=E.x,this._cy=E.y;for(let C=0;C0&&Math.abs(L-$)<=O4&&Math.abs(T-M)<=O4||($=L,M=T,N===h||N===p||N===g))continue;let k=0;for(let j=0,Y=this._hashKey(L,T);j=0;)if(F=I,F===k){F=-1;break}if(F===-1)continue;let B=this._addTriangle(F,N,r[F],-1,-1,i[F]);i[N]=this._legalize(B+2),i[F]=B,S++;let O=r[F];for(;I=r[O],im(L,T,t[2*O],t[2*O+1],t[2*I],t[2*I+1])<0;)B=this._addTriangle(O,N,I,i[N],-1,i[O]),i[N]=this._legalize(B+2),r[O]=O,S--,O=I;if(F===k)for(;I=n[F],im(L,T,t[2*I],t[2*I+1],t[2*F],t[2*F+1])<0;)B=this._addTriangle(I,N,F,-1,i[F],i[I]),this._legalize(B+2),i[I]=B,r[F]=F,S--,F=I;this._hullStart=n[N]=F,r[F]=n[O]=N,r[N]=O,s[this._hashKey(L,T)]=N,s[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(S);for(let C=0,$=this._hullStart;C0?3-n:1+n)/4}function wx(e,t,n,r){const i=e-n,s=t-r;return i*i+s*s}function mae(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 vae(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 yae(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 If(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;Ph(e,i,s),t[e[n]]>t[e[r]]&&Ph(e,n,r),t[e[s]]>t[e[r]]&&Ph(e,s,r),t[e[n]]>t[e[s]]&&Ph(e,n,s);const a=e[s],u=t[a];for(;;){do s++;while(t[e[s]]u);if(o=o-n?(If(e,t,s,r),If(e,t,n,o-1)):(If(e,t,n,o-1),If(e,t,s,r))}}function Ph(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function bae(e){return e[0]}function xae(e){return e[1]}const L4=1e-6;class ec{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)>L4||Math.abs(this._y1-s)>L4)&&(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 lE{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 _ae=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,b,x;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 Sae(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class q3{static from(t,n=Eae,r=Aae,i){return new q3("length"in t?Cae(t,n,r,i):Float64Array.from($ae(t,n,r,i)))}constructor(t){this._delaunator=new wv(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&&kae(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 _ae(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=wf(n-l[t*2],2)+wf(r-l[t*2+1],2);const d=i[t];let h=d;do{let p=u[h];const g=wf(n-l[p*2],2)+wf(r-l[p*2+1],2);if(g>5)*e[1]),m=null,v=l.length,b=-1,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);++b>1,w.y=e[1]*(c()+.5)>>1,Nae(p,w,_,b),w.hasText&&h(g,w,m)&&(x.push(w),m?Lae(m,w):m=[{x:w.x+w.x0,y:w.y+w.y0},{x:w.x+w.x1,y:w.y+w.y1}],w.x-=e[0]>>1,w.y-=e[1]>>1)}return x};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=(vp<<5)/g,p.height=Zm/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,b=g.y,x=Math.hypot(e[0],e[1]),_=u(e),w=c()<.5?1:-1,A=-w,E,S,C;(E=_(A+=w))&&(S=~~E[0],C=~~E[1],!(Math.min(Math.abs(S),Math.abs(C))>=x));)if(g.x=v+S,g.y=b+C,!(g.x+g.x0<0||g.y+g.y0<0||g.x+g.x1>e[0]||g.y+g.y1>e[1])&&(!m||!Oae(g,p,e[0]))&&(!m||Iae(g,m))){for(var $=g.sprite,M=g.width>>5,N=e[0]>>5,L=g.x-(M<<4),T=L&127,k=32-T,F=g.y1-g.y0,I=(g.y+g.y0)*N+(L>>5),B,O=0;O>>T:0);I+=N}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=Fl(p),f):n},f.fontStyle=function(p){return arguments.length?(i=Fl(p),f):i},f.fontWeight=function(p){return arguments.length?(s=Fl(p),f):s},f.rotate=function(p){return arguments.length?(o=Fl(p),f):o},f.text=function(p){return arguments.length?(t=Fl(p),f):t},f.spiral=function(p){return arguments.length?(u=zae[p]||p,f):u},f.fontSize=function(p){return arguments.length?(r=Fl(p),f):r},f.padding=function(p){return arguments.length?(a=Fl(p),f):a},f.random=function(p){return arguments.length?(c=p,f):c},f}function Nae(e,t,n,r){if(!t.sprite){var i=e.context,s=e.ratio;i.clearRect(0,0,(vp<<5)/s,Zm/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(b+x),Math.abs(b-x))}else c=c+31>>5<<5;if(d>u&&(u=d),o+c>=vp<<5&&(o=0,a+=u,u=0),a+d>=Zm)break;i.translate((o+(c>>1))/s,(a+(d>>1))/s),t.rotate&&i.rotate(t.rotate*Ex),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 w=i.getImageData(0,0,(vp<<5)/s,Zm/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),$=w[(a+p)*(vp<<5)+(o+h)<<2]?1<<31-h%32:0;A[C]|=$,E|=$}E?S=p:(t.y0++,d--,p--,a++)}t.y1=t.y0+S,t.sprite=A.slice(0,(t.y1-t.y0)*f)}}}function Oae(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 Lae(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 Iae(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(Ss).layout(),c=s.size(),f=c[0]>>1,d=c[1]>>1,h=l.length;for(let p=0,g,m;pnew Uint8Array(e),Wae=e=>new Uint16Array(e),Lp=e=>new Uint32Array(e);function Hae(){let e=8,t=[],n=Lp(0),r=om(0,e),i=om(0,e);return{data:()=>t,seen:()=>n=Gae(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=om(s,e,r),i=om(s,e))}}}function Gae(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function om(e,t,n){const r=(t<257?qae:t<65537?Wae:Lp)(e);return n&&r.set(n),r}function I4(e,t,n){const r=1<0)for(m=0;me,size:()=>n}}function Yae(e,t){return e.sort.call(t,(n,r)=>{const i=e[n],s=e[r];return is?1:0}),nY(e,t)}function Vae(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 Xae=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:G3,resolvefilter:Y3},Symbol.toStringTag,{value:"Module"})),Kae="RawCode",Tc="Literal",Zae="Property",Jae="Identifier",Qae="ArrayExpression",eue="BinaryExpression",KI="CallExpression",tue="ConditionalExpression",nue="LogicalExpression",rue="MemberExpression",iue="ObjectExpression",sue="UnaryExpression";function fo(e){this.type=e}fo.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=oue(this),n=0,r=t.length;n";la[Rc]="Identifier";la[pl]="Keyword";la[eb]="Null";la[ef]="Numeric";la[vi]="Punctuator";la[c0]="String";la[aue]="RegularExpression";var uue="ArrayExpression",lue="BinaryExpression",cue="CallExpression",fue="ConditionalExpression",ZI="Identifier",due="Literal",hue="LogicalExpression",pue="MemberExpression",gue="ObjectExpression",mue="Property",vue="UnaryExpression",nr="Unexpected token %0",yue="Unexpected number",bue="Unexpected string",xue="Unexpected identifier",_ue="Unexpected reserved word",wue="Unexpected end of input",cE="Invalid regular expression",Ax="Invalid regular expression: missing /",JI="Octal literals are not allowed in strict mode.",Eue="Duplicate data property in object literal not allowed in strict mode",xr="ILLEGAL",ug="Disabled.",Aue=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]"),kue=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 tb(e,t){if(!e)throw new Error("ASSERT: "+t)}function ka(e){return e>=48&&e<=57}function V3(e){return"0123456789abcdefABCDEF".includes(e)}function Ip(e){return"01234567".includes(e)}function Sue(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 lg(e){return e===10||e===13||e===8232||e===8233}function f0(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Aue.test(String.fromCharCode(e))}function Ev(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&kue.test(String.fromCharCode(e))}const Cue={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 QI(){for(;ie1114111||e!=="}")&&zt({},nr,xr),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function eP(){var e,t;for(e=ze.charCodeAt(ie++),t=String.fromCharCode(e),e===92&&(ze.charCodeAt(ie)!==117&&zt({},nr,xr),++ie,e=fE("u"),(!e||e==="\\"||!f0(e.charCodeAt(0)))&&zt({},nr,xr),t=e);ie>>=")return ie+=4,{type:vi,value:o,start:e,end:ie};if(s=o.substr(0,3),s===">>>"||s==="<<="||s===">>=")return ie+=3,{type:vi,value:s,start:e,end:ie};if(i=s.substr(0,2),r===i[1]&&"+-<>&|".includes(r)||i==="=>")return ie+=2,{type:vi,value:i,start:e,end:ie};if(i==="//"&&zt({},nr,xr),"<>=!+-*%&|^/".includes(r))return++ie,{type:vi,value:r,start:e,end:ie};zt({},nr,xr)}function Mue(e){let t="";for(;ie{if(parseInt(i,16)<=1114111)return"x";zt({},cE)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{zt({},cE)}try{return new RegExp(e,t)}catch{return null}}function Oue(){var e,t,n,r,i;for(e=ze[ie],tb(e==="/","Regular expression literal must start with a slash"),t=ze[ie++],n=!1,r=!1;ie=0&&zt({},cE,n),{value:n,literal:t}}function Iue(){var e,t,n,r;return Qt=null,QI(),e=ie,t=Oue(),n=Lue(),r=Nue(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:ie}}function Pue(e){return e.type===Rc||e.type===pl||e.type===Qy||e.type===eb}function tP(){if(QI(),ie>=Pr)return{type:l0,start:ie,end:ie};const e=ze.charCodeAt(ie);return f0(e)?Due():e===40||e===41||e===59?kx():e===39||e===34?Rue():e===46?ka(ze.charCodeAt(ie+1))?B4():kx():ka(e)?B4():kx()}function xi(){const e=Qt;return ie=e.end,Qt=tP(),ie=e.end,e}function nP(){const e=ie;Qt=tP(),ie=e}function Bue(e){const t=new fo(uue);return t.elements=e,t}function z4(e,t,n){const r=new fo(e==="||"||e==="&&"?hue:lue);return r.operator=e,r.left=t,r.right=n,r}function zue(e,t){const n=new fo(cue);return n.callee=e,n.arguments=t,n}function jue(e,t,n){const r=new fo(fue);return r.test=e,r.consequent=t,r.alternate=n,r}function X3(e){const t=new fo(ZI);return t.name=e,t}function yp(e){const t=new fo(due);return t.value=e.value,t.raw=ze.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function j4(e,t,n){const r=new fo(pue);return r.computed=e==="[",r.object=t,r.property=n,r.computed||(n.member=!0),r}function Uue(e){const t=new fo(gue);return t.properties=e,t}function U4(e,t,n){const r=new fo(mue);return r.key=t,r.value=n,r.kind=e,r}function que(e,t){const n=new fo(vue);return n.operator=e,n.argument=t,n.prefix=!0,n}function zt(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(s,o)=>(tb(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 tle(){var e,t,n,r,i,s,o,a,u,l;if(e=Qt,u=Jm(),r=Qt,i=H4(r),i===0)return u;for(r.prec=i,xi(),t=[e,Qt],o=Jm(),s=[u,r,o];(i=H4(Qt))>0;){for(;s.length>2&&i<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,u=s.pop(),t.pop(),n=z4(a,u,o),s.push(n);r=xi(),r.prec=i,s.push(r),t.push(Qt),n=Jm(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=z4(s[l-1].value,s[l-2],n),l-=2;return n}function Nc(){var e,t,n;return e=tle(),fn("?")&&(xi(),t=Nc(),Br(":"),n=Nc(),e=jue(e,t,n)),e}function K3(){const e=Nc();if(fn(","))throw new Error(ug);return e}function rP(e){ze=e,ie=0,Pr=ze.length,Qt=null,nP();const t=K3();if(Qt.type!==l0)throw new Error("Unexpect token after expression.");return t}var iP={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 sP(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&&ne("Missing arguments to clamp function."),o.length>3&&ne("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&&ne("Missing arguments to if function."),o.length>3&&ne("Too many arguments to if function.");const a=o.map(e);return"("+a[0]+"?"+a[1]+":"+a[2]+")"}}}function nle(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function oP(e){e=e||{};const t=e.allowed?ro(e.allowed):{},n=e.forbidden?ro(e.forbidden):{},r=e.constants||iP,i=(e.functions||sP)(f),s=e.globalvar,o=e.fieldvar,a=ht(s)?s:p=>`${s}["${p}"]`;let u={},l={},c=0;function f(p){if(De(p))return p;const g=d[p.type];return g==null&&ne("Unsupported type: "+p.type),g(p)}const d={Literal:p=>p.raw,Identifier:p=>{const g=p.name;return c>0?g:Le(n,g)?ne("Illegal identifier: "+g):Le(r,g)?r[g]:Le(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[nle(v)]=1),g&&(c-=1),m+(g?"."+v:"["+v+"]")},CallExpression:p=>{p.callee.type!=="Identifier"&&ne("Illegal callee type: "+p.callee.type);const g=p.callee.name,m=p.arguments,v=Le(i,g)&&i[g];return v||ne("Unrecognized function: "+g),ht(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;RA.has(m)&&ne("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 G4=Symbol("vega_selection_getter");function aP(e){return(!e.getter||!e.getter[G4])&&(e.getter=As(e.field),e.getter[G4]=!0),e.getter}const Z3="intersect",Y4="union",rle="vlMulti",ile="vlPoint",V4="or",sle="and",Ro="_vgsid_",cg=As(Ro),ole="E",ale="R",ule="R-E",lle="R-LE",cle="R-RE",fle="E-LT",dle="E-LTE",hle="E-GT",ple="E-GTE",gle="E-VALID",mle="E-ONE",Av="index:unit";function X4(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===dle){if(o>r[s])return!1}else if(a.type===hle){if(o<=r[s])return!1}else if(a.type===ple){if(odt(t.fields?{values:t.fields.map(r=>aP(r)(n.datum))}:{[Ro]:cg(n.datum)},t))}function wle(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,b,x=s.length,_=0,w,A;_(E[c[C].field]=S,E),{})))}else h=Ro,p=cg(l),g=o[h]||(o[h]={}),m=g[d]||(g[d]=[]),m.push(p),n&&(m=a[d]||(a[d]=[]),m.push({[Ro]:p}));if(t=t||Y4,o[Ro]?o[Ro]=Cx[`${Ro}_${t}`](...Object.values(o[Ro])):Object.keys(o).forEach(E=>{o[E]=Object.keys(o[E]).map(S=>o[E][S]).reduce((S,C)=>S===void 0?C:Cx[`${u[E]}_${t}`](S,C))}),s=Object.keys(a),n&&s.length){const E=r?ile:rle;o[E]=t===Y4?{[V4]:s.reduce((S,C)=>(S.push(...a[C]),S),[])}:{[sle]:s.map(S=>({[V4]:a[S]}))}}return o}var Cx={[`${Ro}_union`]:fY,[`${Ro}_intersect`]:lY,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=Nr(t[0]),r=Nr(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 Ele=":",Ale="@";function J3(e,t,n,r){t[0].type!==Tc&&ne("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=Ale+o,u=Ele+i;s===Z3&&!Le(r,a)&&(r[a]=n.getData(i).indataRef(n,o)),Le(r,u)||(r[u]=n.getData(i).tuplesRef())}function lP(e){const t=this.context.data[e];return t?t.values.value:[]}function kle(e,t,n){const r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i&&i.count}function Sle(e,t){const n=this.context.dataflow,r=this.context.data[e],i=r.input;return n.pulse(i,n.changeset().remove(Qi).insert(t)),1}function Cle(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 d0=e=>function(t,n){const r=this.context.dataflow.locale();return t===null?"null":r[e](n)(t)},$le=d0("format"),cP=d0("timeFormat"),Fle=d0("utcFormat"),Dle=d0("timeParse"),Mle=d0("utcParse"),am=new Date(2e3,0,1);function rb(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(am.setYear(2e3),am.setMonth(e),am.setDate(t),cP.call(this,am,n))}function Tle(e){return rb.call(this,e,1,"%B")}function Rle(e){return rb.call(this,e,1,"%b")}function Nle(e){return rb.call(this,0,2+e,"%A")}function Ole(e){return rb.call(this,0,2+e,"%a")}const Lle=":",Ile="@",dE="%",fP="$";function Q3(e,t,n,r){t[0].type!==Tc&&ne("First argument to data functions must be a string literal.");const i=t[0].value,s=Lle+i;if(!Le(s,r))try{r[s]=n.getData(i).tuplesRef()}catch{}}function Ple(e,t,n,r){t[0].type!==Tc&&ne("First argument to indata must be a string literal."),t[1].type!==Tc&&ne("Second argument to indata must be a string literal.");const i=t[0].value,s=t[1].value,o=Ile+s;Le(o,r)||(r[o]=n.getData(i).indataRef(n,s))}function ii(e,t,n,r){if(t[0].type===Tc)K4(n,r,t[0].value);else for(e in n.scales)K4(n,r,e)}function K4(e,t,n){const r=dE+n;if(!Le(t,r))try{t[r]=e.scaleRef(n)}catch{}}function ca(e,t){if(De(e)){const n=t.scales[e];return n&&Q5(n.value)?n.value:void 0}else if(ht(e))return Q5(e)?e:void 0}function Ble(e,t,n){t.__bandwidth=i=>i&&i.bandwidth?i.bandwidth():0,n._bandwidth=ii,n._range=ii,n._scale=ii;const r=i=>"_["+(i.type===Tc?Ee(dE+i.value):Ee(dE)+"+"+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 eC(e,t){return function(n,r,i){if(n){const s=ca(n,(i||this).context);return s&&s.path[e](r)}else return t(r)}}const zle=eC("area",ire),jle=eC("bounds",ure),Ule=eC("centroid",pre);function qle(e,t){const n=ca(e,(t||this).context);return n&&n.scale()}function Wle(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 tC(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(r){e.warn(r)}return n[n.length-1]}function Hle(){return tC(this.context.dataflow,"warn",arguments)}function Gle(){return tC(this.context.dataflow,"info",arguments)}function Yle(){return tC(this.context.dataflow,"debug",arguments)}function $x(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function hE(e){const t=Yu(e),n=$x(t.r),r=$x(t.g),i=$x(t.b);return .2126*n+.7152*r+.0722*i}function Vle(e,t){const n=hE(e),r=hE(t),i=Math.max(n,r),s=Math.min(n,r);return(i+.05)/(s+.05)}function Xle(){const e=[].slice.call(arguments);return e.unshift({}),dt(...e)}function dP(e,t){return e===t||e!==e&&t!==t?!0:oe(e)?oe(t)&&e.length===t.length?Kle(e,t):!1:Fe(e)&&Fe(t)?hP(e,t):!1}function Kle(e,t){for(let n=0,r=e.length;nhP(e,t)}function Zle(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?Qi:oe(n)||dy(n)?n:Z4(n),c.remove(f)),t&&c.insert(t),r&&(f=Z4(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 Jle(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 Qle(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const J4={};function ece(e,t){const n=J4[t]||(J4[t]=As(t));return oe(e)?e.map(n):n(e)}function ib(e){return oe(e)||ArrayBuffer.isView(e)?e:null}function nC(e){return ib(e)||(De(e)?e:null)}function tce(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 mce(e,t,n){const r=ca(e,(n||this).context);return function(i){return r?r.path.context(i)(t):""}}function vce(e){let t=null;return function(n){return n?eg(n,t=t||Ed(e)):e}}const pP=e=>e.data;function gP(e,t){const n=lP.call(t,e);return n.root&&n.root.lookup||{}}function yce(e,t,n){const r=gP(e,this),i=r[t],s=r[n];return i&&s?i.path(s).map(pP):void 0}function bce(e,t){const n=gP(e,this)[t];return n?n.ancestors().map(pP):void 0}const mP=()=>typeof window<"u"&&window||null;function xce(){const e=mP();return e?e.screen:{}}function _ce(){const e=mP();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function wce(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function vP(e,t,n){if(!e)return[];const[r,i]=e,s=new zn().set(r[0],r[1],i[0],i[1]),o=n||this.context.dataflow.scenegraph().root;return Q9(o,s,Ece(t))}function Ece(e){let t=null;if(e){const n=Me(e.marktype),r=Me(e.markname);t=i=>(!n.length||n.some(s=>i.marktype===s))&&(!r.length||r.some(s=>i.name===s))}return t}function Ace(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;e=Me(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 kce(e){return Me(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 Sce(e,t,n){const{x:r,y:i,mark:s}=n,o=new zn().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),vP([[o.x1,o.y1],[o.x2,o.y2]],e,s).filter(u=>Cce(u.x,u.y,t))}function Cce(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 fg={random(){return Ss()},cumulativeNormal:vy,cumulativeLogNormal:mk,cumulativeUniform:xk,densityNormal:fk,densityLogNormal:gk,densityUniform:bk,quantileNormal:yy,quantileLogNormal:vk,quantileUniform:_k,sampleNormal:my,sampleLogNormal:pk,sampleUniform:yk,isArray:oe,isBoolean:ul,isDate:Ou,isDefined(e){return e!==void 0},isNumber:Ut,isObject:Fe,isRegExp:UA,isString:De,isTuple:dy,isValid(e){return e!=null&&e===e},toBoolean:WA,toDate(e){return HA(e)},toNumber:Nr,toString:GA,indexof:nce,join:tce,lastindexof:rce,replace:sce,reverse:oce,sort:ace,slice:ice,flush:ER,lerp:kR,merge:Xle,pad:$R,peek:Nt,pluck:ece,span:Bg,inrange:Rf,truncate:FR,rgb:Yu,lab:D1,hcl:M1,hsl:$1,luminance:hE,contrast:Vle,sequence:Gi,format:$le,utcFormat:Fle,utcParse:Mle,utcOffset:aN,utcSequence:cN,timeFormat:cP,timeParse:Dle,timeOffset:oN,timeSequence:lN,timeUnitSpecifier:XR,monthFormat:Tle,monthAbbrevFormat:Rle,dayFormat:Nle,dayAbbrevFormat:Ole,quarter:bR,utcquarter:xR,week:ZR,utcweek:eN,dayofyear:KR,utcdayofyear:QR,warn:Hle,info:Gle,debug:Yle,extent(e){return Vo(e)},inScope:Wle,intersect:vP,clampRange:_R,pinchDistance:Jle,pinchAngle:Qle,screen:xce,containerSize:wce,windowSize:_ce,bandspace:uce,setdata:Sle,pathShape:vce,panLinear:gR,panLog:mR,panPow:vR,panSymlog:yR,zoomLinear:IA,zoomLog:PA,zoomPow:p1,zoomSymlog:BA,encode:Cle,modify:Zle,lassoAppend:Ace,lassoPath:kce,intersectLasso:Sce},$ce=["view","item","group","xy","x","y"],Fce="event.vega.",yP="this.",rC={},bP={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Ee(fP+e)}]`,functions:Dce,constants:iP,visitors:rC},pE=oP(bP);function Dce(e){const t=sP(e);$ce.forEach(n=>t[n]=Fce+n);for(const n in fg)t[n]=yP+n;return dt(t,Ble(e,fg,rC)),t}function In(e,t,n){return arguments.length===1?fg[e]:(fg[e]=t,n&&(rC[e]=n),pE&&(pE.functions[e]=yP+e),this)}In("bandwidth",lce,ii);In("copy",cce,ii);In("domain",fce,ii);In("range",hce,ii);In("invert",dce,ii);In("scale",pce,ii);In("gradient",gce,ii);In("geoArea",zle,ii);In("geoBounds",jle,ii);In("geoCentroid",Ule,ii);In("geoShape",mce,ii);In("geoScale",qle,ii);In("indata",kle,Ple);In("data",lP,Q3);In("treePath",yce,Q3);In("treeAncestors",bce,Q3);In("vlSelectionTest",vle,J3);In("vlSelectionIdTest",xle,J3);In("vlSelectionResolve",wle,J3);In("vlSelectionTuples",_le);function Qo(e,t){const n={};let r;try{e=De(e)?e:Ee(e)+"",r=rP(e)}catch{ne("Expression parse error: "+e)}r.visit(s=>{if(s.type!==KI)return;const o=s.callee.name,a=bP.visitors[o];a&&a(o,s.arguments,t,n)});const i=pE(r);return i.globals.forEach(s=>{const o=fP+s;!Le(n,o)&&t.getSignal(s)&&(n[o]=t.signalRef(s))}),{$expr:dt({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}function Mce(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 Tce=ro(["rule"]),Q4=ro(["group","image","rect"]);function Rce(e,t){let n="";return Tce[t]||(e.x2&&(e.x?(Q4[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?(Q4[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 iC(e){return(e+"").toLowerCase()}function Nce(e){return iC(e)==="operator"}function Oce(e){return iC(e)==="collect"}function Bh(e,t,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function Lce(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 Ice={operator:(e,t)=>Bh(e,["_"],t.code),parameter:(e,t)=>Bh(e,["datum","_"],t.code),event:(e,t)=>Bh(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return Bh(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["+Ee(s)+"]";i+=`$=${r[s].code};if(${o}!==$)${o}=$,m=1;`}return i+=Rce(r,n),i+="return m;",Bh(e,["item","_"],i)},codegen:{get(e){const t=`[${e.map(Ee).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)`),Lce(u,l,-a,a)},i=Function("a","b","var u, v; return "+e.map(r).join("")+"0;");return n?i.bind(n):i}}};function Pce(e){const t=this;Nce(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function Bce(e){const t=this;if(e.params){const n=t.get(e.id);n||ne("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function zce(e,t){t=t||{};const n=this;for(const r in e){const i=e[r];t[r]=oe(i)?i.map(s=>eM(s,n,t)):eM(i,n,t)}return t}function eM(e,t,n){if(!e||!Fe(e))return e;for(let r=0,i=tM.length,s;ri&&i.$tupleid?Ye:i);return t.fn[n]||(t.fn[n]=zA(r,e.$order,t.expr.codegen))}function Gce(e,t){const n=e.$encode,r={};for(const i in n){const s=n[i];r[i]=Ti(t.encodeExpression(s.$expr),s.$fields),r[i].output=s.$output}return r}function Yce(e,t){return t}function Vce(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 Xce(){return Ye}function Kce(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&&ne("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function Zce(e){var t=this,n=Fe(n=e.source)?n.$ref:n,r=t.get(n),i=null,s=e.update,o=void 0;r||ne("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 Jce={skip:!0};function Qce(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 efe(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],Jce)}),Object.keys(r||{}).forEach(s=>{n.pulse(t.data[s].input,n.changeset().remove(Qi).insert(r[s]))}),(e.subcontext||[]).forEach((s,o)=>{const a=t.subcontext[o];a&&a.setState(s)})}function xP(e,t,n,r){return new _P(e,t,n,r)}function _P(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||Ice,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function nM(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)}_P.prototype=nM.prototype={fork(){const e=new nM(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),Oce(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[iC(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:Mce,parseOperator:Pce,parseOperatorParameters:Bce,parseParameters:zce,parseStream:Kce,parseUpdate:Zce,getState:Qce,setState:efe};function tfe(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),wP(t,e.description()))}function wP(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function nfe(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const Fx="default";function rfe(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:Fx,item:null}));e.on(e.events("view","pointermove"),t,(n,r)=>{const i=t.value,s=i?De(i)?i:i.user:Fx,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 De(r)||(i=r.item,r=r.user),gE(e,r&&r!==Fx?r:i||r),i},{cursor:t})}function gE(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 kv(e,t){var n=e._runtime.data;return Le(n,t)||ne("Unrecognized data set: "+t),n[t]}function ife(e,t){return arguments.length<2?kv(this,e).values.value:sb.call(this,e,ll().remove(Qi).insert(t))}function sb(e,t){IN(t)||ne("Second argument to changes must be a changeset.");const n=kv(this,e);return n.modified=!0,this.pulse(n.input,t)}function sfe(e,t){return sb.call(this,e,ll().insert(t))}function ofe(e,t){return sb.call(this,e,ll().remove(t))}function EP(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function AP(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function ob(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function afe(e){var t=ob(e),n=EP(e),r=AP(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 ufe(e,t,n){var r=e._renderer,i=r&&r.canvas(),s,o,a;return i&&(a=ob(e),o=t.changedTouches?t.changedTouches[0]:t,s=Hy(o,i),s[0]-=a[0],s[1]-=a[1]),t.dataflow=e,t.item=n,t.vega=lfe(e,n,s),t}function lfe(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;De(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:qr(e),item:qr(t||{}),group:i,xy:s,x:o=>s(o)[0],y:o=>s(o)[1]}}const rM="view",cfe="timer",ffe="window",dfe={trap:!1};function hfe(e){const t=dt({defaults:{}},e),n=(r,i)=>{i.forEach(s=>{oe(r[s])&&(r[s]=ro(r[s]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function kP(e,t,n,r){e._eventListeners.push({type:n,sources:Me(t),handler:r})}function pfe(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 um(e,t,n){const r=e._eventConfig&&e._eventConfig[t];return r===!1||Fe(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function gfe(e,t,n){var r=this,i=new gy(n),s=function(l,c){r.runAsync(null,()=>{e===rM&&pfe(r,t)&&l.preventDefault(),i.receive(ufe(r,l,c))})},o;if(e===cfe)um(r,"timer",t)&&r.timer(s,t);else if(e===rM)um(r,"view",t)&&r.addEventListener(t,s,dfe);else if(e===ffe?um(r,"window",t)&&typeof window<"u"&&(o=[window]):typeof document<"u"&&um(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 Zi(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 yfe="vega-bind",bfe="vega-bind-name",xfe="vega-bind-radio";function _fe(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=jA(r.debounce,i.update))),(r.input==null&&r.element?wfe:Afe)(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 wfe(e,t,n,r){const i=n.event||"input",s=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,s),kP(r,t,i,s),e.set=o=>{t.value=o,t.dispatchEvent(Efe(i))}}function Efe(e){return typeof Event<"u"?new Event(e):{type:e}}function Afe(e,t,n,r){const i=r.signal(n.signal),s=Zi("div",{class:yfe}),o=n.input==="radio"?s:s.appendChild(Zi("label"));o.appendChild(Zi("span",{class:bfe},n.name||n.signal)),t.appendChild(s);let a=kfe;switch(n.input){case"checkbox":a=Sfe;break;case"select":a=Cfe;break;case"radio":a=$fe;break;case"range":a=Ffe;break}a(e,o,n,i)}function kfe(e,t,n,r){const i=Zi("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 Sfe(e,t,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const s=Zi("input",i);t.appendChild(s),s.addEventListener("change",()=>e.update(s.checked)),e.elements=[s],e.set=o=>s.checked=!!o||null}function Cfe(e,t,n,r){const i=Zi("select",{name:n.signal}),s=n.labels||[];n.options.forEach((o,a)=>{const u={value:o};Sv(o,r)&&(u.selected=!0),i.appendChild(Zi("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};Sv(o,r)&&(u.checked=!0);const l=Zi("input",u);l.addEventListener("change",()=>e.update(o));const c=Zi("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 Sv(e,t){return e===t||e+""==t+""}function SP(e,t,n,r,i,s){return t=t||new r(e.loader()),t.initialize(n,EP(e),AP(e),ob(e),i,s).background(e.background())}function sC(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function Dfe(e,t,n,r){const i=new r(e.loader(),sC(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,ob(e),e);return t&&t.handlers().forEach(s=>{i.on(s.type,s.handler)}),i}function Mfe(e,t){const n=this,r=n._renderType,i=n._eventConfig.bind,s=Gy(r);e=n._el=e?Dx(n,e,!0):null,tfe(n),s||n.error("Unrecognized renderer type: "+r);const o=s.handler||i0,a=e?s.renderer:s.headless;return n._renderer=a?SP(n,n._renderer,e,a):null,n._handler=Dfe(n,n._handler,e,o),n._redraw=!0,e&&i!=="none"&&(t=t?n._elBind=Dx(n,t,!0):e.appendChild(Zi("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&i!=="container"&&(u.element=Dx(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{_fe(n,u.element||t,u)})),n}function Dx(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 zh=e=>+e||0,Tfe=e=>({top:e,bottom:e,left:e,right:e});function aM(e){return Fe(e)?{top:zh(e.top),bottom:zh(e.bottom),left:zh(e.left),right:zh(e.right)}:Tfe(zh(e))}async function oC(e,t,n,r){const i=Gy(t),s=i&&i.headless;return s||ne("Unrecognized renderer type: "+t),await e.runAsync(),SP(e,null,null,s,n,r).renderAsync(e._scenegraph.root)}async function Rfe(e,t){e!==Su.Canvas&&e!==Su.SVG&&e!==Su.PNG&&ne("Unrecognized image type: "+e);const n=await oC(this,e,t);return e===Su.SVG?Nfe(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function Nfe(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function Ofe(e,t){return(await oC(this,Su.Canvas,e,t)).canvas()}async function Lfe(e){return(await oC(this,Su.SVG,e)).svg()}function Ife(e,t,n){return xP(e,vd,fg,n).parse(t)}function Pfe(e){var t=this._runtime.scales;return Le(t,e)||ne("Unrecognized scale or projection: "+e),t[e].value}var CP="width",$P="height",aC="padding",uM={skip:!0};function FP(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===aC?r.left+r.right:0)}function DP(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===aC?r.top+r.bottom:0)}function Bfe(e){var t=e._signals,n=t[CP],r=t[$P],i=t[aC];function s(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,a=>{e._width=a.size,e._viewWidth=FP(e,a.size),s()},{size:n}),e._resizeHeight=e.add(null,a=>{e._height=a.size,e._viewHeight=DP(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 zfe(e,t,n,r,i,s){this.runAfter(o=>{let a=0;o._autosize=0,o.width()!==n&&(a=1,o.signal(CP,n,uM),o._resizeWidth.skip(!0)),o.height()!==r&&(a=1,o.signal($P,r,uM),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 jfe(e){return this._runtime.getState(e||{data:Ufe,signals:qfe,recurse:!0})}function Ufe(e,t){return t.modified&&oe(t.input.value)&&!e.startsWith("_:vega:_")}function qfe(e,t){return!(e==="parent"||t instanceof vd.proxy)}function Wfe(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function Hfe(e,t){function n(r){e({timestamp:Date.now(),elapsed:r})}this._timers.push(gse(n,t))}function Gfe(e,t,n,r){const i=e.element();i&&i.setAttribute("title",Yfe(r))}function Yfe(e){return e==null?"":oe(e)?MP(e):Fe(e)&&!Ou(e)?Vfe(e):e+""}function Vfe(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(oe(n)?MP(n):TP(n))}).join(` `)}function MP(e){return"["+e.map(TP).join(", ")+"]"}function TP(e){return oe(e)?"[…]":Fe(e)&&!Ou(e)?"{…}":e}function Xfe(){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 RP(e,t){const n=this;if(t=t||{},jf.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=dt({},e.locale,t.locale);n.locale(CN(s.number,s.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Su.Canvas,n._scenegraph=new S9;const r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||Gfe,n._redraw=!0,n._handler=new i0().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=hfe(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=Ife(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(s=>({state:null,param:dt({},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=FP(n,n._width),n._viewHeight=DP(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,Bfe(n),nfe(n),rfe(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function lm(e,t){return Le(e._signals,t)?e._signals[t]:ne("Unrecognized signal name: "+Ee(t))}function NP(e,t){const n=(e._targets||[]).filter(r=>r._update&&r._update.handler===t);return n.length?n[0]:null}function lM(e,t,n,r){let i=NP(n,r);return i||(i=sC(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function cM(e,t,n){const r=NP(t,n);return r&&t._targets.remove(r),e}Se(RP,jf,{async evaluate(e,t,n){if(await jf.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,afe(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(r){this.error(r)}return n&&Om(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&&wP(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=lm(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",aM(e)):aM(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?(Gy(e)||ne("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&&(jf.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(lm(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:zfe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=sC(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 lM(this,e,lm(this,e),t)},removeSignalListener(e,t){return cM(this,lm(this,e),t)},addDataListener(e,t){return lM(this,e,kv(this,e).values,t)},removeDataListener(e,t){return cM(this,kv(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=gE(this,null);this._globalCursor=!!e,t&&gE(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:Hfe,events:gfe,finalize:vfe,hover:mfe,data:ife,change:sb,insert:sfe,remove:ofe,scale:Pfe,initialize:Mfe,toImageURL:Rfe,toCanvas:Ofe,toSVG:Lfe,getState:jfe,setState:Wfe,_watchPixelRatio:Xfe});const Kfe="view",Cv="[",$v="]",OP="{",LP="}",Zfe=":",IP=",",Jfe="@",Qfe=">",ede=/[[\]{}]/,tde={"*":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 PP,BP;function gl(e,t,n){return PP=t||Kfe,BP=n||tde,zP(e.trim()).map(mE)}function nde(e){return BP[e]}function Pp(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 zP(e){const t=[],n=e.length;let r=0,i=0;for(;i' after between selector: "+e;r=r.map(mE);const i=mE(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function ide(e){const t={source:PP},n=[];let r=[0,0],i=0,s=0,o=e.length,a=0,u,l;if(e[o-1]===LP){if(a=e.lastIndexOf(OP),a>=0){try{r=sde(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]===Jfe&&(i=++a),u=Pp(e,a,Zfe),u1?(t.type=n[1],i?t.markname=n[0].slice(1):nde(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 sde(e){const t=e.split(IP);if(!e.length||t.length>2)throw e;return t.map(n=>{const r=+n;if(r!==r)throw e;return r})}function ode(e){return Fe(e)?e:{type:e||"pad"}}const jh=e=>+e||0,ade=e=>({top:e,bottom:e,left:e,right:e});function ude(e){return Fe(e)?e.signal?e:{top:jh(e.top),bottom:jh(e.bottom),left:jh(e.left),right:jh(e.right)}:ade(jh(e))}const rr=e=>Fe(e)&&!oe(e)?dt({},e):{value:e};function fM(e,t,n,r){return n!=null?(Fe(n)&&!oe(n)||oe(n)&&n.length&&Fe(n[0])?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function kr(e,t,n){for(const r in t)fM(e,r,t[r]);for(const r in n)fM(e,r,n[r],"update")}function fh(e,t,n){for(const r in t)n&&Le(n,r)||(e[r]=dt(e[r]||{},t[r]));return e}function Df(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const uC="mark",lC="frame",cC="scope",lde="axis",cde="axis-domain",fde="axis-grid",dde="axis-label",hde="axis-tick",pde="axis-title",gde="legend",mde="legend-band",vde="legend-entry",yde="legend-gradient",jP="legend-label",bde="legend-symbol",xde="legend-title",_de="title",wde="title-text",Ede="title-subtitle";function Ade(e,t,n,r,i){const s={},o={};let a,u,l,c;u="lineBreak",t==="text"&&i[u]!=null&&!Df(u,e)&&Mx(s,u,i[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===lC?i.group:n===uC?dt({},i.mark,i[t]):null;for(u in c)l=Df(u,e)||(u==="fill"||u==="stroke")&&(Df("fill",e)||Df("stroke",e)),l||Mx(s,u,c[u]);Me(r).forEach(f=>{const d=i.style&&i.style[f];for(const h in d)Df(h,e)||Mx(s,h,d[h])}),e=dt({},e);for(u in s)c=s[u],c.signal?(a=a||{})[u]=c:o[u]=c;return e.enter=dt(o,e.enter),a&&(e.update=dt(a,e.update)),e}function Mx(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const UP=e=>De(e)?Ee(e):e.signal?`(${e.signal})`:qP(e);function ab(e){if(e.gradient!=null)return Sde(e);let t=e.signal?`(${e.signal})`:e.color?kde(e.color):e.field!=null?qP(e.field):e.value!==void 0?Ee(e.value):void 0;return e.scale!=null&&(t=Cde(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${Qm(e.exponent)})`),e.mult!=null&&(t+=`*${Qm(e.mult)}`),e.offset!=null&&(t+=`+${Qm(e.offset)}`),e.round&&(t=`round(${t})`),t}const cm=(e,t,n,r)=>`(${e}(${[t,n,r].map(ab).join(",")})+'')`;function kde(e){return e.c?cm("hcl",e.h,e.c,e.l):e.h||e.s?cm("hsl",e.h,e.s,e.l):e.l||e.a?cm("lab",e.l,e.a,e.b):e.r||e.g||e.b?cm("rgb",e.r,e.g,e.b):null}function Sde(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:Ee(n));for(;t.length&&Nt(t)==null;)t.pop();return t.unshift(UP(e.gradient)),`gradient(${t.join(",")})`}function Qm(e){return Fe(e)?"("+ab(e)+")":e}function qP(e){return WP(Fe(e)?e:{datum:e})}function WP(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):ne("Invalid field reference: "+Ee(e));return e.signal||(r=De(r)?ia(r).map(Ee).join("]["):WP(r)),t+"["+r+"]"}function Cde(e,t){const n=UP(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?"":"*"+Qm(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function $de(e){let t="";return e.forEach(n=>{const r=ab(n);t+=n.test?`(${n.test})?${r}:`:r}),Nt(t)===":"&&(t+="null"),t}function HP(e,t,n,r,i,s){const o={};s=s||{},s.encoders={$encode:o},e=Ade(e,t,n,r,i.config);for(const a in e)o[a]=Fde(e[a],t,s,i);return s}function Fde(e,t,n,r){const i={},s={};for(const o in e)e[o]!=null&&(i[o]=Mde(Dde(e[o]),r,n,s));return{$expr:{marktype:t,channels:i},$fields:Object.keys(s),$output:Object.keys(e)}}function Dde(e){return oe(e)?$de(e):ab(e)}function Mde(e,t,n,r){const i=Qo(e,t);return i.$fields.forEach(s=>r[s]=1),dt(n,i.$params),i.$expr}const Tde="outer",Rde=["value","update","init","react","bind"];function dM(e,t){ne(e+' for "outer" push: '+Ee(t))}function GP(e,t){const n=e.name;if(e.push===Tde)t.signals[n]||dM("No prior signal definition",n),Rde.forEach(r=>{e[r]!==void 0&&dM("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 vE(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function ub(e,t,n,r){return new vE(e,t,n,r)}function Fv(e,t){return ub("operator",e,t)}function Ge(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function dg(e,t){return t?{$field:e,$name:t}:{$field:e}}const yE=dg("key");function hM(e,t){return{$compare:e,$order:t}}function Nde(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const Ode="ascending",Lde="descending";function Ide(e){return Fe(e)?(e.order===Lde?"-":"+")+lb(e.op,e.field):""}function lb(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const fC="scope",bE="view";function Gn(e){return e&&e.signal}function Pde(e){return e&&e.expr}function e1(e){if(Gn(e))return!0;if(Fe(e)){for(const t in e)if(e1(e[t]))return!0}return!1}function qs(e,t){return e??t}function cc(e){return e&&e.signal||e}const pM="timer";function hg(e,t){return(e.merge?zde:e.stream?jde:e.type?Ude:ne("Invalid stream specification: "+Ee(e)))(e,t)}function Bde(e){return e===fC?bE:e||bE}function zde(e,t){const n=e.merge.map(i=>hg(i,t)),r=dC({merge:n},e,t);return t.addStream(r).id}function jde(e,t){const n=hg(e.stream,t),r=dC({stream:n},e,t);return t.addStream(r).id}function Ude(e,t){let n;e.type===pM?(n=t.event(pM,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(Bde(e.source),e.type);const r=dC({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function dC(e,t,n){let r=t.between;return r&&(r.length!==2&&ne('Stream "between" parameter must have 2 entries: '+Ee(t)),e.between=[hg(r[0],n),hg(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(qde(t.marktype,t.markname,t.markrole)),t.source===fC&&r.push("inScope(event.item)"),r.length&&(e.filter=Qo("("+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 qde(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 Wde={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Hde(e,t,n){const r=e.encode,i={target:n};let s=e.events,o=e.update,a=[];s||ne("Signal update missing events specification."),De(s)&&(s=gl(s,t.isSubscope()?fC:bE)),s=Me(s).filter(u=>u.signal||u.scale?(a.push(u),0):1),a.length>1&&(a=[Yde(a)]),s.length&&a.push(s.length>1?{merge:s}:s[0]),r!=null&&(o&&ne("Signal encode and update are mutually exclusive."),o="encode(item(),"+Ee(r)+")"),i.update=De(o)?Qo(o,t):o.expr!=null?Qo(o.expr,t):o.value!=null?o.value:o.signal!=null?{$expr:Wde,$params:{$value:t.signalRef(o.signal)}}:ne("Invalid signal update specification."),e.force&&(i.options={force:!0}),a.forEach(u=>t.addUpdate(dt(Gde(u,t),i)))}function Gde(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):hg(e,t)}}function Yde(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function Vde(e,t){const n=t.getSignal(e.name);let r=e.update;e.init&&(r?ne("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=Qo(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(i=>Hde(i,t,n.id))}const un=e=>(t,n,r)=>ub(e,n,t||void 0,r),YP=un("aggregate"),Xde=un("axisticks"),VP=un("bound"),ho=un("collect"),gM=un("compare"),Kde=un("datajoin"),XP=un("encode"),Zde=un("expression"),Jde=un("facet"),Qde=un("field"),ehe=un("key"),the=un("legendentries"),nhe=un("load"),rhe=un("mark"),ihe=un("multiextent"),she=un("multivalues"),ohe=un("overlap"),ahe=un("params"),KP=un("prefacet"),uhe=un("projection"),lhe=un("proxy"),che=un("relay"),ZP=un("render"),fhe=un("scale"),tf=un("sieve"),dhe=un("sortitems"),JP=un("viewlayout"),hhe=un("values");let phe=0;const QP={min:"min",max:"max",count:"sum"};function ghe(e,t){const n=e.type||"linear";P7(n)||ne("Unrecognized scale type: "+Ee(n)),t.addScale(e.name,{type:n,domain:void 0})}function mhe(e,t){const n=t.getScale(e.name).params;let r;n.domain=eB(e.domain,e,t),e.range!=null&&(n.range=nB(e,t,n)),e.interpolate!=null&&She(e.interpolate,n),e.nice!=null&&(n.nice=khe(e.nice,t)),e.bins!=null&&(n.bins=Ahe(e.bins,t));for(r in e)Le(n,r)||r==="name"||(n[r]=ms(e[r],t))}function ms(e,t){return Fe(e)?e.signal?t.signalRef(e.signal):ne("Unsupported object: "+Ee(e)):e}function t1(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>ms(n,t))}function cb(e){ne("Can not find data set: "+Ee(e))}function eB(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&ne("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(oe(e)?vhe:e.fields?bhe:yhe)(e,t,n)}function vhe(e,t,n){return e.map(r=>ms(r,n))}function yhe(e,t,n){const r=n.getData(e.data);return r||cb(e.data),wd(t.type)?r.valuesRef(n,e.field,tB(e.sort,!1)):j7(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function bhe(e,t,n){const r=e.data,i=e.fields.reduce((s,o)=>(o=De(o)?{data:r,field:o}:oe(o)||o.signal?xhe(o,n):o,s.push(o),s),[]);return(wd(t.type)?_he:j7(t.type)?whe:Ehe)(e,n,i)}function xhe(e,t){const n="_:vega:_"+phe++,r=ho({});if(oe(e))r.value={$ingest:e};else if(e.signal){const i="setdata("+Ee(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,tf({})]),{data:n,field:"data"}}function _he(e,t,n){const r=tB(e.sort,!0);let i,s;const o=n.map(l=>{const c=t.getData(l.data);return c||cb(l.data),c.countsRef(t,l.field,r)}),a={groupby:yE,pulse:o};r&&(i=r.op||"count",s=r.field?lb(i,r.field):"count",a.ops=[QP[i]],a.fields=[t.fieldRef(s)],a.as=[s]),i=t.add(YP(a));const u=t.add(ho({pulse:Ge(i)}));return s=t.add(hhe({field:yE,sort:t.sortRef(r),pulse:Ge(u)})),Ge(s)}function tB(e,t){return e&&(!e.field&&!e.op?Fe(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?ne("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!QP[e.op]&&ne("Multiple domain scales can not be sorted using "+e.op)),e}function whe(e,t,n){const r=n.map(i=>{const s=t.getData(i.data);return s||cb(i.data),s.domainRef(t,i.field)});return Ge(t.add(she({values:r})))}function Ehe(e,t,n){const r=n.map(i=>{const s=t.getData(i.data);return s||cb(i.data),s.extentRef(t,i.field)});return Ge(t.add(ihe({extents:r})))}function Ahe(e,t){return e.signal||oe(e)?t1(e,t):t.objectProperty(e)}function khe(e,t){return e.signal?t.signalRef(e.signal):Fe(e)?{interval:ms(e.interval),step:ms(e.step)}:ms(e)}function She(e,t){t.interpolate=ms(e.type||e),e.gamma!=null&&(t.interpolateGamma=ms(e.gamma))}function nB(e,t,n){const r=t.config.range;let i=e.range;if(i.signal)return t.signalRef(i.signal);if(De(i)){if(r&&Le(r,i))return e=dt({},e,{range:r[i]}),nB(e,t,n);i==="width"?i=[0,{signal:"width"}]:i==="height"?i=wd(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:ne("Unrecognized scale range value: "+Ee(i))}else if(i.scheme){n.scheme=oe(i.scheme)?t1(i.scheme,t):ms(i.scheme,t),i.extent&&(n.schemeExtent=t1(i.extent,t)),i.count&&(n.schemeCount=ms(i.count,t));return}else if(i.step){n.rangeStep=ms(i.step,t);return}else{if(wd(e.type)&&!oe(i))return eB(i,e,t);oe(i)||ne("Unsupported range type: "+Ee(i))}return i.map(s=>(oe(s)?t1:ms)(s,t))}function Che(e,t){const n=t.config.projection||{},r={};for(const i in e)i!=="name"&&(r[i]=xE(e[i],i,t));for(const i in n)r[i]==null&&(r[i]=xE(n[i],i,t));t.addProjection(e.name,r)}function xE(e,t,n){return oe(e)?e.map(r=>xE(r,t,n)):Fe(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:ne("Unsupported parameter object: "+Ee(e)):e}const po="top",dh="left",hh="right",Ju="bottom",rB="center",$he="vertical",Fhe="start",Dhe="middle",Mhe="end",_E="index",hC="label",The="offset",Md="perc",Rhe="perc2",_s="value",h0="guide-label",pC="guide-title",Nhe="group-title",Ohe="group-subtitle",mM="symbol",n1="gradient",wE="discrete",EE="size",Lhe="shape",Ihe="fill",Phe="stroke",Bhe="strokeWidth",zhe="strokeDash",jhe="opacity",gC=[EE,Lhe,Ihe,Phe,Bhe,zhe,jhe],p0={name:1,style:1,interactive:1},Lt={value:0},ws={value:1},fb="group",iB="rect",mC="rule",Uhe="symbol",nf="text";function pg(e){return e.type=fb,e.interactive=e.interactive||!1,e}function Ri(e,t){const n=(r,i)=>qs(e[r],qs(t[r],i));return n.isVertical=r=>$he===qs(e.direction,t.direction||(r?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>qs(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>qs(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>qs(e.columns,qs(t.columns,+n.isVertical(!0))),n}function sB(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 qhe(e,t,n){const r=t.config.style[n];return r&&r[e]}function db(e,t,n){return`item.anchor === '${Fhe}' ? ${e} : item.anchor === '${Mhe}' ? ${t} : ${n}`}const vC=db(Ee(dh),Ee(hh),Ee(rB));function Whe(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'`},Fe(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 oB(e,t){return t?e?Fe(e)?Object.assign({},e,{offset:oB(e.offset,t)}):{value:e,offset:t}:t:e}function rs(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=fh(e.encode,t,p0)):e.interactive=!1,e}function Hhe(e,t,n,r){const i=Ri(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:Lt,x:Lt,y:Lt,width:rr(f),height:rr(d)},update:dt({},u,{opacity:ws,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:Lt}};return kr(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),rs({type:iB,role:yde,encode:h},r)}function Ghe(e,t,n,r,i){const s=Ri(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:Lt,fill:{scale:t,field:_s}};p[l]={signal:h+"datum."+Md,mult:u},p[c]=Lt,p[f]={signal:h+"datum."+Rhe,mult:u},p[d]=rr(a);const g={enter:p,update:dt({},p,{opacity:ws}),exit:{opacity:Lt}};return kr(g,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),rs({type:iB,role:mde,key:_s,from:i,encode:g},r)}const Yhe=`datum.${Md}<=0?"${dh}":datum.${Md}>=1?"${hh}":"${rB}"`,Vhe=`datum.${Md}<=0?"${Ju}":datum.${Md}>=1?"${po}":"${Dhe}"`;function vM(e,t,n,r){const i=Ri(e,t),s=i.isVertical(),o=rr(i.gradientThickness()),a=i.gradientLength();let u=i("labelOverlap"),l,c,f,d,h="";const p={enter:l={opacity:Lt},update:c={opacity:ws,text:{field:hC}},exit:{opacity:Lt}};return kr(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:qs(e.labelLimit,t.gradientLabelLimit)}),s?(l.align={value:"left"},l.baseline=c.baseline={signal:Vhe},f="y",d="x",h="1-"):(l.align=c.align={signal:Yhe},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:h+"datum."+Md,mult:a},l[d]=c[d]=o,o.offset=qs(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:i("labelSeparation"),method:u,order:"datum."+_E}:void 0,rs({type:nf,role:jP,style:h0,key:_s,from:r,encode:p,overlap:u},n)}function Xhe(e,t,n,r,i){const s=Ri(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.${The} : datum.${EE}`,h=l?rr(l):{field:EE},p=`datum.${_E}`,g=`max(1, ${i})`;let m,v,b,x,_;h.mult=.5,m={enter:v={opacity:Lt,x:{signal:d,mult:.5,offset:c},y:h},update:b={opacity:ws,x:v.x,y:v.y},exit:{opacity:Lt}};let w=null,A=null;e.fill||(w=t.symbolBaseFillColor,A=t.symbolBaseStrokeColor),kr(m,{fill:s("symbolFillColor",w),shape:s("symbolType"),size:s("symbolSize"),stroke:s("symbolStrokeColor",A),strokeDash:s("symbolDash"),strokeDashOffset:s("symbolDashOffset"),strokeWidth:s("symbolStrokeWidth")},{opacity:s("symbolOpacity")}),gC.forEach($=>{e[$]&&(b[$]=v[$]={scale:e[$],field:_s})});const E=rs({type:Uhe,role:bde,key:_s,from:f,clip:l?!0:void 0,encode:m},n.symbols),S=rr(c);S.offset=s("labelOffset"),m={enter:v={opacity:Lt,x:{signal:d,offset:S},y:h},update:b={opacity:ws,text:{field:hC},x:v.x,y:v.y},exit:{opacity:Lt}},kr(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 C=rs({type:nf,role:jP,style:h0,key:_s,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:Lt,height:l?rr(l):Lt,opacity:Lt},exit:{opacity:Lt},update:b={opacity:ws,row:{signal:null},column:{signal:null}}},s.isVertical(!0)?(x=`ceil(item.mark.items.length / ${g})`,b.row.signal=`${p}%${x}`,b.column.signal=`floor(${p} / ${x})`,_={field:["row",p]}):(b.row.signal=`floor(${p} / ${g})`,b.column.signal=`${p} % ${g}`,_={field:p}),b.column.signal=`(${i})?${b.column.signal}:${p}`,r={facet:{data:r,name:"value",groupby:_E}},pg({role:cC,from:r,encode:fh(m,o,p0),marks:[E,C],name:u,interactive:a,sort:_})}function Khe(e,t){const n=Ri(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const yC='item.orient === "left"',bC='item.orient === "right"',hb=`(${yC} || ${bC})`,Zhe=`datum.vgrad && ${hb}`,Jhe=db('"top"','"bottom"','"middle"'),Qhe=db('"right"','"left"','"center"'),epe=`datum.vgrad && ${bC} ? (${Qhe}) : (${hb} && !(datum.vgrad && ${yC})) ? "left" : ${vC}`,tpe=`item._anchor || (${hb} ? "middle" : "start")`,npe=`${Zhe} ? (${yC} ? -90 : 90) : 0`,rpe=`${hb} ? (datum.vgrad ? (${bC} ? "bottom" : "top") : ${Jhe}) : "top"`;function ipe(e,t,n,r){const i=Ri(e,t),s={enter:{opacity:Lt},update:{opacity:ws,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Lt}};return kr(s,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:tpe},angle:{signal:npe},align:{signal:epe},baseline:{signal:rpe},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")}),rs({type:nf,role:xde,style:pC,from:r,encode:s},n)}function spe(e,t){let n;return Fe(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+yM(e.path)+")":e.sphere&&(n="geoShape("+yM(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function yM(e){return Fe(e)&&e.signal?e.signal:Ee(e)}function aB(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===fb?cC:t||uC}function ope(e){return{marktype:e.type,name:e.name||void 0,role:e.role||aB(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function ape(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function xC(e,t){const n=zN(e.type);n||ne("Unrecognized transform type: "+Ee(e.type));const r=ub(n.type.toLowerCase(),null,uB(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function uB(e,t,n){const r={},i=e.params.length;for(let s=0;sbM(e,s,n)):bM(e,i,n)}function bM(e,t,n){const r=e.type;if(Gn(t))return _M(r)?ne("Expression references can not be signals."):Tx(r)?n.fieldRef(t):wM(r)?n.compareRef(t):n.signalRef(t.signal);{const i=e.expr||Tx(r);return i&&fpe(t)?n.exprRef(t.expr,t.as):i&&dpe(t)?dg(t.field,t.as):_M(r)?Qo(t,n):hpe(r)?Ge(n.getData(t).values):Tx(r)?dg(t):wM(r)?n.compareRef(t):t}}function lpe(e,t,n){return De(t.from)||ne('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function cpe(e,t,n){const r=t[e.name];return e.array?(oe(r)||ne("Expected an array of sub-parameters. Instead: "+Ee(r)),r.map(i=>xM(e,i,n))):xM(e,r,n)}function xM(e,t,n){const r=e.params.length;let i;for(let o=0;oe&&e.expr,dpe=e=>e&&e.field,hpe=e=>e==="data",_M=e=>e==="expr",Tx=e=>e==="field",wM=e=>e==="compare";function ppe(e,t,n){let r,i,s,o,a;return e?(r=e.facet)&&(t||ne("Only group marks can be faceted."),r.field!=null?o=a=r1(r,n):(e.data?a=Ge(n.getData(e.data).aggregate):(s=xC(dt({type:"aggregate",groupby:Me(r.groupby)},r.aggregate),n),s.params.key=n.keyRef(r.groupby),s.params.pulse=r1(r,n),o=a=Ge(n.add(s))),i=n.keyRef(r.groupby,!0))):o=Ge(n.add(ho(null,[{}]))),o||(o=r1(e,n)),{key:i,pulse:o,parent:a}}function r1(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Ge(t.getData(e.data).output)}function Oc(e,t,n,r,i){this.scope=e,this.input=t,this.output=n,this.values=r,this.aggregate=i,this.index={}}Oc.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=Qo(l,t);u.update=c.$expr,u.params=c.$params}function pb(e,t){const n=aB(e),r=e.type===fb,i=e.from&&e.from.facet,s=e.overlap;let o=e.layout||n===cC||n===lC,a,u,l,c,f,d,h;const p=n===uC||o||i,g=ppe(e.from,r,t);u=t.add(Kde({key:g.key||(e.key?dg(e.key):void 0),pulse:g.pulse,clean:!r}));const m=Ge(u);u=l=t.add(ho({pulse:m})),u=t.add(rhe({markdef:ope(e),interactive:ape(e.interactive,t),clip:spe(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Ge(u)}));const v=Ge(u);u=c=t.add(XP(HP(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=xC(A,t),S=E.metadata;(S.generates||S.changes)&&ne("Mark transforms should not generate new data."),S.nomod||(c.params.mod=!0),E.params.pulse=Ge(u),t.add(u=E)}),e.sort&&(u=t.add(dhe({sort:t.compareRef(e.sort),pulse:Ge(u)})));const b=Ge(u);(i||o)&&(o=t.add(JP({layout:t.objectProperty(e.layout),legends:t.legends,mark:v,pulse:b})),d=Ge(o));const x=t.add(VP({mark:v,pulse:d||b}));h=Ge(x),r&&(p&&(a=t.operators,a.pop(),o&&a.pop()),t.pushState(b,d||h,m),i?gpe(e,t,g):p?mpe(e,t,g):t.parse(e),t.popState(),p&&(o&&a.push(o),a.push(x))),s&&(h=vpe(s,h,t));const _=t.add(ZP({pulse:h})),w=t.add(tf({pulse:Ge(_)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new Oc(t,l,_,w)),e.on&&e.on.forEach(A=>{(A.insert||A.remove||A.toggle)&&ne("Marks only support modify triggers."),cB(A,t,f)}))}function vpe(e,t,n){const r=e.method,i=e.bound,s=e.separation,o={separation:Gn(s)?n.signalRef(s.signal):s,method:Gn(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=Gn(a)?n.signalRef(a.signal):+a,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return Ge(n.add(ohe(o)))}function ype(e,t){const n=t.config.legend,r=e.encode||{},i=Ri(e,n),s=r.legend||{},o=s.name||void 0,a=s.interactive,u=s.style,l={};let c=0,f,d,h;gC.forEach(x=>e[x]?(l[x]=e[x],c=c||e[x]):0),c||ne("Missing valid scale for legend.");const p=bpe(e,t.scaleType(c)),g={title:e.title!=null,scales:l,type:p,vgrad:p!=="symbol"&&i.isVertical()},m=Ge(t.add(ho(null,[g]))),v={enter:{x:{value:0},y:{value:0}}},b=Ge(t.add(the(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===n1?(h=[Hhe(e,c,n,r.gradient),vM(e,n,r.labels,b)],d.count=d.count||t.signalRef(`max(2,2*floor((${cc(i.gradientLength())})/100))`)):p===wE?h=[Ghe(e,c,n,r.gradient,b),vM(e,n,r.labels,b)]:(f=Khe(e,n),h=[Xhe(e,n,r,b,cc(f.columns))],d.size=wpe(e,t,h[0].marks)),h=[pg({role:vde,from:m,encode:v,marks:h,layout:f,interactive:a})],g.title&&h.push(ipe(e,n,r.title,m)),pb(pg({role:gde,from:m,encode:fh(_pe(i,e,n),s,p0),marks:h,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:o,interactive:a,style:u}),t)}function bpe(e,t){let n=e.type||mM;return!e.type&&xpe(e)===1&&(e.fill||e.stroke)&&(n=_S(t)?n1:pw(t)?wE:mM),n!==n1?n:pw(t)?wE:n1}function xpe(e){return gC.reduce((t,n)=>t+(e[n]?1:0),0)}function _pe(e,t,n){const r={enter:{},update:{}};return kr(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 wpe(e,t,n){const r=cc(AM("size",e,n)),i=cc(AM("strokeWidth",e,n)),s=cc(Epe(n[1].encode,t,h0));return Qo(`max(ceil(sqrt(${r})+${i}),${s})`,t)}function AM(e,t,n){return t[e]?`scale("${t[e]}",datum)`:sB(e,n[0].encode)}function Epe(e,t,n){return sB("fontSize",e)||qhe("fontSize",t,n)}const Ape=`item.orient==="${dh}"?-90:item.orient==="${hh}"?90:0`;function kpe(e,t){e=De(e)?{text:e}:e;const n=Ri(e,t.config.title),r=e.encode||{},i=r.group||{},s=i.name||void 0,o=i.interactive,a=i.style,u=[],l={},c=Ge(t.add(ho(null,[l])));return u.push($pe(e,n,Spe(e),c)),e.subtitle&&u.push(Fpe(e,n,r.subtitle,c)),pb(pg({role:_de,from:c,encode:Cpe(n,i),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:s,interactive:o,style:a}),t)}function Spe(e){const t=e.encode;return t&&t.title||dt({name:e.name,interactive:e.interactive,style:e.style},t)}function Cpe(e,t){const n={enter:{},update:{}};return kr(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:vC},angle:{signal:Ape},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),fh(n,t,p0)}function $pe(e,t,n,r){const i={value:0},s=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return kr(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")}),rs({type:nf,role:wde,style:Nhe,from:r,encode:o},n)}function Fpe(e,t,n,r){const i={value:0},s=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return kr(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")}),rs({type:nf,role:Ede,style:Ohe,from:r,encode:o},n)}function Dpe(e,t){const n=[];e.transform&&e.transform.forEach(r=>{n.push(xC(r,t))}),e.on&&e.on.forEach(r=>{cB(r,t,e.name)}),t.addDataPipeline(e.name,Mpe(e,t,n))}function Mpe(e,t,n){const r=[];let i=null,s=!1,o=!1,a,u,l,c,f;for(e.values?Gn(e.values)||e1(e.format)?(r.push(kM(t,e)),r.push(i=Dl())):r.push(i=Dl({$ingest:e.values,$format:e.format})):e.url?e1(e.url)||e1(e.format)?(r.push(kM(t,e)),r.push(i=Dl())):r.push(i=Dl({$request:e.url,$format:e.format})):e.source&&(i=a=Me(e.source).map(d=>Ge(t.getData(d).output)),r.push(null)),u=0,l=n.length;ue===Ju||e===po,gb=(e,t,n)=>Gn(e)?Ope(e.signal,t,n):e===dh||e===po?t:n,ir=(e,t,n)=>Gn(e)?Rpe(e.signal,t,n):fB(e)?t:n,Qs=(e,t,n)=>Gn(e)?Npe(e.signal,t,n):fB(e)?n:t,dB=(e,t,n)=>Gn(e)?Lpe(e.signal,t,n):e===po?{value:t}:{value:n},Tpe=(e,t,n)=>Gn(e)?Ipe(e.signal,t,n):e===hh?{value:t}:{value:n},Rpe=(e,t,n)=>hB(`${e} === '${po}' || ${e} === '${Ju}'`,t,n),Npe=(e,t,n)=>hB(`${e} !== '${po}' && ${e} !== '${Ju}'`,t,n),Ope=(e,t,n)=>_C(`${e} === '${dh}' || ${e} === '${po}'`,t,n),Lpe=(e,t,n)=>_C(`${e} === '${po}'`,t,n),Ipe=(e,t,n)=>_C(`${e} === '${hh}'`,t,n),hB=(e,t,n)=>(t=t!=null?rr(t):t,n=n!=null?rr(n):n,SM(t)&&SM(n)?(t=t?t.signal||Ee(t.value):null,n=n?n.signal||Ee(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[dt({test:e},t)].concat(n||[])),SM=e=>e==null||Object.keys(e).length===1,_C=(e,t,n)=>({signal:`${e} ? (${Pf(t)}) : (${Pf(n)})`}),Ppe=(e,t,n,r,i)=>({signal:(r!=null?`${e} === '${dh}' ? (${Pf(r)}) : `:"")+(n!=null?`${e} === '${Ju}' ? (${Pf(n)}) : `:"")+(i!=null?`${e} === '${hh}' ? (${Pf(i)}) : `:"")+(t!=null?`${e} === '${po}' ? (${Pf(t)}) : `:"")+"(null)"}),Pf=e=>Gn(e)?e.signal:e==null?null:Ee(e),Bpe=(e,t)=>t===0?0:Gn(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},Hf=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Ef(e,t,n,r){let i;if(t&&Le(t,e))return t[e];if(Le(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[pC][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[h0][i]}return null}function CM(e){const t={};for(const n of e)if(n)for(const r in n)t[r]=1;return Object.keys(t)}function zpe(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(Gn(o)){const f=CM([n.axisX,n.axisY]),d=CM([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);a={};for(l of f)a[l]=ir(o,Ef(l,n.axisX,i,r),Ef(l,n.axisY,i,r));u={};for(l of d)u[l]=Ppe(o.signal,Ef(l,n.axisTop,i,r),Ef(l,n.axisBottom,i,r),Ef(l,n.axisLeft,i,r),Ef(l,n.axisRight,i,r))}else a=o===po||o===Ju?n.axisX:n.axisY,u=n["axis"+o[0].toUpperCase()+o.slice(1)];return a||u||s?dt({},i,a,u,s):i}function jpe(e,t,n,r){const i=Ri(e,t),s=e.orient;let o,a;const u={enter:o={opacity:Lt},update:a={opacity:ws},exit:{opacity:Lt}};kr(u,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=$M(e,0),c=$M(e,1);return o.x=a.x=ir(s,l,Lt),o.x2=a.x2=ir(s,c),o.y=a.y=Qs(s,l,Lt),o.y2=a.y2=Qs(s,c),rs({type:mC,role:cde,from:r,encode:u},n)}function $M(e,t){return{scale:e.scale,range:t}}function Upe(e,t,n,r,i){const s=Ri(e,t),o=e.orient,a=e.gridScale,u=gb(o,1,-1),l=qpe(e.offset,u);let c,f,d;const h={enter:c={opacity:Lt},update:d={opacity:ws},exit:f={opacity:Lt}};kr(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:_s,band:i.band,extra:i.extra,offset:i.offset,round:s("tickRound")},g=ir(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}:dt(g,{mult:u,offset:l});return c.x=d.x=ir(o,p,m),c.y=d.y=Qs(o,p,m),c.x2=d.x2=Qs(o,v),c.y2=d.y2=ir(o,v),f.x=ir(o,p),f.y=Qs(o,p),rs({type:mC,role:fde,key:_s,from:r,encode:h},n)}function qpe(e,t){if(t!==1)if(!Fe(e))e=Gn(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=dt({},e);for(;n.mult!=null;)if(Fe(n.mult))n=n.mult=dt({},n.mult);else return n.mult=Gn(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function Wpe(e,t,n,r,i,s){const o=Ri(e,t),a=e.orient,u=gb(a,-1,1);let l,c,f;const d={enter:l={opacity:Lt},update:f={opacity:ws},exit:c={opacity:Lt}};kr(d,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const h=rr(i);h.mult=u;const p={scale:e.scale,field:_s,band:s.band,extra:s.extra,offset:s.offset,round:o("tickRound")};return f.y=l.y=ir(a,Lt,p),f.y2=l.y2=ir(a,h),c.x=ir(a,p),f.x=l.x=Qs(a,Lt,p),f.x2=l.x2=Qs(a,h),c.y=Qs(a,p),rs({type:mC,role:hde,key:_s,from:r,encode:d},n)}function Rx(e,t,n,r,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+r+","+i+")"}}function Hpe(e,t,n,r,i,s){const o=Ri(e,t),a=e.orient,u=e.scale,l=gb(a,-1,1),c=cc(o("labelFlush")),f=cc(o("labelFlushOffset")),d=o("labelAlign"),h=o("labelBaseline");let p=c===0||!!c,g;const m=rr(i);m.mult=l,m.offset=rr(o("labelPadding")||0),m.offset.mult=l;const v={scale:u,field:_s,band:.5,offset:oB(s.offset,o("labelOffset"))},b=ir(a,p?Rx(u,c,'"left"','"right"','"center"'):{value:"center"},Tpe(a,"left","right")),x=ir(a,dB(a,"bottom","top"),p?Rx(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),_=Rx(u,c,`-(${f})`,f,0);p=p&&f;const w={opacity:Lt,x:ir(a,v,m),y:Qs(a,v,m)},A={enter:w,update:g={opacity:ws,text:{field:hC},x:w.x,y:w.y,align:b,baseline:x},exit:{opacity:Lt,x:w.x,y:w.y}};kr(A,{dx:!d&&p?ir(a,_):null,dy:!h&&p?Qs(a,_):null}),kr(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!==b&&(g.align=Hf(g.align,b)),g.baseline!==x&&(g.baseline=Hf(g.baseline,x)),rs({type:nf,role:dde,style:h0,key:_s,from:r,encode:A,overlap:S},n)}function Gpe(e,t,n,r){const i=Ri(e,t),s=e.orient,o=gb(s,-1,1);let a,u;const l={enter:a={opacity:Lt,anchor:rr(i("titleAnchor",null)),align:{signal:vC}},update:u=dt({},a,{opacity:ws,text:rr(e.title)}),exit:{opacity:Lt}},c={signal:`lerp(range("${e.scale}"), ${db(0,1,.5)})`};return u.x=ir(s,c),u.y=Qs(s,c),a.angle=ir(s,Lt,Bpe(o,90)),a.baseline=ir(s,dB(s,Ju,po),{value:Ju}),u.angle=a.angle,u.baseline=a.baseline,kr(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")}),Ype(i,s,l,n),l.update.align=Hf(l.update.align,a.align),l.update.angle=Hf(l.update.angle,a.angle),l.update.baseline=Hf(l.update.baseline,a.baseline),rs({type:nf,role:pde,style:pC,from:r,encode:l},n)}function Ype(e,t,n,r){const i=(a,u)=>a!=null?(n.update[u]=Hf(rr(a),n.update[u]),!1):!Df(u,r),s=i(e("titleX"),"x"),o=i(e("titleY"),"y");n.enter.auto=o===s?rr(o):ir(t,rr(o),rr(s))}function Vpe(e,t){const n=zpe(e,t),r=e.encode||{},i=r.axis||{},s=i.name||void 0,o=i.interactive,a=i.style,u=Ri(e,n),l=Whe(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=Ge(t.add(ho({},[c]))),d=Ge(t.add(Xde({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(Upe(e,n,r.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(Wpe(e,n,r.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(Hpe(e,n,r.labels,d,p,l))),c.domain&&h.push(jpe(e,n,r.domain,f)),c.title&&h.push(Gpe(e,n,r.title,f)),pb(pg({role:lde,from:f,encode:fh(Xpe(u,e),i,p0),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:o,style:a}),t)}function Xpe(e,t){const n={enter:{},update:{}};return kr(n,{orient:e("orient"),offset:e("offset")||0,position:qs(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 pB(e,t,n){const r=Me(e.signals),i=Me(e.scales);return n||r.forEach(s=>GP(s,t)),Me(e.projections).forEach(s=>Che(s,t)),i.forEach(s=>ghe(s,t)),Me(e.data).forEach(s=>Dpe(s,t)),i.forEach(s=>mhe(s,t)),(n||r).forEach(s=>Vde(s,t)),Me(e.axes).forEach(s=>Vpe(s,t)),Me(e.marks).forEach(s=>pb(s,t)),Me(e.legends).forEach(s=>ype(s,t)),e.title&&kpe(e.title,t),t.parseLambdas(),t}const Kpe=e=>fh({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function Zpe(e,t){const n=t.config,r=Ge(t.root=t.add(Fv())),i=Jpe(e,n);i.forEach(l=>GP(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(ho()),o=t.add(XP(HP(Kpe(e.encode),fb,lC,e.style,t,{pulse:Ge(s)}))),a=t.add(JP({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:r,pulse:Ge(o)}));t.operators.pop(),t.pushState(Ge(o),Ge(a),null),pB(e,t,i),t.operators.push(a);let u=t.add(VP({mark:r,pulse:Ge(a)}));return u=t.add(ZP({pulse:Ge(u)})),u=t.add(tf({pulse:Ge(u)})),t.addData("root",new Oc(t,s,s,u)),t}function qh(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function Jpe(e,t){const n=o=>qs(e[o],t[o]),r=[qh("background",n("background")),qh("autosize",ode(n("autosize"))),qh("padding",ude(n("padding"))),qh("width",n("width")||0),qh("height",n("height")||0)],i=r.reduce((o,a)=>(o[a.name]=a,o),{}),s={};return Me(e.signals).forEach(o=>{Le(i,o.name)?o=dt(i[o.name],o):r.push(o),s[o.name]=o}),Me(t.signals).forEach(o=>{!Le(s,o.name)&&!Le(i,o.name)&&r.push(o)}),r}function gB(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 FM(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}gB.prototype=FM.prototype={parse(e){return pB(e,this)},fork(){return new FM(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 vE?Ge(e):e;return this.add(lhe({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(Ge(this.add(tf({pulse:e})))),this._parent.push(t),this._lookup.push(n?Ge(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(De(e))return dg(e,t);e.signal||ne("Unsupported field reference: "+Ee(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=Ge(this.add(Qde(i)))}return r},compareRef(e){let t=!1;const n=s=>Gn(s)?(t=!0,this.signalRef(s.signal)):Pde(s)?(t=!0,this.exprRef(s.expr)):s,r=Me(e.field).map(n),i=Me(e.order).map(n);return t?Ge(this.add(gM({fields:r,orders:i}))):hM(r,i)},keyRef(e,t){let n=!1;const r=s=>Gn(s)?(n=!0,Ge(i[s.signal])):s,i=this.signals;return e=Me(e).map(r),n?Ge(this.add(ehe({fields:e,flat:t}))):Nde(e,t)},sortRef(e){if(!e)return e;const t=lb(e.op,e.field),n=e.order||Ode;return n.signal?Ge(this.add(gM({fields:t,orders:this.signalRef(n.signal)}))):hM(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 Le(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&ne("Duplicate signal name: "+Ee(e));const n=t instanceof vE?t:this.add(Fv(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||ne("Unrecognized signal name: "+Ee(e)),this.signals[e]},signalRef(e){return this.signals[e]?Ge(this.signals[e]):(Le(this.lambdas,e)||(this.lambdas[e]=this.add(Fv(null))),Ge(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t0?",":"")+(Fe(i)?i.signal||wC(i):Ee(i))}return n+"]"}function ege(e){let t="{",n=0,r,i;for(r in e)i=e[r],t+=(++n>1?",":"")+Ee(r)+":"+(Fe(i)?i.signal||wC(i):Ee(i));return t+"}"}function tge(){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 nge(e,t,n){return Fe(e)||ne("Input Vega specification must be an object."),t=Zd(tge(),t,e.config),Zpe(e,new gB(t,n)).toRuntime()}var rge="5.33.1";dt(vd,GK,wne,ere,Bie,Rse,oae,Boe,uae,Tae,Uae,Xae);const ige=Object.freeze(Object.defineProperty({__proto__:null,Bounds:zn,CanvasHandler:i0,CanvasRenderer:q1,DATE:Ci,DAY:Rr,DAYOFYEAR:Zo,Dataflow:jf,Debug:cR,DisallowedObjectProperties:RA,Error:NA,EventStream:gy,Gradient:n9,GroupItem:Py,HOURS:es,Handler:GS,HybridHandler:Y9,HybridRenderer:kw,Info:lR,Item:Iy,MILLISECONDS:io,MINUTES:ts,MONTH:Ir,Marks:ns,MultiPulse:ok,None:uR,Operator:ln,Parameters:py,Pulse:Iu,QUARTER:Si,RenderType:Su,Renderer:r0,ResourceLoader:l9,SECONDS:ks,SVGHandler:N9,SVGRenderer:JS,SVGStringRenderer:G9,Scenegraph:S9,TIME_UNITS:KA,Transform:J,View:RP,WEEK:Wn,Warn:OA,YEAR:wr,accessor:Ti,accessorFields:Lr,accessorName:Tn,array:Me,ascending:Qd,bandwidthNRD:ck,bin:qN,bootstrapCI:WN,boundClip:rL,boundContext:Qg,boundItem:xw,boundMark:w9,boundStroke:eu,changeset:ll,clampRange:_R,codegenExpression:oP,compare:zA,constant:qr,cumulativeLogNormal:mk,cumulativeNormal:vy,cumulativeUniform:xk,dayofyear:KR,debounce:jA,defaultLocale:tk,definition:zN,densityLogNormal:gk,densityNormal:fk,densityUniform:bk,domChild:qn,domClear:ds,domCreate:Au,domFind:HS,dotbin:HN,error:ne,expressionFunction:In,extend:dt,extent:Vo,extentIndex:wR,falsy:fu,fastmap:eh,field:As,flush:ER,font:qy,fontFamily:n0,fontSize:aa,format:Nm,formatLocale:_1,formats:ik,hasOwnProperty:Le,id:Pg,identity:Ur,inferType:FN,inferTypes:DN,ingest:Gt,inherits:Se,inrange:Rf,interpolate:wS,interpolateColors:Oy,interpolateRange:U7,intersect:Q9,intersectBoxLine:Nf,intersectPath:DS,intersectPoint:MS,intersectRule:f9,isArray:oe,isBoolean:ul,isDate:Ou,isFunction:ht,isIterable:AR,isNumber:Ut,isObject:Fe,isRegExp:UA,isString:De,isTuple:dy,key:qA,lerp:kR,lineHeight:Xu,loader:cy,locale:CN,logger:LA,lruCache:SR,markup:ZS,merge:CR,mergeConfig:Zd,multiLineOffset:US,one:Kd,pad:$R,panLinear:gR,panLog:mR,panPow:vR,panSymlog:yR,parse:nge,parseExpression:rP,parseSelector:gl,path:wy,pathCurves:CS,pathEqual:iL,pathParse:Ed,pathRectangle:s9,pathRender:eg,pathSymbols:i9,pathTrail:o9,peek:Nt,point:Hy,projection:v3,quantileLogNormal:vk,quantileNormal:yy,quantileUniform:_k,quantiles:uk,quantizeInterpolator:q7,quarter:bR,quartiles:lk,get random(){return Ss},randomInteger:KX,randomKDE:hk,randomLCG:XX,randomLogNormal:YN,randomMixture:VN,randomNormal:dk,randomUniform:XN,read:RN,regressionConstant:wk,regressionExp:ZN,regressionLinear:Ek,regressionLoess:eO,regressionLog:KN,regressionPoly:QN,regressionPow:JN,regressionQuad:Ak,renderModule:Gy,repeat:Jh,resetDefaultLocale:GV,resetSVGClipId:u9,resetSVGDefIds:zte,responseType:TN,runtimeContext:xP,sampleCurve:xy,sampleLogNormal:pk,sampleNormal:my,sampleUniform:yk,scale:Wt,sceneEqual:QS,sceneFromJSON:A9,scenePickVisit:O1,sceneToJSON:E9,sceneVisit:so,sceneZOrder:TS,scheme:ES,serializeXML:U9,setHybridRendererOptions:Lte,setRandom:YX,span:Bg,splitAccessPath:ia,stringValue:Ee,textMetrics:Ki,timeBin:hN,timeFloor:rN,timeFormatLocale:Vp,timeInterval:ih,timeOffset:oN,timeSequence:lN,timeUnitSpecifier:XR,timeUnits:ZA,toBoolean:WA,toDate:HA,toNumber:Nr,toSet:ro,toString:GA,transform:jN,transforms:vd,truncate:FR,truthy:Qi,tupleid:Ye,typeParsers:nw,utcFloor:iN,utcInterval:sh,utcOffset:aN,utcSequence:cN,utcdayofyear:QR,utcquarter:xR,utcweek:eN,version:rge,visitArray:pu,week:ZR,writeConfig:Jd,zero:bu,zoomLinear:IA,zoomLog:PA,zoomPow:p1,zoomSymlog:BA},Symbol.toStringTag,{value:"Module"}));function sge(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 oge={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},age={"*":(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},uge={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const lge=Array.prototype.slice,Ml=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,lge.call(t,1))},cge=(e,t,n,r,i,s,o)=>new Date(e,t||0,n??1,r||0,i||0,s||0,o||0);var fge={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:cge,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 Ml("join",arguments)},indexof:function(){return Ml("indexOf",arguments)},lastindexof:function(){return Ml("lastIndexOf",arguments)},slice:function(){return Ml("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(Qd),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Ml("substring",arguments,String)},split:function(){return Ml("split",arguments,String)},replace:function(){return Ml("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 dge=["view","item","group","xy","x","y"],AE=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&AE.add(setImmediate);const hge={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:oge[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),AE.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]||fge[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>age[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>uge[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 RA.has(i)?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):AE.has(s)?console.error(`Prevented interpretation of method "${s}" which could lead to insecure code execution`):n[i]=s,n},{})};function Wh(e,t,n,r,i,s){const o=a=>hge[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,dge.forEach(a=>o.fn[a]=function(){return i.vega[a](...arguments)}),o(e)}var pge={operator(e,t){const n=t.ast,r=e.functions;return i=>Wh(n,r,i)},parameter(e,t){const n=t.ast,r=e.functions;return(i,s)=>Wh(n,r,s,i)},event(e,t){const n=t.ast,r=e.functions;return i=>Wh(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 Wh(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=Wh(r[f].ast,i,a,u,void 0,o),o[f]!==c&&(o[f]=c,l=1);return n!=="rule"&&sge(o,r,s),l}}};const gge="5.23.0",mge={version:gge};function EC(e){return me(e,"or")}function AC(e){return me(e,"and")}function kC(e){return me(e,"not")}function i1(e,t){if(kC(e))i1(e.not,t);else if(AC(e))for(const n of e.and)i1(n,t);else if(EC(e))for(const n of e.or)i1(n,t);else t(e)}function Gf(e,t){return kC(e)?{not:Gf(e.not,t)}:AC(e)?{and:e.and.map(n=>Gf(n,t))}:EC(e)?{or:e.or.map(n=>Gf(n,t))}:t(e)}const it=structuredClone;function mB(e){throw new Error(e)}function Td(e,t){const n={};for(const r of t)Le(e,r)&&(n[r]=e[r]);return n}function Ai(e,t){const n={...e};for(const r of t)delete n[r];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>an(e)).join(",")})`};function Ft(e){if(Ut(e))return e;const t=De(e)?e:an(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 $C(e,t){return e===void 0||t===void 0?!0:CC(SE(e),SE(t))}function on(e){return pe(e).length===0}const pe=Object.keys,Er=Object.values,Qu=Object.entries;function gg(e){return e===!0||e===!1}function yn(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function Bp(e,t){return kC(e)?`!(${Bp(e.not,t)})`:AC(e)?`(${e.and.map(n=>Bp(n,t)).join(") && (")})`:EC(e)?`(${e.or.map(n=>Bp(n,t)).join(") || (")})`:t(e)}function Dv(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&Dv(e[n],t)&&delete e[n],on(e)}function g0(e){return e.charAt(0).toUpperCase()+e.substr(1)}function FC(e,t="datum"){const n=ia(e),r=[];for(let i=1;i<=n.length;i++){const s=`[${n.slice(0,i).map(Ee).join("][")}]`;r.push(`${t}${s}`)}return r.join(" && ")}function bB(e,t="datum"){return`${t}[${Ee(ia(e).join("."))}]`}function Jt(e){return`datum['${e.replaceAll("'","\\'")}']`}function bge(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function $s(e){return`${ia(e).map(bge).join("\\.")}`}function Lc(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function ph(e){return`${ia(e).join(".")}`}function Nd(e){return e?ia(e).length:0}function On(...e){return e.find(t=>t!==void 0)}let xB=42;function _B(e){const t=++xB;return e?String(e)+t:t}function xge(){xB=42}function wB(e){return EB(e)?e:`__${e}`}function EB(e){return e.startsWith("__")}function mg(e){if(e!==void 0)return(e%360+360)%360}function mb(e){return Ut(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const DM=Object.getPrototypeOf(structuredClone({}));function Yi(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(!Yi(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(!Yi(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!==DM.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==DM.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(!Yi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function an(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;iAb(e[t])?yn(`_${t}_${Qu(e[t])}`):yn(`_${t}_${e[t]}`)).join("")}function cn(e){return e===!0||of(e)&&!e.binned}function hr(e){return e==="binned"||of(e)&&e.binned===!0}function of(e){return Fe(e)}function Ab(e){return me(e,"param")}function MM(e){switch(e){case Ua:case qa:case iu:case Fi:case da:case ha:case xl:case su:case yl:case bl:case Di:return 6;case _l:return 4;default:return 10}}function b0(e){return me(e,"expr")}function gr(e,{level:t}={level:0}){const n=pe(e||{}),r={};for(const i of n)r[i]=t===0?Wi(e[i]):gr(e[i],{level:t-1});return r}function IB(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}:{}},b={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}},x=Td(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:m,subtitleMarkConfig:x,nonMarkTitleProperties:v,subtitle:b}}function yu(e){return De(e)||oe(e)&&De(e[0])}function Ue(e){return me(e,"signal")}function af(e){return me(e,"step")}function Hge(e){return oe(e)?!1:me(e,"fields")&&!me(e,"data")}function Gge(e){return oe(e)?!1:me(e,"fields")&&me(e,"data")}function La(e){return oe(e)?!1:me(e,"field")&&me(e,"data")}const Yge={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},Vge=pe(Yge),Xge={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},CE=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function PB(e){const t=oe(e.condition)?e.condition.map(TM):TM(e.condition);return{...Wi(e),condition:t}}function Wi(e){if(b0(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function TM(e){if(b0(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function dn(e){if(b0(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Ue(e)?e:e!==void 0?{value:e}:void 0}function Kge(e){return Ue(e)?e.signal:Ee(e)}function RM(e){return Ue(e)?e.signal:Ee(e.value)}function Zs(e){return Ue(e)?e.signal:e==null?null:Ee(e)}function Zge(e,t,n){for(const r of n){const i=ea(r,t.markDef,t.config);i!==void 0&&(e[r]=dn(i))}return e}function BB(e){return[].concat(e.type,e.style??[])}function sn(e,t,n,r={}){const{vgChannel:i,ignoreVgConfig:s}=r;return i&&me(t,i)?t[i]:t[e]!==void 0?t[e]:s&&(!i||i===e)?void 0:ea(e,t,n,r)}function ea(e,t,n,{vgChannel:r}={}){const i=$E(e,t,n.style);return On(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function $E(e,t,n){return zB(e,BB(t),n)}function zB(e,t,n){t=Me(t);let r;for(const i of t){const s=n[i];me(s,e)&&(r=s[e])}return r}function jB(e,t){return Me(e).reduce((n,r)=>(n.field.push(Ce(r,t)),n.order.push(r.sort??"ascending"),n),{field:[],order:[]})}function UB(e,t){const n=[...e];return t.forEach(r=>{for(const i of n)if(Yi(i,r))return;n.push(r)}),n}function qB(e,t){return Yi(e,t)||!t?e:e?[...Me(e),...Me(t)].join(", "):t}function WB(e,t){const n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((yu(n)||Ue(n))&&(yu(r)||Ue(r)))return{explicit:e.explicit,value:qB(n,r)};if(yu(n)||Ue(n))return{explicit:e.explicit,value:n};if(yu(r)||Ue(r))return{explicit:e.explicit,value:r};if(!yu(n)&&!Ue(n)&&!yu(r)&&!Ue(r))return{explicit:e.explicit,value:UB(n,r)};throw new Error("It should never reach here")}function BC(e){return`Invalid specification ${an(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Jge='Autosize "fit" only works for single views and layered views.';function NM(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function OM(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 LM(e){return e?`Dropping "fit-${e}" because spec has discrete ${Mi(e)}.`:'Dropping "fit" because spec has discrete size.'}function zC(e){return`Unknown field for ${e}. Cannot calculate view size.`}function IM(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Qge(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function e0e(e){return`The "nearest" transform is not supported for ${e} marks.`}function HB(e){return`Selection not supported for ${e} yet.`}function t0e(e){return`Cannot find a selection named "${e}".`}const n0e="Scale bindings are currently only supported for scales with unbinned, continuous domains.",r0e="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",i0e="Legend bindings are only supported for selections over an individual field or encoding channel.";function s0e(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function o0e(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const a0e="The same selection must be used to override scale domains in a layered view.",u0e='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function l0e(e){return`Unknown repeated value "${e}".`}function PM(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const c0e="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",jC="Animation involving facet, layer, or concat is currently unsupported.";function f0e(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Ee(e)}.`}function d0e(e,t,n,r){return(e.length?"Multiple ":"No ")+`matching ${Ee(t)} encoding found for selection ${Ee(n.param)}. Using "field": ${Ee(r)}.`}const h0e="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function p0e(e){return`Unrecognized parse "${e}".`}function BM(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const g0e="Attempt to add the same child twice.";function m0e(e){return`Ignoring an invalid transform: ${an(e)}.`}const v0e='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 zM(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function y0e(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${an(t)} is overridden by a child projection ${an(n)}.`}const b0e="Arc marks uses theta channel rather than angle, replacing angle with theta.";function x0e(e){return`${e}Offset dropped because ${e} is continuous`}function _0e(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${an(n)}}.`}function GB(e){return`Invalid field type "${e}".`}function w0e(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function E0e(e){return`Invalid aggregation operator "${e}".`}function YB(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 A0e(e){return`Position range does not support relative band size for ${e}.`}function FE(e,t){return`Dropping ${an(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const k0e="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function kb(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function S0e(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function C0e(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function $0e(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function F0e(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function Lx(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function D0e(e){return`The ${e} for range marks cannot be an expression`}function M0e(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 T0e(e,t){return`Specified orient "${e}" overridden with "${t}".`}function R0e(e){return`Cannot use the scale property "${e}" with non-color channel.`}function N0e(e){return`Cannot use the relative band size with ${e} scale.`}function O0e(e){return`Using unaggregated domain with raw field has no effect (${an(e)}).`}function L0e(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function I0e(e){return`Unaggregated domain is currently unsupported for log scale (${an(e)}).`}function P0e(e){return`Cannot apply size to non-oriented mark "${e}".`}function B0e(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function z0e(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function VB(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function XB(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function j0e(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${an(n)} and ${an(r)}). Using ${an(n)}.`}function U0e(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${an(n)} and ${an(r)}). Using the union of the two domains.`}function q0e(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 W0e(e){return`Dropping sort property ${an(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const jM="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",H0e="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.",G0e="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.",Y0e="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 V0e(e){return`Cannot stack "${e}" if there is already "${e}2".`}function X0e(e){return`Stack is applied to a non-linear scale (${e}).`}function K0e(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Mv(e,t){return`Invalid ${e}: ${an(t)}.`}function Z0e(e){return`Dropping day from datetime ${an(e)} as day cannot be combined with other units.`}function J0e(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function Q0e(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function eme(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function UM(e){return`1D error band does not support ${e}.`}function KB(e){return`Channel ${e} is required for "binned" bin.`}function tme(e){return`Channel ${e} should not be used with "binned" bin.`}function nme(e){return`Domain for ${e} is required for threshold scale.`}const ZB=LA(OA);let Pc=ZB;function rme(e){return Pc=e,Pc}function ime(){return Pc=ZB,Pc}function UC(...e){Pc.error(...e)}function ve(...e){Pc.warn(...e)}function sme(...e){Pc.debug(...e)}function uf(e){if(e&&Fe(e)){for(const t of WC)if(me(e,t))return!0}return!1}const JB=["january","february","march","april","may","june","july","august","september","october","november","december"],ome=JB.map(e=>e.substr(0,3)),QB=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],ame=QB.map(e=>e.substr(0,3));function ume(e){if(mb(e)&&(e=+e),Ut(e))return e>4&&ve(Mv("quarter",e)),e-1;throw new Error(Mv("quarter",e))}function lme(e){if(mb(e)&&(e=+e),Ut(e))return e-1;{const t=e.toLowerCase(),n=JB.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=ome.indexOf(r);if(i!==-1)return i;throw new Error(Mv("month",e))}}function cme(e){if(mb(e)&&(e=+e),Ut(e))return e%7;{const t=e.toLowerCase(),n=QB.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=ame.indexOf(r);if(i!==-1)return i;throw new Error(Mv("day",e))}}function qC(e,t){const n=[];if(t&&e.day!==void 0&&pe(e).length>1&&(ve(Z0e(e)),e=it(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const r=t?lme(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){const r=t?ume(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?cme(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 Bc(e){const n=qC(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function fme(e){const n=qC(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function dme(e){const t=qC(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const ez={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},WC=pe(ez);function hme(e){return Le(ez,e)}function lf(e){return Fe(e)?e.binned:tz(e)}function tz(e){return e&&e.startsWith("binned")}function HC(e){return e.startsWith("utc")}function pme(e){return e.substring(3)}const gme={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Sb(e){return WC.filter(t=>rz(e,t))}function nz(e){const t=Sb(e);return t[t.length-1]}function rz(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 mme(e,t,{end:n}={end:!1}){const r=FC(t),i=HC(e)?"utc":"";function s(u){return u==="quarter"?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`}let o;const a={};for(const u of WC)rz(e,u)&&(a[u]=s(u),o=u);return n&&(a[o]+="+1"),fme(a)}function iz(e){if(!e)return;const t=Sb(e);return`timeUnitSpecifier(${an(t)}, ${an(gme)})`}function vme(e,t,n){if(!e)return;const r=iz(e);return`${n||HC(e)?"utc":"time"}Format(${t}, ${r})`}function or(e){if(!e)return;let t;return De(e)?tz(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:Fe(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),HC(t.unit)&&(t.utc=!0,t.unit=pme(t.unit)),t}function yme(e){const{utc:t,...n}=or(e);return n.unit?(t?"utc":"")+pe(n).map(r=>yn(`${r==="unit"?"":`_${r}_`}${n[r]}`)).join(""):(t?"utc":"")+"timeunit"+pe(n).map(r=>yn(`_${r}_${n[r]}`)).join("")}function sz(e,t=n=>n){const n=or(e),r=nz(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}=oz(r,n.step),a={...i,[o]:+i[o]+s};return`${t(Bc(a))} - ${t(Bc(i))}`}}const bme={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function xme(e){return Le(bme,e)}function oz(e,t=1){if(xme(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 _me(e){return me(e,"param")}function GC(e){return!!(e!=null&&e.field)&&e.equal!==void 0}function YC(e){return!!(e!=null&&e.field)&&e.lt!==void 0}function VC(e){return!!(e!=null&&e.field)&&e.lte!==void 0}function XC(e){return!!(e!=null&&e.field)&&e.gt!==void 0}function KC(e){return!!(e!=null&&e.field)&&e.gte!==void 0}function ZC(e){if(e!=null&&e.field){if(oe(e.range)&&e.range.length===2)return!0;if(Ue(e.range))return!0}return!1}function JC(e){return!!(e!=null&&e.field)&&(oe(e.oneOf)||oe(e.in))}function wme(e){return!!(e!=null&&e.field)&&e.valid!==void 0}function az(e){return JC(e)||GC(e)||ZC(e)||YC(e)||XC(e)||VC(e)||KC(e)}function Ao(e,t){return Lb(e,{timeUnit:t,wrapTime:!0})}function Eme(e,t){return e.map(n=>Ao(n,t))}function uz(e,t=!0){const{field:n}=e,r=or(e.timeUnit),{unit:i,binned:s}=r||{},o=Ce(e,{expr:"datum"}),a=i?`time(${s?o:mme(i,n)})`:o;if(GC(e))return`${a}===${Ao(e.equal,i)}`;if(YC(e)){const u=e.lt;return`${a}<${Ao(u,i)}`}else if(XC(e)){const u=e.gt;return`${a}>${Ao(u,i)}`}else if(VC(e)){const u=e.lte;return`${a}<=${Ao(u,i)}`}else if(KC(e)){const u=e.gte;return`${a}>=${Ao(u,i)}`}else{if(JC(e))return`indexof([${Eme(e.oneOf,i).join(",")}], ${a}) !== -1`;if(wme(e))return Cb(a,e.valid);if(ZC(e)){const{range:u}=gr(e),l=Ue(u)?{signal:`${u.signal}[0]`}:u[0],c=Ue(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return"inrange("+a+", ["+Ao(l,i)+", "+Ao(c,i)+"])";const f=[];return l!==null&&f.push(`${a} >= ${Ao(l,i)}`),c!==null&&f.push(`${a} <= ${Ao(c,i)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${an(e)}`)}function Cb(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Ame(e){return az(e)&&e.timeUnit?{...e,timeUnit:or(e.timeUnit)}:e}const x0={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function kme(e){return e==="quantitative"||e==="temporal"}function lz(e){return e==="ordinal"||e==="nominal"}const zc=x0.quantitative,QC=x0.ordinal,Ld=x0.temporal,e$=x0.nominal,mh=x0.geojson;function Sme(e){if(e)switch(e=e.toLowerCase(),e){case"q":case zc:return"quantitative";case"t":case Ld:return"temporal";case"o":case QC:return"ordinal";case"n":case e$:return"nominal";case mh:return"geojson"}}const vr={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},DE={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 Cme(e,t){const n=DE[e],r=DE[t];return n===r||n==="ordinal-position"&&r==="time"||r==="ordinal-position"&&n==="time"}const $me={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 qM(e){return $me[e]}const cz=new Set(["linear","log","pow","sqrt","symlog"]),fz=new Set([...cz,"time","utc"]);function dz(e){return cz.has(e)}const hz=new Set(["quantile","quantize","threshold"]),Fme=new Set([...fz,...hz,"sequential","identity"]),Dme=new Set(["ordinal","bin-ordinal","point","band"]);function ur(e){return Dme.has(e)}function oo(e){return Fme.has(e)}function zo(e){return fz.has(e)}function Id(e){return hz.has(e)}const Mme={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 Tme(e){return!De(e)&&me(e,"name")}function pz(e){return me(e,"param")}function Rme(e){return me(e,"unionWith")}function Nme(e){return Fe(e)&&"field"in e}const Ome={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:e$e,domain:t$e,range:n$e,rangeMax:r$e,rangeMin:i$e,scheme:s$e,...Lme}=Ome,Ime=pe(Lme);function ME(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 zo(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return zo(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 zo(e);case"nice":return zo(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return oo(e)&&!At(["log","time","utc","threshold","quantile"],e)}}function gz(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Yf(e)?void 0:R0e(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 Pme(e,t){return At([QC,e$],t)?e===void 0||ur(e):t===Ld?At([vr.TIME,vr.UTC,void 0],e):t===zc?dz(e)||Id(e)||e===void 0:!0}function Bme(e,t,n=!1){if(!ga(e))return!1;switch(e){case bn:case cr:case ml:case gh:case Ms:case mo:return zo(t)||t==="band"?!0:t==="point"?!n:!1;case vl:return At(["linear","band"],t);case iu:case xl:case su:case yl:case bl:case rf:return zo(t)||Id(t)||At(["band","point","ordinal"],t);case Fi:case da:case ha:return t!=="band";case _l:case Di:return t==="ordinal"||Id(t)}}function zme(e){return Fe(e)&&"value"in e}const fi={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"},mz=fi.arc,$b=fi.area,Fb=fi.bar,jme=fi.image,Db=fi.line,Mb=fi.point,Ume=fi.rect,Tv=fi.rule,vz=fi.text,t$=fi.tick,qme=fi.trail,n$=fi.circle,r$=fi.square,yz=fi.geoshape;function El(e){return["line","area","trail"].includes(e)}function vg(e){return["rect","bar","image","arc","tick"].includes(e)}const Wme=new Set(pe(fi));function ta(e){return me(e,"type")}const Hme=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],Gme=["fill","fillOpacity"],Yme=[...Hme,...Gme],Vme={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},WM=pe(Vme),Ix=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],Xme={area:["line","point"],bar:Ix,rect:Ix,line:["point"],tick:["bandSize","thickness",...Ix]},Kme={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},Zme={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},bz=pe(Zme);function jc(e){return me(e,"band")}const Jme={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},Qme=5,i$={binSpacing:0,continuousBandSize:Qme,minBandSize:.25,timeUnitBandPosition:.5},e1e={...i$,binSpacing:1},t1e={...i$,thickness:1};function n1e(e){return ta(e)?e.type:e}function xz(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function s$({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){var a,u;if(!r||!oo(r)||i)return"always-valid";const s=xz(sn("invalid",e,t),{isPath:El(e.type)});return((u=(a=t.scale)==null?void 0:a.invalid)==null?void 0:u[n])!==void 0?"show":s}function r1e(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function _z({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 wz({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:s}){var c;const o=n==null?void 0:n.get("type"),a=uo(t),u=Eb(a==null?void 0:a.aggregate),l=s$({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:Cb(Ce(a,{expr:"datum"}),!1),...i1e(f,n,r)}}}function i1e(e,t,n){if(zme(e)){const{value:r}=e;return Ue(r)?{signal:r.signal}:{value:r}}return _z({scale:t,scaleName:n,mode:"zeroOrMin"})}function o$(e){const{channel:t,channelDef:n,markDef:r,scale:i,scaleName:s,config:o}=e,a=sf(t),u=a$(e),l=wz({scaleChannel:a,channelDef:n,scale:i,scaleName:s,markDef:r,config:o});return l!==void 0?[l,u]:u}function s1e(e){const{datum:t}=e;return uf(t)?Bc(t):`${an(t)}`}function fc(e,t,n,r){const i={};if(t&&(i.scale=t),ma(e)){const{datum:s}=e;uf(s)?i.signal=Bc(s):Ue(s)?i.signal=s.signal:b0(s)?i.signal=s.expr:i.value=s}else i.field=Ce(e,n);if(r){const{offset:s,band:o}=r;s&&(i.offset=s),o&&(i.band=o)}return i}function Rv({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:s="end",bandPosition:o=.5}){const a=!Ue(o)&&0{switch(t.fieldTitle){case"plain":return e.field;case"functional":return x1e(e);default:return b1e(e,t)}};let Oz=Nz;function Lz(e){Oz=e}function _1e(){Lz(Nz)}function Vf(e,t,{allowDisabling:n,includeDefault:r=!0}){var a;const i=(a=f$(e))==null?void 0:a.title;if(!be(e))return i??e.title;const s=e,o=r?d$(s,t):void 0;return n?On(i,s.title,o):i??s.title??o}function f$(e){if(Bd(e)&&e.axis)return e.axis;if(Tz(e)&&e.legend)return e.legend;if(l$(e)&&e.header)return e.header}function d$(e,t){return Oz(e,t)}function Lv(e){if(Rz(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=f$(e)??{},{format:n,formatType:r}=t;return{format:n,formatType:r}}}function w1e(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(c$(e)&&oe(e.sort))return"ordinal";const{aggregate:n,bin:r,timeUnit:i}=e;if(i)return"temporal";if(r||n&&!wl(n)&&!Za(n))return"quantitative";if(cf(e)&&((s=e.scale)!=null&&s.type))switch(DE[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function uo(e){if(be(e))return e;if(Nb(e))return e.condition}function Hn(e){if(at(e))return e;if(A0(e))return e.condition}function Iz(e,t,n,r={}){if(De(e)||Ut(e)||ul(e)){const i=De(e)?"string":Ut(e)?"number":"boolean";return ve(_0e(t,i,e)),{value:e}}return at(e)?Iv(e,t,n,r):A0(e)?{...e,condition:Iv(e.condition,t,n,r)}:e}function Iv(e,t,n,r){if(Rz(e)){const{format:i,formatType:s,...o}=e;if(Uc(s)&&!n.customFormatTypes)return ve(zM(t)),Iv(o,t,n,r)}else{const i=Bd(e)?"axis":Tz(e)?"legend":l$(e)?"header":null;if(i&&e[i]){const{format:s,formatType:o,...a}=e[i];if(Uc(o)&&!n.customFormatTypes)return ve(zM(t)),Iv({...e,[i]:a},t,n,r)}}return be(e)?h$(e,t,r):E1e(e)}function E1e(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=Ut(n)?"quantitative":De(n)?"nominal":uf(n)?"temporal":void 0,{...e,type:t}}function h$(e,t,{compositeMark:n=!1}={}){const{aggregate:r,timeUnit:i,bin:s,field:o}=e,a={...e};if(!n&&r&&!PC(r)&&!wl(r)&&!Za(r)&&(ve(E0e(r)),delete a.aggregate),i&&(a.timeUnit=or(i)),o&&(a.field=`${o}`),cn(s)&&(a.bin=Ob(s,t)),hr(s)&&!Ln(t)&&ve(tme(t)),ai(a)){const{type:u}=a,l=Sme(u);u!==l&&(a.type=l),u!=="quantitative"&&Eb(r)&&(ve(w0e(u,r)),a.type="quantitative")}else if(!DB(t)){const u=w1e(a,t);a.type=u}if(ai(a)){const{compatible:u,warning:l}=A1e(a,t)||{};u===!1&&ve(l)}if(c$(a)&&De(a.sort)){const{sort:u}=a;if(GM(u))return{...a,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&GM(l))return{...a,sort:{encoding:l,order:"descending"}}}if(l$(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 Ob(e,t){return ul(e)?{maxbins:MM(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:MM(t)}:e}const Af={compatible:!0};function A1e(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 Ua:case qa:case vb:return Ov(e)?Af:{compatible:!1,warning:C0e(t)};case bn:case cr:case ml:case gh:case Fi:case da:case ha:case m0:case v0:case yb:case Ic:case bb:case xb:case rf:case Ms:case mo:case _b:return Af;case yo:case Fs:case vo:case bo:return n!==zc?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Af;case su:case yl:case bl:case xl:case iu:case ru:case nu:case go:case fa:case vl:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Af;case Di:case _l:return!Ov(e)&&!v1e(e)?{compatible:!1,warning:$0e(t)}:Af;case Od:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:Af}}function zd(e){const{formatType:t}=Lv(e);return t==="time"||!t&&k1e(e)}function k1e(e){return e&&(e.type==="temporal"||be(e)&&!!e.timeUnit)}function Lb(e,{timeUnit:t,type:n,wrapTime:r,undefinedIfExprNotRequired:i}){var u;const s=t&&((u=or(t))==null?void 0:u.unit);let o=s||n==="temporal",a;return b0(e)?a=e.expr:Ue(e)?a=e.signal:uf(e)?(o=!0,a=Bc(e)):(De(e)||Ut(e))&&o&&(a=`datetime(${an(e)})`,hme(s)&&(Ut(e)&&e<1e4||De(e)&&isNaN(Date.parse(e)))&&(a=Bc({[s]:e}))),a?r&&o?`time(${a})`:a:i?void 0:an(e)}function Pz(e,t){const{type:n}=e;return t.map(r=>{const i=be(e)&&!lf(e.timeUnit)?e.timeUnit:void 0,s=Lb(r,{timeUnit:i,type:n,undefinedIfExprNotRequired:!0});return s!==void 0?{signal:s}:r})}function k0(e,t){return cn(e.bin)?ga(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const XM={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 S0(e){return e==null?void 0:e.condition}const Bz=["domain","grid","labels","ticks","title"],S1e={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"},zz={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},C1e={...zz,style:1,labelExpr:1,encoding:1};function KM(e){return Le(C1e,e)}const $1e={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},jz=pe($1e);function au(e){return me(e,"mark")}class Ib{constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return au(t)?n1e(t.mark)===this.name:!1}}function dc(e,t){const n=e&&e[t];return n?oe(n)?Rd(n,r=>!!r.field):be(n)||Nb(n):!1}function Uz(e,t){const n=e&&e[t];return n?oe(n)?Rd(n,r=>!!r.field):be(n)||ma(n)||A0(n):!1}function qz(e,t){if(Ln(t)){const n=e[t];if((be(n)||ma(n))&&(lz(n.type)||be(n)&&n.timeUnit)){const r=RC(t);return Uz(e,r)}}return!1}function Wz(e){return Rd(Ege,t=>{if(dc(e,t)){const n=e[t];if(oe(n))return Rd(n,r=>!!r.aggregate);{const r=uo(n);return r&&!!r.aggregate}}return!1})}function Hz(e,t){const n=[],r=[],i=[],s=[],o={};return p$(e,(a,u)=>{if(be(a)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=a;if(c||d||f){const p=f$(a),g=p==null?void 0:p.title;let m=Ce(a,{forAs:!0});const v={...g?[]:{title:Vf(a,t,{allowDisabling:!0})},...h,field:m};if(c){let b;if(wl(c)?(b="argmax",m=Ce({op:"argmax",field:c.argmax},{forAs:!0}),v.field=`${m}.${l}`):Za(c)?(b="argmin",m=Ce({op:"argmin",field:c.argmin},{forAs:!0}),v.field=`${m}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(b=c),b){const x={op:b,as:m};l&&(x.field=l),s.push(x)}}else if(n.push(m),ai(a)&&cn(f)){if(r.push({bin:f,field:l,as:m}),n.push(Ce(a,{binSuffix:"end"})),k0(a,u)&&n.push(Ce(a,{binSuffix:"range"})),Ln(u)){const b={field:`${m}_end`};o[`${u}2`]=b}v.bin="binned",DB(u)||(v.type=zc)}else if(d&&!lf(d)){i.push({timeUnit:d,field:l,as:m});const b=ai(a)&&a.type!==Ld&&"time";b&&(u===m0||u===Ic?v.formatType=b:Nge(u)?v.legend={formatType:b,...v.legend}:Ln(u)&&(v.axis={formatType:b,...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 F1e(e,t,n){const r=Lge(t,n);if(r){if(r==="binned"){const i=e[t===go?bn:cr];return!!(be(i)&&be(e[t])&&hr(i.bin))}}else return!1;return!0}function D1e(e,t,n,r){const i={};for(const s of pe(e))FB(s)||ve(S0e(s));for(let s of Fge){if(!e[s])continue;const o=e[s];if(y0(s)){const a=$ge(s),u=i[a];if(be(u)&&kme(u.type)&&be(o)&&!u.timeUnit){ve(x0e(a));continue}}if(s==="angle"&&t==="arc"&&!e.theta&&(ve(b0e),s=Ms),!F1e(e,s,t)){ve(kb(s,t));continue}if(s===iu&&t==="line"){const a=uo(e[s]);if(a!=null&&a.aggregate){ve(k0e);continue}}if(s===Fi&&(n?"fill"in e:"stroke"in e)){ve(YB("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(s===v0||s===Od&&!oe(o)&&!ao(o)||s===Ic&&oe(o)){if(o){if(s===Od){const a=e[s];if(Mz(a)){i[s]=a;continue}}i[s]=Me(o).reduce((a,u)=>(be(u)?a.push(h$(u,s)):ve(FE(u,s)),a),[])}}else{if(s===Ic&&o===null)i[s]=null;else if(!be(o)&&!ma(o)&&!ao(o)&&!E0(o)&&!Ue(o)){ve(FE(o,s));continue}i[s]=Iz(o,s,r)}}return i}function Pb(e,t){const n={};for(const r of pe(e)){const i=Iz(e[r],r,t,{compositeMark:!0});n[r]=i}return n}function M1e(e){const t=[];for(const n of pe(e))if(dc(e,n)){const r=e[n],i=Me(r);for(const s of i)be(s)?t.push(s):Nb(s)&&t.push(s.condition)}return t}function p$(e,t,n){if(e)for(const r of pe(e)){const i=e[r];if(oe(i))for(const s of i)t.call(n,s,r);else t.call(n,i,r)}}function T1e(e,t,n,r){return e?pe(e).reduce((i,s)=>{const o=e[s];return oe(o)?o.reduce((a,u)=>t.call(r,a,u,s),i):t.call(r,i,o,s)},n):n}function Gz(e,t){return pe(t).reduce((n,r)=>{switch(r){case bn:case cr:case bb:case _b:case xb:case go:case fa:case ml:case gh:case Ms:case ru:case mo:case nu:case vl:case vo:case yo:case bo:case Fs:case m0:case Di:case rf:case Ic:return n;case Od:if(e==="line"||e==="trail")return n;case v0:case yb:{const i=t[r];if(oe(i)||be(i))for(const s of Me(i))s.aggregate||n.push(Ce(s,{}));return n}case iu:if(e==="trail")return n;case Fi:case da:case ha:case su:case yl:case bl:case _l:case xl:{const i=uo(t[r]);return i&&!i.aggregate&&n.push(Ce(i,{})),n}}},[])}function R1e(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(oe(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 oe(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function RE(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 ${g$(t)}`:"";return{field:o+t.field,type:t.type,title:Ue(a)?{signal:`${a}"${escape(u)}"`}:a+u}}),s=M1e(n).map(g1e);return{tooltip:[...i,...Bo(s,Ft)]}}function g$(e){const{title:t,field:n}=e;return On(t,n)}function m$(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=g$(n);return Yz(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}:{}},...De(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...r,...f}})}}function Yz(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}:{},...ta(r.mark)?r.mark:{type:r.mark},style:`${a}-${String(t)}`,...ul(e[t])?{}:e[t]}}]:[]}function Vz(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:fm(s,n),continuousAxisChannelDef2:fm(o,n),continuousAxisChannelDefError:fm(a,n),continuousAxisChannelDefError2:fm(u,n),continuousAxis:i}}function fm(e,t){if(e!=null&&e.aggregate){const{aggregate:n,...r}=e;return n!==t&&ve(eme(n,t)),r}else return e}function Xz(e,t){const{mark:n,encoding:r}=e,{x:i,y:s}=r;if(ta(n)&&n.orient)return n.orient;if(Mu(i)){if(Mu(s)){const o=be(i)&&i.aggregate,a=be(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 zd(s)&&!zd(i)?"horizontal":"vertical"}return"horizontal"}else{if(Mu(s))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const Pv="boxplot",N1e=["box","median","outliers","rule","ticks"],O1e=new Ib(Pv,Zz);function Kz(e){return Ut(e)?"tukey":e}function Zz(e,{config:t}){e={...e,encoding:Pb(e.encoding,t)};const{mark:n,encoding:r,params:i,projection:s,...o}=e,a=ta(n)?n:{type:n};i&&ve(HB("boxplot"));const u=a.extent??t.boxplot.extent,l=sn("size",a,t),c=a.invalid,f=Kz(u),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:g,continuousAxis:m,groupby:v,aggregate:b,encodingWithoutContinuousAxis:x,ticksOrient:_,boxOrient:w,customTooltipWithoutAggregatedField:A}=L1e(e,u,t),E=ph(g.field),{color:S,size:C,...$}=x,M=fe=>m$(a,m,g,fe,t.boxplot),N=M($),L=M(x),T=(Fe(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",k=M({...$,...C?{size:C}:{},color:{condition:{test:`${Jt(`lower_box_${g.field}`)} >= ${Jt(`upper_box_${g.field}`)}`,...S||{value:T}}}}),F=RE([{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,x),I={type:"tick",color:"black",opacity:1,orient:_,invalid:c,aria:!1},B=f==="min-max"?F:RE([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,x),O=[...N({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:B}),...N({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:B}),...N({partName:"ticks",mark:I,positionPrefix:"lower_whisker",extraEncoding:B}),...N({partName:"ticks",mark:I,positionPrefix:"upper_whisker",extraEncoding:B})],j=[...f!=="tukey"?O:[],...L({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:w,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:F}),...k({partName:"median",mark:{type:"tick",invalid:c,...Fe(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:_,aria:!1},positionPrefix:"mid_box",extraEncoding:F})];if(f==="min-max")return{...o,transform:(o.transform??[]).concat(p),layer:j};const Y=Jt(`lower_box_${g.field}`),te=Jt(`upper_box_${g.field}`),ce=`(${te} - ${Y})`,Ae=`${Y} - ${u} * ${ce}`,ge=`${te} + ${u} * ${ce}`,Ie=Jt(g.field),tt={joinaggregate:Jz(g.field),groupby:v},nt={transform:[{filter:`(${Ae} <= ${Ie}) && (${Ie} <= ${ge})`},{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}`},...b],groupby:v}],layer:O},{tooltip:ue,...Ne}=$,{scale:Q,axis:W}=g,xe=g$(g),ke=Ai(W,["title"]),Te=Yz(a,"outliers",t.boxplot,{transform:[{filter:`(${Ie} < ${Ae}) || (${Ie} > ${ge})`}],mark:"point",encoding:{[m]:{field:g.field,type:g.type,...xe!==void 0?{title:xe}:{},...Q!==void 0?{scale:Q}:{},...on(ke)?{}:{axis:ke}},...Ne,...S?{color:S}:{},...A?{tooltip:A}:{}}})[0];let G;const H=[...d,...h,tt];return Te?G={transform:H,layer:[Te,nt]}:(G=nt,G.transform.unshift(...H)),{...o,layer:[G,{transform:p,layer:j}]}}function Jz(e){const t=ph(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function L1e(e,t,n){const r=Xz(e,Pv),{continuousAxisChannelDef:i,continuousAxis:s}=Vz(e,r,Pv),o=i.field,a=ph(o),u=Kz(t),l=[...Jz(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:`${Jt(`upper_box_${a}`)} - ${Jt(`lower_box_${a}`)}`,as:`iqr_${a}`},{calculate:`min(${Jt(`upper_box_${a}`)} + ${Jt(`iqr_${a}`)} * ${t}, ${Jt(`max_${a}`)})`,as:`upper_whisker_${a}`},{calculate:`max(${Jt(`lower_box_${a}`)} - ${Jt(`iqr_${a}`)} * ${t}, ${Jt(`min_${a}`)})`,as:`lower_whisker_${a}`}],{[s]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:p}=R1e(d),{bins:g,timeUnits:m,aggregate:v,groupby:b,encoding:x}=Hz(p,n),_=r==="vertical"?"horizontal":"vertical",w=r,A=[...g,...m,{aggregate:[...v,...l],groupby:b},...c];return{bins:g,timeUnits:m,transform:A,groupby:b,aggregate:v,continuousAxisChannelDef:i,continuousAxis:s,encodingWithoutContinuousAxis:x,ticksOrient:_,boxOrient:w,customTooltipWithoutAggregatedField:h}}const v$="errorbar",I1e=["ticks","rule"],P1e=new Ib(v$,Qz);function Qz(e,{config:t}){e={...e,encoding:Pb(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:s,ticksOrient:o,markDef:a,outerSpec:u,tooltipEncoding:l}=ej(e,v$,t);delete s.size;const c=m$(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 B1e(e,t){const{encoding:n}=e;if(z1e(n))return{orient:Xz(e,t),inputType:"raw"};const r=j1e(n),i=U1e(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(at(a)&&at(u))throw new Error(`${t} cannot have both x2 and y2`);if(at(a)){if(Mu(s))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(at(u)){if(Mu(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(at(u)&&!at(a))throw new Error(`${t} cannot have xError2 without xError`);if(at(c)&&!at(l))throw new Error(`${t} cannot have yError2 without yError`);if(at(a)&&at(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(at(a)){if(Mu(s))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(at(l)){if(Mu(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 z1e(e){return(at(e.x)||at(e.y))&&!at(e.x2)&&!at(e.y2)&&!at(e.xError)&&!at(e.xError2)&&!at(e.yError)&&!at(e.yError2)}function j1e(e){return at(e.x2)||at(e.y2)}function U1e(e){return at(e.xError)||at(e.xError2)||at(e.yError)||at(e.yError2)}function ej(e,t,n){const{mark:r,encoding:i,params:s,projection:o,...a}=e,u=ta(r)?r:{type:r};s&&ve(HB(t));const{orient:l,inputType:c}=B1e(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:g}=Vz(e,l,t),{errorBarSpecificAggregate:m,postAggregateCalculates:v,tooltipSummary:b,tooltipTitleWithFieldName:x}=q1e(u,f,d,h,p,c,t,n),{[g]:_,[g==="x"?"x2":"y2"]:w,[g==="x"?"xError":"yError"]:A,[g==="x"?"xError2":"yError2"]:E,...S}=i,{bins:C,timeUnits:$,aggregate:M,groupby:N,encoding:L}=Hz(S,n),T=[...M,...m],k=c!=="raw"?[]:N,F=RE(b,f,L,x);return{transform:[...a.transform??[],...C,...$,...T.length===0?[]:[{aggregate:T,groupby:k}],...v],groupby:k,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:L,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:a,tooltipEncoding:F}}function q1e(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")&&ve(Q0e(h,p,o)),p==="stderr"||p==="stdev")u=[{op:p,field:c,as:`extent_${c}`},{op:h,field:c,as:`center_${c}`}],l=[{calculate:`${Jt(`center_${c}`)} + ${Jt(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${Jt(`center_${c}`)} - ${Jt(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:g0(h)},{fieldPrefix:"upper_",titlePrefix:ZM(h,p,"+")},{fieldPrefix:"lower_",titlePrefix:ZM(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:Vf({field:c,aggregate:v,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Vf({field:c,aggregate:m,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Vf({field:c,aggregate:g,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&ve(J0e(e.center,e.extent)),s==="aggregated-upper-lower"?(f=[],l=[{calculate:Jt(n.field),as:`upper_${c}`},{calculate:Jt(c),as:`lower_${c}`}]):s==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${Jt(c)} + ${Jt(r.field)}`,as:`upper_${c}`}],i?l.push({calculate:`${Jt(c)} + ${Jt(i.field)}`,as:`lower_${c}`}):l.push({calculate:`${Jt(c)} - ${Jt(r.field)}`,as:`lower_${c}`}));for(const h of l)f.push({fieldPrefix:h.as.substring(0,6),titlePrefix:Lc(Lc(h.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function ZM(e,t,n){return`${g0(e)} ${n} ${t}`}const y$="errorband",W1e=["band","borders"],H1e=new Ib(y$,tj);function tj(e,{config:t}){e={...e,encoding:Pb(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:s,markDef:o,outerSpec:a,tooltipEncoding:u}=ej(e,y$,t),l=o,c=m$(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?ve(UM("interpolate")):l.tension&&ve(UM("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 nj={};function b$(e,t,n){const r=new Ib(e,t);nj[e]={normalizer:r,parts:n}}function G1e(){return pe(nj)}b$(Pv,Zz,N1e);b$(v$,Qz,I1e);b$(y$,tj,W1e);const Y1e=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],rj={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"},ij={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"},V1e=pe(rj),X1e=pe(ij),K1e={header:1,headerRow:1,headerColumn:1,headerFacet:1},sj=pe(K1e),oj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Z1e={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},J1e={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},lo="_vgsid_",Q1e={point:{on:"click",fields:[lo],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 x$(e){return e==="legend"||!!(e!=null&&e.legend)}function Px(e){return x$(e)&&Fe(e)}function _$(e){return!!(e!=null&&e.select)}function aj(e){const t=[];for(const n of e||[]){if(_$(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 eve(e){return Bb(e)||E$(e)||w$(e)}function w$(e){return me(e,"concat")}function Bb(e){return me(e,"vconcat")}function E$(e){return me(e,"hconcat")}function uj({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function na(e){return me(e,"step")}function JM(e){return me(e,"view")||me(e,"width")||me(e,"height")}const QM=20,tve={align:1,bounds:1,center:1,columns:1,spacing:1},nve=pe(tve);function rve(e,t,n){const r=n[t],i={},{spacing:s,columns:o}=r;s!==void 0&&(i.spacing=s),o!==void 0&&(Rb(e)&&!w0(e.facet)||w$(e))&&(i.columns=o),Bb(e)&&(i.columns=1);for(const a of nve)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 NE(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function OE(e,t){const n=Bv(e,t);return na(n)?n.step:lj}function Bv(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return On(n,{step:e.step})}const lj=20,ive={continuousWidth:200,continuousHeight:200,step:lj},sve={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:ive,mark:Kme,arc:{},area:{},bar:e1e,circle:{},geoshape:{},image:{},line:{},point:{},rect:i$,rule:{color:"black"},square:{},text:{color:"black"},tick:t1e,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:Mme,projection:{},legend:Z1e,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Q1e,style:{},title:{},facet:{spacing:QM},concat:{spacing:QM},normalizedNumberFormat:".0%"},_a=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],e6={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},t6={blue:_a[0],orange:_a[1],red:_a[2],teal:_a[3],green:_a[4],yellow:_a[5],purple:_a[6],pink:_a[7],brown:_a[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 ove(e={}){return{signals:[{name:"color",value:Fe(e)?{...t6,...e}:t6}],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 ave(e){return{signals:[{name:"fontSize",value:Fe(e)?{...e6,...e}:e6}],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 uve(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function cj(e){const t=pe(e||{}),n={};for(const r of t){const i=e[r];n[r]=S0(i)?PB(i):Wi(i)}return n}function lve(e){const t=pe(e),n={};for(const r of t)n[r]=cj(e[r]);return n}const cve=[...bz,...jz,...sj,"background","padding","legend","lineBreak","scale","style","title","view"];function fj(e={}){const{color:t,font:n,fontSize:r,selection:i,...s}=e,o=Zd({},it(sve),n?uve(n):{},t?ove(t):{},r?ave(r):{},s||{});i&&Jd(o,"selection",i,!0);const a=Ai(o,cve);for(const u of["background","lineBreak","padding"])o[u]&&(a[u]=Wi(o[u]));for(const u of bz)o[u]&&(a[u]=gr(o[u]));for(const u of jz)o[u]&&(a[u]=cj(o[u]));for(const u of sj)o[u]&&(a[u]=gr(o[u]));if(o.legend&&(a.legend=gr(o.legend)),o.scale){const{invalid:u,...l}=o.scale,c=gr(u,{level:1});a.scale={...gr(l),...pe(c).length>0?{invalid:c}:{}}}return o.style&&(a.style=lve(o.style)),o.title&&(a.title=gr(o.title)),o.view&&(a.view=gr(o.view)),a}const fve=new Set(["view",...Wme]),dve=["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"],hve={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...Xme};function pve(e){e=it(e);for(const t of dve)delete e[t];if(e.axis)for(const t in e.axis)S0(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Y1e)delete e.legend[t];if(e.mark){for(const t of WM)delete e.mark[t];e.mark.tooltip&&Fe(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(aj(e.params)),delete e.params);for(const t of fve){for(const r of WM)delete e[t][r];const n=hve[t];if(n)for(const r of n)delete e[t][r];mve(e,t)}for(const t of G1e())delete e[t];gve(e);for(const t in e)Fe(e[t])&&on(e[t])&&delete e[t];return on(e)?void 0:e}function gve(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=IB(e.title);on(t)||(e.style["group-title"]={...e.style["group-title"],...t}),on(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),on(r)?delete e.title:e.title=r}function mve(e,t,n,r){const i=e[t];t==="view"&&(n="cell");const s={...i,...e.style[n??t]};on(s)||(e.style[n??t]=s),delete e[t]}function zb(e){return me(e,"layer")}function vve(e){return me(e,"repeat")}function yve(e){return!oe(e.repeat)&&me(e.repeat,"layer")}class A${map(t,n){return Rb(t)?this.mapFacet(t,n):vve(t)?this.mapRepeat(t,n):E$(t)?this.mapHConcat(t,n):Bb(t)?this.mapVConcat(t,n):w$(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(zb(t))return this.mapLayer(t,n);if(au(t))return this.mapUnit(t,n);throw new Error(BC(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 bve={zero:1,center:1,normalize:1};function xve(e){return Le(bve,e)}const _ve=new Set([mz,Fb,$b,Tv,Mb,n$,r$,Db,vz,t$]),wve=new Set([Fb,$b,mz]);function kf(e){return be(e)&&Pd(e)==="quantitative"&&!e.bin}function n6(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(be(o)&&be(a))if(kf(o)&&kf(a)){if(o.stack)return t;if(a.stack)return i;const u=be(o)&&!!o.aggregate,l=be(a)&&!!a.aggregate;if(u!==l)return u?t:i;if(s){if(n==="vertical")return i;if(n==="horizontal")return t}}else{if(kf(o))return t;if(kf(a))return i}else{if(kf(o))return s&&n==="vertical"?void 0:t;if(kf(a))return s&&n==="horizontal"?void 0:i}}function Eve(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function dj(e,t){var g,m;const n=ta(e)?e:{type:e},r=n.type;if(!_ve.has(r))return null;const i=n6(t,"x",n)||n6(t,"theta",n);if(!i)return null;const s=t[i],o=be(s)?Ce(s,{}):void 0,a=Eve(i),u=[],l=new Set;if(t[a]){const v=t[a],b=be(v)?Ce(v,{}):void 0;b&&b!==o&&(u.push(a),l.add(b))}const c=a==="x"?"xOffset":"yOffset",f=t[c],d=be(f)?Ce(f,{}):void 0;d&&d!==o&&(u.push(c),l.add(d));const h=Dge.reduce((v,b)=>{if(b!=="tooltip"&&dc(t,b)){const x=t[b];for(const _ of Me(x)){const w=uo(_);if(w.aggregate)continue;const A=Ce(w,{});(!A||!l.has(A))&&v.push({channel:b,fieldDef:w})}}return v},[]);let p;return s.stack!==void 0?ul(s.stack)?p=s.stack?"zero":null:p=s.stack:wve.has(r)&&(p="zero"),!p||!xve(p)||Wz(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)!==vr.LINEAR&&s!=null&&s.stack&&ve(X0e(s.scale.type)),at(t[pa(i)])?(s.stack!==void 0&&ve(V0e(i)),null):(be(s)&&s.aggregate&&!qge.has(s.aggregate)&&ve(K0e(s.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:i,impute:s.impute===null?!1:El(r),stackBy:h,offset:p}))}function hj(e,t,n){const r=gr(e),i=sn("orient",r,n);if(r.orient=Cve(r.type,t,i),i!==void 0&&i!==r.orient&&ve(T0e(r.orient,i)),r.type==="bar"&&r.orient){const u=sn("cornerRadiusEnd",r,n);if(u!==void 0){const l=r.orient==="horizontal"&&t.x2||r.orient==="vertical"&&t.y2?["cornerRadius"]:Jme[r.orient];for(const c of l)r[c]=u;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}const s=sn("opacity",r,n),o=sn("fillOpacity",r,n);return s===void 0&&o===void 0&&(r.opacity=kve(r.type,t)),sn("cursor",r,n)===void 0&&(r.cursor=Ave(r,t,n)),r}function Ave(e,t,n){return t.href||e.href||sn("href",e,n)?"pointer":e.cursor}function kve(e,t){if(At([Mb,t$,n$,r$],e)&&!Wz(t))return .7}function Sve(e,t,{graticule:n}){if(n)return!1;const r=ea("filled",e,t),i=e.type;return On(r,i!==Mb&&i!==Db&&i!==Tv)}function Cve(e,t,n){switch(e){case Mb:case n$:case r$:case vz:case Ume:case jme:return}const{x:r,y:i,x2:s,y2:o}=t;switch(e){case Fb:if(be(r)&&(hr(r.bin)||be(i)&&i.aggregate&&!r.aggregate))return"vertical";if(be(i)&&(hr(i.bin)||be(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(o||s){if(n)return n;if(!s)return(be(r)&&r.type===zc&&!cn(r.bin)||Nv(r))&&be(i)&&hr(i.bin)?"horizontal":"vertical";if(!o)return(be(i)&&i.type===zc&&!cn(i.bin)||Nv(i))&&be(r)&&hr(r.bin)?"vertical":"horizontal"}case Tv:if(s&&!(be(r)&&hr(r.bin))&&o&&!(be(i)&&hr(i.bin)))return;case $b:if(o)return be(i)&&hr(i.bin)?"horizontal":"vertical";if(s)return be(r)&&hr(r.bin)?"vertical":"horizontal";if(e===Tv){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case Db:case t$:{const a=VM(r),u=VM(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=ai(r)&&r.type===Ld,c=ai(i)&&i.type===Ld;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function $ve(e){const{point:t,line:n,...r}=e;return pe(r).length>1?r:r.type}function Fve(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:Ai(e[t],["point","line"])});return e}function Bx(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?Fe(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?Fe(t.point)?t.point:{}:void 0}function r6(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 Dve{constructor(){this.name="path-overlay"}hasMatchingType(t,n){if(au(t)){const{mark:r,encoding:i}=t,s=ta(r)?r:{type:r};switch(s.type){case"line":case"rule":case"trail":return!!Bx(s,n[s.type],i);case"area":return!!Bx(s,n[s.type],i)||!!r6(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=Pb(l,i),d=ta(a)?a:{type:a},h=Bx(d,i[d.type],f),p=d.type==="area"&&r6(d,i[d.type]),g=[{name:u,...s?{params:s}:{},mark:$ve({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:Ai(f,["shape"])}],m=dj(hj(d,f,i),f);let v=f;if(m){const{fieldChannel:b,offset:x}=m;v={...f,[b]:{...f[b],...x?{stack:x}:{}}}}return v=Ai(v,["y2","x2"]),p&&g.push({...o?{projection:o}:{},mark:{type:"line",...Td(d,["clip","interpolate","tension","tooltip"]),...p},encoding:v}),h&&g.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...Td(d,["clip","tooltip"]),...h},encoding:v}),r({...c,layer:g},{...n,config:Fve(i)})}}function Mve(e,t){return t?w0(e)?gj(e,t):pj(e,t):e}function zx(e,t){return t?gj(e,t):e}function LE(e,t,n){const r=t[e];if(h1e(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};ve(l0e(r.repeat));return}return t}function pj(e,t){if(e=LE("field",e,t),e!==void 0){if(e===null)return null;if(c$(e)&&Wa(e.sort)){const n=LE("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function i6(e,t){if(be(e))return pj(e,t);{const n=LE("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function s6(e,t){if(at(e)){const n=i6(e,t);if(n)return n;if(E0(e))return{condition:e.condition}}else{if(A0(e)){const n=i6(e.condition,t);if(n)return{...e,condition:n};{const{condition:r,...i}=e;return i}}return e}}function gj(e,t){const n={};for(const r in e)if(me(e,r)){const i=e[r];if(oe(i))n[r]=i.map(s=>s6(s,t)).filter(s=>s);else{const s=s6(i,t);s!==void 0&&(n[r]=s)}}return n}class Tve{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(au(t)){const{encoding:n,mark:r}=t;if(r==="line"||ta(r)&&r.type==="line")for(const i of Cge){const s=sf(i),o=n[s];if(n[i]&&(be(o)&&!hr(o.bin)||ma(o)))return!0}}return!1}run(t,n,r){const{encoding:i,mark:s}=t;return ve(M0e(!!i.x2,!!i.y2)),r({...t,mark:Fe(s)?{...s,type:"rule"}:"rule"},n)}}class Rve extends A${constructor(){super(...arguments),this.nonFacetUnitNormalizers=[O1e,P1e,H1e,new Dve,new Tve]}map(t,n){if(au(t)){const r=dc(t.encoding,Ua),i=dc(t.encoding,qa),s=dc(t.encoding,vb);if(r||i||s)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:r,parentProjection:i}=n,s=zx(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 yve(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_${yn(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;!oe(r)&&t.columns&&(t=Ai(t,["columns"]),ve(PM("repeat")));const a=[],{repeater:u={},repeaterPrefix:l=""}=n,c=!oe(r)&&r.row||[u?u.row:null],f=!oe(r)&&r.column||[u?u.column:null],d=oe(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},b=(i.name?`${i.name}_`:"")+l+"child__"+(oe(r)?`${yn(p)}`:(r.row?`row_${yn(g)}`:"")+(r.column?`column_${yn(m)}`:"")),x=this.map(i,{...n,repeater:v,repeaterPrefix:b});x.name=b,a.push(Ai(x,["data"]))}const h=oe(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 w0(r)&&t.columns&&(t=Ai(t,["columns"]),ve(PM("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:r,projection:i}=t,{parentEncoding:s,parentProjection:o,config:a}=n,u=a6({parentProjection:o,projection:i}),l=o6({parentEncoding:s,encoding:zx(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=zx(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&&ve(F0e([...r?[Ua]:[],...i?[qa]:[]]));const o={},a={};for(const u of[Ua,qa]){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:Mve(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:o6({parentEncoding:n,encoding:s,layer:!0}),parentProjection:a6({parentProjection:r,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter(l=>l).join("_")}:{}},u)}}function o6({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){const i=new Set([...pe(e),...pe(t)]);for(const s of i){const o=t[s],a=e[s];if(at(o)){const u={...a,...o};r[s]=u}else A0(o)?r[s]={...o,condition:{...a,...o.condition}}:o||o===null?r[s]=o:(n||ao(a)||Ue(a)||at(a)||oe(a))&&(r[s]=a)}}else r=t;return!r||on(r)?void 0:r}function a6(e){const{parentProjection:t,projection:n}=e;return t&&n&&ve(y0e({parentProjection:t,projection:n})),n??t}function k$(e){return me(e,"filter")}function Nve(e){return me(e,"stop")}function mj(e){return me(e,"lookup")}function Ove(e){return me(e,"data")}function Lve(e){return me(e,"param")}function Ive(e){return me(e,"pivot")}function Pve(e){return me(e,"density")}function Bve(e){return me(e,"quantile")}function zve(e){return me(e,"regression")}function jve(e){return me(e,"loess")}function Uve(e){return me(e,"sample")}function qve(e){return me(e,"window")}function Wve(e){return me(e,"joinaggregate")}function Hve(e){return me(e,"flatten")}function Gve(e){return me(e,"calculate")}function vj(e){return me(e,"bin")}function Yve(e){return me(e,"impute")}function Vve(e){return me(e,"timeUnit")}function Xve(e){return me(e,"aggregate")}function Kve(e){return me(e,"stack")}function Zve(e){return me(e,"fold")}function Jve(e){return me(e,"extent")&&!me(e,"density")&&!me(e,"regression")}function Qve(e){return e.map(t=>k$(t)?{filter:Gf(t.filter,Ame)}:t)}class eye extends A${map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=u6(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=u6(t,n),t.encoding){const r={};for(const[i,s]of Qu(t.encoding))r[i]=yj(s,n);t={...t,encoding:r}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:r,...i}=t;return r?{...i,params:Qu(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 Er(n.selectionPredicates[s]??{}))f.empty=l!=="none";return{name:s,value:a,select:c,bind:u}})}:t}}function u6(e,t){const{transform:n,...r}=e;if(n){const i=n.map(s=>{if(k$(s))return{filter:IE(s,t)};if(vj(s)&&of(s.bin))return{...s,bin:bj(s.bin)};if(mj(s)){const{selection:o,...a}=s.from;return o?{...s,from:{param:o,...a}}:s}return s});return{...r,transform:i}}return e}function yj(e,t){var r,i;const n=it(e);if(be(n)&&of(n.bin)&&(n.bin=bj(n.bin)),cf(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(E0(n))if(oe(n.condition))n.condition=n.condition.map(s=>{const{selection:o,param:a,test:u,...l}=s;return a?s:{...l,test:IE(s,t)}});else{const{selection:s,param:o,test:a,...u}=yj(n.condition,t);n.condition=o?n.condition:{...u,test:IE(n.condition,t)}}return n}function bj(e){const t=e.extent;if(t!=null&&t.selection){const{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function IE(e,t){const n=r=>Gf(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):Gf(e.test||e.filter,r=>r.selection?n(r.selection):r)}class PE extends A${map(t,n){const r=n.selections??[];if(t.params&&!au(t)){const i=[];for(const s of t.params)_$(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)(De(a)&&(a===t.name||i.includes(a))||oe(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=PE.prototype[e];PE.prototype[e]=function(n,r){return t.call(this,n,tye(n,r))}}function tye(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function xj(e,t){t===void 0&&(t=fj(e.config));const n=sye(e,t),{width:r,height:i}=e,s=oye(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...s?{autosize:s}:{}}}const nye=new Rve,rye=new eye,iye=new PE;function sye(e,t={}){const n={config:t};return iye.map(nye.map(rye.map(e,n),n),n)}function l6(e){return De(e)?{type:e}:e??{}}function oye(e,t,n){let{width:r,height:i}=t;const s=au(e)||zb(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"&&(ve(NM("width")),r=void 0),i=="container"&&(ve(NM("height")),i=void 0));const a={type:"pad",...o,...n?l6(n.autosize):{},...l6(e.autosize)};if(a.type==="fit"&&!s&&(ve(Jge),a.type="pad"),r=="container"&&!(a.type=="fit"||a.type=="fit-x")&&ve(OM("width")),i=="container"&&!(a.type=="fit"||a.type=="fit-y")&&ve(OM("height")),!Yi(a,{type:"pad"}))return a}function aye(e){return["fit","fit-x","fit-y"].includes(e)}function uye(e){return e?`fit-${wb(e)}`:"fit"}const lye=["background","padding"];function c6(e,t){const n={};for(const r of lye)e&&e[r]!==void 0&&(n[r]=Wi(e[r]));return t&&(n.params=e.params),n}class uu{constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new uu(it(this.explicit),it(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return On(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 pe(t.combine())){const r=t.getWithExplicit(n);this.setWithExplicit(n,r)}}}function $o(e){return{explicit:!0,value:e}}function Pi(e){return{explicit:!1,value:e}}function _j(e){return(t,n,r,i)=>{const s=e(t.value,n.value);return s>0?t:s<0?n:jb(t,n,r,i)}}function jb(e,t,n,r){return e.explicit&&t.explicit&&ve(j0e(n,r,e.value,t.value)),e}function nl(e,t,n,r,i=jb){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Yi(e.value,t.value)?e:i(e,t,n,r)}class cye extends uu{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 jd(e){return me(e,"url")}function yg(e){return me(e,"values")}function wj(e){return me(e,"name")&&!jd(e)&&!yg(e)&&!zu(e)}function zu(e){return e&&(Ej(e)||Aj(e)||S$(e))}function Ej(e){return me(e,"sequence")}function Aj(e){return me(e,"sphere")}function S$(e){return me(e,"graticule")}var Cn;(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"})(Cn||(Cn={}));function kj({invalid:e,isPath:t}){switch(xz(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 fye(e){const{marks:t,scales:n}=kj(e);return t===n?Cn.Main:n==="include-invalid-values"?Cn.PreFilterInvalid:Cn.PostFilterInvalid}class tn{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)){ve(g0e);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 ki extends tn{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 ${_B()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function jx(e){return e.as!==void 0}function f6(e){return`${e}_end`}class Wo extends tn{clone(){return new Wo(null,it(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(lf(u)){if(kn(n)){const{mark:c,markDef:f,config:d}=n,h=tl({fieldDef:s,markDef:f,config:d});(vg(c)||h)&&(l={timeUnit:or(u),field:a})}}else l={as:Ce(s,{forAs:!0}),field:a,timeUnit:u};if(kn(n)){const{mark:c,markDef:f,config:d}=n,h=tl({fieldDef:s,markDef:f,config:d});vg(c)&&Ln(o)&&h!==.5&&(l.rectBandPosition=h)}l&&(i[Ft(l)]=l)}return i},{});return on(r)?null:new Wo(t,r)}static makeFromTransform(t,n){const{timeUnit:r,...i}={...n},s=or(r),o={...i,timeUnit:s};return new Wo(t,{[Ft(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 Qu(this.timeUnits)){const s=jx(i)?i.as:`${i.field}_end`;t.has(s)||(n[r]=i)}this.timeUnits=n}producedFields(){return new Set(Er(this.timeUnits).map(t=>jx(t)?t.as:f6(t.field)))}dependentFields(){return new Set(Er(this.timeUnits).map(t=>t.field))}hash(){return`TimeUnit ${Ft(this.timeUnits)}`}assemble(){const t=[];for(const n of Er(this.timeUnits)){const{rectBandPosition:r}=n,i=or(n.timeUnit);if(jx(n)){const{field:s,as:o}=n,{unit:a,utc:u,...l}=i,c=[o,`${o}_end`];t.push({field:$s(s),type:"timeunit",...a?{units:Sb(a)}:{},...u?{timezone:"utc"}:{},...l,as:c}),t.push(...d6(c,r,i))}else if(n){const{field:s}=n,o=s.replaceAll("\\.","."),a=Sj({timeUnit:i,field:o}),u=f6(o);t.push({type:"formula",expr:a,as:u}),t.push(...d6([o,u],r,i))}}return t}}const Ub="offsetted_rect_start",qb="offsetted_rect_end";function Sj({timeUnit:e,field:t,reverse:n}){const{unit:r,utc:i}=e,s=nz(r),{part:o,step:a}=oz(s,e.step);return`${i?"utcOffset":"timeOffset"}('${o}', ${Jt(t)}, ${n?-a:a})`}function d6([e,t],n,r){if(n!==void 0&&n!==.5){const i=Jt(e),s=Jt(t);return[{type:"formula",expr:h6([Sj({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${Ub}`},{type:"formula",expr:h6([i,s],n+.5),as:`${e}_${qb}`}]}return[]}function h6([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const C0="_tuple_fields";class dye{constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const hye={defined:()=>!0,parse:(e,t,n)=>{const r=t.name,i=t.project??(t.project=new dye),s={},o={},a=new Set,u=(p,g)=>{const m=g==="visual"?p.channel:p.field;let v=yn(`${r}_${m}`);for(let b=1;a.has(v);b++)v=yn(`${r}_${m}_${b}`);return a.add(v),{[g]:v}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?Me(n.value):null;let{fields:d,encodings:h}=Fe(n.select)?n.select:{};if(!d&&!h&&f){for(const p of f)if(Fe(p))for(const g of pe(p))Sge(g)?(h||(h=[])).push(g):l==="interval"?(ve(u0e),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){ve(Qge(p,g.aggregate));continue}else if(!m){ve(IM(p));continue}if(g.timeUnit&&!lf(g.timeUnit)){m=e.vgField(p);const v={timeUnit:g.timeUnit,as:m,field:g.field};o[Ft(v)]=v}if(!s[m]){const v=l==="interval"&&ga(p)&&oo(e.getScaleComponent(p).get("type"))?"R":g.bin?"R-RE":"E",b={field:m,channel:p,type:v,index:i.items.length};b.signals={...u(b,"data"),...u(b,"visual")},i.items.push(s[m]=b),i.hasField[m]=s[m],i.hasSelectionId=i.hasSelectionId||m===lo,CB(p)?(b.geoChannel=p,b.channel=SB(p),i.hasChannel[b.channel]=s[m]):i.hasChannel[p]=s[m]}}else ve(IM(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===lo}f&&(t.init=f.map(p=>i.items.map(g=>Fe(p)?p[g.geoChannel||g.channel]!==void 0?p[g.geoChannel||g.channel]:p[g.field]:p))),on(o)||(i.timeUnit=new Wo(null,o))},signals:(e,t,n)=>{const r=t.name+C0;return n.filter(s=>s.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(Dj)})}},Cj="_curr",s1="anim_value",Mf="anim_clock",BE="eased_anim_clock",$j="min_extent",Fj="max_range_extent",Ux="last_tick_at",qx="is_playing",pye=1/60*1e3,gye=(e,t)=>[{name:BE,update:Mf},{name:`${e}_domain`,init:`domain('${t}')`},{name:$j,init:`extent(${e}_domain)[0]`},{name:Fj,init:`extent(range('${t}'))[1]`},{name:s1,update:`invert('${t}', ${BE})`}],mye={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(Ho(t)&&(n=n.concat([{name:Mf,init:"0",on:[{events:{type:"timer",throttle:pye},update:`${qx} ? (${Mf} + (now() - ${Ux}) > ${Fj} ? 0 : ${Mf} + (now() - ${Ux})) : ${Mf}`}]},{name:Ux,init:"now()",on:[{events:[{signal:Mf},{signal:qx}],update:"now()"}]},{name:qx,init:"true"}])),n),signals:(e,t,n)=>{const r=t.name,i=r+C0,s=t.project,o="(item().isVoronoi ? datum.datum : datum)",a=Er(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+Xf):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: ${hc(e)}, `;if(t.project.hasSelectionId)l+=`${lo}: ${o}[${Ee(lo)}]`;else if(Ho(t))l+=`fields: ${i}, values: [${s1} ? ${s1} : ${$j}]`;else{const c=s.items.map(f=>{const d=e.fieldDef(f.channel);return d!=null&&d.bin?`[${o}[${Ee(e.vgField(f.channel,{}))}], ${o}[${Ee(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${o}[${Ee(f.field)}]`}).join(", ");l+=`fields: ${i}, values: [${c}]`}if(Ho(t))return n.concat(gye(t.name,e.scaleName(vl)),[{name:r+Qa,on:[{events:[{signal:BE},{signal:s1}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:r+Qa,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function Dj(e){const{signals:t,hasLegend:n,index:r,...i}=e;return i.field=$s(i.field),i}function qc(e,t=!0,n=Ur){if(oe(e)){const r=e.map(i=>qc(i,t,n));return t?`[${r.join(", ")}]`:r}else if(uf(e))return n(t?Bc(e):dme(e));return t?n(an(e)):e}function vye(e,t){for(const n of Er(e.component.selection??{})){const r=n.name;let i=`${r}${Qa}, ${n.resolve==="global"?"true":`{unit: ${hc(e)}}`}`;for(const s of Hb)s.defined(n)&&(s.signals&&(t=s.signals(e,n,t)),s.modifyExpr&&(i=s.modifyExpr(e,n,i)));t.push({name:r+Wye,on:[{events:{signal:n.name+Qa},update:`modify(${Ee(n.name+Wc)}, ${i})`}]})}return C$(t)}function yye(e,t){if(e.component.selection&&pe(e.component.selection).length){const n=Ee(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:gl("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return C$(t)}function bye(e,t){let n=!1;for(const r of Er(e.component.selection??{})){const i=r.name,s=Ee(i+Wc);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:`${Yj}(${s}, ${Ee(a)}${u}`})}n=!0;for(const a of Hb)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"}]}),C$(t)}function xye(e,t){const n=[],r=[],i=hc(e,{escape:!1});for(const s of Er(e.component.selection??{})){const o={name:s.name+Wc};if(s.project.hasSelectionId&&(o.transform=[{type:"collect",sort:{field:lo}}]),s.init){const u=s.project.items.map(Dj);o.values=s.project.hasSelectionId?s.init.map(l=>({unit:i,[lo]:qc(l,!1)[0]})):s.init.map(l=>({unit:i,fields:u,values:qc(l,!1)}))}if([...n,...t].filter(u=>u.name===s.name+Wc).length||n.push(o),Ho(s)&&t.length){const u=e.lookupDataSource(e.getDataName(Cn.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+Cj,source:l.name,transform:[c]};r.push(f)}}}return n.concat(t,r)}function Mj(e,t){for(const n of Er(e.component.selection??{}))for(const r of Hb)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function _ye(e,t){for(const n of e.children)kn(n)&&(t=Mj(n,t));return t}function wye(e,t,n,r){const i=iU(e,t.param,t);return{signal:oo(n.get("type"))&&oe(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function C$(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const Ha={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(!ga(i))continue;const s=e.getScaleComponent(i),o=s?s.get("type"):void 0;if(o=="sequential"&&ve(r0e),!s||!oo(o)){ve(n0e);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||jE(e)||r.length===0)return n;const i=n.find(o=>o.name===t.name);let s=i.update;if(s.includes(Yj))i.update=`{${r.map(o=>`${Ee($s(o.field))}: ${o.signals.data}`).join(", ")}}`;else{for(const o of r){const a=`${Ee($s(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&&!jE(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 zE(e,t){return`domain(${Ee(e.scaleName(t))})`}function jE(e){return e.parent&&_h(e.parent)&&(!e.parent.parent||jE(e.parent.parent))}const Xf="_brush",Tj="_scale_trigger",Hh="geo_interval_init_tick",Rj="_init",Eye="_center",Aye={defined:e=>e.type==="interval",parse:(e,t,n)=>{var r;if(e.hasProjection){const i={...Fe(n.select)?n.select:{}};i.fields=[lo],i.encodings||(i.encodings=n.value?pe(n.value):[yo,vo]),n.select={type:"interval",...i}}if(t.translate&&!Ha.defined(t)){const i=`!event.item || event.item.mark.name !== ${Ee(t.name+Xf)}`;for(const s of t.events){if(!s.between){ve(`${s} is not an ordered event stream for interval selections.`);continue}const o=Me((r=s.between[0]).filter??(r.filter=[]));o.includes(i)||o.push(i)}}},signals:(e,t,n)=>{const r=t.name,i=r+Qa,s=Er(t.project.hasChannel).filter(a=>a.channel===bn||a.channel===cr),o=t.init?t.init[0]:null;if(n.push(...s.reduce((a,u)=>a.concat(kye(e,t,u,o&&o[u.index])),[])),e.hasProjection){const a=Ee(e.projectionName()),u=e.projectionName()+Eye,{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=w=>e.getSizeSignalRef(w).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+Rj,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: ${Ee(e.getName("marks"))}}, unit.mark)`,b=`{unit: ${hc(e)}}`,x=`vlSelectionTuples(${v}, ${b})`,_=s.map(w=>w.signals.visual);return n.concat({name:i,on:[{events:[..._.length?[{signal:_.join(" || ")}]:[],...o?[{signal:Hh}]:[]],update:x}]})}else{if(!Ha.defined(t)){const l=r+Tj,c=s.map(f=>{const d=f.channel,{data:h,visual:p}=f.signals,g=Ee(e.scaleName(d)),m=e.getScaleComponent(d).get("type"),v=oo(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: ${hc(e)}, fields: ${r+C0}, values`;return n.concat({name:i,...o?{init:`{${u}: ${qc(o)}}`}:{},...a.length?{on:[{events:[{signal:a.join(" || ")}],update:`${a.join(" && ")} ? {${u}: [${a}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(kn(e)&&e.hasProjection&&t.init&&(n.filter(i=>i.name===Hh).length||n.unshift({name:Hh,value:null,on:[{events:"timer{1}",update:`${Hh} === null ? {} : ${Hh}`}]})),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(${Ee(t.name+Wc)})`;if(Ha.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 pe(l))l[m]=[{test:`${u}.length && ${u}[0].unit === ${hc(e)}`,...l[m]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=pe(h).reduce((m,v)=>(m[v]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,s!==void 0&&`${a}[0] !== ${a}[1]`].filter(b=>b).join(" && "),value:h[v]},{value:null}],m),{}),g=d??(t.translate?"move":null);return[{name:`${r+Xf}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:r+Xf,type:"rect",clip:!0,encode:{enter:{...g?{cursor:{value:g}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function kye(e,t,n,r){const i=!e.hasProjection,s=n.channel,o=n.signals.visual,a=Ee(i?e.scaleName(s):e.projectionName()),u=d=>`scale(${a}, ${d})`,l=e.getSizeSignalRef(s===bn?"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=Ha.defined(t),p=e.getScaleComponent(s),g=p?p.get("type"):void 0,m=r?{init:qc(r,!0,u)}:{value:[]};return f.push({events:{signal:t.name+Tj},update:oo(g)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),h?[{name:d,on:[]}]:[{name:o,...m,on:f},{name:d,...r?{init:qc(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${a}, ${o})`}]}]}else{const d=s===bn?0:1,h=t.name+Rj,p=r?{init:`[${h}[0][${d}], ${h}[1][${d}]]`}:{value:[]};return[{name:o,...p,on:f}]}}function vh({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){const s=E0(t)&&t.condition;let o=[];s&&(o=Me(s).map(l=>{const c=i(l);if(d1e(l)){const{param:f,empty:d}=l;return{test:rU(e,{param:f,empty:d}),...c}}else return{test:qv(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 $$(e,t="text"){const n=e.encoding[t];return vh({model:e,channelDef:n,vgChannel:t,mainRefFn:r=>Wb(r,e.config),invalidValueRef:void 0})}function Wb(e,t,n="datum"){if(e){if(ao(e))return dn(e.value);if(at(e)){const{format:r,formatType:i}=Lv(e);return u$({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function Nj(e,t={}){const{encoding:n,markDef:r,config:i,stack:s}=e,o=n.tooltip;if(oe(o))return{tooltip:p6({tooltip:o},s,i,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return vh({model:e,channelDef:o,vgChannel:"tooltip",mainRefFn:l=>{const c=Wb(l,i,a);if(c)return c;if(l===null)return;let f=sn("tooltip",r,i);if(f===!0&&(f={content:"encoding"}),De(f))return{value:f};if(Fe(f))return Ue(f)?f:f.content==="encoding"?p6(n,s,i,t):{signal:a}},invalidValueRef:void 0})}}function Oj(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=sf(f),h=ai(c)?c:{...c,type:e[d].type},p=h.title||d$(h,i),g=Me(p).join(", ").replaceAll(/"/g,'\\"');let m;if(Ln(f)){const v=f==="x"?"x2":"y2",b=uo(e[v]);if(hr(h.bin)&&b){const x=Ce(h,{expr:o}),_=Ce(b,{expr:o}),{format:w,formatType:A}=Lv(h);m=_0(x,_,w,A,i),s.add(v)}}if((Ln(f)||f===Ms||f===mo)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:v,formatType:b}=Lv(h);m=u$({fieldOrDatumDef:h,format:v,formatType:b,expr:o,config:i,normalizeStack:!0}).signal}m??(m=Wb(h,i,o).signal),a.push({channel:f,key:g,value:m})}p$(e,(c,f)=>{be(c)?u(c,f):Nb(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 p6(e,t,n,{reactiveGeom:r}={}){const i=Oj(e,t,n,{reactiveGeom:r}),s=Qu(i).map(([o,a])=>`"${o}": ${a}`);return s.length>0?{signal:`{${s.join(", ")}}`}:void 0}function Sye(e){const{markDef:t,config:n}=e,r=sn("aria",t,n);return r===!1?{}:{...r?{aria:r}:{},...Cye(e),...$ye(e)}}function Cye(e){const{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};const i=sn("ariaRoleDescription",n,r);return i!=null?{ariaRoleDescription:{value:i}}:Le(Xge,t)?{}:{ariaRoleDescription:{value:t}}}function $ye(e){const{encoding:t,markDef:n,config:r,stack:i}=e,s=t.description;if(s)return vh({model:e,channelDef:s,vgChannel:"description",mainRefFn:u=>Wb(u,e.config),invalidValueRef:void 0});const o=sn("description",n,r);if(o!=null)return{description:dn(o)};if(r.aria===!1)return{};const a=Oj(t,i,r);if(!on(a))return{description:{signal:Qu(a).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function yr(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=sn(e,r,s,{vgChannel:o,ignoreVgConfig:!E0(l)})),u!==void 0&&(a=dn(u)));const c={markDef:r,config:s,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=wz({...c,scaleChannel:e,channelDef:l});return vh({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:f,mainRefFn:h=>a$({...c,channel:e,channelDef:h,stack:null,defaultRef:a})})}function Lj(e,t={filled:void 0}){const{markDef:n,encoding:r,config:i}=e,{type:s}=n,o=t.filled??sn("filled",n,i),a=At(["bar","point","circle","square","geoshape"],s)?"transparent":void 0,u=sn(o===!0?"color":void 0,n,i,{vgChannel:"fill"})??i.mark[o===!0&&"color"]??a,l=sn(o===!1?"color":void 0,n,i,{vgChannel:"stroke"})??i.mark[o===!1&&"color"],c=o?"fill":"stroke",f={...u?{fill:dn(u)}:{},...l?{stroke:dn(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&ve(YB("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...yr("color",e,{vgChannel:c,defaultValue:o?u:l}),...yr("fill",e,{defaultValue:r.fill?u:void 0}),...yr("stroke",e,{defaultValue:r.stroke?l:void 0})}}function Fye(e){const{encoding:t,mark:n}=e,r=t.order;return!El(n)&&ao(r)?vh({model:e,channelDef:r,vgChannel:"zindex",mainRefFn:i=>dn(i.value),invalidValueRef:void 0}):{}}function Ud({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:a$({channel:s,channelDef:a,markDef:t,config:r==null?void 0:r.config,scaleName:r.scaleName(s),scale:r.getScaleComponent(s),stack:null,defaultRef:dn(o),bandPosition:i})};const u=t[s];return u?{offsetType:"visual",offset:u}:{}}function ni(e,t,{defaultPos:n,vgChannel:r}){const{encoding:i,markDef:s,config:o,stack:a}=t,u=i[e],l=i[pa(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=Ud({channel:e,markDef:s,encoding:i,model:t,bandPosition:.5}),p=F$({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),g=!u&&Ln(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:Dye({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 Dye(e){const{channel:t,channelDef:n,scaleName:r,stack:i,offset:s,markDef:o}=e;if(at(n)&&i&&t===i.fieldChannel){if(be(n)){let a=n.bandPosition;if(a===void 0&&o.type==="text"&&(t==="radius"||t==="theta")&&(a=.5),a!==void 0)return Rv({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",bandPosition:a,offset:s})}return fc(n,r,{suffix:"end"},{offset:s})}return o$(e)}function F$({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){const{markDef:s,config:o}=e;return()=>{const a=sf(n),u=el(n),l=sn(n,s,o,{vgChannel:u});if(l!==void 0)return zp(n,l);switch(t){case"zeroOrMin":return g6({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:a,config:o});case"zeroOrMax":return g6({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:a,config:o});case"mid":return{...e[Mi(n)],mult:.5}}}}function g6({mainChannel:e,config:t,...n}){const r=_z(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 Mye={left:"x",center:"xc",right:"x2"},Tye={top:"y",middle:"yc",bottom:"y2"};function Ij(e,t,n,r="middle"){if(e==="radius"||e==="theta")return el(e);const i=e==="x"?"align":"baseline",s=sn(i,t,n);let o;return Ue(s)?(ve(D0e(i)),o=void 0):o=s,e==="x"?Mye[o||(r==="top"?"left":"center")]:Tye[o||r]}function zv(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?Pj(e,t,{defaultPos:n,defaultPos2:r}):ni(e,t,{defaultPos:n})}function Pj(e,t,{defaultPos:n,defaultPos2:r}){const{markDef:i,config:s}=t,o=pa(e),a=Mi(e),u=Rye(t,r,o),l=u[a]?Ij(e,i,s):el(e);return{...ni(e,t,{defaultPos:n,vgChannel:l}),...u}}function Rye(e,t,n){const{encoding:r,mark:i,markDef:s,stack:o,config:a}=e,u=sf(n),l=Mi(n),c=el(n),f=r[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:p}=n in r||n in s?Ud({channel:n,markDef:s,encoding:r,model:e}):Ud({channel:u,markDef:s,encoding:r,model:e});if(!f&&(n==="x2"||n==="y2")&&(r.latitude||r.longitude)){const m=Mi(n),v=e.markDef[m];return v!=null?{[m]:{value:v}}:{[c]:{field:e.getName(n)}}}const g=Nye({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}:dm(n,s)||dm(n,{[n]:$E(n,s,a.style),[l]:$E(l,s,a.style)})||dm(n,a[i])||dm(n,a.mark)||{[c]:F$({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}function Nye({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:s,scale:o,stack:a,offset:u,defaultRef:l}){return at(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0)?fc(t,s,{suffix:"start"},{offset:u}):o$({channel:e,channelDef:n,scaleName:s,scale:o,stack:a,markDef:r,config:i,offset:u,defaultRef:l})}function dm(e,t){const n=Mi(e),r=el(e);if(t[r]!==void 0)return{[r]:zp(e,t[r])};if(t[e]!==void 0)return{[r]:zp(e,t[e])};if(t[n]){const i=t[n];if(jc(i))ve(A0e(n));else return{[n]:zp(e,i)}}}function Ja(e,t){const{config:n,encoding:r,markDef:i}=e,s=i.type,o=pa(t),a=Mi(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??sn("size",i,n,{vgChannel:a}),p=MB(t),g=s==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||s==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return be(u)&&(cn(u.bin)||hr(u.bin)||u.timeUnit&&!l)&&!(h&&!jc(h))&&!r[p]&&!ur(f)?Iye({fieldDef:u,fieldDef2:l,channel:t,model:e}):(at(u)&&ur(f)||g)&&!l?Lye(u,t,e):Pj(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function Oye(e,t,n,r,i,s,o){if(jc(i))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;i.band!==1&&(l=`${i.band} * ${l}`);const c=ea("minBandSize",{type:o},r);return{signal:c?`max(${Zs(c)}, ${l})`:l}}else i.band!==1&&(ve(N0e(u)),i=void 0)}else return{mult:i.band,field:{group:e}};else{if(Ue(i))return i;if(i)return{value:i}}if(n){const u=n.get("range");if(af(u)&&Ut(u.step))return{value:u.step-2}}if(!s){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=r.scale,d=On(u,o==="tick"?f:o==="bar"?l:c);if(Ue(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(Ut(d))return{signal:`${1-d} * ${e}`}}return{value:OE(r.view,e)-2}}function Lye(e,t,n){var C,$;const{markDef:r,encoding:i,config:s,stack:o}=n,a=r.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=Mi(t),f=pa(t),d=MB(t),h=n.scaleName(d),p=n.getScaleComponent(RC(t)),g=r.type==="tick"||a==="horizontal"&&t==="y"||a==="vertical"&&t==="x";let m;(i.size||r.size)&&(g?m=yr("size",n,{vgChannel:c,defaultRef:dn(r.size)}):ve(P0e(r.type)));const v=!!m,b=Fz({channel:t,fieldDef:e,markDef:r,config:s,scaleType:(C=l||p)==null?void 0:C.get("type"),useVlSizeChannel:g});m=m||{[c]:Oye(c,h||u,p||l,s,b,!!e,r.type)};const x=(($=l||p)==null?void 0:$.get("type"))==="band"&&jc(b)&&!v?"top":"middle",_=Ij(t,r,s,x),w=_==="xc"||_==="yc",{offset:A,offsetType:E}=Ud({channel:t,markDef:r,encoding:i,model:n,bandPosition:w?.5:0}),S=o$({channel:t,channelDef:e,markDef:r,config:s,scaleName:u,scale:l,stack:o,offset:A,defaultRef:F$({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:w?E==="encoding"?0:.5:Ue(b)?{signal:`(1-${b})/2`}:jc(b)?(1-b.band)/2:0});if(c)return{[_]:S,...m};{const M=el(f),N=m[c],L=A?{...N,offset:A}:N;return{[_]:S,[M]:oe(S)?[S[0],{...S[1],offset:L}]:{...S,offset:L}}}}function m6(e,t,n,r,i,s,o){if(kB(e))return 0;const a=e==="x"||e==="y2",u=a?-t/2:t/2;if(Ue(n)||Ue(i)||Ue(r)||s){const l=Zs(n),c=Zs(i),f=Zs(r),d=Zs(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 Iye({fieldDef:e,fieldDef2:t,channel:n,model:r}){var $;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=Fz({channel:n,fieldDef:e,markDef:s,config:i,scaleType:l}),d=($=r.component.axes[n])==null?void 0:$[0],h=(d==null?void 0:d.get("translate"))??.5,p=Ln(n)?sn("binSpacing",s,i)??0:0,g=pa(n),m=el(n),v=el(g),b=ea("minBandSize",s,i),{offset:x}=Ud({channel:n,markDef:s,encoding:o,model:r,bandPosition:0}),{offset:_}=Ud({channel:g,markDef:s,encoding:o,model:r,bandPosition:0}),w=o1e({fieldDef:e,scaleName:u}),A=m6(n,p,c,h,x,b,w),E=m6(g,p,c,h,_??x,b,w),S=Ue(f)?{signal:`(1-${f.signal})/2`}:jc(f)?(1-f.band)/2:.5,C=tl({fieldDef:e,fieldDef2:t,markDef:s,config:i});if(cn(e.bin)||e.timeUnit){const M=e.timeUnit&&C!==.5;return{[v]:v6({fieldDef:e,scaleName:u,bandPosition:S,offset:E,useRectOffsetField:M}),[m]:v6({fieldDef:e,scaleName:u,bandPosition:Ue(S)?{signal:`1-${S.signal}`}:1-S,offset:A,useRectOffsetField:M})}}else if(hr(e.bin)){const M=fc(e,u,{},{offset:E});if(be(t))return{[v]:M,[m]:fc(t,u,{},{offset:A})};if(of(e.bin)&&e.bin.step)return{[v]:M,[m]:{signal:`scale("${u}", ${Ce(e,{expr:"datum"})} + ${e.bin.step})`,offset:A}}}ve(KB(g))}function v6({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return Rv({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:Ub,endSuffix:qb}:{}})}const Pye=new Set(["aria","width","height"]);function Ts(e,t){const{fill:n=void 0,stroke:r=void 0}=t.color==="include"?Lj(e):{};return{...Bye(e.markDef,t),...y6("fill",n),...y6("stroke",r),...yr("opacity",e),...yr("fillOpacity",e),...yr("strokeOpacity",e),...yr("strokeWidth",e),...yr("strokeDash",e),...Fye(e),...Nj(e),...$$(e,"href"),...Sye(e)}}function y6(e,t){return t?{[e]:t}:{}}function Bye(e,t){return Vge.reduce((n,r)=>(!Pye.has(r)&&me(e,r)&&t[r]!=="ignore"&&(n[r]=dn(e[r])),n),{})}function D$(e){const{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,s)=>{var l;let o;if(!ga(s)||!(o=e.getScaleType(s)))return;const a=Eb(i.aggregate),u=s$({scaleChannel:s,markDef:n,config:t,scaleType:o,isCountAggregate:a});if(r1e(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=>Cb(s,!0)).join(" && ")}}}function b6(e,t){if(t!==void 0)return{[e]:dn(t)}}const Wx="voronoi",Bj={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Wx)},marks:(e,t,n)=>{const{x:r,y:i}=t.project.hasChannel,s=e.mark;if(El(s))return ve(e0e(s)),n;const o={name:e.getName(Wx),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Nj(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(Wx)&&(u=!0)}),u||n.splice(a+1,0,o),n}},zj={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!x$(e.bind),parse:(e,t,n)=>Vj(t,n),topLevelSignals:(e,t,n)=>{const r=t.name,i=t.project,s=t.bind,o=t.init&&t.init[0],a=Bj.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((u,l)=>{const c=yn(`${r}_${u.field}`);n.filter(d=>d.name===c).length||n.unshift({name:c,...o?{init:qc(o[l])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${Ee(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+Qa),o=r+C0,a=i.items.map(l=>yn(`${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}},jv="_toggle",jj={defined:e=>e.type==="point"&&!Ho(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+jv,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Qa,r=t.name+jv;return`${r} ? null : ${n}, `+(t.resolve==="global"?`${r} ? null : true, `:`${r} ? null : {unit: ${hc(e)}}, `)+`${r} ? ${n} : null`}},zye={defined:e=>e.clear!==void 0&&e.clear!==!1&&!Ho(e),parse:(e,t)=>{t.clear&&(t.clear=De(t.clear)?gl(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(zj.defined(t))for(const r of t.project.items){const i=n.findIndex(s=>s.name===yn(`${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+Qa);r(i,"null"),jj.defined(t)&&(i=n.findIndex(s=>s.name===t.name+jv),r(i,"false"))}return n}},Uj={defined:e=>{const t=e.resolve==="global"&&e.bind&&x$(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==lo;return t&&!n&&ve(i0e),t&&n},parse:(e,t,n)=>{const r=it(n);if(r.select=De(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},Vj(t,r),Fe(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=Me(a.filter??[]),a.filter.includes(o)||a.filter.push(o)}const i=Px(t.bind)?t.bind.legend:"click",s=De(i)?gl(i,"view"):Me(i);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const r=t.name,i=Px(t.bind)&&t.bind.legend,s=o=>a=>{const u=it(a);return u.markname=o,u};for(const o of t.project.items){if(!o.hasLegend)continue;const a=`${yn(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+Qa),o=r+C0,a=i.items.filter(d=>d.hasLegend).map(d=>yn(`${r}_${yn(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+jv),f=Px(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function jye(e,t,n){var i;const r=(i=e.fieldDef(t))==null?void 0:i.field;for(const s of Er(e.component.selection??{})){const o=s.project.hasField[r]??s.project.hasChannel[t];if(o&&Uj.defined(s)){const a=n.get("selections")??[];a.push(s.name),n.set("selections",a,!1),o.hasLegend=!0}}}const qj="_translate_anchor",Wj="_translate_delta",Uye={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const r=t.name,i=Ha.defined(t),s=r+qj,{x:o,y:a}=t.project.hasChannel;let u=gl(t.translate,"scope");return i||(u=u.map(l=>(l.between[0].markname=r+Xf,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?zE(e,bn):`slice(${o.signals.visual})`}`:"")+(a!==void 0?`, extent_y: ${i?zE(e,cr):`slice(${a.signals.visual})`}`:"")+"}"}]},{name:r+Wj,value:{},on:[{events:u,update:`{x: ${s}.x - x(unit), y: ${s}.y - y(unit)}`}]}),o!==void 0&&x6(e,t,o,"width",n),a!==void 0&&x6(e,t,a,"height",n),n}};function x6(e,t,n,r,i){const s=t.name,o=s+qj,a=s+Wj,u=n.channel,l=Ha.defined(t),c=i.find(w=>w.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===bn?p?"":"-":p?"-":"":"",m=`${o}.extent_${u}`,v=`${g}${a}.${u} / ${l?`${f}`:`span(${m})`}`,b=!l||!d?"panLinear":h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear",x=l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":"",_=`${b}(${m}, ${v}${x})`;c.on.push({events:{signal:a},update:l?_:`clampRange(${_}, 0, ${f})`})}const Hj="_zoom_anchor",Gj="_zoom_delta",qye={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const r=t.name,i=Ha.defined(t),s=r+Gj,{x:o,y:a}=t.project.hasChannel,u=Ee(e.scaleName(bn)),l=Ee(e.scaleName(cr));let c=gl(t.zoom,"scope");return i||(c=c.map(f=>(f.markname=r+Xf,f))),n.push({name:r+Hj,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&&_6(e,t,o,"width",n),a!==void 0&&_6(e,t,a,"height",n),n}};function _6(e,t,n,r,i){const s=t.name,o=n.channel,a=Ha.defined(t),u=i.find(b=>b.name===n.signals[a?"data":"visual"]),l=e.getSizeSignalRef(r).signal,c=e.getScaleComponent(o),f=c&&c.get("type"),d=a?zE(e,o):u.name,h=s+Gj,p=`${s}${Hj}.${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 Wc="_store",Qa="_tuple",Wye="_modify",Yj="vlSelectionResolve",Hb=[mye,Aye,hye,jj,zj,Ha,Uj,zye,Uye,qye,Bj];function Hye(e){let t=e.parent;for(;t&&!Ji(t);)t=t.parent;return t}function hc(e,{escape:t}={escape:!0}){let n=t?Ee(e.name):e.name;const r=Hye(e);if(r){const{facet:i}=r;for(const s of vs)i[s]&&(n+=` + '__facet_${s}_' + (facet[${Ee(r.vgField(s))}])`)}return n}function M$(e){return Er(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function Vj(e,t){(De(t.select)||!t.select.on)&&delete e.events,(De(t.select)||!t.select.clear)&&delete e.clear,(De(t.select)||!t.select.toggle)&&delete e.toggle}function Ho(e){var t;return(t=e.events)==null?void 0:t.find(n=>"type"in n&&n.type==="timer")}const Gye="RawCode",Yye="Literal",Vye="Property",Xye="Identifier",Kye="ArrayExpression",Zye="BinaryExpression",Jye="CallExpression",Qye="ConditionalExpression",ebe="LogicalExpression",tbe="MemberExpression",nbe="ObjectExpression",rbe="UnaryExpression";function xo(e){this.type=e}xo.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=ibe(this),n=0,r=t.length;n";va[Hc]="Identifier";va[Al]="Keyword";va[Yb]="Null";va[ff]="Numeric";va[yi]="Punctuator";va[F0]="String";va[sbe]="RegularExpression";var obe="ArrayExpression",abe="BinaryExpression",ube="CallExpression",lbe="ConditionalExpression",Xj="Identifier",cbe="Literal",fbe="LogicalExpression",dbe="MemberExpression",hbe="ObjectExpression",pbe="Property",gbe="UnaryExpression",sr="Unexpected token %0",mbe="Unexpected number",vbe="Unexpected string",ybe="Unexpected identifier",bbe="Unexpected reserved word",xbe="Unexpected end of input",UE="Invalid regular expression",Hx="Invalid regular expression: missing /",Kj="Octal literals are not allowed in strict mode.",_be="Duplicate data property in object literal not allowed in strict mode",_r="ILLEGAL",bg="Disabled.",wbe=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]"),Ebe=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 Vb(e,t){if(!e)throw new Error("ASSERT: "+t)}function Sa(e){return e>=48&&e<=57}function T$(e){return"0123456789abcdefABCDEF".includes(e)}function jp(e){return"01234567".includes(e)}function Abe(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 xg(e){return e===10||e===13||e===8232||e===8233}function D0(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&wbe.test(String.fromCharCode(e))}function Uv(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Ebe.test(String.fromCharCode(e))}const kbe={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 Zj(){for(;se1114111||e!=="}")&&jt({},sr,_r),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function Jj(){var e,t;for(e=je.charCodeAt(se++),t=String.fromCharCode(e),e===92&&(je.charCodeAt(se)!==117&&jt({},sr,_r),++se,e=qE("u"),(!e||e==="\\"||!D0(e.charCodeAt(0)))&&jt({},sr,_r),t=e);se>>=")return se+=4,{type:yi,value:o,start:e,end:se};if(s=o.substr(0,3),s===">>>"||s==="<<="||s===">>=")return se+=3,{type:yi,value:s,start:e,end:se};if(i=s.substr(0,2),r===i[1]&&"+-<>&|".includes(r)||i==="=>")return se+=2,{type:yi,value:i,start:e,end:se};if(i==="//"&&jt({},sr,_r),"<>=!+-*%&|^/".includes(r))return++se,{type:yi,value:r,start:e,end:se};jt({},sr,_r)}function Fbe(e){let t="";for(;se{if(parseInt(i,16)<=1114111)return"x";jt({},UE)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{jt({},UE)}try{return new RegExp(e,t)}catch{return null}}function Rbe(){var e,t,n,r,i;for(e=je[se],Vb(e==="/","Regular expression literal must start with a slash"),t=je[se++],n=!1,r=!1;se=0&&jt({},UE,n),{value:n,literal:t}}function Obe(){var e,t,n,r;return en=null,Zj(),e=se,t=Rbe(),n=Nbe(),r=Tbe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:se}}function Lbe(e){return e.type===Hc||e.type===Al||e.type===Gb||e.type===Yb}function Qj(){if(Zj(),se>=zr)return{type:$0,start:se,end:se};const e=je.charCodeAt(se);return D0(e)?$be():e===40||e===41||e===59?Gx():e===39||e===34?Mbe():e===46?Sa(je.charCodeAt(se+1))?w6():Gx():Sa(e)?w6():Gx()}function _i(){const e=en;return se=e.end,en=Qj(),se=e.end,e}function eU(){const e=se;en=Qj(),se=e}function Ibe(e){const t=new xo(obe);return t.elements=e,t}function E6(e,t,n){const r=new xo(e==="||"||e==="&&"?fbe:abe);return r.operator=e,r.left=t,r.right=n,r}function Pbe(e,t){const n=new xo(ube);return n.callee=e,n.arguments=t,n}function Bbe(e,t,n){const r=new xo(lbe);return r.test=e,r.consequent=t,r.alternate=n,r}function R$(e){const t=new xo(Xj);return t.name=e,t}function bp(e){const t=new xo(cbe);return t.value=e.value,t.raw=je.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function A6(e,t,n){const r=new xo(dbe);return r.computed=e==="[",r.object=t,r.property=n,r.computed||(n.member=!0),r}function zbe(e){const t=new xo(hbe);return t.properties=e,t}function k6(e,t,n){const r=new xo(pbe);return r.key=t,r.value=n,r.kind=e,r}function jbe(e,t){const n=new xo(gbe);return n.operator=e,n.argument=t,n.prefix=!0,n}function jt(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(s,o)=>(Vb(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 Qbe(){var e,t,n,r,i,s,o,a,u,l;if(e=en,u=o1(),r=en,i=$6(r),i===0)return u;for(r.prec=i,_i(),t=[e,en],o=o1(),s=[u,r,o];(i=$6(en))>0;){for(;s.length>2&&i<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,u=s.pop(),t.pop(),n=E6(a,u,o),s.push(n);r=_i(),r.prec=i,s.push(r),t.push(en),n=o1(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=E6(s[l-1].value,s[l-2],n),l-=2;return n}function Gc(){var e,t,n;return e=Qbe(),hn("?")&&(_i(),t=Gc(),jr(":"),n=Gc(),e=Bbe(e,t,n)),e}function N$(){const e=Gc();if(hn(","))throw new Error(bg);return e}function e2e(e){je=e,se=0,zr=je.length,en=null,eU();const t=N$();if(en.type!==$0)throw new Error("Unexpect token after expression.");return t}function WE(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...WE(e.object)),t.push(...WE(e.property))),t)}function tU(e){return e.object.type==="MemberExpression"?tU(e.object):e.object.name==="datum"}function nU(e){const t=e2e(e),n=new Set;return t.visit(r=>{r.type==="MemberExpression"&&tU(r)&&n.add(WE(r).slice(1).join("."))}),n}class yh extends tn{clone(){return new yh(null,this.model,it(this.filter))}constructor(t,n,r){super(t),this.model=n,this.filter=r,this.expr=qv(this.model,this.filter,this),this._dependentFields=nU(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function t2e(e,t){const n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(const s of t){const o=yn(s.name),a=s.select,u=De(a)?a:a.type,l=Fe(a)?it(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]=it(c[h]??l[h])));const f=n[o]={...l,name:o,type:u,init:s.value,bind:s.bind,events:De(l.on)?gl(l.on,"scope"):Me(it(l.on))};if(Ho(f)&&(i++,i>1)){delete n[o];continue}const d=it(s);for(const h of Hb)h.defined(f)&&h.parse&&h.parse(e,f,d)}return i>1&&ve(c0e),n}function rU(e,t,n,r="datum"){const i=De(t)?t:t.param,s=yn(i),o=Ee(s+Wc);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"?")":`, ${Ee(a.resolve)})`,c=`${u}${o}, ${r}${l}`,f=`length(data(${o}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function iU(e,t,n){const r=yn(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&&ve(f0e(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,ve(d0e(a,i,n,s))):s=a[0].field}return`${o.name}[${Ee($s(s))}]`}function n2e(e,t){for(const[n,r]of Qu(e.component.selection??{})){const i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new ki(new yh(t,e,{param:n}),i,Cn.Lookup,e.component.data.outputNodeRefCounts)}}function qv(e,t,n){return Bp(t,r=>De(r)?r:_me(r)?rU(e,r,n):uz(r))}function r2e(e,t){if(e)return oe(e)&&!yu(e)?e.map(n=>d$(n,t)).join(", "):e}function Vx(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 xp(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=S1e[p],m=c[p];if(g&&g!==t&&g!=="both")delete c[p];else if(S0(m)){const{condition:v,...b}=m,x=Me(v),_=XM[p];if(_){const{vgProp:w,part:A}=_,E=[...x.map(S=>{const{test:C,...$}=S;return{test:qv(null,C),...$}}),b];Vx(c,A,w,E),delete c[p]}else if(_===null){const w={signal:x.map(A=>{const{test:E,...S}=A;return`${qv(null,E)} ? ${RM(S)} : `}).join("")+RM(b)};c[p]=w}}else if(Ue(m)){const v=XM[p];if(v){const{vgProp:b,part:x}=v;Vx(c,x,b,m),delete c[p]}}At(["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}:{}},on(c.encode)&&delete c.encode}return{scale:o,orient:s,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:On(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&&Ue(c.encode.labels.update.text)&&(p=Lc(a,"datum.label",c.encode.labels.update.text.signal)),Vx(c,"labels","text",{signal:p})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const p of Bz)e.hasAxisPart(p)||delete c.encode[p];on(c.encode)&&delete c.encode}const h=r2e(u,n);return{scale:o,orient:s,grid:!1,...h?{title:h}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:On(l,0)}}}}function sU(e){const{axes:t}=e.component,n=[];for(const r of ou)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 i2e(e,t){const{x:n=[],y:r=[]}=e;return[...n.map(i=>xp(i,"grid",t)),...r.map(i=>xp(i,"grid",t)),...n.map(i=>xp(i,"main",t)),...r.map(i=>xp(i,"main",t))].filter(i=>i)}function F6(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([...pe(o),...pe(a)]),l={};for(const c of u.values())l[c]={signal:`${r.signal} === "${s}" ? ${Zs(o[c])} : ${Zs(a[c])}`};return l}return t[i]})])}function s2e(e,t,n,r){const i=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:dz(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],s=e==="x"?"axisX":"axisY",o=Ue(n)?"axisOrient":`axis${g0(n)}`,a=[...i,...i.map(l=>s+l.substr(4))],u=["axis",o,s];return{vlOnlyAxisConfig:F6(a,r,e,n),vgAxisConfig:F6(u,r,e,n),axisConfigStyle:o2e([...u,...a],r)}}function o2e(e,t){var r;const n=[{}];for(const i of e){let s=(r=t[i])==null?void 0:r.style;if(s){s=Me(s);for(const o of s)n.push(t.style[o])}}return Object.assign.apply(null,n)}function HE(e,t,n,r={}){var s;const i=zB(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 D6={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??a2e(n,e),gridScale:({model:e,channel:t})=>u2e(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||aU(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||oU(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??c2e(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??f2e(t.type,n,be(t)&&!!t.timeUnit,be(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??h2e({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:p2e,title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const r=uU(t,n);if(r!==void 0)return r;const i=t.typedFieldDef(n),s=n==="x"?"x2":"y2",o=t.fieldDef(s);return UB(i?[YM(i)]:[],be(o)?[YM(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>g2e(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??m2e(n,t)};function a2e(e,t){return!ur(e)&&be(t)&&!cn(t==null?void 0:t.bin)&&!hr(t==null?void 0:t.bin)}function u2e(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function l2e(e,t,n,r,i){const s=t==null?void 0:t.labelAngle;if(s!==void 0)return Ue(s)?s:mg(s);{const{configValue:o}=HE("labelAngle",r,t==null?void 0:t.style,i);return o!==void 0?mg(o):n===bn&&At([e$,QC],e.type)&&!(be(e)&&e.timeUnit)?270:void 0}}function GE(e){return`(((${e.signal} % 360) + 360) % 360)`}function oU(e,t,n,r){if(e!==void 0)if(n==="x"){if(Ue(e)){const i=GE(e),s=Ue(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(cf(r)&&$z(r.sort)){const{field:s,timeUnit:o}=r,a=r.sort,u=a.map((l,c)=>`${uz({field:s,timeUnit:o,equal:l})} ? ${c} : `).join("")+a.length;t=new qd(t,{calculate:u,as:Wd(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 ${Ft(this.transform)}`}}function Wd(e,t,n){return Ce(e,{prefix:t,suffix:"sort_index",...n})}function Kb(e,t){return At(["top","bottom"],t)?"column":At(["left","right"],t)||e==="row"?"row":"column"}function Hd(e,t,n,r){const i=r==="row"?n.headerRow:r==="column"?n.headerColumn:n.headerFacet;return On((t||{})[e],i[e],n.header[e])}function Zb(e,t,n,r){const i={};for(const s of e){const o=Hd(s,t||{},n,r);o!==void 0&&(i[s]=o)}return i}const O$=["row","column"],L$=["header","footer"];function v2e(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}=Zb(["titleAnchor","titleAngle","titleOrient"],i.header,r,t),u=Kb(t,a),l=mg(o);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...cU(l,u),...lU(u,l,s),...fU(r,i,t,V1e,rj)}}}function lU(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const r=aU(t,e==="row"?"left":"top",e==="row"?"y":"x");return r?{align:r}:{}}function cU(e,t){const n=oU(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function y2e(e,t){const n=e.component.layoutHeaders[t],r=[];for(const i of L$)if(n[i])for(const s of n[i]){const o=x2e(e,t,i,n,s);o!=null&&r.push(o)}return r}function b2e(e,t){const{sort:n}=e;return Wa(n)?{field:Ce(n,{expr:"datum"}),order:n.order??"ascending"}:oe(n)?{field:Wd(e,t,{expr:"datum"}),order:"ascending"}:{field:Ce(e,{expr:"datum"}),order:n??"ascending"}}function YE(e,t,n){const{format:r,formatType:i,labelAngle:s,labelAnchor:o,labelOrient:a,labelExpr:u}=Zb(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=u$({fieldOrDatumDef:e,format:r,formatType:i,expr:"parent",config:n}).signal,c=Kb(t,a);return{text:{signal:u?Lc(Lc(u,"datum.label",l),"datum.value",Ce(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...cU(s,c),...lU(c,s,o),...fU(n,e,t,X1e,ij)}}function x2e(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}=Zb(["labelOrient"],o.header,a,t);(t==="row"&&!At(["top","bottom"],f)||t==="column"&&!At(["left","right"],f))&&(s=YE(o,t,a))}const u=Ji(e)&&!w0(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:b2e(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 _2e={column:{start:0,end:1},row:{start:1,end:0}};function w2e(e,t){return _2e[t][e]}function E2e(e,t){const n={};for(const r of vs){const i=e[r];if(i!=null&&i.facetFieldDef){const{titleAnchor:s,titleOrient:o}=Zb(["titleAnchor","titleOrient"],i.facetFieldDef.header,t,r),a=Kb(r,o),u=w2e(s,a);u!==void 0&&(n[a]=u)}}return on(n)?void 0:n}function fU(e,t,n,r,i){const s={};for(const o of r){if(!i[o])continue;const a=Hd(o,t==null?void 0:t.header,e,n);a!==void 0&&(s[i[o]]=a)}return s}function I$(e){return[...hm(e,"width"),...hm(e,"height"),...hm(e,"childWidth"),...hm(e,"childHeight")]}function hm(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(ur(o)&&af(a)){const u=e.scaleName(n);return Ji(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[M6(u,a)]:[M6(u,a),{name:i,update:dU(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=NE(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 M6(e,t){const n=`${e}_step`;return Ue(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function dU(e,t,n){const r=t.get("type"),i=t.get("padding"),s=On(t.get("paddingOuter"),i);let o=t.get("paddingInner");return o=r==="band"?o!==void 0?o:i:1,`bandspace(${n}, ${Zs(o)}, ${Zs(s)}) * ${e}_step`}function hU(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function pU(e,t){return pe(e).reduce((n,r)=>({...n,...vh({model:t,channelDef:e[r],vgChannel:r,mainRefFn:i=>dn(i.value),invalidValueRef:void 0})}),{})}function gU(e,t){if(Ji(t))return e==="theta"?"independent":"shared";if(_h(t))return"shared";if(W$(t))return Ln(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function P$(e,t){const n=e.scale[t],r=Ln(t)?"axis":"legend";return n==="independent"?(e[r][t]==="shared"&&ve(q0e(t)),"independent"):e[r][t]||"shared"}const A2e={...J1e,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},mU=pe(A2e);class k2e extends uu{}const T6={symbols:S2e,gradient:C2e,labels:$2e,entries:F2e};function S2e(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={...Zge({},n,Yme),...Lj(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?vU(a.opacity)??o.opacity:void 0;if(f.fill){if(r==="fill"||c&&r===Fi)delete f.fill;else if(me(f.fill,"field"))h?delete f.fill:(f.fill=dn(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=dn(g??1));else if(oe(f.fill)){const m=VE(a.fill??a.color)??o.fill??(c&&o.color);m&&(f.fill=dn(m))}}if(f.stroke){if(r==="stroke"||!c&&r===Fi)delete f.stroke;else if(me(f.stroke,"field")||p)delete f.stroke;else if(oe(f.stroke)){const m=On(VE(a.stroke||a.color),o.stroke,c?o.color:void 0);m&&(f.stroke={value:m})}}if(r!==su){const m=be(t)&&bU(n,i,t);m?f.opacity=[{test:m,...dn(g??1)},dn(u.legend.unselectedOpacity)]:g&&(f.opacity=dn(g))}return f={...f,...e},on(f)?void 0:f}function C2e(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?vU(o.opacity)||s.opacity:void 0;return l&&(a.opacity=dn(l)),a={...a,...e},on(a)?void 0:a}function $2e(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){const s=n.legend(r)||{},o=n.config,a=be(t)?bU(n,i,t):void 0,u=a?[{test:a,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=s;let f;Uc(c)?f=Js({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=Js({fieldOrDatumDef:t,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type==="temporal"&&o.timeFormatType&&be(t)&&t.timeUnit===void 0&&(f=Js({fieldOrDatumDef:t,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return on(d)?void 0:d}function F2e(e,{legendCmpt:t}){const n=t.get("selections");return n!=null&&n.length?{...e,fill:{value:"transparent"}}:e}function vU(e){return yU(e,(t,n)=>Math.max(t,n.value))}function VE(e){return yU(e,(t,n)=>On(t,n.value))}function yU(e,t){if(p1e(e))return Me(e.condition).reduce(t,e.value);if(ao(e))return e.value}function bU(e,t,n){const r=t.get("selections");if(!(r!=null&&r.length))return;const i=Ee(n.field);return r.map(s=>`(!length(data(${Ee(yn(s)+Wc)})) || (${s}[${i}] && indexof(${s}[${i}], datum.value) >= 0))`).join(" || ")}const R6={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:r,formatType:i}=t;return kz(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:r}=e;return Sz(r,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??L2e(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??I2e(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??M2e(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>Vf(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Yf(n)&&zo(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>D2e(t,e)};function D2e(e,t){const n=e.values;if(oe(n))return Pz(t,n);if(Ue(n))return n}function M2e(e,t,n,r){if(t!=="shape"){const i=VE(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 T2e(e){const{legend:t}=e;return On(t.type,R2e(e))}function R2e({channel:e,timeUnit:t,scaleType:n}){if(Yf(e)){if(At(["quarter","month","day"],t))return"symbol";if(zo(n))return"gradient"}return"symbol"}function N2e({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?"gradientDirection":"symbolDirection"]??O2e(n,t)}function O2e(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 L2e({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:s,gradientHorizontalMinLength:o,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(zo(i))return n==="horizontal"?r==="top"||r==="bottom"?N6(t,"width",o,s):o:N6(t,"height",u,a)}function N6(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function I2e(e){if(At(["quantile","threshold","log","symlog"],e))return"greedy"}function xU(e){const t=kn(e)?P2e(e):U2e(e);return e.component.legends=t,t}function P2e(e){const{encoding:t}=e,n={};for(const r of[Fi,...oj]){const i=Hn(t[r]);!i||!e.getScaleComponent(r)||r===Di&&be(i)&&i.type===mh||(n[r]=j2e(e,r))}return n}function B2e(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 z2e(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 j2e(e,t){var _;let n=e.legend(t);const{markDef:r,encoding:i,config:s}=e,o=s.legend,a=new k2e({},B2e(e,t));jye(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=Hn(i[t]),f=be(c)?(_=or(c.timeUnit))==null?void 0:_.unit:void 0,d=n.orient||s.legend.orient||"right",h=T2e({legend:n,channel:t,timeUnit:f,scaleType:l}),p=N2e({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 w of mU){if(h==="gradient"&&w.startsWith("symbol")||h==="symbol"&&w.startsWith("gradient"))continue;const A=w in R6?R6[w](g):n[w];if(A!==void 0){const E=z2e(A,w,n,e.fieldDef(t));(E||s.legend[w]===void 0)&&a.set(w,A,E)}}const m=(n==null?void 0:n.encoding)??{},v=a.get("selections"),b={},x={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:a,legendType:h};for(const w of["labels","legend","title","symbols","gradient","entries"]){const A=pU(m[w]??{},e),E=w in T6?T6[w](A,x):A;E!==void 0&&!on(E)&&(b[w]={...v!=null&&v.length&&be(c)?{name:`${yn(c.field)}_legend_${w}`}:{},...v!=null&&v.length?{interactive:!!v}:{},update:E})}return on(b)||a.set("encode",b,!!(n!=null&&n.encoding)),a}function U2e(e){const{legends:t,resolve:n}=e.component;for(const r of e.children){xU(r);for(const i of pe(r.component.legends))n.legend[i]=P$(e.component.resolve,i),n.legend[i]==="shared"&&(t[i]=_U(t[i],r.component.legends[i]),t[i]||(n.legend[i]="independent",delete t[i]))}for(const r of pe(t))for(const i of e.children)i.component.legends[r]&&n.legend[r]==="shared"&&delete i.component.legends[r];return t}function _U(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 mU){const c=nl(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return q2e(f,d);case"title":return WB(f,d);case"type":return i=!0,Pi("symbol")}return jb(f,d,l,"legend")});e.setWithExplicit(l,c)}return i&&((o=(s=e.implicit)==null?void 0:s.encode)!=null&&o.gradient&&Dv(e.implicit,["encode","gradient"]),(u=(a=e.explicit)==null?void 0:a.encode)!=null&&u.gradient&&Dv(e.explicit,["encode","gradient"])),e}function q2e(e,t){return t.value==="circle"?t:e}function W2e(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 wU(e){const t=e.component.legends,n={};for(const i of pe(t)){const s=e.getScaleComponent(i),o=an(s.get("domains"));if(n[o])for(const a of n[o])_U(a,t[i])||n[o].push(t[i]);else n[o]=[t[i].clone()]}return Er(n).flat().map(i=>H2e(i,e.config)).filter(i=>i!==void 0)}function H2e(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 oj)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&&Ue(s.encode.labels.update.text)&&(l=Lc(r,"datum.label",s.encode.labels.update.text.signal)),W2e(s,"labels","text",{signal:l})}return s}}function G2e(e){return _h(e)||W$(e)?Y2e(e):EU(e)}function Y2e(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),EU(e))}function EU(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=Ue(a)?a.signal:`data('${e.lookupDataSource(a)}')`;return At(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 V2e=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class AU extends uu{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 kU(e){e.component.projection=kn(e)?X2e(e):J2e(e)}function X2e(e){if(e.hasProjection){const t=gr(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,i=n?K2e(e):void 0,s=new AU(e.projectionName(!0),{...gr(e.config.projection),...t},r,i);return s.get("type")||s.set("type","equalEarth",!1),s}}function K2e(e){const t=[],{encoding:n}=e;for(const r of[[yo,vo],[Fs,bo]])(Hn(n[r[0]])||Hn(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Di)&&e.typedFieldDef(Di).type===mh&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Cn.Main)),t}function Z2e(e,t){const n=SC(V2e,i=>!!(!Le(e.explicit,i)&&!Le(t.explicit,i)||Le(e.explicit,i)&&Le(t.explicit,i)&&Yi(e.get(i),t.get(i))));if(Yi(e.size,t.size)){if(n)return e;if(Yi(e.explicit,{}))return t;if(Yi(t.explicit,{}))return e}return null}function J2e(e){if(e.children.length===0)return;let t;for(const r of e.children)kU(r);const n=SC(e.children,r=>{const i=r.component.projection;if(i)if(t){const s=Z2e(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 AU(r,t.specifiedProjection,t.size,it(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 Q2e(e,t,n,r){if(k0(t,n)){const i=kn(e)?e.axis(n)??e.legend(n)??{}:{},s=Ce(t,{expr:"datum"}),o=Ce(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Ce(t,{binSuffix:"range",forAs:!0}),formula:_0(s,o,i.format,i.formatType,r)}}return{}}function SU(e,t){return`${LB(e)}_${t}`}function exe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function B$(e,t,n){const r=Ob(n,void 0)??{},i=SU(r,t);return e.getName(`${i}_bins`)}function txe(e){return"as"in e}function O6(e,t,n){let r,i;txe(e)?r=De(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:r=[Ce(e,{forAs:!0}),Ce(e,{binSuffix:"end",forAs:!0})];const s={...Ob(t,void 0)},o=SU(s,e.field),{signal:a,extentSignal:u}=exe(n,o);if(Ab(s.extent)){const c=s.extent;i=iU(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 Go extends tn{clone(){return new Go(null,it(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const r=n.reduceFieldDef((i,s,o)=>{if(ai(s)&&cn(s.bin)){const{key:a,binComponent:u}=O6(s,s.bin,n);i[a]={...u,...i[a],...Q2e(n,s,o,n.config)}}return i},{});return on(r)?null:new Go(t,r)}static makeFromTransform(t,n,r){const{key:i,binComponent:s}=O6(n,n.bin,r);return new Go(t,{[i]:s})}merge(t,n){for(const r of pe(t.bins))r in this.bins?(n(t.bins[r].signal,this.bins[r].signal),this.bins[r].as=Bo([...this.bins[r].as,...t.bins[r].as],Ft)):this.bins[r]=t.bins[r];for(const r of t.children)t.removeChild(r),r.parent=this;t.remove()}producedFields(){return new Set(Er(this.bins).map(t=>t.as).flat(2))}dependentFields(){return new Set(Er(this.bins).map(t=>t.field))}hash(){return`Bin ${Ft(this.bins)}`}assemble(){return Er(this.bins).flatMap(t=>{const n=[],[r,...i]=t.as,{extent:s,...o}=t.bin,a={type:"bin",field:$s(t.field),as:r,signal:t.signal,...Ab(s)?{extent:null}:{extent:s},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!s&&t.extentSignal&&(n.push({type:"extent",field:$s(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:Ce({field:r[l]},{expr:"datum"}),as:u[l]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n})}}function nxe(e,t,n,r){var s;const i=kn(r)?r.encoding[pa(t)]:void 0;if(ai(n)&&kn(r)&&Dz(n,i,r.markDef,r.config)){e.add(Ce(n,{})),e.add(Ce(n,{suffix:"end"}));const{mark:o,markDef:a,config:u}=r,l=tl({fieldDef:n,markDef:a,config:u});vg(o)&&l!==.5&&Ln(t)&&(e.add(Ce(n,{suffix:Ub})),e.add(Ce(n,{suffix:qb}))),n.bin&&k0(n,t)&&e.add(Ce(n,{binSuffix:"range"}))}else if(CB(t)){const o=SB(t);e.add(r.getName(o))}else e.add(Ce(n));return cf(n)&&Nme((s=n.scale)==null?void 0:s.range)&&e.add(n.scale.range.field),e}function rxe(e,t){for(const n of pe(t)){const r=t[n];for(const i of pe(r))n in e?e[n][i]=new Set([...e[n][i]??[],...r[i]]):e[n]={[i]:r[i]}}}class eo extends tn{clone(){return new eo(null,new Set(this.dimensions),it(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([Ce(o,{forAs:!0})]);else{if(Za(u)||wl(u)){const c=Za(u)?"argmin":"argmax",f=u[c];i[f]??(i[f]={}),i[f][c]=new Set([Ce({op:c,field:f},{forAs:!0})])}else i[l]??(i[l]={}),i[l][u]=new Set([Ce(o,{forAs:!0})]);ga(a)&&n.scaleDomain(a)==="unaggregated"&&(i[l]??(i[l]={}),i[l].min=new Set([Ce({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([Ce({field:l,aggregate:"max"},{forAs:!0})]))}else nxe(s,a,o,n)}),s.size+pe(i).length===0)?null:new eo(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||Ce(o,{forAs:!0})])):(s[u]??(s[u]={}),(r=s[u])[a]??(r[a]=new Set),s[u][a].add(l||Ce(o,{forAs:!0}))))}for(const o of n.groupby??[])i.add(o);return i.size+pe(s).length===0?null:new eo(t,i,s)}merge(t){return yB(this.dimensions,t.dimensions)?(rxe(this.measures,t.measures),!0):(sme("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...pe(this.measures)])}producedFields(){const t=new Set;for(const n of pe(this.measures))for(const r of pe(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 ${Ft({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],r=[];for(const s of pe(this.measures))for(const o of pe(this.measures[s]))for(const a of this.measures[s][o])r.push(a),t.push(o),n.push(s==="*"?null:$s(s));return{type:"aggregate",groupby:[...this.dimensions].map($s),ops:t,fields:n,as:r}}}class bh extends tn{constructor(t,n,r,i){super(t),this.model=n,this.name=r,this.data=i;for(const s of vs){const o=n.facet[s];if(o){const{bin:a,sort:u}=o;this[s]={name:n.getName(`${s}_domain`),fields:[Ce(o),...cn(a)?[Ce(o,{binSuffix:"end"})]:[]],...Wa(u)?{sortField:u}:oe(u)?{sortIndexField:Wd(o,s)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of vs)this[n]&&(t+=` ${n.charAt(0)}:${Ft(this[n])}`);return t}get fields(){var n;const t=[];for(const r of vs)(n=this[r])!=null&&n.fields&&t.push(...this[r].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of vs)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 ou){const r=this.childModel.component.scales[n];if(r&&!r.merged){const i=r.get("type"),s=r.get("range");if(ur(i)&&af(s)){const o=Jb(this.childModel,n),a=q$(o);a?t[n]=a:ve(zC(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=Tb,field:f}=u;s.push(f),o.push(c),a.push(Ce(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 O$){for(const c of L$){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[qa,Ua])this[a]&&t.push(this.assembleRowColumnHeaderData(a,n,r));if(o){const a=this.assembleFacetHeaderData(r);a&&t.push(...a)}return t}}function L6(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function ixe(e,t){const n=FC(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=L6(t.slice(5,t.length));return`timeParse(${n},'${r}')`}else if(t.startsWith("utc:")){const r=L6(t.slice(4,t.length));return`utcParse(${n},'${r}')`}else return ve(p0e(t)),null}function sxe(e){const t={};return i1(e.filter,n=>{if(az(n)){let r=null;GC(n)?r=Wi(n.equal):VC(n)?r=Wi(n.lte):YC(n)?r=Wi(n.lt):XC(n)?r=Wi(n.gt):KC(n)?r=Wi(n.gte):ZC(n)?r=n.range[0]:JC(n)&&(r=(n.oneOf??n.in)[0]),r&&(uf(r)?t[n.field]="date":Ut(r)?t[n.field]="number":De(r)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function oxe(e){const t={};function n(r){zd(r)?t[r.field]="date":r.type==="quantitative"&&Uge(r.aggregate)?t[r.field]="number":Nd(r.field)>1?r.field in t||(t[r.field]="flatten"):cf(r)&&Wa(r.sort)&&Nd(r.sort.field)>1&&(r.sort.field in t||(t[r.sort.field]="flatten"))}if((kn(e)||Ji(e))&&e.forEachFieldDef((r,i)=>{if(ai(r))n(r);else{const s=sf(i),o=e.fieldDef(s);n({...r,type:o.type})}}),kn(e)){const{mark:r,markDef:i,encoding:s}=e;if(El(r)&&!e.encoding.order){const o=i.orient==="horizontal"?"y":"x",a=s[o];be(a)&&a.type==="quantitative"&&!(a.field in t)&&(t[a.field]="number")}}return t}function axe(e){const t={};if(kn(e)&&e.component.selection)for(const n of pe(e.component.selection)){const r=e.component.selection[n];for(const i of r.project.items)!i.channel&&Nd(i.field)>1&&(t[i.field]="flatten")}return t}class Or extends tn{clone(){return new Or(null,it(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${Ft(this._parse)}`}static makeExplicit(t,n,r){var o;let i={};const s=n.data;return!zu(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 pe(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]:ve(BM(a,r[a],u.value)))}for(const a of pe(n)){const u=i.get(a);u!==void 0&&(u===n[a]?delete n[a]:ve(BM(a,n[a],u)))}const s=new uu(n,r);i.copyAll(s);const o={};for(const a of pe(s.combine())){const u=s.get(a);u!==null&&(o[a]=u)}return pe(o).length===0||i.parseNothing?null:new Or(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of pe(this._parse)){const r=this._parse[n];Nd(n)===1&&(t[n]=r)}return t}producedFields(){return new Set(pe(this._parse))}dependentFields(){return new Set(pe(this._parse))}assembleTransforms(t=!1){return pe(this._parse).filter(n=>t?Nd(n)>1:!0).map(n=>{const r=ixe(n,this._parse[n]);return r?{type:"formula",expr:r,as:ph(n)}:null}).filter(n=>n!==null)}}class rl extends tn{clone(){return new rl(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([lo])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:lo}}}class M0 extends tn{clone(){return new M0(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${Ft(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class T0 extends tn{clone(){return new T0(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 ${Ft(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Yc extends tn{constructor(t){super(null),t??(t={name:"source"});let n;if(zu(t)||(n=t.format?{...Ai(t.format,["parse"])}:{}),yg(t))this._data={values:t.values};else if(jd(t)){if(this._data={url:t.url},!n.type){let r=/(?:\.([^.]+))?$/.exec(t.url)[1];At(["json","csv","tsv","dsv","topojson"],r)||(r="json"),n.type=r}}else Aj(t)?this._data={values:[{type:"Sphere"}]}:(wj(t)||zu(t))&&(this._data={});this._generator=zu(t),t.name&&(this._name=t.name),n&&!on(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 I6=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},uxe=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)},_p;function z$(e){return e instanceof Yc||e instanceof M0||e instanceof T0}class j${constructor(){_p.set(this,void 0),I6(this,_p,!1,"f")}setModified(){I6(this,_p,!0,"f")}get modifiedFlag(){return uxe(this,_p,"f")}}_p=new WeakMap;class df extends j${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 U$ extends j${optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class lxe extends U${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 cxe extends U${constructor(t){super(),this.requiresSelectionId=t&&M$(t)}run(t){t instanceof rl&&(this.requiresSelectionId&&(z$(t.parent)||t.parent instanceof eo||t.parent instanceof Or)||(this.setModified(),t.remove()))}}class fxe extends j${optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let r=new Set;t instanceof Wo&&(r=t.producedFields(),CC(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 dxe extends U${constructor(){super()}run(t){t instanceof ki&&!t.isRequired()&&(this.setModified(),t.remove())}}class hxe extends df{run(t){if(!z$(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof Or)if(t instanceof Or)this.setModified(),t.merge(n);else{if($C(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class pxe extends df{run(t){const n=[...t.children],r=t.children.filter(i=>i instanceof Or);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 pe(a))u in i?i[u]!==a[u]&&s.add(u):i[u]=a[u]}for(const o of s)delete i[o];if(!on(i)){this.setModified();const o=new Or(t,i);for(const a of n){if(a instanceof Or)for(const u of pe(i))delete a.parse[u];t.removeChild(a),a.parent=o,a instanceof Or&&pe(a.parse).length===0&&a.remove()}}}}}class gxe extends df{run(t){t instanceof ki||t.numChildren()>0||t instanceof bh||t instanceof Yc||(this.setModified(),t.remove())}}class mxe extends df{run(t){const n=t.children.filter(i=>i instanceof Wo),r=n.pop();for(const i of n)this.setModified(),r.merge(i)}}class vxe extends df{run(t){const n=t.children.filter(i=>i instanceof eo),r={};for(const i of n){const s=Ft(i.groupBy);s in r||(r[s]=[]),r[s].push(i)}for(const i of pe(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 yxe extends df{constructor(t){super(),this.model=t}run(t){const n=!(z$(t)||t instanceof yh||t instanceof Or||t instanceof rl),r=[],i=[];for(const s of t.children)s instanceof Go&&(n&&!$C(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 Go?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 bxe extends df{run(t){const n=[...t.children];if(!Rd(n,o=>o instanceof ki)||t.numChildren()<=1)return;const i=[];let s;for(const o of n)if(o instanceof ki){let a=o;for(;a.numChildren()===1;){const[u]=a.children;if(u instanceof ki)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 hf extends tn{clone(){return new hf(null,it(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Bo(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??Ce(t)}hash(){return`JoinAggregateTransform ${Ft(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 Gd extends tn{clone(){return new Gd(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=ga(f)&&n.getScaleComponent(f);if(d){const h=d.get("type"),{aggregate:p}=c,g=s$({scaleChannel:f,markDef:s,config:i,scaleType:h,isCountAggregate:Eb(p)});g!=="show"&&g!=="always-valid"&&(l[c.field]=c)}return l},{});return pe(u).length?new Gd(t,u):null}dependentFields(){return new Set(pe(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${Ft(this.filter)}`}assemble(){const t=pe(this.filter).reduce((n,r)=>{const i=this.filter[r],s=Ce(i,{expr:"datum"});return i!==null&&(i.type==="temporal"?n.push(`(isDate(${s}) || (${XE(s)}))`):i.type==="quantitative"&&n.push(XE(s))),n},[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function XE(e){return`isValid(${e}) && isFinite(+${e})`}function xxe(e){return e.stack.stackBy.reduce((t,n)=>{const r=n.fieldDef,i=Ce(r);return i&&t.push(i),t},[])}function _xe(e){return oe(e)&&e.every(t=>De(t))&&e.length>1}class Ga extends tn{clone(){return new Ga(null,it(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(On(f.order,"ascending"));const l={field:a,order:u};let c;return _xe(s)?c=s:De(s)?c=[s,`${s}_end`]:c=[`${n.stack}_start`,`${n.stack}_end`],new Ga(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 uo(p)}).filter(h=>!!h),c=xxe(n),f=n.encoding.order;let d;if(oe(f)||be(f))d=jB(f);else{const h=Mz(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 Ga(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 ${Ft(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:r}=this._stack;return t.length>0?t.map(i=>i.bin?n?[Ce(i,{binSuffix:"mid"})]:[Ce(i,{}),Ce(i,{binSuffix:"end"})]:[Ce(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=Ce(c,{expr:"datum"}),p=Ce(c,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${XE(h)} ? ${f}*${h}+${1-f}*${p} : ${h}`,as:Ce(c,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:i,groupby:[...s,...n],key:Ce(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 xh extends tn{clone(){return new xh(null,it(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Bo(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??Ce(t)}hash(){return`WindowTransform ${Ft(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=>PC(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 wxe(e){function t(n){if(!(n instanceof bh)){const r=n.clone();if(r instanceof ki){const i=ZE+r.getSource();r.setSource(i),e.model.component.data.outputNodes[i]=r}else(r instanceof eo||r instanceof Ga||r instanceof xh||r instanceof hf)&&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 KE(e){if(e instanceof bh)if(e.numChildren()===1&&!(e.children[0]instanceof ki)){const t=e.children[0];(t instanceof eo||t instanceof Ga||t instanceof xh||t instanceof hf)&&t.addDimensions(e.fields),t.swapWithParent(),KE(e)}else{const t=e.model.component.data.main;CU(t);const n=wxe(e),r=e.children.map(n).flat();for(const i of r)i.parent=t}else e.children.map(KE)}function CU(e){if(e instanceof ki&&e.type===Cn.Main&&e.numChildren()===1){const t=e.children[0];t instanceof bh||(t.swapWithParent(),CU(e))}}const ZE="scale_",pm=5;function JE(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!JE(t.children))return!1}return!0}function Ls(e,t){let n=!1;for(const r of t)n=e.optimize(r)||n;return n}function P6(e,t,n){let r=e.sources,i=!1;return i=Ls(new dxe,r)||i,i=Ls(new cxe(t),r)||i,r=r.filter(s=>s.numChildren()>0),i=Ls(new gxe,r)||i,r=r.filter(s=>s.numChildren()>0),n||(i=Ls(new hxe,r)||i,i=Ls(new yxe(t),r)||i,i=Ls(new fxe,r)||i,i=Ls(new pxe,r)||i,i=Ls(new vxe,r)||i,i=Ls(new mxe,r)||i,i=Ls(new lxe,r)||i,i=Ls(new bxe,r)||i),e.sources=r,i}function Exe(e,t){JE(e.sources);let n=0,r=0;for(let i=0;it(n))}}function $U(e){kn(e)?Axe(e):kxe(e)}function Axe(e){const t=e.component.scales;for(const n of pe(t)){const r=Cxe(e,n);if(t[n].setWithExplicit("domains",r),Fxe(e,n),e.component.data.isFaceted){let s=e;for(;!Ji(s)&&s.parent;)s=s.parent;if(s.component.resolve.scale[n]==="shared")for(const a of r.value)La(a)&&(a.data=ZE+a.data.replace(ZE,""))}}}function kxe(e){for(const n of e.children)$U(n);const t=e.component.scales;for(const n of pe(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=nl(r,o.getWithExplicit("domains"),"domains","scale",QE);const a=o.get("selectionExtent");i&&a&&i.param!==a.param&&ve(a0e),i=a}}t[n].setWithExplicit("domains",r),i&&t[n].set("selectionExtent",i,!0)}}function Sxe(e,t,n,r){if(e==="unaggregated"){const{valid:i,reason:s}=B6(t,n);if(!i){ve(s);return}}else if(e===void 0&&r.useUnaggregatedDomain){const{valid:i}=B6(t,n);if(i)return"unaggregated"}return e}function Cxe(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:r}=e,i=Sxe(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"&&Hn(r.x2)?Hn(r.x)?nl(hu(n,i,e,"x"),hu(n,i,e,"x2"),"domain","scale",QE):hu(n,i,e,"x2"):t==="y"&&Hn(r.y2)?Hn(r.y)?nl(hu(n,i,e,"y"),hu(n,i,e,"y2"),"domain","scale",QE):hu(n,i,e,"y2"):hu(n,i,e,t)}function $xe(e,t,n){return e.map(r=>({signal:`{data: ${Lb(r,{timeUnit:n,type:t})}}`}))}function Xx(e,t,n){var i;const r=(i=or(n))==null?void 0:i.unit;return t==="temporal"||r?$xe(e,t,r):[e]}function hu(e,t,n,r){const{encoding:i,markDef:s,mark:o,config:a,stack:u}=n,l=Hn(i[r]),{type:c}=l,f=l.timeUnit,d=fye({invalid:ea("invalid",s,a),isPath:El(o)});if(Rme(t)){const g=hu(e,void 0,n,r),m=Xx(t.unionWith,c,f);return $o([...m,...g.value])}else{if(Ue(t))return $o([t]);if(t&&t!=="unaggregated"&&!pz(t))return $o(Xx(t,c,f))}if(u&&r===u.fieldChannel){if(u.offset==="normalize")return Pi([[0,1]]);const g=n.requestDataName(d);return Pi([{data:g,field:n.vgField(r,{suffix:"start"})},{data:g,field:n.vgField(r,{suffix:"end"})}])}const h=ga(r)&&be(l)?Dxe(n,r,e):void 0;if(ma(l)){const g=Xx([l.datum],c,f);return Pi(g)}const p=l;if(t==="unaggregated"){const{field:g}=l;return Pi([{data:n.requestDataName(d),field:Ce({field:g,aggregate:"min"})},{data:n.requestDataName(d),field:Ce({field:g,aggregate:"max"})}])}else if(cn(p.bin)){if(ur(e))return Pi(e==="bin-ordinal"?[]:[{data:gg(h)?n.requestDataName(d):n.requestDataName(Cn.Raw),field:n.vgField(r,k0(p,r)?{binSuffix:"range"}:{}),sort:h===!0||!Fe(h)?{field:n.vgField(r,{}),op:"min"}:h}]);{const{bin:g}=p;if(cn(g)){const m=B$(n,p.field,g);return Pi([new Jn(()=>{const v=n.getSignalName(m);return`[${v}.start, ${v}.stop]`})])}else return Pi([{data:n.requestDataName(d),field:n.vgField(r,{})}])}}else if(p.timeUnit&&At(["time","utc"],e)){const g=i[pa(r)];if(Dz(p,g,s,a)){const m=n.requestDataName(d),v=tl({fieldDef:p,fieldDef2:g,markDef:s,config:a}),b=vg(o)&&v!==.5&&Ln(r);return Pi([{data:m,field:n.vgField(r,b?{suffix:Ub}:{})},{data:m,field:n.vgField(r,{suffix:b?qb:"end"})}])}}return Pi(h?[{data:gg(h)?n.requestDataName(d):n.requestDataName(Cn.Raw),field:n.vgField(r),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(r)}])}function Kx(e,t){const{op:n,field:r,order:i}=e;return{op:n??(t?"sum":Tb),...r?{field:$s(r)}:{},...i?{order:i}:{}}}function Fxe(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=pz(r)?r:void 0,o=of(i)&&Ab(i.extent)?i.extent:void 0;(s||o)&&n.set("selectionExtent",s??o,!0)}function Dxe(e,t,n){if(!ur(n))return;const r=e.fieldDef(t),i=r.sort;if($z(i))return{op:"min",field:Wd(r,t),order:"ascending"};const{stack:s}=e,o=s?new Set([...s.groupbyFields,...s.stackBy.map(a=>a.fieldDef.field)]):void 0;if(Wa(i)){const a=s&&!o.has(i.field);return Kx(i,a)}else if(f1e(i)){const{encoding:a,order:u}=i,l=e.fieldDef(a),{aggregate:c,field:f}=l,d=s&&!o.has(f);if(Za(c)||wl(c))return Kx({field:Ce(l),order:u},d);if(PC(c)||!c)return Kx({op:c,field:f,order:u},d)}else{if(i==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(At(["ascending",void 0],i))return!0}}function B6(e,t){const{aggregate:n,type:r}=e;return n?De(n)&&!Wge.has(n)?{valid:!1,reason:L0e(n)}:r==="quantitative"&&t==="log"?{valid:!1,reason:I0e(e)}:{valid:!0}:{valid:!1,reason:O0e(e)}}function QE(e,t,n,r){return e.explicit&&t.explicit&&ve(U0e(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Mxe(e){const t=Bo(e.map(o=>{if(La(o)){const{sort:a,...u}=o;return u}return o}),Ft),n=Bo(e.map(o=>{if(La(o)){const a=o.sort;return a!==void 0&&!gg(a)&&("op"in a&&a.op==="count"&&delete a.field,a.order==="ascending"&&delete a.order),a}}).filter(o=>o!==void 0),Ft);if(t.length===0)return;if(t.length===1){const o=e[0];if(La(o)&&n.length>0){let a=n[0];if(n.length>1){ve(jM);const u=n.filter(l=>Fe(l)&&"op"in l&&l.op!=="min");n.every(l=>Fe(l)&&"op"in l)&&u.length===1?a=u[0]:a=!0}else if(Fe(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=Bo(n.map(o=>gg(o)||!("op"in o)||De(o.op)&&Le(zge,o.op)?o:(ve(W0e(o)),!0)),Ft);let i;r.length===1?i=r[0]:r.length>1&&(ve(jM),i=!0);const s=Bo(e.map(o=>La(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 q$(e){if(La(e)&&De(e.field))return e.field;if(Hge(e)){let t;for(const n of e.fields)if(La(n)&&De(n.field)){if(!t)t=n.field;else if(t!==n.field)return ve(H0e),t}return ve(G0e),t}else if(Gge(e)){ve(Y0e);const t=e.fields[0];return De(t)?t:void 0}}function Jb(e,t){const r=e.component.scales[t].get("domains").map(i=>(La(i)&&(i.data=e.lookupDataSource(i.data)),i));return Mxe(r)}function FU(e){return _h(e)||W$(e)?e.children.reduce((t,n)=>t.concat(FU(n)),z6(e)):z6(e)}function z6(e){return pe(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=Txe(i.range,s,n,e),h=Jb(e,n),p=a?wye(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 Txe(e,t,n,r){if(Ln(n)){if(af(e))return{step:{signal:`${t}_step`}}}else if(Fe(e)&&La(e))return{...e,data:r.lookupDataSource(e.data)};return e}class DU extends uu{constructor(t,n){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(At([vr.LOG,vr.TIME,vr.UTC],t))return"definitely-not";const n=this.get("zero");if(n===!0||n===void 0&&At([vr.LINEAR,vr.SQRT,vr.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(oe(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 Rxe=["range","scheme"];function Nxe(e){const t=e.component.scales;for(const n of IC){const r=t[n];if(!r)continue;const i=Oxe(n,e);r.setWithExplicit("range",i)}}function j6(e,t){const n=e.fieldDef(t);if(n!=null&&n.bin){const{bin:r,field:i}=n,s=Mi(t),o=e.getName(s);if(Fe(r)&&r.binned&&r.step!==void 0)return new Jn(()=>{const a=e.scaleName(t),u=`(domain("${a}")[1] - domain("${a}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${u})`});if(cn(r)){const a=B$(e,i,r);return new Jn(()=>{const u=e.getSignalName(a),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(o)} / (${l})`})}}}function Oxe(e,t){const n=t.specifiedScales[e],{size:r}=t,s=t.getScaleComponent(e).get("type");for(const f of Rxe)if(n[f]!==void 0){const d=ME(s,f),h=gz(e,f);if(!d)ve(VB(s,f,e));else if(h)ve(h);else switch(f){case"range":{const p=n.range;if(oe(p)){if(Ln(e))return $o(p.map(g=>{if(g==="width"||g==="height"){const m=t.getName(g),v=t.getSignalName.bind(t);return Jn.fromName(v,m)}return g}))}else if(Fe(p))return $o({data:t.requestDataName(Cn.Main),field:p.field,sort:{op:"min",field:t.vgField(e)}});return $o(p)}case"scheme":return $o(Lxe(n[f]))}}const o=e===bn||e==="xOffset"?"width":"height",a=r[o];if(na(a)){if(Ln(e))if(ur(s)){const f=TU(a,t,e);if(f)return $o({step:f})}else ve(XB(o));else if(y0(e)){const f=e===ml?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const p=RU(a,s);if(p)return $o(p)}}}const{rangeMin:u,rangeMax:l}=n,c=Ixe(e,t);return(u!==void 0||l!==void 0)&&ME(s,"rangeMin")&&oe(c)&&c.length===2?$o([u??c[0],l??c[1]]):Pi(c)}function Lxe(e){return Tme(e)?{scheme:e.name,...Ai(e,["name"])}:{scheme:e}}function MU(e,t,n,{center:r}={}){const i=Mi(e),s=t.getName(i),o=t.getSignalName.bind(t);return e===cr&&oo(n)?r?[Jn.fromName(a=>`${o(a)}/2`,s),Jn.fromName(a=>`-${o(a)}/2`,s)]:[Jn.fromName(o,s),0]:r?[Jn.fromName(a=>`-${o(a)}/2`,s),Jn.fromName(a=>`${o(a)}/2`,s)]:[0,Jn.fromName(o,s)]}function Ixe(e,t){const{size:n,config:r,mark:i,encoding:s}=t,{type:o}=Hn(s[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case bn:case cr:{if(At(["point","band"],u)){const f=NU(e,n,r.view);if(na(f))return{step:TU(f,t,e)}}return MU(e,t,u)}case ml:case gh:return Pxe(e,t,u);case iu:{const f=jxe(i,r),d=Uxe(i,n,t,r);return Id(u)?zxe(f,d,Bxe(u,r,l,e)):[f,d]}case Ms:return[0,Math.PI*2];case rf:return[0,360];case mo:return[0,new Jn(()=>{const f=t.getSignalName(Ji(t.parent)?"child_width":"width"),d=t.getSignalName(Ji(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case vl:return{step:1e3/r.scale.framesPerSecond};case xl:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case _l:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Di:return"symbol";case Fi:case da:case ha:return u==="ordinal"?o==="nominal"?"category":"ordinal":c!==void 0?"diverging":i==="rect"||i==="geoshape"?"heatmap":"ramp";case su:case yl:case bl:return[r.scale.minOpacity,r.scale.maxOpacity]}}function TU(e,t,n){const{encoding:r}=t,i=t.getScaleComponent(n),s=RC(n),o=r[s];if(uj({step:e,offsetIsDiscrete:at(o)&&lz(o.type)})==="offset"&&Uz(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-${Kge(f)})`}}else return e.step}function RU(e,t){if(uj({step:e,offsetIsDiscrete:ur(t)})==="offset")return{step:e.step}}function Pxe(e,t,n){const r=e===ml?"x":"y",i=t.getScaleComponent(r);if(!i)return MU(r,t,n,{center:!0});const s=i.get("type"),o=t.scaleName(r),{markDef:a,config:u}=t;if(s==="band"){const l=NU(r,t.size,t.config.view);if(na(l)){const c=RU(l,n);if(c)return c}return[0,{signal:`bandwidth('${o}')`}]}else{const l=t.encoding[r];if(be(l)&&l.timeUnit){const c=sz(l.timeUnit,p=>`scale('${o}', ${p})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=tl({fieldDef:l,markDef:a,config:u})-.5,h=d!==0?` + ${d}`:"";if(f){const p=Ue(f)?`${f.signal}/2`+h:`${f/2+d}`,g=Ue(f)?`(1 - ${f.signal}/2)`+h:`${1-f/2+d}`;return[{signal:`${p} * (${c})`},{signal:`${g} * (${c})`}]}return[0,{signal:c}]}return mB(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function NU(e,t,n){const r=e===bn?"width":"height",i=t[r];return i||Bv(n,r)}function Bxe(e,t,n,r){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&oe(n)?n.length+1:(ve(nme(r)),3)}}function zxe(e,t,n){const r=()=>{const i=Zs(t),s=Zs(e),o=`(${i} - ${s}) / (${n} - 1)`;return`sequence(${s}, ${i} + ${o}, ${o})`};return Ue(t)?new Jn(r):{signal:r()}}function jxe(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(kb("size",e))}const U6=.95;function Uxe(e,t,n,r){const i={x:j6(n,"x"),y:j6(n,"y")};switch(e){case"bar":case"tick":{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;const s=q6(t,i,r.view);return Ut(s)?s-1:new Jn(()=>`${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=q6(t,i,r.view);return Ut(s)?Math.pow(U6*s,2):new Jn(()=>`pow(${U6} * ${s.signal}, 2)`)}}throw new Error(kb("size",e))}function q6(e,t,n){const r=na(e.width)?e.width.step:OE(n,"width"),i=na(e.height)?e.height.step:OE(n,"height");return t.x||t.y?new Jn(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(", ")})`):Math.min(r,i)}function OU(e,t){kn(e)?qxe(e,t):IU(e,t)}function qxe(e,t){const n=e.component.scales,{config:r,encoding:i,markDef:s,specifiedScales:o}=e;for(const a of pe(n)){const u=o[a],l=n[a],c=e.getScaleComponent(a),f=Hn(i[a]),d=u[t],h=c.get("type"),p=c.get("padding"),g=c.get("paddingInner"),m=ME(h,t),v=gz(a,t);if(d!==void 0&&(m?v&&ve(v):ve(VB(h,t,a))),m&&v===void 0)if(d!==void 0){const b=f.timeUnit,x=f.type;switch(t){case"domainMax":case"domainMin":uf(u[t])||x==="temporal"||b?l.set(t,{signal:Lb(u[t],{type:x,timeUnit:b})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const b=me(W6,t)?W6[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:qz(i,a),hasSecondaryRangeChannel:!!i[pa(a)]}):r.scale[t];b!==void 0&&l.set(t,b,!1)}}}const W6={bins:({model:e,fieldOrDatumDef:t})=>be(t)?Wxe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>Hxe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:s})=>Gxe(e,t,n,r,i,s),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>Yxe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:s})=>Vxe(e,t,n.type,r,i.scale,s),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:s})=>Xxe(e,t,n,r,i.scale,s),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>{const i=be(e)?e.sort:void 0;return Kxe(t,i,n,r.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:s,hasSecondaryRangeChannel:o})=>Zxe(e,t,n,r,i,s.scale,o)};function LU(e){kn(e)?Nxe(e):IU(e,"range")}function IU(e,t){const n=e.component.scales;for(const r of e.children)t==="range"?LU(r):OU(r,t);for(const r of pe(n)){let i;for(const s of e.children){const o=s.component.scales[r];if(o){const a=o.getWithExplicit(t);i=nl(i,a,t,"scale",_j((u,l)=>{switch(t){case"range":return u.step&&l.step?u.step-l.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function Wxe(e,t){const n=t.bin;if(cn(n)){const r=B$(e,t.field,n);return new Jn(()=>e.getSignalName(r))}else if(hr(n)&&of(n)&&n.step!==void 0)return{step:n.step}}function Hxe(e,t){if(At([Fi,da,ha],e)&&t!=="nominal")return"hcl"}function Gxe(e,t,n,r,i,s){var o;if(!((o=uo(s))!=null&&o.bin||oe(n)||i!=null||r!=null||At([vr.TIME,vr.UTC],e)))return Ln(t)?!0:void 0}function Yxe(e,t,n,r,i,s){if(Ln(e)){if(zo(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:o,orient:a}=i;if(o==="bar"&&!(be(r)&&(r.bin||r.timeUnit))&&(a==="vertical"&&e==="x"||a==="horizontal"&&e==="y"))return s.continuousBandSize}if(t===vr.POINT)return n.pointPadding}}function Vxe(e,t,n,r,i,s=!1){if(e===void 0){if(Ln(t)){const{bandPaddingInner:o,barBandPaddingInner:a,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=i;return s?c:On(o,n==="bar"?a:n==="tick"?l:u)}else if(y0(t)&&r===vr.BAND)return i.offsetBandPaddingInner}}function Xxe(e,t,n,r,i,s=!1){if(e===void 0){if(Ln(t)){const{bandPaddingOuter:o,bandWithNestedOffsetPaddingOuter:a}=i;if(s)return a;if(n===vr.BAND)return On(o,Ue(r)?{signal:`${r.signal}/2`}:r/2)}else if(y0(t)){if(n===vr.POINT)return .5;if(n===vr.BAND)return i.offsetBandPaddingOuter}}}function Kxe(e,t,n,r){if(n==="x"&&r.xReverse!==void 0)return oo(e)&&t==="descending"?Ue(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(oo(e)&&t==="descending")return!0}function Zxe(e,t,n,r,i,s,o){if(!!n&&n!=="unaggregated"&&oo(i)){if(oe(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"&&!Id(i))return!0;if(!(be(t)&&t.bin)&&At([...ou,...Mge],e)){const{orient:u,type:l}=r;return At(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:At(["bar","area"],l)&&!o?!0:s==null?void 0:s.zero}return!1}function Jxe(e,t,n,r,i=!1){const s=Qxe(t,n,r,i),{type:o}=e;return ga(t)?o!==void 0?Bme(t,o)?be(n)&&!Pme(o,n.type)?(ve(z0e(o,s)),s):o:(ve(B0e(t,o,s)),s):s:null}function Qxe(e,t,n,r){var i;switch(t.type){case"nominal":case"ordinal":{if(Yf(e)||Ox(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&ve(Lx(e,"ordinal")),"ordinal";if(Nx(e))return"band";if(Ln(e)||y0(e)){if(At(["rect","bar","image","rule","tick"],n.type)||r)return"band"}else if(n.type==="arc"&&e in LC)return"band";const s=n[Mi(e)];return jc(s)||Bd(t)&&((i=t.axis)!=null&&i.tickBand)?"band":"point"}case"temporal":return Yf(e)?"time":Ox(e)==="discrete"?(ve(Lx(e,"temporal")),"ordinal"):be(t)&&t.timeUnit&&or(t.timeUnit).utc?"utc":Nx(e)?"band":"time";case"quantitative":return Yf(e)?be(t)&&cn(t.bin)?"bin-ordinal":"linear":Ox(e)==="discrete"?(ve(Lx(e,"quantitative")),"ordinal"):Nx(e)?"band":"linear";case"geojson":return}throw new Error(GB(t.type))}function e_e(e,{ignoreRange:t}={}){PU(e),$U(e);for(const n of Ime)OU(e,n);t||LU(e)}function PU(e){kn(e)?e.component.scales=t_e(e):e.component.scales=r_e(e)}function t_e(e){const{encoding:t,mark:n,markDef:r}=e,i={};for(const s of IC){const o=Hn(t[s]);if(o&&n===yz&&s===Di&&o.type===mh)continue;let a=o&&o.scale;if(o&&a!==null&&a!==!1){a??(a={});const u=qz(t,s),l=Jxe(a,s,o,r,u);i[s]=new DU(e.scaleName(`${s}`,!0),{value:l,explicit:a.type===l})}}return i}const n_e=_j((e,t)=>qM(e)-qM(t));function r_e(e){var t;const n=e.component.scales={},r={},i=e.component.resolve;for(const s of e.children){PU(s);for(const o of pe(s.component.scales))if((t=i.scale)[o]??(t[o]=gU(o,e)),i.scale[o]==="shared"){const a=r[o],u=s.component.scales[o].getWithExplicit("type");a?Cme(a.value,u.value)?r[o]=nl(a,u,"type","scale",n_e):(i.scale[o]="independent",delete r[o]):r[o]=u}}for(const s of pe(r)){const o=e.scaleName(s,!0),a=r[s];n[s]=new DU(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 Zx{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 kn(e){return(e==null?void 0:e.type)==="unit"}function Ji(e){return(e==null?void 0:e.type)==="facet"}function W$(e){return(e==null?void 0:e.type)==="concat"}function _h(e){return(e==null?void 0:e.type)==="layer"}class H${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=gr(a),this.name=t.name??i,this.title=yu(t.title)?{text:t.title}:t.title?gr(t.title):void 0,this.scaleNameMap=r?r.scaleNameMap:new Zx,this.projectionNameMap=r?r.projectionNameMap:new Zx,this.signalNameMap=r?r.signalNameMap:new Zx,this.data=t.data,this.description=t.description,this.transforms=Qve(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:rve(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:Rb(t)||(r==null?void 0:r.component.data.isFaceted)&&t.data===void 0},layoutSize:new uu,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?it(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(){e_e(this)}parseProjection(){kU(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){xU(this)}assembleEncodeFromView(t){const{style:n,...r}=t,i={};for(const s of pe(r)){const o=r[s];o!==void 0&&(i[s]=dn(o))}return i}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=dn(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:on(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:r,config:i}=this,s=E2e(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 vs)t[r].title&&n.push(v2e(this,r));for(const r of O$)n=n.concat(y2e(this,r));return n}assembleAxes(){return i2e(this.component.axes,this.config)}assembleLegends(){return wU(this)}assembleProjections(){return G2e(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},r={...IB(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(r.text)return At(["unit","layer"],this.type)?At(["middle",void 0],r.anchor)&&(r.frame??(r.frame="group")):r.anchor??(r.anchor="start"),on(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||Ji(this.parent)?FU(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 yn((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Cn[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(Ji(this.parent)){const n=hU(t),r=wb(n),i=this.component.scales[r];if(i&&!i.merged){const s=i.get("type"),o=i.get("range");if(ur(s)&&af(o)){const a=i.get("name"),u=Jb(this,r),l=q$(u);if(l){const c=Ce({aggregate:"distinct",field:l},{expr:"datum"});return{signal:dU(a,i,c)}}else return ve(zC(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(FB(t)&&ga(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(t0e(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 BU extends H${vgField(t,n={}){const r=this.fieldDef(t);if(r)return Ce(r,n)}reduceFieldDef(t,n){return T1e(this.getMapping(),(r,i,s)=>{const o=uo(i);return o?t(r,o,s):r},n)}forEachFieldDef(t,n){p$(this.getMapping(),(r,i)=>{const s=uo(r);s&&t(s,i)},n)}}class Qb extends tn{clone(){return new Qb(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{density:t,...n}=this.transform,r={type:"kde",field:t,...n};return r.resolve=this.transform.resolve,r}}class e2 extends tn{clone(){return new e2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${Ft(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class t2 extends tn{clone(){return new t2(this.parent,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class n2 extends tn{clone(){return new n2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class Kf extends tn{clone(){return new Kf(null,it(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[[yo,vo],[Fs,bo]]){const s=i.map(o=>{const a=Hn(n.encoding[o]);return be(a)?a.field:ma(a)?{expr:`${a.datum}`}:ao(a)?{expr:`${a.value}`}:void 0});(s[0]||s[1])&&(t=new Kf(t,s,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(Di)){const i=n.typedFieldDef(Di);i.type===mh&&(t=new Kf(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(De);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${Ft(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 _g extends tn{clone(){return new _g(null,this.projection,it(this.fields),it(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[[yo,vo],[Fs,bo]]){const i=r.map(o=>{const a=Hn(n.encoding[o]);return be(a)?a.field:ma(a)?{expr:`${a.datum}`}:ao(a)?{expr:`${a.value}`}:void 0}),s=r[0]===Fs?"2":"";(i[0]||i[1])&&(t=new _g(t,n.projectionName(),i,[n.getName(`x${s}`),n.getName(`y${s}`)]))}return t}dependentFields(){return new Set(this.fields.filter(De))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${Ft(this.fields)} ${Ft(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class pc extends tn{clone(){return new pc(null,it(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 pc(t,n)}static makeFromEncoding(t,n){const r=n.encoding,i=r.x,s=r.y;if(be(i)&&be(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=Gz(n.mark,r);return new pc(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 ${Ft(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:Nve(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 r2 extends tn{clone(){return new r2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{loess:t,on:n,...r}=this.transform;return{type:"loess",x:n,y:t,...r}}}class wg extends tn{clone(){return new wg(null,it(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(Ove(o)){let u=UU(o.data,s);u||(u=new Yc(o.data),s.push(u));const l=n.getName(`lookup_${i}`);a=new ki(u,l,Cn.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[l]=a}else if(Lve(o)){const u=o.param;r={as:u,...r};let l;try{l=n.getSelectionComponent(yn(u),u)}catch{throw new Error(s0e(u))}if(a=l.materialized,!a)throw new Error(o0e(u))}return new wg(t,r,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Me(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${Ft({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:Me(this.transform.as)}:{}};else{let n=this.transform.as;De(n)||(ve(v0e),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 i2 extends tn{clone(){return new i2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class s2 extends tn{clone(){return new s2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=it(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 ${Ft(this.transform)}`}assemble(){const{regression:t,on:n,...r}=this.transform;return{type:"regression",x:n,y:t,...r}}}class o2 extends tn{clone(){return new o2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=Bo((this.transform.groupby??[]).concat(t),n=>n)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${Ft(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 a2 extends tn{clone(){return new a2(null,it(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${Ft(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function zU(e){let t=0;function n(r,i){if(r instanceof Yc&&!r.isGenerator&&!jd(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof Or&&(r.parent instanceof Yc&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof bh){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 M0||r instanceof T0||r instanceof Gd||r instanceof yh||r instanceof qd||r instanceof _g||r instanceof eo||r instanceof wg||r instanceof xh||r instanceof hf||r instanceof n2||r instanceof t2||r instanceof Qb||r instanceof r2||r instanceof i2||r instanceof s2||r instanceof rl||r instanceof a2||r instanceof o2||r instanceof e2)&&i.transform.push(r.assemble()),(r instanceof Go||r instanceof Wo||r instanceof pc||r instanceof Ga||r instanceof Kf)&&i.transform.push(...r.assemble()),r instanceof ki&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof ki?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 ki&&(!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 i_e(e){const t=[],n=zU(t);for(const r of e.children)n(r,{source:e.name,name:null,transform:[]});return t}function s_e(e,t){const n=[],r=zU(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 o_e(e){return e==="top"||e==="left"||Ue(e)?"header":"footer"}function a_e(e){for(const t of vs)u_e(e,t);H6(e,"x"),H6(e,"y")}function u_e(e,t){var o;const{facet:n,config:r,child:i,component:s}=e;if(e.channelHasField(t)){const a=n[t],u=Hd("title",null,r,t);let l=Vf(a,r,{allowDisabling:!0,includeDefault:u===void 0||!!u});i.component.layoutHeaders[t].title&&(l=oe(l)?l.join(", "):l,l+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);const c=Hd("labelOrient",a.header,r,t),f=a.header!==null?On((o=a.header)==null?void 0:o.labels,r.header.labels,!0):!1,d=At(["bottom","right"],c)?"footer":"header";s.layoutHeaders[t]={title:a.header!==null?l:null,facetFieldDef:a,[d]:t==="facet"?[]:[jU(e,t,f)]}}}function jU(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 H6(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=P$(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=o_e(a.get("orient"));o[u]??(o[u]=[jU(e,s,!1)]);const l=xp(a,"main",e.config,{header:!0});l&&o[u][0].axes.push(l),a.mainExtracted=!0}}}}function l_e(e){G$(e),Wv(e,"width"),Wv(e,"height")}function c_e(e){G$(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";Wv(e,t),Wv(e,n)}function G$(e){for(const t of e.children)t.parseLayoutSize()}function Wv(e,t){const n=hU(t),r=wb(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]??gU(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=nl(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 f_e(e){const{size:t,component:n}=e;for(const r of ou){const i=Mi(r);if(t[i]){const s=t[i];n.layoutSize.set(i,na(s)?"step":s,!0)}else{const s=d_e(e,i);n.layoutSize.set(i,s,!1)}}}function d_e(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(ur(s)){const a=Bv(r.view,t);return af(o)||na(a)?"step":a}else return NE(r.view,t)}else{if(e.hasProjection||e.mark==="arc")return NE(r.view,t);{const s=Bv(r.view,t);return na(s)?s.step:s}}}function eA(e,t,n){return Ce(t,{suffix:`by_${Ce(e)}`,...n})}class Up extends BU{constructor(t,n,r,i){super(t,"facet",n,r,i,t.resolve),this.child=Z$(t.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!w0(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=pe(t),r={};for(const i of n){if(![Ua,qa].includes(i)){ve(kb(i,"facet"));break}const s=t[i];if(s.field===void 0){ve(FE(s,i));break}r[i]=this.initFacetFieldDef(s,i)}return r}initFacetFieldDef(t,n){const r=h$(t,n);return r.header?r.header=gr(r.header):r.header===null&&(r.header=null),r}channelHasField(t){return me(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=u2(this),this.child.parseData()}parseLayoutSize(){G$(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some(t=>Ho(t))&&UC(jC)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),a_e(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 vs)for(const r of L$){const i=this.component.layoutHeaders[n],s=i[r],{facetFieldDef:o}=i;if(o){const a=Hd("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(a)){const u=Kb(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 Up))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof Up?{...this.channelHasField("column")?{encode:{update:{columns:{field:Ce(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],r=[];if(this.child instanceof Up){if(this.child.channelHasField("column")){const i=Ce(this.child.facet.column);t.push(i),n.push("distinct"),r.push(`distinct_${i}`)}}else for(const i of ou){const s=this.child.component.scales[i];if(s&&!s.merged){const o=s.get("type"),a=s.get("range");if(ur(o)&&af(a)){const u=Jb(this.child,i),l=q$(u);l?(t.push(l),n.push("distinct"),r.push(`distinct_${l}`)):ve(zC(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 vs){const f=this.facet[c];if(f){u.push(Ce(f));const{bin:d,sort:h}=f;if(cn(d)&&u.push(Ce(f,{binSuffix:"end"})),Wa(h)){const{field:p,op:g=Tb}=h,m=eA(f,h);r&&i?(s.push(m),o.push("max"),a.push(m)):(s.push(p),o.push(g),a.push(m))}else if(oe(h)){const p=Wd(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?Wa(r.sort)?[eA(r,r.sort,{expr:"datum"})]:oe(r.sort)?[Wd(r,t,{expr:"datum"})]:[Ce(r,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,r=n[t];if(r){const{sort:i}=r;return[(Wa(i)?i.order:!oe(i)&&i)||"ascending"]}return[]}assembleLabelTitle(){var i;const{facet:t,config:n}=this;if(t.facet)return YE(t.facet,"facet",n);const r={row:["top","bottom"],column:["left","right"]};for(const s of O$)if(t[s]){const o=Hd("labelOrient",(i=t[s])==null?void 0:i.header,n,s);if(r[s].includes(o))return YE(t[s],s,n)}}assembleMarks(){const{child:t}=this,n=this.component.data.facetRoot,r=i_e(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:vs.map(u=>this.facetSortFields(u)).flat(),order:vs.map(u=>this.facetSortOrder(u)).flat()},...r.length>0?{data:r}:{},...i?{encode:{update:i}}:{},...t.assembleGroup(yye(this,[]))}]}getMapping(){return this.facet}}function h_e(e,t){const{row:n,column:r}=t;if(n&&r){let i=null;for(const s of[n,r])if(Wa(s.sort)){const{field:o,op:a=Tb}=s.sort;e=i=new hf(e,{joinaggregate:[{op:a,field:o,as:eA(s,s.sort,{forAs:!0})}],groupby:[Ce(s)]})}return i}return null}function UU(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(yg(e)&&yg(a)){if(Yi(e.values,a.values))return o}else if(jd(e)&&jd(a)){if(e.url===a.url)return o}else if(wj(e)&&e.name===o.dataName)return o}}return null}function p_e(e,t){if(e.data||!e.parent){if(e.data===null){const r=new Yc({values:[]});return t.push(r),r}const n=UU(e.data,t);if(n)return zu(e.data)||(n.data.format=vB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const r=new Yc(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 g_e(e,t,n){let r=0;for(const i of t.transforms){let s,o;if(Gve(i))o=e=new qd(e,i),s="derived";else if(k$(i)){const a=sxe(i);o=e=Or.makeWithAncestors(e,{},a,n)??e,e=new yh(e,t,i.filter)}else if(vj(i))o=e=Go.makeFromTransform(e,i,t),s="number";else if(Vve(i))s="date",n.getWithExplicit(i.field).value===void 0&&(e=new Or(e,{[i.field]:s}),n.set(i.field,s,!1)),o=e=Wo.makeFromTransform(e,i);else if(Xve(i))o=e=eo.makeFromTransform(e,i),s="number",M$(t)&&(e=new rl(e));else if(mj(i))o=e=wg.make(e,t,i,r++),s="derived";else if(qve(i))o=e=new xh(e,i),s="number";else if(Wve(i))o=e=new hf(e,i),s="number";else if(Kve(i))o=e=Ga.makeFromTransform(e,i),s="derived";else if(Zve(i))o=e=new n2(e,i),s="derived";else if(Jve(i))o=e=new e2(e,i),s="derived";else if(Hve(i))o=e=new t2(e,i),s="derived";else if(Ive(i))o=e=new o2(e,i),s="derived";else if(Uve(i))e=new a2(e,i);else if(Yve(i))o=e=pc.makeFromTransform(e,i),s="derived";else if(Pve(i))o=e=new Qb(e,i),s="derived";else if(Bve(i))o=e=new i2(e,i),s="derived";else if(zve(i))o=e=new s2(e,i),s="derived";else if(jve(i))o=e=new r2(e,i),s="derived";else{ve(m0e(i));continue}if(o&&s!==void 0)for(const a of o.producedFields()??[])n.set(a,s,!1)}return e}function u2(e){var m;let t=p_e(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,o=!(i&&(zu(i)||jd(i)||yg(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new cye;zu(i)?(Ej(i)?t=new T0(t,i.sequence):S$(i)&&(t=new M0(t,i.graticule)),o.parseNothing=!0):((m=i==null?void 0:i.format)==null?void 0:m.parse)===null&&(o.parseNothing=!0),t=Or.makeExplicit(t,e,o)??t,t=new rl(t);const a=e.parent&&_h(e.parent);(kn(e)||Ji(e))&&a&&(t=Go.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=g_e(t,e,o));const u=axe(e),l=oxe(e);t=Or.makeWithAncestors(t,{},{...u,...l},o)??t,kn(e)&&(t=Kf.parseAll(t,e),t=_g.parseAll(t,e)),(kn(e)||Ji(e))&&(a||(t=Go.makeFromEncoding(t,e)??t),t=Wo.makeFromEncoding(t,e)??t,t=qd.parseAllForSortIndex(t,e));const c=t=gm(Cn.Raw,e,t);if(kn(e)){const v=eo.makeFromEncoding(t,e);v&&(t=v,M$(e)&&(t=new rl(t))),t=pc.makeFromEncoding(t,e)??t,t=Ga.makeFromEncoding(t,e)??t}let f,d;if(kn(e)){const{markDef:v,mark:b,config:x}=e,_=sn("invalid",v,x),{marks:w,scales:A}=d=kj({invalid:_,isPath:El(b)});w!==A&&A==="include-invalid-values"&&(f=t=gm(Cn.PreFilterInvalid,e,t)),w==="exclude-invalid-values"&&(t=Gd.make(t,e,d)??t)}const h=t=gm(Cn.Main,e,t);let p;if(kn(e)&&d){const{marks:v,scales:b}=d;v==="include-invalid-values"&&b==="exclude-invalid-values"&&(t=Gd.make(t,e,d)??t,p=t=gm(Cn.PostFilterInvalid,e,t))}kn(e)&&n2e(e,h);let g=null;if(Ji(e)){const v=e.getName("facet");t=h_e(t,e.facet)??t,g=new bh(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 gm(e,t,n){const{outputNodes:r,outputNodeRefCounts:i}=t.component.data,s=t.getDataName(e),o=new ki(n,s,e,i);return r[s]=o,o}class m_e extends H${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")&&ve(h0e),this.children=this.getChildren(t).map((l,c)=>Z$(l,this,this.getName(`concat_${c}`),void 0,i))}parseData(){this.component.data=u2(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 pe(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>Ho(t))&&UC(jC)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return Bb(t)?t.vconcat:E$(t)?t.hconcat:t.concat}parseLayoutSize(){c_e(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=I$(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 v_e(e){return e===!1||e===null}const y_e={disable:1,gridScale:1,scale:1,...zz,labelExpr:1,encode:1},qU=pe(y_e);class Y$ extends uu{constructor(t={},n={},r=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=r}clone(){return new Y$(it(this.explicit),it(this.implicit),this.mainExtracted)}hasAxisPart(t){return t==="axis"?!0:t==="grid"||t==="title"?!!this.get(t):!v_e(this.get(t))}hasOrientSignalRef(){return Ue(this.explicit.orient)}}function b_e(e,t,n){const{encoding:r,config:i}=e,s=Hn(r[t])??Hn(r[pa(t)]),o=e.axis(t)||{},{format:a,formatType:u}=o;if(Uc(u))return{text:Js({fieldOrDatumDef:s,field:"datum.value",format:a,formatType:u,config:i}),...n};if(a===void 0&&u===void 0&&i.customFormatTypes){if(Pd(s)==="quantitative"){if(Bd(s)&&s.stack==="normalize"&&i.normalizedNumberFormatType)return{text:Js({fieldOrDatumDef:s,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:Js({fieldOrDatumDef:s,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(Pd(s)==="temporal"&&i.timeFormatType&&be(s)&&!s.timeUnit)return{text:Js({fieldOrDatumDef:s,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function x_e(e){return ou.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[C_e(n,e)]),t),{})}const __e={bottom:"top",top:"bottom",left:"right",right:"left"};function w_e(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 pe(i.component.axes))n.axis[s]=P$(e.component.resolve,s),n.axis[s]==="shared"&&(t[s]=E_e(t[s],i.component.axes[s]),t[s]||(n.axis[s]="independent",delete t[s]))}for(const i of ou){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(!Ue(a)){if(r[a]>0&&!u){const l=__e[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 E_e(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let r=0;rn.clone());return e}function A_e(e,t){for(const n of qU){const r=nl(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(i,s)=>{switch(n){case"title":return WB(i,s);case"gridScale":return{explicit:i.explicit,value:On(i.value,s.value)}}return jb(i,s,n,"axis")});e.setWithExplicit(n,r)}return e}function k_e(e,t,n,r,i){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Ue(n.labelAngle)?n.labelAngle:mg(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===uU(r,i))return!0}return e===n[t]}const S_e=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function C_e(e,t){var v,b;let n=t.axis(e);const r=new Y$,i=Hn(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)||((b=o.axis)==null?void 0:b.orient)||d2e(e),u=t.getScaleComponent(e).get("type"),l=s2e(e,u,a,t.config),c=n!==void 0?!n:HE("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=l2e(i,n,e,o.style,l),d=Sz(n.formatType,i,u),h=kz(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 x of qU){const _=x in D6?D6[x](p):KM(x)?n[x]:void 0,w=_!==void 0,A=k_e(_,x,n,t,e);if(w&&A)r.set(x,_,A);else{const{configValue:E=void 0,configFrom:S=void 0}=KM(x)&&x!=="values"?HE(x,o.style,n.style,l):{},C=E!==void 0;w&&!C?r.set(x,_,A):(S!=="vgAxisConfig"||S_e.has(x)&&C||S0(E)||Ue(E))&&r.set(x,E,!1)}}const g=n.encoding??{},m=Bz.reduce((x,_)=>{if(!r.hasAxisPart(_))return x;const w=pU(g[_]??{},t),A=_==="labels"?b_e(t,e,w):w;return A!==void 0&&!on(A)&&(x[_]={update:A}),x},{});return on(m)||r.set("encode",m,!!n.encoding||n.labelAngle!==void 0),r}function $_e({encoding:e,size:t}){for(const n of ou){const r=Mi(n);na(t[r])&&Mu(e[n])&&(delete t[r],ve(XB(r)))}return t}const F_e={vgMark:"arc",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...ni("x",e,{defaultPos:"mid"}),...ni("y",e,{defaultPos:"mid"}),...Ja(e,"radius"),...Ja(e,"theta")})},D_e={vgMark:"area",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...zv("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...zv("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...D$(e)})},M_e={vgMark:"rect",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ja(e,"x"),...Ja(e,"y")})},T_e={vgMark:"shape",encodeEntry:e=>({...Ts(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&&be(n)&&n.type===mh?{field:Ce(n,{expr:"datum"})}:{}}]}},R_e={vgMark:"image",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Ja(e,"x"),...Ja(e,"y"),...$$(e,"url")})},N_e={vgMark:"line",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...ni("x",e,{defaultPos:"mid"}),...ni("y",e,{defaultPos:"mid"}),...yr("size",e,{vgChannel:"strokeWidth"}),...D$(e)})},O_e={vgMark:"trail",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...ni("x",e,{defaultPos:"mid"}),...ni("y",e,{defaultPos:"mid"}),...yr("size",e),...D$(e)})};function V$(e,t){const{config:n}=e;return{...Ts(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...ni("x",e,{defaultPos:"mid"}),...ni("y",e,{defaultPos:"mid"}),...yr("size",e),...yr("angle",e),...L_e(e,n,t)}}function L_e(e,t,n){return n?{shape:{value:n}}:yr("shape",e)}const I_e={vgMark:"symbol",encodeEntry:e=>V$(e)},P_e={vgMark:"symbol",encodeEntry:e=>V$(e,"circle")},B_e={vgMark:"symbol",encodeEntry:e=>V$(e,"square")},z_e={vgMark:"rect",encodeEntry:e=>({...Ts(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ja(e,"x"),...Ja(e,"y")})},j_e={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...Ts(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...zv("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...zv("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...yr("size",e,{vgChannel:"strokeWidth"})}}},U_e={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Ts(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...ni("x",e,{defaultPos:"mid"}),...ni("y",e,{defaultPos:"mid"}),...$$(e),...yr("size",e,{vgChannel:"fontSize"}),...yr("angle",e),...b6("align",q_e(e.markDef,n,t)),...b6("baseline",W_e(e.markDef,n,t)),...ni("radius",e,{defaultPos:null}),...ni("theta",e,{defaultPos:null})}}};function q_e(e,t,n){if(sn("align",e,n)===void 0)return"center"}function W_e(e,t,n){if(sn("baseline",e,n)===void 0)return"middle"}const H_e={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{...Ts(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ja(e,i),...ni(s,e,{defaultPos:"mid",vgChannel:s==="y"?"yc":"xc"}),[o]:dn(sn("thickness",n,t))}}},mm={arc:F_e,area:D_e,bar:M_e,circle:P_e,geoshape:T_e,image:R_e,line:N_e,point:I_e,rect:z_e,rule:j_e,square:B_e,text:U_e,tick:H_e,trail:O_e};function G_e(e){if(At([Db,$b,qme],e.mark)){const t=Gz(e.mark,e.encoding);if(t.length>0)return Y_e(e,t)}else if(e.mark===Fb){const t=CE.some(n=>sn(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return V_e(e)}return X$(e)}const G6="faceted_path_";function Y_e(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:G6+e.requestDataName(Cn.Main),data:e.requestDataName(Cn.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:X$(e,{fromPrefix:G6})}]}const Y6="stack_group_";function V_e(e){var l;const[t]=X$(e,{fromPrefix:Y6}),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={...Td(t.encode.update,["y","yc","y2","height",...CE]),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={...Ai(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...Td(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={...Ai(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const c of CE){const f=ea(c,e.markDef,e.config);t.encode.update[c]?(s[c]=t.encode.update[c],delete t.encode.update[c]):f&&(s[c]=dn(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=Ce(f);d&&a.push(d),(f!=null&&f.bin||f!=null&&f.timeUnit)&&a.push(Ce(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=ea(f,e.markDef,e.config);return d!==void 0?{...c,[f]:dn(d)}:c}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Cn.Main),name:Y6+e.requestDataName(Cn.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 X_e(e){const{encoding:t,stack:n,mark:r,markDef:i,config:s}=e,o=t.order;if(!(!oe(o)&&ao(o)&&kE(o.value)||!o&&kE(sn("order",i,s)))){if((oe(o)||be(o))&&!n)return jB(o,{expr:"datum"});if(El(r)){const a=i.orient==="horizontal"?"y":"x",u=t[a];if(be(u))return{field:a}}}}function X$(e,t={fromPrefix:""}){const{mark:n,markDef:r,encoding:i,config:s}=e,o=On(r.clip,K_e(e),Z_e(e)),a=BB(r),u=i.key,l=X_e(e),c=J_e(e),f=sn("aria",r,s),d=mm[n].postEncodingTransform?mm[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:mm[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(Cn.Main)},encode:{update:mm[n].encodeEntry(e)},...d?{transform:d}:{}}]}function K_e(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 Z_e(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function J_e(e){if(!e.component.selection)return null;const t=pe(e.component.selection).length;let n=t,r=e.parent;for(;r&&n===0;)n=pe(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class WU extends BU{constructor(t,n,r,i={},s){super(t,"unit",n,r,s,void 0,JM(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+Cj)),(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=ta(t.mark)?{...t.mark}:{type:t.mark},a=o.type;o.filled===void 0&&(o.filled=Sve(o,s,{graticule:t.data&&S$(t.data)}));const u=this.encoding=D1e(t.encoding||{},a,o.filled,s);this.markDef=hj(o,u,s),this.size=$_e({encoding:u,size:JM(t)?{...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}}:i}),this.stack=dj(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=>_$(l))}get hasProjection(){const{encoding:t}=this,n=this.mark===yz,r=t&&wge.some(i=>at(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 IC.reduce((r,i)=>{const s=Hn(n[i]);return s&&(r[i]=this.initScale(s.scale??{})),r},{})}initScale(t){const{domain:n,range:r}=t,i=gr(t);return oe(n)&&(i.domain=n.map(Wi)),oe(r)&&(i.range=r.map(Wi)),i}initAxes(t){return ou.reduce((n,r)=>{const i=t[r];if(at(i)||r===bn&&at(t.x2)||r===cr&&at(t.y2)){const s=at(i)?i.axis:void 0;n[r]=s&&this.initAxis({...s})}return n},{})}initAxis(t){const n=pe(t),r={};for(const i of n){const s=t[i];r[i]=S0(s)?PB(s):Wi(s)}return r}initLegends(t){return Rge.reduce((n,r)=>{const i=Hn(t[r]);if(i&&Oge(r)){const s=i.legend;n[r]=s&&gr(s)}return n},{})}parseData(){this.component.data=u2(this)}parseLayoutSize(){f_e(this)}parseSelections(){this.component.selection=t2e(this,this.selection)}parseMarkGroup(){this.component.mark=G_e(this)}parseAxesAndHeaders(){this.component.axes=x_e(this)}assembleSelectionTopLevelSignals(t){return bye(this,t)}assembleSignals(){return[...sU(this),...vye(this,[])]}assembleSelectionData(t){return xye(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return I$(this)}assembleMarks(){let t=this.component.mark??[];return(!this.parent||!_h(this.parent))&&(t=Mj(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 dc(this.encoding,t)}fieldDef(t){const n=this.encoding[t];return uo(n)}typedFieldDef(t){const n=this.fieldDef(t);return ai(n)?n:null}}class K$ extends H${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(zb(a))return new K$(a,this,this.getName(`layer_${u}`),o,s);if(au(a))return new WU(a,this,this.getName(`layer_${u}`),o,s);throw new Error(BC(a))})}parseData(){this.component.data=u2(this);for(const t of this.children)t.parseData()}parseLayoutSize(){l_e(this)}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of pe(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>Ho(t))&&UC(jC)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){w_e(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,r)=>r.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleSignals()),sU(this))}assembleLayoutSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleLayoutSignals()),I$(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 Me(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 _ye(this,this.children.flatMap(t=>t.assembleMarks()))}assembleLegends(){return this.children.reduce((t,n)=>t.concat(n.assembleLegends()),wU(this))}}function Z$(e,t,n,r,i){if(Rb(e))return new Up(e,t,n,i);if(zb(e))return new K$(e,t,n,r,i);if(au(e))return new WU(e,t,n,r,i);if(eve(e))return new m_e(e,t,n,i);throw new Error(BC(e))}function Q_e(e,t={}){t.logger&&rme(t.logger),t.fieldTitle&&Lz(t.fieldTitle);try{const n=fj(Zd(t.config,e.config)),r=xj(e,n),i=Z$(r,null,"",void 0,n);return i.parse(),Exe(i.component.data,i),{spec:twe(i,ewe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&ime(),t.fieldTitle&&_1e()}}function ewe(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)):De(t)&&(t={type:t}),i&&s&&aye(t.type)){if(i==="step"&&s==="step")ve(LM()),t.type="pad";else if(i==="step"||s==="step"){const o=i==="step"?"width":"height";ve(LM(wb(o)));const a=o==="width"?"height":"width";t.type=uye(a)}}return{...pe(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...c6(n,!1),...c6(e,!0)}}function twe(e,t,n={},r){const i=e.config?pve(e.config):void 0,s=s_e(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([]),...aj(d)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}const nwe=mge.version,rwe=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:Nd,accessPathWithDatum:FC,accessWithDatumToUnescapedPath:Jt,compile:Q_e,contains:At,deepEqual:Yi,deleteNestedProperty:Dv,duplicate:it,entries:Qu,every:SC,fieldIntersection:$C,flatAccessWithDatum:bB,getFirstDefined:On,hasIntersection:CC,hasProperty:me,hash:Ft,internalField:wB,isBoolean:gg,isEmpty:on,isEqual:yge,isInternalField:EB,isNullOrFalse:kE,isNumeric:mb,keys:pe,logicalExpr:Bp,mergeDeep:vB,never:mB,normalize:xj,normalizeAngle:mg,omit:Ai,pick:Td,prefixGenerator:SE,removePathFromField:ph,replaceAll:Lc,replacePathInField:$s,resetIdCounter:xge,setEqual:yB,some:Rd,stringify:an,titleCase:g0,unique:Bo,uniqueId:_B,vals:Er,varName:yn,version:nwe},Symbol.toStringTag,{value:"Module"}));function HU(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var iwe="2.15.0",swe={version:iwe};const Sf="#fff",V6="#888",owe={background:"#333",view:{stroke:V6},title:{color:Sf,subtitleColor:Sf},style:{"guide-label":{fill:Sf},"guide-title":{fill:Sf}},axis:{domainColor:Sf,gridColor:V6,tickColor:Sf}},Tl="#4572a7",awe={background:"#fff",arc:{fill:Tl},area:{fill:Tl},line:{stroke:Tl,strokeWidth:2},path:{stroke:Tl},rect:{fill:Tl},shape:{stroke:Tl},symbol:{fill:Tl,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"]}},Rl="#30a2da",Jx="#cbcbcb",uwe="#999",lwe="#333",X6="#f0f0f0",K6="#333",cwe={arc:{fill:Rl},area:{fill:Rl},axis:{domainColor:Jx,grid:!0,gridColor:Jx,gridWidth:1,labelColor:uwe,labelFontSize:10,titleColor:lwe,tickColor:Jx,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:X6,group:{fill:X6},legend:{labelColor:K6,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:K6,titleFontSize:14,titlePadding:10},line:{stroke:Rl,strokeWidth:2},path:{stroke:Rl,strokeWidth:.5},rect:{fill:Rl},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:Rl},bar:{binSpacing:2,fill:Rl,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Nl="#000",fwe={group:{fill:"#e5e5e5"},arc:{fill:Nl},area:{fill:Nl},line:{stroke:Nl},path:{stroke:Nl},rect:{fill:Nl},shape:{stroke:Nl},symbol:{fill:Nl,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"]}},dwe=22,hwe="normal",Z6="Benton Gothic, sans-serif",J6=11.5,pwe="normal",Ol="#82c6df",Qx="Benton Gothic Bold, sans-serif",Q6="normal",e8=13,Gh={"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"]},gwe={background:"#ffffff",title:{anchor:"start",color:"#000000",font:Qx,fontSize:dwe,fontWeight:hwe},arc:{fill:Ol},area:{fill:Ol},line:{stroke:Ol,strokeWidth:2},path:{stroke:Ol},rect:{fill:Ol},shape:{stroke:Ol},symbol:{fill:Ol,size:30},axis:{labelFont:Z6,labelFontSize:J6,labelFontWeight:pwe,titleFont:Qx,titleFontSize:e8,titleFontWeight:Q6},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:Z6,labelFontSize:J6,symbolType:"square",titleFont:Qx,titleFontSize:e8,titleFontWeight:Q6},range:{category:Gh["category-6"],diverging:Gh["fireandice-6"],heatmap:Gh["fire-7"],ordinal:Gh["fire-7"],ramp:Gh["fire-7"]}},Ll="#ab5787",vm="#979797",mwe={background:"#f9f9f9",arc:{fill:Ll},area:{fill:Ll},line:{stroke:Ll},path:{stroke:Ll},rect:{fill:Ll},shape:{stroke:Ll},symbol:{fill:Ll,size:30},axis:{domainColor:vm,domainWidth:.5,gridWidth:.2,labelColor:vm,tickColor:vm,tickWidth:.2,titleColor:vm},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"]}},Il="#3e5c69",vwe={background:"#fff",arc:{fill:Il},area:{fill:Il},line:{stroke:Il},path:{stroke:Il},rect:{fill:Il},shape:{stroke:Il},symbol:{fill:Il},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"]}},as="#1696d2",t8="#000000",ywe="#FFFFFF",ym="Lato",e_="Lato",bwe="Lato",xwe="#DEDDDD",_we=18,Yh={"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"]},wwe={background:ywe,title:{anchor:"start",fontSize:_we,font:ym},axisX:{domain:!0,domainColor:t8,domainWidth:1,grid:!1,labelFontSize:12,labelFont:e_,labelAngle:0,tickColor:t8,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:ym},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:xwe,gridWidth:1,labelFontSize:12,labelFont:e_,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:ym,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:e_,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:ym,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:Yh["six-groups-cat-1"],diverging:Yh["diverging-colors"],heatmap:Yh["diverging-colors"],ordinal:Yh["six-groups-seq"],ramp:Yh["shades-blue"]},area:{fill:as},rect:{fill:as},line:{color:as,stroke:as,strokeWidth:5},trail:{color:as,stroke:as,strokeWidth:0,size:1},path:{stroke:as,strokeWidth:.5},point:{filled:!0},text:{font:bwe,color:as,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:as,stroke:null}},arc:{fill:as},shape:{stroke:as},symbol:{fill:as,size:30}},Pl="#3366CC",n8="#ccc",bm="Arial, sans-serif",Ewe={arc:{fill:Pl},area:{fill:Pl},path:{stroke:Pl},rect:{fill:Pl},shape:{stroke:Pl},symbol:{stroke:Pl},circle:{fill:Pl},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:bm,fontSize:12},"guide-title":{font:bm,fontSize:12},"group-title":{font:bm,fontSize:12}},title:{font:bm,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:n8,tickColor:n8,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},J$=e=>e*(1/3+1),r8=J$(9),i8=J$(10),s8=J$(12),Vh="Segoe UI",o8="wf_standard-font, helvetica, arial, sans-serif",a8="#252423",Xh="#605E5C",u8="transparent",Awe="#C8C6C4",Ps="#118DFF",kwe="#12239E",Swe="#E66C37",Cwe="#6B007B",$we="#E044A7",Fwe="#744EC2",Dwe="#D9B300",Mwe="#D64550",GU=Ps,YU="#DEEFFF",l8=[YU,GU],Twe=[YU,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",GU],Rwe={view:{stroke:u8},background:u8,font:Vh,header:{titleFont:o8,titleFontSize:s8,titleColor:a8,labelFont:Vh,labelFontSize:i8,labelColor:Xh},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Xh,labelFontSize:r8,titleFont:o8,titleColor:a8,titleFontSize:s8,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:Awe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Ps},line:{stroke:Ps,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Vh,fontSize:r8,fill:Xh},arc:{fill:Ps},area:{fill:Ps,line:!0,opacity:.6},path:{stroke:Ps},rect:{fill:Ps},point:{fill:Ps,filled:!0,size:75},shape:{stroke:Ps},symbol:{fill:Ps,strokeWidth:1.5,size:50},legend:{titleFont:Vh,titleFontWeight:"bold",titleColor:Xh,labelFont:Vh,labelFontSize:i8,labelColor:Xh,symbolType:"circle",symbolSize:75},range:{category:[Ps,kwe,Swe,Cwe,$we,Fwe,Dwe,Mwe],diverging:l8,heatmap:l8,ordinal:Twe}},t_='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',Nwe='IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',n_=400,xm={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"}},Owe=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Lwe=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function l2({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",r=xm.gridBg[e],i=xm.textPrimary[e],s=xm.textSecondary[e],o=n==="dark"?Owe:Lwe,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:t_,fontWeight:600},axis:{labelColor:s,labelFontSize:12,labelFont:Nwe,labelFontWeight:n_,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:xm.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:t_,fill:s,fontWeight:n_},"guide-title":{font:t_,fill:s,fontWeight:n_}},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 Iwe=l2({theme:"white",background:"#ffffff"}),Pwe=l2({theme:"g10",background:"#f4f4f4"}),Bwe=l2({theme:"g90",background:"#262626"}),zwe=l2({theme:"g100",background:"#161616"}),jwe=swe.version,Uwe=Object.freeze(Object.defineProperty({__proto__:null,carbong10:Pwe,carbong100:zwe,carbong90:Bwe,carbonwhite:Iwe,dark:owe,excel:awe,fivethirtyeight:cwe,ggplot2:fwe,googlecharts:Ewe,latimes:gwe,powerbi:Rwe,quartz:mwe,urbaninstitute:wwe,version:jwe,vox:vwe},Symbol.toStringTag,{value:"Module"}));function qwe(e,t,n,r){if(oe(e))return`[${e.map(i=>t(De(i)?i:c8(i,n))).join(", ")}]`;if(Fe(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&&(Fe(c)&&(c=c8(c,n)),i+=``)}i+="
      ${t(l)}${t(c)}
      "}return i||"{}"}return t(e)}function Wwe(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 c8(e,t){return JSON.stringify(e,Wwe(t))}var Hwe=`#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 VU="vg-tooltip-element",Gwe={offsetX:10,offsetY:10,id:VU,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:Ywe,maxDepth:2,formatTooltip:qwe,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function Ywe(e){return String(e).replace(/&/g,"&").replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function Zwe(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 Jwe{constructor(t){this.options={...Gwe,...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=Vwe(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"?Xwe(t,n,r,this.el.getBoundingClientRect(),this.options):XU(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${s}px`}}var r_={};/*! * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017-2022 Joachim Wester * MIT licensed */var Qwe=(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)}})(),eEe=Object.prototype.hasOwnProperty;function tA(e,t){return eEe.call(e,t)}function nA(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 jl(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function JU(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function iA(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&&!rA(h))throw new Fn("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);rA(h)&&(h=~~h)}if(c>=f){if(n&&t.op==="add"&&h>l.length)throw new Fn("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=nEe[t.op].call(t,l,h,e);if(o.test===!1)throw new Fn("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}}else if(c>=f){var o=Bf[t.op].call(t,l,h,e);if(o.test===!1)throw new Fn("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}if(l=l[h],n&&c0)throw new Fn('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 Fn("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 Fn("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")&&iA(e.value))throw new Fn("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 Fn("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 Fn("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=eq([o],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Fn("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new Fn("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function eq(e,t,n){try{if(!Array.isArray(e))throw new Fn("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)c2(Vi(t),Vi(e),n||!0);else{n=n||Gv;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function eF(e,t,n,r,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=nA(t),o=nA(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(tA(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)?eF(c,f,n,r+"/"+jl(l),i):c!==f&&(i&&n.push({op:"test",path:r+"/"+jl(l),value:Vi(c)}),n.push({op:"replace",path:r+"/"+jl(l),value:Vi(f)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+jl(l),value:Vi(c)}),n.push({op:"remove",path:r+"/"+jl(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 i_=e,i_}var s_,h8;function tF(){if(h8)return s_;h8=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return s_=r=>r?typeof r!="object"?e:r:t,s_}var _m={exports:{}},o_,p8;function nF(){if(p8)return o_;p8=1;const e="2.0.0",t=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,r=16,i=t-6;return o_={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},o_}var a_,g8;function f2(){return g8||(g8=1,a_=typeof process=="object"&&r_&&r_.NODE_DEBUG&&/\bsemver\b/i.test(r_.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),a_}var m8;function rF(){return m8||(m8=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=nF(),s=f2();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 b=h(m),x=c++;s(g,x,m),l[g]=x,u[x]=m,o[x]=new RegExp(m,v?"g":void 0),a[x]=new RegExp(b,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*$")})(_m,_m.exports)),_m.exports}var u_,v8;function mEe(){if(v8)return u_;v8=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)},u_}var l_,y8;function iF(){if(y8)return l_;y8=1;const e=f2(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=nF(),{safeRe:r,t:i}=rF(),s=tF(),{compareIdentifiers:o}=mEe();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 l_=a,l_}var c_,b8;function wh(){if(b8)return c_;b8=1;const e=iF();return c_=(n,r,i)=>new e(n,i).compare(new e(r,i)),c_}var f_,x8;function vEe(){if(x8)return f_;x8=1;const e=wh();return f_=(n,r,i)=>e(n,r,i)===0,f_}var d_,_8;function yEe(){if(_8)return d_;_8=1;const e=wh();return d_=(n,r,i)=>e(n,r,i)!==0,d_}var h_,w8;function bEe(){if(w8)return h_;w8=1;const e=wh();return h_=(n,r,i)=>e(n,r,i)>0,h_}var p_,E8;function xEe(){if(E8)return p_;E8=1;const e=wh();return p_=(n,r,i)=>e(n,r,i)>=0,p_}var g_,A8;function _Ee(){if(A8)return g_;A8=1;const e=wh();return g_=(n,r,i)=>e(n,r,i)<0,g_}var m_,k8;function wEe(){if(k8)return m_;k8=1;const e=wh();return m_=(n,r,i)=>e(n,r,i)<=0,m_}var v_,S8;function EEe(){if(S8)return v_;S8=1;const e=vEe(),t=yEe(),n=bEe(),r=xEe(),i=_Ee(),s=wEe();return v_=(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}`)}},v_}var y_,C8;function AEe(){if(C8)return y_;C8=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(">")))}}y_=t;const n=tF(),{safeRe:r,t:i}=rF(),s=EEe(),o=f2(),a=iF(),u=tq();return y_}var b_,$8;function tq(){if($8)return b_;$8=1;const e=/\s+/g;class t{constructor(k,F){if(F=i(F),k instanceof t)return k.loose===!!F.loose&&k.includePrerelease===!!F.includePrerelease?k:new t(k.raw,F);if(k instanceof s)return this.raw=k.value,this.set=[[k]],this.formatted=void 0,this;if(this.options=F,this.loose=!!F.loose,this.includePrerelease=!!F.includePrerelease,this.raw=k.trim().replace(e," "),this.set=this.raw.split("||").map(I=>this.parseRange(I.trim())).filter(I=>I.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const I=this.set[0];if(this.set=this.set.filter(B=>!g(B[0])),this.set.length===0)this.set=[I];else if(this.set.length>1){for(const B of this.set)if(B.length===1&&m(B[0])){this.set=[B];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let k=0;k0&&(this.formatted+="||");const F=this.set[k];for(let I=0;I0&&(this.formatted+=" "),this.formatted+=F[I].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(k){const I=((this.options.includePrerelease&&h)|(this.options.loose&&p))+":"+k,B=r.get(I);if(B)return B;const O=this.options.loose,j=O?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];k=k.replace(j,N(this.options.includePrerelease)),o("hyphen replace",k),k=k.replace(u[l.COMPARATORTRIM],c),o("comparator trim",k),k=k.replace(u[l.TILDETRIM],f),o("tilde trim",k),k=k.replace(u[l.CARETTRIM],d),o("caret trim",k);let Y=k.split(" ").map(ge=>b(ge,this.options)).join(" ").split(/\s+/).map(ge=>M(ge,this.options));O&&(Y=Y.filter(ge=>(o("loose invalid filter",ge,this.options),!!ge.match(u[l.COMPARATORLOOSE])))),o("range list",Y);const te=new Map,ce=Y.map(ge=>new s(ge,this.options));for(const ge of ce){if(g(ge))return[ge];te.set(ge.value,ge)}te.size>1&&te.has("")&&te.delete("");const Ae=[...te.values()];return r.set(I,Ae),Ae}intersects(k,F){if(!(k instanceof t))throw new TypeError("a Range is required");return this.set.some(I=>v(I,F)&&k.set.some(B=>v(B,F)&&I.every(O=>B.every(j=>O.intersects(j,F)))))}test(k){if(!k)return!1;if(typeof k=="string")try{k=new a(k,this.options)}catch{return!1}for(let F=0;FT.value==="<0.0.0-0",m=T=>T.value==="",v=(T,k)=>{let F=!0;const I=T.slice();let B=I.pop();for(;F&&I.length;)F=I.every(O=>B.intersects(O,k)),B=I.pop();return F},b=(T,k)=>(o("comp",T,k),T=A(T,k),o("caret",T),T=_(T,k),o("tildes",T),T=S(T,k),o("xrange",T),T=$(T,k),o("stars",T),T),x=T=>!T||T.toLowerCase()==="x"||T==="*",_=(T,k)=>T.trim().split(/\s+/).map(F=>w(F,k)).join(" "),w=(T,k)=>{const F=k.loose?u[l.TILDELOOSE]:u[l.TILDE];return T.replace(F,(I,B,O,j,Y)=>{o("tilde",T,I,B,O,j,Y);let te;return x(B)?te="":x(O)?te=`>=${B}.0.0 <${+B+1}.0.0-0`:x(j)?te=`>=${B}.${O}.0 <${B}.${+O+1}.0-0`:Y?(o("replaceTilde pr",Y),te=`>=${B}.${O}.${j}-${Y} <${B}.${+O+1}.0-0`):te=`>=${B}.${O}.${j} <${B}.${+O+1}.0-0`,o("tilde return",te),te})},A=(T,k)=>T.trim().split(/\s+/).map(F=>E(F,k)).join(" "),E=(T,k)=>{o("caret",T,k);const F=k.loose?u[l.CARETLOOSE]:u[l.CARET],I=k.includePrerelease?"-0":"";return T.replace(F,(B,O,j,Y,te)=>{o("caret",T,B,O,j,Y,te);let ce;return x(O)?ce="":x(j)?ce=`>=${O}.0.0${I} <${+O+1}.0.0-0`:x(Y)?O==="0"?ce=`>=${O}.${j}.0${I} <${O}.${+j+1}.0-0`:ce=`>=${O}.${j}.0${I} <${+O+1}.0.0-0`:te?(o("replaceCaret pr",te),O==="0"?j==="0"?ce=`>=${O}.${j}.${Y}-${te} <${O}.${j}.${+Y+1}-0`:ce=`>=${O}.${j}.${Y}-${te} <${O}.${+j+1}.0-0`:ce=`>=${O}.${j}.${Y}-${te} <${+O+1}.0.0-0`):(o("no pr"),O==="0"?j==="0"?ce=`>=${O}.${j}.${Y}${I} <${O}.${j}.${+Y+1}-0`:ce=`>=${O}.${j}.${Y}${I} <${O}.${+j+1}.0-0`:ce=`>=${O}.${j}.${Y} <${+O+1}.0.0-0`),o("caret return",ce),ce})},S=(T,k)=>(o("replaceXRanges",T,k),T.split(/\s+/).map(F=>C(F,k)).join(" ")),C=(T,k)=>{T=T.trim();const F=k.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return T.replace(F,(I,B,O,j,Y,te)=>{o("xRange",T,I,B,O,j,Y,te);const ce=x(O),Ae=ce||x(j),ge=Ae||x(Y),Ie=ge;return B==="="&&Ie&&(B=""),te=k.includePrerelease?"-0":"",ce?B===">"||B==="<"?I="<0.0.0-0":I="*":B&&Ie?(Ae&&(j=0),Y=0,B===">"?(B=">=",Ae?(O=+O+1,j=0,Y=0):(j=+j+1,Y=0)):B==="<="&&(B="<",Ae?O=+O+1:j=+j+1),B==="<"&&(te="-0"),I=`${B+O}.${j}.${Y}${te}`):Ae?I=`>=${O}.0.0${te} <${+O+1}.0.0-0`:ge&&(I=`>=${O}.${j}.0${te} <${O}.${+j+1}.0-0`),o("xRange return",I),I})},$=(T,k)=>(o("replaceStars",T,k),T.trim().replace(u[l.STAR],"")),M=(T,k)=>(o("replaceGTE0",T,k),T.trim().replace(u[k.includePrerelease?l.GTE0PRE:l.GTE0],"")),N=T=>(k,F,I,B,O,j,Y,te,ce,Ae,ge,Ie)=>(x(I)?F="":x(B)?F=`>=${I}.0.0${T?"-0":""}`:x(O)?F=`>=${I}.${B}.0${T?"-0":""}`:j?F=`>=${F}`:F=`>=${F}${T?"-0":""}`,x(ce)?te="":x(Ae)?te=`<${+ce+1}.0.0-0`:x(ge)?te=`<${ce}.${+Ae+1}.0-0`:Ie?te=`<=${ce}.${Ae}.${ge}-${Ie}`:T?te=`<${ce}.${Ae}.${+ge+1}-0`:te=`<=${te}`,`${F} ${te}`.trim()),L=(T,k,F)=>{for(let I=0;I0){const B=T[I].semver;if(B.major===k.major&&B.minor===k.minor&&B.patch===k.patch)return!0}return!1}return!0};return b_}var x_,F8;function kEe(){if(F8)return x_;F8=1;const e=tq();return x_=(n,r,i)=>{try{r=new e(r,i)}catch{return!1}return r.test(n)},x_}var SEe=kEe(),nq=pEe(SEe);function CEe(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 $Ee=`.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 rq(e,...t){for(const n of t)FEe(e,n);return e}function FEe(e,t){for(const n of Object.keys(t))Jd(e,n,t[n],!0)}const ko=ige;let Ag=rwe;const wm=typeof window<"u"?window:void 0;var nT;Ag===void 0&&((nT=wm==null?void 0:wm.vl)!=null&&nT.compile)&&(Ag=wm.vl);const DEe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},MEe={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"},wp={vega:"Vega","vega-lite":"Vega-Lite"},Yv={vega:ko.version,"vega-lite":Ag?Ag.version:"not available"},TEe={vega:e=>e,"vega-lite":(e,t)=>Ag.compile(e,{config:t}).spec},REe=` `,NEe="chart-wrapper";function OEe(e){return typeof e=="function"}function D8(e,t,n,r){const i=`${t}
      `,s=`
      ${n}`,o=window.open("");o.document.write(i+e+s),o.document.title=`${wp[r]} JSON Source`}function LEe(e,t){if(e.$schema){const n=HU(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${wp[n.library]}, but mode argument sets ${wp[t]??t}.`);const r=n.library;return nq(Yv[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${wp[r]} ${n.version}, but the current version of ${wp[r]} is v${Yv[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 iq(e){return!!(e&&"load"in e)}function M8(e){return iq(e)?e:ko.loader(e)}function IEe(e){var n;const t=((n=e.usermeta)==null?void 0:n.embedOptions)??{};return De(t.defaultStyle)&&(t.defaultStyle=!1),t}async function sq(e,t,n={}){let r,i;De(t)?(i=M8(n.loader),r=JSON.parse(await i.load(t))):r=t;const s=IEe(r),o=s.loader;(!i||o)&&(i=M8(n.loader??o));const a=await T8(s,i),u=await T8(n,i),l={...rq(u,a),config:Zd(u.config??{},a.config??{})};return await BEe(e,r,l,i)}async function T8(e,t){const n=De(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=De(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function PEe(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 BEe(e,t,n={},r){const i=n.theme?Zd(Uwe[n.theme],n.config??{}):n.config,s=ul(n.actions)?n.actions:rq({},DEe,n.actions??{}),o={...MEe,...n.i18n},a=n.renderer??"canvas",u=n.logLevel??ko.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 w="vega-embed-style",{root:A,rootContainer:E}=PEe(c);if(!A.getElementById(w)){const S=document.createElement("style");S.id=w,S.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?$Ee.toString():n.defaultStyle,E.appendChild(S)}}const f=LEe(t,n.mode);let d=TEe[f](t,i);if(f==="vega-lite"&&d.$schema){const w=HU(d.$schema);nq(Yv.vega,`^${w.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${w.version}, but current version is v${Yv.vega}.`)}c.classList.add("vega-embed"),s&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(s){const w=document.createElement("div");w.classList.add(NEe),c.appendChild(w),h=w}const p=n.patch;if(p&&(d=p instanceof Function?p(d):c2(d,p,!0,!1).newDocument),n.formatLocale&&ko.formatLocale(n.formatLocale),n.timeFormatLocale&&ko.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const w in n.expressionFunctions){const A=n.expressionFunctions[w];"fn"in A?ko.expressionFunction(w,A.fn,A.visitor):A instanceof Function&&ko.expressionFunction(w,A)}const{ast:g}=n,m=ko.parse(d,f==="vega-lite"?{}:i,{ast:g}),v=new(n.viewClass||ko.View)(m,{loader:r,logLevel:u,renderer:a,...g?{expr:ko.expressionInterpreter??n.expr??pge}:{}});if(v.addSignalListener("autosize",(w,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:w,tooltip:A}=n,E=w&&!iq(w)?w==null?void 0:w.baseURL:void 0,S=OEe(A)?A:new Jwe({baseURL:E,...A===!0?{}:A}).call;v.tooltip(S)}let{hover:b}=n;if(b===void 0&&(b=f==="vega"),b){const{hoverSet:w,updateSet:A}=typeof b=="boolean"?{}:b;v.hover(w,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 x;if(s!==!1){let w=c;if(n.defaultStyle!==!1||n.forceActionsMenu){const E=document.createElement("details");E.title=o.CLICK_TO_VIEW_ACTIONS,c.append(E),w=E;const S=document.createElement("summary");S.innerHTML=REe,E.append(S),x=C=>{E.contains(C.target)||E.removeAttribute("open")},document.addEventListener("click",x)}const A=document.createElement("div");if(w.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`],C=document.createElement("a"),$=Fe(n.scaleFactor)?n.scaleFactor[E]:n.scaleFactor;C.text=S,C.href="#",C.target="_blank",C.download=`${l}.${E}`,C.addEventListener("mousedown",async function(M){M.preventDefault();const N=await v.toImageURL(E,$);this.href=N}),A.append(C)}}if(s===!0||s.source!==!1){const E=document.createElement("a");E.text=o.SOURCE_ACTION,E.href="#",E.addEventListener("click",function(S){D8($2(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){D8($2(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(C){CEe(window,E,{config:i,mode:p?"vega":f,renderer:a,spec:$2(p?d:t)}),C.preventDefault()}),A.append(S)}}function _(){x&&document.removeEventListener("click",x),v.finalize()}return{view:v,spec:t,vgSpec:d,finalize:_,embedOptions:n}}function R8(e,t,n){return!e||e.length===0?[]:t||e.length<=n?e:e.slice(0,n)}var zEe=q('
      '),jEe=q(''),UEe=q(' '),qEe=q(''),WEe=q('
      '),HEe=q(' '),GEe=q('
      '),YEe=q('
      ',1),VEe=q(''),XEe=q(' '),KEe=q(''),ZEe=q('
      '),JEe=q(' '),QEe=q('
      '),eAe=q('
      '),tAe=q('
      ',1);function Vv(e,t){xn(t,!0);let n=re(t,"data",19,()=>[]),r=re(t,"x",3,"step"),i=re(t,"y",3,""),s=re(t,"colorField",3,"run"),o=re(t,"colorDisplayField",3,""),a=re(t,"colorLabel",3,""),u=re(t,"dashField",3,""),l=re(t,"dashLabel",3,""),c=re(t,"yLabel",3,""),f=re(t,"colorMap",19,()=>({})),d=re(t,"title",3,""),h=re(t,"xLim",3,null),p=re(t,"yExtent",3,void 0),g=re(t,"onSelect",3,null),m=re(t,"onResetZoom",3,null),v=re(t,"draggable",3,!1),b=re(t,"ondragstart",3,null),x=re(t,"ondragover",3,null),_=re(t,"ondrop",3,null),w=ae(null),A=ae(null),E=ae(null),S=ae(null),C=ae(!1),$=null,M=!1,N=_e(()=>a()||s()),L=_e(()=>l()||u()),T=_e(()=>c()||(i().includes("/")?i().split("/").pop():i())),k=_e(()=>{if(!s()||!n()||n().length===0)return[];const Z=new Set,X=[];for(const Be of n()){const rt=Be[s()];rt&&!Z.has(rt)&&(Z.add(rt),X.push({key:rt,name:Be[o()]||rt,color:f()[rt]||"#999"}))}return X}),F=_e(()=>iR(n(),s(),f()));const I=6;let B=ae(!1),O=ae(!1),j=_e(()=>R8(y(k),y(B),I)),Y=_e(()=>R8(y(k),y(O),I)),te=_e(()=>{if(!u()||!n()||n().length===0)return[];const Z=new Set,X=[],Be=[[1,0],[12,4],[3,2],[10,3,2,3],[2,2],[14,4,2,4],[6,4,1,4],[16,5],[4,2,1,2],[2,1]];for(const rt of n()){const kt=rt[u()];kt&&!Z.has(kt)&&(Z.add(kt),X.push({name:kt,pattern:Be[X.length%Be.length]}))}return X}),ce=_e(()=>{if(!u()||!n()||n().length===0)return"";const Z=y(te).map(X=>`${X.name}:${X.pattern.join(",")}`);return Z.sort(),Z.join("|")});function Ae(Z,X){return getComputedStyle(document.documentElement).getPropertyValue(Z).trim()||X}function ge(){const Z=n().filter(Be=>Be.data_type==="original"||!Be.data_type),X=n().filter(Be=>Be.data_type==="smoothed");return{originalData:Z,smoothedData:X,hasSmoothed:X.length>0}}function Ie(Z){const X=Z.map(Be=>Be[r()]).filter(Be=>Be!=null);if(h())return[h()[0],h()[1]];if(X.length>0)return[Math.min(...X),Math.max(...X)]}function tt(){const Z=s()&&n().length>0&&Object.hasOwn(n()[0],s()),X=u()&&n().length>0&&Object.hasOwn(n()[0],u()),Be=Z?[...new Set(n().map(He=>He[s()]))]:[],rt=[...new Set(Be)],kt=rt,ut=rt.map(He=>f()[He]||"#999"),{originalData:bt,smoothedData:Pt,hasSmoothed:Ht}=ge();M=Ht;const pn=Ie(bt),qe={field:r(),type:"quantitative",scale:{zero:!1,...pn?{domain:pn}:{}}},ot={field:i(),type:"quantitative",...p()?{scale:{domain:p()}}:{}},Yt=Z?{color:{field:s(),type:"nominal",scale:{domain:kt,range:ut},legend:null}}:{},wn=X?{strokeDash:{field:u(),type:"nominal",scale:{domain:y(te).map(He=>He.name),range:y(te).map(He=>He.pattern)},legend:null}}:{},Ot=[],xt=(He={})=>({type:"line",clip:!0,strokeWidth:2.25,...He}),Zt=y(T),Bt=[];Z&&Bt.push({field:o()||s(),type:"nominal",title:y(N)}),X&&Bt.push({field:u(),type:"nominal",title:y(L)}),Bt.push({field:r(),type:"quantitative",title:r()},{field:i(),type:"quantitative",title:Zt});const Pn=[{name:"hover",select:{type:"point",on:"pointerover",nearest:!0,clear:"pointerout"}}],St=(He,gn)=>({...He,mark:{type:"circle",clip:!0,size:60,opacity:0},encoding:{x:qe,y:ot,...Yt,tooltip:Bt,opacity:{condition:{param:"hover",empty:!1,value:1},value:0}},params:Pn,name:gn});return Ht?(Ot.push({data:{name:"data_original",values:bt},mark:xt({strokeWidth:1,opacity:.3}),encoding:{x:qe,y:ot,...Yt,...wn},name:"original"}),Ot.push({data:{name:"data_smoothed",values:Pt},mark:xt(),encoding:{x:qe,y:ot,...Yt,...wn},name:"plot"}),Ot.push(St({data:{name:"data_smoothed",values:Pt}},"hover_points"))):(Ot.push({data:{name:"data_plot",values:n()},mark:xt(),encoding:{x:qe,y:ot,...Yt,...wn},name:"plot"}),Ot.push(St({data:{name:"data_plot",values:n()}},"hover_points"))),{$schema:"https://vega.github.io/schema/vega-lite/v5.json",title:{text:d(),fontSize:13,color:Ae("--body-text-color","#374151")},width:"container",height:y(C)?"container":250,autosize:{type:"fit",contains:"padding"},layer:Ot,...g()?{params:[{name:"brush",select:{type:"interval",encodings:["x"],mark:{fill:"gray",fillOpacity:.3,stroke:"none"}},views:["plot"]}]}:{},config:{background:"transparent",axis:{labelColor:Ae("--body-text-color-subdued","#6b7280"),titleColor:Ae("--body-text-color","#374151"),gridColor:Ae("--border-color-primary","#f3f4f6")},view:{stroke:"transparent"},mark:{cursor:g()?"crosshair":void 0}},encoding:{y:{title:Zt}}}}function nt(){const{originalData:Z}=ge(),X=Ie(Z),Be=X?`${X[0]},${X[1]}`:"auto",rt=p()?`${p()[0]},${p()[1]}`:"auto";return`${i()}\0${r()}\0${y(F)}\0${y(ce)}\0${d()}\0${y(C)}\0${!!g()}\0${Be}\0${rt}`}function ue(Z,X,Be){const rt=ll().remove(Qi).insert(Be);Z.change(X,rt)}function Ne(){if(!y(S))return!1;const{originalData:Z,smoothedData:X,hasSmoothed:Be}=ge();if(Be!==M)return!1;try{return Be?(ue(y(S),"data_original",Z),ue(y(S),"data_smoothed",X)):ue(y(S),"data_plot",n()),y(S).run(),M=Be,!0}catch{return!1}}async function Q(){if(await qi(),!y(w)||!n()||n().length===0||!i())return;const Z=tt();try{y(S)&&(y(S).finalize(),R(S,null));const X=await sq(y(w),Z,{actions:!1,renderer:"canvas"});if(R(S,X.view,!0),$=nt(),requestAnimationFrame(()=>{X.view.resize()}),g()){let Be=0,rt=null;X.view.addSignalListener("brush",(kt,ut)=>{if(Date.now()-Be<1e3||!ut||Object.keys(ut).length===0)return;clearTimeout(rt);const bt=ut[Object.keys(ut)[0]];!bt||bt.length!==2||(rt=setTimeout(()=>{Be=Date.now(),g()(bt)},250))})}}catch(X){console.error("Vega render error:",X)}}async function W(){if(!y(w)||!n()||n().length===0||!i())return;const Z=nt();y(S)&&Z===$&&Ne()||await Q()}function xe(){if(!n()||n().length===0)return;const Z=n().filter(Ht=>Ht.data_type==="original"||!Ht.data_type);if(Z.length===0)return;const X=Object.keys(Z[0]).filter(Ht=>Ht!=="data_type"),Be=X.map(Ht=>/[,"]/.test(Ht)?`"${Ht.replace(/"/g,'""')}"`:Ht).join(","),rt=Z.map(Ht=>X.map(pn=>{const qe=Ht[pn];return qe==null?"":typeof qe=="string"&&(qe.includes(",")||qe.includes('"'))?`"${qe.replace(/"/g,'""')}"`:qe}).join(",")),kt=[Be,...rt].join(` `),ut=new Blob([kt],{type:"text/csv"}),bt=URL.createObjectURL(ut),Pt=document.createElement("a");Pt.href=bt,Pt.download=`${(i()||"data").replace(/\//g,"_")}.csv`,document.body.appendChild(Pt),Pt.click(),document.body.removeChild(Pt),URL.revokeObjectURL(bt)}async function ke(){if(y(S))try{const Z=await y(S).toImageURL("png",4),X=document.createElement("a");X.href=Z,X.download=`${(i()||"chart").replace(/\//g,"_")}.png`,document.body.appendChild(X),X.click(),document.body.removeChild(X)}catch(Z){console.error("Failed to export image:",Z)}}function Te(Z){if(!Z)return Promise.reject(new Error("no element"));const X=Z.requestFullscreen||Z.webkitRequestFullscreen||Z.mozRequestFullScreen||Z.msRequestFullscreen;return X?X.call(Z):Promise.reject(new Error("no fullscreen"))}function G(){const Z=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;return Z?Z.call(document):Promise.resolve()}function H(Z){const X=document.getElementById("vg-tooltip-element");X&&Z&&X.parentElement!==Z&&Z.appendChild(X)}async function fe(){var Z;R(C,!0),document.body.style.overflow="hidden",await qi(),await qi();try{await Te(y(E)),await qi(),H(y(E)),(Z=y(S))==null||Z.resize()}catch{document.body.style.overflow="",R(C,!1)}}async function Pe(){try{await G()}catch{}document.body.style.overflow="",R(C,!1),H(document.body)}async function U(){y(C)?await Pe():await fe()}function V(){const Z=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;!Z&&y(C)&&(document.body.style.overflow="",R(C,!1),H(document.body)),Z&&y(C)&&qi().then(()=>{var X;return(X=y(S))==null?void 0:X.resize()})}function K(Z){Z.key==="Escape"&&y(C)&&Pe()}Kt(()=>{n(),i(),r(),y(F),y(ce),h(),p(),d(),y(C),y(w),W()}),Kt(()=>{if(!y(w))return;const Z=new ResizeObserver(()=>{queueMicrotask(()=>{var X;(X=y(S))==null||X.resize()})});return Z.observe(y(w)),()=>Z.disconnect()}),Xd(()=>(document.addEventListener("fullscreenchange",V),document.addEventListener("webkitfullscreenchange",V),document.addEventListener("mozfullscreenchange",V),document.addEventListener("MSFullscreenChange",V),()=>{document.removeEventListener("fullscreenchange",V),document.removeEventListener("webkitfullscreenchange",V),document.removeEventListener("mozfullscreenchange",V),document.removeEventListener("MSFullscreenChange",V),y(S)&&y(S).finalize(),document.body.style.overflow=""}));function de(Z){b()&&b()(Z)}var $e=tAe();mr("keydown",Wp,K);var Je=Tt($e);let Qe;var Oe=D(Je),et=D(Oe),Xe=P(et,2),st=P(Xe,2),mt=P(Oe,2);{var Dt=Z=>{var X=zEe();z(Z,X)};he(mt,Z=>{v()&&Z(Dt)})}var le=P(mt,2);{var Re=Z=>{var X=YEe(),Be=Tt(X),rt=D(Be);Hi(rt,qe=>R(w,qe),()=>y(w));var kt=P(rt,2);{var ut=qe=>{var ot=jEe();We("click",ot,Yt=>{Yt.stopPropagation(),m()()}),z(qe,ot)};he(kt,qe=>{h()&&m()&&qe(ut)})}var bt=P(Be,2);{var Pt=qe=>{var ot=WEe(),Yt=D(ot);gt(Yt,17,()=>y(j),pt,(xt,Zt)=>{var Bt=UEe(),Pn=D(Bt),St=P(Pn,2),He=D(St);ye(()=>{Uu(Pn,`background: ${y(Zt).color??""}`),we(He,y(Zt).name)}),z(xt,Bt)});var wn=P(Yt,2);{var Ot=xt=>{var Zt=qEe(),Bt=D(Zt);ye(()=>we(Bt,y(B)?"Show less":`+${y(k).length-I} more`)),We("click",Zt,Pn=>{Pn.stopPropagation(),R(B,!y(B))}),z(xt,Zt)};he(wn,xt=>{y(k).length>I&&xt(Ot)})}z(qe,ot)};he(bt,qe=>{y(k).length>0&&qe(Pt)})}var Ht=P(bt,2);{var pn=qe=>{var ot=GEe(),Yt=D(ot),wn=D(Yt),Ot=P(Yt,2);gt(Ot,17,()=>y(te),pt,(xt,Zt)=>{var Bt=HEe(),Pn=D(Bt),St=D(Pn),He=P(Pn,2),gn=D(He);ye(mn=>{Et(St,"stroke-dasharray",mn),we(gn,y(Zt).name)},[()=>y(Zt).pattern.join(" ")]),z(xt,Bt)}),ye(()=>we(wn,y(L))),z(qe,ot)};he(Ht,qe=>{y(te).length>0&&qe(pn)})}z(Z,X)};he(le,Z=>{y(C)||Z(Re)})}Hi(Je,Z=>R(A,Z),()=>y(A));var lt=P(Je,2);{var nn=Z=>{var X=eAe(),Be=D(X),rt=D(Be),kt=P(rt,2),ut=P(kt,2),bt=P(Be,2),Pt=D(bt),Ht=D(Pt);Hi(Ht,xt=>R(w,xt),()=>y(w));var pn=P(Ht,2);{var qe=xt=>{var Zt=VEe();We("click",Zt,Bt=>{Bt.stopPropagation(),m()()}),z(xt,Zt)};he(pn,xt=>{h()&&m()&&xt(qe)})}var ot=P(bt,2);{var Yt=xt=>{var Zt=ZEe(),Bt=D(Zt);gt(Bt,17,()=>y(Y),pt,(He,gn)=>{var mn=XEe(),Cr=D(mn),Ni=P(Cr,2),is=D(Ni);ye(()=>{Uu(Cr,`background: ${y(gn).color??""}`),we(is,y(gn).name)}),z(He,mn)});var Pn=P(Bt,2);{var St=He=>{var gn=KEe(),mn=D(gn);ye(()=>we(mn,y(O)?"Show less":`+${y(k).length-I} more`)),We("click",gn,Cr=>{Cr.stopPropagation(),R(O,!y(O))}),z(He,gn)};he(Pn,He=>{y(k).length>I&&He(St)})}z(xt,Zt)};he(ot,xt=>{y(k).length>0&&xt(Yt)})}var wn=P(ot,2);{var Ot=xt=>{var Zt=QEe(),Bt=D(Zt),Pn=D(Bt),St=P(Bt,2);gt(St,17,()=>y(te),pt,(He,gn)=>{var mn=JEe(),Cr=D(mn),Ni=D(Cr),is=P(Cr,2),It=D(is);ye(Mt=>{Et(Ni,"stroke-dasharray",Mt),we(It,y(gn).name)},[()=>y(gn).pattern.join(" ")]),z(He,mn)}),ye(()=>we(Pn,y(L))),z(xt,Zt)};he(wn,xt=>{y(te).length>0&&xt(Ot)})}Hi(X,xt=>R(E,xt),()=>y(E)),We("click",rt,xe),We("click",kt,ke),We("click",ut,()=>Pe()),z(Z,X)};he(lt,Z=>{y(C)&&Z(nn)})}ye(()=>{Qe=rn(Je,1,"plot-container svelte-9thu1j",null,Qe,{"hidden-plot":y(C)}),Et(Je,"draggable",v()?"true":void 0)}),mr("dragstart",Je,function(...Z){var X;(X=v()?de:void 0)==null||X.apply(this,Z)}),mr("dragover",Je,function(...Z){var X;(X=v()?x():void 0)==null||X.apply(this,Z)}),mr("drop",Je,function(...Z){var X;(X=v()?_():void 0)==null||X.apply(this,Z)}),We("click",et,xe),We("click",Xe,ke),We("click",st,U),z(e,$e),_n()}ui(["click"]);var nAe=q('
      '),rAe=q(' '),iAe=q(''),sAe=q('
      '),oAe=q('
      ',1),aAe=q(' '),uAe=q(''),lAe=q('
      '),cAe=q(`
      `),fAe=q(`
      `,1);function N8(e,t){xn(t,!0);let n=re(t,"data",19,()=>[]),r=re(t,"y",3,""),i=re(t,"colorField",3,"run"),s=re(t,"colorDisplayField",3,""),o=re(t,"colorMap",19,()=>({})),a=re(t,"title",3,""),u=re(t,"draggable",3,!1),l=re(t,"ondragstart",3,null),c=re(t,"ondragover",3,null),f=re(t,"ondrop",3,null),d=ae(null),h=ae(null),p=ae(null),g=ae(null),m=ae(!1),v=_e(()=>{if(!i()||!n()||n().length===0)return[];const G=new Set,H=[];for(const fe of n()){const Pe=fe[i()];Pe&&!G.has(Pe)&&(G.add(Pe),H.push({key:Pe,name:fe[s()]||Pe,color:o()[Pe]||"#999"}))}return H}),b=_e(()=>iR(n(),i(),o()));const x=6;let _=ae(!1),w=ae(!1),A=_e(()=>y(_)||y(v).length<=x?y(v):y(v).slice(0,x)),E=_e(()=>y(w)||y(v).length<=x?y(v):y(v).slice(0,x));function S(){const G=new Map;for(const H of n()){if(H.data_type==="smoothed")continue;const fe=H[i()];fe&&H[r()]!=null&&G.set(fe,{run:fe,label:H[s()]||fe,value:H[r()]})}return Array.from(G.values())}function C(G,H){return getComputedStyle(document.documentElement).getPropertyValue(G).trim()||H}function $(G){const H=G.map(U=>U.run),fe=H.map(U=>o()[U]||"#999"),Pe=r().includes("/")?r().split("/").pop():r();return{$schema:"https://vega.github.io/schema/vega-lite/v5.json",title:{text:a(),fontSize:13,color:C("--body-text-color","#374151")},width:"container",height:y(m)?"container":250,autosize:{type:"fit",contains:"padding"},data:{values:G},mark:{type:"bar",cornerRadiusTopLeft:3,cornerRadiusTopRight:3},encoding:{x:{field:"run",type:"nominal",sort:H,axis:{labelExpr:"datum.label",labelAngle:H.length>4?-45:0,labelLimit:120},title:null},y:{field:"value",type:"quantitative",title:Pe,scale:{zero:!0}},color:{field:"run",type:"nominal",scale:{domain:H,range:fe},legend:null},tooltip:[{field:s()||"label",type:"nominal",title:"Run"},{field:"value",type:"quantitative",title:Pe}]},config:{background:"transparent",axis:{labelColor:C("--body-text-color-subdued","#6b7280"),titleColor:C("--body-text-color","#374151"),gridColor:C("--border-color-primary","#f3f4f6")},view:{stroke:"transparent"}}}}async function M(){if(await qi(),!y(d)||!n()||n().length===0||!r())return;const G=S();if(G.length===0)return;const H=$(G);try{y(g)&&(y(g).finalize(),R(g,null));const fe=await sq(y(d),H,{actions:!1,renderer:"canvas"});R(g,fe.view,!0),requestAnimationFrame(()=>{fe.view.resize()})}catch(fe){console.error("Vega render error:",fe)}}function N(){const G=S();if(G.length===0)return;const fe="run,"+(/[,"]/.test(r())?`"${r().replace(/"/g,'""')}"`:r()),Pe=G.map($e=>`${typeof $e.label=="string"&&($e.label.includes(",")||$e.label.includes('"'))?`"${$e.label.replace(/"/g,'""')}"`:$e.label},${$e.value}`),U=[fe,...Pe].join(` `),V=new Blob([U],{type:"text/csv"}),K=URL.createObjectURL(V),de=document.createElement("a");de.href=K,de.download=`${(r()||"data").replace(/\//g,"_")}.csv`,document.body.appendChild(de),de.click(),document.body.removeChild(de),URL.revokeObjectURL(K)}async function L(){if(y(g))try{const G=await y(g).toImageURL("png",4),H=document.createElement("a");H.href=G,H.download=`${(r()||"chart").replace(/\//g,"_")}.png`,document.body.appendChild(H),H.click(),document.body.removeChild(H)}catch(G){console.error("Failed to export image:",G)}}function T(G){if(!G)return Promise.reject(new Error("no element"));const H=G.requestFullscreen||G.webkitRequestFullscreen||G.mozRequestFullScreen||G.msRequestFullscreen;return H?H.call(G):Promise.reject(new Error("no fullscreen"))}function k(){const G=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;return G?G.call(document):Promise.resolve()}function F(G){const H=document.getElementById("vg-tooltip-element");H&&G&&H.parentElement!==G&&G.appendChild(H)}async function I(){var G;R(m,!0),document.body.style.overflow="hidden",await qi(),await qi();try{await T(y(p)),await qi(),F(y(p)),(G=y(g))==null||G.resize()}catch{document.body.style.overflow="",R(m,!1)}}async function B(){try{await k()}catch{}document.body.style.overflow="",R(m,!1),F(document.body)}async function O(){y(m)?await B():await I()}function j(){const G=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;!G&&y(m)&&(document.body.style.overflow="",R(m,!1),F(document.body)),G&&y(m)&&qi().then(()=>{var H;return(H=y(g))==null?void 0:H.resize()})}function Y(G){G.key==="Escape"&&y(m)&&B()}Kt(()=>{n(),r(),y(b),a(),y(m),y(d),M()}),Kt(()=>{if(!y(d))return;const G=new ResizeObserver(()=>{queueMicrotask(()=>{var H;(H=y(g))==null||H.resize()})});return G.observe(y(d)),()=>G.disconnect()}),Xd(()=>(document.addEventListener("fullscreenchange",j),document.addEventListener("webkitfullscreenchange",j),document.addEventListener("mozfullscreenchange",j),document.addEventListener("MSFullscreenChange",j),()=>{document.removeEventListener("fullscreenchange",j),document.removeEventListener("webkitfullscreenchange",j),document.removeEventListener("mozfullscreenchange",j),document.removeEventListener("MSFullscreenChange",j),y(g)&&y(g).finalize(),document.body.style.overflow=""}));function te(G){l()&&l()(G)}var ce=fAe();mr("keydown",Wp,Y);var Ae=Tt(ce);let ge;var Ie=D(Ae),tt=D(Ie),nt=P(tt,2),ue=P(nt,2),Ne=P(Ie,2);{var Q=G=>{var H=nAe();z(G,H)};he(Ne,G=>{u()&&G(Q)})}var W=P(Ne,2);{var xe=G=>{var H=oAe(),fe=Tt(H),Pe=D(fe);Hi(Pe,K=>R(d,K),()=>y(d));var U=P(fe,2);{var V=K=>{var de=sAe(),$e=D(de);gt($e,17,()=>y(A),pt,(Oe,et)=>{var Xe=rAe(),st=D(Xe),mt=P(st,2),Dt=D(mt);ye(()=>{Uu(st,`background: ${y(et).color??""}`),we(Dt,y(et).name)}),z(Oe,Xe)});var Je=P($e,2);{var Qe=Oe=>{var et=iAe(),Xe=D(et);ye(()=>we(Xe,y(_)?"Show less":`+${y(v).length-x} more`)),We("click",et,st=>{st.stopPropagation(),R(_,!y(_))}),z(Oe,et)};he(Je,Oe=>{y(v).length>x&&Oe(Qe)})}z(K,de)};he(U,K=>{y(v).length>0&&K(V)})}z(G,H)};he(W,G=>{y(m)||G(xe)})}Hi(Ae,G=>R(h,G),()=>y(h));var ke=P(Ae,2);{var Te=G=>{var H=cAe(),fe=D(H),Pe=D(fe),U=P(Pe,2),V=P(U,2),K=P(fe,2),de=D(K),$e=D(de);Hi($e,Oe=>R(d,Oe),()=>y(d));var Je=P(K,2);{var Qe=Oe=>{var et=lAe(),Xe=D(et);gt(Xe,17,()=>y(E),pt,(Dt,le)=>{var Re=aAe(),lt=D(Re),nn=P(lt,2),Z=D(nn);ye(()=>{Uu(lt,`background: ${y(le).color??""}`),we(Z,y(le).name)}),z(Dt,Re)});var st=P(Xe,2);{var mt=Dt=>{var le=uAe(),Re=D(le);ye(()=>we(Re,y(w)?"Show less":`+${y(v).length-x} more`)),We("click",le,lt=>{lt.stopPropagation(),R(w,!y(w))}),z(Dt,le)};he(st,Dt=>{y(v).length>x&&Dt(mt)})}z(Oe,et)};he(Je,Oe=>{y(v).length>0&&Oe(Qe)})}Hi(H,Oe=>R(p,Oe),()=>y(p)),We("click",Pe,N),We("click",U,L),We("click",V,()=>B()),z(G,H)};he(ke,G=>{y(m)&&G(Te)})}ye(()=>{ge=rn(Ae,1,"plot-container bar-plot svelte-1swghqy",null,ge,{"hidden-plot":y(m)}),Et(Ae,"draggable",u()?"true":void 0)}),mr("dragstart",Ae,function(...G){var H;(H=u()?te:void 0)==null||H.apply(this,G)}),mr("dragover",Ae,function(...G){var H;(H=u()?c():void 0)==null||H.apply(this,G)}),mr("drop",Ae,function(...G){var H;(H=u()?f():void 0)==null||H.apply(this,G)}),We("click",tt,N),We("click",nt,L),We("click",ue,O),z(e,ce),_n()}ui(["click"]);var dAe=q('
      '),hAe=q('
      '),pAe=q('
      ');function oA(e,t){xn(t,!0);let n=re(t,"label",3,""),r=re(t,"open",15,!0),i=re(t,"hidden",3,!1);function s(){r(!r())}var o=Qr(),a=Tt(o);{var u=c=>{var f=dAe(),d=D(f);{var h=p=>{var g=Qr(),m=Tt(g);DF(m,()=>t.children),z(p,g)};he(d,p=>{t.children&&p(h)})}z(c,f)},l=c=>{var f=pAe(),d=D(f),h=D(d);let p;var g=P(h,2),m=D(g),v=P(d,2);{var b=x=>{var _=hAe(),w=D(_);{var A=E=>{var S=Qr(),C=Tt(S);DF(C,()=>t.children),z(E,S)};he(w,E=>{t.children&&E(A)})}z(x,_)};he(v,x=>{r()&&x(b)})}ye(()=>{p=rn(h,1,"arrow svelte-1jep0a",null,p,{rotated:r()}),we(m,n())}),We("click",d,s),z(c,f)};he(a,c=>{i()?c(u):c(l,-1)})}z(e,o),_n()}ui(["click"]);EW();const oq="trackio_theme_preference";let a1=[];function gAe(e){return a1.push(e),()=>{a1=a1.filter(t=>t!==e)}}function mAe(){const e=sF();a1.forEach(t=>t(e))}const O8={"--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 qp(e){const t=document.documentElement;e==="dark"?(t.dataset.theme="dark",Object.entries(O8).forEach(([n,r])=>{t.style.setProperty(n,r)})):(delete t.dataset.theme,Object.keys(O8).forEach(n=>{t.style.removeProperty(n)})),mAe()}function sF(){return document.documentElement.dataset.theme==="dark"}function oF(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"default"}function aF(){return localStorage.getItem(oq)||"system"}function vAe(e){localStorage.setItem(oq,e),aq(e),uq(e==="system")}function aq(e){qp(e==="system"?oF():e==="dark"?"dark":"default")}let Em=!1;function L8(){aF()==="system"&&qp(oF())}function uq(e){const t=window.matchMedia("(prefers-color-scheme: dark)");e&&!Em?(t.addEventListener("change",L8),Em=!0):!e&&Em&&(t.removeEventListener("change",L8),Em=!1)}function yAe(){const e=new URLSearchParams(window.location.search).get("__theme");if(e){qp(e);return}const t=aF();aq(t),uq(t==="system")}var bAe=q('
      Loading
      ');function kl(e,t){xn(t,!1);const r=sF()||new URLSearchParams(window.location.search).get("__theme")==="dark"||oF()==="dark"?"/static/trackio/trackio_logo_dark.png":"/static/trackio/trackio_logo_light.png";EH();var i=bAe(),s=D(i),o=D(s),a=D(o),u=P(o,2),l=D(u);ye(()=>{Et(a,"src",r),Et(l,"src",r)}),z(e,i),_n()}const I8=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],Yl=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],xAe=["REQUIRED","OPTIONAL","REPEATED"],_Ae=["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"],wAe=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],lq=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],EAe=["SPHERICAL","VINCENTY","THOMAS","ANDOYER","KARNEY"];function aA(e){const t=Am(e);if(t.type===1)return{type:"Point",coordinates:uA(e,t)};if(t.type===2)return{type:"LineString",coordinates:lA(e,t)};if(t.type===3)return{type:"Polygon",coordinates:P8(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 uA(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(AAe(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(cq.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 AAe(e){const t=(e>>64n)-2440588n,n=e&0xffffffffffffffffn;return t*86400000000000n+n}function hq(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 pq(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 kAe(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 mq(e){let t=0;for(const{element:n}of e)n.repetition_type==="REPEATED"&&t++;return t}function uF(e){let t=0;for(const{element:n}of e.slice(1))n.repetition_type!=="REQUIRED"&&t++;return t}function SAe(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 CAe(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 vq(e){if(e.length!==2)return!1;const[,t]=e;return!(t.element.repetition_type==="REPEATED"||t.children.length)}const $Ae=0,z8=1,j8=2,U8=3,FAe=4,DAe=5,MAe=6,TAe=7,RAe=8,NAe=9,OAe=12;function h2(e){const t={};let n=0;for(;e.offset>4;n=s?n+s:yq(e),t[`field_${n}`]=cA(e,i)}return t}function cA(e,t){switch(t){case z8:return!0;case j8:return!1;case U8:return e.view.getInt8(e.offset++);case FAe:case DAe:return yq(e);case MAe:return fA(e);case TAe:{const n=e.view.getFloat64(e.offset,!0);return e.offset+=8,n}case RAe:{const n=mc(e),r=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n);return e.offset+=n,r}case NAe:{const n=e.view.getUint8(e.offset++),r=n&15;let i=n>>4;i===15&&(i=mc(e));const s=r===z8||r===j8,o=new Array(i);for(let a=0;a>>1^-(t&1)}function fA(e){const t=LAe(e);return t>>1n^-(t&1n)}function IAe(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),q8(c,{parsers:t,geoparquet:r})}else return q8(s,{parsers:t,geoparquet:r})}function q8(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={...d2,...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=h2({view:r,offset:o}),l=u.field_1,c=u.field_2.map(v=>({type:I8[v.field_1],type_length:v.field_2,repetition_type:xAe[v.field_3],name:So(v.field_4),num_children:v.field_5,converted_type:_Ae[v.field_6],scale:v.field_7,precision:v.field_8,field_id:v.field_9,logical_type:jAe(v.field_10)})),f=c.filter(v=>v.type),d=u.field_3,h=u.field_4.map(v=>{var b;return{columns:v.field_1.map((x,_)=>{var w,A,E;return{file_path:So(x.field_1),file_offset:x.field_2,meta_data:x.field_3&&{type:I8[x.field_3.field_1],encodings:(w=x.field_3.field_2)==null?void 0:w.map(S=>Yl[S]),path_in_schema:x.field_3.field_3.map(So),codec:wAe[x.field_3.field_4],num_values:x.field_3.field_5,total_uncompressed_size:x.field_3.field_6,total_compressed_size:x.field_3.field_7,key_value_metadata:(A=x.field_3.field_8)==null?void 0:A.map(S=>({key:So(S.field_1),value:So(S.field_2)})),data_page_offset:x.field_3.field_9,index_page_offset:x.field_3.field_10,dictionary_page_offset:x.field_3.field_11,statistics:UAe(x.field_3.field_12,f[_],t),encoding_stats:(E=x.field_3.field_13)==null?void 0:E.map(S=>({page_type:lq[S.field_1],encoding:Yl[S.field_2],count:S.field_3})),bloom_filter_offset:x.field_3.field_14,bloom_filter_length:x.field_3.field_15,size_statistics:x.field_3.field_16&&{unencoded_byte_array_data_bytes:x.field_3.field_16.field_1,repetition_level_histogram:x.field_3.field_16.field_2,definition_level_histogram:x.field_3.field_16.field_3},geospatial_statistics:x.field_3.field_17&&{bbox:x.field_3.field_17.field_1&&{xmin:x.field_3.field_17.field_1.field_1,xmax:x.field_3.field_17.field_1.field_2,ymin:x.field_3.field_17.field_1.field_3,ymax:x.field_3.field_17.field_1.field_4,zmin:x.field_3.field_17.field_1.field_5,zmax:x.field_3.field_17.field_1.field_6,mmin:x.field_3.field_17.field_1.field_7,mmax:x.field_3.field_17.field_1.field_8},geospatial_types:x.field_3.field_17.field_2}},offset_index_offset:x.field_4,offset_index_length:x.field_5,column_index_offset:x.field_6,column_index_length:x.field_7,crypto_metadata:x.field_8,encrypted_column_metadata:x.field_9}}),total_byte_size:v.field_2,num_rows:v.field_3,sorting_columns:(b=v.field_4)==null?void 0:b.map(x=>({column_idx:x.field_1,descending:x.field_2,nulls_first:x.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:So(v.field_1),value:So(v.field_2)})),g=So(u.field_6);return n&&IAe(c,p),{version:l,schema:c,num_rows:d,row_groups:h,key_value_metadata:p,created_by:g,metadata_length:s}}function dA({schema:e}){return gq(e,[])[0]}function jAe(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:W8(e.field_7.field_2)}:e!=null&&e.field_8?{type:"TIMESTAMP",isAdjustedToUTC:e.field_8.field_1,unit:W8(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:So(e.field_17.field_1)}:e!=null&&e.field_18?{type:"GEOGRAPHY",crs:So(e.field_18.field_1),algorithm:EAe[e.field_18.field_2]}:e}function W8(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 UAe(e,t,n){return e&&{max:km(e.field_1,t,n),min:km(e.field_2,t,n),null_count:e.field_3,distinct_count:e.field_4,max_value:km(e.field_5,t,n),min_value:km(e.field_6,t,n),is_max_value_exact:e.field_7,is_min_value_exact:e.field_8}}function km(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"?dq(e)*10**-(t.scale||0):(s==null?void 0:s.type)==="FLOAT16"?hq(e):e}function qAe(e){const t=h2(e);return{page_locations:t.field_1.map(WAe),unencoded_byte_array_data_bytes:t.field_2}}function WAe(e){return{offset:e.field_1,compressed_page_size:e.field_2,first_row_index:e.field_3}}function bq(e,t){for(let r=0;rn.split(".")[0])),[...new Set(t)]}function Ep(e,t,n=!0){return"$and"in t&&Array.isArray(t.$and)?t.$and.every(r=>Ep(e,r,n)):"$or"in t&&Array.isArray(t.$or)?t.$or.some(r=>Ep(e,r,n)):"$nor"in t&&Array.isArray(t.$nor)?!t.$nor.some(r=>Ep(e,r,n)):Object.entries(t).every(([r,i])=>{const s=HAe(e,r);return typeof i!="object"||i===null||Array.isArray(i)?Ya(s,i,n):Object.entries(i||{}).every(([o,a])=>o==="$gt"?s>a:o==="$gte"?s>=a:o==="$lt"?shA({rowGroup:e,physicalColumns:t,filter:s,strict:r}));if("$or"in n&&Array.isArray(n.$or))return n.$or.every(s=>hA({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"&&Ya(h,p,r)&&Ya(h,m,r)||g==="$in"&&Array.isArray(m)&&m.every(v=>vp)||g==="$nin"&&Array.isArray(m)&&Ya(h,p,r)&&m.includes(h))return!0}}return!1}function HAe(e,t){let n=e;for(const r of t.split("."))n=n==null?void 0:n[r];return n}const GAe=1<<21;function YAe({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=kAe(dA(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 lF=new TextDecoder,H8=new WeakMap;function _q(e,t=d2){if(Array.isArray(e))return e.map(n=>_q(n,t));if(typeof e!="object")return e;if("metadata"in e){const n=XAe(e.metadata),r=e.typed_value&&l1(e.typed_value,n,t),i=e.value&&kg(Xv(e.value),n,t);return r&&i?{...i,...r}:r??i}return e}function l1(e,t,n){if(e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Uint8Array)){if("typed_value"in e)return l1(e.typed_value,t,n);if("value"in e&&e.value instanceof Uint8Array)return kg(Xv(e.value),t,n);const r={};for(const[i,s]of Object.entries(e))r[i]=l1(s,t,n);return r}return e instanceof Uint8Array?kg(Xv(e),t,n):Array.isArray(e)?e.map(r=>l1(r,t,n)):e}function Xv(e){return{view:new DataView(e.buffer,e.byteOffset,e.byteLength),offset:0}}function XAe(e){let t=H8.get(e.buffer);t||(t=new Map,H8.set(e.buffer,t));const n=`${e.byteOffset}:${e.byteLength}`,r=t.get(n);if(r)return r;const i=Xv(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=vc(i,u),c=new Array(l+1);for(let p=0;p>2;if(i===0)return KAe(e,s,n);if(i===2)return ZAe(e,s,t,n);if(i===3)return JAe(e,s,t,n);const o=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,s);return e.offset+=s,lF.decode(o)}function KAe(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 __(e,4);case 9:return __(e,8);case 10:return __(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 G8(e);case 16:{const r=G8(e);return lF.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 ZAe(e,t,n,r){const i=(t&3)+1,s=(t>>2&3)+1,a=t>>4&1?vc(e,4):e.view.getUint8(e.offset++),u=new Array(a);for(let f=0;f>2&1,o=i+1,a=vc(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;eke(e,a,t,n,s),s+=a}}e.offset=i+r}function eke(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 kq(e,t,n,r){const i=nke(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&fke[l])+1,i+=l}if(i+u>n)throw new Error("snappy error literal exceeds input length");V8(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");V8(t,s-u,t,s,a),s+=a}}if(s!==r)throw new Error("premature end of input")}function hke(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=pke(o,t,i),{definitionLevels:l,numNulls:c}=gke(o,t,i),f=t.num_values-c;if(t.encoding==="PLAIN")a=cF(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"?(il(o,d,a),a=a.map(h=>!!h)):il(o,d,a,s.byteLength-o.offset)):a=new Uint8Array(f)}else if(t.encoding==="BYTE_STREAM_SPLIT")a=kq(o,f,n,r.type_length);else if(t.encoding==="DELTA_BINARY_PACKED")a=n==="INT32"?new Int32Array(f):new BigInt64Array(f),Sg(o,f,a);else if(t.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(f),Aq(o,f,a);else throw new Error(`parquet unsupported encoding: ${t.encoding}`);return{definitionLevels:l,repetitionLevels:u,dataPage:a}}function pke(e,t,n){if(n.length>1){const r=mq(n);if(r){const i=new Array(t.num_values);return il(e,p2(r),i),i}}return[]}function gke(e,t,n){const r=uF(n);if(!r)return{definitionLevels:[],numNulls:0};const i=new Array(t.num_values);il(e,p2(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 pA(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),dke(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 mke(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=vke(i,c,a);i.offset=c.repetition_levels_byte_length;const d=yke(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=pA(p,h,u,l));const g=new DataView(p.buffer,p.byteOffset,p.byteLength),m={view:g,offset:0};let v;const b=c.num_values-c.num_nulls;if(c.encoding==="PLAIN")v=cF(m,s,b,o.type_length);else if(c.encoding==="RLE")v=new Array(b),il(m,1,v),v=v.map(x=>!!x);else if(c.encoding==="PLAIN_DICTIONARY"||c.encoding==="RLE_DICTIONARY"){const x=g.getUint8(m.offset++);v=new Array(b),il(m,x,v,h-1)}else if(c.encoding==="DELTA_BINARY_PACKED")v=s==="INT32"?new Int32Array(b):new BigInt64Array(b),Sg(m,b,v);else if(c.encoding==="DELTA_LENGTH_BYTE_ARRAY")v=new Array(b),Aq(m,b,v);else if(c.encoding==="DELTA_BYTE_ARRAY")v=new Array(b),QAe(m,b,v);else if(c.encoding==="BYTE_STREAM_SPLIT")v=kq(m,b,s,o.type_length);else throw new Error(`parquet unsupported encoding: ${c.encoding}`);return{definitionLevels:d,repetitionLevels:f,dataPage:v}}function vke(e,t,n){const r=mq(n);if(!r)return[];const i=new Array(t.num_values);return il(e,p2(r),i,t.repetition_levels_byte_length),i}function yke(e,t,n){const r=uF(n);if(r){const i=new Array(t.num_values);return il(e,p2(r),i,t.definition_levels_byte_length),i}}function X8(e,{groupStart:t,selectStart:n,selectEnd:r},i,s){const{pathInSchema:o,schemaPath:a}=i,u=vq(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=bke(e);if(g.type==="DICTIONARY_PAGE"){const{data:m}=K8(e,g,i,c,void 0,0);m&&(c=fq(m,i))}else{const m=(f==null?void 0:f.length)||0,v=K8(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 K8(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&&vq(u))return{skipped:d.num_values};const h=pA(f,Number(t.uncompressed_page_size),l,c),{definitionLevels:p,repetitionLevels:g,dataPage:m}=hke(h,d,n),v=B8(m,r,d.encoding,n),b=Array.isArray(i)?i:[];return{skipped:0,data:Y8(b,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}=mke(f,t,n),m=B8(g,r,d.encoding,n),v=Array.isArray(i)?i:[];return{skipped:0,data:Y8(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=pA(f,Number(t.uncompressed_page_size),l,c),p={view:new DataView(h.buffer,h.byteOffset,h.byteLength),offset:0};return{skipped:0,data:cF(p,o,d.num_values,a.type_length)}}else throw new Error(`parquet unsupported page type: ${t.type}`)}function bke(e){const t=h2(e),n=lq[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:Yl[t.field_5.field_2],definition_level_encoding:Yl[t.field_5.field_3],repetition_level_encoding:Yl[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:Yl[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:Yl[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 xke(e,{metadata:t},n){const{file:r,compressors:i,utf8:s}=e,o=[],a={...d2,...e.parsers};for(const u of n.chunks){const{columnMetadata:l}=u,c=gq(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 X8(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=qAe({view:new DataView(d),offset:0}),{selectStart:p,selectEnd:g}=n,m=h.page_locations;let v=NaN,b=NaN,x=0;for(let C=0;Cp&&(Number.isNaN(v)&&(v=Number($.offset),x=M),b=Number($.offset)+$.compressed_page_size)}const _=await r.slice(v,b),w={view:new DataView(_),offset:0},A=x?{...n,groupStart:n.groupStart+x,selectStart:n.selectStart-x,selectEnd:n.selectEnd-x}:n,{data:E,skipped:S}=X8(w,A,f,e.onPage);return{data:E,skipped:x+S}})})}return{groupStart:n.groupStart,groupRows:n.groupRows,asyncColumns:o}}async function Z8({asyncColumns:e},t,n,r,i){const s=await Promise.all(e.map(async({data:f})=>{const d=await f;return{...d,data:xq(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 _ke(e,t,n){const{asyncColumns:r}=e;n={...d2,...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("."),xq(c))}))).then(()=>{Ap(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 wke(e){e.metadata??(e.metadata=await zAe(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=u1(a);if(l.length){const m=dA(e.metadata).children.map(b=>b.element.name),v=l.filter(b=>!m.includes(b));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=Eke(d);if(!s&&!i){for(const{asyncColumns:m}of h)for(const{data:v}of m)await v;return}const p=dA(e.metadata),g=h.map(m=>_ke(m,p,e.parsers));if(i)for(const m of g)for(const v of m.asyncColumns)v.data.then(({data:b,skipped:x})=>{let _=m.groupStart+x;for(const w of b)i({columnName:v.pathInSchema[0],columnData:w,rowStart:_,rowEnd:_+w.length}),_+=w.length});if(s){const m=[];for(const v of g){const b=Math.max(t-v.groupStart,0),x=Math.min((n??1/0)-v.groupStart,v.groupRows),_=o==="object"?await Z8(v,b,x,c,"object"):await Z8(v,b,x,r,"array");if(a){for(const w of _)if(Ep(w,a,u)){if(f&&r)for(const A of l)r.includes(A)||delete w[A];m.push(w)}}else bq(m,_)}s(m)}else for(const{asyncColumns:m}of g)for(const{data:v}of m)await v}function Eke(e){if(!e.metadata)throw new Error("parquet requires metadata");const t=YAe(e);return e.file=VAe(e.file,t),t.groups.map(n=>xke(e,t,n))}const Sm=new Map;function Ake(e){const t={};for(const n in e){const r=e[n];t[n]=typeof r=="bigint"?Number(r):r}return t}async function fF(e,t={}){if(Sm.has(e))return Sm.get(e);const n=await fetch(e,{headers:t});if(!n.ok){if(n.status===404)return Sm.set(e,[]),[];throw new Error(`Failed to fetch ${e}: ${n.status}`)}const r=await n.arrayBuffer();let i=[];return await wke({file:r,rowFormat:"object",onComplete:s=>{i=s.map(Ake)}}),Sm.set(e,i),i}let Sn=null,Cm=null,$m=null,Fm=null,Cf=null,$f=null,Eo=null;function pf(e){return Sn.bucket_id?`https://huggingface.co/buckets/${Sn.bucket_id}/resolve/${e}`:`https://huggingface.co/datasets/${Sn.dataset_id}/resolve/main/${e}`}function sl(){return Sn.hf_token?{Authorization:`Bearer ${Sn.hf_token}`}:{}}async function kke(e){Sn=e}function Ske(){return!Sn||Sn.mode!=="static"?null:Sn.bucket_id?{url:`https://huggingface.co/buckets/${Sn.bucket_id}`}:Sn.dataset_id?{url:`https://huggingface.co/datasets/${Sn.dataset_id}`}:null}async function Sq(){return Cm||(Cm=await fF(pf("metrics.parquet"),sl()),Cm)}async function Cke(){return $m||($m=await fF(pf("aux/system_metrics.parquet"),sl()),$m)}async function $ke(){return Fm||(Fm=await fF(pf("aux/configs.parquet"),sl()),Fm)}async function dF(){if(Cf)return Cf;const e=await fetch(pf("runs.json"),{headers:sl()});return e.ok?(Cf=await e.json(),Cf):(Cf=[],Cf)}async function Fke(){if($f)return $f;const e=await fetch(pf("settings.json"),{headers:sl()});return e.ok?($f=await e.json(),$f):($f={},$f)}const hF=new Set(["id","run_id","run_name","timestamp","step","log_id","space_id","created_at"]);function m2(e){return!e||e.length===0?{rows:[],columns:[]}:{rows:e,columns:Object.keys(e[0])}}function pF(e){return e==null?{name:null,id:null}:typeof e=="string"?{name:e,id:null}:{name:e.name??null,id:e.id??null}}function gF(e,t){const n=pF(t);return n.id!=null&&e.run_id!=null?e.run_id===n.id:n.name==null?!0:e.run_name===n.name}async function Dke(){return[Sn.project]}async function Mke(){return(await dF()).map(t=>({id:t.id??t.run_id??t.name,name:t.name,created_at:t.created_at??null,last_step:t.last_step??null,log_count:t.log_count??0}))}async function Tke(e,t){const n=await Sq(),{rows:r,columns:i}=m2(n),s=i.filter(u=>!hF.has(u)),o=r.filter(u=>gF(u,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 mF(e,t){const n=await Sq(),{rows:r}=m2(n);return r.filter(s=>gF(s,t)).map(s=>{const o={};for(const[a,u]of Object.entries(s))if(!hF.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})}function Rke(e){const t=[];function n(r){if(r!=null){if(Array.isArray(r)){r.forEach(n);return}if(typeof r=="object"){Object.values(r).forEach(n);return}t.push(String(r))}}return n(e.messages||[]),n(e.metadata||{}),t.join(" ").toLowerCase()}function Nke(e,t){switch(t){case"step_asc":return[...e].sort((n,r)=>(n.step??0)-(r.step??0));case"step_desc":return[...e].sort((n,r)=>(r.step??0)-(n.step??0));case"request_time_asc":return[...e].sort((n,r)=>String(n.timestamp||"").localeCompare(String(r.timestamp||"")));case"request_time_desc":default:return[...e].sort((n,r)=>String(r.timestamp||"").localeCompare(String(n.timestamp||"")))}}async function Oke(e,t,n={}){const r=await mF(e,t),i=pF(t),s=i.id||i.name||"run",o=[];function a(l){if(typeof l=="string"&&(l.startsWith("{")||l.startsWith("["))&&l.includes("_type"))try{return JSON.parse(l)}catch{return l}return l}for(const l of r)for(const[c,f]of Object.entries(l)){if(c==="step"||c==="timestamp")continue;const d=a(f),h=Array.isArray(d)?d:[d];for(let p=0;pc._search_text.includes(l))}return u=Nke(u,n.sort||"request_time_desc"),n.offset&&(u=u.slice(n.offset)),n.limit!=null&&(u=u.slice(0,n.limit)),u.map(({_search_text:l,...c})=>c)}async function Lke(){const e=await dF(),t=e.map(n=>n.last_step||0);return{project:Sn.project,num_runs:e.length,runs:e.map(n=>({id:n.id??n.run_id??n.name,name:n.name,created_at:n.created_at??null,last_step:n.last_step??null,log_count:n.log_count??0})),last_activity:t.length?Math.max(...t):null}}async function Ike(e,t){const n=await dF(),r=pF(t),i=n.find(c=>r.id!=null&&(c.id??c.run_id??c.name)!=null?(c.id??c.run_id??c.name)===r.id:c.name===r.name);if(!i)return{project:Sn.project,run:r.name,run_id:r.id,num_logs:0,metrics:[],config:null,last_step:null};const s=await Tke(Sn.project,t);let o=null;const a=await $ke(),{rows:u}=m2(a),l=u.find(c=>r.id!=null&&c.run_id!=null?c.run_id===r.id:c.run_name===r.name);if(l){o={};for(const[c,f]of Object.entries(l))c!=="id"&&c!=="run_name"&&c!=="created_at"&&(o[c]=f)}return{project:Sn.project,run:i.name,run_id:i.id??i.run_id??i.name,num_logs:i.log_count||0,metrics:s,config:o,last_step:i.last_step}}async function Pke(){return[]}async function Cq(e,t){const n=await Cke(),{rows:r}=m2(n);return r.filter(s=>gF(s,t)).map(s=>{const o={};for(const[a,u]of Object.entries(s))hF.has(a)||u!=null&&(o[a]=u);return o.timestamp=s.timestamp,o})}async function Bke(){const e=await Fke();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 zke(){if(Eo)return Eo;if(Sn.bucket_id){const r=await fetch(`https://huggingface.co/api/buckets/${Sn.bucket_id}/tree?prefix=media/files/&recursive=true`,{headers:sl()});if(!r.ok)return Eo=[],Eo;const i=await r.json();return Eo=(Array.isArray(i)?i:[]).filter(s=>s.type==="file").map(s=>({name:s.path.split("/").at(-1)??s.path,path:s.path.slice(6)})),Eo}const e=await fetch(`https://huggingface.co/api/datasets/${Sn.dataset_id}`,{headers:sl()});if(!e.ok)return Eo=[],Eo;const t=await e.json();return Eo=(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)})),Eo}async function jke(){return{allowed:!1}}async function Uke(){throw new Error("Not supported in static mode")}async function qke(){throw new Error("Not supported in static mode")}function $q(e){return Sn.project&&e.startsWith(Sn.project+"/")?e.slice(Sn.project.length+1):e}const w_=new Map;async function Wke(e){const t=$q(e),n=pf(`media/${t}`);if(w_.has(n))return w_.get(n);const r=await fetch(n,{headers:sl()});if(!r.ok)return n;const i=await r.blob(),s=URL.createObjectURL(i);return w_.set(n,s),s}function Fq(e){const t=$q(e);return pf(`media/${t}`)}let gA=0;function Dq(){return typeof window>"u"?!1:(window.location.hostname||"").toLowerCase().endsWith(".hf.space")}function Hke(){const e=Date.now()+12e3;gA=Math.max(gA,e)}function vF(){return Date.now()(Zf=e,e))),E_)}function Vke(){const e=sessionStorage.getItem("trackio_oauth_session");return e?{"x-trackio-oauth-session":e}:{}}async function di(e,t={}){const n=e.startsWith("/")?e.slice(1):e,r=`${v2}/api/${n}`,i=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...Vke()},body:JSON.stringify(t)});if(i.status===429&&Hke(),!i.ok)throw new Error(`API call ${e} failed: ${i.status}`);const s=await i.json();if(s.error)throw new Error(s.error);return s.data}async function Xke(){return await fr()?Dke():await di("/get_all_projects")}async function Kke(e){return await fr()?Mke():await di("/get_runs_for_project",{project:e})}function co(e){return e==null?{run:null,run_id:null}:typeof e=="string"?{run:e,run_id:null}:{run:e.name??null,run_id:e.id??null}}async function Rq(e,t){const n={project:e,...co(t)};return await fr()?mF(e,t):await di("/get_logs",n)}async function Zke(e,t){if(await fr()){const r=[];for(const i of t){const s=await mF(e,i);r.push({...co(i),logs:s})}return r}const n={project:e,runs:t.map(r=>co(r))};return await di("/get_logs_batch",n)}async function Jke(e,t,n={}){const r={project:e,...co(t),...n};return await fr()?Oke(e,t,n):await di("/get_traces",r)}async function Qke(e){return await fr()?Lke():await di("/get_project_summary",{project:e})}async function Nq(e,t){const n={project:e,...co(t)};return await fr()?Ike(e,t):await di("/get_run_summary",n)}async function Oq(e,t,n,r){const i={project:e,...co(t),level:n,since:r};return await fr()?Pke():await di("/get_alerts",i)}async function eSe(e,t){const n={project:e,...co(t)};return await fr()?Cq(e,t):await di("/get_system_logs",n)}async function J8(e,t){if(await fr()){const n=[];for(const r of t){const i=await Cq(e,r);n.push({...co(r),logs:i})}return n}return await di("/get_system_logs_batch",{project:e,runs:t.map(n=>co(n))})}async function tSe(){return await fr()?Bke():await di("/get_settings")}async function nSe(e){return await fr()?zke():await di("/get_project_files",{project:e})}async function rSe(){return await fr()?jke():await di("/get_run_mutation_status",{})}async function iSe(e,t){const n={project:e,...co(t)};return await fr()?Uke():await di("/delete_run",n)}async function sSe(e,t,n){const r=co(t);return await fr()?qke():await di("/rename_run",{project:e,old_name:r.run,run_id:r.run_id,new_name:n})}function oSe(e){Tq=e?e+"/":""}function bF(e){return Zf?Fq(e):`${v2}/file?path=${encodeURIComponent(`${Tq}${e}`)}`}function A_(e){return Zf?Fq(e):`${v2}/file?path=${encodeURIComponent(e)}`}async function aSe(){return await fr()?Ske():null}async function uSe(e){return Zf?Wke(e):bF(e)}var lSe=q('

      No projects

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

      '),cSe=q('

      No run selected

      Select one or more runs in the sidebar.

      '),fSe=q('

      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:

      '),dSe=q('
      '),hSe=q('
      '),pSe=q('
      ',1),gSe=q('
      ');function mSe(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"selectedRuns",19,()=>[]),i=re(t,"allRuns",19,()=>[]),s=re(t,"smoothing",3,10),o=re(t,"xAxis",3,"step"),a=re(t,"logScaleX",3,!1),u=re(t,"logScaleY",3,!1),l=re(t,"metricFilter",3,""),c=re(t,"showHeaders",3,!0),f=re(t,"appBootstrapReady",3,!1),d=re(t,"plotOrder",19,()=>[]),h=re(t,"realtimeEnabled",3,!0),p=re(t,"metricColumns",31,()=>ft([])),g=ae(ft([])),m=ae("step"),v=ae(ft([])),b=ae(ft(new Set)),x=ae(null),_=ae(!1),w=ae(ft({})),A=ae(ft({group:null,index:-1})),E=new Map,S=null;const C=64;let $=_e(()=>Ig(i())),M=_e(()=>{let Q=l()?TA(y(v),l()):y(v);return rR(Q,d())}),N=_e(()=>Object.keys(y(M))),L=_e(()=>{const Q=new Map,W=y(g),xe=y(m),ke=y(x);for(const Te of Object.values(y(M))){for(const G of Te.direct)Q.has(G)||Q.set(G,d1(W,xe,G,ke));for(const G of Object.values(Te.subgroups))for(const H of G)Q.has(H)||Q.set(H,d1(W,xe,H,ke))}return Q});function T(Q,W){const xe=y(w)[Q];if(!xe)return W;const ke=[];for(const Te of xe)W.includes(Te)&&ke.push(Te);for(const Te of W)ke.includes(Te)||ke.push(Te);return ke}function k(Q,W,xe){R(A,{group:Q,index:W},!0),xe.dataTransfer.effectAllowed="move",xe.dataTransfer.setData("text/plain","")}function F(Q,W,xe){y(A).group===Q&&(xe.preventDefault(),xe.dataTransfer.dropEffect="move")}function I(Q,W,xe,ke){if(ke.preventDefault(),y(A).group!==Q||y(A).index===W){R(A,{group:null,index:-1},!0);return}const Te=[...xe],[G]=Te.splice(y(A).index,1);Te.splice(W,0,G),R(w,{...y(w),[Q]:Te},!0),R(A,{group:null,index:-1},!0)}function B(){if(!n()||r().length===0){R(g,[],!0),R(v,[],!0);return}const Q=[];for(const G of r()){const H=E.get(G.id??G.name);if(!H)continue;const fe=YH(H,G,s(),o(),a(),u());fe&&(Q.push(...fe.rows),R(m,fe.xColumn,!0))}R(g,Q,!0);const W=Q.filter(G=>G.data_type==="original"||!G.data_type),xe=XH(W).filter(G=>G!==y(m)&&G!=="run"&&G!=="data_type"&&G!=="x_axis");R(v,xe,!0),p(xe);const ke=new Map;for(const G of W){const H=G.series_key;for(const fe of xe){if(G[fe]==null)continue;const Pe=`${fe}\0${H}`;ke.set(Pe,(ke.get(Pe)||0)+1)}}const Te=new Set(xe);for(const[G,H]of ke)H>1&&Te.delete(G.split("\0")[0]);R(b,Te,!0)}async function O(Q){const W=[];for(let xe=0;xe{const ke=xe.id??xe.name;return!E.has(ke)});let W=!1;if(Q.length>0)try{const xe=await O(Q);for(const ke of xe){const Te=ke.run_id??ke.run;E.set(Te,ke.logs),W=!0}}catch(xe){console.error("Failed to load metric logs:",xe)}(W||!y(_))&&B(),R(_,!0)}async function Y(){if(h()&&!(!n()||r().length===0)&&!yF()&&!vF())try{const Q=await O(r());let W=!1;for(const xe of Q){const ke=xe.run_id??xe.run,Te=xe.logs,G=E.get(ke);(!G||sR(G,Te))&&(E.set(ke,Te),W=!0)}W&&B()}catch(Q){console.error("Failed to refresh metric logs:",Q)}}Kt(()=>{n(),r(),f(),E=n()?E:new Map,j()}),Kt(()=>{s(),o(),a(),u(),y(_)&&B()}),Xd(()=>{const Q=gi("xmin"),W=gi("xmax");if(Q!=null&&Q!==""&&W!=null&&W!==""){const xe=parseFloat(Q),ke=parseFloat(W);!Number.isNaN(xe)&&!Number.isNaN(ke)&&xe{S&&clearInterval(S)}});function te(Q){Q&&Q.length===2&&R(x,Q,!0)}function ce(){R(x,null)}var Ae=gSe(),ge=D(Ae);{var Ie=Q=>{kl(Q,{})},tt=Q=>{var W=lSe();z(Q,W)},nt=Q=>{var W=cSe();z(Q,W)},ue=Q=>{var W=fSe(),xe=P(D(W),4),ke=D(xe);ke.textContent=`import trackio trackio.init(project="my-project")`;var Te=P(xe,4),G=D(Te);G.textContent=`for i in range(10): trackio.log({"loss": 1/(i+1)})`;var H=P(Te,4),fe=D(H);fe.textContent="trackio.finish()",z(Q,W)},Ne=Q=>{var W=Qr(),xe=Tt(W);gt(xe,17,()=>y(N),pt,(ke,Te)=>{const G=_e(()=>y(M)[y(Te)]),H=_e(()=>`${y(Te)}:direct`),fe=_e(()=>T(y(H),y(G).direct)),Pe=_e(()=>y(G).direct.length),U=_e(()=>Object.values(y(G).subgroups).reduce((K,de)=>K+de.length,0)),V=_e(()=>y(Pe)+y(U));{let K=_e(()=>!c());oA(ke,{get label(){return`${y(Te)??""} (${y(V)??""})`},open:!0,get hidden(){return y(K)},children:(de,$e)=>{var Je=pSe(),Qe=Tt(Je);{var Oe=Xe=>{var st=dSe();gt(st,21,()=>y(fe),pt,(mt,Dt,le)=>{const Re=_e(()=>y(L).get(y(Dt))??{data:[],yExtent:void 0}),lt=_e(()=>y(Re).data),nn=_e(()=>y(Re).yExtent),Z=_e(()=>y(b).has(y(Dt))),X=_e(()=>c()&&y(Dt).split("/").slice(1).join("/")||y(Dt));var Be=Qr(),rt=Tt(Be);{var kt=ut=>{var bt=Qr(),Pt=Tt(bt);{var Ht=qe=>{N8(qe,{get data(){return y(lt)},get y(){return y(Dt)},get title(){return y(X)},colorField:"series_key",colorDisplayField:"run",get colorMap(){return y($)},draggable:!0,ondragstart:ot=>k(y(H),le,ot),ondragover:ot=>F(y(H),le,ot),ondrop:ot=>I(y(H),le,y(fe),ot)})},pn=qe=>{Vv(qe,{get data(){return y(lt)},get x(){return y(m)},get y(){return y(Dt)},get title(){return y(X)},colorField:"series_key",colorDisplayField:"run",get colorMap(){return y($)},get xLim(){return y(x)},get yExtent(){return y(nn)},onSelect:te,onResetZoom:ce,draggable:!0,ondragstart:ot=>k(y(H),le,ot),ondragover:ot=>F(y(H),le,ot),ondrop:ot=>I(y(H),le,y(fe),ot)})};he(Pt,qe=>{y(Z)?qe(Ht):qe(pn,-1)})}z(ut,bt)};he(rt,ut=>{y(lt).length>0&&ut(kt)})}z(mt,Be)}),z(Xe,st)};he(Qe,Xe=>{y(fe).length>0&&Xe(Oe)})}var et=P(Qe,2);gt(et,21,()=>Object.entries(y(G).subgroups),pt,(Xe,st)=>{var mt=_e(()=>uT(y(st),2));let Dt=()=>y(mt)[0],le=()=>y(mt)[1];const Re=_e(()=>`${y(Te)}:${Dt()}`),lt=_e(()=>T(y(Re),le()));{let nn=_e(()=>!c());oA(Xe,{get label(){return`${Dt()??""} (${le().length??""})`},open:!0,get hidden(){return y(nn)},children:(Z,X)=>{var Be=hSe();gt(Be,21,()=>y(lt),pt,(rt,kt,ut)=>{const bt=_e(()=>y(L).get(y(kt))??{data:[],yExtent:void 0}),Pt=_e(()=>y(bt).data),Ht=_e(()=>y(bt).yExtent),pn=_e(()=>y(b).has(y(kt))),qe=_e(()=>c()&&y(kt).split("/").slice(2).join("/")||y(kt));var ot=Qr(),Yt=Tt(ot);{var wn=Ot=>{var xt=Qr(),Zt=Tt(xt);{var Bt=St=>{N8(St,{get data(){return y(Pt)},get y(){return y(kt)},get title(){return y(qe)},colorField:"series_key",colorDisplayField:"run",get colorMap(){return y($)},draggable:!0,ondragstart:He=>k(y(Re),ut,He),ondragover:He=>F(y(Re),ut,He),ondrop:He=>I(y(Re),ut,y(lt),He)})},Pn=St=>{Vv(St,{get data(){return y(Pt)},get x(){return y(m)},get y(){return y(kt)},get title(){return y(qe)},colorField:"series_key",colorDisplayField:"run",get colorMap(){return y($)},get xLim(){return y(x)},get yExtent(){return y(Ht)},onSelect:te,onResetZoom:ce,draggable:!0,ondragstart:He=>k(y(Re),ut,He),ondragover:He=>F(y(Re),ut,He),ondrop:He=>I(y(Re),ut,y(lt),He)})};he(Zt,St=>{y(pn)?St(Bt):St(Pn,-1)})}z(Ot,xt)};he(Yt,Ot=>{y(Pt).length>0&&Ot(wn)})}z(rt,ot)}),z(Z,Be)},$$slots:{default:!0}})}}),z(de,Je)},$$slots:{default:!0}})}}),z(Q,W)};he(ge,Q=>{!f()||!y(_)?Q(Ie):n()?r().length===0?Q(nt,2):y(g).length===0?Q(ue,3):Q(Ne,-1):Q(tt,1)})}z(e,Ae),_n()}var vSe=q('

      Select a project

      Pick a project to browse trace logs.

      '),ySe=q('

      No runs selected

      Select one or more runs in the sidebar to browse traces.

      '),bSe=q('

      No traces match the current filters

      Try a different search query or model filter.

      '),xSe=q(" "),_Se=q('tool calls'),wSe=q('function call'),ESe=q('
      Expand content
       
      '),ASe=q('
       
      '),kSe=q(''),SSe=q('
       
      '),CSe=q('
      '),$Se=q('
       
      '),FSe=q('
      '),DSe=q('
       
      '),MSe=q('
      '),TSe=q('
      '),RSe=q('
      ',1),NSe=q('
      Trace IDRequestRunStepRequest time
      '),OSe=q('
      ',1),LSe=q('
      ');function ISe(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"selectedRuns",19,()=>[]),i=ae(!1),s=ae(""),o=ae("request_time_desc"),a=ae(null),u=ae(ft([])),l=0;function c(k){return typeof k=="string"?k:Array.isArray(k)?k.map(F=>typeof F=="string"?F:typeof(F==null?void 0:F.text)=="string"?F.text:typeof(F==null?void 0:F.content)=="string"?F.content:(F==null?void 0:F._type)==="trackio.image"||(F==null?void 0:F.type)==="image"?"[image]":"").filter(Boolean).join(" "):typeof(k==null?void 0:k.text)=="string"?k.text:""}function f(k,F){const I=Array.isArray(k.messages)?k.messages:[],B=I.find(j=>(j==null?void 0:j.role)==="user"),O=I.find(j=>(j==null?void 0:j.role)==="assistant");return{...k,run:k.run||F,request:c(B==null?void 0:B.content)||"(no user message)",preview:c(O==null?void 0:O.content)||"(no assistant response)"}}function d(k,F){return[...k].sort((I,B)=>{switch(F){case"step_asc":return(I.step??0)-(B.step??0);case"step_desc":return(B.step??0)-(I.step??0);case"request_time_asc":return String(I.timestamp||"").localeCompare(String(B.timestamp||""));case"request_time_desc":default:return String(B.timestamp||"").localeCompare(String(I.timestamp||""))}})}async function h(k,F){const I=++l;if(!n()||r().length===0){R(u,[],!0),R(a,null);return}R(i,!0);try{const B=await Promise.all(r().map(async O=>(await Jke(n(),O,{search:k,sort:F})).map(Y=>f(Y,O.name))));if(I!==l)return;R(u,d(B.flat(),F),!0),y(u).find(O=>O.id===y(a))||R(a,null)}catch(B){if(I!==l)return;console.error("Failed to load traces:",B),R(u,[],!0)}finally{I===l&&R(i,!1)}}Kt(()=>{n(),r(),y(s),y(o);const k=setTimeout(()=>{h(y(s).trim(),y(o))},150);return()=>clearTimeout(k)});function p(k){R(a,y(a)===k?null:k,!0)}function g(k,F){(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),p(F))}function m(k){if(!k)return"—";const F=new Date(k);if(Number.isNaN(F.getTime()))return k;const B=new Date().getTime()-F.getTime(),O=Math.max(0,Math.round(B/1e3));if(O<5)return"just now";if(O<60)return`${O} sec ago`;const j=Math.round(O/60);if(j<60)return`${j} min ago`;const Y=Math.round(j/60);if(Y<24)return`${Y} hr ago`;const te=Math.round(Y/24);if(te<7)return`${te} day${te===1?"":"s"} ago`;const ce=Math.round(te/7);if(ce<5)return`${ce} wk ago`;const Ae=Math.round(te/30);return Ae<12?`${Ae} mo ago`:`${Math.round(te/365)} yr ago`}function v(k){const F=k==null?void 0:k.content;return typeof F=="string"||F==null?[]:Array.isArray(F)?F:[F]}function b(k){return v(k).length>0}function x(k){return(k==null?void 0:k._type)==="trackio.image"||(k==null?void 0:k.type)==="image"||(k==null?void 0:k.type)==="input_image"||(k==null?void 0:k.type)==="image_url"}function _(k){var F;return k!=null&&k.file_path?bF(k.file_path):(F=k==null?void 0:k.image_url)!=null&&F.url?k.image_url.url:typeof(k==null?void 0:k.url)=="string"?k.url:""}function w(k){return(k==null?void 0:k.caption)||(k==null?void 0:k.alt)||"Trace image"}function A(k){return typeof k=="string"&&k.length>500}function E(k){return Object.entries(k.metadata||{})}function S(){return y(s).trim()?`${y(u).length} match${y(u).length===1?"":"es"}`:`${y(u).length} trace${y(u).length===1?"":"s"}`}var C=LSe(),$=D(C);{var M=k=>{kl(k,{})},N=k=>{var F=vSe();z(k,F)},L=k=>{var F=ySe();z(k,F)},T=k=>{var F=OSe(),I=Tt(F),B=D(I),O=D(B),j=P(B,2),Y=P(D(j),2),te=D(Y);te.value=te.__value="request_time_desc";var ce=P(te);ce.value=ce.__value="request_time_asc";var Ae=P(ce);Ae.value=Ae.__value="step_desc";var ge=P(Ae);ge.value=ge.__value="step_asc";var Ie=P(j,2),tt=D(Ie),nt=P(I,2);{var ue=Q=>{var W=bSe();z(Q,W)},Ne=Q=>{var W=NSe(),xe=D(W),ke=P(D(xe));gt(ke,21,()=>y(u),pt,(Te,G)=>{var H=RSe(),fe=Tt(H),Pe=D(fe),U=D(Pe),V=D(U),K=P(Pe),de=D(K),$e=D(de),Je=P(de,2),Qe=D(Je),Oe=P(K),et=D(Oe),Xe=P(Oe),st=D(Xe),mt=P(Xe),Dt=D(mt),le=P(fe,2);{var Re=lt=>{var nn=TSe(),Z=D(nn),X=D(Z),Be=D(X),rt=D(Be),kt=D(rt),ut=P(rt,2),bt=D(ut),Pt=P(ut,2);gt(Pt,17,()=>E(y(G)),pt,(pn,qe)=>{var ot=_e(()=>uT(y(qe),2));let Yt=()=>y(ot)[0],wn=()=>y(ot)[1];var Ot=xSe(),xt=D(Ot);ye(()=>we(xt,`${Yt()??""}: ${wn()??""}`)),z(pn,Ot)});var Ht=P(Be,2);gt(Ht,21,()=>y(G).messages,pt,(pn,qe)=>{var ot=MSe(),Yt=D(ot),wn=D(Yt),Ot=P(wn);{var xt=It=>{var Mt=_Se();z(It,Mt)};he(Ot,It=>{var Mt;(Mt=y(qe).tool_calls)!=null&&Mt.length&&It(xt)})}var Zt=P(Ot,2);{var Bt=It=>{var Mt=wSe();z(It,Mt)};he(Zt,It=>{y(qe).function_call&&It(Bt)})}var Pn=P(Yt,2);{var St=It=>{var Mt=Qr(),Hr=Tt(Mt);{var En=Vt=>{var Rs=ESe(),jn=P(D(Rs),2),Zn=D(jn);ye(()=>we(Zn,y(qe).content)),z(Vt,Rs)},Kn=_e(()=>A(y(qe).content)),Oi=Vt=>{var Rs=ASe(),jn=D(Rs);ye(()=>we(jn,y(qe).content)),z(Vt,Rs)};he(Hr,Vt=>{y(Kn)?Vt(En):Vt(Oi,-1)})}z(It,Mt)},He=It=>{var Mt=CSe();gt(Mt,21,()=>v(y(qe)),pt,(Hr,En)=>{var Kn=Qr(),Oi=Tt(Kn);{var Vt=Zn=>{var ss=kSe();ye((Ns,Sl)=>{Et(ss,"src",Ns),Et(ss,"alt",Sl)},[()=>_(y(En)),()=>w(y(En))]),z(Zn,ss)},Rs=_e(()=>x(y(En))),jn=Zn=>{var ss=SSe(),Ns=D(ss);ye(Sl=>we(Ns,Sl),[()=>JSON.stringify(y(En),null,2)]),z(Zn,ss)};he(Oi,Zn=>{y(Rs)?Zn(Vt):Zn(jn,-1)})}z(Hr,Kn)}),z(It,Mt)},gn=_e(()=>b(y(qe)));he(Pn,It=>{typeof y(qe).content=="string"?It(St):y(gn)&&It(He,1)})}var mn=P(Pn,2);{var Cr=It=>{var Mt=FSe();gt(Mt,21,()=>y(qe).tool_calls,pt,(Hr,En)=>{var Kn=$Se(),Oi=D(Kn);ye(Vt=>we(Oi,Vt),[()=>JSON.stringify(y(En),null,2)]),z(Hr,Kn)}),z(It,Mt)};he(mn,It=>{var Mt;(Mt=y(qe).tool_calls)!=null&&Mt.length&&It(Cr)})}var Ni=P(mn,2);{var is=It=>{var Mt=DSe(),Hr=D(Mt);ye(En=>we(Hr,En),[()=>JSON.stringify(y(qe).function_call,null,2)]),z(It,Mt)};he(Ni,It=>{y(qe).function_call&&It(is)})}ye(()=>{Et(ot,"data-role",y(qe).role||"unknown"),we(wn,`${(y(qe).role||"message")??""} `)}),z(pn,ot)}),ye(()=>{we(kt,`Logged as: ${y(G).key??""}`),we(bt,`Timestamp: ${(y(G).timestamp||"—")??""}`)}),z(lt,nn)};he(le,lt=>{y(a)===y(G).id&<(Re)})}ye(lt=>{Et(fe,"aria-expanded",y(a)===y(G).id),we(V,y(G).id),we($e,y(G).request),we(Qe,y(G).preview),we(et,y(G).run||"—"),we(st,y(G).step??"—"),we(Dt,lt)},[()=>m(y(G).timestamp)]),We("click",fe,()=>p(y(G).id)),We("keydown",fe,lt=>g(lt,y(G).id)),z(Te,H)}),z(Q,W)};he(nt,Q=>{y(u).length===0?Q(ue):Q(Ne,-1)})}ye(Q=>we(tt,Q),[S]),Lg(O,()=>y(s),Q=>R(s,Q)),JT(Y,()=>y(o),Q=>R(o,Q)),z(k,F)};he($,k=>{y(i)?k(M):n()?r().length===0?k(L,2):k(T,-1):k(N,1)})}z(e,C),_n()}ui(["click","keydown"]);var PSe=q('

      Unable to load system metrics

      '),BSe=q('

      No projects

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

      '),zSe=q('

      No run selected

      Select one or more runs in the sidebar.

      '),jSe=q('

      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)
      '),USe=q('
      '),qSe=q('
      '),WSe=q(" ",1),HSe=q('
      ');function GSe(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"selectedRuns",19,()=>[]),i=re(t,"allRuns",19,()=>[]),s=re(t,"smoothing",3,5),o=re(t,"appBootstrapReady",3,!1),a=re(t,"realtimeEnabled",3,!0),u=re(t,"availableDevices",31,()=>ft([])),l=re(t,"selectedDevices",31,()=>ft([])),c=ae(ft([])),f=ae(ft([])),d=ae(null),h=ae(!1),p=ae(null),g=!0,m=ae(ft({})),v=ae(ft({group:null,index:-1}));const b=64;let x=new Map,_=null,w=_e(()=>Ig(i().length?i():r())),A=_e(()=>rR(y(f))),E=_e(()=>Object.keys(y(A))),S=_e(()=>{const U=new Map,V=y(d);for(const K of Object.values(y(A))){for(const de of K.direct)U.has(de)||U.set(de,d1(y(c),"time",de,V));for(const de of Object.values(K.subgroups))for(const $e of de)U.has($e)||U.set($e,d1(y(c),"time",$e,V))}return U}),C=_e(()=>{const U=[];for(const[V,K]of Object.entries(y(A)))for(const de of F(Object.keys(K.subgroups)))U.push(nt(V,de));return[...new Set(U)]}),$=_e(()=>{const U=new Map;for(const[V,K]of Object.entries(y(A)))U.set(V,Ne(V,K.subgroups));return U}),M=_e(()=>{const U=new Map,V=y(d);for(const[K,de]of y($).entries())for(const[$e,Je]of Object.entries(de)){const Qe=`sys:${K}:compare:${$e}`;U.set(Qe,Q(y(c),"time",Je,V))}return U});function N(U,V){const K=y(m)[U];if(!K)return V;const de=[];for(const $e of K)V.includes($e)&&de.push($e);for(const $e of V)de.includes($e)||de.push($e);return de}function L(U,V,K){R(v,{group:U,index:V},!0),K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("text/plain","")}function T(U,V,K){y(v).group===U&&(K.preventDefault(),K.dataTransfer.dropEffect="move")}function k(U,V,K,de){if(de.preventDefault(),y(v).group!==U||y(v).index===V){R(v,{group:null,index:-1},!0);return}const $e=[...K],[Je]=$e.splice(y(v).index,1);$e.splice(V,0,Je),R(m,{...y(m),[U]:$e},!0),R(v,{group:null,index:-1},!0)}function F(U){return[...U].sort((V,K)=>{const de=Number(V),$e=Number(K);return!Number.isNaN(de)&&!Number.isNaN($e)?de-$e:V.localeCompare(K)})}function I(U,V){return U.length!==V.length?!1:U.every((K,de)=>K===V[de])}function B(){if(!n()||r().length===0){R(c,[],!0),R(f,[],!0);return}const U=[],V=new Set;for(const K of r()){const de=K.id??K.name,$e=x.get(de);if(!$e||$e.length===0)continue;const Je=new Date($e[0].timestamp).getTime();$e.forEach(Qe=>{const Oe=(new Date(Qe.timestamp).getTime()-Je)/1e3;Object.keys(Qe).forEach(et=>{typeof Qe[et]=="number"&&et!=="step"&&et!=="time"&&V.add(et)}),U.push({...Qe,time:Oe,run:K.name,run_id:de,series_key:de,data_type:"original"})})}R(f,Array.from(V).sort(),!0),R(c,U,!0)}function O(U){const V=U&&U.message?String(U.message):"";return/\b(404|405|501)\b/.test(V)}async function j(U){if(g&&U.length<=b)try{return await J8(n(),U)}catch(K){if(!O(K))throw K;g=!1}if(g){const K=[];for(let de=0;de{const de=K.id??K.name;return!x.has(de)});let V=!1;if(U.length>0)try{const K=await j(U);for(const de of K){const $e=de.run_id??de.run;x.set($e,de.logs),V=!0}R(p,null)}catch(K){if(console.error("Failed to load system metric logs:",K),!y(h)){R(p,K&&K.message?K.message:"Failed to load system metrics",!0);return}}(V||!y(h))&&B(),R(p,null),R(h,!0)}async function te(){if(a()&&!(!n()||r().length===0)&&!yF()&&!vF())try{const U=await j(r());let V=!1;for(const K of U){const de=K.run_id??K.run,$e=K.logs,Je=x.get(de);(!Je||sR(Je,$e))&&(x.set(de,$e),V=!0)}V&&B()}catch(U){console.error("Failed to refresh system metric logs:",U)}}Kt(()=>{n(),r(),o(),x=n()?x:new Map,Y()}),Kt(()=>{s(),y(h)&&B()}),Kt(()=>{const U=u(),V=y(C),K=l().filter(de=>V.includes(de));if(I(u(),V)||u(V),V.length===0){l().length>0&&l([]);return}if(U.length===0&&l().length===0){I(l(),V)||l([...V]);return}if(l().length>0&&K.length!==l().length){const de=K.length>0?K:[...V];I(l(),de)||l(de)}}),Xd(()=>(_=setInterval(te,Mq()),()=>{_&&clearInterval(_)}));function ce(U){U&&U.length===2&&R(d,U,!0)}function Ae(){R(d,null)}const ge={utilization:"%",mean_utilization:"%",allocated_memory:"GiB",total_allocated_memory:"GiB",power:"W",total_power:"W",temp:"°C",max_temp:"°C"};function Ie(U){const V=U.split("/").pop(),K=ge[V];return K?`${U} (${K})`:U}function tt(U,V=1){const K=U.split("/").slice(V).join("/")||U;return Ie(K)}function nt(U,V){return U==="gpu"?`GPU ${V}`:`${U.toUpperCase()} ${V}`}function ue(U,V){return nt(U,V)}function Ne(U,V){const K={},de=F(Object.keys(V)).filter(Je=>{const Qe=ue(U,Je);return l().length===0||l().includes(Qe)});for(const Je of de)for(const Qe of V[Je]??[]){const Oe=Qe.split("/").slice(2).join("/");Oe&&(K[Oe]||(K[Oe]=[]),K[Oe].push(Qe))}const $e={};return Object.keys(K).sort().forEach(Je=>{$e[Je]=K[Je]}),$e}function Q(U,V,K,de){if(!K||K.length===0)return{data:[],yExtent:void 0};let $e=[];for(const Oe of K){const[et,Xe]=Oe.split("/");for(const st of U){const mt=st[Oe];mt!=null&&$e.push({[V]:st[V],value:mt,seriesKey:`${st.series_key}\0${et}\0${Xe}`,run:st.run,series_key:st.series_key,device:ue(et,Xe),data_type:st.data_type})}}if(de){const Oe=new Map;for(const Xe of $e){const st=`${Xe.seriesKey}\0${Xe.data_type||"original"}`;Oe.has(st)||Oe.set(st,[]),Oe.get(st).push(Xe)}const et=[];for(const Xe of Oe.values()){Xe.sort((Dt,le)=>Dt[V]-le[V]);let st=0,mt=Xe.length-1;for(;st=0&&Xe[mt][V]>de[1];)mt--;st=Math.max(0,st-1),mt=Math.min(Xe.length-1,mt+1),et.push(...Xe.slice(st,mt+1))}$e=et}const Je=$e.filter(Oe=>Oe.data_type==="original"||!Oe.data_type);let Qe;if(Je.length>0){let Oe=1/0,et=-1/0;for(const Xe of Je)Xe.valueet&&(et=Xe.value);Oe!==1/0&&(Qe=[Oe,et])}return{data:nR($e,V,"value","seriesKey",de,["seriesKey","run","series_key","device"]).data,yExtent:Qe}}var W=HSe(),xe=D(W);{var ke=U=>{kl(U,{})},Te=U=>{var V=PSe(),K=P(D(V),2),de=D(K);ye(()=>we(de,y(p))),z(U,V)},G=U=>{var V=BSe();z(U,V)},H=U=>{var V=zSe();z(U,V)},fe=U=>{var V=jSe(),K=P(D(V),4),de=D(K);de.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()`,z(U,V)},Pe=U=>{var V=Qr(),K=Tt(V);gt(K,17,()=>y(E),pt,(de,$e)=>{const Je=_e(()=>y(A)[y($e)]),Qe=_e(()=>`sys:${y($e)}`),Oe=_e(()=>`sys:${y($e)}:compare`),et=_e(()=>N(y(Qe),y(Je).direct)),Xe=_e(()=>y($).get(y($e))??{}),st=_e(()=>N(y(Oe),Object.keys(y(Xe))));oA(de,{get label(){return y($e)},open:!0,children:(mt,Dt)=>{var le=WSe(),Re=Tt(le);{var lt=X=>{var Be=USe();gt(Be,21,()=>y(et),pt,(rt,kt,ut)=>{const bt=_e(()=>y(S).get(y(kt))??{data:[],yExtent:void 0}),Pt=_e(()=>y(bt).data),Ht=_e(()=>y(bt).yExtent);var pn=Qr(),qe=Tt(pn);{var ot=Yt=>{{let wn=_e(()=>tt(y(kt),1));Vv(Yt,{get data(){return y(Pt)},x:"time",get y(){return y(kt)},get title(){return y(wn)},get colorMap(){return y(w)},colorField:"series_key",colorDisplayField:"run",get xLim(){return y(d)},get yExtent(){return y(Ht)},onSelect:ce,onResetZoom:Ae,draggable:!0,ondragstart:Ot=>L(y(Qe),ut,Ot),ondragover:Ot=>T(y(Qe),ut,Ot),ondrop:Ot=>k(y(Qe),ut,y(et),Ot)})}};he(qe,Yt=>{y(Pt).length>0&&Yt(ot)})}z(rt,pn)}),z(X,Be)};he(Re,X=>{y(et).length>0&&X(lt)})}var nn=P(Re,2);{var Z=X=>{var Be=qSe(),rt=D(Be);gt(rt,21,()=>y(st),pt,(kt,ut,bt)=>{const Pt=_e(()=>`sys:${y($e)}:compare:${y(ut)}`),Ht=_e(()=>y(M).get(y(Pt))??{data:[],yExtent:void 0}),pn=_e(()=>y(Ht).data),qe=_e(()=>y(Ht).yExtent);var ot=Qr(),Yt=Tt(ot);{var wn=Ot=>{{let xt=_e(()=>Ie(y(ut))),Zt=_e(()=>Ie(y(ut)));Vv(Ot,{get data(){return y(pn)},x:"time",y:"value",get yLabel(){return y(xt)},get title(){return y(Zt)},colorField:"series_key",colorDisplayField:"run",colorLabel:"Run",get colorMap(){return y(w)},dashField:"device",dashLabel:"Device",get xLim(){return y(d)},get yExtent(){return y(qe)},onSelect:ce,onResetZoom:Ae,draggable:!0,ondragstart:Bt=>L(y(Oe),bt,Bt),ondragover:Bt=>T(y(Oe),bt,Bt),ondrop:Bt=>k(y(Oe),bt,y(st),Bt)})}};he(Yt,Ot=>{y(pn).length>0&&Ot(wn)})}z(kt,ot)}),z(X,Be)};he(nn,X=>{y(st).length>0&&X(Z)})}z(mt,le)},$$slots:{default:!0}})}),z(U,V)};he(xe,U=>{!o()||!y(h)&&!y(p)?U(ke):y(p)&&!y(h)?U(Te,1):n()?r().length===0?U(H,3):y(c).length===0?U(fe,4):U(Pe,-1):U(G,2)})}z(e,W),_n()}var YSe=li(''),VSe=li(''),XSe=q('
      ');function KSe(e,t){xn(t,!0);let n=re(t,"src",3,"");const r=72;let i,s,o=ae(ft([])),a=ae(0),u=ae(0),l=ae(!1),c=ae(!1);function f(C){if(!Number.isFinite(C)||C<0)return"0:00";const $=Math.floor(C/60),M=Math.floor(C%60);return`${$}:${M.toString().padStart(2,"0")}`}async function d(){var C;if(n()){R(c,!1);try{const M=await(await fetch(n())).arrayBuffer(),N=window.AudioContext||window.webkitAudioContext,L=new N,T=await L.decodeAudioData(M);R(a,T.duration,!0);const k=T.getChannelData(0),F=Math.max(1,Math.floor(k.length/r)),I=new Array(r);for(let O=0;OO/B),!0),(C=L.close)==null||C.call(L)}catch{R(c,!0)}}}function h(){if(!i||y(o).length===0)return;const C=window.devicePixelRatio||1,$=i.getBoundingClientRect();if($.width===0)return;i.width=$.width*C,i.height=$.height*C;const M=i.getContext("2d");M.setTransform(C,0,0,C,0,0),M.clearRect(0,0,$.width,$.height);const N=getComputedStyle(i),L=(N.getPropertyValue("--wave-played")||"#f97316").trim(),T=(N.getPropertyValue("--wave-base")||"#9ca3af").trim(),k=y(a)>0?y(u)/y(a):0,F=$.width/y(o).length,I=$.height/2;for(let B=0;B{}):s.pause())}function g(C){if(!s||!y(a))return;const $=i.getBoundingClientRect(),M=C.clientX-$.left,N=Math.max(0,Math.min(y(a),M/$.width*y(a)));s.currentTime=N,R(u,N,!0)}Kt(()=>{n(),R(o,[],!0),R(u,0),R(a,0),R(l,!1),d()}),Kt(()=>{y(o),y(u),y(a),h()});var m=XSe();mr("resize",Wp,h);var v=D(m),b=D(v);{var x=C=>{var $=YSe();z(C,$)},_=C=>{var $=VSe();z(C,$)};he(b,C=>{y(l)?C(x):C(_,-1)})}var w=P(v,2);Hi(w,C=>i=C,()=>i);var A=P(w,2),E=D(A),S=P(A,2);Hi(S,C=>s=C,()=>s),ye((C,$)=>{Et(v,"aria-label",y(l)?"Pause":"Play"),v.disabled=y(c),we(E,`${C??""} / ${$??""}`),Et(S,"src",n())},[()=>f(y(u)),()=>f(y(a))]),We("click",v,p),We("click",w,g),mr("timeupdate",S,()=>R(u,s.currentTime,!0)),mr("loadedmetadata",S,()=>R(a,s.duration,!0)),mr("play",S,()=>R(l,!0)),mr("pause",S,()=>R(l,!1)),mr("ended",S,()=>{R(l,!1),R(u,0)}),z(e,m),_n()}ui(["click"]);var ZSe=q('

      Select a project

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

      ',1),JSe=q('

      No runs selected

      Select runs in the sidebar to browse media and tables.

      ',1),QSe=q('

      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),e3e=q('
      '),t3e=q('
      '),n3e=q('
      '),r3e=q(''),i3e=q('
      '),s3e=q('',2),o3e=q('
      '),a3e=q(''),u3e=q('
      '),l3e=q(' '),c3e=q(''),f3e=q(''),d3e=q('
      '),h3e=q(''),p3e=q(''),g3e=q('
      '),m3e=q('
      '),v3e=q(" ",1),y3e=q('
      ');function b3e(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"selectedRuns",19,()=>[]),i=re(t,"allRuns",19,()=>[]),s=re(t,"tableTruncateLength",3,250),o=_e(()=>Ig(i().length?i():r()));function a(x){return y(o)[x._runId]??y(o)[x._run]??"#9ca3af"}let u=ae(ft({images:[],videos:[],audios:[],tables:[]})),l=ae(!1);async function c(){if(!n()||r().length===0){R(u,{images:[],videos:[],audios:[],tables:[]},!0);return}R(l,!0);try{const x=r(),_=[];for(const $ of x){const M=await Rq(n(),$);M&&_.push(...M.map(N=>({...N,_run:$.name,_runId:$.id??$.name})))}const w=_,A=[],E=[],S=[],C=[];if(w&&w.forEach(($,M)=>{Object.entries($).forEach(([N,L])=>{if(L&&typeof L=="object"&&L._type){const T={key:N,step:$.step||M,_run:$._run,_runId:$._runId,...L};switch(L._type){case"trackio.image":A.push(T);break;case"trackio.video":E.push(T);break;case"trackio.audio":S.push(T);break;case"trackio.table":C.push(T);break}}})}),await fr()){const $=N=>Promise.all(N.map(async L=>(L.file_path&&(L._resolvedUrl=await uSe(L.file_path)),L))),M=[];for(const N of C)if(Array.isArray(N._value)){for(const L of N._value)for(const T of Object.values(L))if(T&&typeof T=="object"&&!Array.isArray(T)&&T._type==="trackio.image")M.push(T);else if(Array.isArray(T))for(const k of T)k&&typeof k=="object"&&k._type==="trackio.image"&&M.push(k)}await Promise.all([$(A),$(E),$(S),$(M)])}R(u,{images:A,videos:E,audios:S,tables:C},!0)}catch(x){console.error("Failed to load media:",x)}finally{R(l,!1)}}Kt(()=>{n(),r(),c()});function f(x){return x._resolvedUrl?x._resolvedUrl:x.file_path?bF(x.file_path):""}function d(x){return x&&typeof x=="object"&&!Array.isArray(x)&&x._type==="trackio.image"}function h(x){return Array.isArray(x)&&x.length>0&&x.every(_=>_&&typeof _=="object"&&_._type==="trackio.image")}var p=y3e(),g=D(p);{var m=x=>{kl(x,{})},v=x=>{var _=e3e(),w=D(_);{var A=C=>{var $=ZSe();z(C,$)},E=C=>{var $=JSe(),M=P(Tt($),4),N=D(M);N.textContent=`import trackio trackio.init(project="my-project") trackio.log({"loss": 0.5}) trackio.finish()`,z(C,$)},S=C=>{var $=QSe(),M=P(Tt($),4),N=D(M);N.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)})`,z(C,$)};he(w,C=>{n()?r().length===0?C(E,1):C(S,-1):C(A)})}z(x,_)},b=x=>{const _=(T,k=oT)=>{var F=t3e(),I=D(F);let B;var O=P(I,2),j=D(O);ye(Y=>{B=Uu(I,"",B,Y),we(j,`Run: ${k()._run??""}, Step: ${k().step??""}`)},[()=>({background:a(k())})]),z(T,F)};var w=v3e(),A=Tt(w);{var E=T=>{var k=i3e(),F=D(k),I=P(D(F),2),B=D(I),O=P(F,2);gt(O,21,()=>y(u).images,pt,(j,Y)=>{var te=r3e(),ce=D(te),Ae=D(ce),ge=P(ce,2),Ie=P(ge,2);{var tt=ue=>{var Ne=n3e(),Q=D(Ne);ye(()=>we(Q,y(Y).caption)),z(ue,Ne)};he(Ie,ue=>{y(Y).caption&&ue(tt)})}var nt=P(Ie,2);_(nt,()=>y(Y)),ye(ue=>{we(Ae,y(Y).key),Et(ge,"src",ue),Et(ge,"alt",y(Y).caption||y(Y).key)},[()=>f(y(Y))]),z(j,te)}),ye(()=>we(B,`Images (${y(u).images.length??""})`)),z(T,k)};he(A,T=>{y(u).images.length>0&&T(E)})}var S=P(A,2);{var C=T=>{var k=o3e(),F=D(k),I=P(D(F),2),B=D(I),O=P(F,2);gt(O,21,()=>y(u).videos,pt,(j,Y)=>{var te=s3e(),ce=D(te),Ae=D(ce),ge=P(ce,2),Ie=P(ge,2);_(Ie,()=>y(Y)),ye(tt=>{we(Ae,y(Y).key),Et(ge,"src",tt)},[()=>f(y(Y))]),z(j,te)}),ye(()=>we(B,`Videos (${y(u).videos.length??""})`)),z(T,k)};he(S,T=>{y(u).videos.length>0&&T(C)})}var $=P(S,2);{var M=T=>{var k=u3e(),F=D(k),I=P(D(F),2),B=D(I),O=P(F,2);gt(O,21,()=>y(u).audios,pt,(j,Y)=>{var te=a3e(),ce=D(te),Ae=D(ce),ge=P(ce,2);{let tt=_e(()=>f(y(Y)));KSe(ge,{get src(){return y(tt)}})}var Ie=P(ge,2);_(Ie,()=>y(Y)),ye(()=>we(Ae,y(Y).key)),z(j,te)}),ye(()=>we(B,`Audio (${y(u).audios.length??""})`)),z(T,k)};he($,T=>{y(u).audios.length>0&&T(M)})}var N=P($,2);{var L=T=>{var k=m3e(),F=D(k),I=P(D(F),2),B=D(I),O=P(F,2);gt(O,17,()=>y(u).tables,pt,(j,Y)=>{var te=Qr(),ce=Tt(te);{var Ae=ge=>{var Ie=g3e(),tt=D(Ie),nt=D(tt),ue=D(nt),Ne=P(nt,2);_(Ne,()=>y(Y));var Q=P(tt,2),W=D(Q),xe=D(W);gt(xe,21,()=>Object.keys(y(Y)._value[0]),pt,(Te,G)=>{var H=l3e(),fe=D(H);ye(()=>we(fe,y(G))),z(Te,H)});var ke=P(W);gt(ke,21,()=>y(Y)._value,pt,(Te,G)=>{var H=p3e();gt(H,21,()=>Object.values(y(G)),pt,(fe,Pe)=>{var U=h3e(),V=D(U);{var K=Oe=>{var et=c3e();ye(Xe=>{Et(et,"src",Xe),Et(et,"alt",y(Pe).caption||"")},[()=>f(y(Pe))]),z(Oe,et)},de=_e(()=>d(y(Pe))),$e=Oe=>{var et=d3e();gt(et,21,()=>y(Pe),pt,(Xe,st)=>{var mt=f3e();ye(Dt=>{Et(mt,"src",Dt),Et(mt,"alt",y(st).caption||"")},[()=>f(y(st))]),z(Xe,mt)}),z(Oe,et)},Je=_e(()=>h(y(Pe))),Qe=Oe=>{var et=z_();ye(Xe=>we(et,Xe),[()=>typeof y(Pe)=="string"&&y(Pe).length>s()?y(Pe).slice(0,s())+"…":y(Pe)??""]),z(Oe,et)};he(V,Oe=>{y(de)?Oe(K):y(Je)?Oe($e,1):Oe(Qe,-1)})}z(fe,U)}),z(Te,H)}),ye(()=>we(ue,y(Y).key)),z(ge,Ie)};he(ce,ge=>{y(Y)._value&&y(Y)._value.length>0&&ge(Ae)})}z(j,te)}),ye(()=>we(B,`Tables (${y(u).tables.length??""})`)),z(T,k)};he(N,T=>{y(u).tables.length>0&&T(L)})}z(x,w)};he(g,x=>{y(l)?x(m):y(u).images.length===0&&y(u).videos.length===0&&y(u).audios.length===0&&y(u).tables.length===0?x(v,1):x(b,-1)})}z(e,p),_n()}var x3e=q(`

      No alerts or reports yet

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

      `),_3e=q('
      '),w3e=q('

      '),E3e=q('

      No alerts for this level.

      '),A3e=q(' '),k3e=q(' '),S3e=q(''),C3e=q('
      '),$3e=q('

      '),F3e=q(" ",1),D3e=q('
      ');function M3e(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"selectedRuns",19,()=>[]),i=ae(ft([])),s=ae(ft([])),o=ae(null),a=ae(!1);const u={info:"🔵",warn:"🟡",error:"🔴"};function l(_){if(!_)return"";let w=_.replace(/&/g,"&").replace(//g,">");return w=w.replace(/^### (.+)$/gm,"

      $1

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

      $1

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

      $1

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

      "),w=`

      ${w}

      `,w=w.replace(/

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

      \s*(

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

        \s*<\/p>/g,""),w}let c=_e(()=>y(o)?y(i).filter(_=>_.level===y(o)):y(i));async function f(){if(!n()){R(i,[],!0),R(s,[],!0);return}R(a,!0);try{const _=await Oq(n(),null,null,null),w=new Set(r().map(S=>S.name));R(i,(_||[]).filter(S=>!S.run||w.has(S.run)),!0);const A=r(),E=[];for(const S of A)try{const C=await Rq(n(),S);if(C)for(const $ of C)for(const[M,N]of Object.entries($))N&&typeof N=="object"&&N._type==="trackio.markdown"&&E.push({key:M,run:S.name,step:$.step,content:N._value||""})}catch{}R(s,E,!0)}catch(_){console.error("Failed to load alerts:",_),R(i,[],!0)}finally{R(a,!1)}}Kt(()=>{n(),r(),f()});function d(_){if(!_)return"";try{return new Date(_).toLocaleString()}catch{return _}}let h=["Level","Run","Title","Text","Step","Time"],p=_e(()=>y(c).map(_=>[`${u[_.level]||""} ${_.level}`,_.run||"",_.title,_.text||"",_.step??"",d(_.timestamp)]));var g=D3e(),m=D(g);{var v=_=>{kl(_,{})},b=_=>{var w=x3e(),A=P(D(w),4),E=D(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.")})`,z(_,w)},x=_=>{var w=F3e(),A=Tt(w);{var E=$=>{var M=w3e(),N=D(M),L=D(N),T=P(N,2);gt(T,17,()=>y(s),pt,(k,F)=>{var I=_3e(),B=D(I),O=D(B),j=P(B,2);pH(j,()=>l(y(F).content),!0),ye(()=>we(O,`${y(F).key??""} · ${y(F).run??""} · step ${y(F).step??""}`)),z(k,I)}),ye(()=>we(L,`Reports (${y(s).length??""})`)),z($,M)};he(A,$=>{y(s).length>0&&$(E)})}var S=P(A,2);{var C=$=>{var M=$3e(),N=D(M),L=D(N),T=P(N,2),k=D(T),F=D(k),I=D(F);let B;var O=P(I,2);let j;var Y=P(O,2);let te;var ce=P(Y,2);let Ae;var ge=P(T,2);{var Ie=nt=>{var ue=E3e();z(nt,ue)},tt=nt=>{var ue=C3e(),Ne=D(ue),Q=D(Ne);gt(Q,21,()=>h,pt,(xe,ke)=>{var Te=A3e(),G=D(Te);ye(()=>we(G,y(ke))),z(xe,Te)});var W=P(Ne);gt(W,21,()=>y(p),pt,(xe,ke)=>{var Te=S3e();gt(Te,21,()=>y(ke),pt,(G,H)=>{var fe=k3e(),Pe=D(fe);ye(()=>we(Pe,y(H))),z(G,fe)}),z(xe,Te)}),z(nt,ue)};he(ge,nt=>{y(c).length===0?nt(Ie):nt(tt,-1)})}ye(()=>{we(L,`Alerts (${y(i).length??""})`),B=rn(I,1,"pill svelte-iufsej",null,B,{active:y(o)===null}),j=rn(O,1,"pill svelte-iufsej",null,j,{active:y(o)==="info"}),te=rn(Y,1,"pill svelte-iufsej",null,te,{active:y(o)==="warn"}),Ae=rn(ce,1,"pill svelte-iufsej",null,Ae,{active:y(o)==="error"})}),We("click",I,()=>R(o,null)),We("click",O,()=>R(o,"info")),We("click",Y,()=>R(o,"warn")),We("click",ce,()=>R(o,"error")),z($,M)};he(S,$=>{y(i).length>0&&$(C)})}z(_,w)};he(m,_=>{y(a)?_(v):y(i).length===0&&y(s).length===0?_(b,1):_(x,-1)})}z(e,g),_n()}ui(["click"]);var T3e=q('

        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.

        '),R3e=q('
        '),N3e=q(''),O3e=q('
        '),L3e=q('
        '),I3e=q('
        ActionsRun NameStepsLast Step
        ',1),P3e=q('
        ');function B3e(e,t){xn(t,!0);let n=re(t,"project",3,null),r=re(t,"runs",19,()=>[]),i=re(t,"filterText",3,""),s=re(t,"onRunsChanged",3,null),o=re(t,"runMutationAllowed",3,!0),a=_e(o),u=_e(()=>Ig(r())),l=ae(ft([])),c=ae(!1),f=ae(-1),d=ae(""),h=ae(null),p=_e(()=>{if(!i()||!i().trim())return y(l);const C=new Set(TA(y(l).map($=>$.name),i()));return y(l).filter($=>C.has($.name))});async function g(){if(!n()){R(l,[],!0);return}R(c,!0);try{const $=(await Qke(n())).runs||[],N=(await Promise.all($.map(L=>Nq(n(),L)))).map((L,T)=>({id:$[T].id??$[T].name,name:$[T].name,numSteps:L.num_logs||0,lastStep:L.last_step||0}));R(l,N,!0)}catch(C){console.error("Failed to load runs:",C)}finally{R(c,!1)}}Kt(()=>{n(),g()});async function m(C){if(y(a)&&confirm(`Delete run "${C.name}"? This cannot be undone.`))try{await iSe(n(),C),await g(),s()&&s()()}catch($){console.error("Failed to delete run:",$)}}async function v(C,$){var M,N;y(a)&&(R(f,C,!0),R(d,$,!0),await qi(),(M=y(h))==null||M.focus(),(N=y(h))==null||N.select())}async function b(C){if(!y(a))return;const $=y(d).trim();if(!$||$===C.name){R(f,-1);return}try{await sSe(n(),C,$),R(f,-1),await g(),s()&&s()()}catch(M){console.error("Failed to rename run:",M)}}function x(C,$){C.key==="Enter"&&b($),C.key==="Escape"&&R(f,-1)}var _=P3e(),w=D(_);{var A=C=>{kl(C,{})},E=C=>{var $=T3e(),M=P(D($),4),N=D(M);N.textContent=`import trackio trackio.init(project="my-project") for i in range(10): trackio.log({"loss": 1 / (i + 1)}) trackio.finish()`,z(C,$)},S=C=>{var $=I3e(),M=Tt($);{var N=k=>{var F=R3e(),I=D(F),B=D(I);ye(()=>we(B,`${y(p).length??""} of ${y(l).length??""} runs`)),z(k,F)};he(M,k=>{i()&&k(N)})}var L=P(M,2),T=P(D(L));gt(T,21,()=>y(p),pt,(k,F,I)=>{var B=L3e(),O=D(B),j=D(O),Y=D(j),te=P(Y,2),ce=P(O),Ae=D(ce);{var ge=Q=>{var W=N3e();Hi(W,xe=>R(h,xe),()=>y(h)),We("keydown",W,xe=>x(xe,y(F))),mr("blur",W,()=>b(y(F))),Lg(W,()=>y(d),xe=>R(d,xe)),z(Q,W)},Ie=Q=>{var W=O3e(),xe=D(W);let ke;var Te=P(xe,2),G=D(Te);ye(()=>{ke=Uu(xe,"",ke,{background:y(u)[y(F).id]??"#9ca3af"}),we(G,y(F).name)}),We("click",Te,()=>{WF("selected_run_id",y(F).id),WF("selected_run",y(F).name),oR("run-detail")}),z(Q,W)};he(Ae,Q=>{y(f)===I?Q(ge):Q(Ie,-1)})}var tt=P(ce),nt=D(tt),ue=P(tt),Ne=D(ue);ye(()=>{Et(Y,"title",y(a)?"Rename":"Sign in with Hugging Face (write access) to rename runs"),Y.disabled=!y(a),Et(te,"title",y(a)?"Delete":"Sign in with Hugging Face (write access) to delete runs"),te.disabled=!y(a),we(nt,y(F).numSteps),we(Ne,y(F).lastStep)}),We("click",Y,()=>v(I,y(F).name)),We("click",te,()=>m(y(F))),z(k,B)}),z(C,$)};he(w,C=>{y(c)?C(A):y(l).length===0?C(E,1):C(S,-1)})}z(e,_),_n()}ui(["click","keydown"]);var z3e=q(`

        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.

        `),j3e=q('

        Configuration

         
        ',1),U3e=q('

        Project
        Total Logs
        Last Step
        Metrics
        '),q3e=q('
        ');function W3e(e,t){xn(t,!0);let n=re(t,"project",3,null),r=ae(null),i=ae(null),s=ae(null),o=ae(!1);Kt(()=>{R(i,gi("selected_run_id"),!0),R(r,gi("selected_run"),!0)});async function a(){if(!n()||!y(r)&&!y(i)){R(s,null);return}R(o,!0);try{const h=await Nq(n(),y(i)?{id:y(i),name:y(r)}:y(r));R(s,h,!0),h!=null&&h.run&&R(r,h.run,!0)}catch(h){console.error("Failed to load run detail:",h)}finally{R(o,!1)}}Kt(()=>{n(),y(r),y(i),a()});var u=q3e(),l=D(u);{var c=h=>{kl(h,{})},f=h=>{var p=z3e(),g=P(D(p),4),m=D(g);m.textContent=`import trackio trackio.init(project="my-project", config={"lr": 1e-3}) trackio.log({"loss": 0.5}) trackio.finish()`,z(h,p)},d=h=>{var p=U3e(),g=D(p),m=D(g),v=P(g,2),b=D(v),x=P(D(b),2),_=D(x),w=P(b,2),A=P(D(w),2),E=D(A),S=P(w,2),C=P(D(S),2),$=D(C),M=P(S,2),N=P(D(M),2),L=D(N),T=P(v,2);{var k=F=>{var I=j3e(),B=P(Tt(I),2),O=D(B);ye(j=>we(O,j),[()=>JSON.stringify(y(s).config,null,2)]),z(F,I)};he(T,F=>{y(s).config&&F(k)})}ye(F=>{we(m,y(s).run),we(_,y(s).project),we(E,y(s).num_logs),we($,y(s).last_step??"N/A"),we(L,F)},[()=>y(s).metrics?y(s).metrics.join(", "):"None"]),z(h,p)};he(l,h=>{y(o)?h(c):y(s)?h(d,-1):h(f,1)})}z(e,u),_n()}var H3e=q('

        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.

        '),G3e=q(' '),Y3e=q('
        Loading preview...
        '),V3e=q('
         
        '),X3e=q('
        Preview not available. Download the file instead.
        '),K3e=q('
        '),Z3e=q('
        '),J3e=q('

        Files

        Showing files saved across all runs in this project.

        ',1),Q3e=q('
        ');function eCe(e,t){xn(t,!0);let n=re(t,"project",3,null),r=ae(ft([])),i=ae(!1),s=ae(null),o=ae(null),a=ae(!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(b){const x=b.split(".").pop().toLowerCase();return u.has(x)}function c(b){return b==null?"":b<1024?`${b} B`:b<1024*1024?`${(b/1024).toFixed(1)} KB`:`${(b/(1024*1024)).toFixed(1)} MB`}async function f(b){if(y(s)===b.name){R(s,null),R(o,null);return}if(R(s,b.name,!0),!l(b.name)){R(o,null);return}R(a,!0);try{const x=A_(b.path),_=await fetch(x);if(!_.ok)throw new Error("fetch failed");const w=await _.text();R(o,w.length>5e4?w.slice(0,5e4)+` … (truncated)`:w,!0)}catch{R(o,null)}finally{R(a,!1)}}async function d(){if(!n()){R(r,[],!0);return}R(i,!0);try{R(r,await nSe(n()),!0)}catch{R(r,[],!0)}finally{R(i,!1)}}Kt(()=>{n(),d()});var h=Q3e(),p=D(h);{var g=b=>{kl(b,{})},m=b=>{var x=H3e(),_=P(D(x),4),w=D(_);w.textContent=`import trackio trackio.init(project="my-project") trackio.save("config.yaml") trackio.save("checkpoints/*.pt")`,z(b,x)},v=b=>{var x=J3e(),_=P(Tt(x),4);gt(_,21,()=>y(r),pt,(w,A)=>{var E=Z3e();let S;var C=D(E),$=D(C),M=D($),N=D(M),L=P(M),T=P($,2),k=D(T);{var F=j=>{var Y=G3e(),te=D(Y);ye(ce=>we(te,ce),[()=>c(y(A).size)]),z(j,Y)};he(k,j=>{y(A).size!=null&&j(F)})}var I=P(k,2),B=P(C,2);{var O=j=>{var Y=K3e(),te=D(Y);{var ce=Ie=>{var tt=Y3e();z(Ie,tt)},Ae=Ie=>{var tt=V3e(),nt=D(tt);ye(()=>we(nt,y(o))),z(Ie,tt)},ge=Ie=>{var tt=X3e(),nt=P(D(tt));ye(ue=>Et(nt,"href",ue),[()=>A_(y(A).path)]),z(Ie,tt)};he(te,Ie=>{y(a)?Ie(ce):y(o)!=null?Ie(Ae,1):Ie(ge,-1)})}z(j,Y)};he(B,j=>{y(s)===y(A).name&&j(O)})}ye((j,Y)=>{S=rn(E,1,"file-item svelte-1xvfk9n",null,S,{expanded:y(s)===y(A).name}),we(N,j),we(L,` ${y(A).name??""}`),Et(I,"href",Y)},[()=>l(y(A).name)?"📄":"📦",()=>A_(y(A).path)]),We("click",$,()=>f(y(A))),z(w,E)}),z(b,x)};he(p,b=>{y(i)?b(g):y(r).length===0?b(m,1):b(v,-1)})}z(e,h),_n()}ui(["click"]);var tCe=li(''),nCe=li(''),rCe=li(''),iCe=q(""),sCe=q('Connected to — remote commands include --space automatically.',1),oCe=q(""),aCe=q('
        '),uCe=li(''),lCe=li(''),cCe=q('
        '),fCe=q(""),dCe=li(''),hCe=li(''),pCe=li(''),gCe=li(''),mCe=q('

        Settings

        Appearance

        Choose how the dashboard looks to you.

        CLI Reference

        Common Trackio CLI commands.

        Agent Skills

        Install Trackio as a skill in your AI coding agent to query experiments with natural language.

        Run in Terminal to Install:
        Example prompt

        ');function vCe(e,t){xn(t,!0);let n=re(t,"spaceId",3,null),r=re(t,"selectedProject",3,null),i=re(t,"projects",19,()=>[]),s=ae(ft(aF())),o=ae(null),a=ae(null),u=ae("claude"),l=ae(!1),c=ae(!1);const f=[{id:"claude",label:"Claude Code",flag:"--claude"},{id:"codex",label:"Codex",flag:"--codex"},{id:"cursor",label:"Cursor",flag:"--cursor"},{id:"opencode",label:"OpenCode",flag:"--opencode"}];let d=_e(()=>{var H;return`trackio skills add ${(H=f.find(fe=>fe.id===y(u)))==null?void 0:H.flag}`}),h=_e(()=>{const H=y(a)||"";return{claude:`Use the trackio skill to look at the runs in project "${H}" and find at which step the loss started diverging. Summarize what happened.`,codex:`Use the trackio skill to pull the latest metrics for project "${H}" and tell me which run has the best final eval accuracy.`,cursor:`Use the trackio skill to compare the last two runs in project "${H}" and explain why the learning rate change affected convergence.`,opencode:`Use the trackio skill to get a summary of project "${H}" and flag any runs where the loss spiked unexpectedly.`}[y(u)]});Kt(()=>{if(i(),r(),!(y(a)&&i().includes(y(a)))){if(r()&&i().includes(r())){R(a,r());return}R(a,i()[0]??r()??null,!0)}});function p(H){R(s,H,!0),vAe(H)}function g(){return n()?` --space ${n()}`:""}let m=_e(()=>{const H=g(),fe=y(a)||"";return[{title:"Launch dashboard",cmd:"trackio show"},{title:"Launch dashboard (project)",cmd:`trackio show --project "${fe}"`},{title:"List projects",cmd:`trackio${H} list projects`},{title:"List runs",cmd:`trackio${H} list runs --project "${fe}"`},{title:"List metrics",cmd:`trackio${H} list metrics --project "${fe}" --run `},{title:"Project summary",cmd:`trackio${H} get project --project "${fe}"`},{title:"Run summary",cmd:`trackio${H} get run --project "${fe}" --run `},{title:"Sync to HF Space",cmd:`trackio sync${H} --project "${fe}"`},{title:"Check sync status",cmd:"trackio status"}]});async function v(H,fe){try{await navigator.clipboard.writeText(H),R(o,fe,!0),setTimeout(()=>{y(o)===fe&&R(o,null)},1500)}catch{}}async function b(H,fe){try{await navigator.clipboard.writeText(H),fe==="agent"?(R(l,!0),setTimeout(()=>{R(l,!1)},1500)):(R(c,!0),setTimeout(()=>{R(c,!1)},1500))}catch{}}var x=mCe(),_=P(D(x),2),w=D(_),A=D(w),E=P(D(A),4);gt(E,20,()=>[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}],pt,(H,fe)=>{var Pe=iCe();let U;var V=D(Pe);{var K=Qe=>{var Oe=tCe();z(Qe,Oe)},de=Qe=>{var Oe=nCe();z(Qe,Oe)},$e=Qe=>{var Oe=rCe();z(Qe,Oe)};he(V,Qe=>{fe.value==="system"?Qe(K):fe.value==="light"?Qe(de,1):Qe($e,-1)})}var Je=P(V);ye(()=>{U=rn(Pe,1,"theme-option svelte-1ozf5k3",null,U,{selected:y(s)===fe.value}),we(Je,` ${fe.label??""}`)}),We("click",Pe,()=>p(fe.value)),z(H,Pe)});var S=P(A,2),C=P(D(S),2),$=P(D(C));{var M=H=>{var fe=sCe(),Pe=P(Tt(fe)),U=D(Pe);ye(()=>we(U,n())),z(H,fe)};he($,H=>{n()&&H(M)})}var N=P(C,2);{var L=H=>{var fe=aCe(),Pe=P(D(fe),2);gt(Pe,21,i,pt,(U,V)=>{var K=oCe(),de=D(K),$e={};ye(()=>{we(de,y(V)),$e!==($e=y(V))&&(K.value=(K.__value=y(V))??"")}),z(U,K)}),JT(Pe,()=>y(a),U=>R(a,U)),z(H,fe)};he(N,H=>{i().length>0&&H(L)})}var T=P(N,2);gt(T,21,()=>y(m),pt,(H,fe,Pe)=>{var U=cCe(),V=D(U),K=D(V),de=P(V,2),$e=D(de),Je=D($e),Qe=P($e,2);let Oe;var et=D(Qe);{var Xe=mt=>{var Dt=uCe();z(mt,Dt)},st=mt=>{var Dt=lCe();z(mt,Dt)};he(et,mt=>{y(o)===Pe?mt(Xe):mt(st,-1)})}ye(()=>{we(K,y(fe).title),we(Je,y(fe).cmd),Oe=rn(Qe,1,"copy-btn svelte-1ozf5k3",null,Oe,{copied:y(o)===Pe})}),We("click",Qe,()=>v(y(fe).cmd,Pe)),z(H,U)});var k=P(w,2),F=D(k),I=P(D(F),4);gt(I,21,()=>f,pt,(H,fe)=>{var Pe=fCe();let U;var V=D(Pe);ye(()=>{U=rn(Pe,1,"agent-tab svelte-1ozf5k3",null,U,{active:y(u)===y(fe).id}),we(V,y(fe).label)}),We("click",Pe,()=>{R(u,y(fe).id,!0)}),z(H,Pe)});var B=P(I,2),O=D(B),j=P(D(O),2),Y=D(j),te=D(Y),ce=P(Y,2);let Ae;var ge=D(ce);{var Ie=H=>{var fe=dCe();z(H,fe)},tt=H=>{var fe=hCe();z(H,fe)};he(ge,H=>{y(l)?H(Ie):H(tt,-1)})}var nt=P(O,2),ue=D(nt),Ne=P(D(ue),2);let Q;var W=D(Ne);{var xe=H=>{var fe=pCe();z(H,fe)},ke=H=>{var fe=gCe();z(H,fe)};he(W,H=>{y(c)?H(xe):H(ke,-1)})}var Te=P(ue,2),G=D(Te);ye(()=>{we(te,y(d)),Ae=rn(ce,1,"copy-btn svelte-1ozf5k3",null,Ae,{copied:y(l)}),Q=rn(Ne,1,"copy-btn svelte-1ozf5k3",null,Q,{copied:y(c)}),we(G,y(h))}),We("click",ce,()=>b(y(d),"agent")),We("click",Ne,()=>b(y(h),"example")),z(e,x),_n()}ui(["click"]);var yCe=q('
        ');function bCe(e,t){xn(t,!0);function n(le){if(!le)return"";const Re=le.trim(),lt=Re.split(",").map(Z=>Z.trim()).filter(Boolean);if(lt.length===0)return"";const nn=Z=>/^[\w./-]+$/.test(Z);return lt.every(nn)?lt.map(Z=>`^${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`).join("|"):Re}yAe();let r=ae(ft(sF()));gAe(le=>{R(r,le,!0)});let i=ae("metrics"),s=ae(ft([])),o=ae(null),a=ae(ft([])),u=ae(ft([])),l=ae(10),c=ae("step"),f=ae(!1),d=ae(!1),h=ae(""),p=ae(!0),g=ae(!0),m=ae(""),v=ae(ft([])),b=ae(!0),x=ae(!1),_=ae(!1),w=ae(0),A=ae(ft([])),E=ae(null),S=ae(ft({spaces:!1,allowed:!0,auth:"local"})),C=ae(null),$=ae(!1),M=ae(ft({light:"/static/trackio/trackio_logo_type_light_transparent.png",dark:"/static/trackio/trackio_logo_type_dark_transparent.png"})),N=ae(ft([])),L=ae(250),T=ae(null),k=ae(null),F=ae(ft([])),I=ae(ft([]));function B(le){return(le==null?void 0:le.id)??(le==null?void 0:le.name)}let O=_e(()=>y(a).filter(le=>y(u).includes(B(le))));function j(le){R(i,le,!0),oR(le)}function Y(){return gi("project")||gi("selected_project")}function te(){const le=Y();le&&y(s).includes(le)&&R(o,le,!0)}async function ce(){try{const le=await Xke();if(R(s,le||[],!0),y(s).length>0&&!y(o)){const Re=Y();R(o,Re&&y(s).includes(Re)?Re:y(s)[0],!0)}te()}catch(le){console.error("Failed to load projects:",le)}}async function Ae(){await ge(),await ue()}async function ge(){if(!y(o)){R(a,[],!0),R(u,[],!0),R(F,[],!0),R(I,[],!0);return}try{const Re=[...await Kke(y(o))||[]].reverse();if(JSON.stringify(y(a))!==JSON.stringify(Re)){const lt=y(u),nn=y(a).map(B);R(a,Re,!0),R(u,GH(lt,Re.map(B),nn),!0)}}catch(le){console.error("Failed to load runs:",le)}}async function Ie(){if(y(o))try{const le=await Oq(y(o),null,null,null);R(A,(le||[]).slice(-20),!0)}catch{}}function tt(){y(E)&&clearInterval(y(E)),R(E,setInterval(async()=>{y(p)&&(yF()||vF()||(await ce(),await ge(),await Ie()))},Gke()),!0)}function nt(){const le=new URLSearchParams(window.location.search);let Re=!1;const lt=le.get("write_token");lt&&(document.cookie=`trackio_write_token=${encodeURIComponent(lt)}; path=/; max-age=604800; SameSite=Lax`,le.delete("write_token"),Re=!0);const nn=le.get("oauth_session");if(nn&&(sessionStorage.setItem("trackio_oauth_session",nn),le.delete("oauth_session"),Re=!0),Re){const Z=le.toString(),X=window.location.pathname+(Z?`?${Z}`:"");window.history.replaceState({},"",X)}}async function ue(){try{const le=await rSe();R(S,{spaces:!!le.spaces,allowed:!!le.allowed,auth:le.auth??"none"},!0)}catch{R(S,{spaces:!1,allowed:!0,auth:"local"},!0)}}function Ne(){y(C)&&clearInterval(y(C)),R(C,setInterval(()=>{ue()},12e4),!0)}Kt(()=>{y(o),R(F,[],!0),R(I,[],!0),ge()}),Kt(()=>{y(w),R(_,gi("navbar")==="hidden")}),Xd(()=>{const le=gi("sidebar");le==="hidden"?(R(x,!0),R(b,!1)):le==="collapsed"?(R(x,!1),R(b,!1)):R(x,!1);const Re=gi("smoothing");if(Re){const Z=parseInt(Re,10);Number.isNaN(Z)||R(l,Z,!0)}const lt=gi("metric_filter"),nn=gi("metrics");return lt?R(h,lt,!0):nn&&R(h,n(nn),!0),gi("accordion")==="hidden"&&R(g,!1),R(i,qF(),!0),window.addEventListener("popstate",()=>{R(i,qF(),!0),ST(w),te()}),nt(),(async()=>{const Z=await fr();Z?(R(p,!1),R(S,{spaces:!1,allowed:!1,auth:"static"},!0),R(T,await aSe(),!0)):(ue(),Ne(),window.addEventListener("focus",ue));try{try{const X=await tSe();X&&(X.logo_urls&&R(M,X.logo_urls,!0),X.color_palette&&HH(X.color_palette),X.plot_order&&R(N,X.plot_order,!0),X.table_truncate_length&&R(L,X.table_truncate_length,!0),X.media_dir&&oSe(X.media_dir),X.space_id&&R(k,X.space_id,!0))}catch{}await ce(),await ge(),await Ie()}catch(X){console.error("Failed to load projects:",X)}finally{R($,!0)}Z||tt()})(),()=>{y(E)&&clearInterval(y(E)),y(C)&&clearInterval(y(C)),window.removeEventListener("focus",ue)}});let Q=_e(()=>{y(w);const le=Y();return!!(le&&y(s).includes(le))});Kt(()=>{y(s),y(w),y(Q)&&te()});let W=ae(!1);Kt(()=>{if(y(W)||!y($)||!y(o))return;const le=gi("run_ids"),Re=gi("runs");if(!le&&!Re){R(W,!0);return}if(!y(a).length){R(W,!0);return}let lt;if(le){const nn=le.split(",").map(X=>X.trim()).filter(Boolean),Z=new Set(y(a).map(X=>B(X)));lt=nn.filter(X=>Z.has(X))}else{const nn=Re.split(",").map(X=>X.trim()).filter(Boolean),Z=new Set(nn);lt=y(a).filter(X=>Z.has(X.name)).map(X=>B(X))}lt.length&&R(u,lt,!0),R(W,!0)});let xe=_e(()=>y(i)==="metrics"||y(i)==="traces"||y(i)==="system"||y(i)==="media"||y(i)==="reports"||y(i)==="runs"||y(i)==="run-detail"||y(i)==="files"),ke=_e(()=>y(i)==="runs"||y(i)==="files"?"compact":"full");var Te=yCe(),G=D(Te);{var H=le=>{xG(le,{get variant(){return y(ke)},get currentPage(){return y(i)},get spacesMode(){return y(S).spaces},get runMutationAllowed(){return y(S).allowed},get mutationAuth(){return y(S).auth},get readOnlySource(){return y(T)},get projects(){return y(s)},get projectLocked(){return y(Q)},get runs(){return y(a)},get metricColumns(){return y(v)},get availableSystemDevices(){return y(F)},get spaceId(){return y(k)},get logoUrls(){return y(M)},get darkMode(){return y(r)},get open(){return y(b)},set open(Re){R(b,Re,!0)},get selectedProject(){return y(o)},set selectedProject(Re){R(o,Re,!0)},get selectedRuns(){return y(u)},set selectedRuns(Re){R(u,Re,!0)},get smoothing(){return y(l)},set smoothing(Re){R(l,Re,!0)},get xAxis(){return y(c)},set xAxis(Re){R(c,Re,!0)},get logScaleX(){return y(f)},set logScaleX(Re){R(f,Re,!0)},get logScaleY(){return y(d)},set logScaleY(Re){R(d,Re,!0)},get metricFilter(){return y(h)},set metricFilter(Re){R(h,Re,!0)},get realtimeEnabled(){return y(p)},set realtimeEnabled(Re){R(p,Re,!0)},get showHeaders(){return y(g)},set showHeaders(Re){R(g,Re,!0)},get filterText(){return y(m)},set filterText(Re){R(m,Re,!0)},get selectedSystemDevices(){return y(I)},set selectedSystemDevices(Re){R(I,Re,!0)}})};he(G,le=>{y(xe)&&!y(x)&&le(H)})}var fe=P(G,2),Pe=D(fe);{var U=le=>{SH(le,{get currentPage(){return y(i)},onNavigate:j})};he(Pe,le=>{y(_)||le(U)})}var V=P(Pe,2),K=D(V);{var de=le=>{mSe(le,{get project(){return y(o)},get selectedRuns(){return y(O)},get allRuns(){return y(a)},get smoothing(){return y(l)},get xAxis(){return y(c)},get logScaleX(){return y(f)},get logScaleY(){return y(d)},get metricFilter(){return y(h)},get showHeaders(){return y(g)},get appBootstrapReady(){return y($)},get plotOrder(){return y(N)},get realtimeEnabled(){return y(p)},get metricColumns(){return y(v)},set metricColumns(Re){R(v,Re,!0)}})},$e=le=>{ISe(le,{get project(){return y(o)},get selectedRuns(){return y(O)}})},Je=le=>{GSe(le,{get project(){return y(o)},get selectedRuns(){return y(O)},get allRuns(){return y(a)},get smoothing(){return y(l)},get appBootstrapReady(){return y($)},get realtimeEnabled(){return y(p)},get availableDevices(){return y(F)},set availableDevices(Re){R(F,Re,!0)},get selectedDevices(){return y(I)},set selectedDevices(Re){R(I,Re,!0)}})},Qe=le=>{b3e(le,{get project(){return y(o)},get selectedRuns(){return y(O)},get allRuns(){return y(a)},get tableTruncateLength(){return y(L)}})},Oe=le=>{M3e(le,{get project(){return y(o)},get selectedRuns(){return y(O)}})},et=le=>{B3e(le,{get project(){return y(o)},get runs(){return y(a)},get filterText(){return y(m)},onRunsChanged:Ae,get runMutationAllowed(){return y(S).allowed}})},Xe=le=>{W3e(le,{get project(){return y(o)}})},st=le=>{eCe(le,{get project(){return y(o)}})},mt=le=>{vCe(le,{get spaceId(){return y(k)},get selectedProject(){return y(o)},get projects(){return y(s)}})};he(K,le=>{y(i)==="metrics"?le(de):y(i)==="traces"?le($e,1):y(i)==="system"?le(Je,2):y(i)==="media"?le(Qe,3):y(i)==="reports"?le(Oe,4):y(i)==="runs"?le(et,5):y(i)==="run-detail"?le(Xe,6):y(i)==="files"?le(st,7):y(i)==="settings"&&le(mt,8)})}var Dt=P(fe,2);SG(Dt,{get alerts(){return y(A)}}),z(e,Te),_n()}aH(bCe,{target:document.getElementById("app")});