diff --git "a/assets/index-sNT4w7tZ.js" "b/assets/index-sNT4w7tZ.js" new file mode 100644--- /dev/null +++ "b/assets/index-sNT4w7tZ.js" @@ -0,0 +1,1094 @@ +(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 g9=!1;var Fg=Array.isArray,udt=Array.prototype.indexOf,O5=Array.from,Zy=Object.defineProperty,bu=Object.getOwnPropertyDescriptor,m9=Object.getOwnPropertyDescriptors,fdt=Object.prototype,hdt=Array.prototype,L5=Object.getPrototypeOf,u$=Object.isExtensible;function i0(e){return typeof e=="function"}const yn=()=>{};function ddt(e){return e()}function Qy(e){for(var t=0;t{e=r,t=i});return{promise:n,resolve:e,reject:t}}function qT(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 Uo=2,D5=4,sS=8,Bg=16,Lu=32,tp=64,F5=128,Ma=256,Lw=512,qi=1024,Oa=2048,Du=4096,al=8192,ep=16384,oS=32768,np=65536,f$=1<<17,gdt=1<<18,aS=1<<19,B5=1<<20,jT=1<<21,P5=1<<22,ad=1<<23,sc=Symbol("$state"),U5=Symbol("legacy props"),mdt=Symbol(""),z5=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},q5=3,Z0=8;function ydt(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function a1(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function vdt(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function bdt(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function _dt(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function wdt(e){throw new Error("https://svelte.dev/e/effect_orphan")}function xdt(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Sdt(){throw new Error("https://svelte.dev/e/hydration_failed")}function Adt(e){throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function Edt(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function kdt(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Tdt(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Mdt(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Idt(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const lS=1,cS=2,y9=4,Rdt=8,Cdt=16,Ndt=1,$dt=2,Odt=4,Ldt=8,Ddt=16,Fdt=1,Bdt=2,Pdt=4,v9=1,Udt=2,b9="[",j5="[!",V5="]",ld={},wi=Symbol(),zdt="http://www.w3.org/1999/xhtml",qdt="@attach";function l1(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function jdt(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Vdt(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let ze=!1;function rl(e){ze=e}let ln;function Ds(e){if(e===null)throw l1(),ld;return ln=e}function Tu(){return Ds(Sl(ln))}function tt(e){if(ze){if(Sl(ln)!==null)throw l1(),ld;ln=e}}function Id(e=1){if(ze){for(var t=e,n=ln;t--;)n=Sl(n);ln=n}}function Dw(){for(var e=0,t=ln;;){if(t.nodeType===Z0){var n=t.data;if(n===V5){if(e===0)return t;e-=1}else(n===b9||n===j5)&&(e+=1)}var r=Sl(t);t.remove(),t=r}}function _9(e){if(!e||e.nodeType!==Z0)throw l1(),ld;return e.data}function w9(e){return e===this.v}function uS(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Wdt(e,t){return e!==t}function x9(e){return!uS(e,this.v)}let Pg=!1,Ydt=!1;function Hdt(){Pg=!0}let zn=null;function Q0(e){zn=e}function h$(e){return S9().get(e)}function d$(e,t){return S9().set(e,t),t}function ye(e,t=!1,n){zn={p:zn,c:null,e:null,s:e,x:null,l:Pg&&!t?{s:null,u:null,$:[]}:null}}function ve(e){var t=zn,n=t.e;if(n!==null){t.e=null;for(var r of n)z9(r)}return e!==void 0&&(t.x=e),zn=t.p,e??{}}function rp(){return!Pg||zn!==null&&zn.l===null}function S9(e){return zn===null&&a1(),zn.c??=new Map(Gdt(zn)||void 0)}function Gdt(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}const Xdt=new WeakMap;function A9(e){var t=He;if(t===null)return dn.f|=ad,e;if((t.f&oS)===0){if((t.f&F5)===0)throw!t.parent&&e instanceof Error&&E9(e),e;t.b.error(e)}else tv(e,t)}function tv(e,t){for(;t!==null;){if((t.f&F5)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e instanceof Error&&E9(e),e}function E9(e){const t=Xdt.get(e);t&&(Zy(e,"message",{value:t.message}),Zy(e,"stack",{value:t.stack}))}const Kdt=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let ev=[],nv=[];function k9(){var e=ev;ev=[],Qy(e)}function T9(){var e=nv;nv=[],Qy(e)}function ip(e){ev.length===0&&queueMicrotask(k9),ev.push(e)}function Jdt(e){nv.length===0&&Kdt(T9),nv.push(e)}function Zdt(){ev.length>0&&k9(),nv.length>0&&T9()}function Qdt(e){let t=0,n=Nd(0),r;return()=>{fpt()&&(x(n),sp(()=>(t===0&&(r=bo(()=>e(()=>$y(n)))),t+=1,()=>{ip(()=>{t-=1,t===0&&(r?.(),r=void 0,$y(n))})})))}}var tpt=np|aS|F5;function ept(e,t,n){new npt(e,t,n)}class npt{pending=!1;parent;#t;#e;#n;#r;#c;#i=null;#s=null;#a=null;#o=null;#l=0;#f=!1;#u=null;#p=()=>{this.#u&&eg(this.#u,this.#l)};#h=Qdt(()=>(this.#u=Nd(this.#l),()=>{this.#u=null}));constructor(t,n,r){this.#t=t,this.#n=n,this.#r=r,this.#e=ln,this.parent=He.b,this.pending=!!this.#n.pending,this.#c=lh(()=>{He.b=this,ze&&Tu();const i=this.#n.pending;if(ze&&i)this.#s=zi(()=>i(this.#t)),rv.enqueue(()=>{this.#i=this.#d(()=>(rv.ensure(),zi(()=>this.#r(this.#t)))),this.#l>0?this.#g():($f(this.#s,()=>{this.#s=null}),this.pending=!1)});else{try{this.#i=zi(()=>r(this.#t))}catch(s){this.error(s)}this.#l>0?this.#g():this.pending=!1}},tpt),ze&&(this.#t=ln)}has_pending_snippet(){return!!this.#n.pending}#d(t){var n=He,r=dn,i=zn;hc(this.#c),ao(this.#c),Q0(this.#c.ctx);try{return t()}catch(s){return A9(s),null}finally{hc(n),ao(r),Q0(i)}}#g(){const t=this.#n.pending;this.#i!==null&&(this.#o=document.createDocumentFragment(),rpt(this.#i,this.#o)),this.#s===null&&(this.#s=zi(()=>t(this.#t)))}#m(t){this.#l+=t,this.#l===0&&(this.pending=!1,this.#s&&$f(this.#s,()=>{this.#s=null}),this.#o&&(this.#t.before(this.#o),this.#o=null))}update_pending_count(t){this.has_pending_snippet()?this.#m(t):this.parent&&this.parent.#m(t),VT.add(this.#p)}get_effect_pending(){return this.#h(),x(this.#u)}error(t){var n=this.#n.onerror;let r=this.#n.failed;this.#i&&(cs(this.#i),this.#i=null),this.#s&&(cs(this.#s),this.#s=null),this.#a&&(cs(this.#a),this.#a=null),ze&&(Ds(this.#e),Id(),Ds(Dw()));var i=!1,s=!1;const o=()=>{if(i){Vdt();return}i=!0,s&&Idt(),this.#l=0,this.#a!==null&&$f(this.#a,()=>{this.#a=null}),this.pending=!0,this.#i=this.#d(()=>(this.#f=!1,zi(()=>this.#r(this.#t)))),this.#l>0?this.#g():this.pending=!1};if(this.#f||!n&&!r)throw t;var a=dn;try{ao(null),s=!0,n?.(t,o),s=!1}catch(l){tv(l,this.#c&&this.#c.parent)}finally{ao(a)}r&&ip(()=>{this.#a=this.#d(()=>{this.#f=!0;try{return zi(()=>{r(this.#t,()=>t,()=>o)})}catch(l){return tv(l,this.#c.parent),null}finally{this.#f=!1}})})}}function rpt(e,t){for(var n=e.nodes_start,r=e.nodes_end;n!==null;){var i=n===r?null:Sl(n);t.append(n),n=i}}function ipt(){for(var e=He.b;e!==null&&!e.has_pending_snippet();)e=e.parent;return e===null&&ydt(),e}function c1(e){var t=Uo|Oa,n=dn!==null&&(dn.f&Uo)!==0?dn:null;return He===null||n!==null&&(n.f&Ma)!==0?t|=Ma:He.f|=aS,{ctx:zn,deps:null,effects:null,equals:w9,f:t,fn:e,reactions:null,rv:0,v:wi,wv:0,parent:n??He,ac:null}}function spt(e,t){let n=He;n===null&&vdt();var r=n.b,i=void 0,s=Nd(wi),o=null,a=!dn;return gpt(()=>{try{var l=e()}catch(d){l=Promise.reject(d)}var c=()=>l;i=o?.then(c,c)??Promise.resolve(l),o=i;var u=Qn,f=r.pending;a&&(r.update_pending_count(1),f||u.increment());const h=(d,g=void 0)=>{o=null,f||u.activate(),g?g!==z5&&(s.f|=ad,eg(s,g)):((s.f&ad)!==0&&(s.f^=ad),eg(s,d)),a&&(r.update_pending_count(-1),f||u.decrement()),C9()};if(i.then(h,d=>h(null,d||"unknown")),u)return()=>{queueMicrotask(()=>u.neuter())}}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function dt(e){const t=c1(e);return G9(t),t}function W5(e){const t=c1(e);return t.equals=x9,t}function M9(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nspt(l))).then(l=>{i?.activate(),o();try{n([...e.map(r),...l])}catch(c){(s.f&ep)===0&&tv(c,s)}i?.deactivate(),C9()}).catch(l=>{a.error(l)})}function apt(){var e=He,t=dn,n=zn;return function(){hc(e),ao(t),Q0(n)}}function C9(){hc(null),ao(null),Q0(null)}const Lm=new Set;let Qn=null,Q_=null,tg=null,VT=new Set,Fw=[];function N9(){const e=Fw.shift();Fw.length>0&&queueMicrotask(N9),e()}let Rd=[],fS=null,WT=!1,tw=!1,rv=class YT{current=new Map;#t=new Map;#e=new Set;#n=0;#r=null;#c=!1;#i=[];#s=[];#a=[];#o=[];#l=[];#f=[];#u=[];skipped_effects=new Set;process(t){Rd=[],Q_=null;var n=null;if(Lm.size>1){n=new Map,tg=new Map;for(const[s,o]of this.current)n.set(s,{v:s.v,wv:s.wv}),s.v=o;for(const s of Lm)if(s!==this)for(const[o,a]of s.#t)n.has(o)||(n.set(o,{v:o.v,wv:o.wv}),o.v=a)}for(const s of t)this.#p(s);if(this.#i.length===0&&this.#n===0){this.#d();var r=this.#a,i=this.#o;this.#a=[],this.#o=[],this.#l=[],Q_=Qn,Qn=null,p$(r),p$(i),Qn===null?Qn=this:Lm.delete(this),this.#r?.resolve()}else this.#h(this.#a),this.#h(this.#o),this.#h(this.#l);if(n){for(const[s,{v:o,wv:a}]of n)s.wv<=a&&(s.v=o);tg=null}for(const s of this.#i)M0(s);for(const s of this.#s)M0(s);this.#i=[],this.#s=[]}#p(t){t.f^=qi;for(var n=t.first;n!==null;){var r=n.f,i=(r&(Lu|tp))!==0,s=i&&(r&qi)!==0,o=s||(r&al)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){if(i)n.f^=qi;else if((r&qi)===0)if((r&D5)!==0)this.#o.push(n);else if((r&P5)!==0){var a=n.b?.pending?this.#s:this.#i;a.push(n)}else u1(n)&&((n.f&Bg)!==0&&this.#l.push(n),M0(n));var l=n.first;if(l!==null){n=l;continue}}var c=n.parent;for(n=n.next;n===null&&c!==null;)n=c.next,c=c.parent}}#h(t){for(const n of t)((n.f&Oa)!==0?this.#f:this.#u).push(n),Fs(n,qi);t.length=0}capture(t,n){this.#t.has(t)||this.#t.set(t,n),this.current.set(t,t.v)}activate(){Qn=this}deactivate(){Qn=null,Q_=null;for(const t of VT)if(VT.delete(t),t(),Qn!==null)break}neuter(){this.#c=!0}flush(){Rd.length>0?O9():this.#d(),Qn===this&&(this.#n===0&&Lm.delete(this),this.deactivate())}#d(){if(!this.#c)for(const t of this.#e)t();this.#e.clear()}increment(){this.#n+=1}decrement(){if(this.#n-=1,this.#n===0){for(const t of this.#f)Fs(t,Oa),Cd(t);for(const t of this.#u)Fs(t,Du),Cd(t);this.#a=[],this.#o=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#r??=pdt()).promise}static ensure(){if(Qn===null){const t=Qn=new YT;Lm.add(Qn),tw||YT.enqueue(()=>{Qn===t&&t.flush()})}return Qn}static enqueue(t){Fw.length===0&&queueMicrotask(N9),Fw.unshift(t)}};function $9(e){var t=tw;tw=!0;try{for(var n;;){if(Zdt(),Rd.length===0&&(Qn?.flush(),Rd.length===0))return fS=null,n;O9()}}finally{tw=t}}function O9(){var e=T0;WT=!0;try{var t=0;for(m$(!0);Rd.length>0;){var n=rv.ensure();if(t++>1e3){var r,i;lpt()}n.process(Rd),cd.clear()}}finally{WT=!1,m$(e),fS=null}}function lpt(){try{xdt()}catch(e){tv(e,fS)}}function p$(e){var t=e.length;if(t!==0){for(var n=0;ni&&(r.f&B5)!==0)break}}for(;n{if(ud===s)return a();var l=dn,c=ud;ao(null),v$(s);var u=a();return ao(l),v$(c),u};return r&&n.set("length",xt(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&kdt();var u=n.get(l);return u===void 0?u=o(()=>{var f=xt(c.value);return n.set(l,f),f}):G(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>xt(wi));n.set(l,u),$y(i)}}else G(c,wi),$y(i);return!0},get(a,l,c){if(l===sc)return e;var u=n.get(l),f=l in a;if(u===void 0&&(!f||bu(a,l)?.writable)&&(u=o(()=>{var d=il(f?a[l]:wi),g=xt(d);return g}),n.set(l,u)),u!==void 0){var h=x(u);return h===wi?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=x(u))}else if(c===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==wi)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===sc)return!0;var c=n.get(l),u=c!==void 0&&c.v!==wi||Reflect.has(a,l);if(c!==void 0||He!==null&&(!u||bu(a,l)?.writable)){c===void 0&&(c=o(()=>{var h=u?il(a[l]):wi,d=xt(h);return d}),n.set(l,c));var f=x(c);if(f===wi)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var d=c;dxt(wi)),n.set(d+"",g))}if(f===void 0)(!h||bu(a,l)?.writable)&&(f=o(()=>xt(void 0)),G(f,il(c)),n.set(l,f));else{h=f.v!==wi;var y=o(()=>il(c));G(f,y)}var v=Reflect.getOwnPropertyDescriptor(a,l);if(v?.set&&v.set.call(u,c),!h){if(r&&typeof l=="string"){var b=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=b.v&&G(b,_+1)}$y(i)}return!0},ownKeys(a){x(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==wi});for(var[c,u]of n)u.v!==wi&&!(c in a)&&l.push(c);return l},setPrototypeOf(){Tdt()}})}function g$(e){try{if(e!==null&&typeof e=="object"&&sc in e)return e[sc]}catch{}return e}function cpt(e,t){return Object.is(g$(e),g$(t))}var HT,D9,F9,B9;function GT(){if(HT===void 0){HT=window,D9=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;F9=bu(t,"firstChild").get,B9=bu(t,"nextSibling").get,u$(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),u$(n)&&(n.__t=void 0)}}function La(e=""){return document.createTextNode(e)}function rs(e){return F9.call(e)}function Sl(e){return B9.call(e)}function ot(e,t){if(!ze)return rs(e);var n=rs(ln);if(n===null)n=ln.appendChild(La());else if(t&&n.nodeType!==q5){var r=La();return n?.before(r),Ds(r),r}return Ds(n),n}function Yt(e,t){if(!ze){var n=rs(e);return n instanceof Comment&&n.data===""?Sl(n):n}return ln}function yt(e,t=1,n=!1){let r=ze?ln:e;for(var i;t--;)i=r,r=Sl(r);if(!ze)return r;if(n&&r?.nodeType!==q5){var s=La();return r===null?i?.after(s):r.before(s),Ds(s),s}return Ds(r),r}function P9(e){e.textContent=""}function hS(){return!1}function U9(e){He===null&&dn===null&&wdt(),dn!==null&&(dn.f&Ma)!==0&&He===null&&_dt(),op&&bdt()}function upt(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function kc(e,t,n,r=!0){var i=He;i!==null&&(i.f&al)!==0&&(e|=al);var s={ctx:zn,deps:null,nodes_start:null,nodes_end:null,f:e|Oa,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{M0(s),s.f|=oS}catch(l){throw cs(s),l}else t!==null&&Cd(s);var o=n&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null&&(s.f&aS)===0;if(!o&&r&&(i!==null&&upt(s,i),dn!==null&&(dn.f&Uo)!==0&&(e&tp)===0)){var a=dn;(a.effects??=[]).push(s)}return s}function fpt(){return dn!==null&&!tl}function dS(e){const t=kc(sS,null,!1);return Fs(t,qi),t.teardown=e,t}function hs(e){U9();var t=He.f,n=!dn&&(t&Lu)!==0&&(t&oS)===0;if(n){var r=zn;(r.e??=[]).push(e)}else return z9(e)}function z9(e){return kc(D5|B5,e,!1)}function fe(e){return U9(),kc(sS|B5,e,!0)}function hpt(e){rv.ensure();const t=kc(tp,e,!0);return(n={})=>new Promise(r=>{n.outro?$f(t,()=>{cs(t),r(void 0)}):(cs(t),r(void 0))})}function Ug(e){return kc(D5,e,!1)}function dpt(e,t){var n=zn,r={effect:null,ran:!1,deps:e};n.l.$.push(r),r.effect=sp(()=>{e(),!r.ran&&(r.ran=!0,bo(t))})}function ppt(){var e=zn;sp(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&qi)!==0&&Fs(n,Du),u1(n)&&M0(n),t.ran=!1}})}function gpt(e){return kc(P5|aS,e,!0)}function sp(e,t=0){return kc(sS|t,e,!0)}function Ft(e,t=[],n=[]){R9(t,n,r=>{kc(sS,()=>e(...r.map(x)),!0)})}function lh(e,t=0){var n=kc(Bg|t,e,!0);return n}function zi(e,t=!0){return kc(Lu,e,!0,t)}function q9(e){var t=e.teardown;if(t!==null){const n=op,r=dn;y$(!0),ao(null);try{t.call(null)}finally{y$(n),ao(r)}}}function j9(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){n.ac?.abort(z5);var r=n.next;(n.f&tp)!==0?n.parent=null:cs(n,t),n=r}}function mpt(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Lu)===0&&cs(t),t=n}}function cs(e,t=!0){var n=!1;(t||(e.f&gdt)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(V9(e.nodes_start,e.nodes_end),n=!0),j9(e,t&&!n),Bw(e,0),Fs(e,ep);var r=e.transitions;if(r!==null)for(const s of r)s.stop();q9(e);var i=e.parent;i!==null&&i.first!==null&&W9(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function V9(e,t){for(;e!==null;){var n=e===t?null:Sl(e);e.remove(),e=n}}function W9(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 $f(e,t){var n=[];H5(e,n,!0),Y9(n,()=>{cs(e),t&&t()})}function Y9(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function H5(e,t,n){if((e.f&al)===0){if(e.f^=al,e.transitions!==null)for(const o of e.transitions)(o.is_global||n)&&t.push(o);for(var r=e.first;r!==null;){var i=r.next,s=(r.f&np)!==0||(r.f&Lu)!==0;H5(r,t,s?n:!1),r=i}}}function G5(e){H9(e,!0)}function H9(e,t){if((e.f&al)!==0){e.f^=al,(e.f&qi)===0&&(Fs(e,Oa),Cd(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&np)!==0||(n.f&Lu)!==0;H9(n,i?t:!1),n=r}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}let T0=!1;function m$(e){T0=e}let op=!1;function y$(e){op=e}let dn=null,tl=!1;function ao(e){dn=e}let He=null;function hc(e){He=e}let _u=null;function G9(e){dn!==null&&(_u===null?_u=[e]:_u.push(e))}let xs=null,Mo=0,la=null;function ypt(e){la=e}let X9=1,iv=0,ud=iv;function v$(e){ud=e}let Sf=!1;function K9(){return++X9}function u1(e){var t=e.f;if((t&Oa)!==0)return!0;if((t&Du)!==0){var n=e.deps,r=(t&Ma)!==0;if(n!==null){var i,s,o=(t&Lw)!==0,a=r&&He!==null&&!Sf,l=n.length;if((o||a)&&(He===null||(He.f&ep)===0)){var c=e,u=c.parent;for(i=0;ie.wv)return!0}(!r||He!==null&&!Sf)&&Fs(e,qi)}return!1}function J9(e,t,n=!0){var r=e.reactions;if(r!==null&&!_u?.includes(e))for(var i=0;i0)for(h.length=Mo+xs.length,d=0;d{document.activeElement===n&&e.focus()})}}let b$=!1;function tP(){b$||(b$=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function pS(e){var t=dn,n=He;ao(null),hc(null);try{return e()}finally{ao(t),hc(n)}}function Ipt(e,t,n,r=n){e.addEventListener(t,()=>pS(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),tP()}const eP=new Set,KT=new Set;function nP(e,t,n,r={}){function i(s){if(r.capture||ly.call(t,s),!s.cancelBubble)return pS(()=>n?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ip(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function I0(e,t,n,r,i){var s={capture:r,passive:i},o=nP(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&dS(()=>{t.removeEventListener(e,o,s)})}function Dr(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,ao(u),hc(f)}}}function K5(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("",""),t.content}function Po(e,t){var n=He;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function At(e,t){var n=(t&v9)!==0,r=(t&Udt)!==0,i,s=!e.startsWith("");return()=>{if(ze)return Po(ln,null),ln;i===void 0&&(i=K5(s?e:""+e),n||(i=rs(i)));var o=r||D9?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=rs(o),l=o.lastChild;Po(a,l)}else Po(o,o);return o}}function Rpt(e,t,n="svg"){var r=!e.startsWith(""),i=(t&v9)!==0,s=`<${n}>${r?e:""+e}`,o;return()=>{if(ze)return Po(ln,null),ln;if(!o){var a=K5(s),l=rs(a);if(i)for(o=document.createDocumentFragment();rs(l);)o.appendChild(rs(l));else o=rs(l)}var c=o.cloneNode(!0);if(i){var u=rs(c),f=c.lastChild;Po(u,f)}else Po(c,c);return c}}function tn(e,t){return Rpt(e,t,"svg")}function io(e=""){if(!ze){var t=La(e+"");return Po(t,t),t}var n=ln;return n.nodeType!==q5&&(n.before(n=La()),Ds(n)),Po(n,n),n}function wn(){if(ze)return Po(ln,null),ln;var e=document.createDocumentFragment(),t=document.createComment(""),n=La();return e.append(t,n),Po(t,n),e}function rt(e,t){if(ze){He.nodes_end=ln,Tu();return}e!==null&&e.before(t)}let JT=!0;function ue(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function J5(e,t){return rP(e,t)}function Cpt(e,t){GT(),t.intro=t.intro??!1;const n=t.target,r=ze,i=ln;try{for(var s=rs(n);s&&(s.nodeType!==Z0||s.data!==b9);)s=Sl(s);if(!s)throw ld;rl(!0),Ds(s),Tu();const o=rP(e,{...t,anchor:s});if(ln===null||ln.nodeType!==Z0||ln.data!==V5)throw l1(),ld;return rl(!1),o}catch(o){if(o===ld)return t.recover===!1&&Sdt(),GT(),P9(n),rl(!1),J5(e,t);throw o}finally{rl(r),Ds(i)}}const zp=new Map;function rP(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0}){GT();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(La());return zi(()=>{if(s){ye({});var h=zn;h.c=s}i&&(r.$$events=i),ze&&Po(f,null),JT=o,c=e(f,r)||{},JT=!0,ze&&(He.nodes_end=ln),s&&ve()}),()=>{for(var h of a){t.removeEventListener(h,ly);var d=zp.get(h);--d===0?(document.removeEventListener(h,ly),zp.delete(h)):zp.set(h,d)}KT.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return ZT.set(c,u),c}let ZT=new WeakMap;function Npt(e,t){const n=ZT.get(e);return n?(ZT.delete(e),n(t)):Promise.resolve()}function Lt(e,t,n=!1){ze&&Tu();var r=e,i=null,s=null,o=wi,a=n?np:0,l=!1;const c=(d,g=!0)=>{l=!0,h(g,d)};var u=null;function f(){u!==null&&(u.lastChild.remove(),r.before(u),u=null);var d=o?i:s,g=o?s:i;d&&G5(d),g&&$f(g,()=>{o?s=null:i=null})}const h=(d,g)=>{if(o===(o=d))return;let y=!1;if(ze){const k=_9(r)===j5;!!o===k&&(r=Dw(),Ds(r),rl(!1),y=!0)}var v=hS(),b=r;if(v&&(u=document.createDocumentFragment(),u.append(b=La())),o?i??=g&&zi(()=>g(b)):s??=g&&zi(()=>g(b)),v){var _=Qn,w=o?i:s,S=o?s:i;w&&_.skipped_effects.delete(w),S&&_.skipped_effects.add(S),_.add_callback(f)}else f();y&&rl(!0)};lh(()=>{l=!1,t(c),l||h(null,null)},a),ze&&(r=ln)}function gS(e,t,n){ze&&Tu();var r=e,i=wi,s,o,a=null,l=rp()?Wdt:uS;function c(){s&&$f(s),a!==null&&(a.lastChild.remove(),r.before(a),a=null),s=o}lh(()=>{if(l(i,i=t())){var u=r,f=hS();f&&(a=document.createDocumentFragment(),a.append(u=La())),o=zi(()=>n(u)),f?Qn.add_callback(c):c()}}),ze&&(r=ln)}let ew=null;function Bn(e,t){return t}function $pt(e,t,n){for(var r=e.items,i=[],s=t.length,o=0;o0&&i.length===0&&n!==null;if(a){var l=n.parentNode;P9(l),l.append(n),r.clear(),Pl(e,t[0].prev,t[s-1].next)}Y9(i,()=>{for(var c=0;c{var b=n();return Fg(b)?b:b==null?[]:O5(b)}),g,y;function v(){Opt(y,g,a,h,o,i,t,r,n),s!==null&&(g.length===0?u?G5(u):u=zi(()=>s(o)):u!==null&&$f(u,()=>{u=null}))}lh(()=>{y??=He,g=x(d);var b=g.length;if(f&&b===0)return;f=b===0;let _=!1;if(ze){var w=_9(o)===j5;w!==(b===0)&&(o=Dw(),Ds(o),rl(!1),_=!0)}if(ze){for(var S=null,k,A=0;A0&&Ds(Dw())}if(ze)b===0&&s&&(u=zi(()=>s(o)));else if(hS()){var I=new Set,C=Qn;for(A=0;A0){var B=(o&y9)!==0&&f===0?i:null;if(c){for(T=0;T{if(b!==void 0)for(A of b)A.a?.apply()}),e.first=n.first&&n.first.e,e.last=v&&v.e;for(var V of r.values())cs(V.e);r.clear()}function iP(e,t,n,r){(r&lS)!==0&&eg(e.v,t),(r&cS)!==0?eg(e.i,n):e.i=n}function QT(e,t,n,r,i,s,o,a,l,c,u){var f=ew,h=(l&lS)!==0,d=(l&Cdt)===0,g=h?d?k0(i,!1,!1):Nd(i):i,y=(l&cS)===0?o:Nd(o),v={i:y,v:g,k:s,a:null,e:null,prev:n,next:r};ew=v;try{if(e===null){var b=document.createDocumentFragment();b.append(e=La())}return v.e=zi(()=>a(e,g,y,c),ze),v.e.prev=n&&n.e,v.e.next=r&&r.e,n===null?u||(t.first=v):(n.next=v,n.e.next=v.e),r!==null&&(r.prev=v,r.e.prev=v.e),v}finally{ew=f}}function LE(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,s=e.e.nodes_start;s!==null&&s!==r;){var o=Sl(s);i.before(s),s=o}}function Pl(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function Lpt(e,t,n=!1,r=!1,i=!1){var s=e,o="";Ft(()=>{var a=He;if(o===(o=t()??"")){ze&&Tu();return}if(a.nodes_start!==null&&(V9(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),o!==""){if(ze){ln.data;for(var l=Tu(),c=l;l!==null&&(l.nodeType!==Z0||l.data!=="");)c=l,l=Sl(l);if(l===null)throw l1(),ld;Po(ln,c),s=Ds(l);return}var u=o+"";n?u=`${u}`:r&&(u=`${u}`);var f=K5(u);if((n||r)&&(f=rs(f)),Po(rs(f),f.lastChild),n||r)for(;rs(f);)s.before(rs(f));else s.before(f)}})}function sv(e,t,...n){var r=e,i=yn,s;lh(()=>{i!==(i=t())&&(s&&(cs(s),s=null),s=zi(()=>i(r,...n)))},np),ze&&(r=ln)}function ov(e,t,n){ze&&Tu();var r=e,i,s,o=null,a=null;function l(){s&&($f(s),s=null),o&&(o.lastChild.remove(),r.before(o),o=null),s=a,a=null}lh(()=>{if(i!==(i=t())){var c=hS();if(i){var u=r;c&&(o=document.createDocumentFragment(),o.append(u=La())),a=zi(()=>n(u,i))}c?Qn.add_callback(l):l()}},np),ze&&(r=ln)}function sP(e,t,n){Ug(()=>{var r=bo(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,s={};sp(()=>{var o=n();X5(o),i&&uS(s,o)&&(s=o,r.update(o))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function Dpt(e,t){var n=void 0,r;lh(()=>{n!==(n=t())&&(r&&(cs(r),r=null),n&&(r=zi(()=>{Ug(()=>n(e))})))})}function oP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t=0;){var a=o+s;(o===0||w$.includes(r[o-1]))&&(a===r.length||w$.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function x$(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function DE(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Upt(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,l=[];r&&l.push(...Object.keys(r).map(DE)),i&&l.push(...Object.keys(i).map(DE));var c=0,u=-1;const y=e.length;for(var f=0;f{ng(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),dS(()=>{t.disconnect()})}function S$(e){return"__value"in e?e.__value:e.value}const Dm=Symbol("class"),Fm=Symbol("style"),aP=Symbol("is custom element"),lP=Symbol("is html");function cP(e){if(ze){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;ct(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var i=e.checked;ct(e,"checked",null),e.checked=i}}};e.__on_r=n,Jdt(n),tP()}}function zpt(e,t){var n=Z5(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function qpt(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function ct(e,t,n,r){var i=Z5(e);ze&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[mdt]=n),n==null?e.removeAttribute(t):typeof n!="string"&&uP(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function jpt(e,t,n,r,i=!1){var s=Z5(e),o=s[aP],a=!s[lP];let l=ze&&o;l&&rl(!1);var c=t||{},u=e.tagName==="OPTION";for(var f in t)f in n||(n[f]=null);n.class?n.class=Bpt(n.class):n[Dm]&&(n.class=null),n[Fm]&&(n.style??=null);var h=uP(e);for(const w in n){let S=n[w];if(u&&w==="value"&&S==null){e.value=e.__value="",c[w]=S;continue}if(w==="class"){var d=e.namespaceURI==="http://www.w3.org/1999/xhtml";lr(e,d,S,r,t?.[Dm],n[Dm]),c[w]=S,c[Dm]=n[Dm];continue}if(w==="style"){Ce(e,S,t?.[Fm],n[Fm]),c[w]=S,c[Fm]=n[Fm];continue}var g=c[w];if(!(S===g&&!(S===void 0&&e.hasAttribute(w)))){c[w]=S;var y=w[0]+w[1];if(y!=="$$")if(y==="on"){const k={},A="$$"+w;let T=w.slice(2);var v=Spt(T);if(wpt(T)&&(T=T.slice(0,-7),k.capture=!0),!v&&g){if(S!=null)continue;e.removeEventListener(T,c[A],k),c[A]=null}if(S!=null)if(v)e[`__${T}`]=S,Dr([T]);else{let M=function(I){c[w].call(this,I)};c[A]=nP(T,e,M,k)}else v&&(e[`__${T}`]=void 0)}else if(w==="style")ct(e,w,S);else if(w==="autofocus")Mpt(e,!!S);else if(!o&&(w==="__value"||w==="value"&&S!=null))e.value=e.__value=S;else if(w==="selected"&&u)qpt(e,S);else{var b=w;a||(b=Ept(b));var _=b==="defaultValue"||b==="defaultChecked";if(S==null&&!o&&!_)if(s[w]=null,b==="value"||b==="checked"){let k=e;const A=t===void 0;if(b==="value"){let T=k.defaultValue;k.removeAttribute(b),k.defaultValue=T,k.value=k.__value=A?T:null}else{let T=k.defaultChecked;k.removeAttribute(b),k.defaultChecked=T,k.checked=A?T:!1}}else e.removeAttribute(w);else _||h.includes(b)&&(o||typeof S!="string")?(e[b]=S,b in s&&(s[b]=wi)):typeof S!="function"&&ct(e,b,S)}}}return l&&rl(!0),c}function Go(e,t,n=[],r=[],i,s=!1){R9(n,r,o=>{var a=void 0,l={},c=e.nodeName==="SELECT",u=!1;if(lh(()=>{var h=t(...o.map(x)),d=jpt(e,a,h,i,s);u&&c&&"value"in h&&ng(e,h.value);for(let y of Object.getOwnPropertySymbols(l))h[y]||cs(l[y]);for(let y of Object.getOwnPropertySymbols(h)){var g=h[y];y.description===qdt&&(!a||g!==a[y])&&(l[y]&&cs(l[y]),l[y]=zi(()=>Dpt(e,()=>g))),d[y]=g}a=d}),c){var f=e;Ug(()=>{ng(f,a.value,!0),Pw(f)})}u=!0})}function Z5(e){return e.__attributes??={[aP]:e.nodeName.includes("-"),[lP]:e.namespaceURI===zdt}}var A$=new Map;function uP(e){var t=A$.get(e.nodeName);if(t)return t;A$.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=m9(r);for(var s in n)n[s].set&&t.push(s);r=L5(r)}return t}const Vpt=()=>performance.now(),Hl={tick:e=>requestAnimationFrame(e),now:()=>Vpt(),tasks:new Set};function fP(){const e=Hl.now();Hl.tasks.forEach(t=>{t.c(e)||(Hl.tasks.delete(t),t.f())}),Hl.tasks.size!==0&&Hl.tick(fP)}function hP(e){let t;return Hl.tasks.size===0&&Hl.tick(fP),{promise:new Promise(n=>{Hl.tasks.add(t={c:e,f:n})}),abort(){Hl.tasks.delete(t)}}}function Jb(e,t){pS(()=>{e.dispatchEvent(new CustomEvent(t))})}function Wpt(e){if(e==="float")return"cssFloat";if(e==="offset")return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return t.length===1?t[0]:t[0]+t.slice(1).map(n=>n[0].toUpperCase()+n.slice(1)).join("")}function E$(e){const t={},n=e.split(";");for(const r of n){const[i,s]=r.split(":");if(!i||s===void 0)break;const o=Wpt(i.trim());t[o]=s.trim()}return t}const Ypt=e=>e;function Hpt(e,t,n){var r=ew,i,s,o,a=null;r.a??={element:e,measure(){i=this.element.getBoundingClientRect()},apply(){if(o?.abort(),s=this.element.getBoundingClientRect(),i.left!==s.left||i.right!==s.right||i.top!==s.top||i.bottom!==s.bottom){const l=t()(this.element,{from:i,to:s},n?.());o=zw(this.element,l,void 0,1,()=>{o?.abort(),o=void 0})}},fix(){if(!e.getAnimations().length){var{position:l,width:c,height:u}=getComputedStyle(e);if(l!=="absolute"&&l!=="fixed"){var f=e.style;a={position:f.position,width:f.width,height:f.height,transform:f.transform},f.position="absolute",f.width=c,f.height=u;var h=e.getBoundingClientRect();if(i.left!==h.left||i.top!==h.top){var d=`translate(${i.left-h.left}px, ${i.top-h.top}px)`;f.transform=f.transform?`${f.transform} ${d}`:d}}}},unfix(){if(a){var l=e.style;l.position=a.position,l.width=a.width,l.height=a.height,l.transform=a.transform}}},r.a.element=e}function Uw(e,t,n,r){var i=(e&Fdt)!==0,s=(e&Bdt)!==0,o=i&&s,a=(e&Pdt)!==0,l=o?"both":i?"in":"out",c,u=t.inert,f=t.style.overflow,h,d;function g(){return pS(()=>c??=n()(t,r?.()??{},{direction:l}))}var y={is_global:a,in(){if(t.inert=u,!i){d?.abort(),d?.reset?.();return}s||h?.abort(),Jb(t,"introstart"),h=zw(t,g(),d,1,()=>{Jb(t,"introend"),h?.abort(),h=c=void 0,t.style.overflow=f})},out(w){if(!s){w?.(),c=void 0;return}t.inert=!0,Jb(t,"outrostart"),d=zw(t,g(),h,0,()=>{Jb(t,"outroend"),w?.()})},stop:()=>{h?.abort(),d?.abort()}},v=He;if((v.transitions??=[]).push(y),i&&JT){var b=a;if(!b){for(var _=v.parent;_&&(_.f&np)!==0;)for(;(_=_.parent)&&(_.f&Bg)===0;);b=!_||(_.f&oS)!==0}b&&Ug(()=>{bo(()=>y.in())})}}function zw(e,t,n,r,i){var s=r===1;if(i0(t)){var o,a=!1;return ip(()=>{if(!a){var v=t({direction:s?"in":"out"});o=zw(e,v,n,r,i)}}),{abort:()=>{a=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(n?.deactivate(),!t?.duration)return i(),{abort:yn,deactivate:yn,reset:yn,t:()=>r};const{delay:l=0,css:c,tick:u,easing:f=Ypt}=t;var h=[];if(s&&n===void 0&&(u&&u(0,1),c)){var d=E$(c(0,1));h.push(d,d)}var g=()=>1-r,y=e.animate(h,{duration:l,fill:"forwards"});return y.onfinish=()=>{y.cancel();var v=n?.t()??1-r;n?.abort();var b=r-v,_=t.duration*Math.abs(b),w=[];if(_>0){var S=!1;if(c)for(var k=Math.ceil(_/16.666666666666668),A=0;A<=k;A+=1){var T=v+b*f(A/k),M=E$(c(T,1-T));w.push(M),S||=M.overflow==="hidden"}S&&(e.style.overflow="hidden"),g=()=>{var I=y.currentTime;return v+b*f(I/_)},u&&hP(()=>{if(y.playState!=="running")return!1;var I=g();return u(I,1-I),!0})}y=e.animate(w,{duration:_,fill:"forwards"}),y.onfinish=()=>{g=()=>r,u?.(r,1-r),i()}},{abort:()=>{y&&(y.cancel(),y.effect=null,y.onfinish=yn)},deactivate:()=>{i=yn},reset:()=>{r===0&&u?.(1,0)},t:()=>g()}}function Gpt(e,t,n=t){var r=rp(),i=new WeakSet;Ipt(e,"input",s=>{var o=s?e.defaultValue:e.value;if(o=BE(e)?PE(o):o,n(o),Qn!==null&&i.add(Qn),r&&o!==(o=t())){var a=e.selectionStart,l=e.selectionEnd;e.value=o??"",l!==null&&(e.selectionStart=a,e.selectionEnd=Math.min(l,e.value.length))}}),(ze&&e.defaultValue!==e.value||bo(t)==null&&e.value)&&(n(BE(e)?PE(e.value):e.value),Qn!==null&&i.add(Qn)),sp(()=>{var s=t();if(e===document.activeElement){var o=Q_??Qn;if(i.has(o))return}BE(e)&&s===PE(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function BE(e){var t=e.type;return t==="number"||t==="range"}function PE(e){return e===""?null:+e}function Xpt(e,t,n){var r=bu(e,t);r&&r.set&&(e[t]=n,dS(()=>{e[t]=null}))}class Q5{#t=new WeakMap;#e;#n;static entries=new WeakMap;constructor(t){this.#n=t}observe(t,n){var r=this.#t.get(t)||new Set;return r.add(n),this.#t.set(t,r),this.#r().observe(t,this.#n),()=>{var i=this.#t.get(t);i.delete(n),i.size===0&&(this.#t.delete(t),this.#e.unobserve(t))}}#r(){return this.#e??(this.#e=new ResizeObserver(t=>{for(var n of t){Q5.entries.set(n.target,n);for(var r of this.#t.get(n.target)||[])r(n)}}))}}var Kpt=new Q5({box:"border-box"});function $d(e,t,n){var r=Kpt.observe(e,()=>n(e[t]));Ug(()=>(bo(()=>n(e[t])),r))}function k$(e,t){return e===t||e?.[sc]===t}function ho(e={},t,n,r){return Ug(()=>{var i,s;return sp(()=>{i=s,s=[],bo(()=>{e!==n(...s)&&(t(e,...s),i&&k$(n(...i),e)&&t(null,...i))})}),()=>{ip(()=>{s&&k$(n(...s),e)&&t(null,...s)})}}),e}function t6(e=!1){const t=zn,n=t.l.u;if(!n)return;let r=()=>X5(t.s);if(e){let i=0,s={};const o=c1(()=>{let a=!1;const l=t.s;for(const c in l)l[c]!==s[c]&&(s[c]=l[c],a=!0);return a&&i++,i});r=()=>x(o)}n.b.length&&fe(()=>{T$(t,r),Qy(n.b)}),hs(()=>{const i=bo(()=>n.m.map(ddt));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&hs(()=>{T$(t,r),Qy(n.a)})}function T$(e,t){if(e.l.s)for(const n of e.l.s)x(n);t()}function M$(e,t){var n=e.$$events?.[t.type],r=Fg(n)?n.slice():n==null?[]:[n];for(var i of r)i.call(this,t)}function e6(e,t,n){if(e==null)return t(void 0),n&&n(void 0),yn;const r=bo(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const qp=[];function dP(e,t){return{subscribe:rg(e,t).subscribe}}function rg(e,t=yn){let n=null;const r=new Set;function i(a){if(uS(e,a)&&(e=a,n)){const l=!qp.length;for(const c of r)c[1](),qp.push(c,e);if(l){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:o}}function n6(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=t.length<2;return dP(n,(o,a)=>{let l=!1;const c=[];let u=0,f=yn;const h=()=>{if(u)return;f();const g=t(r?c[0]:c,o,a);s?o(g):f=typeof g=="function"?g:yn},d=i.map((g,y)=>e6(g,v=>{c[y]=v,u&=~(1<{u|=1<t=n)(),t}let Zb=!1,t4=Symbol();function us(e,t,n){const r=n[t]??={store:null,source:k0(void 0),unsubscribe:yn};if(r.store!==e&&!(t4 in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=yn;else{var i=!0;r.unsubscribe=e6(e,s=>{i?r.source.v=s:G(r.source,s)}),i=!1}return e&&t4 in n?Jpt(e):x(r.source)}function Bm(e,t){return e.set(t),t}function _o(){const e={};function t(){dS(()=>{for(var n in e)e[n].unsubscribe();Zy(e,t4,{enumerable:!1,value:!0})})}return[e,t]}function Zpt(e){var t=Zb;try{return Zb=!1,[e(),Zb]}finally{Zb=t}}const Qpt={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function qs(e,t,n){return new Proxy({props:e,exclude:t},Qpt)}const t0t={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(i0(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];i0(i)&&(i=i());const s=bu(i,t);if(s&&s.set)return s.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(i0(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const i=bu(r,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===sc||t===U5)return!1;for(let n of e.props)if(i0(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props)if(i0(n)&&(n=n()),!!n){for(const r in n)t.includes(r)||t.push(r);for(const r of Object.getOwnPropertySymbols(n))t.includes(r)||t.push(r)}return t}};function e4(...e){return new Proxy({props:e},t0t)}function se(e,t,n,r){var i=!Pg||(n&$dt)!==0,s=(n&Ldt)!==0,o=(n&Ddt)!==0,a=r,l=!0,c=()=>(l&&(l=!1,a=o?bo(r):r),a),u;if(s){var f=sc in e||U5 in e;u=bu(e,t)?.set??(f&&t in e?w=>e[t]=w:void 0)}var h,d=!1;s?[h,d]=Zpt(()=>e[t]):h=e[t],h===void 0&&r!==void 0&&(h=c(),u&&(i&&Edt(),u(h)));var g;if(i?g=()=>{var w=e[t];return w===void 0?c():(l=!0,w)}:g=()=>{var w=e[t];return w!==void 0&&(a=void 0),w===void 0?a:w},i&&(n&Odt)===0)return g;if(u){var y=e.$$legacy;return function(w,S){return arguments.length>0?((!i||!S||y||d)&&u(S?g():w),w):g()}}var v=!1,b=((n&Ndt)!==0?c1:W5)(()=>(v=!1,g()));s&&x(b);var _=He;return function(w,S){if(arguments.length>0){const k=S?x(b):i&&s?il(w):w;return G(b,k),v=!0,a!==void 0&&(a=k),w}return op&&v||(_.f&ep)!==0?b.v:x(b)}}function e0t(e){return new n0t(e)}class n0t{#t;#e;constructor(t){var n=new Map,r=(s,o)=>{var a=k0(o,!1,!1);return n.set(s,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(s,o){return x(n.get(o)??r(o,Reflect.get(s,o)))},has(s,o){return o===U5?!0:(x(n.get(o)??r(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return G(n.get(o)??r(o,a),a),Reflect.set(s,o,a)}});this.#e=(t.hydrate?Cpt:J5)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&$9(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||Zy(this,s,{get(){return this.#e[s]},set(o){this.#e[s]=o},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{Npt(this.#e)}}$set(t){this.#e.$set(t)}$on(t,n){this.#t[t]=this.#t[t]||[];const r=(...i)=>n.call(this,...i);return this.#t[t].push(r),()=>{this.#t[t]=this.#t[t].filter(i=>i!==r)}}$destroy(){this.#e.$destroy()}}function zg(e){zn===null&&a1(),Pg&&zn.l!==null?pP(zn).m.push(e):hs(()=>{const t=bo(e);if(typeof t=="function")return t})}function r6(e){zn===null&&a1(),zg(()=>()=>bo(e))}function r0t(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function i0t(){const e=zn;return e===null&&a1(),(t,n,r)=>{const i=e.s.$$events?.[t];if(i){const s=Fg(i)?i.slice():[i],o=r0t(t,n,r);for(const a of s)a.call(e.x,o);return!o.defaultPrevented}return!0}}function s0t(e){zn===null&&a1(),zn.l===null&&Adt(),pP(zn).a.push(e)}function pP(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const o0t="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(o0t);Hdt();function a0t(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,s,o=[],a="",l=e.split("/");for(l[0]||l.shift();i=l.shift();)n=i[0],n==="*"?(o.push("wild"),a+="/(.*)"):n===":"?(r=i.indexOf("?",1),s=i.indexOf(".",1),o.push(i.substring(1,~r?r:~s?s:i.length)),a+=~r&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(a+=(~r?"?":"")+"\\"+i.substring(s))):a+="/"+i;return{keys:o,pattern:new RegExp("^"+a+"/?$","i")}}function I$(){const e=window.location.href.indexOf("#/");let t=e>-1?window.location.href.substr(e+1):"/";const n=t.indexOf("?");let r="";return n>-1&&(r=t.substr(n+1),t=t.substr(0,n)),{location:t,querystring:r}}const i6=dP(null,function(t){t(I$());const n=()=>{t(I$())};return window.addEventListener("hashchange",n,!1),function(){window.removeEventListener("hashchange",n,!1)}});n6(i6,e=>e.location);n6(i6,e=>e.querystring);const R$=rg(void 0);function l0t(e){e?window.scrollTo(e.__svelte_spa_router_scrollX,e.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function c0t(e,t){ye(t,!1);let n=se(t,"routes",24,()=>({})),r=se(t,"prefix",8,""),i=se(t,"restoreScrollState",8,!1);class s{constructor(A,T){if(!T||typeof T!="function"&&(typeof T!="object"||T._sveltesparouter!==!0))throw Error("Invalid component object");if(!A||typeof A=="string"&&(A.length<1||A.charAt(0)!="/"&&A.charAt(0)!="*")||typeof A=="object"&&!(A instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:M,keys:I}=a0t(A);this.path=A,typeof T=="object"&&T._sveltesparouter===!0?(this.component=T.component,this.conditions=T.conditions||[],this.userData=T.userData,this.props=T.props||{}):(this.component=()=>Promise.resolve(T),this.conditions=[],this.props={}),this._pattern=M,this._keys=I}match(A){if(r()){if(typeof r()=="string")if(A.startsWith(r()))A=A.substr(r().length)||"/";else return null;else if(r()instanceof RegExp){const C=A.match(r());if(C&&C[0])A=A.substr(C[0].length)||"/";else return null}}const T=this._pattern.exec(A);if(T===null)return null;if(this._keys===!1)return T;const M={};let I=0;for(;I{o.push(new s(A,k))}):Object.keys(n()).forEach(k=>{o.push(new s(k,n()[k]))});let a=k0(null),l=k0(null),c=k0({});const u=i0t();async function f(k,A){await bpt(),u(k,A)}let h=null,d=null;i()&&(d=k=>{k.state&&(k.state.__svelte_spa_router_scrollY||k.state.__svelte_spa_router_scrollX)?h=k.state:h=null},window.addEventListener("popstate",d),s0t(()=>{l0t(h)}));let g=null,y=null;const v=i6.subscribe(async k=>{g=k;let A=0;for(;A{R$.set(x(l))});return}G(a,null),y=null,R$.set(void 0)});r6(()=>{v(),d&&window.removeEventListener("popstate",d)}),dpt(()=>X5(i()),()=>{history.scrollRestoration=i()?"manual":"auto"}),ppt(),t6();var b=wn(),_=Yt(b);{var w=k=>{var A=wn(),T=Yt(A);ov(T,()=>x(a),(M,I)=>{I(M,e4({get params(){return x(l)}},()=>x(c),{$$events:{routeEvent(C){M$.call(this,t,C)}}}))}),rt(k,A)},S=k=>{var A=wn(),T=Yt(A);ov(T,()=>x(a),(M,I)=>{I(M,e4(()=>x(c),{$$events:{routeEvent(C){M$.call(this,t,C)}}}))}),rt(k,A)};Lt(_,k=>{x(l)?k(w):k(S,!1)})}rt(e,b),ve()}const C$={};function gP(e,t=!1){let n,r,i=C$;function s(c){n=e(c)?.catch(()=>{}).finally(()=>{if(r){const{event:u}=r;r=null,s(u)}else n=null})||null}function o(c){r={event:c}}function a(c){n?o(c):s(c)}function l(c){i!==c&&requestAnimationFrame(()=>{const u=i;i=C$,a(u)}),i=c}return t?l:a}function mS(e){return e instanceof ch}class ch{_filterBy;_requestUpdate;_coordinator;_pending;_enabled;_initialized;_request;constructor(t){this._filterBy=t,this._requestUpdate=gP(()=>this.requestQuery(),!0),this._coordinator=null,this._pending=Promise.resolve(),this._enabled=!0,this._initialized=!1,this._request=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get enabled(){return this._enabled}set enabled(t){t=!!t,this._enabled!==t&&(this._enabled=t,t&&(this._initialized?this._request&&this.requestQuery(this._request===!0?void 0:this._request):this.initialize(),this._request=null))}get pending(){return this._pending}get filterBy(){return this._filterBy}get filterStable(){return!0}async prepare(){}query(t){return null}queryPending(){return this}queryResult(t){return this}queryError(t){return this}requestQuery(t){if(this._enabled){const n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}else return this._request=t??!0,null}requestUpdate(){this._enabled?this._requestUpdate():this.requestQuery()}initialize(){this._enabled?this._coordinator&&(this._initialized=!0,this._pending=this.prepare().then(()=>this.requestQuery())):this._initialized=!1}destroy(){this.coordinator?.disconnect(this)}update(){return this}}const mP=Uint8Array.of(65,82,82,79,87,49),yS={V1:0,V4:3,V5:4},Af={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},Nt={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},yP={HALF:0,SINGLE:1,DOUBLE:2},qw={DAY:0,MILLISECOND:1},Ia={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},R0={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},s6={Sparse:0,Dense:1},u0t=Uint8Array,vP=Uint16Array,f0t=Uint32Array,bP=BigUint64Array,_P=Int8Array,h0t=Int16Array,Al=Int32Array,Tc=BigInt64Array,d0t=Float32Array,vS=Float64Array;function p0t(e,t){const n=Math.log2(e)-3;return(t?[_P,h0t,Al,Tc]:[u0t,vP,f0t,bP])[n]}function o6(e,t){let n=0,r=e.length;if(r<=2147483648)do{const i=n+r>>>1;e[i]<=t?n=i+1:r=i}while(nt.includes(r),n??(()=>`${e} must be one of ${t}`))}function wP(e,t){for(const[n,r]of Object.entries(e))if(r===t)return n;return""}const l6=e=>`Unsupported data type: "${wP(Nt,e)}" (id ${e})`,xP=(e,t,n=!0,r=null)=>({name:e,type:t,nullable:n,metadata:r});function SP(e){return Object.hasOwn(e,"name")&&AP(e.type)}function AP(e){return typeof e?.typeId=="number"}function Ff(e,t="",n=!0){return SP(e)?e:xP(t,a6(e,AP,()=>"Data type expected."),n)}const g0t=(e,t,n=!1,r=-1)=>({typeId:Nt.Dictionary,id:r,dictionary:e,indices:t||kP(),ordered:n}),EP=(e=32,t=!0)=>({typeId:Nt.Int,bitWidth:pl(e,[8,16,32,64]),signed:t,values:p0t(e,t)}),kP=()=>EP(32),m0t=(e=2)=>({typeId:Nt.Float,precision:pl(e,yP),values:[vP,d0t,vS][e]}),y0t=()=>({typeId:Nt.Binary,offsets:Al}),v0t=()=>({typeId:Nt.Utf8,offsets:Al}),b0t=(e,t,n=128)=>({typeId:Nt.Decimal,precision:e,scale:t,bitWidth:pl(n,[32,64,128,256]),values:n===32?Al:bP}),_0t=e=>({typeId:Nt.Date,unit:pl(e,qw),values:e===qw.DAY?Al:Tc}),w0t=(e=Ia.MILLISECOND,t=32)=>({typeId:Nt.Time,unit:pl(e,Ia),bitWidth:pl(t,[32,64]),values:t===32?Al:Tc}),x0t=(e=Ia.MILLISECOND,t=null)=>({typeId:Nt.Timestamp,unit:pl(e,Ia),timezone:t,values:Tc}),S0t=(e=R0.MONTH_DAY_NANO)=>({typeId:Nt.Interval,unit:pl(e,R0),values:e===R0.MONTH_DAY_NANO?void 0:Al}),A0t=e=>({typeId:Nt.List,children:[Ff(e)],offsets:Al}),E0t=e=>({typeId:Nt.Struct,children:Array.isArray(e)&&SP(e[0])?e:Object.entries(e).map(([t,n])=>xP(t,n))}),k0t=(e,t,n,r)=>(n??=t.map((i,s)=>s),{typeId:Nt.Union,mode:pl(e,s6),typeIds:n,typeMap:n.reduce((i,s,o)=>(i[s]=o,i),{}),children:t.map((i,s)=>Ff(i,`_${s}`)),typeIdForValue:r,offsets:Al}),T0t=e=>({typeId:Nt.FixedSizeBinary,stride:e}),M0t=(e,t)=>({typeId:Nt.FixedSizeList,stride:t,children:[Ff(e)]}),I0t=(e,t)=>({typeId:Nt.Map,keysSorted:e,children:[t],offsets:Al}),R0t=(e=Ia.MILLISECOND)=>({typeId:Nt.Duration,unit:pl(e,Ia),values:Tc}),C0t=()=>({typeId:Nt.LargeBinary,offsets:Tc}),N0t=()=>({typeId:Nt.LargeUtf8,offsets:Tc}),$0t=e=>({typeId:Nt.LargeList,children:[Ff(e)],offsets:Tc}),O0t=(e,t)=>({typeId:Nt.RunEndEncoded,children:[a6(Ff(e,"run_ends"),n=>n.type.typeId===Nt.Int,()=>"Run-ends must have an integer type."),Ff(t,"values")]}),L0t=e=>({typeId:Nt.ListView,children:[Ff(e,"value")],offsets:Al}),D0t=e=>({typeId:Nt.LargeListView,children:[Ff(e,"value")],offsets:Tc}),F0t=new vS(2),B0t=F0t.buffer;new Tc(B0t);function Bf(e){if(e>Number.MAX_SAFE_INTEGER||eBigInt.asUintN(64,e);function P0t(e,t){return BigInt.asIntN(64,e[t])}function U0t(e,t){const n=t<<1;let r;return BigInt.asIntN(64,e[n+1])<0?(r=m0(~e[n])|m0(~e[n+1])<<64n,r=-(r+1n)):r=e[n]|e[n+1]<<64n,r}function z0t(e,t){const n=t<<2;let r;return BigInt.asIntN(64,e[n+3])<0?(r=m0(~e[n])|m0(~e[n+1])<<64n|m0(~e[n+2])<<128n|m0(~e[n+3])<<192n,r=-(r+1n)):r=e[n]|e[n+1]<<64n|e[n+2]<<128n|e[n+3]<<192n,r}const q0t=new TextDecoder("utf-8");new TextEncoder;function bS(e){return q0t.decode(e)}const av=4;function TP(e,t){return(e[t>>3]&1<{if(s>24}function u6(e,t){return e[t]}function ha(e,t){return V0t(e,t)<<16>>16}function V0t(e,t){return e[t]|e[t+1]<<8}function Cr(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function N$(e,t){return Cr(e,t)>>>0}function ma(e,t){return Bf(BigInt.asIntN(64,BigInt(N$(e,t))+(BigInt(N$(e,t+av))<<32n)))}function jw(e,t){let n=t+Cr(e,t);const r=Cr(e,n);return n+=av,bS(e.subarray(n,n+r))}function Of(e,t,n,r){if(!t)return[];const i=t+Cr(e,t);return Array.from({length:Cr(e,i)},(s,o)=>r(e,i+av+o*n))}const UE=Symbol("rowIndex");function n4(e,t){class n{constructor(s){this[UE]=s}toJSON(){return IP(e,t,this[UE])}}const r=n.prototype;for(let i=0;inew n(i)}function MP(e,t){return n=>IP(e,t,n)}function IP(e,t,n){const r={};for(let i=0;ithis.value(c))}get[Symbol.toStringTag](){return"Batch"}at(t){return this.isValid(t)?this.value(t):null}isValid(t){return TP(this.validity,t)}value(t){return this.values[t]}slice(t,n){const r=n-t,i=Array(r);for(let s=0;s>10,i=(n&1023)/1024,s=(-1)**((n&32768)>>15);switch(r){case 31:return s*(i?Number.NaN:1/0);case 0:return s*(i?6103515625e-14*i:0)}return s*2**(r-15)*(1+i)}}class G0t extends ui{value(t){return TP(this.values,t)}}class X0t extends wS{constructor(t){super(t);const{scale:n}=this.type;this.scale=10**n}value(t){return this.values[t]/this.scale}}class RP extends _S{constructor(t){super(t);const{bitWidth:n,scale:r}=this.type;this.decimal=n===64?P0t:n===128?U0t:z0t,this.scale=10n**BigInt(r)}}class K0t extends RP{static ArrayType=vS;value(t){return c6(this.decimal(this.values,t),this.scale)}}class J0t extends RP{static ArrayType=Array;value(t){return this.decimal(this.values,t)}}class $$ extends ui{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}}class Z0t extends wS{value(t){return 864e5*this.values[t]}}const Q0t=qg;class tgt extends qg{value(t){return super.value(t)*1e3}}const egt=qg;class ngt extends qg{value(t){return c6(this.values[t],1000n)}}class rgt extends qg{value(t){return c6(this.values[t],1000000n)}}class igt extends ui{value(t){return this.values.subarray(t<<1,t+1<<1)}}class sgt extends ui{value(t){const n=this.values,r=t<<4;return Float64Array.of(Cr(n,r),Cr(n,r+4),ma(n,r+8))}}const CP=({values:e,offsets:t},n)=>e.subarray(t[n],t[n+1]),NP=({values:e,offsets:t},n)=>e.subarray(Bf(t[n]),Bf(t[n+1]));class ogt extends ui{value(t){return CP(this,t)}}class agt extends ui{value(t){return NP(this,t)}}class lgt extends ui{value(t){return bS(CP(this,t))}}class cgt extends ui{value(t){return bS(NP(this,t))}}class ugt extends ui{value(t){const n=this.offsets;return this.children[0].slice(n[t],n[t+1])}}class fgt extends ui{value(t){const n=this.offsets;return this.children[0].slice(Bf(n[t]),Bf(n[t+1]))}}class hgt extends ui{value(t){const n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(n,r)}}class dgt extends ui{value(t){const n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(Bf(n),Bf(r))}}class $P extends ui{constructor(t){super(t),this.stride=this.type.stride}}class pgt extends $P{value(t){const{stride:n,values:r}=this;return r.subarray(t*n,(t+1)*n)}}class ggt extends $P{value(t){const{children:n,stride:r}=this;return n[0].slice(t*r,(t+1)*r)}}function OP({children:e,offsets:t},n){const[r,i]=e[0].children,s=t[n],o=t[n+1],a=[];for(let l=s;lr.name),this.factory=n(this.names,this.children)}value(t){return this.factory(t)}}class bgt extends DP{constructor(t){super(t,n4)}}class _gt extends ui{value(t){const[{values:n},r]=this.children;return r.at(o6(n,t))}}let wgt=class extends ui{setDictionary(t){return this.dictionary=t,this.cache=t.cache(),this}value(t){return this.cache[this.key(t)]}key(t){return this.values[t]}};class FP extends ui{constructor({data:t,...n}){super(n),this.data=t}view(t){const{values:n,data:r}=this,i=t<<4;let s=i+4,o=n;const a=Cr(o,i);return a>12&&(s=Cr(o,i+12),o=r[Cr(o,i+8)]),o.subarray(s,s+a)}}class xgt extends FP{value(t){return this.view(t)}}class Sgt extends FP{value(t){return bS(this.view(t))}}function O$(e){let t=[];return{add(n){return t.push(n),this},clear:()=>t=[],done:()=>new Agt(t,e)}}class Agt{constructor(t,n=t[0]?.type){this.type=n,this.length=t.reduce((s,o)=>s+o.length,0),this.nullCount=t.reduce((s,o)=>s+o.nullCount,0),this.data=t;const r=t.length,i=new Int32Array(r+1);if(r===1){const[s]=t;i[1]=s.length,this.at=o=>s.at(o)}else for(let s=0,o=0;s0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new o(t);return i?kgt(a,r):Tgt(a,r)}cache(){return this._cache??(this._cache=this.toArray())}}function*Egt(e){for(let t=0;to.name);this.schema=t,this.names=i,this.children=n,this.factory=r?n4:MP;const s=[];this.getFactory=o=>s[o]??(s[o]=this.factory(i,n.map(a=>a.data[o])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(t){return this.children[t]}getChild(t){const n=this.names.findIndex(r=>r===t);return n>-1?this.children[n]:void 0}selectAt(t,n=[]){const{children:r,factory:i,schema:s}=this,{fields:o}=s;return new BP({...s,fields:t.map((a,l)=>Igt(o[a],n[l]))},t.map(a=>r[a]),i===n4)}select(t,n){const r=this.names,i=t.map(s=>r.indexOf(s));return this.selectAt(i,n)}toColumns(){const{children:t,names:n}=this,r={};return n.forEach((i,s)=>r[i]=t[s]?.toArray()??[]),r}toArray(){const{children:t,getFactory:n,numRows:r}=this,i=t[0]?.data??[],s=Array(r);for(let o=0,a=-1;o=i)return null;const[{offsets:s}]=n,o=o6(s,t)-1;return r(o)(t-s[o])}get(t){return this.at(t)}};function Igt(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Rgt(e,t={}){const{typeId:n,bitWidth:r,precision:i,unit:s}=e,{useBigInt:o,useDate:a,useDecimalInt:l,useMap:c,useProxy:u}=t;switch(n){case Nt.Null:return Y0t;case Nt.Bool:return G0t;case Nt.Int:case Nt.Time:case Nt.Duration:return o||r<64?cy:qg;case Nt.Float:return i?cy:H0t;case Nt.Date:return L$(s===qw.DAY?Z0t:Q0t,a&&$$);case Nt.Timestamp:return L$(s===Ia.SECOND?tgt:s===Ia.MILLISECOND?egt:s===Ia.MICROSECOND?ngt:rgt,a&&$$);case Nt.Decimal:return r===32?l?cy:X0t:l?J0t:K0t;case Nt.Interval:return s===R0.DAY_TIME?igt:s===R0.YEAR_MONTH?cy:sgt;case Nt.FixedSizeBinary:return pgt;case Nt.Utf8:return lgt;case Nt.LargeUtf8:return cgt;case Nt.Binary:return ogt;case Nt.LargeBinary:return agt;case Nt.BinaryView:return xgt;case Nt.Utf8View:return Sgt;case Nt.List:return ugt;case Nt.LargeList:return fgt;case Nt.Map:return c?ygt:mgt;case Nt.ListView:return hgt;case Nt.LargeListView:return dgt;case Nt.FixedSizeList:return ggt;case Nt.Struct:return u?bgt:DP;case Nt.RunEndEncoded:return _gt;case Nt.Dictionary:return wgt;case Nt.Union:return e.mode?vgt:LP}throw new Error(l6(n))}function L$(e,t){return t?class extends t{constructor(r){super(new e(r))}}:e}function Cgt(e,t){return{offset:ma(e,t),metadataLength:Cr(e,t+8),bodyLength:ma(e,t+16)}}function D$(e,t){return Of(e,t,24,Cgt)}function PP(e,t,n){const r=Fu(e,t);if(r(10,Jh,0))throw new Error("Record batch compression not implemented");const i=n({length:ma(s,o),nullCount:ma(s,o+8)})),regions:Of(e,r(8,Jh),16+i,(s,o)=>({offset:ma(s,o+i),length:ma(s,o+i+8)})),variadic:Of(e,r(12,Jh),8,ma)}}function Ngt(e,t,n){const r=Fu(e,t);return{id:r(4,ma,0),data:r(6,(i,s)=>PP(i,s,n)),isDelta:r(8,lv,!1)}}function UP(e,t,n,r){pl(n,Nt,l6);const i=Fu(e,t);switch(n){case Nt.Binary:return y0t();case Nt.Utf8:return v0t();case Nt.LargeBinary:return C0t();case Nt.LargeUtf8:return N0t();case Nt.List:return A0t(r[0]);case Nt.ListView:return L0t(r[0]);case Nt.LargeList:return $0t(r[0]);case Nt.LargeListView:return D0t(r[0]);case Nt.Struct:return E0t(r);case Nt.RunEndEncoded:return O0t(r[0],r[1]);case Nt.Int:return EP(i(4,Cr,0),i(6,lv,!1));case Nt.Float:return m0t(i(4,ha,yP.HALF));case Nt.Decimal:return b0t(i(4,Cr,0),i(6,Cr,0),i(8,Cr,128));case Nt.Date:return _0t(i(4,ha,qw.MILLISECOND));case Nt.Time:return w0t(i(4,ha,Ia.MILLISECOND),i(6,Cr,32));case Nt.Timestamp:return x0t(i(4,ha,Ia.SECOND),i(6,jw));case Nt.Interval:return S0t(i(4,ha,R0.YEAR_MONTH));case Nt.Duration:return R0t(i(4,ha,Ia.MILLISECOND));case Nt.FixedSizeBinary:return T0t(i(4,Cr,0));case Nt.FixedSizeList:return M0t(r[0],i(4,Cr,0));case Nt.Map:return I0t(i(4,lv,!1),r[0]);case Nt.Union:return k0t(i(4,ha,s6.Sparse),r,Of(e,i(6,Jh),4,Cr))}return{typeId:n}}function f6(e,t){const n=Of(e,t,4,(r,i)=>{const s=Fu(r,i);return[s(4,jw),s(6,jw)]});return n.length?new Map(n):null}function zP(e,t,n){const r=Fu(e,t);return{version:n,endianness:r(4,ha,0),fields:r(6,$gt,[]),metadata:r(8,f6)}}function $gt(e,t){return Of(e,t,4,qP)}function qP(e,t){const n=Fu(e,t),r=n(8,u6,Nt.NONE),i=n(10,Jh,0),s=n(12,Lgt),o=n(14,(l,c)=>Ogt(l,c));let a=UP(e,i,r,o);return s&&(s.dictionary=a,a=s),{name:n(4,jw),type:a,nullable:n(6,lv,!1),metadata:n(16,f6)}}function Ogt(e,t){const n=Of(e,t,4,qP);return n.length?n:null}function Lgt(e,t){if(!t)return null;const n=Fu(e,t);return g0t(null,n(6,Dgt,kP()),n(8,lv,!1),n(4,ma,0))}function Dgt(e,t){return UP(e,t,Nt.Int)}const Fgt=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Bgt=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Pgt=e=>`Unsupported message type: ${e} (${wP(Af,e)})`;function r4(e,t){let n=Cr(e,t)||0;if(t+=av,n===-1&&(n=Cr(e,t)||0,t+=av),n===0)return null;const r=e.subarray(t,t+=n);if(r.byteLength0){const f=e.subarray(t,t+=l);if(f.byteLengthzP(a,l,i)),dictionaries:s.map(({offset:a})=>r4(e,a).content),records:o.map(({offset:a})=>r4(e,a).content),metadata:r(12,f6)}}function Vgt(e,t){return Wgt(Ugt(e),t)}function Wgt(e,t={}){const{schema:n={fields:[]},dictionaries:r,records:i}=e,{version:s,fields:o}=n,a=new Map,l=Hgt(t,s,a),c=new Map;Ygt(n,h=>{const d=h.type;d.typeId===Nt.Dictionary&&c.set(d.id,d.dictionary)});const u=new Map;for(const h of r){const{id:d,data:g,isDelta:y,body:v}=h,b=c.get(d),_=i4(b,l({...g,body:v}));if(u.has(d)){const w=u.get(d);y||w.clear(),w.add(_)}else{if(y)throw new Error("Delta update can not be first dictionary batch.");u.set(d,O$(b).add(_))}}u.forEach((h,d)=>a.set(d,h.done()));const f=o.map(h=>O$(h.type));for(const h of i){const d=l(h);o.forEach((g,y)=>f[y].add(i4(g.type,d)))}return new Mgt(n,f.map(h=>h.done()),t.useProxy)}function Ygt(e,t){e.fields.forEach(function n(r){t(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Hgt(e,t,n){const r={version:t,options:e,dictionary:i=>n.get(i)};return i=>{const{length:s,nodes:o,regions:a,variadic:l,body:c}=i;let u=-1,f=-1,h=-1;return{...r,length:s,node:()=>o[++u],buffer:d=>{const{length:g,offset:y}=a[++f];return d?new d(c.buffer,c.byteOffset+y,g/d.BYTES_PER_ELEMENT):c.subarray(y,y+g)},variadic:()=>l[++h],visit(d){return d.map(g=>i4(g.type,this))}}}}function i4(e,t){const{typeId:n}=e,{length:r,options:i,node:s,buffer:o,variadic:a,version:l}=t,c=Rgt(e,i);if(n===Nt.Null)return new c({length:r,nullCount:r,type:e});const u={...s(),type:e};switch(n){case Nt.Bool:case Nt.Int:case Nt.Time:case Nt.Duration:case Nt.Float:case Nt.Decimal:case Nt.Date:case Nt.Timestamp:case Nt.Interval:case Nt.FixedSizeBinary:return new c({...u,validity:o(),values:o(e.values)});case Nt.Utf8:case Nt.LargeUtf8:case Nt.Binary:case Nt.LargeBinary:return new c({...u,validity:o(),offsets:o(e.offsets),values:o()});case Nt.BinaryView:case Nt.Utf8View:return new c({...u,validity:o(),values:o(),data:Array.from({length:a()},()=>o())});case Nt.List:case Nt.LargeList:case Nt.Map:return new c({...u,validity:o(),offsets:o(e.offsets),children:t.visit(e.children)});case Nt.ListView:case Nt.LargeListView:return new c({...u,validity:o(),offsets:o(e.offsets),sizes:o(e.offsets),children:t.visit(e.children)});case Nt.FixedSizeList:case Nt.Struct:return new c({...u,validity:o(),children:t.visit(e.children)});case Nt.RunEndEncoded:return new c({...u,children:t.visit(e.children)});case Nt.Dictionary:{const{id:f,indices:h}=e;return new c({...u,validity:o(),values:o(h.values)}).setDictionary(t.dictionary(f))}case Nt.Union:return lthis.enqueue(t,n,r))}}const h6="COLUMN_REF",d6="COLUMN_PARAM",Xgt="TABLE_REF",Kgt="LITERAL",Jgt="INTERVAL",VP="ORDER_BY",WP="CAST",YP="CASE",HP="WHEN",Zgt="COLLATE",GP="UNARY",XP="UNARY_POSTFIX",KP="BINARY",JP="BETWEEN",ZP="NOT_BETWEEN",QP="LOGICAL_OPERATOR",tU="IN",eU="FUNCTION",xS="AGGREGATE",p6="WINDOW",nU="WINDOW_FUNCTION",rU="WINDOW_DEF",iU="WINDOW_FRAME",sU="WINDOW_EXTENT_EXPR",Qgt="EXPRESSION",g6="FRAGMENT",oU="VERBATIM",m6="PARAM",aU="WITH_CLAUSE",lU="WINDOW_CLAUSE",cU="SELECT_CLAUSE",uU="FROM_CLAUSE",tmt="SAMPLE_CLAUSE",fU="SELECT_QUERY",hU="DESCRIBE_QUERY",dU="SET_OPERATION",emt="SCALAR_SUBQUERY";function dc(e){return e instanceof ja}class ja{type;constructor(t){this.type=t}clone(){const t=new this.constructor;for(const n in this)t[n]=this[n];return t}}class Zr extends ja{}let y6=class extends Zr{value;constructor(t){super(Kgt),this.value=t}toString(){return pU(this.value)}};function pU(e){switch(typeof e){case"number":return Number.isFinite(e)?`${e}`:"NULL";case"string":return`'${e.replaceAll("'","''")}'`;case"boolean":return e?"TRUE":"FALSE";default:if(e==null)return"NULL";if(e instanceof Date){const t=+e;if(Number.isNaN(t))return"NULL";const n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`DATE '${n}-${r+1}-${i}'`:`epoch_ms(${t})`}else return e instanceof RegExp?`'${e.source}'`:`${e}`}}let SS=class extends Zr{param;constructor(t){super(m6),this.param=t}get value(){return this.param.value}toString(){return pU(this.value)}};class nmt extends Zr{name;args;constructor(t,n=[]){super(eU),this.name=t,this.args=n}toString(){const{name:t,args:n}=this;return`${t}(${n.join(", ")})`}}function _r(e,...t){return new nmt(e,AS(t).map(In))}function xn(e,...t){return new Dy(e,AS(t).map(In))}function El(e,...t){return new Zh(new smt(e,AS(t).map(In)))}function Oy(e,t){return e.flat().filter(n=>n!=null).map(n=>t(n))}function Pf(e){return Oy(e,In)}function AS(e){const t=e.length;let n=t;for(;n>0&&e[n-1]===void 0;--n);return no).join(" ");return`${t}(${s})`}}class v6 extends ja{name;partition;order;framedef;constructor(t,n,r,i){super(rU),this.name=t,this.partition=n,this.order=r,this.framedef=i}over(t){return Qb(this,{name:t})}partitionby(...t){return Qb(this,{partition:Pf(t)})}orderby(...t){return Qb(this,{order:Pf(t)})}frame(t){return Qb(this,{framedef:t})}toString(){const{name:t,partition:n,order:r,framedef:i}=this,s=t&&jg(t),o=[s,n?.length&&`PARTITION BY ${n.join(", ")}`,r?.length&&`ORDER BY ${r.join(", ")}`,i].filter(a=>a);return s&&o.length<2?s:`(${o.join(" ")})`}}function Qb(e,t){return new v6(t.name??e.name,t.partition??e.partition,t.order??e.order,t.framedef??e.framedef)}function ES(e){return e instanceof kS}class kS extends Zr{table;constructor(t,n){super(t),this.table=n}get column(){return""}toString(){const{column:t,table:n}=this,r=`${n??""}`,i=t==="*"?"*":jg(t);return(r?r+".":"")+i}}class mU extends kS{name;constructor(t,n){super(h6,n),this.name=t}get column(){return this.name}}function omt(e){return e instanceof yU}class yU extends kS{param;constructor(t,n){super(d6,n),this.param=t}get column(){return`${this.param.value}`}}function Uf(e){return typeof e=="string"}function s4(e){return Array.isArray(e)}function f1(e){if(e){const t=e;return typeof t?.addEventListener=="function"&&t.dynamic!==!1&&"value"in t}return!1}function Mt(e,t){const n=_U(t);return f1(e)?new yU(new SS(e),n):new mU(e,n)}class vU extends Zr{value;hint;constructor(t,n){super(oU),this.value=t,this.hint=n}toString(){return this.value}}function Zt(e){return new y6(e)}function amt(e,t){return new vU(e,t)}function Ww(e){return e instanceof bU}class bU extends Zr{table;constructor(t){super(Xgt),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>jg(t)).join(".")}}function b6(...e){const t=Oy(e,String);return t?.length?new bU(t):void 0}function In(e){return Uf(e)?cmt(e):TS(e)}function Ly(e){return Uf(e)?amt(e):TS(e)}function TS(e){return e instanceof Zr?e:f1(e)?new SS(e):Zt(e)}function _U(e){return wU(e)}function lmt(e){return wU(e)}function wU(e){return Uf(e)?umt(e):s4(e)?b6(e):e}function cmt(e){const t=gU(e);return Mt(t.pop(),b6(t))}function umt(e){return b6(gU(e))}function fmt(){return new v6}class Dy extends Zr{name;args;isDistinct;filter;order;constructor(t,n,r=!1,i=null,s=[]){super(xS),this.name=t,this.args=n,this.isDistinct=r,this.filter=i,this.order=Pf([s])}distinct(t=!0){return new Dy(this.name,this.args,t,this.filter,this.order)}where(t){return Uf(t)&&(t=Ly(t)),new Dy(this.name,this.args,this.isDistinct,t,this.order)}argOrder(t){return new Dy(this.name,this.args,this.isDistinct,this.filter,t)}window(){return new Zh(this)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}frame(t){return this.window().frame(t)}toString(){const{name:t,args:n,isDistinct:r,filter:i,order:s}=this,o=[r?"DISTINCT":"",n?.length?n.join(", "):t.toLowerCase()==="count"?"*":"",s.length?`ORDER BY ${s.join(", ")}`:""].filter(l=>l).join(" "),a=i?` FILTER (WHERE ${i})`:"";return`${t}(${o})${a}`}}const hmt=["any_value","approx_count_distinct","approx_quantile","arbitrary","arg_max","arg_max_null","arg_min","arg_min_null","array_agg","avg","bit_and","bit_or","bit_xor","bitstring_agg","bool_and","bool_or","corr","count","count_star","covar_pop","covar_samp","entropy","favg","first","fsum","geomean","kurtosis_pop","kurtosis","last","mad","max","max_by","median","min","min_by","mode","product","quantile","quantile_cont","quantile_disc","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_sxx","regr_sxy","regr_syy","regr_slope","reservoir_quantile","skewness","stddev","stddev_pop","stddev_samp","string_agg","sum","variance","var_pop","var_samp"];class xU extends Zr{expr;extent;constructor(t,n,r){super(t),this.expr=n,this.extent=r}toSQL(t){const{extent:n,expr:r}=this;return n?`(${r} ${t} ${n[0]} AND ${n[1]})`:""}}class SU extends xU{constructor(t,n){super(JP,t,n)}toString(){return super.toSQL("BETWEEN")}}class dmt extends xU{constructor(t,n){super(ZP,t,n)}toString(){return super.toSQL("NOT BETWEEN")}}class pmt extends Zr{op;left;right;constructor(t,n,r){super(KP),this.op=t,this.left=n,this.right=r}toString(){return`(${this.left} ${this.op} ${this.right})`}}class cv extends Zr{expr;_when;_else;constructor(t=void 0,n=[],r=void 0){super(YP),this.expr=t,this._when=n,this._else=r}when(t,n){return new cv(this.expr,this._when.concat(new AU(In(t),In(n))),this._else)}else(t){return new cv(this.expr,this._when,In(t))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}}class AU extends ja{when;then;constructor(t,n){super(HP),this.when=t,this.then=n}toString(){return`WHEN ${this.when} THEN ${this.then}`}}class gmt extends Zr{expr;cast;constructor(t,n){super(WP),this.expr=t,this.cast=n}toString(){return`(${this.expr})::${this.cast}`}}class mmt extends Zr{spans;constructor(t){super(g6),this.spans=t}toString(){return this.spans.join("")}}class ymt extends ja{size;perc;method;seed;constructor(t,n=!1,r,i){super(tmt),this.size=t,this.perc=n,this.method=r,this.seed=i}toString(){const{size:t,perc:n,method:r,seed:i}=this,s=r?`${r} `:"",o=i!=null?` REPEATABLE (${i})`:"";return`${s}(${t}${n?"%":" ROWS"})${o}`}}class vmt extends ja{expr;alias;constructor(t,n){super(cU),this.expr=t,this.alias=n}toString(){const{expr:t,alias:n}=this;return!n||bmt(t,n)?`${t}`:`${t} AS ${jg(n)}`}}function bmt(e,t){return e instanceof kS&&e.table==null&&e.column===t}class o4 extends ja{name;query;materialized;constructor(t,n,r=null){super(aU),this.name=t,this.query=n,this.materialized=r}toString(){const t=this.materialized,n=t===!0?" MATERIALIZED":t===!1?" NOT MATERIALIZED":"";return`"${this.name}" AS${n} (${this.query})`}}function _6(e){return e instanceof zt}function MS(e){return e instanceof ig}function _mt(e){return e instanceof IS}class zt extends Zr{static with(...t){return new wmt(...t)}static select(...t){return new ig().select(...t)}static from(...t){return new ig().from(...t)}static union(...t){return new y0("UNION",t.flat())}static unionAll(...t){return new y0("UNION ALL",t.flat())}static intersect(...t){return new y0("INTERSECT",t.flat())}static except(...t){return new y0("EXCEPT",t.flat())}static describe(t){return new IS(t)}_with=[];_orderby=[];_limitPerc=!1;_limit;_offset;cteFor=null;constructor(t){super(t)}get subqueries(){return[]}clone(){return this}setCteFor(t){this.cteFor=t}with(...t){const n=[],r=(i,s)=>{const o=s.clone();o.setCteFor(this),n.push(new o4(i,o))};return t.flat().forEach(i=>{if(i instanceof o4)n.push(i);else if(i!=null)for(const s in i)r(s,i[s])}),this._with=this._with.concat(n),this}orderby(...t){return this._orderby=this._orderby.concat(Pf(t)),this}limitPercent(t){return this._limitPerc=!0,this._limit=In(t),this}limit(t){return this._limitPerc=!1,this._limit=In(t),this}offset(t){return this._offset=In(t),this}}class ig extends zt{_select=[];_from=[];_where=[];_sample;_groupby=[];_having=[];_window=[];_qualify=[];_distinct=!1;constructor(){super(fU)}get subqueries(){const t=this.cteFor||this,r=(t instanceof ig?t._with:[]).reduce((s,o)=>(s[o.name]=o.query,s),{}),i=[];return this._from.forEach(({expr:s})=>{if(_6(s))i.push(s);else if(Ww(s)){const o=r[s.name];o&&i.push(o)}}),i}clone(){return Object.assign(new ig,this)}select(...t){const n=new Set,r=[],i=(s,o)=>{const a=zE(o);n.add(a),s&&r.push(new vmt(In(s),a))};return t.flat().forEach(s=>{if(s!=null)if(Uf(s))i(s,s);else if(ES(s))i(s,s.column);else if(s4(s))i(s[1],s[0]);else if(dc(s))i(s,`${s}`);else for(const o in s)i(s[o],o)}),this._select=this._select.filter(s=>!n.has(s.alias)).concat(r),this}setSelect(...t){return this._select=[],this.select(...t)}distinct(t=!0){return this._distinct=!!t,this}from(...t){const n=[],r=(i,s)=>{n.push(new F$(lmt(i),zE(s)))};return t.flat().forEach(i=>{if(i!=null)if(i instanceof F$)n.push(i);else if(Uf(i))r(i,i);else if(Ww(i))r(i,i.name);else if(dc(i))r(i);else if(s4(i))r(i[1],i[0]);else for(const s in i)r(i[s],s)}),this._from=this._from.concat(n),this}setFrom(...t){return this._from=[],this.from(...t)}sample(t,n,r){let i;if(typeof t=="number"){const s=t>0&&t<1,o=s?t*100:Math.floor(t);i=new ymt(o,s,n,r)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat(Oy(t,Ly)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat(Pf(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat(Oy(t,Ly)),this}window(...t){const n=[];return t.flat().forEach(r=>{if(r!=null)for(const i in r)n.push(new imt(zE(i),r[i]))}),this._window=this._window.concat(n),this}qualify(...t){return this._qualify=this._qualify.concat(Oy(t,Ly)),this}toString(){const{_with:t,_select:n,_distinct:r,_from:i,_sample:s,_where:o,_groupby:a,_having:l,_window:c,_qualify:u,_orderby:f,_limitPerc:h,_limit:d,_offset:g}=this,y=[];if(t.length&&y.push(`WITH ${t.join(", ")}`),y.push(`SELECT${r?" DISTINCT":""} ${n.join(", ")}`),i.length&&y.push(`FROM ${i.join(", ")}`),o.length){const v=o.map(String).filter(b=>b).join(" AND ");v&&y.push(`WHERE ${v}`)}if(s&&y.push(`USING SAMPLE ${s}`),a.length&&y.push(`GROUP BY ${a.join(", ")}`),l.length){const v=l.map(String).filter(b=>b).join(" AND ");v&&y.push(`HAVING ${v}`)}if(c.length&&y.push(`WINDOW ${c.join(", ")}`),u.length){const v=u.map(String).filter(b=>b).join(" AND ");v&&y.push(`QUALIFY ${v}`)}return f.length&&y.push(`ORDER BY ${f.join(", ")}`),d&&y.push(`LIMIT ${d}${h?"%":""}`),g&&y.push(`OFFSET ${g}`),y.join(" ")}}class IS extends ja{query;constructor(t){super(hU),this.query=t}clone(){return new IS(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}}class y0 extends zt{op;queries;constructor(t,n){super(dU),this.op=t,this.queries=n}setCteFor(t){super.setCteFor(t);const{queries:n,cteFor:r}=this;r&&n.forEach(i=>i.setCteFor(r))}get subqueries(){return this.queries}clone(){const{op:t,queries:n,...r}=this;return Object.assign(new y0(t,n),r)}toString(){const{op:t,queries:n,_with:r,_orderby:i,_limitPerc:s,_limit:o,_offset:a}=this,l=[];return r.length&&l.push(`WITH ${r.join(", ")}`),l.push(n.join(` ${t} `)),i.length&&l.push(`ORDER BY ${i.join(", ")}`),o&&l.push(`LIMIT ${o}${s?"%":""}`),a&&l.push(`OFFSET ${a}`),l.join(" ")}}class wmt{_with;constructor(...t){this._with=t}select(...t){return zt.select(...t).with(...this._with)}from(...t){return zt.from(...t).with(...this._with)}union(...t){return zt.union(...t).with(...this._with)}unionAll(...t){return zt.unionAll(...t).with(...this._with)}intersect(...t){return zt.intersect(...t).with(...this._with)}except(...t){return zt.except(...t).with(...this._with)}}class F$ extends ja{expr;alias;sample;constructor(t,n,r){super(uU),this.expr=t,this.alias=n,this.sample=r}toString(){const{expr:t,alias:n,sample:r}=this,i=_6(t)?`(${t})`:`${t}`;return`${n&&!(Ww(t)&&t.table.join(".")===n)?`${i} AS ${jg(n)}`:`${i}`}${r?` TABLESAMPLE ${r}`:""}`}}class xmt extends Zr{expr;values;constructor(t,n){super(tU),this.expr=t,this.values=n}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}}class Smt extends Zr{name;steps;constructor(t,n=1){super(Jgt),this.name=t,this.steps=n}toString(){return`INTERVAL ${this.steps} ${this.name}`}}class EU extends Zr{op;clauses;constructor(t,n){super(QP),this.op=t,this.clauses=n}toString(){const t=this.clauses;return t.length===0?"":t.length===1?`${t[0]}`:`(${t.join(` ${this.op} `)})`}}class Amt extends EU{constructor(t){super("AND",t)}}class Emt extends EU{constructor(t){super("OR",t)}}class kU extends Zr{expr;desc;nullsFirst;constructor(t,n,r){super(VP),this.expr=t,this.desc=n,this.nullsFirst=r}toString(){const{expr:t,desc:n,nullsFirst:r}=this;return`${t}${n?" DESC":n===!1?" ASC":""}${r?" NULLS FIRST":r===!1?" NULLS LAST":""}`}}class TU extends Zr{op;expr;constructor(t,n,r){super(t),this.op=n,this.expr=r}}class kmt extends TU{constructor(t,n){super(GP,t,n)}toString(){return`(${this.op} ${this.expr})`}}class Tmt extends TU{constructor(t,n){super(XP,t,n)}toString(){return`(${this.expr} ${this.op})`}}const Mmt="ROWS",Imt="RANGE",Rmt="GROUPS",Cmt="PRECEDING",Nmt="FOLLOWING",MU="CURRENT ROW",IU="UNBOUNDED";let RS=class extends ja{frameType;extent;exclude;constructor(t,n,r){super(iU),this.frameType=t,this.extent=f1(n)?new SS(n):n,this.exclude=r}toString(){const{frameType:t,exclude:n,extent:r}=this,[i,s]=dc(r)?r.value:r,o=B$(i,Cmt),a=B$(s,Nmt);return`${t} BETWEEN ${o} AND ${a}${n?` ${n}`:""}`}};function B$(e,t){return e instanceof $mt?e:e!=null&&typeof e!="number"?`${e} ${t}`:e===0?MU:e&&Number.isFinite(e)?`${Math.abs(e)} ${t}`:`${IU} ${t}`}class $mt extends ja{scope;expr;constructor(t,n=null){super(sU),this.scope=t,this.expr=n}toString(){const{scope:t,expr:n}=this;return t===MU?t:`${n??IU} ${t}`}}function Yw(e,t){return xn("arg_max",e,t)}function Hw(e,t){return xn("arg_min",e,t)}function Omt(e){return xn("array_agg",e)}function CS(e){return xn("avg",e)}function Lmt(e,t){return xn("corr",e,t)}function ar(e){return xn("count",e)}function Dmt(e,t){return xn("covar_samp",e,t)}function Fmt(e,t){return xn("covar_pop",e,t)}function Bmt(e){return xn("entropy",e)}function Pmt(e){return xn("first",e)}function Umt(e){return xn("geomean",e)}function zmt(e){return xn("kurtosis",e)}function qmt(e){return xn("mad",e)}function Da(e){return xn("max",e)}function NS(e){return xn("median",e)}function gl(e){return xn("min",e)}function jmt(e){return xn("mode",e)}function Vmt(e){return xn("last",e)}function Wmt(e){return xn("product",e)}function a4(e,t){return xn("quantile",e,t)}function RU(e,t){return xn("regr_avgx",e,t)}function Ymt(e,t){return xn("regr_avgy",e,t)}function CU(e,t){return xn("regr_count",e,t)}function Hmt(e,t){return xn("regr_intercept",e,t)}function Gmt(e,t){return xn("regr_sxx",e,t)}function Xmt(e,t){return xn("regr_syy",e,t)}function Kmt(e,t){return xn("regr_slope",e,t)}function Jmt(e){return xn("skewness",e)}function NU(e){return xn("stddev",e)}function Zmt(e){return xn("stddev_pop",e)}function Qmt(e){return xn("string_agg",e)}function Er(e){return xn("sum",e)}function tyt(e){return xn("var_samp",e)}function eyt(e){return xn("var_pop",e)}function eo(e,t,n){return e?new cv(void 0,[new AU(In(e),In(t))],In(n)):new cv}function Xr(e,t){return new gmt(In(e),t)}function Si(e){return Xr(e,"INTEGER")}function nyt(e){return Xr(e,"FLOAT")}function ks(e){return Xr(e,"DOUBLE")}function ryt(e,t,n=null){return new o4(e,t,n)}function kl(e,t){return new Smt(e,t)}function iyt(e){return kl("YEARS",e)}function syt(e){return kl("MONTHS",e)}function oyt(e){return kl("DAYS",e)}function ayt(e){return kl("HOURS",e)}function lyt(e){return kl("MINUTES",e)}function cyt(e){return kl("SECONDS",e)}function uyt(e){return kl("MILLISECONDS",e)}function fyt(e){return kl("MICROSECONDS",e)}function hyt(e){return _r("epoch_ms",e)}function dyt(e,t,n=1){return _r("time_bucket",kl(t,n),e)}function pyt(e){return _r("make_date",2012,_r("month",e),1)}function gyt(e){const t=In(e);return _r("make_date",2012,_r("month",t),_r("day",t))}function myt(e){return _r("make_date",2012,1,_r("day",e))}function Lf(e){return _r("isfinite",e)}function yyt(...e){return _r("greatest",...e)}function w6(e){return _r("exp",e)}function $U(e){return _r("log",e)}function C0(e){return _r("ln",e)}function Mu(e){return _r("sign",e)}function Ss(e){return _r("abs",e)}function uv(e){return _r("sqrt",e)}function vyt(e){return _r("ceil",e)}function zo(e){return _r("floor",e)}function fv(e,t){return _r("round",e,t)}function byt(e,t){return new kmt(e,In(t))}function OU(e,t){return new Tmt(e,In(t))}function js(e,t,n){return new pmt(e,In(t),In(n))}function Di(...e){return new Amt(Pf(e))}function Ns(...e){return new Emt(Pf(e))}function sg(e){return byt("NOT",e)}function ll(e){return OU("IS NULL",e)}function pc(e){return OU("IS NOT NULL",e)}function qE(e,t){return js("&",e,t)}function er(e,t){return js("+",e,t)}function Pe(e,t){return js("-",e,t)}function Ue(e,t){return js("*",e,t)}function hr(e,t){return js("/",e,t)}function _yt(e,t){return js("%",e,t)}function os(e,t){return js("**",e,t)}function No(e,t){return js("=",e,t)}function h1(e,t){return js("<>",e,t)}function gi(e,t){return js("<",e,t)}function ba(e,t){return js(">",e,t)}function oc(e,t){return js("<=",e,t)}function wyt(e,t){return js(">=",e,t)}function xyt(e,t){return js("IS DISTINCT FROM",e,t)}function x6(e,t){return js("IS NOT DISTINCT FROM",e,t)}function $s(e,t){return new SU(In(e),t?.map(In))}function Syt(e,t){return new dmt(In(e),t?.map(In))}function Od(e,t){return new xmt(In(e),t.map(In))}function Ayt(e,t){return new kU(In(e),!1,t)}function Vg(e,t){return new kU(In(e),!0,t)}function LU(e){return _r("st_asgeojson",e)}function Eyt(e){return _r("st_x",e)}function kyt(e){return _r("st_y",e)}function S6(e){return _r("st_centroid",e)}function Tyt(e){return Eyt(S6(e))}function Myt(e){return kyt(S6(e))}function ee(e,...t){return new mmt(Iyt(e,t))}function Iyt(e,t){const n=[e[0]],r=t.length;for(let i=0,s=0;ii).map(i=>Uf(i)?new vU(i):i)}function $S(e,t,...n){return _r(e,t,...AS(n).map(TS))}function Ryt(e,t,n){return $S("regexp_matches",e,t,n)}function Cyt(e,t){return $S("contains",e,t)}function Nyt(e,t){return $S("starts_with",e,t)}function $yt(e,t){return $S("ends_with",e,t)}function DU(...e){return _r("coalesce",...e)}function FU(){return El("row_number")}function Oyt(){return El("rank")}function Lyt(){return El("dense_rank")}function Dyt(){return El("percent_rank")}function Fyt(){return El("cume_dist")}function Byt(e){return El("ntile",e)}function Pyt(e,t,n){return El("lag",e,t,n)}function l4(e,t,n){return El("lead",e,t,n)}function Uyt(e){return El("first_value",e)}function zyt(e){return El("last_value",e)}function qyt(e,t){return El("nth_value",e,t)}function jyt(e,t){return new RS(Mmt,e,t)}function Vyt(e,t){return new RS(Imt,e,t)}function Wyt(e,t){return new RS(Rmt,e,t)}const BU={[xS]:["args","order","filter"],[JP]:["expr","extent"],[KP]:["left","right"],[YP]:["expr","_when","_else"],[WP]:["expr"],[Zgt]:["expr"],[d6]:["param","table"],[h6]:["table"],[hU]:["query"],[Qgt]:["node"],[g6]:["spans"],[uU]:["expr"],[eU]:["args"],[tU]:["expr","values"],[QP]:["clauses"],[ZP]:["expr","extent"],[VP]:["expr"],[m6]:["value"],[emt]:["subquery"],[cU]:["expr"],[fU]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[dU]:["queries","_orderby"],[GP]:["expr"],[XP]:["expr"],[HP]:["when","then"],[p6]:["func","def"],[lU]:["def"],[rU]:["partition","order","framedef"],[sU]:["expr"],[iU]:["extent"],[nU]:["args"],[aU]:["query"]};function c4(e,t){if(t.has(e))return t.get(e);if(dc(e)){const n=BU[e.type],r=n?.length??0;if(r>0){e=e.clone();for(let i=0;it.endsWith("(")&&Yyt.test(t.slice(0,-1)))}function uh(e){let t=0;return Ld(e,n=>{switch(n.type){case p6:return-1;case xS:return t|=1,-1;case g6:case oU:{let r=`${n}`.toLowerCase();const i=r.indexOf("(select ");return i>=0&&(r=r.slice(0,i)),r.includes(") over ")?-1:Gyt(r)?(t|=2,-1):1}}}),t}function Xyt(e){const t=new Set;return Ld(e,n=>{n.type===xS&&t.add(n)}),Array.from(t)}function A6(e){const t={};return Ld(e,n=>{(n.type===h6||n.type===d6)&&(t[`${n}`]=n)}),Object.values(t)}function Kyt(e){const t=new Set;return Ld(e,n=>{n.type===m6&&t.add(n.param)}),Array.from(t)}function d1(e,t,{replace:n=!1,temp:r=!1,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function Jyt(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function PU(e){return`INSTALL ${e}; LOAD ${e}`}function Zyt(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,s)=>(i[s]=s,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");const r=[];for(const i of e){const s=n.map(o=>`${TS(i[o])} AS "${t[o]}"`);r.push(`(SELECT ${s.join(", ")})`)}return r.join(" UNION ALL ")}function OS(e,t,n,r={},i={}){const{select:s=["*"],where:o,view:a,temp:l,replace:c,...u}=r,f=ivt({...i,...u}),h=`${e}('${n}'${f?", "+f:""})`,d=o?` WHERE ${o}`:"",g=`SELECT ${s.join(", ")} FROM ${h}${d}`;return d1(t,g,{view:a,temp:l,replace:c})}function Qyt(e,t,n){return OS("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function tvt(e,t,n){return OS("read_json",e,t,n,{auto_detect:!0,format:"auto"})}function evt(e,t,n){return OS("read_parquet",e,t,n)}function nvt(e,t,n={}){const{options:r,...i}=n;if(r){const s=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([o,a])=>`${o}=${a}`).join(", ");Object.assign(i,{open_options:s.toUpperCase()})}return OS("st_read",e,t,i)}function rvt(e,t,n={}){const{select:r=["*"],...i}=n,s=Zyt(t),o=r.length===1&&r[0]==="*"?s:`SELECT ${r} FROM ${s}`;return d1(e,o,i)}function ivt(e){return Object.entries(e).map(([t,n])=>`${t}=${u4(n)}`).join(", ")}function u4(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>u4(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${u4(n)}`).join(", ")+"}";default:return`${e}`}}function svt(e,t,n,r,i=!1){const s=i?Pe(n,ks(e)):Pe(ks(e),t),o=n===t?0:r/(n-t);return o?Ue(s,ks(o)):s}function ovt(e,t,n,r,i,s){return e.select({index:er(Si(zo(t)),Ue(Si(zo(n)),i)),...r}).groupby("index",s)}function avt(e,t,n){let{step:r,steps:i=25}=n;const{minstep:s=0,nice:o=!0,base:a}=n;if(o!==!1){const l=t-e,c=a?Math.log(a):Math.LN10;r=r||f4(l,i,s,c);let u=Math.log(r);const f=u>=0?0:~~(-u/c)+1,h=Math.pow(10,-f-1);u=Math.floor(e/r+h)*r,e=et;)o*=10;const a=[5,2];for(let l=0,c=a.length;l=n&&e/i<=t&&(o=i);return o}const UU="year",P$="month",U$="day",t_="hour",e_="minute",n_="second",lvt="millisecond",cvt="microsecond",uy=1e3,fy=uy*60,hy=fy*60,LS=hy*24,uvt=LS*7,z$=LS*30,zU=LS*365,Pm=[{unit:n_,step:1,dt:uy},{unit:n_,step:5,dt:uy*5},{unit:n_,step:15,dt:uy*15},{unit:n_,step:30,dt:uy*30},{unit:e_,step:1,dt:fy},{unit:e_,step:5,dt:fy*5},{unit:e_,step:15,dt:fy*15},{unit:e_,step:30,dt:fy*30},{unit:t_,step:1,dt:hy},{unit:t_,step:3,dt:hy*3},{unit:t_,step:6,dt:hy*6},{unit:t_,step:12,dt:hy*12},{unit:U$,step:1,dt:LS},{unit:U$,step:7,dt:uvt},{unit:P$,step:1,dt:z$},{unit:P$,step:3,dt:z$*3},{unit:UU,step:1,dt:zU}];function fvt(e,t,n){const r=+t-+e,i=r/n,s=hvt(Pm,i,l=>l.dt);let o,a;return s===Pm.length?(o=UU,a=f4(r/zU,n)):s?{unit:o,step:a}=Pm[i/Pm[s-1].dt=1?lvt:cvt,a=a>=1?a:a*1e3),{unit:o,step:a}}function hvt(e,t,n){const r=(a,l)=>Number(a)-Number(l),i=(a,l)=>r(n(a),l);let s=0,o=e.length;if(s>>1;i(e[a],t)<=0?s=a+1:o=a}while(sC0(t),sqlInvert:t=>w6(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>$U(t),sqlInvert:t=>os(10,t)};{const t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>hr(C0(n),C0(t)),sqlInvert:n=>os(t,n)}}}function gvt({constant:e=1}={}){const t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=In(n),Ue(Mu(n),C0(er(t,Ss(n))))),sqlInvert:n=>Ue(Mu(n),Pe(w6(Ss(n)),t))}}function mvt(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=In(e),Ue(Mu(e),uv(Ss(e)))),sqlInvert:e=>Ue(Mu(e),os(e,2))}}function yvt({exponent:e=1}={}){const t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=In(n),Ue(Mu(n),os(Ss(n),t))),sqlInvert:n=>Ue(Mu(n),os(Ss(n),hr(1,t)))}}function j$(){return{apply:e=>Number(e),invert:e=>new Date(e),sqlApply:e=>e instanceof Date?Zt(+e):bvt(e)?Zt(Number(e.value)):hyt(e),sqlInvert:Fy}}const vvt={identity:q$,linear:q$,log:pvt,symlog:gvt,sqrt:mvt,pow:yvt,time:j$,utc:j$};function E6(e){const t=vvt[e.type];if(!t)throw new Error(`Unrecognized scale type: ${e.type}`);return{...e,...t(e)}}function bvt(e){return e instanceof y6&&e.value instanceof Date}function _vt(e,t,n={},r=E6({type:"linear"})){const[i,s]=t,{offset:o=0}=n,{apply:a,sqlApply:l,sqlInvert:c}=r,u=avt(a(i),a(s),n),f=l(e),h=(u.max-u.min)/u.steps;let d=u.min===0?f:Pe(f,u.min);return h!==1&&(d=hr(d,ks(h))),d=zo(o?er(o,d):d),h!==1&&(d=Ue(h,d)),u.min!==0&&(d=er(u.min,d)),c(d)}function wvt(e,t,n=void 0,r=[]){const i=n?a=>Ue(a,n):a=>a,s=zo(t),o=er(s,1);return zt.from(zt.unionAll(e.clone().select({i:Si(s),w:i(Pe(o,t))}),e.clone().select({i:Si(o),w:i(Pe(t,s))}))).select({index:"i",density:Er("w")},r).groupby("index",r).having(h1("density",0))}function xvt(e,t,n,r,i,s=[]){const o=r?b=>Ue(b,r):Fy,a=(b,_)=>e.clone().select({xp:t,yp:n,i:b,w:_}),l=(b,_)=>er(b,Ue(_,i)),c=Si(zo(t)),u=Si(zo(n)),f=er(c,1),h=er(u,1),d=Pe(t,c),g=Pe(f,t),y=Pe(n,u),v=Pe(h,n);return zt.from(zt.unionAll(a(l(c,u),o(Ue(g,v))),a(l(c,h),o(Ue(g,y))),a(l(f,u),o(Ue(d,v))),a(l(f,h),o(Ue(d,y))))).select({index:"i",density:Er("w")},s).groupby("index",s).having(h1("density",0))}function Svt(e,t,n,r,i,s,o=[],a=!0){e.select({x:Si(zo(t)),y:Si(zo(n))});const l=o.concat(r),c=zt.from(e).select(l,{x0:"x",y0:"y",dx:Pe(l4("x").over("sw"),"x"),dy:Pe(l4("y").over("sw"),"y")}).window({sw:fmt().partitionby(l).orderby(Ayt("x"))}).qualify([Ns(gi("x0",i),gi(er("x0","dx"),i)),Ns(gi("y0",s),gi(er("y0","dy"),s)),Ns(ba("x0",0),ba(er("x0","dx"),0)),Ns(ba("y0",0),ba(er("y0","dy"),0))]),u=zt.select({x:yyt(Da(Ss("dx")),Da(Ss("dy")))}).from("pairs"),f=zt.select({i:Si(ee`UNNEST(range((${u})))`)}),h=zt.unionAll(zt.select(l,{x:er("x0","i"),y:er("y0",Si(fv(hr(Ue("i","dy"),"dx"))))}).from("pairs","indices").where([oc(Ss("dy"),Ss("dx")),gi("i",Ss("dx"))]),zt.select(l,{x:er("x0",Si(fv(hr(Ue(Ue(Mu("dy"),"i"),"dx"),"dy")))),y:er("y0",Ue(Mu("dy"),"i"))}).from("pairs","indices").where([ba(Ss("dy"),Ss("dx")),gi("i",Ss("dy"))]),zt.select(l,{x:"x0",y:"y0"}).from("pairs").where(ll("dx"))),d=zt.from("raster").select(l,"x","y",a?{w:hr(1,ar().partitionby(["x"].concat(l)))}:null).where([oc(0,"x"),gi("x",i),oc(0,"y"),gi("y",s)]);return zt.with({pairs:c,indices:f,raster:h,points:d}).from("points").select(o,{index:er("x",Ue("y",Si(i))),density:a?Er("w"):ar()}).groupby("index",o)}function Avt(e,t,n,r,i=[]){const s=Si(zo(t)),o=_6(e),a=o?"input":e,l=o?zt.with(ryt(String(a),e,!0)):zt,c=u=>zt.from(a).select(u).groupby(s,i);return l.union(c([{[n]:gl(n),[r]:Hw(r,n)},...i]),c([{[n]:Da(n),[r]:Yw(r,n)},...i]),c([{[n]:Hw(n,r),[r]:gl(r)},...i]),c([{[n]:Yw(n,r),[r]:Da(r)},...i])).orderby(i,n)}function qU(e){let t=2166136261;for(let n=0,r=e.length;n>8)),t=V$(t^i&255)}return Evt(t)>>>0}function V$(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function Evt(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function kvt(e,t,n){switch(e.name){case"count":case"count_star":return Tvt(t,e);case"sum":return VU(t,e);case"avg":return Mvt(t,e);case"geomean":return Ivt(t,e);case"arg_max":return Rvt(t,e);case"arg_min":return Cvt(t,e);case"variance":case"var_samp":return r_(t,e,n);case"var_pop":return r_(t,e,n,!1);case"stddev":case"stddev_samp":return uv(r_(t,e,n));case"stddev_pop":return uv(r_(t,e,n,!1));case"covar_samp":return nw(t,e,n);case"covar_pop":return nw(t,e,n,!1);case"corr":return W$(t,e,n);case"regr_count":return Wg(t,e).expr;case"regr_avgx":return YU(t,e);case"regr_avgy":return HU(t,e);case"regr_syy":return d4(t,0,e,n);case"regr_sxx":return d4(t,1,e,n);case"regr_sxy":return nw(t,e,n,null);case"regr_slope":return GU(t,e,n);case"regr_intercept":return Nvt(t,e,n);case"regr_r2":return os(W$(t,e,n),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{const r=jU(e);return t[r]=e,ee`${e.name}("${r}")`}default:return null}}function jU(e){return"pre_"+qU(`${e}`).toString(16)}function ds(e,t,n){const r=n?.filter;r&&(t=t.filter?t.where(Di(r,t.filter)):t.where(r));const i=jU(t);return e[i]=t,i}function k6(e,t){const n=ds(e,ar(t.args[0]),t);return{expr:DU(Er(n),0),name:n}}function Tvt(e,t){return DU(VU(e,t),0)}function VU(e,t){return Er(ds(e,t))}function Mvt(e,t){const n=ds(e,t),{expr:r,name:i}=k6(e,t);return hr(Er(Ue(n,i)),r)}function Ivt(e,t){const n=t.args[0],r=ds(e,Er(C0(n)),t),{expr:i}=k6(e,t);return w6(hr(Er(r),i))}function Rvt(e,t){const n=ds(e,t),r=ds(e,Da(t.args[1]),t);return Yw(n,r)}function Cvt(e,t){const n=ds(e,t),r=ds(e,gl(t.args[1]),t);return Hw(n,r)}function r_(e,t,n,r=!0){const i=t.args[0],{expr:s}=k6(e,t),o=Pe(i,n(i)),a=ds(e,Er(os(o,2)),t),l=ds(e,Er(o),t),c=r?Pe(s,1):s;return hr(Pe(Er(a),hr(os(Er(l),2),s)),c)}function nw(e,t,n,r=!0){const{expr:i}=Wg(e,t),s=WU(e,t,n),o=hv(e,1,t,n),a=hv(e,0,t,n),l=Pe(s,hr(Ue(o,a),i));return r===null?l:r?hr(l,Pe(i,1)):hr(l,i)}function W$(e,t,n){const{expr:r}=Wg(e,t),i=WU(e,t,n),s=h4(e,1,t,n),o=h4(e,0,t,n),a=hv(e,1,t,n),l=hv(e,0,t,n),c=Pe(s,hr(os(a,2),r)),u=Pe(o,hr(os(l,2),r));return hr(Pe(i,hr(Ue(a,l),r)),uv(Ue(c,u)))}function Wg(e,t){const[n,r]=t.args,i=ds(e,CU(n,r),t);return{expr:Er(i),name:i}}function hv(e,t,n,r){const i=n.args,s=i[t],o=i[1-t],a=Er(Pe(s,r(s))).where(pc(o));return Er(ds(e,a,n))}function h4(e,t,n,r){const i=n.args,s=i[t],o=i[1-t],a=Er(os(Pe(s,r(s)),2)).where(pc(o));return Er(ds(e,a,n))}function WU(e,t,n){const[r,i]=t.args,s=Er(Ue(Pe(i,n(i)),Pe(r,n(r))));return Er(ds(e,s,t))}function YU(e,t){const[n,r]=t.args,{expr:i,name:s}=Wg(e,t),o=ds(e,RU(n,r),t);return hr(Er(Ue(o,s)),i)}function HU(e,t){const[n,r]=t.args,{expr:i,name:s}=Wg(e,t),o=ds(e,Ymt(n,r),t);return hr(Er(Ue(o,s)),i)}function d4(e,t,n,r){const{expr:i}=Wg(e,n),s=hv(e,t,n,r),o=h4(e,t,n,r);return Pe(o,hr(os(s,2),i))}function GU(e,t,n){const r=nw(e,t,n,null),i=d4(e,1,t,n);return hr(r,i)}function Nvt(e,t,n){const r=YU(e,t),i=HU(e,t),s=GU(e,t,n);return Pe(i,Ue(s,r))}function $vt(e){if(!e.filterStable)return null;const t=e.query();if(!MS(t))return null;const n=Gw(t,l=>{const c=l._from[0]?.expr;return Ww(c)?c.name:c});if(typeof n!="string")return null;const r=new Map,i={},s={},o=[],a=l=>{const c=l.column,u=Gw(t,f=>f._select.find(h=>h.alias===c)?.expr);return ee`(SELECT avg(${u??l}) FROM "${n}")`};for(const{alias:l,expr:c}of t._select){if(uh(c)>1)return null;const u=Xyt(c);if(u.length===0)o.push(l),i[l]=c;else{for(const f of u){if(f.isDistinct)return null;const h=kvt(f,i,a);if(!h)return null;r.set(f,h)}s[l]=c4(c,r)}}return r.size?{group:o,preagg:i,output:s}:null}function Gw(e,t){const n=e.subqueries;if(MS(e)&&n.length===0)return t(e);const r=Gw(n[0],t);for(let i=1;is.logger().error(h))}return i.set(t,u),u}}function Dvt(e){const{source:t,meta:n}=e,r=e.predicate,i=A6(r).map(a=>a.column);let s,o;if(!n||!i)return{source:null,columns:o,predicate:s};switch(n.type){case"point":s=a=>a,o=Object.fromEntries(i.map(a=>[`${a}`,In(a)]));break;case"interval":{const{scales:a,bin:l,pixelSize:c=1}=n;if(!a)break;const u=a.map(f=>Bvt(f,c,l));u.some(f=>!f)||(u.length===1?(s=f=>f?$s("active0",f.extent?.map(u[0])):[],o={active0:u[0](r.expr)}):(s=f=>f?Di(f.clauses.map((h,d)=>$s(`active${d}`,h.extent?.map(u[d])))):[],o=Object.fromEntries(r.clauses.map((f,h)=>[`active${h}`,u[h](f.expr)]))))}}return{source:o?t:null,columns:o,predicate:s}}const Fvt={ceil:vyt,round:fv};function Bvt(e,t,n){const{type:r,domain:i,range:s,apply:o,sqlApply:a}=E6(e);if(!o)return;const l=Fvt[`${n}`.toLowerCase()]||zo,c=i.map(y=>Number(y)),u=o(Math.min(...c)),f=o(Math.max(...c)),h=(r==="identity"?1:Math.abs(s[1]-s[0])/(f-u))/t,d=h===1?y=>y:y=>Ue(ks(h),y),g=u===0?y=>y:y=>Pe(y,ks(u));return y=>Si(l(d(g(a(y)))))}function Pvt(e,t,n,r){const{group:i,output:s,preagg:o}=n,{columns:a}=t,l=e.setSelect({...o,...a}).groupby(Object.keys(a)),[c]=l.subqueries;if(c){const v=Object.values(a).flatMap(b=>A6(b).map(_=>_.column));Uvt(c,v)}const u=l._having,f=l._orderby;l._having=[],l._orderby=[];const h=l.toString(),d=(qU(h)>>>0).toString(16),g=`${r}.preagg_${d}`,y=zt.select(i,s).from(g).groupby(i).having(u).orderby(f);return new qvt({table:g,create:h,active:t,select:y})}function Uvt(e,t){const n=new Set,r=i=>{if(!n.has(i)){if(n.add(i),MS(i)&&i._from.length&&(i.select(t),zvt(i))){const s=new Set(i._groupby.flatMap(o=>o instanceof mU?[o.name]:[]));i.groupby(t.filter(o=>!s.has(o)))}i.subqueries.forEach(r)}};r(e)}function zvt(e){return e._groupby.length>0||e._select.some(t=>uh(t))}class qvt{table;create;result;active;select;skip;constructor({table:t,create:n,active:r,select:i}){this.table=t,this.create=n,this.result=null,this.active=r,this.select=i,this.skip=!1}query(t){return this.select.clone().where(this.active.predicate(t))}}function p4(){return{debug(){},info(){},log(){},warn(){},error(){},group(){},groupCollapsed(){},groupEnd(){}}}const Qh=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")});class T6 extends Promise{_resolve;_reject;_state;_value;constructor(){let t,n;super((r,i)=>{t=r,n=i}),this._resolve=t,this._reject=n,this._state=Qh.pending,this._value=void 0}fulfill(t){if(this._value!==void 0){if(t!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(t===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(t)}return this._state=Qh.done,this}ready(t){return this._state=Qh.ready,this._value=t,this}reject(t){return this._state=Qh.error,this._reject(t),this}get state(){return this._state}}T6.prototype.constructor=Promise;function jvt(e){return typeof requestAnimationFrame<"u"?requestAnimationFrame(e):typeof setImmediate<"u"?setImmediate(e):setTimeout(e)}function Vvt(e,t){let n=[],r=0;function i(){const s=Wvt(n,t);n=[],r=0;for(const o of s)Hvt(o,e),Kvt(o,t)}return{add(s,o){s.request.type==="arrow"?(r||=jvt(()=>i()),n.push({entry:s,priority:o,index:n.length})):e(s,o)}}}function Wvt(e,t){const n=[],r=new Map;for(const i of e){const{entry:{request:s}}=i,o=Yvt(s.query,t);if(!r.has(o)){const a=[];n.push(a),r.set(o,a)}r.get(o).push(i)}return n}function Yvt(e,t){const n=`${e}`;if(MS(e)&&!t.get(n)){if(e._orderby.length||e._where.length||e._qualify.length||e._having.length)return n;const r=e.clone().setSelect("*"),i=e._groupby;if(i.length){const s={};e._select.forEach(({alias:o,expr:a})=>s[o]=a),r.setGroupby(i.map(o=>ES(o)&&s[o.column]||o))}else e._select.some(s=>uh(s.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function Hvt(e,t){if(Gvt(e))t({request:{type:"arrow",cache:!1,query:e.query=Xvt(e)},result:e.result=new T6});else for(const{entry:n,priority:r}of e)t(n,r)}function Gvt(e){if(e.length>1){const t=`${e[0].entry.request.query}`;for(let n=1;ns[a]=o),r.setGroupby(i.map(o=>ES(o)&&s[o.column]||o))}return r.setSelect(Array.from(n.values()))}async function Kvt(e,t){const{maps:n,query:r,result:i}=e;if(!n)return;let s;try{s=await i}catch(a){for(const{entry:l}of e)l.result.reject(a);return}const o=_mt(r);e.forEach(({entry:a},l)=>{const{request:c,result:u}=a,f=n[l],h=o&&f?Zvt(s,f):f?Jvt(s,f):s;c.cache&&t.set(String(c.query),h),u.fulfill(h)})}function Jvt(e,t){return e.select(t.map(n=>n[0]),t.map(n=>n[1]))}function Zvt(e,t){const n=new Map(t),r=[];for(const i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}const Qvt=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout;function t1t(){return{get:()=>{},set:(e,t)=>t,clear:()=>{}}}function e1t({max:e=1e3,ttl:t=10800*1e3}={}){let n=new Map;function r(){const i=performance.now()-t;let s=null,o=1/0;for(const[a,l]of n){const{last:c}=l;cc&&n.delete(a)}s&&n.delete(s)}return{get(i){const s=n.get(i);if(s)return s.last=performance.now(),s.value},set(i,s){return n.set(i,{last:performance.now(),value:s}),n.size>e&&Qvt(r),s},clear(){n=new Map}}}class n1t{queue;constructor(t){this.queue=Array.from({length:t},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(t=>!t.head)}insert(t,n){const r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);const i={item:t,next:null};r.head===null?r.head=r.tail=i:r.tail=r.tail.next=i}remove(t){for(const n of this.queue){let{head:r,tail:i}=n;for(let s=null,o=r;o;s=o,o=o.next)t(o.item)&&(o===r?r=o.next:s.next=o.next,o===i&&(i=s||r));n.head=r,n.tail=i}}next(){for(const t of this.queue){const{head:n}=t;if(n!==null)return t.head=n.next,t.tail===n&&(t.tail=null),n.item}}}const v0=Object.freeze({High:0,Normal:1,Low:2});class r1t{queue;db;clientCache;_logger;_logQueries;_consolidate;pendingResults;maxConcurrentRequests;pendingExec;constructor(t=32){this.queue=new n1t(3),this.db=null,this.clientCache=null,this._logger=p4(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=t,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;const t=this.queue.next();if(!t)return;const{request:n,result:r}=t;this.pendingResults.push(r),n.type==="exec"&&(this.pendingExec=!0),this.submit(n,r).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==Qh.pending;){const i=this.pendingResults.shift();i.state===Qh.ready?i.fulfill():i.state===Qh.done&&this._logger.warn("Found resolved query in pending results.")}n.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,n=v0.Normal){this.queue.insert(t,n),this.next()}async submit(t,n){try{const{query:r,type:i,cache:s=!1,options:o}=t,a=r?`${r}`:null;if(s){const f=this.clientCache.get(a);if(f){const h=await f;this._logger.debug("Cache"),n.ready(h);return}}const l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:a,...o});const c=this.db.query({type:i,sql:a,...o});s&&this.clientCache.set(a,c);const u=await c;s&&this.clientCache.set(a,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.ready(i==="exec"?null:u)}catch(r){n.reject(r)}}cache(t){return t!==void 0?this.clientCache=t===!0?e1t():t||t1t():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=Vvt(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=v0.Normal){const r=new T6,i={request:t,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(t){const n=new Set(t);if(n.size){this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1);for(const r of this.pendingResults)n.has(r)&&r.reject("Canceled")}}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0));for(const t of this.pendingResults)t.reject("Cleared");this.pendingResults=[]}}let i_;function Va(e){return e?i_=e:i_==null&&(i_=new i1t),i_}class i1t{manager;preaggregator;clients=new Set;filterGroups=new Map;_logger=p4();constructor(t=new jP,n={}){const{logger:r=console,manager:i=new r1t,cache:s=!0,consolidate:o=!0,preagg:a={}}=n;this.manager=i,this.manager.cache(s),this.manager.consolidate(o),this.databaseConnector(t),this.logger(r),this.clear(),this.preaggregator=new Lvt(this,a)}clear(t={}){const{clients:n=!0,cache:r=!0}=t;this.manager.clear(),n&&(this.filterGroups?.forEach(i=>i.disconnect()),this.filterGroups=new Map,this.clients?.forEach(i=>this.disconnect(i)),this.clients=new Set),r&&this.manager.cache().clear()}databaseConnector(t){return t?this.manager.connector(t):this.manager.connector()}logger(t){return arguments.length&&(this._logger=t||p4(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,n={}){const{priority:r=v0.Normal}=n;return t=Array.isArray(t)?t.filter(i=>i).join(`; +`):t,this.manager.request({type:"exec",query:t},r)}query(t,n={}){const{type:r="arrow",cache:i=!0,priority:s=v0.Normal,...o}=n;return this.manager.request({type:r,query:t,cache:i,options:o},s)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:v0.Low})}updateClient(t,n,r=v0.Normal){return t.queryPending(),t._pending=this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{this._logger?.error(i),t.queryError(i)}).catch(i=>this._logger?.error(i))}requestQuery(t,n){return this.preaggregator.clear(),n?this.updateClient(t,n):Promise.resolve(t.update())}connect(t){const{clients:n}=this;if(n?.has(t))throw new Error("Client already connected.");n?.add(t),t.coordinator=this,t.initialize(),s1t(this,t.filterBy,t)}disconnect(t){const{clients:n,filterGroups:r}=this;if(!n?.has(t))return;n.delete(t),t.coordinator=null;const i=r?.get(t.filterBy);i&&i.clients.delete(t)}}function s1t(e,t,n){if(!t)return;let r=e.filterGroups?.get(t);if(!r){const i=o=>o1t(e,t,o),s=()=>a1t(e,t);t.addEventListener("activate",i),t.addEventListener("value",s),r={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",s)}},e.filterGroups?.set(t,r)}r.clients.add(n)}function o1t(e,t,n){const{preaggregator:r,filterGroups:i}=e,{clients:s}=i.get(t);for(const o of s)o.enabled&&r.request(o,t,n)}function a1t(e,t){const{preaggregator:n,filterGroups:r}=e,{clients:i}=r.get(t),{active:s}=t;return Promise.allSettled(Array.from(i,o=>{if(!o.enabled)return o.requestQuery();const a=n.request(o,t,s),l=a?null:t.predicate(o);if(a?.skip||!a&&!l)return;const c=a?.query(s.predicate)??o.query(l);return e.updateClient(o,c)}))}function l1t(e){const{coordinator:t=Va(),...n}=e,r=new c1t(n);return t.connect(r),r}class c1t extends ch{_methods;_filterStable;constructor({selection:t=void 0,enabled:n=!0,filterStable:r=!0,...i}){super(t),this.enabled=n,this._methods=i,this._filterStable=r}get filterStable(){return this._filterStable}async prepare(){await this._methods.prepare?.()}query(t){return this._methods.query?.(t)??null}queryResult(t){return this._methods.queryResult?.(t),this}queryPending(){return this._methods.queryPending?.(),this}queryError(t){return this._methods.queryError?.(t),this}}class u1t{_callbacks;constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new f1t}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){const r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(t,n){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}async pending(t){await this._callbacks.get(t)?.pending}emit(t,n){const r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{const i=this.willEmit(t,n),{callbacks:s,queue:o}=r;if(s?.size){const a=Array.from(s,l=>l(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,o.isEmpty()||this.emit(t,o.dequeue())})}}}}class f1t{next=null;constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){const r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){const{next:t}=this;return this.next=t?.next||null,t?.value}}function XU(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?h1t(e,t):!0}function h1t(e,t){if(e.length!==t.length)return!0;for(let n=0;nRa(n))){const n=new _a,r=()=>{n.update(t.map(i=>Ra(i)?i.value:i))};return r(),t.forEach(i=>Ra(i)?i.addEventListener("value",r):0),n}return new _a(t)}get value(){return this._value}update(t,{force:n}={}){return XU(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}}function Os(e){return e instanceof og}function s_(e,t){return new og(new JU(e),t?[t].flat():void 0)}let og=class KU extends _a{_resolved;_resolver;_relay;static intersect({cross:t=!1,empty:n=!1,include:r=[]}={}){return s_({cross:t,empty:n},r)}static union({cross:t=!1,empty:n=!1,include:r=[]}={}){return s_({cross:t,empty:n,union:!0},r)}static single({cross:t=!1,empty:n=!1,include:r=[]}={}){return s_({cross:t,empty:n,single:!0},r)}static crossfilter({empty:t=!1,include:n=[]}={}){return s_({cross:!0,empty:t},n)}constructor(t=new JU,n=[]){if(super([]),this._resolved=this._value,this._resolver=t,this._relay=new Set,Array.isArray(n))for(const r of n)r._relay.add(this)}clone(){const t=new KU(this._resolver);return t._value=t._resolved=this._value,t}remove(t){const n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(n=>n.source===t)?.value}activate(t){this.emit("activate",t),this._relay.forEach(n=>n.activate(t))}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,this._relay.forEach(n=>n.update(t)),super.update(this._resolved)}reset(t){return t??=this._resolved,t.forEach(n=>n.source?.reset?.()),this._resolved=this._resolved.filter(n=>t.includes(n)),this._relay.forEach(n=>n.reset(t)),super.update(this._resolved=[])}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){const{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}};class JU{union;cross;single;empty;constructor({union:t,cross:n,single:r,empty:i}={}){this.union=!!t,this.cross=!!n,this.single=!!r,this.empty=!!i}resolve(t,n,r=!1){const{source:i,predicate:s}=n,o=t.filter(l=>i!==l.source),a=this.single?[]:o;return this.single&&r&&o.forEach(l=>l.source?.reset?.()),s&&a.push(n),a}skip(t,n){return!!(this.cross&&n?.clients?.has(t))}predicate(t,n,r){const{empty:i,union:s}=this;if(i&&!t.length)return[Zt(!1)];if(this.skip(r,n))return;const o=t.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return s&&o.length>1?Ns(o):o}queueFilter(t){if(this.cross){const n=t.active?.source;return r=>r.active?.source!==n}return null}}function d1t(e){return new p1t(e)}class p1t{_uri;_ipc;constructor({uri:t="http://localhost:3000/",ipc:n=void 0}={}){this._uri=t,this._ipc=n}async query(t){const n=fetch(this._uri,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n;if(!r.ok)throw new Error(`Query failed with HTTP status ${r.status}: ${await r.text()}`);return t.type==="exec"?n:t.type==="arrow"?Vw(await r.arrayBuffer(),this._ipc):r.json()}}function Fe(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(f){o(f)}}function l(u){try{c(r.throw(u))}catch(f){o(f)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function Y$(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ye(e){return this instanceof Ye?(this.v=e,this):new Ye(e)}function ec(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(g){return Promise.resolve(g).then(d,f)}}function a(d,g){r[d]&&(i[d]=function(y){return new Promise(function(v,b){s.push([d,y,v,b])>1||l(d,y)})},g&&(i[d]=g(i[d])))}function l(d,g){try{c(r[d](g))}catch(y){h(s[0][3],y)}}function c(d){d.value instanceof Ye?Promise.resolve(d.value.v).then(u,f):h(s[0][2],d)}function u(d){l("next",d)}function f(d){l("throw",d)}function h(d,g){d(g),s.shift(),s.length&&l(s[0][0],s[0][1])}}function rw(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(o){return(n=!n)?{value:Ye(e[i](o)),done:!1}:s?s(o):o}:s}}function fd(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Y$=="function"?Y$(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,l){o=e[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}const g1t=new TextDecoder("utf-8"),g4=e=>g1t.decode(e),m1t=new TextEncoder,M6=e=>m1t.encode(e),y1t=e=>typeof e=="number",ZU=e=>typeof e=="boolean",xi=e=>typeof e=="function",po=e=>e!=null&&Object(e)===e,Dd=e=>po(e)&&xi(e.then),p1=e=>po(e)&&xi(e[Symbol.iterator]),Yg=e=>po(e)&&xi(e[Symbol.asyncIterator]),m4=e=>po(e)&&po(e.schema),QU=e=>po(e)&&"done"in e&&"value"in e,tz=e=>po(e)&&xi(e.stat)&&y1t(e.fd),ez=e=>po(e)&&I6(e.body),DS=e=>"_getDOMStream"in e&&"_getNodeStream"in e,v1t=e=>po(e)&&xi(e.abort)&&xi(e.getWriter)&&!DS(e),I6=e=>po(e)&&xi(e.cancel)&&xi(e.getReader)&&!DS(e),b1t=e=>po(e)&&xi(e.end)&&xi(e.write)&&ZU(e.writable)&&!DS(e),nz=e=>po(e)&&xi(e.read)&&xi(e.pipe)&&ZU(e.readable)&&!DS(e),_1t=e=>po(e)&&xi(e.clear)&&xi(e.bytes)&&xi(e.position)&&xi(e.setPosition)&&xi(e.capacity)&&xi(e.getBufferIdentifier)&&xi(e.createLong),R6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function w1t(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let o,a,l=0,c=0,u=e.length;++lu+f.byteLength,0);let i,s,o,a=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const u=n.length;++ltr(Int32Array,e),G$=e=>tr(BigInt64Array,e),mn=e=>tr(Uint8Array,e),y4=e=>(e.next(),e);function*x1t(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof R6?n(t):p1(t)?t:n(t);return yield*y4(function*(i){let s=null;do s=i.next(yield tr(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const S1t=e=>x1t(Uint8Array,e);function rz(e,t){return ec(this,arguments,function*(){if(Dd(t))return yield Ye(yield Ye(yield*rw(fd(rz(e,yield Ye(t))))));const r=function(o){return ec(this,arguments,function*(){yield yield Ye(yield Ye(o))})},i=function(o){return ec(this,arguments,function*(){yield Ye(yield*rw(fd(y4(function*(a){let l=null;do l=a.next(yield l?.value);while(!l.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof R6?r(t):p1(t)?i(t):Yg(t)?t:r(t);return yield Ye(yield*rw(fd(y4(function(o){return ec(this,arguments,function*(){let a=null;do a=yield Ye(o.next(yield yield Ye(tr(e,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield Ye(new e)})}const A1t=e=>rz(Uint8Array,e);function iz(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r0)do if(e[n]!==t[n])return!1;while(++n(e.next(),e);function*k1t(e){let t,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?gc(r,o)[0]:([i,r,a]=gc(r,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const c=S1t(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o0&&(i.push(s),l+=s.byteLength),n||a<=l)do({cmd:o,size:a}=yield yield Ye(c()));while(a0&&(i.push(mn(s)),l+=s.byteLength),n||a<=l)do({cmd:o,size:a}=yield yield Ye(c()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Fe(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Fe(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=mn(n)),n})}}const jE=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function R1t(e){return ec(this,arguments,function*(){const n=[];let r="error",i=!1,s=null,o,a,l=0,c=[],u;function f(){return o==="peek"?gc(c,a)[0]:([u,c,l]=gc(c,a),u)}if({cmd:o,size:a}=(yield yield Ye(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ye(new Uint8Array(0)),yield Ye(null);try{n[0]=jE(e,"end"),n[1]=jE(e,"error");do{if(n[2]=jE(e,"readable"),[r,s]=yield Ye(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-l)?(u=mn(e.read(a-l)),u.byteLength0&&(c.push(u),l+=u.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield Ye(f()));while(a{for(const[b,_]of d)e.off(b,_);try{const b=e.destroy;b&&b.call(e,g),g=void 0}catch(b){g=b||g}finally{g!=null?v(g):y()}})}})}var ai;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(ai||(ai={}));var ps;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(ps||(ps={}));var fs;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(fs||(fs={}));var Fa;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Fa||(Fa={}));var Ee;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Ee||(Ee={}));var mc;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(mc||(mc={}));const VE=2,Gl=4,au=4,Xn=4,yf=new Int32Array(2),X$=new Float32Array(yf.buffer),K$=new Float64Array(yf.buffer),a_=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var v4;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(v4||(v4={}));let ag=class sz{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new sz(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){X$[0]=n,this.writeInt32(t,yf[0])}writeFloat64(t,n){K$[0]=n,this.writeInt32(t,yf[a_?0:1]),this.writeInt32(t+4,yf[a_?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*VE;this.addInt16(s);let o=0;const a=this.space;t:for(n=0;n=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Gl+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return so.startUnion(t),so.addMode(t,n),so.addTypeIds(t,r),so.endUnion(t)}}let rO=class by{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new by).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+Xn),(n||new by).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return by.startUtf8(t),by.endUtf8(t)}};var br;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(br||(br={}));let aa=class cw{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new cw).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+Xn),(n||new cw).__init(t.readInt32(t.position())+t.position(),t)}name(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):br.NONE}type(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){const n=this.bb.__offset(this.bb_pos,12);return n?(t||new lu).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new cw).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||new Ai).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,br.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}},Ul=class Jc{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new Jc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+Xn),(n||new Jc).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):lg.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new aa).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Ai).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,lg.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,s){return Jc.startSchema(t),Jc.addEndianness(t,n),Jc.addFields(t,r),Jc.addCustomMetadata(t,i),Jc.addFeatures(t,s),Jc.endSchema(t)}};var Cn;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Cn||(Cn={}));var J;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(J||(J={}));var eu;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(eu||(eu={}));const C1t=void 0;function dv(e){if(e===null)return"null";if(e===C1t)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>dv(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function dr(e){if(typeof e=="bigint"&&(eNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function uz(e,t){return dr(e/t)+dr(e%t)/dr(t)}const N1t=Symbol.for("isArrowBigNum");function Tl(e,...t){return t.length===0?Object.setPrototypeOf(tr(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Tl.prototype[N1t]=!0;Tl.prototype.toJSON=function(){return`"${gv(this)}"`};Tl.prototype.valueOf=function(e){return fz(this,e)};Tl.prototype.toString=function(){return gv(this)};Tl.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return fz(this);case"string":return gv(this);case"default":return L1t(this)}return gv(this)};function N0(...e){return Tl.apply(this,e)}function $0(...e){return Tl.apply(this,e)}function pv(...e){return Tl.apply(this,e)}Object.setPrototypeOf(N0.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf($0.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(pv.prototype,Object.create(Uint32Array.prototype));Object.assign(N0.prototype,Tl.prototype,{constructor:N0,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign($0.prototype,Tl.prototype,{constructor:$0,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(pv.prototype,Tl.prototype,{constructor:pv,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const $1t=BigInt(4294967296)*BigInt(4294967296),O1t=$1t-BigInt(1);function fz(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=e,o=new BigUint64Array(n,r,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return WE(e);t=t.slice();let r=1;for(let s=0;s(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(re.prototype);class zf extends re{constructor(){super(J.Null)}toString(){return"Null"}}dz=Symbol.toStringTag;zf[dz]=(e=>e[Symbol.toStringTag]="Null")(zf.prototype);class Fd extends re{constructor(t,n){super(J.Int),this.isSigned=t,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}pz=Symbol.toStringTag;Fd[pz]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Fd.prototype);class mv extends Fd{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(mv.prototype,"ArrayType",{value:Int32Array});class Zw extends re{constructor(t){super(J.Float),this.precision=t}get ArrayType(){switch(this.precision){case fs.HALF:return Uint16Array;case fs.SINGLE:return Float32Array;case fs.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}gz=Symbol.toStringTag;Zw[gz]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Zw.prototype);class Qw extends re{constructor(){super(J.Binary)}toString(){return"Binary"}}mz=Symbol.toStringTag;Qw[mz]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Qw.prototype);class tx extends re{constructor(){super(J.LargeBinary)}toString(){return"LargeBinary"}}yz=Symbol.toStringTag;tx[yz]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(tx.prototype);class ex extends re{constructor(){super(J.Utf8)}toString(){return"Utf8"}}vz=Symbol.toStringTag;ex[vz]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(ex.prototype);class nx extends re{constructor(){super(J.LargeUtf8)}toString(){return"LargeUtf8"}}bz=Symbol.toStringTag;nx[bz]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(nx.prototype);class rx extends re{constructor(){super(J.Bool)}toString(){return"Bool"}}_z=Symbol.toStringTag;rx[_z]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(rx.prototype);class ix extends re{constructor(t,n,r=128){super(J.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}wz=Symbol.toStringTag;ix[wz]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ix.prototype);class sx extends re{constructor(t){super(J.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Fa[this.unit]}>`}get ArrayType(){return this.unit===Fa.DAY?Int32Array:BigInt64Array}}xz=Symbol.toStringTag;sx[xz]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(sx.prototype);class ox extends re{constructor(t,n){super(J.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${Ee[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Sz=Symbol.toStringTag;ox[Sz]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(ox.prototype);class ax extends re{constructor(t,n){super(J.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${Ee[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Az=Symbol.toStringTag;ax[Az]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ax.prototype);class lx extends re{constructor(t){super(J.Interval),this.unit=t}toString(){return`Interval<${mc[this.unit]}>`}}Ez=Symbol.toStringTag;lx[Ez]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(lx.prototype);class cx extends re{constructor(t){super(J.Duration),this.unit=t}toString(){return`Duration<${Ee[this.unit]}>`}}kz=Symbol.toStringTag;cx[kz]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(cx.prototype);class ux extends re{constructor(t){super(J.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Tz=Symbol.toStringTag;ux[Tz]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ux.prototype);class Rs extends re{constructor(t){super(J.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Mz=Symbol.toStringTag;Rs[Mz]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Rs.prototype);class fx extends re{constructor(t,n,r){super(J.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Iz=Symbol.toStringTag;fx[Iz]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(fx.prototype);class hx extends re{constructor(t){super(J.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Rz=Symbol.toStringTag;hx[Rz]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(hx.prototype);class dx extends re{constructor(t,n){super(J.FixedSizeList),this.listSize=t,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Cz=Symbol.toStringTag;dx[Cz]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(dx.prototype);class px extends re{constructor(t,n=!1){var r,i,s;if(super(J.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){const o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t?.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Nz=Symbol.toStringTag;px[Nz]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(px.prototype);const D1t=(e=>()=>++e)(-1);class cg extends re{constructor(t,n,r,i){super(J.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?D1t():dr(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}$z=Symbol.toStringTag;cg[$z]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(cg.prototype);function nu(e){const t=e;switch(e.typeId){case J.Decimal:return e.bitWidth/32;case J.Interval:return 1+t.unit;case J.FixedSizeList:return t.listSize;case J.FixedSizeBinary:return t.byteWidth;default:return 1}}class en{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return F1t(this,t,n)}getVisitFnByTypeId(t,n=!0){return h0(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function F1t(e,t,n=!0){return typeof t=="number"?h0(e,t,n):typeof t=="string"&&t in J?h0(e,J[t],n):t&&t instanceof re?h0(e,iO(t),n):t?.type&&t.type instanceof re?h0(e,iO(t.type),n):h0(e,J.NONE,n)}function h0(e,t,n=!0){let r=null;switch(t){case J.Null:r=e.visitNull;break;case J.Bool:r=e.visitBool;break;case J.Int:r=e.visitInt;break;case J.Int8:r=e.visitInt8||e.visitInt;break;case J.Int16:r=e.visitInt16||e.visitInt;break;case J.Int32:r=e.visitInt32||e.visitInt;break;case J.Int64:r=e.visitInt64||e.visitInt;break;case J.Uint8:r=e.visitUint8||e.visitInt;break;case J.Uint16:r=e.visitUint16||e.visitInt;break;case J.Uint32:r=e.visitUint32||e.visitInt;break;case J.Uint64:r=e.visitUint64||e.visitInt;break;case J.Float:r=e.visitFloat;break;case J.Float16:r=e.visitFloat16||e.visitFloat;break;case J.Float32:r=e.visitFloat32||e.visitFloat;break;case J.Float64:r=e.visitFloat64||e.visitFloat;break;case J.Utf8:r=e.visitUtf8;break;case J.LargeUtf8:r=e.visitLargeUtf8;break;case J.Binary:r=e.visitBinary;break;case J.LargeBinary:r=e.visitLargeBinary;break;case J.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case J.Date:r=e.visitDate;break;case J.DateDay:r=e.visitDateDay||e.visitDate;break;case J.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case J.Timestamp:r=e.visitTimestamp;break;case J.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case J.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case J.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case J.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case J.Time:r=e.visitTime;break;case J.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case J.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case J.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case J.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case J.Decimal:r=e.visitDecimal;break;case J.List:r=e.visitList;break;case J.Struct:r=e.visitStruct;break;case J.Union:r=e.visitUnion;break;case J.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case J.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case J.Dictionary:r=e.visitDictionary;break;case J.Interval:r=e.visitInterval;break;case J.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case J.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case J.Duration:r=e.visitDuration;break;case J.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case J.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case J.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case J.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case J.FixedSizeList:r=e.visitFixedSizeList;break;case J.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${J[t]}'`)}function iO(e){switch(e.typeId){case J.Null:return J.Null;case J.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?J.Int8:J.Uint8;case 16:return n?J.Int16:J.Uint16;case 32:return n?J.Int32:J.Uint32;case 64:return n?J.Int64:J.Uint64}return J.Int}case J.Float:switch(e.precision){case fs.HALF:return J.Float16;case fs.SINGLE:return J.Float32;case fs.DOUBLE:return J.Float64}return J.Float;case J.Binary:return J.Binary;case J.LargeBinary:return J.LargeBinary;case J.Utf8:return J.Utf8;case J.LargeUtf8:return J.LargeUtf8;case J.Bool:return J.Bool;case J.Decimal:return J.Decimal;case J.Time:switch(e.unit){case Ee.SECOND:return J.TimeSecond;case Ee.MILLISECOND:return J.TimeMillisecond;case Ee.MICROSECOND:return J.TimeMicrosecond;case Ee.NANOSECOND:return J.TimeNanosecond}return J.Time;case J.Timestamp:switch(e.unit){case Ee.SECOND:return J.TimestampSecond;case Ee.MILLISECOND:return J.TimestampMillisecond;case Ee.MICROSECOND:return J.TimestampMicrosecond;case Ee.NANOSECOND:return J.TimestampNanosecond}return J.Timestamp;case J.Date:switch(e.unit){case Fa.DAY:return J.DateDay;case Fa.MILLISECOND:return J.DateMillisecond}return J.Date;case J.Interval:switch(e.unit){case mc.DAY_TIME:return J.IntervalDayTime;case mc.YEAR_MONTH:return J.IntervalYearMonth}return J.Interval;case J.Duration:switch(e.unit){case Ee.SECOND:return J.DurationSecond;case Ee.MILLISECOND:return J.DurationMillisecond;case Ee.MICROSECOND:return J.DurationMicrosecond;case Ee.NANOSECOND:return J.DurationNanosecond}return J.Duration;case J.Map:return J.Map;case J.List:return J.List;case J.Struct:return J.Struct;case J.Union:switch(e.mode){case ps.Dense:return J.DenseUnion;case ps.Sparse:return J.SparseUnion}return J.Union;case J.FixedSizeBinary:return J.FixedSizeBinary;case J.FixedSizeList:return J.FixedSizeList;case J.Dictionary:return J.Dictionary}throw new Error(`Unrecognized type '${J[e.typeId]}'`)}en.prototype.visitInt8=null;en.prototype.visitInt16=null;en.prototype.visitInt32=null;en.prototype.visitInt64=null;en.prototype.visitUint8=null;en.prototype.visitUint16=null;en.prototype.visitUint32=null;en.prototype.visitUint64=null;en.prototype.visitFloat16=null;en.prototype.visitFloat32=null;en.prototype.visitFloat64=null;en.prototype.visitDateDay=null;en.prototype.visitDateMillisecond=null;en.prototype.visitTimestampSecond=null;en.prototype.visitTimestampMillisecond=null;en.prototype.visitTimestampMicrosecond=null;en.prototype.visitTimestampNanosecond=null;en.prototype.visitTimeSecond=null;en.prototype.visitTimeMillisecond=null;en.prototype.visitTimeMicrosecond=null;en.prototype.visitTimeNanosecond=null;en.prototype.visitDenseUnion=null;en.prototype.visitSparseUnion=null;en.prototype.visitIntervalDayTime=null;en.prototype.visitIntervalYearMonth=null;en.prototype.visitDuration=null;en.prototype.visitDurationSecond=null;en.prototype.visitDurationMillisecond=null;en.prototype.visitDurationMicrosecond=null;en.prototype.visitDurationNanosecond=null;const Oz=new Float64Array(1),jp=new Uint32Array(Oz.buffer);function Lz(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function B1t(e){if(e!==e)return 32256;Oz[0]=e;const t=(jp[1]&2147483648)>>16&65535;let n=jp[1]&2146435072,r=0;return n>=1089470464?jp[0]>0?n=31744:(n=(n&2080374784)>>16,r=(jp[1]&1048575)>>10):n<=1056964608?(r=1048576+(jp[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(jp[1]&1048575)+512>>10),t|n|r&65535}class Te extends en{}function $e(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const P1t=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Dz=(e,t,n,r)=>{if(n+1{const i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},N6=({values:e},t,n)=>{e[t]=n},Fz=({values:e},t,n)=>{e[t]=B1t(n)},z1t=(e,t,n)=>{switch(e.type.precision){case fs.HALF:return Fz(e,t,n);case fs.SINGLE:case fs.DOUBLE:return N6(e,t,n)}},Bz=({values:e},t,n)=>{P1t(e,t,n.valueOf())},Pz=({values:e},t,n)=>{e[t]=BigInt(n)},q1t=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Uz=({values:e,valueOffsets:t},n,r)=>Dz(e,t,n,r),zz=({values:e,valueOffsets:t},n,r)=>Dz(e,t,n,M6(r)),j1t=(e,t,n)=>{e.type.unit===Fa.DAY?Bz(e,t,n):Pz(e,t,n)},qz=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},jz=({values:e},t,n)=>{e[t]=BigInt(n)},Vz=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},Wz=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},V1t=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return qz(e,t,n);case Ee.MILLISECOND:return jz(e,t,n);case Ee.MICROSECOND:return Vz(e,t,n);case Ee.NANOSECOND:return Wz(e,t,n)}},Yz=({values:e},t,n)=>{e[t]=n},Hz=({values:e},t,n)=>{e[t]=n},Gz=({values:e},t,n)=>{e[t]=n},Xz=({values:e},t,n)=>{e[t]=n},W1t=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return Yz(e,t,n);case Ee.MILLISECOND:return Hz(e,t,n);case Ee.MICROSECOND:return Gz(e,t,n);case Ee.NANOSECOND:return Xz(e,t,n)}},Y1t=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},H1t=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=Ba.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[t],l=i[t+1];a{const r=e.children[0],{valueOffsets:i}=e,s=Ba.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(s(r,o,c),++o>=a)break},X1t=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),K1t=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),J1t=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),Z1t=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),Q1t=(e,t,n)=>{const r=e.type.children.map(s=>Ba.getVisitFn(s.type)),i=n instanceof Map?J1t(t,n):n instanceof Ur?K1t(t,n):Array.isArray(n)?X1t(t,n):Z1t(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},tbt=(e,t,n)=>{e.type.mode===ps.Dense?Kz(e,t,n):Jz(e,t,n)},Kz=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Ba.visit(i,e.valueOffsets[t],n)},Jz=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Ba.visit(i,t,n)},ebt=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},nbt=(e,t,n)=>{e.type.unit===mc.DAY_TIME?Zz(e,t,n):Qz(e,t,n)},Zz=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Qz=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},tq=({values:e},t,n)=>{e[t]=n},eq=({values:e},t,n)=>{e[t]=n},nq=({values:e},t,n)=>{e[t]=n},rq=({values:e},t,n)=>{e[t]=n},rbt=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return tq(e,t,n);case Ee.MILLISECOND:return eq(e,t,n);case Ee.MICROSECOND:return nq(e,t,n);case Ee.NANOSECOND:return rq(e,t,n)}},ibt=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=Ba.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=t*r;++o`${dv(t)}: ${dv(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new sbt(this[Za],this[O0])}}class sbt{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return tn.name)}has(t,n){return t[Za].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Za].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Za].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=go.visit(t[Za].children[r],t[O0]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Za].type.children.findIndex(s=>s.name===n);return i!==-1?(Ba.visit(t[Za].children[i],t[O0],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class be extends en{}function Me(e){return(t,n)=>t.getValid(n)?e(t,n):null}const abt=(e,t)=>864e5*e[t],lbt=(e,t)=>null,iq=(e,t,n)=>{if(n+1>=t.length)return null;const r=dr(t[n]),i=dr(t[n+1]);return e.subarray(r,i)},cbt=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<abt(e,t),oq=({values:e},t)=>dr(e[t]),fh=({stride:e,values:t},n)=>t[e*n],ubt=({stride:e,values:t},n)=>Lz(t[e*n]),aq=({values:e},t)=>e[t],fbt=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),lq=({values:e,valueOffsets:t},n)=>iq(e,t,n),cq=({values:e,valueOffsets:t},n)=>{const r=iq(e,t,n);return r!==null?g4(r):null},hbt=({values:e},t)=>e[t],dbt=({type:e,values:t},n)=>e.precision!==fs.HALF?t[n]:Lz(t[n]),pbt=(e,t)=>e.type.unit===Fa.DAY?sq(e,t):oq(e,t),uq=({values:e},t)=>1e3*dr(e[t]),fq=({values:e},t)=>dr(e[t]),hq=({values:e},t)=>uz(e[t],BigInt(1e3)),dq=({values:e},t)=>uz(e[t],BigInt(1e6)),gbt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return uq(e,t);case Ee.MILLISECOND:return fq(e,t);case Ee.MICROSECOND:return hq(e,t);case Ee.NANOSECOND:return dq(e,t)}},pq=({values:e},t)=>e[t],gq=({values:e},t)=>e[t],mq=({values:e},t)=>e[t],yq=({values:e},t)=>e[t],mbt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return pq(e,t);case Ee.MILLISECOND:return gq(e,t);case Ee.MICROSECOND:return mq(e,t);case Ee.NANOSECOND:return yq(e,t)}},ybt=({values:e,stride:t},n)=>C6.decimal(e.subarray(t*n,t*(n+1))),vbt=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:o}=n,l=i[0].slice(s,o-s);return new Ur([l])},bbt=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,o=r[0];return new O6(o.slice(i,s-i))},_bt=(e,t)=>new $6(e,t),wbt=(e,t)=>e.type.mode===ps.Dense?vq(e,t):bq(e,t),vq=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return go.visit(r,e.valueOffsets[t])},bq=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return go.visit(r,t)},xbt=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Sbt=(e,t)=>e.type.unit===mc.DAY_TIME?_q(e,t):wq(e,t),_q=({values:e},t)=>e.subarray(2*t,2*(t+1)),wq=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},xq=({values:e},t)=>e[t],Sq=({values:e},t)=>e[t],Aq=({values:e},t)=>e[t],Eq=({values:e},t)=>e[t],Abt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return xq(e,t);case Ee.MILLISECOND:return Sq(e,t);case Ee.MICROSECOND:return Aq(e,t);case Ee.NANOSECOND:return Eq(e,t)}},Ebt=(e,t)=>{const{stride:n,children:r}=e,s=r[0].slice(t*n,n);return new Ur([s])};be.prototype.visitNull=Me(lbt);be.prototype.visitBool=Me(cbt);be.prototype.visitInt=Me(hbt);be.prototype.visitInt8=Me(fh);be.prototype.visitInt16=Me(fh);be.prototype.visitInt32=Me(fh);be.prototype.visitInt64=Me(aq);be.prototype.visitUint8=Me(fh);be.prototype.visitUint16=Me(fh);be.prototype.visitUint32=Me(fh);be.prototype.visitUint64=Me(aq);be.prototype.visitFloat=Me(dbt);be.prototype.visitFloat16=Me(ubt);be.prototype.visitFloat32=Me(fh);be.prototype.visitFloat64=Me(fh);be.prototype.visitUtf8=Me(cq);be.prototype.visitLargeUtf8=Me(cq);be.prototype.visitBinary=Me(lq);be.prototype.visitLargeBinary=Me(lq);be.prototype.visitFixedSizeBinary=Me(fbt);be.prototype.visitDate=Me(pbt);be.prototype.visitDateDay=Me(sq);be.prototype.visitDateMillisecond=Me(oq);be.prototype.visitTimestamp=Me(gbt);be.prototype.visitTimestampSecond=Me(uq);be.prototype.visitTimestampMillisecond=Me(fq);be.prototype.visitTimestampMicrosecond=Me(hq);be.prototype.visitTimestampNanosecond=Me(dq);be.prototype.visitTime=Me(mbt);be.prototype.visitTimeSecond=Me(pq);be.prototype.visitTimeMillisecond=Me(gq);be.prototype.visitTimeMicrosecond=Me(mq);be.prototype.visitTimeNanosecond=Me(yq);be.prototype.visitDecimal=Me(ybt);be.prototype.visitList=Me(vbt);be.prototype.visitStruct=Me(_bt);be.prototype.visitUnion=Me(wbt);be.prototype.visitDenseUnion=Me(vq);be.prototype.visitSparseUnion=Me(bq);be.prototype.visitDictionary=Me(xbt);be.prototype.visitInterval=Me(Sbt);be.prototype.visitIntervalDayTime=Me(_q);be.prototype.visitIntervalYearMonth=Me(wq);be.prototype.visitDuration=Me(Abt);be.prototype.visitDurationSecond=Me(xq);be.prototype.visitDurationMillisecond=Me(Sq);be.prototype.visitDurationMicrosecond=Me(Aq);be.prototype.visitDurationNanosecond=Me(Eq);be.prototype.visitFixedSizeList=Me(Ebt);be.prototype.visitMap=Me(bbt);const go=new be,d0=Symbol.for("keys"),L0=Symbol.for("vals"),p0=Symbol.for("kKeysAsStrings"),w4=Symbol.for("_kKeysAsStrings");class O6{constructor(t){return this[d0]=new Ur([t.children[0]]).memoize(),this[L0]=t.children[1],new Proxy(this,new Tbt)}get[p0](){return this[w4]||(this[w4]=Array.from(this[d0].toArray(),String))}[Symbol.iterator](){return new kbt(this[d0],this[L0])}get size(){return this[d0].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[d0],n=this[L0],r={};for(let i=-1,s=t.length;++i`${dv(t)}: ${dv(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class kbt{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),go.visit(this.vals,t)]})}}class Tbt{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[p0]}has(t,n){return t[p0].includes(n)}getOwnPropertyDescriptor(t,n){if(t[p0].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[p0].indexOf(n);if(r!==-1){const i=go.visit(Reflect.get(t,L0),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[p0].indexOf(n);return i!==-1?(Ba.visit(Reflect.get(t,L0),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(O6.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[d0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[L0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[w4]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let sO;function kq(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,s,o):[s,o]}const L6=(e,t)=>e<0?t+e:e,oO=e=>e!==e;function Hg(e){if(typeof e!=="object"||e===null)return oO(e)?oO:n=>n===e;if(e instanceof Date){const n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?E1t(e,n):!1:e instanceof Map?Ibt(e):Array.isArray(e)?Mbt(e):e instanceof Ur?Rbt(e):Cbt(e,!0)}function Mbt(e){const t=[];for(let n=-1,r=e.length;++n!1;const r=[];for(let i=-1,s=n.length;++i{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return Nbt(e,n);case Map:return aO(e,n,n.keys());case O6:case $6:case Object:case void 0:return aO(e,n,t||Object.keys(n))}return n instanceof Ur?$bt(e,n):!1}}function Nbt(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r>r}function gx(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength>3):mx(new D6(n,e,t,null,Tq)).subarray(0,r)),i}return n}function mx(e){const t=[];let n=0,r=0,i=0;for(const o of e)o&&(i|=1<0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class D6{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return x4(e,t,i)+x4(e,r,n)+Lbt(e,i>>3,r-i>>3)}function Lbt(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=YE(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=YE(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=YE(s.getUint8(i)),i+=1;return r}function YE(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Dbt=-1;class Jn{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return re.isSparseUnion(t)?this.children.some(n=>n.nullable):re.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(re.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Dbt&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-x4(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof Jn?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=nu(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(re.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===ps.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(gx(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const f=s[u];r=(f&c)!==0,s[u]=n?f|c:f&~c}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new Jn(t,n,r,i,s,o,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,l=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===J.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<0&&i.set(gx(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[eu.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:o}=this;return(s=o[eu.TYPE])&&(o[eu.TYPE]=s.subarray(t,t+n)),(s=o[eu.OFFSET])&&(o[eu.OFFSET]=s.subarray(t,t+n+1))||(s=o[eu.DATA])&&(o[eu.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),o}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}Jn.prototype.children=Object.freeze([]);class By extends en{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Jn(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.data),s=mn(t.nullBitmap),o=Um(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,i,s])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.data),s=mn(t.nullBitmap),o=G$(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.data),s=mn(t.nullBitmap),o=Um(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,i,s])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.data),s=mn(t.nullBitmap),o=G$(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=mn(t.nullBitmap),o=Um(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=mn(t.nullBitmap),{length:o=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=tr(n.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(re.isSparseUnion(n))return new Jn(n,r,o,a,[void 0,void 0,void 0,s],i);const l=Um(t.valueOffsets);return new Jn(n,r,o,a,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.indices.ArrayType,t.data),{["dictionary"]:o=new Ur([new By().visit({type:n.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=mn(t.nullBitmap),s=tr(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new By().visit({type:n.valueType})}=t,s=mn(t.nullBitmap),{["length"]:o=i.length/nu(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Jn(n,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new By().visit({type:n.childType})}=t,s=mn(t.nullBitmap),o=Um(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Jn(n,r,a,l,[o,void 0,s],[i])}}const Fbt=new By;function nn(e){return Fbt.visit(e)}class lO{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function Mq(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Iq(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Rq(e,t,n,r){const i=[];for(let s=-1,o=e.length;++s=r)break;if(n>=l+c)continue;if(l>=n&&l+c<=r){i.push(a);continue}const u=Math.max(0,n-l),f=Math.min(r-l,c);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function F6(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function Ubt(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new D6(n,e.offset+(t||0),e.length,n,Tq)){if(!i)return r;++r}return-1}function Le(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case J.Union:break;case J.Dictionary:break;default:return Ubt(e,n)}const r=go.getVisitFn(e),i=Hg(t);for(let s=(n||0)-1,o=e.length;++s{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new lO(e.data.length,r=>{const s=e.data[r].length,o=e.slice(n,n+s);return n+=s,new zbt(o)})}class zbt{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(s.length===0||s.some(a=>!(a instanceof Jn)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:c}=Lq[o.typeId],u=s[0];this.isValid=f=>B6(u,f),this.get=f=>a(u,f),this.set=(f,h)=>l(u,f,h),this.indexOf=f=>c(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,Dq[o.typeId]),this._offsets=Iq(s);break}this.data=s,this.type=o,this.stride=nu(o),this.numChildren=(i=(r=o.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullable(){return Bbt(this.data)}get nullCount(){return Mq(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${J[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(L6(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return P6.visit(this)}concat(...t){return new Wh(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new Wh(kq(this,t,n,({data:r,_offsets:i},s,o)=>Rq(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case J.Int:case J.Float:case J.Decimal:case J.Time:case J.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&tn[t])):null}get isMemoized(){return re.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(re.isDictionary(this.type)){const t=new bx(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Wh(n)}return new bx(this)}unmemoize(){if(re.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Wh(n)}return this}};Oq=Symbol.toStringTag;Ur[Oq]=(e=>{e.type=re.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(J).map(n=>J[n]).filter(n=>typeof n=="number"&&n!==J.NONE);for(const n of t){const r=go.getVisitFnByTypeId(n),i=Ba.getVisitFnByTypeId(n),s=vx.getVisitFnByTypeId(n);Lq[n]={get:r,set:i,indexOf:s},Dq[n]=Object.create(e,{isValid:{value:yx(B6)},get:{value:yx(go.getVisitFnByTypeId(n))},set:{value:Cq(Ba.getVisitFnByTypeId(n))},indexOf:{value:Nq(vx.getVisitFnByTypeId(n))}})}return"Vector"})(Ur.prototype);class bx extends Ur{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=n.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new bx(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ur(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class S4{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}}class Co{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new Co).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+Xn),(n||new Co).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ai.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ul).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new S4).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new S4).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Ai).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,ai.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}}class Vn{constructor(t=[],n,r,i=ai.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=A4(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){const n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new Vn(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new Vn(n,this.metadata)}assign(...t){const n=t[0]instanceof Vn?t[0]:Array.isArray(t[0])?new Vn(t[0]):new Vn(t),r=[...this.fields],i=l_(l_(new Map,this.metadata),n.metadata),s=n.fields.filter(a=>{const l=r.findIndex(c=>c.name===a.name);return~l?(r[l]=a.clone({metadata:l_(l_(new Map,r[l].metadata),a.metadata)}))&&!1:!0}),o=A4(s,new Map);return new Vn([...r,...s],i,new Map([...this.dictionaries,...o]))}}Vn.prototype.fields=null;Vn.prototype.metadata=null;Vn.prototype.dictionaries=null;class Tr{static new(...t){let[n,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new Tr(`${n}`,r,i,s)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],Tr.new(n,r,i,s)}}Tr.prototype.type=null;Tr.prototype.name=null;Tr.prototype.nullable=null;Tr.prototype.metadata=null;function l_(e,t){return new Map([...e||new Map,...t||new Map])}function A4(e,t=new Map){for(let n=-1,r=e.length;++n0&&A4(s.children,t)}return t}var qbt=oz,jbt=ag;class yv{static decode(t){t=new jbt(mn(t));const n=Co.getRootAsFooter(t),r=Vn.decode(n.schema(),new Map,n.version());return new Vbt(r,n)}static encode(t){const n=new qbt,r=Vn.encode(n,t.schema);Co.startRecordBatchesVector(n,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())qf.encode(n,o);const i=n.endVector();Co.startDictionariesVector(n,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())qf.encode(n,o);const s=n.endVector();return Co.startFooter(n),Co.addSchema(n,r),Co.addVersion(n,ai.V5),Co.addRecordBatches(n,i),Co.addDictionaries(n,s),Co.finishFooterBuffer(n,Co.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=ai.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Fe(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(zr);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return da.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return da.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Fe(this,void 0,void 0,function*(){return yield this.abort(t),zr})}return(t){return Fe(this,void 0,void 0,function*(){return yield this.close(),zr})}read(t){return Fe(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Fe(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(zr)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class uw extends Wbt{write(t){if((t=mn(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?g4(this.toUint8Array(!0)):this.toUint8Array(!1).then(g4)}toUint8Array(t=!1){return t?gc(this._values)[0]:Fe(this,void 0,void 0,function*(){var n,r,i,s;const o=[];let a=0;try{for(var l=!0,c=fd(this),u;u=yield c.next(),n=u.done,!n;l=!0){s=u.value,l=!1;const f=s;o.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return gc(o,a)[0]})}}class _x{constructor(t){t&&(this.source=new Ybt(da.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class ug{constructor(t){t instanceof ug?this.source=t.source:t instanceof uw?this.source=new zh(da.fromAsyncIterable(t)):nz(t)?this.source=new zh(da.fromNodeStream(t)):I6(t)?this.source=new zh(da.fromDOMStream(t)):ez(t)?this.source=new zh(da.fromDOMStream(t.body)):p1(t)?this.source=new zh(da.fromIterable(t)):Dd(t)?this.source=new zh(da.fromAsyncIterable(t)):Yg(t)&&(this.source=new zh(da.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Ybt{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||zr)}return(t){return Object.create(this.source.return&&this.source.return(t)||zr)}}class zh{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Fe(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Fe(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Fe(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Fe(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(t){return Fe(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(t))||zr;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Fe(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(t))||zr;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class uO extends _x{constructor(t,n){super(),this.position=0,this.buffer=mn(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){const{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){const n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]>>0&&++n[1],n[1]>>0&&++n[2],n[2]>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${b0(this.buffer[3])} ${b0(this.buffer[2])} ${b0(this.buffer[1])} ${b0(this.buffer[0])}`}static multiply(t,n){return new zl(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new zl(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return zl.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return zl.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new zl(n);for(let o=r?1:0;o0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}}class Gbt extends Bq{constructor(t,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):mx(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return tr(Uint8Array,tr(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return tr(Uint8Array,tr(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return re.isTimestamp(t)||(re.isInt(t)||re.isTime(t))&&t.bitWidth===64||re.isDuration(t)||re.isDate(t)&&t.unit===Fa.MILLISECOND?tr(Uint8Array,Js.convertArray(r[n])):re.isDecimal(t)?tr(Uint8Array,zl.convertArray(r[n])):re.isBinary(t)||re.isLargeBinary(t)||re.isFixedSizeBinary(t)?Xbt(r[n]):re.isBool(t)?mx(r[n]):re.isUtf8(t)||re.isLargeUtf8(t)?M6(r[n].join("")):tr(Uint8Array,tr(t.ArrayType,r[n].map(i=>+i)))}}function Xbt(e){const t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r>1]=Number.parseInt(t.slice(r,r+2),16);return n}class xe extends en{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}}function Vs(e,t){return t instanceof e.constructor}function ap(e,t){return e===t||Vs(e,t)}function Pu(e,t){return e===t||Vs(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function BS(e,t){return e===t||Vs(e,t)&&e.precision===t.precision}function Kbt(e,t){return e===t||Vs(e,t)&&e.byteWidth===t.byteWidth}function q6(e,t){return e===t||Vs(e,t)&&e.unit===t.unit}function g1(e,t){return e===t||Vs(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function m1(e,t){return e===t||Vs(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Jbt(e,t){return e===t||Vs(e,t)&&e.children.length===t.children.length&&jf.compareManyFields(e.children,t.children)}function Zbt(e,t){return e===t||Vs(e,t)&&e.children.length===t.children.length&&jf.compareManyFields(e.children,t.children)}function j6(e,t){return e===t||Vs(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&jf.compareManyFields(e.children,t.children)}function Qbt(e,t){return e===t||Vs(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&jf.visit(e.indices,t.indices)&&jf.visit(e.dictionary,t.dictionary)}function V6(e,t){return e===t||Vs(e,t)&&e.unit===t.unit}function y1(e,t){return e===t||Vs(e,t)&&e.unit===t.unit}function t_t(e,t){return e===t||Vs(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&jf.compareManyFields(e.children,t.children)}function e_t(e,t){return e===t||Vs(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&jf.compareManyFields(e.children,t.children)}xe.prototype.visitNull=ap;xe.prototype.visitBool=ap;xe.prototype.visitInt=Pu;xe.prototype.visitInt8=Pu;xe.prototype.visitInt16=Pu;xe.prototype.visitInt32=Pu;xe.prototype.visitInt64=Pu;xe.prototype.visitUint8=Pu;xe.prototype.visitUint16=Pu;xe.prototype.visitUint32=Pu;xe.prototype.visitUint64=Pu;xe.prototype.visitFloat=BS;xe.prototype.visitFloat16=BS;xe.prototype.visitFloat32=BS;xe.prototype.visitFloat64=BS;xe.prototype.visitUtf8=ap;xe.prototype.visitLargeUtf8=ap;xe.prototype.visitBinary=ap;xe.prototype.visitLargeBinary=ap;xe.prototype.visitFixedSizeBinary=Kbt;xe.prototype.visitDate=q6;xe.prototype.visitDateDay=q6;xe.prototype.visitDateMillisecond=q6;xe.prototype.visitTimestamp=g1;xe.prototype.visitTimestampSecond=g1;xe.prototype.visitTimestampMillisecond=g1;xe.prototype.visitTimestampMicrosecond=g1;xe.prototype.visitTimestampNanosecond=g1;xe.prototype.visitTime=m1;xe.prototype.visitTimeSecond=m1;xe.prototype.visitTimeMillisecond=m1;xe.prototype.visitTimeMicrosecond=m1;xe.prototype.visitTimeNanosecond=m1;xe.prototype.visitDecimal=ap;xe.prototype.visitList=Jbt;xe.prototype.visitStruct=Zbt;xe.prototype.visitUnion=j6;xe.prototype.visitDenseUnion=j6;xe.prototype.visitSparseUnion=j6;xe.prototype.visitDictionary=Qbt;xe.prototype.visitInterval=V6;xe.prototype.visitIntervalDayTime=V6;xe.prototype.visitIntervalYearMonth=V6;xe.prototype.visitDuration=y1;xe.prototype.visitDurationSecond=y1;xe.prototype.visitDurationMillisecond=y1;xe.prototype.visitDurationMicrosecond=y1;xe.prototype.visitDurationNanosecond=y1;xe.prototype.visitFixedSizeList=t_t;xe.prototype.visitMap=e_t;const jf=new xe;function E4(e,t){return jf.compareSchemas(e,t)}function HE(e,t){return n_t(e,t.map(n=>n.data.concat()))}function n_t(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.length),0)};let s=0,o=0,a=-1;const l=t.length;let c,u=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(r[s++]=nn({type:new Rs(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new oo(e,f))]}function r_t(e,t,n,r,i){var s;const o=(t+63&-64)>>3;for(let a=-1,l=r.length;++a=t)u===t?n[a]=c:(n[a]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(c.slice(t,u-t))));else{const f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(s=c?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:nn({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return n}var Pq;let Vf=class Yh{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new Vn([]),this._offsets=[0],this;let i,s;t[0]instanceof Vn&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=l=>{if(l){if(l instanceof oo)return[l];if(l instanceof Yh)return l.batches;if(l instanceof Jn){if(l.type instanceof Rs)return[new oo(new Vn(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>o(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>o(c));if(typeof l=="object"){const c=Object.keys(l),u=c.map(d=>new Ur([l[d]])),f=i??new Vn(c.map((d,g)=>new Tr(String(d),u[g].type,u[g].nullable))),[,h]=HE(f,u);return h.length===0?[new oo(l)]:h}}}return[]},a=t.flatMap(l=>o(l));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new Vn([]),!(i instanceof Vn))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof oo))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!E4(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??Iq(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Mq(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(L6(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?P6.visit(new Ur(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ + ${this.toArray().join(`, + `)} +]`}concat(...t){const n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new Yh(n,r.map(i=>new oo(n,i)))}slice(t,n){const r=this.schema;[t,n]=kq({length:this.numRows},t,n);const i=Rq(this.data,this._offsets,t,n);return new Yh(r,i.map(s=>new oo(r,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&tr.children[t]);if(n.length===0){const{type:r}=this.schema.fields[t],i=nn({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ur(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&tthis.getChildAt(c));[s[t],a[t]]=[o,n],[r,i]=HE(r,a)}return new Yh(r,i)}select(t){const n=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){const n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new Yh(n,r)}assign(t){const n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,l,c)=>{const[u,f]=a,h=n.findIndex(d=>d.name===l.name);return~h?f[h]=c:u.push(c),a},[[],[]]),s=this.schema.assign(t.schema),o=[...n.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new Yh(...HE(s,o))}};Pq=Symbol.toStringTag;Vf[Pq]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=yx(B6),e.get=yx(go.getVisitFn(J.Struct)),e.set=Cq(Ba.getVisitFn(J.Struct)),e.indexOf=Nq(vx.getVisitFn(J.Struct)),"Table"))(Vf.prototype);var Uq;let oo=class _y{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Vn))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=nn({nullCount:0,type:new Rs(this.schema.fields),children:this.schema.fields.map(n=>nn({type:n.type,nullCount:0}))})]=t,!(this.data instanceof Jn))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=fO(this.schema,this.data.children);break}case 1:{const[n]=t,{fields:r,children:i,length:s}=Object.keys(n).reduce((l,c,u)=>(l.children[u]=n[c],l.length=Math.max(l.length,n[c].length),l.fields[u]=Tr.new({name:c,type:n[c].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new Vn(r),a=nn({type:new Rs(r),length:s,children:i,nullCount:0});[this.schema,this.data]=fO(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=zq(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return go.visit(this.data,t)}at(t){return this.get(L6(t,this.numRows))}set(t,n){return Ba.visit(this.data,t,n)}indexOf(t,n){return vx.visit(this.data,t,n)}[Symbol.iterator](){return P6.visit(new Ur([this.data]))}toArray(){return[...this]}concat(...t){return new Vf(this.schema,[this,...t])}slice(t,n){const[r]=new Ur([this.data]).slice(t,n).data;return new _y(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&ti.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&ta.name===s);~o&&(i[o]=this.data.children[o])}return new _y(n,nn({type:r,length:this.numRows,children:i}))}selectAt(t){const n=this.schema.selectAt(t),r=t.map(s=>this.data.children[s]).filter(Boolean),i=nn({type:new Rs(n.fields),length:this.numRows,children:r});return new _y(n,i)}};Uq=Symbol.toStringTag;oo[Uq]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(oo.prototype);function fO(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...e.fields],s=[...t],o=(n+63&-64)>>3;for(const[a,l]of e.fields.entries()){const c=t[a];(!c||c.length!==n)&&(i[a]=l.clone({nullable:!0}),s[a]=(r=c?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:nn({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[e.assign(i),nn({type:new Rs(i),length:n,children:s})]}function zq(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let s=-1,o=e.length;++snn({type:i.type})),r=nn({type:new Rs(t.fields),nullCount:0,children:n});super(t,r)}}let hf=class Fl{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new Fl).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+Xn),(n||new Fl).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ai.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Cn.NONE}header(t){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Ai).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,ai.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Cn.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,s,o){return Fl.startMessage(t),Fl.addVersion(t,n),Fl.addHeaderType(t,r),Fl.addHeader(t,i),Fl.addBodyLength(t,s),Fl.addCustomMetadata(t,o),Fl.endMessage(t)}};class i_t extends en{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return nO.startNull(n),nO.endNull(n)}visitInt(t,n){return $o.startInt(n),$o.addBitWidth(n,t.bitWidth),$o.addIsSigned(n,t.isSigned),$o.endInt(n)}visitFloat(t,n){return Xl.startFloatingPoint(n),Xl.addPrecision(n,t.precision),Xl.endFloatingPoint(n)}visitBinary(t,n){return J$.startBinary(n),J$.endBinary(n)}visitLargeBinary(t,n){return Q$.startLargeBinary(n),Q$.endLargeBinary(n)}visitBool(t,n){return Z$.startBool(n),Z$.endBool(n)}visitUtf8(t,n){return rO.startUtf8(n),rO.endUtf8(n)}visitLargeUtf8(t,n){return tO.startLargeUtf8(n),tO.endLargeUtf8(n)}visitDecimal(t,n){return a0.startDecimal(n),a0.addScale(n,t.scale),a0.addPrecision(n,t.precision),a0.addBitWidth(n,t.bitWidth),a0.endDecimal(n)}visitDate(t,n){return iw.startDate(n),iw.addUnit(n,t.unit),iw.endDate(n)}visitTime(t,n){return ya.startTime(n),ya.addUnit(n,t.unit),ya.addBitWidth(n,t.bitWidth),ya.endTime(n)}visitTimestamp(t,n){const r=t.timezone&&n.createString(t.timezone)||void 0;return va.startTimestamp(n),va.addUnit(n,t.unit),r!==void 0&&va.addTimezone(n,r),va.endTimestamp(n)}visitInterval(t,n){return Kl.startInterval(n),Kl.addUnit(n,t.unit),Kl.endInterval(n)}visitDuration(t,n){return sw.startDuration(n),sw.addUnit(n,t.unit),sw.endDuration(n)}visitList(t,n){return eO.startList(n),eO.endList(n)}visitStruct(t,n){return td.startStruct_(n),td.endStruct_(n)}visitUnion(t,n){so.startTypeIdsVector(n,t.typeIds.length);const r=so.createTypeIdsVector(n,t.typeIds);return so.startUnion(n),so.addMode(n,t.mode),so.addTypeIds(n,r),so.endUnion(n)}visitDictionary(t,n){const r=this.visit(t.indices,n);return lu.startDictionaryEncoding(n),lu.addId(n,BigInt(t.id)),lu.addIsOrdered(n,t.isOrdered),r!==void 0&&lu.addIndexType(n,r),lu.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ow.startFixedSizeBinary(n),ow.addByteWidth(n,t.byteWidth),ow.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return aw.startFixedSizeList(n),aw.addListSize(n,t.listSize),aw.endFixedSizeList(n)}visitMap(t,n){return lw.startMap(n),lw.addKeysSorted(n,t.keysSorted),lw.endMap(n)}}const GE=new i_t;function s_t(e,t=new Map){return new Vn(a_t(e,t),fw(e.metadata),t)}function qq(e){return new qo(e.count,jq(e.columns),Vq(e.columns))}function o_t(e){return new yc(qq(e.data),e.id,e.isDelta)}function a_t(e,t){return(e.fields||[]).filter(Boolean).map(n=>Tr.fromJSON(n,t))}function hO(e,t){return(e.children||[]).filter(Boolean).map(n=>Tr.fromJSON(n,t))}function jq(e){return(e||[]).reduce((t,n)=>[...t,new Wf(n.count,l_t(n.VALIDITY)),...jq(n.children)],[])}function Vq(e,t=[]){for(let n=-1,r=(e||[]).length;++nt+ +(n===0),0)}function c_t(e,t){let n,r,i,s,o,a;return!t||!(s=e.dictionary)?(o=pO(e,hO(e,t)),i=new Tr(e.name,o,e.nullable,fw(e.metadata))):t.has(n=s.id)?(r=(r=s.indexType)?dO(r):new mv,a=new cg(t.get(n),r,n,s.isOrdered),i=new Tr(e.name,a,e.nullable,fw(e.metadata))):(r=(r=s.indexType)?dO(r):new mv,t.set(n,o=pO(e,hO(e,t))),a=new cg(o,r,n,s.isOrdered),i=new Tr(e.name,a,e.nullable,fw(e.metadata))),i||null}function fw(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function dO(e){return new Fd(e.isSigned,e.bitWidth)}function pO(e,t){const n=e.type.name;switch(n){case"NONE":return new zf;case"null":return new zf;case"binary":return new Qw;case"largebinary":return new tx;case"utf8":return new ex;case"largeutf8":return new nx;case"bool":return new rx;case"list":return new ux((t||[])[0]);case"struct":return new Rs(t||[]);case"struct_":return new Rs(t||[])}switch(n){case"int":{const r=e.type;return new Fd(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=e.type;return new Zw(fs[r.precision])}case"decimal":{const r=e.type;return new ix(r.scale,r.precision,r.bitWidth)}case"date":{const r=e.type;return new sx(Fa[r.unit])}case"time":{const r=e.type;return new ox(Ee[r.unit],r.bitWidth)}case"timestamp":{const r=e.type;return new ax(Ee[r.unit],r.timezone)}case"interval":{const r=e.type;return new lx(mc[r.unit])}case"duration":{const r=e.type;return new cx(Ee[r.unit])}case"union":{const r=e.type,[i,...s]=(r.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new fx(ps[o],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=e.type;return new hx(r.byteWidth)}case"fixedsizelist":{const r=e.type;return new dx(r.listSize,(t||[])[0])}case"map":{const r=e.type;return new px((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var u_t=oz,f_t=ag;class Cs{static fromJSON(t,n){const r=new Cs(0,ai.V5,n);return r._createHeader=h_t(t,n),r}static decode(t){t=new f_t(mn(t));const n=hf.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),s=n.headerType(),o=new Cs(r,i,s);return o._createHeader=d_t(n,s),o}static encode(t){const n=new u_t;let r=-1;return t.isSchema()?r=Vn.encode(n,t.header()):t.isRecordBatch()?r=qo.encode(n,t.header()):t.isDictionaryBatch()&&(r=yc.encode(n,t.header())),hf.startMessage(n),hf.addVersion(n,ai.V5),hf.addHeader(n,r),hf.addHeaderType(n,t.headerType),hf.addBodyLength(n,BigInt(t.bodyLength)),hf.finishMessageBuffer(n,hf.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof Vn)return new Cs(0,ai.V5,Cn.Schema,t);if(t instanceof qo)return new Cs(n,ai.V5,Cn.RecordBatch,t);if(t instanceof yc)return new Cs(n,ai.V5,Cn.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Cn.Schema}isRecordBatch(){return this.headerType===Cn.RecordBatch}isDictionaryBatch(){return this.headerType===Cn.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=dr(t)}}class qo{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=dr(t)}}class yc{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=dr(n)}}class nc{constructor(t,n){this.offset=dr(t),this.length=dr(n)}}class Wf{constructor(t,n){this.length=dr(t),this.nullCount=dr(n)}}function h_t(e,t){return()=>{switch(t){case Cn.Schema:return Vn.fromJSON(e);case Cn.RecordBatch:return qo.fromJSON(e);case Cn.DictionaryBatch:return yc.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Cn[t]}, type: ${t} }`)}}function d_t(e,t){return()=>{switch(t){case Cn.Schema:return Vn.decode(e.header(new Ul),new Map,e.version());case Cn.RecordBatch:return qo.decode(e.header(new tu),e.version());case Cn.DictionaryBatch:return yc.decode(e.header(new s0),e.version())}throw new Error(`Unrecognized Message type: { name: ${Cn[t]}, type: ${t} }`)}}Tr.encode=A_t;Tr.decode=x_t;Tr.fromJSON=c_t;Vn.encode=S_t;Vn.decode=p_t;Vn.fromJSON=s_t;qo.encode=E_t;qo.decode=g_t;qo.fromJSON=qq;yc.encode=k_t;yc.decode=m_t;yc.fromJSON=o_t;Wf.encode=T_t;Wf.decode=v_t;nc.encode=M_t;nc.decode=y_t;function p_t(e,t=new Map,n=ai.V5){const r=w_t(e,t);return new Vn(r,hw(e),t,n)}function g_t(e,t=ai.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new qo(e.length(),b_t(e),__t(e,t))}function m_t(e,t=ai.V5){return new yc(qo.decode(e.data(),t),e.id(),e.isDelta())}function y_t(e){return new nc(e.offset(),e.length())}function v_t(e){return new Wf(e.length(),e.nullCount())}function b_t(e){const t=[];for(let n,r=-1,i=-1,s=e.nodesLength();++rTr.encode(e,s));Ul.startFieldsVector(e,n.length);const r=Ul.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Ul.createCustomMetadataVector(e,[...t.metadata].map(([s,o])=>{const a=e.createString(`${s}`),l=e.createString(`${o}`);return Ai.startKeyValue(e),Ai.addKey(e,a),Ai.addValue(e,l),Ai.endKeyValue(e)})):-1;return Ul.startSchema(e),Ul.addFields(e,r),Ul.addEndianness(e,I_t?lg.Little:lg.Big),i!==-1&&Ul.addCustomMetadata(e,i),Ul.endSchema(e)}function A_t(e,t){let n=-1,r=-1,i=-1;const s=t.type;let o=t.typeId;re.isDictionary(s)?(o=s.dictionary.typeId,i=GE.visit(s,e),r=GE.visit(s.dictionary,e)):r=GE.visit(s,e);const a=(s.children||[]).map(u=>Tr.encode(e,u)),l=aa.createChildrenVector(e,a),c=t.metadata&&t.metadata.size>0?aa.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{const h=e.createString(`${u}`),d=e.createString(`${f}`);return Ai.startKeyValue(e),Ai.addKey(e,h),Ai.addValue(e,d),Ai.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),aa.startField(e),aa.addType(e,r),aa.addTypeType(e,o),aa.addChildren(e,l),aa.addNullable(e,!!t.nullable),n!==-1&&aa.addName(e,n),i!==-1&&aa.addDictionary(e,i),c!==-1&&aa.addCustomMetadata(e,c),aa.endField(e)}function E_t(e,t){const n=t.nodes||[],r=t.buffers||[];tu.startNodesVector(e,n.length);for(const o of n.slice().reverse())Wf.encode(e,o);const i=e.endVector();tu.startBuffersVector(e,r.length);for(const o of r.slice().reverse())nc.encode(e,o);const s=e.endVector();return tu.startRecordBatch(e),tu.addLength(e,BigInt(t.length)),tu.addNodes(e,i),tu.addBuffers(e,s),tu.endRecordBatch(e)}function k_t(e,t){const n=qo.encode(e,t.data);return s0.startDictionaryBatch(e),s0.addId(e,BigInt(t.id)),s0.addIsDelta(e,t.isDelta),s0.addData(e,n),s0.endDictionaryBatch(e)}function T_t(e,t){return cz.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function M_t(e,t){return lz.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const I_t=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Y6=e=>`Expected ${Cn[e]} Message in stream, but was null or length 0.`,H6=e=>`Header pointer of flatbuffer-encoded ${Cn[e]} Message is null or length 0.`,Wq=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Yq=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class Hq{constructor(t){this.source=t instanceof _x?t:new _x(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?zr:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Y6(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const n=mn(this.source.read(t));if(n.byteLength[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...n(s.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Y6(t));return n.value}readSchema(){const t=Cn.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(H6(t));return r}}const PS=4,k4="ARROW1",vv=new Uint8Array(k4.length);for(let e=0;ethis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return da.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return da.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Ca?t:m4(t)?D_t(t):tz(t)?P_t(t):Dd(t)?Fe(this,void 0,void 0,function*(){return yield Ca.from(yield t)}):ez(t)||I6(t)||nz(t)||Yg(t)?B_t(new ug(t)):F_t(new _x(t))}static readAll(t){return t instanceof Ca?t.isSync()?vO(t):bO(t):m4(t)||ArrayBuffer.isView(t)||p1(t)||QU(t)?vO(t):bO(t)}}class xx extends Ca{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ec(this,arguments,function*(){yield Ye(yield*rw(fd(this[Symbol.iterator]())))})}}class Sx extends Ca{constructor(t){super(t),this._impl=t}readAll(){return Fe(this,void 0,void 0,function*(){var t,n,r,i;const s=new Array;try{for(var o=!0,a=fd(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;const c=i;s.push(c)}}catch(c){n={error:c}}finally{try{!o&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Xq extends xx{constructor(t){super(t),this._impl=t}}class $_t extends Sx{constructor(t){super(t),this._impl=t}}class Kq{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){const r=this._loadVectors(t,n,this.schema.fields),i=nn({type:new Rs(this.schema.fields),length:t.length,children:r});return new oo(this.schema,i)}_loadDictionaryBatch(t,n){const{id:r,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(r),l=o.dictionaries.get(r),c=this._loadVectors(t.data,n,[l]);return(a&&i?a.concat(new Ur(c)):new Ur(c)).memoize()}_loadVectors(t,n,r){return new Bq(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class Ax extends Kq{constructor(t,n){super(n),this._reader=m4(t)?new C_t(this._handle=t):new Hq(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Zq(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):zr}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):zr}next(){if(this.closed)return zr;let t;const{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new W6(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Ex extends Kq{constructor(t,n){super(n),this._reader=new R_t(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Fe(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Fe(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Zq(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Fe(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):zr})}return(t){return Fe(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):zr})}next(){return Fe(this,void 0,void 0,function*(){if(this.closed)return zr;let t;const{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=yield n.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new W6(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Fe(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Jq extends Ax{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof uO?t:new uO(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(Cn.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(Cn.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,n=t.size-Gq,r=t.readInt32(n),i=t.readAt(n-r,r);return yv.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return Fe(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){return Fe(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(Cn.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return Fe(this,void 0,void 0,function*(){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(Cn.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return Fe(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const n=t.size-Gq,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return yv.decode(i)})}_readNextMessageAndValidate(t){return Fe(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?G6(t)?new Xq(new Jq(e.read())):new xx(new Ax(e)):new xx(new Ax(function*(){}()))}function B_t(e){return Fe(this,void 0,void 0,function*(){const t=yield e.peek(v1+7&-8);return t&&t.byteLength>=4?G6(t)?new Xq(new Jq(yield e.read())):new Sx(new Ex(e)):new Sx(new Ex(function(){return ec(this,arguments,function*(){})}()))})}function P_t(e){return Fe(this,void 0,void 0,function*(){const{size:t}=yield e.stat(),n=new wx(e,t);return t>=N_t&&G6(yield n.readAt(0,v1+7&-8))?new $_t(new O_t(n)):new Sx(new Ex(n))})}class jr extends en{static assemble(...t){const n=i=>i.flatMap(s=>Array.isArray(s)?n(s):s instanceof oo?s.data.children:s.data),r=new jr;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Ur)return this.visitMany(t.data),this;const{type:n}=t;if(!re.isDictionary(n)){const{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(re.isUnion(n))this.nodes.push(new Wf(r,0));else{const{nullCount:i}=t;re.isNull(n)||cl.call(this,i<=0?new Uint8Array(0):gx(t.offset,r,t.nullBitmap)),this.nodes.push(new Wf(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function cl(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new nc(this._byteLength,t)),this._byteLength+=t,this}function U_t(e){var t;const{type:n,length:r,typeIds:i,valueOffsets:s}=e;if(cl.call(this,i),n.mode===ps.Sparse)return T4.call(this,e);if(n.mode===ps.Dense){if(e.offset<=0)return cl.call(this,s),T4.call(this,e);{const o=new Int32Array(r),a=Object.create(null),l=Object.create(null);for(let c,u,f=-1;++f{const f=n.typeIds[u],h=a[f],d=l[f];return c.slice(h,Math.min(r,d))}))}}return this}function z_t(e){let t;return e.nullCount>=e.length?cl.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?cl.call(this,gx(e.offset,e.length,t)):cl.call(this,mx(e.values))}function Uu(e){return cl.call(this,e.values.subarray(0,e.length*e.stride))}function US(e){const{length:t,values:n,valueOffsets:r}=e,i=dr(r[0]),s=dr(r[t]),o=Math.min(s-i,n.byteLength-i);return cl.call(this,iz(-i,t+1,r)),cl.call(this,n.subarray(i,i+o)),this}function X6(e){const{length:t,valueOffsets:n}=e;if(n){const{[0]:r,[t]:i}=n;return cl.call(this,iz(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function T4(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}jr.prototype.visitBool=z_t;jr.prototype.visitInt=Uu;jr.prototype.visitFloat=Uu;jr.prototype.visitUtf8=US;jr.prototype.visitLargeUtf8=US;jr.prototype.visitBinary=US;jr.prototype.visitLargeBinary=US;jr.prototype.visitFixedSizeBinary=Uu;jr.prototype.visitDate=Uu;jr.prototype.visitTimestamp=Uu;jr.prototype.visitTime=Uu;jr.prototype.visitDecimal=Uu;jr.prototype.visitList=X6;jr.prototype.visitStruct=T4;jr.prototype.visitUnion=U_t;jr.prototype.visitInterval=Uu;jr.prototype.visitDuration=Uu;jr.prototype.visitFixedSizeList=X6;jr.prototype.visitMap=X6;class Qq extends U6{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new uw,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,po(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Dd(t)?t.then(n=>this.writeAll(n)):Yg(t)?Q6(this,t):Z6(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof uw?this._sink=t:(this._sink=new uw,t&&v1t(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&b1t(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!E4(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Vf&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof oo&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!E4(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof oo?t instanceof W6||this._writeRecordBatch(t):t instanceof Vf?this.writeAll(t.batches):p1(t)&&this.writeAll(t)}_writeMessage(t,n=8){const r=n-1,i=Cs.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+r&~r,l=a-s-o;return t.headerType===Cn.RecordBatch?this._recordBatchBlocks.push(new qf(a,t.bodyLength,this._position)):t.headerType===Cn.DictionaryBatch&&this._dictionaryBlocks.push(new qf(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const n=mn(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Cs.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(vv)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:n,nodes:r,bufferRegions:i,buffers:s}=jr.assemble(t),o=new qo(t.numRows,r,i),a=Cs.from(o,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,n,r=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=jr.assemble(new Ur([t])),l=new qo(t.length,s,o),c=new yc(l,n,r),u=Cs.from(c,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let s=-1,o=t.length;++s0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){var n,r;for(const[i,s]of t.dictionaries){const o=(n=s?.data)!==null&&n!==void 0?n:[],a=this._seenDictionaries.get(i),l=(r=this._dictionaryDeltaOffsets.get(i))!==null&&r!==void 0?r:0;if(!a||a.data[0]!==o[0])for(const[c,u]of o.entries())this._writeDictionaryBatch(u,i,c>0);else if(lr.writeAll(i)):Yg(t)?Q6(r,t):Z6(r,t)}}class J6 extends Qq{static writeAll(t){const n=new J6;return Dd(t)?t.then(r=>n.writeAll(r)):Yg(t)?Q6(n,t):Z6(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,n,r=!1){if(!r&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,n,r)}_writeFooter(t){const n=yv.encode(new yv(t,ai.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function Z6(e,t){let n=t;t instanceof Vf&&(n=t.batches,e.reset(void 0,t.schema));for(const r of n)e.write(r);return e.finish()}function Q6(e,t){return Fe(this,void 0,void 0,function*(){var n,r,i,s,o,a,l;try{for(n=!0,r=fd(t);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const c=l;e.write(c)}}catch(c){o={error:c}}finally{try{!n&&!s&&(a=r.return)&&(yield a.call(r))}finally{if(o)throw o.error}}return e.finish()})}function q_t(e,t="stream"){return(t==="stream"?K6:J6).writeAll(e).toUint8Array(!0)}var j_t=Object.create,tj=Object.defineProperty,V_t=Object.getOwnPropertyDescriptor,W_t=Object.getOwnPropertyNames,Y_t=Object.getPrototypeOf,H_t=Object.prototype.hasOwnProperty,G_t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),X_t=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of W_t(t))!H_t.call(e,i)&&i!==n&&tj(e,i,{get:()=>t[i],enumerable:!(r=V_t(t,i))||r.enumerable});return e},K_t=(e,t,n)=>(n=e!=null?j_t(Y_t(e)):{},X_t(!e||!e.__esModule?tj(n,"default",{value:e,enumerable:!0}):n,e)),J_t=G_t((e,t)=>{t.exports=Worker}),Z_t=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Z_t||{}),Q_t=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(Q_t||{}),twt=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(twt||{}),ewt=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(ewt||{}),nwt=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(nwt||{}),rwt=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(rwt||{}),ej=class{log(t){}},nj=class{constructor(t=2){this.level=t}log(t){t.level>=this.level&&console.log(t)}},iwt=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(iwt||{}),swt=class{constructor(t,n){this._bindings=t,this._conn=n}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}async query(t){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:t});let n=await this._bindings.runQuery(this._conn,t),r=Ca.from(n);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Vf(r)}async send(t){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:t});let n=await this._bindings.startPendingQuery(this._conn,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new rj(this._bindings,this._conn,n),i=await Ca.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(t){return await this._bindings.getTableNames(this._conn,t)}async prepare(t){let n=await this._bindings.createPrepared(this._conn,t);return new owt(this._bindings,this._conn,n)}async insertArrowTable(t,n){let r=q_t(t,"stream");await this.insertArrowFromIPCStream(r,n)}async insertArrowFromIPCStream(t,n){await this._bindings.insertArrowFromIPCStream(this._conn,t,n)}async insertCSVFromPath(t,n){await this._bindings.insertCSVFromPath(this._conn,t,n)}async insertJSONFromPath(t,n){await this._bindings.insertJSONFromPath(this._conn,t,n)}},rj=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},owt=class{constructor(t,n,r){this.bindings=t,this.connectionId=n,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...t){let n=await this.bindings.runPrepared(this.connectionId,this.statementId,t),r=Ca.from(n);return console.assert(r.isSync()),console.assert(r.isFile()),new Vf(r)}async send(...t){let n=await this.bindings.sendPrepared(this.connectionId,this.statementId,t),r=new rj(this.bindings,this.connectionId,n),i=await Ca.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}},awt=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(awt||{}),lwt=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(lwt||{}),En=class{constructor(t,n){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=t,this.data=n,this.promise=new Promise((r,i)=>{this.promiseResolver=r,this.promiseRejecter=i})}};function dw(e){switch(e.typeId){case J.Binary:return{sqlType:"binary"};case J.Bool:return{sqlType:"bool"};case J.Date:return{sqlType:"date"};case J.DateDay:return{sqlType:"date32[d]"};case J.DateMillisecond:return{sqlType:"date64[ms]"};case J.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case J.Float:return{sqlType:"float"};case J.Float16:return{sqlType:"float16"};case J.Float32:return{sqlType:"float32"};case J.Float64:return{sqlType:"float64"};case J.Int:return{sqlType:"int32"};case J.Int16:return{sqlType:"int16"};case J.Int32:return{sqlType:"int32"};case J.Int64:return{sqlType:"int64"};case J.Uint16:return{sqlType:"uint16"};case J.Uint32:return{sqlType:"uint32"};case J.Uint64:return{sqlType:"uint64"};case J.Uint8:return{sqlType:"uint8"};case J.IntervalDayTime:return{sqlType:"interval[dt]"};case J.IntervalYearMonth:return{sqlType:"interval[m]"};case J.List:return{sqlType:"list",valueType:dw(e.valueType)};case J.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case J.Null:return{sqlType:"null"};case J.Utf8:return{sqlType:"utf8"};case J.Struct:return{sqlType:"struct",fields:e.children.map(t=>M4(t.name,t.type))};case J.Map:{let t=e;return{sqlType:"map",keyType:dw(t.keyType),valueType:dw(t.valueType)}}case J.Time:return{sqlType:"time[s]"};case J.TimeMicrosecond:return{sqlType:"time[us]"};case J.TimeMillisecond:return{sqlType:"time[ms]"};case J.TimeNanosecond:return{sqlType:"time[ns]"};case J.TimeSecond:return{sqlType:"time[s]"};case J.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case J.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case J.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case J.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case J.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function M4(e,t){let n=dw(t);return n.name=e,n}var cwt=new TextEncoder,ij=class{constructor(t,n=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=t,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),n!=null&&this.attach(n)}get logger(){return this._logger}attach(t){this._worker=t,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((n,r)=>{this._workerShutdownResolver=n})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(t,n=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,t),this._worker.postMessage({messageId:r,type:t.type,data:t.data},n),await t.promise}onMessage(t){var n;let r=t.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let s of this._onInstantiationProgress)s(r.data);return}}let i=this._pendingRequests.get(r.requestId);if(!i){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let s=new Error(r.data.message);s.name=r.data.name,(n=Object.getOwnPropertyDescriptor(s,"stack"))!=null&&n.writable&&(s.stack=r.data.stack),i.promiseRejecter(s);return}switch(i.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){i.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){i.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){i.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){i.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){i.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){i.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){i.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){i.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){i.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){i.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){i.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){i.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){i.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){i.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){i.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){i.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){i.promiseResolver(r.data);return}break}i.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(t){console.error(t),console.error("error in duckdb worker: ".concat(t.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let t=new En("RESET",null);return await this.postTask(t)}async ping(){let t=new En("PING",null);await this.postTask(t)}async dropFile(t){let n=new En("DROP_FILE",t);return await this.postTask(n)}async dropFiles(){let t=new En("DROP_FILES",null);return await this.postTask(t)}async flushFiles(){let t=new En("FLUSH_FILES",null);return await this.postTask(t)}async instantiate(t,n=null,r=i=>{}){this._onInstantiationProgress.push(r);let i=new En("INSTANTIATE",[t,n]);return await this.postTask(i)}async getVersion(){let t=new En("GET_VERSION",null);return await this.postTask(t)}async getFeatureFlags(){let t=new En("GET_FEATURE_FLAGS",null);return await this.postTask(t)}async open(t){let n=new En("OPEN",t);await this.postTask(n)}async tokenize(t){let n=new En("TOKENIZE",t);return await this.postTask(n)}async connectInternal(){let t=new En("CONNECT",null);return await this.postTask(t)}async connect(){let t=await this.connectInternal();return new swt(this,t)}async disconnect(t){let n=new En("DISCONNECT",t);await this.postTask(n)}async runQuery(t,n){let r=new En("RUN_QUERY",[t,n]);return await this.postTask(r)}async startPendingQuery(t,n){let r=new En("START_PENDING_QUERY",[t,n]);return await this.postTask(r)}async pollPendingQuery(t){let n=new En("POLL_PENDING_QUERY",t);return await this.postTask(n)}async cancelPendingQuery(t){let n=new En("CANCEL_PENDING_QUERY",t);return await this.postTask(n)}async fetchQueryResults(t){let n=new En("FETCH_QUERY_RESULTS",t);return await this.postTask(n)}async getTableNames(t,n){let r=new En("GET_TABLE_NAMES",[t,n]);return await this.postTask(r)}async createPrepared(t,n){let r=new En("CREATE_PREPARED",[t,n]);return await this.postTask(r)}async closePrepared(t,n){let r=new En("CLOSE_PREPARED",[t,n]);await this.postTask(r)}async runPrepared(t,n,r){let i=new En("RUN_PREPARED",[t,n,r]);return await this.postTask(i)}async sendPrepared(t,n,r){let i=new En("SEND_PREPARED",[t,n,r]);return await this.postTask(i)}async globFiles(t){let n=new En("GLOB_FILE_INFOS",t);return await this.postTask(n)}async registerFileText(t,n){let r=cwt.encode(n);await this.registerFileBuffer(t,r)}async registerFileURL(t,n,r,i){n===void 0&&(n=t);let s=new En("REGISTER_FILE_URL",[t,n,r,i]);await this.postTask(s)}async registerEmptyFileBuffer(t){}async registerFileBuffer(t,n){let r=new En("REGISTER_FILE_BUFFER",[t,n]);await this.postTask(r,[n.buffer])}async registerFileHandle(t,n,r,i){let s=new En("REGISTER_FILE_HANDLE",[t,n,r,i]);await this.postTask(s,[])}async collectFileStatistics(t,n){let r=new En("COLLECT_FILE_STATISTICS",[t,n]);await this.postTask(r,[])}async exportFileStatistics(t){let n=new En("EXPORT_FILE_STATISTICS",t);return await this.postTask(n,[])}async copyFileToBuffer(t){let n=new En("COPY_FILE_TO_BUFFER",t);return await this.postTask(n)}async copyFileToPath(t,n){let r=new En("COPY_FILE_TO_PATH",[t,n]);await this.postTask(r)}async insertArrowFromIPCStream(t,n,r){if(n.length==0)return;let i=new En("INSERT_ARROW_FROM_IPC_STREAM",[t,n,r]);await this.postTask(i,[n.buffer])}async insertCSVFromPath(t,n,r){if(r.columns!==void 0){let s=[];for(let o in r.columns){let a=r.columns[o];s.push(M4(o,a))}r.columnsFlat=s,delete r.columns}let i=new En("IMPORT_CSV_FROM_PATH",[t,n,r]);await this.postTask(i)}async insertJSONFromPath(t,n,r){if(r.columns!==void 0){let s=[];for(let o in r.columns){let a=r.columns[o];s.push(M4(o,a))}r.columnsFlat=s,delete r.columns}let i=new En("IMPORT_JSON_FROM_PATH",[t,n,r]);await this.postTask(i)}},uwt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),fwt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),hwt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),dwt=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),tI={name:"@duckdb/duckdb-wasm",version:"1.29.0"},pwt=tI.name,gwt=tI.version,eI=tI.version.split(".");eI[0];eI[1];eI[2];var mwt=()=>typeof navigator>"u";function ywt(){let e="https://cdn.jsdelivr.net/npm/".concat(pwt,"@").concat(gwt,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var XE=null,KE=null,JE=null,ZE=null,QE=null;async function vwt(){return XE==null&&(XE=typeof BigInt64Array<"u"),KE==null&&(KE=await fwt()),JE==null&&(JE=await dwt()),ZE==null&&(ZE=await hwt()),QE==null&&(QE=await uwt()),{bigInt64Array:XE,crossOriginIsolated:mwt()||globalThis.crossOriginIsolated||!1,wasmExceptions:KE,wasmSIMD:ZE,wasmThreads:JE,wasmBulkMemory:QE}}async function sj(e){let t=await vwt();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}K_t(J_t());function bwt(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}bwt();var _wt=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(_wt||{});function wwt(e={}){return new xwt(e)}class xwt{_ipc;_options;_db;_con;_loadPromise;constructor(t={}){const{ipc:n,duckdb:r,connection:i,...s}=t;this._ipc=n,this._options=s,this._db=r,this._con=i}async getDuckDB(){return this._db||await _O(this),this._db}async getConnection(){return this._con||await _O(this),this._con}async query(t){const{type:n,sql:r}=t,i=await this.getConnection(),s=await Swt(i,r);return n==="exec"?void 0:n==="arrow"?Vw(s,this._ipc):Vw(s).toArray()}}function Swt(e,t){return new Promise((n,r)=>{e.useUnsafe(async(i,s)=>{try{const o=await i.runQuery(s,t);n(o)}catch(o){r(o)}})})}function _O(e){return e._loadPromise||(e._loadPromise=(e._db?Promise.resolve(e._db):Awt(e._options).then(t=>e._db=t)).then(t=>t.connect()).then(t=>e._con=t)),e._loadPromise}async function Awt({log:e=!1}={}){const t=ywt(),n=await sj(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),s=e?new nj:new ej,o=new ij(s,i);return await o.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),o}function kx(e,t,{source:n,clients:r=mS(n)?new Set([n]):void 0}){const i=t!==void 0?Od(e,[Zt(t)]):null;return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function zS(e,t,{source:n,clients:r=mS(n)?new Set([n]):void 0}){let i=null;if(t){const s=t.length&&e.length===1?[Od(e[0],t.map(o=>Zt(o[0])))]:t.map(o=>Di(o.map((a,l)=>x6(e[l],Zt(a)))));i=t.length===0?Zt(!1):s.length>1?Ns(s):s[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function nI(e,t,{source:n,clients:r=mS(n)?new Set([n]):void 0,bin:i,scale:s,pixelSize:o=1}){const a=t!=null?$s(e,t):null;return{meta:{type:"interval",scales:s&&[s],bin:i,pixelSize:o},source:n,clients:r,value:t,predicate:a}}function Ewt(e,t,{source:n,clients:r=mS(n)?new Set([n]):void 0,bin:i,scales:s=[],pixelSize:o=1}){const a=t!=null?Di(e.map((c,u)=>$s(c,t[u]))):null;return{meta:{type:"interval",scales:s,bin:i,pixelSize:o},source:n,clients:r,value:t,predicate:a}}const kwt={contains:Cyt,prefix:Nyt,suffix:$yt,regexp:Ryt};function Twt(e,t,{source:n,clients:r=void 0,method:i="contains"}){const s=kwt[i],o=t?s(e,Zt(t)):null;return{meta:{type:"match",method:i},source:n,clients:r,value:t,predicate:o}}function Mwt(e){return typeof e?.getChild=="function"}class Iwt{_set;_done;_promise;constructor(){this._set=new Set,this._done=()=>{},this._promise=new Promise(t=>this._done=t)}pending(t){this._set.add(t)}ready(t){return this._set.delete(t),this._set.size===0}resolve(){this._promise=new Promise(t=>{this._done(),this._done=t})}get promise(){return this._promise}}function Bd(e){if(Mwt(e))return Rwt(e);if(Array.isArray(e))return Cwt(e);throw new Error("Unrecognized data format.")}function Rwt(e){const{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function Cwt(e){const t=e.length;if(typeof e[0]=="object"){const n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(s=>s[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}function oj(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("ENUM"))return"string";if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}const Nwt="count",$wt="nulls",Owt="max",Lwt="min",Dwt="distinct",Fwt={[Nwt]:ar,[Dwt]:e=>ar(e).distinct(),[Owt]:Da,[Lwt]:gl,[$wt]:e=>ar().where(ll(e))};function Bwt({table:e,column:t,stats:n}){return zt.from(e).select(Array.from(n,r=>({[r]:Fwt[r](t)})))}async function rI(e,t){return t.length===1&&t[0].column==="*"?Uwt(e,t[0].table):(await Promise.all(t.map(n=>Pwt(e,n)))).filter(n=>n!==void 0)}async function Pwt(e,{table:t,column:n,stats:r}){const i=zt.from({source:t}).select({column:n}).groupby(dc(n)&&uh(n)?ee`ALL`:[]),[s]=Array.from(await e.query(zt.describe(i))),o={table:t,column:`${n}`,sqlType:s.column_type,type:oj(s.column_type),nullable:s.null==="YES"};if(!r?.length)return o;const[a]=await e.query(Bwt({table:t,column:n,stats:r}),{persist:!0});return Object.assign(o,a)}async function Uwt(e,t){return Array.from(await e.query(`DESCRIBE ${_U(t)}`)).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:oj(r.column_type),nullable:r.null==="YES"}))}var zwt=(e,t)=>{t.onClick?.()},qwt=At(" "),jwt=At("");function wa(e,t){ye(t,!0);let n=se(t,"label",3,null),r=se(t,"icon",3,null),i=se(t,"title",3,""),s=se(t,"order",3,null),o=se(t,"style",3,"default");const a={default:"bg-white dark:bg-slate-800 border-slate-300 dark:border-slate-600 dark:text-slate-400 focus-visible:outline-2 outline-blue-600 -outline-offset-1",plotCell:"bg-white text-slate-400 border-slate-300 hover:text-slate-500 hover:border-slate-500 dark:text-slate-500 dark:border-slate-500 dark:bg-slate-800 dark:hover:border-slate-300 dark:hover:text-slate-300",plotCellClose:"bg-white text-red-500 border-red-500 hover:text-white hover:bg-red-500 dark:bg-slate-800"};var l=jwt();l.__click=[zwt,t];let c;var u=ot(l);{var f=g=>{var y=wn();const v=dt(r);var b=Yt(y);ov(b,()=>x(v),(_,w)=>{w(_,{class:"w-5 h-5"})}),rt(g,y)};Lt(u,g=>{r()!=null&&g(f)})}var h=yt(u,2);{var d=g=>{var y=qwt();let v;var b=ot(y,!0);tt(y),Ft(_=>{v=lr(y,1,"",null,v,_),ue(b,n())},[()=>({"ml-1":r()!=null})]),rt(g,y)};Lt(h,g=>{n()!=null&&n()!=""&&g(d)})}tt(l),Ft(g=>{lr(l,1,`rounded-md px-1.5 py-1.5 h-[28px] flex select-none items-center border ${a[o()]??""} ${t.class??""??""}`),ct(l,"title",i()),c=Ce(l,"",c,g)},[()=>({order:s()})]),rt(e,l),ve()}Dr(["click"]);var Vwt=(e,t,n)=>t(n),Wwt=At(''),Ywt=At('
    '),Hwt=At('
    ');function wO(e,t){ye(t,!0);let n=se(t,"value",3,""),r=se(t,"options",19,()=>[]),i,s,o=xt(!1),a=dt(()=>n()!=null&&r()!=null?r().filter(g=>g.toLowerCase().includes(n().toLowerCase())):r()??[]);function l(g){t.onChange?.(g)}function c(g){l(g),G(o,!1)}var u=Hwt(),f=ot(u);cP(f),f.__change=()=>l(i.value??""),f.__input=()=>l(i.value??""),ho(f,g=>i=g,()=>i);var h=yt(f,2);{var d=g=>{var y=Ywt();_n(y,20,()=>x(a),v=>v,(v,b)=>{var _=Wwt();_.__click=[Vwt,c,b];var w=ot(_,!0);tt(_),Ft(()=>ue(w,b)),rt(v,_)}),tt(y),rt(g,y)};Lt(h,g=>{x(o)&&x(a).length>0&&g(d)})}tt(u),ho(u,g=>s=g,()=>s),Ft(()=>{lr(u,1,`relative ${t.className??""??""}`),ct(f,"placeholder",t.placeholder),zpt(f,n())}),I0("focus",f,()=>G(o,!0)),I0("blur",f,g=>{g.relatedTarget&&g.relatedTarget instanceof Node&&s.contains(g.relatedTarget)||G(o,!1)}),rt(e,u),ve()}Dr(["change","input","click"]);const Gwt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let iI=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Gwt[n[e]&63];return t};function xO(e,t,n,r){!t()||!x(n)||t()(r(x(n).value))}var Xwt=At(""),Kwt=At("
    "),Jwt=At(""),Zwt=At(''),Qwt=At(""),txt=At("
    "),ext=At(""),nxt=At("");function xa(e,t){ye(t,!0);let n=se(t,"label",3,void 0),r=se(t,"disabled",3,!1),i=se(t,"placeholder",3,null),s=se(t,"options",19,()=>[]),o=se(t,"onChange",3,void 0),a=xt(void 0);const l=iI(),c=l+"_null",u=l+"_undefined",f=b=>b===null?c:b===void 0?u:b.toString(),h=b=>b===c?null:b===u?void 0:b;var d=wn(),g=Yt(d);{var y=b=>{var _=Zwt(),w=ot(_),S=ot(w,!0);tt(w);var k=yt(w,2);k.__change=[xO,o,a,h];var A=ot(k);{var T=C=>{var N=Xwt(),L=ot(N,!0);tt(N),N.value=(N.__value=null)??"",Ft(()=>ue(L,i())),rt(C,N)};Lt(A,C=>{i()!=null&&C(T)})}var M=yt(A);_n(M,17,s,Bn,(C,N)=>{var L=wn(),F=Yt(L);{var $=O=>{var B=Kwt();rt(O,B)},D=O=>{var B=Jwt(),V=ot(B,!0);tt(B);var U={};Ft(z=>{ue(V,x(N).label),U!==(U=z)&&(B.value=(B.__value=z)??"")},[()=>f(x(N).value)]),rt(O,B)};Lt(F,O=>{x(N)==="---"?O($):O(D,!1)})}rt(C,L)}),tt(k),ho(k,C=>G(a,C),()=>x(a));var I;Pw(k),tt(_),Ft(C=>{ue(S,n()),lr(k,1,`form-select rounded-md py-1 bg-white dark:bg-slate-900 border border-slate-300 dark:border-slate-600 dark:text-slate-400 text-ellipsis ${t.class??""??""}`),k.disabled=r(),I!==(I=C)&&(k.value=(k.__value=C)??"",ng(k,C))},[()=>f(t.value)]),rt(b,_)},v=b=>{var _=nxt();_.__change=[xO,o,a,h];var w=ot(_);{var S=T=>{var M=Qwt(),I=ot(M,!0);tt(M),M.value=(M.__value=null)??"",Ft(()=>ue(I,i())),rt(T,M)};Lt(w,T=>{i()!=null&&T(S)})}var k=yt(w);_n(k,17,s,Bn,(T,M)=>{var I=wn(),C=Yt(I);{var N=F=>{var $=txt();rt(F,$)},L=F=>{var $=ext(),D=ot($,!0);tt($);var O={};Ft(B=>{ue(D,x(M).label),O!==(O=B)&&($.value=($.__value=B)??"")},[()=>f(x(M).value)]),rt(F,$)};Lt(C,F=>{x(M)==="---"?F(N):F(L,!1)})}rt(T,I)}),tt(_),ho(_,T=>G(a,T),()=>x(a));var A;Pw(_),Ft(T=>{lr(_,1,`form-select rounded-md py-1 bg-white dark:bg-slate-900 border border-slate-300 dark:border-slate-600 dark:text-slate-400 select-none text-ellipsis ${t.class??""??""}`),_.disabled=r(),A!==(A=T)&&(_.value=(_.__value=T)??"",ng(_,T))},[()=>f(t.value)]),rt(b,_)};Lt(g,b=>{n()!=null?b(y):b(v,!1)})}rt(e,d),ve()}Dr(["change"]);function rxt(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Tx(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function hg(e){return e=Tx(Math.abs(e)),e?e[1]:NaN}function ixt(e,t){return function(n,r){for(var i=n.length,s=[],o=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[o=(o+1)%e.length];return s.reverse().join(t)}}function sxt(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var oxt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bv(e){if(!(t=oxt.exec(e)))throw new Error("invalid format: "+e);var t;return new sI({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]})}bv.prototype=sI.prototype;function sI(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+""}sI.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 axt(e){t: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 aj;function lxt(e,t){var n=Tx(e,t);if(!n)return e+"";var r=n[0],i=n[1],s=i-(aj=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")+Tx(e,Math.max(0,t+s-1))[0]}function SO(e,t){var n=Tx(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 AO={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:rxt,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)=>SO(e*100,t),r:SO,s:lxt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function EO(e){return e}var kO=Array.prototype.map,TO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cxt(e){var t=e.grouping===void 0||e.thousands===void 0?EO:ixt(kO.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?EO:sxt(kO.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function c(f){f=bv(f);var h=f.fill,d=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,_=f.comma,w=f.precision,S=f.trim,k=f.type;k==="n"?(_=!0,k="g"):AO[k]||(w===void 0&&(w=12),S=!0,k="g"),(v||h==="0"&&d==="=")&&(v=!0,h="0",d="=");var A=y==="$"?n:y==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():"",T=y==="$"?r:/[%p]/.test(k)?o:"",M=AO[k],I=/[defgprs%]/.test(k);w=w===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function C(N){var L=A,F=T,$,D,O;if(k==="c")F=M(N)+F,N="";else{N=+N;var B=N<0||1/N<0;if(N=isNaN(N)?l:M(Math.abs(N),w),S&&(N=axt(N)),B&&+N==0&&g!=="+"&&(B=!1),L=(B?g==="("?g:a:g==="-"||g==="("?"":g)+L,F=(k==="s"?TO[8+aj/3]:"")+F+(B&&g==="("?")":""),I){for($=-1,D=N.length;++$O||O>57){F=(O===46?i+N.slice($+1):N.slice($))+F,N=N.slice(0,$);break}}}_&&!v&&(N=t(N,1/0));var V=L.length+N.length+F.length,U=V>1)+L+N+F+U.slice(V);break;default:N=U+L+N+F;break}return s(N)}return C.toString=function(){return f+""},C}function u(f,h){var d=c((f=bv(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(hg(h)/3)))*3,y=Math.pow(10,-g),v=TO[8+g/3];return function(b){return d(y*b)+v}}return{format:c,formatPrefix:u}}var c_,Wa,lj;uxt({thousands:",",grouping:[3],currency:["$",""]});function uxt(e){return c_=cxt(e),Wa=c_.format,lj=c_.formatPrefix,c_}function fxt(e){return Math.max(0,-hg(Math.abs(e)))}function hxt(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(hg(t)/3)))*3-hg(Math.abs(e)))}function dxt(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,hg(t)-hg(e))+1}function Hn(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Pd(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function qS(e){let t,n,r;e.length!==2?(t=Hn,n=(a,l)=>Hn(e(a),l),r=(a,l)=>e(a)-l):(t=e===Hn||e===Pd?e:pxt,n=e,r=e);function i(a,l,c=0,u=a.length){if(c>>1;n(a[f],l)<0?c=f+1:u=f}while(c>>1;n(a[f],l)<=0?c=f+1:u=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function pxt(){return 0}function cj(e){return e===null?NaN:+e}function*gxt(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 mxt=qS(Hn),jS=mxt.right;qS(cj).center;const uj=fj(hj),yxt=fj(vxt);function fj(e){return function(t,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:s,height:o}=t;if(!((s=Math.floor(s))>=0))throw new RangeError("invalid width");if(!((o=Math.floor(o!==void 0?o:i.length/s))>=0))throw new RangeError("invalid height");if(!s||!o||!n&&!r)return t;const a=n&&e(n),l=r&&e(r),c=i.slice();return a&&l?(Vp(a,c,i,s,o),Vp(a,i,c,s,o),Vp(a,c,i,s,o),Wp(l,i,c,s,o),Wp(l,c,i,s,o),Wp(l,i,c,s,o)):a?(Vp(a,i,c,s,o),Vp(a,c,i,s,o),Vp(a,i,c,s,o)):l&&(Wp(l,i,c,s,o),Wp(l,c,i,s,o),Wp(l,i,c,s,o)),t}}function Vp(e,t,n,r,i){for(let s=0,o=r*i;s{i<<=2,s<<=2,o<<=2,t(n,r,i+0,s+0,o),t(n,r,i+1,s+1,o),t(n,r,i+2,s+2,o),t(n,r,i+3,s+3,o)}}function hj(e){const t=Math.floor(e);if(t===e)return bxt(e);const n=e-t,r=2*e+1;return(i,s,o,a,l)=>{if(!((a-=l)>=o))return;let c=t*s[o];const u=l*t,f=u+l;for(let h=o,d=o+u;h{if(!((s-=o)>=i))return;let a=e*r[i];const l=o*e;for(let c=i,u=i+l;c=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function _xt(e){return e.length|0}function wxt(e){return!(e>0)}function xxt(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Sxt(e){return t=>e(...t)}function Axt(...e){const t=typeof e[e.length-1]=="function"&&Sxt(e.pop());e=e.map(xxt);const n=e.map(_xt),r=e.length-1,i=new Array(r+1).fill(0),s=[];if(r<0||n.some(wxt))return s;for(;;){s.push(i.map((a,l)=>e[l][a]));let o=r;for(;++i[o]===n[o];){if(o===0)return t?s.map(t):s;i[o--]=0}}}function Ext(e,t){var n=0;return Float64Array.from(e,r=>n+=+r||0)}function oI(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 b1(e,t){const n=oI(e,t);return n&&Math.sqrt(n)}function yi(e,t){let n,r;if(t===void 0)for(const i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=s&&(n=r=s):(n>s&&(n=s),r0){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 Ud extends Map{constructor(t,n=gj){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(I4(this,t))}has(t){return super.has(I4(this,t))}set(t,n){return super.set(dj(this,t),n)}delete(t){return super.delete(pj(this,t))}}class Gg extends Set{constructor(t,n=gj){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(I4(this,t))}add(t){return super.add(dj(this,t))}delete(t){return super.delete(pj(this,t))}}function I4({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function dj({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function pj({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function gj(e){return e!==null&&typeof e=="object"?e.valueOf():e}function R4(e){return e}function hh(e,...t){return aI(e,R4,R4,t)}function D0(e,t,...n){return aI(e,R4,t,n)}function kxt(e,t,...n){return aI(e,Array.from,t,n)}function aI(e,t,n,r){return function i(s,o){if(o>=r.length)return n(s);const a=new Ud,l=r[o++];let c=-1;for(const u of s){const f=l(u,++c,s),h=a.get(f);h?h.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,i(f,o));return t(a)}(e,0)}function Txt(e,t){return Array.from(t,n=>e[n])}function Mx(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){const r=Uint32Array.from(e,(i,s)=>s);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,s)=>{for(const o of t){const a=_v(o[i],o[s]);if(a)return a}})):(n=e.map(n),r.sort((i,s)=>_v(n[i],n[s]))),Txt(e,r)}return e.sort(lI(n))}function lI(e=Hn){if(e===Hn)return _v;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 _v(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function cI(e,t,n){return(t.length!==2?Mx(D0(e,t,n),([r,i],[s,o])=>Hn(i,o)||Hn(r,s)):Mx(hh(e,n),([r,i],[s,o])=>t(i,o)||Hn(r,s))).map(([r])=>r)}const Mxt=Math.sqrt(50),Ixt=Math.sqrt(10),Rxt=Math.sqrt(2);function Ix(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>=Mxt?10:s>=Ixt?5:s>=Rxt?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(e*c),l=Math.round(t*c),a/ct&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(e/c),l=Math.round(t/c),a*ct&&--l),l0))return[];if(e===t)return[e];const r=t=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function uI(e){return Math.max(1,Math.ceil(Math.log(VS(e))/Math.LN2)+1)}function Vr(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n=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 Cxt(e,t){let n,r=-1,i=-1;if(t===void 0)for(const s of e)++i,s!=null&&(n=s)&&(n=s,r=i);else for(let s of e)(s=t(s,++i,e))!=null&&(n=s)&&(n=s,r=i);return r}function Or(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 Nxt(e,t){let n,r=-1,i=-1;if(t===void 0)for(const s of e)++i,s!=null&&(n>s||n===void 0&&s>=s)&&(n=s,r=i);else for(let s of e)(s=t(s,++i,e))!=null&&(n>s||n===void 0&&s>=s)&&(n=s,r=i);return r}function yj(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?_v:lI(i);r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),d=Math.max(n,Math.floor(t-c*f/l+h)),g=Math.min(r,Math.floor(t+(l-c)*f/l+h));yj(e,t,d,g,i)}const s=e[t];let o=n,a=r;for(zm(e,n,t),i(e[r],s)>0&&zm(e,n,r);o0;)--a}i(e[n],s)===0?zm(e,n,a):(++a,zm(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function zm(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fI(e,t=Hn){let n,r=!1;if(t.length===1){let i;for(const s of e){const o=t(s);(r?Hn(o,i)>0:Hn(o,o)===0)&&(n=s,i=o,r=!0)}}else for(const i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Hf(e,t,n){if(e=Float64Array.from(gxt(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Or(e);if(t>=1)return Vr(e);var r,i=(r-1)*t,s=Math.floor(i),o=Vr(yj(e,s).subarray(0,s+1)),a=Or(e.subarray(s+1));return o+(a-o)*(i-s)}}function $xt(e,t,n=cj){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 Oxt(e,t,n){const r=VS(e),i=Hf(e,.75)-Hf(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function vj(e,t,n){const r=VS(e),i=b1(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function WS(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 xv(e,t){return Hf(e,.5,t)}function*Lxt(e){for(const t of e)yield*t}function bj(e){return Array.from(Lxt(e))}function _j(e,t){const n=new Ud;if(t===void 0)for(let s of e)s!=null&&s>=s&&n.set(s,(n.get(s)||0)+1);else{let s=-1;for(let o of e)(o=t(o,++s,e))!=null&&o>=o&&n.set(o,(n.get(o)||0)+1)}let r,i=0;for(const[s,o]of n)o>i&&(i=o,r=s);return r}function Dxt(e,t=Fxt){const n=[];let r,i=!1;for(const s of e)i&&n.push(t(r,s)),r=s,i=!0;return n}function Fxt(e,t){return[e,t]}function Do(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);++rt(n[a],n[l]);let s,o;return e=Uint32Array.from(n,(a,l)=>l),e.sort(t===Hn?(a,l)=>_v(n[a],n[l]):lI(i)),e.forEach((a,l)=>{const c=i(a,s===void 0?a:s);c>=0?((s===void 0||c>0)&&(s=a,o=l),r[a]=o):r[a]=NaN}),r}function Bxt(e,t=Hn){let n,r=!1;if(t.length===1){let i;for(const s of e){const o=t(s);(r?Hn(o,i)<0:Hn(o,o)===0)&&(n=s,i=o,r=!0)}}else for(const i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function ml(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Rx(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function Mc(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function YS(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 N4=Symbol("implicit");function hI(){var e=new Ud,t=[],n=[],r=N4;function i(s){let o=e.get(s);if(o===void 0){if(r!==N4)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 Ud;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 hI(t,n).unknown(r)},Mc.apply(i,arguments),i}function _1(){var e=hI().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,s,o,a=!1,l=0,c=0,u=.5;delete e.unknown;function f(){var h=t().length,d=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?u_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?u_(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=zxt.exec(e))?new Li(t[1],t[2],t[3],1):(t=qxt.exec(e))?new Li(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jxt.exec(e))?u_(t[1],t[2],t[3],t[4]):(t=Vxt.exec(e))?u_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wxt.exec(e))?OO(t[1],t[2]/100,t[3]/100,1):(t=Yxt.exec(e))?OO(t[1],t[2]/100,t[3]/100,t[4]):MO.hasOwnProperty(e)?CO(MO[e]):e==="transparent"?new Li(NaN,NaN,NaN,0):null}function CO(e){return new Li(e>>16&255,e>>8&255,e&255,1)}function u_(e,t,n,r){return r<=0&&(e=t=n=NaN),new Li(e,t,n,r)}function dI(e){return e instanceof dh||(e=Gf(e)),e?(e=e.rgb(),new Li(e.r,e.g,e.b,e.opacity)):new Li}function mo(e,t,n,r){return arguments.length===1?dI(e):new Li(e,t,n,r??1)}function Li(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Xg(Li,mo,w1(dh,{brighter(e){return e=e==null?dg:Math.pow(dg,e),new Li(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zd:Math.pow(zd,e),new Li(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Li(hd(this.r),hd(this.g),hd(this.b),Cx(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:NO,formatHex:NO,formatHex8:Xxt,formatRgb:$O,toString:$O}));function NO(){return`#${ed(this.r)}${ed(this.g)}${ed(this.b)}`}function Xxt(){return`#${ed(this.r)}${ed(this.g)}${ed(this.b)}${ed((isNaN(this.opacity)?1:this.opacity)*255)}`}function $O(){const e=Cx(this.opacity);return`${e===1?"rgb(":"rgba("}${hd(this.r)}, ${hd(this.g)}, ${hd(this.b)}${e===1?")":`, ${e})`}`}function Cx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function hd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ed(e){return e=hd(e),(e<16?"0":"")+e.toString(16)}function OO(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new el(e,t,n,r)}function Sj(e){if(e instanceof el)return new el(e.h,e.s,e.l,e.opacity);if(e instanceof dh||(e=Gf(e)),!e)return new el;if(e instanceof el)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,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&l<1?0:o,new el(o,a,l,e.opacity)}function $4(e,t,n,r){return arguments.length===1?Sj(e):new el(e,t,n,r??1)}function el(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Xg(el,$4,w1(dh,{brighter(e){return e=e==null?dg:Math.pow(dg,e),new el(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zd:Math.pow(zd,e),new el(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 Li(tk(e>=240?e-240:e+120,i,r),tk(e,i,r),tk(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new el(LO(this.h),f_(this.s),f_(this.l),Cx(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=Cx(this.opacity);return`${e===1?"hsl(":"hsla("}${LO(this.h)}, ${f_(this.s)*100}%, ${f_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function LO(e){return e=(e||0)%360,e<0?e+360:e}function f_(e){return Math.max(0,Math.min(1,e||0))}function tk(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 Aj=Math.PI/180,Ej=180/Math.PI,Nx=18,kj=.96422,Tj=1,Mj=.82521,Ij=4/29,B0=6/29,Rj=3*B0*B0,Kxt=B0*B0*B0;function Cj(e){if(e instanceof cc)return new cc(e.l,e.a,e.b,e.opacity);if(e instanceof uu)return Nj(e);e instanceof Li||(e=dI(e));var t=ik(e.r),n=ik(e.g),r=ik(e.b),i=ek((.2225045*t+.7168786*n+.0606169*r)/Tj),s,o;return t===n&&n===r?s=o=i:(s=ek((.4360747*t+.3850649*n+.1430804*r)/kj),o=ek((.0139322*t+.0971045*n+.7141733*r)/Mj)),new cc(116*i-16,500*(s-i),200*(i-o),e.opacity)}function $x(e,t,n,r){return arguments.length===1?Cj(e):new cc(e,t,n,r??1)}function cc(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Xg(cc,$x,w1(dh,{brighter(e){return new cc(this.l+Nx*(e??1),this.a,this.b,this.opacity)},darker(e){return new cc(this.l-Nx*(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=kj*nk(t),e=Tj*nk(e),n=Mj*nk(n),new Li(rk(3.1338561*t-1.6168667*e-.4906146*n),rk(-.9787684*t+1.9161415*e+.033454*n),rk(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function ek(e){return e>Kxt?Math.pow(e,1/3):e/Rj+Ij}function nk(e){return e>B0?e*e*e:Rj*(e-Ij)}function rk(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ik(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jxt(e){if(e instanceof uu)return new uu(e.h,e.c,e.l,e.opacity);if(e instanceof cc||(e=Cj(e)),e.a===0&&e.b===0)return new uu(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 Oj(e,t){return function(n){return e+n*t}}function e2t(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 mI(e,t){var n=t-e;return n?Oj(e,n>180||n<-180?n-360*Math.round(n/360):n):GS(isNaN(e)?t:e)}function n2t(e){return(e=+e)==1?as:function(t,n){return n-t?e2t(t,n,e):GS(isNaN(t)?n:t)}}function as(e,t){var n=t-e;return n?Oj(e,n):GS(isNaN(e)?t:e)}const qd=function e(t){var n=n2t(t);function r(i,s){var o=n((i=mo(i)).r,(s=mo(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=as(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r}(1);function r2t(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,l.push({i:o,x:es(r,i)})),n=sk.lastIndex;return n180?u+=360:u-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:es(c,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(c,u,f,h){c!==u?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:es(c,u)}):u&&f.push(i(f)+"skewX("+u+r)}function l(c,u,f,h,d,g){if(c!==f||u!==h){var y=d.push(i(d)+"scale(",null,",",null,")");g.push({i:y-4,x:es(c,f)},{i:y-2,x:es(u,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(c,u){var f=[],h=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,h),o(c.rotate,u.rotate,f,h),a(c.skewX,u.skewX,f,h),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,h),c=u=null,function(d){for(var g=-1,y=h.length,v;++gt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function T2t(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?M2t:T2t,l=c=null,f}function f(h){return h==null||isNaN(h=+h)?s:(l||(l=a(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(i((c||(c=a(t,e.map(r),es)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,F4),u()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=yI,u()},f.clamp=function(h){return arguments.length?(o=h?!0:Aa,u()):o!==Aa},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,d){return r=h,i=d,u()}}function Pj(){return KS()(Aa,Aa)}function I2t(e,t,n,r){var i=C4(e,t,n),s;switch(r=bv(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=hxt(i,o))&&(r.precision=s),lj(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=dxt(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=fxt(i))&&(r.precision=s-(r.type==="%")*2);break}}return Wa(r)}function S1(e){var t=e.domain;return e.ticks=function(n){var r=t();return Yf(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return I2t(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],l,c,u=10;for(a0;){if(c=wv(o,a,n),c===l)return r[i]=o,r[s]=a,t(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return e},e}function zu(){var e=Pj();return e.copy=function(){return x1(e,zu())},Mc.apply(e,arguments),S1(e)}function Uj(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,F4),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Uj(e).unknown(t)},e=arguments.length?Array.from(e,F4):[0,1],S1(n)}function zj(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 O2t(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 VO(e){return(t,n)=>-e(-t,n)}function qj(e){const t=e(qO,jO),n=t.domain;let r=10,i,s;function o(){return i=O2t(r),s=$2t(r),n()[0]<0?(i=VO(i),s=VO(s),e(R2t,C2t)):e(qO,jO),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 l=n();let c=l[0],u=l[l.length-1];const f=u0){for(;h<=d;++h)for(g=1;gu)break;b.push(y)}}else for(;h<=d;++h)for(g=r-1;g>=1;--g)if(y=h>0?g/s(-h):g*s(h),!(yu)break;b.push(y)}b.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=bv(l)).precision==null&&(l.trim=!0),l=Wa(l)),a===1/0)return l;const c=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/s(Math.round(i(u)));return f*rn(zj(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),t}function pg(){const e=qj(KS()).domain([1,10]);return e.copy=()=>x1(e,pg()).base(e.base()),Mc.apply(e,arguments),e}function WO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function YO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jj(e){var t=1,n=e(WO(t),YO(t));return n.constant=function(r){return arguments.length?e(WO(t=+r),YO(t)):t},S1(n)}function bI(){var e=jj(KS());return e.copy=function(){return x1(e,bI()).constant(e.constant())},Mc.apply(e,arguments)}function HO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function L2t(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function D2t(e){return e<0?-e*e:e*e}function Vj(e){var t=e(Aa,Aa),n=1;function r(){return n===1?e(Aa,Aa):n===.5?e(L2t,D2t):e(HO(n),HO(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},S1(t)}function Wj(){var e=Vj(KS());return e.copy=function(){return x1(e,Wj()).exponent(e.exponent())},Mc.apply(e,arguments),e}function Yj(){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(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 l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),t(s,a),e(s);while(cEi(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)=>(ok.setTime(+s),ak.setTime(+o),e(ok),e(ak),Math.floor(n(ok,ak))),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 Ox=Ei(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ox.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ei(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ox);Ox.range;const fu=1e3,Ea=fu*60,hu=Ea*60,Iu=hu*24,_I=Iu*7,GO=Iu*30,lk=Iu*365,sl=Ei(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*fu)},(e,t)=>(t-e)/fu,e=>e.getUTCSeconds());sl.range;const A1=Ei(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fu)},(e,t)=>{e.setTime(+e+t*Ea)},(e,t)=>(t-e)/Ea,e=>e.getMinutes());A1.range;const E1=Ei(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ea)},(e,t)=>(t-e)/Ea,e=>e.getUTCMinutes());E1.range;const k1=Ei(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fu-e.getMinutes()*Ea)},(e,t)=>{e.setTime(+e+t*hu)},(e,t)=>(t-e)/hu,e=>e.getHours());k1.range;const T1=Ei(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*hu)},(e,t)=>(t-e)/hu,e=>e.getUTCHours());T1.range;const lp=Ei(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ea)/Iu,e=>e.getDate()-1);lp.range;const JS=Ei(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Iu,e=>e.getUTCDate()-1);JS.range;const ZS=Ei(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Iu,e=>Math.floor(e/Iu));ZS.range;function cp(e){return Ei(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())*Ea)/_I)}const gg=cp(0),Ev=cp(1),Gj=cp(2),Xj=cp(3),jd=cp(4),Kj=cp(5),Jj=cp(6);gg.range;Ev.range;Gj.range;Xj.range;jd.range;Kj.range;Jj.range;function up(e){return Ei(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)/_I)}const mg=up(0),kv=up(1),Zj=up(2),Qj=up(3),Vd=up(4),tV=up(5),eV=up(6);mg.range;kv.range;Zj.range;Qj.range;Vd.range;tV.range;eV.range;const M1=Ei(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());M1.range;const I1=Ei(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());I1.range;const vl=Ei(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());vl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ei(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)});vl.range;const bl=Ei(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());bl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ei(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)});bl.range;function nV(e,t,n,r,i,s){const o=[[sl,1,fu],[sl,5,5*fu],[sl,15,15*fu],[sl,30,30*fu],[s,1,Ea],[s,5,5*Ea],[s,15,15*Ea],[s,30,30*Ea],[i,1,hu],[i,3,3*hu],[i,6,6*hu],[i,12,12*hu],[r,1,Iu],[r,2,2*Iu],[n,1,_I],[t,1,GO],[t,3,3*GO],[e,1,lk]];function a(c,u,f){const h=uv).right(o,h);if(d===o.length)return e.every(C4(c/lk,u/lk,f));if(d===0)return Ox.every(Math.max(C4(c,u,f),1));const[g,y]=o[h/o[d-1][2]53)return null;"w"in at||(at.w=1),"Z"in at?(wt=uk(qm(at.y,0,1)),Bt=wt.getUTCDay(),wt=Bt>4||Bt===0?kv.ceil(wt):kv(wt),wt=JS.offset(wt,(at.V-1)*7),at.y=wt.getUTCFullYear(),at.m=wt.getUTCMonth(),at.d=wt.getUTCDate()+(at.w+6)%7):(wt=ck(qm(at.y,0,1)),Bt=wt.getDay(),wt=Bt>4||Bt===0?Ev.ceil(wt):Ev(wt),wt=lp.offset(wt,(at.V-1)*7),at.y=wt.getFullYear(),at.m=wt.getMonth(),at.d=wt.getDate()+(at.w+6)%7)}else("W"in at||"U"in at)&&("w"in at||(at.w="u"in at?at.u%7:"W"in at?1:0),Bt="Z"in at?uk(qm(at.y,0,1)).getUTCDay():ck(qm(at.y,0,1)).getDay(),at.m=0,at.d="W"in at?(at.w+6)%7+at.W*7-(Bt+5)%7:at.w+at.U*7-(Bt+6)%7);return"Z"in at?(at.H+=at.Z/100|0,at.M+=at.Z%100,uk(at)):ck(at)}}function M(st,Z,mt,at){for(var Ct=0,wt=Z.length,Bt=mt.length,Pt,kt;Ct=Bt)return-1;if(Pt=Z.charCodeAt(Ct++),Pt===37){if(Pt=Z.charAt(Ct++),kt=k[Pt in XO?Z.charAt(Ct++):Pt],!kt||(at=kt(st,mt,at))<0)return-1}else if(Pt!=mt.charCodeAt(at++))return-1}return at}function I(st,Z,mt){var at=c.exec(Z.slice(mt));return at?(st.p=u.get(at[0].toLowerCase()),mt+at[0].length):-1}function C(st,Z,mt){var at=d.exec(Z.slice(mt));return at?(st.w=g.get(at[0].toLowerCase()),mt+at[0].length):-1}function N(st,Z,mt){var at=f.exec(Z.slice(mt));return at?(st.w=h.get(at[0].toLowerCase()),mt+at[0].length):-1}function L(st,Z,mt){var at=b.exec(Z.slice(mt));return at?(st.m=_.get(at[0].toLowerCase()),mt+at[0].length):-1}function F(st,Z,mt){var at=y.exec(Z.slice(mt));return at?(st.m=v.get(at[0].toLowerCase()),mt+at[0].length):-1}function $(st,Z,mt){return M(st,t,Z,mt)}function D(st,Z,mt){return M(st,n,Z,mt)}function O(st,Z,mt){return M(st,r,Z,mt)}function B(st){return o[st.getDay()]}function V(st){return s[st.getDay()]}function U(st){return l[st.getMonth()]}function z(st){return a[st.getMonth()]}function q(st){return i[+(st.getHours()>=12)]}function Y(st){return 1+~~(st.getMonth()/3)}function Q(st){return o[st.getUTCDay()]}function ft(st){return s[st.getUTCDay()]}function gt(st){return l[st.getUTCMonth()]}function pt(st){return a[st.getUTCMonth()]}function lt(st){return i[+(st.getUTCHours()>=12)]}function vt(st){return 1+~~(st.getUTCMonth()/3)}return{format:function(st){var Z=A(st+="",w);return Z.toString=function(){return st},Z},parse:function(st){var Z=T(st+="",!1);return Z.toString=function(){return st},Z},utcFormat:function(st){var Z=A(st+="",S);return Z.toString=function(){return st},Z},utcParse:function(st){var Z=T(st+="",!0);return Z.toString=function(){return st},Z}}}var XO={"-":"",_:" ",0:"0"},Fi=/^\s*\d+/,z2t=/^%/,q2t=/[\\^$*+?|[\]().{}]/g;function $n(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function V2t(e,t,n){var r=Fi.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function W2t(e,t,n){var r=Fi.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Y2t(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function H2t(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function G2t(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function KO(e,t,n){var r=Fi.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function JO(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function X2t(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 K2t(e,t,n){var r=Fi.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function J2t(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ZO(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Z2t(e,t,n){var r=Fi.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function QO(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Q2t(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function tSt(e,t,n){var r=Fi.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function eSt(e,t,n){var r=Fi.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function nSt(e,t,n){var r=Fi.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rSt(e,t,n){var r=z2t.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function iSt(e,t,n){var r=Fi.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function sSt(e,t,n){var r=Fi.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function tL(e,t){return $n(e.getDate(),t,2)}function oSt(e,t){return $n(e.getHours(),t,2)}function aSt(e,t){return $n(e.getHours()%12||12,t,2)}function lSt(e,t){return $n(1+lp.count(vl(e),e),t,3)}function iV(e,t){return $n(e.getMilliseconds(),t,3)}function cSt(e,t){return iV(e,t)+"000"}function uSt(e,t){return $n(e.getMonth()+1,t,2)}function fSt(e,t){return $n(e.getMinutes(),t,2)}function hSt(e,t){return $n(e.getSeconds(),t,2)}function dSt(e){var t=e.getDay();return t===0?7:t}function pSt(e,t){return $n(gg.count(vl(e)-1,e),t,2)}function sV(e){var t=e.getDay();return t>=4||t===0?jd(e):jd.ceil(e)}function gSt(e,t){return e=sV(e),$n(jd.count(vl(e),e)+(vl(e).getDay()===4),t,2)}function mSt(e){return e.getDay()}function ySt(e,t){return $n(Ev.count(vl(e)-1,e),t,2)}function vSt(e,t){return $n(e.getFullYear()%100,t,2)}function bSt(e,t){return e=sV(e),$n(e.getFullYear()%100,t,2)}function _St(e,t){return $n(e.getFullYear()%1e4,t,4)}function wSt(e,t){var n=e.getDay();return e=n>=4||n===0?jd(e):jd.ceil(e),$n(e.getFullYear()%1e4,t,4)}function xSt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+$n(t/60|0,"0",2)+$n(t%60,"0",2)}function eL(e,t){return $n(e.getUTCDate(),t,2)}function SSt(e,t){return $n(e.getUTCHours(),t,2)}function ASt(e,t){return $n(e.getUTCHours()%12||12,t,2)}function ESt(e,t){return $n(1+JS.count(bl(e),e),t,3)}function oV(e,t){return $n(e.getUTCMilliseconds(),t,3)}function kSt(e,t){return oV(e,t)+"000"}function TSt(e,t){return $n(e.getUTCMonth()+1,t,2)}function MSt(e,t){return $n(e.getUTCMinutes(),t,2)}function ISt(e,t){return $n(e.getUTCSeconds(),t,2)}function RSt(e){var t=e.getUTCDay();return t===0?7:t}function CSt(e,t){return $n(mg.count(bl(e)-1,e),t,2)}function aV(e){var t=e.getUTCDay();return t>=4||t===0?Vd(e):Vd.ceil(e)}function NSt(e,t){return e=aV(e),$n(Vd.count(bl(e),e)+(bl(e).getUTCDay()===4),t,2)}function $St(e){return e.getUTCDay()}function OSt(e,t){return $n(kv.count(bl(e)-1,e),t,2)}function LSt(e,t){return $n(e.getUTCFullYear()%100,t,2)}function DSt(e,t){return e=aV(e),$n(e.getUTCFullYear()%100,t,2)}function FSt(e,t){return $n(e.getUTCFullYear()%1e4,t,4)}function BSt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Vd(e):Vd.ceil(e),$n(e.getUTCFullYear()%1e4,t,4)}function PSt(){return"+0000"}function nL(){return"%"}function rL(e){return+e}function iL(e){return Math.floor(+e/1e3)}var Yp,wI,R1;USt({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 USt(e){return Yp=U2t(e),wI=Yp.format,Yp.parse,R1=Yp.utcFormat,Yp.utcParse,Yp}function zSt(e){return new Date(e)}function qSt(e){return e instanceof Date?+e:+new Date(+e)}function xI(e,t,n,r,i,s,o,a,l,c){var u=Pj(),f=u.invert,h=u.domain,d=c(".%L"),g=c(":%S"),y=c("%I:%M"),v=c("%I %p"),b=c("%a %d"),_=c("%b %d"),w=c("%B"),S=c("%Y");function k(A){return(l(A)e,forward:e=>e,reverse:e=>e},log:{type:"log",expr:e=>eo(ba(e,0),$U(e),Zt("nan")),forward:e=>Math.log10(e),reverse:e=>Math.pow(10,e)},symlog:{type:"symlog",expr:(e,t)=>Ue(Mu(e),C0(er(1,Ss(hr(e,t))))),forward:(e,t)=>Math.sign(e)*Math.log1p(Math.abs(e)/t),reverse:(e,t)=>Math.sign(e)*Math.expm1(Math.abs(e))*t}};function WSt(e,t){let n=e,r=1/0;for(let i of t){let s=Math.abs(e-i);s=100&&n>=0&&i0?"log":"symlog")),n<=0&&o=="log"&&(r<=0?(n=1,r=10):n=Math.min(e.minPositive,r/10));let a=t.desiredCount??5;switch(o){case"linear":{let l=zu().domain([n,r]).nice(a),c=l.ticks(a);return{scale:{...Wm.linear,domain:l.domain()},binStart:l.domain()[0],binSize:c[1]-c[0]}}case"log":{let l=pg().domain([n,r]).nice(),c=Math.log10(l.domain()[0]),u=(Math.log10(l.domain()[1])-c)/a;return u=WSt(u,[.05,.1,.2,.5,1,1.5,2]),{scale:{...Wm.log,domain:l.domain()},binStart:c,binSize:u}}case"symlog":{let l=Math.max(Math.abs(n),Math.abs(r)),c=l>=100?1:l>0?l/1e5:1,u=Wm.symlog.forward(n,c),f=Wm.symlog.forward(r,c);return{scale:{...Wm.symlog,domain:[n,r],constant:c},binStart:u,binSize:(f-u)/a}}default:throw new Error("invalid scale type")}}function Ve(e){for(var t=e.length/6|0,n=new Array(t),r=0;ri2t(e[e.length-1]);var dV=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Ve);const pV=gr(dV);var gV=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Ve);const mV=gr(gV);var yV=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Ve);const vV=gr(yV);var bV=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Ve);const _V=gr(bV);var P4=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Ve);const Lx=gr(P4);var wV=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Ve);const xV=gr(wV);var U4=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Ve);const Dx=gr(U4);var SV=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Ve);const AV=gr(SV);var EV=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Ve);const kV=gr(EV);var TV=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Ve);const MV=gr(TV);var IV=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Ve);const RV=gr(IV);var CV=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Ve);const NV=gr(CV);var $V=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Ve);const OV=gr($V);var LV=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Ve);const SI=gr(LV);var DV=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Ve);const FV=gr(DV);var BV=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Ve);const PV=gr(BV);var UV=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Ve);const zV=gr(UV);var qV=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Ve);const AI=gr(qV);var jV=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Ve);const VV=gr(jV);var WV=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Ve);const YV=gr(WV);var HV=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Ve);const GV=gr(HV);var XV=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Ve);const KV=gr(XV);var JV=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Ve);const ZV=gr(JV);var QV=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Ve);const tW=gr(QV);var eW=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Ve);const nW=gr(eW);var rW=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Ve);const iW=gr(rW);var sW=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Ve);const oW=gr(sW);function aW(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}const lW=vI(vc(300,.5,0),vc(-240,.5,1));var cW=vI(vc(-100,.75,.35),vc(80,1.5,.8)),uW=vI(vc(260,.75,.35),vc(80,1.5,.8)),d_=vc();function fW(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return d_.h=360*e-100,d_.s=1.5-1.5*t,d_.l=.8-.9*t,d_+""}var p_=mo(),r3t=Math.PI/3,i3t=Math.PI*2/3;function hW(e){var t;return e=(.5-e)*Math.PI,p_.r=255*(t=Math.sin(e))*t,p_.g=255*(t=Math.sin(e+r3t))*t,p_.b=255*(t=Math.sin(e+i3t))*t,p_+""}function EI(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function e3(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const dW=e3(Ve("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var pW=e3(Ve("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),n3=e3(Ve("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),gW=e3(Ve("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function mW(){return!(navigator.gpu==null||navigator.gpu.requestAdapter==null)}function s3t(e){return e==0&&(e=4),e%4!=0&&(e+=4-e%4),e}function P0(e,t,n,r){return(e.buffer==null||e.byteSize!=n||e.usage!=r)&&(e.buffer!=null&&e.buffer.destroy(),e.buffer=t.createBuffer({size:s3t(n),usage:r}),e.byteSize=n,e.destroy=()=>{e.buffer?.destroy()}),e.buffer}function fk(e,t,n,r){if(e.buffer!==n||e.data!==r){if(r!=null)if(r.byteLength%4!=0){let i=r.byteLength-r.byteLength%4;if(t.queue.writeBuffer(n,0,r,0,i),r instanceof Uint8Array){let s=new Uint8Array(4);for(let o=0;o<4;o++)i+o{e.texture?.destroy()}),e.texture}const jo=2,kI=4,r3=8,C1=16,qu=32,fp=64,yW=128,Na=256,Fx=512,is=1024,Pa=2048,ph=4096,ul=8192,hp=16384,TI=32768,MI=65536,oL=1<<17,o3t=1<<18,II=1<<19,RI=1<<20,z4=1<<21,CI=1<<22,pd=1<<23,gd=Symbol("$state"),vW=Symbol("legacy props"),a3t=Symbol(""),NI=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},bW=3,Tv=8,l3t=!1;var $I=Array.isArray,c3t=Array.prototype.indexOf,OI=Array.from,Bx=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,_W=Object.getOwnPropertyDescriptors,u3t=Object.prototype,f3t=Array.prototype,LI=Object.getPrototypeOf,aL=Object.isExtensible;function wW(e){for(var t=0;t{e=r,t=i});return{promise:n,resolve:e,reject:t}}function xW(e){return e===this.v}function SW(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function d3t(e,t){return e!==t}function AW(e){return!SW(e,this.v)}function p3t(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function EW(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function g3t(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function m3t(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function y3t(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function v3t(e){throw new Error("https://svelte.dev/e/effect_orphan")}function b3t(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function _3t(){throw new Error("https://svelte.dev/e/hydration_failed")}function w3t(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function x3t(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function S3t(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function A3t(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let E3t=!1;const DI=1,FI=2,kW=4,k3t=8,T3t=16,M3t=1,I3t=4,R3t=8,C3t=16,N3t=1,$3t=2,TW="[",BI="[!",PI="]",z0={},Ci=Symbol(),O3t="http://www.w3.org/1999/xhtml";let Vo=null;function Px(e){Vo=e}function dp(e,t=!1,n){Vo={p:Vo,c:null,e:null,s:e,x:null,l:null}}function pp(e){var t=Vo,n=t.e;if(n!==null){t.e=null;for(var r of n)ZW(r)}return e!==void 0&&(t.x=e),Vo=t.p,e??{}}function MW(){return!0}function i3(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let rr=!1;function du(e){rr=e}let Yn;function fl(e){if(e===null)throw i3(),z0;return Yn=e}function N1(){return fl(ju(Yn))}function mi(e){if(rr){if(ju(Yn)!==null)throw i3(),z0;Yn=e}}function L3t(e=1){if(rr){for(var t=e,n=Yn;t--;)n=ju(n);Yn=n}}function q4(){for(var e=0,t=Yn;;){if(t.nodeType===Tv){var n=t.data;if(n===PI){if(e===0)return t;e-=1}else(n===TW||n===BI)&&(e+=1)}var r=ju(t);t.remove(),t=r}}function IW(e){if(!e||e.nodeType!==Tv)throw i3(),z0;return e.data}function nd(e){if(typeof e!="object"||e===null||gd in e)return e;const t=LI(e);if(t!==u3t&&t!==f3t)return e;var n=new Map,r=$I(e),i=Sr(0),s=yd,o=a=>{if(yd===s)return a();var l=Tn,c=yd;bc(null),dL(s);var u=a();return bc(l),dL(c),u};return r&&n.set("length",Sr(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&x3t();var u=n.get(l);return u===void 0?u=o(()=>{var f=Sr(c.value);return n.set(l,f),f}):De(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Sr(Ci));n.set(l,u),hk(i)}}else De(c,Ci),hk(i);return!0},get(a,l,c){if(l===gd)return e;var u=n.get(l),f=l in a;if(u===void 0&&(!f||U0(a,l)?.writable)&&(u=o(()=>{var d=nd(f?a[l]:Ci),g=Sr(d);return g}),n.set(l,u)),u!==void 0){var h=X(u);return h===Ci?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=X(u))}else if(c===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==Ci)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===gd)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Ci||Reflect.has(a,l);if(c!==void 0||vn!==null&&(!u||U0(a,l)?.writable)){c===void 0&&(c=o(()=>{var h=u?nd(a[l]):Ci,d=Sr(h);return d}),n.set(l,c));var f=X(c);if(f===Ci)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var d=c;dSr(Ci)),n.set(d+"",g))}if(f===void 0)(!h||U0(a,l)?.writable)&&(f=o(()=>Sr(void 0)),De(f,nd(c)),n.set(l,f));else{h=f.v!==Ci;var y=o(()=>nd(c));De(f,y)}var v=Reflect.getOwnPropertyDescriptor(a,l);if(v?.set&&v.set.call(u,c),!h){if(r&&typeof l=="string"){var b=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=b.v&&De(b,_+1)}hk(i)}return!0},ownKeys(a){X(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==Ci});for(var[c,u]of n)u.v!==Ci&&!(c in a)&&l.push(c);return l},setPrototypeOf(){S3t()}})}var lL,RW,CW,NW;function j4(){if(lL===void 0){lL=window,RW=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;CW=U0(t,"firstChild").get,NW=U0(t,"nextSibling").get,aL(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),aL(n)&&(n.__t=void 0)}}function Xf(e=""){return document.createTextNode(e)}function Ru(e){return CW.call(e)}function ju(e){return NW.call(e)}function Oi(e,t){if(!rr)return Ru(e);var n=Ru(Yn);if(n===null)n=Yn.appendChild(Xf());else if(t&&n.nodeType!==bW){var r=Xf();return n?.before(r),fl(r),r}return fl(n),n}function g0(e,t){if(!rr){var n=Ru(e);return n instanceof Comment&&n.data===""?ju(n):n}return Yn}function Nr(e,t=1,n=!1){let r=rr?Yn:e;for(var i;t--;)i=r,r=ju(r);if(!rr)return r;if(n&&r?.nodeType!==bW){var s=Xf();return r===null?i?.after(s):r.before(s),fl(s),s}return fl(r),r}function $W(e){e.textContent=""}function OW(){return!1}const D3t=new WeakMap;function F3t(e){var t=vn;if(t===null)return Tn.f|=pd,e;if((t.f&TI)===0){if((t.f&yW)===0)throw!t.parent&&e instanceof Error&&LW(e),e;t.b.error(e)}else UI(e,t)}function UI(e,t){for(;t!==null;){if((t.f&yW)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e instanceof Error&&LW(e),e}function LW(e){const t=D3t.get(e);t&&(Bx(e,"message",{value:t.message}),Bx(e,"stack",{value:t.stack}))}let Mv=[],V4=[];function DW(){var e=Mv;Mv=[],wW(e)}function B3t(){var e=V4;V4=[],wW(e)}function zI(e){Mv.length===0&&queueMicrotask(DW),Mv.push(e)}function P3t(){Mv.length>0&&DW(),V4.length>0&&B3t()}function U3t(){for(var e=vn.b;e!==null&&!e.has_pending_snippet();)e=e.parent;return e===null&&p3t(),e}function s3(e){var t=jo|Pa,n=Tn!==null&&(Tn.f&jo)!==0?Tn:null;return vn===null||n!==null&&(n.f&Na)!==0?t|=Na:vn.f|=II,{ctx:Vo,deps:null,effects:null,equals:xW,f:t,fn:e,reactions:null,rv:0,v:Ci,wv:0,parent:n??vn,ac:null}}function z3t(e,t){let n=vn;n===null&&g3t();var r=n.b,i=void 0,s=Iv(Ci),o=null,a=!Tn;return tAt(()=>{try{var l=e()}catch(d){l=Promise.reject(d)}var c=()=>l;i=o?.then(c,c)??Promise.resolve(l),o=i;var u=hi,f=r.pending;a&&(r.update_pending_count(1),f||u.increment());const h=(d,g=void 0)=>{o=null,f||u.activate(),g?g!==NI&&(s.f|=pd,Rv(s,g)):((s.f&pd)!==0&&(s.f^=pd),Rv(s,d)),a&&(r.update_pending_count(-1),f||u.decrement()),UW()};if(i.then(h,d=>h(null,d||"unknown")),u)return()=>{queueMicrotask(()=>u.neuter())}}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function oe(e){const t=s3(e);return WW(t),t}function FW(e){const t=s3(e);return t.equals=AW,t}function BW(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nz3t(l))).then(l=>{i?.activate(),o();try{n([...e.map(r),...l])}catch(c){(s.f&hp)===0&&UI(c,s)}i?.deactivate(),UW()}).catch(l=>{a.error(l)})}function V3t(){var e=vn,t=Tn,n=Vo;return function(){Kf(e),bc(t),Px(n)}}function UW(){Kf(null),bc(null),Px(null)}const Ym=new Set;let hi=null,yg=null,cL=new Set,Ux=[];function zW(){const e=Ux.shift();Ux.length>0&&queueMicrotask(zW),e()}let Wd=[],o3=null,W4=!1,pw=!1,jI=class Y4{current=new Map;#t=new Map;#e=new Set;#n=0;#r=null;#c=!1;#i=[];#s=[];#a=[];#o=[];#l=[];#f=[];#u=[];skipped_effects=new Set;process(t){Wd=[];var n=null;if(Ym.size>1){n=new Map,yg=new Map;for(const[s,o]of this.current)n.set(s,{v:s.v,wv:s.wv}),s.v=o;for(const s of Ym)if(s!==this)for(const[o,a]of s.#t)n.has(o)||(n.set(o,{v:o.v,wv:o.wv}),o.v=a)}for(const s of t)this.#p(s);if(this.#i.length===0&&this.#n===0){this.#d();var r=this.#a,i=this.#o;this.#a=[],this.#o=[],this.#l=[],hi=null,uL(r),uL(i),hi===null?hi=this:Ym.delete(this),this.#r?.resolve()}else this.#h(this.#a),this.#h(this.#o),this.#h(this.#l);if(n){for(const[s,{v:o,wv:a}]of n)s.wv<=a&&(s.v=o);yg=null}for(const s of this.#i)Py(s);for(const s of this.#s)Py(s);this.#i=[],this.#s=[]}#p(t){t.f^=is;for(var n=t.first;n!==null;){var r=n.f,i=(r&(qu|fp))!==0,s=i&&(r&is)!==0,o=s||(r&ul)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){if(i)n.f^=is;else if((r&is)===0)if((r&kI)!==0)this.#o.push(n);else if((r&CI)!==0){var a=n.b?.pending?this.#s:this.#i;a.push(n)}else a3(n)&&((n.f&C1)!==0&&this.#l.push(n),Py(n));var l=n.first;if(l!==null){n=l;continue}}var c=n.parent;for(n=n.next;n===null&&c!==null;)n=c.next,c=c.parent}}#h(t){for(const n of t)((n.f&Pa)!==0?this.#f:this.#u).push(n),uo(n,is);t.length=0}capture(t,n){this.#t.has(t)||this.#t.set(t,n),this.current.set(t,t.v)}activate(){hi=this}deactivate(){hi=null;for(const t of cL)if(cL.delete(t),t(),hi!==null)break}neuter(){this.#c=!0}flush(){Wd.length>0?qW():this.#d(),hi===this&&(this.#n===0&&Ym.delete(this),this.deactivate())}#d(){if(!this.#c)for(const t of this.#e)t();this.#e.clear()}increment(){this.#n+=1}decrement(){if(this.#n-=1,this.#n===0){for(const t of this.#f)uo(t,Pa),Yd(t);for(const t of this.#u)uo(t,ph),Yd(t);this.#a=[],this.#o=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#r??=h3t()).promise}static ensure(){if(hi===null){const t=hi=new Y4;Ym.add(hi),pw||Y4.enqueue(()=>{hi===t&&t.flush()})}return hi}static enqueue(t){Ux.length===0&&queueMicrotask(zW),Ux.unshift(t)}};function W3t(e){var t=pw;pw=!0;try{for(var n;;){if(P3t(),Wd.length===0&&(hi?.flush(),Wd.length===0))return o3=null,n;qW()}}finally{pw=t}}function qW(){var e=q0;W4=!0;try{var t=0;for(fL(!0);Wd.length>0;){var n=jI.ensure();if(t++>1e3){var r,i;Y3t()}n.process(Wd),md.clear()}}finally{W4=!1,fL(e),o3=null}}function Y3t(){try{b3t()}catch(e){UI(e,o3)}}function uL(e){var t=e.length;if(t!==0){for(var n=0;ni&&(r.f&RI)!==0)break}}for(;ne.wv)return!0}(!r||vn!==null&&!Ef)&&uo(e,is)}return!1}function GW(e,t,n=!0){var r=e.reactions;if(r!==null&&!wu?.includes(e))for(var i=0;i0)for(h.length=Io+As.length,d=0;dnew Promise(r=>{n.outro?l3(t,()=>{Cu(t),r(void 0)}):(Cu(t),r(void 0))})}function QW(e){return Ic(kI,e,!1)}function tAt(e){return Ic(CI|II,e,!0)}function tY(e,t=0){return Ic(r3|t,e,!0)}function Oo(e,t=[],n=[]){j3t(t,n,r=>{Ic(r3,()=>e(...r.map(X)),!0)})}function VI(e,t=0){var n=Ic(C1|t,e,!0);return n}function Hd(e,t=!0){return Ic(qu,e,!0,t)}function eY(e){var t=e.teardown;if(t!==null){const n=gp,r=Tn;hL(!0),bc(null);try{t.call(null)}finally{hL(n),bc(r)}}}function nY(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){n.ac?.abort(NI);var r=n.next;(n.f&fp)!==0?n.parent=null:Cu(n,t),n=r}}function eAt(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&qu)===0&&Cu(t),t=n}}function Cu(e,t=!0){var n=!1;(t||(e.f&o3t)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(nAt(e.nodes_start,e.nodes_end),n=!0),nY(e,t&&!n),zx(e,0),uo(e,hp);var r=e.transitions;if(r!==null)for(const s of r)s.stop();eY(e);var i=e.parent;i!==null&&i.first!==null&&rY(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function nAt(e,t){for(;e!==null;){var n=e===t?null:ju(e);e.remove(),e=n}}function rY(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 l3(e,t){var n=[];WI(e,n,!0),iY(n,()=>{Cu(e),t&&t()})}function iY(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function WI(e,t,n){if((e.f&ul)===0){if(e.f^=ul,e.transitions!==null)for(const o of e.transitions)(o.is_global||n)&&t.push(o);for(var r=e.first;r!==null;){var i=r.next,s=(r.f&MI)!==0||(r.f&qu)!==0;WI(r,t,s?n:!1),r=i}}}function YI(e){sY(e,!0)}function sY(e,t){if((e.f&ul)!==0){e.f^=ul,(e.f&is)===0&&(uo(e,Pa),Yd(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&MI)!==0||(n.f&qu)!==0;sY(n,i?t:!1),n=r}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}function rAt(e){var t=Tn,n=vn;bc(null),Kf(null);try{return e()}finally{bc(t),Kf(n)}}const oY=new Set,G4=new Set;function iAt(e,t,n,r={}){function i(s){if(r.capture||wy.call(t,s),!s.cancelBubble)return rAt(()=>n?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?zI(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function pL(e,t,n,r,i){var s={capture:r,passive:i},o=iAt(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Z3t(()=>{t.removeEventListener(e,o,s)})}function HI(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,bc(u),Kf(f)}}}function aY(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("",""),t.content}function Df(e,t){var n=vn;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function gh(e,t){var n=(t&N3t)!==0,r=(t&$3t)!==0,i,s=!e.startsWith("");return()=>{if(rr)return Df(Yn,null),Yn;i===void 0&&(i=aY(s?e:""+e),n||(i=Ru(i)));var o=r||RW?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Ru(o),l=o.lastChild;Df(a,l)}else Df(o,o);return o}}function sAt(e,t,n="svg"){var r=!e.startsWith(""),i=`<${n}>${r?e:""+e}`,s;return()=>{if(rr)return Df(Yn,null),Yn;if(!s){var o=aY(i),a=Ru(o);s=Ru(a)}var l=s.cloneNode(!0);return Df(l,l),l}}function Vu(e,t){return sAt(e,t,"svg")}function Hm(){if(rr)return Df(Yn,null),Yn;var e=document.createDocumentFragment(),t=document.createComment(""),n=Xf();return e.append(t,n),Df(t,n),e}function Gr(e,t){if(rr){vn.nodes_end=Yn,N1();return}e!==null&&e.before(t)}const oAt=["touchstart","touchmove"];function aAt(e){return oAt.includes(e)}function Uy(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function lY(e,t){return cY(e,t)}function lAt(e,t){j4(),t.intro=t.intro??!1;const n=t.target,r=rr,i=Yn;try{for(var s=Ru(n);s&&(s.nodeType!==Tv||s.data!==TW);)s=ju(s);if(!s)throw z0;du(!0),fl(s),N1();const o=cY(e,{...t,anchor:s});if(Yn===null||Yn.nodeType!==Tv||Yn.data!==PI)throw i3(),z0;return du(!1),o}catch(o){if(o===z0)return t.recover===!1&&_3t(),j4(),$W(n),du(!1),lY(e,t);throw o}finally{du(r),fl(i)}}const Hp=new Map;function cY(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0}){j4();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(Xf());return Hd(()=>{if(s){dp({});var h=Vo;h.c=s}i&&(r.$$events=i),rr&&Df(f,null),c=e(f,r)||{},rr&&(vn.nodes_end=Yn),s&&pp()}),()=>{for(var h of a){t.removeEventListener(h,wy);var d=Hp.get(h);--d===0?(document.removeEventListener(h,wy),Hp.delete(h)):Hp.set(h,d)}G4.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return X4.set(c,u),c}let X4=new WeakMap;function cAt(e,t){const n=X4.get(e);return n?(X4.delete(e),n(t)):Promise.resolve()}function uAt(e){return new fAt(e)}class fAt{#t;#e;constructor(t){var n=new Map,r=(s,o)=>{var a=jW(o,!1,!1);return n.set(s,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(s,o){return X(n.get(o)??r(o,Reflect.get(s,o)))},has(s,o){return o===vW?!0:(X(n.get(o)??r(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return De(n.get(o)??r(o,a),a),Reflect.set(s,o,a)}});this.#e=(t.hydrate?lAt:lY)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&W3t(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||Bx(this,s,{get(){return this.#e[s]},set(o){this.#e[s]=o},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{cAt(this.#e)}}$set(t){this.#e.$set(t)}$on(t,n){this.#t[t]=this.#t[t]||[];const r=(...i)=>n.call(this,...i);return this.#t[t].push(r),()=>{this.#t[t]=this.#t[t].filter(i=>i!==r)}}$destroy(){this.#e.$destroy()}}const hAt="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(hAt);function GI(e){Vo===null&&EW(),Zc(()=>{const t=Jg(e);if(typeof t=="function")return t})}function dAt(e){Vo===null&&EW(),GI(()=>()=>Jg(e))}function Ks(e,t,n=!1){rr&&N1();var r=e,i=null,s=null,o=Ci,a=n?MI:0,l=!1;const c=(h,d=!0)=>{l=!0,f(d,h)};function u(){var h=o?i:s,d=o?s:i;h&&YI(h),d&&l3(d,()=>{o?s=null:i=null})}const f=(h,d)=>{if(o===(o=h))return;let g=!1;if(rr){const b=IW(r)===BI;!!o===b&&(r=q4(),fl(r),du(!1),g=!0)}var y=OW(),v=r;o?i??=d&&Hd(()=>d(v)):s??=d&&Hd(()=>d(v)),y||u(),g&&du(!0)};VI(()=>{l=!1,t(c),l||f(null,null)},a),rr&&(r=Yn)}function pAt(e,t,n){rr&&N1();var r=e,i=Ci,s,o,a=null,l=d3t;function c(){s&&l3(s),a!==null&&(a.lastChild.remove(),r.before(a),a=null),s=o}VI(()=>{if(l(i,i=t())){var u=r,f=OW();f&&(a=document.createDocumentFragment(),a.append(u=Xf())),o=Hd(()=>n(u)),f?hi.add_callback(c):c()}}),rr&&(r=Yn)}function dk(e,t){return t}function gAt(e,t,n){for(var r=e.items,i=[],s=t.length,o=0;o0&&i.length===0&&n!==null;if(a){var l=n.parentNode;$W(l),l.append(n),r.clear(),ql(e,t[0].prev,t[s-1].next)}iY(i,()=>{for(var c=0;c{var b=n();return $I(b)?b:b==null?[]:OI(b)}),g,y;function v(){mAt(y,g,a,h,o,i,t,r,n),s!==null&&(g.length===0?u?YI(u):u=Hd(()=>s(o)):u!==null&&l3(u,()=>{u=null}))}VI(()=>{y??=vn,g=X(d);var b=g.length;if(f&&b===0)return;f=b===0;let _=!1;if(rr){var w=IW(o)===BI;w!==(b===0)&&(o=q4(),fl(o),du(!1),_=!0)}if(rr){for(var S=null,k,A=0;A0&&fl(q4())}rr?b===0&&s&&(u=Hd(()=>s(o))):v(),_&&du(!0),X(d)}),rr&&(o=Yn)}function mAt(e,t,n,r,i,s,o,a,l){var c=(o&k3t)!==0,u=(o&(DI|FI))!==0,f=t.length,h=n.items,d=n.first,g=d,y,v=null,b,_=[],w=[],S,k,A,T;if(c)for(T=0;T0){var B=(o&kW)!==0&&f===0?i:null;if(c){for(T=0;T{if(b!==void 0)for(A of b)A.a?.apply()}),e.first=n.first&&n.first.e,e.last=v&&v.e;for(var V of r.values())Cu(V.e);r.clear()}function yAt(e,t,n,r){(r&DI)!==0&&Rv(e.v,t),(r&FI)!==0?Rv(e.i,n):e.i=n}function uY(e,t,n,r,i,s,o,a,l,c,u){var f=(l&DI)!==0,h=(l&T3t)===0,d=f?h?jW(i,!1,!1):Iv(i):i,g=(l&FI)===0?o:Iv(o),y={i:g,v:d,k:s,a:null,e:null,prev:n,next:r};try{if(e===null){var v=document.createDocumentFragment();v.append(e=Xf())}return y.e=Hd(()=>a(e,d,g,c),rr),y.e.prev=n&&n.e,y.e.next=r&&r.e,n===null?u||(t.first=y):(n.next=y,n.e.next=y.e),r!==null&&(r.prev=y,r.e.prev=y.e),y}finally{}}function gk(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,s=e.e.nodes_start;s!==null&&s!==r;){var o=ju(s);i.before(s),s=o}}function ql(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function vAt(e,t,n){QW(()=>{var r=Jg(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,s={};tY(()=>{var o=n();K3t(o),i&&SW(s,o)&&(s=o,r.update(o))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function mL(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function bAt(e,t){if(t){var n="",r,i;return Array.isArray(t)?(r=t[0],i=t[1]):r=t,r&&(n+=mL(r)),i&&(n+=mL(i,!0)),n=n.trim(),n===""?null:n}return String(e)}function mk(e,t={},n,r){for(var i in n){var s=n[i];t[i]!==s&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,s,r))}}function kn(e,t,n,r){var i=e.__style;if(rr||i!==t){var s=bAt(t,r);(!rr||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}else r&&(Array.isArray(r)?(mk(e,n?.[0],r[0]),mk(e,n?.[1],r[1],"important")):mk(e,n,r));return r}const _At=Symbol("is custom element"),wAt=Symbol("is html");function Kt(e,t,n,r){var i=xAt(e);rr&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[a3t]=n),n==null?e.removeAttribute(t):typeof n!="string"&&SAt(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function xAt(e){return e.__attributes??={[_At]:e.nodeName.includes("-"),[wAt]:e.namespaceURI===O3t}}var yL=new Map;function SAt(e){var t=yL.get(e.nodeName);if(t)return t;yL.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=_W(r);for(var s in n)n[s].set&&t.push(s);r=LI(r)}return t}function vL(e,t){return e===t||e?.[gd]===t}function K4(e={},t,n,r){return QW(()=>{var i,s;return tY(()=>{i=s,s=[],Jg(()=>{e!==n(...s)&&(t(e,...s),i&&vL(n(...i),e)&&t(null,...i))})}),()=>{zI(()=>{s&&vL(n(...s),e)&&t(null,...s)})}}),e}let g_=!1;function AAt(e){var t=g_;try{return g_=!1,[e(),g_]}finally{g_=t}}function ae(e,t,n,r){var i=(n&R3t)!==0,s=(n&C3t)!==0,o=r,a=!0,l=()=>(a&&(a=!1,o=s?Jg(r):r),o),c;if(i){var u=gd in e||vW in e;c=U0(e,t)?.set??(u&&t in e?_=>e[t]=_:void 0)}var f,h=!1;i?[f,h]=AAt(()=>e[t]):f=e[t],f===void 0&&r!==void 0&&(f=l(),c&&(w3t(),c(f)));var d;if(d=()=>{var _=e[t];return _===void 0?l():(a=!0,_)},(n&I3t)===0)return d;if(c){var g=e.$$legacy;return function(_,w){return arguments.length>0?((!w||g||h)&&c(w?d():_),_):d()}}var y=!1,v=((n&M3t)!==0?s3:FW)(()=>(y=!1,d()));i&&X(v);var b=vn;return function(_,w){if(arguments.length>0){const S=w?X(v):i?nd(_):_;return De(v,S),y=!0,o!==void 0&&(o=S),_}return gp&&y||(b.f&hp)!==0?v.v:X(v)}}var EAt=Vu('');function kAt(e,t){dp(t,!0);let n=oe(()=>t.pointLocation(t.value.xMin,t.value.yMin)),r=oe(()=>t.pointLocation(t.value.xMax,t.value.yMax));const i=8;function s(I){return C=>{C.stopPropagation(),C.preventDefault(),t.preventHover(!0);let N=[X(n).x,X(n).y,X(r).x,X(r).y],L=$=>{$.preventDefault();let D=$.pageX-C.pageX,O=$.pageY-C.pageY,B=[D,O,D,O].map((z,q)=>N[q]+z*I[q]),V=t.coordinateAtPoint(B[0],B[1]),U=t.coordinateAtPoint(B[2],B[3]);t.onChange({xMin:Math.min(V.x,U.x),xMax:Math.max(V.x,U.x),yMin:Math.min(V.y,U.y),yMax:Math.max(V.y,U.y)})},F=()=>{t.preventHover(!1),window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",F)};window.addEventListener("mousemove",L),window.addEventListener("mouseup",F)}}var o=EAt(),a=Oi(o),l=oe(()=>s([1,1,1,1]));a.__mousedown=function(...I){X(l)?.apply(this,I)},kn(a,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)",cursor:"move"});var c=Nr(a);Kt(c,"width",i);var u=oe(()=>s([1,0,0,0]));c.__mousedown=function(...I){X(u)?.apply(this,I)},kn(c,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"});var f=Nr(c);Kt(f,"width",i);var h=oe(()=>s([0,0,1,0]));f.__mousedown=function(...I){X(h)?.apply(this,I)},kn(f,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"});var d=Nr(f);Kt(d,"height",i);var g=oe(()=>s([0,1,0,0]));d.__mousedown=function(...I){X(g)?.apply(this,I)},kn(d,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"});var y=Nr(d);Kt(y,"height",i);var v=oe(()=>s([0,0,0,1]));y.__mousedown=function(...I){X(v)?.apply(this,I)},kn(y,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"});var b=Nr(y);Kt(b,"width",i),Kt(b,"height",i);var _=oe(()=>s([1,1,0,0]));b.__mousedown=function(...I){X(_)?.apply(this,I)},kn(b,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"});var w=Nr(b);Kt(w,"width",i),Kt(w,"height",i);var S=oe(()=>s([1,0,0,1]));w.__mousedown=function(...I){X(S)?.apply(this,I)},kn(w,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"});var k=Nr(w);Kt(k,"width",i),Kt(k,"height",i);var A=oe(()=>s([0,1,1,0]));k.__mousedown=function(...I){X(A)?.apply(this,I)},kn(k,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"});var T=Nr(k);Kt(T,"width",i),Kt(T,"height",i);var M=oe(()=>s([0,0,1,1]));T.__mousedown=function(...I){X(M)?.apply(this,I)},kn(T,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),mi(o),Oo((I,C,N,L,F,$,D,O,B,V,U,z)=>{Kt(a,"x",I),Kt(a,"width",C),Kt(a,"y",N),Kt(a,"height",L),Kt(c,"x",X(n).x-i/2),Kt(c,"y",F),Kt(c,"height",$),Kt(f,"x",X(r).x-i/2),Kt(f,"y",D),Kt(f,"height",O),Kt(d,"x",B),Kt(d,"width",V),Kt(d,"y",X(n).y-i/2),Kt(y,"x",U),Kt(y,"width",z),Kt(y,"y",X(r).y-i/2),Kt(b,"x",X(n).x-i/2),Kt(b,"y",X(n).y-i/2),Kt(w,"x",X(n).x-i/2),Kt(w,"y",X(r).y-i/2),Kt(k,"x",X(r).x-i/2),Kt(k,"y",X(n).y-i/2),Kt(T,"x",X(r).x-i/2),Kt(T,"y",X(r).y-i/2)},[()=>Math.min(X(n).x,X(r).x),()=>Math.abs(X(n).x-X(r).x),()=>Math.min(X(n).y,X(r).y),()=>Math.abs(X(n).y-X(r).y),()=>Math.min(X(n).y,X(r).y),()=>Math.abs(X(n).y-X(r).y),()=>Math.min(X(n).y,X(r).y),()=>Math.abs(X(n).y-X(r).y),()=>Math.min(X(n).x,X(r).x),()=>Math.abs(X(n).x-X(r).x),()=>Math.min(X(n).x,X(r).x),()=>Math.abs(X(n).x-X(r).x)]),Gr(e,o),pp()}HI(["mousedown"]);function TAt(e,t){let n=!1,r,i,s,o=300,a=300,l=async u=>{n=!0;try{await e(u)}catch(f){console.error(f)}if(n=!1,r!==void 0){let f=r;r=void 0,c(f)}},c=async u=>{if(n){r=u;return}let f=new Date().getTime();t()&&(i=f);let h=!0;(i==null||f-il(u),o)):l(u)};return c}function yk(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey}}function MAt(e,t){let{zoom:n,click:r,drag:i,hover:s}=t,o=!1,a=!1,l=null,c=r==null?0:5;return{wheel:u=>{if(n==null)return;u.preventDefault();let f=e.getBoundingClientRect(),h=u.clientX-f.left,d=u.clientY-f.top,g=Math.exp(-u.deltaY/200);n(g,{x:h,y:d},yk(u))},mousedown:u=>{u.preventDefault();let f=e.getBoundingClientRect(),h=u.clientX-f.left,d=u.clientY-f.top,g=!1,y=null;o=!0;let v=_=>{_.preventDefault();let w=e.getBoundingClientRect(),S=_.clientX-w.left,k=_.clientY-w.top;g==!1&&i!=null&&(S-h)*(S-h)+(k-d)*(k-d)>c*c&&(g=!0,y=i({x:h,y:d},yk(u))),g&&y?.move!=null&&y.move({x:S,y:k})},b=()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b),o=!1,g&&y?.release!=null&&y.release(),g||r&&r({x:h,y:d},yk(u))};window.addEventListener("mousemove",v),window.addEventListener("mouseup",b)},mousemove:u=>{if(s==null||o||a)return;let f=e.getBoundingClientRect(),h=u.clientX-f.left,d=u.clientY-f.top;l={x:h,y:d},s({x:h,y:d})},mouseleave:()=>{l!=null&&s!=null&&(l=null,s(null))},preventHover:u=>{u!=a&&(u&&l!=null&&s!=null&&(l=null,s(null)),a=u)}}}function IAt(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function RAt(e){return"M "+e.map(({x:t,y:n})=>`${t},${n}`).join(" L ")+" Z"}function fY(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let{x:s,y:o}of e)t=Math.min(t,s),r=Math.min(r,o),n=Math.max(n,s),i=Math.max(i,o);return{xMin:t,yMin:r,xMax:n,yMax:i}}async function CAt(e){let t=JSON.stringify(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-1",n);return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}function kf(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t.hasOwnProperty(n)){if(!kf(e[n],t[n]))return!1}else return!1;return!0}var NAt=Vu("");function $At(e,t){dp(t,!0);let n=oe(()=>t.value.map(({x:i,y:s})=>t.pointLocation(i,s)));var r=NAt();kn(r,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)"}),Oo(i=>Kt(r,"d",i),[()=>RAt(X(n))]),Gr(e,r),pp()}const OAt={marquee:"M7 5a2 2 0 1 1-4 0a2 2 0 0 1 4 0m1-.25c0 .414.336.75.75.75h6.5a.75.75 0 0 0 0-1.5h-6.5a.75.75 0 0 0-.75.75M4.75 8a.75.75 0 0 0-.75.75v6.5a.75.75 0 0 0 1.5 0v-6.5A.75.75 0 0 0 4.75 8m14.5 0a.75.75 0 0 0-.75.75v6.5a.75.75 0 0 0 1.5 0v-6.5a.75.75 0 0 0-.75-.75M8.75 20a.75.75 0 0 1 0-1.5h6.5a.75.75 0 0 1 0 1.5zM5 21a2 2 0 1 0 0-4a2 2 0 0 0 0 4M21 5a2 2 0 1 1-4 0a2 2 0 0 1 4 0m-2 16a2 2 0 1 0 0-4a2 2 0 0 0 0 4",lasso:"M9.703 2.265A10 10 0 0 1 12 2c.79 0 1.559.092 2.297.265a.75.75 0 1 1-.343 1.46A8.5 8.5 0 0 0 12 3.5a8.6 8.6 0 0 0-1.954.225a.75.75 0 1 1-.343-1.46m-1.93 1.47a.75.75 0 0 1-.242 1.033a8.55 8.55 0 0 0-2.763 2.763a.75.75 0 1 1-1.275-.79a10.05 10.05 0 0 1 3.248-3.248a.75.75 0 0 1 1.032.243m8.454 0a.75.75 0 0 1 1.032-.242a10.05 10.05 0 0 1 3.248 3.248a.75.75 0 1 1-1.275.79a8.55 8.55 0 0 0-2.763-2.763a.75.75 0 0 1-.242-1.032m-13.06 5.41a.75.75 0 0 1 .558.901A8.5 8.5 0 0 0 3.5 12c0 .673.078 1.327.225 1.954a.75.75 0 1 1-1.46.343A10 10 0 0 1 2 12c0-.79.092-1.559.265-2.297a.75.75 0 0 1 .902-.559m17.666 0a.75.75 0 0 1 .902.558a10.1 10.1 0 0 1 0 4.595a.75.75 0 1 1-1.46-.343a8.54 8.54 0 0 0-.001-3.908a.75.75 0 0 1 .559-.902M3.736 16.226a.75.75 0 0 1 1.032.242a8.55 8.55 0 0 0 2.763 2.763a.75.75 0 0 1-.79 1.275a10.05 10.05 0 0 1-3.248-3.248a.75.75 0 0 1 .243-1.032m16.685.858a.75.75 0 1 0-1.342-.67l-.002.004l-.015.029l-.069.123a8 8 0 0 1-.289.466a9.6 9.6 0 0 1-.965 1.219c-1.17-1.073-2.756-2.006-4.74-2.006c-2.347 0-3.99 1.203-3.99 2.875S10.653 22 13 22c1.942 0 3.495-.75 4.658-1.645a11.7 11.7 0 0 1 1.315 2.01q.05.099.073.149l.017.035l.004.009a.75.75 0 0 0 1.368-.615c-.087-.183 0-.001 0-.001v-.002l-.003-.004l-.007-.015l-.024-.052l-.091-.184a13.2 13.2 0 0 0-1.538-2.337a11 11 0 0 0 1.525-2.032l.09-.162l.024-.047l.007-.014l.002-.005zM13 17.75c1.433 0 2.644.652 3.616 1.512c-.95.7-2.155 1.238-3.616 1.238c-1.973 0-2.49-.922-2.49-1.375s.517-1.375 2.49-1.375"};var LAt=Vu(''),DAt=gh("");function bL(e,t){let n=ae(t,"active",3,!1);var r=DAt();r.__click=function(...a){t.onClick?.apply(this,a)};let i;var s=Oi(r);{var o=a=>{var l=LAt();kn(l,"",{},{width:"14px",height:"14px"});var c=Oi(l);kn(c,"",{},{fill:"currentColor"}),mi(l),Oo(()=>Kt(c,"d",OAt[t.icon])),Gr(a,l)};Ks(s,a=>{t.icon!=null&&a(o)})}mi(r),Oo(a=>{Kt(r,"title",t.title),i=kn(r,"",i,a)},[()=>({border:"none",appearance:"none",background:n()?"color-mix(in srgb, currentColor 20%, transparent)":"none","border-radius":"2px",height:"16px",width:"16px",padding:"0",margin:"0","font-family":"inherit","font-size":"1em",color:"currentColor",display:"flex","flex-direction":"row","align-items":"center","justify-content":"center"})]),Gr(e,r)}HI(["click"]);var FAt=gh('
    ');function BAt(e,t){function n(h,d){let g=Math.log10(d*h),y=Math.round(g),v=[.1,.2,.5,1,2,5,10],b=0,_=1e10;for(let w of v){let S=Math.abs(Math.log10(w)+y-g);S<_&&(b=w,_=S)}return b*Math.pow(10,y)}let r=oe(()=>n(t.distancePerPoint,30)),i=oe(()=>X(r)/t.distancePerPoint);var s=FAt();kn(s,"",{},{display:"flex","align-items":"center"});var o=Oi(s);kn(o,"",{},{"padding-right":"4px"});var a=Oi(o,!0);mi(o);var l=Nr(o,2),c=Oi(l);Kt(c,"x1",1),Kt(c,"y1",3),Kt(c,"y2",3),kn(c,"",{},{stroke:"currentColor","stroke-width":"2","stroke-cap":"butt"});var u=Nr(c);Kt(u,"x1",1),Kt(u,"x2",1),Kt(u,"y1",0),Kt(u,"y2",6),kn(u,"",{},{stroke:"currentColor"});var f=Nr(u);Kt(f,"y1",0),Kt(f,"y2",6),kn(f,"",{},{stroke:"currentColor"}),mi(l),mi(s),Oo(h=>{Uy(a,h),Kt(l,"width",`${X(i)+2}px`),Kt(c,"x2",X(i)+1),Kt(f,"x1",X(i)+1),Kt(f,"x2",X(i)+1)},[()=>X(r).toLocaleString()]),Gr(e,s)}var PAt=gh("
    "),UAt=gh('
    ',1),zAt=gh('
    ');function qAt(e,t){dp(t,!0);let n=ae(t,"statusMessage",3,null);var r=zAt();let i;var s=Oi(r);let o;var a=Oi(s);{var l=w=>{var S=PAt();kn(S,"",{},{display:"inline-block"});var k=Oi(S,!0);mi(S),Oo(()=>Uy(k,n())),Gr(w,S)};Ks(a,w=>{n()!=null&&w(l)})}mi(s);var c=Nr(s,2);kn(c,"",{},{flex:"1 1 0%"});var u=Nr(c,2);let f;var h=Oi(u);{var d=w=>{var S=UAt(),k=g0(S);kn(k,"",{},{color:"currentColor","text-decoration":"underline"});var A=Oi(k,!0);mi(k),L3t(2),Oo(()=>{Kt(k,"href",t.resolvedTheme.brandingLink.href),Uy(A,t.resolvedTheme.brandingLink.text)}),Gr(w,S)};Ks(h,w=>{t.resolvedTheme.brandingLink!=null&&w(d)})}var g=Nr(h,2);{let w=oe(()=>t.selectionMode=="marquee");bL(g,{icon:"marquee",get active(){return X(w)},title:"Toggle rectangle selection mode. In normal mode, use shift + drag for rectangle selection.",onClick:()=>t.onSelectionMode(t.selectionMode=="marquee"?"none":"marquee")})}var y=Nr(g,2);{let w=oe(()=>t.selectionMode=="lasso");bL(y,{icon:"lasso",get active(){return X(w)},title:"Toggle lasso selection mode. In normal mode, use shift + meta + drag for lasso selection.",onClick:()=>t.onSelectionMode(t.selectionMode=="lasso"?"none":"lasso")})}var v=Nr(y,4);BAt(v,{get distancePerPoint(){return t.distancePerPoint}});var b=Nr(v,4),_=Oi(b);mi(b),mi(u),mi(r),Oo((w,S,k,A)=>{i=kn(r,"",i,w),o=kn(s,"",o,S),f=kn(u,"",f,k),Uy(_,`${A??""} points`)},[()=>({"font-size":"12px","line-height":"20px",height:"20px",color:t.resolvedTheme.statusBarTextColor,position:"absolute",bottom:"0px",left:"0px",right:"0px","user-select":"none","font-family":t.resolvedTheme.fontFamily,display:"flex","flex-direction":"row"}),()=>({flex:"none",display:"flex","flex-direction":"row",gap:"4px",padding:"0px 4px","border-radius":"2px",background:t.resolvedTheme.statusBarBackgroundColor}),()=>({flex:"none",display:"flex","flex-direction":"row","align-items":"center",gap:"4px",padding:"0px 4px","border-radius":"2px",background:t.resolvedTheme.statusBarBackgroundColor}),()=>t.pointCount.toLocaleString()]),Gr(e,r),pp()}function jAt(e){return(t,n)=>{let r=new e(t,n);return{...r.update?{update:r.update.bind(r)}:{},...r.destroy?{destroy:r.destroy.bind(r)}:{}}}}let vk=new WeakMap;function hY(e){let t=typeof e=="function"?e:e.class;if(vk.has(t))return vk.get(t);{let n=jAt(t);return vk.set(t,n),n}}function dY(e,t){return typeof e=="function"?t:{...e.props??{},...t}}var VAt=gh("
    ");function WAt(e,t){dp(t,!0);let n=ae(t,"margin",3,4),r,i,s=oe(()=>hY(t.customTooltip)),o=oe(()=>dY(t.customTooltip,{tooltip:t.tooltip}));GI(()=>{qx(()=>{let c=X(s),u=null;return qx(()=>{i.style.left="0px",i.style.top="0px",i.style.pointerEvents=t.allowInteraction?"all":"none",u==null?u=c(i,X(o)):u.update?.(X(o));function f(v,b,_,w){let S=t.location.x,k=t.location.y,A=2,T=v/2,M=b+(t.targetHeight+n());S-T<_&&(T=S-_),S-T>w-v&&(T=S-w+v),k-M{y=null;let v=i.getBoundingClientRect();(v.width!=d||v.height!=g)&&f(v.width,v.height,2,h.width-2)});return()=>{y!=null&&cancelAnimationFrame(y)}}),()=>{u?.destroy?.(),i.replaceChildren()}})});var a=VAt();kn(a,"",{},{position:"absolute",width:"100%"});var l=Oi(a);kn(l,"",{},{display:"flex",position:"absolute",width:"fit-content",height:"fit-content","z-index":"100"}),K4(l,c=>i=c,()=>i),mi(a),K4(a,c=>r=c,()=>r),Gr(e,a),pp()}function XI(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pY(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function $1(){}var Nv=.7,jx=1/Nv,j0="\\s*([+-]?\\d+)\\s*",$v="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",uc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YAt=/^#([0-9a-f]{3,8})$/,HAt=new RegExp(`^rgb\\(${j0},${j0},${j0}\\)$`),GAt=new RegExp(`^rgb\\(${uc},${uc},${uc}\\)$`),XAt=new RegExp(`^rgba\\(${j0},${j0},${j0},${$v}\\)$`),KAt=new RegExp(`^rgba\\(${uc},${uc},${uc},${$v}\\)$`),JAt=new RegExp(`^hsl\\(${$v},${uc},${uc}\\)$`),ZAt=new RegExp(`^hsla\\(${$v},${uc},${uc},${$v}\\)$`),_L={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};XI($1,KI,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wL,formatHex:wL,formatHex8:QAt,formatHsl:tEt,formatRgb:xL,toString:xL});function wL(){return this.rgb().formatHex()}function QAt(){return this.rgb().formatHex8()}function tEt(){return mY(this).formatHsl()}function xL(){return this.rgb().formatRgb()}function KI(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=YAt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?SL(t):n===3?new lo(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?m_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?m_(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=HAt.exec(e))?new lo(t[1],t[2],t[3],1):(t=GAt.exec(e))?new lo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=XAt.exec(e))?m_(t[1],t[2],t[3],t[4]):(t=KAt.exec(e))?m_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=JAt.exec(e))?kL(t[1],t[2]/100,t[3]/100,1):(t=ZAt.exec(e))?kL(t[1],t[2]/100,t[3]/100,t[4]):_L.hasOwnProperty(e)?SL(_L[e]):e==="transparent"?new lo(NaN,NaN,NaN,0):null}function SL(e){return new lo(e>>16&255,e>>8&255,e&255,1)}function m_(e,t,n,r){return r<=0&&(e=t=n=NaN),new lo(e,t,n,r)}function eEt(e){return e instanceof $1||(e=KI(e)),e?(e=e.rgb(),new lo(e.r,e.g,e.b,e.opacity)):new lo}function gY(e,t,n,r){return arguments.length===1?eEt(e):new lo(e,t,n,r??1)}function lo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}XI(lo,gY,pY($1,{brighter(e){return e=e==null?jx:Math.pow(jx,e),new lo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nv:Math.pow(Nv,e),new lo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new lo(vd(this.r),vd(this.g),vd(this.b),Vx(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:AL,formatHex:AL,formatHex8:nEt,formatRgb:EL,toString:EL}));function AL(){return`#${rd(this.r)}${rd(this.g)}${rd(this.b)}`}function nEt(){return`#${rd(this.r)}${rd(this.g)}${rd(this.b)}${rd((isNaN(this.opacity)?1:this.opacity)*255)}`}function EL(){const e=Vx(this.opacity);return`${e===1?"rgb(":"rgba("}${vd(this.r)}, ${vd(this.g)}, ${vd(this.b)}${e===1?")":`, ${e})`}`}function Vx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rd(e){return e=vd(e),(e<16?"0":"")+e.toString(16)}function kL(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new nl(e,t,n,r)}function mY(e){if(e instanceof nl)return new nl(e.h,e.s,e.l,e.opacity);if(e instanceof $1||(e=KI(e)),!e)return new nl;if(e instanceof nl)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,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&l<1?0:o,new nl(o,a,l,e.opacity)}function rEt(e,t,n,r){return arguments.length===1?mY(e):new nl(e,t,n,r??1)}function nl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}XI(nl,rEt,pY($1,{brighter(e){return e=e==null?jx:Math.pow(jx,e),new nl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nv:Math.pow(Nv,e),new nl(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 lo(bk(e>=240?e-240:e+120,i,r),bk(e,i,r),bk(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new nl(TL(this.h),y_(this.s),y_(this.l),Vx(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=Vx(this.opacity);return`${e===1?"hsl(":"hsla("}${TL(this.h)}, ${y_(this.s)*100}%, ${y_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function TL(e){return e=(e||0)%360,e<0?e+360:e}function y_(e){return Math.max(0,Math.min(1,e||0))}function bk(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 ML=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],v_=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];function Zg(e){if(e<1&&(e=1),e<=ML.length)return ML.slice(0,e);if(e<=v_.length)return v_.slice(0,e);{let t=[];for(let n=0;nt.measureText(i).width),r=(e.fontSize??10)*(e.lineSpacing??1)*n.length;return{width:n.reduce((i,s)=>Math.max(i,s)),height:r}}function yY(){return[1,0,0,0,1,0,0,0,1]}function ZI(e,t){return[e[0]*t[0]+e[3]*t[1]+e[6]*t[2],e[1]*t[0]+e[4]*t[1]+e[7]*t[2],e[2]*t[0]+e[5]*t[1]+e[8]*t[2],e[0]*t[3]+e[3]*t[4]+e[6]*t[5],e[1]*t[3]+e[4]*t[4]+e[7]*t[5],e[2]*t[3]+e[5]*t[4]+e[8]*t[5],e[0]*t[6]+e[3]*t[7]+e[6]*t[8],e[1]*t[6]+e[4]*t[7]+e[7]*t[8],e[2]*t[6]+e[5]*t[7]+e[8]*t[8]]}function vY(e,t){return[t[0]*e[0]+t[3]*e[1]+t[6]*e[2],t[1]*e[0]+t[4]*e[1]+t[7]*e[2],t[2]*e[0]+t[5]*e[1]+t[8]*e[2]]}function oEt(e){return e[0]*e[4]*e[8]-e[0]*e[5]*e[7]-e[1]*e[3]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]}function bY(e){let t=oEt(e);return[(e[4]*e[8]-e[5]*e[7])/t,(e[2]*e[7]-e[1]*e[8])/t,(e[1]*e[5]-e[2]*e[4])/t,(e[5]*e[6]-e[3]*e[8])/t,(e[0]*e[8]-e[2]*e[6])/t,(e[2]*e[3]-e[0]*e[5])/t,(e[3]*e[7]-e[4]*e[6])/t,(e[1]*e[6]-e[0]*e[7])/t,(e[0]*e[4]-e[1]*e[3])/t]}class Wx{viewport;width;height;_matrix=[0,0,0,0,0,0,0,0,0];_pixel_kx=0;_pixel_bx=0;_pixel_ky=0;_pixel_by=0;constructor(t,n,r){this.viewport=t,this.width=n,this.height=r,this.updateCoefficients()}update(t,n,r){this.viewport=t,this.width=n,this.height=r,this.updateCoefficients()}updateCoefficients(){let{x:t,y:n,scale:r}=this.viewport,i=r,s=r;this.width({x:s*t+r,y:o*n+i})}coordinateAtPixelFunction(){let t=this._pixel_kx,n=this._pixel_ky,r=this._pixel_bx,i=this._pixel_by;return(s,o)=>({x:(s-r)/t,y:(o-i)/n})}}class J4{_needsRun=!0;_inputs=new Set;_targets=new Set;constructor(t=[]){this._inputs=new Set(t);for(let n of this._inputs)n._targets.add(this)}addInput(t){this._inputs.add(t),t._targets.add(this)}removeInput(t){t._targets.delete(this),this._inputs.delete(t)}run(){if(this._needsRun){for(let t of this._inputs)t.run();this.update(),this._needsRun=!1}}setNeedsRunDownstream(){for(let t of this._targets)t._needsRun||(t._needsRun=!0,t.setNeedsRunDownstream())}update(){}destroy(){for(let t of this._inputs)t._targets.delete(this)}}let Qg=class extends J4{_value=null;setValue(e){this._value!==e&&(this._value=e,this.setNeedsRunDownstream())}get value(){return this.run(),this._value}};class _Y extends Qg{constructor(t){super([]),this.setValue(t)}get value(){return super.value}set value(t){this.setValue(t)}}class aEt extends Qg{fn;constructor(t,n){super(n),this.fn=t}update(){this.setValue(this.fn())}}class lEt extends Qg{fn;state;constructor(t,n){super(n),this.fn=t,this.state={}}update(){this.setValue(this.fn(this.state))}destroy(){super.destroy(),this.state.destroy&&this.state.destroy(),this.state={}}}class cEt extends Qg{parent;condition;buildTrue;buildFalse;context=null;currentCondition=null;currentNode=null;constructor(t,n,r,i){super([n]),this.parent=t,this.condition=n,this.buildTrue=r,this.buildFalse=i}update(){(this.currentNode==null||this.currentCondition!==this.condition.value)&&(this.currentNode&&this.removeInput(this.currentNode),this.context?.destroy(),this.context=new O1(this.parent),this.currentCondition=this.condition.value,this.currentCondition?this.currentNode=this.buildTrue(this.context):this.currentNode=this.buildFalse(this.context),this.addInput(this.currentNode)),this.setValue(this.currentNode.value)}destroy(){super.destroy(),this.context?.destroy()}}class uEt extends Qg{parent;input;build;cache;constructor(t,n,r){super([n]),this.parent=t,this.input=n,this.build=r,this.cache=new Map}update(){let t=new Set,n=this.input.value.map(r=>{if(t.add(r),this.cache.has(r)){let i=this.cache.get(r);return i.input.value=r,i.output.value}else{let i=new O1(this.parent),s=new _Y(r),o=this.build(i,s);return this.cache.set(r,{context:i,input:s,output:o}),this.addInput(o),o.value}});for(let[r,i]of this.cache)t.has(r)||(this.cache.delete(r),this.removeInput(i.output),i.context.destroy());this.setValue(n)}destroy(){super.destroy();for(let t of this.cache.values())t.context.destroy()}}class fEt extends Qg{parent;input;cases;currentCase=null;currentNode=null;currentContext=null;constructor(t,n,r){super([n]),this.parent=t,this.input=n,this.cases=r}update(){(this.currentNode==null||this.input.value!==this.currentCase)&&(this.currentNode&&this.removeInput(this.currentNode),this.currentContext?.destroy(),this.currentContext=new O1(this.parent),this.currentCase=this.input.value,this.currentNode=this.cases[this.currentCase](this.currentContext),this.addInput(this.currentNode)),this.setValue(this.currentNode.value)}destroy(){super.destroy(),this.currentContext?.destroy()}}let O1=class wY{_children;_nodes;constructor(t=null){this._children=new Set,this._nodes=new Set,t?._children.add(this)}destroy(){for(let t of this._children)t.destroy();for(let t of this._nodes)t.destroy();this._children.clear(),this._nodes.clear()}value(t){let n=new _Y(t);return this._nodes.add(n),n}derive(t,n){let r=t.map(s=>s instanceof J4?s:this.value(s)),i=new aEt(()=>n(...r.map(s=>s.value)),r);return this._nodes.add(i),i}statefulDerive(t,n){let r=t.map(s=>s instanceof J4?s:this.value(s)),i=new lEt(s=>n(s,...r.map(o=>o.value)),r);return this._nodes.add(i),i}if(t,n,r){let i=new cEt(this,t,n,r);return this._nodes.add(i),i}switch(t,n){let r=new fEt(this,t,n);return this._nodes.add(r),r}map(t,n){let r=new uEt(this,t,n);return this._nodes.add(r),r}assertNotNull(t){return t}subgraph(){return new wY(this)}};function _c(e,t,n,r){if(e.program==null||e.vsSource!=n||e.fsSource!=r){e.destroy&&e.destroy();let s=IL(t,t.VERTEX_SHADER,n),o=IL(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,s),t.attachShader(a,o),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS)){var i=t.getProgramInfoLog(a);throw new Error(`failed to link program: ${i}, vertex source: ${n}, fragment source: ${r}`)}e.program=a,e.vsSource=n,e.fsSource=r,e.destroy=()=>{t.deleteProgram(a),t.deleteShader(s),t.deleteShader(o)},e.uniforms={};for(let l of(n+r).matchAll(/uniform +[0-9a-zA-Z_]+ +([0-9a-zA-Z_]+) *(;|\[)/g)){let c=l[1];e.uniforms[c]=t.getUniformLocation(a,c)}}return{program:e.program,uniforms:e.uniforms??{}}}function IL(e,t,n){let r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){var i=e.getShaderInfoLog(r);throw new Error(`failed to compile shader: ${i}, source: ${n}`)}return r}function fc(e,t,n,r){if(e.buffer==null){let i=t.createBuffer();e.buffer=i,e.destroy=()=>{t.deleteBuffer(i)}}if(e.data!==n){if(e.data=n,t.bindBuffer(t.ARRAY_BUFFER,e.buffer),n instanceof Array)switch(r??"f32"){case"f32":t.bufferData(t.ARRAY_BUFFER,new Float32Array(n),t.STATIC_DRAW);break;case"i32":t.bufferData(t.ARRAY_BUFFER,new Int32Array(n),t.STATIC_DRAW);break;case"u32":t.bufferData(t.ARRAY_BUFFER,new Uint32Array(n),t.STATIC_DRAW);break;case"i16":t.bufferData(t.ARRAY_BUFFER,new Int16Array(n),t.STATIC_DRAW);break;case"u16":t.bufferData(t.ARRAY_BUFFER,new Uint16Array(n),t.STATIC_DRAW);break;case"i8":t.bufferData(t.ARRAY_BUFFER,new Int8Array(n),t.STATIC_DRAW);break;case"u8":t.bufferData(t.ARRAY_BUFFER,new Uint8Array(n),t.STATIC_DRAW);break;default:throw new Error("invalid type")}else t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW);t.bindBuffer(t.ARRAY_BUFFER,null)}return e.buffer}function hEt(e,t,n,r,i){const s={u8:{1:[e.R8,e.RED,e.UNSIGNED_BYTE],2:[e.RG8,e.RG,e.UNSIGNED_BYTE],3:[e.RGB8,e.RGB,e.UNSIGNED_BYTE],4:[e.RGBA8,e.RGBA,e.UNSIGNED_BYTE]},u16:{1:[e.R8,e.RED,e.UNSIGNED_SHORT],2:[e.RG8,e.RG,e.UNSIGNED_SHORT],3:[e.RGB8,e.RGB,e.UNSIGNED_SHORT],4:[e.RGBA8,e.RGBA,e.UNSIGNED_SHORT]},u32:{1:[e.R8,e.RED,e.UNSIGNED_INT],2:[e.RG8,e.RG,e.UNSIGNED_INT],3:[e.RGB8,e.RGB,e.UNSIGNED_INT],4:[e.RGBA8,e.RGBA,e.UNSIGNED_INT]},f32:{1:[e.R32F,e.RED,e.FLOAT],2:[e.RG32F,e.RG,e.FLOAT],3:[e.RGB32F,e.RGB,e.FLOAT],4:[e.RGBA32F,e.RGBA,e.FLOAT]}};let[o,a,l]=s[i][r];e.texImage2D(e.TEXTURE_2D,0,o,t,n,0,a,l,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}function Tf(e,t,n,r,i,s){if(e.framebuffer==null||e.texture==null){let a=t.createFramebuffer(),l=t.createTexture();t.bindFramebuffer(t.FRAMEBUFFER,a),t.bindTexture(t.TEXTURE_2D,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,l,0),t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),e.framebuffer=a,e.texture=l,e.destroy=()=>{t.deleteFramebuffer(a),t.deleteTexture(l)}}let o=`${n},${r},${i},${s}`;return e.cacheKey!=o&&(e.cacheKey=o,t.bindTexture(t.TEXTURE_2D,e.texture),hEt(t,n,r,i,s),t.bindTexture(t.TEXTURE_2D,null)),{framebuffer:e.framebuffer,texture:e.texture,width:n,height:r}}function dEt(e){let t=e.squareMaxSize,n=e.samples,r=`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,i=`#version 300 es + precision highp float; + uniform sampler2D image; + uniform vec2 resolution; + uniform vec2 direction; + in vec2 uv; + out vec4 outColor; + void main() { + vec4 color = vec4(0.0); + const int count = ${t}; + int i = -count; + while(i + 1 <= count) { + color += texture(image, uv + direction * (float(i) + 0.5) / resolution) * 2.0; + i += 2; + } + if (i <= count) { + color += texture(image, uv + direction * float(count) / resolution); + } + outColor = color; + } + `,s=`#version 300 es + precision highp float; + uniform sampler2D image; + uniform sampler2D imageBox; + uniform vec2 resolution; + uniform float scaler; + in vec2 uv; + out vec4 outColor; + + void main() { + vec4 color = texture(imageBox, uv); + if (color != vec4(0.0)) { + ${n.map(({x:o,y:a,w:l})=>`color -= texture(image, uv + vec2(${o.toFixed(8)}, ${a.toFixed(8)}) / resolution) * (${l.toFixed(8)})`).join(";")}; + } + outColor = color * scaler; + } + `;return{vertex:r,fragment1:i,fragment2:s}}function pEt(e,t,n){let r=e.derive([n],gEt),i=e.derive([r],dEt),s=e.statefulDerive([t,e.derive([i],l=>l.vertex),e.derive([i],l=>l.fragment1)],_c),o=e.statefulDerive([t,e.derive([i],l=>l.vertex),e.derive([i],l=>l.fragment2)],_c),a=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,a,s,o,n,r],(l,c,u,f,h,d)=>(g,y,v)=>{let{width:b,height:_}=y;l.disable(l.BLEND),l.enableVertexAttribArray(0),l.bindBuffer(l.ARRAY_BUFFER,c),l.vertexAttribPointer(0,2,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,null),l.useProgram(u.program),l.uniform2f(u.uniforms.resolution,b,_),l.uniform1i(u.uniforms.image,0),l.bindFramebuffer(l.FRAMEBUFFER,y.framebuffer),l.bindTexture(l.TEXTURE_2D,g),l.uniform2f(u.uniforms.direction,0,1),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,v.framebuffer),l.bindTexture(l.TEXTURE_2D,y.texture),l.uniform2f(u.uniforms.direction,1,0),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,y.framebuffer),l.activeTexture(l.TEXTURE1),l.bindTexture(l.TEXTURE_2D,v.texture),l.activeTexture(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,g),l.useProgram(f.program),l.uniform2f(f.uniforms.resolution,b,_),l.uniform1i(f.uniforms.image,0),l.uniform1i(f.uniforms.imageBox,1);let w=1/d.totalWeight*h*h*Math.PI;l.uniform1f(f.uniforms.scaler,w),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,null),l.useProgram(null),l.activeTexture(l.TEXTURE1),l.bindTexture(l.TEXTURE_2D,null),l.activeTexture(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,null),l.disableVertexAttribArray(0)})}function RL(e,t,n){let r=Math.sqrt(t*t+n*n);if(re+Math.sqrt(2)/2)return 0;let i=2,s=0;for(let o=0;o0&&a==i[i.length-1].x&&l==i[i.length-1].y+1){let u=i[i.length-1].w,f=c;i[i.length-1].y+=1-u/(u+f),i[i.length-1].w=u+f}else i.push({x:a,y:l,w:c})}i=i.sort((a,l)=>a.y!=l.y?a.y-l.y:a.x-l.x);let s=[];for(let{x:a,y:l,w:c}of i)if(s.length>0&&l==s[s.length-1].y&&a==s[s.length-1].x+1){let u=s[s.length-1].w,f=c;s[s.length-1].x+=1-u/(u+f),s[s.length-1].w=u+f}else s.push({x:a,y:l,w:c});let o=-s.reduce((a,l)=>a+l.w,0);return o+=r*(1+n*2)*(1+n*2),{squareMaxSize:n,squareWeight:r,samples:s,totalWeight:o}}function mEt(e){let t;return e?t=`#version 300 es + precision highp float; + uniform mat3 matrix; + layout(location=0) in float x; + layout(location=1) in float y; + layout(location=2) in int category; + out vec4 color; + void main() { + gl_Position = vec4(matrix * vec3(x, y, 1), 1); + if (category == 0) { + color = vec4(1, 0, 0, 0); + } else if (category == 1) { + color = vec4(0, 1, 0, 0); + } else if (category == 2) { + color = vec4(0, 0, 1, 0); + } else if (category == 3) { + color = vec4(0, 0, 0, 1); + } + gl_PointSize = 1.0; + } + `:t=`#version 300 es + precision highp float; + uniform mat3 matrix; + layout(location=0) in float x; + layout(location=1) in float y; + out vec4 color; + void main() { + gl_Position = vec4(matrix * vec3(x, y, 1), 1); + color = vec4(1, 0, 0, 0); + gl_PointSize = 1.0; + } + `,{vertex:t,fragment:`#version 300 es + precision highp float; + in vec4 color; + out vec4 outColor; + void main() { + outColor = color; + } + `}}function Z4(e,t,n,r,i,s){let o=i!=null,a=mEt(o),l=e.statefulDerive([t,a.vertex,a.fragment],_c);return e.derive([t,l,n,r,i,s],(c,u,f,h,d,g)=>y=>{c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE),c.useProgram(u.program),c.enableVertexAttribArray(0),c.bindBuffer(c.ARRAY_BUFFER,f),c.vertexAttribPointer(0,1,c.FLOAT,!1,0,0),c.enableVertexAttribArray(1),c.bindBuffer(c.ARRAY_BUFFER,h),c.vertexAttribPointer(1,1,c.FLOAT,!1,0,0),d!=null&&(c.enableVertexAttribArray(2),c.bindBuffer(c.ARRAY_BUFFER,d),c.vertexAttribIPointer(2,1,c.BYTE,0,0)),c.bindBuffer(c.ARRAY_BUFFER,null),c.uniformMatrix3fv(u.uniforms.matrix,!1,y),c.drawArrays(c.POINTS,0,g),c.disableVertexAttribArray(0),c.disableVertexAttribArray(1),d!=null&&c.disableVertexAttribArray(2),c.useProgram(null)})}function yEt(){return{vertex:`#version 300 es + precision highp float; + uniform vec2 xyScaler; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy * xyScaler, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,fragment:`#version 300 es + precision highp float; + uniform sampler2D source; + uniform float gamma; + in vec2 uv; + out vec4 outColor; + void main() { + vec4 color = texture(source, uv); + color.rgb = pow(color.rgb, vec3(1.0 / gamma)); + outColor = color; + } + `}}function xY(e,t){let{vertex:n,fragment:r}=yEt(),i=e.statefulDerive([t,n,r],_c),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,i,s],(o,a,l)=>(c,u,f,h)=>{o.disable(o.BLEND),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,c),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.xyScaler,f??1,h??1),o.uniform1f(a.uniforms.gamma,u??2.2),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function SY(e){return Math.ceil(e*3)}function vEt(e){let t=SY(e),n=[];for(let a=-t;a<=t;a++)n.push(Math.exp(-a*a/e/e/2));let r=n.reduce((a,l)=>a+l,0);n=n.map(a=>a/r);let i=_Et(n).map(([a,l])=>[a-t,l]),s=`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,o=`#version 300 es + precision highp float; + uniform sampler2D image; + uniform vec2 resolution; + uniform vec2 direction; + in vec2 uv; + out vec4 outColor; + + void main() { + vec4 color = vec4(0.0); + ${i.map(([a,l])=>`color += texture(image, uv + direction * vec2(${a.toFixed(10)}) / resolution) * ${l.toFixed(10)};`).join(` +`)} + outColor = color; + } + `;return{vertex:s,fragment:o}}function bEt(e,t,n){let r=e.derive([n],vEt),i=e.statefulDerive([t,e.derive([r],o=>o.vertex),e.derive([r],o=>o.fragment)],_c),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,s,i,n],(o,a,l,c)=>(u,f,h)=>{let{width:d,height:g}=f;o.disable(o.BLEND),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,a),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.useProgram(l.program),o.uniform2f(l.uniforms.resolution,d,g),o.uniform1i(l.uniforms.image,0),o.bindFramebuffer(o.FRAMEBUFFER,h.framebuffer),o.bindTexture(o.TEXTURE_2D,u),o.uniform2f(l.uniforms.direction,0,1),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.bindFramebuffer(o.FRAMEBUFFER,f.framebuffer),o.bindTexture(o.TEXTURE_2D,h.texture),o.uniform2f(l.uniforms.direction,1,0),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.bindFramebuffer(o.FRAMEBUFFER,null),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function _Et(e){let t=[];for(let n=0;n=0&&s<=1){let o=r+i;o!=0&&t.push([n+s,o])}else t.push([n,e[n]]),t.push([n+1,e[n+1]])}else t.push([n,e[n]]);return t}function wEt(e){return Math.ceil(e*3)}function xEt(){return{vertex:`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,fragment:`#version 300 es + precision highp float; + uniform sampler2D image; + uniform vec2 resolution; + uniform vec2 direction; + in vec2 uv; + out vec4 outColor; + + uniform float weight0; + uniform vec3 distances; + uniform vec3 weights; + + void main() { + vec4 color = texture(image, uv) * weight0; + if (weights.x != 0.0) { + color += texture(image, uv + direction * vec2(distances.x) / resolution) * weights.x; + color += texture(image, uv - direction * vec2(distances.x) / resolution) * weights.x; + } + if (weights.y != 0.0) { + color += texture(image, uv + direction * vec2(distances.y) / resolution) * weights.y; + color += texture(image, uv - direction * vec2(distances.y) / resolution) * weights.y; + } + if (weights.z != 0.0) { + color += texture(image, uv + direction * vec2(distances.z) / resolution) * weights.z; + color += texture(image, uv - direction * vec2(distances.z) / resolution) * weights.z; + } + outColor = color; + } + `}}function SEt(e,t,n){let{vertex:r,fragment:i}=xEt(),s=e.statefulDerive([t,r,i],_c),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,o,s],(a,l,c)=>(u,f,h)=>{let{width:d,height:g}=f;a.disable(a.BLEND),a.enableVertexAttribArray(0),a.bindBuffer(a.ARRAY_BUFFER,l),a.vertexAttribPointer(0,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(c.program),a.uniform2f(c.uniforms.resolution,d,g),a.uniform1i(c.uniforms.image,0);let y=u,v=h,b=f;for(let _=0;_<2;_++){a.uniform2f(c.uniforms.direction,_,1-_);for(let[w,S,k]of AEt){a.bindFramebuffer(a.FRAMEBUFFER,v.framebuffer),a.bindTexture(a.TEXTURE_2D,y),a.uniform1fv(c.uniforms.weight0,S),a.uniform3fv(c.uniforms.distances,w),a.uniform3fv(c.uniforms.weights,k),a.drawArrays(a.TRIANGLE_STRIP,0,4),y=v.texture;let A=v;v=b,b=A}}a.bindFramebuffer(a.FRAMEBUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.disableVertexAttribArray(0)})}const AEt=[[[1,2,3],[.2288468365182578],[.18230006506971572,.1356122230111784,.06766429365997693]],[[2,6,10],[.09116254014100238],[.23317759354726447,.18385867277788717,.03738246360434722]],[[3,10,20],[.2950645715317288],[.010918865853671198,.23773695670296047,.10381189167750389]],[[4,16,30],[.20085957073474772],[.14463019087130788,.17934533765938643,.07559468610193185]]];function EEt(){return{vertex:`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,fragment:`#version 300 es + precision highp float; + uniform sampler2D source; + uniform vec2 resolution; + uniform float densityScaler; + uniform float quantizationStep; + uniform vec4 channelMask; + uniform vec4 color; + uniform float globalAlpha; + + in vec2 uv; + out vec4 outColor; + + float sample_density(vec2 uv) { + float d = dot(texture(source, uv), channelMask) * densityScaler; + d = min(1.0, max(0.0, d)); + d = floor(d / quantizationStep); + return d; + } + + void main() { + // Run the Sobel operator. + float v = sample_density(uv); + float v11 = sample_density(uv + vec2(-1, -1) / resolution); + float v12 = sample_density(uv + vec2(-1, 0) / resolution); + float v13 = sample_density(uv + vec2(-1, +1) / resolution); + float v21 = sample_density(uv + vec2( 0, -1) / resolution); + float v23 = sample_density(uv + vec2( 0, +1) / resolution); + float v31 = sample_density(uv + vec2(+1, -1) / resolution); + float v32 = sample_density(uv + vec2(+1, 0) / resolution); + float v33 = sample_density(uv + vec2(+1, +1) / resolution); + float gx = v11 + v12 * 2.0 + v13 - v31 - v32 * 2.0 - v33; + float gy = v11 + v21 * 2.0 + v31 - v13 - v23 * 2.0 - v33; + // Derive alpha value from the result. + float alpha = length(vec2(gx, gy)) * 0.2; + alpha = min(1.0, max(0.0, alpha)); + outColor = color * alpha * globalAlpha; + } + `}}function kEt(e,t){let{vertex:n,fragment:r}=EEt(),i=e.statefulDerive([t,n,r],_c),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,i,s],(o,a,l)=>(c,u,f,h,d,g)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,c.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,c.width,c.height),o.uniform1f(a.uniforms.densityScaler,u),o.uniform1f(a.uniforms.quantizationStep,f),o.uniform1f(a.uniforms.globalAlpha,h),o.uniform4fv(a.uniforms.channelMask,d),o.uniform4fv(a.uniforms.color,g),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function TEt(){return{vertex:`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,fragment:`#version 300 es + precision highp float; + uniform sampler2D source; + uniform vec2 resolution; + uniform float densityScaler; + uniform float quantizationStep; + + uniform mat4 colorMatrix; + uniform int isDarkMode; + uniform float globalAlpha; + + in vec2 uv; + out vec4 outColor; + + /* Combine alphas with symmetric blending equation f(a, b) = a + b - ab. */ + float combine_alphas(vec4 alphas) { + float r = alphas.x + alphas.y - alphas.x * alphas.y; + r = r + alphas.z - r * alphas.z; + r = r + alphas.w - r * alphas.w; + return r; + } + + void main() { + vec4 density = texture(source, uv) * densityScaler; + + if (density.x > 1.0 || density.y > 1.0 || density.z > 1.0 || density.w > 1.0) { + density = density / max(max(max(density.x, density.y), density.z), density.w); + } else { + density = floor(density / quantizationStep) * quantizationStep; + } + + if (density.x + density.y + density.z + density.w == 0.0) { + discard; + } + + float alpha = combine_alphas(density); + + density *= alpha / (density.x + density.y + density.z + density.w); + + vec3 c1 = colorMatrix[0].rgb * density.x; + vec3 c2 = colorMatrix[1].rgb * density.y; + vec3 c3 = colorMatrix[2].rgb * density.z; + vec3 c4 = colorMatrix[3].rgb * density.w; + vec3 c; + + if (isDarkMode == 0) { + c = vec3(1.0) - alpha + c1 + c2 + c3 + c4; + } else { + c = c1 + c2 + c3 + c4; + } + + outColor = vec4(c, 1.0) * alpha * globalAlpha; + } + `}}function MEt(e,t){let{vertex:n,fragment:r}=TEt(),i=e.statefulDerive([t,n,r],_c),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,i,s],(o,a,l)=>(c,u,f,h,d,g)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,c.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,c.width,c.height),o.uniform1f(a.uniforms.densityScaler,u),o.uniform1f(a.uniforms.quantizationStep,f),o.uniform1f(a.uniforms.globalAlpha,h),o.uniform1i(a.uniforms.isDarkMode,g=="dark"?1:0),o.uniformMatrix4fv(a.uniforms.colorMatrix,!1,d),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function IEt(e){let t;return e?t=`#version 300 es + precision highp float; + uniform mat3 matrix; + uniform float point_size; + uniform float alpha; + uniform vec4 colorScheme[64]; + + layout(location=0) in float x; + layout(location=1) in float y; + layout(location=2) in int category; + + out vec4 color; + + void main() { + gl_Position = vec4(matrix * vec3(x, y, 1), 1); + if (category < 64) { + color = colorScheme[category]; + } else { + color = vec4(0.5, 0.5, 0.5, 1); + } + color *= alpha; + gl_PointSize = point_size; + } + `:t=`#version 300 es + precision highp float; + uniform mat3 matrix; + uniform float point_size; + uniform vec4 colorScheme; + uniform float alpha; + + layout(location=0) in float x; + layout(location=1) in float y; + + out vec4 color; + + void main() { + gl_Position = vec4(matrix * vec3(x, y, 1), 1); + color = colorScheme; + color *= alpha; + gl_PointSize = point_size; + } + `,{vertex:t,fragment:`#version 300 es + precision highp float; + uniform float point_size; + in vec4 color; + out vec4 outColor; + void main() { + float r = length(gl_PointCoord.xy - vec2(0.5, 0.5)) * point_size; + float a = max(0.0, min(1.0, point_size / 2.0 - r)); + outColor = color * a; + } + `}}function CL(e,t,n,r,i,s){let o=i!=null,a=IEt(o),l=e.statefulDerive([t,a.vertex,a.fragment],_c);return e.derive([t,l,n,r,i,s],(c,u,f,h,d,g)=>(y,v,b,_)=>{c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),c.useProgram(u.program),c.enableVertexAttribArray(0),c.bindBuffer(c.ARRAY_BUFFER,f),c.vertexAttribPointer(0,1,c.FLOAT,!1,0,0),c.enableVertexAttribArray(1),c.bindBuffer(c.ARRAY_BUFFER,h),c.vertexAttribPointer(1,1,c.FLOAT,!1,0,0),d!=null&&(c.enableVertexAttribArray(2),c.bindBuffer(c.ARRAY_BUFFER,d),c.vertexAttribIPointer(2,1,c.BYTE,0,0)),c.bindBuffer(c.ARRAY_BUFFER,null),c.uniformMatrix3fv(u.uniforms.matrix,!1,y),c.uniform1f(u.uniforms.point_size,v*2),c.uniform1f(u.uniforms.alpha,b),o?c.uniform4fv(u.uniforms.colorScheme,_):c.uniform4fv(u.uniforms.colorScheme,_.slice(0,4)),c.drawArrays(c.POINTS,0,g),c.disableVertexAttribArray(0),c.disableVertexAttribArray(1),d!=null&&c.disableVertexAttribArray(2),c.useProgram(null)})}function REt(){return{vertex:`#version 300 es + precision highp float; + layout(location=0) in vec2 xy; + out vec2 uv; + void main() { + gl_Position = vec4(xy, 0, 1); + uv = (xy + 1.0) / 2.0; + } + `,fragment:`#version 300 es + precision highp float; + uniform sampler2D source; + uniform vec2 resolution; + uniform mat4 colorMatrix; + uniform float pointAlpha; + uniform float globalAlpha; + uniform int isDarkMode; + in vec2 uv; + out vec4 outColor; + + /* Combine alphas with symmetric blending equation f(a, b) = a + b - ab. */ + float combine_alphas(vec4 alphas) { + float r = alphas.x + alphas.y - alphas.x * alphas.y; + r = r + alphas.z - r * alphas.z; + r = r + alphas.w - r * alphas.w; + return r; + } + + void main() { + vec4 count = texture(source, uv); + vec4 alphas = pointAlpha >= 0.999 + ? vec4(count.x > 0.0 ? 1.0 : 0.0, count.y > 0.0 ? 1.0 : 0.0, count.z > 0.0 ? 1.0 : 0.0, count.w > 0.0 ? 1.0 : 0.0) + : vec4(1.0) - pow(vec4(1.0 - pointAlpha), count); + float a = combine_alphas(alphas); + if (a <= 0.0) { discard; } + alphas *= a / (alphas.x + alphas.y + alphas.z + alphas.w); + + vec3 c1 = colorMatrix[0].rgb * alphas.x; + vec3 c2 = colorMatrix[1].rgb * alphas.y; + vec3 c3 = colorMatrix[2].rgb * alphas.z; + vec3 c4 = colorMatrix[3].rgb * alphas.w; + vec3 c; + if (isDarkMode == 0) { + c = vec3(1.0) - a + c1 + c2 + c3 + c4; + } else { + c = c1 + c2 + c3 + c4; + } + outColor = vec4(c, 1.0) * a * globalAlpha; + } + `}}function CEt(e,t){let{vertex:n,fragment:r}=REt(),i=e.statefulDerive([t,n,r],_c),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],fc);return e.derive([t,i,s],(o,a,l)=>(c,u,f,h,d)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,c.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,c.width,c.height),o.uniform1f(a.uniforms.pointAlpha,u),o.uniform1f(a.uniforms.globalAlpha,f),o.uniform1i(a.uniforms.isDarkMode,d=="dark"?1:0),o.uniformMatrix4fv(a.uniforms.colorMatrix,!1,h),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}class NEt{props;viewport;df;gl;renderInputs;dataBuffers;renderer;constructor(t,n,r){this.props={mode:"points",colorScheme:"light",x:new Float32Array,y:new Float32Array,category:null,categoryCount:1,categoryColors:null,viewportX:0,viewportY:0,viewportScale:1,pointSize:1,pointAlpha:1,pointsAlpha:1,densityScaler:1,densityBandwidth:1,densityQuantizationStep:.1,contoursAlpha:1,densityAlpha:1,gamma:2.2,width:n,height:r},this.viewport=new Wx({x:0,y:0,scale:1},n,r);let i=new O1,s=i.value(t);this.df=i,this.gl=s,this.renderInputs={mode:i.value(this.props.mode),colorScheme:i.value(this.props.colorScheme),xData:i.value(this.props.x),yData:i.value(this.props.y),categoryData:i.value(this.props.category),categoryCount:i.value(this.props.categoryCount),matrix:i.value(yY()),width:i.value(n),height:i.value(r),pointSize:i.value(this.props.pointSize),densityBandwidth:i.value(this.props.densityBandwidth)},this.dataBuffers=$Et(i,s,this.renderInputs),this.renderer=OEt(i,s,this.renderInputs,this.dataBuffers)}setProps(t){let n=!1,r;for(r in t)t[r]!==this.props[r]&&(this.props[r]=t[r],n=!0);return this.viewport.update({x:this.props.viewportX,y:this.props.viewportY,scale:this.props.viewportScale},this.props.width,this.props.height),this.renderInputs.mode.value=this.props.mode,this.renderInputs.colorScheme.value=this.props.colorScheme,this.renderInputs.xData.value=this.props.x,this.renderInputs.yData.value=this.props.y,this.renderInputs.categoryData.value=this.props.category,this.props.category!=null?this.renderInputs.categoryCount.value=this.props.categoryCount:this.renderInputs.categoryCount.value=1,this.renderInputs.matrix.value=this.viewport.matrix(),this.renderInputs.width.value=this.props.width,this.renderInputs.height.value=this.props.height,this.renderInputs.pointSize.value=this.props.pointSize,this.renderInputs.densityBandwidth.value=this.props.densityBandwidth,n}render(){this.renderer.value(this.props)}destroy(){this.df.destroy()}async densityMap(t,n,r,i){let s=this.df.subgraph(),o=FEt(s,this.gl,this.dataBuffers,s.value(t),s.value(n),s.value(r)),{x:a,y:l,scale:c}=i,u=[c,0,0,0,c,0,-a*c,-l*c,1],f=o.value(u),h=bY(u);return s.destroy(),{data:f,width:t,height:n,coordinateAtPixel:(d,g)=>{let y=d/t*2-1,v=g/n*2-1,b=vY([y,v,1],h);return{x:b[0],y:b[1]}}}}}function $Et(e,t,n){const r=e.statefulDerive([t,n.xData,"f32"],fc),i=e.statefulDerive([t,n.yData,"f32"],fc),s=e.if(e.derive([n.categoryData],a=>a!=null),a=>a.statefulDerive([t,a.assertNotNull(n.categoryData),"u8"],fc),a=>a.value(null)),o=e.derive([n.xData],a=>a.length);return{x:r,y:i,category:s,count:o}}function OEt(e,t,n,r){return e.switch(n.mode,{points:i=>LEt(i,t,n,r),density:i=>DEt(i,t,n,r)})}function LEt(e,t,n,r){const i=e.derive([n.categoryCount],l=>l>1),s=e.statefulDerive([t,n.width,n.height,4,"f32"],Tf);let o=e.if(i,l=>CL(l,t,r.x,r.y,l.assertNotNull(r.category),r.count),l=>CL(l,t,r.x,r.y,null,r.count)),a=xY(e,t);return e.derive([t,s,o,a,n.colorScheme,n.matrix,n.categoryCount],(l,c,u,f,h,d,g)=>y=>{let v=[],b=y.categoryColors??Zg(y.categoryCount);for(let _=0;_wEt(w)+1),s=e.derive([n.width,i],(w,S)=>w+S*2),o=e.derive([n.height,i],(w,S)=>w+S*2);const a=e.derive([n.categoryCount],w=>w>1),l=e.statefulDerive([t,s,o,4,"f32"],Tf),c=e.statefulDerive([t,s,o,4,"f32"],Tf),u=e.statefulDerive([t,s,o,4,"f32"],Tf),f=e.statefulDerive([t,s,o,4,"f32"],Tf);let h=e.if(a,w=>Z4(w,t,r.x,r.y,w.assertNotNull(r.category),r.count),w=>Z4(w,t,r.x,r.y,null,r.count)),d=pEt(e,t,n.pointSize),g=SEt(e,t,n.densityBandwidth),y=CEt(e,t),v=MEt(e,t),b=kEt(e,t),_=xY(e,t);return e.derive([t,l,c,u,f,n.colorScheme,n.matrix,h,d,g,y,v,b,_],(w,S,k,A,T,M,I,C,N,L,F,$,D,O)=>B=>{let V=B.categoryColors??Zg(B.categoryCount),U=[];for(let Q=0;Q<4;Q++)if(Q0&&B.pointsAlpha>0&&(N(S.texture,A,T),w.bindFramebuffer(w.FRAMEBUFFER,k.framebuffer),F(A,B.pointAlpha,B.pointsAlpha,U,M)),B.densityScaler>0&&(B.densityAlpha>0||B.contoursAlpha>0)&&(L(S.texture,A,T),w.bindFramebuffer(w.FRAMEBUFFER,k.framebuffer),B.densityAlpha>0&&$(A,B.densityScaler,B.densityQuantizationStep,B.densityAlpha,U,M),B.contoursAlpha>0))for(let Q=0;QSY(g)+1),a=e.derive([r,o],(g,y)=>g+y*2),l=e.derive([i,o],(g,y)=>g+y*2);const c=e.statefulDerive([t,a,l,1,"f32"],Tf),u=e.statefulDerive([t,a,l,1,"f32"],Tf),f=e.statefulDerive([t,a,l,1,"f32"],Tf);let h=Z4(e,t,n.x,n.y,null,n.count),d=bEt(e,t,s);return e.derive([t,o,r,i,c,u,f,h,d],(g,y,v,b,_,w,S,k,A)=>T=>{let M=v/_.width,I=b/_.height,C=ZI([M,0,0,0,I,0,0,0,1],T);g.bindFramebuffer(g.FRAMEBUFFER,_.framebuffer),g.viewport(0,0,_.width,_.height),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),k(C),A(_.texture,w,S),g.bindFramebuffer(g.FRAMEBUFFER,w.framebuffer);let N=new Float32Array(v*b);return g.readPixels(y,y,v,b,g.RED,g.FLOAT,N),g.bindFramebuffer(g.FRAMEBUFFER,null),N})}class BEt{i32View;u32View;f32View;offset;constructor(t){this.i32View=new Int32Array(t),this.u32View=new Uint32Array(t),this.f32View=new Float32Array(t),this.offset=0}align2(){this.offset%2!=0&&(this.offset+=2-this.offset%2)}align4(){this.offset%4!=0&&(this.offset+=4-this.offset%4)}f32(t){this.f32View[this.offset++]=t}u32(t){this.u32View[this.offset++]=t}i32(t){this.i32View[this.offset++]=t}vec2f(t,n){this.align2(),this.f32View[this.offset++]=t,this.f32View[this.offset++]=n}vec3f(t,n,r){this.align4(),this.f32View[this.offset++]=t,this.f32View[this.offset++]=n,this.f32View[this.offset++]=r}vec4f(t,n,r,i){this.align4(),this.f32View[this.offset++]=t,this.f32View[this.offset++]=n,this.f32View[this.offset++]=r,this.f32View[this.offset++]=i}mat3x3f(t){this.vec3f(t[0],t[1],t[2]),this.vec3f(t[3],t[4],t[5]),this.vec3f(t[6],t[7],t[8])}byteOffset(){return this.offset*4}}function PEt(e,t){let n=new ArrayBuffer(4288),r=e.statefulDerive([t,4288,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX],P0);return{buffer:r,update:e.derive([t,r],(i,s)=>o=>{let a=new BEt(n);a.u32(o.count),a.u32(o.category_count),a.i32(o.framebuffer_width),a.i32(o.framebuffer_height),a.i32(o.density_width),a.i32(o.density_height),a.f32(o.gamma),a.f32(o.point_size),a.f32(o.point_alpha),a.f32(o.points_alpha),a.f32(o.density_scaler),a.f32(o.quantization_step),a.f32(o.density_alpha),a.f32(o.contours_alpha),a.mat3x3f(o.matrix),a.vec2f(...o.view_xy_scaler),a.vec4f(...o.kde_causal),a.vec4f(...o.kde_anticausal),a.vec4f(...o.kde_a),a.vec4f(...o.background_color);let l=o.gamma;for(let c=0;ca.createComputePipeline({layout:a.createPipelineLayout({bindGroupLayouts:[c.group0,c.group1,c.group2A]}),compute:{module:l,entryPoint:"accumulate"}}));return e.derive([o,r.group0,r.group1,r.group2A,s.countBuffer,i.count],(a,l,c,u,f,h)=>d=>{if(d.clearBuffer(f),h==0)return;let g=d.beginComputePass();g.setPipeline(a),g.setBindGroup(0,l),g.setBindGroup(1,c),g.setBindGroup(2,u),h<=_k*wk?g.dispatchWorkgroups(Math.ceil(h/_k)):g.dispatchWorkgroups(wk,Math.ceil(h/(_k*wk))),g.end()})}function UEt(e){const{COMPUTE:t,VERTEX:n,FRAGMENT:r}=GPUShaderStage;return{group0:e.createBindGroupLayout({entries:[{binding:0,visibility:t|n|r,buffer:{type:"uniform"}}]}),group1:e.createBindGroupLayout({entries:[{binding:0,visibility:t|n,buffer:{type:"read-only-storage"}},{binding:1,visibility:t|n,buffer:{type:"read-only-storage"}},{binding:2,visibility:t|n,buffer:{type:"read-only-storage"}}]}),group2A:e.createBindGroupLayout({entries:[{binding:0,visibility:t|r,buffer:{type:"storage"}}]}),group2B:e.createBindGroupLayout({entries:[{binding:1,visibility:t|r,buffer:{type:"storage"}},{binding:2,visibility:t|r,buffer:{type:"storage"}}]}),group3:e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"non-filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]})}}function EY(e,t,n,r,i){let s=e.derive([t],f=>UEt(f)),o=e.derive([t,s,n],(f,h,d)=>f.createBindGroup({layout:h.group0,entries:[{binding:0,resource:{buffer:d}}]})),a=e.derive([t,s,r.x,r.y,r.category],(f,h,d,g,y)=>f.createBindGroup({layout:h.group1,entries:[{binding:0,resource:{buffer:d}},{binding:1,resource:{buffer:g}},{binding:2,resource:{buffer:y??d}}]})),l=e.derive([t,s,i.countBuffer,i.blurBuffer],(f,h,d,g)=>f.createBindGroup({layout:h.group2A,entries:[{binding:0,resource:{buffer:d}}]})),c=e.derive([t,s,i.countBuffer,i.blurBuffer],(f,h,d,g)=>f.createBindGroup({layout:h.group2B,entries:[{binding:1,resource:{buffer:d}},{binding:2,resource:{buffer:g}}]})),u=e.derive([t,s,i.colorTexture,i.alphaTexture],(f,h,d,g)=>f.createBindGroup({layout:h.group3,entries:[{binding:0,resource:f.createSampler({})},{binding:1,resource:d.createView()},{binding:2,resource:g.createView()}]}));return{layouts:s,group0:o,group1:a,group2A:l,group2B:c,group3:u}}function zEt(e,t,n,r,i){const s=e.derive([t,n,r.layouts],(o,a,l)=>o.createRenderPipeline({layout:o.createPipelineLayout({bindGroupLayouts:[l.group0,l.group1,l.group2B]}),vertex:{entryPoint:"draw_density_map_vs",module:a},fragment:{entryPoint:"draw_density_map_fs",module:a,targets:[{format:i.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:i.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return e.derive([s,r.group0,r.group1,r.group2B,i.colorTexture,i.alphaTexture],(o,a,l,c,u,f)=>h=>{let d=h.beginRenderPass({colorAttachments:[{loadOp:"load",storeOp:"store",view:u.createView()},{loadOp:"load",storeOp:"store",view:f.createView()}]});d.setPipeline(o),d.setBindGroup(0,a),d.setBindGroup(1,l),d.setBindGroup(2,c),d.draw(4),d.end()})}function qEt(e,t,n,r,i,s){const o=e.derive([t,n,r.layouts],(a,l,c)=>a.createRenderPipeline({layout:a.createPipelineLayout({bindGroupLayouts:[c.group0,c.group1]}),vertex:{entryPoint:"points_vs",module:l},fragment:{entryPoint:"points_fs",module:l,targets:[{format:s.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:s.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return e.derive([o,r.group0,r.group1,i.count,s.colorTexture,s.alphaTexture],(a,l,c,u,f,h)=>d=>{let g=d.beginRenderPass({colorAttachments:[{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:f.createView()},{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:h.createView()}]});g.setPipeline(a),g.setBindGroup(0,l),g.setBindGroup(1,c),u>0&&g.draw(4,u),g.end()})}function jEt(e,t,n,r,i){const s=e.derive([t,n,i.layouts],(o,a,l)=>o.createRenderPipeline({layout:o.createPipelineLayout({bindGroupLayouts:[l.group0,l.group1,l.group2B,l.group3]}),vertex:{entryPoint:"gamma_correction_vs",module:a},fragment:{entryPoint:"gamma_correction_fs",module:a,targets:[{format:r}]},primitive:{topology:"triangle-strip"}}));return e.derive([s,i.group0,i.group1,i.group2B,i.group3],(o,a,l,c,u)=>(f,h)=>{let d=f.beginRenderPass({colorAttachments:[{clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store",view:h}]});d.setPipeline(o),d.setBindGroup(0,a),d.setBindGroup(1,l),d.setBindGroup(2,c),d.setBindGroup(3,u),d.draw(4),d.end()})}const NL=64;function kY(e,t,n,r,i,s,o){let a=e.derive([t,n,r.layouts],(c,u,f)=>c.createComputePipeline({layout:c.createPipelineLayout({bindGroupLayouts:[f.group0,f.group1,f.group2B,f.group3]}),compute:{module:u,entryPoint:"gaussian_blur_stage_1"}})),l=e.derive([t,n,r.layouts],(c,u,f)=>c.createComputePipeline({layout:c.createPipelineLayout({bindGroupLayouts:[f.group0,f.group1,f.group2B,f.group3]}),compute:{module:u,entryPoint:"gaussian_blur_stage_2"}}));return e.derive([a,l,r.group0,r.group1,r.group2B,r.group3,i,s,o],(c,u,f,h,d,g,y,v,b)=>_=>{let w=_.beginComputePass();w.setBindGroup(0,f),w.setBindGroup(1,h),w.setBindGroup(2,d),w.setBindGroup(3,g),w.setPipeline(c),w.dispatchWorkgroups(Math.ceil(y/NL),b),w.setPipeline(u),w.dispatchWorkgroups(Math.ceil(v/NL),b),w.end()})}function VEt(e,t=!1){const n=new Float64Array(5),r=new Float64Array(4);WEt(n,r,e);const i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),s=1+n[1]+n[2]+n[3]+n[4],o=(r[0]+r[1]+r[2]+r[3])/s,a=(i[1]+i[2]+i[3]+i[4])/s;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:o,sum_anticausal:a}}function WEt(e,t,n){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),s=Math.exp(-1.723/n),o=.6318/n,a=1.997/n,l=Float64Array.of(-i*Math.cos(o),i*Math.sin(o),-i*Math.cos(-o),i*Math.sin(-o),-s*Math.cos(a),s*Math.sin(a),-s*Math.cos(-a),s*Math.sin(-a)),c=n*2.5066282746310007,u=Float64Array.of(r[0],r[1],0,0,0,0,0,0),f=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0);let h,d;for(d=2;d<8;d+=2){for(u[d]=l[d]*u[d-2]-l[d+1]*u[d-1],u[d+1]=l[d]*u[d-1]+l[d+1]*u[d-2],h=d-2;h>0;h-=2)u[h]+=l[d]*u[h-2]-l[d+1]*u[h-1],u[h+1]+=l[d]*u[h-1]+l[d+1]*u[h-2];for(h=0;h<=d;h+=2)u[h]+=r[d]*f[h]-r[d+1]*f[h+1],u[h+1]+=r[d]*f[h+1]+r[d+1]*f[h];for(f[d+2]=l[d]*f[d]-l[d+1]*f[d+1],f[d+3]=l[d]*f[d+1]+l[d+1]*f[d],h=d;h>0;h-=2)f[h]+=l[d]*f[h-2]-l[d+1]*f[h-1],f[h+1]+=l[d]*f[h-1]+l[d+1]*f[h-2]}for(d=0;d<4;++d)h=d<<1,t[d]=u[h]/c,e[d+1]=f[h+2]}function TY(e){let t=VEt(e);return{kde_causal:[t.b_causal[0],t.b_causal[1],t.b_causal[2],t.b_causal[3]],kde_anticausal:[t.b_anticausal[1],t.b_anticausal[2],t.b_anticausal[3],t.b_anticausal[4]],kde_a:[t.a[1],t.a[2],t.a[3],t.a[4]]}}const YEt=`// Copyright (c) 2025 Apple Inc. Licensed under MIT License. + +enable f16; + +struct Uniforms { + count: u32, + category_count: u32, + framebuffer_width: i32, + framebuffer_height: i32, + density_width: i32, + density_height: i32, + gamma: f32, + point_size: f32, + point_alpha: f32, + points_alpha: f32, + density_scaler: f32, + quantization_step: f32, + density_alpha: f32, + contours_alpha: f32, + matrix: mat3x3, + view_xy_scaler: vec2, + kde_causal: vec4, + kde_anticausal: vec4, + kde_a: vec4, + background_color: vec4, + category_colors: array, 256>, +} + +struct PointData { + position: vec3, + category: u32, +} + +struct FragmentOutput { + @location(0) color: vec4, + @location(1) log1malpha: f32, // log(1 - alpha) +} + +@group(0) @binding(0) var uniforms: Uniforms; + +@group(1) @binding(0) var x_buffer: array; +@group(1) @binding(1) var y_buffer: array; +@group(1) @binding(2) var category_buffer: array; + +@group(2) @binding(0) var count_buffer: array>; +@group(2) @binding(1) var blur_buffer: array; +@group(2) @binding(2) var blur_swap_buffer: array; + +@group(3) @binding(0) var framebuffer_sampler: sampler; +@group(3) @binding(1) var color_texture: texture_2d; +@group(3) @binding(2) var log1malpha_texture: texture_2d; + +fn get_point(index: u32) -> PointData { + var result: PointData; + result.position = vec3(x_buffer[index], y_buffer[index], 1.0); + if (uniforms.category_count > 1) { + result.category = (category_buffer[index >> 2] >> ((index & 3) << 3)) & 0xff; + } else { + result.category = 0; + } + return result; +} + +const ACCUMULATE_UNIT: u32 = 4096; + +fn increment_count(x: i32, y: i32, category: u32, value: u32) { + let width = uniforms.density_width; + let height = uniforms.density_height; + if (x < 0 || x >= width || y < 0 || y >= height || category >= uniforms.category_count || value == 0) { + return; + } + let offset = (y * width + x) + i32(category) * (width * height); + atomicAdd(&count_buffer[offset], value); +} + +@compute @workgroup_size(64, 1) +fn accumulate(@builtin(global_invocation_id) id: vec3) { + let width = uniforms.density_width; + let height = uniforms.density_height; + let index = id.y * 4096 + id.x; // 4096 = 64 * 64 + if (index >= uniforms.count) { return; } + let point = get_point(index); + let pos = uniforms.matrix * point.position; + let x = (pos.x + 1.0) / 2.0 * f32(width) - 0.5; + let y = (pos.y + 1.0) / 2.0 * f32(height) - 0.5; + let ix = i32(x); + let iy = i32(y); + let tx = x - f32(ix); + let ty = y - f32(iy); + let w1: u32 = u32((1 - tx) * (1 - ty) * f32(ACCUMULATE_UNIT)); + let w2: u32 = u32(tx * (1 - ty) * f32(ACCUMULATE_UNIT)); + let w3: u32 = u32((1 - tx) * ty * f32(ACCUMULATE_UNIT)); + let w123 = w1 + w2 + w3; + var w4: u32 = select(0, ACCUMULATE_UNIT - w123, w123 < ACCUMULATE_UNIT); + increment_count(ix, iy, point.category, w1); + increment_count(ix + 1, iy, point.category, w2); + increment_count(ix, iy + 1, point.category, w3); + increment_count(ix + 1, iy + 1, point.category, w4); +} + +// Draw Discrete Points + +struct PointsVertexOutput { + @builtin(position) position: vec4, + @location(0) dp: vec3, + @location(1) color: vec4, +} + +@vertex +fn points_vs( + @builtin(instance_index) index: u32, + @builtin(vertex_index) part: u32, +) -> PointsVertexOutput { + let framebuffer_size = vec2(f32(uniforms.framebuffer_width), f32(uniforms.framebuffer_height)); + let alpha = uniforms.point_alpha * uniforms.points_alpha; + let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; + let point = get_point(index); + let pos = uniforms.matrix * point.position; + + var out: PointsVertexOutput; + out.position = vec4(pos.xy + dp * uniforms.point_size / framebuffer_size * 2.0, 0.0, 1.0); + out.dp = vec3(dp, uniforms.point_size); + out.color = uniforms.category_colors[point.category] * alpha; + return out; +} + +@fragment +fn points_fs(in: PointsVertexOutput) -> FragmentOutput { + let r = length(in.dp.xy) * in.dp.z; + let a = max(0.0, min(1.0, in.dp.z - r)); + var out: FragmentOutput; + out.color = in.color * a; + out.log1malpha = log(1 - out.color.a); + return out; +} + +// Draw Density Map + +struct DrawDensityMapVertexOutput { + @builtin(position) position: vec4, + @location(0) texture_coord: vec2, +} + +@vertex +fn draw_density_map_vs( + @builtin(vertex_index) part: u32, +) -> DrawDensityMapVertexOutput { + let framebuffer_size = vec2(f32(uniforms.framebuffer_width), f32(uniforms.framebuffer_height)); + let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; + var out: DrawDensityMapVertexOutput; + out.position = vec4(dp, 0.0, 1.0); + out.texture_coord = (vec2(dp.x, dp.y) + 1.0) / 2.0 * framebuffer_size; + return out; +} + +fn get_density_raw(x: i32, y: i32, category: u32) -> f32 { + let width = uniforms.density_width; + let height = uniforms.density_height; + let density_scaler = uniforms.density_scaler; + if (x < 0 || x >= width || y < 0 || y >= height) { + return 0.0; + } + let offset = (y * width + x) + i32(category) * (width * height); + return max(0.0, f32(blur_buffer[offset]) * density_scaler); +} + +fn get_density(x: f32, y: f32, category: u32) -> f32 { + let px = x / f32(uniforms.framebuffer_width) * f32(uniforms.density_width) - 0.5; + let py = y / f32(uniforms.framebuffer_height) * f32(uniforms.density_height) - 0.5; + let ix = i32(px); + let iy = i32(py); + let tx = px - f32(ix); + let ty = py - f32(iy); + let v00 = get_density_raw(ix, iy, category); + let v10 = get_density_raw(ix + 1, iy, category); + let v01 = get_density_raw(ix, iy + 1, category); + let v11 = get_density_raw(ix + 1, iy + 1, category); + return mix(mix(v00, v10, tx), mix(v01, v11, tx), ty); +} + +fn get_density_quantized(x: f32, y: f32, category: u32) -> f32 { + let v = get_density(x, y, category); + return floor(clamp(v, 0, 1) / uniforms.quantization_step); +} + +fn get_density_quantized_sobel(x: f32, y: f32, category: u32) -> vec2 { + let v11 = get_density_quantized(x - 1, y - 1, category); + let v21 = get_density_quantized(x, y - 1, category); + let v31 = get_density_quantized(x + 1, y - 1, category); + let v12 = get_density_quantized(x - 1, y, category); + let v22 = get_density_quantized(x, y, category); + let v32 = get_density_quantized(x + 1, y, category); + let v13 = get_density_quantized(x - 1, y + 1, category); + let v23 = get_density_quantized(x, y + 1, category); + let v33 = get_density_quantized(x + 1, y + 1, category); + let gx = v11 + v12 * 2.0 + v13 - v31 - v32 * 2.0 - v33; + let gy = v11 + v21 * 2.0 + v31 - v13 - v23 * 2.0 - v33; + return vec2(gx, gy); +} + +@fragment +fn draw_density_map_fs(in: DrawDensityMapVertexOutput) -> FragmentOutput { + let px = in.texture_coord.x; + let py = in.texture_coord.y; + let quantization_step: f32 = uniforms.quantization_step; + + var sum_color: vec4 = vec4(0); + var sum_log1malpha: f32 = 0.0; + + for (var i: u32 = 0; i < uniforms.category_count; i++) { + let density = get_density(px, py, i); + var alpha = min(1.0, floor(density / quantization_step) * quantization_step); + alpha *= uniforms.density_alpha; + let color = uniforms.category_colors[i] * alpha; + sum_color += color; + sum_log1malpha += log(1 - color.a); + } + + if (uniforms.contours_alpha > 0.0) { + for (var i: u32 = 0; i < uniforms.category_count; i++) { + let sobel = get_density_quantized_sobel(px, py, i); + let alpha = clamp(length(sobel) * 0.2, 0.0, 1.0) * uniforms.contours_alpha; + let color = uniforms.category_colors[i] * alpha; + sum_color += color; + sum_log1malpha += log(1 - color.a); + } + } + + var out: FragmentOutput; + out.color = sum_color; + out.log1malpha = sum_log1malpha; + return out; +} + +// Gamma Correction + +struct GammaCorrectionVertexOutput { + @builtin(position) position: vec4, + @location(0) texture_coord: vec2, +} + +@vertex +fn gamma_correction_vs( + @builtin(vertex_index) part: u32, +) -> GammaCorrectionVertexOutput { + let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; + var out: GammaCorrectionVertexOutput; + out.position = vec4(dp * uniforms.view_xy_scaler, 0.0, 1.0); + out.texture_coord = (vec2(dp.x, -dp.y) + 1.0) / 2.0; + return out; +} + +@fragment +fn gamma_correction_fs(in: GammaCorrectionVertexOutput) -> @location(0) vec4 { + let sum_color = textureSample(color_texture, framebuffer_sampler, in.texture_coord); + let sum_log_one_minus_alpha = textureSample(log1malpha_texture, framebuffer_sampler, in.texture_coord).r; + var color: vec4; + if (sum_color.a > 0.0) { + color = sum_color / sum_color.a * (1.0 - exp(sum_log_one_minus_alpha)); + color = color + uniforms.background_color * (1 - color.a); + } else { + color = uniforms.background_color; + } + let rgb = pow(color.rgb, vec3(1.0 / uniforms.gamma)); + return vec4(rgb, 1.0); +} + +// Gaussian Blur + +@compute @workgroup_size(64, 1) +fn gaussian_blur_stage_1(@builtin(global_invocation_id) id: vec3) { + let width = uniforms.density_width; + let height = uniforms.density_height; + let x = id.x; + if (x >= u32(width)) { return; } + let start = x + id.y * u32(width * height); + let count = u32(height); + let stride = u32(width); + + deriche_conv_1d( + &blur_buffer, &blur_swap_buffer, start, stride, count, + uniforms.kde_causal, uniforms.kde_anticausal, uniforms.kde_a, + true + ); +} + +@compute @workgroup_size(64, 1) +fn gaussian_blur_stage_2(@builtin(global_invocation_id) id: vec3) { + let width = uniforms.density_width; + let height = uniforms.density_height; + let y = id.x; + if (y >= u32(height)) { return; } + let start = y * u32(width) + id.y * u32(width * height); + let count = u32(width); + let stride = u32(1); + + deriche_conv_1d( + &blur_swap_buffer, &blur_buffer, start, stride, count, + uniforms.kde_causal, uniforms.kde_anticausal, uniforms.kde_a, + false + ); +} + +fn deriche_conv_1d( + src: ptr, read_write>, + dst: ptr, read_write>, + start: u32, stride: u32, count: u32, + kde_causal: vec4, kde_anticausal: vec4, kde_a: vec4, + src_is_u32: bool +) { + var s: vec4 = vec4(0.0); + var y0: f32 = 0.0; + var y1234: vec4 = vec4(0.0); + + var first_nonzero: u32 = count; + var last_nonzero: u32 = 0; + + for (var i: u32 = 0; i < count; i++) { + let offset = start + i * stride; + var input: f32; + if (src_is_u32) { + input = f32(bitcast(vec2((*src)[offset * 2], (*src)[offset * 2 + 1]))) / f32(ACCUMULATE_UNIT); + } else { + input = f32((*src)[offset]); + } + if (input != 0.0) { + first_nonzero = min(i, first_nonzero); + last_nonzero = max(i, last_nonzero); + } + s = vec4(input, s.xyz); + y1234 = vec4(y0, y1234.xyz); + y0 = dot(kde_causal, s) - dot(kde_a, y1234); + (*dst)[offset] = f16(y0); + } + + if (first_nonzero > last_nonzero) { + return; + } + + s = vec4(0.0); + y0 = 0.0; + y1234 = vec4(0.0); + + for (var i: u32 = count - 1 - last_nonzero; i < count; i++) { + let p = count - 1 - i; + let offset = start + p * stride; + var input: f32 = 0.0; + if (p >= first_nonzero) { + if (src_is_u32) { + input = f32(bitcast(vec2((*src)[offset * 2], (*src)[offset * 2 + 1]))) / f32(ACCUMULATE_UNIT); + } else { + input = f32((*src)[offset]); + } + } + y1234 = vec4(y0, y1234.xyz); + y0 = dot(kde_anticausal, s) - dot(kde_a, y1234); + s = vec4(input, s.xyz); + if (y0 != 0.0) { + (*dst)[offset] = f16(f32((*dst)[offset]) + y0); + } + } +} +`;class HEt{props;viewport;df;device;module;uniforms;context;renderInputs;dataBuffers;renderer;constructor(t,n,r,i,s){this.context=t,this.props={mode:"points",colorScheme:"light",x:new Float32Array,y:new Float32Array,category:null,categoryCount:1,categoryColors:null,viewportX:0,viewportY:0,viewportScale:1,pointSize:1,pointAlpha:1,pointsAlpha:1,densityScaler:1,densityBandwidth:1,densityQuantizationStep:.1,contoursAlpha:1,densityAlpha:1,gamma:2.2,width:i,height:s},this.viewport=new Wx({x:0,y:0,scale:1},i,s),this.df=new O1;let o=this.df;this.renderInputs={mode:o.value(this.props.mode),colorScheme:o.value(this.props.colorScheme),xData:o.value(this.props.x),yData:o.value(this.props.y),categoryData:o.value(this.props.category),categoryCount:o.value(this.props.categoryCount),categoryColors:o.value(this.props.categoryColors),matrix:o.value(yY()),width:o.value(i),height:o.value(s),pointSize:o.value(this.props.pointSize),densityBandwidth:o.value(this.props.densityBandwidth)},this.device=o.value(n),this.dataBuffers=GEt(o,this.device,this.renderInputs),this.module=o.derive([this.device],a=>a.createShaderModule({code:YEt})),this.uniforms=PEt(o,this.device),this.renderer=XEt(o,this.device,this.module,this.uniforms,r,this.renderInputs,this.dataBuffers)}setProps(t){let n=!1,r;for(r in t)t[r]!==this.props[r]&&(this.props[r]=t[r],n=!0);return this.viewport.update({x:this.props.viewportX,y:this.props.viewportY,scale:this.props.viewportScale},this.props.width,this.props.height),this.renderInputs.mode.value=this.props.mode,this.renderInputs.colorScheme.value=this.props.colorScheme,this.renderInputs.xData.value=this.props.x,this.renderInputs.yData.value=this.props.y,this.renderInputs.categoryData.value=this.props.category,this.renderInputs.categoryColors.value=this.props.categoryColors,this.props.category!=null?this.renderInputs.categoryCount.value=this.props.categoryCount:this.renderInputs.categoryCount.value=1,this.renderInputs.matrix.value=this.viewport.matrix(),this.renderInputs.width.value=this.props.width,this.renderInputs.height.value=this.props.height,this.renderInputs.pointSize.value=this.props.pointSize,this.renderInputs.densityBandwidth.value=this.props.densityBandwidth,n}render(){this.renderer.value(this.props,this.context.getCurrentTexture().createView())}destroy(){this.df.destroy()}async densityMap(t,n,r,i){let s=this.df.subgraph(),{x:o,y:a,scale:l}=i,c=[l,0,0,0,l,0,-o*l,-a*l,1],u=bY(c),f=await KEt(s,this.device,this.module,this.uniforms,s.value(t),s.value(n),s.value(r),s.value(c),this.dataBuffers).value();return s.destroy(),{data:f,width:t,height:n,coordinateAtPixel:(h,d)=>{let g=h/t*2-1,y=d/n*2-1,v=vY([g,y,1],u);return{x:v[0],y:v[1]}}}}}function GEt(e,t,n){let r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;const i=e.derive([n.xData],u=>u.length),s=e.derive([i],u=>u*4),o=i,a=e.statefulDerive([t,e.statefulDerive([t,s,r],P0),n.xData],fk),l=e.statefulDerive([t,e.statefulDerive([t,s,r],P0),n.yData],fk),c=e.statefulDerive([t,e.statefulDerive([t,o,r],P0),n.categoryData],fk);return{x:a,y:l,category:c,count:i}}function MY(e,t,n,r,i,s,o){let a="rgba16float",l="r16float",c=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,u=e.statefulDerive([t,n,r,a,c],sL),f=e.statefulDerive([t,n,r,l,c],sL),h=e.derive([i,s,o],(v,b,_)=>v*b*_*4),d=e.derive([i,s,o],(v,b,_)=>v*b*_*2),g=e.statefulDerive([t,h,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC],P0),y=e.statefulDerive([t,d,GPUBufferUsage.STORAGE],P0);return{colorTexture:u,alphaTexture:f,colorTextureFormat:a,alphaTextureFormat:l,countBuffer:g,blurBuffer:y}}function XEt(e,t,n,r,i,s,o){let a=e.derive([s.densityBandwidth],k=>Math.ceil(k*3)+1),l=e.derive([s.width,a],(k,A)=>k+A*2),c=e.derive([s.height,a],(k,A)=>k+A*2),u=e.derive([l],k=>Math.ceil(k/4)),f=e.derive([c],k=>Math.ceil(k/4)),h=MY(e,t,l,c,u,f,s.categoryCount),d=EY(e,t,r.buffer,o,h),g=AY(e,t,n,d,o,h),y=qEt(e,t,n,d,o,h),v=zEt(e,t,n,d,h),b=jEt(e,t,n,i,d),_=kY(e,t,n,d,l,c,s.categoryCount),w=e.derive([s.densityBandwidth,l,u],(k,A,T)=>TY(k/A*T)),S=e.derive([s.categoryColors,s.categoryCount],(k,A)=>(k==null&&(k=Zg(A)),k.map(T=>JI(T))));return e.derive([t,l,c,u,f,r.update,o.count,s.matrix,S,y,b,g,_,v,w],(k,A,T,M,I,C,N,L,F,$,D,O,B,V,U)=>(z,q)=>{let Y=z.colorScheme=="light"?[1,1,1,1]:[0,0,0,1],Q=z.width/A,ft=z.height/T,gt=ZI([Q,0,0,0,ft,0,0,0,1],L);C({count:N,category_count:z.categoryCount,framebuffer_width:A,framebuffer_height:T,density_width:M,density_height:I,gamma:z.gamma,point_size:Math.max(z.mode=="points"?3:1,z.pointSize),point_alpha:z.pointAlpha,points_alpha:z.pointsAlpha,density_scaler:z.densityScaler/16,quantization_step:z.densityQuantizationStep,density_alpha:z.densityAlpha,contours_alpha:z.contoursAlpha,matrix:gt,view_xy_scaler:[1/Q,1/ft],kde_causal:U.kde_causal,kde_anticausal:U.kde_anticausal,kde_a:U.kde_a,background_color:Y,category_colors:F});let pt=k.createCommandEncoder();$(pt),z.mode=="density"&&(z.densityAlpha>0||z.contoursAlpha>0)&&(O(pt),B(pt),V(pt)),D(pt,q),k.queue.submit([pt.finish()])})}function KEt(e,t,n,r,i,s,o,a,l){let c=MY(e,t,i,s,i,s,e.value(1)),u=EY(e,t,r.buffer,l,c),f=AY(e,t,n,u,l,c),h=kY(e,t,n,u,i,s,e.value(1));return e.derive([t,i,s,l.count,r.update,o,a,f,h,c.countBuffer],(d,g,y,v,b,_,w,S,k,A)=>()=>{let T=d.createCommandEncoder(),M=TY(_);b({count:v,category_count:1,framebuffer_width:g,framebuffer_height:y,density_width:g,density_height:y,gamma:1,point_size:0,point_alpha:0,points_alpha:0,density_scaler:0,quantization_step:0,density_alpha:0,contours_alpha:0,matrix:w,view_xy_scaler:[1,1],kde_causal:M.kde_causal,kde_anticausal:M.kde_anticausal,kde_a:M.kde_a,background_color:[0,0,0,0],category_colors:[]}),S(T),k(T);let I=d.createBuffer({size:g*y*2,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});return T.copyBufferToBuffer(A,0,I,0,g*y*2),d.queue.submit([T.finish()]),I.mapAsync(GPUMapMode.READ,0,g*y*2).then(()=>JEt(I.getMappedRange()))})}function JEt(e){let t=new Uint16Array(e),n=new Uint32Array(t.length);for(let r=0;r1?(u=c.x,f=c.y):g>0&&(u+=h*g,f+=d*g)}return h=a.x-u,d=a.y-f,h*h+d*d}function r(a,l){for(var c=a[0],u=[c],f,h=1,d=a.length;hl&&(u.push(f),c=f);return c!==f&&u.push(f),u}function i(a,l,c,u,f){for(var h=u,d,g=l+1;gh&&(d=g,h=y)}h>u&&(d-l>1&&i(a,l,d,u,f),f.push(a[d]),c-d>1&&i(a,d,c,u,f))}function s(a,l){var c=a.length-1,u=[a[0]];return i(a,0,c,l,u),u.push(a[c]),u}function o(a,l,c){if(a.length<=2)return a;var u=l!==void 0?l*l:1;return a=c?a:r(a,u),a=s(a,u),a}e.exports=o,e.exports.default=o})()}($L)),$L.exports}var tkt=QEt();const LL=ZEt(tkt);function ekt(e,t){let n=e.slice();for(let r=0;rt&&o<20;)i*=1.1,o+=1,s=LL(n,i);return s}const DL={light:{fontFamily:"system-ui,sans-serif",clusterLabelColor:"#000",clusterLabelOutlineColor:"rgba(255,255,255,0.8)",clusterLabelOpacity:.8,statusBar:!0,statusBarTextColor:"#525252",statusBarBackgroundColor:"rgba(255,255,255,0.9)",brandingLink:{text:"Embedding Atlas",href:"https://apple.github.io/embedding-atlas"}},dark:{fontFamily:"system-ui,sans-serif",clusterLabelColor:"#ccc",clusterLabelOutlineColor:"rgba(0,0,0,0.8)",clusterLabelOpacity:.8,statusBar:!0,statusBarTextColor:"#d9d9d9",statusBarBackgroundColor:"rgba(0,0,0,0.9)",brandingLink:{text:"Embedding Atlas",href:"https://apple.github.io/embedding-atlas"}}};function rkt(e,t){return e==null?DL[t]:{...DL[t],...e,...e[t]!=null?e[t]:{}}}let xk=null,Q4=new Map;function ikt(){return xk==null&&(xk=new Promise((e,t)=>{let n=new Worker(new URL(""+new URL("clustering.worker-Bu7owlFv.js",import.meta.url).href,import.meta.url),{type:"module"});n.onmessage=r=>{if(r.data.ready){e(n);return}if(r.data.id!=null){let i=Q4.get(r.data.id);i!=null&&(Q4.delete(r.data.id),i(r.data))}}})),xk}function tm(e,t,n=[]){return new Promise((r,i)=>{ikt().then(s=>{let o=new Date().getTime().toString()+"-"+Math.random().toString();Q4.set(o,a=>{r(a.payload)}),s.postMessage({id:o,name:e,payload:t},n)})})}let skt=(e,t,n,r)=>tm("findClusters",[e,t,n,r],[e.buffer]),okt=(...e)=>tm("dynamicLabelPlacement",e),akt=(...e)=>tm("textSummarizerCreate",e),lkt=(...e)=>tm("textSummarizerDestroy",e),ckt=(...e)=>tm("textSummarizerAdd",e),ukt=(...e)=>tm("textSummarizerSummarize",e);function fkt(e,t,n,r,i,s){let o=Math.max(r,i)/s,a=e/(n*n)/(o*o),l=1/(a/(s*s))*.2,c=Math.sqrt(e/t/(o*o)),u=Math.log(c),f=Math.log(n),h=(Math.min(Math.max((f-u)*2,-1),1)+1)/2,d=.25/Math.sqrt(a),g=Math.max(.2,Math.min(5,d))*s,y=1-h,v=.5+h*.5;return{densityScaler:l,densityAlpha:y,contoursAlpha:y,pointSize:g,pointAlpha:.7,pointsAlpha:v,densityBandwidth:20}}var hkt=gh("
    "),dkt=Vu(""),pkt=Vu(""),gkt=Vu(' '),mkt=Vu(""),ykt=Vu(""),vkt=Vu(""),bkt=gh('
    ');function _kt(e,t){dp(t,!0);let n=ae(t,"data",19,()=>({x:new Float32Array,y:new Float32Array,category:null})),r=ae(t,"categoryCount",3,1),i=ae(t,"categoryColors",3,null),s=ae(t,"width",3,800),o=ae(t,"height",3,800),a=ae(t,"pixelRatio",3,2),l=ae(t,"colorScheme",3,"light"),c=ae(t,"theme",3,null),u=ae(t,"mode",3,"density"),f=ae(t,"minimumDensity",3,1/16),h=ae(t,"totalCount",3,null),d=ae(t,"maxDensity",3,null),g=ae(t,"automaticLabels",3,!1),y=ae(t,"queryClusterLabels",3,null),v=ae(t,"tooltip",7,null),b=ae(t,"selection",7,null),_=ae(t,"querySelection",3,null),w=ae(t,"rangeSelection",7,null),S=ae(t,"defaultViewportState",3,null),k=ae(t,"viewportState",7,null),A=ae(t,"customTooltip",3,null),T=ae(t,"customOverlay",3,null),M=ae(t,"onViewportState",3,null),I=ae(t,"onTooltip",3,null),C=ae(t,"onSelection",3,null),N=ae(t,"onRangeSelection",3,null),L=oe(()=>rkt(c(),l())),F=oe(()=>i()??Zg(r())),$=oe(()=>k()??S()??{x:0,y:0,scale:1}),D=oe(()=>new Wx(X($),s(),o())),O=oe(()=>X(D).pixelLocationFunction()),B=oe(()=>X(D).coordinateAtPixelFunction());function V(Rt,Vt){return Rt.x==Vt.x&&Rt.y==Vt.y&&Rt.category==Vt.category&&Rt.text==Vt.text}let U=oe(()=>b()?.length==1&&v()!=null&&V(b()[0],v()));function z(Rt){kf(k(),Rt)||(k(Rt),M()?.(Rt))}function q(Rt){kf(v(),Rt)||(v(Rt),I()?.(Rt))}function Y(Rt){kf(b(),Rt)||(b(Rt),C()?.(Rt))}function Q(Rt){kf(w(),Rt)||(w(Rt),N()?.(Rt))}let ft=Sr(nd([])),gt=Sr(null),pt=Sr("none"),lt=oe(()=>s()*a()),vt=oe(()=>o()*a()),st=Sr(null),Z=Sr(null),mt=Sr(null),at=oe(()=>fkt(d()??(h()??n().x.length)/4,f(),X($).scale,X(lt),X(vt),a())),Ct=oe(()=>X(at).pointSize),wt=!0;qx(()=>{X(Z)?.setProps({mode:u(),colorScheme:l(),viewportX:X($).x,viewportY:X($).y,viewportScale:X($).scale,width:X(lt),height:X(vt),x:n().x,y:n().y,category:n().category,categoryCount:r(),categoryColors:X(F),...X(at)})&&(kt(),g()!==!1&&wt&&X(Z)!=null&&n().x!=null&&n().x.length>0&&S()!=null&&(wt=!1,Ln(S())))});function Bt(){Pt=null,!(!X(st)||!X(Z))&&(X(st).width=X(Z).props.width,X(st).height=X(Z).props.height,X(st).style.width=`${X(Z).props.width/a()}px`,X(st).style.height=`${X(Z).props.height/a()}px`,X(Z).render())}let Pt=null;function kt(){Pt==null&&(Pt=requestAnimationFrame(Bt))}function qt(Rt){let Vt;function Wt(){Vt=Rt.getContext("webgl2",{antialias:!1}),Vt.getExtension("EXT_color_buffer_float"),Vt.getExtension("EXT_float_blend"),Vt.getExtension("OES_texture_float_linear"),De(Z,new NEt(Vt,X(lt),X(vt)),!0)}Wt(),Rt.addEventListener("webglcontextlost",()=>{X(Z)?.destroy(),De(Z,null),Vt=null}),Rt.addEventListener("webglcontextrestored",()=>{Wt()})}function Re(Rt){async function Vt(){let Wt=Rt.getContext("webgpu");if(Wt==null){console.error("Could not get WebGPU canvas context");return}let Gt=await navigator.gpu.requestAdapter();if(!Gt){console.error("Could not request WebGPU adapter");return}let Qt=512*1048576,Oe=512*1048576;Qt=Math.min(Qt,Gt.limits.maxBufferSize),Oe=Math.min(Oe,Gt.limits.maxStorageBufferBindingSize);let sn={requiredLimits:{maxBufferSize:Qt,maxStorageBufferBindingSize:Oe},requiredFeatures:["shader-f16"]},on=await Gt.requestDevice(sn);on.lost.then(Ot=>{console.info(`WebGPU device was lost: ${Ot.message}`),Ot.reason!="destroyed"&&(X(Z)?.destroy(),De(Z,null),Vt())});let _t=navigator.gpu.getPreferredCanvasFormat();Wt.configure({device:on,format:_t,alphaMode:"premultiplied"}),De(Z,new HEt(Wt,on,_t,X(lt),X(vt)),!0)}Vt()}function Ht(Rt){Rt!=null&&k()==null&&z(Rt)}qx(()=>Ht(S())),GI(()=>{X(st)!=null&&(mW()?Re(X(st)):(qt(X(st)),De(mt,"WebGPU is unavailable. If you are using Safari, please enable the WebGPU feature flag.")))}),dAt(()=>{X(Z)?.destroy(),De(Z,null)});function le(Rt,Vt){let{x:Wt,y:Gt,scale:Qt}=X($);q(null);let Oe=Math.min(100,Math.max(.01,Qt*Rt)),sn=X(st).getBoundingClientRect(),on=Math.max(sn.width,sn.height),_t=(Vt.x-sn.width/2)/on*2,Ot=(sn.height/2-Vt.y)/on*2,Ut=Wt+_t/Qt-_t/Oe,ie=Gt+Ot/Qt-Ot/Oe;z({x:Ut,y:ie,scale:Oe})}function Ke(Rt,Vt){q(null);let Wt="pan";switch(X(pt)!="none"?Vt.shift||(Wt=X(pt)):Vt.shift&&(Wt=Vt.meta?"lasso":"marquee"),Wt){case"marquee":return{move:Gt=>{if(q(null),X(Z)==null)return;let Qt=X(B)(Rt.x,Rt.y),Oe=X(B)(Gt.x,Gt.y);Q({xMin:Math.min(Qt.x,Oe.x),yMin:Math.min(Qt.y,Oe.y),xMax:Math.max(Qt.x,Oe.x),yMax:Math.max(Qt.y,Oe.y)})}};case"lasso":{let Gt=[X(B)(Rt.x,Rt.y)];return{move:Qt=>{q(null),X(Z)!=null&&(Gt=[...Gt,X(B)(Qt.x,Qt.y)],Gt.length>=3&&Q(nkt(Gt,24)))}}}case"pan":{let Gt=X(B)(0,0),Qt=X(B)(1,1),Oe=Gt.x-Qt.x,sn=Gt.y-Qt.y,on=X($).x,_t=X($).y;return{move:Ot=>{z({x:on+(Ot.x-Rt.x)*Oe,y:_t+(Ot.y-Rt.y)*sn,scale:X($).scale})}}}}}async function ce(Rt,Vt){if(w()!=null)Q(null);else{const Wt=await Je(Rt);if(Wt==null)Y([]),q(null);else if(Vt.shift||Vt.ctrl||Vt.meta){let Gt=b()?.findIndex(Qt=>Qt.x==Wt.x&&Qt.y==Wt.y&&Qt.category==Wt.category);b()==null||Gt==null||Gt<0?(Y([...b()??[],Wt]),q(Wt)):(Y([...b().slice(0,Gt),...b().slice(Gt+1)]),q(null))}else Y([Wt]),q(Wt)}}async function bn(Rt){if(b()!=null&&b().length==1){let Vt=X(O)(b()[0].x,b()[0].y);Rt!=null&&IAt(Rt,Vt)<10&&q(b()[0])}else q(await Je(Rt))}async function Je(Rt){if(X(Z)==null||Rt==null||_()==null)return null;let{x:Vt,y:Wt}=X(B)(Rt.x,Rt.y),Gt=Math.abs(X(B)(Rt.x+1,Rt.y).x-Vt);return await _()(Vt,Wt,Gt)}function wr(){return v()!=null}let or=oe(()=>X(st)?MAt(X(st),{zoom:le,drag:Ke,hover:TAt(bn,wr),click:ce}):null);async function Ge(Rt,Vt,Wt){let Gt=await Rt.densityMap(1e3,1e3,Vt,Wt),Qt=await skt(Gt.data,Gt.width,Gt.height),Oe=[];for(let on=0;on{let te=Gt.coordinateAtPixel(ie,je),Dn=Gt.coordinateAtPixel(qn,An);return{xMin:Math.min(te.x,Dn.x),xMax:Math.max(te.x,Dn.x),yMin:Math.min(te.y,Dn.y),yMax:Math.max(te.y,Dn.y)}});Oe.push({x:Ot.x,y:Ot.y,sumDensity:_t.sumDensity,rects:Ut,bandwidth:Vt})}let sn=Oe.reduce((on,_t)=>Math.max(on,_t.sumDensity),0)*.005;return Oe.filter(on=>on.sumDensity>sn)}async function un(Rt){if(X(Z)==null)return[];let Vt=await CAt({generateLabels:Rt});if(typeof g()=="object"&&g().cache){let Qt=await g().cache.get(Vt);if(Qt!=null)return Qt}De(gt,"Generating clusters...");let Wt=await Ge(X(Z),10,Rt);if(Wt=Wt.concat(await Ge(X(Z),5,Rt)),De(gt,"Generating labels..."),y()){let Qt=await y()(Wt.map(Oe=>Oe.rects));for(let Oe=0;OeQt.label!=null).map(Qt=>({text:Qt.label,x:Qt.x,y:Qt.y,priority:Qt.sumDensity,level:Qt.bandwidth==10?0:1}));return typeof g()=="object"&&g().cache&&await g().cache.set(Vt,Gt),Gt}async function Ln(Rt){if(X(Z)==null)return;let Vt=new Wx(Rt,s(),o()),Wt=await un(Rt),Gt=Rt.scale,Qt=Rt.scale/2,Oe=Qt*4,sn=Wt.map(_t=>{let Ot=Vt.pixelLocation(_t.x,_t.y),Ut=_t.level==0?14:12,ie=sEt({text:_t.text,fontSize:Ut,fontFamily:X(L).fontFamily});ie.width+=4,ie.height+=4;let je=Gt/Oe;return{text:_t.text,fontSize:Ut,bounds:{xMin:Ot.x-ie.width/2,xMax:Ot.x+ie.width/2,yMin:Ot.y-ie.height/2,yMax:Ot.y+ie.height/2},locationAtZero:Ot,priority:_t.priority,minScale:_t.level==0?je/1.2:null,maxScale:_t.level==0?null:je,coordinate:{x:_t.x,y:_t.y},placement:null}}),on=await okt(sn,{globalMaxScale:Gt/Qt});for(let _t=0;_tDe(st,Rt),()=>X(st));var ni=Nr(fi,2);let Nl;var kh=Oi(ni);{var Zu=Rt=>{var Vt=Hm();const Wt=oe(()=>hY(T())),Gt=oe(()=>({location:X(O),width:s(),height:o()}));var Qt=g0(Vt);pAt(Qt,()=>X(Wt),Oe=>{var sn=hkt();vAt(sn,(on,_t)=>X(Wt)?.(on,_t),()=>dY(T(),{proxy:X(Gt)})),Gr(Oe,sn)}),Gr(Rt,Vt)};Ks(kh,Rt=>{T()&&Rt(Zu)})}mi(ni);var ys=Nr(ni,2);ys.__mousedown=function(...Rt){X(or)?.mousedown?.apply(this,Rt)},ys.__mousemove=function(...Rt){X(or)?.mousemove?.apply(this,Rt)},kn(ys,"",{},{position:"absolute",left:"0",top:"0"});var Qu=Oi(ys);{var Th=Rt=>{var Vt=Hm();const Wt=oe(()=>{const{x:sn,y:on}=X(O)(v().x,v().y);return{x:sn,y:on}}),Gt=oe(()=>Math.max(3,X(Ct)/a())+1);var Qt=g0(Vt);{var Oe=sn=>{var on=dkt();let _t;Oo(Ot=>{Kt(on,"cx",X(Wt).x),Kt(on,"cy",X(Wt).y),Kt(on,"r",X(Gt)),_t=kn(on,"",_t,Ot)},[()=>({stroke:l()=="light"?"#000":"#fff","stroke-width":1,fill:"none"})]),Gr(sn,on)};Ks(Qt,sn=>{isFinite(X(Wt).x)&&isFinite(X(Wt).y)&&isFinite(X(Gt))&&sn(Oe)})}Gr(Rt,Vt)};Ks(Qu,Rt=>{v()!=null&&X(Z)!=null&&Rt(Th)})}var tf=Nr(Qu);{var Ap=Rt=>{var Vt=Hm(),Wt=g0(Vt);pk(Wt,17,b,dk,(Gt,Qt)=>{var Oe=Hm();const sn=oe(()=>{const{x:ie,y:je}=X(O)(X(Qt).x,X(Qt).y);return{x:ie,y:je}}),on=oe(()=>X(Qt).category!=null?X(F)[X(Qt).category]:X(F)[0]),_t=oe(()=>Math.max(3,X(Ct)/a())+1);var Ot=g0(Oe);{var Ut=ie=>{var je=pkt();let qn;Oo(An=>{Kt(je,"cx",X(sn).x),Kt(je,"cy",X(sn).y),Kt(je,"r",X(_t)),qn=kn(je,"",qn,An)},[()=>({stroke:l()=="light"?"#000":"#fff","stroke-width":2,fill:X(on)})]),Gr(ie,je)};Ks(Ot,ie=>{isFinite(X(sn).x)&&isFinite(X(sn).y)&&isFinite(X(_t))&&ie(Ut)})}Gr(Gt,Oe)}),Gr(Rt,Vt)};Ks(tf,Rt=>{b()!=null&&X(Z)!=null&&Rt(Ap)})}var Mh=Nr(tf);{var mm=Rt=>{var Vt=vkt();pk(Vt,21,()=>X(ft),dk,(Wt,Gt)=>{var Qt=ykt();const Oe=oe(()=>X(Gt).text.split(` +`)),sn=oe(()=>X(O)(X(Gt).coordinate.x,X(Gt).coordinate.y)),on=oe(()=>X(Gt).placement!=null&&X(Gt).placement.minScale<=X($).scale&&X($).scale<=X(Gt).placement.maxScale);var _t=Oi(Qt);{var Ot=Ut=>{var ie=mkt();pk(ie,21,()=>X(Oe),dk,(je,qn,An)=>{var te=gkt();Kt(te,"x",0);let Dn;var Fr=Oi(te,!0);mi(te),Oo(Ti=>{Kt(te,"y",(An-(X(Oe).length-1)/2)*X(Gt).fontSize),Kt(te,"font-size",X(Gt).fontSize),Dn=kn(te,"",Dn,Ti),Uy(Fr,X(qn))},[()=>({"paint-order":"stroke","stroke-width":"4","stroke-linejoin":"round","stroke-linecap":"round","text-anchor":"middle",fill:X(L).clusterLabelColor,stroke:X(L).clusterLabelOutlineColor,opacity:X(L).clusterLabelOpacity,"user-select":"none","-webkit-user-select":"none","font-family":X(L).fontFamily})]),Gr(je,te)}),mi(ie),Gr(Ut,ie)};Ks(_t,Ut=>{X(on)&&Ut(Ot)})}mi(Qt),Oo(()=>Kt(Qt,"transform",`translate(${X(sn).x??""},${X(sn).y??""})`)),Gr(Wt,Qt)}),mi(Vt),Gr(Rt,Vt)};Ks(Mh,Rt=>{Rt(mm)})}var Ep=Nr(Mh);{var Ih=Rt=>{var Vt=Hm(),Wt=g0(Vt);{var Gt=Oe=>{$At(Oe,{get value(){return w()},get pointLocation(){return X(O)}})},Qt=Oe=>{{let sn=oe(()=>X(or)?.preventHover??(()=>{}));kAt(Oe,{get value(){return w()},onChange:Q,get pointLocation(){return X(O)},get coordinateAtPoint(){return X(B)},get preventHover(){return X(sn)}})}};Ks(Wt,Oe=>{w()instanceof Array?Oe(Gt):Oe(Qt,!1)})}Gr(Rt,Vt)};Ks(Ep,Rt=>{w()!=null&&X(Z)!=null&&Rt(Ih)})}mi(ys);var Rh=Nr(ys,2);{var ym=Rt=>{const Vt=oe(()=>X(O)(v().x,v().y));{let Wt=oe(()=>Math.max(3,X(Ct)/a())),Gt=oe(()=>A()??{class:Hi,props:{colorScheme:l(),fontFamily:X(L).fontFamily}});WAt(Rt,{get location(){return X(Vt)},get allowInteraction(){return X(U)},get targetHeight(){return X(Wt)},get customTooltip(){return X(Gt)},get tooltip(){return v()}})}};Ks(Rh,Rt=>{v()!=null&&X(Z)!=null&&Rt(ym)})}var kp=Nr(Rh,2);{var Ch=Rt=>{{let Vt=oe(()=>X(gt)??X(mt)),Wt=oe(()=>1/(X(O)(1,0).x-X(O)(0,0).x));qAt(Rt,{get resolvedTheme(){return X(L)},get statusMessage(){return X(Vt)},get distancePerPoint(){return X(Wt)},get pointCount(){return n().x.length},get selectionMode(){return X(pt)},onSelectionMode:Gt=>De(pt,Gt,!0)})}};Ks(kp,Rt=>{X(L).statusBar&&Rt(Ch)})}return mi(Gi),Oo((Rt,Vt)=>{wo=kn(Gi,"",wo,Rt),Nl=kn(ni,"",Nl,Vt),Kt(ys,"width",s()),Kt(ys,"height",o())},[()=>({width:`${s()??""}px`,height:`${o()??""}px`,position:"relative"}),()=>({width:`${s()??""}px`,height:`${o()??""}px`,position:"absolute",top:"0",left:"0"})]),pL("wheel",ys,function(...Rt){X(or)?.wheel?.apply(this,Rt)}),pL("mouseleave",ys,function(...Rt){X(or)?.mouseleave?.apply(this,Rt)}),Gr(e,Gi),pp({updateLabels:Ln})}HI(["mousedown","mousemove"]);function FL(e,t){if(t.length==0)return Zt(!1);if(e.identifier!=null){let n=e.identifier;return Ns(...t.map(r=>No(Mt(n),Zt(r.identifier))))}else{let n=e.x,r=e.y,i=e.category;return i!=null?Ns(...t.map(s=>Di(No(Xr(Mt(n),"DOUBLE"),Zt(s.x)),No(Xr(Mt(r),"DOUBLE"),Zt(s.y)),No(Xr(Mt(i),"INTEGER"),Zt(s.category))))):Ns(...t.map(s=>Di(No(Xr(Mt(n),"DOUBLE"),Zt(s.x)),No(Xr(Mt(r),"DOUBLE"),Zt(s.y)))))}}function wkt(e,t,n){let r=[];for(let s=0;ser(s,o));return No(_yt(i,Zt(2)),Zt(1))}function xkt(e,t){if(t instanceof Array){if(t.length<3)return Zt(!1);let n=fY(t);return Di($s(Mt(e.x),[n.xMin,n.xMax]),$s(Mt(e.y),[n.yMin,n.yMax]),wkt(Mt(e.x),Mt(e.y),t))}else return Di($s(Mt(e.x),[t.xMin,t.xMax]),$s(Mt(e.y),[t.yMin,t.yMax]))}async function Skt(e,t){let{x:n,y:r,table:i}=t,s=await e.query(zt.from(i).select({centerX:ee`MEDIAN(${Mt(n)})`,centerY:ee`MEDIAN(${Mt(r)})`,stdX:ee`STDDEV(${Mt(n)})`,stdY:ee`STDDEV(${Mt(r)})`,...t.category!=null?{maxCategory:ee`MAX(${Mt(t.category)}::UTINYINT)`}:{}})),{centerX:o,centerY:a,stdX:l,stdY:c,maxCategory:u}=s.get(0),f=1/(Math.max(l,c,.001)*3),h=.1/f,d=ee`FLOOR((${Mt(n)} - ${o}) / ${h})`,g=ee`FLOOR((${Mt(r)} - ${a}) / ${h})`,y=t.category!=null?Mt(t.category):null,v=y!=null?[d,g,y]:[d,g],b=zt.from(zt.from(i).select({count:ee`COUNT(*)`}).groupby(...v)).select({totalCount:ee`SUM(count)::INT`,maxCount:ee`MAX(count)::INT`});s=await e.query(b);let{maxCount:_,totalCount:w}=s.get(0),S=_/(h*h);return{centerX:o,centerY:a,scaler:f,totalCount:w,categoryCount:(u??0)+1,maxDensity:S}}let Akt=class{coordinator;source;lastDistance;selectParams;constructor(t,n){this.coordinator=t,this.source=n,this.lastDistance=0;let{x:r,y:i,category:s,text:o,identifier:a}=this.source,l={},c=n.additionalFields??{};for(let u in c){let f=c[u];typeof f=="string"?l["field_"+u]=Mt(f):l["field_"+u]=ee`${f.sql}`}this.selectParams={x:ee`${Mt(r)}::DOUBLE`,y:ee`${Mt(i)}::DOUBLE`,...s!=null?{category:ee`${Mt(s)}::INT`}:{},...o!=null?{text:ee`${Mt(o)}`}:{},...a!=null?{identifier:ee`${Mt(a)}`}:{},...l}}_convertToDataPoint(t){let n={};for(let r in t)r.startsWith("field_")&&(n[r.slice(6)]=t[r]);return{x:t.x,y:t.y,category:t.category,text:t.text,identifier:t.identifier,fields:n}}async queryClosestPoint(t,n,r,i){let s=i*12,{x:o,y:a}=this.source;for(let l of[this.lastDistance,s]){if(l==0||l>s)continue;let c=zt.from(this.source.table).select(this.selectParams);c=c.where(ee`${Mt(o)} BETWEEN ${n-l} AND ${n+l}`),c=c.where(ee`${Mt(a)} BETWEEN ${r-l} AND ${r+l}`),t&&(c=c.where(t)),c=c.orderby(ee`(x - (${n}))**2 + (y - (${r}))**2`).limit(1);let u=(await this.coordinator.query(c)).get(0);if(u)return this.lastDistance=Math.max(Math.abs(u.x-n),Math.abs(u.y-r))*4,this._convertToDataPoint(u)}return null}async queryPoints(t){let{table:n,identifier:r}=this.source;if(r==null)return[];let i=zt.from(n).select(this.selectParams);return i=i.where(Od(Mt(r),t.map(s=>Zt(s)))),Array.from(await this.coordinator.query(i)).map(s=>this._convertToDataPoint(s))}};function Ekt(e){let t=e.coordinator??Va(),n=new kkt({...e,coordinator:t});return t.connect(n),n.destroy=()=>{t.disconnect(n)},n}let kkt=class extends ch{_spec;constructor(t){super(t.selection??void 0),this._spec={...t}}query(t){return this._spec.query(t)}queryResult(t){return this._spec.queryResult?.(t),this}queryPending(){return this._spec.queryPending?.(),this}queryError(t){return this._spec.queryError?.(t),this}};function Tkt(e,t){dp(t,!0);let n=ae(t,"coordinator",19,Va),r=ae(t,"category",3,null),i=ae(t,"text",3,null),s=ae(t,"identifier",3,null),o=ae(t,"filter",3,null),a=ae(t,"categoryColors",3,null),l=ae(t,"tooltip",3,null),c=ae(t,"additionalFields",3,null),u=ae(t,"selection",3,null),f=ae(t,"rangeSelection",3,null),h=ae(t,"rangeSelectionValue",3,null),d=ae(t,"width",3,null),g=ae(t,"height",3,null),y=ae(t,"pixelRatio",3,null),v=ae(t,"colorScheme",3,"light"),b=ae(t,"theme",3,null),_=ae(t,"viewportState",3,null),w=ae(t,"automaticLabels",3,!1),S=ae(t,"mode",3,"density"),k=ae(t,"minimumDensity",3,1/16),A=ae(t,"customTooltip",3,null),T=ae(t,"customOverlay",3,null),M=ae(t,"onViewportState",3,null),I=ae(t,"onTooltip",3,null),C=ae(t,"onSelection",3,null),N=ae(t,"onRangeSelection",3,null),L=Sr(new Float32Array),F=Sr(new Float32Array),$=Sr(null),D=Sr(1),O=Sr(1),B=Sr(1),V=Sr(null),U=Sr(null),z=Sr(null),q=Sr(null),Y=Sr(null);Zc(()=>{let Z={coordinator:n(),source:{table:t.table,x:t.x,y:t.y,category:r()}},mt=null,at=!1;async function Ct(){let wt=Z.source,Bt=await Skt(Z.coordinator,wt);if(at)return;let Pt=Bt.scaler*.95;De(V,{x:Bt.centerX,y:Bt.centerY,scale:Pt}),De(O,Bt.totalCount),De(B,Bt.maxDensity),De(D,Bt.categoryCount),mt=Ekt({coordinator:Z.coordinator,selection:o(),query:kt=>zt.from(wt.table).select({x:ee`${Mt(wt.x)}::FLOAT`,y:ee`${Mt(wt.y)}::FLOAT`,...wt.category!=null?{c:ee`${Mt(wt.category)}::UTINYINT`}:{}}).where(kt),queryResult:kt=>{let qt=kt.getChild("x").toArray(),Re=kt.getChild("y").toArray(),Ht=kt.getChild("c")?.toArray()??null;qt!=null&&!(qt instanceof Float32Array)&&(qt=new Float32Array(qt)),Re!=null&&!(Re instanceof Float32Array)&&(Re=new Float32Array(Re)),Ht!=null&&!(Ht instanceof Uint8Array)&&(Ht=new Uint8Array(Ht)),De(L,qt),De(F,Re),De($,Ht),Q(null),ft(null)}}),mt.reset=()=>{gt()},De(Y,mt)}return Ct(),()=>{De(Y,null),at=!0,mt?.destroy()}}),Zc(()=>{if(Os(l())){let Z=X(Y);if(Z==null)return;let mt=l();De(U,mt.value);let at=()=>{De(U,mt.value)};return Zc(()=>{let Ct=X(U),wt={x:t.x,y:t.y,category:r(),identifier:s()};mt.update({source:Z,clients:new Set().add(Z),predicate:Ct!=null?FL(wt,[Ct]):null,value:Ct})}),mt.addEventListener("value",at),()=>{mt.removeEventListener("value",at),mt.update({source:Z,clients:new Set().add(Z),value:null,predicate:null})}}else if(l()==null||typeof l()=="object")De(U,l());else{if(X(U)?.identifier==l())return;let Z=!1;return vt([l()]).then(mt=>{Z||(mt.length>0?De(U,mt[0]):De(U,null))}),()=>{Z=!0}}});function Q(Z){kf(l(),Z)||(De(U,Z),I()?.(Z))}Zc(()=>{if(Os(u())){let Z=X(Y);if(Z==null)return;let mt=u();De(z,mt.value);let at=()=>{De(z,mt.value)};return Zc(()=>{let Ct=X(z),wt={x:t.x,y:t.y,category:r(),identifier:s()};mt.update({source:Z,clients:new Set().add(Z),predicate:Ct!=null?FL(wt,Ct):null,value:Ct})}),mt.addEventListener("value",at),()=>{mt.removeEventListener("value",at),mt.update({source:Z,clients:new Set().add(Z),value:null,predicate:null})}}else if(u()==null)De(z,null);else if(u().length==0)De(z,[]);else if(u().every(Z=>typeof Z=="object"))De(z,u());else{let Z=!1;return vt(u()).then(mt=>{Z||De(z,mt)}),()=>{Z=!0}}});function ft(Z){kf(u(),Z)||(De(z,Z),C()?.(Z))}Zc(()=>{let Z=X(Y);if(Z==null)return;let mt=f();if(mt!=null)return Zc(()=>{let at=X(q),Ct={x:t.x,y:t.y},wt={source:Z,clients:new Set().add(Z),predicate:at!=null?xkt(Ct,at):null,value:at};mt.update(wt),mt.activate(wt)}),()=>{mt.update({source:Z,clients:new Set().add(Z),value:null,predicate:null})}}),Zc(()=>{kf(Jg(()=>X(q)),h())||De(q,h())});function gt(){ft(null),Q(null),N()?.(null),De(q,null)}let pt=oe(()=>new Akt(n(),{table:t.table,x:t.x,y:t.y,category:r(),text:i(),identifier:s(),additionalFields:c()}));async function lt(Z,mt,at){return await X(pt).queryClosestPoint(o()?.predicate?.(X(Y)),Z,mt,at)}async function vt(Z){return await X(pt).queryPoints(Z)}async function st(Z){if(i()==null)return Z.map(()=>null);let mt=await akt({regions:Z}),at=0,Ct=1e4,wt=null;for(;;){let Pt=await n().query(zt.from(t.table).select({x:Mt(t.x),y:Mt(t.y),text:Mt(i())}).offset(at).limit(Ct)),kt={x:Pt.getChild("x").toArray(),y:Pt.getChild("y").toArray(),text:Pt.getChild("text").toArray()};if(wt!=null&&await wt,wt=ckt(mt,kt),Pt.getChild("text").lengthPt.length==0?null:Pt.length>2?Pt.slice(0,2).join("-")+`- +`+Pt.slice(2).join("-"):Pt.join("-"))}{let Z=oe(()=>S()??"points"),mt=oe(()=>d()??800),at=oe(()=>g()??800),Ct=oe(()=>y()??2),wt=oe(()=>v()??"light"),Bt=oe(()=>({x:X(L),y:X(F),category:X($)})),Pt=oe(()=>i()!=null?w()??!1:!1),kt=oe(()=>k()??1/16);_kt(e,{get mode(){return X(Z)},get width(){return X(mt)},get height(){return X(at)},get pixelRatio(){return X(Ct)},get colorScheme(){return X(wt)},get theme(){return b()},get data(){return X(Bt)},get totalCount(){return X(O)},get maxDensity(){return X(B)},get categoryCount(){return X(D)},get categoryColors(){return a()},get defaultViewportState(){return X(V)},querySelection:lt,queryClusterLabels:st,get automaticLabels(){return X(Pt)},get minimumDensity(){return X(kt)},get customTooltip(){return A()},get customOverlay(){return T()},get tooltip(){return X(U)},onTooltip:Q,get selection(){return X(z)},onSelection:ft,get viewportState(){return _()},get onViewportState(){return M()},get rangeSelection(){return X(q)},onRangeSelection:qt=>{De(q,qt),N()?.(qt)}})}pp()}let Mkt=class{component;currentProps;constructor(t,n){this.currentProps={...n},this.component=uAt({component:Tkt,target:t,props:n})}update(t){let n={};for(let r in t)t[r]!==this.currentProps[r]&&(n[r]=t[r],this.currentProps[r]=t[r]);this.component.$set(n)}destroy(){this.component.$destroy()}};function Ikt(){return mW()?32:4}function IY(e){let t=[];for(let n=0;n({...r}))}async queryOne(t){return{...(await this.coordinator.query(t)).get(0)}}async describe(){return await this.query(ee`DESCRIBE ${this.table}`)}async distinctCount(t){return(await this.queryOne(ee`SELECT COUNT(DISTINCT ${Mt(t)}) AS count FROM ${this.table}`)).count}async columnDescriptions(){let t=await this.describe(),n=[];for(let r of t)n.push({name:r.column_name,type:r.column_type,jsType:Yx(r.column_type),distinctCount:await this.distinctCount(r.column_name)});return n}async defaultViewportScale(t,n){let{stdX:r,stdY:i}=await this.queryOne(zt.from(this.table).select({stdX:ee`STDDEV(${Mt(t)})::FLOAT`,stdY:ee`STDDEV(${Mt(n)})::FLOAT`}));return 1/(Math.max(r,i,.001)*3)}defaultPlots(t){let n=[{id:Gh(),title:"Named Selections",spec:{component:"SelectionList",props:{}}}];for(let r of t)if(r.jsType!=null&&!(r.distinctCount<=1))switch(r.jsType){case"string":r.distinctCount<=1e3&&n.push({id:Gh(),title:r.name,spec:gw({name:r.name,type:"discrete"})});break;case"string[]":n.push({id:Gh(),title:r.name,spec:gw({name:r.name,type:"discrete[]"})});break;case"number":r.distinctCount<=10?n.push({id:Gh(),title:r.name,spec:gw({name:r.name,type:"discrete"})}):n.push({id:Gh(),title:r.name,spec:RY({name:r.name})});break}return n}async makeCategoryColumn(t,n){let r=`_ev_${t}_id`,i=Array.from(await this.query(zt.from(this.table).select({value:Xr(Mt(t),"TEXT"),count:ar()}).where(sg(ll(Xr(Mt(t),"TEXT")))).groupby(Xr(Mt(t),"TEXT")).orderby(Vg(ar())).limit(n))),s=i.length,o=i.length+1;await this.exec(ee` + ALTER TABLE ${this.table} ADD COLUMN IF NOT EXISTS ${Mt(r)} INTEGER DEFAULT 0; + UPDATE ${this.table} + SET ${Mt(r)} = CASE ${Mt(t)}::TEXT + ${i.map(({value:d},g)=>ee`WHEN ${Zt(d)} THEN ${Zt(g)}`).join(" ")} + ELSE (CASE WHEN ${Mt(t)} IS NULL THEN ${Zt(o)} ELSE ${Zt(s)} END) END + `);let a=await this.query(ee` + SELECT ${Mt(r)} AS index, COUNT(*)::INT AS count + FROM ${this.table} + GROUP BY ${Mt(r)} + `),l=new Map;for(let d of a)l.set(d.index,d.count);let c=l.get(s)??0,u=l.get(o)??0,f=Zg(i.length),h=i.map(({value:d},g)=>({label:d,color:f[g],predicate:No(Xr(Mt(t),"TEXT"),Zt(d)),count:l.get(g)??0}));if(c>0){let{otherCategoryCount:d}=await this.queryOne(ee` + SELECT COUNT(DISTINCT(${Mt(t)}::TEXT)) AS otherCategoryCount + FROM ${this.table} + WHERE ${Mt(r)} = ${Zt(s)} AND ${Mt(t)} IS NOT NULL + `);h.push({label:`(other ${d.toLocaleString()})`,color:"#9eabc2",predicate:i.length>0?ee`${Mt(t)} IS NOT NULL AND ${Mt(t)}::TEXT NOT IN (${i.map(g=>Zt(g.value)).join(",")})`:ee`${Mt(t)} IS NOT NULL`,count:c})}return u>0&&(c<=0&&(await this.exec(` + UPDATE ${this.table} + SET ${Mt(r)} = ${Mt(r)} - 1 WHERE ${Mt(r)} = ${Zt(o)} + `),o-=1),h.push({label:"(null)",color:"#aaaaaa",predicate:ll(Mt(t)),count:u})),{indexColumn:r,legend:h}}async makeBinnedNumericColumn(t){let n=await this.queryOne(zt.from(this.table).select({count:ar(),min:gl(Mt(t)),max:Da(Mt(t)),mean:CS(Mt(t)),median:NS(Mt(t))}).where(Lf(Mt(t)))),r=hV(n),i=`_ev_${t}_id`,s=Xr(Mt(t),"DOUBLE");s=r.scale.expr(s,r.scale.constant??0);let o=eo(Lf(Xr(Mt(t),"DOUBLE")),zo(Ue(Pe(s,r.binStart),1/r.binSize)),Zt(null));await this.exec(ee` + ALTER TABLE ${this.table} ADD COLUMN IF NOT EXISTS ${Mt(i)} INTEGER DEFAULT 0; + UPDATE ${this.table} + SET ${Mt(i)} = ${o} + `);let a=await this.query(ee` + SELECT ${Mt(i)} AS index, COUNT(*)::INT AS count + FROM ${this.table} + GROUP BY ${Mt(i)} + ORDER BY ${Mt(i)} ASC + `),l=null,c=null,u=new Map,f=g=>r.scale.reverse(g,r.scale.constant??0);for(let{index:g,count:y}of Array.from(a))g!=null&&((l==null||gc)&&(c=g)),u.set(g,y);let h=[],d=Wa(".6");if(l!=null&&c!=null){let g=IY(c-l+1);for(let y=l;y<=c;y++){let v=f(y*r.binSize+r.binStart),b=f((y+1)*r.binSize+r.binStart);h.push({label:`[${d(v)}, ${d(b)})`,color:g[y-l],predicate:No(o,Zt(y)),count:u.get(y)??0})}}if(u.has(null)){let g=h.length;await this.exec(` + UPDATE ${this.table} + SET ${Mt(i)} = ${Zt(g)} + WHERE ${Mt(i)} IS NULL + `),h.push({label:"(null / nan / inf)",color:"#aaaaaa",predicate:ll(o),count:u.get(null)??0})}return{indexColumn:i,legend:h}}}function Yx(e){return Ukt.has(e)?"number":zkt.has(e)?"string":e.match(/^(VARCHAR|TEXT)\[\d*\]$/)?"string[]":null}const Ukt=new Set(["REAL","FLOAT4","FLOAT8","FLOAT","DOUBLE","INT","TINYINT","INT1","SMALLINT","INT2","SHORT","INTEGER","INT4","INT","SIGNED","INT8","LONG","BIGINT","UTINYINT","USMALLINT","UINTEGER","UBIGINT","UHUGEINT"]),zkt=new Set(["BOOLEAN","DATE","VARCHAR","CHAR","BPCHAR","TEXT","STRING"]);var qkt=(e,t,n)=>G(t,n(),!0),jkt=At(""),Vkt=At('
    X
    Y
    ',1),Wkt=At('
    Text
    Model

    Computing the embedding and 2D projection in browser may take a while.

    ',1),Ykt=At('
    Image
    Model

    Computing the embedding and 2D projection in browser may take a while.

    ',1),Hkt=At(`

    Search and Tooltip (optional)

    The selected column, if any, will be used for full-text search and tooltips. Choose a column with freeform text, + such as a description, chat messages, or a summary.

    Text

    Embedding View (optional)

    To enable the embedding view, you can either (a) pick a pair of pre-computed X and Y columns; or (b) pick a text + column and compute the embedding projection in browser. For large data, it's recommended to pre-compute the + embedding and its 2D projection.

    `);function Gkt(e,t){ye(t,!0);const n=["Xenova/all-MiniLM-L6-v2","Xenova/multilingual-e5-small","Xenova/multilingual-e5-base","Xenova/multilingual-e5-large"],r=["Xenova/dinov2-small","Xenova/dinov2-base","Xenova/dinov2-large","Xenova/dino-vitb8","Xenova/dino-vits8","Xenova/dino-vitb16","Xenova/dino-vits16"];let i=xt("precomputed"),s=xt(null),o=xt(null),a=xt(null),l=xt(null),c=xt(null),u=xt(null),f=xt(null),h=dt(()=>t.columns.filter(I=>Yx(I.column_type)=="number")),d=dt(()=>t.columns.filter(I=>Yx(I.column_type)=="string"));fe(()=>{let I=x(f);bo(()=>x(a)==null)&&G(a,I,!0)});function g(){let I={text:x(f),embedding:null};if(x(i)=="precomputed"&&x(s)!=null&&x(o)!=null&&(I.embedding={precomputed:{x:x(s),y:x(o)}}),x(i)=="from-text"&&x(a)!=null){let C=x(l)?.trim()??"";(C==null||C=="")&&(C=n[0]),I.embedding={compute:{column:x(a),type:"text",model:C}}}if(x(i)=="from-image"&&x(c)!=null){let C=x(u)?.trim()??"";(C==null||C=="")&&(C=r[0]),I.embedding={compute:{column:x(c),type:"image",model:C}}}t.onConfirm?.(I)}var y=Hkt(),v=ot(y),b=yt(ot(v),4),_=yt(ot(b),2);{let I=dt(()=>[{value:null,label:"(none)"},...x(d).map(C=>({value:C.column_name,label:`${C.column_name} (${C.column_type})`}))]);xa(_,{class:"flex-1",get value(){return x(f)},onChange:C=>G(f,C,!0),get options(){return x(I)}})}tt(b);var w=yt(b,8);_n(w,20,()=>[["precomputed","Precomputed"],["from-text","From Text"],["from-image","From Image"],["none","Disabled"]],Bn,(I,C)=>{var N=dt(()=>qT(C,2));let L=()=>x(N)[0],F=()=>x(N)[1];var $=jkt();let D;$.__click=[qkt,i,L];var O=ot($,!0);tt($),Ft(B=>{D=lr($,1,"bg-slate-200 dark:bg-slate-700 dark:text-slate-400 px-2 py-1",null,D,B),ue(O,F())},[()=>({"!bg-slate-500":L()==x(i),"!text-slate-100":L()==x(i)})]),rt(I,$)}),tt(w);var S=yt(w,2);{var k=I=>{var C=Vkt(),N=Yt(C),L=yt(ot(N),2);{let D=dt(()=>[{value:null,label:"(none)"},...x(h).map(O=>({value:O.column_name,label:`${O.column_name} (${O.column_type})`}))]);xa(L,{class:"flex-1",get value(){return x(s)},onChange:O=>G(s,O,!0),get options(){return x(D)}})}tt(N);var F=yt(N,2),$=yt(ot(F),2);{let D=dt(()=>[{value:null,label:"(none)"},...x(h).map(O=>({value:O.column_name,label:`${O.column_name} (${O.column_type})`}))]);xa($,{class:"flex-1",get value(){return x(o)},onChange:O=>G(o,O,!0),get options(){return x(D)}})}tt(F),rt(I,C)},A=I=>{var C=wn(),N=Yt(C);{var L=$=>{var D=Wkt(),O=Yt(D),B=yt(ot(O),2);{let z=dt(()=>[{value:null,label:"(none)"},...x(d).map(q=>({value:q.column_name,label:`${q.column_name} (${q.column_type})`}))]);xa(B,{class:"flex-1",get value(){return x(a)},onChange:q=>G(a,q,!0),get options(){return x(z)}})}tt(O);var V=yt(O,2),U=yt(ot(V),2);wO(U,{className:"flex-1",get value(){return x(l)},get placeholder(){return`(default ${n[0]??""})`},onChange:z=>G(l,z,!0),get options(){return n}}),tt(V),Id(2),rt($,D)},F=$=>{var D=wn(),O=Yt(D);{var B=V=>{var U=Ykt(),z=Yt(U),q=yt(ot(z),2);{let ft=dt(()=>[{value:null,label:"(none)"},...t.columns.map(gt=>({value:gt.column_name,label:`${gt.column_name} (${gt.column_type})`}))]);xa(q,{class:"flex-1",get value(){return x(c)},onChange:gt=>G(c,gt,!0),get options(){return x(ft)}})}tt(z);var Y=yt(z,2),Q=yt(ot(Y),2);wO(Q,{className:"flex-1",get value(){return x(u)},get placeholder(){return`(default ${r[0]??""})`},onChange:ft=>G(u,ft,!0),get options(){return r}}),tt(Y),Id(2),rt(V,U)};Lt(O,V=>{x(i)=="from-image"&&V(B)},!0)}rt($,D)};Lt(N,$=>{x(i)=="from-text"?$(L):$(F,!1)},!0)}rt(I,C)};Lt(S,I=>{x(i)=="precomputed"?I(k):I(A,!1)})}tt(v);var T=yt(v,2),M=yt(ot(T),2);wa(M,{label:"Confirm",class:"w-40 justify-center",onClick:()=>{g()}}),tt(T),tt(y),rt(e,y),ve()}Dr(["click"]);function Xkt(e,t,n){const r=Array.from(e.target.files);r.length==1&&t(r[0])&&n.onUpload(r[0])}var Kkt=At('');function Jkt(e,t){ye(t,!0);let n=xt(!1),r;function i(d){d.preventDefault(),G(n,!0)}function s(){G(n,!1)}function o(d){if(d.preventDefault(),G(n,!1),d.dataTransfer.files&&d.dataTransfer.files.length==1){let g=d.dataTransfer.files[0];a(g)&&t.onUpload(g)}}function a(d){if(t.extensions==null)return!0;for(let g of t.extensions)if(d.name.toLowerCase().endsWith(g.toLowerCase()))return!0;return!1}var l=Kkt();l.__click=()=>{r.click()};var c=ot(l),u=ot(c),f=ot(u,!0);tt(u),Id(2),tt(c);var h=yt(c,2);h.__change=[Xkt,a,t],ho(h,d=>r=d,()=>r),tt(l),Ft(d=>{lr(l,1,`flex flex-col items-center w-[40rem] justify-center py-20 border-2 border-dashed rounded-md transition-all + ${x(n)?"bg-slate-50 border-slate-500 dark:bg-slate-900 dark:border-slate-500":"bg-slate-50 border-slate-300 dark:bg-slate-900 dark:border-slate-700"}`),ue(f,x(n)?"Drop your files here":"Drag & drop files here or click to select"),ct(h,"accept",d)},[()=>t.extensions?.join(",")]),I0("dragover",l,i),I0("dragleave",l,s),I0("drop",l,o),rt(e,l),ve()}Dr(["click","change"]);const L1=Symbol("Fixed"),_l=Symbol("Transient"),CY=Symbol("Transform");function Zkt(e){return e}var Qkt=3,BL=1e-6;function tTt(e){return"translate("+e+",0)"}function eTt(e){return t=>+e(t)}function nTt(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function rTt(){return!this.__axis}function iTt(e,t){var n=[],r=null,i=null,s=6,o=6,a=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=1,u="y",f=tTt;function h(d){var g=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):Zkt),v=Math.max(s,0)+a,b=t.range(),_=+b[0]+l,w=+b[b.length-1]+l,S=(t.bandwidth?nTt:eTt)(t.copy(),l),k=d.selection?d.selection():d,A=k.selectAll(".domain").data([null]),T=k.selectAll(".tick").data(g,t).order(),M=T.exit(),I=T.enter().append("g").attr("class","tick"),C=T.select("line"),N=T.select("text");A=A.merge(A.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(I),C=C.merge(I.append("line").attr("stroke","currentColor").attr(u+"2",c*s)),N=N.merge(I.append("text").attr("fill","currentColor").attr(u,c*v).attr("dy","0.71em")),d!==k&&(A=A.transition(d),T=T.transition(d),C=C.transition(d),N=N.transition(d),M=M.transition(d).attr("opacity",BL).attr("transform",function(L){return isFinite(L=S(L))?f(L+l):this.getAttribute("transform")}),I.attr("opacity",BL).attr("transform",function(L){var F=this.parentNode.__axis;return f((F&&isFinite(F=F(L))?F:S(L))+l)})),M.remove(),A.attr("d",o?"M"+_+","+c*o+"V"+l+"H"+w+"V"+c*o:"M"+_+","+l+"H"+w),T.attr("opacity",1).attr("transform",function(L){return f(S(L)+l)}),C.attr(u+"2",c*s),N.attr(u,c*v).text(y),k.filter(rTt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),k.each(function(){this.__axis=S})}return h.scale=function(d){return arguments.length?(t=d,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(s=o=+d,h):s},h.tickSizeInner=function(d){return arguments.length?(s=+d,h):s},h.tickSizeOuter=function(d){return arguments.length?(o=+d,h):o},h.tickPadding=function(d){return arguments.length?(a=+d,h):a},h.offset=function(d){return arguments.length?(l=+d,h):l},h}function sTt(e){return iTt(Qkt,e)}var oTt={value:()=>{}};function c3(){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}})}mw.prototype=c3.prototype={constructor:mw,on:function(e,t){var n=this._,r=aTt(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&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Nu.hasOwnProperty(t)?{space:Nu[t],local:e}:e}function cTt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tM&&t.documentElement.namespaceURI===tM?t.createElement(e):t.createElementNS(n,e)}}function uTt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function f3(e){var t=u3(e);return(t.local?uTt:cTt)(t)}function fTt(){}function tR(e){return e==null?fTt:function(){return this.querySelector(e)}}function hTt(e){typeof e!="function"&&(e=tR(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=w&&(w=_+1);!(k=v[w])&&++w=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function FTt(e){e||(e=BTt);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function PTt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function UTt(){return Array.from(this)}function zTt(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ZTt:typeof t=="function"?t4t:QTt)(e,t,n??"")):vg(this.node(),e)}function vg(e,t){return e.style.getPropertyValue(t)||DY(e).getComputedStyle(e,null).getPropertyValue(t)}function n4t(e){return function(){delete this[e]}}function r4t(e,t){return function(){this[e]=t}}function i4t(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function s4t(e,t){return arguments.length>1?this.each((t==null?n4t:typeof t=="function"?i4t:r4t)(e,t)):this.node()[e]}function FY(e){return e.trim().split(/^|\s+/)}function eR(e){return e.classList||new BY(e)}function BY(e){this._node=e,this._names=FY(e.getAttribute("class")||"")}BY.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function PY(e,t){for(var n=eR(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function $4t(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n=0&&e._call.call(void 0,t),e=e._next;--bg}function UL(){Gd=(Xx=Ov.now())+h3,bg=xy=0;try{j4t()}finally{bg=0,W4t(),Gd=0}}function V4t(){var e=Ov.now(),t=e-Xx;t>WY&&(h3-=t,Xx=e)}function W4t(){for(var e,t=Gx,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:Gx=n);Sy=e,rM(r)}function rM(e){if(!bg){xy&&(xy=clearTimeout(xy));var t=e-Gd;t>24?(e<1/0&&(xy=setTimeout(UL,e-Ov.now()-h3)),Xm&&(Xm=clearInterval(Xm))):(Xm||(Xx=Ov.now(),Xm=setInterval(V4t,WY)),bg=1,YY(UL))}}function zL(e,t,n){var r=new Kx;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Y4t=c3("start","end","cancel","interrupt"),H4t=[],GY=0,qL=1,iM=2,yw=3,jL=4,sM=5,vw=6;function d3(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;G4t(e,n,{name:t,index:r,group:i,on:Y4t,tween:H4t,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:GY})}function rR(e,t){var n=Ml(e,t);if(n.state>GY)throw new Error("too late; already scheduled");return n}function Rc(e,t){var n=Ml(e,t);if(n.state>yw)throw new Error("too late; already running");return n}function Ml(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function G4t(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=HY(s,0,n.time);function s(c){n.state=qL,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,f,h,d;if(n.state!==qL)return l();for(u in r)if(d=r[u],d.name===n.name){if(d.state===yw)return zL(o);d.state===jL?(d.state=vw,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+uiM&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function AMt(e,t,n){var r,i,s=SMt(t)?rR:Rc;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function EMt(e,t){var n=this._id;return arguments.length<2?Ml(this.node(),n).on.on(e):this.each(AMt(n,e,t))}function kMt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function TMt(){return this.on("end.remove",kMt(this._id))}function MMt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tR(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o()=>e;function QMt(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function t5t(e){e.stopImmediatePropagation()}function Ak(e){e.preventDefault(),e.stopImmediatePropagation()}var VL={name:"drag"},Ek={name:"space"},Gp={name:"handle"},Xp={name:"center"};const{abs:WL,max:Zi,min:Qi}=Math;function YL(e){return[+e[0],+e[1]]}function oM(e){return[YL(e[0]),YL(e[1])]}var bw={name:"x",handles:["w","e"].map(Lv),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},_w={name:"y",handles:["n","s"].map(Lv),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},e5t={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Lv),input:function(e){return e==null?null:oM(e)},output:function(e){return e}},Yc={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},HL={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},GL={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},n5t={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},r5t={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Lv(e){return{type:e}}function i5t(e){return!e.ctrlKey&&!e.button}function s5t(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function o5t(){return navigator.maxTouchPoints||"ontouchstart"in this}function kk(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function a5t(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function l5t(){return sR(bw)}function c5t(){return sR(_w)}function u5t(){return sR(e5t)}function sR(e){var t=s5t,n=i5t,r=o5t,i=!0,s=c3("start","brush","end"),o=6,a;function l(v){var b=v.property("__brush",y).selectAll(".overlay").data([Lv("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Yc.overlay).merge(b).each(function(){var w=kk(this).extent;Ar(this).attr("x",w[0][0]).attr("y",w[0][1]).attr("width",w[1][0]-w[0][0]).attr("height",w[1][1]-w[0][1])}),v.selectAll(".selection").data([Lv("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Yc.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var _=v.selectAll(".handle").data(e.handles,function(w){return w.type});_.exit().remove(),_.enter().append("rect").attr("class",function(w){return"handle handle--"+w.type}).attr("cursor",function(w){return Yc[w.type]}),v.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}l.move=function(v,b,_){v.tween?v.on("start.brush",function(w){u(this,arguments).beforestart().start(w)}).on("interrupt.brush end.brush",function(w){u(this,arguments).end(w)}).tween("brush",function(){var w=this,S=w.__brush,k=u(w,arguments),A=S.selection,T=e.input(typeof b=="function"?b.apply(this,arguments):b,S.extent),M=Kg(A,T);function I(C){S.selection=C===1&&T===null?null:M(C),c.call(w),k.brush()}return A!==null&&T!==null?I:I(1)}):v.each(function(){var w=this,S=arguments,k=w.__brush,A=e.input(typeof b=="function"?b.apply(w,S):b,k.extent),T=u(w,S).beforestart();V0(w),k.selection=A===null?null:A,c.call(w),T.start(_).brush(_).end(_)})},l.clear=function(v,b){l.move(v,null,b)};function c(){var v=Ar(this),b=kk(this).selection;b?(v.selectAll(".selection").style("display",null).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1]),v.selectAll(".handle").style("display",null).attr("x",function(_){return _.type[_.type.length-1]==="e"?b[1][0]-o/2:b[0][0]-o/2}).attr("y",function(_){return _.type[0]==="s"?b[1][1]-o/2:b[0][1]-o/2}).attr("width",function(_){return _.type==="n"||_.type==="s"?b[1][0]-b[0][0]+o:o}).attr("height",function(_){return _.type==="e"||_.type==="w"?b[1][1]-b[0][1]+o:o})):v.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(v,b,_){var w=v.__brush.emitter;return w&&(!_||!w.clean)?w:new f(v,b,_)}function f(v,b,_){this.that=v,this.args=b,this.state=v.__brush,this.active=0,this.clean=_}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(v,b){return this.starting?(this.starting=!1,this.emit("start",v,b)):this.emit("brush",v),this},brush:function(v,b){return this.emit("brush",v,b),this},end:function(v,b){return--this.active===0&&(delete this.state.emitter,this.emit("end",v,b)),this},emit:function(v,b,_){var w=Ar(this.that).datum();s.call(v,this.that,new QMt(v,{sourceEvent:b,target:l,selection:e.output(this.state.selection),mode:_,dispatch:s}),w)}};function h(v){if(a&&!v.touches||!n.apply(this,arguments))return;var b=this,_=v.target.__data__.type,w=(i&&v.metaKey?_="overlay":_)==="selection"?VL:i&&v.altKey?Xp:Gp,S=e===_w?null:n5t[_],k=e===bw?null:r5t[_],A=kk(b),T=A.extent,M=A.selection,I=T[0][0],C,N,L=T[0][1],F,$,D=T[1][0],O,B,V=T[1][1],U,z,q=0,Y=0,Q,ft=S&&k&&i&&v.shiftKey,gt,pt,lt=Array.from(v.touches||[v],kt=>{const qt=kt.identifier;return kt=Qa(kt,b),kt.point0=kt.slice(),kt.identifier=qt,kt});V0(b);var vt=u(b,arguments,!0).beforestart();if(_==="overlay"){M&&(Q=!0);const kt=[lt[0],lt[1]||lt[0]];A.selection=M=[[C=e===_w?I:Qi(kt[0][0],kt[1][0]),F=e===bw?L:Qi(kt[0][1],kt[1][1])],[O=e===_w?D:Zi(kt[0][0],kt[1][0]),U=e===bw?V:Zi(kt[0][1],kt[1][1])]],lt.length>1&&Ct(v)}else C=M[0][0],F=M[0][1],O=M[1][0],U=M[1][1];N=C,$=F,B=O,z=U;var st=Ar(b).attr("pointer-events","none"),Z=st.selectAll(".overlay").attr("cursor",Yc[_]);if(v.touches)vt.moved=at,vt.ended=wt;else{var mt=Ar(v.view).on("mousemove.brush",at,!0).on("mouseup.brush",wt,!0);i&&mt.on("keydown.brush",Bt,!0).on("keyup.brush",Pt,!0),jY(v.view)}c.call(b),vt.start(v,w.name);function at(kt){for(const qt of kt.changedTouches||[kt])for(const Re of lt)Re.identifier===qt.identifier&&(Re.cur=Qa(qt,b));if(ft&&!gt&&!pt&<.length===1){const qt=lt[0];WL(qt.cur[0]-qt[0])>WL(qt.cur[1]-qt[1])?pt=!0:gt=!0}for(const qt of lt)qt.cur&&(qt[0]=qt.cur[0],qt[1]=qt.cur[1]);Q=!0,Ak(kt),Ct(kt)}function Ct(kt){const qt=lt[0],Re=qt.point0;var Ht;switch(q=qt[0]-Re[0],Y=qt[1]-Re[1],w){case Ek:case VL:{S&&(q=Zi(I-C,Qi(D-O,q)),N=C+q,B=O+q),k&&(Y=Zi(L-F,Qi(V-U,Y)),$=F+Y,z=U+Y);break}case Gp:{lt[1]?(S&&(N=Zi(I,Qi(D,lt[0][0])),B=Zi(I,Qi(D,lt[1][0])),S=1),k&&($=Zi(L,Qi(V,lt[0][1])),z=Zi(L,Qi(V,lt[1][1])),k=1)):(S<0?(q=Zi(I-C,Qi(D-C,q)),N=C+q,B=O):S>0&&(q=Zi(I-O,Qi(D-O,q)),N=C,B=O+q),k<0?(Y=Zi(L-F,Qi(V-F,Y)),$=F+Y,z=U):k>0&&(Y=Zi(L-U,Qi(V-U,Y)),$=F,z=U+Y));break}case Xp:{S&&(N=Zi(I,Qi(D,C-q*S)),B=Zi(I,Qi(D,O+q*S))),k&&($=Zi(L,Qi(V,F-Y*k)),z=Zi(L,Qi(V,U+Y*k)));break}}B0&&(C=N-q),k<0?U=z-Y:k>0&&(F=$-Y),w=Ek,Z.attr("cursor",Yc.selection),Ct(kt));break}default:return}Ak(kt)}function Pt(kt){switch(kt.keyCode){case 16:{ft&&(gt=pt=ft=!1,Ct(kt));break}case 18:{w===Xp&&(S<0?O=B:S>0&&(C=N),k<0?U=z:k>0&&(F=$),w=Gp,Ct(kt));break}case 32:{w===Ek&&(kt.altKey?(S&&(O=B-q*S,C=N+q*S),k&&(U=z-Y*k,F=$+Y*k),w=Xp):(S<0?O=B:S>0&&(C=N),k<0?U=z:k>0&&(F=$),w=Gp),Z.attr("cursor",Yc[_]),Ct(kt));break}default:return}Ak(kt)}}function d(v){u(this,arguments).moved(v)}function g(v){u(this,arguments).ended(v)}function y(){var v=this.__brush||{selection:null};return v.extent=oM(t.apply(this,arguments)),v.dim=e,v}return l.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Sk(oM(v)),l):t},l.filter=function(v){return arguments.length?(n=typeof v=="function"?v:Sk(!!v),l):n},l.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Sk(!!v),l):r},l.handleSize=function(v){return arguments.length?(o=+v,l):o},l.keyModifiers=function(v){return arguments.length?(i=!!v,l):i},l.on=function(){var v=s.on.apply(s,arguments);return v===s?l:v},l}const aM=Math.PI,lM=2*aM,Hh=1e-6,f5t=lM-Hh;function ZY(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ZY;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iHh)if(!(Math.abs(f*l-c*u)>Hh)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let d=r-o,g=i-a,y=l*l+c*c,v=d*d+g*g,b=Math.sqrt(y),_=Math.sqrt(h),w=s*Math.tan((aM-Math.acos((y+h-v)/(2*b*_)))/2),S=w/_,k=w/b;Math.abs(S-1)>Hh&&this._append`L${t+S*u},${n+S*f}`,this._append`A${s},${s},0,0,${+(f*d>u*g)},${this._x1=t+k*l},${this._y1=n+k*c}`}}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),l=r*Math.sin(i),c=t+a,u=n+l,f=1^o,h=o?i-s:s-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Hh||Math.abs(this._y1-u)>Hh)&&this._append`L${c},${u}`,r&&(h<0&&(h=h%lM+lM),h>f5t?this._append`A${r},${r},0,1,${f},${t-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=u}`:h>Hh&&this._append`A${r},${r},0,${+(h>=aM)},${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 pu(e=3){return new QY(+e)}var d5t=Array.prototype,tH=d5t.slice;function p5t(e,t){return e-t}function g5t(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t()=>e;function m5t(e,t){for(var n=-1,r=t.length,i;++nr!=d>r&&n<(h-c)*(r-u)/(d-u)+c&&(i=-i)}return i}function v5t(e,t,n){var r;return b5t(e,t,n)&&_5t(e[r=+(e[0]===t[0])],n[r],t[r])}function b5t(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function _5t(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function w5t(){}var Hc=[[],[[[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 Jx(){var e=1,t=1,n=uI,r=l;function i(c){var u=n(c);if(Array.isArray(u))u=u.slice().sort(p5t);else{const f=yi(c,x5t);for(u=Yf(...mj(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]s(c,f))}function s(c,u){const f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var h=[],d=[];return o(c,f,function(g){r(g,c,f),g5t(g)>0?h.push([g]):d.push(g)}),d.forEach(function(g){for(var y=0,v=h.length,b;y=u,Hc[_<<2].forEach(S);++g0&&d0&&g=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(c){return arguments.length?(n=typeof c=="function"?c:Array.isArray(c)?bf(tH.call(c)):bf(c),i):n},i.smooth=function(c){return arguments.length?(r=c?l:w5t,i):r===l},i}function x5t(e){return isFinite(e)?e:NaN}function qh(e,t){return e==null?!1:+e>=t}function Tk(e){return e==null||isNaN(e=+e)?-1/0:e}function XL(e,t,n,r){const i=r-t,s=n-t,o=isFinite(i)||isFinite(s)?i/s:Math.sign(i)/Math.sign(s);return isNaN(o)?e:e+o-.5}function S5t(e){return e[0]}function A5t(e){return e[1]}function E5t(){return 1}function k5t(){var e=S5t,t=A5t,n=E5t,r=960,i=500,s=20,o=2,a=s*3,l=r+a*2>>o,c=i+a*2>>o,u=bf(20);function f(_){var w=new Float32Array(l*c),S=Math.pow(2,-o),k=-1;for(const F of _){var A=(e(F,++k,_)+a)*S,T=(t(F,k,_)+a)*S,M=+n(F,k,_);if(M&&A>=0&&A=0&&TA*k))(w).map((A,T)=>(A.value=+S[T],d(A)))}h.contours=function(_){var w=f(_),S=Jx().size([l,c]),k=Math.pow(2,2*o),A=T=>{T=+T;var M=d(S.contour(w,T*k));return M.value=T,M};return Object.defineProperty(A,"max",{get:()=>Vr(w)/k}),A};function d(_){return _.coordinates.forEach(g),_}function g(_){_.forEach(y)}function y(_){_.forEach(v)}function v(_){_[0]=_[0]*Math.pow(2,o)-a,_[1]=_[1]*Math.pow(2,o)-a}function b(){return a=s*3,l=r+a*2>>o,c=i+a*2>>o,h}return h.x=function(_){return arguments.length?(e=typeof _=="function"?_:bf(+_),h):e},h.y=function(_){return arguments.length?(t=typeof _=="function"?_:bf(+_),h):t},h.weight=function(_){return arguments.length?(n=typeof _=="function"?_:bf(+_),h):n},h.size=function(_){if(!arguments.length)return[r,i];var w=+_[0],S=+_[1];if(!(w>=0&&S>=0))throw new Error("invalid size");return r=w,i=S,b()},h.cellSize=function(_){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return o=Math.floor(Math.log(_)/Math.LN2),b()},h.thresholds=function(_){return arguments.length?(u=typeof _=="function"?_:Array.isArray(_)?bf(tH.call(_)):bf(_),h):u},h.bandwidth=function(_){if(!arguments.length)return Math.sqrt(s*(s+1));if(!((_=+_)>=0))throw new Error("invalid bandwidth");return s=(Math.sqrt(4*_*_+1)-1)/2,b()},h}const xu=11102230246251565e-32,ts=134217729,T5t=(3+8*xu)*xu;function Mk(e,t,n,r,i){let s,o,a,l,c=t[0],u=r[0],f=0,h=0;u>c==u>-c?(s=c,c=t[++f]):(s=u,u=r[++h]);let d=0;if(fc==u>-c?(o=c+s,a=s-(o-c),c=t[++f]):(o=u+s,a=s-(o-u),u=r[++h]),s=o,a!==0&&(i[d++]=a);fc==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=t[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=r[++h]),s=o,a!==0&&(i[d++]=a);for(;f=$||-F>=$||(f=e-I,a=e-(I+f)+(f-i),f=n-C,c=n-(C+f)+(f-i),f=t-N,l=t-(N+f)+(f-s),f=r-L,u=r-(L+f)+(f-s),a===0&&l===0&&c===0&&u===0)||($=C5t*o+T5t*Math.abs(F),F+=I*u+L*a-(N*c+C*l),F>=$||-F>=$))return F;S=a*L,h=ts*a,d=h-(h-a),g=a-d,h=ts*L,y=h-(h-L),v=L-y,k=g*v-(S-d*y-g*y-d*v),A=l*C,h=ts*l,d=h-(h-l),g=l-d,h=ts*C,y=h-(h-C),v=C-y,T=g*v-(A-d*y-g*y-d*v),b=k-T,f=k-b,ws[0]=k-(b+f)+(f-T),_=S+b,f=_-S,w=S-(_-f)+(b-f),b=w-A,f=w-b,ws[1]=w-(b+f)+(f-A),M=_+b,f=M-_,ws[2]=_-(M-f)+(b-f),ws[3]=M;const D=Mk(4,Kp,4,ws,KL);S=I*u,h=ts*I,d=h-(h-I),g=I-d,h=ts*u,y=h-(h-u),v=u-y,k=g*v-(S-d*y-g*y-d*v),A=N*c,h=ts*N,d=h-(h-N),g=N-d,h=ts*c,y=h-(h-c),v=c-y,T=g*v-(A-d*y-g*y-d*v),b=k-T,f=k-b,ws[0]=k-(b+f)+(f-T),_=S+b,f=_-S,w=S-(_-f)+(b-f),b=w-A,f=w-b,ws[1]=w-(b+f)+(f-A),M=_+b,f=M-_,ws[2]=_-(M-f)+(b-f),ws[3]=M;const O=Mk(D,KL,4,ws,JL);S=a*u,h=ts*a,d=h-(h-a),g=a-d,h=ts*u,y=h-(h-u),v=u-y,k=g*v-(S-d*y-g*y-d*v),A=l*c,h=ts*l,d=h-(h-l),g=l-d,h=ts*c,y=h-(h-c),v=c-y,T=g*v-(A-d*y-g*y-d*v),b=k-T,f=k-b,ws[0]=k-(b+f)+(f-T),_=S+b,f=_-S,w=S-(_-f)+(b-f),b=w-A,f=w-b,ws[1]=w-(b+f)+(f-A),M=_+b,f=M-_,ws[2]=_-(M-f)+(b-f),ws[3]=M;const B=Mk(O,JL,4,ws,ZL);return ZL[B-1]}function b_(e,t,n,r,i,s){const o=(t-s)*(n-i),a=(e-i)*(r-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=I5t*c?l:-N5t(e,t,n,r,i,s,c)}const QL=Math.pow(2,-52),__=new Uint32Array(512);class Zx{static from(t,n=F5t,r=B5t){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,l=1/0,c=-1/0,u=-1/0;for(let I=0;Ic&&(c=C),N>u&&(u=N),this._ids[I]=I}const f=(a+c)/2,h=(l+u)/2;let d,g,y;for(let I=0,C=1/0;I0&&(g=I,C=N)}let _=t[2*g],w=t[2*g+1],S=1/0;for(let I=0;IL&&(I[C++]=F,L=$)}this.hull=I.subarray(0,C),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(b_(v,b,_,w,k,A)<0){const I=g,C=_,N=w;g=y,_=k,w=A,y=I,k=C,A=N}const T=D5t(v,b,_,w,k,A);this._cx=T.x,this._cy=T.y;for(let I=0;I0&&Math.abs(F-C)<=QL&&Math.abs($-N)<=QL||(C=F,N=$,L===d||L===g||L===y))continue;let D=0;for(let z=0,q=this._hashKey(F,$);z=0;)if(O=B,O===D){O=-1;break}if(O===-1)continue;let V=this._addTriangle(O,L,r[O],-1,-1,i[O]);i[L]=this._legalize(V+2),i[O]=V,M++;let U=r[O];for(;B=r[U],b_(F,$,t[2*U],t[2*U+1],t[2*B],t[2*B+1])<0;)V=this._addTriangle(U,L,B,i[L],-1,i[U]),i[L]=this._legalize(V+2),r[U]=U,M--,U=B;if(O===D)for(;B=n[O],b_(F,$,t[2*B],t[2*B+1],t[2*O],t[2*O+1])<0;)V=this._addTriangle(B,L,O,-1,i[O],i[B]),this._legalize(V+2),i[B]=V,r[O]=O,M--,O=B;this._hullStart=n[L]=O,r[O]=n[U]=L,r[L]=U,s[this._hashKey(F,$)]=L,s[this._hashKey(t[2*O],t[2*O+1])]=O}this.hull=new Uint32Array(M);for(let I=0,C=this._hullStart;I0?3-n:1+n)/4}function Ik(e,t,n,r){const i=e-n,s=t-r;return i*i+s*s}function O5t(e,t,n,r,i,s,o,a){const l=e-o,c=t-a,u=n-o,f=r-a,h=i-o,d=s-a,g=l*l+c*c,y=u*u+f*f,v=h*h+d*d;return l*(f*v-y*d)-c*(u*v-y*h)+g*(u*d-f*h)<0}function L5t(e,t,n,r,i,s){const o=n-e,a=r-t,l=i-e,c=s-t,u=o*o+a*a,f=l*l+c*c,h=.5/(o*c-a*l),d=(c*u-a*f)*h,g=(o*f-l*u)*h;return d*d+g*g}function D5t(e,t,n,r,i,s){const o=n-e,a=r-t,l=i-e,c=s-t,u=o*o+a*a,f=l*l+c*c,h=.5/(o*c-a*l),d=e+(c*u-a*f)*h,g=t+(o*f-l*u)*h;return{x:d,y:g}}function _0(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;Km(e,i,s),t[e[n]]>t[e[r]]&&Km(e,n,r),t[e[s]]>t[e[r]]&&Km(e,s,r),t[e[n]]>t[e[s]]&&Km(e,n,s);const a=e[s],l=t[a];for(;;){do s++;while(t[e[s]]l);if(o=o-n?(_0(e,t,s,r),_0(e,t,n,o-1)):(_0(e,t,n,o-1),_0(e,t,s,r))}}function Km(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function F5t(e){return e[0]}function B5t(e){return e[1]}const tD=1e-6;class id{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)>tD||Math.abs(this._y1-s)>tD)&&(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 cM{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 P5t=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 y=0,v=0,b=r.length,_,w;y1;)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 V5t(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class mh{static from(t,n=z5t,r=q5t,i){return new mh("length"in t?W5t(t,n,r,i):Float64Array.from(Y5t(t,n,r,i)))}constructor(t){this._delaunator=new Zx(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&&j5t(t)){this.collinear=Int32Array.from({length:n.length/2},(h,d)=>d).sort((h,d)=>n[2*h]-n[2*d]||n[2*h+1]-n[2*d+1]);const l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[n[2*l],n[2*l+1],n[2*c],n[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let h=0,d=n.length/2;h0&&(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 P5t(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:l,points:c}=this;if(i[t]===-1||!c.length)return(t+1)%(c.length>>1);let u=t,f=Jp(n-c[t*2],2)+Jp(r-c[t*2+1],2);const h=i[t];let d=h;do{let g=l[d];const y=Jp(n-c[g*2],2)+Jp(r-c[g*2+1],2);if(y0?1:e<0?-1:0},Ps=Math.sqrt,oR=Math.tan;function nH(e){return e>1?0:e<-1?rn:Math.acos(e)}function yo(e){return e>1?Kr:e<-1?-Kr:Math.asin(e)}function Fo(){}function e2(e,t){e&&rD.hasOwnProperty(e.type)&&rD[e.type](e,t)}var nD={Feature:function(e,t){e2(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rrn&&(e-=Math.round(e/Yo)*Yo),[e,t]}vM.invert=vM;function oH(e,t,n){return(e%=Yo)?t||n?yM(lD(e),cD(t,n)):lD(e):t||n?cD(t,n):vM}function aD(e){return function(t,n){return t+=e,Un(t)>rn&&(t-=Math.round(t/Yo)*Yo),[t,n]}}function lD(e){var t=aD(e);return t.invert=aD(-e),t}function cD(e,t){var n=Ne(e),r=he(e),i=Ne(t),s=he(t);function o(a,l){var c=Ne(l),u=Ne(a)*c,f=he(a)*c,h=he(l),d=h*n+u*r;return[wl(f*i-d*s,u*n-h*r),yo(d*i+f*s)]}return o.invert=function(a,l){var c=Ne(l),u=Ne(a)*c,f=he(a)*c,h=he(l),d=h*i-f*s;return[wl(f*i+h*s,u*n+d*r),yo(d*n-u*r)]},o}function Q5t(e){e=oH(e[0]*Rn,e[1]*Rn,e.length>2?e[2]*Rn:0);function t(n){return n=e(n[0]*Rn,n[1]*Rn),n[0]*=Ui,n[1]*=Ui,n}return t.invert=function(n){return n=e.invert(n[0]*Rn,n[1]*Rn),n[0]*=Ui,n[1]*=Ui,n},t}function t6t(e,t,n,r,i,s){if(n){var o=Ne(t),a=he(t),l=r*n;i==null?(i=t+r*Yo,s=t-l/2):(i=uD(o,i),s=uD(o,s),(r>0?is)&&(i+=r*Yo));for(var c,u=i;r>0?u>s:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ww(e,t){return Un(e[0]-t[0])=0;--a)i.point((f=u[a])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,u=h.z,d=!d}while(!h.v);i.lineEnd()}}}function fD(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n=0?1:-1,C=I*M,N=C>rn,L=v*A;if(l.add(wl(L*I*he(C),b*T+L*Ne(C))),o+=N?M+I*Yo:M,N^g>=n^S>=n){var F=n2(_g(d),_g(w));dM(F);var $=n2(s,F);dM($);var D=(N^M>=0?-1:1)*yo($[2]);(r>D||r===D&&(F[0]||F[1]))&&(a+=N^M>=0?1:-1)}}return(o<-ke||o0){for(l||(i.polygonStart(),l=!0),i.lineStart(),A=0;A1&&S&2&&k.push(k.pop().concat(k.shift())),u.push(k.filter(n6t))}}return h}}function n6t(e){return e.length>1}function r6t(e,t){return((e=e.x)[0]<0?e[1]-Kr-ke:Kr-e[1])-((t=t.x)[0]<0?t[1]-Kr-ke:Kr-t[1])}const hD=cH(function(){return!0},i6t,o6t,[-rn,-Kr]);function i6t(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(s,o){var a=s>0?rn:-rn,l=Un(s-t);Un(l-rn)0?Kr:-Kr),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(s,n),i=0):r!==a&&l>=rn&&(Un(t-r)ke?em((he(t)*(s=Ne(r))*he(n)-he(r)*(i=Ne(t))*he(e))/(i*s*o)):(t+r)/2}function o6t(e,t,n,r){var i;if(e==null)i=n*Kr,r.point(-rn,i),r.point(0,i),r.point(rn,i),r.point(rn,0),r.point(rn,-i),r.point(0,-i),r.point(-rn,-i),r.point(-rn,0),r.point(-rn,i);else if(Un(e[0]-t[0])>ke){var s=e[0]0,i=Un(t)>ke;function s(u,f,h,d){t6t(d,e,n,h,u,f)}function o(u,f){return Ne(u)*Ne(f)>t}function a(u){var f,h,d,g,y;return{lineStart:function(){g=d=!1,y=1},point:function(v,b){var _=[v,b],w,S=o(v,b),k=r?S?0:c(v,b):S?c(v+(v<0?rn:-rn),b):0;if(!f&&(g=d=S)&&u.lineStart(),S!==d&&(w=l(f,_),(!w||ww(f,w)||ww(_,w))&&(_[2]=1)),S!==d)y=0,S?(u.lineStart(),w=l(_,f),u.point(w[0],w[1])):(w=l(f,_),u.point(w[0],w[1],2),u.lineEnd()),f=w;else if(i&&f&&r^S){var A;!(k&h)&&(A=l(_,f,!0))&&(y=0,r?(u.lineStart(),u.point(A[0][0],A[0][1]),u.point(A[1][0],A[1][1]),u.lineEnd()):(u.point(A[1][0],A[1][1]),u.lineEnd(),u.lineStart(),u.point(A[0][0],A[0][1],3)))}S&&(!f||!ww(f,_))&&u.point(_[0],_[1]),f=_,d=S,h=k},lineEnd:function(){d&&u.lineEnd(),f=null},clean:function(){return y|(g&&d)<<1}}}function l(u,f,h){var d=_g(u),g=_g(f),y=[1,0,0],v=n2(d,g),b=x_(v,v),_=v[0],w=b-_*_;if(!w)return!h&&u;var S=t*b/w,k=-t*_/w,A=n2(y,v),T=S_(y,S),M=S_(v,k);Ck(T,M);var I=A,C=x_(T,I),N=x_(I,I),L=C*C-N*(x_(T,T)-1);if(!(L<0)){var F=Ps(L),$=S_(I,(-C-F)/N);if(Ck($,T),$=hM($),!h)return $;var D=u[0],O=f[0],B=u[1],V=f[1],U;O0^$[1]<(Un($[0]-D)rn^(D<=$[0]&&$[0]<=O)){var Q=S_(I,(-C+F)/N);return Ck(Q,T),[$,hM(Q)]}}}function c(u,f){var h=r?e:rn-e,d=0;return u<-h?d|=1:u>h&&(d|=2),f<-h?d|=4:f>h&&(d|=8),d}return cH(o,a,s,r?[0,-e]:[-rn,e-rn])}function l6t(e,t,n,r,i,s){var o=e[0],a=e[1],l=t[0],c=t[1],u=0,f=1,h=l-o,d=c-a,g;if(g=n-o,!(!h&&g>0)){if(g/=h,h<0){if(g0){if(g>f)return;g>u&&(u=g)}if(g=i-o,!(!h&&g<0)){if(g/=h,h<0){if(g>f)return;g>u&&(u=g)}else if(h>0){if(g0)){if(g/=d,d<0){if(g0){if(g>f)return;g>u&&(u=g)}if(g=s-a,!(!d&&g<0)){if(g/=d,d<0){if(g>f)return;g>u&&(u=g)}else if(d>0){if(g0&&(e[0]=o+u*h,e[1]=a+u*d),f<1&&(t[0]=o+f*h,t[1]=a+f*d),!0}}}}}var Ey=1e9,E_=-Ey;function uH(e,t,n,r){function i(c,u){return e<=c&&c<=n&&t<=u&&u<=r}function s(c,u,f,h){var d=0,g=0;if(c==null||(d=o(c,f))!==(g=o(u,f))||l(c,u)<0^f>0)do h.point(d===0||d===3?e:n,d>1?r:t);while((d=(d+f+4)%4)!==g);else h.point(u[0],u[1])}function o(c,u){return Un(c[0]-e)0?0:3:Un(c[0]-n)0?2:1:Un(c[1]-t)0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),h=o(u,1);return f!==h?f-h:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=aH(),h,d,g,y,v,b,_,w,S,k,A,T={point:M,lineStart:L,lineEnd:F,polygonStart:C,polygonEnd:N};function M(D,O){i(D,O)&&u.point(D,O)}function I(){for(var D=0,O=0,B=d.length;Or&&(ft-Y)*(r-Q)>(gt-Q)*(e-Y)&&++D:gt<=r&&(ft-Y)*(r-Q)<(gt-Q)*(e-Y)&&--D;return D}function C(){u=f,h=[],d=[],A=!0}function N(){var D=I(),O=A&&D,B=(h=bj(h)).length;(O||B)&&(c.polygonStart(),O&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),B&&lH(h,a,D,s,c),c.polygonEnd()),u=c,h=d=g=null}function L(){T.point=$,d&&d.push(g=[]),k=!0,S=!1,_=w=NaN}function F(){h&&($(y,v),b&&S&&f.rejoin(),h.push(f.result())),T.point=M,S&&u.lineEnd()}function $(D,O){var B=i(D,O);if(d&&g.push([D,O]),k)y=D,v=O,b=B,k=!1,B&&(u.lineStart(),u.point(D,O));else if(B&&S)u.point(D,O);else{var V=[_=Math.max(E_,Math.min(Ey,_)),w=Math.max(E_,Math.min(Ey,w))],U=[D=Math.max(E_,Math.min(Ey,D)),O=Math.max(E_,Math.min(Ey,O))];l6t(V,U,e,t,n,r)?(S||(u.lineStart(),u.point(V[0],V[1])),u.point(U[0],U[1]),B||u.lineEnd(),A=!1):B&&(u.lineStart(),u.point(D,O),A=!1)}_=D,w=O,S=B}return T}}function dD(e,t,n){var r=Do(e,t-ke,n).concat(t);return function(i){return r.map(function(s){return[i,s]})}}function pD(e,t,n){var r=Do(e,t-ke,n).concat(t);return function(i){return r.map(function(s){return[s,i]})}}function c6t(){var e,t,n,r,i,s,o,a,l=10,c=l,u=90,f=360,h,d,g,y,v=2.5;function b(){return{type:"MultiLineString",coordinates:_()}}function _(){return Do(w_(r/u)*u,n,u).map(g).concat(Do(w_(a/f)*f,o,f).map(y)).concat(Do(w_(t/l)*l,e,l).filter(function(w){return Un(w%u)>ke}).map(h)).concat(Do(w_(s/c)*c,i,c).filter(function(w){return Un(w%f)>ke}).map(d))}return b.lines=function(){return _().map(function(w){return{type:"LineString",coordinates:w}})},b.outline=function(){return{type:"Polygon",coordinates:[g(r).concat(y(o).slice(1),g(n).reverse().slice(1),y(a).reverse().slice(1))]}},b.extent=function(w){return arguments.length?b.extentMajor(w).extentMinor(w):b.extentMinor()},b.extentMajor=function(w){return arguments.length?(r=+w[0][0],n=+w[1][0],a=+w[0][1],o=+w[1][1],r>n&&(w=r,r=n,n=w),a>o&&(w=a,a=o,o=w),b.precision(v)):[[r,a],[n,o]]},b.extentMinor=function(w){return arguments.length?(t=+w[0][0],e=+w[1][0],s=+w[0][1],i=+w[1][1],t>e&&(w=t,t=e,e=w),s>i&&(w=s,s=i,i=w),b.precision(v)):[[t,s],[e,i]]},b.step=function(w){return arguments.length?b.stepMajor(w).stepMinor(w):b.stepMinor()},b.stepMajor=function(w){return arguments.length?(u=+w[0],f=+w[1],b):[u,f]},b.stepMinor=function(w){return arguments.length?(l=+w[0],c=+w[1],b):[l,c]},b.precision=function(w){return arguments.length?(v=+w,h=dD(s,i,90),d=pD(t,e,v),g=dD(a,o,90),y=pD(r,n,v),b):v},b.extentMajor([[-180,-90+ke],[180,90-ke]]).extentMinor([[-180,-80-ke],[180,80+ke]])}function u6t(){return c6t()()}const bM=e=>e;var $k=new ac,_M=new ac,fH,hH,wM,xM,cu={point:Fo,lineStart:Fo,lineEnd:Fo,polygonStart:function(){cu.lineStart=f6t,cu.lineEnd=d6t},polygonEnd:function(){cu.lineStart=cu.lineEnd=cu.point=Fo,$k.add(Un(_M)),_M=new ac},result:function(){var e=$k/2;return $k=new ac,e}};function f6t(){cu.point=h6t}function h6t(e,t){cu.point=dH,fH=wM=e,hH=xM=t}function dH(e,t){_M.add(xM*e-wM*t),wM=e,xM=t}function d6t(){dH(fH,hH)}var wg=1/0,u2=wg,Dv=-wg,f2=Dv,h2={point:p6t,lineStart:Fo,lineEnd:Fo,polygonStart:Fo,polygonEnd:Fo,result:function(){var e=[[wg,u2],[Dv,f2]];return Dv=f2=-(u2=wg=1/0),e}};function p6t(e,t){eDv&&(Dv=e),tf2&&(f2=t)}var SM=0,AM=0,ky=0,d2=0,p2=0,w0=0,EM=0,kM=0,Ty=0,pH,gH,Zl,Ql,Sa={point:Xd,lineStart:gD,lineEnd:mD,polygonStart:function(){Sa.lineStart=y6t,Sa.lineEnd=v6t},polygonEnd:function(){Sa.point=Xd,Sa.lineStart=gD,Sa.lineEnd=mD},result:function(){var e=Ty?[EM/Ty,kM/Ty]:w0?[d2/w0,p2/w0]:ky?[SM/ky,AM/ky]:[NaN,NaN];return SM=AM=ky=d2=p2=w0=EM=kM=Ty=0,e}};function Xd(e,t){SM+=e,AM+=t,++ky}function gD(){Sa.point=g6t}function g6t(e,t){Sa.point=m6t,Xd(Zl=e,Ql=t)}function m6t(e,t){var n=e-Zl,r=t-Ql,i=Ps(n*n+r*r);d2+=i*(Zl+e)/2,p2+=i*(Ql+t)/2,w0+=i,Xd(Zl=e,Ql=t)}function mD(){Sa.point=Xd}function y6t(){Sa.point=b6t}function v6t(){mH(pH,gH)}function b6t(e,t){Sa.point=mH,Xd(pH=Zl=e,gH=Ql=t)}function mH(e,t){var n=e-Zl,r=t-Ql,i=Ps(n*n+r*r);d2+=i*(Zl+e)/2,p2+=i*(Ql+t)/2,w0+=i,i=Ql*e-Zl*t,EM+=i*(Zl+e),kM+=i*(Ql+t),Ty+=i*3,Xd(Zl=e,Ql=t)}function yH(e){this._context=e}yH.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,Yo);break}}},result:Fo};var TM=new ac,Ok,vH,bH,My,Iy,Fv={point:Fo,lineStart:function(){Fv.point=_6t},lineEnd:function(){Ok&&_H(vH,bH),Fv.point=Fo},polygonStart:function(){Ok=!0},polygonEnd:function(){Ok=null},result:function(){var e=+TM;return TM=new ac,e}};function _6t(e,t){Fv.point=_H,vH=My=e,bH=Iy=t}function _H(e,t){My-=e,Iy-=t,TM.add(Ps(My*My+Iy*Iy)),My=e,Iy=t}let yD,g2,vD,bD;class _D{constructor(t){this._append=t==null?wH:w6t(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!==vD||this._append!==g2){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`,vD=r,g2=this._append,bD=this._,this._=i}this._+=bD;break}}}result(){const t=this._;return this._="",t.length?t:null}}function wH(e){let t=1;this._+=e[0];for(const n=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return wH;if(t!==yD){const n=10**t;yD=t,g2=function(i){let s=1;this._+=i[0];for(const o=i.length;s=0))throw new RangeError(`invalid digits: ${a}`);n=l}return t===null&&(s=new _D(n)),o},o.projection(e).digits(n).context(t)}function m2(e){return{stream:p3(e)}}function p3(e){return function(t){var n=new MM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function MM(){}MM.prototype={constructor:MM,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 lR(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),_f(n,e.stream(h2)),t(h2.result()),r!=null&&e.clipExtent(r),e}function cR(e,t,n){return lR(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,l=+t[0][1]+(s-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([a,l])},n)}function xH(e,t,n){return cR(e,[[0,0],t],n)}function SH(e,t,n){return lR(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 AH(e,t,n){return lR(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 wD=16,x6t=Ne(30*Rn);function xD(e,t){return+t?A6t(e,t):S6t(e)}function S6t(e){return p3({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function A6t(e,t){function n(r,i,s,o,a,l,c,u,f,h,d,g,y,v){var b=c-r,_=u-i,w=b*b+_*_;if(w>4*t&&y--){var S=o+h,k=a+d,A=l+g,T=Ps(S*S+k*k+A*A),M=yo(A/=T),I=Un(Un(A)-1)t||Un((b*F+_*$)/w-.5)>.3||o*h+a*d+l*g2?D[2]%360*Rn:0,F()):[a*Ui,l*Ui,c*Ui]},N.angle=function(D){return arguments.length?(f=D%360*Rn,F()):f*Ui},N.reflectX=function(D){return arguments.length?(h=D?-1:1,F()):h<0},N.reflectY=function(D){return arguments.length?(d=D?-1:1,F()):d<0},N.precision=function(D){return arguments.length?(A=xD(T,k=D*D),$()):Ps(k)},N.fitExtent=function(D,O){return cR(N,D,O)},N.fitSize=function(D,O){return xH(N,D,O)},N.fitWidth=function(D,O){return SH(N,D,O)},N.fitHeight=function(D,O){return AH(N,D,O)};function F(){var D=SD(n,0,0,h,d,f).apply(null,t(s,o)),O=SD(n,r-D[0],i-D[1],h,d,f);return u=oH(a,l,c),T=yM(t,O),M=yM(u,T),A=xD(T,k),$()}function $(){return I=C=null,N}return function(){return t=e.apply(this,arguments),N.invert=t.invert&&L,F()}}function uR(e){var t=0,n=rn/3,r=EH(e),i=r(t,n);return i.parallels=function(s){return arguments.length?r(t=s[0]*Rn,n=s[1]*Rn):[t*Ui,n*Ui]},i}function M6t(e){var t=Ne(e);function n(r,i){return[r*t,he(i)/t]}return n.invert=function(r,i){return[r/t,yo(i*t)]},n}function I6t(e,t){var n=he(e),r=(n+he(t))/2;if(Un(r)=.12&&v<.234&&y>=-.425&&y<-.214?i:v>=.166&&v<.234&&y>=-.214&&y<-.115?o:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=R6t([n.stream(t=h),i.stream(h),o.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),o.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),o.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var d=n.scale(),g=+h[0],y=+h[1];return r=n.translate(h).clipExtent([[g-.455*d,y-.238*d],[g+.455*d,y+.238*d]]).stream(c),s=i.translate([g-.307*d,y+.201*d]).clipExtent([[g-.425*d+ke,y+.12*d+ke],[g-.214*d-ke,y+.234*d-ke]]).stream(c),a=o.translate([g-.205*d,y+.212*d]).clipExtent([[g-.214*d+ke,y+.166*d+ke],[g-.115*d-ke,y+.234*d-ke]]).stream(c),f()},u.fitExtent=function(h,d){return cR(u,h,d)},u.fitSize=function(h,d){return xH(u,h,d)},u.fitWidth=function(h,d){return SH(u,h,d)},u.fitHeight=function(h,d){return AH(u,h,d)};function f(){return e=t=null,u}return u.scale(1070)}function TH(e){return function(t,n){var r=Ne(t),i=Ne(n),s=e(r*i);return s===1/0?[2,0]:[s*i*he(t),s*he(n)]}}function U1(e){return function(t,n){var r=Ps(t*t+n*n),i=e(r),s=he(i),o=Ne(i);return[wl(t*s,r*o),yo(r&&n*s/r)]}}var MH=TH(function(e){return Ps(2/(1+e))});MH.invert=U1(function(e){return 2*yo(e/2)});function N6t(){return yh(MH).scale(124.75).clipAngle(180-.001)}var IH=TH(function(e){return(e=nH(e))&&e/he(e)});IH.invert=U1(function(e){return e});function $6t(){return yh(IH).scale(79.4188).clipAngle(180-.001)}function g3(e,t){return[e,t2(oR((Kr+t)/2))]}g3.invert=function(e,t){return[e,2*em(eH(t))-Kr]};function O6t(){return RH(g3).scale(961/Yo)}function RH(e){var t=yh(e),n=t.center,r=t.scale,i=t.translate,s=t.clipExtent,o=null,a,l,c;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?o=a=l=c=null:(o=+f[0][0],a=+f[0][1],l=+f[1][0],c=+f[1][1]),u()):o==null?null:[[o,a],[l,c]]};function u(){var f=rn*r(),h=t(Q5t(t.rotate()).invert([0,0]));return s(o==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===g3?[[Math.max(h[0]-f,o),a],[Math.min(h[0]+f,l),c]]:[[o,Math.max(h[1]-f,a)],[l,Math.min(h[1]+f,c)]])}return u()}function k_(e){return oR((Kr+e)/2)}function L6t(e,t){var n=Ne(e),r=e===t?he(e):t2(n/Ne(t))/t2(k_(t)/k_(e)),i=n*Rk(k_(e),r)/r;if(!r)return g3;function s(o,a){i>0?a<-Kr+ke&&(a=-Kr+ke):a>Kr-ke&&(a=Kr-ke);var l=i/Rk(k_(a),r);return[l*he(r*o),i-l*Ne(r*o)]}return s.invert=function(o,a){var l=i-a,c=ka(r)*Ps(o*o+l*l),u=wl(o,Un(l))*ka(l);return l*r<0&&(u-=rn*ka(o)*ka(l)),[u/r,2*em(Rk(i/c,1/r))-Kr]},s}function D6t(){return uR(L6t).scale(109.5).parallels([30,30])}function v2(e,t){return[e,t]}v2.invert=v2;function F6t(){return yh(v2).scale(152.63)}function B6t(e,t){var n=Ne(e),r=e===t?he(e):(n-Ne(t))/(t-e),i=n/r+e;if(Un(r)2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function Y6t(e,t){return e.parent===t.parent?1:2}function H6t(e){return e.reduce(G6t,0)/e.length}function G6t(e,t){return e+t.x}function X6t(e){return 1+e.reduce(K6t,0)}function K6t(e,t){return Math.max(e,t.y)}function J6t(e){for(var t;t=e.children;)e=t[0];return e}function Z6t(e){for(var t;t=e.children;)e=t[t.length-1];return e}function DH(){var e=Y6t,t=1,n=1,r=!1;function i(s){var o,a=0;s.eachAfter(function(h){var d=h.children;d?(h.x=H6t(d),h.y=X6t(d)):(h.x=o?a+=e(h,o):0,h.y=0,o=h)});var l=J6t(s),c=Z6t(s),u=l.x-e(l,c)/2,f=c.x+e(c,l)/2;return s.eachAfter(r?function(h){h.x=(h.x-s.x)*t,h.y=(s.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(s.y?h.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 Q6t(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 tIt(){return this.eachAfter(Q6t)}function eIt(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function nIt(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 rIt(e,t){for(var n=this,r=[n],i=[],s,o,a,l=-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 oIt(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function aIt(e){for(var t=this,n=lIt(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 lIt(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 cIt(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function uIt(){return Array.from(this)}function fIt(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function hIt(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*dIt(){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 xg(o[a])),s.parent=r,s.depth=r.depth+1;return n.eachBefore(BH)}function pIt(){return FH(this).eachBefore(yIt)}function gIt(e){return e.children}function mIt(e){return Array.isArray(e)?e[1]:null}function yIt(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function BH(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function xg(e){this.data=e,this.depth=this.height=0,this.parent=null}xg.prototype=FH.prototype={constructor:xg,count:tIt,each:eIt,eachAfter:rIt,eachBefore:nIt,find:iIt,sum:sIt,sort:oIt,path:aIt,ancestors:cIt,descendants:uIt,leaves:fIt,links:hIt,copy:pIt,[Symbol.iterator]:dIt};function Lk(e){return e==null?null:vIt(e)}function vIt(e){if(typeof e!="function")throw new Error;return e}var bIt={depth:-1},AD={},Dk={};function _It(e){return e.id}function wIt(e){return e.parentId}function PH(){var e=_It,t=wIt,n;function r(i){var s=Array.from(i),o=e,a=t,l,c,u,f,h,d,g,y,v=new Map;if(n!=null){const b=s.map((S,k)=>xIt(n(S,k,i))),_=b.map(ED),w=new Set(b).add("");for(const S of _)w.has(S)||(w.add(S),b.push(S),_.push(ED(S)),s.push(Dk));o=(S,k)=>b[k],a=(S,k)=>_[k]}for(u=0,l=s.length;u=0&&(d=s[b],d.data===Dk);--b)d.data=null}if(f.parent=bIt,f.eachBefore(function(b){b.depth=b.parent.depth+1,--l}).eachBefore(BH),f.parent=null,l>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Lk(i),r):e},r.parentId=function(i){return arguments.length?(t=Lk(i),r):t},r.path=function(i){return arguments.length?(n=Lk(i),r):n},r}function xIt(e){e=`${e}`;let t=e.length;return IM(e,t-1)&&!IM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function ED(e){let t=e.length;if(t<2)return"";for(;--t>1&&!IM(e,t););return e.slice(0,t)}function IM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function SIt(e,t){return e.parent===t.parent?1:2}function Fk(e){var t=e.children;return t?t[0]:e.t}function Bk(e){var t=e.children;return t?t[t.length-1]:e.t}function AIt(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 EIt(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 kIt(e,t,n){return e.a.parent===t.parent?e.a:n}function xw(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}xw.prototype=Object.create(xg.prototype);function TIt(e){for(var t=new xw(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 xw(s[o],o)),i.parent=n;return(t.parent=new xw(null,0)).children=[t],t}function _2(){var e=SIt,t=1,n=1,r=null;function i(c){var u=TIt(c);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(o),r)c.eachBefore(l);else{var f=c,h=c,d=c;c.eachBefore(function(_){_.xh.x&&(h=_),_.depth>d.depth&&(d=_)});var g=f===h?1:e(f,h)/2,y=g-f.x,v=t/(h.x+g+y),b=n/(d.depth||1);c.eachBefore(function(_){_.x=(_.x+y)*v,_.y=_.depth*b})}return c}function s(c){var u=c.children,f=c.parent.children,h=c.i?f[c.i-1]:null;if(u){EIt(c);var d=(u[0].z+u[u.length-1].z)/2;h?(c.z=h.z+e(c._,h._),c.m=c.z-d):c.z=d}else h&&(c.z=h.z+e(c._,h._));c.parent.A=a(c,h,c.parent.A||f[0])}function o(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function a(c,u,f){if(u){for(var h=c,d=c,g=u,y=h.parent.children[0],v=h.m,b=d.m,_=g.m,w=y.m,S;g=Bk(g),h=Fk(h),g&&h;)y=Fk(y),d=Bk(d),d.a=c,S=g.z+_-h.z-v+e(g._,h._),S>0&&(AIt(kIt(g,c,f),c,S),v+=S,b+=S),_+=g.m,v+=h.m,w+=y.m,b+=d.m;g&&!Bk(d)&&(d.t=g,d.m+=_-b),h&&!Fk(y)&&(y.t=h,y.m+=v-w,f=c)}return f}function l(c){c.x*=t,c.y=c.depth*n}return i.separation=function(c){return arguments.length?(e=c,i):e},i.size=function(c){return arguments.length?(r=!1,t=+c[0],n=+c[1],i):r?null:[t,n]},i.nodeSize=function(c){return arguments.length?(r=!0,t=+c[0],n=+c[1],i):r?[t,n]:null},i}const MIt=1664525,IIt=1013904223,kD=1/4294967296;function fR(e=Math.random()){let t=(0<=e&&e<1?e/kD:Math.abs(e))|0;return()=>(t=MIt*t+IIt|0,kD*(t>>>0))}function $i(e){return function(){return e}}const UH=Math.cos,hR=Math.min,w2=Math.sin,ki=Math.sqrt,TD=1e-12,x2=Math.PI,m3=2*x2;function zH(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 QY(t)}function qH(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jH(e){this._context=e}jH.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 z1(e){return new jH(e)}function VH(e){return e[0]}function WH(e){return e[1]}function YH(e,t){var n=$i(!0),r=null,i=z1,s=null,o=zH(a);e=typeof e=="function"?e:e===void 0?VH:$i(e),t=typeof t=="function"?t:t===void 0?WH:$i(t);function a(l){var c,u=(l=qH(l)).length,f,h=!1,d;for(r==null&&(s=i(d=o())),c=0;c<=u;++c)!(c=d;--g)a.point(w[g],S[g]);a.lineEnd(),a.areaEnd()}b&&(w[h]=+e(v,h,f),S[h]=+t(v,h,f),a.point(r?+r(v,h,f):w[h],n?+n(v,h,f):S[h]))}if(_)return a=null,_+""||null}function u(){return YH().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(e=typeof f=="function"?f:$i(+f),r=null,c):e},c.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$i(+f),c):e},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$i(+f),c):r},c.y=function(f){return arguments.length?(t=typeof f=="function"?f:$i(+f),n=null,c):t},c.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$i(+f),c):t},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$i(+f),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:$i(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class HH{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function RIt(e){return new HH(e,!0)}function CIt(e){return new HH(e,!1)}const NIt=ki(3),GH={draw(e,t){const n=ki(t+hR(t/28,.75))*.59436,r=n/2,i=r*NIt;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}},Bv={draw(e,t){const n=ki(t/x2);e.moveTo(n,0),e.arc(0,0,n,0,m3)}},XH={draw(e,t){const n=ki(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},KH=ki(1/3),$It=KH*2,JH={draw(e,t){const n=ki(t/$It),r=n*KH;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ZH={draw(e,t){const n=ki(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}},QH={draw(e,t){const n=ki(t-hR(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}},tG={draw(e,t){const n=ki(t),r=-n/2;e.rect(r,r,n,n)}},eG={draw(e,t){const n=ki(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}},OIt=.8908130915292852,nG=w2(x2/10)/w2(7*x2/10),LIt=w2(m3/10)*nG,DIt=-UH(m3/10)*nG,rG={draw(e,t){const n=ki(t*OIt),r=LIt*n,i=DIt*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=m3*s/5,a=UH(o),l=w2(o);e.lineTo(l*n,-a*n),e.lineTo(a*r-l*i,l*r+a*i)}e.closePath()}},Pk=ki(3),iG={draw(e,t){const n=-ki(t/(Pk*3));e.moveTo(0,n*2),e.lineTo(-Pk*n,-n),e.lineTo(Pk*n,-n),e.closePath()}},FIt=ki(3),sG={draw(e,t){const n=ki(t)*.6824,r=n/2,i=n*FIt/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}},sa=-.5,oa=ki(3)/2,RM=1/ki(12),BIt=(RM/2+1)*3,oG={draw(e,t){const n=ki(t/BIt),r=n/2,i=n*RM,s=r,o=n*RM+n,a=-s,l=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(a,l),e.lineTo(sa*r-oa*i,oa*r+sa*i),e.lineTo(sa*s-oa*o,oa*s+sa*o),e.lineTo(sa*a-oa*l,oa*a+sa*l),e.lineTo(sa*r+oa*i,sa*i-oa*r),e.lineTo(sa*s+oa*o,sa*o-oa*s),e.lineTo(sa*a+oa*l,sa*l-oa*a),e.closePath()}},aG={draw(e,t){const n=ki(t-hR(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}},PIt=[Bv,XH,JH,tG,rG,iG,oG],UIt=[Bv,QH,aG,sG,GH,eG,ZH];function Jf(){}function S2(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 y3(e){this._context=e}y3.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:S2(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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zIt(e){return new y3(e)}function lG(e){this._context=e}lG.prototype={areaStart:Jf,areaEnd:Jf,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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qIt(e){return new lG(e)}function cG(e){this._context=e}cG.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:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jIt(e){return new cG(e)}function uG(e,t){this._basis=new y3(e),this._beta=t}uG.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,l;++a<=n;)l=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+l*s),this._beta*t[a]+(1-this._beta)*(i+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const VIt=function e(t){function n(r){return t===1?new y3(r):new uG(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function A2(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 pR(e,t){this._context=e,this._k=(1-t)/6}pR.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:A2(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:A2(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 WIt=function e(t){function n(r){return new pR(r,t)}return n.tension=function(r){return e(+r)},n}(0);function gR(e,t){this._context=e,this._k=(1-t)/6}gR.prototype={areaStart:Jf,areaEnd:Jf,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:A2(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 YIt=function e(t){function n(r){return new gR(r,t)}return n.tension=function(r){return e(+r)},n}(0);function mR(e,t){this._context=e,this._k=(1-t)/6}mR.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:A2(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 HIt=function e(t){function n(r){return new mR(r,t)}return n.tension=function(r){return e(+r)},n}(0);function yR(e,t,n){var r=e._x1,i=e._y1,s=e._x2,o=e._y2;if(e._l01_a>TD){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>TD){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*c+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,s,o,e._x2,e._y2)}function fG(e,t){this._context=e,this._alpha=t}fG.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:yR(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 GIt=function e(t){function n(r){return t?new fG(r,t):new pR(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function hG(e,t){this._context=e,this._alpha=t}hG.prototype={areaStart:Jf,areaEnd:Jf,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:yR(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 XIt=function e(t){function n(r){return t?new hG(r,t):new gR(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function dG(e,t){this._context=e,this._alpha=t}dG.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:yR(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 KIt=function e(t){function n(r){return t?new dG(r,t):new mR(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function pG(e){this._context=e}pG.prototype={areaStart:Jf,areaEnd:Jf,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 JIt(e){return new pG(e)}function MD(e){return e<0?-1:1}function ID(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(MD(s)+MD(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function RD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Uk(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 E2(e){this._context=e}E2.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:Uk(this,this._t0,RD(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,Uk(this,RD(this,n=ID(this,e,t)),n);break;default:Uk(this,this._t0,n=ID(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function gG(e){this._context=new mG(e)}(gG.prototype=Object.create(E2.prototype)).point=function(e,t){E2.prototype.point.call(this,t,e)};function mG(e){this._context=e}mG.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 ZIt(e){return new E2(e)}function QIt(e){return new gG(e)}function yG(e){this._context=e}yG.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=CD(e),i=CD(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 eRt(e){return new v3(e,.5)}function nRt(e){return new v3(e,0)}function rRt(e){return new v3(e,1)}const T_=e=>()=>e;function iRt(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function rc(e,t,n){this.k=e,this.x=t,this.y=n}rc.prototype={constructor:rc,scale:function(e){return e===1?this:new rc(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new rc(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vG=new rc(1,0,0);rc.prototype;function zk(e){e.stopImmediatePropagation()}function Jm(e){e.preventDefault(),e.stopImmediatePropagation()}function sRt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function oRt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ND(){return this.__zoom||vG}function aRt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lRt(){return navigator.maxTouchPoints||"ontouchstart"in this}function cRt(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function uRt(){var e=sRt,t=oRt,n=cRt,r=aRt,i=lRt,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=b2t,c=c3("start","zoom","end"),u,f,h,d=500,g=150,y=0,v=10;function b($){$.property("__zoom",ND).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",C).filter(i).on("touchstart.zoom",N).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function($,D,O,B){var V=$.selection?$.selection():$;V.property("__zoom",ND),$!==V?k($,D,O,B):V.interrupt().each(function(){A(this,arguments).event(B).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},b.scaleBy=function($,D,O,B){b.scaleTo($,function(){var V=this.__zoom.k,U=typeof D=="function"?D.apply(this,arguments):D;return V*U},O,B)},b.scaleTo=function($,D,O,B){b.transform($,function(){var V=t.apply(this,arguments),U=this.__zoom,z=O==null?S(V):typeof O=="function"?O.apply(this,arguments):O,q=U.invert(z),Y=typeof D=="function"?D.apply(this,arguments):D;return n(w(_(U,Y),z,q),V,o)},O,B)},b.translateBy=function($,D,O,B){b.transform($,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof O=="function"?O.apply(this,arguments):O),t.apply(this,arguments),o)},null,B)},b.translateTo=function($,D,O,B,V){b.transform($,function(){var U=t.apply(this,arguments),z=this.__zoom,q=B==null?S(U):typeof B=="function"?B.apply(this,arguments):B;return n(vG.translate(q[0],q[1]).scale(z.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof O=="function"?-O.apply(this,arguments):-O),U,o)},B,V)};function _($,D){return D=Math.max(s[0],Math.min(s[1],D)),D===$.k?$:new rc(D,$.x,$.y)}function w($,D,O){var B=D[0]-O[0]*$.k,V=D[1]-O[1]*$.k;return B===$.x&&V===$.y?$:new rc($.k,B,V)}function S($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function k($,D,O,B){$.on("start.zoom",function(){A(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(B).end()}).tween("zoom",function(){var V=this,U=arguments,z=A(V,U).event(B),q=t.apply(V,U),Y=O==null?S(q):typeof O=="function"?O.apply(V,U):O,Q=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),ft=V.__zoom,gt=typeof D=="function"?D.apply(V,U):D,pt=l(ft.invert(Y).concat(Q/ft.k),gt.invert(Y).concat(Q/gt.k));return function(lt){if(lt===1)lt=gt;else{var vt=pt(lt),st=Q/vt[2];lt=new rc(st,Y[0]-vt[0]*st,Y[1]-vt[1]*st)}z.zoom(null,lt)}})}function A($,D,O){return!O&&$.__zooming||new T($,D)}function T($,D){this.that=$,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply($,D),this.taps=0}T.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,D){return this.mouse&&$!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var D=Ar(this.that).datum();c.call($,this.that,new iRt($,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),D)}};function M($,...D){if(!e.apply(this,arguments))return;var O=A(this,D).event($),B=this.__zoom,V=Math.max(s[0],Math.min(s[1],B.k*Math.pow(2,r.apply(this,arguments)))),U=Qa($);if(O.wheel)(O.mouse[0][0]!==U[0]||O.mouse[0][1]!==U[1])&&(O.mouse[1]=B.invert(O.mouse[0]=U)),clearTimeout(O.wheel);else{if(B.k===V)return;O.mouse=[U,B.invert(U)],V0(this),O.start()}Jm($),O.wheel=setTimeout(z,g),O.zoom("mouse",n(w(_(B,V),O.mouse[0],O.mouse[1]),O.extent,o));function z(){O.wheel=null,O.end()}}function I($,...D){if(h||!e.apply(this,arguments))return;var O=$.currentTarget,B=A(this,D,!0).event($),V=Ar($.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",Q,!0),U=Qa($,O),z=$.clientX,q=$.clientY;jY($.view),zk($),B.mouse=[U,this.__zoom.invert(U)],V0(this),B.start();function Y(ft){if(Jm(ft),!B.moved){var gt=ft.clientX-z,pt=ft.clientY-q;B.moved=gt*gt+pt*pt>y}B.event(ft).zoom("mouse",n(w(B.that.__zoom,B.mouse[0]=Qa(ft,O),B.mouse[1]),B.extent,o))}function Q(ft){V.on("mousemove.zoom mouseup.zoom",null),VY(ft.view,B.moved),Jm(ft),B.event(ft).end()}}function C($,...D){if(e.apply(this,arguments)){var O=this.__zoom,B=Qa($.changedTouches?$.changedTouches[0]:$,this),V=O.invert(B),U=O.k*($.shiftKey?.5:2),z=n(w(_(O,U),B,V),t.apply(this,D),o);Jm($),a>0?Ar(this).transition().duration(a).call(k,z,B,$):Ar(this).call(b.transform,z,B,$)}}function N($,...D){if(e.apply(this,arguments)){var O=$.touches,B=O.length,V=A(this,D,$.changedTouches.length===B).event($),U,z,q,Y;for(zk($),z=0;z0&&isFinite(e)?e:NaN}function b3(e){return e<0&&isFinite(e)?e:NaN}function fRt(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;const n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),s=e.getUTCMilliseconds();return`${hRt(e.getUTCFullYear())}-${iu(e.getUTCMonth()+1,2)}-${iu(e.getUTCDate(),2)}${n||r||i||s?`T${iu(n,2)}:${iu(r,2)}${i||s?`:${iu(i,2)}${s?`.${iu(s,3)}`:""}`:""}Z`:""}`}function hRt(e){return e<0?`-${iu(-e,6)}`:e>9999?`+${iu(e,6)}`:iu(e,4)}function iu(e,t){return`${e}`.padStart(t,"0")}const dRt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function bG(e,t){return dRt.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Sg(e){if(e==null)return;const t=e[0],n=e[e.length-1];return Pd(t,n)}const x0=1e3,Mf=x0*60,If=Mf*60,wc=If*24,jl=wc*7,bd=wc*30,mf=wc*365,qk=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",x0],["5 seconds",5*x0],["15 seconds",15*x0],["30 seconds",30*x0],["minute",Mf],["5 minutes",5*Mf],["15 minutes",15*Mf],["30 minutes",30*Mf],["hour",If],["3 hours",3*If],["6 hours",6*If],["12 hours",12*If],["day",wc],["2 days",2*wc],["week",jl],["2 weeks",2*jl],["month",bd],["3 months",3*bd],["6 months",6*bd],["year",mf],["2 years",2*mf],["5 years",5*mf],["10 years",10*mf],["20 years",20*mf],["50 years",50*mf],["100 years",100*mf]],bR=new Map([["second",x0],["minute",Mf],["hour",If],["day",wc],["monday",jl],["tuesday",jl],["wednesday",jl],["thursday",jl],["friday",jl],["saturday",jl],["sunday",jl],["week",jl],["month",bd],["year",mf]]),_G=new Map([["second",sl],["minute",A1],["hour",k1],["day",lp],["monday",Ev],["tuesday",Gj],["wednesday",Xj],["thursday",jd],["friday",Kj],["saturday",Jj],["sunday",gg],["week",gg],["month",M1],["year",vl]]),_R=new Map([["second",sl],["minute",E1],["hour",T1],["day",ZS],["monday",kv],["tuesday",Zj],["wednesday",Qj],["thursday",Vd],["friday",tV],["saturday",eV],["sunday",mg],["week",mg],["month",I1],["year",bl]]),q1=Symbol("intervalDuration"),_3=Symbol("intervalType");for(const[e,t]of _G)t[q1]=bR.get(e),t[_3]="time";for(const[e,t]of _R)t[q1]=bR.get(e),t[_3]="utc";const Ry=[["year",bl,"utc"],["month",I1,"utc"],["day",ZS,"utc",6*bd],["hour",T1,"utc",3*wc],["minute",E1,"utc",6*If],["second",sl,"utc",30*Mf]],Sw=[["year",vl,"time"],["month",M1,"time"],["day",lp,"time",6*bd],["hour",k1,"time",3*wc],["minute",A1,"time",6*If],["second",sl,"time",30*Mf]],pRt=[Ry[0],Sw[0],Ry[1],Sw[1],Ry[2],Sw[2],...Ry.slice(3)];function wR(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1;const r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=_R.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function xR(e){return wG(wR(e),"time")}function w3(e){return wG(wR(e),"utc")}function wG([e,t],n){let r=(n==="time"?_G:_R).get(e);return t>1&&(r=r.every(t),r[q1]=bR.get(e)*t,r[_3]=n),r}function $D(e,t){if(!(t>1))return;const n=e[q1];if(!qk.some(([,i])=>i===n)||n%wc===0&&wcMath.log(i)).center(qk,Math.log(n*t))];return(e[_3]==="time"?xR:w3)(r)}function OD(e,t,n){const r=t==="time"?wI:R1;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");const i=gRt(n);switch(e){case"millisecond":return Zp(r(".%L"),r(":%M:%S"),i);case"second":return Zp(r(":%S"),r("%-I:%M"),i);case"minute":return Zp(r("%-I:%M"),r("%p"),i);case"hour":return Zp(r("%-I %p"),r("%b %-d"),i);case"day":return Zp(r("%-d"),r("%b"),i);case"month":return Zp(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function gRt(e){return e==="left"||e==="right"?(t,n)=>` +${t} +${n}`:e==="top"?(t,n)=>`${n} +${t}`:(t,n)=>`${t} +${n}`}function mRt(e){return e==="time"?Sw:e==="utc"?Ry:pRt}function yRt(e,t,n){const r=Vr(Dxt(t,(i,s)=>Math.abs(s-i)));if(r<1e3)return OD("millisecond","utc",n);for(const[i,s,o,a]of mRt(e)){if(r>a||i==="hour"&&!r)break;if(t.every(l=>s.floor(l)>=l))return OD(i,o,n)}}function Zp(e,t,n){return(r,i,s)=>{const o=e(r,i),a=t(r,i),l=i-Sg(s);return i!==l&&s[l]!==void 0&&a===t(s[l],l)?o:n(o,a)}}const x3=Object.getPrototypeOf(Uint8Array),vRt=Object.prototype.toString;function Wu(e){return e instanceof Array||e instanceof x3}function xG(e){return e instanceof x3&&!bRt(e)}function SG(e){return e?.prototype instanceof x3&&!_Rt(e)}function bRt(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function _Rt(e){return e===BigInt64Array||e===BigUint64Array}const AG=Symbol("reindex");function cn(e,t,n){const r=typeof t;return r==="string"?BG(e)?SR(e.getChild(t),n):LD(e,EG(t),n):r==="function"?LD(e,t,n):r==="number"||t instanceof Date||r==="boolean"?pr(e,Vi(t),n):typeof t?.transform=="function"?CM(t.transform(e),n):wRt(CM(t,n),e?.[AG])}function wRt(e,t){return e!=null&&t?A3(e,t):e}function LD(e,t,n){return pr(e,SG(n)?(r,i)=>kR(t(r,i)):t,n)}function CM(e,t){return t===void 0?vh(e):PG(e)?SR(e,t):e instanceof t?e:t.from(e,SG(t)&&!xG(e)?kR:void 0)}function SR(e,t){return e==null?e:(t===void 0||t===Array)&&LRt(e.type)?kG(DD(e)):CM(DD(e),t)}function DD(e){return e.nullCount?e.toJSON():e.toArray()}const Wy=[null],EG=e=>t=>{const n=t[e];return n===void 0&&t.type==="Feature"?t.properties?.[e]:n},vi={transform:Yu},de={transform:e=>e},AR=()=>1,xRt=()=>!0,ji=e=>e==null?e:`${e}`,kr=e=>e==null?e:+e,S3=e=>e?e[0]:void 0,Pv=e=>e?e[1]:void 0,SRt=e=>e?e[2]:void 0,Vi=e=>()=>e;function ER(e){const t=+`${e}`.slice(1)/100;return(n,r)=>Hf(n,t,r)}function co(e){return xG(e)?e:pr(e,kR,Float64Array)}function kR(e){return e==null?NaN:Number(e)}function kG(e){return pr(e,TG)}function TG(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?bG(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Us(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:j1(e)?[void 0,e]:[e,void 0]}function li(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function MG(e,t,n){if(e!=null)return Xo(e,t,n)}function Xo(e,t,n){const r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function Ag(e){return BG(e)?e:vh(e)}function vh(e){if(e==null||Wu(e))return e;if(PG(e))return SR(e);if(IG(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function IG(e){switch(e?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function pr(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Uv(e,t=Array){return e instanceof t?e.slice():t.from(e)}function RG({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function CG({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function nm(e){return RG(e)||CG(e)||e.interval!==void 0}function Ko(e){return e?.toString===vRt}function _d(e){return Ko(e)&&(e.type!==void 0||e.domain!==void 0)}function Yl(e){return Ko(e)&&typeof e.transform!="function"}function Zf(e){return Yl(e)&&e.value===void 0&&e.channel===void 0}function NG(e,t,n,r=de){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function Il(e,t){return e===void 0&&t===void 0?[S3,Pv]:[e,t]}function bh({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Us(t)),e===void 0&&([e]=Us(n)),e}function zv(e){return Wu(e)?e.length:e?.numRows}function Yu(e){const t=zv(e),n=new Uint32Array(t);for(let r=0;re[n],e.constructor):pr(t,n=>e.at(n))}function TR(e){return e.length===1?(t,n)=>e(A3(n,t)):e}function wd(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function gu(e){return e!==null&&typeof e=="object"?e.valueOf():e}function $G(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function Bo(e){let t;return[{transform:()=>t,label:Cc(e)},n=>t=n]}function Zs(e){return e==null?[e]:Bo(e)}function Cc(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function M2(e,t){return{transform(n){const r=e.transform(n),i=t.transform(n);return zs(r)||zs(i)?pr(r,(s,o)=>new Date((+r[o]+ +i[o])/2)):pr(r,(s,o)=>(+r[o]+ +i[o])/2,Float64Array)},label:e.label}}function I2(e,t){const n=OG(t?.interval,t?.type);return n?pr(e,n):e}function OG(e,t){const n=E3(e,t);return n&&(r=>Yi(r)?n.floor(r):r)}function E3(e,t){if(e!=null){if(typeof e=="number")return LG(e);if(typeof e=="string")return(t==="time"?xR:w3)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function LG(e){e=+e,0Math.floor(n*t)/t,offset:(n,r=1)=>(n*t+Math.floor(r))/t,range:(n,r)=>Do(Math.ceil(n*t),r*t).map(i=>i/t)}:{floor:n=>Math.floor(n/t)*t,offset:(n,r=1)=>n+t*Math.floor(r),range:(n,r)=>Do(Math.ceil(n/t),r/t).map(i=>i*t)}}function rm(e,t){if(e=E3(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function ARt(e,t){if(e=rm(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function ERt(e){return S0(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function S0(e){return typeof e?.range=="function"}function im(e){return e===void 0||Yl(e)?e:{value:e}}function kRt(e){return e==null?null:{transform:t=>cn(t,e,Float64Array),label:Cc(e)}}function TRt(e){if(!Hu(e))return!1;for(const t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function Hu(e){return e&&typeof e[Symbol.iterator]=="function"}function DG(e){for(const t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Hr(e){for(const t of e){if(t==null)continue;const n=typeof t;return n==="string"||n==="boolean"}}function zs(e){for(const t of e)if(t!=null)return t instanceof Date}function MRt(e){for(const t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&bG(t)}function IRt(e){for(const t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function A0(e){for(const t of e)if(t!=null)return typeof t=="number"}function jk(e,t){let n;for(const r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}const RRt=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function j1(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||RRt.has(e))}function CRt(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function $r(e){return e==null||Eg(e)}function Eg(e){return/^\s*none\s*$/i.test(e)}function NRt(e){return/^\s*round\s*$/i.test(e)}function NM(e,t){return MG(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function V1(e="middle"){return NM(e,"frameAnchor")}function $Rt(e={},...t){let n=e;for(const r of t)for(const i in r)if(n[i]===void 0){const s=r[i];n===e?n={...n,[i]:s}:n[i]=s}return n}function ORt(e){console.warn("named iterables are deprecated; please use an object instead");const t=new Set;return Object.fromEntries(Array.from(e,n=>{const{name:r}=n;if(r==null)throw new Error("missing name");const i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function MR(e){return Hu(e)?ORt(e):e}function FG(e){return e===!0?e="frame":e===!1?e=null:!IG(e)&&e!=null&&(e=Xo(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function BG(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function PG(e){return e&&typeof e.toArray=="function"&&e.type}function LRt(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}const ic=Symbol("position"),Gu=Symbol("color"),W1=Symbol("radius"),Y1=Symbol("length"),H1=Symbol("opacity"),k3=Symbol("symbol"),UG=Symbol("projection"),qr=new Map([["x",ic],["y",ic],["fx",ic],["fy",ic],["r",W1],["color",Gu],["opacity",H1],["symbol",k3],["length",Y1],["projection",UG]]);function DRt(e){return e===ic||e===UG}function FRt(e){return e===ic||e===W1||e===Y1||e===H1}const zG=Math.sqrt(3),qG=2/zG,BRt={draw(e,t){const n=Math.sqrt(t/Math.PI),r=n*qG,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},IR=new Map([["asterisk",GH],["circle",Bv],["cross",XH],["diamond",JH],["diamond2",ZH],["hexagon",BRt],["plus",QH],["square",tG],["square2",eG],["star",rG],["times",aG],["triangle",iG],["triangle2",sG],["wye",oG]]);function RR(e){return e&&typeof e.draw=="function"}function PRt(e){return RR(e)?!0:typeof e!="string"?!1:IR.has(e.toLowerCase())}function CR(e){if(e==null||RR(e))return e;const t=IR.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function URt(e){if(e==null||RR(e))return[void 0,e];if(typeof e=="string"){const t=IR.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function Rl({filter:e,sort:t,reverse:n,transform:r,initializer:i,...s}={},o){if(r===void 0&&(e!=null&&(r=NR(e)),t!=null&&!Zf(t)&&(r=Vk(r,OR(t))),n&&(r=Vk(r,$R))),o!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...s,...(t===null||Zf(t))&&{sort:t},transform:Vk(r,o)}}function gs({filter:e,sort:t,reverse:n,initializer:r,...i}={},s){return r===void 0&&(e!=null&&(r=NR(e)),t!=null&&!Zf(t)&&(r=Wk(r,OR(t))),n&&(r=Wk(r,$R))),{...i,...(t===null||Zf(t))&&{sort:t},initializer:Wk(r,s)}}function Vk(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,Ag(n),r,i)}}function Wk(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...s){let o,a,l,c,u,f;return{data:a=n,facets:l=r,channels:o}=e.call(this,n,r,i,...s),{data:u=a,facets:f=l,channels:c}=t.call(this,a,l,{...i,...o},...s),{data:u,facets:f,channels:{...o,...c}}}}function T3(e,t){return(e.initializer!=null?gs:Rl)(e,t)}function zRt(e,t){return T3(t,NR(e))}function NR(e){return(t,n)=>{const r=cn(t,e);return{data:t,facets:n.map(i=>i.filter(s=>r[s]))}}}function qRt({sort:e,...t}={}){return{...T3(t,$R),sort:Zf(e)?e:null}}function $R(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function jRt({seed:e,sort:t,...n}={}){return{...T3(n,VG(e==null?Math.random:fR(e))),sort:Zf(t)?t:null}}function jG(e,{sort:t,...n}={}){return{...(Yl(e)&&e.channel!==void 0?gs:T3)(n,OR(e)),sort:Zf(t)?t:null}}function OR(e){return(typeof e=="function"&&e.length!==1?VRt:VG)(e)}function VRt(e){return(t,n)=>{const r=Wu(t)?(i,s)=>e(t[i],t[s]):(i,s)=>e(t.get(i),t.get(s));return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function VG(e){let t,n;({channel:t,value:e,order:n}={...im(e)});const r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?k2:Ua),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=Ua;break;case"descending":n=k2;break;default:throw new Error(`invalid order: ${n}`)}return(i,s,o)=>{let a;if(t===void 0)a=cn(i,e);else{if(o===void 0)throw new Error("channel sort requires an initializer");if(a=o[t],!a)return{};a=a.value}const l=(c,u)=>n(a[c],a[u]);return{data:i,facets:s.map(c=>c.slice().sort(l))}}}function LR(e,t){return M3(null,null,e,t)}function qv(e={y:"count"},t={}){const{x:n=de}=t;if(n==null)throw new Error("missing channel: x");return M3(n,null,e,t)}function jv(e={x:"count"},t={}){const{y:n=de}=t;if(n==null)throw new Error("missing channel: y");return M3(null,n,e,t)}function DR(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Il(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return M3(n,r,e,t)}function M3(e,t,{data:n=UR,filter:r,sort:i,reverse:s,...o}={},a={}){o=YG(o,a),n=XG(n,de),i=i==null?void 0:HG("sort",i,a),r=r==null?void 0:GG("filter",r,a);const[l,c]=Zs(e),[u,f]=Zs(t),{z:h,fill:d,stroke:g,x1:y,x2:v,y1:b,y2:_,...w}=a,[S,k]=Zs(h),[A]=Us(d),[T]=Us(g),[M,I]=Zs(A),[C,N]=Zs(T);return{..."z"in a&&{z:S||h},..."fill"in a&&{fill:M||d},..."stroke"in a&&{stroke:C||g},...Rl(w,(L,F,$)=>{const D=I2(cn(L,e),$?.x),O=I2(cn(L,t),$?.y),B=cn(L,h),V=cn(L,A),U=cn(L,T),z=PR(o,{z:B,fill:V,stroke:U}),q=[],Y=[],Q=D&&c([]),ft=O&&f([]),gt=B&&k([]),pt=V&&I([]),lt=U&&N([]);let vt=0;for(const st of o)st.initialize(L);i&&i.initialize(L),r&&r.initialize(L);for(const st of F){const Z=[];for(const mt of o)mt.scope("facet",st);i&&i.scope("facet",st),r&&r.scope("facet",st);for(const[mt,at]of xd(st,z))for(const[Ct,wt]of xd(at,O))for(const[Bt,Pt]of xd(wt,D)){const kt={data:L};if(D&&(kt.x=Bt),O&&(kt.y=Ct),z&&(kt.z=mt),!(r&&!r.reduce(Pt,kt))){Z.push(vt++),Y.push(n.reduceIndex(Pt,L,kt)),D&&Q.push(Bt),O&&ft.push(Ct),B&>.push(z===B?mt:B[Pt[0]]),V&&pt.push(z===V?mt:V[Pt[0]]),U&<.push(z===U?mt:U[Pt[0]]);for(const qt of o)qt.reduce(Pt,kt);i&&i.reduce(Pt,kt)}}q.push(Z)}return KG(q,i,s),{data:Y,facets:q}}),...!Rf(o,"x")&&(l?{x:l}:{x1:y,x2:v}),...!Rf(o,"y")&&(u?{y:u}:{y1:b,y2:_}),...Object.fromEntries(o.map(({name:L,output:F})=>[L,F]))}}function Rf(e,...t){for(const{name:n}of e)if(t.includes(n))return!0;return!1}function WG(e,t,n=FR){const r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",KRt]),t.href!=null&&e.href===void 0&&r.push(["href",zR]),r.filter(([,i])=>i!==void 0).map(([i,s])=>s===null?WRt(i):n(i,s,t))}function FR(e,t,n,r=BR){let i;Ko(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);const s=r(e,t,n),[o,a]=Bo(s.label);let l;return{name:e,output:i===void 0?o:{value:o,scale:i},initialize(c){s.initialize(c),l=a([])},scope(c,u){s.scope(c,u)},reduce(c,u){l.push(s.reduce(c,u))}}}function WRt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function BR(e,t,n,r=I3){const i=$G(e,n),s=r(t,i);let o,a;return{label:Cc(s===R2?null:i,s.label),initialize(l){o=i===void 0?l:cn(l,i),s.scope==="data"&&(a=s.reduceIndex(Yu(l),o))},scope(l,c){s.scope===l&&(a=s.reduceIndex(c,o))},reduce(l,c){return s.scope==null?s.reduceIndex(l,o,c):s.reduceIndex(l,o,a,c)}}}function xd(e,t){return t?hh(e,n=>t[n]):[[,e]]}function I3(e,t,n=YRt){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Ko(e))return GRt(e);if(typeof e=="function")return XRt(e);if(/^p\d{2}$/i.test(e))return Qc(ER(e));switch(`${e}`.toLowerCase()){case"first":return zR;case"last":return JRt;case"identity":return UR;case"count":return R2;case"distinct":return ZRt;case"sum":return t==null?R2:QRt;case"proportion":return BD(t,"data");case"proportion-facet":return BD(t,"facet");case"deviation":return Qc(b1);case"min":return Qc(Or);case"min-index":return Qc(Nxt);case"max":return Qc(Vr);case"max-index":return Qc(Cxt);case"mean":return FD(WS);case"median":return FD(xv);case"variance":return Qc(oI);case"mode":return Qc(_j)}return n(e)}function YRt(e){throw new Error(`invalid reduce: ${e}`)}function YG(e,t){return WG(e,t,HG)}function HG(e,t,n){return FR(e,t,n,GG)}function GG(e,t,n){return BR(e,t,n,XG)}function XG(e,t){return I3(e,t,HRt)}function HRt(e){switch(`${e}`.toLowerCase()){case"x":return tCt;case"y":return eCt;case"z":return JG}throw new Error(`invalid group reduce: ${e}`)}function PR(e,t){for(const n in t){const r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function KG(e,t,n){if(t){const r=t.output.transform(),i=(s,o)=>Ua(r[s],r[o]);e.forEach(s=>s.sort(i))}n&&e.forEach(r=>r.reverse())}function GRt(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function XRt(e){return{reduceIndex(t,n,r){return e(A3(n,t),r)}}}function Qc(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function FD(e){return{reduceIndex(t,n){const r=e(t,i=>n[i]);return zs(n)?new Date(r):r}}}const UR={reduceIndex(e,t){return A3(t,e)}},zR={reduceIndex(e,t){return t[e[0]]}},KRt={reduceIndex(e,t){const r=Mx(D0(e,s=>s.length,s=>t[s]),Pv),i=r.slice(-5).reverse();if(i.length`${s} (${o.toLocaleString("en-US")})`).join(` +`)}},JRt={reduceIndex(e,t){return t[e[e.length-1]]}},R2={label:"Frequency",reduceIndex(e){return e.length}},ZRt={label:"Distinct",reduceIndex(e,t){const n=new Gg;for(const r of e)n.add(t[r]);return n.size}},QRt=Qc(ml);function BD(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>ml(n,s=>r[s])/i}}const tCt={reduceIndex(e,t,{x:n}){return n}},eCt={reduceIndex(e,t,{y:n}){return n}},JG={reduceIndex(e,t,{z:n}){return n}};function nCt(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(Wu(r)?i=>e(r[i],i,r):i=>e(r.get(i),i,r))]}}}function Vv(e,{scale:t,type:n,value:r,filter:i,hint:s,label:o=Cc(r)},a){return s===void 0&&typeof r?.transform=="function"&&(s=r.hint),QG(a,{scale:t,type:n,value:cn(e,r),label:o,filter:i,hint:s})}function ZG(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Vv(t,r,n)]))}function R3(e,t){const n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:s}])=>{const o=i==null?null:t[i];return[r,o==null?s:pr(s,o)]}));return n.channels=e,n}function QG(e,t){const{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&jk(r,j1)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&jk(r,CRt)?null:"opacity",t.defaultScale="opacity";break;case"symbol":n!==!0&&jk(r,PRt)?(t.scale=null,t.value=pr(r,CR)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=qr.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!qr.has(n))throw new Error(`unknown scale: ${n}`);return t}function rCt(e,t,n,r,i){const{order:s,reverse:o,reduce:a=!0,limit:l}=i;for(const c in i){if(!qr.has(c))continue;let{value:u,order:f=s,reverse:h=o,reduce:d=a,limit:g=l}=im(i[c]);const y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?eX:tX:oCt(f),d==null||d===!1)continue;const v=c==="fx"||c==="fy"?sCt(t,r[c]):iCt(n,c);if(!v)throw new Error(`missing channel for scale: ${c}`);const b=v.value,[_=0,w=1/0]=Hu(g)?g:g<0?[g]:[0,g];if(u==null)v.domain=()=>{let S=Array.from(new Gg(b));return h&&(S=S.reverse()),(_!==0||w!==1/0)&&(S=S.slice(_,w)),S};else{const S=u==="data"?e:u==="height"?PD(n,"y1","y2"):u==="width"?PD(n,"x1","x2"):$M(n,u,u==="y"?"y2":u==="x"?"x2":void 0),k=I3(d===!0?"max":d,S);v.domain=()=>{let A=kxt(Yu(b),T=>k.reduceIndex(T,S),T=>b[T]);return f&&A.sort(f),h&&A.reverse(),(_!==0||w!==1/0)&&(A=A.slice(_,w)),A.map(S3)}}}}function iCt(e,t){for(const n in e){const r=e[n];if(r.scale===t)return r}}function sCt(e,t){const n=e.original;if(n===e)return t;const r=t.value,i=t.value=[];for(let s=0;sMath.abs(s-r[o]),Float64Array)}function $M(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function oCt(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return tX;case"descending":return eX}throw new Error(`invalid order: ${e}`)}function tX([e,t],[n,r]){return Ua(t,r)||Ua(e,n)}function eX([e,t],[n,r]){return k2(t,r)||Ua(e,n)}function OM(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}const nX=new Map([["accent",HSt],["category10",YSt],["dark2",GSt],["observable10",XSt],["paired",KSt],["pastel1",JSt],["pastel2",ZSt],["set1",QSt],["set2",t3t],["set3",e3t],["tableau10",n3t]]);function aCt(e){return e!=null&&nX.has(`${e}`.toLowerCase())}const UD=new Map([...nX,["brbg",Gc(dV,pV)],["prgn",Gc(gV,mV)],["piyg",Gc(yV,vV)],["puor",Gc(bV,_V)],["rdbu",Gc(P4,Lx)],["rdgy",Gc(wV,xV)],["rdylbu",Gc(U4,Dx)],["rdylgn",Gc(SV,AV)],["spectral",Gc(EV,kV)],["burd",zD(P4,Lx)],["buylrd",zD(U4,Dx)],["blues",Ri(XV,KV)],["greens",Ri(JV,ZV)],["greys",Ri(QV,tW)],["oranges",Ri(sW,oW)],["purples",Ri(eW,nW)],["reds",Ri(rW,iW)],["turbo",Xc(EI)],["viridis",Xc(dW)],["magma",Xc(pW)],["inferno",Xc(n3)],["plasma",Xc(gW)],["cividis",Xc(aW)],["cubehelix",Xc(lW)],["warm",Xc(cW)],["cool",Xc(uW)],["bugn",Ri(TV,MV)],["bupu",Ri(IV,RV)],["gnbu",Ri(CV,NV)],["orrd",Ri($V,OV)],["pubu",Ri(DV,FV)],["pubugn",Ri(LV,SI)],["purd",Ri(BV,PV)],["rdpu",Ri(UV,zV)],["ylgn",Ri(jV,VV)],["ylgnbu",Ri(qV,AI)],["ylorbr",Ri(WV,YV)],["ylorrd",Ri(HV,GV)],["rainbow",qD(fW)],["sinebow",qD(hW)]]);function Ri(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?yl(t,n):e[n])}function Gc(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?yl(t,n):e[n])}function zD(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?yl(r=>t(1-r),n):e[n].slice().reverse())}function Xc(e){return({length:t})=>yl(e,Math.max(2,Math.floor(t)))}function qD(e){return({length:t})=>yl(e,Math.floor(t)+1).slice(0,-1)}function rX(e){const t=`${e}`.toLowerCase();if(!UD.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return UD.get(t)}function C3(e,t){const n=rX(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function lCt(e,t="greys"){const n=new Set,[r,i]=C3(t,2);for(const s of e)if(s!=null)if(s===!0)n.add(i);else if(s===!1)n.add(r);else return;return[...n]}const jD=new Map([["brbg",pV],["prgn",mV],["piyg",vV],["puor",_V],["rdbu",Lx],["rdgy",xV],["rdylbu",Dx],["rdylgn",AV],["spectral",kV],["burd",e=>Lx(1-e)],["buylrd",e=>Dx(1-e)],["blues",KV],["greens",ZV],["greys",tW],["purples",nW],["reds",iW],["oranges",oW],["turbo",EI],["viridis",dW],["magma",pW],["inferno",n3],["plasma",gW],["cividis",aW],["cubehelix",lW],["warm",cW],["cool",uW],["bugn",MV],["bupu",RV],["gnbu",NV],["orrd",OV],["pubugn",SI],["pubu",FV],["purd",PV],["rdpu",zV],["ylgnbu",AI],["ylgn",VV],["ylorbr",YV],["ylorrd",GV],["rainbow",fW],["sinebow",hW]]);function qR(e){const t=`${e}`.toLowerCase();if(!jD.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return jD.get(t)}const cCt=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function uCt(e){return e!=null&&cCt.has(`${e}`.toLowerCase())}const iX=e=>t=>e(1-t),Yk=[0,1],VD=new Map([["number",es],["rgb",qd],["hsl",w2t],["hcl",A2t],["lab",x2t]]);function sX(e){const t=`${e}`.toLowerCase();if(!VD.has(t))throw new Error(`unknown interpolator: ${t}`);return VD.get(t)}function G1(e,t,n,{type:r,nice:i,clamp:s,zero:o,domain:a=aX(e,n),unknown:l,round:c,scheme:u,interval:f,range:h=qr.get(e)===W1?wCt(n,a):qr.get(e)===Y1?xCt(n,a):qr.get(e)===H1?Yk:void 0,interpolate:d=qr.get(e)===Gu?u==null&&h!==void 0?qd:qR(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):c?yI:es,reverse:g}){if(a=WD(a),f=rm(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=sX(d)),g=!!g,h!==void 0){const y=a.length,v=(h=WD(h)).length;if(y!==v){if(d.length===1)throw new Error("invalid piecewise interpolator");d=XS(d,h),h=void 0}}if(d.length===1?(g&&(d=iX(d),g=!1),h===void 0&&(h=Float64Array.from(a,(y,v)=>v/(a.length-1)),h.length===2&&(h=Yk)),t.interpolate((h===Yk?Vi:VR)(d))):t.interpolate(d),o){const[y,v]=yi(a);(y>0||v<0)&&(a=Uv(a),(Sg(a)||1)===Math.sign(y)?a[0]=0:a[a.length-1]=0)}return g&&(a=Rx(a)),t.domain(a).unknown(l),i&&(t.nice(fCt(i,r)),a=t.domain()),h!==void 0&&t.range(h),s&&t.clamp(s),{type:r,domain:a,range:h,scale:t,interpolate:d,interval:f}}function WD(e){return e=vh(e),e.length>=2?e:[e[0],e[0]]}function fCt(e,t){return e===!0?void 0:typeof e=="number"?e:ARt(e,t)}function hCt(e,t,n){return G1(e,zu(),t,n)}function dCt(e,t,n){return oX(e,t,{...n,exponent:.5})}function oX(e,t,{exponent:n=1,...r}){return G1(e,Wj().exponent(n),t,{...r,type:"pow"})}function pCt(e,t,{base:n=10,domain:r=SCt(t),...i}){return G1(e,pg().base(n),t,{...i,domain:r})}function gCt(e,t,{constant:n=1,...r}){return G1(e,bI().constant(n),t,r)}function mCt(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:s="rdylbu",domain:o=ACt(t),unknown:a,interpolate:l,reverse:c}){return n===void 0&&(n=l!==void 0?yl(l,i):qr.get(e)===Gu?C3(s,i):void 0),o.length>0&&(o=Yj(o,n===void 0?{length:i}:n).quantiles()),jR(e,t,{domain:o,range:n,reverse:c,unknown:a})}function yCt(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:s=aX(e,t),unknown:o,interpolate:a,reverse:l}){const[c,u]=yi(s);let f;return n===void 0?(f=Yf(c,u,r),f[0]<=c&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?yl(a,r):qr.get(e)===Gu?C3(i,r):void 0):(f=yl(es(c,u),r+1).slice(1,-1),c instanceof Date&&(f=f.map(h=>new Date(h)))),Sg(vh(s))<0&&f.reverse(),jR(e,t,{domain:f,range:n,reverse:l,unknown:o})}function jR(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:s,range:o=s!==void 0?yl(s,n.length+1):qr.get(e)===Gu?C3(i,n.length+1):void 0,reverse:a}){n=vh(n);const l=Sg(n);if(!isNaN(l)&&!vCt(n,l))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(o=Rx(o)),{type:"threshold",scale:Hj(l<0?Rx(n):n,o===void 0?[]:o).unknown(r),domain:n,range:o}}function vCt(e,t){for(let n=1,r=e.length,i=e[0];nt}}function Wv(e,t=T2){return e.length?[Or(e,({value:n})=>n===void 0?n:Or(n,t)),Vr(e,({value:n})=>n===void 0?n:Vr(n,t))]:[0,1]}function aX(e,t){const n=qr.get(e);return(n===W1||n===H1||n===Y1?_Ct:Wv)(t)}function _Ct(e){return[0,e.length?Vr(e,({value:t})=>t===void 0?t:Vr(t,T2)):1]}function wCt(e,t){const n=e.find(({radius:o})=>o!==void 0);if(n!==void 0)return[0,n.radius];const r=Hf(e,.5,({value:o})=>o===void 0?NaN:Hf(o,.25,Su)),i=t.map(o=>3*Math.sqrt(o/r)),s=30/Vr(i);return s<1?i.map(o=>o*s):i}function xCt(e,t){const n=xv(e,({value:s})=>s===void 0?NaN:xv(s,Math.abs)),r=t.map(s=>12*s/n),i=60/Vr(r);return i<1?r.map(s=>s*i):r}function SCt(e){for(const{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Wv(e,Su);if(n<0)return Wv(e,b3)}return[1,10]}function ACt(e){const t=[];for(const{value:n}of e)if(n!==void 0)for(const r of n)t.push(r);return t}function VR(e){return(t,n)=>r=>e(t+r*(n-t))}let LM=0,DM;function ECt(){const e=LM;return LM=0,DM=void 0,e}function Au(e){e!==DM&&(DM=e,console.warn(e),++LM)}function N3(e,t,n,r,{type:i,nice:s,clamp:o,domain:a=Wv(r),unknown:l,pivot:c=0,scheme:u,range:f,symmetric:h=!0,interpolate:d=qr.get(e)===Gu?u==null&&f!==void 0?qd:qR(u!==void 0?u:"rdbu"):es,reverse:g}){c=+c,a=vh(a);let[y,v]=a;if(a.length>2&&Au(`Warning: the diverging ${e} scale domain contains extra elements.`),Pd(y,v)<0&&([y,v]=[v,y],g=!g),y=Math.min(y,c),v=Math.max(v,c),typeof d!="function"&&(d=sX(d)),f!==void 0&&(d=d.length===1?VR(d)(...f):XS(d,f)),g&&(d=iX(d)),h){const b=n.apply(c),_=b-n.apply(y),w=n.apply(v)-b;_w&&(v=n.invert(b+_))}return t.domain([y,c,v]).unknown(l).interpolator(d),o&&t.clamp(o),s&&t.nice(s),{type:i,domain:[y,v],pivot:c,interpolate:d,scale:t}}function kCt(e,t,n){return N3(e,lV(),RCt,t,n)}function TCt(e,t,n){return lX(e,t,{...n,exponent:.5})}function lX(e,t,{exponent:n=1,...r}){return N3(e,fV().exponent(n=+n),$Ct(n),t,{...r,type:"diverging-pow"})}function MCt(e,t,{base:n=10,pivot:r=1,domain:i=Wv(t,r<0?b3:Su),...s}){return N3(e,cV().base(n=+n),CCt,t,{domain:i,pivot:r,...s})}function ICt(e,t,{constant:n=1,...r}){return N3(e,uV().constant(n=+n),OCt(n),t,r)}const RCt={apply(e){return e},invert(e){return e}},CCt={apply:Math.log,invert:Math.exp},NCt={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function $Ct(e){return e===.5?NCt:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function OCt(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function cX(e,t,n,r){return G1(e,t,n,r)}function LCt(e,t,n){return cX(e,jSt(),t,n)}function DCt(e,t,n){return cX(e,VSt(),t,n)}const X1=Symbol("ordinal");function uX(e,t,n,{type:r,interval:i,domain:s,range:o,reverse:a,hint:l}){return i=rm(i,r),s===void 0&&(s=hX(n,i,e)),(r==="categorical"||r===X1)&&(r="ordinal"),a&&(s=Rx(s)),s=t.domain(s).domain(),o!==void 0&&(typeof o=="function"&&(o=o(s)),t.range(o)),{type:r,domain:s,range:o,scale:t,hint:l,interval:i}}function FCt(e,t,{type:n,interval:r,domain:i,range:s,scheme:o,unknown:a,...l}){r=rm(r,n),i===void 0&&(i=hX(t,r,e));let c;if(qr.get(e)===k3)c=UCt(t),s=s===void 0?zCt(c):pr(s,CR);else if(qr.get(e)===Gu&&(s===void 0&&(n==="ordinal"||n===X1)&&(s=lCt(i,o),s!==void 0&&(o=void 0)),o===void 0&&s===void 0&&(o=n==="ordinal"?"turbo":"observable10"),o!==void 0))if(s!==void 0){const u=qR(o),f=s[0],h=s[1]-s[0];s=({length:d})=>yl(g=>u(f+h*g),d)}else s=rX(o);if(a===N4)throw new Error(`implicit unknown on ${e} scale is not supported`);return uX(e,hI().unknown(a),t,{...l,type:n,domain:i,range:s,hint:c})}function BCt(e,t,{align:n=.5,padding:r=.5,...i}){return fX(Pxt().align(n).padding(r),t,i,e)}function PCt(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:s=e==="fx"||e==="fy"?0:r,...o}){return fX(_1().align(n).paddingInner(i).paddingOuter(s),t,o,e)}function fX(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=uX(r,e,t,n),e.round=i,e}function hX(e,t,n){const r=new Gg;for(const{value:i,domain:s}of e){if(s!==void 0)return s();if(i!==void 0)for(const o of i)r.add(o)}if(t!==void 0){const[i,s]=yi(r).map(t.floor,t);return t.range(i,t.offset(s))}if(r.size>1e4&&qr.get(n)===ic)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return Mx(r,Ua)}function YD(e,t){let n;for(const{hint:r}of e){const i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function UCt(e){return{fill:YD(e,"fill"),stroke:YD(e,"stroke")}}function zCt(e){return $r(e.fill)?UIt:PIt}function FM(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:s=n,insetLeft:o=n,round:a,nice:l,clamp:c,zero:u,align:f,padding:h,projection:d,facet:{label:g=t}={},...y}={}){const v={};for(const[b,_]of e){const w=y[b],S=yX(b,_,{round:qr.get(b)===ic?a:void 0,nice:l,clamp:c,zero:u,align:f,padding:h,projection:d,...w});if(S){let{label:k=b==="fx"||b==="fy"?g:t,percent:A,transform:T,inset:M,insetTop:I=M!==void 0?M:b==="y"?r:0,insetRight:C=M!==void 0?M:b==="x"?i:0,insetBottom:N=M!==void 0?M:b==="y"?s:0,insetLeft:L=M!==void 0?M:b==="x"?o:0}=w||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");S.percent=!!A,S.label=k===void 0?jCt(_,S):k,S.transform=T,b==="x"||b==="fx"?(S.insetLeft=+L,S.insetRight=+C):(b==="y"||b==="fy")&&(S.insetTop=+I,S.insetBottom=+N),v[b]=S}}return v}function HD(e){const t={},n={scales:t};for(const[r,i]of Object.entries(e)){const{scale:s,type:o,interval:a,label:l}=i;t[r]=bX(i),n[r]=s,s.type=o,a!=null&&(s.interval=a),l!=null&&(s.label=l)}return n}function qCt(e,t){const{x:n,y:r,fx:i,fy:s}=e,o=i||s?WR(t):t;i&&GD(i,o),s&&XD(s,o);const a=i||s?pX(e,t):t;n&&GD(n,a),r&&XD(r,a)}function jCt(e=[],t){let n;for(const{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!mp(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function dX(e){return Math.sign(Sg(e.domain()))*Math.sign(Sg(e.range()))}function WR(e){const{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:s,height:o,facet:{marginTop:a,marginRight:l,marginBottom:c,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,l),marginBottom:Math.max(r,c),marginLeft:Math.max(i,u),width:s,height:o}}function pX({fx:e,fy:t},n){const{marginTop:r,marginRight:i,marginBottom:s,marginLeft:o,width:a,height:l}=WR(n);return{marginTop:r,marginRight:i,marginBottom:s,marginLeft:o,width:e?e.scale.bandwidth()+o+i:a,height:t?t.scale.bandwidth()+r+s:l,facet:{width:a,height:l}}}function GD(e,t){if(e.range===void 0){const{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:s=0,marginRight:o=0}=t,a=s+n,l=i-o-r;e.range=[a,Math.max(a,l)],mp(e)||(e.range=mX(e)),e.scale.range(e.range)}gX(e)}function XD(e,t){if(e.range===void 0){const{insetTop:n,insetBottom:r}=e,{height:i,marginTop:s=0,marginBottom:o=0}=t,a=s+n,l=i-o-r;e.range=[Math.max(a,l),a],mp(e)?e.range.reverse():e.range=mX(e),e.scale.range(e.range)}gX(e)}function gX(e){e.round===void 0&&YCt(e)&&VCt(e)<=30&&e.scale.round(!0)}function VCt({scale:e}){const t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,s=e.paddingOuter?e.paddingOuter():e.padding(),o=t-i,a=Math.abs(r-n)/Math.max(1,o+s*2);return(a-Math.floor(a))*o}function mX(e){const t=e.scale.domain().length+vX(e);if(!(t>2))return e.range;const[n,r]=e.range;return Array.from({length:t},(i,s)=>n+s/(t-1)*(r-n))}function BM(e,t,n){return yX(e,n===void 0?void 0:[{hint:n}],{...t})}function yX(e,t=[],n={}){const r=WCt(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&mp({type:r})){const i=t.map(({value:s})=>s).filter(s=>s!==void 0);i.some(zs)?Au(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Qp(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Qp(r)}".`):i.some(MRt)?Au(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Qp(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Qp(r)}".`):i.some(IRt)&&Au(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Qp(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Qp(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=M_(t,n,co);break;case"identity":switch(qr.get(e)){case ic:n=M_(t,n,co);break;case k3:n=M_(t,n,HCt);break}break;case"utc":case"time":n=M_(t,n,kG);break}switch(r){case"diverging":return kCt(e,t,n);case"diverging-sqrt":return TCt(e,t,n);case"diverging-pow":return lX(e,t,n);case"diverging-log":return MCt(e,t,n);case"diverging-symlog":return ICt(e,t,n);case"categorical":case"ordinal":case X1:return FCt(e,t,n);case"cyclical":case"sequential":case"linear":return hCt(e,t,n);case"sqrt":return dCt(e,t,n);case"threshold":return jR(e,t,n);case"quantile":return mCt(e,t,n);case"quantize":return yCt(e,t,n);case"pow":return oX(e,t,n);case"log":return pCt(e,t,n);case"symlog":return gCt(e,t,n);case"utc":return DCt(e,t,n);case"time":return LCt(e,t,n);case"point":return BCt(e,t,n);case"band":return PCt(e,t,n);case"identity":return bCt(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Qp(e){return typeof e=="symbol"?e.description:e}function KD(e){return typeof e=="string"?`${e}`.toLowerCase():e}const JD={toString:()=>"projection"};function WCt(e,t,{type:n,domain:r,range:i,scheme:s,pivot:o,projection:a}){if(n=KD(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=JD);for(const u of t){const f=KD(u.type);if(f!==void 0){if(n===void 0)n=f;else if(n!==f)throw new Error(`scale incompatible with channel: ${n} !== ${f}`)}}if(n===JD)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:u})=>u!==void 0))return;const l=qr.get(e);if(l===W1)return"sqrt";if(l===H1||l===Y1)return"linear";if(l===k3)return"ordinal";const c=(r??i)?.length;if(c<2||c>2)return Hk(l);if(r!==void 0){if(Hr(r))return Hk(l);if(zs(r))return"utc"}else{const u=t.map(({value:f})=>f).filter(f=>f!==void 0);if(u.some(Hr))return Hk(l);if(u.some(zs))return"utc"}if(l===Gu){if(o!=null||uCt(s))return"diverging";if(aCt(s))return"categorical"}return"linear"}function Hk(e){switch(e){case ic:return"point";case Gu:return X1;default:return"ordinal"}}function mp({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===X1}function vX({type:e}){return e==="threshold"}function YCt({type:e}){return e==="point"||e==="band"}function xc(e){if(e===void 0)return!0;const t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r{if(!qr.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function bX({scale:e,type:t,domain:n,range:r,interpolate:i,interval:s,transform:o,percent:a,pivot:l}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};const c=e.unknown?e.unknown():void 0;return{type:t,domain:Uv(n),...r!==void 0&&{range:Uv(r)},...o!==void 0&&{transform:o},...a&&{percent:a},...c!==void 0&&{unknown:c},...s!==void 0&&{interval:s},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...l!==void 0&&{pivot:l,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function XCt(e,t){const{fx:n,fy:r}=FM(e,t),i=n?.scale.domain(),s=r?.scale.domain();return i&&s?Axt(i,s).map(([o,a],l)=>({x:o,y:a,i:l})):i?i.map((o,a)=>({x:o,i:a})):s?s.map((o,a)=>({y:o,i:a})):void 0}function KCt(e,{x:t,y:n}){return t&&=PM(t),n&&=PM(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function YR(e,{fx:t,fy:n}){const r=Yu(e),i=t?.value,s=n?.value;return t&&n?D0(r,o=>(o.fx=i[o[0]],o.fy=s[o[0]],o),o=>i[o],o=>s[o]):t?D0(r,o=>(o.fx=i[o[0]],o),o=>i[o]):D0(r,o=>(o.fy=s[o[0]],o),o=>s[o])}function JCt(e,t,{marginTop:n,marginLeft:r}){const i=e?({x:o})=>e(o)-r:()=>0,s=t?({y:o})=>t(o)-n:()=>0;return function(o){this.tagName==="svg"?(this.setAttribute("x",i(o)),this.setAttribute("y",s(o))):this.setAttribute("transform",`translate(${i(o)},${s(o)})`)}}function ZCt(e){const t=[],n=new Uint32Array(ml(e,r=>r.length));for(const r of e){let i=0;for(const s of e)r!==s&&(n.set(s,i),i+=s.length);t.push(n.slice(0,i))}return t}const QCt=new Map([["top",Gk],["right",Jk],["bottom",Xk],["left",Kk],["top-left",I_(Gk,Kk)],["top-right",I_(Gk,Jk)],["bottom-left",I_(Xk,Kk)],["bottom-right",I_(Xk,Jk)],["top-empty",n8t],["right-empty",s8t],["bottom-empty",r8t],["left-empty",i8t],["empty",o8t]]);function t8t(e){if(e==null)return null;const t=QCt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}const ZD=new WeakMap;function PM(e){let t=ZD.get(e);return t||ZD.set(e,t=new Ud(pr(e,(n,r)=>[n,r]))),t}function _h(e,t){return PM(e).get(t)}function e8t(e,t,n){return t=gu(t),n=gu(n),e.find(r=>Object.is(gu(r.x),t)&&Object.is(gu(r.y),n))}function $3(e,t,n){return e8t(e,t,n)?.empty}function Gk(e,{y:t},{y:n}){return t?_h(t,n)===0:!0}function Xk(e,{y:t},{y:n}){return t?_h(t,n)===t.length-1:!0}function Kk(e,{x:t},{x:n}){return t?_h(t,n)===0:!0}function Jk(e,{x:t},{x:n}){return t?_h(t,n)===t.length-1:!0}function n8t(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const s=_h(t,r);if(s>0)return $3(e,n,t[s-1])}function r8t(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const s=_h(t,r);if(s0)return $3(e,t[s-1],r)}function s8t(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const s=_h(t,n);if(sr.get(i)?.get(s)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}const _X=Math.PI,Kc=2*_X,Qk=.618;function a8t({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:s=t}={},o){if(e==null)return;if(typeof e.stream=="function")return e;let a,l,c="frame";if(Ko(e)){let k;if({type:e,domain:l,inset:k,insetTop:n=k!==void 0?k:n,insetRight:r=k!==void 0?k:r,insetBottom:i=k!==void 0?k:i,insetLeft:s=k!==void 0?k:s,clip:c=c,...a}=e,e==null)return}typeof e!="function"&&({type:e}=UM(e));const{width:u,height:f,marginLeft:h,marginRight:d,marginTop:g,marginBottom:y}=o,v=u-h-d-s-r,b=f-g-y-n-i;if(e=e?.({width:v,height:b,clip:c,...a}),e==null)return;c=l8t(c,h,g,u-d,f-y);let _=h+s,w=g+n,S;if(l!=null){const[[k,A],[T,M]]=P1(e).bounds(l),I=Math.min(v/(T-k),b/(M-A));I>0?(_-=(I*(k+T)-v)/2,w-=(I*(A+M)-b)/2,S=m2({point(C,N){this.stream.point(C*I+_,N*I+w)}})):Au("Warning: the projection could not be fit to the specified domain; using the default scale.")}return S??=_===0&&w===0?wX():m2({point(k,A){this.stream.point(k+_,A+w)}}),{stream:k=>e.stream(S.stream(c(k)))}}function UM(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ka(C6t,.7463,.4673);case"albers":return R_(kH,.7463,.4673);case"azimuthal-equal-area":return Ka(N6t,4,4);case"azimuthal-equidistant":return Ka($6t,Kc,Kc);case"conic-conformal":return R_(D6t,Kc,Kc);case"conic-equal-area":return R_(y2,6.1702,2.9781);case"conic-equidistant":return R_(P6t,7.312,3.6282);case"equal-earth":return Ka(z6t,5.4133,2.6347);case"equirectangular":return Ka(F6t,Kc,_X);case"gnomonic":return Ka(q6t,3.4641,3.4641);case"identity":return{type:wX};case"reflect-y":return{type:c8t};case"mercator":return Ka(O6t,Kc,Kc);case"orthographic":return Ka(j6t,2,2);case"stereographic":return Ka(V6t,2,2);case"transverse-mercator":return Ka(W6t,Kc,Kc);default:throw new Error(`unknown projection type: ${e}`)}}function l8t(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return s=>s;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return uH(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Ka(e,t,n){return{type:({width:r,height:i,rotate:s,precision:o=.15,clip:a})=>{const l=e();return o!=null&&l.precision?.(o),s!=null&&l.rotate?.(s),typeof a=="number"&&l.clipAngle?.(a),r!=null&&(l.scale(Math.min(r/t,i/n)),l.translate([r/2,i/2])),l},aspectRatio:n/t}}function R_(e,t,n){const{type:r,aspectRatio:i}=Ka(e,t,n);return{type:s=>{const{parallels:o,domain:a,width:l,height:c}=s,u=r(s);return o!=null&&(u.parallels(o),a===void 0&&l!=null&&u.fitSize([l,c],{type:"Sphere"})),u},aspectRatio:i}}const wX=Vi({stream:e=>e}),c8t=Vi(m2({point(e,t){this.stream.point(e,-t)}}));function xX(e,t,n,r){const i=n[e],s=n[t],o=i.length,a=n[e]=new Float64Array(o).fill(NaN),l=n[t]=new Float64Array(o).fill(NaN);let c;const u=r.stream({point(f,h){a[c]=f,l[c]=h}});for(c=0;c5?5:l:Qk}}if(e!=null){if(typeof e!="function"){const{aspectRatio:t}=UM(e);if(t)return t}return Qk}}function K1(e,t,{projection:n}){const{x:r,y:i}=e;let s={};return r&&(s.x=r),i&&(s.y=i),s=R3(s,t),n&&r?.scale==="x"&&i?.scale==="y"&&xX("x","y",s,n),r&&(s.x=co(s.x)),i&&(s.y=co(s.y)),s}function h8t(e){const t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},s={point(o,a){t.push(o),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(const o of e.value)_f(o,s);return[r,i]}function d8t({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,m2({point(n,r){this.stream.point(e(n),t(r))}})}function O3(e={}){const{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:FG(n)}}function Sn(e,{document:t}){return Ar(f3(e).call(t.documentElement))}const zM=Symbol("unset");function kg(e){return(e.length===1?p8t:g8t)(e)}function p8t(e){let t,n=zM;return r=>(Object.is(n,r)||(n=r,t=e(r)),t)}function g8t(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,s)=>!Object.is(i,r[s])))&&(n=r,t=e(...r)),t)}const m8t=kg(e=>new Intl.NumberFormat(e)),y8t=kg((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),v8t=kg((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function SX(e="en-US"){const t=m8t(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function b8t(e="en-US",t="short"){const n=y8t(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function _8t(e="en-US",t="short"){const n=v8t(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function AX(e){return fRt(e,"Invalid Date")}function w8t(e="en-US"){const t=SX(e);return n=>(n instanceof Date?AX:typeof n=="number"?t:ji)(n)}const Tg=w8t(),Wi=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5;let x8t=0,S8t=0;function HR(){return`plot-clip-${++x8t}`}function A8t(){return`plot-pattern-${++S8t}`}function EX(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:s,target:o,fill:a,fillOpacity:l,stroke:c,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:g,strokeDasharray:y,strokeDashoffset:v,opacity:b,mixBlendMode:_,imageFilter:w,paintOrder:S,pointerEvents:k,shapeRendering:A,channels:T},{ariaLabel:M,fill:I="currentColor",fillOpacity:C,stroke:N="none",strokeOpacity:L,strokeWidth:F,strokeLinecap:$,strokeLinejoin:D,strokeMiterlimit:O,paintOrder:B}){I===null&&(a=null,l=null),N===null&&(c=null,f=null),$r(I)?!$r(N)&&(!$r(a)||T?.fill)&&(N="none"):$r(N)&&(!$r(c)||T?.stroke)&&(I="none");const[V,U]=Us(a,I),[z,q]=li(l,C),[Y,Q]=Us(c,N),[ft,gt]=li(f,L),[pt,lt]=li(b);Eg(Q)||(u===void 0&&(u=F),d===void 0&&(d=$),h===void 0&&(h=D),g===void 0&&!NRt(h)&&(g=O),!Eg(U)&&S===void 0&&(S=B));const[vt,st]=li(u);return I!==null&&(e.fill=pi(U,"currentColor"),e.fillOpacity=Zm(q,1)),N!==null&&(e.stroke=pi(Q,"none"),e.strokeWidth=Zm(st,1),e.strokeOpacity=Zm(gt,1),e.strokeLinejoin=pi(h,"miter"),e.strokeLinecap=pi(d,"butt"),e.strokeMiterlimit=Zm(g,4),e.strokeDasharray=pi(y,"none"),e.strokeDashoffset=pi(v,"0")),e.target=ji(o),e.ariaLabel=ji(M),e.ariaDescription=ji(i),e.ariaHidden=ji(s),e.opacity=Zm(lt,1),e.mixBlendMode=pi(_,"normal"),e.imageFilter=pi(w,"none"),e.paintOrder=pi(S,"normal"),e.pointerEvents=pi(k,"auto"),e.shapeRendering=pi(A,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:V,scale:"auto",optional:!0},fillOpacity:{value:z,scale:"auto",optional:!0},stroke:{value:Y,scale:"auto",optional:!0},strokeOpacity:{value:ft,scale:"auto",optional:!0},strokeWidth:{value:vt,optional:!0},opacity:{value:pt,scale:"auto",optional:!0}}}function E8t(e,t){t&&e.filter(n=>vR(t[n])).append("title").call(T8t,t)}function k8t(e,t){t&&e.filter(([n])=>vR(t[n])).append("title").call(M8t,t)}function T8t(e,t){t&&e.text(n=>Tg(t[n]))}function M8t(e,t){t&&e.text(([n])=>Tg(t[n]))}function Wr(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:s,fillOpacity:o,stroke:a,strokeOpacity:l,strokeWidth:c,opacity:u,href:f}){r&&me(e,"aria-label",h=>r[h]),s&&me(e,"fill",h=>s[h]),o&&me(e,"fill-opacity",h=>o[h]),a&&me(e,"stroke",h=>a[h]),l&&me(e,"stroke-opacity",h=>l[h]),c&&me(e,"stroke-width",h=>c[h]),u&&me(e,"opacity",h=>u[h]),f&&TX(e,h=>f[h],t),n||E8t(e,i)}function C2(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:s,fillOpacity:o,stroke:a,strokeOpacity:l,strokeWidth:c,opacity:u,href:f}){r&&me(e,"aria-label",([h])=>r[h]),s&&me(e,"fill",([h])=>s[h]),o&&me(e,"fill-opacity",([h])=>o[h]),a&&me(e,"stroke",([h])=>a[h]),l&&me(e,"stroke-opacity",([h])=>l[h]),c&&me(e,"stroke-width",([h])=>c[h]),u&&me(e,"opacity",([h])=>u[h]),f&&TX(e,([h])=>f[h],t),n||k8t(e,i)}function I8t({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:s,strokeWidth:o,opacity:a,href:l},{tip:c}){return[e,c?void 0:t,n,r,i,s,o,a,l].filter(u=>u!==void 0)}function GR(e,t,n){const r=hh(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Au("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*kX(e,t,n,r){const{z:i}=n,{z:s}=r,o=I8t(r,n),a=[...t,...o];for(const l of s?GR(e,s,i):[e]){let c,u;t:for(const f of l){for(const h of a)if(!Yi(h[f])){u&&u.push(-1);continue t}if(c===void 0){u&&(yield u),c=o.map(h=>gu(h[f])),u=[f];continue}u.push(f);for(let h=0;hgu(g[f])),u=[f];continue t}}u&&(yield u)}}function R8t(e,t,n,r){let i;const{clip:s=r.clip}=t;s==="frame"?(e=Sn("svg:g",r).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=N8t(r,n)):s&&(i=O8t(s,r)),me(e,"aria-label",t.ariaLabel),me(e,"aria-description",t.ariaDescription),me(e,"aria-hidden",t.ariaHidden),me(e,"clip-path",i)}function C8t(e){const t=new WeakMap;return(n,r)=>{let i=t.get(n);if(!i){const s=HR();Ar(n.ownerSVGElement).append("clipPath").attr("id",s).call(e,n,r),t.set(n,i=`url(#${s})`)}return i}}const N8t=C8t((e,t,n)=>{const{width:r,height:i,marginLeft:s,marginRight:o,marginTop:a,marginBottom:l}=n;e.append("rect").attr("x",s).attr("y",a).attr("width",r-o-s).attr("height",i-a-l)}),QD=new WeakMap,$8t={type:"Sphere"};function O8t(e,t){let n,r;if((n=QD.get(t))||QD.set(t,n=new WeakMap),e.type==="Sphere"&&(e=$8t),!(r=n.get(e))){const i=HR();Ar(t.ownerSVGElement).append("clipPath").attr("id",i).append("path").attr("d",t.path()(e)),n.set(e,r=`url(#${i})`)}return r}function Mr(e,t,n,r){R8t(e,t,n,r),me(e,"class",t.className),me(e,"fill",t.fill),me(e,"fill-opacity",t.fillOpacity),me(e,"stroke",t.stroke),me(e,"stroke-width",t.strokeWidth),me(e,"stroke-opacity",t.strokeOpacity),me(e,"stroke-linejoin",t.strokeLinejoin),me(e,"stroke-linecap",t.strokeLinecap),me(e,"stroke-miterlimit",t.strokeMiterlimit),me(e,"stroke-dasharray",t.strokeDasharray),me(e,"stroke-dashoffset",t.strokeDashoffset),me(e,"shape-rendering",t.shapeRendering),me(e,"filter",t.imageFilter),me(e,"paint-order",t.paintOrder);const{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;me(e,"pointer-events",i)}function cr(e,t){L8t(e,"mix-blend-mode",t.mixBlendMode),me(e,"opacity",t.opacity)}function TX(e,t,n){e.each(function(r){const i=t(r);if(i!=null){const s=this.ownerDocument.createElementNS(Nu.svg,"a");s.setAttribute("fill","inherit"),s.setAttributeNS(Nu.xlink,"href",i),n!=null&&s.setAttribute("target",n),this.parentNode.insertBefore(s,this).appendChild(this)}})}function me(e,t,n){n!=null&&e.attr(t,n)}function L8t(e,t,n){n!=null&&e.style(t,n)}function mr(e,t,{x:n,y:r},i=Wi,s=Wi){i+=t.dx,s+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(s+=r.bandwidth()/2),(i||s)&&e.attr("transform",`translate(${i},${s})`)}function pi(e,t){if((e=ji(e))!==t)return e}function Zm(e,t){if((e=kr(e))!==t)return e}const D8t=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function XR(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!D8t.test(e))throw new Error(`invalid class name: ${e}`);return e}function KR(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(const n of e)Object.assign(n.style,t)}function Nc({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:s,marginLeft:o}){return[/left$/.test(e)?o:/right$/.test(e)?t-i:(o+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-s:(r+n-s)/2]}let yr=class{constructor(t,n={},r={},i){const{facet:s="auto",facetAnchor:o,fx:a,fy:l,sort:c,dx:u=0,dy:f=0,margin:h=0,marginTop:d=h,marginRight:g=h,marginBottom:y=h,marginLeft:v=h,className:b,clip:_=i?.clip,channels:w,tip:S,render:k}=r;if(this.data=t,this.sort=Zf(c)?c:null,this.initializer=gs(r).initializer,this.transform=this.initializer?r.transform:Rl(r).transform,s===null||s===!1?this.facet=null:(this.facet=Xo(s===!0?"include":s,"facet",["auto","include","exclude","super"]),this.fx=t===Wy&&typeof a=="string"?[a]:a,this.fy=t===Wy&&typeof l=="string"?[l]:l),this.facetAnchor=t8t(o),n=MR(n),w!==void 0&&(n={...F8t(w),...n}),i!==void 0&&(n={...EX(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([A,T])=>{if(Yl(T.value)){const{value:M,label:I=T.label,scale:C=T.scale}=T.value;T={...T,label:I,scale:C,value:M}}if(t===Wy&&typeof T.value=="string"){const{value:M}=T;T={...T,value:[M]}}return[A,T]}).filter(([A,{value:T,optional:M}])=>{if(T!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${A}`)})),this.dx=+u,this.dy=+f,this.marginTop=+d,this.marginRight=+g,this.marginBottom=+y,this.marginLeft=+v,this.clip=FG(_),this.tip=B8t(S),this.className=ji(b),this.facet==="super"){if(a||l)throw new Error("super-faceting cannot use fx or fy");for(const A in this.channels){const{scale:T}=n[A];if(!(T!=="x"&&T!=="y"))throw new Error("super-faceting cannot use x or y")}}k!=null&&(this.render=Hv(k,this.render))}initialize(t,n,r){let i=Ag(this.data);t===void 0&&i!=null&&(t=[Yu(i)]);const s=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=Ag(i)),t!==void 0&&(t.original=s);const o=ZG(this.channels,i);return this.sort!=null&&rCt(i,t,o,n,this.sort),{data:i,facets:t,channels:o}}filter(t,n,r){for(const i in n){const{filter:s=Yi}=n[i];if(s!==null){const o=r[i];t=t.filter(a=>s(o[a]))}}return t}project(t,n,r){for(const i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){const s=i.replace(/^x|x$/,"y");s in t&&t[s].scale==="y"&&xX(i,s,n,r.projection)}}scale(t,n,r){const i=R3(t,n);return r.projection&&this.project(t,i,r),i}};function za(...e){return e.plot=yr.prototype.plot,e}function Hv(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,s,o,a){return e.call(this,n,r,i,s,o,(l,c,u,f,h)=>t.call(this,l,c,u,f,h,a))}}function F8t(e){return Object.fromEntries(Object.entries(MR(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:im(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function B8t(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Xo(e,"tip",["x","y","xy"]):e}function yp(e,t){return e?.tip===!0?{...e,tip:t}:Ko(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function P8t(e,t,n={}){let r=.5-Wi,i=.5+Wi,s=.5+Wi,o=.5-Wi;for(const{marginTop:y,marginRight:v,marginBottom:b,marginLeft:_}of t)y>r&&(r=y),v>i&&(i=v),b>s&&(s=b),_>o&&(o=_);let{margin:a,marginTop:l=a!==void 0?a:r,marginRight:c=a!==void 0?a:i,marginBottom:u=a!==void 0?a:s,marginLeft:f=a!==void 0?a:o}=n;l=+l,c=+c,u=+u,f=+f;let{width:h=640,height:d=U8t(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:s,marginLeftDefault:o})+Math.max(0,l-r+u-s)}=n;h=+h,d=+d;const g={width:h,height:d,marginTop:l,marginRight:c,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:y,marginTop:v=y!==void 0?y:l,marginRight:b=y!==void 0?y:c,marginBottom:_=y!==void 0?y:u,marginLeft:w=y!==void 0?y:f}=n.facet??{};v=+v,b=+b,_=+_,w=+w,g.facet={marginTop:v,marginRight:b,marginBottom:_,marginLeft:w}}return g}function U8t({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:s},{width:o,marginTopDefault:a,marginRightDefault:l,marginBottomDefault:c,marginLeftDefault:u}){const f=n&&n.scale.domain().length||1,h=f8t(i);if(h){const g=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*g-.1)*h,v=Math.max(.1,Math.min(10,y));return Math.round((o-u-l)*v+a+c)}const d=t?mp(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(s!=null){if(s=+s,!(isFinite(s)&&s>0))throw new Error(`invalid aspectRatio: ${s}`);const g=tF("y",t)/(tF("x",e)*s),y=r?r.scale.bandwidth():1,v=n?n.scale.bandwidth():1,b=y*(o-u-l)-e.insetLeft-e.insetRight;return(g*b+t.insetTop+t.insetBottom)/v+a+c}return!!(t||n)*Math.max(1,Math.min(60,d*f))*20+!!r*30+60}function tF(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);const{type:n,domain:r}=t;let i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{const a=t.scale.exponent();i=l=>Math.pow(l,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}const[s,o]=yi(r);return Math.abs(i(o)-i(s))}const eF=new WeakMap;function JR(e,t,{x:n,y:r,px:i,py:s,maxRadius:o=40,channels:a,render:l,...c}={}){return o=+o,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),s!=null&&(r??=null,a={...a,py:{value:s,scale:"y"}}),{x:n,y:r,channels:a,...c,render:Hv(function(u,f,h,d,g,y){g={...g,pointerSticky:!1};const v=g.ownerSVGElement,{data:b}=g.getMarkState(this);let _=eF.get(v);_||eF.set(v,_={sticky:!1,roots:[],renders:[]});let w=_.renders.push(Q)-1;const{x:S,y:k,fx:A,fy:T}=f;let M=A?A(u.fx)-d.marginLeft:0,I=T?T(u.fy)-d.marginTop:0;S?.bandwidth&&(M+=S.bandwidth()/2),k?.bandwidth&&(I+=k.bandwidth()/2);const C=u.fi!=null;let N;if(C){let lt=_.facetStates;lt||(_.facetStates=lt=new Map),N=lt.get(this),N||lt.set(this,N=new Map)}const[L,F]=Nc(this,d),{px:$,py:D}=h,O=$?lt=>$[lt]:MX(h,L),B=D?lt=>D[lt]:IX(h,F);let V,U,z,q;function Y(lt,vt){if(C)if(q&&(q=cancelAnimationFrame(q)),lt==null)N.delete(u.fi);else{N.set(u.fi,vt),q=requestAnimationFrame(()=>{q=null;for(const[st,Z]of N)if(Z1)){const Z=V==null?null:Wu(b)?b[V]:b.get(V);g.dispatchValue(Z)}return st}function ft(lt){if(_.sticky||lt.pointerType==="mouse"&<.buttons===1)return;let[vt,st]=Qa(lt);vt-=M,st-=I;const Z=vtd.width-d.marginRight?1:e,mt=std.height-d.marginBottom?1:t;let at=null,Ct=o*o;for(const wt of u){const Bt=Z*(O(wt)-vt),Pt=mt*(B(wt)-st),kt=Bt*Bt+Pt*Pt;kt<=Ct&&(at=wt,Ct=kt)}if(at!=null&&(e!==1||t!==1)){const wt=O(at)-vt,Bt=B(at)-st;Ct=wt*wt+Bt*Bt}Y(at,Ct)}function gt(lt){lt.pointerType==="mouse"&&V!=null&&(_.sticky&&_.roots.some(vt=>vt?.contains(lt.target))||(_.sticky?(_.sticky=!1,_.renders.forEach(vt=>vt(null))):(_.sticky=!0,Q(V)),lt.stopImmediatePropagation()))}function pt(lt){lt.pointerType==="mouse"&&(_.sticky||Y(null))}return v.addEventListener("pointerenter",ft),v.addEventListener("pointermove",ft),v.addEventListener("pointerdown",gt),v.addEventListener("pointerleave",pt),Q(null)},l)}}function L3(e){return JR(1,1,e)}function D3(e){return JR(1,.01,e)}function Gv(e){return JR(.01,1,e)}function MX({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function IX({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function RX(e){return mp(e)&&e.interval===void 0?void 0:"tabular-nums"}function z8t(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:s=44+r,marginTop:o=18,marginRight:a=0,marginBottom:l=16+r,marginLeft:c=0,style:u,ticks:f=(i-c-a)/64,tickFormat:h,fontVariant:d=RX(e),round:g=!0,opacity:y,className:v}=t;const b=O3(t);v=XR(v),y=li(y)[1],h===null&&(h=()=>null);const _=Sn("svg",b).attr("class",`${v}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).call(L=>L.append("style").text(`:where(.${v}-ramp) { + display: block; + height: auto; + height: intrinsic; + max-width: 100%; + overflow: visible; +} +:where(.${v}-ramp text) { + white-space: pre; +}`)).call(KR,u);let w=L=>L.selectAll(".tick line").attr("y1",o+l-s),S;const k=g?(L,F)=>L.rangeRound(F):(L,F)=>L.range(F),{type:A,domain:T,range:M,interpolate:I,scale:C,pivot:N}=e;if(I){const L=M===void 0?I:XS(I.length===1?VR(I):I,M);S=k(C.copy(),yl(es(c,i-a),Math.min(T.length+(N!==void 0),M===void 0?1/0:M.length)));const F=256,$=b.document.createElement("canvas");$.width=F,$.height=1;const D=$.getContext("2d");for(let O=0,B=F-1;O$:typeof h=="string"?Wa(h):h;S=k(zu().domain([-1,M.length-1]),[c,i-a]),_.append("g").attr("fill-opacity",y).selectAll().data(M).enter().append("rect").attr("x",($,D)=>S(D-1)).attr("y",o).attr("width",($,D)=>S(D)-S(D-1)).attr("height",s-o-l).attr("fill",$=>$),f=pr(L,($,D)=>D),h=$=>F(L[$],$)}else S=k(_1().domain(T),[c,i-a]),_.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",S).attr("y",o).attr("width",Math.max(0,S.bandwidth()-1)).attr("height",s-o-l).attr("fill",C),w=()=>{};return _.append("g").attr("transform",`translate(0,${s-l})`).call(sTt(S).ticks(Array.isArray(f)?null:f,typeof h=="string"?h:void 0).tickFormat(typeof h=="function"?h:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",pi(d,"normal")).call(w).call(L=>L.select(".domain").remove()),n!==void 0&&_.append("text").attr("x",c).attr("y",o-6).attr("fill","currentColor").attr("font-weight","bold").text(n),_.node()}const N2=Math.PI/180;function sm(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=tT(n),e.markerMid=tT(r),e.markerEnd=tT(i)}function tT(e){if(e==null||e===!1)return null;if(e===!0)return rF;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return nF("auto");case"arrow-reverse":return nF("auto-start-reverse");case"dot":return q8t;case"circle":case"circle-fill":return rF;case"circle-stroke":return j8t;case"tick":return eT("auto");case"tick-x":return eT(90);case"tick-y":return eT(0)}throw new Error(`invalid marker: ${e}`)}function nF(e){return(t,n)=>Sn("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function q8t(e,t){return Sn("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function rF(e,t){return Sn("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function j8t(e,t){return Sn("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function eT(e){return(t,n)=>Sn("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}let V8t=0;function J1(e,t,{stroke:n},r){return NX(e,t,n&&(i=>n[i]),null,r)}function W8t(e,t,{stroke:n,z:r},i){return NX(e,t,n&&(([s])=>n[s]),r,i)}const qM=1,CX=2;function Y8t(e,t){const n=new Uint8Array(t.length),r=e.data().filter(s=>s.length>1),i=r.length;for(let s=0,o=zM;s1){const l=a[0];o!==(o=gu(t[l]))&&(n[l]|=qM)}}for(let s=i-1,o=zM;s>=0;--s){const a=r[s];if(a.length>1){const l=a[0];o!==(o=gu(t[l]))&&(n[l]|=CX)}}return([s])=>n[s]}function NX(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},s=()=>i,o,a){if(!t&&!n&&!r)return;const l=new Map,c=o&&Y8t(e,o);function u(f,h,d){return function(g){if(d&&!d(g))return;const y=s(g);let v=l.get(h);v||l.set(h,v=new Map);let b=v.get(y);if(!b){const _=this.parentNode.insertBefore(h(y,a),this),w=`plot-marker-${++V8t}`;_.setAttribute("id",w),v.set(y,b=`url(#${w})`)}this.setAttribute(f,b)}}t&&e.each(u("marker-start",t,c&&(f=>c(f)&qM))),n&&c&&e.each(u("marker-start",n,f=>!(c(f)&qM))),n&&e.each(u("marker-mid",n)),r&&e.each(u("marker-end",r,c&&(f=>c(f)&CX)))}function Z1({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=$X(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Q1({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=$X(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function $X(e,t,n){return e===void 0&&t===void 0&&n===void 0?Wi?[1,0]:[.5,.5]:[t,n]}function OX(e,{interval:t}){return e={...im(e)},e.interval=E3(e.interval===void 0?t:e.interval),e}function F3(e,t,n,r){const{[e]:i,[`${e}1`]:s,[`${e}2`]:o}=n,{value:a,interval:l}=OX(i,n);if(a==null||l==null&&!r)return n;const c=Cc(i);if(l==null){let d;const g={transform:y=>d||(d=cn(y,a)),label:c};return{...n,[e]:void 0,[`${e}1`]:s===void 0?g:s,[`${e}2`]:o===void 0&&!(s===o&&r)?g:o}}let u,f;function h(d){return f!==void 0&&d===u?f:f=pr(cn(u=d,a),g=>l.floor(g))}return t({...n,[e]:void 0,[`${e}1`]:s===void 0?{transform:h,label:c}:s,[`${e}2`]:o===void 0?{transform:d=>h(d).map(g=>l.offset(g)),label:c}:o})}function LX(e,t,n){const{[e]:r}=n,{value:i,interval:s}=OX(r,n);return i==null||s==null?n:t({...n,[e]:{label:Cc(r),transform:o=>{const a=pr(cn(o,i),c=>s.floor(c)),l=a.map(c=>s.offset(c));return a.map(zs(a)?(c,u)=>c==null||isNaN(c=+c)||(u=l[u],u==null)||isNaN(u=+u)?void 0:new Date((c+u)/2):(c,u)=>c==null||(u=l[u],u==null)?NaN:(+c+ +u)/2)}}})}function DX(e={}){return F3("x",Z1,e,!0)}function FX(e={}){return F3("y",Q1,e,!0)}function ZR(e={}){return F3("x",Z1,e)}function QR(e={}){return F3("y",Q1,e)}function BX(e={}){return LX("x",Z1,e)}function PX(e={}){return LX("y",Q1,e)}const UX={ariaLabel:"rule",fill:null,stroke:"currentColor"};class zX extends yr{constructor(t,n={}){const{x:r,y1:i,y2:s,inset:o=0,insetTop:a=o,insetBottom:l=o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:s,scale:"y",optional:!0}},yp(n,"x"),UX),this.insetTop=kr(a),this.insetBottom=kr(l),sm(this,n)}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y1:c,y2:u}=r,{width:f,height:h,marginTop:d,marginRight:g,marginLeft:y,marginBottom:v}=i,{insetTop:b,insetBottom:_}=this;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o},Wi,0).call(w=>w.selectAll().data(t).enter().append("line").call(cr,this).attr("x1",l?S=>l[S]:(y+f-g)/2).attr("x2",l?S=>l[S]:(y+f-g)/2).attr("y1",c&&!xc(a)?S=>c[S]+b:d+b).attr("y2",u&&!xc(a)?a.bandwidth?S=>u[S]+a.bandwidth()-_:S=>u[S]-_:h-v-_).call(Wr,this,r).call(J1,this,r,s)).node()}}class qX extends yr{constructor(t,n={}){const{x1:r,x2:i,y:s,inset:o=0,insetRight:a=o,insetLeft:l=o}=n;super(t,{y:{value:s,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},yp(n,"y"),UX),this.insetRight=kr(a),this.insetLeft=kr(l),sm(this,n)}render(t,n,r,i,s){const{x:o,y:a}=n,{y:l,x1:c,x2:u}=r,{width:f,height:h,marginTop:d,marginRight:g,marginLeft:y,marginBottom:v}=i,{insetLeft:b,insetRight:_}=this;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{y:l&&a},0,Wi).call(w=>w.selectAll().data(t).enter().append("line").call(cr,this).attr("x1",c&&!xc(o)?S=>c[S]+b:y+b).attr("x2",u&&!xc(o)?o.bandwidth?S=>u[S]+o.bandwidth()-_:S=>u[S]-_:f-g-_).attr("y1",l?S=>l[S]:(d+h-v)/2).attr("y2",l?S=>l[S]:(d+h-v)/2).call(Wr,this,r).call(J1,this,r,s)).node()}}function Qf(e,t){let{x:n=de,y:r,y1:i,y2:s,...o}=QR(t);return[i,s]=jX(r,i,s),new zX(e,{...o,x:n,y1:i,y2:s})}function th(e,t){let{y:n=de,x:r,x1:i,x2:s,...o}=ZR(t);return[i,s]=jX(r,i,s),new qX(e,{...o,y:n,x1:i,x2:s})}function jX(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function tb(e,...t){let n=t.length;for(let r=0,i=!0;r{let i=e[0];for(let s=0;s=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=XX(this),this.clipLine=KX(this)}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,rotate:u,text:f,title:h,fontSize:d}=r,{rotate:g}=this,[y,v]=Nc(this,i);return Sn("svg:g",s).call(Mr,this,i,s).call(GX,this,f,i).call(mr,this,{x:l&&o,y:c&&a}).call(b=>b.selectAll().data(t).enter().append("text").call(cr,this).call(G8t,this,f,h).attr("transform",tb`translate(${l?_=>l[_]:y},${c?_=>c[_]:v})${u?_=>` rotate(${u[_]})`:g?` rotate(${g})`:""}`).call(me,"font-size",d&&(_=>d[_])).call(Wr,this,r)).node()}};function WX(e){return e==null?null:Xo(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function G8t(e,t,n,r){if(!n)return;const{lineAnchor:i,lineHeight:s,textOverflow:o,splitLines:a,clipLine:l}=t;e.each(function(c){const u=a(Tg(n[c])??"").map(l),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let d=0;for(let g=0;gi&&n(e,i,a)>t&&(r.push(e.slice(i,s)+(e[s-1]===VX?"-":"")),i=o),l){r.push(e.slice(i,a)),i=void 0;continue}s=a}return r}function*Q8t(e){let t=0,n=0;const r=e.length;for(;ns.split(/\r\n?|\n/g);const r=e?eC:tC,i=t*100;return s=>Z8t(s,i,r)}function KX({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return s=>s;const r=e?eC:tC,i=t*100;switch(n){case"clip-start":return s=>oF(s,i,r,"");case"clip-end":return s=>sF(s,i,r,"");case"ellipsis-start":return s=>oF(s,i,r,W0);case"ellipsis-middle":return s=>tNt(s,i,r,W0);case"ellipsis-end":return s=>sF(s,i,r,W0)}}const W0="…";function Ig(e,t,n,r){const i=[];let s=0;for(let o=0,a=0,l=e.length;ot){for(s+=r;s>t&&o>0;)a=o,o=i.pop(),s-=n(e,o,a);return[o,t-s]}s+=c,i.push(o)}return[-1,0]}function sF(e,t,n,r){e=e.trim();const i=n(r),[s]=Ig(e,t,n,i);return s<0?e:e.slice(0,s).trimEnd()+r}function tNt(e,t,n,r){e=e.trim();const i=n(e);if(i<=t)return e;const s=n(r)/2,[o,a]=Ig(e,t/2,n,s),[l]=Ig(e,i-t/2-a+s,n,-s);return l<0?r:e.slice(0,o).trimEnd()+r+e.slice(om(e,l)).trimStart()}function oF(e,t,n,r){e=e.trim();const i=n(e);if(i<=t)return e;const s=n(r),[o]=Ig(e,i-t+s,n,-s);return o<0?r:r+e.slice(om(e,o)).trimStart()}const jM=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,aF=/\p{Extended_Pictographic}/uy;function om(e,t){return t+=eNt(e,t)?2:1,rNt(e,t)&&(t=jM.lastIndex),nNt(e,t)?om(e,t+1):t}function JX(e,t){return e.charCodeAt(t)<128}function eNt(e,t){const n=e.charCodeAt(t);if(n>=55296&&n<56320){const r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function nNt(e,t){return e.charCodeAt(t)===8205}function rNt(e,t){return JX(e,t)?!1:(jM.lastIndex=t,jM.test(e))}function ZX(e,t){return JX(e,t)?!1:(aF.lastIndex=t,aF.test(e))}const QX={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},tK=3.5,iNt=tK*5,eK={draw(e,t,n){const r=t*n/iNt;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},nK={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},sNt=new Map([["arrow",eK],["spike",nK]]);function oNt(e){return e&&typeof e.draw=="function"}function aNt(e){if(oNt(e))return e;const t=sNt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}class P3 extends yr{constructor(t,n={}){const{x:r,y:i,r:s=tK,length:o,rotate:a,shape:l=eK,anchor:c="middle",frameAnchor:u}=n,[f,h]=li(o,12),[d,g]=li(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:d,optional:!0}},n,QX),this.r=+s,this.length=h,this.rotate=g,this.shape=aNt(l),this.anchor=Xo(c,"anchor",["start","middle","end"]),this.frameAnchor=V1(u)}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,length:u,rotate:f}=r,{length:h,rotate:d,anchor:g,shape:y,r:v}=this,[b,_]=Nc(this,i);return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o,y:c&&a}).call(w=>w.selectAll().data(t).enter().append("path").call(cr,this).attr("transform",tb`translate(${l?S=>l[S]:b},${c?S=>c[S]:_})${f?S=>` rotate(${f[S]})`:d?` rotate(${d})`:""}${g==="start"?"":g==="end"?u?S=>` translate(0,${u[S]})`:` translate(0,${h})`:u?S=>` translate(0,${u[S]/2})`:` translate(0,${h/2})`}`).attr("d",u?S=>{const k=pu();return y.draw(k,u[S],v),k}:(()=>{const S=pu();return y.draw(S,h,v),S})()).call(Wr,this,r)).node()}}function rK(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Il(n,r)),new P3(e,{...i,x:n,y:r})}function iK(e,t={}){const{x:n=de,...r}=t;return new P3(e,{...r,x:n})}function sK(e,t={}){const{y:n=de,...r}=t;return new P3(e,{...r,y:n})}function lNt(e,t={}){const{shape:n=nK,stroke:r=QX.stroke,strokeWidth:i=1,fill:s=r,fillOpacity:o=.3,anchor:a="start",...l}=t;return rK(e,{...l,shape:n,stroke:r,strokeWidth:i,fill:s,fillOpacity:o,anchor:a})}function wh(e,t){return arguments.length<2&&!Hu(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function U3({anchor:e}={},t){return e===void 0?t[0]:Xo(e,"anchor",t)}function oK(e){return U3(e,["left","right"])}function aK(e){return U3(e,["right","left"])}function lK(e){return U3(e,["bottom","top"])}function cK(e){return U3(e,["top","bottom"])}function nC(){const[e,t]=wh(...arguments);return hK("y",oK(t),e,t)}function uK(){const[e,t]=wh(...arguments);return hK("fy",aK(t),e,t)}function rC(){const[e,t]=wh(...arguments);return dK("x",lK(t),e,t)}function fK(){const[e,t]=wh(...arguments);return dK("fx",cK(t),e,t)}function hK(e,t,n,{color:r="currentColor",opacity:i=1,stroke:s=r,strokeOpacity:o=i,strokeWidth:a=1,fill:l=r,fillOpacity:c=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:g=e==="y"?6:0,tickPadding:y,tickRotate:v,x:b,margin:_,marginTop:w=_===void 0?20:_,marginRight:S=_===void 0?t==="right"?40:0:_,marginBottom:k=_===void 0?20:_,marginLeft:A=_===void 0?t==="left"?40:0:_,label:T,labelAnchor:M,labelArrow:I,labelOffset:C,ariaLabel:N=`${e}-axis`,...L}){return g=kr(g),y=kr(y),v=kr(v),M!==void 0&&(M=Xo(M,"labelAnchor",["center","top","bottom"])),I=EK(I),za(g&&!$r(s)?cNt(e,t,n,{stroke:s,strokeOpacity:o,strokeWidth:a,tickSize:g,tickPadding:y,tickRotate:v,x:b,ariaLabel:N,...L}):null,$r(l)?null:fNt(e,t,n,{fill:l,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:g,tickPadding:y,tickRotate:v,x:b,marginTop:w,marginRight:S,marginBottom:k,marginLeft:A,ariaLabel:N,...L}),!$r(l)&&T!==null?Mg([],wK({fill:l,fillOpacity:c,...L},function(F,$,D,O,B){const V=O[e],{marginTop:U,marginRight:z,marginBottom:q,marginLeft:Y}=e==="y"&&B.inset||B,Q=M??(V.bandwidth?"center":"top"),ft=C??(t==="right"?z:Y)-3;return Q==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=Q,this.frameAnchor=`${Q}-${t}`,this.rotate=0),this.dy=Q==="top"?3-U:Q==="bottom"?q-3:0,this.dx=t==="right"?ft:-ft,this.ariaLabel=`${N} label`,{facets:[[0]],channels:{text:{value:[AK(e,V,{anchor:t,label:T,labelAnchor:Q,labelArrow:I})]}}}})):null)}function dK(e,t,n,{color:r="currentColor",opacity:i=1,stroke:s=r,strokeOpacity:o=i,strokeWidth:a=1,fill:l=r,fillOpacity:c=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:g=e==="x"?6:0,tickPadding:y,tickRotate:v,y:b,margin:_,marginTop:w=_===void 0?t==="top"?30:0:_,marginRight:S=_===void 0?20:_,marginBottom:k=_===void 0?t==="bottom"?30:0:_,marginLeft:A=_===void 0?20:_,label:T,labelAnchor:M,labelArrow:I,labelOffset:C,ariaLabel:N=`${e}-axis`,...L}){return g=kr(g),y=kr(y),v=kr(v),M!==void 0&&(M=Xo(M,"labelAnchor",["center","left","right"])),I=EK(I),za(g&&!$r(s)?uNt(e,t,n,{stroke:s,strokeOpacity:o,strokeWidth:a,tickSize:g,tickPadding:y,tickRotate:v,y:b,ariaLabel:N,...L}):null,$r(l)?null:hNt(e,t,n,{fill:l,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:g,tickPadding:y,tickRotate:v,y:b,marginTop:w,marginRight:S,marginBottom:k,marginLeft:A,ariaLabel:N,...L}),!$r(l)&&T!==null?Mg([],wK({fill:l,fillOpacity:c,...L},function(F,$,D,O,B){const V=O[e],{marginTop:U,marginRight:z,marginBottom:q,marginLeft:Y}=e==="x"&&B.inset||B,Q=M??(V.bandwidth?"center":"right"),ft=C??(t==="top"?U:q)-3;return Q==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${Q}`,this.textAnchor=Q==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-ft:ft,this.dx=Q==="right"?z-3:Q==="left"?3-Y:0,this.ariaLabel=`${N} label`,{facets:[[0]],channels:{text:{value:[AK(e,V,{anchor:t,label:T,labelAnchor:Q,labelArrow:I})]}}}})):null)}function cNt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:s=null,facetAnchor:o=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:l,inset:c=0,insetLeft:u=c,insetRight:f=c,dx:h=0,y:d=e==="y"?void 0:null,ariaLabel:g,...y}){return am(sK,e,n,{ariaLabel:`${g} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:s,facetAnchor:o,frameAnchor:a,y:d,...y,dx:t==="left"?+h-Wi+ +u:+h+Wi-f,anchor:"start",length:l,shape:t==="left"?mNt:yNt})}function uNt(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:s=null,facetAnchor:o=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:l,inset:c=0,insetTop:u=c,insetBottom:f=c,dy:h=0,x:d=e==="x"?void 0:null,ariaLabel:g,...y}){return am(iK,e,n,{ariaLabel:`${g} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:s,strokeLinecap:i,facetAnchor:o,frameAnchor:a,x:d,...y,dy:t==="bottom"?+h-Wi-f:+h+Wi+ +u,anchor:"start",length:l,shape:t==="bottom"?pNt:gNt})}function fNt(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:s,tickRotate:o=0,tickPadding:a=Math.max(3,9-s)+(Math.abs(o)>60?4*Math.cos(o*N2):0),text:l,textAnchor:c=Math.abs(o)>60?"middle":t==="left"?"end":"start",lineAnchor:u=o>60?"top":o<-60?"bottom":"middle",fontVariant:f,inset:h=0,insetLeft:d=h,insetRight:g=h,dx:y=0,ariaLabel:v,y:b=e==="y"?void 0:null,..._}){return am(HX,e,n,{ariaLabel:`${v} tick label`},{facetAnchor:r,frameAnchor:i,text:l,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:o,y:b,..._,dx:t==="left"?+y-s-a+ +d:+y+ +s+ +a-g},function(w,S,k,A,T){f===void 0&&(this.fontVariant=SK(w)),l===void 0&&(T.text=xK(w,S,k,A,t))})}function hNt(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:s,tickRotate:o=0,tickPadding:a=Math.max(3,9-s)+(Math.abs(o)>=10?4*Math.cos(o*N2):0),text:l,textAnchor:c=Math.abs(o)>=10?o<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(o)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:h=0,insetTop:d=h,insetBottom:g=h,dy:y=0,x:v=e==="x"?void 0:null,ariaLabel:b,..._}){return am(YX,e,n,{ariaLabel:`${b} tick label`},{facetAnchor:r,frameAnchor:i,text:l===void 0?null:l,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:o,x:v,..._,dy:t==="bottom"?+y+ +s+ +a-g:+y-s-a+ +d},function(w,S,k,A,T){f===void 0&&(this.fontVariant=SK(w)),l===void 0&&(T.text=xK(w,S,k,A,t))})}function pK(){const[e,t]=wh(...arguments);return vK("y",oK(t),e,t)}function gK(){const[e,t]=wh(...arguments);return vK("fy",aK(t),e,t)}function mK(){const[e,t]=wh(...arguments);return bK("x",lK(t),e,t)}function yK(){const[e,t]=wh(...arguments);return bK("fx",cK(t),e,t)}function vK(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:s=t==="left"?i:null,x2:o=t==="right"?i:null,ariaLabel:a=`${e}-grid`,ariaHidden:l=!0,...c}){return am(th,e,n,{ariaLabel:a,ariaHidden:l},{y:r,x1:s,x2:o,..._K(c)})}function bK(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:s=t==="top"?i:null,y2:o=t==="bottom"?i:null,ariaLabel:a=`${e}-grid`,ariaHidden:l=!0,...c}){return am(Qf,e,n,{ariaLabel:a,ariaHidden:l},{x:r,y1:s,y2:o,..._K(c)})}function _K({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...s}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...s}}function wK({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:s,fontWeight:o,monospace:a,pointerEvents:l,shapeRendering:c,clip:u=!1},f){return[,e]=Us(e),[,t]=li(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:s,fontWeight:o,monospace:a,pointerEvents:l,shapeRendering:c,clip:u,initializer:f}}function am(e,t,n,r,i,s){let o;function a(u,f,h,d,g,y){const v=u==null&&(t==="fx"||t==="fy"),{[t]:b}=d;if(!b)throw new Error(`missing scale: ${t}`);const _=b.domain();let{interval:w,ticks:S,tickFormat:k,tickSpacing:A=t==="x"?80:35}=i;if(typeof S=="string"&&kK(b)&&(w=S,S=void 0),S===void 0&&(S=rm(w,b.type)??dNt(b,A)),u==null){if(Hu(S))u=vh(S);else if(S0(S))u=nT(S,...yi(_));else if(b.interval){let M=b.interval;if(b.ticks){const[I,C]=yi(_),N=(C-I)/M[q1];M=$D(M,N/S)??M,u=nT(M,I,C)}else{u=_;const I=u.length;M=$D(M,I/S)??M,M!==b.interval&&(u=nT(M,...yi(u)))}if(M===b.interval){const I=Math.round(u.length/S);I>1&&(u=u.filter((C,N)=>N%I===0))}}else b.ticks?u=b.ticks(S):u=_;if(!b.ticks&&u.length&&u!==_){const M=new Gg(_);u=u.filter(I=>M.has(I)),u.length||Au(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[Yu(u)]:o[t]={scale:t,value:de}}s?.call(this,b,u,S,k,o);const T=Object.fromEntries(Object.entries(o).map(([M,I])=>[M,{...I,value:cn(u,I.value)}]));return v&&(f=y.filterFacets(u,T)),{data:u,facets:f,channels:T}}const l=gs(i).initializer,c=e(n,gs({...i,initializer:a},l));return n==null?(o=c.channels,c.channels={}):o={},r!==void 0&&Object.assign(c,r),c.clip===void 0&&(c.clip=!1),c}function dNt(e,t){const[n,r]=yi(e.range());return(r-n)/t}function xK(e,t,n,r,i){return{value:iC(e,t,n,r,i)}}function iC(e,t,n,r,i){return typeof r=="function"&&!(e.type==="log"&&e.tickFormat)?r:r===void 0&&t&&zs(t)?yRt(e.type,t,i)??Tg:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):typeof r=="string"&&e.domain().length>0?(zs(e.domain())?R1:Wa)(r):r===void 0?Tg:Vi(r)}function nT(e,t,n){return e.range(t,e.offset(e.floor(n)))}const pNt={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},gNt={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},mNt={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},yNt={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function SK(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function AK(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:s}={}){if(!(r==null||r.inferred&&kK(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),s==="auto"&&(s=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!s)return r;if(s===!0){const o=dX(t);o&&(s=/x$/.test(e)||i==="center"?/x$/.test(e)===o<0?"left":"right":o<0?"up":"down")}switch(s){case"left":return`← ${r}`;case"right":return`${r} →`;case"up":return n==="right"?`${r} ↑`:`↑ ${r}`;case"down":return n==="right"?`${r} ↓`:`↓ ${r}`}return r}}function EK(e="auto"){return $r(e)?!1:typeof e=="boolean"?e:Xo(e,"labelArrow",["auto","up","right","down","left"])}function kK(e){return zs(e.domain())}function lF(e,t){if(t==null)return t;const n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function vNt(e,{opacity:t,...n}={}){if(!mp(e)&&!vX(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return TK(e,n,(r,i,s,o)=>r.append("svg").attr("width",s).attr("height",o).attr("fill",i.scale).attr("fill-opacity",li(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function bNt(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:$r(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:s=1.5,r:o=4.5,...a}={},l){const[c,u]=Us(t),[f,h]=Us(r),d=lF(l,c),g=lF(l,f),y=o*o*Math.PI;return n=li(n)[1],i=li(i)[1],s=li(s)[1],TK(e,a,(v,b,_,w)=>v.append("svg").attr("viewBox","-8 -8 16 16").attr("width",_).attr("height",w).attr("fill",c==="color"?S=>d.scale(S):u).attr("fill-opacity",n).attr("stroke",f==="color"?S=>g.scale(S):h).attr("stroke-opacity",i).attr("stroke-width",s).append("path").attr("d",S=>{const k=pu();return e.scale(S).draw(k,y),k}))}function TK(e,t={},n){let{columns:r,tickFormat:i,fontVariant:s=RX(e),swatchSize:o=15,swatchWidth:a=o,swatchHeight:l=o,marginLeft:c=0,className:u,style:f,width:h}=t;const d=O3(t);u=XR(u),i=iC(e.scale,e.domain,void 0,i);const g=Sn("div",d).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`);let y;return r!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) { + display: flex; + align-items: center; + break-inside: avoid; + padding-bottom: 1px; +} +:where(.${u}-swatches-columns .${u}-swatch::before) { + flex-shrink: 0; +} +:where(.${u}-swatches-columns .${u}-swatch-label) { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +}`,g.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,l).call(v=>v.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) { + display: flex; + align-items: center; + min-height: 33px; + flex-wrap: wrap; +} +:where(.${u}-swatches-wrap .${u}-swatch) { + display: inline-flex; + align-items: center; + margin-right: 1em; +}`,g.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,e,a,l).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),g.call(v=>v.insert("style","*").text(`:where(.${u}-swatches) { + font-family: system-ui, sans-serif; + font-size: 10px; + margin-bottom: 0.5em; +} +:where(.${u}-swatch > svg) { + margin-right: 0.5em; + overflow: visible; +} +${y}`)).style("margin-left",c?`${+c}px`:null).style("width",h===void 0?null:`${+h}px`).style("font-variant",pi(s,"normal")).call(KR,f).node()}const $2=new Map([["symbol",bNt],["color",MK],["opacity",xNt]]);function _Nt(e={}){for(const[t,n]of $2){const r=e[t];if(_d(r)){const i=O3(e);let s;if(t==="symbol"){const{fill:o,stroke:a=o===void 0&&_d(e.color)?"color":void 0}=e;s={fill:o,stroke:a}}return n(BM(t,r,s),sC(i,r,e),o=>_d(e[o])?BM(o,e[o]):null)}}throw new Error("unknown legend type; no scale found")}function wNt(e,t,n={}){return(r,i)=>{if(!$2.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return $2.get(r)(e[r],sC(t,n[r],i),s=>e[s])}}function sC({className:e,...t},{label:n,ticks:r,tickFormat:i}={},s){return $Rt(s,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function MK(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return vNt(e,n);case"ramp":return z8t(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function xNt({type:e,interpolate:t,...n},{legend:r=!0,color:i=mo(0,0,0),...s}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return MK({type:e,...n,interpolate:SNt(i)},{legend:r,...s})}function SNt(e){const{r:t,g:n,b:r}=mo(e)||mo(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function ANt(e,t,n){const r=[];for(const[i,s]of $2){const o=n[i];if(o?.legend&&i in e){const a=s(e[i],sC(t,e[i],o),l=>e[l]);a!=null&&r.push(a)}}return r}function z3(e={},t="x"){return RG(e)?e:{...e,[t]:de}}function q3(e={},t="y"){return CG(e)?e:{...e,[t]:de}}function IK(e,t){if(t.length===1)return{data:e,facets:t};const n=zv(e),r=new Uint8Array(n);let i=0;for(const a of t)for(const l of a)r[l]&&++i,r[l]=1;if(i===0)return{data:e,facets:t};e=Uv(e);const s=e[AG]=new Uint32Array(n+i);t=t.map(a=>Uv(a,Uint32Array));let o=n;r.fill(0);for(const a of t)for(let l=0,c=a.length;l{({data:y,facets:v}=IK(y,v));const _=e==null?void 0:u(I2(cn(y,e),b?.[n])),w=cn(y,t,Float64Array),S=cn(y,l),k=s&&s(y,_,w,S),A=zv(y),T=h(new Float64Array(A)),M=g(new Float64Array(A)),I=[];for(const C of v){const N=_?Array.from(hh(C,L=>_[L]).values()):[C];if(k)for(const L of N)L.sort(k);for(const L of N){let F=0,$=0;o&&L.reverse();for(const D of L){const O=w[D];O<0?F=M[D]=(T[D]=F)+O:O>0?$=M[D]=(T[D]=$)+O:M[D]=T[D]=$}}I.push(N)}return i&&i(I,T,M,S),{data:y,facets:v}}),c,f,d]}function RNt(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return CNt;case"center":case"silhouette":return NNt;case"wiggle":return $K}throw new Error(`unknown offset: ${e}`)}}function NK(e,t){let n=0,r=0;for(const i of e){const s=t[i];sr&&(r=s)}return[n,r]}function CNt(e,t,n){for(const r of e)for(const i of r){const[s,o]=NK(i,n);for(const a of i){const l=1/(o-s||1);t[a]=l*(t[a]-s),n[a]=l*(n[a]-s)}}}function NNt(e,t,n){for(const r of e){for(const i of r){const[s,o]=NK(i,n);for(const a of i){const l=(o+s)/2;t[a]-=l,n[a]-=l}}OK(r,t,n)}LK(e,t,n)}function $K(e,t,n,r){for(const i of e){const s=new Ud;let o=0;for(const a of i){let l=-1;const c=a.map(d=>Math.abs(n[d]-t[d])),u=a.map(d=>{l=r?r[d]:++l;const g=n[d]-t[d],y=s.has(l)?g-s.get(l):0;return s.set(l,g),y}),f=[0,...Ext(u)];for(const d of a)t[d]+=o,n[d]+=o;const h=ml(c);h&&(o-=ml(c,(d,g)=>(u[g]/2+f[g])*d)/h)}OK(i,t,n)}LK(e,t,n)}function OK(e,t,n){const r=Or(e,i=>Or(i,s=>t[s]));for(const i of e)for(const s of i)t[s]-=r,n[s]-=r}function LK(e,t,n){const r=e.length;if(r===1)return;const i=e.map(a=>a.flat()),s=i.map(a=>(Or(a,l=>t[l])+Vr(a,l=>n[l]))/2),o=Or(s);for(let a=0;a(i,s)=>e(r[i],r[s])}function LNt(e){return(t,n,r,i)=>(s,o)=>e(i[s],i[o])}function DNt(e){return W3(e,(t,n,r,i)=>cI(Yu(t),s=>ml(s,o=>r[o]),s=>i[s]))}function FNt(e){return W3(e,(t,n,r,i)=>cI(Yu(t),s=>n[fI(s,o=>r[o])],s=>i[s]))}function cF(e){return W3(e,(t,n,r,i)=>{const s=Yu(t),o=cI(s,f=>n[fI(f,h=>r[h])],f=>i[f]),a=D0(s,f=>ml(f,h=>r[h]),f=>i[f]),l=[],c=[];let u=0;for(const f of o)u<0?(u+=a.get(f),l.push(f)):(u-=a.get(f),c.push(f));return c.reverse().concat(l)})}function uF(e){return t=>{const n=cn(t,e);return(r,i)=>Ua(n[r],n[i])}}function BNt(e){return t=>Wu(t)?(n,r)=>e(t[n],t[r]):(n,r)=>e(t.get(n),t.get(r))}function PNt(e){return W3(Ua,()=>e)}function W3(e,t){return(n,r,i,s)=>{if(!s)throw new Error("missing channel: z");const o=new Ud(t(n,r,i,s).map((a,l)=>[a,l]));return(a,l)=>e(o.get(s[a]),o.get(s[l]))}}const UNt={ariaLabel:"rect"};class Y3 extends yr{constructor(t,n={}){const{x1:r,y1:i,x2:s,y2:o}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&s==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&o==null?"band":void 0,optional:!0},x2:{value:s,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},n,UNt),oC(this,n),aC(this,n)}render(t,n,r,i,s){const{x:o,y:a}=n;let{x1:l,y1:c,x2:u,y2:f}=r;const{marginTop:h,marginRight:d,marginBottom:g,marginLeft:y,width:v,height:b}=i,{projection:_}=s,{insetTop:w,insetRight:S,insetBottom:k,insetLeft:A}=this,{rx:T,ry:M,rx1y1:I,rx1y2:C,rx2y1:N,rx2y2:L}=this;(l||u)&&!_&&xc(o)&&(l=u=null),(c||f)&&!_&&xc(a)&&(c=f=null);const F=o?.bandwidth?o.bandwidth():0,$=a?.bandwidth?a.bandwidth():0;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{},0,0).call(D=>D.selectAll().data(t).enter().call(I||C||N||L?O=>O.append("path").call(cr,this).call(lC,l&&u?B=>l[B]+(u[B]l[B]+A:y+A,c&&f?B=>c[B]+(f[B]c[B]+w:h+w,l&&u?B=>u[B]-(u[B]l[B]+F-S:v-d-S,c&&f?B=>f[B]-(f[B]c[B]+$-k:b-g-k,this).call(Wr,this,r):O=>O.append("rect").call(cr,this).attr("x",l?u?B=>Math.min(l[B],u[B])+A:B=>l[B]+A:y+A).attr("y",c?f?B=>Math.min(c[B],f[B])+w:B=>c[B]+w:h+w).attr("width",l?u?B=>Math.max(0,Math.abs(u[B]-l[B])+F-A-S):F-A-S:v-d-y-S-A).attr("height",c?f?B=>Math.max(0,Math.abs(c[B]-f[B])+$-w-k):$-w-k:b-h-g-w-k).call(me,"rx",T).call(me,"ry",M).call(Wr,this,r))).node()}}function oC(e,{inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:s=t}={}){e.insetTop=kr(n),e.insetRight=kr(r),e.insetBottom=kr(i),e.insetLeft=kr(s)}function aC(e,{r:t,rx:n,ry:r,rx1:i=t,ry1:s=t,rx2:o=t,ry2:a=t,rx1y1:l=i!==void 0?+i:s!==void 0?+s:0,rx1y2:c=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=o!==void 0?+o:s!==void 0?+s:0,rx2y2:f=o!==void 0?+o:a!==void 0?+a:0}={}){l||c||u||f?(e.rx1y1=l,e.rx1y2=c,e.rx2y1=u,e.rx2y2=f):(e.rx=pi(n,"auto"),e.ry=pi(r,"auto"))}function lC(e,t,n,r,i,s){const{rx1y1:o,rx1y2:a,rx2y1:l,rx2y2:c}=s;typeof t!="function"&&(t=Vi(t)),typeof n!="function"&&(n=Vi(n)),typeof r!="function"&&(r=Vi(r)),typeof i!="function"&&(i=Vi(i));const u=Math.max(Math.abs(o+l),Math.abs(a+c)),f=Math.max(Math.abs(o+a),Math.abs(l+c));e.attr("d",h=>{const d=t(h),g=n(h),y=r(h),v=i(h),b=d>y,_=g>v,w=b?y:d,S=b?d:y,k=_?v:g,A=_?g:v,T=Math.min(1,(S-w)/u,(A-k)/f),M=T*(b?_?c:l:_?a:o),I=T*(b?_?a:o:_?c:l),C=T*(b?_?o:a:_?l:c),N=T*(b?_?l:c:_?o:a);return`M${w},${k+N_(M,N)}A${M},${M} 0 0 ${M<0?0:1} ${w+C_(M,N)},${k}H${S-C_(I,C)}A${I},${I} 0 0 ${I<0?0:1} ${S},${k+N_(I,C)}V${A-N_(C,I)}A${C},${C} 0 0 ${C<0?0:1} ${S-C_(C,I)},${A}H${w+C_(N,M)}A${N},${N} 0 0 ${N<0?0:1} ${w},${A-N_(N,M)}Z`})}function C_(e,t){return t<0?e:Math.abs(e)}function N_(e,t){return t<0?Math.abs(e):e}function cC(e,t){return new Y3(e,DX(FX(t)))}function O2(e,t={}){return nm(t)||(t={...t,y:vi,x2:de,interval:1}),new Y3(e,j3(FX(z3(t))))}function L2(e,t={}){return nm(t)||(t={...t,x:vi,y2:de,interval:1}),new Y3(e,V3(DX(q3(t))))}const zNt={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},qNt={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class DK extends yr{constructor(t={}){const{anchor:n=null}=t;super(Wy,void 0,t,n==null?zNt:qNt),this.anchor=MG(n,"anchor",["top","right","bottom","left"]),oC(this,t),n||aC(this,t)}render(t,n,r,i,s){const{marginTop:o,marginRight:a,marginBottom:l,marginLeft:c,width:u,height:f}=i,{anchor:h,insetTop:d,insetRight:g,insetBottom:y,insetLeft:v}=this,{rx:b,ry:_,rx1y1:w,rx1y2:S,rx2y1:k,rx2y2:A}=this,T=c+v,M=u-a-g,I=o+d,C=f-l-y;return Sn(h?"svg:line":w||S||k||A?"svg:path":"svg:rect",s).datum(0).call(Mr,this,i,s).call(cr,this).call(Wr,this,r).call(mr,this,{}).call(h==="left"?N=>N.attr("x1",T).attr("x2",T).attr("y1",I).attr("y2",C):h==="right"?N=>N.attr("x1",M).attr("x2",M).attr("y1",I).attr("y2",C):h==="top"?N=>N.attr("x1",T).attr("x2",M).attr("y1",I).attr("y2",I):h==="bottom"?N=>N.attr("x1",T).attr("x2",M).attr("y1",C).attr("y2",C):w||S||k||A?N=>N.call(lC,T,I,M,C,this):N=>N.attr("x",T).attr("y",I).attr("width",M-T).attr("height",C-I).attr("rx",b).attr("ry",_)).node()}}function uC(e){return new DK(e)}const rT={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},jNt=new Set(["geometry","href","src","ariaLabel","scales"]);class FK extends yr{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&Hu(t)&&DG(t)&&(n={...n,title:de});const{x:r,y:i,x1:s,x2:o,y1:a,y2:l,anchor:c,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:g,fontVariant:y,fontWeight:v,lineHeight:b=1,lineWidth:_=20,frameAnchor:w,format:S,textAnchor:k="start",textOverflow:A,textPadding:T=8,title:M,pointerSize:I=12,pathFilter:C="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:s!=null&&o!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&l!=null?null:i,scale:"y",optional:!0},x1:{value:s,scale:"x",optional:o==null},y1:{value:a,scale:"y",optional:l==null},x2:{value:o,scale:"x",optional:s==null},y2:{value:l,scale:"y",optional:a==null},title:{value:M,optional:!0}},n,rT),this.anchor=NM(c,"anchor"),this.preferredAnchor=NM(u,"preferredAnchor"),this.frameAnchor=V1(w),this.textAnchor=pi(k,"middle"),this.textPadding=+T,this.pointerSize=+I,this.pathFilter=ji(C),this.lineHeight=+b,this.lineWidth=+_,this.textOverflow=WX(A),this.monospace=!!f,this.fontFamily=ji(h),this.fontSize=kr(d),this.fontStyle=ji(g),this.fontVariant=ji(y),this.fontWeight=ji(v);for(const N in rT)N in this.channels&&(this[N]=rT[N]);this.splitLines=XX(this),this.clipLine=KX(this),this.format=typeof S=="string"||typeof S=="function"?{title:S}:{...S}}render(t,n,r,i,s){const o=this,{x:a,y:l,fx:c,fy:u}=n,{ownerSVGElement:f,document:h}=s,{anchor:d,monospace:g,lineHeight:y,lineWidth:v}=this,{textPadding:b,pointerSize:_,pathFilter:w}=this,{marginTop:S,marginLeft:k}=i,{x1:A,y1:T,x2:M,y2:I,x:C=A??M,y:N=T??I}=r,L=c?c(t.fx)-k:0,F=u?u(t.fy)-S:0,[$,D]=Nc(this,i),O=MX(r,$),B=IX(r,D),V=g?eC:tC,U=V(W0);let z,q;"title"in r?(z=fF.call(this,{title:r.channels.title},n),q=HNt):(z=fF.call(this,r.channels,n),q=GNt);const Y=Sn("svg:g",s).call(Mr,this,i,s).call(GX,this).call(mr,this,{x:C&&a,y:N&&l}).call(gt=>gt.selectAll().data(t).enter().append("g").attr("transform",pt=>`translate(${Math.round(O(pt))},${Math.round(B(pt))})`).call(cr,this).call(pt=>pt.append("path").attr("filter",w)).call(pt=>pt.append("text").each(function(lt){const vt=Ar(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");const st=q.call(o,lt,t,z,n,r);if(typeof st=="string")for(const Z of o.splitLines(st))Q(vt,{value:o.clipLine(Z)});else{const Z=new Set;for(const mt of st){const{label:at=""}=mt;at&&Z.has(at)||(Z.add(at),Q(vt,mt))}}})));function Q(gt,{label:pt,value:lt,color:vt,opacity:st}){pt??="",lt??="";const Z=vt!=null||st!=null;let mt,at=v*100;const[Ct]=Ig(pt,at,V,U);if(Ct>=0)pt=pt.slice(0,Ct).trimEnd()+W0,mt=lt.trim(),lt="";else{(pt||!lt&&!Z)&&(lt=" "+lt);const[Bt]=Ig(lt,at-V(pt),V,U);Bt>=0&&(mt=lt.trim(),lt=lt.slice(0,Bt).trimEnd()+W0)}const wt=gt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("​");pt&&wt.append("tspan").attr("font-weight","bold").text(pt),lt&&wt.append(()=>h.createTextNode(lt)),Z&&wt.append("tspan").text(" ■").attr("fill",vt).attr("fill-opacity",st).style("user-select","none"),mt&&wt.append("title").text(mt)}function ft(){const{width:gt,height:pt}=i.facet??i;Y.selectChildren().each(function(lt){let{x:vt,width:st,height:Z}=this.getBBox();st=Math.round(st),Z=Math.round(Z);let mt=d;if(mt===void 0){const wt=O(lt)+L,Bt=B(lt)+F,Pt=wt+st+_+b*20,qt=Bt+Z+_+b*20;mt=Pt&&kt?qt&&Re?o.preferredAnchor:Re?"bottom":"top":qt&&Re?Pt?"left":"right":(Pt||kt)&&(qt||Re)?`${Re?"bottom":"top"}-${Pt?"left":"right"}`:o.preferredAnchor}const at=this.firstChild,Ct=this.lastChild;if(at.setAttribute("d",YNt(mt,_,b,st,Z)),vt)for(const wt of Ct.childNodes)wt.setAttribute("x",-vt);Ct.setAttribute("y",`${+VNt(mt,Ct.childNodes.length,y).toFixed(6)}em`),Ct.setAttribute("transform",`translate(${WNt(mt,_,b,st,Z)})`)}),Y.attr("visibility",null)}return t.length&&(Y.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(ft):typeof requestAnimationFrame<"u"&&requestAnimationFrame(ft)),Y.node()}}function BK(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Il(t,n)),new FK(e,{...r,x:t,y:n})}function VNt(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function WNt(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function YNt(e,t,n,r,i){const s=r+n*2,o=i+n*2;switch(e){case"middle":return`M${-s/2},${-o/2}h${s}v${o}h${-s}z`;case"top-left":return`M0,0l${t},${t}h${s-t}v${o}h${-s}z`;case"top":return`M0,0l${t/2},${t/2}h${(s-t)/2}v${o}h${-s}v${-o}h${(s-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-s}v${o}h${s}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-o/2}h${-s}v${o}h${s}v${t/2-o/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${s-t}v${-o}h${-s}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(s-t)/2}v${-o}h${-s}v${o}h${(s-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-s}v${-o}h${s}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-o/2}h${s}v${o}h${-s}v${t/2-o/2}z`}}function fF(e,t){const n={};let r=this.format;r=hF(r,e,"x"),r=hF(r,e,"y"),this.format=r;for(const i in r){const s=r[i];if(!(s===null||s===!1))if(i==="fx"||i==="fy")n[i]=!0;else{const o=OM(e,i);o&&(n[i]=o)}}for(const i in e){if(i in n||i in r||jNt.has(i)||(i==="x"||i==="y")&&e.geometry)continue;const s=OM(e,i);if(s){if(s.scale==null&&s.defaultScale==="color")continue;n[i]=s}}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(const i in n){const s=this.format[i];if(typeof s=="string"){const o=n[i]?.value??t[i]?.domain()??[];this.format[i]=(zs(o)?R1:Wa)(s)}else if(s===void 0||s===!0){const o=t[i];this.format[i]=o?.bandwidth?iC(o,o.domain()):Tg}}return n}function hF(e,t,n){if(!(n in e))return e;const r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;const s=Object.entries(e),o=e[n];return s.splice(s.findIndex(([a])=>a===n)+1,0,[r,o],[i,o]),Object.fromEntries(s)}function HNt(e,t,{title:n}){return this.format.title(n.value[e],e)}function*GNt(e,t,n,r,i){for(const s in n){if(s==="fx"||s==="fy"){yield{label:D2(r,n,s),value:this.format[s](t[s],e)};continue}if(s==="x1"&&"x2"in n||s==="y1"&&"y2"in n)continue;const o=n[s];if(s==="x2"&&"x1"in n)yield{label:pF(r,n,"x"),value:dF(this.format.x2,n.x1,o,e)};else if(s==="y2"&&"y1"in n)yield{label:pF(r,n,"y"),value:dF(this.format.y2,n.y1,o,e)};else{const a=o.value[e],l=o.scale;if(!Yi(a)&&l==null)continue;yield{label:D2(r,n,s),value:this.format[s](a,e),color:l==="color"?i[s][e]:null,opacity:l==="opacity"?i[s][e]:null}}}}function dF(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}–${e(n.value[r],r)}`}function pF(e,t,n){const r=D2(e,t,`${n}1`,n),i=D2(e,t,`${n}2`,n);return r===i?r:`${r}–${i}`}function D2(e,t,n,r=n){const i=t[n],s=e[i?.scale??n];return String(s?.label??i?.label??r)}function fC(e={}){const{facet:t,style:n,title:r,subtitle:i,caption:s,ariaLabel:o,ariaDescription:a}=e,l=XR(e.className),c=e.marks===void 0?[]:mF(e.marks);c.push(...e7t(c));const u=QNt(t,e),f=new Map;for(const U of c){const z=yF(U,u,e);z&&f.set(U,z)}const h=new Map;u&&Qm(h,[u],e),Qm(h,f,e);const d=mF(n7t(c,h,e));for(const U of d){const z=yF(U,u,e);z&&f.set(U,z)}c.unshift(...d);let g=XCt(h,e);if(g!==void 0){const U=u?Zk(g,u):void 0;for(const q of c){if(q.facet===null||q.facet==="super")continue;const Y=f.get(q);Y!==void 0&&(Y.facetsIndex=q.fx!=null||q.fy!=null?Zk(g,Y):U)}const z=new Set;for(const{facetsIndex:q}of f.values())q?.forEach((Y,Q)=>{Y?.length>0&&z.add(Q)});g.forEach(0q.empty=!z.has(Y):q=>q.empty=!1);for(const q of c)if(q.facet==="exclude"){const Y=f.get(q);Y!==void 0&&(Y.facetsIndex=ZCt(Y.facetsIndex))}}for(const U of qr.keys())_d(e[U])&&U!=="fx"&&U!=="fy"&&h.set(U,[]);const y=new Map;for(const U of c){if(y.has(U))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:z,channels:q}=f.get(U)??{},{data:Y,facets:Q,channels:ft}=U.initialize(z,q,e);hC(ft,e),y.set(U,{data:Y,facets:Q,channels:ft})}const v=FM(Qm(h,y,e),e),b=P8t(v,c,e);qCt(v,b);const _=HD(v),{fx:w,fy:S}=_,k=w||S?pX(v,b):b,A=w||S?c7t(_,b):b,T=O3(e),M=T.document,I=f3("svg").call(M.documentElement);let C=I;T.ownerSVGElement=I,T.className=l,T.projection=a8t(e,k),T.path=function(){return P1(this.projection??d8t(_))},T.filterFacets=(U,z)=>Zk(g,{channels:z,groups:YR(U,z)}),T.getMarkState=U=>{const z=y.get(U),q=f.get(U);return{...z,channels:{...z.channels,...q?.channels}}},T.dispatchValue=U=>{C.value!==U&&(C.value=U,C.dispatchEvent(new T.document.defaultView.Event("input",{bubbles:!0})))};const N=new Set;for(const[U,z]of y)if(U.initializer!=null){const q=U.facet==="super"?A:k,Y=U.initializer(z.data,z.facets,z.channels,_,q,T);if(Y.data!==void 0&&(z.data=Y.data),Y.facets!==void 0&&(z.facets=Y.facets),Y.channels!==void 0){const{fx:Q,fy:ft,...gt}=Y.channels;ZNt(gt),Object.assign(z.channels,gt);for(const pt of Object.values(gt)){const{scale:lt}=pt;lt!=null&&!DRt(qr.get(lt))&&(PK(pt,e),N.add(lt))}(Q!=null||ft!=null)&&f.set(U,!0)}}if(N.size){const U=new Map;Qm(U,y,e,Q=>N.has(Q)),Qm(h,y,e,Q=>N.has(Q));const z=l7t(FM(U,e),v),{scales:q,...Y}=HD(z);Object.assign(v,z),Object.assign(_,Y),Object.assign(_.scales,q)}let L,F;g!==void 0&&(L={x:w?.domain(),y:S?.domain()},g=KCt(g,L),F=JCt(w,S,b));for(const[U,z]of y)z.values=U.scale(z.channels,_,T);const{width:$,height:D}=b;Ar(I).attr("class",l).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",$).attr("height",D).attr("viewBox",`0 0 ${$} ${D}`).attr("aria-label",o).attr("aria-description",a).call(U=>U.append("style").text(`:where(.${l}) { + --plot-background: white; + display: block; + height: auto; + height: intrinsic; + max-width: 100%; +} +:where(.${l} text), +:where(.${l} tspan) { + white-space: pre; +}`)).call(KR,n);for(const U of c){const{channels:z,values:q,facets:Y}=y.get(U);if(g===void 0||U.facet==="super"){let Q=null;if(Y&&(Q=Y[0],Q=U.filter(Q,z,q),Q.length===0))continue;const ft=U.render(Q,_,q,A,T);if(ft==null)continue;I.appendChild(ft)}else{let Q;for(const ft of g){if(!(U.facetAnchor?.(g,L,ft)??!ft.empty))continue;let gt=null;if(Y){const lt=f.has(U);if(gt=Y[lt?ft.i:0],gt=U.filter(gt,z,q),gt.length===0)continue;!lt&>===Y[0]&&(gt=wd(gt)),gt.fx=ft.x,gt.fy=ft.y,gt.fi=ft.i}const pt=U.render(gt,_,q,k,T);if(pt!=null){(Q??=Ar(I).append("g")).append(()=>pt).datum(ft);for(const lt of["aria-label","aria-description","aria-hidden","transform"])pt.hasAttribute(lt)&&(Q.attr(lt,pt.getAttribute(lt)),pt.removeAttribute(lt))}}Q?.selectChildren().each(F)}}const O=ANt(v,T,e),{figure:B=r!=null||i!=null||s!=null||O.length>0}=e;B&&(C=M.createElement("figure"),C.className=`${l}-figure`,C.style.maxWidth="initial",r!=null&&C.append(gF(M,r,"h2")),i!=null&&C.append(gF(M,i,"h3")),C.append(...O,I),s!=null&&C.append(XNt(M,s)),"value"in I&&(C.value=I.value,delete I.value)),C.scale=GCt(_.scales),C.legend=wNt(v,T,e);const V=ECt();return V>0&&Ar(I).append("text").attr("x",$).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${V.toLocaleString("en-US")} warning${V===1?"":"s"}. Please check the console.`),C}function gF(e,t,n){if(t.ownerDocument)return t;const r=e.createElement(n);return r.append(t),r}function XNt(e,t){const n=e.createElement("figcaption");return n.append(t),n}function mF(e){return e.flat(1/0).filter(t=>t!=null).map(KNt)}function KNt(e){return typeof e.render=="function"?e:new JNt(e)}class JNt extends yr{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}}function hC(e,t){for(const n in e)PK(e[n],t);return e}function PK(e,t){const{scale:n,transform:r=!0}=e;if(n==null||!r)return;const{type:i,percent:s,interval:o,transform:a=s?l=>l==null?NaN:l*100:OG(o,i)}=t[n]??{};a!=null&&(e.value=pr(e.value,a),e.transform=!1)}function ZNt(e){for(const t in e)QG(t,e[t])}function Qm(e,t,n,r=xRt){for(const{channels:i}of t.values())for(const s in i){const o=i[s],{scale:a}=o;if(a!=null&&r(a))if(a==="projection"){if(!u8t(n)){const l=n.x?.domain===void 0,c=n.y?.domain===void 0;if(l||c){const[u,f]=h8t(o);l&&iT(e,"x",u),c&&iT(e,"y",f)}}}else iT(e,a,o)}return e}function iT(e,t,n){const r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function QNt(e,t){if(e==null)return;const{x:n,y:r}=e;if(n==null&&r==null)return;const i=Ag(e.data);if(i==null)throw new Error("missing facet data");const s={};n!=null&&(s.fx=Vv(i,{value:n,scale:"fx"})),r!=null&&(s.fy=Vv(i,{value:r,scale:"fy"})),hC(s,t);const o=YR(i,s);return{channels:s,groups:o,data:e.data}}function yF(e,t,n){if(e.facet===null||e.facet==="super")return;const{fx:r,fy:i}=e;if(r!=null||i!=null){const l=Ag(e.data??r??i);if(l===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(l===null)return;const c={};return r!=null&&(c.fx=Vv(l,{value:r,scale:"fx"})),i!=null&&(c.fy=Vv(l,{value:i,scale:"fy"})),hC(c,n),{channels:c,groups:YR(l,c)}}if(t===void 0)return;const{channels:s,groups:o,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:s,groups:o};a.length>0&&(o.size>1||o.size===1&&s.fx&&s.fy&&[...o][0][1].size>1)&&zv(Ag(e.data))===zv(a)&&Au(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function t7t(e,t={}){return gs({...t,x:null,y:null},(n,r,i,s,o,a)=>a.getMarkState(e))}function e7t(e){const t=[];for(const n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:s}=r;i=/^x$/i.test(i)?D3:/^y$/i.test(i)?Gv:L3,r=i(t7t(n,r)),r.title=null,s===void 0&&(r.preferredAnchor=i===Gv?"left":"bottom");const o=BK(n.data,r);o.facet=n.facet,o.facetAnchor=n.facetAnchor,t.push(o)}}return t}function n7t(e,t,n){let{projection:r,x:i={},y:s={},fx:o={},fy:a={},axis:l,grid:c,facet:u={},facet:{axis:f=l,grid:h}=u,x:{axis:d=l,grid:g=d===null?null:c}=i,y:{axis:y=l,grid:v=y===null?null:c}=s,fx:{axis:b=f,grid:_=b===null?null:h}=o,fy:{axis:w=f,grid:S=w===null?null:h}=a}=n;(r||!_d(i)&&!vF("x",e))&&(d=g=null),(r||!_d(s)&&!vF("y",e))&&(y=v=null),t.has("fx")||(b=_=null),t.has("fy")||(w=S=null),d===void 0&&(d=!L_(e,"x")),y===void 0&&(y=!L_(e,"y")),b===void 0&&(b=!L_(e,"fx")),w===void 0&&(w=!L_(e,"fy")),d===!0&&(d="bottom"),y===!0&&(y="left"),b===!0&&(b=d==="top"||d===null?"bottom":"top"),w===!0&&(w=y==="right"||y===null?"left":"right");const k=[];return O_(k,S,gK,a),$_(k,w,uK,"right","left",u,a),O_(k,_,yK,o),$_(k,b,fK,"top","bottom",u,o),O_(k,v,pK,s),$_(k,y,nC,"left","right",n,s),O_(k,g,mK,i),$_(k,d,rC,"bottom","top",n,i),k}function $_(e,t,n,r,i,s,o){if(!t)return;const a=r7t(t);o=i7t(a?r:t,s,o);const{line:l}=o;(n===nC||n===rC)&&l&&!Eg(l)&&e.push(uC(s7t(o))),e.push(n(o)),a&&e.push(n({...o,anchor:i,label:null}))}function O_(e,t,n,r){!t||Eg(t)||e.push(n(o7t(t,r)))}function r7t(e){return/^\s*both\s*$/i.test(e)}function i7t(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:s,tickPadding:o,tickFormat:a,tickRotate:l,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h=t.label,labelAnchor:d,labelArrow:g=t.labelArrow,labelOffset:y}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:s,tickPadding:o,tickFormat:a,tickRotate:l,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h,labelAnchor:d,labelArrow:g,labelOffset:y}}function s7t(e){const{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function o7t(e,{stroke:t=j1(e)?e:void 0,ticks:n=a7t(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:s}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:s}}function a7t(e){switch(typeof e){case"number":return!0;case"string":return!j1(e)}return Hu(e)||typeof e?.range=="function"}function L_(e,t){const n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function vF(e,t){for(const n of t)for(const r in n.channels){const{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function l7t(e,t){for(const n in e){const r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function c7t({fx:e,fy:t},n){const{marginTop:r,marginRight:i,marginBottom:s,marginLeft:o,width:a,height:l}=WR(n),c=e&&bF(e),u=t&&bF(t);return{marginTop:t?u[0]:r,marginRight:e?a-c[1]:i,marginBottom:t?l-u[1]:s,marginLeft:e?c[0]:o,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:l}}function bF(e){const t=e.domain();if(t.length===0)return[0,e.bandwidth()];let n=e(t[0]),r=e(t[t.length-1]);return r{const mt=I2(cn(vt,_),Z?.[w]),at=cn(vt,M),Ct=cn(vt,Y),wt=cn(vt,Q),Bt=PR(l,{z:at,fill:Ct,stroke:wt}),Pt=[],kt=[],qt=mt&&k([]),Re=at&&q([]),Ht=Ct&>([]),le=wt&<([]),Ke=e&&f([]),ce=e&&d([]),bn=t&&y([]),Je=t&&b([]),wr=g7t(e,t,vt);let or=0;for(const Ge of l)Ge.initialize(vt);o&&o.initialize(vt),s&&s.initialize(vt);for(const Ge of st){const un=[];for(const Ln of l)Ln.scope("facet",Ge);o&&o.scope("facet",Ge),s&&s.scope("facet",Ge);for(const[Ln,Hi]of xd(Ge,Bt))for(const[Gi,wo]of xd(Hi,mt))for(const[fi,ni]of wr(wo))if(Bt&&(ni.z=Ln),!(s&&!s.reduce(fi,ni))){un.push(or++),kt.push(i.reduceIndex(fi,vt,ni)),mt&&qt.push(Gi),at&&Re.push(Bt===at?Ln:at[(fi.length>0?fi:wo)[0]]),Ct&&Ht.push(Bt===Ct?Ln:Ct[(fi.length>0?fi:wo)[0]]),wt&&le.push(Bt===wt?Ln:wt[(fi.length>0?fi:wo)[0]]),Ke&&(Ke.push(ni.x1),ce.push(ni.x2)),bn&&(bn.push(ni.y1),Je.push(ni.y2));for(const Nl of l)Nl.reduce(fi,ni);o&&o.reduce(fi,ni)}Pt.push(un)}return KG(Pt,o,a),{data:kt,facets:Pt}}),...!Rf(l,"x")&&(u?{x1:u,x2:h,x:M2(u,h)}:{x:A,x1:N,x2:L}),...!Rf(l,"y")&&(g?{y1:g,y2:v,y:M2(g,v)}:{y:T,y1:F,y2:$}),...S&&{[w]:S},...Object.fromEntries(l.map(({name:vt,output:st})=>[vt,st]))}}function yC({cumulative:e,domain:t,thresholds:n,interval:r,...i},s){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...s}]}function F2(e,{cumulative:t,domain:n,thresholds:r,interval:i},s){return e={...im(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=s),e.thresholds=qK(e.thresholds,e.interval),e}function f7t(e){let{x:t,y:n}=e;return t=F2(t,e),n=F2(n,e),[t.value,n.value]=Il(t.value,n.value),{x:t,y:n}}function _F(e){if(e==null)return;const{value:t,cumulative:n,domain:r=yi,thresholds:i}=e,s=o=>{let a=cn(o,t),l;if(zs(a)||p7t(i)){a=pr(a,TG,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!S0(i)?i(a,u,f):i;typeof h=="number"&&(h=rV(u,f,h)),S0(h)&&(r===yi&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),l=h}else{a=co(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!S0(i)?i(a,u,f):i;if(typeof h=="number")if(r===yi){let d=wv(u,f,h);if(isFinite(d))if(d>0){let g=Math.round(u/d),y=Math.round(f/d);g*d<=u||--g,y*d>f||++y;let v=y-g+1;h=new Float64Array(v);for(let b=0;bf||++y;let v=y-g+1;h=new Float64Array(v);for(let b=0;b0?m7t:vC)(c,l,a),c};return s.label=Cc(t),s}function qK(e,t,n=wF){if(e===void 0)return t===void 0?n:rm(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Oxt;case"scott":return vj;case"sturges":return uI;case"auto":return wF}return w3(e)}return e}function h7t(e,t){return WG(e,t,jK)}function jK(e,t,n){return FR(e,t,n,VK)}function VK(e,t,n){return BR(e,t,n,WK)}function WK(e,t){return I3(e,t,d7t)}function d7t(e){switch(`${e}`.toLowerCase()){case"x":return v7t;case"x1":return _7t;case"x2":return w7t;case"y":return b7t;case"y1":return x7t;case"y2":return S7t;case"z":return JG}throw new Error(`invalid bin reduce: ${e}`)}function wF(e,t,n){return Math.min(200,vj(e,t,n))}function p7t(e){return ERt(e)||Hu(e)&&zs(e)}function g7t(e,t,n){const r=e?.(n),i=t?.(n);return r&&i?function*(s){const o=r.bin(s);for(const[a,[l,c]]of r.entries()){const u=i.bin(o[a]);for(const[f,[h,d]]of i.entries())yield[u[f],{data:n,x1:l,y1:h,x2:c,y2:d}]}}:r?function*(s){const o=r.bin(s);for(const[a,[l,c]]of r.entries())yield[o[a],{data:n,x1:l,x2:c}]}:function*(s){const o=i.bin(s);for(const[a,[l,c]]of i.entries())yield[o[a],{data:n,y1:l,y2:c}]}}function vC(e,t,n){return t=co(t),r=>{const i=e.map(()=>[]);for(const s of r)i[jS(t,n[s])-1]?.push(s);return i}}function m7t(e,t,n){const r=vC(e,t,n);return i=>{const s=r(i);for(let o=1,a=s.length;o{const s=r(i);for(let o=s.length-2;o>=0;--o){const a=s[o+1],l=s[o];for(const c of a)l.push(c)}return s}}function YK(e,t){const n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}const v7t={reduceIndex(e,t,{x1:n,x2:r}){return YK(n,r)}},b7t={reduceIndex(e,t,{y1:n,y2:r}){return YK(n,r)}},_7t={reduceIndex(e,t,{x1:n}){return n}},w7t={reduceIndex(e,t,{x2:n}){return n}},x7t={reduceIndex(e,t,{y1:n}){return n}},S7t={reduceIndex(e,t,{y2:n}){return n}},A7t={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class H3 extends yr{constructor(t,n={}){const{x1:r,y1:i,x2:s,y2:o,z:a,curve:l,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:s,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0},z:{value:bh(n),optional:!0}},n,A7t),this.z=a,this.curve=dC(l,c)}filter(t){return t}render(t,n,r,i,s){const{x1:o,y1:a,x2:l=o,y2:c=a}=r;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n,0,0).call(u=>u.selectAll().data(kX(t,[o,a,l,c],this,r)).enter().append("path").call(cr,this).call(C2,this,r).attr("d",dR().curve(this.curve).defined(f=>f>=0).x0(f=>o[f]).y0(f=>a[f]).x1(f=>l[f]).y1(f=>c[f]))).node()}}function VM(e,t){return t===void 0?Cg(e,{x:S3,y:Pv}):new H3(e,t)}function Xv(e,t){const{y:n=vi,...r}=gC(t);return new H3(e,j3(z3({...r,y1:n,y2:void 0},n===vi?"x2":"x")))}function Cg(e,t){const{x:n=vi,...r}=pC(t);return new H3(e,V3(q3({...r,x1:n,x2:void 0},n===vi?"y2":"y")))}const E7t={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class HK extends yr{constructor(t,n={}){const{x1:r,y1:i,x2:s,y2:o,curve:a,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:s,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},n,E7t),this.curve=UK(a,l),sm(this,n)}project(t,n,r){this.curve!==Rg&&super.project(t,n,r)}render(t,n,r,i,s){const{x1:o,y1:a,x2:l=o,y2:c=a}=r,{curve:u}=this;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(cr,this).attr("d",u===Rg&&s.projection?k7t(s.path(),o,a,l,c):h=>{const d=pu(),g=u(d);return g.lineStart(),g.point(o[h],a[h]),g.point(l[h],c[h]),g.lineEnd(),d}).call(Wr,this,r).call(J1,this,r,s)).node()}}function k7t(e,t,n,r,i){return t=co(t),n=co(n),r=co(r),i=co(i),s=>e({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function GK(e,{x:t,x1:n,x2:r,y:i,y1:s,y2:o,...a}={}){return[n,r]=B2(t,n,r),[s,o]=B2(i,s,o),new HK(e,{...a,x1:n,x2:r,y1:s,y2:o})}function B2(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}const T7t={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class XK extends yr{constructor(t,n={}){const{x1:r,y1:i,x2:s,y2:o,bend:a=0,headAngle:l=60,headLength:c=8,inset:u=0,insetStart:f=u,insetEnd:h=u,sweep:d}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:s,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},n,T7t),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+l,this.headLength=+c,this.insetStart=+f,this.insetEnd=+h,this.sweep=M7t(d)}render(t,n,r,i,s){const{x1:o,y1:a,x2:l=o,y2:c=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:d,headLength:g,insetStart:y,insetEnd:v}=this,b=u?S=>u[S]:Vi(f===void 0?1:f),_=d*N2/2,w=g/1.5;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(S=>S.selectAll().data(t).enter().append("path").call(cr,this).attr("d",k=>{let A=o[k],T=a[k],M=l[k],I=c[k];const C=Math.hypot(M-A,I-T);if(C<=y+v)return null;let N=Math.atan2(I-T,M-A);const L=Math.min(w*b(k),C/3),F=this.sweep(A,T,M,I)*h*N2,$=Math.hypot(C/Math.tan(F),C)/2;if(y||v)if($<1e5){const ft=Math.sign(F),[gt,pt]=I7t([A,T],[M,I],$,ft);if(y&&([A,T]=xF([gt,pt,$],[A,T,y],-ft*Math.sign(y))),v){const[lt,vt]=xF([gt,pt,$],[M,I,v],ft*Math.sign(v));N+=Math.atan2(vt-pt,lt-gt)-Math.atan2(I-pt,M-gt),M=lt,I=vt}}else{const ft=M-A,gt=I-T,pt=Math.hypot(ft,gt);y&&(A+=ft/pt*y,T+=gt/pt*y),v&&(M-=ft/pt*v,I-=gt/pt*v)}const D=N+F,O=D+_,B=D-_,V=M-L*Math.cos(O),U=I-L*Math.sin(O),z=M-L*Math.cos(B),q=I-L*Math.sin(B),Y=$<1e5?`A${$},${$} 0,0,${F>0?1:0} `:"L",Q=L?`M${V},${U}L${M},${I}L${z},${q}`:"";return`M${A},${T}${Y}${M},${I}${Q}`}).call(Wr,this,r)).node()}}function M7t(e=1){if(typeof e=="number")return Vi(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Xo(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Hn(t,r);case"-x":return(t,n,r)=>Pd(t,r);case"+y":return(t,n,r,i)=>Hn(n,i);case"-y":return(t,n,r,i)=>Pd(n,i)}}function I7t([e,t],[n,r],i,s){const o=n-e,a=r-t,l=Math.hypot(o,a),c=s*Math.sqrt(i*i-l*l/4)/l;return[(e+n)/2-a*c,(t+r)/2+o*c]}function xF([e,t,n],[r,i,s],o){const a=r-e,l=i-t,c=Math.hypot(a,l),u=(a*a+l*l-s*s+n*n)/(2*c),f=o*Math.sqrt(n*n-u*u);return[e+(a*u+l*f)/c,t+(l*u-a*f)/c]}function R7t(e,{x:t,x1:n,x2:r,y:i,y1:s,y2:o,...a}={}){return[n,r]=B2(t,n,r),[s,o]=B2(i,s,o),new XK(e,{...a,x1:n,x2:r,y1:s,y2:o})}const C7t={ariaLabel:"bar"};class bC extends yr{constructor(t,n,r={},i=C7t){super(t,n,r,i),oC(this,r),aC(this,r)}render(t,n,r,i,s){const{rx:o,ry:a,rx1y1:l,rx1y2:c,rx2y1:u,rx2y2:f}=this,h=this._x(n,r,i),d=this._y(n,r,i),g=this._width(n,r,i),y=this._height(n,r,i);return Sn("svg:g",s).call(Mr,this,i,s).call(this._transform,this,n).call(v=>v.selectAll().data(t).enter().call(l||c||u||f?b=>b.append("path").call(cr,this).call(lC,h,d,SF(h,g),SF(d,y),this).call(Wr,this,r):b=>b.append("rect").call(cr,this).attr("x",h).attr("width",g).attr("y",d).attr("height",y).call(me,"rx",o).call(me,"ry",a).call(Wr,this,r))).node()}_x(t,{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n?s=>n[s]+i:r+i}_y(t,{y:n},{marginTop:r}){const{insetTop:i}=this;return n?s=>n[s]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:s}){const{insetLeft:o,insetRight:a}=this,l=n&&t?t.bandwidth():s-r-i;return Math.max(0,l-o-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:s}){const{insetTop:o,insetBottom:a}=this,l=n&&t?t.bandwidth():s-r-i;return Math.max(0,l-o-a)}}function SF(e,t){return typeof e=="function"&&typeof t=="function"?n=>e(n)+t(n):typeof e=="function"?n=>e(n)+t:typeof t=="function"?n=>e+t(n):e+t}class _C extends bC{constructor(t,n={},r){const{x1:i,x2:s,y:o}=n;super(t,{x1:{value:i,scale:"x"},x2:{value:s,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,r)}_transform(t,n,{x:r}){t.call(mr,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){const{insetLeft:s}=this;return xc(t)?i+s:o=>Math.min(n[o],r[o])+s}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:s,width:o}){const{insetLeft:a,insetRight:l}=this;return xc(t)?o-i-s-a-l:c=>Math.max(0,Math.abs(r[c]-n[c])-a-l)}}class wC extends bC{constructor(t,n={},r){const{x:i,y1:s,y2:o}=n;super(t,{y1:{value:s,scale:"y"},y2:{value:o,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},n,r)}_transform(t,n,{y:r}){t.call(mr,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){const{insetTop:s}=this;return xc(t)?i+s:o=>Math.min(n[o],r[o])+s}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:s,height:o}){const{insetTop:a,insetBottom:l}=this;return xc(t)?o-i-s-a-l:c=>Math.max(0,Math.abs(r[c]-n[c])-a-l)}}function sd(e,t={}){return nm(t)||(t={...t,y:vi,x2:de}),new _C(e,j3(ZR(z3(t))))}function od(e,t={}){return nm(t)||(t={...t,x:vi,y2:de}),new wC(e,V3(QR(q3(t))))}const N7t={ariaLabel:"cell"};class G3 extends bC{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,N7t)}_transform(t,n){t.call(mr,n,{},0,0)}}function E0(e,{x:t,y:n,...r}={}){return[t,n]=Il(t,n),new G3(e,{...r,x:t,y:n})}function $7t(e,{x:t=vi,fill:n,stroke:r,...i}={}){return n===void 0&&Us(r)[0]===void 0&&(n=de),new G3(e,{...i,x:t,fill:n,stroke:r})}function O7t(e,{y:t=vi,fill:n,stroke:r,...i}={}){return n===void 0&&Us(r)[0]===void 0&&(n=de),new G3(e,{...i,y:t,fill:n,stroke:r})}const L7t={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function xC(e){return e.sort===void 0&&e.reverse===void 0?jG({channel:"-r"},e):e}class X3 extends yr{constructor(t,n={}){const{x:r,y:i,r:s,rotate:o,symbol:a=Bv,frameAnchor:l}=n,[c,u]=li(o,0),[f,h]=URt(a),[d,g]=li(s,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:d,scale:"r",filter:Su,optional:!0},rotate:{value:c,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},xC(n),L7t),this.r=g,this.rotate=u,this.symbol=h,this.frameAnchor=V1(l);const{channels:y}=this,{symbol:v}=y;if(v){const{fill:b,stroke:_}=y;v.hint={fill:b?b.value===v.value?"color":"currentColor":this.fill??"currentColor",stroke:_?_.value===v.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,r:u,rotate:f,symbol:h}=r,{r:d,rotate:g,symbol:y}=this,[v,b]=Nc(this,i),_=y===Bv,w=u?void 0:d*d*Math.PI;return b3(d)&&(t=[]),Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o,y:c&&a}).call(S=>S.selectAll().data(t).enter().append(_?"circle":"path").call(cr,this).call(_?k=>{k.attr("cx",l?A=>l[A]:v).attr("cy",c?A=>c[A]:b).attr("r",u?A=>u[A]:d)}:k=>{k.attr("transform",tb`translate(${l?A=>l[A]:v},${c?A=>c[A]:b})${f?A=>` rotate(${f[A]})`:g?` rotate(${g})`:""}`).attr("d",u&&h?A=>{const T=pu();return h[A].draw(T,u[A]*u[A]*Math.PI),T}:u?A=>{const T=pu();return y.draw(T,u[A]*u[A]*Math.PI),T}:h?A=>{const T=pu();return h[A].draw(T,w),T}:(()=>{const A=pu();return y.draw(A,w),A})())}).call(Wr,this,r)).node()}}function xh(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Il(t,n)),new X3(e,{...r,x:t,y:n})}function D7t(e,{x:t=de,...n}={}){return new X3(e,PX({...n,x:t}))}function F7t(e,{y:t=de,...n}={}){return new X3(e,BX({...n,y:t}))}function B7t(e,t){return xh(e,{...t,symbol:"circle"})}function P7t(e,t){return xh(e,{...t,symbol:"hexagon"})}const U7t={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class K3 extends yr{constructor(t,n={}){const{x:r,y:i,z:s,curve:o,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:bh(n),optional:!0}},n,U7t),this.z=s,this.curve=UK(o,a),sm(this,n)}filter(t){return t}project(t,n,r){this.curve!==Rg&&super.project(t,n,r)}render(t,n,r,i,s){const{x:o,y:a}=r,{curve:l}=this;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(c=>c.selectAll().data(kX(t,[o,a],this,r)).enter().append("path").call(cr,this).call(C2,this,r).call(W8t,this,r,s).attr("d",l===Rg&&s.projection?z7t(s.path(),o,a):YH().curve(l).defined(u=>u>=0).x(u=>o[u]).y(u=>a[u]))).node()}}function z7t(e,t,n){return t=co(t),n=co(n),r=>{let i=[];const s=[i];for(const o of r)o===-1?(i=[],s.push(i)):i.push([t[o],n[o]]);return e({type:"MultiLineString",coordinates:s})}}function J3(e,{x:t,y:n,...r}={}){return[t,n]=Il(t,n),new K3(e,{...r,x:t,y:n})}function Kv(e,{x:t=de,y:n=vi,...r}={}){return new K3(e,gC({...r,x:t,y:n}))}function Jv(e,{x:t=vi,y:n=de,...r}={}){return new K3(e,pC({...r,x:t,y:n}))}function KK(e,t){t=j7t(t);const{x:n,y:r,color:i,size:s}=t,o=D_(e,n),a=D_(e,r),l=D_(e,i),c=D_(e,s);let{fx:u,fy:f,x:{value:h,reduce:d,zero:g,...y},y:{value:v,reduce:b,zero:_,...w},color:{value:S,color:k,reduce:A},size:{value:T,reduce:M},mark:I}=t;if(d===void 0&&(d=b==null&&h==null&&T==null&&v!=null?"count":null),b===void 0&&(b=d==null&&v==null&&T==null&&h!=null?"count":null),M===void 0&&T==null&&A==null&&d==null&&b==null&&(h==null||Hr(o))&&(v==null||Hr(a))&&(M="count"),g===void 0&&(g=F_(d)?!0:void 0),_===void 0&&(_=F_(b)?!0:void 0),h==null&&v==null)throw new Error("must specify x or y");if(d!=null&&v==null)throw new Error("reducing x requires y");if(b!=null&&h==null)throw new Error("reducing y requires x");I===void 0&&(I=T!=null||M!=null?"dot":F_(d)||F_(b)||A!=null?"bar":h!=null&&v!=null?Hr(o)||Hr(a)||d==null&&b==null&&!ty(o)&&!ty(a)?"dot":"line":h!=null||v!=null?"rule":null);let C,N,L;switch(I){case"dot":L=xh,N="stroke";break;case"line":L=o&&a||d!=null||b!=null?_||b!=null||o&&ty(o)?Jv:g||d!=null||a&&ty(a)?Kv:J3:o?Kv:Jv,N="stroke",EF(l)&&(C=null);break;case"area":L=!(_||b!=null)&&(g||d!=null||a&&ty(a))?Xv:Cg,N="fill",EF(l)&&(C=null);break;case"rule":L=o?Qf:th,N="stroke";break;case"bar":L=d!=null?Hr(a)?AF(d)&&o&&Hr(o)?E0:sd:O2:b!=null?Hr(o)?AF(b)&&a&&Hr(a)?E0:od:L2:A!=null||M!=null?o&&Hr(o)&&a&&Hr(a)?E0:o&&Hr(o)?od:a&&Hr(a)?sd:cC:o&&A0(o)&&!(a&&A0(a))?sd:a&&A0(a)&&!(o&&A0(o))?od:E0,N="fill";break;default:throw new Error(`invalid mark: ${I}`)}let F={fx:u,fy:f,x:o??void 0,y:a??void 0,[N]:l??k,z:C,r:c??void 0,tip:!0},$,D={[N]:A??void 0,r:M??void 0};if(d!=null&&b!=null)throw new Error("cannot reduce both x and y");return b!=null?(D.y=b,$=Hr(o)?qv:wf):d!=null?(D.x=d,$=Hr(a)?jv:xf):(A!=null||M!=null)&&(o&&a?$=Hr(o)&&Hr(a)?DR:Hr(o)?xf:Hr(a)?wf:Xh:o?$=Hr(o)?qv:wf:a&&($=Hr(a)?jv:xf)),($===Xh||$===wf)&&(F.x={value:o,...y}),($===Xh||$===xf)&&(F.y={value:a,...w}),g===void 0&&(g=o&&!($===Xh||$===wf)&&(L===sd||L===Xv||L===O2||L===th)),_===void 0&&(_=a&&!($===Xh||$===xf)&&(L===od||L===Cg||L===L2||L===Qf)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:d??null,zero:!!g,...y},y:{value:v??null,reduce:b??null,zero:!!_,...w},color:{value:S??null,reduce:A??null,...k!==void 0&&{color:k}},size:{value:T??null,reduce:M??null},mark:I,markImpl:kF[L],markOptions:F,transformImpl:kF[$],transformOptions:D,colorMode:N}}function q7t(e,t){const n=KK(e,t),{fx:r,fy:i,x:{zero:s},y:{zero:o},markOptions:a,transformOptions:l,colorMode:c}=n,u=WM[n.markImpl],f=WM[n.transformImpl],h=r!=null||i!=null?uC({strokeOpacity:.1}):null,d=[s?Qf([0]):null,o?th([0]):null],g=u(e,f?f(l,a):a);return c==="stroke"?za(h,d,g):za(h,g,d)}function ty(e){let t,n;for(const r of e){if(r==null)continue;if(t===void 0){t=r;continue}const i=Math.sign(Hn(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function j7t({x:e,y:t,color:n,size:r,fx:i,fy:s,mark:o}={}){return Yl(e)||(e=t0(e)),Yl(t)||(t=t0(t)),Yl(n)||(n=j1(n)?{color:n}:t0(n)),Yl(r)||(r=t0(r)),Yl(i)&&({value:i}=t0(i)),Yl(s)&&({value:s}=t0(s)),o!=null&&(o=`${o}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:s,mark:o}}function D_(e,t){const n=cn(e,t.value);return n&&(n.label=Cc(t.value)),n}function t0(e){return V7t(e)?{reduce:e}:{value:e}}function F_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function AF(e){return/^(?:first|last|mode)$/i.test(e)}function V7t(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&Ko(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function EF(e){return e?new Gg(e).size>e.length>>1:!1}const WM={dot:xh,line:J3,lineX:Kv,lineY:Jv,areaX:Xv,areaY:Cg,ruleX:Qf,ruleY:th,barX:sd,barY:od,rect:cC,rectX:O2,rectY:L2,cell:E0,bin:Xh,binX:wf,binY:xf,group:DR,groupX:qv,groupY:jv},kF=Object.fromEntries(Object.entries(WM).map(([e,t])=>[t,e]));function SC(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=de});const s={};return n!=null&&(s.x=e),r!=null&&(s.x1=e),i!=null&&(s.x2=e),Sc(s,t)}function AC(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=de});const s={};return n!=null&&(s.y=e),r!=null&&(s.y1=e),i!=null&&(s.y2=e),Sc(s,t)}function Sc(e={},t={}){const n=bh(t),r=Object.entries(e).map(([i,s])=>{const o=$G(i,t);if(o==null)throw new Error(`missing channel: ${i}`);const[a,l]=Bo(o);return{key:i,input:o,output:a,setOutput:l,map:W7t(s)}});return{...Rl(t,(i,s)=>{const o=cn(i,n),a=r.map(({input:c})=>cn(i,c)),l=r.map(({setOutput:c})=>c(new Array(i.length)));for(const c of s)for(const u of o?hh(c,f=>o[f]).values():[c])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],l[h]));return{data:i,facets:s}}),...Object.fromEntries(r.map(({key:i,output:s})=>[i,s]))}}function W7t(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&Ko(e))return Y7t(e);if(typeof e=="function")return sT(TR(e));switch(`${e}`.toLowerCase()){case"cumsum":return G7t;case"rank":return sT((t,n)=>wj(t,r=>n[r]));case"quantile":return sT((t,n)=>H7t(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function Y7t(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function H7t(e,t){const n=VS(e,t)-1;return wj(e,t).map(r=>r/n)}function sT(e){return{mapIndex(t,n,r){const i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let s=0,o=t.length;s0))throw new Error(`invalid k: ${t}`);return Q7t(n)(t,J7t(i,t),s)}function J7t(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function Z7t(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function Q7t(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return B_(ER(e));switch(e.toLowerCase()){case"deviation":return B_(b1);case"max":return P_((t,n)=>Vr(t,r=>n[r]));case"mean":return t$t;case"median":return B_(xv);case"min":return P_((t,n)=>Or(t,r=>n[r]));case"mode":return P_((t,n)=>_j(t,r=>n[r]));case"sum":return JK;case"variance":return B_(oI);case"difference":return r$t;case"ratio":return i$t;case"first":return s$t;case"last":return o$t}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return P_(TR(e))}function B_(e){return(t,n,r)=>r?{mapIndex(i,s,o){const a=c=>s[c]==null?NaN:+s[c];let l=0;for(let c=0;cs[l]==null?NaN:+s[l];for(let l=-n;l<0;++l)o[i[l+n]]=e(wd(i,0,l+t),a);for(let l=0,c=i.length-n;lr?{mapIndex(i,s,o){let a=0;for(let l=0;l=n;--i){const s=e[t[i]];if(Yi(s))return s}}function ZK(e,t,n,r){for(let i=n+r;n=n;--i){let s=e[t[i]];if(s!==null&&!isNaN(s=+s))return s}}function r$t(e,t,n){return n?{mapIndex(r,i,s){for(let o=0,a=r.length-e;oWS(i)+t*(b1(i)||0),strict:n,anchor:r})}const c$t={ariaLabel:"tick",fill:null,stroke:"currentColor"};class tJ extends yr{constructor(t,n,r){super(t,n,r,c$t),sm(this,r)}render(t,n,r,i,s){return Sn("svg:g",s).call(Mr,this,i,s).call(this._transform,this,n).call(o=>o.selectAll().data(t).enter().append("line").call(cr,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Wr,this,r).call(J1,this,r,s)).node()}}class eJ extends tJ{constructor(t,n={}){const{x:r,y:i,inset:s=0,insetTop:o=s,insetBottom:a=s}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=kr(o),this.insetBottom=kr(a)}_transform(t,n,{x:r}){t.call(mr,n,{x:r},Wi,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){const{insetTop:i}=this;return n&&t?s=>n[s]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){const{insetBottom:s}=this;return n&&t?o=>n[o]+t.bandwidth()-s:r-i-s}}class nJ extends tJ{constructor(t,n={}){const{x:r,y:i,inset:s=0,insetRight:o=s,insetLeft:a=s}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=kr(o),this.insetLeft=kr(a)}_transform(t,n,{y:r}){t.call(mr,n,{y:r},0,Wi)}_x1({x:t},{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n&&t?s=>n[s]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){const{insetRight:s}=this;return n&&t?o=>n[o]+t.bandwidth()-s:r-i-s}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}}function rJ(e,{x:t=de,...n}={}){return new eJ(e,{...n,x:t})}function iJ(e,{y:t=de,...n}={}){return new nJ(e,{...n,y:t})}function u$t(e,{x:t=de,y:n=null,r,fill:i="#ccc",fillOpacity:s,stroke:o="currentColor",strokeOpacity:a,strokeWidth:l=2,sort:c,...u}={}){const f=n!=null?jv:LR;return za(th(e,f({x1:EC,x2:kC},{x:t,y:n,stroke:o,strokeOpacity:a,...u})),sd(e,f({x1:"p25",x2:"p75"},{x:t,y:n,fill:i,fillOpacity:s,...u})),rJ(e,f({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:a,strokeWidth:l,sort:c,...u})),xh(e,Sc({x:sJ},{x:t,y:n,z:n,r,stroke:o,strokeOpacity:a,...u})))}function f$t(e,{y:t=de,x:n=null,r,fill:i="#ccc",fillOpacity:s,stroke:o="currentColor",strokeOpacity:a,strokeWidth:l=2,sort:c,...u}={}){const f=n!=null?qv:LR;return za(Qf(e,f({y1:EC,y2:kC},{x:n,y:t,stroke:o,strokeOpacity:a,...u})),od(e,f({y1:"p25",y2:"p75"},{x:n,y:t,fill:i,fillOpacity:s,...u})),iJ(e,f({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:a,strokeWidth:l,sort:c,...u})),xh(e,Sc({y:sJ},{x:n,y:t,z:n,r,stroke:o,strokeOpacity:a,...u})))}function sJ(e){const t=EC(e),n=kC(e);return e.map(r=>rn?r:NaN)}function EC(e){const t=oJ(e)*2.5-aJ(e)*1.5;return Or(e,n=>n>=t?n:NaN)}function kC(e){const t=aJ(e)*2.5-oJ(e)*1.5;return Vr(e,n=>n<=t?n:NaN)}function oJ(e){return Hf(e,.25)}function aJ(e){return Hf(e,.75)}const h$t={ariaLabel:"raster",stroke:null,pixelSize:1};function e0(e,t){const n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function TF(e,t){const n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}class lJ extends yr{constructor(t,n,r={},i){let{width:s,height:o,x:a,y:l,x1:c=a==null?0:void 0,y1:u=l==null?0:void 0,x2:f=a==null?s:void 0,y2:h=l==null?o:void 0,pixelSize:d=i.pixelSize,blur:g=0,interpolate:y}=r;if(s!=null&&(s=TF(s,"width")),o!=null&&(o=TF(o,"height")),c!=null&&(c=e0(c,"x1")),u!=null&&(u=e0(u,"y1")),f!=null&&(f=e0(f,"x2")),h!=null&&(h=e0(h,"y2")),a==null&&(c==null||f==null))throw new Error("missing x");if(l==null&&(u==null||h==null))throw new Error("missing y");t!=null&&s!=null&&o!=null&&(a===void 0&&c!=null&&f!=null&&(a=w$t(c,f,s)),l===void 0&&u!=null&&h!=null&&(l=x$t(u,h,s,o))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:l,scale:"y",optional:!0},x1:{value:c==null?null:[c],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:h==null?null:[h],scale:"y",optional:!0,filter:null},...n},r,i),this.width=s,this.height=o,this.pixelSize=e0(d,"pixelSize"),this.blur=e0(g,"blur"),this.interpolate=a==null||l==null?null:p$t(y)}}let cJ=class extends lJ{constructor(t,n={}){const{imageRendering:r}=n;if(t==null){const{fill:i,fillOpacity:s}=n;li(s)[0]!==void 0&&(n=YM("fillOpacity",n)),Us(i)[0]!==void 0&&(n=YM("fill",n))}super(t,void 0,n,h$t),this.imageRendering=pi(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,s){const o=n[r.channels.fill?.scale]??(D=>D),{x:a,y:l}=r,{document:c}=s,[u,f,h,d]=fJ(r,i,s),g=h-u,y=d-f,{pixelSize:v,width:b=Math.round(Math.abs(g)/v),height:_=Math.round(Math.abs(y)/v)}=this,w=b*_;let{fill:S,fillOpacity:k}=r,A=0;if(this.interpolate){const D=b/g,O=_/y,B=pr(a,U=>(U-u)*D,Float64Array),V=pr(l,U=>(U-f)*O,Float64Array);S&&(S=this.interpolate(t,b,_,B,V,S)),k&&(k=this.interpolate(t,b,_,B,V,k))}else this.data==null&&t&&(A=t.fi*w);const T=c.createElement("canvas");T.width=b,T.height=_;const M=T.getContext("2d"),I=M.createImageData(b,_),C=I.data;let{r:N,g:L,b:F}=mo(this.fill)??{r:0,g:0,b:0},$=(this.fillOpacity??1)*255;for(let D=0;D0&&yxt(I,this.blur),M.putImageData(I,0,0),Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(D=>D.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(g)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(me,"image-rendering",this.imageRendering).call(cr,this).attr("xlink:href",T.toDataURL())).node()}};function uJ(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:s,...o}=n;return r===void 0&&i===void 0&&TRt(t)&&(r=S3,i=Pv,s===void 0&&(s=SRt)),[t,{...o,x:r,y:i,[e]:s}]}function d$t(){const[e,t]=uJ("fill",...arguments);return new cJ(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:de})}function fJ({x1:e,y1:t,x2:n,y2:r},i,{projection:s}){const{width:o,height:a,marginTop:l,marginRight:c,marginBottom:u,marginLeft:f}=i;return[e&&s==null?e[0]:f,t&&s==null?t[0]:l,n&&s==null?n[0]:o-c,r&&s==null?r[0]:a-u]}function hJ({x1:e,y1:t,x2:n,y2:r},i,s,o){const a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),fJ(R3(a,i),s,o)}function YM(e,t={}){const{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return gs({...t,[e]:void 0},function(r,i,s,o,a,l){const{x:c,y:u}=o;if(!c)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");const[f,h,d,g]=hJ(s,o,a,l),y=d-f,v=g-h,{pixelSize:b}=this,{width:_=Math.round(Math.abs(y)/b),height:w=Math.round(Math.abs(v)/b)}=t,S=new Array(_*w*(i?i.length:1)),k=y/_,A=v/w;let T=0;for(const M of i??[void 0])for(let I=.5;I=t||i[a]<0||i[a]>=n||(o[Math.floor(i[a])*t+Math.floor(r[a])]=s[a]);return o}function TC({random:e=fR(42)}={}){return(t,n,r,i,s,o)=>{const{points:a,triangles:l,hull:c}=mh.from(t,d=>i[d],d=>s[d]),u=new o.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=_$t(o,e);for(let d=0;d=n||O<0||O>=r)continue;const B=D+.5,V=O+.5,U=Math.sign(N),z=(k-A)*(B-w)+(V-A)*(w-_);if(z*U<0)continue;const q=(A-S)*(B-w)+(V-A)*(b-w);if(q*U<0)continue;const Y=N-(z+q);if(Y*U<0)continue;const Q=D+n*O;u[Q]=h(L,z/N,F,q/N,$,Y/N,D,O),f[Q]=1}}return g$t(u,f,i,s,o,n,r,c,t,h),u}}function g$t(e,t,n,r,i,s,o,a,l,c){n=Float64Array.from(a,d=>n[l[d]]),r=Float64Array.from(a,d=>r[l[d]]),i=Array.from(a,d=>i[l[d]]);const u=n.length,f=Array.from({length:u},(d,g)=>y$t(g,n,r));let h=0;for(let d=0;d0&&c>0?l/(l+c):+(l>c)}function ey(e,t,n,r){return e*r-n*t}function y$t(e,t,n){const r=t.length,i=t.at(e-2),s=n.at(e-2),o=t.at(e-1),a=n.at(e-1),l=t[e],c=n[e],u=t.at(e+1-r),f=n.at(e+1-r),h=o-l,d=a-c,g=i-o,y=s-a,v=l-u,b=c-f,_=Math.hypot(h,d),w=Math.hypot(g,y),S=Math.hypot(v,b);return(k,A)=>{const T=k-o,M=A-a,I=k-l,C=A-c;return ey(T,M,I,C)>-1e-6&&ey(T,M,h,d)*w-ey(T,M,g,y)*_>-1e-6&&ey(I,C,v,b)*_-ey(I,C,h,d)*S<=0}}function MC(e,t,n,r,i,s){const o=new s.constructor(t*n),a=mh.from(e,u=>r[u],u=>i[u]);let l,c;for(let u=.5,f=0;u{const c=new l.constructor(i*s),u=mh.from(r,g=>o[g],g=>a[g]);let f,h,d;for(let g=.5,y=0;gt&&S{const c=e(a,l);return cl.map(c=>c.value),label:Cc(r)};for(const l in s)i[l]==="value"&&(i[l]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=YM("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=de),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},S$t(i),MF);const o={geometry:{value:de}};for(const a in this.channels){const l=this.channels[a],{scale:c}=l;c==="x"||c==="y"||a==="value"||(o[a]=l,delete this.channels[a])}this.contourChannels=o,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...s},o){return super.filter(t,s,o)}render(t,n,r,i,s){const{geometry:o}=r,a=P1();return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(l=>{l.selectAll().data(t).enter().append("path").call(cr,this).attr("d",c=>a(o[c])).call(Wr,this,r)}).node()}}function S$t({thresholds:e,interval:t,...n}){return e=qK(e,t,uI),gs(n,function(r,i,s,o,a,l){const[c,u,f,h]=hJ(s,o,a,l),d=f-c,g=h-u,{pixelSize:y,width:v=Math.round(Math.abs(d)/y),height:b=Math.round(Math.abs(g)/y)}=this,_=v/d,w=b/g,S=s.value.value,k=[];if(this.interpolate){const{x:C,y:N}=K1(s,o,l),L=pr(C,O=>(O-c)*_,Float64Array),F=pr(N,O=>(O-u)*w,Float64Array),$=[s.x,s.y,s.value],D=[L,F,S];for(const O of i){const B=this.filter(O,$,D);k.push(this.interpolate(B,v,b,L,F,S))}}else if(i){const C=v*b,N=i.length;for(let L=0;L0)for(const C of k)uj({data:C,width:v,height:b},this.blur);const A=A$t(e,S,...k$t(k));if(A===null)throw new Error(`unsupported thresholds: ${e}`);const{contour:T}=Jx().size([v,b]).smooth(this.smooth),M=[],I=[];for(const C of k)I.push(Do(M.length,M.push(...pr(A,N=>T(C,N)))));for(const{coordinates:C}of M)for(const N of C)for(const L of N)for(const F of L)F[0]=F[0]/_+c,F[1]=F[1]/w+u;return{data:M,facets:I,channels:ZG(this.contourChannels,M)}})}function A$t(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return vh(e);const i=Yf(...mj(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]Or(t,IF)),Vr(e,t=>Vr(t,IF))]}function IF(e){return isFinite(e)?e:NaN}function T$t(e,t){return RC(L3,e,t)}function M$t(e,t={}){return RC(D3,e,t)}function I$t(e,t={}){return RC(Gv,e,t)}function RC(e,t,n={}){const{x:r,y:i,maxRadius:s}=n,o=e({px:r,py:i,maxRadius:s}),a=[];r!=null&&a.push(Qf(t,RF("x",{...o,inset:-6},n))),i!=null&&a.push(th(t,RF("y",{...o,inset:-6},n))),r!=null&&a.push(Mg(t,CF("x",{...o,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Mg(t,CF("y",{...o,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(const l of a)l.ariaLabel=`crosshair ${l.ariaLabel}`;return za(...a)}function pJ(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:s,fy:o,[e]:a,channels:l,transform:c,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:s,fy:o,[e]:a,channels:{...t,...l},transform:c,initializer:R$t(e,u)}}function R$t(e,t){return t==null?t:function(n,r,{x:i,y:s,px:o,py:a,...l},...c){const{channels:{x:u,y:f,...h}={},...d}=t.call(this,n,r,{...l,x:o,y:a},...c);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...d}}}function RF(e,t,n){const{color:r="currentColor",opacity:i=.2,ruleStroke:s=r,ruleStrokeOpacity:o=i,ruleStrokeWidth:a}=n;return{...pJ(e,t,n),stroke:s,strokeOpacity:o,strokeWidth:a}}function CF(e,t,n){const{color:r="currentColor",textFill:i=r,textFillOpacity:s,textStroke:o="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:l=5}=n;return{...pJ(e,t,C$t(e,n)),fill:i,fillOpacity:s,stroke:o,strokeOpacity:a,strokeWidth:l}}function C$t(e,t){return gs(t,(n,r,i)=>({channels:{text:{value:OM(i,e)?.value}}}))}const N$t={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},$$t={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},O$t={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},L$t={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},D$t={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class F$t extends yr{constructor(t,n={}){const{x:r,y:i,z:s,curve:o,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:s,optional:!0}},n,N$t),this.curve=dC(o,a),sm(this,n)}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,z:u}=r,{curve:f}=this,[h,d]=Nc(this,i),g=l?_=>l[_]:Vi(h),y=c?_=>c[_]:Vi(d),v=this;function b(_){let w=-1;const S=[],k={};for(const $ in r)k[$]=[];const A=[],T=[],M=[],I=[];function C($,D){$=_[$],D=_[D],S.push(++w),A[w]=g($),M[w]=y($),T[w]=g(D),I[w]=y(D);for(const O in r)k[O].push(r[O][D])}const{halfedges:N,hull:L,triangles:F}=mh.from(_,g,y);for(let $=0;$$&&C(F[$],F[D])}for(let $=0;${const D=pu(),O=f(D);return O.lineStart(),O.point(A[$],M[$]),O.point(T[$],I[$]),O.lineEnd(),D}).call(Wr,v,k).call(J1,v,k,s)}return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o,y:c&&a}).call(u?_=>_.selectAll().data(hh(t,w=>u[w]).values()).enter().append("g").each(b):_=>_.datum(t).each(b)).node()}}class CC extends yr{constructor(t,n={},r,i=({z:s})=>s){const{x:s,y:o}=n;super(t,{x:{value:s,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,z:u}=r,[f,h]=Nc(this,i),d=l?b=>l[b]:Vi(f),g=c?b=>c[b]:Vi(h),y=this;function v(b){const _=mh.from(b,d,g);Ar(this).append("path").datum(b[0]).call(cr,y).attr("d",y._render(_,i)).call(Wr,y,r)}return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o,y:c&&a}).call(u?b=>b.selectAll().data(hh(t,_=>u[_]).values()).enter().append("g").each(v):b=>b.datum(t).each(v)).node()}}class B$t extends CC{constructor(t,n={}){super(t,n,$$t),this.fill="none"}_render(t){return t.render()}}class P$t extends CC{constructor(t,n={}){super(t,n,O$t,bh)}_render(t){return t.renderHull()}}class U$t extends yr{constructor(t,n={}){const{x:r,y:i,z:s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:s,optional:!0}},gs(n,function(o,a,l,c,u,f){let{x:h,y:d,z:g}=l;({x:h,y:d}=K1(l,c,f)),g=g?.value;const y=new Array((h??d).length).fill(null),[v,b]=Nc(this,u),_=h?S=>h[S]:Vi(v),w=d?S=>d[S]:Vi(b);for(let S of a){h&&(S=S.filter(k=>Yi(_(k)))),d&&(S=S.filter(k=>Yi(w(k))));for(const[,k]of xd(S,g)){const A=mh.from(k,_,w),T=gJ(A,u);for(let M=0,I=k.length;M{f.selectAll().data(t).enter().append("path").call(cr,this).attr("d",h=>u[h]).call(Wr,this,r)}).node()}}class z$t extends CC{constructor(t,n){super(t,n,D$t),this.fill="none"}_render(t,n){return gJ(t,n).render()}}function gJ(e,t){const{width:n,height:r,marginTop:i,marginRight:s,marginBottom:o,marginLeft:a}=t;return e.voronoi([a,i,n-s,r-o])}function eb(e,t,{x:n,y:r,...i}={}){return[n,r]=Il(n,r),new e(t,{...i,x:n,y:r})}function q$t(e,t){return eb(F$t,e,t)}function j$t(e,t){return eb(B$t,e,t)}function V$t(e,t){return eb(P$t,e,t)}function W$t(e,{x:t,y:n,initializer:r,...i}={}){return eb(U$t,e,{...Rl({...i,x:t,y:n},IK),initializer:r})}function Y$t(e,t){return eb(z$t,e,t)}const H$t={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class mJ extends yr{constructor(t,{x:n,y:r,z:i,weight:s,fill:o,stroke:a,...l}={}){const c=NF(o)&&(o="currentColor",!0),u=NF(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:bh({z:i,fill:o,stroke:a}),optional:!0},weight:{value:s,optional:!0}},K$t({...l,fill:o,stroke:a},c,u),H$t),c&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,s){const{contours:o}=r,a=P1();return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{}).call(l=>l.selectAll().data(t).enter().append("path").call(cr,this).call(Wr,this,r).attr("d",c=>a(o[c]))).node()}}function G$t(e,{x:t,y:n,...r}={}){return[t,n]=Il(t,n),new mJ(e,{...r,x:t,y:n})}const X$t=new Set(["x","y","z","weight"]);function K$t(e,t,n){let{bandwidth:i,thresholds:s}=e;return i=i===void 0?20:+i,s=s===void 0?20:typeof s?.[Symbol.iterator]=="function"?co(s):+s,gs(e,function(o,a,l,c,u,f){const h=l.weight?co(l.weight.value):null,d=l.z?.value,{z:g}=this,[y,v]=Nc(this,u),{width:b,height:_}=u,{x:w,y:S}=K1(l,c,f),k=Object.fromEntries(Object.entries(l).filter(([F])=>!X$t.has(F)).map(([F,$])=>[F,{...$,value:[]}])),A=t&&[],T=n&&[],M=k5t().x(w?F=>w[F]:y).y(S?F=>S[F]:v).weight(h?F=>h[F]:1).size([b,_]).bandwidth(i),I=[];for(const F of a){const $=[];I.push($);for(const D of d?GR(F,d,g):[F]){const O=M.contours(D);$.push([D,O])}}let C=s;if(!(C instanceof x3)){let F=0;for(const $ of I)for(const[,D]of $){const O=D.max;O>F&&(F=O)}C=Float64Array.from({length:s-1},($,D)=>F*100*(D+1)/s)}const N=[],L=[];for(const F of I){const $=[];N.push($);for(const[D,O]of F)for(const B of C){$.push(L.length),L.push(O(B/100)),A&&A.push(B),T&&T.push(B);for(const V in k)k[V].value.push(l[V].value[D[0]])}}return A&&A.push(0),T&&T.push(0),{data:o,facets:N,channels:{...k,...A&&{fill:{value:A,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:L}}}})}function NF(e){return/^density$/i.test(e)}function J$t(e,t){return yJ("x",e,t)}function Z$t(e,t){return yJ("y",e,t)}function yJ(e,t,{x1:n,x2:r,y1:i,y2:s,x:o=n===void 0&&r===void 0?e==="y"?vi:de:void 0,y:a=i===void 0&&s===void 0?e==="x"?vi:de:void 0,fill:l,positiveFill:c="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:h=f,negativeFillOpacity:d=f,stroke:g,strokeOpacity:y,z:v=Us(g)[0],clip:b,tip:_,render:w,...S}={}){return[n,r]=$F(o,n,r),[i,s]=$F(a,i,s),n===r&&i===s&&(e==="y"?i=ru(0):n=ru(0)),{tip:_}=yp({tip:_},e==="y"?"x":"y"),za($r(c)?null:Object.assign(VM(t,{x1:n,x2:r,y1:i,y2:s,z:v,fill:c,fillOpacity:h,render:Hv(w,OF(e,!0)),clip:b,...S}),{ariaLabel:"positive difference"}),$r(u)?null:Object.assign(VM(t,{x1:n,x2:r,y1:i,y2:s,z:v,fill:u,fillOpacity:d,render:Hv(w,OF(e,!1)),clip:b,...S}),{ariaLabel:"negative difference"}),J3(t,{x:r,y:s,z:v,stroke:g,strokeOpacity:y,tip:_,clip:!0,...S}))}function $F(e,t,n){return t===void 0&&n===void 0?t=n=ru(e):t===void 0?(n=ru(n),t=e===void 0?n:ru(e)):n===void 0?(t=ru(t),n=e===void 0?t:ru(e)):(t=ru(t),n=ru(n)),[t,n]}function ru(e){let t;const{value:n,label:r=Cc(n)}=im(e);return{transform:i=>t||(t=cn(i,n)),label:r}}function OF(e,t){const n=e==="x"?"y":"x",r=`${n}1`,i=`${n}2`,s=`${e}1`,o=`${e}2`;return(a,l,c,u,f,h)=>{const{[r]:d,[i]:g}=c,y=new Float32Array(d.length),v=new Float32Array(g.length),b=u[e==="y"?"height":"width"];(t===dX(l[e])<0?y:v).fill(b);const _=h(a,l,{...c,[i]:d,[o]:v},u,f),w=h(a,l,{...c,[r]:g,[s]:y},u,f),S=_.querySelector("g")??_,k=w.querySelector("g")??w;for(let A=0;S.firstChild;A+=2){const T=HR(),M=Sn("svg:clipPath",f).attr("id",T).node();M.appendChild(S.firstChild),k.childNodes[A].setAttribute("clip-path",`url(#${T})`),k.insertBefore(M,k.childNodes[A])}return w}}function vJ({geometry:e=de,...t}={}){const n=kg(r=>cn(r,e));return gs({...t,x:null,y:null,geometry:{transform:n}},(r,i,s,o,a,l)=>{const c=n(r),u=c.length,f=new Float64Array(u),h=new Float64Array(u),{centroid:d}=l.path();for(let g=0;gcn(i,e)),r=kg(i=>cn(n(i),Z5t));return{...t,x:{transform:i=>Float64Array.from(r(i),([s])=>s)},y:{transform:i=>Float64Array.from(r(i),([,s])=>s)},geometry:{transform:n}}}const tOt={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class bJ extends yr{constructor(t,n={}){const[r,i]=li(n.r,3);super(t,{x:{value:n.tip?n.x:null,scale:"x",optional:!0},y:{value:n.tip?n.y:null,scale:"y",optional:!0},r:{value:r,scale:"r",filter:Su,optional:!0},geometry:{value:n.geometry,scale:"projection"}},xC(n),tOt),this.r=i}render(t,n,r,i,s){const{geometry:o,r:a}=r,l=s.path(),{r:c}=this;return b3(c)?t=[]:c!==void 0&&l.pointRadius(c),Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(cr,this).attr("d",a?f=>l.pointRadius(a[f])(o[f]):f=>l(o[f])).call(Wr,this,r)}).node()}}function NC(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=vJ(t):t.geometry===void 0&&(t={...t,geometry:de}),new bJ(e,t)}function eOt({strokeWidth:e=1.5,...t}={}){return NC({type:"Sphere"},{strokeWidth:e,...t})}function nOt({strokeOpacity:e=.1,...t}={}){return NC(u6t(),{strokeOpacity:e,...t})}const Yy=.5,Hy=0;function rOt(e={fill:"count"},{binWidth:t,...n}={}){const{z:r}=n;return t=t===void 0?20:kr(t),e=YG(e,n),Rf(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Rf(e,"r")&&(n.r=t/2),gs(n,(i,s,o,a,l,c)=>{let{x:u,y:f,z:h,fill:d,stroke:g,symbol:y}=o;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=K1(o,a,c)),h=h?h.value:cn(i,r),d=d?.value,g=g?.value,y=y?.value;const v=PR(e,{z:h,fill:d,stroke:g,symbol:y}),b=h&&[],_=d&&[],w=g&&[],S=y&&[],k=[],A=[],T=[];let M=-1;for(const L of e)L.initialize(i);for(const L of s){const F=[];for(const $ of e)$.scope("facet",L);for(const[$,D]of xd(L,v))for(const{index:O,extent:B}of iOt(i,D,u,f,t)){F.push(++M),A.push(B.x),T.push(B.y),h&&b.push(v===h?$:h[O[0]]),d&&_.push(v===d?$:d[O[0]]),g&&w.push(v===g?$:g[O[0]]),y&&S.push(v===y?$:y[O[0]]);for(const V of e)V.reduce(O,B)}k.push(F)}const I=o.x.scale,C=o.y.scale,N={x:{value:A,source:a[I]?{value:pr(A,a[I].invert),scale:I}:null},y:{value:T,source:a[C]?{value:pr(T,a[C].invert),scale:C}:null},...h&&{z:{value:b}},...d&&{fill:{value:_,scale:"auto"}},...g&&{stroke:{value:w,scale:"auto"}},...y&&{symbol:{value:S,scale:"auto"}},...Object.fromEntries(e.map(({name:L,output:F})=>[L,{scale:"auto",label:F.label,radius:L==="r"?t/2:void 0,value:F.transform()}]))};return{data:i,facets:k,channels:N}})}function iOt(e,t,n,r,i){const s=i*(1.5/zG),o=new Map;for(const a of t){let l=n[a],c=r[a];if(isNaN(l)||isNaN(c))continue;let u=Math.round(c=(c-Hy)/s),f=Math.round(l=(l-Yy)/i-(u&1)/2),h=c-u;if(Math.abs(h)*3>1){let y=l-f,v=f+(l_*_+w*w&&(f=v+(u&1?1:-1)/2,u=b)}const d=`${f},${u}`;let g=o.get(d);g===void 0&&(g={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Yy,y:u*s+Hy}},o.set(d,g)),g.index.push(a)}return o.values()}const sOt={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function oOt(e){return new _J(e)}class _J extends yr{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wy,void 0,{clip:n,...r},sOt),this.binWidth=kr(t)}render(t,n,r,i,s){const{binWidth:o}=this,{marginTop:a,marginRight:l,marginBottom:c,marginLeft:u,width:f,height:h}=i,d=u-Yy,g=f-l-Yy,y=a-Hy,v=h-c-Hy,b=o/2,_=b*qG,w=_/2,S=b*2,k=_*1.5,A=Math.floor(d/S),T=Math.ceil(g/S),M=Math.floor((y+w)/k),I=Math.ceil((v-w)/k)+1,C=`m0,${df(-_)}l${df(b)},${df(w)}v${df(_)}l${df(-b)},${df(w)}`;let N=C;for(let L=M;LL.append("path").call(cr,this).call(Wr,this,r).attr("d",N)).node()}}function df(e){return Math.round(e*1e3)/1e3}const aOt={ariaLabel:"image",fill:null,stroke:null};function lOt(e){return/^\.*\//.test(e)}function cOt(e){return/^(blob|data|file|http|https):/i.test(e)}function uOt(e){return typeof e=="string"&&(lOt(e)||cOt(e))?[void 0,e]:[e,void 0]}class wJ extends yr{constructor(t,n={}){let{x:r,y:i,r:s,width:o,height:a,rotate:l,src:c,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=n;s==null&&(s=void 0),s===void 0&&o===void 0&&a===void 0?o=a=16:o===void 0&&a!==void 0?o=a:a===void 0&&o!==void 0&&(a=o);const[g,y]=uOt(c),[v,b]=li(s),[_,w]=li(o,b!==void 0?b*2:void 0),[S,k]=li(a,b!==void 0?b*2:void 0),[A,T]=li(l,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:v,scale:"r",filter:Su,optional:!0},width:{value:_,filter:Su,optional:!0},height:{value:S,filter:Su,optional:!0},rotate:{value:A,optional:!0},src:{value:g,optional:!0}},xC(n),aOt),this.src=y,this.width=w,this.rotate=T,this.height=k,this.r=b,this.preserveAspectRatio=pi(u,"xMidYMid"),this.crossOrigin=ji(f),this.frameAnchor=V1(h),this.imageRendering=pi(d,"auto")}render(t,n,r,i,s){const{x:o,y:a}=n,{x:l,y:c,width:u,height:f,r:h,rotate:d,src:g}=r,{r:y,width:v,height:b,rotate:_}=this,[w,S]=Nc(this,i);return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,{x:l&&o,y:c&&a}).call(k=>k.selectAll().data(t).enter().append("image").call(cr,this).attr("x",LF(l,u,h,w,v,y)).attr("y",LF(c,f,h,S,b,y)).attr("width",u?A=>u[A]:v!==void 0?v:h?A=>h[A]*2:y*2).attr("height",f?A=>f[A]:b!==void 0?b:h?A=>h[A]*2:y*2).attr("transform",d?A=>`rotate(${d[A]})`:_?`rotate(${_})`:null).attr("transform-origin",d||_?tb`${l?A=>l[A]:w}px ${c?A=>c[A]:S}px`:null).call(me,"href",g?A=>g[A]:this.src).call(me,"preserveAspectRatio",this.preserveAspectRatio).call(me,"crossorigin",this.crossOrigin).call(me,"image-rendering",this.imageRendering).call(me,"clip-path",h?A=>`circle(${h[A]}px)`:y!==void 0?`circle(${y}px)`:null).call(Wr,this,r)).node()}}function LF(e,t,n,r,i,s){return t&&e?o=>e[o]-t[o]/2:t?o=>r-t[o]/2:e&&i!==void 0?o=>e[o]-i/2:i!==void 0?r-i/2:n&&e?o=>e[o]-n[o]:n?o=>r-n[o]:e?o=>e[o]-s:r-s}function fOt(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Il(t,n)),new wJ(e,{...r,x:t,y:n})}function hOt(e,t,n){var r=1e-8,i=t-1,s=n-1,o=0,a,l,c,u,f,h,d,g;if(e<=0)return 0;if(e>=1)return 1;for(a=Math.log(t/(t+n)),l=Math.log(n/(t+n)),c=Math.exp(t*a)/t,u=Math.exp(n*l)/n,d=c+u,e=1&&(h=.5*(h+c+1)),Math.abs(c)0)break}return h}function dOt(e,t,n){var r=e===0||e===1?0:Math.exp(Y0(t+n)-Y0(t)-Y0(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*DF(e,t,n)/t:1-r*DF(1-e,n,t)/n}function DF(e,t,n){var r=1e-30,i=1,s=t+n,o=t+1,a=t-1,l=1,c=1-s*e/o,u,f,h,d;for(Math.abs(c).5?n:-n}const gOt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class xJ extends yr{constructor(t,n={}){const{x:r,y:i,z:s,ci:o=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:bh(n),optional:!0}},n,gOt),this.z=s,this.ci=+o,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${o}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,s){const{x:o,y:a,z:l}=r,{ci:c}=this;return Sn("svg:g",s).call(Mr,this,i,s).call(mr,this,n).call(u=>u.selectAll().data(l?GR(t,l,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(cr,this).call(C2,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,o,a)).call(c&&!Eg(this.fill)?h=>h.select(mOt).attr("stroke","none").call(cr,this).call(C2,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,o,a)):()=>{}))).node()}}function mOt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Nu.svg,"path"),this)}class yOt extends xJ{constructor(t,n){super(t,n)}_renderBand(t,n,r){const{ci:i,precision:s}=this,[o,a]=yi(t,u=>r[u]),l=P2(t,r,n),c=SJ(t,r,n,(1-i)/2,l);return dR().y(u=>u).x0(u=>c(u,-1)).x1(u=>c(u,1))(Do(o,a-s/2,s).concat(a))}_renderLine(t,n,r){const[i,s]=yi(t,a=>r[a]),o=P2(t,r,n);return`M${o(i)},${i}L${o(s)},${s}`}}class vOt extends xJ{constructor(t,n){super(t,n)}_renderBand(t,n,r){const{ci:i,precision:s}=this,[o,a]=yi(t,u=>n[u]),l=P2(t,n,r),c=SJ(t,n,r,(1-i)/2,l);return dR().x(u=>u).y0(u=>c(u,-1)).y1(u=>c(u,1))(Do(o,a-s/2,s).concat(a))}_renderLine(t,n,r){const[i,s]=yi(t,a=>n[a]),o=P2(t,n,r);return`M${i},${o(i)}L${s},${o(s)}`}}function bOt(e,{y:t=vi,x:n=de,stroke:r,fill:i=$r(r)?"currentColor":r,...s}={}){return new yOt(e,gC({...s,x:n,y:t,fill:i,stroke:r}))}function _Ot(e,{x:t=vi,y:n=de,stroke:r,fill:i=$r(r)?"currentColor":r,...s}={}){return new vOt(e,pC({...s,x:t,y:n,fill:i,stroke:r}))}function P2(e,t,n){let r=0,i=0,s=0,o=0;for(const u of e){const f=t[u],h=n[u];r+=f,i+=h,s+=f*h,o+=f*f}const a=e.length,l=(a*s-r*i)/(a*o-r*r),c=(i-l*r)/a;return u=>l*u+c}function SJ(e,t,n,r,i){const s=ml(e,u=>t[u])/e.length;let o=0,a=0;for(const u of e)o+=(t[u]-s)**2,a+=(n[u]-i(t[u]))**2;const l=Math.sqrt(a/(e.length-2)),c=pOt(r,e.length-2);return(u,f)=>{const h=i(u),d=l*Math.sqrt(1/e.length+(u-s)**2/o);return h+f*c*d}}function GM({path:e=de,delimiter:t,frameAnchor:n,treeLayout:r=_2,treeSort:i,treeSeparation:s,treeAnchor:o,treeFilter:a,...l}={}){o=$C(o),i=EJ(i),a!=null&&(a=KM(a)),n===void 0&&(n=o.frameAnchor);const c=kJ(t),u=$J(l,KM),[f,h]=Bo(),[d,g]=Bo();return{x:f,y:d,frameAnchor:n,...Rl(l,(y,v)=>{const b=c(cn(y,e)),_=h([]),w=g([]);let S=-1;const k=[],A=[],T=PH().path(C=>b[C]),M=Wu(y)?C=>C.data=y[C.data]:C=>C.data=y.get(C.data),I=r();I.nodeSize&&I.nodeSize([1,1]),I.separation&&s!==void 0&&I.separation(s??AR);for(const C of u)C[U2]=C[CJ]([]);for(const C of v){const N=[],L=T(C.filter(F=>b[F]!=null)).each(M);i!=null&&L.sort(i),I(L);for(const F of L.descendants())if(!(a!=null&&!a(F))){N.push(++S),k[S]=F.data,o.position(F,S,_,w);for(const $ of u)$[U2][S]=$[NJ](F)}A.push(N)}return{data:k,facets:A}}),...Object.fromEntries(u)}}function AJ({path:e=de,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:s=.5,treeLayout:o=_2,treeSort:a,treeSeparation:l,treeAnchor:c,treeFilter:u,...f}={}){c=$C(c),a=EJ(a),u!=null&&(u=BF(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:s,...f};const h=kJ(t),d=$J(f,BF),[g,y]=Bo(),[v,b]=Bo(),[_,w]=Bo(),[S,k]=Bo();return{x1:g,x2:v,y1:_,y2:S,...Rl(f,(A,T)=>{const M=h(cn(A,e)),I=y([]),C=b([]),N=w([]),L=k([]);let F=-1;const $=[],D=[],O=PH().path(V=>M[V]),B=o();B.nodeSize&&B.nodeSize([1,1]),B.separation&&l!==void 0&&B.separation(l??AR);for(const V of d)V[U2]=V[CJ]([]);for(const V of T){const U=[],z=O(V.filter(q=>M[q]!=null)).each(q=>q.data=A[q.data]);a!=null&&z.sort(a),B(z);for(const{source:q,target:Y}of z.links())if(!(u!=null&&!u(Y,q))){U.push(++F),$[F]=Y.data,c.position(q,F,I,N),c.position(Y,F,C,L);for(const Q of d)Q[U2][F]=Q[NJ](Y,q)}D.push(U)}return{data:$,facets:D}}),...Object.fromEntries(d)}}function $C(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return wOt;case"right":return xOt}throw new Error(`invalid tree anchor: ${e}`)}const wOt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},xOt={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function EJ(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?FF(KM(e)):FF(SOt(e))}function FF(e){return(t,n)=>Ua(e(t),e(n))}function SOt(e){return t=>t.data?.[e]}function kJ(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");const t=e.charCodeAt(0);return n=>n.map(r=>AOt(r,t))}const XM=92,TJ=47;function AOt(e,t){if(t===XM)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;rn==null?void 0:e(n)}function TOt(e){let t=e.length;for(;--t>0&&!MOt(e,t););return EOt(e.slice(t+1))}function MOt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}const CJ=2,NJ=3,U2=4;function $J(e,t){const n=[];for(const r in e){const i=e[r],s=t(i);s!==void 0&&n.push([r,...Bo(i),s])}return n}function OJ(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:s,strokeLinecap:o,strokeMiterlimit:a,strokeDasharray:l,strokeDashoffset:c,marker:u,markerStart:f=u,markerEnd:h=u,dot:d=$r(f)&&$r(h),text:g="node:name",textStroke:y="var(--plot-background)",title:v="node:path",dx:b,dy:_,textAnchor:w,treeLayout:S=_2,textLayout:k=S===_2||S===DH?"mirrored":"normal",tip:A,...T}={}){if(b===void 0&&(b=$C(T.treeAnchor).dx),w!==void 0)throw new Error("textAnchor is not a configurable tree option");k=Xo(k,"textLayout",["mirrored","normal"]);function M(I){return Mg(e,GM({treeLayout:S,text:g,fill:t===void 0?"currentColor":t,stroke:y,dx:b,dy:_,title:v,...I,...T}))}return za(GK(e,AJ({treeLayout:S,markerStart:f,markerEnd:h,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:s,strokeLinecap:o,strokeMiterlimit:a,strokeDasharray:l,strokeDashoffset:c,...T})),d?xh(e,GM({treeLayout:S,fill:t===void 0?"node:internal":t,title:v,tip:A,...T})):null,g!=null?k==="mirrored"?[M({textAnchor:"start",treeFilter:"node:external"}),M({textAnchor:"end",treeFilter:"node:internal",dx:-b})]:M():null)}function IOt(e,t){return OJ(e,{...t,treeLayout:DH})}const LJ={ariaLabel:"waffle"};class DJ extends _C{constructor(t,{unit:n=1,gap:r=1,round:i,multiple:s,...o}={}){super(t,BJ("x",o),LJ),this.unit=Math.max(0,n),this.gap=+r,this.round=PJ(i),this.multiple=UJ(s)}}class FJ extends wC{constructor(t,{unit:n=1,gap:r=1,round:i,multiple:s,...o}={}){super(t,BJ("y",o),LJ),this.unit=Math.max(0,n),this.gap=+r,this.round=PJ(i),this.multiple=UJ(s)}}function BJ(e,t){const n=e==="y"?"x":"y",r=`${e}1`,i=`${e}2`;return gs(ROt(t),function(s,o,a,l,c){const{round:u,unit:f}=this,h=a[r].value,d=a[i].value,g=R3({...n in a&&{[n]:a[n]},[r]:a[r],[i]:a[i]},l),y=this[e==="y"?"_width":"_height"](l,g,c),v=this[e==="y"?"_x":"_y"](l,g,c),b=f*$Ot(l.scales[e]),{multiple:_=Math.max(1,Math.floor(Math.sqrt(y/b)))}=this,w=Math.min(y/_,b*_),S=b*_,k=(y-_*w)/2,A=typeof v=="function"?O=>v(O)+k:v+k,T=l[e](0),M=e==="y"?([O,B])=>[O*w,-B*S]:([O,B])=>[B*S,O*w],I=typeof A=="function"?O=>A(O)-y/2:()=>A,[C,N]=e==="y"?[0,1]:[1,0],L=d.length,F=new Array(L),$=new Float64Array(L),D=new Float64Array(L);for(let O=0;OM.selectAll().data(n).enter().append(()=>A.cloneNode(!0)).attr("id",I=>`${k}-${I}`).select("rect").call(cr,this).call(Wr,this,g)).call(M=>M.selectAll().data(n).enter().append("path").attr("transform",tb`translate(${_},${S})`).attr("d",I=>`M${v[I].join("L")}Z`).attr("fill",I=>`url(#${k}-${I})`).attr("stroke",this.stroke==null?null:"none").call(Wr,this,{ariaLabel:f,href:h,title:d})).node()})}}function OC(e,t,n){if(tl&&f.push([0,l]),f.push([r,l],[r,a+e%1],[i,a+e%1]),e%n>n-1||(f.push([i,a]),c>a&&f.push([n,a])),c>a&&f.push([n,c]),f.push([o,c],[o,c+t%1],[s,c+t%1]),t%n<1||(f.push([s,u]),u>l&&f.push([0,u])),f.push(NOt(e,t,n)),f}function COt(e,t,n,r){return OC(e+r*n,t+r*n,n).map(([i,s])=>[i,s-r])}function NOt(e,t,n){const r=Math.floor(t/n)-Math.floor(e/n);return r===0?oT(e,t,n):r===1?Math.floor(t%n)>Math.ceil(e%n)?[(Math.floor(t%n)+Math.ceil(e%n))/2,Math.floor(t/n)]:t%n>n-e%n?oT(t-t%n,t,n):oT(e,n*Math.ceil(e/n),n):[n/2,(Math.round(e/n)+Math.round(t/n))/2]}function oT(e,t,n){const r=Math.floor(t)-Math.floor(e);return r===0?[Math.floor(e%n)+.5,Math.floor(e/n)+(e+t)/2%1]:r===1?t%1-e%1>.5?[Math.ceil(e%n),Math.floor(t/n)+(e%1+t%1)/2]:t%1>1-e%1?[Math.floor(t%n)+.5,Math.floor(t/n)+t%1/2]:[Math.floor(e%n)+.5,Math.floor(e/n)+(1+e%1)/2]:[Math.ceil(e%n)+Math.ceil(Math.floor(t)-Math.ceil(e))/2,Math.floor(e/n)+(t>=1+e?.5:(e+t)/2%1)]}function PJ(e){if(e===void 0||e===!1)return Number;if(e===!0)return Math.round;if(typeof e!="function")throw new Error(`invalid round: ${e}`);return e}function UJ(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function $Ot({domain:e,range:t}){return PF(t)/PF(e)}function PF(e){const[t,n]=yi(e);return n-t}function OOt(e,{tip:t,...n}={}){return nm(n)||(n={...n,y:vi,x2:de}),new DJ(e,{tip:zJ(t),...j3(ZR(z3(n)))})}function LOt(e,{tip:t,...n}={}){return nm(n)||(n={...n,x:vi,y2:de}),new FJ(e,{tip:zJ(t),...V3(QR(q3(n)))})}function zJ(e){return e===!0?{maxRadius:1/0}:Ko(e)&&e.maxRadius===void 0?{...e,maxRadius:1/0}:void 0}function qJ(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var aT,UF;function DOt(){if(UF)return aT;UF=1;function e(o,a,l,c,u){for(var f=u+1;c<=u;){var h=c+u>>>1,d=o[h],g=l!==void 0?l(d,a):d-a;g>=0?(f=h,u=h-1):c=h+1}return f}function t(o,a,l,c,u){for(var f=u+1;c<=u;){var h=c+u>>>1,d=o[h],g=l!==void 0?l(d,a):d-a;g>0?(f=h,u=h-1):c=h+1}return f}function n(o,a,l,c,u){for(var f=c-1;c<=u;){var h=c+u>>>1,d=o[h],g=l!==void 0?l(d,a):d-a;g<0?(f=h,c=h+1):u=h-1}return f}function r(o,a,l,c,u){for(var f=c-1;c<=u;){var h=c+u>>>1,d=o[h],g=l!==void 0?l(d,a):d-a;g<=0?(f=h,c=h+1):u=h-1}return f}function i(o,a,l,c,u){for(;c<=u;){var f=c+u>>>1,h=o[f],d=l!==void 0?l(h,a):h-a;if(d===0)return f;d<=0?c=f+1:u=f-1}return-1}function s(o,a,l,c,u,f){return typeof l=="function"?f(o,a,l,c===void 0?0:c|0,u===void 0?o.length-1:u|0):f(o,a,void 0,l===void 0?0:l|0,c===void 0?o.length-1:c|0)}return aT={ge:function(o,a,l,c,u){return s(o,a,l,c,u,e)},gt:function(o,a,l,c,u){return s(o,a,l,c,u,t)},lt:function(o,a,l,c,u){return s(o,a,l,c,u,n)},le:function(o,a,l,c,u){return s(o,a,l,c,u,r)},eq:function(o,a,l,c,u){return s(o,a,l,c,u,i)}},aT}var lT,zF;function FOt(){if(zF)return lT;zF=1;var e=DOt(),t=0,n=1,r=2;lT=w;function i(S,k,A,T,M){this.mid=S,this.left=k,this.right=A,this.leftPoints=T,this.rightPoints=M,this.count=(k?k.count:0)+(A?A.count:0)+T.length}var s=i.prototype;function o(S,k){S.mid=k.mid,S.left=k.left,S.right=k.right,S.leftPoints=k.leftPoints,S.rightPoints=k.rightPoints,S.count=k.count}function a(S,k){var A=v(k);S.mid=A.mid,S.left=A.left,S.right=A.right,S.leftPoints=A.leftPoints,S.rightPoints=A.rightPoints,S.count=A.count}function l(S,k){var A=S.intervals([]);A.push(k),a(S,A)}function c(S,k){var A=S.intervals([]),T=A.indexOf(k);return T<0?t:(A.splice(T,1),a(S,A),n)}s.intervals=function(S){return S.push.apply(S,this.leftPoints),this.left&&this.left.intervals(S),this.right&&this.right.intervals(S),S},s.insert=function(S){var k=this.count-this.leftPoints.length;if(this.count+=1,S[1]3*(k+1)?l(this,S):this.left.insert(S):this.left=v([S]);else if(S[0]>this.mid)this.right?4*(this.right.count+1)>3*(k+1)?l(this,S):this.right.insert(S):this.right=v([S]);else{var A=e.ge(this.leftPoints,S,g),T=e.ge(this.rightPoints,S,y);this.leftPoints.splice(A,0,S),this.rightPoints.splice(T,0,S)}},s.remove=function(S){var k=this.count-this.leftPoints;if(S[1]3*(k-1))return c(this,S);var T=this.left.remove(S);return T===r?(this.left=null,this.count-=1,n):(T===n&&(this.count-=1),T)}else if(S[0]>this.mid){if(!this.right)return t;var M=this.left?this.left.count:0;if(4*M>3*(k-1))return c(this,S);var T=this.right.remove(S);return T===r?(this.right=null,this.count-=1,n):(T===n&&(this.count-=1),T)}else{if(this.count===1)return this.leftPoints[0]===S?r:t;if(this.leftPoints.length===1&&this.leftPoints[0]===S){if(this.left&&this.right){for(var I=this,C=this.left;C.right;)I=C,C=C.right;if(I===this)C.right=this.right;else{var N=this.left,T=this.right;I.count-=C.count,I.right=C.left,C.left=N,C.right=T}o(this,C),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return n}for(var N=e.ge(this.leftPoints,S,g);N=0&&S[T][1]>=k;--T){var M=A(S[T]);if(M)return M}}function h(S,k){for(var A=0;Athis.mid){if(this.right){var A=this.right.queryPoint(S,k);if(A)return A}return f(this.rightPoints,S,k)}else return h(this.leftPoints,k)},s.queryInterval=function(S,k,A){if(Sthis.mid&&this.right){var T=this.right.queryInterval(S,k,A);if(T)return T}return kthis.mid?f(this.rightPoints,S,A):h(this.leftPoints,A)};function d(S,k){return S-k}function g(S,k){var A=S[0]-k[0];return A||S[1]-k[1]}function y(S,k){var A=S[1]-k[1];return A||S[0]-k[0]}function v(S){if(S.length===0)return null;for(var k=[],A=0;A>1],M=[],I=[],C=[],A=0;A[1,e],zOt=({width:e,marginRight:t})=>[-1,e-t],qOt=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],jOt=({marginTop:e})=>[1,e],VOt=({height:e,marginBottom:t})=>[-1,e-t],WOt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function jJ(e){return typeof e=="string"?{anchor:e}:e}function YOt(e={},t={}){arguments.length===1&&([e,t]=VJ(e));let{anchor:n="left",padding:r=1,r:i=t.r}=jJ(e);switch(`${n}`.toLowerCase()){case"left":n=UOt;break;case"right":n=zOt;break;case"middle":n=qOt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return WJ("x","y",n,kr(r),i,t)}function HOt(e={},t={}){arguments.length===1&&([e,t]=VJ(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=jJ(e);switch(`${n}`.toLowerCase()){case"top":n=jOt;break;case"bottom":n=VOt;break;case"middle":n=WOt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return WJ("y","x",n,kr(r),i,t)}function VJ(e){const{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function WJ(e,t,n,r,i,s){if(i!=null&&typeof i!="number"){let{channels:o,sort:a,reverse:l}=s;o=MR(o),o?.r===void 0&&(s={...s,channels:{...o,r:{value:i,scale:"r"}}}),a===void 0&&l===void 0&&(s.sort={channel:"-r"})}return gs(s,function(o,a,l,c,u,f){let{[t]:h,r:d}=l;if(!l[t])throw new Error(`missing channel: ${t}`);({[t]:h}=K1(l,c,f));const g=d?void 0:i!==void 0?kr(i):this.r!==void 0?this.r:3;d&&(d=cn(d.value,c[d.scale]||de,Float64Array));let[y,v]=n(u);const b=y?XOt:GOt,_=new Float64Array(h.length),w=d?S=>d[S]:()=>g;for(let S of a){const k=POt();S=S.filter(d?T=>T2(h[T])&&Su(d[T]):T=>T2(h[T]));const A=new Float64Array(2*S.length+2);for(const T of S){const M=w(T),I=y?M+r:0,C=h[T]-M,N=h[T]+M;let L=2;k.queryInterval(C-r,N+r,([,,$])=>{const D=_[$]-I,O=h[T]-h[$],B=r+(d?d[T]+d[$]:2*g),V=Math.sqrt(B*B-O*O);A[L++]=D-V,A[L++]=D+V});let F=A.slice(0,L);y&&(F=F.filter($=>$>=0));t:for(const $ of F.sort(b)){for(let D=0;De(t,r=>n[r]))}const ZOt={mapIndex(e,t,n){const[r,i]=yi(e,o=>t[o]),s=i-r;for(const o of e)n[o]=t[o]===null?NaN:(t[o]-r)/s}},qF=Q3((e,t)=>{for(let n=0;n{for(let n=e.length-1;n>=0;--n){const r=t[e[n]];if(Yi(r))return r}}),tLt={mapIndex(e,t,n){const r=WS(e,s=>t[s]),i=b1(e,s=>t[s]);for(const s of e)n[s]=t[s]===null?NaN:i?(t[s]-r)/i:0}},eLt=um(Vr),nLt=um(WS),rLt=um(xv),iLt=um(Or),sLt=um(ml);function oLt(e,t){return YJ("x",e,t)}function aLt(e,t){return YJ("y",e,t)}function YJ(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(c,u)=>+c+u;else{if(typeof t=="string"){const c=t.startsWith("-")?-1:1;[t,i]=wR(t.replace(/^[+-]/,"")),i*=c}t=E3(t),r=(c,u)=>t.offset(c,u)}const s=`${e}1`,o=`${e}2`,a=Sc({[s]:c=>c.map(u=>r(u,i)),[o]:c=>c},n),l=a[o].transform;return a[o].transform=()=>{const c=l(),[u,f]=yi(c);return c.domain=i<0?[u,r(f,i)]:[r(u,i),f],c},a}function lLt(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return DC(t);case"last":return FC(t)}if(typeof e=="function")return eh(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=cLt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return eh(n,r,t)}function cLt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return BC;case"max":return PC}throw new Error(`unknown selector: ${e}`)}function DC(e){return eh(null,uLt,e)}function FC(e){return eh(null,fLt,e)}function HJ(e){return eh("x",BC,e)}function GJ(e){return eh("y",BC,e)}function XJ(e){return eh("x",PC,e)}function KJ(e){return eh("y",PC,e)}function*uLt(e){yield e[0]}function*fLt(e){yield e[e.length-1]}function*BC(e,t){yield Bxt(e,n=>t[n])}function*PC(e,t){yield fI(e,n=>t[n])}function eh(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}const r=bh(n);return Rl(n,(i,s)=>{const o=cn(i,r),a=cn(i,e),l=[];for(const c of s){const u=[];for(const f of o?hh(c,h=>o[h]).values():[c])for(const h of t(f,a))u.push(h);l.push(u)}return{data:i,facets:l}})}yr.prototype.plot=function({marks:e=[],...t}={}){return fC({...t,marks:[...e,this]})};const hLt=Object.freeze(Object.defineProperty({__proto__:null,Area:H3,Arrow:XK,BarX:_C,BarY:wC,Cell:G3,Contour:dJ,Density:mJ,Dot:X3,Frame:DK,Geo:bJ,Hexgrid:_J,Image:wJ,Line:K3,Link:HK,Mark:yr,Raster:cJ,Rect:Y3,RuleX:zX,RuleY:qX,Text:B3,TickX:eJ,TickY:nJ,Tip:FK,Vector:P3,WaffleX:DJ,WaffleY:FJ,area:VM,areaX:Xv,areaY:Cg,arrow:R7t,auto:q7t,autoSpec:KK,axisFx:fK,axisFy:uK,axisX:rC,axisY:nC,barX:sd,barY:od,bin:Xh,binX:wf,binY:xf,bollinger:Sd,bollingerX:a$t,bollingerY:l$t,boxX:u$t,boxY:f$t,cell:E0,cellX:$7t,cellY:O7t,centroid:vJ,circle:B7t,cluster:IOt,column:Bo,contour:E$t,crosshair:T$t,crosshairX:M$t,crosshairY:I$t,delaunayLink:q$t,delaunayMesh:j$t,density:G$t,differenceX:J$t,differenceY:Z$t,dodgeX:YOt,dodgeY:HOt,dot:xh,dotX:D7t,dotY:F7t,filter:zRt,find:nCt,formatIsoDate:AX,formatMonth:b8t,formatNumber:SX,formatWeekday:_8t,frame:uC,geo:NC,geoCentroid:Q$t,graticule:nOt,gridFx:yK,gridFy:gK,gridX:mK,gridY:pK,group:DR,groupX:qv,groupY:jv,groupZ:LR,hexagon:P7t,hexbin:rOt,hexgrid:oOt,hull:V$t,identity:de,image:fOt,indexOf:vi,initializer:gs,interpolateNearest:MC,interpolateNone:HM,interpolatorBarycentric:TC,interpolatorRandomWalk:IC,legend:_Nt,line:J3,lineX:Kv,lineY:Jv,linearRegressionX:bOt,linearRegressionY:_Ot,link:GK,map:Sc,mapX:SC,mapY:AC,marks:za,normalize:LC,normalizeX:KOt,normalizeY:JOt,numberInterval:LG,plot:fC,pointer:L3,pointerX:D3,pointerY:Gv,raster:d$t,rect:cC,rectX:O2,rectY:L2,reverse:qRt,ruleX:Qf,ruleY:th,scale:Yv,select:lLt,selectFirst:DC,selectLast:FC,selectMaxX:XJ,selectMaxY:KJ,selectMinX:HJ,selectMinY:GJ,shiftX:oLt,shiftY:aLt,shuffle:jRt,sort:jG,sphere:eOt,spike:lNt,stackX:RK,stackX1:ENt,stackX2:kNt,stackY:CK,stackY1:TNt,stackY2:MNt,text:Mg,textX:YX,textY:HX,tickX:rJ,tickY:iJ,timeInterval:xR,tip:BK,transform:Rl,tree:OJ,treeLink:AJ,treeNode:GM,utcInterval:w3,valueof:cn,vector:rK,vectorX:iK,vectorY:sK,voronoi:W$t,voronoiMesh:Y$t,waffleX:OOt,waffleY:LOt,window:Z3,windowX:X7t,windowY:K7t},Symbol.toStringTag,{value:"Module"})),dLt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorPercent","color.percent"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rLabel","r.label"],["rPercent","r.percent"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthPercent","length.percent"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function pLt(e,t,n){for(let r=0;r{const s=n[i];if(s===L1){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);const o=i.slice(0,-6),a=t.scale(o);a?.domain&&e.setAttribute(i,n[`${o}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${s}`)})}function _Lt(e,t){const{marks:n}=t;z_("x",e,n),z_("y",e,n),z_("fx",e,n),z_("fy",e,n)}function z_(e,t,n){const r=t[e]||{};if(r.axis===null||r.label!==void 0)return;const i=n.map(o=>o.channelField(e)?.field);if(i.every(o=>o==null))return;let s;for(let o=0;othis.render())),this.synch.promise}async render(){this.pendingRender=!1;const t=await vLt(this),n=this.legends.flatMap(({legend:r,include:i})=>{const s=r.init(t);return i?s:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return XU(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){const r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){const{params:r}=this;for(const i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(s=>s.initialize()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}}function ELt(e,t,n){const r=e.getAttribute("aspectRatio");if(r==null)return;const i=e.getAttribute("xDomain"),s=e.getAttribute("yDomain");if(!i||!s)return;const o=Math.abs(i[1]-i[0]);return Math.abs(s[1]-s[0])*e.innerWidth()/(r*o)+t+n}function ZJ(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Gf(e)!==null)}const kLt=new Set(["offset","order","reverse","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target","select"]);function TLt(e){return kLt.has(e)}const MLt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function ILt(e){return MLt.has(`${e}`.toLowerCase())}const QJ=e=>e==="stroke"||e==="fill",RLt=e=>/opacity$/i.test(e),CLt=e=>e==="symbol",NLt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),cT=(e,t)=>({channel:e,field:t,as:ES(t)&&!omt(t)?t.column:e}),uT=(e,t)=>({channel:e,value:t}),e5=e=>Array.isArray(e);let Sh=class extends ch{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n;const s=this.channels=[],o=this.detail=new Set,a=this.params=new Set;e5(n)?this.data=Bd(n):Ra(n?.table)&&a.add(n.table);const l=(c,u)=>{const f=typeof u;if(c==="channels")for(const h in u)o.add(h),l(h,u[h]);else if(f==="function"&&u[CY]){const h=u(this,c);for(const d in h)l(d,h[d])}else if(f==="string")TLt(c)||QJ(c)&&ZJ(u)||CLt(c)&&ILt(u)?s.push(uT(c,u)):s.push(cT(c,Mt(u)));else if(f1(u)){const h=uT(c,u.value);s.push(h),u.addEventListener("value",d=>(h.value=d,this.update()))}else dc(u)?(Kyt(u).forEach(h=>a.add(h)),s.push(cT(c,u))):f==="object"&&NLt(c,u)?s.push(cT(c,u)):u!==void 0&&s.push(uT(c,u))};for(const c in r)l(c,r[c])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}sourceTable(){const t=this.source?.table;return t?Ra(t)?t.value:t:null}hasOwnData(){return this.source==null||e5(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){const r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r:null}async prepare(){if(this.hasOwnData())return null;const{channels:t,reqs:n}=this,r=new Map;for(const{channel:a,field:l}of t){if(!l)continue;const c=l.stats?.stats||[],u=l.stats?.column??l,f=r.get(u)??r.set(u,new Set).get(u);c.forEach(h=>f.add(h)),n[a]?.forEach(h=>f.add(h))}const i=this.sourceTable(),s=await rI(this.coordinator,Array.from(r,([a,l])=>({table:i,column:a,stats:Array.from(l)}))),o=Object.fromEntries(s.map(a=>[a.column,a]));for(const a of this.channels){const{field:l}=a;l&&Object.assign(a,o[l.stats?.column??l])}this._fieldInfo=!0}query(t=[]){return this.hasOwnData()?null:UC(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Bd(t),this}update(){return this.plot.update(this)}plotSpecs(){const{type:t,data:n,detail:r,channels:i}=this;return tZ(t,r,i,n)}};function pa(e,t){const n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:QJ(e.channel)?{value:n,scale:"color"}:RLt(e.channel)?{value:n,scale:"opacity"}:n}function UC(e,t,n=[]){const r=zt.from({source:t}),i=new Set;let s=!1;for(const o of e){const{channel:a,field:l,as:c}=o;if(!n.includes(a)){if(a==="orderby")r.orderby(o.value??l);else if(l){if(uh(l))s=!0;else{if(i.has(c))continue;i.add(c)}r.select({[c]:l})}}}return s&&r.groupby(Array.from(i)),r}function tZ(e,t,n,r,i={}){const{numRows:s,values:o,columns:a}=r??{},l={};for(const f of n){const h=t.has(f.channel)?l:i;h[f.channel]=pa(f,a)}return t.size&&(i.channels=l),[{type:e,data:o??(r?{length:s}:null),options:i}]}function z2(e,t){const{plot:n}=e;let r=n.getAttribute(`${t}Scale`);if(!r){const{type:s}=e.channelField(t);r=s==="date"?"time":"linear"}const i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return E6(i)}function nh(e,t,n,r,i=1,s){const{field:o}=e.channelField(t);s=s??o;const{type:a,apply:l,sqlApply:c}=z2(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,h]=r.map(y=>l(y)),d=c(s),g=a==="time"||a==="utc"?d:s;return[svt(d,f,h,n-i,u),g]}const eZ={x:["min","max"]},nZ={y:["min","max"]},rZ={...eZ,...nZ};function iZ(e,t,n,r,i){const{plot:s}=e,o=s.getAttribute(r),a=s.getAttribute(i);if(Array.isArray(o)&&!o[_l])return o;{const{column:l,min:c,max:u}=e.channelField(n),f=sZ(t,l)||(a?zu().domain([c,u]).nice().domain():[c,u]);return o!==L1&&(f[_l]=!0),s.setAttribute(r,f,{silent:!0}),f}}function nb(e,t){return iZ(e,t,"x","xDomain","xNice")}function rb(e,t){return iZ(e,t,"y","yDomain","yNice")}function sZ(e,t){if(!e)return;let n,r;return[e].flat().forEach(i=>Ld(i,s=>{if(s instanceof SU&&`${s.expr}`===t){const o=(s.extent??[]).map(a=>a?.value??a);(n==null||o[0]r)&&(r=o[1])}})),n!=null&&r!=null&&n!==r?[n,r]:void 0}class $Lt extends Sh{constructor(t,n,r){const i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,s=i?{[i]:["count","min","max"]}:void 0;super(t,n,r,s),this.dim=i}query(t=[]){const{plot:n,dim:r,source:i}=this;let s=i.options?.optimize;const o=super.query(t);if(!r)return o;const a=r==="x"?"y":"x",l=this.channelField(a,{exact:!0})?.as,{field:c,as:u,type:f,count:h,min:d,max:g}=this.channelField(r),y=f==="date"||f==="number",v=r==="x"?n.innerWidth():n.innerHeight();if(s??=h/v>10,s&&y&&l){const[b,_]=sZ(t,c)||[d,g],[w]=nh(this,r,v,[b,_],1,u),S=o._select.map(k=>k.alias).filter(k=>k!==u&&k!==l);return Avt(o,w,u,l,S)}else return o.orderby(u)}}function n5(e,t=[]){return new t.constructor(e)}function OLt(e,t,n,r,i){const s=t.length,o={},a=[];if(i?.length){const l=new Int32Array(s),c=i.map(h=>r[h]),u={};for(let h=0;hg[h]);l[h]=u[d]??=a.push(d)-1}for(let h=0;hd[h]);const f=o._grid=a.map(()=>n5(e,n));for(let h=0;hr[d]),u={},f=[],h=new Int32Array(a);if(s?.length){const d=s.map(y=>r[y]),g={};for(let y=0;yb[y]);h[y]=g[v]??=f.push(v)-1}for(let y=0;yv[y])}else f.push([]);if(o){const d=n.map(v=>v%e),g=n.map(v=>Math.floor(v/e)),y=f.map(()=>[]);for(let v=0;v{const _=c[b];u[v]=f.map((w,S)=>o(y[S],e,t,d,g,_))})}else i.forEach((d,g)=>{const y=c[g],v=u[d]=f.map(()=>n5(l,y));for(let b=0;b{const i=r.length;for(let s=0;sn&&(n=o)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function DLt(e){const t=new Gg;return e.forEach(n=>{const r=n.length;for(let i=0;i0;d-=2)f[d]+=c[g]*f[d-2]-c[g+1]*f[d-1],f[d+1]+=c[g]*f[d-1]+c[g+1]*f[d-2];for(d=0;d<=g;d+=2)f[d]+=i[g]*h[d]-i[g+1]*h[d+1],f[d+1]+=i[g]*h[d+1]+i[g+1]*h[d];for(h[g+2]=c[g]*h[g]-c[g+1]*h[g+1],h[g+3]=c[g]*h[g+1]+c[g+1]*h[g],d=g;d>0;d-=2)h[d]+=c[g]*h[d-2]-c[g+1]*h[d-1],h[d+1]+=c[g]*h[d-1]+c[g+1]*h[d-2]}for(g=0;g<4;++g)d=g<<1,t[g]=f[d]/u,e[g+1]=h[d+2]}function BLt(e,t,n,[r,i]){const s=new Float64Array(Math.max(r,i)),o=new Float64Array(Math.max(r,i)),a=new Float64Array(5),l=new Float64Array(n.length);for(let c=0,u=0;c=0&&g(this.bandwidth=h,this.grids?this.convolve().update():null)),this.interpolate=ns(s,h=>(this.interpolate=h,this.requestUpdate())),this.pixelSize=ns(o,h=>(this.pixelSize=h,this.requestUpdate())),this.pad=ns(a,h=>(this.pad=h,this.requestUpdate())),this.width=ns(l,h=>(this.width=h,this.requestUpdate())),this.height=ns(c,h=>(this.height=h,this.requestUpdate()))}setPlot(t,n){const r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterStable(){const t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[_l]&&!n[_l]}query(t=[]){const{interpolate:n,pad:r,channels:i,densityMap:s}=this,[o,a]=this.extentX=nb(this,t),[l,c]=this.extentY=rb(this,t),[u,f]=this.bins=this.binDimensions(),[h,d]=nh(this,"x",u,[o,a],r),[g,y]=nh(this,"y",f,[l,c],r),v=r?[$s(d,[+o,+a]),$s(y,[+l,+c])]:[oc(+o,d),gi(d,+a),oc(+l,y),gi(y,+c)],b=zt.from(this.sourceTable()).where(t.concat(v)),_=this.groupby=[],w={};for(const k of i)if(Object.hasOwn(k,"field")){const{as:A,channel:T,field:M}=k;uh(M)?(w[T]=M,s[T]=!0):T==="weight"?w[Wl]=Er(M):T!=="x"&&T!=="y"&&(b.select({[A]:M}),_.push(A))}const S=this.aggr=Object.keys(w);if(w.density&&S.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(S.length||(S.push(Wl),w[Wl]=ar()),n==="linear"){if(S.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w[Wl])throw new Error("Linear binning not applicable to custom aggregates.");const k=A6(w[Wl])[0];return xvt(b,h,g,k,u,_)}else return ovt(b,h,g,w,u,_)}binDimensions(){const{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){const[n,r]=this.bins,i=zLt(this.interpolate),{columns:s}=Bd(t);return this.grids0=LLt(n,r,s.index,s,this.aggr,this.groupby,i),this.convolve()}convolve(){const{aggr:t,bandwidth:n,bins:r,grids0:i,plot:s}=this;if(this.grids=i,n>0){const o=t.length===1?t[0]:t.includes(Wl)?Wl:null;if(!o)return console.warn("No compatible grid found for smoothing."),this;const a=i.columns[o],l=s.innerWidth(),c=s.innerHeight(),[u,f]=r,h=a.some(y=>y.some(v=>v<0)),d=r5(n*(u-1)/l,h),g=r5(n*(f-1)/c,h);this.grids={numRows:i.numRows,columns:{...i.columns,[o]:a.map(y=>BLt(d,g,y,r))}}}return this}}function ULt(e){const t={};for(const n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function zLt(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return MC;case"barycentric":return TC();case"random-walk":return IC()}throw new Error(`invalid interpolate: ${e}`)}class qLt extends tA{constructor(t,n){const{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=ns(r,s=>(this.thresholds=s,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){const{bins:t,densityMap:n,grids:r,thresholds:i,plot:s}=this,{numRows:o,columns:a}=r;let l=i,c;if(Array.isArray(l))c=l;else{const[,N]=zC(a.density);c=Array.from({length:l-1},(L,F)=>N*(F+1)/l)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);const[u,f]=t,[h,d]=s.getAttribute("xDomain"),[g,y]=s.getAttribute("yDomain"),v=(d-h)/u,b=(y-g)/f,_=+h,w=+g,S=N=>_+N*v,k=N=>w+N*b,A=Jx().size(t),T=this.contourData=Array(o*c.length),{density:M,...I}=a,C=Object.entries(I);for(let N=0,L=0;N(D[O]=B[N],D),{});for(let D=0;Dn)}function oZ(e,t){const n=t.reduce((i,s,o)=>(i[s]=o,i),{}),r=qC(e.length);return r.sort((i,s)=>n[e[i]]-n[e[s]]),r}function aZ(e,t){if(typeof document<"u"){const n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function VLt(e=1){const t=255*e|0;return(n,r,i)=>{for(let s=0,o=0;s{for(let o=0,a=0;o{for(let c=0,u=0;c{if(u.map)for(let f=0,h=0;f{for(let u=0,f=0;u{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){const{bins:t,grids:n}=this,[r,i]=t,{numRows:s,columns:o}=n,{canvas:a,ctx:l,img:c}=QLt(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=lZ(this),g=o[f]??[],y=o[d]??[],v=s>1&&d&&this.groupby?.includes(d)?oZ(y,this.plot.getAttribute("colorDomain")):qC(s);return this.data={numRows:s,columns:{src:Array.from({length:s},(b,_)=>(h?.(c.data,r,i,y[v[_]]),u?.(c.data,r,i,g[v[_]]),l.putImageData(c,0,0),a.toDataURL()))}},this}plotSpecs(){const{type:t,plot:n,data:{numRows:r,columns:i}}=this,s={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:s}]}}class XLt extends jC{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}}function lZ(e){const{aggr:t,densityMap:n,groupby:r,plot:i}=e,s=t.includes(Wl),o=t.includes("fillOpacity"),a=e.channel("fill"),l=e.channel("fillOpacity");if(t.length>2||s&&o)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(l?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");const c=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":ZJ(a?.value)?a.value:s&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof l?.value=="number"?l.value:s&&c!=="grid"?"grid":void 0;if(c!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");const f=a?.as??(c==="grid"?Wl:null),h=l?.as??(u==="grid"?Wl:null),d=c!=="grid"&&c!=="group"?YLt(c):JLt(e,f),g=u!=="grid"?VLt(u):KLt(e,h);return{alphaProp:h,colorProp:f,alpha:g,color:d}}function KLt(e,t){const{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),s=i===L1,o=i?.[_l],a=!s&&!o&&i||zC(r.columns[t]);(s||o||!i)&&(s||(a[_l]=!0),n.setAttribute("opacityDomain",a));const l=Yv({opacity:{type:n.getAttribute("opacityScale"),domain:a,range:n.getAttribute("opacityRange"),clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return WLt(l)}function JLt(e,t){const{plot:n,grids:r}=e,i=r.columns[t],s=!i[0]?.map,o=s||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),l=a===L1,c=a?.[_l],u=!l&&!c&&a||(s?i.slice().sort(Hn):o?DLt(i):zC(i));(l||c||!a)&&(l||(u[_l]=!0),n.setAttribute("colorDomain",u));const f=Yv({color:{type:n.getAttribute("colorScale"),domain:u,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(o)return HLt(f);{const h=Yv({x:{type:ZLt(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return GLt(1024,f,h.apply)}}function ZLt(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function QLt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){const r=aZ(t,n),i=r.getContext("2d",{willReadFrequently:!0}),s=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:s,w:t,h:n}}return e.image}class tDt extends jC{constructor(t,n){const{normalize:r=!0,...i}=n;super(t,i),this.normalize=ns(r,s=>(this.normalize=s,this.requestUpdate()))}query(t=[]){const{channels:n,normalize:r,pad:i}=this,[s,o]=this.bins=this.binDimensions(),[a]=nh(this,"x",s,nb(this,t),i),[l]=nh(this,"y",o,rb(this,t),i),c=zt.from(this.sourceTable()).where(eDt(this,t));this.aggr=["density"];const u=this.groupby=[],f=[];for(const h of n)if(Object.hasOwn(h,"field")){const{channel:d,field:g}=h;d==="z"?(c.select({[d]:g}),f.push("z")):d!=="x"&&d!=="y"&&(c.select({[d]:g}),u.push(d))}return Svt(c,a,l,f,s,o,u,r)}}function eDt(e,t){if(Array.isArray(t)&&!t.length)return t;const n=e.channelField("x").column,r=e.channelField("y").column,i=o=>{const a=`${o.expr}`;return o.type!=="BETWEEN"||a!==n&&a!==r},s=o=>o.op==="AND"?Di(o.clauses.filter(a=>i(a))):o;return Array.isArray(t)?t.filter(o=>i(o)).map(o=>s(o)):s(t)}const nDt={fill:1,stroke:1,z:1};class cZ extends Sh{constructor(t,n,r){const{bins:i=1024,bandwidth:s=20,normalize:o=!1,stack:a=!1,...l}=r,c=t.endsWith("X")?"y":"x";super(t,n,l,c==="x"?eZ:nZ),this.dim=c,this.bins=ns(i,u=>(this.bins=u,this.requestUpdate())),this.bandwidth=ns(s,u=>(this.bandwidth=u,this.grids?this.convolve().update():null)),this.normalize=ns(o,u=>(this.normalize=u,this.convolve().update())),this.stack=ns(a,u=>(this.stack=u,this.update()))}get filterStable(){const t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[_l]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");const{bins:n,channels:r,dim:i}=this,s=this.extent=(i==="x"?nb:rb)(this,t),[o,a]=nh(this,i,n,s),l=UC(r,this.sourceTable(),[i]).where(t.concat($s(a,s))),c=this.channelField("weight")?"weight":null,u=this.groupby=r.flatMap(f=>nDt[f.channel]&&f.field?f.as:[]);return wvt(l,o,c,u)}queryResult(t){const n=Bd(t).columns;return this.grids=OLt(this.bins,n.index,n.density,n,this.groupby),this.convolve()}convolve(){const{bins:t,bandwidth:n,normalize:r,dim:i,grids:s,groupby:o,plot:a,extent:[l,c]}=this,u=s.columns,f=s.numRows,h=this.channelField(i).as,d=i==="x"?"y":"x",g=i==="x"?a.innerWidth():a.innerHeight(),y=u._grid.some(T=>T.some(M=>M<0)),v=r5(n*(t-1)/g,y),b=+l,_=(c-b)/(t-1),w=t*f,S=new Float64Array(w),k=new Float64Array(w),A=o.reduce((T,M)=>(T[M]=Array(w),T),{});for(let T=0,M=0;MA[L].fill(u[L][M],T,T+t));const I=u._grid[M],C=i5(v,I,t),N=1/rDt(I,C,_,r);for(let L=0;La.apply(v)),[f,h]=i.map(v=>l.apply(v)),d=(u-c)/(s-n),g=(h-f)/(o-n),y=n?0:.5;return this.data=sDt(this.grids,t,c,f,d,g,a.invert,l.invert,y),this}plotSpecs(){const{type:t,channels:n,densityMap:r,data:{numRows:i,columns:s}}=this,o={};for(const a of n){const{channel:l}=a;o[l]=l==="x"||l==="y"?s[l]:pa(a,s)}for(const a in r)r[a]&&(o[a]=s.density);return[{type:t,data:{length:i},options:o}]}}function sDt(e,t,n,r,i,s,o,a,l){const c=1/(i*s),[u,f]=t,h=u*f,d=h*e.numRows,g=new Float64Array(d),y=new Float64Array(d),v=new Float64Array(d),b={x:g,y,density:v},{density:_,...w}=e.columns;for(const k in w)b[k]=new w[k].constructor(d);let S=0;for(let k=0;k=1)return 1;for(a=Math.log(t/(t+n)),l=Math.log(n/(t+n)),c=Math.exp(t*a)/t,u=Math.exp(n*l)/n,d=c+u,e=1&&(h=.5*(h+c+1)),Math.abs(c)0)break}return h}function aDt(e,t,n){var r=e===0||e===1?0:Math.exp(H0(t+n)-H0(t)-H0(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*jF(e,t,n)/t:1-r*jF(1-e,n,t)/n}function jF(e,t,n){var r=1e-30,i=1,s=t+n,o=t+1,a=t-1,l=1,c=1-s*e/o,u,f,h,d;for(Math.abs(c).5?n:-n}function cDt(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}class uZ extends Sh{constructor(t,n,r){const i=t.endsWith("X")?"y":"x",{ci:s=.95,...o}=r;super(t,n,o),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=ns(s,a=>(this.ci=a,this.update()))}query(t=[]){const{channels:n,field:r}=this,i=n.concat([{field:CS(r),as:"__avg__"},{field:hr(NU(r),uv(ar(r))),as:"__se__"}]);return UC(i,this.sourceTable()).where(t)}queryResult(t){return this.data=Bd(t),this}plotSpecs(){const{type:t,dim:n,detail:r,data:i,ci:s,channels:o}=this,a=Math.SQRT2*cDt(s),{columns:{__avg__:l,__se__:c}}=i,u={[`${n}1`]:l.map((f,h)=>f-a*c[h]),[`${n}2`]:l.map((f,h)=>f+a*c[h])};return tZ(t,r,o,i,u)}}const uDt="geom";class fDt extends Sh{constructor(t,n={},r){!e5(t)&&!n?.geometry&&(n.geometry=LU(uDt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);const n=this.channelField("geometry")?.as;if(n){const{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}}class hDt extends Sh{constructor(t,n){const{type:r="hexagon",binWidth:i=20,...s}=n;super(r,t,{r:i/2,clip:!0,...s},rZ),this.binWidth=ns(i,o=>(this.binWidth=o,this.requestUpdate()))}get filterStable(){const t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[_l]&&!n[_l]}query(t=[]){if(this.hasOwnData())return null;const{plot:n,binWidth:r,channels:i}=this;let s,o;const a=new Set,l={};for(const C of i)if(C.channel!=="orderby"){if(C.channel==="x")s=C;else if(C.channel==="y")o=C;else if(Object.hasOwn(C,"field")){const{as:N,field:L}=C;l[N]=L,uh(L)||a.add(N)}}const[c,u]=nb(this,t),[f,h]=rb(this,t),d=.5-n.getAttribute("marginLeft"),g=0-n.getAttribute("marginTop"),y=ks(r),v=ks(r*(1.5/Math.sqrt(3))),b=ks(n.innerWidth()/(u-c)),_=ks(n.innerHeight()/(h-f)),w="_x",S="_y",k="_px",A="_py",T="_pi",M="_pj",I="_tt";return zt.select({[s.as]:er(ks(c),hr(er(Ue(er(w,Ue(.5,qE(S,1))),y),d),b)),[o.as]:Pe(ks(h),hr(er(Ue(S,v),g),_)),...l}).groupby(w,S,...a).from(zt.select({[A]:hr(Pe(Ue(_,Pe(h,o.field)),g),v),[M]:Si(fv(A)),[k]:Pe(hr(Pe(Ue(b,Pe(s.field,c)),d),y),Ue(.5,qE(M,1))),[T]:Si(fv(k)),[I]:Di(ba(Ue(Ss(Pe(A,M)),3),1),ba(er(os(Pe(k,T),2),os(Pe(A,M),2)),er(os(Pe(Pe(k,T),Ue(.5,eo(gi(k,T),-1,1))),2),os(Pe(Pe(A,M),eo(gi(A,M),-1,1)),2)))),[w]:eo(I,Si(er(er(T,eo(gi(k,T),-.5,.5)),eo(h1(qE(M,1),0),.5,-.5))),T),[S]:eo(I,Si(er(M,eo(gi(A,M),-1,1))),M)},"*").from(this.sourceTable()).where(pc(s.field),pc(o.field),t))}}class dDt extends tA{constructor(t,n){const{origin:r=[0,0],dim:i="xy",...s}=n;super("image",t,s),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){const r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){const{interpolate:n,pad:r,channels:i,densityMap:s}=this,[[o,a],[l,c]]=t,[u,f]=this.bins,[h,d]=nh(this,"x",u,[o,a],r),[g,y]=nh(this,"y",f,[l,c],r),v=r?[$s(d,[+o,+a]),$s(y,[+l,+c])]:[oc(+o,d),gi(d,+a),oc(+l,y),gi(y,+c)],b=zt.from(this.sourceTable()).where(v),_=this.groupby=[],w={};for(const k of i)if(Object.hasOwn(k,"field")){const{as:A,channel:T,field:M}=k;M.aggregate?(w[T]=M,s[T]=!0):T==="weight"?w.density=Er(M):T!=="x"&&T!=="y"&&(b.select({[A]:M}),_.push(A))}const S=this.aggr=Object.keys(w);if(w.density&&S.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(S.length||(S.push("density"),w.density=ar()),n==="linear"){if(S.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return vDt(b,h,g,w.density,u,_)}else return yDt(b,h,g,w,u,_)}async requestTiles(){const t=Va();this.prefetch&&t.cancel(this.prefetch);const{pad:n,tileX:r,tileY:i,origin:[s,o]}=this,[a,l]=this.bins=this.binDimensions(),[c,u]=nb(this,this._filter),[f,h]=rb(this,this._filter),d=u-c,g=h-f,y=Math.floor((c-s)*(a-n)/d),v=Math.floor((f-o)*(l-n)/g),b=(N,L)=>[[s+N*d,s+(N+1)*d],[o+L*g,o+(L+1)*g]],_=Math.floor((c-s)/d),w=r?VF((u-s)/d):_,S=Math.floor((f-o)/g),k=i?VF((h-o)/g):S,A=[];for(let N=_;N<=w;++N)for(let L=S;L<=k;++L)A.push([N,L]);const T=A.map(([N,L])=>t.query(this.tileQuery(b(N,L)))),M=[];if(r)for(let N=S;N<=k;++N)M.push([w+1,N]),M.push([_-1,N]);if(i){const N=r?_-1:_,L=r?w+1:w;for(let F=N;F<=L;++F)M.push([F,k+1]),M.push([F,S-1])}this.prefetch=M.map(([N,L])=>t.prefetch(this.tileQuery(b(N,L))));const I=await Promise.all(T),C=pDt(a,l,y,v,A,I);this.grids0={numRows:C.length,columns:{density:[C]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){const{bins:t,grids:n}=this,[r,i]=t,{numRows:s,columns:o}=n,{canvas:a,ctx:l,img:c}=mDt(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=lZ(this),g=o[f]??[],y=o[d]??[],v=s>1&&d&&this.groupby?.includes(d)?oZ(y,this.plot.getAttribute("colorDomain")):qC(s);return this.data={numRows:s,columns:{src:Array.from({length:s},(b,_)=>(h?.(c.data,r,i,y[v[_]]),u?.(c.data,r,i,g[v[_]]),l.putImageData(c,0,0),a.toDataURL()))}},this}plotSpecs(){const{type:t,plot:n,data:{numRows:r,columns:i}}=this,s={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:s}]}}function pDt(e,t,n,r,i,s){const o=new Float64Array(e*t);return s.forEach((a,l)=>{const[c,u]=i[l],f=c*e-n,h=u*t-r;gDt(e,t,o,a,f,h)}),o}function gDt(e,t,n,r,i,s){const o=r.numRows;if(o===0)return;const a=r.getChild("index").toArray(),l=r.getChild("density").toArray();for(let c=0;ce.clone().select({xp:t,yp:n,i:h,w:d}),l=a(ee`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,ee`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${o}`),c=a(ee`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,ee`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${o}`),u=a(ee`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,ee`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${o}`),f=a(ee`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,ee`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${o}`);return zt.from(zt.unionAll(l,c,u,f)).select({index:"i",density:Er("w")},s).groupby("index",s).having(h1("density",0))}function VF(e){const t=Math.floor(e);return t===e?t-1:t}class bDt extends Sh{constructor(t,n){const{ci:r=.95,precision:i=4,...s}=n;super("line",t,s);const o=()=>this.modelFit?this.confidenceBand().update():null;this.ci=ns(r,a=>(this.ci=a,o())),this.precision=ns(i,a=>(this.precision=a,o()))}query(t=[]){const n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(s=>this.channelField(s)?.as||[])));return zt.from(super.query(t)).select({intercept:Hmt(r,n),slope:Kmt(r,n),n:CU(r,n),ssy:Xmt(r,n),ssx:Gmt(r,n),xm:RU(r,n),x0:ks(gl(n).where(pc(r))),x1:ks(Da(n).where(pc(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Bd(t),this.lineData=_Dt(this.modelFit),this.confidenceBand()}confidenceBand(){const{ci:t,modelFit:n,precision:r,plot:i}=this,s=i.innerWidth();return this.areaData=t?wDt(n,t,r,s):null,this}plotSpecs(){const{lineData:t,areaData:n,channels:r,ci:i}=this,s=t.columns,o=i?n.columns:{},a={x:s.x,y:s.y},l={x:o.x,y1:o.y1,y2:o.y2,fillOpacity:.1};for(const c of r)switch(c.channel){case"x":case"y":case"fill":break;case"tip":l.tip=pa(c,o);break;case"stroke":a.stroke=pa(c,s),l.fill=pa(c,o);break;case"strokeOpacity":a.strokeOpacity=pa(c,s);break;case"fillOpacity":l.fillOpacity=pa(c,o);break;default:a[c.channel]=pa(c,s),l[c.channel]=pa(c,o);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:l}]:[],{type:"line",data:{length:t.numRows},options:a}]}}function fT(e,t){if(e.concat)return e.concat(t);const n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function _Dt(e){const{x0:t=[],x1:n=[],xm:r,intercept:i,slope:s,n:o,ssx:a,ssy:l,...c}=e.columns,u=(d,g)=>i[g]+d*s[g],f=fT(t,n),h=fT(t.map(u),n.map(u));for(const d in c)c[d]=fT(c[d],c[d]);return{numRows:f.length,columns:{x:f,y:h,...c}}}function wDt(e,t,n,r){const i=e.numRows,{x0:s,x1:o,xm:a,intercept:l,slope:c,n:u,ssx:f,ssy:h,...d}=e.columns,g=Object.keys(d),y={x:[],y1:[],y2:[]};g.forEach(v=>y[v]=[]);for(let v=0;v{const S=l[v]+w*c[v],k=_*Math.sqrt(1/u[v]+(w-a[v])**2/f[v]);y.x.push(w),y.y1.push(S-k),y.y2.push(S+k),g.forEach(A=>y[A].push(d[A][v]))})}return{numRows:y.x.length,columns:y}}function VC(e){e.tagName==="a"&&(e=e.children[0]);const t=e.__data__;return Array.isArray(t)?t[0]:t}function xDt(e){const t=e.toLowerCase(),n=e.length;let r="";for(let i=0;ithis.update()))}init(t){this.svg=t;const n=this.values=[],i=`g[data-index="${this.mark.index}"]`,s=`${i} > *:not(g), ${i} > g > *`,o=this.nodes=t.querySelectorAll(s),{channels:a}=this;for(let l=0;lc.getAttribute(u[0])))}return this.update()}async update(){const{svg:t,nodes:n,channels:r,values:i,mark:s,selection:o}=this;if(!t)return;const a=await EDt(s,o);for(let l=0;l!0;const r=e.filterBy?.predicate(e,!0),i={__:Di(n)},s=e.query(r);(s.queries||[s]).forEach(l=>{l._groupby.length?l.select(i):l.setSelect(i)});const o=await e.coordinator.query(s),a=o.getChild?.("__");return o.numRows||o.length?a?l=>a.at(l):l=>o[l].__:()=>!1}function fZ(){const e=this,t=e.getScreenCTM;let n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}function WC(e){const t=e.on;let n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){const s=i[1];i[1]=(...o)=>n&&s(...o)}return t(...i)},e}function hZ(){return WC(u5t())}function kDt(){return WC(l5t())}function TDt(){return WC(c5t())}function dZ(e,t,n,r,i){let s=Ar(t??e).append("g").attr("class",i);const o=e.scale("fx"),a=e.scale("fy");if(o||a){const l=o?.domain.map(u=>o.apply(u)-n),c=a?.domain.map(u=>a.apply(u)-r);if(l&&c)for(let u=0;u{const s=i==="color"?["color","fill","stroke"]:i==="x"?["x","x1","x2"]:i==="y"?["y","y1","y2"]:[i];for(let o=0;othis.publish(l))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>o5(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),s5(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){const{mark:n,pixelSize:r,field:i,scale:s}=this;return nI(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:s,pixelSize:r})}init(t,n){const{brush:r,channel:i,style:s}=this;this.scale=t.scale(i);const o=this.value?.map(this.scale.apply).sort(Hn),a=t.scale("x").range,l=t.scale("y").range;if(r.extent([[Or(a),Or(l)],[Vr(a),Vr(l)]]),this.g=dZ(t,n,Or(a),Or(l),`interval-${i}`).call(r).call(r.moveSilent,o),s){const c=this.g.selectAll("rect.selection");for(const u in s)c.attr(u,s[u])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}}class IDt{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:s=1,peers:o=!0,brush:a}){this.mark=t,this.pixelSize=s||1,this.selection=n,this.peers=o,this.xfield=r||Ng(t,"x"),this.yfield=i||Ng(t,"y"),this.style=a&&eA(a),this.brush=hZ(),this.brush.on("brush end",({selection:l})=>this.publish(l))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){const{value:n,pixelSize:r,xscale:i,yscale:s}=this;let o,a;if(t){const[l,c]=t;o=[l[0],c[0]].map(u=>o5(u,i,r)).sort(Hn),a=[l[1],c[1]].map(u=>o5(u,s,r)).sort(Hn)}(!s5(o,n?.[0])||!s5(a,n?.[1]))&&(this.value=t?[o,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){const{mark:n,pixelSize:r,xfield:i,yfield:s,xscale:o,yscale:a}=this;return Ewt([i,s],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[o,a],pixelSize:r})}init(t){const{brush:n,style:r,value:i}=this,s=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),a=s.range,l=o.range;if(n.extent([[Or(a),Or(l)],[Vr(a),Vr(l)]]),this.g=dZ(t,null,Or(a),Or(l),"interval-xy").call(n),r){const c=this.g.selectAll("rect.selection");for(const u in r)c.attr(u,r[u])}if(i){const[c,u]=i[0].map(s.apply).sort(Hn),[f,h]=i[1].map(o.apply).sort(Hn);this.g.call(n.moveSilent,[[c,f],[u,h]])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}}class HC{constructor(t,{selection:n,pointer:r,channels:i,fields:s,maxRadius:o=40}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.pointer=r,this.channels=i||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=s||this.channels.map(a=>Ng(t,[a])),this.maxRadius=o,this.valueIndex=-1}clause(t){const{clients:n,fields:r}=this,i={source:this,clients:n};return r.length>1?zS(r,t&&[t],i):kx(r[0],t?.[0],i)}init(t){const n=this,{mark:r,channels:i,selection:s,maxRadius:o}=this,{data:{columns:a}}=r,l=i.map(y=>r.channelField(y).as),c=!Os(s),[u,f]=RDt(t,r),h=this.pointer==="y"?.01:1,d=this.pointer==="x"?.01:1,g=Ar(t);g.on("pointerenter pointerdown pointermove",function(y){const[v,b]=Qa(y,this),_=CDt(u,f,v,b,h,d,o);if(_!==this.valueIndex){this.valueIndex=_;const w=_<0?void 0:l.map(S=>a[S][_]);s.update(c?!w||w.length>1?w:w[0]:n.clause(w))}}),!c&&(g.on("pointerleave",()=>{s.update(n.clause(void 0))}),t.addEventListener("pointerenter",y=>{y.buttons||this.activate()}))}activate(){const t=this.channels.map(()=>0);this.selection.activate(this.clause(t))}}function RDt(e,t){const{data:{columns:n}}=t,r=f=>n[t.channelField(f)?.as],i=f=>e.scale(f),s=e.scale("x"),o=e.scale("y"),a=i("fx")?.apply,l=i("fy")?.apply,c=Array.from(r("x"),s.apply),u=Array.from(r("y"),o.apply);if(a){const f=Or(s.range),h=r("fx");for(let d=0;de-t;class NDt{constructor(t,{x:n=new og,y:r=new og,xfield:i,yfield:s,zoom:o=!0,panx:a=!0,pany:l=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||Ng(t,"x"),this.yfield=s||Ng(t,"y"),this.zoom=hT(o,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&l;const{plot:c}=t;a&&this.xsel.addEventListener("value",u=>{c.setAttribute("xDomain",u)&&c.update()}),l&&this.ysel.addEventListener("value",u=>{c.setAttribute("yDomain",u)&&c.update()})}publish(t){if(this.panx){const n=$Dt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){const n=ODt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return nI(n,t,{source:this,clients:this.mark.plot.markSet,scale:r})}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;const{panx:n,pany:r,mark:{plot:{element:i}}}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");const s=this.xscale.range.slice().sort(YF),o=this.yscale.range.slice().sort(YF),a=hT(n,[-1/0,1/0],s),l=hT(r,[-1/0,1/0],o),c=uRt().extent([[s[0],o[0]],[s[1],o[1]]]).scaleExtent(this.zoom).translateExtent([[a[0],l[0]],[a[1],l[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new rc(1,0,0)).on("zoom",({transform:u})=>this.publish(u));if(Ar(i).call(c),n||r){let u=!1;i.addEventListener("pointerenter",f=>{u||(u=!0,f.buttons||this.activate())}),i.addEventListener("pointerleave",()=>u=!1)}}activate(){if(this.panx){const{xscale:t,xfield:n}=this;this.xsel.activate(this.clause(t.domain,n,t))}if(this.pany){const{yscale:t,yfield:n}=this;this.ysel.activate(this.clause(t.domain,n,t))}}}function hT(e,t,n){return e?Array.isArray(e)?e:t:n}function $Dt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function ODt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}const LDt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},DDt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,FDt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,BDt=/^((\s+,?\s*)|(,\s*))/,PDt=/^[01]/,gZ=e=>`Invalid SVG path, incorrect parameter ${e}`;function UDt(e){const t=[];return(e.match(DDt)||[]).forEach(r=>{let i=r[0];const s=i.toLowerCase(),o=LDt[s],a=zDt(s,o,r.slice(1).trim()),l=a.length;if(l=s&&d<=a&&g>=o&&y<=l)return!0;if(h<=a&&d>=s&&g<=l&&y>=o){let v=r.tagName;if(v==="a"&&(r=r.children[0],v=r.tagName),v==="rect"||v==="text"||v==="image")return!0;switch(s-=c,o-=u,a-=c,l-=u,v){case"circle":return yZ(s,o,a,l,jh(r.cx),jh(r.cy),jh(r.r));case"line":return vZ(s,o,a,l,jh(r.x1),jh(r.y1),jh(r.x2),jh(r.y2));case"path":return jDt(s,o,a,l,r)}}return!1}function jh(e){return e.baseVal.value}function mZ(e){const t=e.transform.baseVal,n=t.length;let r=t[0]?.matrix;for(let i=1;ic)return!1;let u=s,f=a;const h=o-i;if(Math.abs(h)>1e-8){const y=(a-s)/h,v=s-y*i;u=y*l+v,f=y*c+v}const d=Math.max(Math.min(u,f),t),g=Math.min(Math.max(u,f),r);return d<=g}function jDt(e,t,n,r,i){const s=i.__path__||(i.__path__=UDt(i.getAttribute("d")));let o=0,a=0,l=0,c=0,u=!1,f=[0,0],h=2;const d=mZ(i),g=(_,w)=>{f.length=h=2,f[0]=l=o=_,f[1]=c=a=w},y=d?(_,w)=>g(GF(d,_,w),XF(d,_,w)):(_,w)=>g(_,w),v=(_,w)=>(f[h]=_,f[h+1]=w,h+=2,vZ(e,t,n,r,f[h-4],f[h-3],_,w)),b=d?(_,w)=>{u=v(GF(d,l=_,c=w),XF(d,_,w))}:(_,w)=>{u=v(l=_,c=w)};for(let _=0;_0)return!0;y(o,a);break;default:return console.warn("SVG path command not supported: ",w[0]),!1}if(u)return!0}return!1}function GF(e,t,n){return e.a*t+e.c*n+e.e}function XF(e,t,n){return e.b*t+e.d*n+e.f}function VDt(e,t){const n=e[t],r=e[t+1];return r&&r[0]==="a"&&e[t+2]?.[0]==="z"&&n[1]===n[2]&&r[1]===r[2]&&n[1]===r[1]&&n[7]===-r[7]}function WDt(e,t,n){let r=0;const i=n.length-2;for(let s=0;st&&KF(e,t,n,s)>0&&++r:n[s+3]<=t&&KF(e,t,n[s])<0&&--r;return r}function KF(e,t,n,r){return(n[r+2]-n[r])*(t-n[r+1])-(e-n[r])*(n[r+3]-n[r+1])}function bZ(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>a5(n,t[r]))}function a5(e,t){const n=e.length;if(t.length!==n)return!0;for(let r=0;rthis.publish(l.selection)),this.extent=null,this.groups=null;const{fields:o,as:a}=MDt(t,n);this.fields=o,this.as=a}reset(){this.value=void 0,this.extent=null,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}clause(t){const{fields:n,mark:r}=this;return zS(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}publish(t){const{as:n,group:r,mark:i,svg:s}=this;let o;if(t){const{data:{columns:a={}}={}}=i,l=new Map;qDt(s,r,t).forEach(c=>{const u=VC(c),f=n.map(h=>a[h][u]);l.set(f.join("|"),f)}),o=Array.from(l.values())}this.extent=t,bZ(o,this.value)&&(this.value=o,this.selection.update(this.clause(o)))}init(t){const{brush:n,extent:r,mark:i,style:s}=this;this.svg=t;const o=t.width.baseVal.value,a=t.height.baseVal.value;if(n.extent([[0,0],[o,a]]),this.group=t.querySelector(`[data-index="${i.index}"]`),this.g=Ar(t).append("g").attr("class","region-xy").each(fZ).call(n).call(n.moveSilent,r),s){const l=this.g.selectAll("rect.selection");for(const c in s)l.attr(c,s[c])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}}class _Z{constructor(t,{selection:n,channels:r,peers:i=!0}){this.mark=t,this.value=null,this.selection=n,this.peers=i;const s=this.fields=[],o=this.as=[];r.forEach(a=>{const l=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let c=0;cs.map(u=>a[u][VC(c)]),n??=`[data-index="${i.index}"]`;const l=Array.from(t.querySelectorAll(n));t.addEventListener("pointerdown",c=>{const u=o.single?o.value:this.value,f=c.target;let h=null;if(HDt(l,f)){const d=r(f);(c.shiftKey||c.metaKey)&&u?.length?(h=u.filter(g=>a5(g,d)),h.length===u.length&&h.push(d)):u?.length===1&&!a5(u[0],d)?h=null:h=[d]}this.value=h,bZ(u,h)&&o.update(this.clause(h))}),t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}}function HDt(e,t){return e.some(n=>n.contains(t))}const wZ=":scope > div, :scope > span",Aw="swatch",JF="ramp";class ZF{constructor(t,n){const{as:r,field:i,...s}=n;this.channel=t,this.options=s,this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){const n=GDt(this,t);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;const{selection:t,handler:n}=this,{single:r,value:i}=t,s=r?i:t.valueFor(n),o=s&&s.length?new Set(s.map(l=>l[0])):null,a=this.legend.querySelectorAll(wZ);for(const l of a){const c=o?o.has(l.__data__):!0;l.style.opacity=c?1:.2}}}function GDt(e,t){const{channel:n,plot:r,selection:i}=e,s=t.scale(n),o=s.type==="ordinal"?Aw:JF,a={label:r.getAttribute(`${n}Label`)??null,...e.options},l=o===Aw?a:a.label?{tickSize:2,...a}:{tickSize:2,marginTop:1,height:29,...a},c=t.legend(n,l);e.legend=c;let u=!!i;if(u&&o===JF){const f=l.width??240,h=ZDt(s,f);h?c.scale=function(d){return d==="x"?{range:[0,f]}:d==="y"?{range:[-10,0]}:d===n?h:void 0}:u=!1}if(u){const f=XDt(e,o);o===Aw?(f.init(c,wZ,h=>[h.__data__]),e.update()):f.init(c,c.querySelector("g:last-of-type"))}return c}function XDt(e,t){const{channel:n,handler:r,selection:i}=e;if(r)return r;const s=KDt(e);return t===Aw?(e.handler=new _Z(s,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new YC(s,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function KDt(e){const{channel:t,plot:n}=e,r=e.field??JDt(n.marks,t)??"value";if(r){const i={field:r};return{plot:n,channelField:s=>t===s?i:void 0}}}function JDt(e,t){const n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)for(const i of n){const s=e[r].channelField(i,{exact:!0});if(s)return s.field}return null}function ZDt(e,t){const{apply:n,invert:r,interpolate:i,...s}=e;let o=e.type;o.startsWith("diverging-")&&(o=o.slice(11));let a;switch(o){case"log":case"pow":case"sqrt":case"symlog":a=o;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${o} scales.`),null;default:a="linear"}return Yv({x:{...s,type:a,range:[0,t]}})}const QDt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function tFt(e,t){return QDt.has(`${e.type}-${t}`)}function eFt(e,t={}){const n=(r,i)=>tFt(r,i)?{[`${i}1`]:dT(r,i,e,t),[`${i}2`]:dT(r,i,e,{...t,offset:1})}:{[i]:dT(r,i,e,t)};return n[CY]=!0,n}function dT(e,t,n,r){return new rFt(n,e,t,r)}function nFt(e,t){const n=e.plot.getAttribute(`${t}Scale`);return n==="utc"||n==="time"}let rFt=class extends Zr{constructor(t,n,r,i){super("COLUMN_REF"),this.column=t,this.mark=n,this.channel=r,this.options=i}get stats(){return{column:this.column,stats:["min","max"]}}toString(){const{mark:t,channel:n,column:r,options:i}=this,{type:s,min:o,max:a}=t.channelField(n);return`${i.interval||s==="date"||nFt(t,n)?dvt(r,[o,a],i):_vt(r,[o,a],i,z2(t,n))}`}},nA=class extends ch{constructor(t,n,r="input"){super(t),this.element=n||document.createElement("div"),r&&this.element.setAttribute("class",r),Object.defineProperty(this.element,"value",{value:this})}activate(){}};const iFt=e=>e&&typeof e=="object"&&!Array.isArray(e);class sFt extends nA{constructor({element:t,filterBy:n,as:r,from:i,column:s,label:o=s,format:a=f=>f,options:l,value:c,field:u=s}={}){super(n,t),this.from=i,this.column=s,this.format=a,this.field=u;const f=this.selection=r,h=document.createElement("label");if(h.innerText=o||s,this.element.appendChild(h),this.select=document.createElement("select"),this.element.appendChild(this.select),l&&(this.data=l.map(d=>iFt(d)?d:{value:d}),this.selectedValue(c===void 0?"":c),this.update()),f){const d=!Os(f);c!=null&&(!d||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),d?this.selection.addEventListener("value",g=>{g!==this.select.value&&this.selectedValue(g)}):(this.select.addEventListener("pointerenter",g=>{g.buttons||this.activate()}),this.select.addEventListener("focus",()=>this.activate()))}}selectedValue(t){if(arguments.length===0){const n=this.select.selectedIndex;return this.data[n].value}else{const n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}activate(){Os(this.selection)&&this.selection.activate(kx(this.field,0,{source:this}))}publish(t){const{selection:n,field:r}=this;if(Os(n)){t===""&&(t=void 0);const i=kx(r,t,{source:this});n.update(i)}else Ra(n)&&n.update(t)}query(t=[]){const{from:n,column:r}=this;return n?zt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){const{data:t,format:n,select:r,selection:i}=this;r.replaceChildren();for(const{value:s,label:o}of t){const a=document.createElement("option");a.setAttribute("value",s),a.innerText=o??n(s),this.select.appendChild(a)}if(i){const s=Os(i)?i.valueFor(this):i.value;this.selectedValue(s===void 0?"":s)}return this}}let oFt=0;class aFt extends nA{constructor({element:t,filterBy:n,from:r,column:i,label:s,type:o="contains",field:a=i,as:l}={}){if(super(n,t),this.id="search_"+ ++oFt,this.type=o,this.from=r,this.column=i,this.selection=l,this.field=a,s){const c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=s,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),Os(this.selection)?(this.searchbox.addEventListener("pointerenter",c=>{c.buttons||this.activate()}),this.searchbox.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}clause(t){const{field:n,type:r}=this;return Twt(n,t,{source:this,method:r})}activate(){Os(this.selection)&&this.selection.activate(this.clause(""))}publish(t){const{selection:n}=this;Os(n)?n.update(this.clause(t)):Ra(n)&&n.update(t)}query(t=[]){const{from:n,column:r}=this;return n?zt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){const t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(const r of this.data){const i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}}let lFt=0,cFt=class extends nA{constructor({element:t,filterBy:n,as:r,min:i,max:s,step:o,from:a,column:l,label:c=l,value:u=r?.value,select:f="point",field:h=l,width:d}={}){if(super(n,t),this.id="slider_"+ ++lFt,this.from=a,this.column=l||"value",this.selection=r,this.selectionType=f,this.field=h,this.min=i,this.max=s,this.step=o,c){const g=document.createElement("label");g.setAttribute("for",this.id),g.innerText=c,this.element.appendChild(g)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),d!=null&&(this.slider.style.width=`${+d}px`),i!=null&&this.slider.setAttribute("min",`${i}`),s!=null&&this.slider.setAttribute("max",`${s}`),o!=null&&this.slider.setAttribute("step",`${o}`),this.element.appendChild(this.slider),this.curval=document.createElement("label"),this.curval.setAttribute("for",this.id),this.curval.setAttribute("class","value"),this.element.appendChild(this.curval),u!=null&&(this.slider.setAttribute("value",`${u}`),this.selection?.value===void 0&&this.publish(u)),this.curval.innerText=this.slider.value,this.slider.addEventListener("input",()=>{const{value:g}=this.slider;this.curval.innerText=g,this.selection&&this.publish(+g)}),this.selection&&(Os(this.selection)?(this.slider.addEventListener("pointerenter",g=>{g.buttons||this.activate()}),this.slider.addEventListener("focus",()=>this.activate())):this.selection.addEventListener("value",g=>{g!==+this.slider.value&&(this.slider.value=g,this.curval.innerText=g)}))}query(t=[]){const{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:zt.select({min:gl(r),max:Da(r)}).from(n).where(t)}queryResult(t){const{min:n,max:r}=Array.from(t)[0];return this.min==null&&(this.min=n,this.slider.setAttribute("min",`${n}`)),this.max==null&&(this.max=r,this.slider.setAttribute("max",`${r}`)),this.step==null&&(this.step=(r-n)/500,this.slider.setAttribute("step",`${this.step}`)),this}clause(t){const{field:n,selectionType:r}=this;if(r==="interval"){const i=[this.min??0,t];return nI(n,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step})}else return kx(n,t,{source:this})}activate(){Os(this.selection)&&this.selection.activate(this.clause(0))}publish(t){const{selection:n}=this;Os(n)?n.update(this.clause(t)):Ra(this.selection)&&n.update(t)}};const xZ=AZ(e=>{const t=GC(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?SZ(n):`${n}`}),GC=AZ(e=>t=>t===0?"0":t.toLocaleString(e));xZ();GC();function SZ(e){return uFt(e,"Invalid Date")}function AZ(e){let t=null,n;return(r="en")=>r===t?n:n=e(t=r)}function uFt(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(+e))return typeof t=="function"?t(e):t;const n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),s=e.getUTCMilliseconds();return`${fFt(e.getUTCFullYear())}-${su(e.getUTCMonth()+1,2)}-${su(e.getUTCDate(),2)}${n||r||i||s?`T${su(n,2)}:${su(r,2)}${i||s?`:${su(i,2)}${s?`.${su(s,3)}`:""}`:""}Z`:""}`}function fFt(e){return e<0?`-${su(-e,6)}`:e>9999?`+${su(e,6)}`:su(e,4)}function su(e,t){return`${e}`.padStart(t,"0")}let hFt=-1,dFt=class extends nA{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:s={},format:o,width:a,maxWidth:l,height:c=500,rowBatch:u=100,as:f}={}){super(n,t,null),this.id=`table-${++hFt}`,this.element.setAttribute("id",this.id),this.from=r,this.columns=i,this.format=o,this.align=s,this.widths=typeof a=="object"?a:{},Ra(r)&&r.addEventListener("value",()=>this.initialize()),this.offset=0,this.limit=+u,this.isPending=!1,this.selection=f,this.currentRow=-1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,typeof a=="number"&&(this.element.style.width=`${a}px`),l&&(this.element.style.maxWidth=`${l}px`),this.element.style.maxHeight=`${c}px`,this.element.style.overflow="auto";let h=-1;this.element.addEventListener("scroll",d=>{const{isPending:g,loaded:y}=this,{scrollHeight:v,scrollTop:b,clientHeight:_}=d.target,w=b{const g=pFt(d.target);g>-1&&g!==this.currentRow&&(this.currentRow=g,this.selection.update(this.clause([g])))}),this.body.addEventListener("pointerleave",()=>{this.currentRow=-1,this.selection.update(this.clause())})),this.style=document.createElement("style"),this.element.appendChild(this.style)}sourceTable(){return Ra(this.from)?this.from.value:this.from}clause(t=[]){const{data:n,limit:r,schema:i}=this,s=i.map(a=>a.column),o=t.map(a=>{const{columns:l}=n[~~(a/r)];return s.map(c=>l[c][a%r])});return zS(s,o,{source:this})}requestData(t=0){this.offset=t;const n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Va().prefetch(n.clone().offset(t+this.limit))}async prepare(){const t=this.sourceTable(),n=this.columns.map(o=>({column:o,table:t})),r=await rI(this.coordinator,n);this.schema=r;const i=this.head;i.innerHTML="";const s=document.createElement("tr");for(const{column:o}of r){const a=document.createElement("th");a.addEventListener("click",l=>this.sort(l,o)),a.appendChild(document.createElement("span")),a.appendChild(document.createTextNode(o)),s.appendChild(a)}i.appendChild(s),this.formats=gFt(this.format,r),this.style.innerText=vFt(this.id,mFt(this.align,r),yFt(this.widths,r))}query(t=[]){const{limit:n,offset:r,schema:i,sortColumn:s,sortDesc:o}=this;return zt.from(this.sourceTable()).select(i.map(a=>a.column)).where(t).orderby(s?o?Vg(s):s:[]).limit(n).offset(r)}queryResult(t){return this.isPending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(Bd(t)),this}update(){const{body:t,formats:n,data:r,schema:i,limit:s}=this,o=i.length,a=r.length-1,l=s*a,{numRows:c,columns:u}=r[a],f=i.map(h=>u[h.column]);for(let h=0;h{if(r in e)return e[r];switch(i){case"number":return GC(n);case"date":return SZ;default:return xZ(n)}})}function mFt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function yFt(e={},t){return t.map(({column:n})=>e[n])}function vFt(e,t,n){const r=[];return t.forEach((i,s)=>{const o=+n[s];if(i!=="left"||o){const a=i!=="left"?`text-align:${i};`:"",l=o?`width:${o}px;max-width:${o}px;`:"";r.push(`#${e} tr>:nth-child(${s+1}) {${a}${l}}`)}}),r.join(" ")}function EZ(e,...t){const n=e?.context?.coordinator??Va();for(const r of t)n.connect(r)}function rA(e,t,n){const r=new t(n);return EZ(e,r),r.element}function bFt(e){return rA(this,sFt,e)}function _Ft(e){return rA(this,aFt,e)}function wFt(e){return rA(this,cFt,e)}function xFt(e){return rA(this,dFt,e)}function kZ({direction:e="vertical",wrap:t=!1},n){const r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),Object.assign(r,{value:{element:r}}),r}function SFt(...e){return kZ({direction:"vertical"},e.flat())}function AFt(...e){return kZ({direction:"horizontal"},e.flat())}function TZ({dim:e="width",size:t=10}){const n=document.createElement("span");return n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`,Object.assign(n,{value:{element:n}})}function EFt(e){return TZ({dim:"height",size:e})}function kFt(e){return TZ({dim:"width",size:e})}class MZ extends Map{request(t,n){if(this.has(t))n(this.get(t));else{const r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);const{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}clear(){return this.waiting?.clear(),super.clear()}}const IZ=new MZ;function TFt(e,t,n){(e?.context?.namedPlots??IZ).request(t,n)}function MFt(e,t,n){(e?.context?.namedPlots??IZ).set(t,n)}function RZ(e){return t=>MFt(this,e,t)}function CZ(e,t,n){Ra(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function IFt(e,t){return n=>{CZ(n,e,t)}}function XC(e){return t=>{for(const[n,r]of Object.entries(e))CZ(t,n,r)}}function NZ(e){const{top:t,bottom:n,left:r,right:i}=e,s={};return t!==void 0&&(s.marginTop=t),n!==void 0&&(s.marginBottom=n),r!==void 0&&(s.marginLeft=r),i!==void 0&&(s.marginRight=i),XC(s)}function $Z(e){return XC({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function OZ(e){return XC({xDomain:e,yDomain:e})}const et=e=>t=>IFt(e,t),LZ=et("style"),DZ=et("width"),FZ=et("height"),BZ=et("marginLeft"),PZ=et("marginRight"),UZ=et("marginTop"),zZ=et("marginBottom"),qZ=et("align"),jZ=et("aspectRatio"),VZ=et("axis"),WZ=et("inset"),YZ=et("grid"),HZ=et("clip"),GZ=et("padding"),XZ=et("ariaLabel"),KZ=et("ariaDescription"),JZ=et("xScale"),ZZ=et("xDomain"),QZ=et("xRange"),tQ=et("xNice"),eQ=et("xInset"),nQ=et("xInsetLeft"),rQ=et("xInsetRight"),iQ=et("xClamp"),sQ=et("xRound"),oQ=et("xAlign"),aQ=et("xPadding"),lQ=et("xPaddingInner"),cQ=et("xPaddingOuter"),uQ=et("xAxis"),fQ=et("xTicks"),hQ=et("xTickSize"),dQ=et("xTickSpacing"),pQ=et("xTickPadding"),gQ=et("xTickFormat"),mQ=et("xTickRotate"),yQ=et("xGrid"),vQ=et("xLine"),bQ=et("xLabel"),_Q=et("xLabelAnchor"),wQ=et("xLabelArrow"),xQ=et("xLabelOffset"),SQ=et("xFontVariant"),AQ=et("xAriaLabel"),EQ=et("xAriaDescription"),kQ=et("xPercent"),TQ=et("xReverse"),MQ=et("xZero"),IQ=et("xBase"),RQ=et("xExponent"),CQ=et("xConstant"),NQ=et("yScale"),$Q=et("yDomain"),OQ=et("yRange"),LQ=et("yNice"),DQ=et("yInset"),FQ=et("yInsetTop"),BQ=et("yInsetBottom"),PQ=et("yClamp"),UQ=et("yRound"),zQ=et("yAlign"),qQ=et("yPadding"),jQ=et("yPaddingInner"),VQ=et("yPaddingOuter"),WQ=et("yAxis"),YQ=et("yTicks"),HQ=et("yTickSize"),GQ=et("yTickSpacing"),XQ=et("yTickPadding"),KQ=et("yTickFormat"),JQ=et("yTickRotate"),ZQ=et("yGrid"),QQ=et("yLine"),ttt=et("yLabel"),ett=et("yLabelAnchor"),ntt=et("yLabelArrow"),rtt=et("yLabelOffset"),itt=et("yFontVariant"),stt=et("yAriaLabel"),ott=et("yAriaDescription"),att=et("yPercent"),ltt=et("yReverse"),ctt=et("yZero"),utt=et("yBase"),ftt=et("yExponent"),htt=et("yConstant"),dtt=et("facetMargin"),ptt=et("facetMarginTop"),gtt=et("facetMarginBottom"),mtt=et("facetMarginLeft"),ytt=et("facetMarginRight"),vtt=et("facetGrid"),btt=et("facetLabel"),_tt=et("fxDomain"),wtt=et("fxRange"),xtt=et("fxInset"),Stt=et("fxInsetLeft"),Att=et("fxInsetRight"),Ett=et("fxRound"),ktt=et("fxAlign"),Ttt=et("fxPadding"),Mtt=et("fxPaddingInner"),Itt=et("fxPaddingOuter"),Rtt=et("fxAxis"),Ctt=et("fxTicks"),Ntt=et("fxTickSize"),$tt=et("fxTickSpacing"),Ott=et("fxTickPadding"),Ltt=et("fxTickFormat"),Dtt=et("fxTickRotate"),Ftt=et("fxGrid"),Btt=et("fxLine"),Ptt=et("fxLabel"),Utt=et("fxLabelAnchor"),ztt=et("fxLabelOffset"),qtt=et("fxFontVariant"),jtt=et("fxAriaLabel"),Vtt=et("fxAriaDescription"),Wtt=et("fxReverse"),Ytt=et("fyDomain"),Htt=et("fyRange"),Gtt=et("fyInset"),Xtt=et("fyInsetTop"),Ktt=et("fyInsetBottom"),Jtt=et("fyRound"),Ztt=et("fyAlign"),Qtt=et("fyPadding"),tet=et("fyPaddingInner"),eet=et("fyPaddingOuter"),net=et("fyAxis"),ret=et("fyTicks"),iet=et("fyTickSize"),set=et("fyTickSpacing"),oet=et("fyTickPadding"),aet=et("fyTickFormat"),cet=et("fyTickRotate"),uet=et("fyGrid"),fet=et("fyLine"),het=et("fyLabel"),det=et("fyLabelAnchor"),pet=et("fyLabelOffset"),get=et("fyFontVariant"),met=et("fyAriaLabel"),yet=et("fyAriaDescription"),vet=et("fyReverse"),bet=et("colorScale"),_et=et("colorDomain"),wet=et("colorRange"),xet=et("colorClamp"),Aet=et("colorN"),Eet=et("colorNice"),ket=et("colorScheme"),Tet=et("colorInterpolate"),Met=et("colorPivot"),Iet=et("colorSymmetric"),Ret=et("colorLabel"),Cet=et("colorPercent"),Net=et("colorReverse"),$et=et("colorZero"),Oet=et("colorTickFormat"),Let=et("colorBase"),Det=et("colorExponent"),Fet=et("colorConstant"),Bet=et("opacityScale"),Pet=et("opacityDomain"),Uet=et("opacityRange"),zet=et("opacityClamp"),qet=et("opacityNice"),jet=et("opacityLabel"),Vet=et("opacityPercent"),Wet=et("opacityReverse"),Yet=et("opacityZero"),Het=et("opacityTickFormat"),Get=et("opacityBase"),Xet=et("opacityExponent"),Ket=et("opacityConstant"),Jet=et("symbolScale"),Zet=et("symbolDomain"),Qet=et("symbolRange"),tnt=et("rScale"),ent=et("rDomain"),nnt=et("rRange"),rnt=et("rClamp"),int=et("rNice"),snt=et("rLabel"),ont=et("rPercent"),ant=et("rZero"),lnt=et("rBase"),cnt=et("rExponent"),unt=et("rConstant"),fnt=et("lengthScale"),hnt=et("lengthDomain"),dnt=et("lengthRange"),pnt=et("lengthClamp"),gnt=et("lengthNice"),mnt=et("lengthPercent"),ynt=et("lengthZero"),vnt=et("lengthBase"),bnt=et("lengthExponent"),_nt=et("lengthConstant"),wnt=et("projectionType"),xnt=et("projectionParallels"),Snt=et("projectionPrecision"),Ant=et("projectionRotate"),Ent=et("projectionDomain"),knt=et("projectionInset"),Tnt=et("projectionInsetLeft"),Mnt=et("projectionInsetRight"),Int=et("projectionInsetTop"),Rnt=et("projectionInsetBottom"),Cnt=et("projectionClip"),RFt=Object.freeze(Object.defineProperty({__proto__:null,align:qZ,ariaDescription:KZ,ariaLabel:XZ,aspectRatio:jZ,axis:VZ,clip:HZ,colorBase:Let,colorClamp:xet,colorConstant:Fet,colorDomain:_et,colorExponent:Det,colorInterpolate:Tet,colorLabel:Ret,colorN:Aet,colorNice:Eet,colorPercent:Cet,colorPivot:Met,colorRange:wet,colorReverse:Net,colorScale:bet,colorScheme:ket,colorSymmetric:Iet,colorTickFormat:Oet,colorZero:$et,facetGrid:vtt,facetLabel:btt,facetMargin:dtt,facetMarginBottom:gtt,facetMarginLeft:mtt,facetMarginRight:ytt,facetMarginTop:ptt,fxAlign:ktt,fxAriaDescription:Vtt,fxAriaLabel:jtt,fxAxis:Rtt,fxDomain:_tt,fxFontVariant:qtt,fxGrid:Ftt,fxInset:xtt,fxInsetLeft:Stt,fxInsetRight:Att,fxLabel:Ptt,fxLabelAnchor:Utt,fxLabelOffset:ztt,fxLine:Btt,fxPadding:Ttt,fxPaddingInner:Mtt,fxPaddingOuter:Itt,fxRange:wtt,fxReverse:Wtt,fxRound:Ett,fxTickFormat:Ltt,fxTickPadding:Ott,fxTickRotate:Dtt,fxTickSize:Ntt,fxTickSpacing:$tt,fxTicks:Ctt,fyAlign:Ztt,fyAriaDescription:yet,fyAriaLabel:met,fyAxis:net,fyDomain:Ytt,fyFontVariant:get,fyGrid:uet,fyInset:Gtt,fyInsetBottom:Ktt,fyInsetTop:Xtt,fyLabel:het,fyLabelAnchor:det,fyLabelOffset:pet,fyLine:fet,fyPadding:Qtt,fyPaddingInner:tet,fyPaddingOuter:eet,fyRange:Htt,fyReverse:vet,fyRound:Jtt,fyTickFormat:aet,fyTickPadding:oet,fyTickRotate:cet,fyTickSize:iet,fyTickSpacing:set,fyTicks:ret,grid:YZ,height:FZ,inset:WZ,lengthBase:vnt,lengthClamp:pnt,lengthConstant:_nt,lengthDomain:hnt,lengthExponent:bnt,lengthNice:gnt,lengthPercent:mnt,lengthRange:dnt,lengthScale:fnt,lengthZero:ynt,margin:$Z,marginBottom:zZ,marginLeft:BZ,marginRight:PZ,marginTop:UZ,margins:NZ,name:RZ,opacityBase:Get,opacityClamp:zet,opacityConstant:Ket,opacityDomain:Pet,opacityExponent:Xet,opacityLabel:jet,opacityNice:qet,opacityPercent:Vet,opacityRange:Uet,opacityReverse:Wet,opacityScale:Bet,opacityTickFormat:Het,opacityZero:Yet,padding:GZ,projectionClip:Cnt,projectionDomain:Ent,projectionInset:knt,projectionInsetBottom:Rnt,projectionInsetLeft:Tnt,projectionInsetRight:Mnt,projectionInsetTop:Int,projectionParallels:xnt,projectionPrecision:Snt,projectionRotate:Ant,projectionType:wnt,rBase:lnt,rClamp:rnt,rConstant:unt,rDomain:ent,rExponent:cnt,rLabel:snt,rNice:int,rPercent:ont,rRange:nnt,rScale:tnt,rZero:ant,style:LZ,symbolDomain:Zet,symbolRange:Qet,symbolScale:Jet,width:DZ,xAlign:oQ,xAriaDescription:EQ,xAriaLabel:AQ,xAxis:uQ,xBase:IQ,xClamp:iQ,xConstant:CQ,xDomain:ZZ,xExponent:RQ,xFontVariant:SQ,xGrid:yQ,xInset:eQ,xInsetLeft:nQ,xInsetRight:rQ,xLabel:bQ,xLabelAnchor:_Q,xLabelArrow:wQ,xLabelOffset:xQ,xLine:vQ,xNice:tQ,xPadding:aQ,xPaddingInner:lQ,xPaddingOuter:cQ,xPercent:kQ,xRange:QZ,xReverse:TQ,xRound:sQ,xScale:JZ,xTickFormat:gQ,xTickPadding:pQ,xTickRotate:mQ,xTickSize:hQ,xTickSpacing:dQ,xTicks:fQ,xZero:MQ,xyDomain:OZ,yAlign:zQ,yAriaDescription:ott,yAriaLabel:stt,yAxis:WQ,yBase:utt,yClamp:PQ,yConstant:htt,yDomain:$Q,yExponent:ftt,yFontVariant:itt,yGrid:ZQ,yInset:DQ,yInsetBottom:BQ,yInsetTop:FQ,yLabel:ttt,yLabelAnchor:ett,yLabelArrow:ntt,yLabelOffset:rtt,yLine:QQ,yNice:LQ,yPadding:qQ,yPaddingInner:jQ,yPaddingOuter:VQ,yPercent:att,yRange:OQ,yReverse:ltt,yRound:UQ,yScale:NQ,yTickFormat:KQ,yTickPadding:XQ,yTickRotate:JQ,yTickSize:HQ,yTickSpacing:GQ,yTicks:YQ,yZero:ctt},Symbol.toStringTag,{value:"Module"}));function CFt(e,t){return{table:e,options:t}}const NFt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function pe(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=NFt.has(e)?null:[{}]);const r=e.startsWith("area")||e.startsWith("line")?$Lt:Sh;return iA(r,e,t,n)}function iA(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function $c(e,t,n){return r=>{r.addMark(new e(t,n))}}const Nnt=(...e)=>pe("area",...e),$nt=(...e)=>pe("areaX",...e),Ont=(...e)=>pe("areaY",...e),Lnt=(...e)=>pe("line",...e),Dnt=(...e)=>pe("lineX",...e),Fnt=(...e)=>pe("lineY",...e),Bnt=(...e)=>pe("barX",...e),Pnt=(...e)=>pe("barY",...e),Unt=(...e)=>pe("cell",...e),znt=(...e)=>pe("cellX",...e),qnt=(...e)=>pe("cellY",...e),jnt=(...e)=>pe("rect",...e),Vnt=(...e)=>pe("rectX",...e),Wnt=(...e)=>pe("rectY",...e),Ynt=(...e)=>pe("dot",...e),Hnt=(...e)=>pe("dotX",...e),Gnt=(...e)=>pe("dotY",...e),Xnt=(...e)=>pe("circle",...e),Knt=(...e)=>pe("hexagon",...e),Jnt=(...e)=>pe("text",...e),Znt=(...e)=>pe("textX",...e),Qnt=(...e)=>pe("textY",...e),trt=(...e)=>pe("ruleX",...e),ert=(...e)=>pe("ruleY",...e),nrt=(...e)=>pe("tickX",...e),rrt=(...e)=>pe("tickY",...e),irt=(...e)=>pe("vector",...e),srt=(...e)=>pe("vectoX",...e),ort=(...e)=>pe("vectorY",...e),art=(...e)=>pe("spike",...e),lrt=(...e)=>pe("image",...e),crt=(...e)=>iA(cZ,"areaX",...e),urt=(...e)=>iA(cZ,"areaY",...e),frt=(...e)=>$c(iDt,...e),hrt=(...e)=>$c(tDt,...e),drt=(...e)=>$c(qLt,...e),prt=(...e)=>$c(XLt,...e),grt=(...e)=>$c(jC,...e),mrt=(...e)=>$c(dDt,...e),yrt=(...e)=>$c(hDt,...e),vrt=(...e)=>pe("hexgrid",...e),brt=(...e)=>$c(bDt,...e),_rt=(...e)=>iA(uZ,"ruleY",...e),wrt=(...e)=>$c(uZ,"ruleX",...e),xrt=(...e)=>pe("voronoi",...e),Srt=(...e)=>pe("voronoiMesh",...e),Art=(...e)=>pe("delaunayLink",...e),Ert=(...e)=>pe("delaunayMesh",...e),krt=(...e)=>pe("hull",...e),Trt=(...e)=>pe("arrow",...e),Mrt=(...e)=>pe("link",...e),Irt=(...e)=>pe("frame",...e),Rrt=(...e)=>pe("axisX",...e),Crt=(...e)=>pe("axisY",...e),Nrt=(...e)=>pe("axisFx",...e),$rt=(...e)=>pe("axisFy",...e),Ort=(...e)=>pe("gridX",...e),Lrt=(...e)=>pe("gridY",...e),Drt=(...e)=>pe("gridFx",...e),Frt=(...e)=>pe("gridFy",...e),Brt=(...e)=>$c(fDt,...e),Prt=(...e)=>pe("sphere",...e),Urt=(...e)=>pe("graticule",...e),zrt=(...e)=>pe("waffleX",...e),qrt=(...e)=>pe("waffleY",...e),$Ft=Object.freeze(Object.defineProperty({__proto__:null,area:Nnt,areaX:$nt,areaY:Ont,arrow:Trt,axisFx:Nrt,axisFy:$rt,axisX:Rrt,axisY:Crt,barX:Bnt,barY:Pnt,cell:Unt,cellX:znt,cellY:qnt,circle:Xnt,contour:drt,delaunayLink:Art,delaunayMesh:Ert,denseLine:hrt,density:frt,densityX:crt,densityY:urt,dot:Ynt,dotX:Hnt,dotY:Gnt,errorbarX:_rt,errorbarY:wrt,frame:Irt,geo:Brt,graticule:Urt,gridFx:Drt,gridFy:Frt,gridX:Ort,gridY:Lrt,heatmap:prt,hexagon:Knt,hexbin:yrt,hexgrid:vrt,hull:krt,image:lrt,line:Lnt,lineX:Dnt,lineY:Fnt,link:Mrt,raster:grt,rasterTile:mrt,rect:jnt,rectX:Vnt,rectY:Wnt,regressionY:brt,ruleX:trt,ruleY:ert,sphere:Prt,spike:art,text:Jnt,textX:Znt,textY:Qnt,tickX:nrt,tickY:rrt,vector:irt,vectorX:srt,vectorY:ort,voronoi:xrt,voronoiMesh:Srt,waffleX:zrt,waffleY:qrt},Symbol.toStringTag,{value:"Module"}));function Oc(e,t){return n=>{const r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function jrt({by:e,...t}){return Oc(ADt,{selection:e,channels:t})}function Vrt({as:e,...t}){return Oc(YC,{...t,selection:e,channel:"x"})}function Wrt({as:e,...t}){return Oc(YC,{...t,selection:e,channel:"y"})}function Yrt({as:e,...t}){return Oc(IDt,{...t,selection:e})}function Hrt({as:e,...t}){return Oc(HC,{...t,selection:e,pointer:"xy"})}function Grt({as:e,...t}){return Oc(HC,{...t,selection:e,pointer:"x"})}function Xrt({as:e,...t}){return Oc(HC,{...t,selection:e,pointer:"y"})}function Krt({as:e,...t}){return Oc(YDt,{...t,selection:e})}function fm({as:e,...t}){return Oc(_Z,{...t,selection:e})}function Jrt(e){return fm({...e,channels:["x"]})}function Zrt(e){return fm({...e,channels:["y"]})}function Qrt(e){return fm({...e,channels:["z"]})}function tit(e){return fm({...e,channels:["color"]})}function hm(e){return Oc(NDt,e)}function eit(e={}){return hm({...e,zoom:!1})}function nit(e={}){return hm({...e,zoom:!1,pany:!1})}function rit(e={}){return hm({...e,zoom:!1,panx:!1})}function iit(e={}){return hm(e)}function sit(e={}){return hm({...e,pany:!1})}function oit(e={}){return hm({...e,panx:!1})}const OFt=Object.freeze(Object.defineProperty({__proto__:null,highlight:jrt,intervalX:Vrt,intervalXY:Yrt,intervalY:Wrt,nearest:Hrt,nearestX:Grt,nearestY:Xrt,pan:eit,panX:nit,panY:rit,panZoom:iit,panZoomX:sit,panZoomY:oit,region:Krt,toggle:fm,toggleColor:tit,toggleX:Jrt,toggleY:Zrt,toggleZ:Qrt},Symbol.toStringTag,{value:"Module"}));function KC(e,t={}){if(t.for){const{for:n,...r}=t,i=new ZF(e,r),s=typeof n,o=a=>a.addLegend(i,!1);return s==="string"?TFt(this,n,o):n.value&&o(n.value),i.element}else return n=>n.addLegend(new ZF(e,t))}function ait(e){return KC.call(this,"color",e)}function lit(e){return KC.call(this,"opacity",e)}function cit(e){return KC.call(this,"symbol",e)}const LFt=Object.freeze(Object.defineProperty({__proto__:null,colorLegend:ait,opacityLegend:lit,symbolLegend:cit},Symbol.toStringTag,{value:"Module"}));function DFt(...e){const t=new ALt;return e.flat().forEach(n=>n(t)),EZ(this,...t.marks),t.update(),t.element}const FFt=Object.freeze(Object.defineProperty({__proto__:null,Fixed:L1,Param:_a,Query:zt,Selection:og,align:qZ,and:Di,area:Nnt,areaX:$nt,areaY:Ont,argmax:Yw,argmin:Hw,ariaDescription:KZ,ariaLabel:XZ,arrayAgg:Omt,arrow:Trt,aspectRatio:jZ,avg:CS,axis:VZ,axisFx:Nrt,axisFy:$rt,axisX:Rrt,axisY:Crt,barX:Bnt,barY:Pnt,bin:eFt,cast:Xr,cell:Unt,cellX:znt,cellY:qnt,centroid:S6,centroidX:Tyt,centroidY:Myt,circle:Xnt,clip:HZ,colorBase:Let,colorClamp:xet,colorConstant:Fet,colorDomain:_et,colorExponent:Det,colorInterpolate:Tet,colorLabel:Ret,colorLegend:ait,colorN:Aet,colorNice:Eet,colorPercent:Cet,colorPivot:Met,colorRange:wet,colorReverse:Net,colorScale:bet,colorScheme:ket,colorSymmetric:Iet,colorTickFormat:Oet,colorZero:$et,column:Mt,contour:drt,coordinator:Va,corr:Lmt,count:ar,covarPop:Fmt,covariance:Dmt,createSchema:Jyt,createTable:d1,cume_dist:Fyt,dateDay:myt,dateMonth:pyt,dateMonthDay:gyt,days:oyt,delaunayLink:Art,delaunayMesh:Ert,denseLine:hrt,dense_rank:Lyt,density:frt,densityX:crt,densityY:urt,dot:Ynt,dotX:Hnt,dotY:Gnt,entropy:Bmt,eq:No,errorbarX:_rt,errorbarY:wrt,facetGrid:vtt,facetLabel:btt,facetMargin:dtt,facetMarginBottom:gtt,facetMarginLeft:mtt,facetMarginRight:ytt,facetMarginTop:ptt,first:Pmt,first_value:Uyt,float32:nyt,float64:ks,frame:Irt,frameGroups:Wyt,frameRange:Vyt,frameRows:jyt,from:CFt,fxAlign:ktt,fxAriaDescription:Vtt,fxAriaLabel:jtt,fxAxis:Rtt,fxDomain:_tt,fxFontVariant:qtt,fxGrid:Ftt,fxInset:xtt,fxInsetLeft:Stt,fxInsetRight:Att,fxLabel:Ptt,fxLabelAnchor:Utt,fxLabelOffset:ztt,fxLine:Btt,fxPadding:Ttt,fxPaddingInner:Mtt,fxPaddingOuter:Itt,fxRange:wtt,fxReverse:Wtt,fxRound:Ett,fxTickFormat:Ltt,fxTickPadding:Ott,fxTickRotate:Dtt,fxTickSize:Ntt,fxTickSpacing:$tt,fxTicks:Ctt,fyAlign:Ztt,fyAriaDescription:yet,fyAriaLabel:met,fyAxis:net,fyDomain:Ytt,fyFontVariant:get,fyGrid:uet,fyInset:Gtt,fyInsetBottom:Ktt,fyInsetTop:Xtt,fyLabel:het,fyLabelAnchor:det,fyLabelOffset:pet,fyLine:fet,fyPadding:Qtt,fyPaddingInner:tet,fyPaddingOuter:eet,fyRange:Htt,fyReverse:vet,fyRound:Jtt,fyTickFormat:aet,fyTickPadding:oet,fyTickRotate:cet,fyTickSize:iet,fyTickSpacing:set,fyTicks:ret,geo:Brt,geojson:LU,geomean:Umt,graticule:Urt,grid:YZ,gridFx:Drt,gridFy:Frt,gridX:Ort,gridY:Lrt,gt:ba,gte:wyt,hconcat:AFt,heatmap:prt,height:FZ,hexagon:Knt,hexbin:yrt,hexgrid:vrt,highlight:jrt,hours:ayt,hspace:kFt,hull:krt,image:lrt,inset:WZ,int32:Si,interval:kl,intervalX:Vrt,intervalXY:Yrt,intervalY:Wrt,isBetween:$s,isDistinct:xyt,isNotBetween:Syt,isNotDistinct:x6,isNotNull:pc,isNull:ll,kurtosis:zmt,lag:Pyt,last:Vmt,last_value:zyt,lead:l4,lengthBase:vnt,lengthClamp:pnt,lengthConstant:_nt,lengthDomain:hnt,lengthExponent:bnt,lengthNice:gnt,lengthPercent:mnt,lengthRange:dnt,lengthScale:fnt,lengthZero:ynt,line:Lnt,lineX:Dnt,lineY:Fnt,link:Mrt,literal:Zt,loadCSV:Qyt,loadExtension:PU,loadJSON:tvt,loadObjects:rvt,loadParquet:evt,loadSpatial:nvt,lt:gi,lte:oc,mad:qmt,margin:$Z,marginBottom:zZ,marginLeft:BZ,marginRight:PZ,marginTop:UZ,margins:NZ,max:Da,median:NS,menu:bFt,microseconds:fyt,milliseconds:uyt,min:gl,minutes:lyt,mode:jmt,months:syt,name:RZ,nearest:Hrt,nearestX:Grt,nearestY:Xrt,neq:h1,not:sg,nth_value:qyt,ntile:Byt,opacityBase:Get,opacityClamp:zet,opacityConstant:Ket,opacityDomain:Pet,opacityExponent:Xet,opacityLabel:jet,opacityLegend:lit,opacityNice:qet,opacityPercent:Vet,opacityRange:Uet,opacityReverse:Wet,opacityScale:Bet,opacityTickFormat:Het,opacityZero:Yet,or:Ns,padding:GZ,pan:eit,panX:nit,panY:rit,panZoom:iit,panZoomX:sit,panZoomY:oit,percent_rank:Dyt,plot:DFt,product:Wmt,projectionClip:Cnt,projectionDomain:Ent,projectionInset:knt,projectionInsetBottom:Rnt,projectionInsetLeft:Tnt,projectionInsetRight:Mnt,projectionInsetTop:Int,projectionParallels:xnt,projectionPrecision:Snt,projectionRotate:Ant,projectionType:wnt,quantile:a4,rBase:lnt,rClamp:rnt,rConstant:unt,rDomain:ent,rExponent:cnt,rLabel:snt,rNice:int,rPercent:ont,rRange:nnt,rScale:tnt,rZero:ant,rank:Oyt,raster:grt,rasterTile:mrt,rect:jnt,rectX:Vnt,rectY:Wnt,region:Krt,regressionY:brt,row_number:FU,ruleX:trt,ruleY:ert,search:_Ft,seconds:cyt,skewness:Jmt,slider:wFt,sphere:Prt,spike:art,sql:ee,stddev:NU,stddevPop:Zmt,stringAgg:Qmt,style:LZ,sum:Er,symbolDomain:Zet,symbolLegend:cit,symbolRange:Qet,symbolScale:Jet,table:xFt,text:Jnt,textX:Znt,textY:Qnt,tickX:nrt,tickY:rrt,toggle:fm,toggleColor:tit,toggleX:Jrt,toggleY:Zrt,toggleZ:Qrt,varPop:eyt,variance:tyt,vconcat:SFt,vector:irt,vectorX:srt,vectorY:ort,voronoi:xrt,voronoiMesh:Srt,vspace:EFt,waffleX:zrt,waffleY:qrt,width:DZ,xAlign:oQ,xAriaDescription:EQ,xAriaLabel:AQ,xAxis:uQ,xBase:IQ,xClamp:iQ,xConstant:CQ,xDomain:ZZ,xExponent:RQ,xFontVariant:SQ,xGrid:yQ,xInset:eQ,xInsetLeft:nQ,xInsetRight:rQ,xLabel:bQ,xLabelAnchor:_Q,xLabelArrow:wQ,xLabelOffset:xQ,xLine:vQ,xNice:tQ,xPadding:aQ,xPaddingInner:lQ,xPaddingOuter:cQ,xPercent:kQ,xRange:QZ,xReverse:TQ,xRound:sQ,xScale:JZ,xTickFormat:gQ,xTickPadding:pQ,xTickRotate:mQ,xTickSize:hQ,xTickSpacing:dQ,xTicks:fQ,xZero:MQ,xyDomain:OZ,yAlign:zQ,yAriaDescription:ott,yAriaLabel:stt,yAxis:WQ,yBase:utt,yClamp:PQ,yConstant:htt,yDomain:$Q,yExponent:ftt,yFontVariant:itt,yGrid:ZQ,yInset:DQ,yInsetBottom:BQ,yInsetTop:FQ,yLabel:ttt,yLabelAnchor:ett,yLabelArrow:ntt,yLabelOffset:rtt,yLine:QQ,yNice:LQ,yPadding:qQ,yPaddingInner:jQ,yPaddingOuter:VQ,yPercent:att,yRange:OQ,yReverse:ltt,yRound:UQ,yScale:NQ,yTickFormat:KQ,yTickPadding:XQ,yTickRotate:JQ,yTickSize:HQ,yTickSpacing:GQ,yTicks:YQ,yZero:ctt,years:iyt},Symbol.toStringTag,{value:"Module"}));function uit({coordinator:e=Va(),namedPlots:t=new MZ,extensions:n=null,...r}={}){return{...FFt,...n,context:{coordinator:e,namedPlots:t,...r}}}function BFt(e){return e}function JC(e){const t=e-1;return t*t*t+1}function QF(e){return Object.prototype.toString.call(e)==="[object Date]"}function l5(e,t){if(e===t||e!==e)return()=>e;const n=typeof e;if(n!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const r=t.map((i,s)=>l5(e[s],i));return i=>r.map(s=>s(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(QF(e)&&QF(t)){const s=e.getTime(),a=t.getTime()-s;return l=>new Date(s+l*a)}const r=Object.keys(t),i={};return r.forEach(s=>{i[s]=l5(e[s],t[s])}),s=>{const o={};return r.forEach(a=>{o[a]=i[a](s)}),o}}if(n==="number"){const r=t-e;return i=>e+i*r}return()=>t}class ZC{#t;#e;#n;#r=null;constructor(t,n={}){this.#t=xt(t),this.#e=xt(t),this.#n=n}static of(t,n){const r=new ZC(t(),n);return sp(()=>{r.set(t())}),r}set(t,n){G(this.#e,t);let{delay:r=0,duration:i=400,easing:s=BFt,interpolate:o=l5}={...this.#n,...n};if(i===0)return this.#r?.abort(),G(this.#t,t),Promise.resolve();const a=Hl.now()+r;let l,c=!1,u=this.#r;return this.#r=hP(f=>{if(fi?(G(this.#t,t),!1):(G(this.#t,l(s(h/i))),!0)}),this.#r.promise}get current(){return x(this.#t)}get target(){return x(this.#e)}set target(t){this.set(t)}}function PFt(e){const t=e-1;return t*t*t+1}function q2(e,{delay:t=0,duration:n=400,easing:r=PFt,axis:i="y"}={}){const s=getComputedStyle(e),o=+s.opacity,a=i==="y"?"height":"width",l=parseFloat(s[a]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(b=>`${b[0].toUpperCase()}${b.slice(1)}`),f=parseFloat(s[`padding${u[0]}`]),h=parseFloat(s[`padding${u[1]}`]),d=parseFloat(s[`margin${u[0]}`]),g=parseFloat(s[`margin${u[1]}`]),y=parseFloat(s[`border${u[0]}Width`]),v=parseFloat(s[`border${u[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*o};${a}: ${b*l}px;padding-${c[0]}: ${b*f}px;padding-${c[1]}: ${b*h}px;margin-${c[0]}: ${b*d}px;margin-${c[1]}: ${b*g}px;border-${c[0]}-width: ${b*y}px;border-${c[1]}-width: ${b*v}px;min-${a}: 0`}}const Ho=2,QC=4,t8=8,ib=16,Xu=32,vp=64,fit=128,$a=256,j2=512,ss=1024,qa=2048,Ah=4096,hl=8192,bp=16384,e8=32768,sA=65536,tB=1<<17,UFt=1<<18,n8=1<<19,hit=1<<20,c5=1<<21,r8=1<<22,Ad=1<<23,Ed=Symbol("$state"),dit=Symbol("legacy props"),zFt=Symbol(""),i8=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},pit=3,Zv=8,qFt=!1;var oA=Array.isArray,jFt=Array.prototype.indexOf,s8=Array.from,V2=Object.defineProperty,G0=Object.getOwnPropertyDescriptor,git=Object.getOwnPropertyDescriptors,mit=Object.prototype,VFt=Array.prototype,aA=Object.getPrototypeOf,eB=Object.isExtensible;const WFt=()=>{};function yit(e){for(var t=0;t{e=r,t=i});return{promise:n,resolve:e,reject:t}}function vit(e){return e===this.v}function o8(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function HFt(e,t){return e!==t}function bit(e){return!o8(e,this.v)}function GFt(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function _it(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function XFt(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function KFt(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function JFt(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ZFt(e){throw new Error("https://svelte.dev/e/effect_orphan")}function QFt(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function tBt(){throw new Error("https://svelte.dev/e/hydration_failed")}function eBt(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function nBt(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function rBt(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let sb=!1,iBt=!1;function sBt(){sb=!0}const a8=1,l8=2,wit=4,oBt=8,aBt=16,lBt=1,cBt=2,xit="[",c8="[!",u8="]",X0={},Ni=Symbol(),uBt="http://www.w3.org/1999/xhtml",fBt=[];function Sit(e,t=!1){return Ew(e,new Map,"",fBt)}function Ew(e,t,n,r,i=null){if(typeof e=="object"&&e!==null){var s=t.get(e);if(s!==void 0)return s;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(oA(e)){var o=Array(e.length);t.set(e,o),i!==null&&t.set(i,o);for(var a=0;a{if(Td===s)return a();var l=Mn,c=Td;Ac(null),oB(s);var u=a();return Ac(l),oB(c),u};return r&&n.set("length",Jt(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&eBt();var u=n.get(l);return u===void 0?u=o(()=>{var f=Jt(c.value);return n.set(l,f),f}):It(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Jt(Ni));n.set(l,u),pT(i)}}else It(c,Ni),pT(i);return!0},get(a,l,c){if(l===Ed)return e;var u=n.get(l),f=l in a;if(u===void 0&&(!f||G0(a,l)?.writable)&&(u=o(()=>{var d=ls(f?a[l]:Ni),g=Jt(d);return g}),n.set(l,u)),u!==void 0){var h=H(u);return h===Ni?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=H(u))}else if(c===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==Ni)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Ed)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Ni||Reflect.has(a,l);if(c!==void 0||pn!==null&&(!u||G0(a,l)?.writable)){c===void 0&&(c=o(()=>{var h=u?ls(a[l]):Ni,d=Jt(h);return d}),n.set(l,c));var f=H(c);if(f===Ni)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var d=c;dJt(Ni)),n.set(d+"",g))}if(f===void 0)(!h||G0(a,l)?.writable)&&(f=o(()=>Jt(void 0)),It(f,ls(c)),n.set(l,f));else{h=f.v!==Ni;var y=o(()=>ls(c));It(f,y)}var v=Reflect.getOwnPropertyDescriptor(a,l);if(v?.set&&v.set.call(u,c),!h){if(r&&typeof l=="string"){var b=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=b.v&&It(b,_+1)}pT(i)}return!0},ownKeys(a){H(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==Ni});for(var[c,u]of n)u.v!==Ni&&!(c in a)&&l.push(c);return l},setPrototypeOf(){nBt()}})}var f5,kit,Tit,Mit;function h5(){if(f5===void 0){f5=window,kit=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Tit=G0(t,"firstChild").get,Mit=G0(t,"nextSibling").get,eB(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),eB(n)&&(n.__t=void 0)}}function rh(e=""){return document.createTextNode(e)}function Kd(e){return Tit.call(e)}function Eh(e){return Mit.call(e)}function Wn(e,t){if(!Nn)return Kd(e);var n=Kd(fr);if(n===null)n=fr.appendChild(rh());else if(t&&n.nodeType!==pit){var r=rh();return n?.before(r),dl(r),r}return dl(n),n}function Lo(e,t){if(!Nn){var n=Kd(e);return n instanceof Comment&&n.data===""?Eh(n):n}return fr}function Ta(e,t=1,n=!1){let r=Nn?fr:e;for(var i;t--;)i=r,r=Eh(r);if(!Nn)return r;if(n&&r?.nodeType!==pit){var s=rh();return r===null?i?.after(s):r.before(s),dl(s),s}return dl(r),r}function Iit(e){e.textContent=""}function Rit(){return!1}const dBt=new WeakMap;function pBt(e){var t=pn;if(t===null)return Mn.f|=Ad,e;if((t.f&e8)===0){if((t.f&fit)===0)throw!t.parent&&e instanceof Error&&Cit(e),e;t.b.error(e)}else f8(e,t)}function f8(e,t){for(;t!==null;){if((t.f&fit)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e instanceof Error&&Cit(e),e}function Cit(e){const t=dBt.get(e);t&&(V2(e,"message",{value:t.message}),V2(e,"stack",{value:t.stack}))}const gBt=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let Qv=[],t1=[];function Nit(){var e=Qv;Qv=[],yit(e)}function $it(){var e=t1;t1=[],yit(e)}function h8(e){Qv.length===0&&queueMicrotask(Nit),Qv.push(e)}function mBt(e){t1.length===0&&gBt($it),t1.push(e)}function yBt(){Qv.length>0&&Nit(),t1.length>0&&$it()}function vBt(){for(var e=pn.b;e!==null&&!e.has_pending_snippet();)e=e.parent;return e===null&&GFt(),e}function cA(e){var t=Ho|qa,n=Mn!==null&&(Mn.f&Ho)!==0?Mn:null;return pn===null||n!==null&&(n.f&$a)!==0?t|=$a:pn.f|=n8,{ctx:Jr,deps:null,effects:null,equals:vit,f:t,fn:e,reactions:null,rv:0,v:Ni,wv:0,parent:n??pn,ac:null}}function bBt(e,t){let n=pn;n===null&&XFt();var r=n.b,i=void 0,s=e1(Ni),o=null,a=!Mn;return $Bt(()=>{try{var l=e()}catch(d){l=Promise.reject(d)}var c=()=>l;i=o?.then(c,c)??Promise.resolve(l),o=i;var u=di,f=r.pending;a&&(r.update_pending_count(1),f||u.increment());const h=(d,g=void 0)=>{o=null,f||u.activate(),g?g!==i8&&(s.f|=Ad,n1(s,g)):((s.f&Ad)!==0&&(s.f^=Ad),n1(s,d)),a&&(r.update_pending_count(-1),f||u.decrement()),Fit()};if(i.then(h,d=>h(null,d||"unknown")),u)return()=>{queueMicrotask(()=>u.neuter())}}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function Dt(e){const t=cA(e);return qit(t),t}function Oit(e){const t=cA(e);return t.equals=bit,t}function Lit(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nbBt(l))).then(l=>{i?.activate(),o();try{n([...e.map(r),...l])}catch(c){(s.f&bp)===0&&f8(c,s)}i?.deactivate(),Fit()}).catch(l=>{a.error(l)})}function xBt(){var e=pn,t=Mn,n=Jr;return function(){ih(e),Ac(t),W2(n)}}function Fit(){ih(null),Ac(null),W2(null)}const ny=new Set;let di=null,$g=null,nB=new Set,Y2=[];function Bit(){const e=Y2.shift();Y2.length>0&&queueMicrotask(Bit),e()}let Jd=[],uA=null,d5=!1,kw=!1;class Og{current=new Map;#t=new Map;#e=new Set;#n=0;#r=null;#c=!1;#i=[];#s=[];#a=[];#o=[];#l=[];#f=[];#u=[];skipped_effects=new Set;process(t){Jd=[];var n=null;if(ny.size>1){n=new Map,$g=new Map;for(const[s,o]of this.current)n.set(s,{v:s.v,wv:s.wv}),s.v=o;for(const s of ny)if(s!==this)for(const[o,a]of s.#t)n.has(o)||(n.set(o,{v:o.v,wv:o.wv}),o.v=a)}for(const s of t)this.#p(s);if(this.#i.length===0&&this.#n===0){this.#d();var r=this.#a,i=this.#o;this.#a=[],this.#o=[],this.#l=[],di=null,rB(r),rB(i),di===null?di=this:ny.delete(this),this.#r?.resolve()}else this.#h(this.#a),this.#h(this.#o),this.#h(this.#l);if(n){for(const[s,{v:o,wv:a}]of n)s.wv<=a&&(s.v=o);$g=null}for(const s of this.#i)Gy(s);for(const s of this.#s)Gy(s);this.#i=[],this.#s=[]}#p(t){t.f^=ss;for(var n=t.first;n!==null;){var r=n.f,i=(r&(Xu|vp))!==0,s=i&&(r&ss)!==0,o=s||(r&hl)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){if(i)n.f^=ss;else if((r&ss)===0)if((r&QC)!==0)this.#o.push(n);else if((r&r8)!==0){var a=n.b?.pending?this.#s:this.#i;a.push(n)}else fA(n)&&((n.f&ib)!==0&&this.#l.push(n),Gy(n));var l=n.first;if(l!==null){n=l;continue}}var c=n.parent;for(n=n.next;n===null&&c!==null;)n=c.next,c=c.parent}}#h(t){for(const n of t)((n.f&qa)!==0?this.#f:this.#u).push(n),fo(n,ss);t.length=0}capture(t,n){this.#t.has(t)||this.#t.set(t,n),this.current.set(t,t.v)}activate(){di=this}deactivate(){di=null;for(const t of nB)if(nB.delete(t),t(),di!==null)break}neuter(){this.#c=!0}flush(){Jd.length>0?Pit():this.#d(),di===this&&(this.#n===0&&ny.delete(this),this.deactivate())}#d(){if(!this.#c)for(const t of this.#e)t();this.#e.clear()}increment(){this.#n+=1}decrement(){if(this.#n-=1,this.#n===0){for(const t of this.#f)fo(t,qa),Zd(t);for(const t of this.#u)fo(t,Ah),Zd(t);this.#a=[],this.#o=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#r??=YFt()).promise}static ensure(){if(di===null){const t=di=new Og;ny.add(di),kw||Og.enqueue(()=>{di===t&&t.flush()})}return di}static enqueue(t){Y2.length===0&&queueMicrotask(Bit),Y2.unshift(t)}}function SBt(e){var t=kw;kw=!0;try{for(var n;;){if(yBt(),Jd.length===0&&(di?.flush(),Jd.length===0))return uA=null,n;Pit()}}finally{kw=t}}function Pit(){var e=K0;d5=!0;try{var t=0;for(iB(!0);Jd.length>0;){var n=Og.ensure();if(t++>1e3){var r,i;ABt()}n.process(Jd),kd.clear()}}finally{d5=!1,iB(e),uA=null}}function ABt(){try{QFt()}catch(e){f8(e,uA)}}function rB(e){var t=e.length;if(t!==0){for(var n=0;ni&&(r.f&hit)!==0)break}}for(;ne.wv)return!0}(!r||pn!==null&&!Cf)&&fo(e,ss)}return!1}function Wit(e,t,n=!0){var r=e.reactions;if(r!==null&&!ku?.includes(e))for(var i=0;i0)for(h.length=Ro+Es.length,d=0;dnew Promise(r=>{n.outro?pA(t,()=>{Ec(t),r(void 0)}):(Ec(t),r(void 0))})}function ab(e){return Ku(QC,e,!1)}function $Bt(e){return Ku(r8|n8,e,!0)}function Xit(e,t=0){return Ku(t8|t,e,!0)}function ci(e,t=[],n=[]){wBt(t,n,r=>{Ku(t8,()=>e(...r.map(H)),!0)})}function dA(e,t=0){var n=Ku(ib|t,e,!0);return n}function sh(e,t=!0){return Ku(Xu,e,!0,t)}function Kit(e){var t=e.teardown;if(t!==null){const n=_p,r=Mn;sB(!0),Ac(null);try{t.call(null)}finally{sB(n),Ac(r)}}}function Jit(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){n.ac?.abort(i8);var r=n.next;(n.f&vp)!==0?n.parent=null:Ec(n,t),n=r}}function OBt(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Xu)===0&&Ec(t),t=n}}function Ec(e,t=!0){var n=!1;(t||(e.f&UFt)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(LBt(e.nodes_start,e.nodes_end),n=!0),Jit(e,t&&!n),H2(e,0),fo(e,bp);var r=e.transitions;if(r!==null)for(const s of r)s.stop();Kit(e);var i=e.parent;i!==null&&i.first!==null&&Zit(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function LBt(e,t){for(;e!==null;){var n=e===t?null:Eh(e);e.remove(),e=n}}function Zit(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 pA(e,t){var n=[];p8(e,n,!0),Qit(n,()=>{Ec(e),t&&t()})}function Qit(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function p8(e,t,n){if((e.f&hl)===0){if(e.f^=hl,e.transitions!==null)for(const o of e.transitions)(o.is_global||n)&&t.push(o);for(var r=e.first;r!==null;){var i=r.next,s=(r.f&sA)!==0||(r.f&Xu)!==0;p8(r,t,s?n:!1),r=i}}}function g8(e){tst(e,!0)}function tst(e,t){if((e.f&hl)!==0){e.f^=hl,(e.f&ss)===0&&(fo(e,qa),Zd(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&sA)!==0||(n.f&Xu)!==0;tst(n,i?t:!1),n=r}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}let aB=!1;function DBt(){aB||(aB=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function FBt(e){var t=Mn,n=pn;Ac(null),ih(null);try{return e()}finally{Ac(t),ih(n)}}const est=new Set,g5=new Set;function BBt(e){if(!Nn)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;t!==void 0&&(e.__e=void 0,queueMicrotask(()=>{e.isConnected&&e.dispatchEvent(t)}))}function PBt(e,t,n,r={}){function i(s){if(r.capture||Cy.call(t,s),!s.cancelBubble)return FBt(()=>n?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?h8(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Lg(e,t,n,r,i){var s={capture:r,passive:i},o=PBt(e,t,n,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&CBt(()=>{t.removeEventListener(e,o,s)})}function Ju(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,Ac(u),ih(f)}}}function UBt(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("",""),t.content}function J0(e,t){var n=pn;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function On(e,t){var n=(t&lBt)!==0,r=(t&cBt)!==0,i,s=!e.startsWith("");return()=>{if(Nn)return J0(fr,null),fr;i===void 0&&(i=UBt(s?e:""+e),n||(i=Kd(i)));var o=r||kit?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Kd(o),l=o.lastChild;J0(a,l)}else J0(o,o);return o}}function Kh(){if(Nn)return J0(fr,null),fr;var e=document.createDocumentFragment(),t=document.createComment(""),n=rh();return e.append(t,n),J0(t,n),e}function Qe(e,t){if(Nn){pn.nodes_end=fr,ob();return}e!==null&&e.before(t)}const zBt=["touchstart","touchmove"];function qBt(e){return zBt.includes(e)}function Lc(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function nst(e,t){return rst(e,t)}function jBt(e,t){h5(),t.intro=t.intro??!1;const n=t.target,r=Nn,i=fr;try{for(var s=Kd(n);s&&(s.nodeType!==Zv||s.data!==xit);)s=Eh(s);if(!s)throw X0;mu(!0),dl(s),ob();const o=rst(e,{...t,anchor:s});if(fr===null||fr.nodeType!==Zv||fr.data!==u8)throw lA(),X0;return mu(!1),o}catch(o){if(o===X0)return t.recover===!1&&tBt(),h5(),Iit(n),mu(!1),nst(e,t);throw o}finally{mu(r),dl(i)}}const n0=new Map;function rst(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0}){h5();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(rh());return sh(()=>{if(s){Qr({});var h=Jr;h.c=s}i&&(r.$$events=i),Nn&&J0(f,null),c=e(f,r)||{},Nn&&(pn.nodes_end=fr),s&&ti()}),()=>{for(var h of a){t.removeEventListener(h,Cy);var d=n0.get(h);--d===0?(document.removeEventListener(h,Cy),n0.delete(h)):n0.set(h,d)}g5.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return m5.set(c,u),c}let m5=new WeakMap;function VBt(e,t){const n=m5.get(e);return n?(m5.delete(e),n(t)):Promise.resolve()}function WBt(e){return new YBt(e)}class YBt{#t;#e;constructor(t){var n=new Map,r=(s,o)=>{var a=Uit(o,!1,!1);return n.set(s,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(s,o){return H(n.get(o)??r(o,Reflect.get(s,o)))},has(s,o){return o===dit?!0:(H(n.get(o)??r(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return It(n.get(o)??r(o,a),a),Reflect.set(s,o,a)}});this.#e=(t.hydrate?jBt:nst)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&SBt(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||V2(this,s,{get(){return this.#e[s]},set(o){this.#e[s]=o},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{VBt(this.#e)}}$set(t){this.#e.$set(t)}$on(t,n){this.#t[t]=this.#t[t]||[];const r=(...i)=>n.call(this,...i);return this.#t[t].push(r),()=>{this.#t[t]=this.#t[t].filter(i=>i!==r)}}$destroy(){this.#e.$destroy()}}const HBt="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(HBt);function m8(e,t,...n){var r=e,i=WFt,s;dA(()=>{i!==(i=t())&&(s&&(Ec(s),s=null),s=sh(()=>i(r,...n)))},sA),Nn&&(r=fr)}function pm(e){Jr===null&&_it(),sb&&Jr.l!==null?GBt(Jr).m.push(e):Pr(()=>{const t=hA(e);if(typeof t=="function")return t})}function GBt(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}function ro(e,t,n=!1){Nn&&ob();var r=e,i=null,s=null,o=Ni,a=n?sA:0,l=!1;const c=(h,d=!0)=>{l=!0,f(d,h)};function u(){var h=o?i:s,d=o?s:i;h&&g8(h),d&&pA(d,()=>{o?s=null:i=null})}const f=(h,d)=>{if(o===(o=h))return;let g=!1;if(Nn){const b=Eit(r)===c8;!!o===b&&(r=u5(),dl(r),mu(!1),g=!0)}var y=Rit(),v=r;o?i??=d&&sh(()=>d(v)):s??=d&&sh(()=>d(v)),y||u(),g&&mu(!0)};dA(()=>{l=!1,t(c),l||f(null,null)},a),Nn&&(r=fr)}function XBt(e,t,n){Nn&&ob();var r=e,i=Ni,s,o,a=null,l=dm()?HFt:o8;function c(){s&&pA(s),a!==null&&(a.lastChild.remove(),r.before(a),a=null),s=o}dA(()=>{if(l(i,i=t())){var u=r,f=Rit();f&&(a=document.createDocumentFragment(),a.append(u=rh())),o=sh(()=>n(u)),f?di.add_callback(c):c()}}),Nn&&(r=fr)}function KBt(e,t){return t}function JBt(e,t,n){for(var r=e.items,i=[],s=t.length,o=0;o0&&i.length===0&&n!==null;if(a){var l=n.parentNode;Iit(l),l.append(n),r.clear(),Vl(e,t[0].prev,t[s-1].next)}Qit(i,()=>{for(var c=0;c{var b=n();return oA(b)?b:b==null?[]:s8(b)}),g,y;function v(){ZBt(y,g,a,h,o,i,t,r,n),s!==null&&(g.length===0?u?g8(u):u=sh(()=>s(o)):u!==null&&pA(u,()=>{u=null}))}dA(()=>{y??=pn,g=H(d);var b=g.length;if(f&&b===0)return;f=b===0;let _=!1;if(Nn){var w=Eit(o)===c8;w!==(b===0)&&(o=u5(),dl(o),mu(!1),_=!0)}if(Nn){for(var S=null,k,A=0;A0&&dl(u5())}Nn?b===0&&s&&(u=sh(()=>s(o))):v(),_&&mu(!0),H(d)}),Nn&&(o=fr)}function ZBt(e,t,n,r,i,s,o,a,l){var c=(o&oBt)!==0,u=(o&(a8|l8))!==0,f=t.length,h=n.items,d=n.first,g=d,y,v=null,b,_=[],w=[],S,k,A,T;if(c)for(T=0;T0){var B=(o&wit)!==0&&f===0?i:null;if(c){for(T=0;T{if(b!==void 0)for(A of b)A.a?.apply()}),e.first=n.first&&n.first.e,e.last=v&&v.e;for(var V of r.values())Ec(V.e);r.clear()}function QBt(e,t,n,r){(r&a8)!==0&&n1(e.v,t),(r&l8)!==0?n1(e.i,n):e.i=n}function ist(e,t,n,r,i,s,o,a,l,c,u){var f=(l&a8)!==0,h=(l&aBt)===0,d=f?h?Uit(i,!1,!1):e1(i):i,g=(l&l8)===0?o:e1(o),y={i:g,v:d,k:s,a:null,e:null,prev:n,next:r};try{if(e===null){var v=document.createDocumentFragment();v.append(e=rh())}return y.e=sh(()=>a(e,d,g,c),Nn),y.e.prev=n&&n.e,y.e.next=r&&r.e,n===null?u||(t.first=y):(n.next=y,n.e.next=y.e),r!==null&&(r.prev=y,r.e.prev=y.e),y}finally{}}function gT(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,s=e.e.nodes_start;s!==null&&s!==r;){var o=Eh(s);i.before(s),s=o}}function Vl(e,t,n){t===null?e.first=n:(t.next=n,t.e.next=n&&n.e),n!==null&&(n.prev=t,n.e.prev=t&&t.e)}function ei(e,t){ab(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,r.appendChild(i)}})}function y8(e,t,n){ab(()=>{var r=hA(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,s={};Xit(()=>{var o=n();MBt(o),i&&o8(s,o)&&(s=o,r.update(o))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function t9t(e,t,n){var r=e==null?"":""+e;return t&&(r=r?r+" "+t:t),r===""?null:r}function cB(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function e9t(e,t){if(t){var n="",r,i;return Array.isArray(t)?(r=t[0],i=t[1]):r=t,r&&(n+=cB(r)),i&&(n+=cB(i,!0)),n=n.trim(),n===""?null:n}return String(e)}function oh(e,t,n,r,i,s){var o=e.__className;if(Nn||o!==n||o===void 0){var a=t9t(n,r);(!Nn||a!==e.getAttribute("class"))&&(a==null?e.removeAttribute("class"):e.className=a),e.__className=n}return s}function mT(e,t={},n,r){for(var i in n){var s=n[i];t[i]!==s&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,s,r))}}function vo(e,t,n,r){var i=e.__style;if(Nn||i!==t){var s=e9t(t,r);(!Nn||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}else r&&(Array.isArray(r)?(mT(e,n?.[0],r[0]),mT(e,n?.[1],r[1],"important")):mT(e,n,r));return r}const n9t=Symbol("is custom element"),r9t=Symbol("is html");function i9t(e){if(Nn){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;i1(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var i=e.checked;i1(e,"checked",null),e.checked=i}}};e.__on_r=n,mBt(n),DBt()}}function s9t(e,t){var n=sst(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function i1(e,t,n,r){var i=sst(e);Nn&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[zFt]=n),n==null?e.removeAttribute(t):typeof n!="string"&&o9t(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function sst(e){return e.__attributes??={[n9t]:e.nodeName.includes("-"),[r9t]:e.namespaceURI===uBt}}var uB=new Map;function o9t(e){var t=uB.get(e.nodeName);if(t)return t;uB.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=git(r);for(var s in n)n[s].set&&t.push(s);r=aA(r)}return t}class v8{#t=new WeakMap;#e;#n;static entries=new WeakMap;constructor(t){this.#n=t}observe(t,n){var r=this.#t.get(t)||new Set;return r.add(n),this.#t.set(t,r),this.#r().observe(t,this.#n),()=>{var i=this.#t.get(t);i.delete(n),i.size===0&&(this.#t.delete(t),this.#e.unobserve(t))}}#r(){return this.#e??(this.#e=new ResizeObserver(t=>{for(var n of t){v8.entries.set(n.target,n);for(var r of this.#t.get(n.target)||[])r(n)}}))}}var a9t=new v8({box:"border-box"});function xl(e,t,n){var r=a9t.observe(e,()=>n(e[t]));ab(()=>(hA(()=>n(e[t])),r))}function fB(e,t){return e===t||e?.[Ed]===t}function Bs(e={},t,n,r){return ab(()=>{var i,s;return Xit(()=>{i=s,s=[],hA(()=>{e!==n(...s)&&(t(e,...s),i&&fB(n(...i),e)&&t(null,...i))})}),()=>{h8(()=>{s&&fB(n(...s),e)&&t(null,...s)})}}),e}let q_=!1;function l9t(e){var t=q_;try{return q_=!1,[e(),q_]}finally{q_=t}}function gm(e,t,n,r){var i=r,s=!0,o=()=>(s&&(s=!1,i=r),i),a;{var l=Ed in e||dit in e;a=G0(e,t)?.set??(l&&t in e?v=>e[t]=v:void 0)}var c,u=!1;[c,u]=l9t(()=>e[t]);var f;if(f=()=>{var v=e[t];return v===void 0?o():(s=!0,v)},a){var h=e.$$legacy;return function(v,b){return arguments.length>0?((!b||h||u)&&a(b?f():v),v):f()}}var d=!1,g=cA(()=>(d=!1,f()));H(g);var y=pn;return function(v,b){if(arguments.length>0){const _=b?H(g):ls(v);return It(g,_),d=!0,i!==void 0&&(i=_),v}return _p&&d||(y.f&bp)!==0?g.v:H(g)}}var Nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function b8(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tw={exports:{}};/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */var c9t=Tw.exports,hB;function u9t(){return hB||(hB=1,function(e,t){(function(){var n,r="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",f=1,h=2,d=4,g=1,y=2,v=1,b=2,_=4,w=8,S=16,k=32,A=64,T=128,M=256,I=512,C=30,N="...",L=800,F=16,$=1,D=2,O=3,B=1/0,V=9007199254740991,U=17976931348623157e292,z=NaN,q=4294967295,Y=q-1,Q=q>>>1,ft=[["ary",T],["bind",v],["bindKey",b],["curry",w],["curryRight",S],["flip",I],["partial",k],["partialRight",A],["rearg",M]],gt="[object Arguments]",pt="[object Array]",lt="[object AsyncFunction]",vt="[object Boolean]",st="[object Date]",Z="[object DOMException]",mt="[object Error]",at="[object Function]",Ct="[object GeneratorFunction]",wt="[object Map]",Bt="[object Number]",Pt="[object Null]",kt="[object Object]",qt="[object Promise]",Re="[object Proxy]",Ht="[object RegExp]",le="[object Set]",Ke="[object String]",ce="[object Symbol]",bn="[object Undefined]",Je="[object WeakMap]",wr="[object WeakSet]",or="[object ArrayBuffer]",Ge="[object DataView]",un="[object Float32Array]",Ln="[object Float64Array]",Hi="[object Int8Array]",Gi="[object Int16Array]",wo="[object Int32Array]",fi="[object Uint8Array]",ni="[object Uint8ClampedArray]",Nl="[object Uint16Array]",kh="[object Uint32Array]",Zu=/\b__p \+= '';/g,ys=/\b(__p \+=) '' \+/g,Qu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Th=/&(?:amp|lt|gt|quot|#39);/g,tf=/[&<>"']/g,Ap=RegExp(Th.source),Mh=RegExp(tf.source),mm=/<%-([\s\S]+?)%>/g,Ep=/<%([\s\S]+?)%>/g,Ih=/<%=([\s\S]+?)%>/g,Rh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ym=/^\w*$/,kp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ch=/[\\^$.*+?()[\]{}|]/g,Rt=RegExp(Ch.source),Vt=/^\s+/,Wt=/\s/,Gt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qt=/\{\n\/\* \[wrapped with (.+)\] \*/,Oe=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,on=/[()=,{}\[\]\/\s]/,_t=/\\(\\)?/g,Ot=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ut=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,je=/^0b[01]+$/i,qn=/^\[object .+?Constructor\]$/,An=/^0o[0-7]+$/i,te=/^(?:0|[1-9]\d*)$/,Dn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Fr=/($^)/,Ti=/['\n\r\u2028\u2029\\]/g,ri="\\ud800-\\udfff",fn="\\u0300-\\u036f",ii="\\ufe20-\\ufe2f",$l="\\u20d0-\\u20ff",Mi=fn+ii+$l,Xi="\\u2700-\\u27bf",ef="a-z\\xdf-\\xf6\\xf8-\\xff",vm="\\xac\\xb1\\xd7\\xf7",SA="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",AA="\\u2000-\\u206f",bm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",q8="A-Z\\xc0-\\xd6\\xd8-\\xde",j8="\\ufe0e\\ufe0f",V8=vm+SA+AA+bm,EA="['’]",uot="["+ri+"]",W8="["+V8+"]",fb="["+Mi+"]",Y8="\\d+",fot="["+Xi+"]",H8="["+ef+"]",G8="[^"+ri+V8+Y8+Xi+ef+q8+"]",kA="\\ud83c[\\udffb-\\udfff]",hot="(?:"+fb+"|"+kA+")",X8="[^"+ri+"]",TA="(?:\\ud83c[\\udde6-\\uddff]){2}",MA="[\\ud800-\\udbff][\\udc00-\\udfff]",Tp="["+q8+"]",K8="\\u200d",J8="(?:"+H8+"|"+G8+")",dot="(?:"+Tp+"|"+G8+")",Z8="(?:"+EA+"(?:d|ll|m|re|s|t|ve))?",Q8="(?:"+EA+"(?:D|LL|M|RE|S|T|VE))?",tN=hot+"?",eN="["+j8+"]?",pot="(?:"+K8+"(?:"+[X8,TA,MA].join("|")+")"+eN+tN+")*",got="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mot="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",nN=eN+tN+pot,yot="(?:"+[fot,TA,MA].join("|")+")"+nN,vot="(?:"+[X8+fb+"?",fb,TA,MA,uot].join("|")+")",bot=RegExp(EA,"g"),_ot=RegExp(fb,"g"),IA=RegExp(kA+"(?="+kA+")|"+vot+nN,"g"),wot=RegExp([Tp+"?"+H8+"+"+Z8+"(?="+[W8,Tp,"$"].join("|")+")",dot+"+"+Q8+"(?="+[W8,Tp+J8,"$"].join("|")+")",Tp+"?"+J8+"+"+Z8,Tp+"+"+Q8,mot,got,Y8,yot].join("|"),"g"),xot=RegExp("["+K8+ri+Mi+j8+"]"),Sot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Aot=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Eot=-1,xr={};xr[un]=xr[Ln]=xr[Hi]=xr[Gi]=xr[wo]=xr[fi]=xr[ni]=xr[Nl]=xr[kh]=!0,xr[gt]=xr[pt]=xr[or]=xr[vt]=xr[Ge]=xr[st]=xr[mt]=xr[at]=xr[wt]=xr[Bt]=xr[kt]=xr[Ht]=xr[le]=xr[Ke]=xr[Je]=!1;var vr={};vr[gt]=vr[pt]=vr[or]=vr[Ge]=vr[vt]=vr[st]=vr[un]=vr[Ln]=vr[Hi]=vr[Gi]=vr[wo]=vr[wt]=vr[Bt]=vr[kt]=vr[Ht]=vr[le]=vr[Ke]=vr[ce]=vr[fi]=vr[ni]=vr[Nl]=vr[kh]=!0,vr[mt]=vr[at]=vr[Je]=!1;var kot={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Tot={"&":"&","<":"<",">":">",'"':""","'":"'"},Mot={"&":"&","<":"<",">":">",""":'"',"'":"'"},Iot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Rot=parseFloat,Cot=parseInt,rN=typeof Nf=="object"&&Nf&&Nf.Object===Object&&Nf,Not=typeof self=="object"&&self&&self.Object===Object&&self,Bi=rN||Not||Function("return this")(),RA=t&&!t.nodeType&&t,Nh=RA&&!0&&e&&!e.nodeType&&e,iN=Nh&&Nh.exports===RA,CA=iN&&rN.process,Jo=function(){try{var ut=Nh&&Nh.require&&Nh.require("util").types;return ut||CA&&CA.binding&&CA.binding("util")}catch{}}(),sN=Jo&&Jo.isArrayBuffer,oN=Jo&&Jo.isDate,aN=Jo&&Jo.isMap,lN=Jo&&Jo.isRegExp,cN=Jo&&Jo.isSet,uN=Jo&&Jo.isTypedArray;function xo(ut,St,bt){switch(bt.length){case 0:return ut.call(St);case 1:return ut.call(St,bt[0]);case 2:return ut.call(St,bt[0],bt[1]);case 3:return ut.call(St,bt[0],bt[1],bt[2])}return ut.apply(St,bt)}function $ot(ut,St,bt,Xt){for(var Be=-1,Fn=ut==null?0:ut.length;++Be-1}function NA(ut,St,bt){for(var Xt=-1,Be=ut==null?0:ut.length;++Xt-1;);return bt}function vN(ut,St){for(var bt=ut.length;bt--&&Mp(St,ut[bt],0)>-1;);return bt}function qot(ut,St){for(var bt=ut.length,Xt=0;bt--;)ut[bt]===St&&++Xt;return Xt}var jot=DA(kot),Vot=DA(Tot);function Wot(ut){return"\\"+Iot[ut]}function Yot(ut,St){return ut==null?n:ut[St]}function Ip(ut){return xot.test(ut)}function Hot(ut){return Sot.test(ut)}function Got(ut){for(var St,bt=[];!(St=ut.next()).done;)bt.push(St.value);return bt}function UA(ut){var St=-1,bt=Array(ut.size);return ut.forEach(function(Xt,Be){bt[++St]=[Be,Xt]}),bt}function bN(ut,St){return function(bt){return ut(St(bt))}}function sf(ut,St){for(var bt=-1,Xt=ut.length,Be=0,Fn=[];++bt-1}function Lat(p,m){var E=this.__data__,R=Ib(E,p);return R<0?(++this.size,E.push([p,m])):E[R][1]=m,this}Dc.prototype.clear=Cat,Dc.prototype.delete=Nat,Dc.prototype.get=$at,Dc.prototype.has=Oat,Dc.prototype.set=Lat;function Fc(p){var m=-1,E=p==null?0:p.length;for(this.clear();++m=m?p:m)),p}function ea(p,m,E,R,P,W){var K,nt=m&f,ht=m&h,Et=m&d;if(E&&(K=P?E(p,R,P,W):E(p)),K!==n)return K;if(!Br(p))return p;var Tt=qe(p);if(Tt){if(K=Plt(p),!nt)return Ws(p,K)}else{var $t=Ji(p),jt=$t==at||$t==Ct;if(ff(p))return e7(p,nt);if($t==kt||$t==gt||jt&&!P){if(K=ht||jt?{}:_7(p),!nt)return ht?Mlt(p,Jat(K,p)):Tlt(p,CN(K,p))}else{if(!vr[$t])return P?p:{};K=Ult(p,$t,nt)}}W||(W=new Ha);var ne=W.get(p);if(ne)return ne;W.set(p,K),X7(p)?p.forEach(function(Ae){K.add(ea(Ae,m,E,Ae,p,W))}):H7(p)&&p.forEach(function(Ae,an){K.set(an,ea(Ae,m,E,an,p,W))});var Se=Et?ht?hE:fE:ht?Hs:Ii,Xe=Tt?n:Se(p);return Zo(Xe||p,function(Ae,an){Xe&&(an=Ae,Ae=p[an]),km(K,an,ea(Ae,m,E,an,p,W))}),K}function Zat(p){var m=Ii(p);return function(E){return NN(E,p,m)}}function NN(p,m,E){var R=E.length;if(p==null)return!R;for(p=ur(p);R--;){var P=E[R],W=m[P],K=p[P];if(K===n&&!(P in p)||!W(K))return!1}return!0}function $N(p,m,E){if(typeof p!="function")throw new Qo(o);return $m(function(){p.apply(n,E)},m)}function Tm(p,m,E,R){var P=-1,W=hb,K=!0,nt=p.length,ht=[],Et=m.length;if(!nt)return ht;E&&(m=Rr(m,So(E))),R?(W=NA,K=!1):m.length>=i&&(W=_m,K=!1,m=new Lh(m));t:for(;++PP?0:P+E),R=R===n||R>P?P:We(R),R<0&&(R+=P),R=E>R?0:J7(R);E0&&E(nt)?m>1?Pi(nt,m-1,E,R,P):rf(P,nt):R||(P[P.length]=nt)}return P}var HA=a7(),DN=a7(!0);function Ol(p,m){return p&&HA(p,m,Ii)}function GA(p,m){return p&&DN(p,m,Ii)}function Cb(p,m){return nf(m,function(E){return qc(p[E])})}function Fh(p,m){m=cf(m,p);for(var E=0,R=m.length;p!=null&&Em}function elt(p,m){return p!=null&&Kn.call(p,m)}function nlt(p,m){return p!=null&&m in ur(p)}function rlt(p,m,E){return p>=Ki(m,E)&&p<_i(m,E)}function KA(p,m,E){for(var R=E?NA:hb,P=p[0].length,W=p.length,K=W,nt=bt(W),ht=1/0,Et=[];K--;){var Tt=p[K];K&&m&&(Tt=Rr(Tt,So(m))),ht=Ki(Tt.length,ht),nt[K]=!E&&(m||P>=120&&Tt.length>=120)?new Lh(K&&Tt):n}Tt=p[0];var $t=-1,jt=nt[0];t:for(;++$t-1;)nt!==p&&xb.call(nt,ht,1),xb.call(p,ht,1);return p}function HN(p,m){for(var E=p?m.length:0,R=E-1;E--;){var P=m[E];if(E==R||P!==W){var W=P;zc(P)?xb.call(p,P,1):iE(p,P)}}return p}function eE(p,m){return p+Eb(TN()*(m-p+1))}function mlt(p,m,E,R){for(var P=-1,W=_i(Ab((m-p)/(E||1)),0),K=bt(W);W--;)K[R?W:++P]=p,p+=E;return K}function nE(p,m){var E="";if(!p||m<1||m>V)return E;do m%2&&(E+=p),m=Eb(m/2),m&&(p+=p);while(m);return E}function Ze(p,m){return bE(S7(p,m,Gs),p+"")}function ylt(p){return RN(Up(p))}function vlt(p,m){var E=Up(p);return qb(E,Dh(m,0,E.length))}function Rm(p,m,E,R){if(!Br(p))return p;m=cf(m,p);for(var P=-1,W=m.length,K=W-1,nt=p;nt!=null&&++PP?0:P+m),E=E>P?P:E,E<0&&(E+=P),P=m>E?0:E-m>>>0,m>>>=0;for(var W=bt(P);++R>>1,K=p[W];K!==null&&!Eo(K)&&(E?K<=m:K=i){var Et=m?null:Nlt(p);if(Et)return pb(Et);K=!1,P=_m,ht=new Lh}else ht=m?[]:nt;t:for(;++R=R?p:na(p,m,E)}var t7=cat||function(p){return Bi.clearTimeout(p)};function e7(p,m){if(m)return p.slice();var E=p.length,R=xN?xN(E):new p.constructor(E);return p.copy(R),R}function lE(p){var m=new p.constructor(p.byteLength);return new _b(m).set(new _b(p)),m}function Slt(p,m){var E=m?lE(p.buffer):p.buffer;return new p.constructor(E,p.byteOffset,p.byteLength)}function Alt(p){var m=new p.constructor(p.source,Ut.exec(p));return m.lastIndex=p.lastIndex,m}function Elt(p){return Em?ur(Em.call(p)):{}}function n7(p,m){var E=m?lE(p.buffer):p.buffer;return new p.constructor(E,p.byteOffset,p.length)}function r7(p,m){if(p!==m){var E=p!==n,R=p===null,P=p===p,W=Eo(p),K=m!==n,nt=m===null,ht=m===m,Et=Eo(m);if(!nt&&!Et&&!W&&p>m||W&&K&&ht&&!nt&&!Et||R&&K&&ht||!E&&ht||!P)return 1;if(!R&&!W&&!Et&&p=nt)return ht;var Et=E[R];return ht*(Et=="desc"?-1:1)}}return p.index-m.index}function i7(p,m,E,R){for(var P=-1,W=p.length,K=E.length,nt=-1,ht=m.length,Et=_i(W-K,0),Tt=bt(ht+Et),$t=!R;++nt1?E[P-1]:n,K=P>2?E[2]:n;for(W=p.length>3&&typeof W=="function"?(P--,W):n,K&&bs(E[0],E[1],K)&&(W=P<3?n:W,P=1),m=ur(m);++R-1?P[W?m[K]:K]:n}}function u7(p){return Uc(function(m){var E=m.length,R=E,P=ta.prototype.thru;for(p&&m.reverse();R--;){var W=m[R];if(typeof W!="function")throw new Qo(o);if(P&&!K&&Ub(W)=="wrapper")var K=new ta([],!0)}for(R=K?R:E;++R1&&gn.reverse(),Tt&&htnt))return!1;var Et=W.get(p),Tt=W.get(m);if(Et&&Tt)return Et==m&&Tt==p;var $t=-1,jt=!0,ne=E&y?new Lh:n;for(W.set(p,m),W.set(m,p);++$t1?"& ":"")+m[R],m=m.join(E>2?", ":" "),p.replace(Gt,`{ +/* [wrapped with `+m+`] */ +`)}function qlt(p){return qe(p)||Uh(p)||!!(EN&&p&&p[EN])}function zc(p,m){var E=typeof p;return m=m??V,!!m&&(E=="number"||E!="symbol"&&te.test(p))&&p>-1&&p%1==0&&p0){if(++m>=L)return arguments[0]}else m=0;return p.apply(n,arguments)}}function qb(p,m){var E=-1,R=p.length,P=R-1;for(m=m===n?R:m;++E1?p[m-1]:n;return E=typeof E=="function"?(p.pop(),E):n,L7(p,E)});function D7(p){var m=j(p);return m.__chain__=!0,m}function Qct(p,m){return m(p),p}function jb(p,m){return m(p)}var tut=Uc(function(p){var m=p.length,E=m?p[0]:0,R=this.__wrapped__,P=function(W){return YA(W,p)};return m>1||this.__actions__.length||!(R instanceof hn)||!zc(E)?this.thru(P):(R=R.slice(E,+E+(m?1:0)),R.__actions__.push({func:jb,args:[P],thisArg:n}),new ta(R,this.__chain__).thru(function(W){return m&&!W.length&&W.push(n),W}))});function eut(){return D7(this)}function nut(){return new ta(this.value(),this.__chain__)}function rut(){this.__values__===n&&(this.__values__=K7(this.value()));var p=this.__index__>=this.__values__.length,m=p?n:this.__values__[this.__index__++];return{done:p,value:m}}function iut(){return this}function sut(p){for(var m,E=this;E instanceof Mb;){var R=I7(E);R.__index__=0,R.__values__=n,m?P.__wrapped__=R:m=R;var P=R;E=E.__wrapped__}return P.__wrapped__=p,m}function out(){var p=this.__wrapped__;if(p instanceof hn){var m=p;return this.__actions__.length&&(m=new hn(this)),m=m.reverse(),m.__actions__.push({func:jb,args:[_E],thisArg:n}),new ta(m,this.__chain__)}return this.thru(_E)}function aut(){return ZN(this.__wrapped__,this.__actions__)}var lut=Lb(function(p,m,E){Kn.call(p,E)?++p[E]:Bc(p,E,1)});function cut(p,m,E){var R=qe(p)?fN:Qat;return E&&bs(p,m,E)&&(m=n),R(p,ge(m,3))}function uut(p,m){var E=qe(p)?nf:LN;return E(p,ge(m,3))}var fut=c7(R7),hut=c7(C7);function dut(p,m){return Pi(Vb(p,m),1)}function put(p,m){return Pi(Vb(p,m),B)}function gut(p,m,E){return E=E===n?1:We(E),Pi(Vb(p,m),E)}function F7(p,m){var E=qe(p)?Zo:af;return E(p,ge(m,3))}function B7(p,m){var E=qe(p)?Oot:ON;return E(p,ge(m,3))}var mut=Lb(function(p,m,E){Kn.call(p,E)?p[E].push(m):Bc(p,E,[m])});function yut(p,m,E,R){p=Ys(p)?p:Up(p),E=E&&!R?We(E):0;var P=p.length;return E<0&&(E=_i(P+E,0)),Xb(p)?E<=P&&p.indexOf(m,E)>-1:!!P&&Mp(p,m,E)>-1}var vut=Ze(function(p,m,E){var R=-1,P=typeof m=="function",W=Ys(p)?bt(p.length):[];return af(p,function(K){W[++R]=P?xo(m,K,E):Mm(K,m,E)}),W}),but=Lb(function(p,m,E){Bc(p,E,m)});function Vb(p,m){var E=qe(p)?Rr:zN;return E(p,ge(m,3))}function _ut(p,m,E,R){return p==null?[]:(qe(m)||(m=m==null?[]:[m]),E=R?n:E,qe(E)||(E=E==null?[]:[E]),WN(p,m,E))}var wut=Lb(function(p,m,E){p[E?0:1].push(m)},function(){return[[],[]]});function xut(p,m,E){var R=qe(p)?$A:gN,P=arguments.length<3;return R(p,ge(m,4),E,P,af)}function Sut(p,m,E){var R=qe(p)?Lot:gN,P=arguments.length<3;return R(p,ge(m,4),E,P,ON)}function Aut(p,m){var E=qe(p)?nf:LN;return E(p,Hb(ge(m,3)))}function Eut(p){var m=qe(p)?RN:ylt;return m(p)}function kut(p,m,E){(E?bs(p,m,E):m===n)?m=1:m=We(m);var R=qe(p)?Gat:vlt;return R(p,m)}function Tut(p){var m=qe(p)?Xat:_lt;return m(p)}function Mut(p){if(p==null)return 0;if(Ys(p))return Xb(p)?Rp(p):p.length;var m=Ji(p);return m==wt||m==le?p.size:ZA(p).length}function Iut(p,m,E){var R=qe(p)?OA:wlt;return E&&bs(p,m,E)&&(m=n),R(p,ge(m,3))}var Rut=Ze(function(p,m){if(p==null)return[];var E=m.length;return E>1&&bs(p,m[0],m[1])?m=[]:E>2&&bs(m[0],m[1],m[2])&&(m=[m[0]]),WN(p,Pi(m,1),[])}),Wb=uat||function(){return Bi.Date.now()};function Cut(p,m){if(typeof m!="function")throw new Qo(o);return p=We(p),function(){if(--p<1)return m.apply(this,arguments)}}function P7(p,m,E){return m=E?n:m,m=p&&m==null?p.length:m,Pc(p,T,n,n,n,n,m)}function U7(p,m){var E;if(typeof m!="function")throw new Qo(o);return p=We(p),function(){return--p>0&&(E=m.apply(this,arguments)),p<=1&&(m=n),E}}var xE=Ze(function(p,m,E){var R=v;if(E.length){var P=sf(E,Bp(xE));R|=k}return Pc(p,R,m,E,P)}),z7=Ze(function(p,m,E){var R=v|b;if(E.length){var P=sf(E,Bp(z7));R|=k}return Pc(m,R,p,E,P)});function q7(p,m,E){m=E?n:m;var R=Pc(p,w,n,n,n,n,n,m);return R.placeholder=q7.placeholder,R}function j7(p,m,E){m=E?n:m;var R=Pc(p,S,n,n,n,n,n,m);return R.placeholder=j7.placeholder,R}function V7(p,m,E){var R,P,W,K,nt,ht,Et=0,Tt=!1,$t=!1,jt=!0;if(typeof p!="function")throw new Qo(o);m=ia(m)||0,Br(E)&&(Tt=!!E.leading,$t="maxWait"in E,W=$t?_i(ia(E.maxWait)||0,m):W,jt="trailing"in E?!!E.trailing:jt);function ne(oi){var Xa=R,Vc=P;return R=P=n,Et=oi,K=p.apply(Vc,Xa),K}function Se(oi){return Et=oi,nt=$m(an,m),Tt?ne(oi):K}function Xe(oi){var Xa=oi-ht,Vc=oi-Et,c$=m-Xa;return $t?Ki(c$,W-Vc):c$}function Ae(oi){var Xa=oi-ht,Vc=oi-Et;return ht===n||Xa>=m||Xa<0||$t&&Vc>=W}function an(){var oi=Wb();if(Ae(oi))return gn(oi);nt=$m(an,Xe(oi))}function gn(oi){return nt=n,jt&&R?ne(oi):(R=P=n,K)}function ko(){nt!==n&&t7(nt),Et=0,R=ht=P=nt=n}function _s(){return nt===n?K:gn(Wb())}function To(){var oi=Wb(),Xa=Ae(oi);if(R=arguments,P=this,ht=oi,Xa){if(nt===n)return Se(ht);if($t)return t7(nt),nt=$m(an,m),ne(ht)}return nt===n&&(nt=$m(an,m)),K}return To.cancel=ko,To.flush=_s,To}var Nut=Ze(function(p,m){return $N(p,1,m)}),$ut=Ze(function(p,m,E){return $N(p,ia(m)||0,E)});function Out(p){return Pc(p,I)}function Yb(p,m){if(typeof p!="function"||m!=null&&typeof m!="function")throw new Qo(o);var E=function(){var R=arguments,P=m?m.apply(this,R):R[0],W=E.cache;if(W.has(P))return W.get(P);var K=p.apply(this,R);return E.cache=W.set(P,K)||W,K};return E.cache=new(Yb.Cache||Fc),E}Yb.Cache=Fc;function Hb(p){if(typeof p!="function")throw new Qo(o);return function(){var m=arguments;switch(m.length){case 0:return!p.call(this);case 1:return!p.call(this,m[0]);case 2:return!p.call(this,m[0],m[1]);case 3:return!p.call(this,m[0],m[1],m[2])}return!p.apply(this,m)}}function Lut(p){return U7(2,p)}var Dut=xlt(function(p,m){m=m.length==1&&qe(m[0])?Rr(m[0],So(ge())):Rr(Pi(m,1),So(ge()));var E=m.length;return Ze(function(R){for(var P=-1,W=Ki(R.length,E);++P=m}),Uh=BN(function(){return arguments}())?BN:function(p){return Yr(p)&&Kn.call(p,"callee")&&!AN.call(p,"callee")},qe=bt.isArray,Jut=sN?So(sN):slt;function Ys(p){return p!=null&&Gb(p.length)&&!qc(p)}function si(p){return Yr(p)&&Ys(p)}function Zut(p){return p===!0||p===!1||Yr(p)&&vs(p)==vt}var ff=hat||OE,Qut=oN?So(oN):olt;function tft(p){return Yr(p)&&p.nodeType===1&&!Om(p)}function eft(p){if(p==null)return!0;if(Ys(p)&&(qe(p)||typeof p=="string"||typeof p.splice=="function"||ff(p)||Pp(p)||Uh(p)))return!p.length;var m=Ji(p);if(m==wt||m==le)return!p.size;if(Nm(p))return!ZA(p).length;for(var E in p)if(Kn.call(p,E))return!1;return!0}function nft(p,m){return Im(p,m)}function rft(p,m,E){E=typeof E=="function"?E:n;var R=E?E(p,m):n;return R===n?Im(p,m,n,E):!!R}function AE(p){if(!Yr(p))return!1;var m=vs(p);return m==mt||m==Z||typeof p.message=="string"&&typeof p.name=="string"&&!Om(p)}function ift(p){return typeof p=="number"&&kN(p)}function qc(p){if(!Br(p))return!1;var m=vs(p);return m==at||m==Ct||m==lt||m==Re}function Y7(p){return typeof p=="number"&&p==We(p)}function Gb(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=V}function Br(p){var m=typeof p;return p!=null&&(m=="object"||m=="function")}function Yr(p){return p!=null&&typeof p=="object"}var H7=aN?So(aN):llt;function sft(p,m){return p===m||JA(p,m,pE(m))}function oft(p,m,E){return E=typeof E=="function"?E:n,JA(p,m,pE(m),E)}function aft(p){return G7(p)&&p!=+p}function lft(p){if(Wlt(p))throw new Be(s);return PN(p)}function cft(p){return p===null}function uft(p){return p==null}function G7(p){return typeof p=="number"||Yr(p)&&vs(p)==Bt}function Om(p){if(!Yr(p)||vs(p)!=kt)return!1;var m=wb(p);if(m===null)return!0;var E=Kn.call(m,"constructor")&&m.constructor;return typeof E=="function"&&E instanceof E&&yb.call(E)==oat}var EE=lN?So(lN):clt;function fft(p){return Y7(p)&&p>=-V&&p<=V}var X7=cN?So(cN):ult;function Xb(p){return typeof p=="string"||!qe(p)&&Yr(p)&&vs(p)==Ke}function Eo(p){return typeof p=="symbol"||Yr(p)&&vs(p)==ce}var Pp=uN?So(uN):flt;function hft(p){return p===n}function dft(p){return Yr(p)&&Ji(p)==Je}function pft(p){return Yr(p)&&vs(p)==wr}var gft=Pb(QA),mft=Pb(function(p,m){return p<=m});function K7(p){if(!p)return[];if(Ys(p))return Xb(p)?Ya(p):Ws(p);if(wm&&p[wm])return Got(p[wm]());var m=Ji(p),E=m==wt?UA:m==le?pb:Up;return E(p)}function jc(p){if(!p)return p===0?p:0;if(p=ia(p),p===B||p===-B){var m=p<0?-1:1;return m*U}return p===p?p:0}function We(p){var m=jc(p),E=m%1;return m===m?E?m-E:m:0}function J7(p){return p?Dh(We(p),0,q):0}function ia(p){if(typeof p=="number")return p;if(Eo(p))return z;if(Br(p)){var m=typeof p.valueOf=="function"?p.valueOf():p;p=Br(m)?m+"":m}if(typeof p!="string")return p===0?p:+p;p=mN(p);var E=je.test(p);return E||An.test(p)?Cot(p.slice(2),E?2:8):ie.test(p)?z:+p}function Z7(p){return Ll(p,Hs(p))}function yft(p){return p?Dh(We(p),-V,V):p===0?p:0}function jn(p){return p==null?"":Ao(p)}var vft=Dp(function(p,m){if(Nm(m)||Ys(m)){Ll(m,Ii(m),p);return}for(var E in m)Kn.call(m,E)&&km(p,E,m[E])}),Q7=Dp(function(p,m){Ll(m,Hs(m),p)}),Kb=Dp(function(p,m,E,R){Ll(m,Hs(m),p,R)}),bft=Dp(function(p,m,E,R){Ll(m,Ii(m),p,R)}),_ft=Uc(YA);function wft(p,m){var E=Lp(p);return m==null?E:CN(E,m)}var xft=Ze(function(p,m){p=ur(p);var E=-1,R=m.length,P=R>2?m[2]:n;for(P&&bs(m[0],m[1],P)&&(R=1);++E1),W}),Ll(p,hE(p),E),R&&(E=ea(E,f|h|d,$lt));for(var P=m.length;P--;)iE(E,m[P]);return E});function Uft(p,m){return e$(p,Hb(ge(m)))}var zft=Uc(function(p,m){return p==null?{}:plt(p,m)});function e$(p,m){if(p==null)return{};var E=Rr(hE(p),function(R){return[R]});return m=ge(m),YN(p,E,function(R,P){return m(R,P[0])})}function qft(p,m,E){m=cf(m,p);var R=-1,P=m.length;for(P||(P=1,p=n);++Rm){var R=p;p=m,m=R}if(E||p%1||m%1){var P=TN();return Ki(p+P*(m-p+Rot("1e-"+((P+"").length-1))),m)}return eE(p,m)}var Qft=Fp(function(p,m,E){return m=m.toLowerCase(),p+(E?i$(m):m)});function i$(p){return ME(jn(p).toLowerCase())}function s$(p){return p=jn(p),p&&p.replace(Dn,jot).replace(_ot,"")}function tht(p,m,E){p=jn(p),m=Ao(m);var R=p.length;E=E===n?R:Dh(We(E),0,R);var P=E;return E-=m.length,E>=0&&p.slice(E,P)==m}function eht(p){return p=jn(p),p&&Mh.test(p)?p.replace(tf,Vot):p}function nht(p){return p=jn(p),p&&Rt.test(p)?p.replace(Ch,"\\$&"):p}var rht=Fp(function(p,m,E){return p+(E?"-":"")+m.toLowerCase()}),iht=Fp(function(p,m,E){return p+(E?" ":"")+m.toLowerCase()}),sht=l7("toLowerCase");function oht(p,m,E){p=jn(p),m=We(m);var R=m?Rp(p):0;if(!m||R>=m)return p;var P=(m-R)/2;return Bb(Eb(P),E)+p+Bb(Ab(P),E)}function aht(p,m,E){p=jn(p),m=We(m);var R=m?Rp(p):0;return m&&R>>0,E?(p=jn(p),p&&(typeof m=="string"||m!=null&&!EE(m))&&(m=Ao(m),!m&&Ip(p))?uf(Ya(p),0,E):p.split(m,E)):[]}var pht=Fp(function(p,m,E){return p+(E?" ":"")+ME(m)});function ght(p,m,E){return p=jn(p),E=E==null?0:Dh(We(E),0,p.length),m=Ao(m),p.slice(E,E+m.length)==m}function mht(p,m,E){var R=j.templateSettings;E&&bs(p,m,E)&&(m=n),p=jn(p),m=Kb({},m,R,g7);var P=Kb({},m.imports,R.imports,g7),W=Ii(P),K=PA(P,W),nt,ht,Et=0,Tt=m.interpolate||Fr,$t="__p += '",jt=zA((m.escape||Fr).source+"|"+Tt.source+"|"+(Tt===Ih?Ot:Fr).source+"|"+(m.evaluate||Fr).source+"|$","g"),ne="//# sourceURL="+(Kn.call(m,"sourceURL")?(m.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Eot+"]")+` +`;p.replace(jt,function(Ae,an,gn,ko,_s,To){return gn||(gn=ko),$t+=p.slice(Et,To).replace(Ti,Wot),an&&(nt=!0,$t+=`' + +__e(`+an+`) + +'`),_s&&(ht=!0,$t+=`'; +`+_s+`; +__p += '`),gn&&($t+=`' + +((__t = (`+gn+`)) == null ? '' : __t) + +'`),Et=To+Ae.length,Ae}),$t+=`'; +`;var Se=Kn.call(m,"variable")&&m.variable;if(!Se)$t=`with (obj) { +`+$t+` +} +`;else if(on.test(Se))throw new Be(a);$t=(ht?$t.replace(Zu,""):$t).replace(ys,"$1").replace(Qu,"$1;"),$t="function("+(Se||"obj")+`) { +`+(Se?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(nt?", __e = _.escape":"")+(ht?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+$t+`return __p +}`;var Xe=a$(function(){return Fn(W,ne+"return "+$t).apply(n,K)});if(Xe.source=$t,AE(Xe))throw Xe;return Xe}function yht(p){return jn(p).toLowerCase()}function vht(p){return jn(p).toUpperCase()}function bht(p,m,E){if(p=jn(p),p&&(E||m===n))return mN(p);if(!p||!(m=Ao(m)))return p;var R=Ya(p),P=Ya(m),W=yN(R,P),K=vN(R,P)+1;return uf(R,W,K).join("")}function _ht(p,m,E){if(p=jn(p),p&&(E||m===n))return p.slice(0,_N(p)+1);if(!p||!(m=Ao(m)))return p;var R=Ya(p),P=vN(R,Ya(m))+1;return uf(R,0,P).join("")}function wht(p,m,E){if(p=jn(p),p&&(E||m===n))return p.replace(Vt,"");if(!p||!(m=Ao(m)))return p;var R=Ya(p),P=yN(R,Ya(m));return uf(R,P).join("")}function xht(p,m){var E=C,R=N;if(Br(m)){var P="separator"in m?m.separator:P;E="length"in m?We(m.length):E,R="omission"in m?Ao(m.omission):R}p=jn(p);var W=p.length;if(Ip(p)){var K=Ya(p);W=K.length}if(E>=W)return p;var nt=E-Rp(R);if(nt<1)return R;var ht=K?uf(K,0,nt).join(""):p.slice(0,nt);if(P===n)return ht+R;if(K&&(nt+=ht.length-nt),EE(P)){if(p.slice(nt).search(P)){var Et,Tt=ht;for(P.global||(P=zA(P.source,jn(Ut.exec(P))+"g")),P.lastIndex=0;Et=P.exec(Tt);)var $t=Et.index;ht=ht.slice(0,$t===n?nt:$t)}}else if(p.indexOf(Ao(P),nt)!=nt){var jt=ht.lastIndexOf(P);jt>-1&&(ht=ht.slice(0,jt))}return ht+R}function Sht(p){return p=jn(p),p&&Ap.test(p)?p.replace(Th,Zot):p}var Aht=Fp(function(p,m,E){return p+(E?" ":"")+m.toUpperCase()}),ME=l7("toUpperCase");function o$(p,m,E){return p=jn(p),m=E?n:m,m===n?Hot(p)?eat(p):Bot(p):p.match(m)||[]}var a$=Ze(function(p,m){try{return xo(p,n,m)}catch(E){return AE(E)?E:new Be(E)}}),Eht=Uc(function(p,m){return Zo(m,function(E){E=Dl(E),Bc(p,E,xE(p[E],p))}),p});function kht(p){var m=p==null?0:p.length,E=ge();return p=m?Rr(p,function(R){if(typeof R[1]!="function")throw new Qo(o);return[E(R[0]),R[1]]}):[],Ze(function(R){for(var P=-1;++PV)return[];var E=q,R=Ki(p,q);m=ge(m),p-=q;for(var P=BA(R,m);++E0||m<0)?new hn(E):(p<0?E=E.takeRight(-p):p&&(E=E.drop(p)),m!==n&&(m=We(m),E=m<0?E.dropRight(-m):E.take(m-p)),E)},hn.prototype.takeRightWhile=function(p){return this.reverse().takeWhile(p).reverse()},hn.prototype.toArray=function(){return this.take(q)},Ol(hn.prototype,function(p,m){var E=/^(?:filter|find|map|reject)|While$/.test(m),R=/^(?:head|last)$/.test(m),P=j[R?"take"+(m=="last"?"Right":""):m],W=R||/^find/.test(m);P&&(j.prototype[m]=function(){var K=this.__wrapped__,nt=R?[1]:arguments,ht=K instanceof hn,Et=nt[0],Tt=ht||qe(K),$t=function(an){var gn=P.apply(j,rf([an],nt));return R&&jt?gn[0]:gn};Tt&&E&&typeof Et=="function"&&Et.length!=1&&(ht=Tt=!1);var jt=this.__chain__,ne=!!this.__actions__.length,Se=W&&!jt,Xe=ht&&!ne;if(!W&&Tt){K=Xe?K:new hn(this);var Ae=p.apply(K,nt);return Ae.__actions__.push({func:jb,args:[$t],thisArg:n}),new ta(Ae,jt)}return Se&&Xe?p.apply(this,nt):(Ae=this.thru($t),Se?R?Ae.value()[0]:Ae.value():Ae)})}),Zo(["pop","push","shift","sort","splice","unshift"],function(p){var m=gb[p],E=/^(?:push|sort|unshift)$/.test(p)?"tap":"thru",R=/^(?:pop|shift)$/.test(p);j.prototype[p]=function(){var P=arguments;if(R&&!this.__chain__){var W=this.value();return m.apply(qe(W)?W:[],P)}return this[E](function(K){return m.apply(qe(K)?K:[],P)})}}),Ol(hn.prototype,function(p,m){var E=j[m];if(E){var R=E.name+"";Kn.call(Op,R)||(Op[R]=[]),Op[R].push({name:m,func:E})}}),Op[Db(n,b).name]=[{name:"wrapper",func:n}],hn.prototype.clone=Sat,hn.prototype.reverse=Aat,hn.prototype.value=Eat,j.prototype.at=tut,j.prototype.chain=eut,j.prototype.commit=nut,j.prototype.next=rut,j.prototype.plant=sut,j.prototype.reverse=out,j.prototype.toJSON=j.prototype.valueOf=j.prototype.value=aut,j.prototype.first=j.prototype.head,wm&&(j.prototype[wm]=iut),j},Cp=nat();Nh?((Nh.exports=Cp)._=Cp,RA._=Cp):Bi._=Cp}).call(c9t)}(Tw,Tw.exports)),Tw.exports}var y5=u9t();const ost=b8(y5),f9t={headerHeight:null,columnConfigs:{},onColumnConfigsChange:()=>{},minColumnWidths:{},rowRenderBatchSize:4,minFetchSize:1,renderWindowOffset:400,verticalScrollbarPillHeight:4,verticalScrollbarWidth:24,horizontalScrollbarHeight:16,lineHeight:20,textMaxLines:3,betweenRowPadding:8,betweenColPadding:24,scrollOverflowValue:1e6,onRowClick:null,highlightedRows:null,firstColLeftPadding:8,showRowNumber:!0,onShowRowNumberChange:()=>{},highlightHoveredRow:!1,get rowHeight(){return this.textMaxLines*this.lineHeight+this.betweenRowPadding},DEFAULT_TEXT_MAX_LINES:3,DEFAULT_LINE_HEIGHT:20,DEFAULT_ROW_NUMBER_COL_WIDTH:60};class h9t{#t=Jt(ls(f9t));get config(){return H(this.#t)}set config(t){It(this.#t,t,!0)}}const dB=Symbol("config");let nr=class{static initialize(){ga(dB,new h9t)}static get config(){const t=no(dB);if(t==null)throw new Error("config context not yet set");return t.config}};class d9t{tableModel;tableController;margin=2;isDragging=!1;lastDragX=0;#t=Jt(0);get elementWidth(){return H(this.#t)}set elementWidth(t){It(this.#t,t,!0)}#e=Dt(()=>this.elementWidth-this.margin*2);get scrollbarWidth(){return H(this.#e)}set scrollbarWidth(t){It(this.#e,t)}#n=Dt(()=>this.tableController.viewWidth/this.tableModel.colsRightmostPosition*this.scrollbarWidth);get pillWidth(){return H(this.#n)}set pillWidth(t){It(this.#n,t)}#r=Dt(()=>-this.tableController.xScroll/this.tableModel.colsRightmostPosition*this.scrollbarWidth);get pillLeft(){return H(this.#r)}set pillLeft(t){It(this.#r,t)}constructor({tableModel:t,tableController:n}){this.tableModel=t,this.tableController=n}handlePointerDown=t=>{t.preventDefault(),t.target.setPointerCapture(t.pointerId),this.isDragging=!0,this.lastDragX=t.offsetX};handlePointerMove=t=>{this.isDragging&&this.lastDragX!==null&&this.tableController.scroll({deltaX:t.offsetX-this.lastDragX,deltaY:0})};handlePointerUp=t=>{t.target.releasePointerCapture(t.pointerId),this.isDragging=!1,this.lastDragX=null}}const pB="mosaic-coordinator";class v5{static get coordinator(){return no(pB)??Va()}static set coordinator(t){ga(pB,t)}}const Qs="__oid",p9t=120;class g9t{schema;#t=Jt(ls({}));get data(){return H(this.#t)}set data(t){It(this.#t,t,!0)}#e=Jt(ls({}));get defaultColWidths(){return H(this.#e)}set defaultColWidths(t){It(this.#e,t,!0)}#n=Jt(ls([]));get columns(){return H(this.#n)}set columns(t){It(this.#n,t,!0)}#r=Jt(0);get numRows(){return H(this.#r)}set numRows(t){It(this.#r,t,!0)}#c=Jt(0);get renderOffset(){return H(this.#c)}set renderOffset(t){It(this.#c,t,!0)}#i=Jt(ls({}));get rowHeightAddition(){return H(this.#i)}set rowHeightAddition(t){It(this.#i,t,!0)}#s=Dt(()=>this.columns.reduce((t,n)=>(nr.config.columnConfigs[n]?.hidden&&t.add(n),n===Qs&&nr.config.showRowNumber===!1&&t.add(Qs),t),new Set));get hiddenColumns(){return H(this.#s)}set hiddenColumns(t){It(this.#s,t)}rowKeyColumn=null;constructor(t){this.schema=t}#a=Dt(()=>Object.keys(this.data).sort((t,n)=>this.data[t][Qs]-this.data[n][Qs]));get renderableRows(){return H(this.#a)}set renderableRows(t){It(this.#a,t)}#o=Dt(()=>this.columns.filter(t=>!this.hiddenColumns.has(t)));get renderableCols(){return H(this.#o)}set renderableCols(t){It(this.#o,t)}#l=Dt(()=>this.renderableRows.length===0?this.zeroRowPosition:Math.min(...this.renderableRows.map(t=>this.rowPositions[t])));get minRowPosition(){return H(this.#l)}set minRowPosition(t){It(this.#l,t)}#f=Dt(()=>this.renderableRows.length===0?this.finalRowPosition:Math.max(...this.renderableRows.map(t=>this.rowPositions[t])));get maxRowPosition(){return H(this.#f)}set maxRowPosition(t){It(this.#f,t)}#u=Dt(()=>{const t=Math.min(...this.renderableRows.map(n=>this.data[n][Qs]));return Number.isSafeInteger(t)?t:0});get minRowOID(){return H(this.#u)}set minRowOID(t){It(this.#u,t)}#p=Dt(()=>{const t=Math.max(...this.renderableRows.map(n=>this.data[n][Qs]));return Number.isSafeInteger(t)?t:0});get maxRowOID(){return H(this.#p)}set maxRowOID(t){It(this.#p,t)}#h=Dt(()=>0);get zeroRowPosition(){return H(this.#h)}set zeroRowPosition(t){It(this.#h,t)}#d=Dt(()=>(this.numRows-1)*nr.config.rowHeight+this.rowPositionOffsets.cumulative);get finalRowPosition(){return H(this.#d)}set finalRowPosition(t){It(this.#d,t)}colsLeftmostPosition=0;#g=Dt(()=>{const t=this.renderableCols[this.renderableCols.length-1];return this.colPositions[t]+this.colWidths[t]});get colsRightmostPosition(){return H(this.#g)}set colsRightmostPosition(t){It(this.#g,t)}#m=Dt(()=>this.renderableRows.reduce(({offsets:t,cumulative:n},r)=>{t[r]=n;const i=this.rowHeightAddition[r]??0;return{offsets:t,cumulative:n+i}},{offsets:{},cumulative:0}));get rowPositionOffsets(){return H(this.#m)}set rowPositionOffsets(t){It(this.#m,t)}#y=Dt(()=>this.renderableRows.reduce((t,n)=>{const r=(this.data[n][Qs]-1)*nr.config.rowHeight+this.rowPositionOffsets.offsets[n];return t[n]=r,t},{}));get rowPositions(){return H(this.#y)}set rowPositions(t){It(this.#y,t)}#v=Dt(()=>{let t=0;return this.columns.reduce((n,r,i)=>(this.hiddenColumns.has(r)||(n[r]=t,t+=this.colWidths[r]),n),{})});get colPositions(){return H(this.#v)}set colPositions(t){It(this.#v,t)}#b=Dt(()=>this.renderableRows.reduce((t,n)=>(t[n]=nr.config.rowHeight+(this.rowHeightAddition[n]??0),t),{}));get rowHeights(){return H(this.#b)}set rowHeights(t){It(this.#b,t)}#_=Dt(()=>this.columns.reduce((t,n,r)=>(t[n]=Math.max(nr.config.columnConfigs[n]?.width??this.defaultColWidths[n]??p9t,nr.config.minColumnWidths[n]??0),this.isFirstCol(n)&&(t[n]+=nr.config.firstColLeftPadding),this.isLastCol(n)&&(t[n]+=nr.config.verticalScrollbarWidth),t),{}));get colWidths(){return H(this.#_)}set colWidths(t){It(this.#_,t)}getContent({row:t,col:n}){return this.data[t]?this.data[t][n]:null}getRowData(t){return this.data[t]?this.data[t]:null}getPosition({row:t,col:n}){const r=this.colPositions[n],i=this.rowPositions[t];return{x:r,y:i}}getDimensions({row:t,col:n}){const r=this.colWidths[n],i=this.rowHeights[t];return{width:r,height:i}}getRowParity(t){return this.data[t]&&this.data[t][Qs]%2===0?"even":"odd"}isFirstCol(t){return this.renderableCols.indexOf(t)===0}isLastCol(t){return this.renderableCols.indexOf(t)===this.renderableCols.length-1}deleteRow(t){delete this.data[t];const n=this.rowHeightAddition[t]??0;return delete this.rowHeightAddition[t],n}collapseRow(t){const n=this.rowHeightAddition[t]??0;return delete this.rowHeightAddition[t],n}reset(){this.data={},this.rowHeightAddition={}}teardown(){this.reset()}}class m9t extends ch{tableName;onResult;constructor(t,n,r){super(n??void 0),this.tableName=t,this.onResult=r}queryResult(t){const n=t.toArray()[0].count;return this.onResult(n),this}query(t=[]){return zt.from(this.tableName).select({count:ar()}).where(t)}}const to="__oid";class y9t extends ch{tableName;columns;onResult;onColumnInfo;limit=20;offset=0;sort=null;info=null;columnInfo=null;isReady=!1;constructor(t,n,r,i,s){super(r??void 0),this.tableName=t,this.columns=n,this.onResult=i,this.onColumnInfo=s}async prepare(){if(this.coordinator==null)return;const t=(await rI(this.coordinator,[{table:this.tableName,column:"*"}])).reduce((n,r)=>(n[r.column]=r,n),{});this.columnInfo=t,this.onColumnInfo(t),this.isReady=!0}getSelect({includeRowNumber:t}={includeRowNumber:!0}){const n=this.columns.reduce((r,i)=>(this.columnInfo?.[i]?.sqlType==="BIGINT"?r[i]=Xr(Mt(i),"TEXT"):r[i]=Mt(i),r),{});return t||delete n[to],n}queryResult(t){return this.onResult(t),this}query(t=[]){if(!this.isReady)return null;const n=this.columns.reduce((r,i)=>(this.columnInfo?.[i]?.sqlType==="BIGINT"?r[i]=Xr(Mt(i),"TEXT"):r[i]=Mt(i),r),{});if(n[to]=FU(),this.sort){const r=this.sort.direction==="ascending"?this.sort.column:Vg(this.sort.column);n[to]=n[to].orderby(r)}return zt.from(this.tableName).select(n).where(t).limit(this.limit).offset(this.offset)}fetchRows(t,n){this.offset=t,this.limit=n,this.requestUpdate()}}class v9t{model;schema;config;#t=Dt(()=>v5.coordinator);get coordinator(){return H(this.#t)}set coordinator(t){It(this.#t,t)}filterBy=null;rowsClient=null;numRowsClient=null;rowKeyColumn=null;#e=Jt(null);get element(){return H(this.#e)}set element(t){It(this.#e,t,!0)}#n=Jt(0);get viewHeight(){return H(this.#n)}set viewHeight(t){It(this.#n,t,!0)}#r=Jt(0);get viewWidth(){return H(this.#r)}set viewWidth(t){It(this.#r,t,!0)}#c=Jt(0);get yScroll(){return H(this.#c)}set yScroll(t){It(this.#c,t,!0)}#i=Jt(0);get xScroll(){return H(this.#i)}set xScroll(t){It(this.#i,t,!0)}#s=Jt(!1);get isFetching(){return H(this.#s)}set isFetching(t){It(this.#s,t,!0)}#a=Jt(!1);get isJumping(){return H(this.#a)}set isJumping(t){It(this.#a,t,!0)}#o=Jt(null);get sort(){return H(this.#o)}set sort(t){It(this.#o,t,!0)}#l=Jt(!1);get isReady(){return H(this.#l)}set isReady(t){It(this.#l,t,!0)}#f=Jt(0);get updateKey(){return H(this.#f)}set updateKey(t){It(this.#f,t,!0)}#u=Jt(!1);get isStale(){return H(this.#u)}set isStale(t){It(this.#u,t,!0)}#p=Jt(null);get flashedRowId(){return H(this.#p)}set flashedRowId(t){It(this.#p,t,!0)}#h=Jt(null);get hoveredRowId(){return H(this.#h)}set hoveredRowId(t){It(this.#h,t,!0)}#d=Dt(()=>Math.ceil(this.viewHeight/nr.config.rowHeight));get rowsOnScreen(){return H(this.#d)}set rowsOnScreen(t){It(this.#d,t)}#g=Dt(()=>this.isJumping?0:nr.config.renderWindowOffset);get renderWindowOffset(){return H(this.#g)}set renderWindowOffset(t){It(this.#g,t)}#m=Dt(()=>{if(this.model.renderableRows.length===0)return null;const t=this.model.renderableRows.filter(r=>{const i=this.model.rowPositions[r]+this.yScroll;return i+this.model.rowHeights[r]>0&&iMath.max(0,Math.floor(-this.yScroll/nr.config.rowHeight)));get offset(){return H(this.#y)}set offset(t){It(this.#y,t)}onFetchResolveBegin=null;onFetchResolveEnd=null;constructor(t,n){this.model=t,this.schema=n,this.config=nr.config}handleFilterBy=()=>{this.rowsClient&&(this.rowsClient.offset=0,this.rowsClient.limit=this.rowsOnScreen,this.isJumping=!0,this.markStale())};updateData=t=>{if(!this.model||!this.rowKeyColumn)return;this.onFetchResolveBegin&&(this.onFetchResolveBegin(),this.onFetchResolveBegin=null);const n=t.toArray(),r={};for(const i of n){const s=i[this.rowKeyColumn];r[s]=i}this.model.data={...this.model.data,...r},this.onFetchResolveEnd&&(this.onFetchResolveEnd(),this.onFetchResolveEnd=null),this.isFetching=!1};initialize({tableName:t,rowKey:n,columns:r,filterBy:i}){if(this.model.columns=r,this.model.rowKeyColumn=n,this.rowKeyColumn=n,i&&(this.filterBy=i,this.filterBy.addEventListener("value",this.handleFilterBy)),!this.rowKeyColumn)throw new Error("rowkey cannot be null");let s=r.includes(this.rowKeyColumn)?r:[...r,this.rowKeyColumn];this.rowsClient=new y9t(t,s,i,o=>{this.updateData(o)},o=>{this.schema.columnInfo=o,this.computeColWidths(t,r),this.isReady=!0}),this.coordinator.connect(this.rowsClient),this.numRowsClient=new m9t(t,i,o=>{this.model&&(this.model.numRows=o)}),this.coordinator.connect(this.numRowsClient),Pr(()=>{if(!this.rowsClient||this.isFetching||!this.isReady)return;const o=-this.renderWindowOffset,a=this.viewHeight+this.renderWindowOffset,l=this.model.maxRowPosition+this.yScroll+this.config.rowHeight,c=this.model.minRowPosition+this.yScroll;if(c<0&&l<0||c>this.viewHeight&&l>this.viewHeight){const y=this.rowsOnScreen;this.isFetching=!0,this.rowsClient.fetchRows(this.offset,y)}else{if(l0&&this.model.maxRowOID!==this.model.numRows&&(this.isFetching=!0,this.rowsClient.fetchRows(this.model.maxRowOID,v))}const y=this.model.minRowPosition+this.yScroll;if(y>o&&this.model.minRowOID!==1){const v=y5.clamp(Math.ceil((y-o)/this.config.rowHeight),this.config.minFetchSize,this.rowsOnScreen);v>0&&(this.isFetching=!0,this.rowsClient.fetchRows(Math.max(0,this.model.minRowOID-1-v),v))}}const u=Sit(this.model.renderableRows);let f=0;for(;this.model.rowPositions[u[f]]+this.yScroll+this.model.rowHeights[u[f]]<0;)this.yScroll+=this.model.collapseRow(u[f]),f+=1;let h=u.length-1;for(;this.model.rowPositions[u[h]]+this.yScroll>this.viewHeight;)this.model.collapseRow(u[h]),h-=1;let d=0;for(;this.model.rowPositions[u[d]]+this.yScroll+this.model.rowHeights[u[d]]a;)this.model.deleteRow(u[g]),g-=1})}teardown(){this.filterBy&&this.filterBy.removeEventListener("value",this.handleFilterBy)}cellIsVisible(t){const{x:n,y:r}=this.model.getPosition(t),{width:i,height:s}=this.model.getDimensions(t),o=n+this.xScroll,a=r+this.yScroll;return o+i>=0&&o<=this.viewWidth&&a+s>=0&&a<=this.viewHeight}rowIsVisible(t){const n=this.model.rowPositions[t],r=this.model.rowHeights[t],i=n+this.yScroll;return i+r>=0&&i<=this.viewHeight}rowStillExists(t){return this.model.data[t]!=null}colIsVisible(t){const n=this.model.colPositions[t],r=this.model.colWidths[t],i=n+this.xScroll;return i+r>=0&&i<=this.viewWidth}scroll({deltaX:t,deltaY:n}){if(Math.abs(n)>Math.abs(t)){const r=this.yScroll-n;this.model.zeroRowPosition+r>0?this.yScroll=-this.model.zeroRowPosition:this.model.finalRowPosition+r<0?this.yScroll=-this.model.finalRowPosition:this.yScroll=r}else{const r=this.xScroll-t;-r<0?this.xScroll=0:-r>Math.max(this.model.colsRightmostPosition,this.viewWidth)-this.viewWidth?this.xScroll=-Math.max(this.model.colsRightmostPosition,this.viewWidth)+this.viewWidth:this.xScroll=r}}handleWheel=t=>{t.preventDefault(),this.isJumping=!1,this.scroll({deltaX:t.deltaX,deltaY:t.deltaY})};jumpToOffset(t){if(!this.rowsClient)return;this.isFetching=!0;const n=this.rowsOnScreen,r=this.onFetchResolveEnd;this.onFetchResolveEnd=()=>{r&&r(),this.yScroll=-(t*this.config.rowHeight)},this.markStale(),this.rowsClient.fetchRows(t,n)}handleSort=t=>{this.rowsClient&&(this.sort=t,this.rowsClient.sort=t,this.resetRows())};resetRows(){this.model.reset(),this.yScroll=0}flashRow(t){this.flashedRowId=t,setTimeout(()=>{this.flashedRowId=null},400)}async scrollToRow(t,n=!0){if(!this.rowsClient)return;this.isFetching=!0;const r=zt.with({original:this.rowsClient.query(this.rowsClient.filterBy?.predicate(this.rowsClient)).offset(0).limit(this.model.numRows)}).select([to]).from("original").where(No(Mt(this.rowKeyColumn),Zt(t))),i=(await this.coordinator.query(r)).toArray();if(i.length>0){const s=i[0][to]-1;this.onFetchResolveEnd=()=>{n&&this.flashRow(t)},this.jumpToOffset(s)}else this.isFetching=!1,console.error("no row",t,"found")}addHeightToRow(t,n){this.model.rowHeightAddition[t]=(this.model.rowHeightAddition[t]??0)+n}hideColumn(t){t===to?this.config.onShowRowNumberChange?this.config.onShowRowNumberChange(!1):this.config.showRowNumber=!1:(this.config.columnConfigs[t]||(this.config.columnConfigs[t]={}),this.config.columnConfigs[t].hidden=!0)}showColumn(t){t===to?this.config.onShowRowNumberChange?this.config.onShowRowNumberChange(!0):this.config.showRowNumber=!0:(this.config.columnConfigs[t]||(this.config.columnConfigs[t]={}),this.config.columnConfigs[t].hidden=!1)}markStale(){this.isStale=!0;const t=this.onFetchResolveBegin;this.onFetchResolveBegin=()=>{t&&t(),this.resetRows()};const n=this.onFetchResolveEnd;this.onFetchResolveEnd=()=>{n&&n(),this.updateKey+=1,this.isStale=!1}}async computeColWidths(t,n){const r=n.filter(l=>l!==to),i=this.rowsClient?.getSelect({includeRowNumber:!1}),s=r.reduce((l,c)=>(l[c]=0,l),{}),o=zt.from(t).select(i).offset(0).limit(10),a=(await this.coordinator.query(o)).toArray();for(const l of a)for(const c of r)s[c]=Math.max(s[c],b9t(l[c]));n.includes(to)&&(s[to]=this.config.DEFAULT_ROW_NUMBER_COL_WIDTH),this.model.defaultColWidths=s}}function b9t(e){const t=String(e).length;return t>200?600:t>100?300:t>20?200:t>10?150:120}class _9t{tableController;#t=Dt(()=>this.tableController.element);get tableElement(){return H(this.#t)}set tableElement(t){It(this.#t,t)}constructor(t){this.tableController=t}mount(t,n,r,i,s){if(!this.tableElement)return;const o=n.getBoundingClientRect(),a=this.tableElement.getBoundingClientRect(),l=a.top,c=a.left;switch(r){case"inside":switch(s){case"top":t.style.top=o.top-l+"px";break;case"middle":case"bottom":throw new Error("not yet implemented"+r+s)}switch(i){case"left":t.style.left=o.left-c+"px";case"center":case"right":throw new Error("not yet implemented"+r+i)}break;case"outside":switch(s){case"top":t.style.top=o.bottom-l+"px";break;case"middle":case"bottom":throw new Error("not yet implemented"+r+s)}switch(i){case"left":t.style.left=o.left-c+"px";break;case"center":case"right":throw new Error("not yet implemented"+r+i)}break}this.tableElement.appendChild(t)}destroy(t){this.tableElement&&this.tableElement.contains(t)&&this.tableElement.removeChild(t)}}var yT,gB;function w9t(){if(gB)return yT;gB=1;function e(t,n,r){return t===t&&(r!==void 0&&(t=t<=r?t:r),n!==void 0&&(t=t>=n?t:n)),t}return yT=e,yT}var vT,mB;function x9t(){if(mB)return vT;mB=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return vT=t,vT}var bT,yB;function S9t(){if(yB)return bT;yB=1;var e=x9t(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return bT=n,bT}var _T,vB;function _8(){if(vB)return _T;vB=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return _T=e,_T}var wT,bB;function A9t(){if(bB)return wT;bB=1;var e=typeof Nf=="object"&&Nf&&Nf.Object===Object&&Nf;return wT=e,wT}var xT,_B;function ast(){if(_B)return xT;_B=1;var e=A9t(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return xT=n,xT}var ST,wB;function lst(){if(wB)return ST;wB=1;var e=ast(),t=e.Symbol;return ST=t,ST}var AT,xB;function E9t(){if(xB)return AT;xB=1;var e=lst(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function s(o){var a=n.call(o,i),l=o[i];try{o[i]=void 0;var c=!0}catch{}var u=r.call(o);return c&&(a?o[i]=l:delete o[i]),u}return AT=s,AT}var ET,SB;function k9t(){if(SB)return ET;SB=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return ET=n,ET}var kT,AB;function T9t(){if(AB)return kT;AB=1;var e=lst(),t=E9t(),n=k9t(),r="[object Null]",i="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?i:r:s&&s in Object(a)?t(a):n(a)}return kT=o,kT}var TT,EB;function M9t(){if(EB)return TT;EB=1;function e(t){return t!=null&&typeof t=="object"}return TT=e,TT}var MT,kB;function I9t(){if(kB)return MT;kB=1;var e=T9t(),t=M9t(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return MT=r,MT}var IT,TB;function cst(){if(TB)return IT;TB=1;var e=S9t(),t=_8(),n=I9t(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=e(c);var f=s.test(c);return f||o.test(c)?a(c.slice(2),f?2:8):i.test(c)?r:+c}return IT=l,IT}var RT,MB;function R9t(){if(MB)return RT;MB=1;var e=w9t(),t=cst();function n(r,i,s){return s===void 0&&(s=i,i=void 0),s!==void 0&&(s=t(s),s=s===s?s:0),i!==void 0&&(i=t(i),i=i===i?i:0),e(t(r),i,s)}return RT=n,RT}var C9t=R9t();const N9t=b8(C9t);var CT,IB;function $9t(){if(IB)return CT;IB=1;var e=ast(),t=function(){return e.Date.now()};return CT=t,CT}var NT,RB;function O9t(){if(RB)return NT;RB=1;var e=_8(),t=$9t(),n=cst(),r="Expected a function",i=Math.max,s=Math.min;function o(a,l,c){var u,f,h,d,g,y,v=0,b=!1,_=!1,w=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(b=!!c.leading,_="maxWait"in c,h=_?i(n(c.maxWait)||0,l):h,w="trailing"in c?!!c.trailing:w);function S(F){var $=u,D=f;return u=f=void 0,v=F,d=a.apply(D,$),d}function k(F){return v=F,g=setTimeout(M,l),b?S(F):d}function A(F){var $=F-y,D=F-v,O=l-$;return _?s(O,h-D):O}function T(F){var $=F-y,D=F-v;return y===void 0||$>=l||$<0||_&&D>=h}function M(){var F=t();if(T(F))return I(F);g=setTimeout(M,A(F))}function I(F){return g=void 0,w&&u?S(F):(u=f=void 0,d)}function C(){g!==void 0&&clearTimeout(g),v=0,u=y=f=g=void 0}function N(){return g===void 0?d:I(t())}function L(){var F=t(),$=T(F);if(u=arguments,f=this,y=F,$){if(g===void 0)return k(y);if(_)return clearTimeout(g),g=setTimeout(M,l),S(y)}return g===void 0&&(g=setTimeout(M,l)),d}return L.cancel=C,L.flush=N,L}return NT=o,NT}var $T,CB;function L9t(){if(CB)return $T;CB=1;var e=O9t(),t=_8(),n="Expected a function";function r(i,s,o){var a=!0,l=!0;if(typeof i!="function")throw new TypeError(n);return t(o)&&(a="leading"in o?!!o.leading:a,l="trailing"in o?!!o.trailing:l),e(i,s,{leading:a,maxWait:s,trailing:l})}return $T=r,$T}var D9t=L9t();const NB=b8(D9t);class F9t{tableModel;tableController;isDragging=!1;#t=Jt(0);get elementHeight(){return H(this.#t)}set elementHeight(t){It(this.#t,t,!0)}#e=Jt(0);get labelHeight(){return H(this.#e)}set labelHeight(t){It(this.#e,t,!0)}#n=Dt(()=>nr.config.verticalScrollbarPillHeight);get pillHeight(){return H(this.#n)}set pillHeight(t){It(this.#n,t)}#r=Dt(()=>this.elementHeight-this.pillHeight);get scrollbarHeight(){return H(this.#r)}set scrollbarHeight(t){It(this.#r,t)}#c=Dt(()=>this.tableController.firstVisibleRowOID?this.tableController.firstVisibleRowOID:this.tableController.offset+1);get displayRow(){return H(this.#c)}set displayRow(t){It(this.#c,t)}#i=Dt(()=>(this.displayRow-1)/(this.tableModel.numRows-1)*this.scrollbarHeight);get pillPosition(){return H(this.#i)}set pillPosition(t){It(this.#i,t)}#s=Dt(()=>{if(this.pillPosition===null)return 0;const t=this.pillPosition+this.pillHeight/2-this.labelHeight/2;if(t<0)return t;const n=this.pillPosition+this.pillHeight/2+this.labelHeight/2;return n>this.elementHeight?n-this.elementHeight:0});get labelOffset(){return H(this.#s)}set labelOffset(t){It(this.#s,t)}constructor({tableModel:t,tableController:n}){this.tableModel=t,this.tableController=n}computeOffsetFromPointer=t=>{this.isDragging=!0;let n=Math.round(t.offsetY/this.scrollbarHeight*(this.tableModel.numRows-1));return N9t(n,0,this.tableModel.numRows-1)};pointerDown=t=>{t.preventDefault(),t.target.setPointerCapture(t.pointerId),this.isDragging=!0;const n=this.computeOffsetFromPointer(t);this.tableController.isJumping=!0,this.tableController.jumpToOffset(n)};handlePointerDown=NB(this.pointerDown,50);pointerMove=t=>{if(this.isDragging){const n=this.computeOffsetFromPointer(t);this.tableController.jumpToOffset(n)}};handlePointerMove=NB(this.pointerMove,50);handlePointerUp=t=>{t.target.releasePointerCapture(t.pointerId),this.isDragging=!1,this.tableController.isJumping=!1}}class B9t{#t=Jt(null);get columnInfo(){return H(this.#t)}set columnInfo(t){It(this.#t,t,!0)}#e=Dt(()=>this.columnInfo?Object.keys(this.columnInfo).reduce((t,n)=>(t[n]=this.columnInfo[n].type,t),{}):{});get dataType(){return H(this.#e)}set dataType(t){It(this.#e,t)}#n=Dt(()=>this.columnInfo?Object.keys(this.columnInfo).reduce((t,n)=>(t[n]=this.columnInfo[n].sqlType,t),{}):{});get sqlType(){return H(this.#n)}set sqlType(t){It(this.#n,t)}}class P9t{tableController;#t=Dt(()=>Math.floor(-this.tableController.yScroll/nr.config.scrollOverflowValue)*nr.config.scrollOverflowValue);get offset(){return H(this.#t)}set offset(t){It(this.#t,t)}constructor(t){this.tableController=t}y(t){return t-this.offset}yScroll(t){return t+this.offset}}const $B=Symbol("schema"),OB=Symbol("model"),LB=Symbol("controller"),DB=Symbol("vertical-scrollbar-controller"),FB=Symbol("horizontal-scrollbar-controller"),BB=Symbol("table-portal-controller"),PB=Symbol("overscroll-modifier");class sr{static initialize(){const t=new B9t,n=new g9t(t),r=new v9t(n,t),i=new F9t({tableModel:n,tableController:r}),s=new d9t({tableModel:n,tableController:r}),o=new _9t(r),a=new P9t(r);ga($B,t),ga(OB,n),ga(LB,r),ga(DB,i),ga(FB,s),ga(BB,o),ga(PB,a)}static get schema(){return no($B)}static get model(){return no(OB)}static get controller(){return no(LB)}static get verticalScrollbarController(){return no(DB)}static get horizontalScrollbarController(){return no(FB)}static get tablePortalController(){return no(BB)}static get overscrollModifier(){return no(PB)}}var U9t=On('
    ');const z9t={hash:"svelte-1poinb5",code:".horizontal-scrollbar.svelte-1poinb5 {position:absolute;bottom:0;left:0;width:100%;height:var(--height);transition:opacity 200ms linear;background-color:var(--scrollbar-bg);}.horizontal-scrollbar.svelte-1poinb5:hover {opacity:1 !important;}.pill.svelte-1poinb5 {width:var(--width);height:calc(var(--height) - var(--margin) * 2);margin:var(--margin);border-radius:2px;background-color:var(--scrollbar-pill-bg);}"};function q9t(e,t){Qr(t,!0),ei(e,z9t);const n=sr.horizontalScrollbarController,r=sr.controller,i=nr.config;let s=Jt(0),o=Jt(null),a=Jt(null),l=0;pm(()=>(l=requestAnimationFrame(f),()=>{cancelAnimationFrame(l)}));function c(){H(o)&&(H(o).style.opacity="0")}const u=ost.debounce(c,1e3);Pr(()=>{H(o)&&(r.xScroll,H(o).style.opacity="1",u())});function f(){It(s,n.pillWidth,!0),H(a)&&(H(a).style.transform=`translate(${n.pillLeft}px, 0)`),l=requestAnimationFrame(f)}var h=U9t();let d;var g=Wn(h);g.__pointerdown=function(...v){n.handlePointerDown?.apply(this,v)},g.__pointermove=function(...v){n.handlePointerMove?.apply(this,v)},g.__pointerup=function(...v){n.handlePointerUp?.apply(this,v)};let y;Bs(g,v=>It(a,v),()=>H(a)),Pn(h),Bs(h,v=>It(o,v),()=>H(o)),ci((v,b)=>{d=vo(h,"",d,v),y=vo(g,"",y,b)},[()=>({"--height":i.horizontalScrollbarHeight+"px"}),()=>({"--width":H(s)+"px","--margin":n.margin+"px"})]),xl(h,"clientWidth",v=>n.elementWidth=v),Qe(e,h),ti()}Ju(["pointerdown","pointermove","pointerup"]);var j9t=On('
    ');const V9t={hash:"svelte-15rl9bf",code:".vertical-scrollbar.svelte-15rl9bf {position:absolute;right:0;top:0;width:var(--width);height:calc(100% - var(--offset-bottom));contain:layout;cursor:row-resize;transition:opacity 200ms linear;user-select:none;background-color:var(--scrollbar-bg);}.vertical-scrollbar.svelte-15rl9bf:hover {opacity:1 !important;}.pill.svelte-15rl9bf {--pill-height: 4px;position:relative;pointer-events:none; /* let the container respond to pointer events */top:0;left:0;width:calc(var(--width) - 2px);margin-left:1px;margin-right:1px;height:var(--pill-height);border-radius:2px;will-change:transform;background-color:var(--scrollbar-pill-bg);}.label.svelte-15rl9bf {--offset: 0;position:absolute;pointer-events:none;top:0;left:-4px;font-family:var(--font-family);font-size:14px;white-space:nowrap;padding:2px 4px;box-shadow:var(--shadow);transform:translate(-100%, calc(-50% + var(--pill-height) / 2 - var(--offset)));border-radius:2px;color:var(--secondary-text-color);background-color:var(--scrollbar-label-bg);border:var(--outline);}"};function W9t(e,t){Qr(t,!0),ei(e,V9t);const n=sr.verticalScrollbarController,r=sr.controller,i=nr.config;let s=Jt(0),o=Jt(0),a=Jt(null),l=Jt(null),c=Jt(null),u=Dt(()=>new Intl.NumberFormat().format(H(o))),f=0;pm(()=>(f=requestAnimationFrame(g),()=>{cancelAnimationFrame(f)}));function h(){H(a)&&(H(a).style.opacity="0")}const d=ost.debounce(h,1e3);Pr(()=>{H(a)&&(r.yScroll,H(a).style.opacity="1",d())});function g(){It(s,n.pillPosition??H(s),!0),It(o,n.displayRow??H(o),!0),H(l)&&(H(l).style.transform=`translate3d(0, ${H(s)}px, 0)`),H(c)&&H(c).style.setProperty("--offset",n.labelOffset-1+"px"),f=requestAnimationFrame(g)}var y=j9t();y.__pointerdown=function(...k){n.handlePointerDown?.apply(this,k)},y.__pointermove=function(...k){n.handlePointerMove?.apply(this,k)},y.__pointerup=function(...k){n.handlePointerUp?.apply(this,k)};let v;var b=Wn(y);let _;var w=Wn(b),S=Wn(w,!0);Pn(w),Bs(w,k=>It(c,k),()=>H(c)),Pn(b),Bs(b,k=>It(l,k),()=>H(l)),Pn(y),Bs(y,k=>It(a,k),()=>H(a)),ci((k,A)=>{v=vo(y,"",v,k),_=vo(b,"",_,A),Lc(S,H(u))},[()=>({"--offset-bottom":i.horizontalScrollbarHeight+"px","--width":i.verticalScrollbarWidth+"px"}),()=>({"--pill-height":n.pillHeight+"px"})]),xl(w,"clientHeight",k=>n.labelHeight=k),xl(y,"clientHeight",k=>n.elementHeight=k),Qe(e,y),ti()}Ju(["pointerdown","pointermove","pointerup"]);var Y9t=On('
    ');const H9t={hash:"svelte-35i9ld",code:".bigint-content.svelte-35i9ld {text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"};function G9t(e,t){Qr(t,!0),ei(e,H9t);let n=gm(t,"height");function r(o){return o===null?null:o.toLocaleString()}var i=Y9t(),s=Wn(i,!0);Pn(i),ci(o=>Lc(s,o),[()=>r(t.bigint)]),xl(i,"clientHeight",n),Qe(e,i),ti()}var X9t=On("
    ");const K9t={hash:"svelte-3kpd",code:""};function J9t(e,t){Qr(t,!0),ei(e,K9t);let n=gm(t,"height");const r=sr.model,i=c=>typeof c=="function"?(u,f)=>{let h=new c(u,f);return{...h.update?{update:h.update.bind(h)}:{},...h.destroy?{destroy:h.destroy.bind(h)}:{}}}:(u,f)=>{let h=new c.class(u,f);return{...h.update?{update:h.update.bind(h)}:{},...h.destroy?{destroy:h.destroy.bind(h)}:{}}};let s=Dt(()=>i(t.customCell)),o=Dt(()=>r.getContent({row:t.row,col:t.col})),a=Dt(()=>r.getRowData(t.row));var l=X9t();y8(l,(c,u)=>H(s)?.(c,u),()=>({value:H(o),rowData:H(a)})),ab(()=>xl(l,"clientHeight",n)),Qe(e,l),ti()}var Z9t=On('');function Q9t(e,t){Qr(t,!0);let n=gm(t,"height");nr.config;let r=Jt(null);function i(u){let f="";for(let h=0;hh.charCodeAt(0)))}function o(u,f){if(u.lengthIt(r,u),()=>H(r)),ci(u=>i1(c,"src",u),[()=>l(t.image)]),Lg("load",c,()=>{H(r)&&n(H(r).scrollHeight)}),BBt(c),Qe(e,c),ti()}var tPt=On(' '),ePt=On('');const nPt={hash:"svelte-3kpd",code:""};function rPt(e,t){Qr(t,!0),ei(e,nPt);let n=gm(t,"height");var r=ePt(),i=Wn(r);{var s=o=>{var a=tPt(),l=Wn(a,!0);Pn(a),ci(()=>{i1(a,"href",t.url),Lc(l,t.url)}),Qe(o,a)};ro(i,o=>{t.url&&o(s)})}Pn(r),xl(r,"clientHeight",n),Qe(e,r),ti()}var iPt=On('
    ');const sPt={hash:"svelte-rqpfez",code:".number-content.svelte-rqpfez {text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"};function oPt(e,t){Qr(t,!0),ei(e,sPt);let n=gm(t,"height");function r(o){return o===null?null:Number.isInteger(o)?o.toString():o.toPrecision(4).toString()}var i=iPt(),s=Wn(i,!0);Pn(i),ci(o=>Lc(s,o),[()=>r(t.number)]),xl(i,"clientHeight",n),Qe(e,i),ti()}var aPt=On("
    ");const lPt={hash:"svelte-122k9kr",code:".clamped.svelte-122k9kr {display:-webkit-box;-webkit-box-orient:vertical;line-clamp:var(--lines, var(--num-lines)); /* fallback to numlines from parent */-webkit-line-clamp:var(--lines, var(--num-lines));overflow:hidden;text-overflow:ellipsis;}"};function UB(e,t){Qr(t,!0),ei(e,lPt);let n=gm(t,"height");const r=nr.config;let i=Jt(null),s=Jt(null);Pr(()=>{H(i)&&(n(H(i).scrollHeight),It(s,Math.floor(t.parentHeight/r.lineHeight),!0))});var o=aPt();let a;var l=Wn(o,!0);Pn(o),Bs(o,c=>It(i,c),()=>H(i)),ci(c=>{oh(o,1,`text-content ${(t.clamped?"clamped":null)??""}`,"svelte-122k9kr"),a=vo(o,"",a,c),Lc(l,t.text)},[()=>({"--lines":H(s)})]),Qe(e,o),ti()}class cPt{#t=Jt(ls({}));get config(){return H(this.#t)}set config(t){It(this.#t,t,!0)}}const OT="custom-cells";class Mw{static initialize(){ga(OT,new cPt)}static set config(t){const n=no(OT);n.config=t}static get config(){return no(OT).config}}var uPt=(e,t,n,r,i)=>{t.addHeightToRow(n.row,H(r)-H(i))},fPt=On(""),hPt=On('
    ');const dPt={hash:"svelte-ix87lc",code:".cell-content.svelte-ix87lc {position:relative;flex-grow:1;line-height:var(--lineHeight);overflow-wrap:anywhere;overflow:hidden;}.expand-button.svelte-ix87lc {all:unset;visibility:hidden;position:absolute;bottom:0;right:0;cursor:pointer;font-size:12px;line-height:18px;padding-left:4px;padding-right:4px;border-radius:2px;color:var(--secondary-text-color);background-color:var(--background-color);border:var(--outline);}.expand-button.show.svelte-ix87lc {visibility:visible;}"};function pPt(e,t){Qr(t,!0),ei(e,dPt);const n=sr.model,r=sr.controller,i=sr.schema,s=nr.config,o=Mw.config;let a=Jt(0),l=Jt(0),c=Dt(()=>H(l)>H(a));const u=n.getContent({row:t.row,col:t.col}),f=i.dataType[t.col]??"string",h=i.sqlType[t.col]??"TEXT";function d(A){return typeof A=="string"&&(A.startsWith("http://")||A.startsWith("https://"))}function g(A){return A==null?!1:!!(typeof A=="string"&&A.startsWith("data:image/")||A.bytes&&A.bytes instanceof Uint8Array)}var y=hPt();let v;var b=Wn(y);{var _=A=>{J9t(A,{get row(){return t.row},get col(){return t.col},get customCell(){return o[t.col]},get height(){return H(l)},set height(T){It(l,T,!0)}})},w=A=>{var T=Kh(),M=Lo(T);{var I=N=>{var L=Kh(),F=Lo(L);{var $=O=>{rPt(O,{get url(){return u},get height(){return H(l)},set height(B){It(l,B,!0)}})},D=O=>{UB(O,{get text(){return u},get clamped(){return H(c)},get parentHeight(){return H(a)},get height(){return H(l)},set height(B){It(l,B,!0)}})};ro(F,O=>{u&&d(u)?O($):O(D,!1)})}Qe(N,L)},C=N=>{var L=Kh(),F=Lo(L);{var $=O=>{var B=Kh(),V=Lo(B);{var U=q=>{{let Y=Dt(()=>BigInt(u??""));G9t(q,{get bigint(){return H(Y)},get height(){return H(l)},set height(Q){It(l,Q,!0)}})}},z=q=>{oPt(q,{get number(){return u},get height(){return H(l)},set height(Y){It(l,Y,!0)}})};ro(V,q=>{h==="BIGINT"?q(U):q(z,!1)})}Qe(O,B)},D=O=>{var B=Kh(),V=Lo(B);{var U=q=>{Q9t(q,{get image(){return u},get height(){return H(l)},set height(Y){It(l,Y,!0)}})},z=q=>{UB(q,{get text(){return u},get clamped(){return H(c)},get parentHeight(){return H(a)},get height(){return H(l)},set height(Y){It(l,Y,!0)}})};ro(V,q=>{g(u)?q(U):q(z,!1)},!0)}Qe(O,B)};ro(F,O=>{f==="number"?O($):O(D,!1)},!0)}Qe(N,L)};ro(M,N=>{f==="string"?N(I):N(C,!1)},!0)}Qe(A,T)};ro(b,A=>{o[t.col]?A(_):A(w,!1)})}var S=Ta(b,2);{var k=A=>{var T=fPt();T.__click=[uPt,r,t,l,a],ci(()=>oh(T,1,`expand-button ${t.hovered?"show":"hide"}`,"svelte-ix87lc")),Qe(A,T)};ro(S,A=>{H(c)&&A(k)})}Pn(y),ci(A=>v=vo(y,"",v,A),[()=>({"--lineHeight":s.lineHeight+"px","--num-lines":s.textMaxLines})]),xl(y,"clientHeight",A=>It(a,A)),Qe(e,y),ti()}Ju(["click"]);var gPt=On('
    ');const mPt={hash:"svelte-er2yqb",code:".row-number.svelte-er2yqb {flex-grow:1;text-align:right;color:var(--secondary-text-color);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"};function yPt(e,t){Qr(t,!0),ei(e,mPt);const n=sr.model.getContent({row:t.row,col:t.col}),r=Dt(()=>new Intl.NumberFormat().format(n??0));var i=gPt(),s=Wn(i,!0);Pn(i),ci(()=>Lc(s,H(r))),Qe(e,i),ti()}var vPt=(e,t)=>{e.key==="Enter"&&t()},bPt=On('
    ');const _Pt={hash:"svelte-1e1vbvn",code:".cell.svelte-1e1vbvn {--x: 0px;--y: 0px;--width: 0px;--height: 0px;display:flex;box-sizing:border-box;padding-top:calc(var(--padding-y) / 2);padding-bottom:calc(var(--padding-y) / 2);padding-right:calc(calc(var(--padding-x) / 2) + var(--extra-right-padding));padding-left:calc(calc(var(--padding-x) / 2) + var(--extra-left-padding));position:absolute;left:0;top:0;width:var(--width);height:var(--height);transform:translate(var(--x), var(--y));contain:layout paint;color:var(--primary-text-color);font-family:var(--cell-font-family);font-size:var(--cell-font-size);}"};function wPt(e,t){Qr(t,!0),ei(e,_Pt);const n=sr.model,r=sr.controller,i=sr.overscrollModifier,s=nr.config;let o=Dt(()=>n.getPosition({row:t.row,col:t.col})),a=Dt(()=>H(o).x),l=Dt(()=>H(o).y),c=Dt(()=>i.y(H(l))),u=Dt(()=>n.getDimensions({row:t.row,col:t.col})),f=Dt(()=>H(u).width),h=Dt(()=>H(u).height),d=Dt(()=>n.isFirstCol(t.col)),g=Dt(()=>n.isLastCol(t.col)),y=Dt(()=>n.getRowParity(t.row)==="even"?"var(--primary-bg)":"var(--secondary-bg)"),v=()=>{s.onRowClick&&s.onRowClick(t.row)},b=Jt(!1);var _=bPt();_.__click=v,_.__keydown=[vPt,v];let w;var S=Wn(_);{var k=T=>{pPt(T,{get row(){return t.row},get col(){return t.col},get hovered(){return H(b)}})},A=T=>{yPt(T,{get row(){return t.row},get col(){return t.col}})};ro(S,T=>{t.col!==Qs?T(k):T(A,!1)})}Pn(_),ci(T=>w=vo(_,"",w,T),[()=>({"--x":H(a)+"px","--y":H(c)+"px","--width":H(f)+"px","--height":H(h)+"px","--padding-x":s.betweenColPadding+"px","--padding-y":s.betweenRowPadding+"px","--extra-right-padding":(H(g)?s.verticalScrollbarWidth:0)+"px","--extra-left-padding":(H(d)?s.firstColLeftPadding:0)+"px","--background-color":H(y)})]),Lg("pointerenter",_,()=>{It(b,!0),r.hoveredRowId=t.row}),Lg("pointerleave",_,()=>{It(b,!1),r.hoveredRowId=null}),Qe(e,_),ti()}Ju(["click","keydown"]);var xPt=On('
    ');const SPt={hash:"svelte-1wng68q",code:".header-title.svelte-1wng68q {flex-shrink:1;margin-right:2px;}"};function APt(e,t){Qr(t,!0),ei(e,SPt);const n=nr.config;var r=xPt(),i=Wn(r,!0);Pn(r),ci(()=>Lc(i,n.columnConfigs[t.col]?.title??t.col)),Qe(e,r),ti()}sBt();var EPt=On('
    #
    ');const kPt={hash:"svelte-1cjtpqh",code:".row-number-header.svelte-1cjtpqh {flex-grow:1;text-align:right;margin-right:4px;box-sizing:border-box;color:var(--secondary-text-color);}"};function TPt(e){ei(e,kPt);var t=EPt();Qe(e,t)}var MPt=(e,t,n,r,i)=>{const s=H(t)?H(n)==="ascending"?"descending":null:"ascending";s?r.handleSort({column:i.col,direction:s}):r.handleSort(null)},IPt=On('');const RPt={hash:"svelte-3f09kb",code:".sort-buttons.svelte-3f09kb {all:unset;flex-shrink:0;width:16px;cursor:pointer;display:flex;justify-content:center;flex-direction:row;margin-left:4px;border-radius:2px;padding-left:4px;padding-right:4px;color:var(--tertiary-text-color);}.sort-buttons.svelte-3f09kb:hover {--placeholder: 0;background-color:var(--hover-bg);}.sort-glyph.svelte-3f09kb {color:var(--tertiary-text-color);}.sort-buttons.svelte-3f09kb:hover .sort-glyph:where(.svelte-3f09kb) {color:var(--tertiary-text-color);}.selected.svelte-3f09kb {color:var(--primary-text-color) !important;}"};function CPt(e,t){Qr(t,!0),ei(e,RPt);const n=sr.controller;let r=Dt(()=>n.sort?n.sort.column===t.col:!1),i=Dt(()=>n.sort?n.sort.direction:null),s=Dt(()=>H(r)?H(i)==="ascending"?"↑":"↓":"⇅");var o=IPt();o.__click=[MPt,r,i,n,t];var a=Wn(o),l=Wn(a,!0);Pn(a),Pn(o),ci(()=>{oh(a,1,`sort-button ${(H(r)?"selected":null)??""} sort-glyph`,"svelte-3f09kb"),Lc(l,H(s))}),Qe(e,o),ti()}Ju(["click"]);class NPt{#t=Jt(ls({}));get config(){return H(this.#t)}set config(t){It(this.#t,t,!0)}}const LT="custom-cells";class b5{static initialize(){ga(LT,new NPt)}static set config(t){const n=no(LT);n.config=t}static get config(){return no(LT).config}}var $Pt=On("
    ");const OPt={hash:"svelte-3kpd",code:""};function LPt(e,t){Qr(t,!0),ei(e,OPt),sr.model;const n=s=>typeof s=="function"?(o,a)=>{let l=new s(o,a);return{...l.update?{update:l.update.bind(l)}:{},...l.destroy?{destroy:l.destroy.bind(l)}:{}}}:(o,a)=>{let l=new s.class(o,a);return{...l.update?{update:l.update.bind(l)}:{},...l.destroy?{destroy:l.destroy.bind(l)}:{}}};let r=Dt(()=>n(t.customHeader));var i=$Pt();y8(i,(s,o)=>H(r)?.(s,o),()=>({column:t.col})),Qe(e,i),ti()}var DPt=On(" ",1),FPt=On('
    ');const BPt={hash:"svelte-12avjxu",code:".header-cell.svelte-12avjxu {position:relative;display:flex;flex-direction:row;align-items:end;width:var(--width);min-height:var(--height);flex-shrink:0;box-sizing:border-box;padding:0.25em;padding-right:calc(calc(var(--padding-x) / 2) + var(--extra-padding-right));padding-left:calc(calc(var(--padding-x) / 2) + var(--extra-padding-left));color:var(--secondary-text-color);font-family:var(--header-font-family);font-size:var(--header-font-size);}.header-cell.number.svelte-12avjxu {justify-content:end;}.header-content.svelte-12avjxu {display:flex;flex-direction:column;flex-shrink:0;}.header-title.svelte-12avjxu {height:1.5em;align-items:center;display:flex;flex-direction:row;flex-shrink:0;}"};function PPt(e,t){Qr(t,!0),ei(e,BPt);const n=sr.model,r=sr.schema,i=nr.config,s=b5.config;let o=Jt(null),a=Jt(0);Pr(()=>{i.minColumnWidths[t.col]=H(a)+i.betweenColPadding});const l=Dt(()=>n.colWidths[t.col]),c=Dt(()=>(r.dataType[t.col]??"string")==="number"),u=Dt(()=>H(c)||t.col===Qs?"number":""),f=Dt(()=>n.isFirstCol(t.col)),h=Dt(()=>n.isLastCol(t.col));let d=Dt(()=>i.headerHeight?i.headerHeight+"px":"auto");var g=FPt();let y;var v=Wn(g),b=Wn(v);{var _=T=>{LPt(T,{get col(){return t.col},get customHeader(){return s[t.col]}})};ro(b,T=>{s[t.col]&&T(_)})}var w=Ta(b,2),S=Wn(w);{var k=T=>{var M=DPt(),I=Lo(M);APt(I,{get col(){return t.col}});var C=Ta(I,2);CPt(C,{get col(){return t.col}}),Qe(T,M)},A=T=>{TPt(T)};ro(S,T=>{t.col!==Qs?T(k):T(A,!1)})}Pn(w),Pn(v),Pn(g),Bs(g,T=>It(o,T),()=>H(o)),ci(T=>{oh(g,1,`header-cell ${H(u)??""}`,"svelte-12avjxu"),y=vo(g,"",y,T)},[()=>({"--width":H(l)+"px","--height":H(d),"--padding-x":i.betweenColPadding+"px","--extra-padding-right":(H(h)?i.verticalScrollbarWidth:0)+"px","--extra-padding-left":(H(f)?i.firstColLeftPadding:0)+"px"})]),xl(v,"clientWidth",T=>It(a,T)),Qe(e,g),ti()}class UPt{tableModel;tableController;col;config;isDragging=!1;startDragX=0;constructor({tableModel:t,tableController:n,col:r}){this.tableModel=t,this.tableController=n,this.col=r,this.config=nr.config}handlePointerDown=t=>{t.preventDefault(),t.target.setPointerCapture(t.pointerId),this.isDragging=!0,this.startDragX=t.offsetX};handlePointerMove=t=>{if(this.isDragging&&this.startDragX!==null){const n=t.offsetX-this.startDragX,r=this.tableModel.colWidths[this.col],i=Math.max(0,Math.round(r+n));this.config.columnConfigs[this.col]||(this.config.columnConfigs[this.col]={}),this.config.columnConfigs[this.col].width=i,this.config.onColumnConfigsChange(this.col,Sit(this.config.columnConfigs))}};handlePointerUp=t=>{t.target.releasePointerCapture(t.pointerId),this.isDragging=!1,this.startDragX=null}}var zPt=On('
    ');const qPt={hash:"svelte-1v734te",code:".header-resize-indicator.svelte-1v734te {position:absolute;z-index:2;box-sizing:border-box;width:12px;height:calc(100% - 0.25rem);margin:2px;cursor:col-resize;justify-content:center;display:flex;align-items:center;justify-content:center;transform:translateX(calc(var(--x) - 4px - 50%));}.pill.svelte-1v734te {width:2px;height:calc(100% - 4px);margin-top:2px;margin-bottom:2px;background-color:var(--secondary-text-color);opacity:0.2;border-radius:2px;}"};function jPt(e,t){Qr(t,!0),ei(e,qPt);const n=sr.model;let r=new UPt({tableModel:n,tableController:sr.controller,col:t.col});const i=Dt(()=>n.colPositions[t.col]+n.colWidths[t.col]);var s=zPt();s.__pointerdown=function(...a){r.handlePointerDown?.apply(this,a)},s.__pointermove=function(...a){r.handlePointerMove?.apply(this,a)},s.__pointerup=function(...a){r.handlePointerUp?.apply(this,a)};let o;ci(a=>o=vo(s,"",o,a),[()=>({"--x":H(i)+"px"})]),Qe(e,s),ti()}Ju(["pointerdown","pointermove","pointerup"]);var VPt=e=>{e.stopPropagation()},WPt=On('
    ');const YPt={hash:"svelte-1qnjihj",code:".table-portal.svelte-1qnjihj {position:absolute;}"};function HPt(e,t){Qr(t,!0),ei(e,YPt);const n=sr.controller,r=sr.tablePortalController;let i=Jt(null);const s=u=>{Pr(()=>(r.mount(u,t.relativeTo,t.anchor,t.horizontalAlign,t.verticalAlign),u.focus(),()=>{r.destroy(u)}))};let o=0;pm(()=>{o=n.xScroll,requestAnimationFrame(a)});function a(){H(i)&&t.stickyX&&(H(i).style.transform=`translateX(${n.xScroll-o}px)`),requestAnimationFrame(a)}var l=WPt();l.__click=[VPt];var c=Wn(l);m8(c,()=>t.children),Pn(l),Bs(l,u=>It(i,u),()=>H(i)),y8(l,u=>s?.(u)),Lg("wheel",l,u=>{u.stopPropagation()}),Qe(e,l),ti()}Ju(["click"]);var GPt=(e,t)=>{It(t,!0)},XPt=On(" ",1);const KPt={hash:"svelte-8ns8fr",code:'.dropdown.svelte-8ns8fr {all:unset;padding-left:8px;padding-right:8px;border-radius:2px;cursor:pointer;color:var(--secondary-text-color);position:relative;user-select:none;}.dropdown.svelte-8ns8fr::before {content:"";position:absolute;top:0;left:0;height:100%;width:100%;background-color:var(--primary-bg);z-index:-1;}.dropdown.svelte-8ns8fr:hover {background-color:var(--hover-bg);}.unclickable.svelte-8ns8fr {pointer-events:none;}'};function JPt(e,t){ei(e,KPt);let n=Jt(!1),r=Jt(null),i=Jt(null);var s=XPt();Lg("click",f5,u=>{H(n)&&u.target!==H(r)&&It(n,!1)});var o=Lo(s);o.__click=[GPt,n];var a=Wn(o,!0);Pn(o),Bs(o,u=>It(r,u),()=>H(r));var l=Ta(o,2);{var c=u=>{HPt(u,{get relativeTo(){return t.relativeTo},anchor:"outside",horizontalAlign:"left",verticalAlign:"top",stickyX:!1,get element(){return H(i)},set element(f){It(i,f,!0)},children:(f,h)=>{var d=Kh(),g=Lo(d);m8(g,()=>t.children),Qe(f,d)},$$slots:{default:!0}})};ro(l,u=>{H(n)&&u(c)})}ci(()=>{oh(o,1,`dropdown ${H(n)?"unclickable":"clickable"}`,"svelte-8ns8fr"),Lc(a,t.label)}),Qe(e,s)}Ju(["click"]);var ZPt=(e,t,n)=>{e.target.checked?t.showColumn(H(n)):t.hideColumn(H(n))},QPt=On('
  • '),tUt=On('
      '),eUt=On(" ",1),nUt=On('
      ');const rUt={hash:"svelte-def7zm",code:".header-row.svelte-def7zm {flex-shrink:0;border-bottom:1px solid var(--secondary-bg);background-color:var(--primary-bg);}.scroll-container.svelte-def7zm {display:flex;flex-direction:row;}.dropdown-label-container.svelte-def7zm {position:absolute;z-index:20;left:0px;box-sizing:border-box;height:100%;padding:0.25em;display:flex;flex-direction:row;align-items:end;}.dropdown-label.svelte-def7zm {height:1.5em;align-items:center;display:flex;}.column-toggle.svelte-def7zm {margin:0;margin-top:4px;margin-left:8px;padding:12px;background-color:var(--primary-bg);border-radius:4px;box-shadow:var(--shadow);border:var(--outline);max-height:var(--max-height);max-width:var(--max-width);overflow:scroll;}.column-entry.svelte-def7zm {list-style-type:none;padding:4px;user-select:none;}.column-label.svelte-def7zm {display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--secondary-text-color);}"};function iUt(e,t){Qr(t,!0),ei(e,rUt);const n=sr.model,r=sr.controller,i=nr.config;let s=Jt(null),o=Jt(null),a=Jt(null),l=Dt(()=>n.renderableCols),c=0;pm(()=>(c=requestAnimationFrame(u),()=>{cancelAnimationFrame(c)}));function u(){H(o)&&(H(o).style.transform=`translate3d(${r.xScroll}px, 0, 0)`),H(a)&&(H(a).style.transform=`translate3d(${-r.xScroll}px, 0, 0)`),c=requestAnimationFrame(u)}var f=nUt(),h=Wn(f),d=Wn(h),g=Wn(d),y=Wn(g);JPt(y,{label:"⋮",get relativeTo(){return H(s)},children:(b,_)=>{var w=tUt();let S;Xy(w,21,()=>n.columns,KBt,(k,A)=>{var T=QPt(),M=Wn(T),I=Wn(M),C=Ta(I);i9t(C),C.__change=[ZPt,r,A],vo(C,"",{},{float:"right"}),Pn(M),Pn(T),ci(()=>{Lc(I,`${(H(A)===Qs?"row #":i.columnConfigs[H(A)]?.title??H(A))??""} `),i1(C,"id",`${H(A)??""}-checkbox`),s9t(C,H(A)===Qs?i.showRowNumber!==!1:!i.columnConfigs[H(A)]?.hidden)}),Qe(k,T)}),Pn(w),ci(k=>S=vo(w,"",S,k),[()=>({"--max-height":r.viewHeight-48+"px","--max-width":r.viewWidth-48+"px"})]),Qe(b,w)}}),Pn(g),Bs(g,b=>It(a,b),()=>H(a)),Pn(d);var v=Ta(d,2);Xy(v,16,()=>H(l),b=>b,(b,_)=>{var w=eUt(),S=Lo(w);PPt(S,{get col(){return _}});var k=Ta(S,2);jPt(k,{get col(){return _}}),Qe(b,w)}),Pn(h),Bs(h,b=>It(o,b),()=>H(o)),Pn(f),Bs(f,b=>It(s,b),()=>H(s)),Qe(e,f),ti()}Ju(["change"]);function sUt(e,t){return{...e,...e[t]!=null?e[t]:{}}}class oUt{#t=Jt(null);get colorScheme(){return H(this.#t)}set colorScheme(t){It(this.#t,t,!0)}#e=Jt(ls({}));get theme(){return H(this.#e)}set theme(t){It(this.#e,t,!0)}}const zB=Symbol("style");class _5{static initialize(){ga(zB,new oUt)}static get style(){return no(zB)}}var aUt=On("
      ");const lUt={hash:"svelte-vahitw",code:".table-defaults.light.svelte-vahitw {--default-primary-text-color: black;--default-secondary-text-color: gray;--default-tertiary-text-color: lightgray;--default-font-family: sans-serif;--default-font-size: 1rem;--default-primary-bg: white;--default-secondary-bg: rgb(246, 246, 247);--default-tertiary-bg: rgb(234, 234, 235);--default-hover-bg: rgba(0, 0, 0, 0.05);--default-scrollbar-bg: rgba(0, 0, 0, 0.05);--default-scrollbar-pill-bg: rgba(0, 0, 0, 0.5);--default-scrollbar-label-bg: rgba(255, 255, 255, 0.9);--default-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--default-outline-color: rgb(0 0 0 / 0.2);--default-dimmed-row-color: rgb(0 0 0 / 0.2);--default-row-scroll-to-color: rgb(202 225 255);--default-row-hover-color: rgb(220, 235, 255);}.table-defaults.dark.svelte-vahitw {--default-primary-text-color: lightgray;--default-secondary-text-color: gray;--default-tertiary-text-color: dimgray;--default-font-family: sans-serif;--default-font-size: 1rem;--default-primary-bg: #060607;--default-secondary-bg: #161617;--default-hover-bg: rgba(255, 255, 255, 0.05);--default-scrollbar-bg: rgba(255, 255, 255, 0.05);--default-scrollbar-pill-bg: rgba(255, 255, 255, 0.5);--default-scrollbar-label-bg: rgba(0, 0, 0, 0.9);--default-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--default-outline-color: rgb(255 255 255 / 0.2);--default-dimmed-row-color: rgb(0 0 0 / 0.6);--default-row-scroll-to-color: rgb(1, 24, 106);--default-row-hover-color: rgb(0, 6, 35);}.style-wrapper.svelte-vahitw {width:100%;height:100%;--primary-text-color: var(--user-primary-text-color, var(--default-primary-text-color));--secondary-text-color: var(--user-secondary-text-color, var(--default-secondary-text-color));--tertiary-text-color: var(--user-tertiary-text-color, var(--default-tertiary-text-color));--font-family: var(--user-font-family, var(--default-font-family));--font-size: var(--user-font-size, var(--default-font-size));--primary-bg: var(--user-primary-bg, var(--default-primary-bg));--secondary-bg: var(--user-secondary-bg, var(--default-secondary-bg));--tertiary-bg: var(--user-tertiarty-bg, var(--default-tertiary-bg));--hover-bg: var(--user-hover-bg, var(--default-hover-bg));--header-font-family: var(--user-header-font-family, var(--font-family));--header-font-size: var(--user-header-font-size, var(--font-size));--cell-font-family: var(--user-cell-font-family, var(--font-family));--cell-font-size: var(--user-cell-font-size, var(--font-size));--scrollbar-bg: var(--user-scrollbar-bg, var(--default-scrollbar-bg));--scrollbar-pill-bg: var(--user-scrollbar-pill-bg, var(--default-scrollbar-pill-bg));--scrollbar-label-bg: var(--user-scrollbar-label-bg, var(--default-scrollbar-label-bg));--shadow: var(--user-shadow, var(--default-shadow));--outline-color: var(--user-outline-color, var(--default-outline-color));--outline: 0.5px solid var(--outline-color);--dimmed-row-color: var(--user-dimmed-row-color, var(--default-dimmed-row-color));--row-scroll-to-color: var(--user-row-scroll-to-color, var(--default-row-scroll-to-color));--row-hover-color: var(--user-row-hover-color, var(--default-row-hover-color));}"};function cUt(e,t){Qr(t,!0),ei(e,lUt);const n=_5.style;let r=Dt(()=>n.colorScheme),i=Dt(()=>n.theme),s=Jt(null),o=Dt(()=>H(r)??H(s)??"light");const a=B=>{B.matches?It(s,"dark"):It(s,"light")},l="(prefers-color-scheme: dark";pm(()=>(It(s,window.matchMedia(l).matches?"dark":"light",!0),window.matchMedia(l).addEventListener("change",a),()=>{window.matchMedia(l).removeEventListener("change",a)}));let c=Dt(()=>sUt(H(i),H(o))),u=Dt(()=>H(c).primaryTextColor),f=Dt(()=>H(c).secondaryTextColor),h=Dt(()=>H(c).tertiaryTextColor),d=Dt(()=>H(c).fontFamily),g=Dt(()=>H(c).fontSize),y=Dt(()=>H(c).primaryBackgroundColor),v=Dt(()=>H(c).secondaryBackgroundColor),b=Dt(()=>H(c).hoverBackgroundColor),_=Dt(()=>H(c).headerFontFamily),w=Dt(()=>H(c).headerFontSize),S=Dt(()=>H(c).cellFontFamily),k=Dt(()=>H(c).cellFontSize),A=Dt(()=>H(c).scrollbarBackgroundColor),T=Dt(()=>H(c).scrollbarPillColor),M=Dt(()=>H(c).scrollbarLabelBackgroundColor),I=Dt(()=>H(c).shadow),C=Dt(()=>H(c).outlineColor),N=Dt(()=>H(c).dimmedRowColor),L=Dt(()=>H(c).rowScrollToColor),F=Dt(()=>H(c).rowHoverColor);Pr(()=>{});var $=aUt();let D;var O=Wn($);m8(O,()=>t.children),Pn($),ci(B=>{oh($,1,`style-wrapper table-defaults ${H(o)??""}`,"svelte-vahitw"),D=vo($,"",D,B)},[()=>({"--user-primary-text-color":H(u),"--user-secondary-text-color":H(f),"--user-tertiary-text-color":H(h),"--user-font-family":H(d),"--user-font-size":H(g),"--user-primary-bg":H(y),"--user-secondary-bg":H(v),"--user-hover-bg":H(b),"--user-header-font-family":H(_),"--user-header-font-size":H(w),"--user-cell-font-family":H(S),"--user-cell-font-size":H(k),"--user-scrollbar-bg":H(A),"--user-scrollbar-pill-bg":H(T),"--user-scrollbar-label-bg":H(M),"--user-shadow":H(I),"--user-outline-color":H(C),"--user-dimmed-row-color":H(N),"--user-row-scroll-to-color":H(L),"--user-row-hover-color":H(F)})]),Qe(e,$),ti()}function uUt(){return Qs}function fUt(e,t){const n=new Set(e),r=new Set(t);return{left:e.filter(i=>!r.has(i)),right:t.filter(i=>!n.has(i))}}function hUt(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function dUt(e,t){return e.concat(t)}var pUt=On("
      "),gUt=On("
      ",1);const mUt={hash:"svelte-h8fig9",code:".row-background.svelte-h8fig9 {position:absolute;width:var(--width);height:var(--height);box-sizing:border-box;z-index:-1;transform:translate3d(0, var(--y), 0);transition:background-color 100ms linear;}.odd.svelte-h8fig9 {background-color:var(--secondary-bg);}.even.svelte-h8fig9 {background-color:var(--primary-bg);}.dimmer.svelte-h8fig9 {background-color:var(--dimmed-row-color);z-index:10;pointer-events:none;}.flashed.svelte-h8fig9 {background-color:var(--row-scroll-to-color);}.hovered.svelte-h8fig9 {background-color:var(--row-hover-color);}"};function yUt(e,t){Qr(t,!0),ei(e,mUt);const n=sr.controller,r=sr.model,i=sr.overscrollModifier,s=nr.config;let o=Dt(()=>r.rowHeights[t.row]),a=Dt(()=>Math.max(r.colsRightmostPosition,n.viewWidth)),l=Dt(()=>i.y(r.rowPositions[t.row])),c=Dt(()=>r.getRowParity(t.row)),u=Dt(()=>n.flashedRowId===t.row),f=Dt(()=>n.hoveredRowId===t.row),h=Dt(()=>s.highlightedRows?s.highlightedRows?.has(t.row):null);var d=gUt(),g=Lo(d);let y;var v=Ta(g,2);{var b=_=>{var w=pUt();let S;ci(k=>{oh(w,1,`row-background ${H(c)??""} dimmer`,"svelte-h8fig9"),S=vo(w,"",S,k)},[()=>({"--width":H(a)+"px","--height":H(o)+"px","--y":H(l)+"px"})]),Qe(_,w)};ro(v,_=>{H(h)!==null&&!H(h)&&_(b)})}ci(_=>{oh(g,1,`row-background ${H(c)??""} ${(H(u)?"flashed":null)??""} ${(H(f)&&s.highlightHoveredRow?"hovered":null)??""}`,"svelte-h8fig9"),y=vo(g,"",y,_)},[()=>({"--width":H(a)+"px","--height":H(o)+"px","--y":H(l)+"px"})]),Qe(e,d),ti()}var vUt=On(" ",1),bUt=On('
      ',1),_Ut=On('
      ');const wUt={hash:"svelte-1q3xqdh",code:".table.svelte-1q3xqdh {width:100%;max-width:var(--max-width);height:100%;display:flex;flex-direction:column;position:relative;}.table-contents.svelte-1q3xqdh {position:relative;overflow:hidden;flex-grow:1;}.scroll-container.svelte-1q3xqdh {position:absolute;width:0;height:0;will-change:transform;contain:layout size;}"};function xUt(e,t){Qr(t,!0),ei(e,wUt),nr.initialize(),Mw.initialize(),_5.initialize(),sr.initialize();const n=sr.controller,r=sr.model,i=sr.overscrollModifier,s=nr.config,o=_5.style;Pr(()=>{t.scrollTo!=null&&n.scrollToRow(String(t.scrollTo))}),Pr(()=>{t.highlightedRows&&t.highlightedRows.length>0?s.highlightedRows=new Set(t.highlightedRows.map(_=>String(_))):s.highlightedRows=null}),Pr(()=>{t.onRowClick!=null?s.onRowClick=t.onRowClick:s.onRowClick=null}),Pr(()=>{t.coordinator?v5.coordinator=t.coordinator:v5.coordinator=null}),Pr(()=>{t.numLines!=null?s.textMaxLines=t.numLines:s.textMaxLines=s.DEFAULT_TEXT_MAX_LINES,t.lineHeight!=null?s.lineHeight=t.lineHeight:s.lineHeight=s.DEFAULT_LINE_HEIGHT}),Pr(()=>{t.colorScheme!=null?o.colorScheme=t.colorScheme:o.colorScheme=null}),Pr(()=>{t.theme!=null?o.theme=t.theme:o.theme={},t.colorScheme!=null?o.colorScheme=t.colorScheme:o.colorScheme=null}),Pr(()=>{t.columnConfigs!=null?s.columnConfigs=t.columnConfigs:s.columnConfigs={},t.onColumnConfigsChange!=null?s.onColumnConfigsChange=t.onColumnConfigsChange:s.onColumnConfigsChange=()=>{}}),Pr(()=>{s.showRowNumber=t.showRowNumber??null}),Pr(()=>{s.onShowRowNumberChange=t.onShowRowNumberChange??null}),Pr(()=>{n.initialize({tableName:t.table,rowKey:t.rowKey,columns:[uUt(),...t.columns],filterBy:t.filter??null})}),Pr(()=>{t.customCells!=null?Mw.config=t.customCells:Mw.config={}}),Pr(()=>{t.additionalHeaderContents!=null?b5.config=t.additionalHeaderContents:b5.config={}}),Pr(()=>{t.headerHeight!=null?s.headerHeight=t.headerHeight:s.headerHeight=null}),Pr(()=>{t.highlightHoveredRow!=null?s.highlightHoveredRow=t.highlightHoveredRow:s.highlightHoveredRow=!1});let a=Jt([]),l=Jt(0),c=Jt(null),u=Jt(ls([])),f=Jt(ls([])),h=Dt(()=>H(u).filter(_=>n.rowStillExists(_))),d=Dt(()=>H(f)),g=0;pm(()=>(g=requestAnimationFrame(b),()=>{n.teardown(),r.teardown(),cancelAnimationFrame(g)}));function y(_,w){if(w.length>0){const S=w[w.length-1];return Math.abs(r.data[_][to]-r.data[S][to])}return 0}function v(){const{left:_,right:w}=fUt(H(a),r.renderableRows);_.length===0&&w.length===0||(It(a,hUt(H(a),_)),It(a,dUt(H(a),w.sort((S,k)=>y(S,H(a))-y(k,H(a))).slice(0,n.isJumping?n.rowsOnScreen:s.rowRenderBatchSize))))}function b(){v(),It(u,H(a).filter(S=>n.rowIsVisible(S)),!0),It(f,r.renderableCols.filter(S=>n.colIsVisible(S)),!0);const _=n.xScroll,w=i.yScroll(n.yScroll);H(c)&&(H(c).style.transform=`translate3d(${_}px, ${w}px, 0)`),It(l,n.updateKey,!0),g=requestAnimationFrame(b)}cUt(e,{children:(_,w)=>{var S=_Ut(),k=Wn(S);iUt(k,{});var A=Ta(k,2),T=Wn(A);{var M=I=>{var C=bUt(),N=Lo(C),L=Wn(N);XBt(L,()=>H(l),D=>{var O=vUt(),B=Lo(O);Xy(B,16,()=>H(h),U=>U,(U,z)=>{var q=Kh(),Y=Lo(q);Xy(Y,16,()=>H(d),Q=>Q,(Q,ft)=>{wPt(Q,{get row(){return z},get col(){return ft}})}),Qe(U,q)});var V=Ta(B,2);Xy(V,16,()=>r.renderableRows,U=>U,(U,z)=>{yUt(U,{get row(){return z}})}),Qe(D,O)}),Pn(N),Bs(N,D=>It(c,D),()=>H(c));var F=Ta(N,2);W9t(F,{});var $=Ta(F,2);q9t($,{}),Qe(I,C)};ro(T,I=>{n.isReady&&I(M)})}Pn(A),Pn(S),Bs(S,I=>n.element=I,()=>n?.element),Lg("wheel",S,function(...I){n.handleWheel?.apply(this,I)}),xl(A,"clientHeight",I=>n.viewHeight=I),xl(A,"clientWidth",I=>n.viewWidth=I),Qe(_,S)},$$slots:{default:!0}}),ti()}class SUt{component;currentProps;constructor(t,n){this.currentProps={...n},this.component=WBt({component:xUt,target:t,props:n})}update(t){let n={};for(let r in t)t[r]!==this.currentProps[r]&&(n[r]=t[r],this.currentProps[r]=t[r]);this.component.$set(n)}destroy(){this.component.$destroy()}}var AUt=At("
      ");function EUt(e,t){ye(t,!0);let n=qs(t,["$$slots","$$events","$$legacy"]),r;zg(()=>{let s=new SUt(r,n);hs(()=>{s.update(n)}),r6(()=>{s.destroy()})});var i=AUt();Ce(i,"",{},{width:"100%",height:"100%"}),ho(i,s=>r=s,()=>r),rt(e,i),ve()}function kUt(e,t,n){t(e.clientX-x(n).getBoundingClientRect().left);let r=s=>{t(s.clientX-x(n).getBoundingClientRect().left)},i=()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",i)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",i)}function TUt(e,t,n,r,i){e.key=="ArrowLeft"?t(Math.max(t()-(n()??1),r())):e.key=="ArrowRight"&&t(Math.min(t()+(n()??1),i()))}var MUt=At('
      ');function ust(e,t){ye(t,!0);let n=se(t,"value",15,0),r=se(t,"min",3,0),i=se(t,"max",3,100),s=se(t,"step",3,void 0),o=se(t,"width",3,100),a=15,l=dt(()=>w=>(w-r())/(i()-r())*(o()-a)),c=dt(()=>w=>w/(o()-a)*(i()-r())+r()),u=dt(()=>x(l)(n())),f=xt(void 0);function h(w){let S=x(c)(w-a/2);S=Math.max(r(),Math.min(i(),S)),s()!=null&&(S=Math.round(S/s())*s()),n(S)}var d=MUt();d.__mousedown=[kUt,h,f],d.__keydown=[TUt,n,s,r,i];let g;var y=ot(d);let v;var b=yt(y,2);let _;tt(d),ho(d,w=>G(f,w),()=>x(f)),Ft((w,S,k)=>{ct(d,"aria-valuenow",n()),ct(d,"aria-valuemin",r()),ct(d,"aria-valuemax",i()),g=Ce(d,"",g,w),v=Ce(y,"",v,S),_=Ce(b,"",_,k)},[()=>({width:`${o()??""}px`,height:"28px"}),()=>({left:"0px",top:"12px",width:`${o()??""}px`,height:"4px"}),()=>({left:`${x(u)??""}px`,top:"6.5px",width:"15px",height:"15px"})]),rt(e,d),ve()}Dr(["mousedown","keydown"]);function IUt(e){let t="";for(let n=0;nn.charCodeAt(0)))}function r0(e,t){if(e.lengthr instanceof Object&&ArrayBuffer.isView(r)?Array.from(r):r,t)}catch{return"(invalid)"}}class NUt{element;constructor(t,n){this.element=t,this.update(n)}update(t){let n=document.createElement("pre");n.className="text-sm",n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-all",n.innerText=hst(t.value,2),this.element.replaceChildren(n)}}function w8(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wp=w8();function dst(e){wp=e}var Ky={exec:()=>null};function Gn(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ls.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,t)};return r}var Ls={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},$Ut=/^(?:[ \t]*(?:\n|$))+/,OUt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,LUt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,lb=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,DUt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,x8=/(?:[*+-]|\d{1,9}[.)])/,pst=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,gst=Gn(pst).replace(/bull/g,x8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),FUt=Gn(pst).replace(/bull/g,x8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),S8=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,BUt=/^[^\n]+/,A8=/(?!\s*\])(?:\\.|[^\[\]\\])+/,PUt=Gn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",A8).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UUt=Gn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,x8).getRegex(),gA="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",E8=/|$))/,zUt=Gn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",E8).replace("tag",gA).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mst=Gn(S8).replace("hr",lb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gA).getRegex(),qUt=Gn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",mst).getRegex(),k8={blockquote:qUt,code:OUt,def:PUt,fences:LUt,heading:DUt,hr:lb,html:zUt,lheading:gst,list:UUt,newline:$Ut,paragraph:mst,table:Ky,text:BUt},jB=Gn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",lb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gA).getRegex(),jUt={...k8,lheading:FUt,table:jB,paragraph:Gn(S8).replace("hr",lb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jB).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",gA).getRegex()},VUt={...k8,html:Gn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",E8).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ky,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Gn(S8).replace("hr",lb).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",gst).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WUt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,YUt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,yst=/^( {2,}|\\)\n(?!\s*$)/,HUt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,_st=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ZUt=Gn(_st,"u").replace(/punct/g,mA).getRegex(),QUt=Gn(_st,"u").replace(/punct/g,bst).getRegex(),wst="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tzt=Gn(wst,"gu").replace(/notPunctSpace/g,vst).replace(/punctSpace/g,T8).replace(/punct/g,mA).getRegex(),ezt=Gn(wst,"gu").replace(/notPunctSpace/g,KUt).replace(/punctSpace/g,XUt).replace(/punct/g,bst).getRegex(),nzt=Gn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vst).replace(/punctSpace/g,T8).replace(/punct/g,mA).getRegex(),rzt=Gn(/\\(punct)/,"gu").replace(/punct/g,mA).getRegex(),izt=Gn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),szt=Gn(E8).replace("(?:-->|$)","-->").getRegex(),ozt=Gn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",szt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),G2=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,azt=Gn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",G2).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xst=Gn(/^!?\[(label)\]\[(ref)\]/).replace("label",G2).replace("ref",A8).getRegex(),Sst=Gn(/^!?\[(ref)\](?:\[\])?/).replace("ref",A8).getRegex(),lzt=Gn("reflink|nolink(?!\\()","g").replace("reflink",xst).replace("nolink",Sst).getRegex(),M8={_backpedal:Ky,anyPunctuation:rzt,autolink:izt,blockSkip:JUt,br:yst,code:YUt,del:Ky,emStrongLDelim:ZUt,emStrongRDelimAst:tzt,emStrongRDelimUnd:nzt,escape:WUt,link:azt,nolink:Sst,punctuation:GUt,reflink:xst,reflinkSearch:lzt,tag:ozt,text:HUt,url:Ky},czt={...M8,link:Gn(/^!?\[(label)\]\((.*?)\)/).replace("label",G2).getRegex(),reflink:Gn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G2).getRegex()},w5={...M8,emStrongRDelimAst:ezt,emStrongLDelim:QUt,url:Gn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},VB=e=>fzt[e];function Bl(e,t){if(t){if(Ls.escapeTest.test(e))return e.replace(Ls.escapeReplace,VB)}else if(Ls.escapeTestNoEncode.test(e))return e.replace(Ls.escapeReplaceNoEncode,VB);return e}function WB(e){try{e=encodeURI(e).replace(Ls.percentDecode,"%")}catch{return null}return e}function YB(e,t){let n=e.replace(Ls.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(Ls.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length0?-2:-1}function HB(e,t,n,r,i){let s=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function dzt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(` +`).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(` +`)}var X2=class{options;rules;lexer;constructor(e){this.options=e||wp}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:iy(n,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=dzt(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=iy(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:iy(t[0],` +`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=iy(t[0],` +`).split(` +`),r="",i="",s=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,c="",u="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let f=t[2].split(` +`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),h=e.split(` +`,1)[0],d=!f.trim(),g=0;if(this.options.pedantic?(g=2,u=f.trimStart()):d?g=t[1].length+1:(g=t[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=f.slice(g),g+=t[1].length),d&&this.rules.other.blankLine.test(h)&&(c+=h+` +`,e=e.substring(h.length+1),l=!0),!l){let b=this.rules.other.nextBulletRegex(g),_=this.rules.other.hrRegex(g),w=this.rules.other.fencesBeginRegex(g),S=this.rules.other.headingBeginRegex(g),k=this.rules.other.htmlBeginRegex(g);for(;e;){let A=e.split(` +`,1)[0],T;if(h=A,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),w.test(h)||S.test(h)||k.test(h)||b.test(h)||_.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=g||!h.trim())u+=` +`+T.slice(g);else{if(d||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||S.test(f)||_.test(f))break;u+=` +`+h}!d&&!h.trim()&&(d=!0),c+=A+` +`,e=e.substring(A.length+1),f=T.slice(g)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,v;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(v=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:c,task:!!y,checked:v,loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;lf.type==="space"),u=c.length>0&&c.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=u}if(i.loose)for(let l=0;l({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=iy(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=hzt(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),HB(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return HB(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,a=i,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+i);(r=c.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,f=e.slice(0,i+r.index+u+o);if(Math.min(i,o)%2){let d=f.slice(1,-1);return{type:"em",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}let h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},yu=class x5{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||wp,this.options.tokenizer=this.options.tokenizer||new X2,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Ls,block:j_.normal,inline:ry.normal};this.options.pedantic?(n.block=j_.pedantic,n.inline=ry.pedantic):this.options.gfm&&(n.block=j_.gfm,this.options.breaks?n.inline=ry.breaks:n.inline=ry.gfm),this.tokenizer.rules=n}static get rules(){return{block:j_,inline:ry}}static lex(t,n){return new x5(n).lex(t)}static lexInline(t,n){return new x5(n).inlineTokens(t)}lex(t){t=t.replace(Ls.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let n=0;n(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=` +`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)?"":` +`)+i.raw,o.text+=` +`+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)?"":` +`)+i.raw,o.text+=` +`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let s=t;if(this.options.extensions?.startBlock){let o=1/0,a=t.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(s=t.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` +`)?"":` +`)+i.raw,o.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)?"":` +`)+i.raw,o.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let r=t,i=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let s=!1,o="";for(;t;){s||(o=""),s=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let c=n.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(t,r,o)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),n.push(a);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,u=t.slice(1),f;this.options.extensions.startInline.forEach(h=>{f=h.call({lexer:this},u),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),s=!0;let c=n.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):n.push(a);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}},K2=class{options;parser;constructor(e){this.options=e||wp}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Ls.notSpaceStart)?.[0],i=e.replace(Ls.endingNewline,"")+` +`;return r?'
      '+(n?i:Bl(i,!0))+`
      +`:"
      "+(n?i:Bl(i,!0))+`
      +`}blockquote({tokens:e}){return`
      +${this.parser.parse(e)}
      +`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} +`}hr(e){return`
      +`}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o +`+r+" +`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+Bl(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
    • ${t}
    • +`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

      ${this.parser.parseInline(e)}

      +`}table(e){let t="",n="";for(let i=0;i${r}`),` + +`+t+` +`+r+`
      +`}tablerow({text:e}){return` +${e} +`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` +`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Bl(e,!0)}`}br(e){return"
      "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=WB(e);if(i===null)return r;e=i;let s='
      ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=WB(e);if(i===null)return Bl(n);e=i;let s=`${n}{let o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new K2(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=n.renderer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new X2(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=n.tokenizer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Iw;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=n.hooks[o],l=i[o];Iw.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(i,c)).then(f=>l.call(i,f));let u=a.call(i,c);return l.call(i,u)}:i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return yu.lex(e,t??this.defaults)}parser(e,t){return vu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?yu.lex:yu.lexInline,a=i.hooks?i.hooks.provideParser():e?vu.parse:vu.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(l=>o(l,i)).then(l=>i.hooks?i.hooks.processAllTokens(l):l).then(l=>i.walkTokens?Promise.all(this.walkTokens(l,i.walkTokens)).then(()=>l):l).then(l=>a(l,i)).then(l=>i.hooks?i.hooks.postprocess(l):l).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let l=o(t,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let c=a(l,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(l){return s(l)}}}onError(e,t){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let r="

      An error occurred:

      "+Bl(n.message+"",!0)+"
      ";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Qd=new pzt;function ir(e,t){return Qd.parse(e,t)}ir.options=ir.setOptions=function(e){return Qd.setOptions(e),ir.defaults=Qd.defaults,dst(ir.defaults),ir};ir.getDefaults=w8;ir.defaults=wp;ir.use=function(...e){return Qd.use(...e),ir.defaults=Qd.defaults,dst(ir.defaults),ir};ir.walkTokens=function(e,t){return Qd.walkTokens(e,t)};ir.parseInline=Qd.parseInline;ir.Parser=vu;ir.parser=vu.parse;ir.Renderer=K2;ir.TextRenderer=I8;ir.Lexer=yu;ir.lexer=yu.lex;ir.Tokenizer=X2;ir.Hooks=Iw;ir.parse=ir;ir.options;ir.setOptions;ir.use;ir.walkTokens;ir.parseInline;vu.parse;yu.lex;class gzt{element;constructor(t,n){this.element=t,this.update(n)}update(t){this.element.innerHTML='
      '+ir(t.value?.toString()??"(null)",{async:!1,gfm:!0})+"
      "}}class mzt{element;constructor(t,n){this.element=t,this.update(n)}update(t){if(t.value!=null){let n=document.createElement("a");n.href=t.value,n.innerText=t.value,n.className="underline",n.target="_blank",this.element.replaceChildren(n)}else this.element.innerText="(null)"}}let Ast={markdown:gzt,image:CUt,url:mzt,json:NUt},yzt=[{renderer:"markdown",label:"Markdown"},{renderer:"image",label:"Image"},{renderer:"url",label:"Link"},{renderer:"json",label:"JSON"}];function GB(e){if(e!=null)return typeof e=="string"?Ast[e]:e}function vzt(e){return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))}function bzt(e){return e==null?!1:!!(typeof e=="string"&&e.startsWith("data:image/")||e.bytes&&e.bytes instanceof Uint8Array)}function R8(e){if(e==null)return"(null)";if(typeof e=="string")return e.toString();if(typeof e=="number")return e.toLocaleString();if(Array.isArray(e))return"["+e.map(t=>R8(t)).join(", ")+"]";try{return hst(e)}catch{return e.toString()}}var _zt=At('
      ');function wzt(e,t){ye(t,!0);function n(y){t.onChange({...t.style,...y})}var r=_zt(),i=ot(r),s=ot(i),o=ot(s,!0);tt(s),tt(i);var a=yt(i),l=ot(a),c=ot(l);{let y=dt(()=>t.style.renderer??null),v=dt(()=>[{value:null,label:"(default)"},...yzt.map(b=>({value:b.renderer,label:b.label}))]);xa(c,{get value(){return x(y)},onChange:b=>n({renderer:b}),get options(){return x(v)}})}var u=yt(c,2);{var f=y=>{var v=()=>t.style.rendererOptions?.size??100,b=_=>{n({rendererOptions:{size:_}})};ust(y,{get value(){return v()},set value(_){b(_)},width:72,min:16,max:400})};Lt(u,y=>{t.style.renderer=="image"&&y(f)})}tt(l),tt(a);var h=yt(a),d=ot(h),g=ot(d);{let y=dt(()=>t.style.display??"badge");xa(g,{get value(){return x(y)},onChange:v=>{n({display:v})},options:[{value:"full",label:"Full"},{value:"badge",label:"Badge"},{value:"hidden",label:"Hidden"}]})}tt(d),tt(h),tt(r),Ft(()=>ue(o,t.column.name)),rt(e,r),ve()}var xzt=At('
      ColumnFormatStyle
      ');function Szt(e,t){ye(t,!0);var n=xzt(),r=ot(n),i=yt(ot(r));_n(i,21,()=>t.columns,Bn,(s,o)=>{{let a=dt(()=>t.styles[x(o).name]??{});wzt(s,{get column(){return x(o)},get style(){return x(a)},onChange:l=>{let c={...t.styles};c[x(o).name]=l,t.onStylesChange(c)}})}}),tt(i),tt(r),tt(n),rt(e,n),ve()}var Azt=At("
      ");function Ezt(e,t){ye(t,!0);let n=qs(t,["$$slots","$$events","$$legacy"]),r;zg(()=>{let s=new Mkt(r,n);hs(()=>{s.update(n)}),r6(()=>{s.destroy()})});var i=Azt();Ce(i,"",{},{display:"flex"}),ho(i,s=>r=s,()=>r),rt(e,i),ve()}var kzt=(e,t,n)=>{t(x(n),e)},Tzt=At('
      '),Mzt=At('
      ');function Izt(e,t){ye(t,!0);let n=se(t,"selection",3,null),r=xt(new Set);const i={reset:()=>{G(r,new Set)}};function s(c,u){if(u.shiftKey||u.metaKey){let f=new Set(x(r));f.has(c)?f.delete(c):f.add(c),G(r,f)}else x(r).has(c)&&x(r).size==1?G(r,new Set):G(r,new Set([c]))}fe(()=>{let c=n();if(c!=null)return fe(()=>{let u=x(r),f=u.size!=0?Array.from(u).map(d=>d.predicate.toString()).join(" OR "):null,h={source:i,clients:new Set().add(i),value:u.size==0?null:u,predicate:f};c.activate(h),c.update(h)}),()=>{c.update({source:i,clients:new Set().add(i),value:null,predicate:null})}}),fe(()=>{let c=t.stateStore;if(!c)return;let u=c.subscribe(f=>{f!=null&&G(r,new Set(t.items.filter(h=>f.selectedItems.indexOf(h.label)>=0)))});return fe(()=>{c.set({selectedItems:Array.from(x(r)).map(f=>f.label)})}),u});var o=Mzt(),a=ot(o),l=ot(a);_n(l,21,()=>t.items,Bn,(c,u)=>{var f=Tzt();const h=dt(()=>x(r).has(x(u))||x(r).size==0);let d;f.__click=[kzt,s,u];var g=ot(f),y=ot(g);let v;tt(g);var b=yt(g),_=ot(b),w=ot(_,!0);tt(_),tt(b);var S=yt(b),k=ot(S,!0);tt(S),tt(f),Ft((A,T,M)=>{d=lr(f,1,"hover:bg-slate-200 dark:hover:bg-slate-700 select-none leading-7",null,d,A),v=Ce(y,"",v,T),ct(_,"title",x(u).label),ue(w,x(u).label),ue(k,M)},[()=>({"opacity-20":!x(h)}),()=>({"background-color":x(u).color}),()=>x(u).count.toLocaleString()]),rt(c,f)}),tt(l),tt(a),tt(o),rt(e,o),ve()}Dr(["click"]);const XB=Symbol("coordinator"),KB=Symbol("darkMode");class Lr{static get coordinator(){return h$(XB)??Va()}static set coordinator(t){d$(XB,t)}static get darkMode(){return h$(KB)}static set darkMode(t){d$(KB,t)}}function V_(e,t,n){return e+(t-e)*n}function Rzt(e,t,n){let r=Math.log(e.scale),i=Math.log(t.scale);if(Math.abs(i-r)<1e-5)return{x:V_(e.x,t.x,n),y:V_(e.y,t.y,n),scale:V_(e.scale,t.scale,n)};let s=Math.exp(V_(r,i,n));return{x:(t.x*t.scale-e.x*e.scale+(e.x-t.x)*(e.scale*t.scale/s))/(t.scale-e.scale),y:(t.y*t.scale-e.y*e.scale+(e.y-t.y)*(e.scale*t.scale/s))/(t.scale-e.scale),scale:s}}var Czt=At('
      ');function Nzt(e,t){ye(t,!0);const[n,r]=_o(),i=()=>us(l,"$darkMode",n),s=800;let o=se(t,"onClickPoint",3,null);const a=Lr.coordinator,l=Lr.darkMode;let c=xt(null),u=xt(null),f=xt(null),h=xt([]),d=xt(750),g=xt(750),y=dt(()=>t.stateStore?.child("legend")),v;function b(C){G(f,null);let N=x(c);if(N==null){G(c,C);return}let L=s,F=new Date().getTime(),$=()=>{let D=(new Date().getTime()-F)/L;D>1?D=1:v=requestAnimationFrame($),G(c,Rzt(N,C,JC(D)))};v&&cancelAnimationFrame(v),v=requestAnimationFrame($)}function _(C){C==null?(G(h,[]),G(f,null)):(G(h,[C]),G(f,C))}function w(){v&&cancelAnimationFrame(v)}function S(C){o()?.(C)}hs(()=>{x(h)?.[0]!=null&&S(x(h)?.[0])}),fe(()=>{let C=t.stateStore;if(!C)return;let N=C.subscribe(L=>{L!=null&&(G(c,L.viewportState),G(u,L.rangeSelection))});return hs(()=>{C.set({viewportState:x(c),rangeSelection:x(u)})}),N});var k=Czt(),A=ot(k);{let C=dt(()=>i()?"dark":"light"),N=dt(()=>t.categoryLegend?.indexColumn),L=dt(()=>t.categoryLegend?.legend.map($=>$.color)),F=dt(()=>1/16*Math.exp(-(t.minimumDensityExpFactor??0)));Ezt(A,{get coordinator(){return a},get table(){return t.table},get identifier(){return t.id},get x(){return t.x},get y(){return t.y},get colorScheme(){return x(C)},get text(){return t.text},get category(){return x(N)},get categoryColors(){return x(L)},get minimumDensity(){return x(F)},get additionalFields(){return t.additionalFields},get viewportState(){return x(c)},onViewportState:$=>{G(c,$),w()},get tooltip(){return x(f)},onTooltip:$=>G(f,$),get selection(){return x(h)},onSelection:$=>{G(h,$)},get filter(){return t.filter},get rangeSelection(){return t.filter},get rangeSelectionValue(){return x(u)},onRangeSelection:$=>{G(u,$)},get automaticLabels(){return t.automaticLabels},get width(){return x(d)},get height(){return x(g)},get mode(){return t.mode},get customTooltip(){return t.customTooltip},get customOverlay(){return t.customOverlay}})}var T=yt(A,2);{var M=C=>{var N=wn(),L=Yt(N);gS(L,()=>t.categoryLegend,F=>{Izt(F,{get items(){return t.categoryLegend.legend},get selection(){return t.filter},get stateStore(){return x(y)}})}),rt(C,N)};Lt(T,C=>{t.categoryLegend!=null&&C(M)})}tt(k),$d(k,"clientWidth",C=>G(d,C)),$d(k,"clientHeight",C=>G(g,C)),rt(e,k);var I=ve({startViewportAnimation:b,showTooltip:_});return r(),I}function $zt(e,{from:t,to:n},r={}){var{delay:i=0,duration:s=A=>Math.sqrt(A)*120,easing:o=JC}=r,a=getComputedStyle(e),l=a.transform==="none"?"":a.transform,[c,u]=a.transformOrigin.split(" ").map(parseFloat);c/=e.clientWidth,u/=e.clientHeight;var f=Ozt(e),h=e.clientWidth/n.width/f,d=e.clientHeight/n.height/f,g=t.left+t.width*c,y=t.top+t.height*u,v=n.left+n.width*c,b=n.top+n.height*u,_=(g-v)*h,w=(y-b)*d,S=t.width/n.width,k=t.height/n.height;return{delay:i,duration:typeof s=="function"?s(Math.sqrt(_*_+w*w)):s,easing:o,css:(A,T)=>{var M=T*_,I=T*w,C=A+T*S,N=A+T*k;return`transform: ${l} translate(${M}px, ${I}px) scale(${C}, ${N});`}}}function Ozt(e){if("currentCSSZoom"in e)return e.currentCSSZoom;for(var t=e,n=1;t!==null;)n*=+getComputedStyle(t).zoom,t=t.parentElement;return n}const Lzt="spec",Est="literal",Dzt="options",Fzt="selection",Bzt="paramref",Pzt="columnparamref",Uzt="param",zzt="include",kst="select",A5="value",qzt="crossfilter",Tst="intersect",jzt="union",Vzt="single",Wzt="data",Yzt="expression",Jy="sql",C8="input",J2="hconcat",Z2="vconcat",Q2="hspace",tS="vspace",Mst="mark",JB="from",eS="plot",N8="legend",Hzt="attribute",Ist="transform",Gzt="windowframe",Xzt="interactor",Rw="Fixed";function nS(e){const t=typeof e;return t==="object"?e?.param:t==="string"?Kzt(e):null}function Kzt(e){return e?.[0]==="$"?e.slice(1):null}function ZB(e){return`$${e}`}function Rst(e){return[e].flat()}function Md(e){return Array.isArray(e)}function $8(e){return e!==null&&typeof e=="object"&&!Md(e)}function Cw(e){return typeof e=="string"}function Cst(e,t){throw Object.assign(Error(e),{data:t})}const Jzt=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Zzt(e,t){return Jzt.test(e+="")?new Date(e):t}class Ir{constructor(t,n=null){this.type=t,this.children=n}instantiate(t){throw Error("instantiate not implemented")}codegen(t){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}}function Cl(e,t){const n={};for(const r in e)n[r]=t.maybeSelection(e[r]);return new cb(n)}class cb extends Ir{constructor(t){super(Dzt),this.options=t}filter(t){const n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new cb(n)}instantiate(t){const{options:n}=this,r={};for(const i in n)r[i]=n[i].instantiate(t);return r}codegen(t){const{options:n}=this,r=[];for(const i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){const{options:t}=this,n={};for(const r in t)n[r]=t[r].toJSON();return n}}const Nst="table",$st="parquet",Ost="csv",O8="json",L8="spatial",QB=new Map([[Nst,rqt],[$st,iqt],[Ost,sqt],[O8,oqt],[L8,aqt]]);function Qzt(e,t,n){const r=tqt(t);if(QB.has(r.type))return QB.get(r.type)(e,r,n);n.error("Unrecognized data format type.",t)}function tqt(e){return Md(e)&&(e={type:"json",data:e}),Cw(e)&&(e={type:"table",query:e}),{...e,type:eqt(e)}}function eqt(e){return e.type||nqt(e.file)||"table"}function nqt(e){const t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function rqt(e,t,n){const{query:r,type:i,...s}=t;return new uqt(e,r,Cl(s,n))}function iqt(e,t,n){const{file:r,type:i,...s}=t;return new hqt(e,r,Cl(s,n))}function sqt(e,t,n){const{file:r,type:i,...s}=t;return new dqt(e,r,Cl(s,n))}function oqt(e,t,n){const{data:r,file:i,type:s,...o}=t,a=Cl(o,n);return r?new gqt(e,r,a):new pqt(e,i,a)}function aqt(e,t,n){const{file:r,type:i,...s}=t;return new fqt(e,r,Cl(s,n))}function t9(e,t){return t?new URL(e,t).toString():e}function lqt(e,t){const n=e?.codegen(t);return n?`, ${n}`:""}class cqt extends Ir{constructor(t,n){super(Wzt),this.name=t,this.format=n}}class D8 extends cqt{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){const n=this.instantiateQuery(t);if(n)return n}codegen(t){const n=this.codegenQuery(t);if(n)return n}}class uqt extends D8{constructor(t,n,r){super(t,Nst),this.query=n?.trim(),this.options=r}instantiateQuery(t){const{name:n,query:r,options:i}=this;if(r)return t.api.createTable(n,r,i.instantiate(t))}codegenQuery(t){const{name:n,query:r,options:i}=this;if(r)return`\`${d1(n,r,i.instantiate(t))}\``}toJSON(){const{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}}class yA extends D8{constructor(t,n,r,i,s){super(t,n),this.file=i,this.method=r,this.options=s}instantiateQuery(t){const{name:n,method:r,file:i,options:s}=this,o=t9(i,t.baseURL),a=s?.instantiate(t);return t.api[r](n,o,a)}codegenQuery(t){const{name:n,method:r,file:i,options:s}=this,o=t9(i,t.baseURL),a=lqt(s,t);return`${t.ns()}${r}("${n}", "${o}"${a})`}toJSON(){const{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}}class fqt extends yA{constructor(t,n,r){super(t,L8,"loadSpatial",n,r)}}class hqt extends yA{constructor(t,n,r){super(t,$st,"loadParquet",n,r)}}class dqt extends yA{constructor(t,n,r){super(t,Ost,"loadCSV",n,r)}}class pqt extends yA{constructor(t,n,r){super(t,O8,"loadJSON",n,r)}}class gqt extends D8{constructor(t,n,r){super(t,O8),this.data=n,this.options=r}instantiateQuery(t){const{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){const{name:n,data:r,options:i}=this,s=i?","+i.codegen(t):"",o=`[ + `+r.map(a=>JSON.stringify(a)).join(`, + `)+` + ]`;return`${t.ns()}loadObjects("${n}", ${o}${s})`}toJSON(){const{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}}function mqt(e){const t=e.config?.extensions,n=new Set(t?Rst(t):[]);for(const r of Object.values(e.data))r.format===L8&&n.add("spatial");return n}async function yqt(e,t){const{data:n,params:r,plotDefaults:i}=e,s=new vqt({plotDefaults:i,...t}),o=[],a=mqt(e);o.push(...Array.from(a).map(l=>PU(l)));for(const l of Object.values(n)){const c=l.instantiate(s);c&&o.push(c)}o.length>0&&await s.coordinator.exec(o);for(const[l,c]of Object.entries(r))if(!s.activeParams.has(l)){const u=c.instantiate(s);s.activeParams.set(l,u)}return{element:e.root.instantiate(s),params:s.activeParams}}class vqt{constructor({api:t=uit(),plotDefaults:n=[],params:r=new Map,baseURL:i=null}={}){this.api=t,this.plotDefaults=n,this.activeParams=r,this.baseURL=i,this.coordinator=t.context.coordinator}error(t,n){Cst(t,n)}}class E5 extends Ir{constructor(t){super(Est),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}}function bqt(e,t){const{select:n,include:r,...i}=e,s=Cl(i,t);return r&&(s.options.include=new _qt(Rst(r).map(o=>t.selectionRef(nS(o))))),new k5(n,s)}class k5 extends Ir{constructor(t=Tst,n=new cb({})){super(Fzt),this.select=t,this.options=n}instantiate(t){const{select:n,options:r}=this;return t.api.Selection[n](r.instantiate(t))}codegen(t){const{select:n,options:r}=this;return`${t.ns()}Selection.${n}(${r.codegen(t)})`}toJSON(){const{select:t,options:n}=this;return{select:t,...n.toJSON()}}}class _qt extends Ir{constructor(t){super(zzt),this.refs=t}instantiate(t){return this.refs.map(n=>n.instantiate(t))}codegen(t){return`[${this.refs.map(n=>n.codegen(t)).join(", ")}]`}toJSON(){return this.refs.map(t=>t.toJSON())}}const wqt=new Set([A5,Vzt,qzt,Tst,jzt]);function xqt(e,t){const n=$8(e)?e:{value:e},{select:r=A5,value:i,date:s}=n;return wqt.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==A5?bqt(e,t):Md(i)?new T5(i.map(o=>t.maybeParam(o))):new T5(i,s)}class T5 extends Ir{constructor(t,n){super(Uzt),this.value=t,this.date=n}instantiate(t){const{date:n,value:r}=this,{Param:i}=t.api;return Md(r)?i.array(r.map(s=>s.instantiate(t))):i.value(Zzt(n,r))}codegen(t){const{value:n,date:r}=this,i=`${t.ns()}Param.`;return Md(n)?`${i}array([${n.map(s=>s.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){const{date:t,value:n}=this;return Md(n)?n.map(r=>r.toJSON()):t?{date:t}:n}}class Sqt extends Ir{constructor(t){super(Bzt),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(t){return ZB(this.name)}toJSON(){return ZB(this.name)}}function Lst(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new Aqt(e,t===Rw?new Eqt:n.maybeParam(t))}class Aqt extends Ir{constructor(t,n){super(Hzt),this.name=t,this.value=n}instantiate(t){const{name:n,value:r}=this;return t.api[n](r.instantiate(t))}codegen(t){const{name:n,value:r}=this;return`${t.tab()}${t.ns()}${n}(${r.codegen(t)})`}toJSON(){const{name:t,value:n}=this;return{[t]:n.toJSON()}}}class Eqt extends Ir{constructor(){super(Est),this.value=Rw}instantiate(t){return t.api[Rw]}codegen(t){return`${t.ns()}${Rw}`}toJSON(){return this.value}}class kqt extends Ir{constructor(t,n,r,i,s,o){super(Lzt,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=s,this.plotDefaults=o}toJSON(){const{root:t,meta:n,config:r,plotDefaults:i}=this,s=new Map(Object.entries(this.data)),o=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),s?.size){const l=a.data={};for(const[c,u]of s)l[c]=u.toJSON()}if(o?.size){const l=a.params={};for(const[c,u]of o)l[c]=u.toJSON()}if(i?.length){const l=a.plotDefaults={};for(const c of i)Object.assign(l,c.toJSON())}return Object.assign(a,t.toJSON())}}function Tqt(e,t){const n=e[J2].map(r=>t.parseComponent(r));return new Mqt(n)}class Mqt extends Ir{constructor(t){super(J2,t)}instantiate(t){return t.api[J2](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();const n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}( +${n.join(`, +`)} +${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}}function Iqt(e){return new Rqt(e[Q2])}class Rqt extends Ir{constructor(t){super(Q2),this.value=t}instantiate(t){return t.api[Q2](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${t.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}}function Cqt(e,t){const{[C8]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new Nqt(n,Cl(r,t))}class Nqt extends Ir{constructor(t,n){super(C8),this.name=t,this.options=n}instantiate(t){return t.api[this.name](this.options.instantiate(t))}codegen(t){const n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){const{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}}function Dst(e,t){const{[N8]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new $qt(i,n,Cl(r,t))}class $qt extends Ir{constructor(t,n,r){super(N8),this.key=t,this.name=n,this.options=r}instantiate(t){return t.api[this.key](this.options.instantiate(t))}codegen(t){const n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.key}(${n})`}toJSON(){const{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}}function Oqt(e,t){const{[kst]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new Lqt(n,Cl(r,t))}class Lqt extends Ir{constructor(t,n){super(Xzt),this.name=t,this.options=n}instantiate(t){return t.api[this.name](this.options.instantiate(t))}codegen(t){const n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){const{name:t,options:n}=this;return{[kst]:t,...n.toJSON()}}}class Dqt extends Ir{constructor(t){super(Pzt),this.param=t}instantiate(t){return t.api.column(this.param.instantiate(t))}codegen(t){return`${t.ns()}column(${this.param.codegen(t)})`}toJSON(){return`$${this.param.toJSON}`}}const Fqt=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\${1,2}\w+)/g;function Bqt(e,t){const n=e[Jy],r=n.split(Fqt),i=[""],s=[];for(let o=0,a=0;oo.instantiate(t));return i(n,...s)}codegen(t){const{spans:n,params:r}=this;let i="";const s=r.length;for(let o=0;o$8(o)?Fst(o,t):new y6(o));return new jqt(n,s,e.exclude)}class jqt extends Ir{constructor(t,n,r){super(Gzt),this.type=t,this.extent=n,this.exclude=r?.toUpperCase()}instantiate(t){const{type:n,extent:r,exclude:i}=this,s=Array.isArray(r)?r.map(o=>o.instantiate(t)):r.instantiate(t);return new RS(n,s,i?.toUpperCase())}codegen(t){const{type:n,extent:r,exclude:i}=this,s=`frame${n[0].toUpperCase()}${n.slice(1).toLowerCase()}`,o=Array.isArray(r)?`[${r.map(l=>l.codegen(t)).join(", ")}]`:r.codegen(t),a=i?`, '${i.toUpperCase()}'`:"";return`${t.ns()}${s}(${o}${a})`}toJSON(){const{type:t,extent:n,exclude:r}=this,i=t.toLowerCase(),s=Array.isArray(n)?n.map(o=>o.toJSON()):n.toJSON();return{[i]:s,exclude:r}}}function W_(e,t){return e==null?[]:[e].flat().map(n=>t.maybeParam(n))}function Fst(e,t){let n;for(const r in e)t.transforms.has(r)&&(n=r);if(n)if(n==="bin"){const{bin:r,...i}=e,[s]=W_(r,t);return new Wqt(n,s,Cl(i,t))}else{const r=n==="count"&&!e[n]?[]:W_(e[n],t),i={distinct:e.distinct,orderby:W_(e.orderby,t),partitionby:W_(e.partitionby,t),frame:qqt(e,t)};return new Vqt(n,r,i)}}class Vqt extends Ir{constructor(t,n,r){super(Ist),this.name=t,this.args=n,this.options=r}instantiate(t){const{name:n,args:r,options:i}=this,{distinct:s,orderby:o,partitionby:a,frame:l}=i;let c=t.api[n](...r.map(u=>u.instantiate(t)));return s&&(c=c.distinct()),o.length&&(c=c.orderby(o.map(u=>u.instantiate(t)))),a.length&&(c=c.partitionby(a.map(u=>u.instantiate(t)))),l&&(c=c.frame(l.instantiate(t))),c}codegen(t){const{name:n,args:r,options:i}=this,{distinct:s,orderby:o,partitionby:a,frame:l}=i;let c=`${t.ns()}${n}(`+r.map(u=>u.codegen(t)).join(", ")+")";if(s&&(c+=".distinct()"),o.length){const u=o.map(f=>f.codegen(t));c+=`.orderby(${u.join(", ")})`}if(a.length){const u=a.map(f=>f.codegen(t));c+=`.partitionby(${u.join(", ")})`}return l&&(c+=`.frame(${l.codegen(t)})`),c}toJSON(){const{name:t,args:n,options:r}=this,{distinct:i,orderby:s,partitionby:o,frame:a}=r,l={[t]:DT(n.map(c=>c.toJSON()))};return i&&(l.distinct=!0),s.length&&(l.orderby=DT(s.map(c=>c.toJSON()))),o.length&&(l.partitionby=DT(o.map(c=>c.toJSON()))),a&&Object.assign(l,a.toJSON()),l}}class Wqt extends Ir{constructor(t,n,r){super(Ist),this.name=t,this.arg=n,this.options=r}instantiate(t){const{name:n,arg:r,options:i}=this;return t.api[n](r.instantiate(t),i.instantiate(t))}codegen(t){const{name:n,arg:r,options:i}=this,s=i.codegen(t);return`${t.ns()}${n}(`+r.codegen(t)+(s?`, ${s}`:"")+")"}toJSON(){const{name:t,arg:n,options:r}=this;return{[t]:n.toJSON(),...r.toJSON()}}}function DT(e){return e.length===0?"":e.length===1?e[0]:e}function Yqt(e,t){if($8(e))return e[Jy]?Bqt(e,t):Fst(e,t)}function Hqt(e,t){const{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);const s=Uqt(r,t),o={};for(const a in i){const l=i[a];o[a]=Yqt(l,t)||t.maybeParam(l)}return new Gqt(n,s,new cb(o))}class Gqt extends Ir{constructor(t,n,r){super(Mst),this.name=t,this.data=n,this.options=r}instantiate(t){const{name:n,data:r,options:i}=this,s=i.instantiate(t);return r?t.api[n](r.instantiate(t),s):t.api[n](s)}codegen(t){const{name:n,data:r,options:i}=this,s=r?r.codegen(t):"",o=i.codegen(t);let a;if(s&&o){t.indent();const l=i.codegen(t);a=` +${t.tab()}${s}, +${t.tab()}${l} +`,t.undent(),a+=t.tab()}else a=`${s}${o}`;return`${t.tab()}${t.ns()}${n}(${a})`}toJSON(){const{type:t,name:n,data:r,options:i}=this;return{[t]:n,...r?{data:r.toJSON()}:{},...i.toJSON()}}}function Xqt(e,t){return Bst({plot:[e]},t)}function Bst(e,t){const{[eS]:n,...r}=e,i=Object.entries(r).map(([o,a])=>Lst(o,a,t)),s=n.map(o=>Cw(o.mark)?Hqt(o,t):Cw(o.legend)?Dst(o,t):Cw(o.select)?Oqt(o,t):t.error("Invalid plot entry.",o));return new Kqt(s,i)}class Kqt extends Ir{constructor(t,n){super(eS,t),this.attributes=n}instantiate(t){const n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[eS](this.children.map(r=>r.instantiate(t)),n.map(r=>r.instantiate(t)))}codegen(t){const{type:n,children:r,attributes:i}=this;t.indent();const s=[...r.map(o=>o.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(o=>o.codegen(t))].join(`, +`);return t.undent(),`${t.tab()}${t.ns()}${n}( +${s} +${t.tab()})`}toJSON(){const{type:t,children:n,attributes:r}=this,i={[t]:n.map(s=>s.toJSON())};for(const s of r)Object.assign(i,s.toJSON());return i}}function Jqt(e,t){const n=e[Z2].map(r=>t.parseComponent(r));return new Zqt(n)}class Zqt extends Ir{constructor(t){super(Z2,t)}instantiate(t){return t.api[Z2](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();const n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}( +${n.join(`, +`)} +${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}}function Qqt(e){return new tjt(e[tS])}class tjt extends Ir{constructor(t){super(tS),this.value=t}instantiate(t){return t.api[tS](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${t.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}}function ejt(e=[]){return new Map([[eS,Bst],[Mst,Xqt],[N8,Dst],[C8,Cqt],[J2,Tqt],[Z2,Jqt],[Q2,Iqt],[tS,Qqt],...e])}function njt(e=[]){return new Set(["menu","search","slider","table",...e])}function rjt({attributes:e=ijt(),interactors:t=sjt(),legends:n=ojt(),marks:r=ajt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function ijt(e=[]){return new Set([...Object.keys(RFt),...e])}function sjt(e=[]){return new Set([...Object.keys(OFt),...e])}function ojt(e=[]){return new Set([...Object.keys(LFt),...e])}function ajt(e=[]){return new Set([...Object.keys($Ft),...e])}function ljt(e=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","column","count","covariance","covarPop","dateMonth","dateMonthDay","dateDay","first","geomean","geojson","last","max","median","min","mode","product","quantile","stddev","stddevPop","sum","variance","varPop","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value","years","months","days","hours","minutes","seconds","milliseconds","microseconds",...e])}function F8(e,t){return new cjt(t).parse(e)}class cjt{constructor({components:t=ejt(),transforms:n=ljt(),inputs:r=njt(),plot:i=rjt(),params:s=[],datasets:o=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(s),this.datasets=new Map(o)}parse(t){const{meta:n,config:r,data:i={},params:s,plotDefaults:o={},...a}=t;for(const l in i)this.datasets.set(l,Qzt(l,i[l],this));this.plotDefaults=Object.entries(o).map(([l,c])=>Lst(l,c,this));for(const l in s)this.params.set(l,xqt(s[l],this));return new kqt(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(t){for(const[n,r]of this.components)if(t[n]!=null)return r(t,this);this.error("Invalid specification.",t)}maybeParam(t){const n=nS(t);return n?this.paramRef(n):new E5(t)}maybeSelection(t){const n=nS(t);return n?this.selectionRef(n):new E5(t)}paramRef(t,n=()=>new T5){const{params:r}=this;if(!t)return null;let i=r.get(t);return i||(i=n(),r.set(t,i)),new Sqt(t)}selectionRef(t,n=!1){const r=this.params.get(t);return n&&r&&!(r instanceof k5)?null:this.paramRef(t,()=>new k5)}error(t,n){Cst(t,n)}}var Y_={},e9=Symbol(),ujt=Symbol(),Pst=e=>typeof e=="string"?s1[e]:e,s1={plain:Y_,plaintext:Y_,text:Y_,txt:Y_},Ust=(e,t)=>(t[ujt]||fjt)(e,t),fjt=(e,t)=>{for(var n=[e],r,i=[],s=0;r=Pst(t[e9]);)delete t[e9],Object.assign(t,r);for(Vst(e,t,n,0);i[s++]=n[0],n=n[1];);return i},zst=(e,t,n)=>e.replace(/&/g,"&").replace(t,n),n9="",H_="",sy="",qst=e=>{for(var t="",n=e.length,r=0;r{if(e instanceof Ny){var{type:t,alias:n,content:r}=e,i=H_,s=sy,o=``;sy+=n9,H_+=o;var a=jst(r);return H_=i,sy=s,o+a+n9}return typeof e!="string"?qst(e):(e=zst(e,/{for(var s in t)if(t[s])for(var o=0,a=t[s],l=Array.isArray(a)?a:[a];o=v+(A=y[0].length);y=y[1],v+=A);if(y[0]instanceof Ny)continue;for(var T=y,a=v;(a+=T[0].length)i[2]&&(i[2]=N)}}}}};function Ny(e,t,n,r){this.type=e,this.content=t,this.alias=r,this.length=n.length}const hjt=(e,t,...n)=>{let r,i=[],s,o="",a,l=!1,c=!0,u=[],f,h=0;const d=gjt(),g=d.firstChild,y=g.children,v=y[0],b=v.firstChild,_={language:"text",value:o},w=new Set(n),S={},k=D=>{Object.assign(_,D);let O=o!=(o=D.value??o),B=r!=(r=_.language);f=!!_.readOnly,d.style.tabSize=_.tabSize||2,b.inputMode=f?"none":"",b.setAttribute("aria-readonly",f),M(),T(),O&&(l||b.remove(),b.value=o,b.selectionEnd=0,l||v.prepend(b)),(O||B)&&A()},A=()=>{u=Ust(o=b.value,s1[r]||{}),L("tokenize",u,r,o);let D=qst(u).split(` +`),O=0,B=h,V=h=D.length;for(;D[O]==i[O]&&O