diff --git "a/assets/index-JIydDwxo.js" "b/assets/index-JIydDwxo.js" new file mode 100644--- /dev/null +++ "b/assets/index-JIydDwxo.js" @@ -0,0 +1,1142 @@ +(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 o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const s7=!1;var dv=Array.isArray,Rft=Array.prototype.indexOf,V5=Array.from,W5=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,lB=Object.getOwnPropertyDescriptors,Nft=Object.prototype,Ift=Array.prototype,Y5=Object.getPrototypeOf,a7=Object.isExtensible;function Cp(e){return typeof e=="function"}const gn=()=>{};function Oft(e){return e()}function ly(e){for(var t=0;t{r.d=!0})}function Ie(e){const t=yn;if(t!==null){e!==void 0&&(t.x=e);const s=t.e;if(s!==null){var n=vn,r=Jn;t.e=null;try{for(var i=0;i{var l=Jn;ns(o);var c=a();return ns(l),c};return r&&n.set("length",_t(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Wft();var u=n.get(l);return u===void 0?(u=s(()=>_t(c.value)),n.set(l,u)):Y(u,s(()=>ks(c.value))),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0)l in a&&(n.set(l,s(()=>_t(co))),JE(i));else{if(r&&typeof l=="string"){var u=n.get("length"),f=Number(l);Number.isInteger(f)&&f_t(ks(f?a[l]:co))),n.set(l,u)),u!==void 0){var h=w(u);return h===co?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=w(u))}else if(c===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==co)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Wl)return!0;var c=n.get(l),u=c!==void 0&&c.v!==co||Reflect.has(a,l);if(c!==void 0||vn!==null&&(!u||iu(a,l)?.writable)){c===void 0&&(c=s(()=>_t(u?ks(a[l]):co)),n.set(l,c));var f=w(c);if(f===co)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p_t(co)),n.set(p+"",g))}f===void 0?(!h||iu(a,l)?.writable)&&(f=s(()=>_t(void 0)),Y(f,s(()=>ks(c))),n.set(l,f)):(h=f.v!==co,Y(f,s(()=>ks(c))));var y=Reflect.getOwnPropertyDescriptor(a,l);if(y?.set&&y.set.call(u,c),!h){if(r&&typeof l=="string"){var v=n.get("length"),b=Number(l);Number.isInteger(b)&&b>=v.v&&Y(v,b+1)}JE(i)}return!0},ownKeys(a){w(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==co});for(var[c,u]of n)u.v!==co&&!(c in a)&&l.push(c);return l},setPrototypeOf(){Yft()}})}function JE(e,t=1){Y(e,e.v+t)}function u7(e){try{if(e!==null&&typeof e=="object"&&Wl in e)return e[Wl]}catch{}return e}function cht(e,t){return Object.is(u7(e),u7(t))}function g0(e){var t=Za|Ql,n=Jn!==null&&(Jn.f&Za)!==0?Jn:null;return vn===null||n!==null&&(n.f&Ns)!==0?t|=Ns:vn.f|=fB,{ctx:yn,deps:null,effects:null,equals:hB,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:n??vn}}function ht(e){const t=g0(e);return DB(t),t}function mB(e){const t=g0(e);return t.equals=G5,t}function yB(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nnew Promise(r=>{n.outro?cd(t,()=>{tc(t),r(void 0)}):(tc(t),r(void 0))})}function Ad(e){return Z0(cB,e,!1)}function dht(e,t){var n=yn,r={effect:null,ran:!1};n.l.r1.push(r),r.effect=Rd(()=>{e(),!r.ran&&(r.ran=!0,Y(n.l.r2,!0),No(t))})}function pht(){var e=yn;Rd(()=>{if(w(e.l.r2)){for(var t of e.l.r1){var n=t.effect;(n.f&Ro)!==0&&ka(n,Zf),tg(n)&&R2(n),t.ran=!1}e.l.r2.v=!1}})}function Rd(e){return Z0(E2,e,!0)}function At(e,t=[],n=g0){const r=t.map(n);return Nd(()=>e(...r.map(w)))}function Nd(e,t=0){return Z0(E2|T2|t,e,!0)}function Ha(e,t=!0){return Z0(E2|Eu,e,!0,t)}function kB(e){var t=e.teardown;if(t!==null){const n=gv,r=Jn;h7(!0),ns(null);try{t.call(null)}finally{h7(n),ns(r)}}}function MB(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){var r=n.next;(n.f&X0)!==0?n.parent=null:tc(n,t),n=r}}function ght(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Eu)===0&&tc(t),t=n}}function tc(e,t=!0){var n=!1;(t||(e.f&Lft)!==0)&&e.nodes_start!==null&&(CB(e.nodes_start,e.nodes_end),n=!0),MB(e,t&&!n),Z_(e,0),ka(e,k2);var r=e.transitions;if(r!==null)for(const o of r)o.stop();kB(e);var i=e.parent;i!==null&&i.first!==null&&AB(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function CB(e,t){for(;e!==null;){var n=e===t?null:pc(e);e.remove(),e=n}}function AB(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 cd(e,t){var n=[];t6(e,n,!0),RB(n,()=>{tc(e),t&&t()})}function RB(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function t6(e,t,n){if((e.f&ou)===0){if(e.f^=ou,e.transitions!==null)for(const s of e.transitions)(s.is_global||n)&&t.push(s);for(var r=e.first;r!==null;){var i=r.next,o=(r.f&Cd)!==0||(r.f&Eu)!==0;t6(r,t,o?n:!1),r=i}}}function G_(e){NB(e,!0)}function NB(e,t){if((e.f&ou)!==0){e.f^=ou,(e.f&Ro)===0&&(e.f^=Ro),tg(e)&&(ka(e,Ql),N2(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&Cd)!==0||(n.f&Eu)!==0;NB(n,i?t:!1),n=r}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}const mht=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback;let fy=[],hy=[];function IB(){var e=fy;fy=[],ly(e)}function OB(){var e=hy;hy=[],ly(e)}function Q0(e){fy.length===0&&queueMicrotask(IB),fy.push(e)}function yht(e){hy.length===0&&mht(OB),hy.push(e)}function f7(){fy.length>0&&IB(),hy.length>0&&OB()}let jm=!1,X_=!1,J_=null,Yh=!1,gv=!1;function h7(e){gv=e}let Vm=[];let Jn=null,Nl=!1;function ns(e){Jn=e}let vn=null;function Ta(e){vn=e}let su=null;function DB(e){Jn!==null&&Jn.f&r4&&(su===null?su=[e]:su.push(e))}let ho=null,bs=0,ta=null;function vht(e){ta=e}let LB=1,K_=0,mf=!1;function FB(){return++LB}function tg(e){var t=e.f;if((t&Ql)!==0)return!0;if((t&Zf)!==0){var n=e.deps,r=(t&Ns)!==0;if(n!==null){var i,o,s=(t&W_)!==0,a=r&&vn!==null&&!mf,l=n.length;if(s||a){var c=e,u=c.parent;for(i=0;ie.wv)return!0}(!r||vn!==null&&!mf)&&ka(e,Ro)}return!1}function bht(e,t){for(var n=t;n!==null;){if((n.f&cy)!==0)try{n.fn(e);return}catch{n.f^=cy}n=n.parent}throw jm=!1,e}function d7(e){return(e.f&k2)===0&&(e.parent===null||(e.parent.f&cy)===0)}function KE(){jm=!1}function mv(e,t,n,r){if(jm){if(n===null&&(jm=!1),d7(t))throw e;return}if(n!==null&&(jm=!0),bht(e,t),d7(t))throw e}function $B(e,t,n=!0){var r=e.reactions;if(r!==null)for(var i=0;i0)for(f.length=bs+ho.length,h=0;h0;){t++>1e3&&wht();var n=Vm,r=n.length;Vm=[];for(var i=0;i0;)X_=!0,PB(),f7();return t}async function Eht(){await Promise.resolve(),UB()}function w(e){var t=e.f,n=(t&Za)!==0;if(Jn!==null&&!Nl){if(!su?.includes(e)){var r=Jn.deps;e.rv{document.activeElement===n&&e.focus()})}}let p7=!1;function zB(){p7||(p7=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function n6(e){var t=Jn,n=vn;ns(null),Ta(null);try{return e()}finally{ns(t),Ta(n)}}function Dht(e,t,n,r=n){e.addEventListener(t,()=>n6(n));const i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),zB()}const qB=new Set,l4=new Set;function jB(e,t,n,r={}){function i(o){if(r.capture||bm.call(t,o),!o.cancelBubble)return n6(()=>n?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Q0(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Jp(e,t,n,r,i){var o={capture:r,passive:i},s=jB(e,t,n,o);(t===document.body||t===window||t===document)&&A2(()=>{t.removeEventListener(e,s,o)})}function Fr(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,ns(u),Ta(f)}}}function r6(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function Is(e,t){var n=vn;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function St(e,t){var n=(t&pB)!==0,r=(t&sht)!==0,i,o=!e.startsWith("");return()=>{if(Ve)return Is(un,null),un;i===void 0&&(i=r6(o?e:""+e),n||(i=Xi(i)));var s=r||wB?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Xi(s),l=s.lastChild;Is(a,l)}else Is(s,s);return s}}function nn(e,t,n="svg"){var r=!e.startsWith(""),i=(t&pB)!==0,o=`<${n}>${r?e:""+e}`,s;return()=>{if(Ve)return Is(un,null),un;if(!s){var a=r6(o),l=Xi(a);if(i)for(s=document.createDocumentFragment();Xi(l);)s.appendChild(Xi(l));else s=Xi(l)}var c=s.cloneNode(!0);if(i){var u=Xi(c),f=c.lastChild;Is(u,f)}else Is(c,c);return c}}function yo(e=""){if(!Ve){var t=Af(e+"");return Is(t,t),t}var n=un;return n.nodeType!==3&&(n.before(n=Af()),Co(n)),Is(n,n),n}function pr(){if(Ve)return Is(un,null),un;var e=document.createDocumentFragment(),t=document.createComment(""),n=Af();return e.append(t,n),Is(t,n),e}function rt(e,t){if(Ve){vn.nodes_end=un,gu();return}e!==null&&e.before(t)}let c4=!0;function ce(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function i6(e,t){return VB(e,t)}function Lht(e,t){s4(),t.intro=t.intro??!1;const n=t.target,r=Ve,i=un;try{for(var o=Xi(n);o&&(o.nodeType!==8||o.data!==K5);)o=pc(o);if(!o)throw Xp;Va(!0),Co(o),gu();const s=VB(e,{...t,anchor:o});if(un===null||un.nodeType!==8||un.data!==Q5)throw C2(),Xp;return Va(!1),s}catch(s){if(s===Xp)return t.recover===!1&&qft(),s4(),EB(n),Va(!1),i6(e,t);throw s}finally{Va(r),Co(i)}}const fp=new Map;function VB(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:s=!0}){s4();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(Af());return Ha(()=>{if(o){Ne({});var h=yn;h.c=o}i&&(r.$$events=i),Ve&&Is(f,null),c4=s,c=e(f,r)||{},c4=!0,Ve&&(vn.nodes_end=un),o&&Ie()}),()=>{for(var h of a){t.removeEventListener(h,bm);var p=fp.get(h);--p===0?(document.removeEventListener(h,bm),fp.delete(h)):fp.set(h,p)}l4.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return u4.set(c,u),c}let u4=new WeakMap;function Fht(e,t){const n=u4.get(e);return n?(u4.delete(e),n(t)):Promise.resolve()}function Ft(e,t,[n,r]=[0,0]){Ve&&n===0&&gu();var i=e,o=null,s=null,a=co,l=n>0?Cd:0,c=!1;const u=(h,p=!0)=>{c=!0,f(p,h)},f=(h,p)=>{if(a===(a=h))return;let g=!1;if(Ve&&r!==-1){if(n===0){const v=i.data;v===K5?r=0:v===Z5?r=1/0:(r=parseInt(v.substring(1)),r!==r&&(r=a?1/0:-1))}const y=r>n;!!a===y&&(i=H_(),Co(i),Va(!1),g=!0,r=-1)}a?(o?G_(o):p&&(o=Ha(()=>p(i))),s&&cd(s,()=>{s=null})):(s?G_(s):p&&(s=Ha(()=>p(i,[n+1,r]))),o&&cd(o,()=>{o=null})),g&&Va(!0)};Nd(()=>{c=!1,t(u),c||f(null,null)},l),Ve&&(i=un)}function I2(e,t,n){Ve&&gu();var r=e,i=co,o,s=K0()?$ft:M2;Nd(()=>{s(i,i=t())&&(o&&cd(o),o=Ha(()=>n(r)))}),Ve&&(r=un)}let u_=null;function Fn(e,t){return t}function $ht(e,t,n,r){for(var i=[],o=t.length,s=0;s0&&i.length===0&&n!==null;if(a){var l=n.parentNode;EB(l),l.append(n),r.clear(),rf(e,t[0].prev,t[o-1].next)}RB(i,()=>{for(var c=0;c{var p=n();return dv(p)?p:p==null?[]:V5(p)});Nd(()=>{var p=w(h),g=p.length;if(f&&g===0)return;f=g===0;let y=!1;if(Ve){var v=s.data===Z5;v!==(g===0)&&(s=H_(),Co(s),Va(!1),y=!0)}if(Ve){for(var b=null,_,S=0;S0&&Co(H_())}Ve||Bht(p,a,s,i,t,r,n),o!==null&&(g===0?u?G_(u):u=Ha(()=>o(s)):u!==null&&cd(u,()=>{u=null})),y&&Va(!0),w(h)}),Ve&&(s=un)}function Bht(e,t,n,r,i,o,s){var a=(i&Jft)!==0,l=(i&(X5|J5))!==0,c=e.length,u=t.items,f=t.first,h=f,p,g=null,y,v=[],b=[],_,S,x,T;if(a)for(T=0;T0){var $=(i&dB)!==0&&c===0?n:null;if(a){for(T=0;T{if(y!==void 0)for(x of y)x.a?.apply()}),vn.first=t.first&&t.first.e,vn.last=g&&g.e}function Pht(e,t,n,r){(r&X5)!==0&&i4(e.v,t),(r&J5)!==0?i4(e.i,n):e.i=n}function WB(e,t,n,r,i,o,s,a,l,c){var u=u_,f=(l&X5)!==0,h=(l&Kft)===0,p=f?h?Wh(i):ad(i):i,g=(l&J5)===0?s:ad(s),y={i:g,v:p,k:o,a:null,e:null,prev:n,next:r};u_=y;try{return y.e=Ha(()=>a(e,p,g,c),Ve),y.e.prev=n&&n.e,y.e.next=r&&r.e,n===null?t.first=y:(n.next=y,n.e.next=y.e),r!==null&&(r.prev=y,r.e.prev=y.e),y}finally{u_=u}}function g7(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,o=e.e.nodes_start;o!==r;){var s=pc(o);i.before(o),o=s}}function rf(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 Uht(e,t,n=!1,r=!1,i=!1){var o=e,s="";At(()=>{var a=vn;if(s===(s=t()??"")){Ve&&gu();return}if(a.nodes_start!==null&&(CB(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),s!==""){if(Ve){un.data;for(var l=gu(),c=l;l!==null&&(l.nodeType!==8||l.data!=="");)c=l,l=pc(l);if(l===null)throw C2(),Xp;Is(un,c),o=Co(l);return}var u=s+"";n?u=`${u}`:r&&(u=`${u}`);var f=r6(u);if((n||r)&&(f=Xi(f)),Is(Xi(f),f.lastChild),n||r)for(;Xi(f);)o.before(Xi(f));else o.before(f)}})}function dy(e,t,...n){var r=e,i=gn,o;Nd(()=>{i!==(i=t())&&(o&&(tc(o),o=null),o=Ha(()=>i(r,...n)))},Cd),Ve&&(r=un)}function py(e,t,n){Ve&&gu();var r=e,i,o;Nd(()=>{i!==(i=t())&&(o&&(cd(o),o=null),i&&(o=Ha(()=>n(r,i))))},Cd),Ve&&(r=un)}function YB(e,t,n){Ad(()=>{var r=No(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,o={};Rd(()=>{var s=n();e6(s),i&&M2(o,s)&&(o=s,r.update(s))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function HB(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=s+o;(s===0||m7.includes(r[s-1]))&&(a===r.length||m7.includes(r[a]))?r=(s===0?"":r.substring(0,s))+r.substring(a+1):s=a}}return r===""?null:r}function y7(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var o=e[i];o!=null&&o!==""&&(r+=" "+i+": "+o+n)}return r}function ZE(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Vht(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 o=!1,s=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(ZE)),i&&l.push(...Object.keys(i).map(ZE));var c=0,u=-1;const y=e.length;for(var f=0;f{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,yht(n),zB()}}function Wht(e,t){var n=o6(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function Yht(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function ct(e,t,n,r){var i=o6(e);Ve&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[Fft]=n),n==null?e.removeAttribute(t):typeof n!="string"&&KB(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Ps(e,t,n,r,i=!1){var o=o6(e),s=o[GB],a=!o[XB];let l=Ve&&s;l&&Va(!1);var c=t||{},u=e.tagName==="OPTION";for(var f in t)f in n||(n[f]=null);n.class?n.class=qht(n.class):n[Gg]&&(n.class=null),n[Xg]&&(n.style??=null);var h=KB(e);for(const S in n){let x=n[S];if(u&&S==="value"&&x==null){e.value=e.__value="",c[S]=x;continue}if(S==="class"){var p=e.namespaceURI==="http://www.w3.org/1999/xhtml";nr(e,p,x,r,t?.[Gg],n[Gg]),c[S]=x,c[Gg]=n[Gg];continue}if(S==="style"){Ce(e,x,t?.[Xg],n[Xg]),c[S]=x,c[Xg]=n[Xg];continue}var g=c[S];if(x!==g){c[S]=x;var y=S[0]+S[1];if(y!=="$$")if(y==="on"){const T={},k="$$"+S;let M=S.slice(2);var v=Cht(M);if(kht(M)&&(M=M.slice(0,-7),T.capture=!0),!v&&g){if(x!=null)continue;e.removeEventListener(M,c[k],T),c[k]=null}if(x!=null)if(v)e[`__${M}`]=x,Fr([M]);else{let C=function(R){c[S].call(this,R)};c[k]=jB(M,e,C,T)}else v&&(e[`__${M}`]=void 0)}else if(S==="style")ct(e,S,x);else if(S==="autofocus")Oht(e,!!x);else if(!s&&(S==="__value"||S==="value"&&x!=null))e.value=e.__value=x;else if(S==="selected"&&u)Yht(e,x);else{var b=S;a||(b=Rht(b));var _=b==="defaultValue"||b==="defaultChecked";if(x==null&&!s&&!_)if(o[S]=null,b==="value"||b==="checked"){let T=e;const k=t===void 0;if(b==="value"){let M=T.defaultValue;T.removeAttribute(b),T.defaultValue=M,T.value=T.__value=k?M:null}else{let M=T.defaultChecked;T.removeAttribute(b),T.defaultChecked=M,T.checked=k?M:!1}}else e.removeAttribute(S);else _||h.includes(b)&&(s||typeof x!="string")?e[b]=x:typeof x!="function"&&ct(e,b,x)}}}return l&&Va(!0),c}function o6(e){return e.__attributes??={[GB]:e.nodeName.includes("-"),[XB]:e.namespaceURI===aht}}var v7=new Map;function KB(e){var t=v7.get(e.nodeName);if(t)return t;v7.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=lB(r);for(var o in n)n[o].set&&t.push(o);r=Y5(r)}return t}const Hht=()=>performance.now(),Il={tick:e=>requestAnimationFrame(e),now:()=>Hht(),tasks:new Set};function ZB(){const e=Il.now();Il.tasks.forEach(t=>{t.c(e)||(Il.tasks.delete(t),t.f())}),Il.tasks.size!==0&&Il.tick(ZB)}function QB(e){let t;return Il.tasks.size===0&&Il.tick(ZB),{promise:new Promise(n=>{Il.tasks.add(t={c:e,f:n})}),abort(){Il.tasks.delete(t)}}}function lb(e,t){n6(()=>{e.dispatchEvent(new CustomEvent(t))})}function Ght(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 b7(e){const t={},n=e.split(";");for(const r of n){const[i,o]=r.split(":");if(!i||o===void 0)break;const s=Ght(i.trim());t[s]=o.trim()}return t}const Xht=e=>e;function Jht(e,t,n){var r=u_,i,o,s,a=null;r.a??={element:e,measure(){i=this.element.getBoundingClientRect()},apply(){if(s?.abort(),o=this.element.getBoundingClientRect(),i.left!==o.left||i.right!==o.right||i.top!==o.top||i.bottom!==o.bottom){const l=t()(this.element,{from:i,to:o},n?.());s=tw(this.element,l,void 0,1,()=>{s?.abort(),s=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 p=`translate(${i.left-h.left}px, ${i.top-h.top}px)`;f.transform=f.transform?`${f.transform} ${p}`:p}}}},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 Q_(e,t,n,r){var i=(e&rht)!==0,o=(e&iht)!==0,s=i&&o,a=(e&oht)!==0,l=s?"both":i?"in":"out",c,u=t.inert,f=t.style.overflow,h,p;function g(){var S=Jn,x=vn;ns(null),Ta(null);try{return c??=n()(t,r?.()??{},{direction:l})}finally{ns(S),Ta(x)}}var y={is_global:a,in(){if(t.inert=u,!i){p?.abort(),p?.reset?.();return}o||h?.abort(),lb(t,"introstart"),h=tw(t,g(),p,1,()=>{lb(t,"introend"),h?.abort(),h=c=void 0,t.style.overflow=f})},out(S){if(!o){S?.(),c=void 0;return}t.inert=!0,lb(t,"outrostart"),p=tw(t,g(),h,0,()=>{lb(t,"outroend"),S?.()})},stop:()=>{h?.abort(),p?.abort()}},v=vn;if((v.transitions??=[]).push(y),i&&c4){var b=a;if(!b){for(var _=v.parent;_&&(_.f&Cd)!==0;)for(;(_=_.parent)&&(_.f&T2)===0;);b=!_||(_.f&uB)!==0}b&&Ad(()=>{No(()=>y.in())})}}function tw(e,t,n,r,i){var o=r===1;if(Cp(t)){var s,a=!1;return Q0(()=>{if(!a){var v=t({direction:o?"in":"out"});s=tw(e,v,n,r,i)}}),{abort:()=>{a=!0,s?.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(n?.deactivate(),!t?.duration)return i(),{abort:gn,deactivate:gn,reset:gn,t:()=>r};const{delay:l=0,css:c,tick:u,easing:f=Xht}=t;var h=[];if(o&&n===void 0&&(u&&u(0,1),c)){var p=b7(c(0,1));h.push(p,p)}var g=()=>1-r,y=e.animate(h,{duration:l});return y.onfinish=()=>{var v=n?.t()??1-r;n?.abort();var b=r-v,_=t.duration*Math.abs(b),S=[];if(_>0){var x=!1;if(c)for(var T=Math.ceil(_/16.666666666666668),k=0;k<=T;k+=1){var M=v+b*f(k/T),C=b7(c(M,1-M));S.push(C),x||=C.overflow==="hidden"}x&&(e.style.overflow="hidden"),g=()=>{var R=y.currentTime;return v+b*f(R/_)},u&&QB(()=>{if(y.playState!=="running")return!1;var R=g();return u(R,1-R),!0})}y=e.animate(S,{duration:_,fill:"forwards"}),y.onfinish=()=>{g=()=>r,u?.(r,1-r),i()}},{abort:()=>{y&&(y.cancel(),y.effect=null,y.onfinish=gn)},deactivate:()=>{i=gn},reset:()=>{r===0&&u?.(1,0)},t:()=>g()}}function Kht(e,t,n=t){var r=K0();Dht(e,"input",i=>{var o=i?e.defaultValue:e.value;if(o=tT(e)?eT(o):o,n(o),r&&o!==(o=t())){var s=e.selectionStart,a=e.selectionEnd;e.value=o??"",a!==null&&(e.selectionStart=s,e.selectionEnd=Math.min(a,e.value.length))}}),(Ve&&e.defaultValue!==e.value||No(t)==null&&e.value)&&n(tT(e)?eT(e.value):e.value),Rd(()=>{var i=t();tT(e)&&i===eT(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function tT(e){var t=e.type;return t==="number"||t==="range"}function eT(e){return e===""?null:+e}function Zht(e,t,n){var r=iu(e,t);r&&r.set&&(e[t]=n,A2(()=>{e[t]=null}))}function gy(e,t,n){if(e.multiple)return Qht(e,t);for(var r of e.options){var i=t9(r);if(cht(i,t)){r.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function f4(e,t){let n=!0;Ad(()=>{t&&gy(e,No(t),n),n=!1;var r=new MutationObserver(()=>{var i=e.__value;gy(e,i)});return r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),()=>{r.disconnect()}})}function Qht(e,t){for(var n of e.options)n.selected=~t.indexOf(t9(n))}function t9(e){return"__value"in e?e.__value:e.value}class s6{#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){s6.entries.set(n.target,n);for(var r of this.#t.get(n.target)||[])r(n)}}))}}var tdt=new s6({box:"border-box"});function ud(e,t,n){var r=tdt.observe(e,()=>n(e[t]));Ad(()=>(No(()=>n(e[t])),r))}function _7(e,t){return e===t||e?.[Wl]===t}function rs(e={},t,n,r){return Ad(()=>{var i,o;return Rd(()=>{i=o,o=[],No(()=>{e!==n(...o)&&(t(e,...o),i&&_7(n(...i),e)&&t(null,...i))})}),()=>{Q0(()=>{o&&_7(n(...o),e)&&t(null,...o)})}}),e}function a6(e=!1){const t=yn,n=t.l.u;if(!n)return;let r=()=>e6(t.s);if(e){let i=0,o={};const s=g0(()=>{let a=!1;const l=t.s;for(const c in l)l[c]!==o[c]&&(o[c]=l[c],a=!0);return a&&i++,i});r=()=>w(s)}n.b.length&&fe(()=>{w7(t,r),ly(n.b)}),$i(()=>{const i=No(()=>n.m.map(Oft));return()=>{for(const o of i)typeof o=="function"&&o()}}),n.a.length&&$i(()=>{w7(t,r),ly(n.a)})}function w7(e,t){if(e.l.s)for(const n of e.l.s)w(n);t()}function x7(e,t){var n=e.$$events?.[t.type],r=dv(n)?n.slice():n==null?[]:[n];for(var i of r)i.call(this,t)}function l6(e,t,n){if(e==null)return t(void 0),n&&n(void 0),gn;const r=No(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const hp=[];function e9(e,t){return{subscribe:m0(e,t).subscribe}}function m0(e,t=gn){let n=null;const r=new Set;function i(a){if(M2(e,a)&&(e=a,n)){const l=!hp.length;for(const c of r)c[1](),hp.push(c,e);if(l){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:s}}function c6(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 o=t.length<2;return e9(n,(s,a)=>{let l=!1;const c=[];let u=0,f=gn;const h=()=>{if(u)return;f();const g=t(r?c[0]:c,s,a);o?s(g):f=typeof g=="function"?g:gn},p=i.map((g,y)=>l6(g,v=>{c[y]=v,u&=~(1<{u|=1<t=n)(),t}let cb=!1,h4=Symbol();function Zi(e,t,n){const r=n[t]??={store:null,source:Wh(void 0),unsubscribe:gn};if(r.store!==e&&!(h4 in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=gn;else{var i=!0;r.unsubscribe=l6(e,o=>{i?r.source.v=o:Y(r.source,o)}),i=!1}return e&&h4 in n?edt(e):w(r.source)}function Jg(e,t){return e.set(t),t}function fs(){const e={};function t(){A2(()=>{for(var n in e)e[n].unsubscribe();W5(e,h4,{enumerable:!1,value:!0})})}return[e,t]}function ndt(e){var t=cb;try{return cb=!1,[e(),cb]}finally{cb=t}}const rdt={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 Lo(e,t,n){return new Proxy({props:e,exclude:t},rdt)}const idt={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Cp(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];Cp(i)&&(i=i());const o=iu(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Cp(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const i=iu(r,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===Wl||t===H5)return!1;for(let n of e.props)if(Cp(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props){Cp(n)&&(n=n());for(const r in n)t.includes(r)||t.push(r)}return t}};function d4(...e){return new Proxy({props:e},idt)}function S7(e){return e.ctx?.d??!1}function ae(e,t,n,r){var i=(n&Zft)!==0,o=!J0||(n&Qft)!==0,s=(n&eht)!==0,a=(n&nht)!==0,l=!1,c;s?[c,l]=ndt(()=>e[t]):c=e[t];var u=Wl in e||H5 in e,f=s&&(iu(e,t)?.set??(u&&t in e&&(k=>e[t]=k)))||void 0,h=r,p=!0,g=!1,y=()=>(g=!0,p&&(p=!1,a?h=No(r):h=r),h);c===void 0&&r!==void 0&&(f&&o&&Vft(),c=y(),f&&f(c));var v;if(o)v=()=>{var k=e[t];return k===void 0?y():(p=!0,g=!1,k)};else{var b=(i?g0:mB)(()=>e[t]);b.f|=Dft,v=()=>{var k=w(b);return k!==void 0&&(h=void 0),k===void 0?h:k}}if((n&tht)===0)return v;if(f){var _=e.$$legacy;return function(k,M){return arguments.length>0?((!o||!M||_||l)&&f(M?v():k),k):v()}}var S=!1,x=Wh(c),T=g0(()=>{var k=v(),M=w(x);return S?(S=!1,M):x.v=k});return s&&w(T),i||(T.equals=G5),function(k,M){if(arguments.length>0){const C=M?w(T):o&&s?ks(k):k;if(!T.equals(C)){if(S=!0,Y(x,C),g&&h!==void 0&&(h=C),S7(T))return k;No(()=>w(T))}return k}return S7(T)?T.v:w(T)}}function E7(e,t){var n=vn,r=Jn,i=yn;Ta(e),ns(e),Y_(e.ctx);try{t()}finally{Ta(n),ns(r),Y_(i)}}function odt(e,t,n){var r=e,i;Nd(()=>{var o=vn,s=un,a=!1;o.fn=l=>{var c=t.onerror;let u=t.failed;if(!c&&!u||a)throw l;var f=()=>{cd(i),E7(o,()=>{a=!1,i=Ha(()=>n(r)),KE()})};c?.(l,f),i?tc(i):Ve&&(Co(s),ld(),Co(H_())),u&&Q0(()=>{E7(o,()=>{a=!0;try{i=Ha(()=>{u(r,()=>l,()=>f)})}catch(h){mv(h,o,null,o.ctx)}KE(),a=!1})})},Ve&&gu(),i=Ha(()=>n(r)),KE()},Cd|cy),Ve&&(r=un)}function sdt(e){return new adt(e)}class adt{#t;#e;constructor(t){var n=new Map,r=(o,s)=>{var a=Wh(s);return n.set(o,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return w(n.get(s)??r(s,Reflect.get(o,s)))},has(o,s){return s===H5?!0:(w(n.get(s)??r(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,a){return Y(n.get(s)??r(s,a),a),Reflect.set(o,s,a)}});this.#e=(t.hydrate?Lht:i6)(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)&&UB(),this.#t=i.$$events;for(const o of Object.keys(this.#e))o==="$set"||o==="$destroy"||o==="$on"||W5(this,o,{get(){return this.#e[o]},set(s){this.#e[o]=s},enumerable:!0});this.#e.$set=o=>{Object.assign(i,o)},this.#e.$destroy=()=>{Fht(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 eg(e){yn===null&&pv(),J0&&yn.l!==null?n9(yn).m.push(e):$i(()=>{const t=No(e);if(typeof t=="function")return t})}function u6(e){yn===null&&pv(),eg(()=>()=>No(e))}function ldt(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function cdt(){const e=yn;return e===null&&pv(),(t,n,r)=>{const i=e.s.$$events?.[t];if(i){const o=dv(i)?i.slice():[i],s=ldt(t,n,r);for(const a of o)a.call(e.x,s);return!s.defaultPrevented}return!0}}function udt(e){yn===null&&pv(),yn.l===null&&jft(),n9(yn).a.push(e)}function n9(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const fdt="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(fdt);Xft();function hdt(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,o,s=[],a="",l=e.split("/");for(l[0]||l.shift();i=l.shift();)n=i[0],n==="*"?(s.push("wild"),a+="/(.*)"):n===":"?(r=i.indexOf("?",1),o=i.indexOf(".",1),s.push(i.substring(1,~r?r:~o?o:i.length)),a+=~r&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(a+=(~r?"?":"")+"\\"+i.substring(o))):a+="/"+i;return{keys:s,pattern:new RegExp("^"+a+"/?$","i")}}function T7(){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 f6=e9(null,function(t){t(T7());const n=()=>{t(T7())};return window.addEventListener("hashchange",n,!1),function(){window.removeEventListener("hashchange",n,!1)}});c6(f6,e=>e.location);c6(f6,e=>e.querystring);const k7=m0(void 0);function ddt(e){e?window.scrollTo(e.__svelte_spa_router_scrollX,e.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function pdt(e,t){Ne(t,!1);let n=ae(t,"routes",24,()=>({})),r=ae(t,"prefix",8,""),i=ae(t,"restoreScrollState",8,!1);class o{constructor(k,M){if(!M||typeof M!="function"&&(typeof M!="object"||M._sveltesparouter!==!0))throw Error("Invalid component object");if(!k||typeof k=="string"&&(k.length<1||k.charAt(0)!="/"&&k.charAt(0)!="*")||typeof k=="object"&&!(k instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:C,keys:R}=hdt(k);this.path=k,typeof M=="object"&&M._sveltesparouter===!0?(this.component=M.component,this.conditions=M.conditions||[],this.userData=M.userData,this.props=M.props||{}):(this.component=()=>Promise.resolve(M),this.conditions=[],this.props={}),this._pattern=C,this._keys=R}match(k){if(r()){if(typeof r()=="string")if(k.startsWith(r()))k=k.substr(r().length)||"/";else return null;else if(r()instanceof RegExp){const O=k.match(r());if(O&&O[0])k=k.substr(O[0].length)||"/";else return null}}const M=this._pattern.exec(k);if(M===null)return null;if(this._keys===!1)return M;const C={};let R=0;for(;R{s.push(new o(k,T))}):Object.keys(n()).forEach(T=>{s.push(new o(T,n()[T]))});let a=Wh(null),l=Wh(null),c=Wh({});const u=cdt();async function f(T,k){await Eht(),u(T,k)}let h=null,p=null;i()&&(p=T=>{T.state&&(T.state.__svelte_spa_router_scrollY||T.state.__svelte_spa_router_scrollX)?h=T.state:h=null},window.addEventListener("popstate",p),udt(()=>{ddt(h)}));let g=null,y=null;const v=f6.subscribe(async T=>{g=T;let k=0;for(;k{k7.set(w(l))});return}Y(a,null),y=null,k7.set(void 0)});u6(()=>{v(),p&&window.removeEventListener("popstate",p)}),dht(()=>e6(i()),()=>{history.scrollRestoration=i()?"manual":"auto"}),pht(),a6();var b=pr(),_=re(b);{var S=T=>{var k=pr(),M=re(k);py(M,()=>w(a),(C,R)=>{R(C,d4({get params(){return w(l)}},()=>w(c),{$$events:{routeEvent(O){x7.call(this,t,O)}}}))}),rt(T,k)},x=T=>{var k=pr(),M=re(k);py(M,()=>w(a),(C,R)=>{R(C,d4(()=>w(c),{$$events:{routeEvent(O){x7.call(this,t,O)}}}))}),rt(T,k)};Ft(_,T=>{w(l)?T(S):T(x,!1)})}rt(e,b),Ie()}const M7={};function r9(e,t=!1){let n,r,i=M7;function o(c){n=e(c).catch(()=>{}).finally(()=>{if(r){const{value:u}=r;r=null,o(u)}else n=null})}function s(c){r={event:c}}function a(c){n?s(c):o(c)}function l(c){i!==c&&requestAnimationFrame(()=>{const u=i;i=M7,a(u)}),i=c}return t?l:a}class Id{constructor(t){this._filterBy=t,this._requestUpdate=r9(()=>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 i9=Uint8Array.of(65,82,82,79,87,49),O2={V1:0,V4:3,V5:4},yf={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},It={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},o9={HALF:0,SINGLE:1,DOUBLE:2},ew={DAY:0,MILLISECOND:1},xa={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},Kp={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},h6={Sparse:0,Dense:1},gdt=Uint8Array,s9=Uint16Array,mdt=Uint32Array,a9=BigUint64Array,l9=Int8Array,ydt=Int16Array,hl=Int32Array,gc=BigInt64Array,vdt=Float32Array,D2=Float64Array;function bdt(e,t){const n=Math.log2(e)-3;return(t?[l9,ydt,hl,gc]:[gdt,s9,mdt,a9])[n]}function d6(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 c9(e,t){for(const[n,r]of Object.entries(e))if(r===t)return n;return""}const g6=e=>`Unsupported data type: "${c9(It,e)}" (id ${e})`,u9=(e,t,n=!0,r=null)=>({name:e,type:t,nullable:n,metadata:r});function f9(e){return Object.hasOwn(e,"name")&&h9(e.type)}function h9(e){return typeof e?.typeId=="number"}function Rf(e,t="",n=!0){return f9(e)?e:u9(t,p6(e,h9,()=>"Data type expected."),n)}const _dt=(e,t,n=!1,r=-1)=>({typeId:It.Dictionary,id:r,dictionary:e,indices:t||p9(),ordered:n}),d9=(e=32,t=!0)=>({typeId:It.Int,bitWidth:Qa(e,[8,16,32,64]),signed:t,values:bdt(e,t)}),p9=()=>d9(32),wdt=(e=2)=>({typeId:It.Float,precision:Qa(e,o9),values:[s9,vdt,D2][e]}),xdt=()=>({typeId:It.Binary,offsets:hl}),Sdt=()=>({typeId:It.Utf8,offsets:hl}),Edt=(e,t,n=128)=>({typeId:It.Decimal,precision:e,scale:t,bitWidth:Qa(n,[32,64,128,256]),values:n===32?hl:a9}),Tdt=e=>({typeId:It.Date,unit:Qa(e,ew),values:e===ew.DAY?hl:gc}),kdt=(e=xa.MILLISECOND,t=32)=>({typeId:It.Time,unit:Qa(e,xa),bitWidth:Qa(t,[32,64]),values:t===32?hl:gc}),Mdt=(e=xa.MILLISECOND,t=null)=>({typeId:It.Timestamp,unit:Qa(e,xa),timezone:t,values:gc}),Cdt=(e=Kp.MONTH_DAY_NANO)=>({typeId:It.Interval,unit:Qa(e,Kp),values:e===Kp.MONTH_DAY_NANO?void 0:hl}),Adt=e=>({typeId:It.List,children:[Rf(e)],offsets:hl}),Rdt=e=>({typeId:It.Struct,children:Array.isArray(e)&&f9(e[0])?e:Object.entries(e).map(([t,n])=>u9(t,n))}),Ndt=(e,t,n,r)=>(n??=t.map((i,o)=>o),{typeId:It.Union,mode:Qa(e,h6),typeIds:n,typeMap:n.reduce((i,o,s)=>(i[o]=s,i),{}),children:t.map((i,o)=>Rf(i,`_${o}`)),typeIdForValue:r,offsets:hl}),Idt=e=>({typeId:It.FixedSizeBinary,stride:e}),Odt=(e,t)=>({typeId:It.FixedSizeList,stride:t,children:[Rf(e)]}),Ddt=(e,t)=>({typeId:It.Map,keysSorted:e,children:[t],offsets:hl}),Ldt=(e=xa.MILLISECOND)=>({typeId:It.Duration,unit:Qa(e,xa),values:gc}),Fdt=()=>({typeId:It.LargeBinary,offsets:gc}),$dt=()=>({typeId:It.LargeUtf8,offsets:gc}),Bdt=e=>({typeId:It.LargeList,children:[Rf(e)],offsets:gc}),Pdt=(e,t)=>({typeId:It.RunEndEncoded,children:[p6(Rf(e,"run_ends"),n=>n.type.typeId===It.Int,()=>"Run-ends must have an integer type."),Rf(t,"values")]}),Udt=e=>({typeId:It.ListView,children:[Rf(e,"value")],offsets:hl}),zdt=e=>({typeId:It.LargeListView,children:[Rf(e,"value")],offsets:gc}),qdt=new D2(2),jdt=qdt.buffer;new gc(jdt);function Nf(e){if(e>Number.MAX_SAFE_INTEGER||eBigInt.asUintN(64,e);function Vdt(e,t){return BigInt.asIntN(64,e[t])}function Wdt(e,t){const n=t<<1;let r;return BigInt.asIntN(64,e[n+1])<0?(r=Up(~e[n])|Up(~e[n+1])<<64n,r=-(r+1n)):r=e[n]|e[n+1]<<64n,r}function Ydt(e,t){const n=t<<2;let r;return BigInt.asIntN(64,e[n+3])<0?(r=Up(~e[n])|Up(~e[n+1])<<64n|Up(~e[n+2])<<128n|Up(~e[n+3])<<192n,r=-(r+1n)):r=e[n]|e[n+1]<<64n|e[n+2]<<128n|e[n+3]<<192n,r}const Hdt=new TextDecoder("utf-8");new TextEncoder;function L2(e){return Hdt.decode(e)}const my=4;function g9(e,t){return(e[t>>3]&1<{if(o>24}function y6(e,t){return e[t]}function ia(e,t){return Xdt(e,t)<<16>>16}function Xdt(e,t){return e[t]|e[t+1]<<8}function Nr(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function C7(e,t){return Nr(e,t)>>>0}function la(e,t){return Nf(BigInt.asIntN(64,BigInt(C7(e,t))+(BigInt(C7(e,t+my))<<32n)))}function nw(e,t){let n=t+Nr(e,t);const r=Nr(e,n);return n+=my,L2(e.subarray(n,n+r))}function kf(e,t,n,r){if(!t)return[];const i=t+Nr(e,t);return Array.from({length:Nr(e,i)},(o,s)=>r(e,i+my+s*n))}const nT=Symbol("rowIndex");function p4(e,t){class n{constructor(o){this[nT]=o}toJSON(){return y9(e,t,this[nT])}}const r=n.prototype;for(let i=0;inew n(i)}function m9(e,t){return n=>y9(e,t,n)}function y9(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 g9(this.validity,t)}value(t){return this.values[t]}slice(t,n){const r=n-t,i=Array(r);for(let o=0;o>10,i=(n&1023)/1024,o=(-1)**((n&32768)>>15);switch(r){case 31:return o*(i?Number.NaN:1/0);case 0:return o*(i?6103515625e-14*i:0)}return o*2**(r-15)*(1+i)}}class Qdt extends ii{value(t){return g9(this.values,t)}}class tpt extends $2{constructor(t){super(t);const{scale:n}=this.type;this.scale=10**n}value(t){return this.values[t]/this.scale}}class v9 extends F2{constructor(t){super(t);const{bitWidth:n,scale:r}=this.type;this.decimal=n===64?Vdt:n===128?Wdt:Ydt,this.scale=10n**BigInt(r)}}class ept extends v9{static ArrayType=D2;value(t){return m6(this.decimal(this.values,t),this.scale)}}class npt extends v9{static ArrayType=Array;value(t){return this.decimal(this.values,t)}}class A7 extends ii{constructor(t){super(t),this.source=t}value(t){return new Date(this.source.value(t))}}class rpt extends $2{value(t){return 864e5*this.values[t]}}const ipt=ng;class opt extends ng{value(t){return super.value(t)*1e3}}const spt=ng;class apt extends ng{value(t){return m6(this.values[t],1000n)}}class lpt extends ng{value(t){return m6(this.values[t],1000000n)}}class cpt extends ii{value(t){return this.values.subarray(t<<1,t+1<<1)}}class upt extends ii{value(t){const n=this.values,r=t<<4;return Float64Array.of(Nr(n,r),Nr(n,r+4),la(n,r+8))}}const b9=({values:e,offsets:t},n)=>e.subarray(t[n],t[n+1]),_9=({values:e,offsets:t},n)=>e.subarray(Nf(t[n]),Nf(t[n+1]));class fpt extends ii{value(t){return b9(this,t)}}class hpt extends ii{value(t){return _9(this,t)}}class dpt extends ii{value(t){return L2(b9(this,t))}}class ppt extends ii{value(t){return L2(_9(this,t))}}class gpt extends ii{value(t){const n=this.offsets;return this.children[0].slice(n[t],n[t+1])}}class mpt extends ii{value(t){const n=this.offsets;return this.children[0].slice(Nf(n[t]),Nf(n[t+1]))}}class ypt extends ii{value(t){const n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(n,r)}}class vpt extends ii{value(t){const n=this.offsets[t],r=n+this.sizes[t];return this.children[0].slice(Nf(n),Nf(r))}}class w9 extends ii{constructor(t){super(t),this.stride=this.type.stride}}class bpt extends w9{value(t){const{stride:n,values:r}=this;return r.subarray(t*n,(t+1)*n)}}class _pt extends w9{value(t){const{children:n,stride:r}=this;return n[0].slice(t*r,(t+1)*r)}}function x9({children:e,offsets:t},n){const[r,i]=e[0].children,o=t[n],s=t[n+1],a=[];for(let l=o;lr.name),this.factory=n(this.names,this.children)}value(t){return this.factory(t)}}class Ept extends E9{constructor(t){super(t,p4)}}class Tpt extends ii{value(t){const[{values:n},r]=this.children;return r.at(d6(n,t))}}let kpt=class extends ii{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 T9 extends ii{constructor({data:t,...n}){super(n),this.data=t}view(t){const{values:n,data:r}=this,i=t<<4;let o=i+4,s=n;const a=Nr(s,i);return a>12&&(o=Nr(s,i+12),s=r[Nr(s,i+8)]),s.subarray(o,o+a)}}class Mpt extends T9{value(t){return this.view(t)}}class Cpt extends T9{value(t){return L2(this.view(t))}}function R7(e){let t=[];return{add(n){return t.push(n),this},clear:()=>t=[],done:()=>new Apt(t,e)}}class Apt{constructor(t,n=t[0]?.type){this.type=n,this.length=t.reduce((o,s)=>o+s.length,0),this.nullCount=t.reduce((o,s)=>o+s.nullCount,0),this.data=t;const r=t.length,i=new Int32Array(r+1);if(r===1){const[o]=t;i[1]=o.length,this.at=s=>o.at(s)}else for(let o=0,s=0;o0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new s(t);return i?Npt(a,r):Ipt(a,r)}cache(){return this._cache??(this._cache=this.toArray())}}function*Rpt(e){for(let t=0;ts.name);this.schema=t,this.names=i,this.children=n,this.factory=r?p4:m9;const o=[];this.getFactory=s=>o[s]??(o[s]=this.factory(i,n.map(a=>a.data[s])))}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:o}=this,{fields:s}=o;return new k9({...o,fields:t.map((a,l)=>Dpt(s[a],n[l]))},t.map(a=>r[a]),i===p4)}select(t,n){const r=this.names,i=t.map(o=>r.indexOf(o));return this.selectAt(i,n)}toColumns(){const{children:t,names:n}=this,r={};return n.forEach((i,o)=>r[i]=t[o]?.toArray()??[]),r}toArray(){const{children:t,getFactory:n,numRows:r}=this,i=t[0]?.data??[],o=Array(r);for(let s=0,a=-1;s=i)return null;const[{offsets:o}]=n,s=d6(o,t)-1;return r(s)(t-o[s])}get(t){return this.at(t)}};function Dpt(e,t){return t!=null&&t!==e.name?{...e,name:t}:e}function Lpt(e,t={}){const{typeId:n,bitWidth:r,precision:i,unit:o}=e,{useBigInt:s,useDate:a,useDecimalInt:l,useMap:c,useProxy:u}=t;switch(n){case It.Null:return Kdt;case It.Bool:return Qdt;case It.Int:case It.Time:case It.Duration:return s||r<64?_m:ng;case It.Float:return i?_m:Zdt;case It.Date:return N7(o===ew.DAY?rpt:ipt,a&&A7);case It.Timestamp:return N7(o===xa.SECOND?opt:o===xa.MILLISECOND?spt:o===xa.MICROSECOND?apt:lpt,a&&A7);case It.Decimal:return r===32?l?_m:tpt:l?npt:ept;case It.Interval:return o===Kp.DAY_TIME?cpt:o===Kp.YEAR_MONTH?_m:upt;case It.FixedSizeBinary:return bpt;case It.Utf8:return dpt;case It.LargeUtf8:return ppt;case It.Binary:return fpt;case It.LargeBinary:return hpt;case It.BinaryView:return Mpt;case It.Utf8View:return Cpt;case It.List:return gpt;case It.LargeList:return mpt;case It.Map:return c?xpt:wpt;case It.ListView:return ypt;case It.LargeListView:return vpt;case It.FixedSizeList:return _pt;case It.Struct:return u?Ept:E9;case It.RunEndEncoded:return Tpt;case It.Dictionary:return kpt;case It.Union:return e.mode?Spt:S9}throw new Error(g6(n))}function N7(e,t){return t?class extends t{constructor(r){super(new e(r))}}:e}function Fpt(e,t){return{offset:la(e,t),metadataLength:Nr(e,t+8),bodyLength:la(e,t+16)}}function I7(e,t){return kf(e,t,24,Fpt)}function M9(e,t,n){const r=Tu(e,t);if(r(10,$h,0))throw new Error("Record batch compression not implemented");const i=n({length:la(o,s),nullCount:la(o,s+8)})),regions:kf(e,r(8,$h),16+i,(o,s)=>({offset:la(o,s+i),length:la(o,s+i+8)})),variadic:kf(e,r(12,$h),8,la)}}function $pt(e,t,n){const r=Tu(e,t);return{id:r(4,la,0),data:r(6,(i,o)=>M9(i,o,n)),isDelta:r(8,yy,!1)}}function C9(e,t,n,r){Qa(n,It,g6);const i=Tu(e,t);switch(n){case It.Binary:return xdt();case It.Utf8:return Sdt();case It.LargeBinary:return Fdt();case It.LargeUtf8:return $dt();case It.List:return Adt(r[0]);case It.ListView:return Udt(r[0]);case It.LargeList:return Bdt(r[0]);case It.LargeListView:return zdt(r[0]);case It.Struct:return Rdt(r);case It.RunEndEncoded:return Pdt(r[0],r[1]);case It.Int:return d9(i(4,Nr,0),i(6,yy,!1));case It.Float:return wdt(i(4,ia,o9.HALF));case It.Decimal:return Edt(i(4,Nr,0),i(6,Nr,0),i(8,Nr,128));case It.Date:return Tdt(i(4,ia,ew.MILLISECOND));case It.Time:return kdt(i(4,ia,xa.MILLISECOND),i(6,Nr,32));case It.Timestamp:return Mdt(i(4,ia,xa.SECOND),i(6,nw));case It.Interval:return Cdt(i(4,ia,Kp.YEAR_MONTH));case It.Duration:return Ldt(i(4,ia,xa.MILLISECOND));case It.FixedSizeBinary:return Idt(i(4,Nr,0));case It.FixedSizeList:return Odt(r[0],i(4,Nr,0));case It.Map:return Ddt(i(4,yy,!1),r[0]);case It.Union:return Ndt(i(4,ia,h6.Sparse),r,kf(e,i(6,$h),4,Nr))}return{typeId:n}}function v6(e,t){const n=kf(e,t,4,(r,i)=>{const o=Tu(r,i);return[o(4,nw),o(6,nw)]});return n.length?new Map(n):null}function A9(e,t,n){const r=Tu(e,t);return{version:n,endianness:r(4,ia,0),fields:r(6,Bpt,[]),metadata:r(8,v6)}}function Bpt(e,t){return kf(e,t,4,R9)}function R9(e,t){const n=Tu(e,t),r=n(8,y6,It.NONE),i=n(10,$h,0),o=n(12,Upt),s=n(14,(l,c)=>Ppt(l,c));let a=C9(e,i,r,s);return o&&(o.dictionary=a,a=o),{name:n(4,nw),type:a,nullable:n(6,yy,!1),metadata:n(16,v6)}}function Ppt(e,t){const n=kf(e,t,4,R9);return n.length?n:null}function Upt(e,t){if(!t)return null;const n=Tu(e,t);return _dt(null,n(6,zpt,p9()),n(8,yy,!1),n(4,la,0))}function zpt(e,t){return C9(e,t,It.Int)}const qpt=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,jpt=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Vpt=e=>`Unsupported message type: ${e} (${c9(yf,e)})`;function g4(e,t){let n=Nr(e,t)||0;if(t+=my,n===-1&&(n=Nr(e,t)||0,t+=my),n===0)return null;const r=e.subarray(t,t+=n);if(r.byteLength0){const f=e.subarray(t,t+=l);if(f.byteLengthA9(a,l,i)),dictionaries:o.map(({offset:a})=>g4(e,a).content),records:s.map(({offset:a})=>g4(e,a).content),metadata:r(12,v6)}}function Xpt(e,t){return Jpt(Wpt(e),t)}function Jpt(e,t={}){const{schema:n={fields:[]},dictionaries:r,records:i}=e,{version:o,fields:s}=n,a=new Map,l=Zpt(t,o,a),c=new Map;Kpt(n,h=>{const p=h.type;p.typeId===It.Dictionary&&c.set(p.id,p.dictionary)});const u=new Map;for(const h of r){const{id:p,data:g,isDelta:y,body:v}=h,b=c.get(p),_=m4(b,l({...g,body:v}));if(u.has(p)){const S=u.get(p);y||S.clear(),S.add(_)}else{if(y)throw new Error("Delta update can not be first dictionary batch.");u.set(p,R7(b).add(_))}}u.forEach((h,p)=>a.set(p,h.done()));const f=s.map(h=>R7(h.type));for(const h of i){const p=l(h);s.forEach((g,y)=>f[y].add(m4(g.type,p)))}return new Opt(n,f.map(h=>h.done()),t.useProxy)}function Kpt(e,t){e.fields.forEach(function n(r){t(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Zpt(e,t,n){const r={version:t,options:e,dictionary:i=>n.get(i)};return i=>{const{length:o,nodes:s,regions:a,variadic:l,body:c}=i;let u=-1,f=-1,h=-1;return{...r,length:o,node:()=>s[++u],buffer:p=>{const{length:g,offset:y}=a[++f];return p?new p(c.buffer,c.byteOffset+y,g/p.BYTES_PER_ELEMENT):c.subarray(y,y+g)},variadic:()=>l[++h],visit(p){return p.map(g=>m4(g.type,this))}}}}function m4(e,t){const{typeId:n}=e,{length:r,options:i,node:o,buffer:s,variadic:a,version:l}=t,c=Lpt(e,i);if(n===It.Null)return new c({length:r,nullCount:r,type:e});const u={...o(),type:e};switch(n){case It.Bool:case It.Int:case It.Time:case It.Duration:case It.Float:case It.Decimal:case It.Date:case It.Timestamp:case It.Interval:case It.FixedSizeBinary:return new c({...u,validity:s(),values:s(e.values)});case It.Utf8:case It.LargeUtf8:case It.Binary:case It.LargeBinary:return new c({...u,validity:s(),offsets:s(e.offsets),values:s()});case It.BinaryView:case It.Utf8View:return new c({...u,validity:s(),values:s(),data:Array.from({length:a()},()=>s())});case It.List:case It.LargeList:case It.Map:return new c({...u,validity:s(),offsets:s(e.offsets),children:t.visit(e.children)});case It.ListView:case It.LargeListView:return new c({...u,validity:s(),offsets:s(e.offsets),sizes:s(e.offsets),children:t.visit(e.children)});case It.FixedSizeList:case It.Struct:return new c({...u,validity:s(),children:t.visit(e.children)});case It.RunEndEncoded:return new c({...u,children:t.visit(e.children)});case It.Dictionary:{const{id:f,indices:h}=e;return new c({...u,validity:s(),values:s(h.values)}).setDictionary(t.dictionary(f))}case It.Union:return lthis.enqueue(t,n,r))}}const b6="COLUMN_REF",_6="COLUMN_PARAM",t0t="TABLE_REF",e0t="LITERAL",n0t="INTERVAL",I9="ORDER_BY",O9="CAST",D9="CASE",L9="WHEN",F9="UNARY",r0t="UNARY_POSTFIX",$9="BINARY",B9="BETWEEN",P9="NOT_BETWEEN",U9="LOGICAL_OPERATOR",z9="IN",q9="FUNCTION",B2="AGGREGATE",w6="WINDOW",j9="WINDOW_DEF",V9="WINDOW_FRAME",i0t="EXPRESSION",x6="FRAGMENT",W9="VERBATIM",S6="PARAM",o0t="WITH_CLAUSE",Y9="SELECT_CLAUSE",H9="FROM_CLAUSE",s0t="SAMPLE_CLAUSE",G9="WINDOW_CLAUSE",X9="SELECT_QUERY",J9="DESCRIBE_QUERY",K9="SET_OPERATION";function mu(e){return e instanceof dl}class dl{constructor(t){this.type=t}}class oi extends dl{}let Z9=class extends oi{constructor(t){super(e0t),this.value=t}toString(){return Q9(this.value)}};function Q9(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 P2=class extends oi{constructor(t){super(S6),this.param=t}get value(){return this.param.value}toString(){return Q9(this.value)}};class tP extends oi{constructor(t,n=[]){super(q9),this.name=t,this.args=n}toString(){const{name:t,args:n}=this;return`${t}(${n.join(", ")})`}}function wr(e,...t){return new tP(e,U2(t).map(rr))}function bn(e,...t){return new ow(e,U2(t).map(rr))}function pl(e,...t){return new ff(new c0t(e,U2(t).map(rr)))}function Ul(e,t=rr){return e.flat().filter(n=>n!=null).map(n=>t(n))}function U2(e){const t=e.length;let n=t;for(;n>0&&e[n-1]===void 0;--n);return na);return o&&s.length<2?o:`(${s.join(" ")})`}}class O7 extends dl{constructor(t,n=!1,r=void 0){super(V9),this.extent=yv(t)?new P2(t):t,this.range=n,this.exclude=r}toString(){const{range:t,exclude:n,extent:r}=this,i=t?"RANGE":"ROWS",[o,s]=mu(r)?r.value:r,a=D7(o,"PRECEDING"),l=D7(s,"FOLLOWING");return`${i} BETWEEN ${a} AND ${l}${n?` ${n}`:""}`}}function Kg(e,t){return new E6(t.name??e.name,t.partition??e.partition,t.order??e.order,t.frame??e.frame)}function D7(e,t){return e===0?"CURRENT ROW":Number.isFinite(e)?`${Math.abs(e)} ${t}`:`UNBOUNDED ${t}`}function z2(e){return e instanceof q2}class q2 extends oi{constructor(t,n){super(t),this.table=n}get column(){return null}toString(){const{column:t,table:n}=this,r=`${n??""}`,i=t==="*"?"*":rg(t);return(r?r+".":"")+i}}class nP extends q2{constructor(t,n){super(b6,n),this.name=t}get column(){return this.name}}function u0t(e){return e instanceof rP}class rP extends q2{constructor(t,n){super(_6,n),this.param=t}get column(){return`${this.param.value}`}}function kt(e,t){const n=k6(t);return yv(e)?new rP(new P2(e),n):new nP(e,n)}class iP extends oi{constructor(t){super(W9),this.value=t}toString(){return this.value}}function ne(e){return new Z9(e)}function f0t(e){return new iP(e)}function iw(e){return e instanceof oP}class oP extends oi{constructor(t){super(t0t),this.table=[t].flat()}get name(){return this.table[this.table.length-1]}toString(){return this.table.map(t=>rg(t)).join(".")}}function T6(...e){const t=Ul(e,String);return t?.length?new oP(t):void 0}function rr(e){return If(e)?h0t(e):j2(e)}function Wm(e){return If(e)?f0t(e):j2(e)}function j2(e){return e instanceof oi?e:yv(e)?new P2(e):ne(e)}function k6(e){return If(e)?d0t(e):y4(e)?T6(e):e}function h0t(e){const t=eP(e);return kt(t.pop(),T6(t))}function d0t(e){return T6(eP(e))}function p0t(){return new E6}class ow extends oi{constructor(t,n,r,i){super(B2),this.name=t,this.args=n,this.isDistinct=r,this.filter=i}distinct(t=!0){return new ow(this.name,this.args,t,this.filter)}where(t){return If(t)&&(t=Wm(t)),new ow(this.name,this.args,this.isDistinct,t)}window(){return new ff(this)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}toString(){const{name:t,args:n,isDistinct:r,filter:i}=this,o=r?"DISTINCT ":"",s=n?.length?n.join(", "):"*",a=i?` FILTER (WHERE ${i})`:"";return`${t}(${o}${s})${a}`}}const g0t=["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","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 sP extends oi{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 aP extends sP{constructor(t,n){super(B9,t,n)}toString(){return super.toSQL("BETWEEN")}}class m0t extends sP{constructor(t,n){super(P9,t,n)}toString(){return super.toSQL("NOT BETWEEN")}}class y0t extends oi{constructor(t,n,r){super($9),this.op=t,this.left=n,this.right=r}toString(){return`(${this.left} ${this.op} ${this.right})`}}class vy extends oi{constructor(t=void 0,n=[],r=void 0){super(D9),this.expr=t,this._when=n,this._else=r}when(t,n){return new vy(this.expr,this._when.concat(new lP(rr(t),rr(n))),this._else)}else(t){return new vy(this.expr,this._when,rr(t))}toString(){return"CASE "+(this.expr?`${this.expr} `:"")+this._when.join(" ")+(this._else?` ELSE ${this._else}`:"")+" END"}}class lP extends dl{constructor(t,n){super(L9),this.when=t,this.then=n}toString(){return`WHEN ${this.when} THEN ${this.then}`}}class v0t extends oi{constructor(t,n){super(O9),this.expr=t,this.cast=n}toString(){return`(${this.expr})::${this.cast}`}}class b0t extends oi{constructor(t){super(x6),this.spans=t}toString(){return this.spans.join("")}}class _0t extends dl{constructor(t,n=!1,r=void 0,i=void 0){super(s0t),this.size=t,this.perc=n,this.method=r,this.seed=i}toString(){const{size:t,perc:n,method:r,seed:i}=this,o=n?"%":" ROWS",s=i!=null?`, ${i}`:"";return`${t}${o}${r?` (${r}${s})`:""}`}}class w0t extends dl{constructor(t,n){super(Y9),this.expr=t,this.alias=n}toString(){const{expr:t,alias:n}=this;return!n||x0t(t,n)?`${t}`:`${t} AS ${rg(n)}`}}function x0t(e,t){return e instanceof q2&&e.table==null&&e.column===t}class v4 extends dl{constructor(t,n,r=void 0){super(o0t),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 M6(e){return e instanceof qt}function V2(e){return e instanceof y0}function S0t(e){return e instanceof W2}class qt extends oi{static with(...t){return new E0t(...t)}static select(...t){return new y0().select(...t)}static from(...t){return new y0().from(...t)}static union(...t){return new zp("UNION",t.flat())}static unionAll(...t){return new zp("UNION ALL",t.flat())}static intersect(...t){return new zp("INTERSECT",t.flat())}static except(...t){return new zp("EXCEPT",t.flat())}static describe(t){return new W2(t)}constructor(t){super(t),this._with=[],this._orderby=[],this._limit=void 0,this._offset=void 0,this.cteFor=null}get subqueries(){return[]}clone(){return this}with(...t){const n=[],r=(i,o)=>{const s=o.clone();s.cteFor=this,n.push(new v4(i,s))};return t.flat().forEach(i=>{if(i instanceof v4)n.push(i);else if(i!=null)for(const o in i)r(o,i[o])}),this._with=this._with.concat(n),this}orderby(...t){return this._orderby=this._orderby.concat(Ul(t)),this}limit(t){return this._limit=Number.isFinite(t)?t:void 0,this}offset(t){return this._offset=Number.isFinite(t)?t:void 0,this}}class y0 extends qt{constructor(){super(X9),this._select=[],this._from=[],this._where=[],this._sample=void 0,this._groupby=[],this._having=[],this._window=[],this._qualify=[]}get subqueries(){const t=this.cteFor||this,r=(t instanceof y0?t._with:[]).reduce((o,s)=>(o[s.name]=s.query,o),{}),i=[];return this._from.forEach(({expr:o})=>{if(M6(o))i.push(o);else if(iw(o)){const s=r[o.name];s&&i.push(s)}}),i}clone(){return Object.assign(new y0,this)}select(...t){const n=[],r=(o,s)=>n.push(new w0t(o==null?o:rr(o),rT(s)));t.flat().forEach(o=>{if(o!=null)if(If(o))r(o,o);else if(z2(o))r(o,o.column);else if(y4(o))r(o[1],o[0]);else for(const s in o)r(o[s],s)});const i=new Set(n.map(o=>o.alias));return this._select=this._select.filter(o=>!i.has(o.alias)).concat(n.filter(o=>o.expr)),this}setSelect(...t){return this._select=[],this.select(...t)}distinct(t=!0){return this._distinct=!!t,this}from(...t){const n=[],r=(i,o)=>n.push(new T0t(k6(i),rT(o)));return t.flat().forEach(i=>{if(i!=null)if(If(i))r(i,i);else if(iw(i))r(i,i.name);else if(mu(i))r(i);else if(y4(i))r(i[1],i[0]);else for(const o in i)r(i[o],o)}),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 o=t>0&&t<1,s=o?t*100:Math.floor(t);i=new _0t(s,o,n,r)}else i=t;return this._sample=i,this}where(...t){return this._where=this._where.concat(Ul(t,Wm)),this}setWhere(...t){return this._where=[],this.where(...t)}groupby(...t){return this._groupby=this._groupby.concat(Ul(t)),this}setGroupby(...t){return this._groupby=[],this.groupby(...t)}having(...t){return this._having=this._having.concat(Ul(t,Wm)),this}window(...t){const n=[];return t.flat().forEach(r=>{if(r!=null)for(const i in r)n.push(new l0t(rT(i),r[i]))}),this._window=this._window.concat(n),this}qualify(...t){return this._qualify=this._qualify.concat(Ul(t,Wm)),this}toString(){const{_with:t,_select:n,_distinct:r,_from:i,_sample:o,_where:s,_groupby:a,_having:l,_window:c,_qualify:u,_orderby:f,_limit:h,_offset:p}=this,g=[];if(t.length&&g.push(`WITH ${t.join(", ")}`),g.push(`SELECT${r?" DISTINCT":""} ${n.join(", ")}`),i.length&&g.push(`FROM ${i.join(", ")}`),s.length){const y=s.map(String).filter(v=>v).join(" AND ");y&&g.push(`WHERE ${y}`)}if(o&&g.push(`USING SAMPLE ${o}`),a.length&&g.push(`GROUP BY ${a.join(", ")}`),l.length){const y=l.map(String).filter(v=>v).join(" AND ");y&&g.push(`HAVING ${y}`)}if(c.length&&g.push(`WINDOW ${c.join(", ")}`),u.length){const y=u.map(String).filter(v=>v).join(" AND ");y&&g.push(`QUALIFY ${y}`)}return f.length&&g.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(h)&&g.push(`LIMIT ${h}`),Number.isFinite(p)&&g.push(`OFFSET ${p}`),g.join(" ")}}class W2 extends dl{constructor(t){super(J9),this.query=t}clone(){return new W2(this.query.clone())}toString(){return`DESCRIBE ${this.query}`}}class zp extends qt{constructor(t,n){super(K9),this.op=t,this.queries=n}get subqueries(){const{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}clone(){const{op:t,queries:n,...r}=this;return Object.assign(new zp(t,n),r)}toString(){const{op:t,queries:n,_with:r,_orderby:i,_limit:o,_offset:s}=this,a=[];return r.length&&a.push(`WITH ${r.join(", ")}`),a.push(n.join(` ${t} `)),i.length&&a.push(`ORDER BY ${i.join(", ")}`),Number.isFinite(o)&&a.push(`LIMIT ${o}`),Number.isFinite(s)&&a.push(`OFFSET ${s}`),a.join(" ")}}class E0t{constructor(...t){this._with=t}select(...t){return qt.select(...t).with(...this._with)}from(...t){return qt.from(...t).with(...this._with)}union(...t){return qt.union(...t).with(...this._with)}unionAll(...t){return qt.unionAll(...t).with(...this._with)}intersect(...t){return qt.intersect(...t).with(...this._with)}except(...t){return qt.except(...t).with(...this._with)}}class T0t extends dl{constructor(t,n){super(H9),this.expr=t,this.alias=n}toString(){const{expr:t,alias:n}=this,r=M6(t)?`(${t})`:`${t}`;return n&&!(iw(t)&&t.table.join(".")===n)?`${r} AS ${rg(n)}`:`${r}`}}class k0t extends oi{constructor(t,n){super(z9),this.expr=t,this.values=n}toString(){return`(${this.expr} IN (${this.values.join(", ")}))`}}class M0t extends oi{constructor(t,n=1){super(n0t),this.name=t,this.steps=n}toString(){return`INTERVAL ${this.steps} ${this.name}`}}class cP extends oi{constructor(t,n){super(U9),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 C0t extends cP{constructor(t){super("AND",t)}}class A0t extends cP{constructor(t){super("OR",t)}}class uP extends oi{constructor(t,n,r){super(I9),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 fP extends oi{constructor(t,n,r){super(t),this.op=n,this.expr=r}}class R0t extends fP{constructor(t,n){super(F9,t,n)}toString(){return`(${this.op} ${this.expr})`}}class N0t extends fP{constructor(t,n){super(r0t,t,n)}toString(){return`(${this.expr} ${this.op})`}}function sw(e,t){return bn("arg_max",e,t)}function aw(e,t){return bn("arg_min",e,t)}function I0t(e){return bn("array_agg",e)}function Y2(e){return bn("avg",e)}function O0t(e,t){return bn("corr",e,t)}function er(e){return bn("count",e)}function D0t(e,t){return bn("covar_samp",e,t)}function L0t(e,t){return bn("covar_pop",e,t)}function F0t(e){return bn("entropy",e)}function $0t(e){return bn("first",e)}function B0t(e){return bn("geomean",e)}function P0t(e){return bn("kurtosis",e)}function U0t(e){return bn("mad",e)}function Ma(e){return bn("max",e)}function H2(e){return bn("median",e)}function tl(e){return bn("min",e)}function z0t(e){return bn("mode",e)}function q0t(e){return bn("last",e)}function j0t(e){return bn("product",e)}function b4(e,t){return bn("quantile",e,t)}function hP(e,t){return bn("regr_avgx",e,t)}function V0t(e,t){return bn("regr_avgy",e,t)}function dP(e,t){return bn("regr_count",e,t)}function W0t(e,t){return bn("regr_intercept",e,t)}function Y0t(e,t){return bn("regr_sxx",e,t)}function H0t(e,t){return bn("regr_syy",e,t)}function G0t(e,t){return bn("regr_slope",e,t)}function X0t(e){return bn("skewness",e)}function pP(e){return bn("stddev",e)}function J0t(e){return bn("stddev_pop",e)}function K0t(e){return bn("string_agg",e)}function Tr(e){return bn("sum",e)}function Z0t(e){return bn("var_samp",e)}function Q0t(e){return bn("var_pop",e)}function Xo(e,t,n){return e?new vy(void 0,[new lP(rr(e),rr(t))],rr(n)):new vy}function Jr(e,t){return new v0t(rr(e),t)}function bi(e){return Jr(e,"INTEGER")}function tgt(e){return Jr(e,"FLOAT")}function vo(e){return Jr(e,"DOUBLE")}function egt(e,t,n){return new v4(e,t,n)}function gP(e,t){return new M0t(e,t)}function ngt(e){return wr("epoch_ms",e)}function rgt(e,t,n=1){return wr("time_bucket",gP(t,n),e)}function igt(e){return wr("make_date",2012,wr("month",e),1)}function ogt(e){const t=rr(e);return wr("make_date",2012,wr("month",t),wr("day",t))}function sgt(e){return wr("make_date",2012,1,wr("day",e))}function Mf(e){return wr("isfinite",e)}function agt(...e){return wr("greatest",...e)}function C6(e){return wr("exp",e)}function mP(e){return wr("log",e)}function Zp(e){return wr("ln",e)}function yu(e){return wr("sign",e)}function po(e){return wr("abs",e)}function by(e){return wr("sqrt",e)}function lgt(e){return wr("ceil",e)}function Ls(e){return wr("floor",e)}function _y(e,t){return wr("round",e,t)}function cgt(e,t){return new R0t(e,rr(t))}function yP(e,t){return new N0t(e,rr(t))}function Fo(e,t,n){return new y0t(e,rr(t),rr(n))}function vP(e,t,n=!1){const r=n?m0t:aP;return new r(rr(e),t?.map(rr))}function Ci(...e){return new C0t(Ul(e))}function Eo(...e){return new A0t(Ul(e))}function v0(e){return cgt("NOT",e)}function Ga(e){return yP("IS NULL",e)}function ec(e){return yP("IS NOT NULL",e)}function iT(e,t){return Fo("&",e,t)}function Hn(e,t){return Fo("+",e,t)}function Ue(e,t){return Fo("-",e,t)}function ze(e,t){return Fo("*",e,t)}function ur(e,t){return Fo("/",e,t)}function ugt(e,t){return Fo("%",e,t)}function Ji(e,t){return Fo("**",e,t)}function Ss(e,t){return Fo("=",e,t)}function vv(e,t){return Fo("<>",e,t)}function fi(e,t){return Fo("<",e,t)}function fa(e,t){return Fo(">",e,t)}function Yl(e,t){return Fo("<=",e,t)}function fgt(e,t){return Fo(">=",e,t)}function hgt(e,t){return Fo("IS DISTINCT FROM",e,t)}function A6(e,t){return Fo("IS NOT DISTINCT FROM",e,t)}function To(e,t){return vP(e,t,!1)}function dgt(e,t){return vP(e,t,!0)}function fd(e,t){return new k0t(rr(e),t.map(rr))}function pgt(e,t){return new uP(rr(e),!1,t)}function ig(e,t){return new uP(rr(e),!0,t)}function bP(e){return wr("st_asgeojson",e)}function ggt(e){return wr("st_x",e)}function mgt(e){return wr("st_y",e)}function R6(e){return wr("st_centroid",e)}function ygt(e){return ggt(R6(e))}function vgt(e){return mgt(R6(e))}function ee(e,...t){return new b0t(bgt(e,t))}function bgt(e,t){const n=[e[0]],r=t.length;for(let i=0,o=0;ii).map(i=>If(i)?new iP(i):i)}function G2(e,t,...n){return wr(e,t,...U2(n).map(j2))}function _gt(e,t,n){return G2("regexp_matches",e,t,n)}function wgt(e,t){return G2("contains",e,t)}function xgt(e,t){return G2("starts_with",e,t)}function Sgt(e,t){return G2("ends_with",e,t)}function _P(...e){return wr("coalesce",...e)}function wP(){return pl("row_number")}function Egt(){return pl("rank")}function Tgt(){return pl("dense_rank")}function kgt(){return pl("percent_rank")}function Mgt(){return pl("cume_dist")}function Cgt(e){return pl("ntile",e)}function Agt(e,t,n){return pl("lag",e,t,n)}function _4(e,t,n){return pl("lead",e,t,n)}function Rgt(e){return pl("first_value",e)}function Ngt(e){return pl("last_value",e)}function Igt(e,t){return pl("nth_value",e,t)}const xP={[B2]:["args","filter"],[B9]:["expr","extent"],[$9]:["left","right"],[D9]:["expr","_when","_else"],[O9]:["expr"],[_6]:["param","table"],[b6]:["table"],[J9]:["query"],[i0t]:["node"],[x6]:["spans"],[H9]:["expr"],[q9]:["args"],[z9]:["expr","values"],[U9]:["clauses"],[P9]:["expr","extent"],[I9]:["expr"],[S6]:["value"],[Y9]:["expr"],[X9]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[K9]:["subqueries","_orderby"],[F9]:["expr"],[L9]:["when","then"],[w6]:["func","def"],[G9]:["def"],[j9]:["partition","order","frame"],[V9]:["extent"]};function w4(e,t){if(t.has(e))return t.get(e);if(mu(e)){const n=xP[e.type],r=n?.length??0;if(r>0){e=Ogt(e);for(let i=0;it.endsWith("(")&&Dgt.test(t.slice(0,-1)))}function Qf(e){let t=0;return hd(e,n=>{switch(n.type){case w6:return-1;case B2:return t|=1,-1;case x6:case W9:{let r=`${n}`.toLowerCase();const i=r.indexOf("(select ");return i>=0&&(r=r.slice(0,i)),r.includes(") over ")?-1:Fgt(r)?(t|=2,-1):1}}}),t}function $gt(e){const t=new Set;return hd(e,n=>{n.type===B2&&t.add(n)}),Array.from(t)}function N6(e){const t={};return hd(e,n=>{(n.type===b6||n.type===_6)&&(t[n]=n)}),Object.values(t)}function Bgt(e){const t=new Set;return hd(e,n=>{n.type===S6&&t.add(n.param)}),Array.from(t)}function bv(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 Pgt(e,{strict:t=!1}={}){return"CREATE SCHEMA "+(t?"":"IF NOT EXISTS ")+e}function SP(e){return`INSTALL ${e}; LOAD ${e}`}function Ugt(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,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 o=n.map(s=>`${j2(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function X2(e,t,n,r={},i={}){const{select:o=["*"],where:s,view:a,temp:l,replace:c,...u}=r,f=Ygt({...i,...u}),h=`${e}('${n}'${f?", "+f:""})`,p=s?` WHERE ${s}`:"",g=`SELECT ${o.join(", ")} FROM ${h}${p}`;return bv(t,g,{view:a,temp:l,replace:c})}function zgt(e,t,n){return X2("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function qgt(e,t,n){return X2("read_json",e,t,n,{auto_detect:!0,format:"auto"})}function jgt(e,t,n){return X2("read_parquet",e,t,n)}function Vgt(e,t,n={}){const{options:r,...i}=n;if(r){const o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");Object.assign(i,{open_options:o.toUpperCase()})}return X2("st_read",e,t,i)}function Wgt(e,t,n={}){const{select:r=["*"],...i}=n,o=Ugt(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return bv(e,s,i)}function Ygt(e){return Object.entries(e).map(([t,n])=>`${t}=${x4(n)}`).join(", ")}function x4(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=>x4(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${x4(n)}`).join(", ")+"}";default:return e}}function Hgt(e,t,n,r,i){const o=i?Ue(n,vo(e)):Ue(vo(e),t),s=n===t?0:r/(n-t);return s?ze(o,vo(s)):o}function Ggt(e,t,n,r,i,o){return e.select({index:Hn(bi(Ls(t)),ze(bi(Ls(n)),i)),...r}).groupby("index",o)}function Xgt(e,t,n){let{step:r,steps:i=25,minstep:o=0,nice:s=!0,base:a}=n;if(s!==!1){const l=t-e,c=a?Math.log(a):Math.LN10;r=r||S4(l,i,o,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;)s*=10;const a=[5,2];for(let l=0,c=a.length;l=n&&e/i<=t&&(s=i);return s}const EP="year",L7="month",F7="day",ub="hour",fb="minute",hb="second",Jgt="millisecond",Kgt="microsecond",wm=1e3,xm=wm*60,Sm=xm*60,J2=Sm*24,Zgt=J2*7,$7=J2*30,TP=J2*365,Zg=[{unit:hb,step:1,dt:wm},{unit:hb,step:5,dt:wm*5},{unit:hb,step:15,dt:wm*15},{unit:hb,step:30,dt:wm*30},{unit:fb,step:1,dt:xm},{unit:fb,step:5,dt:xm*5},{unit:fb,step:15,dt:xm*15},{unit:fb,step:30,dt:xm*30},{unit:ub,step:1,dt:Sm},{unit:ub,step:3,dt:Sm*3},{unit:ub,step:6,dt:Sm*6},{unit:ub,step:12,dt:Sm*12},{unit:F7,step:1,dt:J2},{unit:F7,step:7,dt:Zgt},{unit:L7,step:1,dt:$7},{unit:L7,step:3,dt:$7*3},{unit:EP,step:1,dt:TP}];function Qgt(e,t,n){const r=+t-+e,i=r/n,o=tmt(Zg,i,l=>l.dt);let s,a;return o===Zg.length?(s=EP,a=S4(r/TP,n)):o?{unit:s,step:a}=Zg[i/Zg[o-1].dt=1?Jgt:Kgt,a=a>=1?a:a*1e3),{unit:s,step:a}}function tmt(e,t,n){const r=(a,l)=>a-l,i=(a,l)=>r(n(a),l);let o=0,s=e.length;if(o>>1;i(e[a],t)<=0?o=a+1:s=a}while(oe;function B7(){return{apply:f_,invert:f_,sqlApply:rr,sqlInvert:f_}}function nmt({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>Zp(t),sqlInvert:t=>C6(t)};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>mP(t),sqlInvert:t=>Ji(10,t)};{const t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>ur(Zp(n),Zp(t)),sqlInvert:n=>Ji(t,n)}}}function rmt({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=rr(n),ze(yu(n),Zp(Hn(t,po(n))))),sqlInvert:n=>ze(yu(n),Ue(C6(po(n)),t))}}function imt(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=rr(e),ze(yu(e),by(po(e)))),sqlInvert:e=>ze(yu(e),Ji(e,2))}}function omt({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=rr(n),ze(yu(n),Ji(po(n),t))),sqlInvert:n=>ze(yu(n),Ji(po(n),ur(1,t)))}}function P7(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?ne(+e):amt(e)?ne(+e.value):ngt(e),sqlInvert:f_}}const smt={identity:B7,linear:B7,log:nmt,symlog:rmt,sqrt:imt,pow:omt,time:P7,utc:P7};function I6(e){const t=smt[e.type];return t?{...e,...t(e)}:null}function amt(e){return e instanceof Z9&&e.value instanceof Date}function lmt(e,t,n={},r=I6({type:"linear"})){const[i,o]=t,{offset:s=0}=n,{apply:a,sqlApply:l,sqlInvert:c}=r,u=Xgt(a(i),a(o),n),f=l(e),h=(u.max-u.min)/u.steps;let p=u.min===0?f:Ue(f,u.min);return h!==1&&(p=ur(p,vo(h))),p=Ls(s?Hn(s,p):p),h!==1&&(p=ze(h,p)),u.min!==0&&(p=Hn(u.min,p)),c(p)}function cmt(e,t,n=void 0,r=[]){const i=n?a=>ze(a,n):a=>a,o=Ls(t),s=Hn(o,1);return qt.from(qt.unionAll(e.clone().select({i:bi(o),w:i(Ue(s,t))}),e.clone().select({i:bi(s),w:i(Ue(t,o))}))).select({index:"i",density:Tr("w")},r).groupby("index",r).having(vv("density",0))}function umt(e){return e}function fmt(e,t,n,r,i,o=[]){const s=r?b=>ze(b,r):umt,a=(b,_)=>e.clone().select({xp:t,yp:n,i:b,w:_}),l=(b,_)=>Hn(b,ze(_,i)),c=bi(Ls(t)),u=bi(Ls(n)),f=Hn(c,1),h=Hn(u,1),p=Ue(t,c),g=Ue(f,t),y=Ue(n,u),v=Ue(h,n);return qt.from(qt.unionAll(a(l(c,u),s(ze(g,v))),a(l(c,h),s(ze(g,y))),a(l(f,u),s(ze(p,v))),a(l(f,h),s(ze(p,y))))).select({index:"i",density:Tr("w")},o).groupby("index",o).having(vv("density",0))}function hmt(e,t,n,r,i,o,s=[],a=!0){e.select({x:bi(Ls(t)),y:bi(Ls(n))});const l=s.concat(r),c=qt.from(e).select(l,{x0:"x",y0:"y",dx:Ue(_4("x").over("sw"),"x"),dy:Ue(_4("y").over("sw"),"y")}).window({sw:p0t().partitionby(l).orderby(pgt("x"))}).qualify([Eo(fi("x0",i),fi(Hn("x0","dx"),i)),Eo(fi("y0",o),fi(Hn("y0","dy"),o)),Eo(fa("x0",0),fa(Hn("x0","dx"),0)),Eo(fa("y0",0),fa(Hn("y0","dy"),0))]),u=qt.select({x:agt(Ma(po("dx")),Ma(po("dy")))}).from("pairs"),f=qt.select({i:bi(ee`UNNEST(range((${u})))`)}),h=qt.unionAll(qt.select(l,{x:Hn("x0","i"),y:Hn("y0",bi(_y(ur(ze("i","dy"),"dx"))))}).from("pairs","indices").where([Yl(po("dy"),po("dx")),fi("i",po("dx"))]),qt.select(l,{x:Hn("x0",bi(_y(ur(ze(ze(yu("dy"),"i"),"dx"),"dy")))),y:Hn("y0",ze(yu("dy"),"i"))}).from("pairs","indices").where([fa(po("dy"),po("dx")),fi("i",po("dy"))]),qt.select(l,{x:"x0",y:"y0"}).from("pairs").where(Ga("dx"))),p=qt.from("raster").select(l,"x","y",a?{w:ur(1,er().partitionby(["x"].concat(l)))}:null).where([Yl(0,"x"),fi("x",i),Yl(0,"y"),fi("y",o)]);return qt.with({pairs:c,indices:f,raster:h,points:p}).from("points").select(s,{index:Hn("x",ze("y",bi(i))),density:a?Tr("w"):er()}).groupby("index",s)}function dmt(e,t,n,r,i=[]){const o=bi(Ls(t)),s=M6(e),a=s?"input":e,l=s?qt.with(egt(a,e,!0)):qt,c=u=>qt.from(a).select(u).groupby(o,i);return l.union(c([{[n]:tl(n),[r]:aw(r,n)},...i]),c([{[n]:Ma(n),[r]:sw(r,n)},...i]),c([{[n]:aw(n,r),[r]:tl(r)},...i]),c([{[n]:sw(n,r),[r]:Ma(r)},...i])).orderby(i,n)}function kP(e){let t=2166136261;for(let n=0,r=e.length;n>8)),t=U7(t^i&255)}return pmt(t)>>>0}function U7(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function pmt(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}function gmt(e,t,n){switch(e.name){case"count":return mmt(t,e);case"sum":return CP(t,e);case"avg":return ymt(t,e);case"geomean":return vmt(t,e);case"arg_max":return bmt(t,e);case"arg_min":return _mt(t,e);case"variance":case"var_samp":return db(t,e,n);case"var_pop":return db(t,e,n,!1);case"stddev":case"stddev_samp":return by(db(t,e,n));case"stddev_pop":return by(db(t,e,n,!1));case"covar_samp":return h_(t,e,n);case"covar_pop":return h_(t,e,n,!1);case"corr":return z7(t,e,n);case"regr_count":return og(t,e).expr;case"regr_avgx":return RP(t,e);case"regr_avgy":return NP(t,e);case"regr_syy":return T4(t,0,e,n);case"regr_sxx":return T4(t,1,e,n);case"regr_sxy":return h_(t,e,n,null);case"regr_slope":return IP(t,e,n);case"regr_intercept":return wmt(t,e,n);case"regr_r2":return Ji(z7(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=MP(e);return t[r]=e,ee`${e.name}("${r}")`}default:return null}}function MP(e){return"pre_"+kP(`${e}`).toString(16)}function to(e,t,n){const r=n?.filter;r&&(t=t.filter?t.where(Ci(r,t.filter)):t.where(r));const i=MP(t);return e[i]=t,i}function O6(e,t){const n=to(e,er(t.args[0]),t);return{expr:_P(Tr(n),0),name:n}}function mmt(e,t){return _P(CP(e,t),0)}function CP(e,t){return Tr(to(e,t))}function ymt(e,t){const n=to(e,t),{expr:r,name:i}=O6(e,t);return ur(Tr(ze(n,i)),r)}function vmt(e,t){const n=t.args[0],r=to(e,Tr(Zp(n)),t),{expr:i}=O6(e,t);return C6(ur(Tr(r),i))}function bmt(e,t){const n=to(e,t),r=to(e,Ma(t.args[1]),t);return sw(n,r)}function _mt(e,t){const n=to(e,t),r=to(e,tl(t.args[1]),t);return aw(n,r)}function db(e,t,n,r=!0){const i=t.args[0],{expr:o}=O6(e,t),s=Ue(i,n(i)),a=to(e,Tr(Ji(s,2)),t),l=to(e,Tr(s),t),c=r?Ue(o,1):o;return ur(Ue(Tr(a),ur(Ji(Tr(l),2),o)),c)}function h_(e,t,n,r=!0){const{expr:i}=og(e,t),o=AP(e,t,n),s=wy(e,1,t,n),a=wy(e,0,t,n),l=Ue(o,ur(ze(s,a),i));return r===null?l:r?ur(l,Ue(i,1)):ur(l,i)}function z7(e,t,n){const{expr:r}=og(e,t),i=AP(e,t,n),o=E4(e,1,t,n),s=E4(e,0,t,n),a=wy(e,1,t,n),l=wy(e,0,t,n),c=Ue(o,ur(Ji(a,2),r)),u=Ue(s,ur(Ji(l,2),r));return ur(Ue(i,ur(ze(a,l),r)),by(ze(c,u)))}function og(e,t){const[n,r]=t.args,i=to(e,dP(n,r),t);return{expr:Tr(i),name:i}}function wy(e,t,n,r){const i=n.args,o=i[t],s=i[1-t],a=Tr(Ue(o,r(o))).where(ec(s));return Tr(to(e,a,n))}function E4(e,t,n,r){const i=n.args,o=i[t],s=i[1-t],a=Tr(Ji(Ue(o,r(o)),2)).where(ec(s));return Tr(to(e,a,n))}function AP(e,t,n){const[r,i]=t.args,o=Tr(ze(Ue(i,n(i)),Ue(r,n(r))));return Tr(to(e,o,t))}function RP(e,t){const[n,r]=t.args,{expr:i,name:o}=og(e,t),s=to(e,hP(n,r),t);return ur(Tr(ze(s,o)),i)}function NP(e,t){const[n,r]=t.args,{expr:i,name:o}=og(e,t),s=to(e,V0t(n,r),t);return ur(Tr(ze(s,o)),i)}function T4(e,t,n,r){const{expr:i}=og(e,n),o=wy(e,t,n,r),s=E4(e,t,n,r);return Ue(s,ur(Ji(o,2),i))}function IP(e,t,n){const r=h_(e,t,n,null),i=T4(e,1,t,n);return ur(r,i)}function wmt(e,t,n){const r=RP(e,t),i=NP(e,t),o=IP(e,t,n);return Ue(i,ze(o,r))}function xmt(e){if(!e.filterStable)return null;const t=e.query();if(!V2(t))return null;const n=lw(t,l=>{const c=l._from[0]?.expr;return iw(c)?c.name:c});if(typeof n!="string")return null;const r=new Map,i={},o={},s=[],a=l=>{const c=l.column,u=lw(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(Qf(c)>1)return null;const u=$gt(c);if(u.length===0)s.push(l),i[l]=c;else{for(const f of u){if(f.isDistinct)return null;const h=gmt(f,i,a);if(!h)return null;r.set(f,h)}o[l]=w4(c,r)}}return r.size?{group:s,preagg:i,output:o}:null}function lw(e,t){const n=e.subqueries;if(V2(e)&&n.length===0)return t(e);const r=lw(n[0],t);for(let i=1;io.logger().error(h))}return i.set(t,u),u}}function Tmt(e){const{source:t,meta:n}=e,r=e.predicate,i=N6(r).map(f=>f.column);let o,s;if(!n||!i)return{source:null,columns:s,predicate:o};const{type:a,scales:l,bin:c,pixelSize:u=1}=n;if(a==="point")o=f=>f,s=Object.fromEntries(i.map(f=>[`${f}`,rr(f)]));else if(a==="interval"&&l){const f=l.map(h=>Mmt(h,u,c));f.some(h=>!h)||(f.length===1?(o=h=>h?To("active0",h.extent.map(f[0])):[],s={active0:f[0](r.expr)}):(o=h=>h?Ci(h.clauses.map((p,g)=>To(`active${g}`,p.extent.map(f[g])))):[],s=Object.fromEntries(r.clauses.map((h,p)=>[`active${p}`,f[p](h.expr)]))))}return{source:s?t:null,columns:s,predicate:o}}const kmt={ceil:lgt,round:_y};function Mmt(e,t,n){const{type:r,domain:i,range:o,apply:s,sqlApply:a}=I6(e);if(!s)return;const l=kmt[`${n}`.toLowerCase()]||Ls,c=s(Math.min(...i)),u=s(Math.max(...i)),f=(r==="identity"?1:Math.abs(o[1]-o[0])/(u-c))/t,h=f===1?g=>g:g=>ze(vo(f),g),p=c===0?g=>g:g=>Ue(g,vo(c));return g=>bi(l(h(p(a(g)))))}function Cmt(e,t,n,r){const{group:i,output:o,preagg:s}=n,{columns:a}=t,l=e.setSelect({...s,...a}).groupby(Object.keys(a)),[c]=l.subqueries;if(c){const v=Object.values(a).flatMap(b=>N6(b).map(_=>_.column));Amt(c,v)}const u=l._having,f=l._orderby;l._having=[],l._orderby=[];const h=l.toString(),p=(kP(h)>>>0).toString(16),g=`${r}.preagg_${p}`,y=qt.select(i,o).from(g).groupby(i).having(u).orderby(f);return new Nmt({table:g,create:h,active:t,select:y})}function Amt(e,t){const n=new Set,r=i=>{if(!n.has(i)){if(n.add(i),V2(i)&&i._from.length&&(i.select(t),Rmt(i))){const o=new Set(i._groupby.flatMap(s=>s instanceof nP?s.name:[]));i.groupby(t.filter(s=>!o.has(s)))}i.subqueries.forEach(r)}};r(e)}function Rmt(e){return e._groupby.length>0||e._select.some(t=>Qf(t))}class Nmt{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 OP(){return{debug(...e){},info(...e){},log(...e){},warn(...e){},error(...e){},group(e){},groupCollapsed(e){},groupEnd(){}}}const Bh=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")});class D6 extends Promise{constructor(){let t,n;super((r,i)=>{t=r,n=i}),this._resolve=t,this._reject=n,this._state=Bh.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=Bh.done,this}ready(t){return this._state=Bh.ready,this._value=t,this}reject(t){return this._state=Bh.error,this._reject(t),this}get state(){return this._state}}D6.prototype.constructor=Promise;function Imt(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function Omt(e,t){let n=[],r=0;function i(){const o=Dmt(n,t);n=[],r=0;for(const s of o)Fmt(s,e),Pmt(s,t)}return{add(o,s){o.request.type==="arrow"?(r=r||Imt(()=>i()),n.push({entry:o,priority:s,index:n.length})):e(o,s)}}}function Dmt(e,t){const n=[],r=new Map;for(const i of e){const{entry:{request:o}}=i,s=Lmt(o.query,t);if(!r.has(s)){const a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Lmt(e,t){const n=`${e}`;if(V2(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 o={};e._select.forEach(({alias:s,expr:a})=>o[s]=a),r.setGroupby(i.map(s=>z2(s)&&o[s.column]||s))}else e._select.some(o=>Qf(o.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function Fmt(e,t){if($mt(e))t({request:{type:"arrow",cache:!1,query:e.query=Bmt(e)},result:e.result=new D6});else for(const{entry:n,priority:r}of e)t(n,r)}function $mt(e){if(e.length>1){const t=`${e[0].entry.request.query}`;for(let n=1;no[a]=s),r.setGroupby(i.map(s=>z2(s)&&o[s.column]||s))}return r.setSelect(Array.from(n.values()))}async function Pmt(e,t){const{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(const{entry:l}of e)l.result.reject(a);return}const s=S0t(r);e.forEach(({entry:a},l)=>{const{request:c,result:u}=a,f=n[l],h=s&&f?zmt(o,f):f?Umt(o,f):o;c.cache&&t.set(String(c.query),h),u.fulfill(h)})}function Umt(e,t){return e.select(t.map(n=>n[0]),t.map(n=>n[1]))}function zmt(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 qmt=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout;function jmt(){return{get:()=>{},set:(e,t)=>t,clear:()=>{}}}function Vmt({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){const i=performance.now()-t;let o=null,s=1/0;for(const[a,l]of n){const{last:c}=l;cc&&n.delete(a)}o&&n.delete(o)}return{get(i){const o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&qmt(r),o},clear(){n=new Map}}}class Wmt{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 o=null,s=r;s;o=s,s=s.next)t(s.item)&&(s===r?r=s.next:o.next=s.next,s===i&&(i=o||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 of=Object.freeze({High:0,Normal:1,Low:2});class Ymt{constructor(t=32){this.queue=new Wmt(3),this.db=null,this.clientCache=null,this._logger=OP(),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{request:t,result:n}=this.queue.next();this.pendingResults.push(n),t.type==="exec"&&(this.pendingExec=!0),this.submit(t,n).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==Bh.pending;){const r=this.pendingResults.shift();r.state===Bh.ready?r.fulfill():r.state===Bh.done&&this._logger.warn("Found resolved query in pending results.")}t.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(t,n=of.Normal){this.queue.insert(t,n),this.next()}async submit(t,n){try{const{query:r,type:i,cache:o=!1,options:s}=t,a=r?`${r}`:null;if(o){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,...s});const c=this.db.query({type:i,sql:a,...s});o&&this.clientCache.set(a,c);const u=await c;o&&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?Vmt():t||jmt():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=Omt(this.enqueue.bind(this),this.clientCache):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=of.Normal){const r=new D6,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 pb;function Ia(e){return e?pb=e:pb==null&&(pb=new Hmt),pb}class Hmt{constructor(t=N9(),{logger:n=console,manager:r=new Ymt,cache:i=!0,consolidate:o=!0,preagg:s={}}={}){this.manager=r,this.manager.cache(i),this.manager.consolidate(o),this.databaseConnector(t),this.logger(n),this.clear(),this.preaggregator=new Emt(this,s)}clear({clients:t=!0,cache:n=!0}={}){this.manager.clear(),t&&(this.filterGroups?.forEach(r=>r.disconnect()),this.filterGroups=new Map,this.clients?.forEach(r=>this.disconnect(r)),this.clients=new Set),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}logger(t){return arguments.length&&(this._logger=t||OP(),this.manager.logger(this._logger)),this._logger}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=of.Normal}={}){return t=Array.isArray(t)?t.filter(r=>r).join(`; +`):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=of.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:of.Low})}createBundle(t,n,r=of.Low){const i={name:t,queries:n.map(o=>typeof o=="string"?{sql:o}:o)};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=of.High){const r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=of.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(),Gmt(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 Gmt(e,t,n){if(!t)return;let r=e.filterGroups.get(t);if(!r){const i=s=>Xmt(e,t,s),o=()=>Jmt(e,t);t.addEventListener("activate",i),t.addEventListener("value",o),r={selection:t,clients:new Set,disconnect(){t.removeEventListener("activate",i),t.removeEventListener("value",o)}},e.filterGroups.set(t,r)}r.clients.add(n)}function Xmt(e,t,n){const{preaggregator:r,filterGroups:i}=e,{clients:o}=i.get(t);for(const s of o)s.enabled&&r.request(s,t,n)}function Jmt(e,t){const{preaggregator:n,filterGroups:r}=e,{clients:i}=r.get(t),{active:o}=t;return Promise.allSettled(Array.from(i,s=>{if(!s.enabled)return s.requestQuery();const a=n.request(s,t,o),l=a?null:t.predicate(s);if(a?.skip||!a&&!l)return;const c=a?.query(o.predicate)??s.query(l);return e.updateClient(s,c)}))}function Kmt(e){const{coordinator:t=Ia(),...n}=e,r=new Zmt(n);return t.connect(r),r}class Zmt extends Id{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 Qmt{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new tyt}),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:o,queue:s}=r;if(o?.size){const a=Array.from(o,l=>l(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}}class tyt{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,t?.value}}function DP(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?eyt(e,t):!0}function eyt(e,t){if(e.length!==t.length)return!0;for(let n=0;nSa(n))){const n=new ha,r=()=>{n.update(t.map(i=>Sa(i)?i.value:i))};return r(),t.forEach(i=>Sa(i)?i.addEventListener("value",r):0),n}return new ha(t)}get value(){return this._value}update(t,{force:n}={}){return DP(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}}function ko(e){return e instanceof b0}function gb(e,t){return new b0(new FP(e),t&&[t].flat())}let b0=class LP extends ha{static intersect({cross:t=!1,empty:n=!1,include:r=[]}={}){return gb({cross:t,empty:n},r)}static union({cross:t=!1,empty:n=!1,include:r=[]}={}){return gb({cross:t,empty:n,union:!0},r)}static single({cross:t=!1,empty:n=!1,include:r=[]}={}){return gb({cross:t,empty:n,single:!0},r)}static crossfilter({empty:t=!1,include:n=[]}={}){return gb({cross:!0,empty:t},n)}constructor(t=new FP,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 LP(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 FP{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:o}=n,s=t.filter(l=>i!==l.source),a=this.single?[]:s;return this.single&&r&&s.forEach(l=>l.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){const{empty:i,union:o}=this;if(i&&!t.length)return[ne(!1)];if(this.skip(r,n))return;const s=t.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return o&&s.length>1?Eo(s):s}queueFilter(t){if(this.cross){const n=t.active?.source;return r=>r.active?.source!==n}return null}}function nyt({uri:e="http://localhost:3000/",ipc:t=void 0}={}){return{async query(n){const r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),i=await r;if(!i.ok)throw new Error(`Query failed with HTTP status ${i.status}: ${await i.text()}`);return n.type==="exec"?r:n.type==="arrow"?rw(await i.arrayBuffer(),t):i.json()}}}function Fe(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function q7(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 Je(e){return this instanceof Je?(this.v=e,this):new Je(e)}function zl(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(p){return function(g){return Promise.resolve(g).then(p,f)}}function a(p,g){r[p]&&(i[p]=function(y){return new Promise(function(v,b){o.push([p,y,v,b])>1||l(p,y)})},g&&(i[p]=g(i[p])))}function l(p,g){try{c(r[p](g))}catch(y){h(o[0][3],y)}}function c(p){p.value instanceof Je?Promise.resolve(p.value.v).then(u,f):h(o[0][2],p)}function u(p){l("next",p)}function f(p){l("throw",p)}function h(p,g){p(g),o.shift(),o.length&&l(o[0][0],o[0][1])}}function d_(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,o){t[i]=e[i]?function(s){return(n=!n)?{value:Je(e[i](s)),done:!1}:o?o(s):s}:o}}function Hh(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 q7=="function"?q7(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,l){s=e[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}}const ryt=new TextDecoder("utf-8"),k4=e=>ryt.decode(e),iyt=new TextEncoder,L6=e=>iyt.encode(e),oyt=e=>typeof e=="number",$P=e=>typeof e=="boolean",vi=e=>typeof e=="function",is=e=>e!=null&&Object(e)===e,dd=e=>is(e)&&vi(e.then),_v=e=>is(e)&&vi(e[Symbol.iterator]),sg=e=>is(e)&&vi(e[Symbol.asyncIterator]),M4=e=>is(e)&&is(e.schema),BP=e=>is(e)&&"done"in e&&"value"in e,PP=e=>is(e)&&vi(e.stat)&&oyt(e.fd),UP=e=>is(e)&&F6(e.body),K2=e=>"_getDOMStream"in e&&"_getNodeStream"in e,syt=e=>is(e)&&vi(e.abort)&&vi(e.getWriter)&&!K2(e),F6=e=>is(e)&&vi(e.cancel)&&vi(e.getReader)&&!K2(e),ayt=e=>is(e)&&vi(e.end)&&vi(e.write)&&$P(e.writable)&&!K2(e),zP=e=>is(e)&&vi(e.read)&&vi(e.pipe)&&$P(e.readable)&&!K2(e),lyt=e=>is(e)&&vi(e.clear)&&vi(e.bytes)&&vi(e.position)&&vi(e.setPosition)&&vi(e.capacity)&&vi(e.getBufferIdentifier)&&vi(e.createLong),$6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function cyt(e){const t=e[0]?[e[0]]:[];let n,r,i,o;for(let s,a,l=0,c=0,u=e.length;++lu+f.byteLength,0);let i,o,s,a=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const u=n.length;++lYn(Int32Array,e),V7=e=>Yn(BigInt64Array,e),pn=e=>Yn(Uint8Array,e),C4=e=>(e.next(),e);function*uyt(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $6?n(t):_v(t)?t:n(t);return yield*C4(function*(i){let o=null;do o=i.next(yield Yn(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}const fyt=e=>uyt(Uint8Array,e);function qP(e,t){return zl(this,arguments,function*(){if(dd(t))return yield Je(yield Je(yield*d_(Hh(qP(e,yield Je(t))))));const r=function(s){return zl(this,arguments,function*(){yield yield Je(yield Je(s))})},i=function(s){return zl(this,arguments,function*(){yield Je(yield*d_(Hh(C4(function*(a){let l=null;do l=a.next(yield l?.value);while(!l.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof $6?r(t):_v(t)?i(t):sg(t)?t:r(t);return yield Je(yield*d_(Hh(C4(function(s){return zl(this,arguments,function*(){let a=null;do a=yield Je(s.next(yield yield Je(Yn(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Je(new e)})}const hyt=e=>qP(Uint8Array,e);function jP(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*pyt(e){let t,n=!1,r=[],i,o,s,a=0;function l(){return o==="peek"?nc(r,s)[0]:([i,r,a]=nc(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});const c=fyt(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?c.next():c.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield l());while(s0&&(i.push(o),l+=o.byteLength),n||a<=l)do({cmd:s,size:a}=yield yield Je(c()));while(a0&&(i.push(pn(o)),l+=o.byteLength),n||a<=l)do({cmd:s,size:a}=yield yield Je(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=pn(n)),n})}}const oT=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function vyt(e){return zl(this,arguments,function*(){const n=[];let r="error",i=!1,o=null,s,a,l=0,c=[],u;function f(){return s==="peek"?nc(c,a)[0]:([u,c,l]=nc(c,a),u)}if({cmd:s,size:a}=(yield yield Je(null))||{cmd:"read",size:0},e.isTTY)return yield yield Je(new Uint8Array(0)),yield Je(null);try{n[0]=oT(e,"end"),n[1]=oT(e,"error");do{if(n[2]=oT(e,"readable"),[r,o]=yield Je(Promise.race(n.map(p=>p[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-l)?(u=pn(e.read(a-l)),u.byteLength0&&(c.push(u),l+=u.byteLength)),i||a<=l)do({cmd:s,size:a}=yield yield Je(f()));while(a{for(const[b,_]of p)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 ni;(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"})(ni||(ni={}));var eo;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(eo||(eo={}));var Qi;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Qi||(Qi={}));var Ca;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Ca||(Ca={}));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 rc;(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"})(rc||(rc={}));const sT=2,Ol=4,Gc=4,qn=4,sf=new Int32Array(2),W7=new Float32Array(sf.buffer),Y7=new Float64Array(sf.buffer),yb=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var A4;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(A4||(A4={}));let _0=class VP{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new VP(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){W7[0]=n,this.writeInt32(t,sf[0])}writeFloat64(t,n){Y7[0]=n,this.writeInt32(t,sf[yb?0:1]),this.writeInt32(t+4,sf[yb?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 o=(r+i)*sT;this.addInt16(o);let s=0;const a=this.space;t:for(n=0;n=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,Ol+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 Ko.startUnion(t),Ko.addMode(t,n),Ko.addTypeIds(t,r),Ko.endUnion(t)}}let Q7=class Rm{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 Rm).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+qn),(n||new Rm).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Rm.startUtf8(t),Rm.endUtf8(t)}};var _r;(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"})(_r||(_r={}));let Qs=class b_{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 b_).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+qn),(n||new b_).__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):_r.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 Xc).__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 b_).__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 _i).__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,_r.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()}},kl=class Bc{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 Bc).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+qn),(n||new Bc).__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):w0.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Qs).__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 _i).__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,w0.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,o){return Bc.startSchema(t),Bc.addEndianness(t,n),Bc.addFields(t,r),Bc.addCustomMetadata(t,i),Bc.addFeatures(t,o),Bc.endSchema(t)}};var Tn;(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"})(Tn||(Tn={}));var K;(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"})(K||(K={}));var qc;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(qc||(qc={}));const byt=void 0;function xy(e){if(e===null)return"null";if(e===byt)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=>xy(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function fr(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 XP(e,t){return fr(e/t)+fr(e%t)/fr(t)}const _yt=Symbol.for("isArrowBigNum");function gl(e,...t){return t.length===0?Object.setPrototypeOf(Yn(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}gl.prototype[_yt]=!0;gl.prototype.toJSON=function(){return`"${Ey(this)}"`};gl.prototype.valueOf=function(e){return JP(this,e)};gl.prototype.toString=function(){return Ey(this)};gl.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return JP(this);case"string":return Ey(this);case"default":return Syt(this)}return Ey(this)};function Qp(...e){return gl.apply(this,e)}function t0(...e){return gl.apply(this,e)}function Sy(...e){return gl.apply(this,e)}Object.setPrototypeOf(Qp.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(t0.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Sy.prototype,Object.create(Uint32Array.prototype));Object.assign(Qp.prototype,gl.prototype,{constructor:Qp,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(t0.prototype,gl.prototype,{constructor:t0,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Sy.prototype,gl.prototype,{constructor:Sy,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const wyt=BigInt(4294967296)*BigInt(4294967296),xyt=wyt-BigInt(1);function JP(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:o}=e,s=new BigUint64Array(n,r,i/8),a=o&&s.at(-1)&BigInt(1)<=0)return aT(e);t=t.slice();let r=1;for(let o=0;o(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(oe.prototype);class Of extends oe{constructor(){super(K.Null)}toString(){return"Null"}}ZP=Symbol.toStringTag;Of[ZP]=(e=>e[Symbol.toStringTag]="Null")(Of.prototype);class pd extends oe{constructor(t,n){super(K.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}`}}QP=Symbol.toStringTag;pd[QP]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(pd.prototype);class Ty extends pd{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Ty.prototype,"ArrayType",{value:Int32Array});class hw extends oe{constructor(t){super(K.Float),this.precision=t}get ArrayType(){switch(this.precision){case Qi.HALF:return Uint16Array;case Qi.SINGLE:return Float32Array;case Qi.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}tU=Symbol.toStringTag;hw[tU]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(hw.prototype);class dw extends oe{constructor(){super(K.Binary)}toString(){return"Binary"}}eU=Symbol.toStringTag;dw[eU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(dw.prototype);class pw extends oe{constructor(){super(K.LargeBinary)}toString(){return"LargeBinary"}}nU=Symbol.toStringTag;pw[nU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(pw.prototype);class gw extends oe{constructor(){super(K.Utf8)}toString(){return"Utf8"}}rU=Symbol.toStringTag;gw[rU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(gw.prototype);class mw extends oe{constructor(){super(K.LargeUtf8)}toString(){return"LargeUtf8"}}iU=Symbol.toStringTag;mw[iU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(mw.prototype);class yw extends oe{constructor(){super(K.Bool)}toString(){return"Bool"}}oU=Symbol.toStringTag;yw[oU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(yw.prototype);class vw extends oe{constructor(t,n,r=128){super(K.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}sU=Symbol.toStringTag;vw[sU]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(vw.prototype);class bw extends oe{constructor(t){super(K.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ca[this.unit]}>`}get ArrayType(){return this.unit===Ca.DAY?Int32Array:BigInt64Array}}aU=Symbol.toStringTag;bw[aU]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(bw.prototype);class _w extends oe{constructor(t,n){super(K.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`)}}lU=Symbol.toStringTag;_w[lU]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(_w.prototype);class ww extends oe{constructor(t,n){super(K.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${Ee[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}cU=Symbol.toStringTag;ww[cU]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ww.prototype);class xw extends oe{constructor(t){super(K.Interval),this.unit=t}toString(){return`Interval<${rc[this.unit]}>`}}uU=Symbol.toStringTag;xw[uU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(xw.prototype);class Sw extends oe{constructor(t){super(K.Duration),this.unit=t}toString(){return`Duration<${Ee[this.unit]}>`}}fU=Symbol.toStringTag;Sw[fU]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Sw.prototype);class Ew extends oe{constructor(t){super(K.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}}hU=Symbol.toStringTag;Ew[hU]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ew.prototype);class xo extends oe{constructor(t){super(K.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}dU=Symbol.toStringTag;xo[dU]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(xo.prototype);class Tw extends oe{constructor(t,n,r){super(K.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}pU=Symbol.toStringTag;Tw[pU]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Tw.prototype);class kw extends oe{constructor(t){super(K.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}gU=Symbol.toStringTag;kw[gU]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(kw.prototype);class Mw extends oe{constructor(t,n){super(K.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}>`}}mU=Symbol.toStringTag;Mw[mU]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Mw.prototype);class Cw extends oe{constructor(t,n=!1){var r,i,o;if(super(K.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){const s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");const a=(o=t?.type)===null||o===void 0?void 0:o.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(", ")}}>`}}yU=Symbol.toStringTag;Cw[yU]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Cw.prototype);const Eyt=(e=>()=>++e)(-1);class x0 extends oe{constructor(t,n,r,i){super(K.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Eyt():fr(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}>`}}vU=Symbol.toStringTag;x0[vU]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(x0.prototype);function jc(e){const t=e;switch(e.typeId){case K.Decimal:return e.bitWidth/32;case K.Interval:return 1+t.unit;case K.FixedSizeList:return t.listSize;case K.FixedSizeBinary:return t.byteWidth;default:return 1}}class rn{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Tyt(this,t,n)}getVisitFnByTypeId(t,n=!0){return Fp(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 Tyt(e,t,n=!0){return typeof t=="number"?Fp(e,t,n):typeof t=="string"&&t in K?Fp(e,K[t],n):t&&t instanceof oe?Fp(e,tO(t),n):t?.type&&t.type instanceof oe?Fp(e,tO(t.type),n):Fp(e,K.NONE,n)}function Fp(e,t,n=!0){let r=null;switch(t){case K.Null:r=e.visitNull;break;case K.Bool:r=e.visitBool;break;case K.Int:r=e.visitInt;break;case K.Int8:r=e.visitInt8||e.visitInt;break;case K.Int16:r=e.visitInt16||e.visitInt;break;case K.Int32:r=e.visitInt32||e.visitInt;break;case K.Int64:r=e.visitInt64||e.visitInt;break;case K.Uint8:r=e.visitUint8||e.visitInt;break;case K.Uint16:r=e.visitUint16||e.visitInt;break;case K.Uint32:r=e.visitUint32||e.visitInt;break;case K.Uint64:r=e.visitUint64||e.visitInt;break;case K.Float:r=e.visitFloat;break;case K.Float16:r=e.visitFloat16||e.visitFloat;break;case K.Float32:r=e.visitFloat32||e.visitFloat;break;case K.Float64:r=e.visitFloat64||e.visitFloat;break;case K.Utf8:r=e.visitUtf8;break;case K.LargeUtf8:r=e.visitLargeUtf8;break;case K.Binary:r=e.visitBinary;break;case K.LargeBinary:r=e.visitLargeBinary;break;case K.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case K.Date:r=e.visitDate;break;case K.DateDay:r=e.visitDateDay||e.visitDate;break;case K.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case K.Timestamp:r=e.visitTimestamp;break;case K.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case K.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case K.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case K.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case K.Time:r=e.visitTime;break;case K.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case K.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case K.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case K.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case K.Decimal:r=e.visitDecimal;break;case K.List:r=e.visitList;break;case K.Struct:r=e.visitStruct;break;case K.Union:r=e.visitUnion;break;case K.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case K.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case K.Dictionary:r=e.visitDictionary;break;case K.Interval:r=e.visitInterval;break;case K.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case K.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case K.Duration:r=e.visitDuration;break;case K.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case K.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case K.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case K.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case K.FixedSizeList:r=e.visitFixedSizeList;break;case K.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${K[t]}'`)}function tO(e){switch(e.typeId){case K.Null:return K.Null;case K.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?K.Int8:K.Uint8;case 16:return n?K.Int16:K.Uint16;case 32:return n?K.Int32:K.Uint32;case 64:return n?K.Int64:K.Uint64}return K.Int}case K.Float:switch(e.precision){case Qi.HALF:return K.Float16;case Qi.SINGLE:return K.Float32;case Qi.DOUBLE:return K.Float64}return K.Float;case K.Binary:return K.Binary;case K.LargeBinary:return K.LargeBinary;case K.Utf8:return K.Utf8;case K.LargeUtf8:return K.LargeUtf8;case K.Bool:return K.Bool;case K.Decimal:return K.Decimal;case K.Time:switch(e.unit){case Ee.SECOND:return K.TimeSecond;case Ee.MILLISECOND:return K.TimeMillisecond;case Ee.MICROSECOND:return K.TimeMicrosecond;case Ee.NANOSECOND:return K.TimeNanosecond}return K.Time;case K.Timestamp:switch(e.unit){case Ee.SECOND:return K.TimestampSecond;case Ee.MILLISECOND:return K.TimestampMillisecond;case Ee.MICROSECOND:return K.TimestampMicrosecond;case Ee.NANOSECOND:return K.TimestampNanosecond}return K.Timestamp;case K.Date:switch(e.unit){case Ca.DAY:return K.DateDay;case Ca.MILLISECOND:return K.DateMillisecond}return K.Date;case K.Interval:switch(e.unit){case rc.DAY_TIME:return K.IntervalDayTime;case rc.YEAR_MONTH:return K.IntervalYearMonth}return K.Interval;case K.Duration:switch(e.unit){case Ee.SECOND:return K.DurationSecond;case Ee.MILLISECOND:return K.DurationMillisecond;case Ee.MICROSECOND:return K.DurationMicrosecond;case Ee.NANOSECOND:return K.DurationNanosecond}return K.Duration;case K.Map:return K.Map;case K.List:return K.List;case K.Struct:return K.Struct;case K.Union:switch(e.mode){case eo.Dense:return K.DenseUnion;case eo.Sparse:return K.SparseUnion}return K.Union;case K.FixedSizeBinary:return K.FixedSizeBinary;case K.FixedSizeList:return K.FixedSizeList;case K.Dictionary:return K.Dictionary}throw new Error(`Unrecognized type '${K[e.typeId]}'`)}rn.prototype.visitInt8=null;rn.prototype.visitInt16=null;rn.prototype.visitInt32=null;rn.prototype.visitInt64=null;rn.prototype.visitUint8=null;rn.prototype.visitUint16=null;rn.prototype.visitUint32=null;rn.prototype.visitUint64=null;rn.prototype.visitFloat16=null;rn.prototype.visitFloat32=null;rn.prototype.visitFloat64=null;rn.prototype.visitDateDay=null;rn.prototype.visitDateMillisecond=null;rn.prototype.visitTimestampSecond=null;rn.prototype.visitTimestampMillisecond=null;rn.prototype.visitTimestampMicrosecond=null;rn.prototype.visitTimestampNanosecond=null;rn.prototype.visitTimeSecond=null;rn.prototype.visitTimeMillisecond=null;rn.prototype.visitTimeMicrosecond=null;rn.prototype.visitTimeNanosecond=null;rn.prototype.visitDenseUnion=null;rn.prototype.visitSparseUnion=null;rn.prototype.visitIntervalDayTime=null;rn.prototype.visitIntervalYearMonth=null;rn.prototype.visitDuration=null;rn.prototype.visitDurationSecond=null;rn.prototype.visitDurationMillisecond=null;rn.prototype.visitDurationMicrosecond=null;rn.prototype.visitDurationNanosecond=null;const bU=new Float64Array(1),dp=new Uint32Array(bU.buffer);function _U(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 kyt(e){if(e!==e)return 32256;bU[0]=e;const t=(dp[1]&2147483648)>>16&65535;let n=dp[1]&2146435072,r=0;return n>=1089470464?dp[0]>0?n=31744:(n=(n&2080374784)>>16,r=(dp[1]&1048575)>>10):n<=1056964608?(r=1048576+(dp[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(dp[1]&1048575)+512>>10),t|n|r&65535}class Te extends rn{}function Oe(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Myt=(e,t,n)=>{e[t]=Math.floor(n/864e5)},wU=(e,t,n,r)=>{if(n+1{const i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},P6=({values:e},t,n)=>{e[t]=n},xU=({values:e},t,n)=>{e[t]=kyt(n)},Ayt=(e,t,n)=>{switch(e.type.precision){case Qi.HALF:return xU(e,t,n);case Qi.SINGLE:case Qi.DOUBLE:return P6(e,t,n)}},SU=({values:e},t,n)=>{Myt(e,t,n.valueOf())},EU=({values:e},t,n)=>{e[t]=BigInt(n)},Ryt=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},TU=({values:e,valueOffsets:t},n,r)=>wU(e,t,n,r),kU=({values:e,valueOffsets:t},n,r)=>wU(e,t,n,L6(r)),Nyt=(e,t,n)=>{e.type.unit===Ca.DAY?SU(e,t,n):EU(e,t,n)},MU=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},CU=({values:e},t,n)=>{e[t]=BigInt(n)},AU=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},RU=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},Iyt=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return MU(e,t,n);case Ee.MILLISECOND:return CU(e,t,n);case Ee.MICROSECOND:return AU(e,t,n);case Ee.NANOSECOND:return RU(e,t,n)}},NU=({values:e},t,n)=>{e[t]=n},IU=({values:e},t,n)=>{e[t]=n},OU=({values:e},t,n)=>{e[t]=n},DU=({values:e},t,n)=>{e[t]=n},Oyt=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return NU(e,t,n);case Ee.MILLISECOND:return IU(e,t,n);case Ee.MICROSECOND:return OU(e,t,n);case Ee.NANOSECOND:return DU(e,t,n)}},Dyt=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Lyt=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,o=Aa.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],l=i[t+1];a{const r=e.children[0],{valueOffsets:i}=e,o=Aa.getVisitFn(r);let{[t]:s,[t+1]:a}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(o(r,s,c),++s>=a)break},$yt=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),Byt=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),Pyt=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),Uyt=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),zyt=(e,t,n)=>{const r=e.type.children.map(o=>Aa.getVisitFn(o.type)),i=n instanceof Map?Pyt(t,n):n instanceof Ur?Byt(t,n):Array.isArray(n)?$yt(t,n):Uyt(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},qyt=(e,t,n)=>{e.type.mode===eo.Dense?LU(e,t,n):FU(e,t,n)},LU=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Aa.visit(i,e.valueOffsets[t],n)},FU=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Aa.visit(i,t,n)},jyt=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Vyt=(e,t,n)=>{e.type.unit===rc.DAY_TIME?$U(e,t,n):BU(e,t,n)},$U=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},BU=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},PU=({values:e},t,n)=>{e[t]=n},UU=({values:e},t,n)=>{e[t]=n},zU=({values:e},t,n)=>{e[t]=n},qU=({values:e},t,n)=>{e[t]=n},Wyt=(e,t,n)=>{switch(e.type.unit){case Ee.SECOND:return PU(e,t,n);case Ee.MILLISECOND:return UU(e,t,n);case Ee.MICROSECOND:return zU(e,t,n);case Ee.NANOSECOND:return qU(e,t,n)}},Yyt=(e,t,n)=>{const{stride:r}=e,i=e.children[0],o=Aa.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s`${xy(t)}: ${xy(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Hyt(this[Ua],this[e0])}}class Hyt{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[Ua].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ua].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[Ua].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=os.visit(t[Ua].children[r],t[e0]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Ua].type.children.findIndex(o=>o.name===n);return i!==-1?(Aa.visit(t[Ua].children[i],t[e0],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class ye extends rn{}function ke(e){return(t,n)=>t.getValid(n)?e(t,n):null}const Xyt=(e,t)=>864e5*e[t],Jyt=(e,t)=>null,jU=(e,t,n)=>{if(n+1>=t.length)return null;const r=fr(t[n]),i=fr(t[n+1]);return e.subarray(r,i)},Kyt=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<Xyt(e,t),WU=({values:e},t)=>fr(e[t]),th=({stride:e,values:t},n)=>t[e*n],Zyt=({stride:e,values:t},n)=>_U(t[e*n]),YU=({values:e},t)=>e[t],Qyt=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),HU=({values:e,valueOffsets:t},n)=>jU(e,t,n),GU=({values:e,valueOffsets:t},n)=>{const r=jU(e,t,n);return r!==null?k4(r):null},tvt=({values:e},t)=>e[t],evt=({type:e,values:t},n)=>e.precision!==Qi.HALF?t[n]:_U(t[n]),nvt=(e,t)=>e.type.unit===Ca.DAY?VU(e,t):WU(e,t),XU=({values:e},t)=>1e3*fr(e[t]),JU=({values:e},t)=>fr(e[t]),KU=({values:e},t)=>XP(e[t],BigInt(1e3)),ZU=({values:e},t)=>XP(e[t],BigInt(1e6)),rvt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return XU(e,t);case Ee.MILLISECOND:return JU(e,t);case Ee.MICROSECOND:return KU(e,t);case Ee.NANOSECOND:return ZU(e,t)}},QU=({values:e},t)=>e[t],tz=({values:e},t)=>e[t],ez=({values:e},t)=>e[t],nz=({values:e},t)=>e[t],ivt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return QU(e,t);case Ee.MILLISECOND:return tz(e,t);case Ee.MICROSECOND:return ez(e,t);case Ee.NANOSECOND:return nz(e,t)}},ovt=({values:e,stride:t},n)=>B6.decimal(e.subarray(t*n,t*(n+1))),svt=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,l=i[0].slice(o,s-o);return new Ur([l])},avt=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new z6(s.slice(i,o-i))},lvt=(e,t)=>new U6(e,t),cvt=(e,t)=>e.type.mode===eo.Dense?rz(e,t):iz(e,t),rz=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return os.visit(r,e.valueOffsets[t])},iz=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return os.visit(r,t)},uvt=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},fvt=(e,t)=>e.type.unit===rc.DAY_TIME?oz(e,t):sz(e,t),oz=({values:e},t)=>e.subarray(2*t,2*(t+1)),sz=({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},az=({values:e},t)=>e[t],lz=({values:e},t)=>e[t],cz=({values:e},t)=>e[t],uz=({values:e},t)=>e[t],hvt=(e,t)=>{switch(e.type.unit){case Ee.SECOND:return az(e,t);case Ee.MILLISECOND:return lz(e,t);case Ee.MICROSECOND:return cz(e,t);case Ee.NANOSECOND:return uz(e,t)}},dvt=(e,t)=>{const{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Ur([o])};ye.prototype.visitNull=ke(Jyt);ye.prototype.visitBool=ke(Kyt);ye.prototype.visitInt=ke(tvt);ye.prototype.visitInt8=ke(th);ye.prototype.visitInt16=ke(th);ye.prototype.visitInt32=ke(th);ye.prototype.visitInt64=ke(YU);ye.prototype.visitUint8=ke(th);ye.prototype.visitUint16=ke(th);ye.prototype.visitUint32=ke(th);ye.prototype.visitUint64=ke(YU);ye.prototype.visitFloat=ke(evt);ye.prototype.visitFloat16=ke(Zyt);ye.prototype.visitFloat32=ke(th);ye.prototype.visitFloat64=ke(th);ye.prototype.visitUtf8=ke(GU);ye.prototype.visitLargeUtf8=ke(GU);ye.prototype.visitBinary=ke(HU);ye.prototype.visitLargeBinary=ke(HU);ye.prototype.visitFixedSizeBinary=ke(Qyt);ye.prototype.visitDate=ke(nvt);ye.prototype.visitDateDay=ke(VU);ye.prototype.visitDateMillisecond=ke(WU);ye.prototype.visitTimestamp=ke(rvt);ye.prototype.visitTimestampSecond=ke(XU);ye.prototype.visitTimestampMillisecond=ke(JU);ye.prototype.visitTimestampMicrosecond=ke(KU);ye.prototype.visitTimestampNanosecond=ke(ZU);ye.prototype.visitTime=ke(ivt);ye.prototype.visitTimeSecond=ke(QU);ye.prototype.visitTimeMillisecond=ke(tz);ye.prototype.visitTimeMicrosecond=ke(ez);ye.prototype.visitTimeNanosecond=ke(nz);ye.prototype.visitDecimal=ke(ovt);ye.prototype.visitList=ke(svt);ye.prototype.visitStruct=ke(lvt);ye.prototype.visitUnion=ke(cvt);ye.prototype.visitDenseUnion=ke(rz);ye.prototype.visitSparseUnion=ke(iz);ye.prototype.visitDictionary=ke(uvt);ye.prototype.visitInterval=ke(fvt);ye.prototype.visitIntervalDayTime=ke(oz);ye.prototype.visitIntervalYearMonth=ke(sz);ye.prototype.visitDuration=ke(hvt);ye.prototype.visitDurationSecond=ke(az);ye.prototype.visitDurationMillisecond=ke(lz);ye.prototype.visitDurationMicrosecond=ke(cz);ye.prototype.visitDurationNanosecond=ke(uz);ye.prototype.visitFixedSizeList=ke(dvt);ye.prototype.visitMap=ke(avt);const os=new ye,$p=Symbol.for("keys"),n0=Symbol.for("vals"),Bp=Symbol.for("kKeysAsStrings"),I4=Symbol.for("_kKeysAsStrings");class z6{constructor(t){return this[$p]=new Ur([t.children[0]]).memoize(),this[n0]=t.children[1],new Proxy(this,new gvt)}get[Bp](){return this[I4]||(this[I4]=Array.from(this[$p].toArray(),String))}[Symbol.iterator](){return new pvt(this[$p],this[n0])}get size(){return this[$p].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[$p],n=this[n0],r={};for(let i=-1,o=t.length;++i`${xy(t)}: ${xy(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class pvt{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),os.visit(this.vals,t)]})}}class gvt{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Bp]}has(t,n){return t[Bp].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Bp].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Bp].indexOf(n);if(r!==-1){const i=os.visit(Reflect.get(t,n0),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Bp].indexOf(n);return i!==-1?(Aa.visit(Reflect.get(t,n0),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(z6.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[$p]:{writable:!0,enumerable:!1,configurable:!1,value:null},[n0]:{writable:!0,enumerable:!1,configurable:!1,value:null},[I4]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let eO;function fz(e,t,n,r){const{length:i=0}=e;let o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),si&&(s=i),r?r(e,o,s):[o,s]}const q6=(e,t)=>e<0?t+e:e,nO=e=>e!==e;function ag(e){if(typeof e!=="object"||e===null)return nO(e)?nO: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?dyt(e,n):!1:e instanceof Map?yvt(e):Array.isArray(e)?mvt(e):e instanceof Ur?vvt(e):bvt(e,!0)}function mvt(e){const t=[];for(let n=-1,r=e.length;++n!1;const r=[];for(let i=-1,o=n.length;++i{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return _vt(e,n);case Map:return rO(e,n,n.keys());case z6:case U6:case Object:case void 0:return rO(e,n,t||Object.keys(n))}return n instanceof Ur?wvt(e,n):!1}}function _vt(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r>r}function Aw(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength>3):Rw(new j6(n,e,t,null,hz)).subarray(0,r)),i}return n}function Rw(e){const t=[];let n=0,r=0,i=0;for(const s of e)s&&(i|=1<0)&&(t[n++]=i);const o=new Uint8Array(t.length+7&-8);return o.set(t),o}class j6{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,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 O4(e,t,i)+O4(e,r,n)+Svt(e,i>>3,r-i>>3)}function Svt(e,t,n){let r=0,i=Math.trunc(t);const o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=lT(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=lT(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=lT(o.getUint8(i)),i+=1;return r}function lT(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 Evt=-1;class Vn{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 oe.isSparseUnion(t)?this.children.some(n=>n.nullable):oe.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:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(oe.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Evt&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-O4(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,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;o instanceof Vn?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=jc(t),o&&((l=o[0])&&(this.valueOffsets=l),(l=o[1])&&(this.values=l),(l=o[2])&&(this.nullBitmap=l),(l=o[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(oe.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===eo.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Aw(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));const f=o[u];r=(f&c)!==0,o[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,o=this,s=this.children){return new Vn(t,n,r,i,o,s,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:o}=this,s=+(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,s,l,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===K.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(Aw(this.offset,n,this.nullBitmap),0);const o=this.buffers;return o[qc.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o;const{buffers:s}=this;return(o=s[qc.TYPE])&&(s[qc.TYPE]=o.subarray(t,t+n)),(o=s[qc.OFFSET])&&(s[qc.OFFSET]=o.subarray(t,t+n+1))||(o=s[qc.DATA])&&(s[qc.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}Vn.prototype.children=Object.freeze([]);class Ym extends rn{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Vn(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.data),o=pn(t.nullBitmap),s=Qg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,i,o])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.data),o=pn(t.nullBitmap),s=V7(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,i,o])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.data),o=pn(t.nullBitmap),s=Qg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,i,o])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.data),o=pn(t.nullBitmap),s=V7(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,i,o])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=pn(t.nullBitmap),s=Qg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,void 0,o],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=pn(t.nullBitmap),{length:s=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Yn(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(oe.isSparseUnion(n))return new Vn(n,r,s,a,[void 0,void 0,void 0,o],i);const l=Qg(t.valueOffsets);return new Vn(n,r,s,a,[l,void 0,void 0,o],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.indices.ArrayType,t.data),{["dictionary"]:s=new Ur([new Ym().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[void 0,o,i],[],s)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=pn(t.nullBitmap),o=Yn(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Ym().visit({type:n.valueType})}=t,o=pn(t.nullBitmap),{["length"]:s=i.length/jc(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Vn(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Ym().visit({type:n.childType})}=t,o=pn(t.nullBitmap),s=Qg(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Vn(n,r,a,l,[s,void 0,o],[i])}}const Tvt=new Ym;function on(e){return Tvt.visit(e)}class iO{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function dz(e){return e.reduce((t,n)=>t+n.nullCount,0)}function pz(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function gz(e,t,n,r){const i=[];for(let o=-1,s=e.length;++o=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 V6(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n0?0:-1}function Cvt(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new j6(n,e.offset+(t||0),e.length,n,hz)){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 K.Union:break;case K.Dictionary:break;default:return Cvt(e,n)}const r=os.getVisitFn(e),i=ag(t);for(let o=(n||0)-1,s=e.length;++o{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new iO(e.data.length,r=>{const o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new Avt(s)})}class Avt{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(o.length===0||o.some(a=>!(a instanceof Vn)))throw new TypeError("Vector constructor expects an Array of Data instances.");const s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:c}=_z[s.typeId],u=o[0];this.isValid=f=>W6(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,wz[s.typeId]),this._offsets=pz(o);break}this.data=o,this.type=s,this.stride=jc(s),this.numChildren=(i=(r=s.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 kvt(this.data)}get nullCount(){return dz(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${K[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(q6(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return Y6.visit(this)}concat(...t){return new Ih(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new Ih(fz(this,t,n,({data:r,_offsets:i},o,s)=>gz(r,i,o,s)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case K.Int:case K.Float:case K.Decimal:case K.Time:case K.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:l})=>(s.array.set(a.subarray(0,l*i),s.offset),s.offset+=l*i,s),{array:new o(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 oe.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(oe.isDictionary(this.type)){const t=new Ow(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new Ih(n)}return new Ow(this)}unmemoize(){if(oe.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 Ih(n)}return this}};bz=Symbol.toStringTag;Ur[bz]=(e=>{e.type=oe.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(K).map(n=>K[n]).filter(n=>typeof n=="number"&&n!==K.NONE);for(const n of t){const r=os.getVisitFnByTypeId(n),i=Aa.getVisitFnByTypeId(n),o=Iw.getVisitFnByTypeId(n);_z[n]={get:r,set:i,indexOf:o},wz[n]=Object.create(e,{isValid:{value:Nw(W6)},get:{value:Nw(os.getVisitFnByTypeId(n))},set:{value:mz(Aa.getVisitFnByTypeId(n))},indexOf:{value:yz(Iw.getVisitFnByTypeId(n))}})}return"Vector"})(Ur.prototype);class Ow extends Ur{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){const a=o[s];if(a!==void 0)return a;const l=n.call(this,s);return o[s]=l,l}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new Ow(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ur(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class D4{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 xs{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 xs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+qn),(n||new xs).__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):ni.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new kl).__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 D4).__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 D4).__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 _i).__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,ni.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 $n{constructor(t=[],n,r,i=ni.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=L4(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 $n(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new $n(n,this.metadata)}assign(...t){const n=t[0]instanceof $n?t[0]:Array.isArray(t[0])?new $n(t[0]):new $n(t),r=[...this.fields],i=vb(vb(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{const l=r.findIndex(c=>c.name===a.name);return~l?(r[l]=a.clone({metadata:vb(vb(new Map,r[l].metadata),a.metadata)}))&&!1:!0}),s=L4(o,new Map);return new $n([...r,...o],i,new Map([...this.dictionaries,...s]))}}$n.prototype.fields=null;$n.prototype.metadata=null;$n.prototype.dictionaries=null;class Mr{static new(...t){let[n,r,i,o]=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),o===void 0&&(o=t[0].metadata)),new Mr(`${n}`,r,i,o)}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,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],Mr.new(n,r,i,o)}}Mr.prototype.type=null;Mr.prototype.name=null;Mr.prototype.nullable=null;Mr.prototype.metadata=null;function vb(e,t){return new Map([...e||new Map,...t||new Map])}function L4(e,t=new Map){for(let n=-1,r=e.length;++n0&&L4(o.children,t)}return t}var Rvt=WP,Nvt=_0;class ky{static decode(t){t=new Nvt(pn(t));const n=xs.getRootAsFooter(t),r=$n.decode(n.schema(),new Map,n.version());return new Ivt(r,n)}static encode(t){const n=new Rvt,r=$n.encode(n,t.schema);xs.startRecordBatchesVector(n,t.numRecordBatches);for(const s of[...t.recordBatches()].slice().reverse())Df.encode(n,s);const i=n.endVector();xs.startDictionariesVector(n,t.numDictionaries);for(const s of[...t.dictionaryBatches()].slice().reverse())Df.encode(n,s);const o=n.endVector();return xs.startFooter(n),xs.addSchema(n,r),xs.addVersion(n,ni.V5),xs.addRecordBatches(n,i),xs.addDictionaries(n,o),xs.finishFooterBuffer(n,xs.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=ni.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 oa.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return oa.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 __ extends Ovt{write(t){if((t=pn(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?k4(this.toUint8Array(!0)):this.toUint8Array(!1).then(k4)}toUint8Array(t=!1){return t?nc(this._values)[0]:Fe(this,void 0,void 0,function*(){var n,r,i,o;const s=[];let a=0;try{for(var l=!0,c=Hh(this),u;u=yield c.next(),n=u.done,!n;l=!0){o=u.value,l=!1;const f=o;s.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 nc(s,a)[0]})}}class Dw{constructor(t){t&&(this.source=new Dvt(oa.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 S0{constructor(t){t instanceof S0?this.source=t.source:t instanceof __?this.source=new Ch(oa.fromAsyncIterable(t)):zP(t)?this.source=new Ch(oa.fromNodeStream(t)):F6(t)?this.source=new Ch(oa.fromDOMStream(t)):UP(t)?this.source=new Ch(oa.fromDOMStream(t.body)):_v(t)?this.source=new Ch(oa.fromIterable(t)):dd(t)?this.source=new Ch(oa.fromAsyncIterable(t)):sg(t)&&(this.source=new Ch(oa.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 Dvt{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 Ch{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 sO extends Dw{constructor(t,n){super(),this.position=0,this.buffer=pn(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 o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>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`${qp(this.buffer[3])} ${qp(this.buffer[2])} ${qp(this.buffer[1])} ${qp(this.buffer[0])}`}static multiply(t,n){return new Ml(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new Ml(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return Ml.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return Ml.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,o=new Ml(n);for(let s=r?1:0;s0&&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 Fvt extends Sz{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Rw(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Yn(Uint8Array,Yn(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Yn(Uint8Array,Yn(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return oe.isTimestamp(t)||(oe.isInt(t)||oe.isTime(t))&&t.bitWidth===64||oe.isDuration(t)||oe.isDate(t)&&t.unit===Ca.MILLISECOND?Yn(Uint8Array,Wo.convertArray(r[n])):oe.isDecimal(t)?Yn(Uint8Array,Ml.convertArray(r[n])):oe.isBinary(t)||oe.isLargeBinary(t)||oe.isFixedSizeBinary(t)?$vt(r[n]):oe.isBool(t)?Rw(r[n]):oe.isUtf8(t)||oe.isLargeUtf8(t)?L6(r[n].join("")):Yn(Uint8Array,Yn(t.ArrayType,r[n].map(i=>+i)))}}function $vt(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 _e extends rn{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 $o(e,t){return t instanceof e.constructor}function Od(e,t){return e===t||$o(e,t)}function Mu(e,t){return e===t||$o(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Q2(e,t){return e===t||$o(e,t)&&e.precision===t.precision}function Bvt(e,t){return e===t||$o(e,t)&&e.byteWidth===t.byteWidth}function X6(e,t){return e===t||$o(e,t)&&e.unit===t.unit}function wv(e,t){return e===t||$o(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function xv(e,t){return e===t||$o(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Pvt(e,t){return e===t||$o(e,t)&&e.children.length===t.children.length&&Lf.compareManyFields(e.children,t.children)}function Uvt(e,t){return e===t||$o(e,t)&&e.children.length===t.children.length&&Lf.compareManyFields(e.children,t.children)}function J6(e,t){return e===t||$o(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&Lf.compareManyFields(e.children,t.children)}function zvt(e,t){return e===t||$o(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Lf.visit(e.indices,t.indices)&&Lf.visit(e.dictionary,t.dictionary)}function K6(e,t){return e===t||$o(e,t)&&e.unit===t.unit}function Sv(e,t){return e===t||$o(e,t)&&e.unit===t.unit}function qvt(e,t){return e===t||$o(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Lf.compareManyFields(e.children,t.children)}function jvt(e,t){return e===t||$o(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Lf.compareManyFields(e.children,t.children)}_e.prototype.visitNull=Od;_e.prototype.visitBool=Od;_e.prototype.visitInt=Mu;_e.prototype.visitInt8=Mu;_e.prototype.visitInt16=Mu;_e.prototype.visitInt32=Mu;_e.prototype.visitInt64=Mu;_e.prototype.visitUint8=Mu;_e.prototype.visitUint16=Mu;_e.prototype.visitUint32=Mu;_e.prototype.visitUint64=Mu;_e.prototype.visitFloat=Q2;_e.prototype.visitFloat16=Q2;_e.prototype.visitFloat32=Q2;_e.prototype.visitFloat64=Q2;_e.prototype.visitUtf8=Od;_e.prototype.visitLargeUtf8=Od;_e.prototype.visitBinary=Od;_e.prototype.visitLargeBinary=Od;_e.prototype.visitFixedSizeBinary=Bvt;_e.prototype.visitDate=X6;_e.prototype.visitDateDay=X6;_e.prototype.visitDateMillisecond=X6;_e.prototype.visitTimestamp=wv;_e.prototype.visitTimestampSecond=wv;_e.prototype.visitTimestampMillisecond=wv;_e.prototype.visitTimestampMicrosecond=wv;_e.prototype.visitTimestampNanosecond=wv;_e.prototype.visitTime=xv;_e.prototype.visitTimeSecond=xv;_e.prototype.visitTimeMillisecond=xv;_e.prototype.visitTimeMicrosecond=xv;_e.prototype.visitTimeNanosecond=xv;_e.prototype.visitDecimal=Od;_e.prototype.visitList=Pvt;_e.prototype.visitStruct=Uvt;_e.prototype.visitUnion=J6;_e.prototype.visitDenseUnion=J6;_e.prototype.visitSparseUnion=J6;_e.prototype.visitDictionary=zvt;_e.prototype.visitInterval=K6;_e.prototype.visitIntervalDayTime=K6;_e.prototype.visitIntervalYearMonth=K6;_e.prototype.visitDuration=Sv;_e.prototype.visitDurationSecond=Sv;_e.prototype.visitDurationMillisecond=Sv;_e.prototype.visitDurationMicrosecond=Sv;_e.prototype.visitDurationNanosecond=Sv;_e.prototype.visitFixedSizeList=qvt;_e.prototype.visitMap=jvt;const Lf=new _e;function F4(e,t){return Lf.compareSchemas(e,t)}function cT(e,t){return Vvt(e,t.map(n=>n.data.concat()))}function Vvt(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.length),0)};let o=0,s=0,a=-1;const l=t.length;let c,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a0&&(r[o++]=on({type:new xo(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Zo(e,f))]}function Wvt(e,t,n,r,i){var o;const s=(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]=(o=c?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:on({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var Ez;let Ff=class Oh{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new $n([]),this._offsets=[0],this;let i,o;t[0]instanceof $n&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());const s=l=>{if(l){if(l instanceof Zo)return[l];if(l instanceof Oh)return l.batches;if(l instanceof Vn){if(l.type instanceof xo)return[new Zo(new $n(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>s(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>s(c));if(typeof l=="object"){const c=Object.keys(l),u=c.map(p=>new Ur([l[p]])),f=i??new $n(c.map((p,g)=>new Mr(String(p),u[g].type,u[g].nullable))),[,h]=cT(f,u);return h.length===0?[new Zo(l)]:h}}}return[]},a=t.flatMap(l=>s(l));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new $n([]),!(i instanceof $n))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof Zo))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!F4(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??pz(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=dz(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(q6(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?Y6.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 Oh(n,r.map(i=>new Zo(n,i)))}slice(t,n){const r=this.schema;[t,n]=fz({length:this.numRows},t,n);const i=gz(this.data,this._offsets,t,n);return new Oh(r,i.map(o=>new Zo(r,o)))}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=on({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));[o[t],a[t]]=[s,n],[r,i]=cT(r,a)}return new Oh(r,i)}select(t){const n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),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 Oh(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(p=>p.name===l.name);return~h?f[h]=c:u.push(c),a},[[],[]]),o=this.schema.assign(t.schema),s=[...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 Oh(...cT(o,s))}};Ez=Symbol.toStringTag;Ff[Ez]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Nw(W6),e.get=Nw(os.getVisitFn(K.Struct)),e.set=mz(Aa.getVisitFn(K.Struct)),e.indexOf=yz(Iw.getVisitFn(K.Struct)),"Table"))(Ff.prototype);var Tz;let Zo=class Nm{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof $n))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=on({nullCount:0,type:new xo(this.schema.fields),children:this.schema.fields.map(n=>on({type:n.type,nullCount:0}))})]=t,!(this.data instanceof Vn))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=aO(this.schema,this.data.children);break}case 1:{const[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((l,c,u)=>(l.children[u]=n[c],l.length=Math.max(l.length,n[c].length),l.fields[u]=Mr.new({name:c,type:n[c].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),s=new $n(r),a=on({type:new xo(r),length:o,children:i,nullCount:0});[this.schema,this.data]=aO(s,a.children,o);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=kz(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 os.visit(this.data,t)}at(t){return this.get(q6(t,this.numRows))}set(t,n){return Aa.visit(this.data,t,n)}indexOf(t,n){return Iw.visit(this.data,t,n)}[Symbol.iterator](){return Y6.visit(new Ur([this.data]))}toArray(){return[...this]}concat(...t){return new Ff(this.schema,[this,...t])}slice(t,n){const[r]=new Ur([this.data]).slice(t,n).data;return new Nm(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===o);~s&&(i[s]=this.data.children[s])}return new Nm(n,on({type:r,length:this.numRows,children:i}))}selectAt(t){const n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=on({type:new xo(n.fields),length:this.numRows,children:r});return new Nm(n,i)}};Tz=Symbol.toStringTag;Zo[Tz]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Zo.prototype);function aO(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...e.fields],o=[...t],s=(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}),o[a]=(r=c?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:on({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),on({type:new xo(i),length:n,children:o})]}function kz(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 o=-1,s=e.length;++oon({type:i.type})),r=on({type:new xo(t.fields),nullCount:0,children:n});super(t,r)}}let Zu=class El{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 El).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+qn),(n||new El).__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):ni.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Tn.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 _i).__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,ni.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Tn.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,o,s){return El.startMessage(t),El.addVersion(t,n),El.addHeaderType(t,r),El.addHeader(t,i),El.addBodyLength(t,o),El.addCustomMetadata(t,s),El.endMessage(t)}};class Yvt extends rn{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Z7.startNull(n),Z7.endNull(n)}visitInt(t,n){return Es.startInt(n),Es.addBitWidth(n,t.bitWidth),Es.addIsSigned(n,t.isSigned),Es.endInt(n)}visitFloat(t,n){return Dl.startFloatingPoint(n),Dl.addPrecision(n,t.precision),Dl.endFloatingPoint(n)}visitBinary(t,n){return H7.startBinary(n),H7.endBinary(n)}visitLargeBinary(t,n){return X7.startLargeBinary(n),X7.endLargeBinary(n)}visitBool(t,n){return G7.startBool(n),G7.endBool(n)}visitUtf8(t,n){return Q7.startUtf8(n),Q7.endUtf8(n)}visitLargeUtf8(t,n){return J7.startLargeUtf8(n),J7.endLargeUtf8(n)}visitDecimal(t,n){return Np.startDecimal(n),Np.addScale(n,t.scale),Np.addPrecision(n,t.precision),Np.addBitWidth(n,t.bitWidth),Np.endDecimal(n)}visitDate(t,n){return p_.startDate(n),p_.addUnit(n,t.unit),p_.endDate(n)}visitTime(t,n){return ca.startTime(n),ca.addUnit(n,t.unit),ca.addBitWidth(n,t.bitWidth),ca.endTime(n)}visitTimestamp(t,n){const r=t.timezone&&n.createString(t.timezone)||void 0;return ua.startTimestamp(n),ua.addUnit(n,t.unit),r!==void 0&&ua.addTimezone(n,r),ua.endTimestamp(n)}visitInterval(t,n){return Ll.startInterval(n),Ll.addUnit(n,t.unit),Ll.endInterval(n)}visitDuration(t,n){return g_.startDuration(n),g_.addUnit(n,t.unit),g_.endDuration(n)}visitList(t,n){return K7.startList(n),K7.endList(n)}visitStruct(t,n){return Ph.startStruct_(n),Ph.endStruct_(n)}visitUnion(t,n){Ko.startTypeIdsVector(n,t.typeIds.length);const r=Ko.createTypeIdsVector(n,t.typeIds);return Ko.startUnion(n),Ko.addMode(n,t.mode),Ko.addTypeIds(n,r),Ko.endUnion(n)}visitDictionary(t,n){const r=this.visit(t.indices,n);return Xc.startDictionaryEncoding(n),Xc.addId(n,BigInt(t.id)),Xc.addIsOrdered(n,t.isOrdered),r!==void 0&&Xc.addIndexType(n,r),Xc.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return m_.startFixedSizeBinary(n),m_.addByteWidth(n,t.byteWidth),m_.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return y_.startFixedSizeList(n),y_.addListSize(n,t.listSize),y_.endFixedSizeList(n)}visitMap(t,n){return v_.startMap(n),v_.addKeysSorted(n,t.keysSorted),v_.endMap(n)}}const uT=new Yvt;function Hvt(e,t=new Map){return new $n(Xvt(e,t),w_(e.metadata),t)}function Mz(e){return new Fs(e.count,Cz(e.columns),Az(e.columns))}function Gvt(e){return new ic(Mz(e.data),e.id,e.isDelta)}function Xvt(e,t){return(e.fields||[]).filter(Boolean).map(n=>Mr.fromJSON(n,t))}function lO(e,t){return(e.children||[]).filter(Boolean).map(n=>Mr.fromJSON(n,t))}function Cz(e){return(e||[]).reduce((t,n)=>[...t,new $f(n.count,Jvt(n.VALIDITY)),...Cz(n.children)],[])}function Az(e,t=[]){for(let n=-1,r=(e||[]).length;++nt+ +(n===0),0)}function Kvt(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=uO(e,lO(e,t)),i=new Mr(e.name,s,e.nullable,w_(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?cO(r):new Ty,a=new x0(t.get(n),r,n,o.isOrdered),i=new Mr(e.name,a,e.nullable,w_(e.metadata))):(r=(r=o.indexType)?cO(r):new Ty,t.set(n,s=uO(e,lO(e,t))),a=new x0(s,r,n,o.isOrdered),i=new Mr(e.name,a,e.nullable,w_(e.metadata))),i||null}function w_(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function cO(e){return new pd(e.isSigned,e.bitWidth)}function uO(e,t){const n=e.type.name;switch(n){case"NONE":return new Of;case"null":return new Of;case"binary":return new dw;case"largebinary":return new pw;case"utf8":return new gw;case"largeutf8":return new mw;case"bool":return new yw;case"list":return new Ew((t||[])[0]);case"struct":return new xo(t||[]);case"struct_":return new xo(t||[])}switch(n){case"int":{const r=e.type;return new pd(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=e.type;return new hw(Qi[r.precision])}case"decimal":{const r=e.type;return new vw(r.scale,r.precision,r.bitWidth)}case"date":{const r=e.type;return new bw(Ca[r.unit])}case"time":{const r=e.type;return new _w(Ee[r.unit],r.bitWidth)}case"timestamp":{const r=e.type;return new ww(Ee[r.unit],r.timezone)}case"interval":{const r=e.type;return new xw(rc[r.unit])}case"duration":{const r=e.type;return new Sw(Ee[r.unit])}case"union":{const r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Tw(eo[s],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=e.type;return new kw(r.byteWidth)}case"fixedsizelist":{const r=e.type;return new Mw(r.listSize,(t||[])[0])}case"map":{const r=e.type;return new Cw((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Zvt=WP,Qvt=_0;class So{static fromJSON(t,n){const r=new So(0,ni.V5,n);return r._createHeader=t1t(t,n),r}static decode(t){t=new Qvt(pn(t));const n=Zu.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new So(r,i,o);return s._createHeader=e1t(n,o),s}static encode(t){const n=new Zvt;let r=-1;return t.isSchema()?r=$n.encode(n,t.header()):t.isRecordBatch()?r=Fs.encode(n,t.header()):t.isDictionaryBatch()&&(r=ic.encode(n,t.header())),Zu.startMessage(n),Zu.addVersion(n,ni.V5),Zu.addHeader(n,r),Zu.addHeaderType(n,t.headerType),Zu.addBodyLength(n,BigInt(t.bodyLength)),Zu.finishMessageBuffer(n,Zu.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof $n)return new So(0,ni.V5,Tn.Schema,t);if(t instanceof Fs)return new So(n,ni.V5,Tn.RecordBatch,t);if(t instanceof ic)return new So(n,ni.V5,Tn.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===Tn.Schema}isRecordBatch(){return this.headerType===Tn.RecordBatch}isDictionaryBatch(){return this.headerType===Tn.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=fr(t)}}class Fs{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=fr(t)}}class ic{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=fr(n)}}class ql{constructor(t,n){this.offset=fr(t),this.length=fr(n)}}class $f{constructor(t,n){this.length=fr(t),this.nullCount=fr(n)}}function t1t(e,t){return()=>{switch(t){case Tn.Schema:return $n.fromJSON(e);case Tn.RecordBatch:return Fs.fromJSON(e);case Tn.DictionaryBatch:return ic.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Tn[t]}, type: ${t} }`)}}function e1t(e,t){return()=>{switch(t){case Tn.Schema:return $n.decode(e.header(new kl),new Map,e.version());case Tn.RecordBatch:return Fs.decode(e.header(new zc),e.version());case Tn.DictionaryBatch:return ic.decode(e.header(new Ap),e.version())}throw new Error(`Unrecognized Message type: { name: ${Tn[t]}, type: ${t} }`)}}Mr.encode=h1t;Mr.decode=u1t;Mr.fromJSON=Kvt;$n.encode=f1t;$n.decode=n1t;$n.fromJSON=Hvt;Fs.encode=d1t;Fs.decode=r1t;Fs.fromJSON=Mz;ic.encode=p1t;ic.decode=i1t;ic.fromJSON=Gvt;$f.encode=g1t;$f.decode=s1t;ql.encode=m1t;ql.decode=o1t;function n1t(e,t=new Map,n=ni.V5){const r=c1t(e,t);return new $n(r,x_(e),t,n)}function r1t(e,t=ni.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Fs(e.length(),a1t(e),l1t(e,t))}function i1t(e,t=ni.V5){return new ic(Fs.decode(e.data(),t),e.id(),e.isDelta())}function o1t(e){return new ql(e.offset(),e.length())}function s1t(e){return new $f(e.length(),e.nullCount())}function a1t(e){const t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++rMr.encode(e,o));kl.startFieldsVector(e,n.length);const r=kl.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?kl.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{const a=e.createString(`${o}`),l=e.createString(`${s}`);return _i.startKeyValue(e),_i.addKey(e,a),_i.addValue(e,l),_i.endKeyValue(e)})):-1;return kl.startSchema(e),kl.addFields(e,r),kl.addEndianness(e,y1t?w0.Little:w0.Big),i!==-1&&kl.addCustomMetadata(e,i),kl.endSchema(e)}function h1t(e,t){let n=-1,r=-1,i=-1;const o=t.type;let s=t.typeId;oe.isDictionary(o)?(s=o.dictionary.typeId,i=uT.visit(o,e),r=uT.visit(o.dictionary,e)):r=uT.visit(o,e);const a=(o.children||[]).map(u=>Mr.encode(e,u)),l=Qs.createChildrenVector(e,a),c=t.metadata&&t.metadata.size>0?Qs.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{const h=e.createString(`${u}`),p=e.createString(`${f}`);return _i.startKeyValue(e),_i.addKey(e,h),_i.addValue(e,p),_i.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Qs.startField(e),Qs.addType(e,r),Qs.addTypeType(e,s),Qs.addChildren(e,l),Qs.addNullable(e,!!t.nullable),n!==-1&&Qs.addName(e,n),i!==-1&&Qs.addDictionary(e,i),c!==-1&&Qs.addCustomMetadata(e,c),Qs.endField(e)}function d1t(e,t){const n=t.nodes||[],r=t.buffers||[];zc.startNodesVector(e,n.length);for(const s of n.slice().reverse())$f.encode(e,s);const i=e.endVector();zc.startBuffersVector(e,r.length);for(const s of r.slice().reverse())ql.encode(e,s);const o=e.endVector();return zc.startRecordBatch(e),zc.addLength(e,BigInt(t.length)),zc.addNodes(e,i),zc.addBuffers(e,o),zc.endRecordBatch(e)}function p1t(e,t){const n=Fs.encode(e,t.data);return Ap.startDictionaryBatch(e),Ap.addId(e,BigInt(t.id)),Ap.addIsDelta(e,t.isDelta),Ap.addData(e,n),Ap.endDictionaryBatch(e)}function g1t(e,t){return GP.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function m1t(e,t){return HP.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const y1t=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Q6=e=>`Expected ${Tn[e]} Message in stream, but was null or length 0.`,tC=e=>`Header pointer of flatbuffer-encoded ${Tn[e]} Message is null or length 0.`,Rz=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Nz=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class Iz{constructor(t){this.source=t instanceof Dw?t:new Dw(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(Q6(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const n=pn(this.source.read(t));if(n.byteLength[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Q6(t));return n.value}readSchema(){const t=Tn.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(tC(t));return r}}const tS=4,$4="ARROW1",My=new Uint8Array($4.length);for(let e=0;e<$4.length;e+=1)My[e]=$4.codePointAt(e);function eC(e,t=0){for(let n=-1,r=My.length;++nthis):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 oa.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return oa.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 Ea?t:M4(t)?E1t(t):PP(t)?M1t(t):dd(t)?Fe(this,void 0,void 0,function*(){return yield Ea.from(yield t)}):UP(t)||F6(t)||zP(t)||sg(t)?k1t(new S0(t)):T1t(new Dw(t))}static readAll(t){return t instanceof Ea?t.isSync()?pO(t):gO(t):M4(t)||ArrayBuffer.isView(t)||_v(t)||BP(t)?pO(t):gO(t)}}class Fw extends Ea{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return zl(this,arguments,function*(){yield Je(yield*d_(Hh(this[Symbol.iterator]())))})}}class $w extends Ea{constructor(t){super(t),this._impl=t}readAll(){return Fe(this,void 0,void 0,function*(){var t,n,r,i;const o=new Array;try{for(var s=!0,a=Hh(this),l;l=yield a.next(),t=l.done,!t;s=!0){i=l.value,s=!1;const c=i;o.push(c)}}catch(c){n={error:c}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Dz extends Fw{constructor(t){super(t),this._impl=t}}class w1t extends $w{constructor(t){super(t),this._impl=t}}class Lz{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=on({type:new xo(this.schema.fields),length:t.length,children:r});return new Zo(this.schema,i)}_loadDictionaryBatch(t,n){const{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r),l=s.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 Sz(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class Bw extends Lz{constructor(t,n){super(n),this._reader=M4(t)?new b1t(this._handle=t):new Iz(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=$z(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),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Z6(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Pw extends Lz{constructor(t,n){super(n),this._reader=new v1t(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=$z(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),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Z6(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Fe(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Fz extends Bw{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 sO?t:new sO(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(Tn.RecordBatch);if(i?.isRecordBatch()){const o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}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(Tn.DictionaryBatch);if(i?.isDictionaryBatch()){const o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){const{_handle:t}=this,n=t.size-Oz,r=t.readInt32(n),i=t.readAt(n-r,r);return ky.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(Tn.RecordBatch);if(i?.isRecordBatch()){const o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}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(Tn.DictionaryBatch);if(i?.isDictionaryBatch()){const o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Fe(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const n=t.size-Oz,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return ky.decode(i)})}_readNextMessageAndValidate(t){return Fe(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?eC(t)?new Dz(new Fz(e.read())):new Fw(new Bw(e)):new Fw(new Bw(function*(){}()))}function k1t(e){return Fe(this,void 0,void 0,function*(){const t=yield e.peek(Ev+7&-8);return t&&t.byteLength>=4?eC(t)?new Dz(new Fz(yield e.read())):new $w(new Pw(e)):new $w(new Pw(function(){return zl(this,arguments,function*(){})}()))})}function M1t(e){return Fe(this,void 0,void 0,function*(){const{size:t}=yield e.stat(),n=new Lw(e,t);return t>=_1t&&eC(yield n.readAt(0,Ev+7&-8))?new w1t(new x1t(n)):new $w(new Pw(n))})}class jr extends rn{static assemble(...t){const n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Zo?o.data.children:o.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(!oe.isDictionary(n)){const{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(oe.isUnion(n))this.nodes.push(new $f(r,0));else{const{nullCount:i}=t;oe.isNull(n)||Xa.call(this,i<=0?new Uint8Array(0):Aw(t.offset,r,t.nullBitmap)),this.nodes.push(new $f(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 Xa(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new ql(this._byteLength,t)),this._byteLength+=t,this}function C1t(e){var t;const{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Xa.call(this,i),n.mode===eo.Sparse)return B4.call(this,e);if(n.mode===eo.Dense){if(e.offset<=0)return Xa.call(this,o),B4.call(this,e);{const s=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],p=l[f];return c.slice(h,Math.min(r,p))}))}}return this}function A1t(e){let t;return e.nullCount>=e.length?Xa.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Xa.call(this,Aw(e.offset,e.length,t)):Xa.call(this,Rw(e.values))}function Cu(e){return Xa.call(this,e.values.subarray(0,e.length*e.stride))}function eS(e){const{length:t,values:n,valueOffsets:r}=e,i=fr(r[0]),o=fr(r[t]),s=Math.min(o-i,n.byteLength-i);return Xa.call(this,jP(-i,t+1,r)),Xa.call(this,n.subarray(i,i+s)),this}function nC(e){const{length:t,valueOffsets:n}=e;if(n){const{[0]:r,[t]:i}=n;return Xa.call(this,jP(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function B4(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}jr.prototype.visitBool=A1t;jr.prototype.visitInt=Cu;jr.prototype.visitFloat=Cu;jr.prototype.visitUtf8=eS;jr.prototype.visitLargeUtf8=eS;jr.prototype.visitBinary=eS;jr.prototype.visitLargeBinary=eS;jr.prototype.visitFixedSizeBinary=Cu;jr.prototype.visitDate=Cu;jr.prototype.visitTimestamp=Cu;jr.prototype.visitTime=Cu;jr.prototype.visitDecimal=Cu;jr.prototype.visitList=nC;jr.prototype.visitStruct=B4;jr.prototype.visitUnion=C1t;jr.prototype.visitInterval=Cu;jr.prototype.visitDuration=Cu;jr.prototype.visitFixedSizeList=nC;jr.prototype.visitMap=nC;class Bz extends H6{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 __,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,is(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)):sg(t)?sC(this,t):oC(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 __?this._sink=t:(this._sink=new __,t&&syt(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ayt(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||!F4(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 Ff&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Zo&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!F4(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Zo?t instanceof Z6||this._writeRecordBatch(t):t instanceof Ff?this.writeAll(t.batches):_v(t)&&this.writeAll(t)}_writeMessage(t,n=8){const r=n-1,i=So.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,l=a-o-s;return t.headerType===Tn.RecordBatch?this._recordBatchBlocks.push(new Df(a,t.bodyLength,this._position)):t.headerType===Tn.DictionaryBatch&&this._dictionaryBlocks.push(new Df(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const n=pn(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(So.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(My)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=jr.assemble(t),s=new Fs(t.numRows,r,i),a=So.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){const{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=jr.assemble(new Ur([t])),l=new Fs(t.length,o,s),c=new ic(l,n,r),u=So.from(c,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){var n,r;for(const[i,o]of t.dictionaries){const s=(n=o?.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]!==s[0])for(const[c,u]of s.entries())this._writeDictionaryBatch(u,i,c>0);else if(lr.writeAll(i)):sg(t)?sC(r,t):oC(r,t)}}class iC extends Bz{static writeAll(t){const n=new iC;return dd(t)?t.then(r=>n.writeAll(r)):sg(t)?sC(n,t):oC(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=ky.encode(new ky(t,ni.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function oC(e,t){let n=t;t instanceof Ff&&(n=t.batches,e.reset(void 0,t.schema));for(const r of n)e.write(r);return e.finish()}function sC(e,t){return Fe(this,void 0,void 0,function*(){var n,r,i,o,s,a,l;try{for(n=!0,r=Hh(t);i=yield r.next(),o=i.done,!o;n=!0){l=i.value,n=!1;const c=l;e.write(c)}}catch(c){s={error:c}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function R1t(e,t="stream"){return(t==="stream"?rC:iC).writeAll(e).toUint8Array(!0)}var N1t=Object.create,Pz=Object.defineProperty,I1t=Object.getOwnPropertyDescriptor,O1t=Object.getOwnPropertyNames,D1t=Object.getPrototypeOf,L1t=Object.prototype.hasOwnProperty,F1t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$1t=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of O1t(t))!L1t.call(e,i)&&i!==n&&Pz(e,i,{get:()=>t[i],enumerable:!(r=I1t(t,i))||r.enumerable});return e},B1t=(e,t,n)=>(n=e!=null?N1t(D1t(e)):{},$1t(!e||!e.__esModule?Pz(n,"default",{value:e,enumerable:!0}):n,e)),P1t=F1t((e,t)=>{t.exports=Worker}),U1t=(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))(U1t||{}),z1t=(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))(z1t||{}),q1t=(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))(q1t||{}),j1t=(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))(j1t||{}),V1t=(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))(V1t||{}),W1t=(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))(W1t||{}),Uz=class{log(t){}},zz=class{constructor(t=2){this.level=t}log(t){t.level>=this.level&&console.log(t)}},Y1t=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(Y1t||{}),H1t=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=Ea.from(n);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Ff(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 qz(this._bindings,this._conn,n),i=await Ea.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 G1t(this._bindings,this._conn,n)}async insertArrowTable(t,n){let r=R1t(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)}},qz=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}},G1t=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Ea.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new Ff(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new qz(this.bindings,this.connectionId,t),r=await Ea.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},X1t=(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))(X1t||{}),J1t=(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))(J1t||{}),wn=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function S_(e){switch(e.typeId){case K.Binary:return{sqlType:"binary"};case K.Bool:return{sqlType:"bool"};case K.Date:return{sqlType:"date"};case K.DateDay:return{sqlType:"date32[d]"};case K.DateMillisecond:return{sqlType:"date64[ms]"};case K.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case K.Float:return{sqlType:"float"};case K.Float16:return{sqlType:"float16"};case K.Float32:return{sqlType:"float32"};case K.Float64:return{sqlType:"float64"};case K.Int:return{sqlType:"int32"};case K.Int16:return{sqlType:"int16"};case K.Int32:return{sqlType:"int32"};case K.Int64:return{sqlType:"int64"};case K.Uint16:return{sqlType:"uint16"};case K.Uint32:return{sqlType:"uint32"};case K.Uint64:return{sqlType:"uint64"};case K.Uint8:return{sqlType:"uint8"};case K.IntervalDayTime:return{sqlType:"interval[dt]"};case K.IntervalYearMonth:return{sqlType:"interval[m]"};case K.List:return{sqlType:"list",valueType:S_(e.valueType)};case K.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case K.Null:return{sqlType:"null"};case K.Utf8:return{sqlType:"utf8"};case K.Struct:return{sqlType:"struct",fields:e.children.map(t=>P4(t.name,t.type))};case K.Map:{let t=e;return{sqlType:"map",keyType:S_(t.keyType),valueType:S_(t.valueType)}}case K.Time:return{sqlType:"time[s]"};case K.TimeMicrosecond:return{sqlType:"time[us]"};case K.TimeMillisecond:return{sqlType:"time[ms]"};case K.TimeNanosecond:return{sqlType:"time[ns]"};case K.TimeSecond:return{sqlType:"time[s]"};case K.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case K.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case K.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case K.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case K.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function P4(e,t){let n=S_(t);return n.name=e,n}var K1t=new TextEncoder,jz=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 o of this._onInstantiationProgress)o(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 o=new Error(r.data.message);o.name=r.data.name,(n=Object.getOwnPropertyDescriptor(o,"stack"))!=null&&n.writable&&(o.stack=r.data.stack),i.promiseRejecter(o);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 wn("RESET",null);return await this.postTask(t)}async ping(){let t=new wn("PING",null);await this.postTask(t)}async dropFile(t){let n=new wn("DROP_FILE",t);return await this.postTask(n)}async dropFiles(){let t=new wn("DROP_FILES",null);return await this.postTask(t)}async flushFiles(){let t=new wn("FLUSH_FILES",null);return await this.postTask(t)}async instantiate(t,n=null,r=i=>{}){this._onInstantiationProgress.push(r);let i=new wn("INSTANTIATE",[t,n]);return await this.postTask(i)}async getVersion(){let t=new wn("GET_VERSION",null);return await this.postTask(t)}async getFeatureFlags(){let t=new wn("GET_FEATURE_FLAGS",null);return await this.postTask(t)}async open(t){let n=new wn("OPEN",t);await this.postTask(n)}async tokenize(t){let n=new wn("TOKENIZE",t);return await this.postTask(n)}async connectInternal(){let t=new wn("CONNECT",null);return await this.postTask(t)}async connect(){let t=await this.connectInternal();return new H1t(this,t)}async disconnect(t){let n=new wn("DISCONNECT",t);await this.postTask(n)}async runQuery(t,n){let r=new wn("RUN_QUERY",[t,n]);return await this.postTask(r)}async startPendingQuery(t,n){let r=new wn("START_PENDING_QUERY",[t,n]);return await this.postTask(r)}async pollPendingQuery(t){let n=new wn("POLL_PENDING_QUERY",t);return await this.postTask(n)}async cancelPendingQuery(t){let n=new wn("CANCEL_PENDING_QUERY",t);return await this.postTask(n)}async fetchQueryResults(t){let n=new wn("FETCH_QUERY_RESULTS",t);return await this.postTask(n)}async getTableNames(t,n){let r=new wn("GET_TABLE_NAMES",[t,n]);return await this.postTask(r)}async createPrepared(t,n){let r=new wn("CREATE_PREPARED",[t,n]);return await this.postTask(r)}async closePrepared(t,n){let r=new wn("CLOSE_PREPARED",[t,n]);await this.postTask(r)}async runPrepared(t,n,r){let i=new wn("RUN_PREPARED",[t,n,r]);return await this.postTask(i)}async sendPrepared(t,n,r){let i=new wn("SEND_PREPARED",[t,n,r]);return await this.postTask(i)}async globFiles(t){let n=new wn("GLOB_FILE_INFOS",t);return await this.postTask(n)}async registerFileText(t,n){let r=K1t.encode(n);await this.registerFileBuffer(t,r)}async registerFileURL(t,n,r,i){n===void 0&&(n=t);let o=new wn("REGISTER_FILE_URL",[t,n,r,i]);await this.postTask(o)}async registerEmptyFileBuffer(t){}async registerFileBuffer(t,n){let r=new wn("REGISTER_FILE_BUFFER",[t,n]);await this.postTask(r,[n.buffer])}async registerFileHandle(t,n,r,i){let o=new wn("REGISTER_FILE_HANDLE",[t,n,r,i]);await this.postTask(o,[])}async collectFileStatistics(t,n){let r=new wn("COLLECT_FILE_STATISTICS",[t,n]);await this.postTask(r,[])}async exportFileStatistics(t){let n=new wn("EXPORT_FILE_STATISTICS",t);return await this.postTask(n,[])}async copyFileToBuffer(t){let n=new wn("COPY_FILE_TO_BUFFER",t);return await this.postTask(n)}async copyFileToPath(t,n){let r=new wn("COPY_FILE_TO_PATH",[t,n]);await this.postTask(r)}async insertArrowFromIPCStream(t,n,r){if(n.length==0)return;let i=new wn("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 o=[];for(let s in r.columns){let a=r.columns[s];o.push(P4(s,a))}r.columnsFlat=o,delete r.columns}let i=new wn("IMPORT_CSV_FROM_PATH",[t,n,r]);await this.postTask(i)}async insertJSONFromPath(t,n,r){if(r.columns!==void 0){let o=[];for(let s in r.columns){let a=r.columns[s];o.push(P4(s,a))}r.columnsFlat=o,delete r.columns}let i=new wn("IMPORT_JSON_FROM_PATH",[t,n,r]);await this.postTask(i)}},Z1t=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])),Q1t=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])),tbt=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])),ebt=()=>(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])),aC={name:"@duckdb/duckdb-wasm",version:"1.29.0"},nbt=aC.name,rbt=aC.version,lC=aC.version.split(".");lC[0];lC[1];lC[2];var ibt=()=>typeof navigator>"u";function obt(){let e="https://cdn.jsdelivr.net/npm/".concat(nbt,"@").concat(rbt,"/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 fT=null,hT=null,dT=null,pT=null,gT=null;async function sbt(){return fT==null&&(fT=typeof BigInt64Array<"u"),hT==null&&(hT=await Q1t()),dT==null&&(dT=await ebt()),pT==null&&(pT=await tbt()),gT==null&&(gT=await Z1t()),{bigInt64Array:fT,crossOriginIsolated:ibt()||globalThis.crossOriginIsolated||!1,wasmExceptions:hT,wasmSIMD:pT,wasmThreads:dT,wasmBulkMemory:gT}}async function Vz(e){let t=await sbt();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}}B1t(P1t());function abt(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}abt();var lbt=(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))(lbt||{});function cbt(e={}){return new ubt(e)}class ubt{constructor(t={}){const{ipc:n,duckdb:r,connection:i,...o}=t;this._ipc=n,this._options=o,this._db=r,this._con=i,this._loadPromise}async getDuckDB(){return this._db||await mO(this),this._db}async getConnection(){return this._con||await mO(this),this._con}async query(t){const{type:n,sql:r}=t,i=await this.getConnection(),o=await fbt(i,r);return n==="exec"?void 0:n==="arrow"?rw(o,this._ipc):rw(o).toArray()}}function fbt(e,t){return new Promise((n,r)=>{e.useUnsafe(async(i,o)=>{try{const s=await i.runQuery(o,t);n(s)}catch(s){r(s)}})})}function mO(e){return e._loadPromise||(e._loadPromise=(e._db?Promise.resolve(e._db):hbt(e._options).then(t=>e._db=t)).then(t=>t.connect()).then(t=>e._con=t)),e._loadPromise}async function hbt({log:e=!1}={}){const t=obt(),n=await Vz(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new zz:new Uz,s=new jz(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function Uw(e,t,{source:n,clients:r=n?new Set([n]):void 0}){const i=t!==void 0?fd(e,[ne(t)]):null;return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function nS(e,t,{source:n,clients:r=n?new Set([n]):void 0}){let i=null;if(t){const o=t.length&&e.length===1?[fd(e[0],t.map(s=>ne(s[0])))]:t.map(s=>Ci(s.map((a,l)=>A6(e[l],ne(a)))));i=t.length===0?ne(!1):o.length>1?Eo(o):o[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function cC(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scale:o,pixelSize:s=1}){const a=t!=null?To(e,t):null;return{meta:{type:"interval",scales:o&&[o],bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function dbt(e,t,{source:n,clients:r=n?new Set([n]):void 0,bin:i,scales:o=[],pixelSize:s=1}){const a=t!=null?Ci(e.map((c,u)=>To(c,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}const pbt={contains:wgt,prefix:xgt,suffix:Sgt,regexp:_gt};function gbt(e,t,{source:n,clients:r=void 0,method:i="contains"}){let o=pbt[i];const s=t?o(e,ne(t)):null;return{meta:{type:"match",method:i},source:n,clients:r,value:t,predicate:s}}function mbt(e){return typeof e?.getChild=="function"}function ybt(){const e=new Set;let t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}function gd(e){return mbt(e)?vbt(e):bbt(e)}function vbt(e){const{numRows:t}=e;return{numRows:t,columns:e.toColumns()}}function bbt(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(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}function Wz(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 _bt="count",wbt="nulls",xbt="max",Sbt="min",Ebt="distinct",Tbt={[_bt]:er,[Ebt]:e=>er(e).distinct(),[xbt]:Ma,[Sbt]:tl,[wbt]:e=>er().where(Ga(e))};function kbt({table:e,column:t,stats:n}){return qt.from(e).select(Array.from(n,r=>({[r]:Tbt[r](t)})))}async function uC(e,t){return t.length===1&&t[0].column==="*"?Cbt(e,t[0].table):(await Promise.all(t.map(n=>Mbt(e,n)))).filter(n=>n)}async function Mbt(e,{table:t,column:n,stats:r}){const i=qt.from({source:t}).select({column:n}).groupby(mu(n)&&Qf(n)?ee`ALL`:[]),[o]=Array.from(await e.query(qt.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:Wz(o.column_type),nullable:o.null==="YES"};if(!r?.length)return s;const[a]=await e.query(kbt({table:t,column:n,stats:r}),{persist:!0});return Object.assign(s,a)}async function Cbt(e,t){return Array.from(await e.query(`DESCRIBE ${k6(t)}`)).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:Wz(r.column_type),nullable:r.null==="YES"}))}var Abt=(e,t)=>{t.onClick?.()},Rbt=St(" "),Nbt=St("");function da(e,t){Ne(t,!0);let n=ae(t,"label",3,null),r=ae(t,"icon",3,null),i=ae(t,"title",3,""),o=ae(t,"order",3,null),s=ae(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=Nbt();l.__click=[Abt,t];let c;var u=ot(l);{var f=g=>{var y=pr();const v=ht(r);var b=re(y);py(b,()=>w(v),(_,S)=>{S(_,{class:"w-5 h-5"})}),rt(g,y)};Ft(u,g=>{r()!=null&&g(f)})}var h=mt(u,2);{var p=g=>{var y=Rbt();let v;var b=ot(y,!0);et(y),At(_=>{v=nr(y,1,"",null,v,_),ce(b,n())},[()=>({"ml-1":r()!=null})]),rt(g,y)};Ft(h,g=>{n()!=null&&n()!=""&&g(p)})}et(l),At(()=>{nr(l,1,`rounded-md px-1.5 py-1.5 h-[28px] flex select-none items-center border ${a[s()]??""} ${t.class??""??""}`),ct(l,"title",i()),c=Ce(l,"",c,{order:o()})}),rt(e,l),Ie()}Fr(["click"]);var Ibt=(e,t,n)=>t(n),Obt=St(''),Dbt=St('
    '),Lbt=St('
    ');function yO(e,t){Ne(t,!0);let n=ae(t,"value",3,""),r=ae(t,"options",19,()=>[]),i,o,s=_t(!1),a=ht(()=>n()!=null&&r()!=null?r().filter(g=>g.toLowerCase().includes(n().toLowerCase())):r()??[]);function l(g){t.onChange?.(g)}function c(g){l(g),Y(s,!1)}var u=Lbt(),f=ot(u);JB(f),f.__change=()=>l(i.value??""),f.__input=()=>l(i.value??""),rs(f,g=>i=g,()=>i);var h=mt(f,2);{var p=g=>{var y=Dbt();Sn(y,20,()=>w(a),v=>v,(v,b)=>{var _=Obt();_.__click=[Ibt,c,b];var S=ot(_,!0);et(_),At(()=>ce(S,b)),rt(v,_)}),et(y),rt(g,y)};Ft(h,g=>{w(s)&&w(a).length>0&&g(p)})}et(u),rs(u,g=>o=g,()=>o),At(()=>{nr(u,1,`relative ${t.className??""??""}`),ct(f,"placeholder",t.placeholder),Wht(f,n())}),Jp("focus",f,()=>Y(s,!0)),Jp("blur",f,g=>{g.relatedTarget&&g.relatedTarget instanceof Node&&o.contains(g.relatedTarget)||Y(s,!1)}),rt(e,u),Ie()}Fr(["change","input","click"]);const Fbt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let fC=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Fbt[n[e]&63];return t};function vO(e,t,n,r){!t()||!w(n)||t()(r(w(n).value))}var $bt=St(""),Bbt=St("
    "),Pbt=St(""),Ubt=St(''),zbt=St(""),qbt=St("
    "),jbt=St(""),Vbt=St("");function pa(e,t){Ne(t,!0);let n=ae(t,"label",3,void 0),r=ae(t,"disabled",3,!1),i=ae(t,"placeholder",3,null),o=ae(t,"options",19,()=>[]),s=ae(t,"onChange",3,void 0),a=_t(void 0);const l=fC(),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 p=pr(),g=re(p);{var y=b=>{var _=Ubt(),S=ot(_),x=ot(S,!0);et(S);var T=mt(S,2);const k=ht(()=>f(t.value));f4(T,()=>w(k));var M;T.__change=[vO,s,a,h];var C=ot(T);{var R=N=>{var L=$bt();L.value=(L.__value=null)??"";var $=ot(L,!0);et(L),At(()=>ce($,i())),rt(N,L)};Ft(C,N=>{i()!=null&&N(R)})}var O=mt(C);Sn(O,17,o,Fn,(N,L)=>{var $=pr(),I=re($);{var F=P=>{var z=Bbt();rt(P,z)},D=P=>{var z=Pbt(),q={},U=ot(z,!0);et(z),At(V=>{q!==(q=V)&&(z.value=(z.__value=V)??""),ce(U,w(L).label)},[()=>f(w(L).value)]),rt(P,z)};Ft(I,P=>{w(L)==="---"?P(F):P(D,!1)})}rt(N,$)}),et(T),rs(T,N=>Y(a,N),()=>w(a)),et(_),At(()=>{ce(x,n()),nr(T,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??""??""}`),M!==(M=w(k))&&(T.value=(T.__value=w(k))??"",gy(T,w(k))),T.disabled=r()}),rt(b,_)},v=b=>{var _=Vbt();const S=ht(()=>f(t.value));f4(_,()=>w(S));var x;_.__change=[vO,s,a,h];var T=ot(_);{var k=C=>{var R=zbt();R.value=(R.__value=null)??"";var O=ot(R,!0);et(R),At(()=>ce(O,i())),rt(C,R)};Ft(T,C=>{i()!=null&&C(k)})}var M=mt(T);Sn(M,17,o,Fn,(C,R)=>{var O=pr(),N=re(O);{var L=I=>{var F=qbt();rt(I,F)},$=I=>{var F=jbt(),D={},P=ot(F,!0);et(F),At(z=>{D!==(D=z)&&(F.value=(F.__value=z)??""),ce(P,w(R).label)},[()=>f(w(R).value)]),rt(I,F)};Ft(N,I=>{w(R)==="---"?I(L):I($,!1)})}rt(C,O)}),et(_),rs(_,C=>Y(a,C),()=>w(a)),At(()=>{nr(_,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??""??""}`),x!==(x=w(S))&&(_.value=(_.__value=w(S))??"",gy(_,w(S))),_.disabled=r()}),rt(b,_)};Ft(g,b=>{n()!=null?b(y):b(v,!1)})}rt(e,p),Ie()}Fr(["change"]);function Wbt(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function zw(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 T0(e){return e=zw(Math.abs(e)),e?e[1]:NaN}function Ybt(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function Hbt(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Gbt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Cy(e){if(!(t=Gbt.exec(e)))throw new Error("invalid format: "+e);var t;return new hC({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]})}Cy.prototype=hC.prototype;function hC(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+""}hC.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 Xbt(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 Yz;function Jbt(e,t){var n=zw(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Yz=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+zw(e,Math.max(0,t+o-1))[0]}function bO(e,t){var n=zw(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 _O={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Wbt,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)=>bO(e*100,t),r:bO,s:Jbt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function wO(e){return e}var xO=Array.prototype.map,SO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Kbt(e){var t=e.grouping===void 0||e.thousands===void 0?wO:Ybt(xO.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+"",o=e.numerals===void 0?wO:Hbt(xO.call(e.numerals,String)),s=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=Cy(f);var h=f.fill,p=f.align,g=f.sign,y=f.symbol,v=f.zero,b=f.width,_=f.comma,S=f.precision,x=f.trim,T=f.type;T==="n"?(_=!0,T="g"):_O[T]||(S===void 0&&(S=12),x=!0,T="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var k=y==="$"?n:y==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",M=y==="$"?r:/[%p]/.test(T)?s:"",C=_O[T],R=/[defgprs%]/.test(T);S=S===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function O(N){var L=k,$=M,I,F,D;if(T==="c")$=C(N)+$,N="";else{N=+N;var P=N<0||1/N<0;if(N=isNaN(N)?l:C(Math.abs(N),S),x&&(N=Xbt(N)),P&&+N==0&&g!=="+"&&(P=!1),L=(P?g==="("?g:a:g==="-"||g==="("?"":g)+L,$=(T==="s"?SO[8+Yz/3]:"")+$+(P&&g==="("?")":""),R){for(I=-1,F=N.length;++ID||D>57){$=(D===46?i+N.slice(I+1):N.slice(I))+$,N=N.slice(0,I);break}}}_&&!v&&(N=t(N,1/0));var z=L.length+N.length+$.length,q=z>1)+L+N+$+q.slice(z);break;default:N=q+L+N+$;break}return o(N)}return O.toString=function(){return f+""},O}function u(f,h){var p=c((f=Cy(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(T0(h)/3)))*3,y=Math.pow(10,-g),v=SO[8+g/3];return function(b){return p(y*b)+v}}return{format:c,formatPrefix:u}}var bb,Oa,Hz;Zbt({thousands:",",grouping:[3],currency:["$",""]});function Zbt(e){return bb=Kbt(e),Oa=bb.format,Hz=bb.formatPrefix,bb}function Qbt(e){return Math.max(0,-T0(Math.abs(e)))}function t_t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(T0(t)/3)))*3-T0(Math.abs(e)))}function e_t(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,T0(t)-T0(e))+1}function Un(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function md(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function rS(e){let t,n,r;e.length!==2?(t=Un,n=(a,l)=>Un(e(a),l),r=(a,l)=>e(a)-l):(t=e===Un||e===md?e:n_t,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:s,right:o}}function n_t(){return 0}function Gz(e){return e===null?NaN:+e}function*r_t(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 i_t=rS(Un),iS=i_t.right;rS(Gz).center;const Xz=Jz(Kz),o_t=Jz(s_t);function Jz(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:o,height:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;const a=n&&e(n),l=r&&e(r),c=i.slice();return a&&l?(pp(a,c,i,o,s),pp(a,i,c,o,s),pp(a,c,i,o,s),gp(l,i,c,o,s),gp(l,c,i,o,s),gp(l,i,c,o,s)):a?(pp(a,i,c,o,s),pp(a,c,i,o,s),pp(a,i,c,o,s)):l&&(gp(l,i,c,o,s),gp(l,c,i,o,s),gp(l,i,c,o,s)),t}}function pp(e,t,n,r,i){for(let o=0,s=r*i;o{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function Kz(e){const t=Math.floor(e);if(t===e)return a_t(e);const n=e-t,r=2*e+1;return(i,o,s,a,l)=>{if(!((a-=l)>=s))return;let c=t*o[s];const u=l*t,f=u+l;for(let h=s,p=s+u;h{if(!((o-=s)>=i))return;let a=e*r[i];const l=s*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 l_t(e){return e.length|0}function c_t(e){return!(e>0)}function u_t(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function f_t(e){return t=>e(...t)}function h_t(...e){const t=typeof e[e.length-1]=="function"&&f_t(e.pop());e=e.map(u_t);const n=e.map(l_t),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(c_t))return o;for(;;){o.push(i.map((a,l)=>e[l][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function d_t(e,t){var n=0;return Float64Array.from(e,r=>n+=+r||0)}function dC(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function Tv(e,t){const n=dC(e,t);return n&&Math.sqrt(n)}function di(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=o&&(n=r=o):(n>o&&(n=o),r0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}}class yd extends Map{constructor(t,n=tq){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(U4(this,t))}has(t){return super.has(U4(this,t))}set(t,n){return super.set(Zz(this,t),n)}delete(t){return super.delete(Qz(this,t))}}class lg extends Set{constructor(t,n=tq){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(U4(this,t))}add(t){return super.add(Zz(this,t))}delete(t){return super.delete(Qz(this,t))}}function U4({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Zz({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Qz({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function tq(e){return e!==null&&typeof e=="object"?e.valueOf():e}function z4(e){return e}function eh(e,...t){return pC(e,z4,z4,t)}function r0(e,t,...n){return pC(e,z4,t,n)}function p_t(e,t,...n){return pC(e,Array.from,t,n)}function pC(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);const a=new yd,l=r[s++];let c=-1;for(const u of o){const f=l(u,++c,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function g_t(e,t){return Array.from(t,n=>e[n])}function qw(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,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(const s of t){const a=Ay(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Ay(n[i],n[o]))),g_t(e,r)}return e.sort(gC(n))}function gC(e=Un){if(e===Un)return Ay;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 Ay(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function mC(e,t,n){return(t.length!==2?qw(r0(e,t,n),([r,i],[o,s])=>Un(i,s)||Un(r,o)):qw(eh(e,n),([r,i],[o,s])=>t(i,s)||Un(r,o))).map(([r])=>r)}const m_t=Math.sqrt(50),y_t=Math.sqrt(10),v_t=Math.sqrt(2);function jw(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=m_t?10:o>=y_t?5:o>=v_t?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/s,a=Math.round(e*c),l=Math.round(t*c),a/ct&&--l,c=-c):(c=Math.pow(10,i)*s,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=o-i+1,l=new Array(a);if(r)if(s<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 yC(e){return Math.max(1,Math.ceil(Math.log(oS(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 b_t(e,t){let n,r=-1,i=-1;if(t===void 0)for(const o of e)++i,o!=null&&(n=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n=o)&&(n=o,r=i);return r}function Dr(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 __t(e,t){let n,r=-1,i=-1;if(t===void 0)for(const o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function nq(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?Ay:gC(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),p=Math.max(n,Math.floor(t-c*f/l+h)),g=Math.min(r,Math.floor(t+(l-c)*f/l+h));nq(e,t,p,g,i)}const o=e[t];let s=n,a=r;for(tm(e,n,t),i(e[r],o)>0&&tm(e,n,r);s0;)--a}i(e[n],o)===0?tm(e,n,a):(++a,tm(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function tm(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function vC(e,t=Un){let n,r=!1;if(t.length===1){let i;for(const o of e){const s=t(o);(r?Un(s,i)>0:Un(s,s)===0)&&(n=o,i=s,r=!0)}}else for(const i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Pf(e,t,n){if(e=Float64Array.from(r_t(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Dr(e);if(t>=1)return Vr(e);var r,i=(r-1)*t,o=Math.floor(i),s=Vr(nq(e,o).subarray(0,o+1)),a=Dr(e.subarray(o+1));return s+(a-s)*(i-o)}}function w_t(e,t,n=Gz){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,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function x_t(e,t,n){const r=oS(e),i=Pf(e,.75)-Pf(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function rq(e,t,n){const r=oS(e),i=Tv(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function sS(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 o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Ny(e,t){return Pf(e,.5,t)}function*S_t(e){for(const t of e)yield*t}function iq(e){return Array.from(S_t(e))}function oq(e,t){const n=new yd;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(const[o,s]of n)s>i&&(i=s,r=o);return r}function E_t(e,t=T_t){const n=[];let r,i=!1;for(const o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function T_t(e,t){return[e,t]}function Cs(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,o=new Array(i);++rt(n[a],n[l]);let o,s;return e=Uint32Array.from(n,(a,l)=>l),e.sort(t===Un?(a,l)=>Ay(n[a],n[l]):gC(i)),e.forEach((a,l)=>{const c=i(a,o===void 0?a:o);c>=0?((o===void 0||c>0)&&(o=a,s=l),r[a]=s):r[a]=NaN}),r}function k_t(e,t=Un){let n,r=!1;if(t.length===1){let i;for(const o of e){const s=t(o);(r?Un(s,i)<0:Un(s,s)===0)&&(n=o,i=s,r=!0)}}else for(const i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function el(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 Vw(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 aS(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 j4=Symbol("implicit");function bC(){var e=new yd,t=[],n=[],r=j4;function i(o){let s=e.get(o);if(s===void 0){if(r!==j4)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new yd;for(const s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return bC(t,n).unknown(r)},mc.apply(i,arguments),i}function kv(){var e=bC().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,l=0,c=0,u=.5;delete e.unknown;function f(){var h=t().length,p=i>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?_b(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?_b(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=A_t.exec(e))?new Mi(t[1],t[2],t[3],1):(t=R_t.exec(e))?new Mi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=N_t.exec(e))?_b(t[1],t[2],t[3],t[4]):(t=I_t.exec(e))?_b(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=O_t.exec(e))?RO(t[1],t[2]/100,t[3]/100,1):(t=D_t.exec(e))?RO(t[1],t[2]/100,t[3]/100,t[4]):EO.hasOwnProperty(e)?MO(EO[e]):e==="transparent"?new Mi(NaN,NaN,NaN,0):null}function MO(e){return new Mi(e>>16&255,e>>8&255,e&255,1)}function _b(e,t,n,r){return r<=0&&(e=t=n=NaN),new Mi(e,t,n,r)}function _C(e){return e instanceof nh||(e=Uf(e)),e?(e=e.rgb(),new Mi(e.r,e.g,e.b,e.opacity)):new Mi}function ss(e,t,n,r){return arguments.length===1?_C(e):new Mi(e,t,n,r??1)}function Mi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cg(Mi,ss,Mv(nh,{brighter(e){return e=e==null?k0:Math.pow(k0,e),new Mi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vd:Math.pow(vd,e),new Mi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mi(Gh(this.r),Gh(this.g),Gh(this.b),Ww(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:CO,formatHex:CO,formatHex8:$_t,formatRgb:AO,toString:AO}));function CO(){return`#${Uh(this.r)}${Uh(this.g)}${Uh(this.b)}`}function $_t(){return`#${Uh(this.r)}${Uh(this.g)}${Uh(this.b)}${Uh((isNaN(this.opacity)?1:this.opacity)*255)}`}function AO(){const e=Ww(this.opacity);return`${e===1?"rgb(":"rgba("}${Gh(this.r)}, ${Gh(this.g)}, ${Gh(this.b)}${e===1?")":`, ${e})`}`}function Ww(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Gh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Uh(e){return e=Gh(e),(e<16?"0":"")+e.toString(16)}function RO(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new qa(e,t,n,r)}function lq(e){if(e instanceof qa)return new qa(e.h,e.s,e.l,e.opacity);if(e instanceof nh||(e=Uf(e)),!e)return new qa;if(e instanceof qa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new qa(s,a,l,e.opacity)}function V4(e,t,n,r){return arguments.length===1?lq(e):new qa(e,t,n,r??1)}function qa(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cg(qa,V4,Mv(nh,{brighter(e){return e=e==null?k0:Math.pow(k0,e),new qa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vd:Math.pow(vd,e),new qa(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 Mi(mT(e>=240?e-240:e+120,i,r),mT(e,i,r),mT(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new qa(NO(this.h),wb(this.s),wb(this.l),Ww(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=Ww(this.opacity);return`${e===1?"hsl(":"hsla("}${NO(this.h)}, ${wb(this.s)*100}%, ${wb(this.l)*100}%${e===1?")":`, ${e})`}`}}));function NO(e){return e=(e||0)%360,e<0?e+360:e}function wb(e){return Math.max(0,Math.min(1,e||0))}function mT(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 cq=Math.PI/180,uq=180/Math.PI,Yw=18,fq=.96422,hq=1,dq=.82521,pq=4/29,o0=6/29,gq=3*o0*o0,B_t=o0*o0*o0;function mq(e){if(e instanceof Xl)return new Xl(e.l,e.a,e.b,e.opacity);if(e instanceof Kc)return yq(e);e instanceof Mi||(e=_C(e));var t=_T(e.r),n=_T(e.g),r=_T(e.b),i=yT((.2225045*t+.7168786*n+.0606169*r)/hq),o,s;return t===n&&n===r?o=s=i:(o=yT((.4360747*t+.3850649*n+.1430804*r)/fq),s=yT((.0139322*t+.0971045*n+.7141733*r)/dq)),new Xl(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Hw(e,t,n,r){return arguments.length===1?mq(e):new Xl(e,t,n,r??1)}function Xl(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}cg(Xl,Hw,Mv(nh,{brighter(e){return new Xl(this.l+Yw*(e??1),this.a,this.b,this.opacity)},darker(e){return new Xl(this.l-Yw*(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=fq*vT(t),e=hq*vT(e),n=dq*vT(n),new Mi(bT(3.1338561*t-1.6168667*e-.4906146*n),bT(-.9787684*t+1.9161415*e+.033454*n),bT(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function yT(e){return e>B_t?Math.pow(e,1/3):e/gq+pq}function vT(e){return e>o0?e*e*e:gq*(e-pq)}function bT(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function _T(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function P_t(e){if(e instanceof Kc)return new Kc(e.h,e.c,e.l,e.opacity);if(e instanceof Xl||(e=mq(e)),e.a===0&&e.b===0)return new Kc(NaN,0=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r()=>e;function bq(e,t){return function(n){return e+n*t}}function j_t(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 SC(e,t){var n=t-e;return n?bq(e,n>180||n<-180?n-360*Math.round(n/360):n):cS(isNaN(e)?t:e)}function V_t(e){return(e=+e)==1?Ki:function(t,n){return n-t?j_t(t,n,e):cS(isNaN(t)?n:t)}}function Ki(e,t){var n=t-e;return n?bq(e,n):cS(isNaN(e)?t:e)}const bd=function e(t){var n=V_t(t);function r(i,o){var s=n((i=ss(i)).r,(o=ss(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),c=Ki(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r}(1);function W_t(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;sn&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Hi(r,i)})),n=wT.lastIndex;return n180?u+=360:u-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Hi(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:Hi(c,u)}):u&&f.push(i(f)+"skewX("+u+r)}function l(c,u,f,h,p,g){if(c!==f||u!==h){var y=p.push(i(p)+"scale(",null,",",null,")");g.push({i:y-4,x:Hi(c,f)},{i:y-2,x:Hi(u,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,u){var f=[],h=[];return c=e(c),u=e(u),o(c.translateX,c.translateY,u.translateX,u.translateY,f,h),s(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(p){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 gwt(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i2?mwt:gwt,l=c=null,f}function f(h){return h==null||isNaN(h=+h)?o:(l||(l=a(e.map(r),t,n)))(r(s(h)))}return f.invert=function(h){return s(i((c||(c=a(t,e.map(r),Hi)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,G4),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=EC,u()},f.clamp=function(h){return arguments.length?(s=h?!0:ma,u()):s!==ma},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,u()}}function Eq(){return fS()(ma,ma)}function ywt(e,t,n,r){var i=q4(e,t,n),o;switch(r=Cy(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=t_t(i,s))&&(r.precision=o),Hz(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=e_t(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=Qbt(i))&&(r.precision=o-(r.type==="%")*2);break}}return Oa(r)}function Av(e){var t=e.domain;return e.ticks=function(n){var r=t();return Bf(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return ywt(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],l,c,u=10;for(a0;){if(c=Ry(s,a,n),c===l)return r[i]=s,r[o]=a,t(r);if(c>0)s=Math.floor(s/c)*c,a=Math.ceil(a/c)*c;else if(c<0)s=Math.ceil(s*c)/c,a=Math.floor(a*c)/c;else break;l=c}return e},e}function Au(){var e=Eq();return e.copy=function(){return Cv(e,Au())},mc.apply(e,arguments),Av(e)}function Tq(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,G4),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Tq(e).unknown(t)},e=arguments.length?Array.from(e,G4):[0,1],Av(n)}function kq(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return oMath.pow(e,t)}function xwt(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 UO(e){return(t,n)=>-e(-t,n)}function Mq(e){const t=e(BO,PO),n=t.domain;let r=10,i,o;function s(){return i=xwt(r),o=wwt(r),n()[0]<0?(i=UO(i),o=UO(o),e(vwt,bwt)):e(BO,PO),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{const l=n();let c=l[0],u=l[l.length-1];const f=u0){for(;h<=p;++h)for(g=1;gu)break;b.push(y)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(y=h>0?g/o(-h):g*o(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=Cy(l)).precision==null&&(l.trim=!0),l=Oa(l)),a===1/0)return l;const c=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*rn(kq(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function M0(){const e=Mq(fS()).domain([1,10]);return e.copy=()=>Cv(e,M0()).base(e.base()),mc.apply(e,arguments),e}function zO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function qO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Cq(e){var t=1,n=e(zO(t),qO(t));return n.constant=function(r){return arguments.length?e(zO(t=+r),qO(t)):t},Av(n)}function kC(){var e=Cq(fS());return e.copy=function(){return Cv(e,kC()).constant(e.constant())},mc.apply(e,arguments)}function jO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Swt(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ewt(e){return e<0?-e*e:e*e}function Aq(e){var t=e(ma,ma),n=1;function r(){return n===1?e(ma,ma):n===.5?e(Swt,Ewt):e(jO(n),jO(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Av(t)}function Rq(){var e=Aq(fS());return e.copy=function(){return Cv(e,Rq()).exponent(e.exponent())},mc.apply(e,arguments),e}function Nq(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s0?n[a-1]:e[0],a(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const s=i(o),a=i.ceil(o);return o-s(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{const l=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o0))return l;let c;do l.push(c=new Date(+o)),t(o,a),e(o);while(cwi(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(xT.setTime(+o),ST.setTime(+s),e(xT),e(ST),Math.floor(n(xT,ST))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Gw=wi(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Gw.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?wi(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Gw);Gw.range;const Zc=1e3,ya=Zc*60,Qc=ya*60,vu=Qc*24,MC=vu*7,VO=vu*30,ET=vu*365,Wa=wi(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Zc)},(e,t)=>(t-e)/Zc,e=>e.getUTCSeconds());Wa.range;const Rv=wi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Zc)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getMinutes());Rv.range;const Nv=wi(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getUTCMinutes());Nv.range;const Iv=wi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Zc-e.getMinutes()*ya)},(e,t)=>{e.setTime(+e+t*Qc)},(e,t)=>(t-e)/Qc,e=>e.getHours());Iv.range;const Ov=wi(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Qc)},(e,t)=>(t-e)/Qc,e=>e.getUTCHours());Ov.range;const Dd=wi(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ya)/vu,e=>e.getDate()-1);Dd.range;const hS=wi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/vu,e=>e.getUTCDate()-1);hS.range;const dS=wi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/vu,e=>Math.floor(e/vu));dS.range;function Ld(e){return wi(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())*ya)/MC)}const C0=Ld(0),Dy=Ld(1),Oq=Ld(2),Dq=Ld(3),_d=Ld(4),Lq=Ld(5),Fq=Ld(6);C0.range;Dy.range;Oq.range;Dq.range;_d.range;Lq.range;Fq.range;function Fd(e){return wi(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)/MC)}const A0=Fd(0),Ly=Fd(1),$q=Fd(2),Bq=Fd(3),wd=Fd(4),Pq=Fd(5),Uq=Fd(6);A0.range;Ly.range;$q.range;Bq.range;wd.range;Pq.range;Uq.range;const Dv=wi(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());Dv.range;const Lv=wi(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());Lv.range;const rl=wi(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());rl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:wi(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)});rl.range;const il=wi(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());il.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:wi(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)});il.range;function zq(e,t,n,r,i,o){const s=[[Wa,1,Zc],[Wa,5,5*Zc],[Wa,15,15*Zc],[Wa,30,30*Zc],[o,1,ya],[o,5,5*ya],[o,15,15*ya],[o,30,30*ya],[i,1,Qc],[i,3,3*Qc],[i,6,6*Qc],[i,12,12*Qc],[r,1,vu],[r,2,2*vu],[n,1,MC],[t,1,VO],[t,3,3*VO],[e,1,ET]];function a(c,u,f){const h=uv).right(s,h);if(p===s.length)return e.every(q4(c/ET,u/ET,f));if(p===0)return Gw.every(Math.max(q4(c,u,f),1));const[g,y]=s[h/s[p-1][2]53)return null;"w"in st||(st.w=1),"Z"in st?(Dt=kT(em(st.y,0,1)),zt=Dt.getUTCDay(),Dt=zt>4||zt===0?Ly.ceil(Dt):Ly(Dt),Dt=hS.offset(Dt,(st.V-1)*7),st.y=Dt.getUTCFullYear(),st.m=Dt.getUTCMonth(),st.d=Dt.getUTCDate()+(st.w+6)%7):(Dt=TT(em(st.y,0,1)),zt=Dt.getDay(),Dt=zt>4||zt===0?Dy.ceil(Dt):Dy(Dt),Dt=Dd.offset(Dt,(st.V-1)*7),st.y=Dt.getFullYear(),st.m=Dt.getMonth(),st.d=Dt.getDate()+(st.w+6)%7)}else("W"in st||"U"in st)&&("w"in st||(st.w="u"in st?st.u%7:"W"in st?1:0),zt="Z"in st?kT(em(st.y,0,1)).getUTCDay():TT(em(st.y,0,1)).getDay(),st.m=0,st.d="W"in st?(st.w+6)%7+st.W*7-(zt+5)%7:st.w+st.U*7-(zt+6)%7);return"Z"in st?(st.H+=st.Z/100|0,st.M+=st.Z%100,kT(st)):TT(st)}}function C(nt,gt,vt,st){for(var Bt=0,Dt=gt.length,zt=vt.length,jt,Ct;Bt=zt)return-1;if(jt=gt.charCodeAt(Bt++),jt===37){if(jt=gt.charAt(Bt++),Ct=T[jt in WO?gt.charAt(Bt++):jt],!Ct||(st=Ct(nt,vt,st))<0)return-1}else if(jt!=vt.charCodeAt(st++))return-1}return st}function R(nt,gt,vt){var st=c.exec(gt.slice(vt));return st?(nt.p=u.get(st[0].toLowerCase()),vt+st[0].length):-1}function O(nt,gt,vt){var st=p.exec(gt.slice(vt));return st?(nt.w=g.get(st[0].toLowerCase()),vt+st[0].length):-1}function N(nt,gt,vt){var st=f.exec(gt.slice(vt));return st?(nt.w=h.get(st[0].toLowerCase()),vt+st[0].length):-1}function L(nt,gt,vt){var st=b.exec(gt.slice(vt));return st?(nt.m=_.get(st[0].toLowerCase()),vt+st[0].length):-1}function $(nt,gt,vt){var st=y.exec(gt.slice(vt));return st?(nt.m=v.get(st[0].toLowerCase()),vt+st[0].length):-1}function I(nt,gt,vt){return C(nt,t,gt,vt)}function F(nt,gt,vt){return C(nt,n,gt,vt)}function D(nt,gt,vt){return C(nt,r,gt,vt)}function P(nt){return s[nt.getDay()]}function z(nt){return o[nt.getDay()]}function q(nt){return l[nt.getMonth()]}function U(nt){return a[nt.getMonth()]}function V(nt){return i[+(nt.getHours()>=12)]}function G(nt){return 1+~~(nt.getMonth()/3)}function Z(nt){return s[nt.getUTCDay()]}function lt(nt){return o[nt.getUTCDay()]}function pt(nt){return l[nt.getUTCMonth()]}function dt(nt){return a[nt.getUTCMonth()]}function at(nt){return i[+(nt.getUTCHours()>=12)]}function yt(nt){return 1+~~(nt.getUTCMonth()/3)}return{format:function(nt){var gt=k(nt+="",S);return gt.toString=function(){return nt},gt},parse:function(nt){var gt=M(nt+="",!1);return gt.toString=function(){return nt},gt},utcFormat:function(nt){var gt=k(nt+="",x);return gt.toString=function(){return nt},gt},utcParse:function(nt){var gt=M(nt+="",!0);return gt.toString=function(){return nt},gt}}}var WO={"-":"",_:" ",0:"0"},Ai=/^\s*\d+/,Awt=/^%/,Rwt=/[\\^$*+?|[\]().{}]/g;function kn(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o[t.toLowerCase(),n]))}function Iwt(e,t,n){var r=Ai.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Owt(e,t,n){var r=Ai.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Dwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Lwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Fwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function YO(e,t,n){var r=Ai.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function HO(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function $wt(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 Bwt(e,t,n){var r=Ai.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Pwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function GO(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Uwt(e,t,n){var r=Ai.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function XO(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function zwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function qwt(e,t,n){var r=Ai.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function jwt(e,t,n){var r=Ai.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Vwt(e,t,n){var r=Ai.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Wwt(e,t,n){var r=Awt.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Ywt(e,t,n){var r=Ai.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Hwt(e,t,n){var r=Ai.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function JO(e,t){return kn(e.getDate(),t,2)}function Gwt(e,t){return kn(e.getHours(),t,2)}function Xwt(e,t){return kn(e.getHours()%12||12,t,2)}function Jwt(e,t){return kn(1+Dd.count(rl(e),e),t,3)}function jq(e,t){return kn(e.getMilliseconds(),t,3)}function Kwt(e,t){return jq(e,t)+"000"}function Zwt(e,t){return kn(e.getMonth()+1,t,2)}function Qwt(e,t){return kn(e.getMinutes(),t,2)}function txt(e,t){return kn(e.getSeconds(),t,2)}function ext(e){var t=e.getDay();return t===0?7:t}function nxt(e,t){return kn(C0.count(rl(e)-1,e),t,2)}function Vq(e){var t=e.getDay();return t>=4||t===0?_d(e):_d.ceil(e)}function rxt(e,t){return e=Vq(e),kn(_d.count(rl(e),e)+(rl(e).getDay()===4),t,2)}function ixt(e){return e.getDay()}function oxt(e,t){return kn(Dy.count(rl(e)-1,e),t,2)}function sxt(e,t){return kn(e.getFullYear()%100,t,2)}function axt(e,t){return e=Vq(e),kn(e.getFullYear()%100,t,2)}function lxt(e,t){return kn(e.getFullYear()%1e4,t,4)}function cxt(e,t){var n=e.getDay();return e=n>=4||n===0?_d(e):_d.ceil(e),kn(e.getFullYear()%1e4,t,4)}function uxt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+kn(t/60|0,"0",2)+kn(t%60,"0",2)}function KO(e,t){return kn(e.getUTCDate(),t,2)}function fxt(e,t){return kn(e.getUTCHours(),t,2)}function hxt(e,t){return kn(e.getUTCHours()%12||12,t,2)}function dxt(e,t){return kn(1+hS.count(il(e),e),t,3)}function Wq(e,t){return kn(e.getUTCMilliseconds(),t,3)}function pxt(e,t){return Wq(e,t)+"000"}function gxt(e,t){return kn(e.getUTCMonth()+1,t,2)}function mxt(e,t){return kn(e.getUTCMinutes(),t,2)}function yxt(e,t){return kn(e.getUTCSeconds(),t,2)}function vxt(e){var t=e.getUTCDay();return t===0?7:t}function bxt(e,t){return kn(A0.count(il(e)-1,e),t,2)}function Yq(e){var t=e.getUTCDay();return t>=4||t===0?wd(e):wd.ceil(e)}function _xt(e,t){return e=Yq(e),kn(wd.count(il(e),e)+(il(e).getUTCDay()===4),t,2)}function wxt(e){return e.getUTCDay()}function xxt(e,t){return kn(Ly.count(il(e)-1,e),t,2)}function Sxt(e,t){return kn(e.getUTCFullYear()%100,t,2)}function Ext(e,t){return e=Yq(e),kn(e.getUTCFullYear()%100,t,2)}function Txt(e,t){return kn(e.getUTCFullYear()%1e4,t,4)}function kxt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?wd(e):wd.ceil(e),kn(e.getUTCFullYear()%1e4,t,4)}function Mxt(){return"+0000"}function ZO(){return"%"}function QO(e){return+e}function tD(e){return Math.floor(+e/1e3)}var mp,CC,Fv;Cxt({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 Cxt(e){return mp=Cwt(e),CC=mp.format,mp.parse,Fv=mp.utcFormat,mp.utcParse,mp}function Axt(e){return new Date(e)}function Rxt(e){return e instanceof Date?+e:+new Date(+e)}function AC(e,t,n,r,i,o,s,a,l,c){var u=Eq(),f=u.invert,h=u.domain,p=c(".%L"),g=c(":%S"),y=c("%I:%M"),v=c("%I %p"),b=c("%a %d"),_=c("%b %d"),S=c("%B"),x=c("%Y");function T(k){return(l(k)e,forward:e=>e,reverse:e=>e},log:{type:"log",expr:e=>Xo(fa(e,0),mP(e),ne("nan")),forward:e=>Math.log10(e),reverse:e=>Math.pow(10,e)},symlog:{type:"symlog",expr:(e,t)=>ze(yu(e),Zp(Hn(1,po(ur(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 Oxt(e,t){let n=e,r=1/0;for(let i of t){let o=Math.abs(e-i);o=100&&n>=0&&i0?"log":"symlog")),n<=0&&s=="log"&&(r<=0?(n=1,r=10):n=Math.min(e.minPositive,r/10));let a=t.desiredCount??5;switch(s){case"linear":{let l=Au().domain([n,r]).nice(a),c=l.ticks(a);return{scale:{...im.linear,domain:l.domain()},binStart:l.domain()[0],binSize:c[1]-c[0]}}case"log":{let l=M0().domain([n,r]).nice(),c=Math.log10(l.domain()[0]),u=(Math.log10(l.domain()[1])-c)/a;return u=Oxt(u,[.05,.1,.2,.5,1,1.5,2]),{scale:{...im.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=im.symlog.forward(n,c),f=im.symlog.forward(r,c);return{scale:{...im.symlog,domain:[n,r],constant:c},binStart:u,binSize:(f-u)/a}}default:throw new Error("invalid scale type")}}function We(e){for(var t=e.length/6|0,n=new Array(t),r=0;rY_t(e[e.length-1]);var Zq=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(We);const Qq=mr(Zq);var tj=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(We);const ej=mr(tj);var nj=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(We);const rj=mr(nj);var ij=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(We);const oj=mr(ij);var J4=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(We);const Xw=mr(J4);var sj=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(We);const aj=mr(sj);var K4=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(We);const Jw=mr(K4);var lj=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(We);const cj=mr(lj);var uj=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(We);const fj=mr(uj);var hj=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(We);const dj=mr(hj);var pj=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(We);const gj=mr(pj);var mj=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(We);const yj=mr(mj);var vj=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(We);const bj=mr(vj);var _j=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(We);const RC=mr(_j);var wj=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(We);const xj=mr(wj);var Sj=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(We);const Ej=mr(Sj);var Tj=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(We);const kj=mr(Tj);var Mj=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(We);const NC=mr(Mj);var Cj=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(We);const Aj=mr(Cj);var Rj=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(We);const Nj=mr(Rj);var Ij=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(We);const Oj=mr(Ij);var Dj=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(We);const Lj=mr(Dj);var Fj=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(We);const $j=mr(Fj);var Bj=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(We);const Pj=mr(Bj);var Uj=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(We);const zj=mr(Uj);var qj=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(We);const jj=mr(qj);var Vj=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(We);const Wj=mr(Vj);function Yj(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 Hj=TC(oc(300,.5,0),oc(-240,.5,1));var Gj=TC(oc(-100,.75,.35),oc(80,1.5,.8)),Xj=TC(oc(260,.75,.35),oc(80,1.5,.8)),Sb=oc();function Jj(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Sb.h=360*e-100,Sb.s=1.5-1.5*t,Sb.l=.8-.9*t,Sb+""}var Eb=ss(),Wxt=Math.PI/3,Yxt=Math.PI*2/3;function Kj(e){var t;return e=(.5-e)*Math.PI,Eb.r=255*(t=Math.sin(e))*t,Eb.g=255*(t=Math.sin(e+Wxt))*t,Eb.b=255*(t=Math.sin(e+Yxt))*t,Eb+""}function IC(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 mS(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const Zj=mS(We("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var Qj=mS(We("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),yS=mS(We("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),tV=mS(We("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function eV(){return!(navigator.gpu==null||navigator.gpu.requestAdapter==null)}function Hxt(e){return e==0&&(e=4),e%4!=0&&(e+=4-e%4),e}function s0(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:Hxt(n),usage:r}),e.byteSize=n,e.destroy=()=>{e.buffer?.destroy()}),e.buffer}function MT(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 o=new Uint8Array(4);for(let s=0;s<4;s++)i+s{e.texture?.destroy()}),e.texture}const ol=2,nV=4,vS=8,OC=16,Ru=32,fg=64,Kw=128,Os=256,Zw=512,as=1024,sc=2048,$d=4096,au=8192,bS=16384,Gxt=32768,DC=65536,Xxt=1<<19,rV=1<<20,Z4=1<<21,Jh=Symbol("$state"),iV=Symbol("legacy props"),Jxt=Symbol(""),Kxt=!1;var LC=Array.isArray,Zxt=Array.prototype.indexOf,FC=Array.from,oV=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,sV=Object.getOwnPropertyDescriptors,Qxt=Object.prototype,t2t=Array.prototype,$C=Object.getPrototypeOf,nD=Object.isExtensible;function aV(e){for(var t=0;t0&&lV(),Q4.length>0&&e2t()}function cV(e){return e===this.v}function uV(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function n2t(e,t){return e!==t}function PC(e){return!uV(e,this.v)}function r2t(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function i2t(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function o2t(e){throw new Error("https://svelte.dev/e/effect_orphan")}function s2t(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function a2t(){throw new Error("https://svelte.dev/e/hydration_failed")}function l2t(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function c2t(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function u2t(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function f2t(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let h2t=!1;const UC=1,zC=2,fV=4,d2t=8,p2t=16,g2t=1,m2t=4,y2t=8,v2t=16,b2t=1,_2t=2,qC="[",jC="[!",VC="]",Hm={},uo=Symbol(),w2t="http://www.w3.org/1999/xhtml";function hV(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Ao=null;function iD(e){Ao=e}function Bd(e,t=!1,n){var r=Ao={p:Ao,c:null,d:!1,e:null,m:!1,s:e,x:null,l:null};AV(()=>{r.d=!0})}function Pd(e){const t=Ao;if(t!==null){e!==void 0&&(t.x=e);const s=t.e;if(s!==null){var n=ir,r=hr;t.e=null;try{for(var i=0;i{var l=hr;ac(o);var c=a();return ac(l),c};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)&&c2t();var u=n.get(l);return u===void 0?(u=s(()=>Sr(c.value)),n.set(l,u)):De(u,s(()=>hf(c.value))),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0)l in a&&(n.set(l,s(()=>Sr(uo))),CT(i));else{if(r&&typeof l=="string"){var u=n.get("length"),f=Number(l);Number.isInteger(f)&&fSr(hf(f?a[l]:uo))),n.set(l,u)),u!==void 0){var h=X(u);return h===uo?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!==uo)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Jh)return!0;var c=n.get(l),u=c!==void 0&&c.v!==uo||Reflect.has(a,l);if(c!==void 0||ir!==null&&(!u||a0(a,l)?.writable)){c===void 0&&(c=s(()=>Sr(u?hf(a[l]):uo)),n.set(l,c));var f=X(c);if(f===uo)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;pSr(uo)),n.set(p+"",g))}f===void 0?(!h||a0(a,l)?.writable)&&(f=s(()=>Sr(void 0)),De(f,s(()=>hf(c))),n.set(l,f)):(h=f.v!==uo,De(f,s(()=>hf(c))));var y=Reflect.getOwnPropertyDescriptor(a,l);if(y?.set&&y.set.call(u,c),!h){if(r&&typeof l=="string"){var v=n.get("length"),b=Number(l);Number.isInteger(b)&&b>=v.v&&De(v,b+1)}CT(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!==uo});for(var[c,u]of n)u.v!==uo&&!(c in a)&&l.push(c);return l},setPrototypeOf(){u2t()}})}function CT(e,t=1){De(e,e.v+t)}function _S(e){var t=ol|sc,n=hr!==null&&(hr.f&ol)!==0?hr:null;return ir===null||n!==null&&(n.f&Os)!==0?t|=Os:ir.f|=rV,{ctx:Ao,deps:null,effects:null,equals:cV,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:n??ir}}function se(e){const t=_S(e);return xV(t),t}function x2t(e){const t=_S(e);return t.equals=PC,t}function pV(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;ne.wv)return!0}(!r||ir!==null&&!vf)&&sl(e,as)}return!1}function k2t(e,t){for(var n=t;n!==null;){if((n.f&Kw)!==0)try{n.fn(e);return}catch{n.f^=Kw}n=n.parent}throw E_=!1,e}function aD(e){return(e.f&bS)===0&&(e.parent===null||(e.parent.f&Kw)===0)}function wS(e,t,n,r){if(E_){if(n===null&&(E_=!1),aD(t))throw e;return}if(n!==null&&(E_=!0),k2t(e,t),aD(t))throw e}function TV(e,t,n=!0){var r=e.reactions;if(r!==null)for(var i=0;i0)for(f.length=_s+go.length,h=0;h0;){t++>1e3&&C2t();var n=Gm,r=n.length;Gm=[];for(var i=0;i0;)tx=!0,MV(),rD();return t}function X(e){var t=e.f,n=(t&ol)!==0;if(hr!==null&&!Fl){if(!lu?.includes(e)){var r=hr.deps;e.rvnew Promise(r=>{n.outro?By(t,()=>{qf(t),r(void 0)}):(qf(t),r(void 0))})}function SS(e){return hg(nV,e,!1)}function GC(e){return hg(vS,e,!0)}function Ms(e,t=[],n=_S){const r=t.map(n);return ES(()=>e(...r.map(X)))}function ES(e,t=0){return hg(vS|OC|t,e,!0)}function N0(e,t=!0){return hg(vS|Ru,e,!0,t)}function RV(e){var t=e.teardown;if(t!==null){const n=Bv,r=hr;sD(!0),ac(null);try{t.call(null)}finally{sD(n),ac(r)}}}function NV(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){var r=n.next;(n.f&fg)!==0?n.parent=null:qf(n,t),n=r}}function F2t(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ru)===0&&qf(t),t=n}}function qf(e,t=!0){var n=!1;(t||(e.f&Xxt)!==0)&&e.nodes_start!==null&&($2t(e.nodes_start,e.nodes_end),n=!0),NV(e,t&&!n),rx(e,0),sl(e,bS);var r=e.transitions;if(r!==null)for(const o of r)o.stop();RV(e);var i=e.parent;i!==null&&i.first!==null&&IV(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function $2t(e,t){for(;e!==null;){var n=e===t?null:Nu(e);e.remove(),e=n}}function IV(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 By(e,t){var n=[];XC(e,n,!0),OV(n,()=>{qf(e),t&&t()})}function OV(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function XC(e,t,n){if((e.f&au)===0){if(e.f^=au,e.transitions!==null)for(const s of e.transitions)(s.is_global||n)&&t.push(s);for(var r=e.first;r!==null;){var i=r.next,o=(r.f&DC)!==0||(r.f&Ru)!==0;XC(r,t,o?n:!1),r=i}}}function ox(e){DV(e,!0)}function DV(e,t){if((e.f&au)!==0){e.f^=au,(e.f&as)===0&&(e.f^=as),Pv(e)&&(sl(e,sc),xS(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&DC)!==0||(n.f&Ru)!==0;DV(n,i?t:!1),n=r}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}function B2t(e){var t=hr,n=ir;ac(null),zf(null);try{return e()}finally{ac(t),zf(n)}}const LV=new Set,iM=new Set;function P2t(e,t,n,r={}){function i(o){if(r.capture||Im.call(t,o),!o.cancelBubble)return B2t(()=>n?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?BC(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function lD(e,t,n,r,i){var o={capture:r,passive:i},s=P2t(e,t,n,o);(t===document.body||t===window||t===document)&&AV(()=>{t.removeEventListener(e,s,o)})}function JC(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,ac(u),zf(f)}}}function FV(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function Cf(e,t){var n=ir;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function rh(e,t){var n=(t&b2t)!==0,r=(t&_2t)!==0,i,o=!e.startsWith("");return()=>{if(Gn)return Cf(Pn,null),Pn;i===void 0&&(i=FV(o?e:""+e),n||(i=bu(i)));var s=r||vV?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=bu(s),l=s.lastChild;Cf(a,l)}else Cf(s,s);return s}}function Iu(e,t,n="svg"){var r=!e.startsWith(""),i=`<${n}>${r?e:""+e}`,o;return()=>{if(Gn)return Cf(Pn,null),Pn;if(!o){var s=FV(i),a=bu(s);o=bu(a)}var l=o.cloneNode(!0);return Cf(l,l),l}}function om(){if(Gn)return Cf(Pn,null),Pn;var e=document.createDocumentFragment(),t=document.createComment(""),n=R0();return e.append(t,n),Cf(t,n),e}function Xr(e,t){if(Gn){ir.nodes_end=Pn,$v();return}e!==null&&e.before(t)}const U2t=["touchstart","touchmove"];function z2t(e){return U2t.includes(e)}function Xm(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function $V(e,t){return BV(e,t)}function q2t(e,t){nM(),t.intro=t.intro??!1;const n=t.target,r=Gn,i=Pn;try{for(var o=bu(n);o&&(o.nodeType!==8||o.data!==qC);)o=Nu(o);if(!o)throw Hm;tu(!0),Ja(o),$v();const s=BV(e,{...t,anchor:o});if(Pn===null||Pn.nodeType!==8||Pn.data!==VC)throw YC(),Hm;return tu(!1),s}catch(s){if(s===Hm)return t.recover===!1&&a2t(),nM(),wV(n),tu(!1),$V(e,t);throw s}finally{tu(r),Ja(i)}}const yp=new Map;function BV(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:s=!0}){nM();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(R0());return N0(()=>{if(o){Bd({});var h=Ao;h.c=o}i&&(r.$$events=i),Gn&&Cf(f,null),c=e(f,r)||{},Gn&&(ir.nodes_end=Pn),o&&Pd()}),()=>{for(var h of a){t.removeEventListener(h,Im);var p=yp.get(h);--p===0?(document.removeEventListener(h,Im),yp.delete(h)):yp.set(h,p)}iM.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return oM.set(c,u),c}let oM=new WeakMap;function j2t(e,t){const n=oM.get(e);return n?(oM.delete(e),n(t)):Promise.resolve()}function V2t(e){return new W2t(e)}let W2t=class{#t;#e;constructor(t){var n=new Map,r=(o,s)=>{var a=WC(s);return n.set(o,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return X(n.get(s)??r(s,Reflect.get(o,s)))},has(o,s){return s===iV?!0:(X(n.get(s)??r(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,a){return De(n.get(s)??r(s,a),a),Reflect.set(o,s,a)}});this.#e=(t.hydrate?q2t:$V)(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)&&N2t(),this.#t=i.$$events;for(const o of Object.keys(this.#e))o==="$set"||o==="$destroy"||o==="$on"||oV(this,o,{get(){return this.#e[o]},set(s){this.#e[o]=s},enumerable:!0});this.#e.$set=o=>{Object.assign(i,o)},this.#e.$destroy=()=>{j2t(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 Y2t="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Y2t);function Vo(e,t,[n,r]=[0,0]){Gn&&n===0&&$v();var i=e,o=null,s=null,a=uo,l=n>0?DC:0,c=!1;const u=(h,p=!0)=>{c=!0,f(p,h)},f=(h,p)=>{if(a===(a=h))return;let g=!1;if(Gn&&r!==-1){if(n===0){const v=i.data;v===qC?r=0:v===jC?r=1/0:(r=parseInt(v.substring(1)),r!==r&&(r=a?1/0:-1))}const y=r>n;!!a===y&&(i=eM(),Ja(i),tu(!1),g=!0,r=-1)}a?(o?ox(o):p&&(o=N0(()=>p(i))),s&&By(s,()=>{s=null})):(s?ox(s):p&&(s=N0(()=>p(i,[n+1,r]))),o&&By(o,()=>{o=null})),g&&tu(!0)};ES(()=>{c=!1,t(u),c||f(null,null)},l),Gn&&(i=Pn)}function H2t(e,t,n){Gn&&$v();var r=e,i=uo,o,s=n2t;ES(()=>{s(i,i=t())&&(o&&By(o),o=N0(()=>n(r)))}),Gn&&(r=Pn)}function AT(e,t){return t}function G2t(e,t,n,r){for(var i=[],o=t.length,s=0;s0&&i.length===0&&n!==null;if(a){var l=n.parentNode;wV(l),l.append(n),r.clear(),lf(e,t[0].prev,t[o-1].next)}OV(i,()=>{for(var c=0;c{var p=n();return LC(p)?p:p==null?[]:FC(p)});ES(()=>{var p=X(h),g=p.length;if(f&&g===0)return;f=g===0;let y=!1;if(Gn){var v=s.data===jC;v!==(g===0)&&(s=eM(),Ja(s),tu(!1),y=!0)}if(Gn){for(var b=null,_,S=0;S0&&Ja(eM())}Gn||X2t(p,a,s,i,t,r,n),o!==null&&(g===0?u?ox(u):u=N0(()=>o(s)):u!==null&&By(u,()=>{u=null})),y&&tu(!0),X(h)}),Gn&&(s=Pn)}function X2t(e,t,n,r,i,o,s){var a=(i&d2t)!==0,l=(i&(UC|zC))!==0,c=e.length,u=t.items,f=t.first,h=f,p,g=null,y,v=[],b=[],_,S,x,T;if(a)for(T=0;T0){var $=(i&fV)!==0&&c===0?n:null;if(a){for(T=0;T{if(y!==void 0)for(x of y)x.a?.apply()}),ir.first=t.first&&t.first.e,ir.last=g&&g.e}function J2t(e,t,n,r){(r&UC)!==0&&tM(e.v,t),(r&zC)!==0?tM(e.i,n):e.i=n}function PV(e,t,n,r,i,o,s,a,l,c){var u=(l&UC)!==0,f=(l&p2t)===0,h=u?f?WC(i):Qw(i):i,p=(l&zC)===0?s:Qw(s),g={i:p,v:h,k:o,a:null,e:null,prev:n,next:r};try{return g.e=N0(()=>a(e,h,p,c),Gn),g.e.prev=n&&n.e,g.e.next=r&&r.e,n===null?t.first=g:(n.next=g,n.e.next=g.e),r!==null&&(r.prev=g,r.e.prev=g.e),g}finally{}}function cD(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,o=e.e.nodes_start;o!==r;){var s=Nu(o);i.before(o),o=s}}function lf(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 K2t(e,t,n){SS(()=>{var r=xd(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,o={};GC(()=>{var s=n();O2t(s),i&&uV(o,s)&&(o=s,r.update(s))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function uD(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var o=e[i];o!=null&&o!==""&&(r+=" "+i+": "+o+n)}return r}function Z2t(e,t){if(t){var n="",r,i;return Array.isArray(t)?(r=t[0],i=t[1]):r=t,r&&(n+=uD(r)),i&&(n+=uD(i,!0)),n=n.trim(),n===""?null:n}return String(e)}function NT(e,t={},n,r){for(var i in n){var o=n[i];t[i]!==o&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,o,r))}}function xn(e,t,n,r){var i=e.__style;if(Gn||i!==t){var o=Z2t(t,r);(!Gn||o!==e.getAttribute("style"))&&(o==null?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else r&&(Array.isArray(r)?(NT(e,n?.[0],r[0]),NT(e,n?.[1],r[1],"important")):NT(e,n,r));return r}const Q2t=Symbol("is custom element"),tSt=Symbol("is html");function Qt(e,t,n,r){var i=eSt(e);Gn&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[Jxt]=n),n==null?e.removeAttribute(t):typeof n!="string"&&nSt(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function eSt(e){return e.__attributes??={[Q2t]:e.nodeName.includes("-"),[tSt]:e.namespaceURI===w2t}}var fD=new Map;function nSt(e){var t=fD.get(e.nodeName);if(t)return t;fD.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=sV(r);for(var o in n)n[o].set&&t.push(o);r=$C(r)}return t}function hD(e,t){return e===t||e?.[Jh]===t}function sM(e={},t,n,r){return SS(()=>{var i,o;return GC(()=>{i=o,o=[],xd(()=>{e!==n(...o)&&(t(e,...o),i&&hD(n(...i),e)&&t(null,...i))})}),()=>{BC(()=>{o&&hD(n(...o),e)&&t(null,...o)})}}),e}function KC(e){Ao===null&&hV(),Pc(()=>{const t=xd(e);if(typeof t=="function")return t})}function rSt(e){Ao===null&&hV(),KC(()=>()=>xd(e))}let Tb=!1;function iSt(e){var t=Tb;try{return Tb=!1,[e(),Tb]}finally{Tb=t}}function dD(e){return e.ctx?.d??!1}function le(e,t,n,r){var i=(n&g2t)!==0,o=!0,s=(n&y2t)!==0,a=(n&v2t)!==0,l=!1,c;s?[c,l]=iSt(()=>e[t]):c=e[t];var u=Jh in e||iV in e,f=s&&(a0(e,t)?.set??(u&&t in e&&(T=>e[t]=T)))||void 0,h=r,p=!0,g=!1,y=()=>(g=!0,p&&(p=!1,a?h=xd(r):h=r),h);c===void 0&&r!==void 0&&(f&&o&&l2t(),c=y(),f&&f(c));var v;if(v=()=>{var T=e[t];return T===void 0?y():(p=!0,g=!1,T)},(n&m2t)===0)return v;if(f){var b=e.$$legacy;return function(T,k){return arguments.length>0?((!k||b||l)&&f(k?v():T),T):v()}}var _=!1,S=WC(c),x=_S(()=>{var T=v(),k=X(S);return _?(_=!1,k):S.v=T});return s&&X(x),i||(x.equals=PC),function(T,k){if(arguments.length>0){const M=k?X(x):s?hf(T):T;if(!x.equals(M)){if(_=!0,De(S,M),g&&h!==void 0&&(h=M),dD(x))return T;xd(()=>X(x))}return T}return dD(x)?x.v:X(x)}}var oSt=Iu('');function sSt(e,t){Bd(t,!0);let n=se(()=>t.pointLocation(t.value.xMin,t.value.yMin)),r=se(()=>t.pointLocation(t.value.xMax,t.value.yMax));const i=8;function o(R){return O=>{O.stopPropagation(),O.preventDefault(),t.preventHover(!0);let N=[X(n).x,X(n).y,X(r).x,X(r).y],L=I=>{I.preventDefault();let F=I.pageX-O.pageX,D=I.pageY-O.pageY,P=[F,D,F,D].map((U,V)=>N[V]+U*R[V]),z=t.coordinateAtPoint(P[0],P[1]),q=t.coordinateAtPoint(P[2],P[3]);t.onChange({xMin:Math.min(z.x,q.x),xMax:Math.max(z.x,q.x),yMin:Math.min(z.y,q.y),yMax:Math.max(z.y,q.y)})},$=()=>{t.preventHover(!1),window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",$)};window.addEventListener("mousemove",L),window.addEventListener("mouseup",$)}}var s=oSt(),a=ki(s),l=se(()=>o([1,1,1,1]));a.__mousedown=function(...R){X(l)?.apply(this,R)},xn(a,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)",cursor:"move"});var c=Ir(a);Qt(c,"width",i);var u=se(()=>o([1,0,0,0]));c.__mousedown=function(...R){X(u)?.apply(this,R)},xn(c,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"});var f=Ir(c);Qt(f,"width",i);var h=se(()=>o([0,0,1,0]));f.__mousedown=function(...R){X(h)?.apply(this,R)},xn(f,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"});var p=Ir(f);Qt(p,"height",i);var g=se(()=>o([0,1,0,0]));p.__mousedown=function(...R){X(g)?.apply(this,R)},xn(p,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"});var y=Ir(p);Qt(y,"height",i);var v=se(()=>o([0,0,0,1]));y.__mousedown=function(...R){X(v)?.apply(this,R)},xn(y,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"});var b=Ir(y);Qt(b,"width",i),Qt(b,"height",i);var _=se(()=>o([1,1,0,0]));b.__mousedown=function(...R){X(_)?.apply(this,R)},xn(b,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"});var S=Ir(b);Qt(S,"width",i),Qt(S,"height",i);var x=se(()=>o([1,0,0,1]));S.__mousedown=function(...R){X(x)?.apply(this,R)},xn(S,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"});var T=Ir(S);Qt(T,"width",i),Qt(T,"height",i);var k=se(()=>o([0,1,1,0]));T.__mousedown=function(...R){X(k)?.apply(this,R)},xn(T,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"});var M=Ir(T);Qt(M,"width",i),Qt(M,"height",i);var C=se(()=>o([0,0,1,1]));M.__mousedown=function(...R){X(C)?.apply(this,R)},xn(M,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),hi(s),Ms((R,O,N,L,$,I,F,D,P,z,q,U)=>{Qt(a,"x",R),Qt(a,"width",O),Qt(a,"y",N),Qt(a,"height",L),Qt(c,"x",X(n).x-i/2),Qt(c,"y",$),Qt(c,"height",I),Qt(f,"x",X(r).x-i/2),Qt(f,"y",F),Qt(f,"height",D),Qt(p,"x",P),Qt(p,"width",z),Qt(p,"y",X(n).y-i/2),Qt(y,"x",q),Qt(y,"width",U),Qt(y,"y",X(r).y-i/2),Qt(b,"x",X(n).x-i/2),Qt(b,"y",X(n).y-i/2),Qt(S,"x",X(n).x-i/2),Qt(S,"y",X(r).y-i/2),Qt(T,"x",X(r).x-i/2),Qt(T,"y",X(n).y-i/2),Qt(M,"x",X(r).x-i/2),Qt(M,"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)]),Xr(e,s),Pd()}JC(["mousedown"]);function aSt(e,t){let n=!1,r,i,o,s=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),s)):l(u)};return c}function IT(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey}}function lSt(e,t){let{zoom:n,click:r,drag:i,hover:o}=t,s=!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,p=u.clientY-f.top,g=Math.exp(-u.deltaY/200);n(g,{x:h,y:p},IT(u))},mousedown:u=>{u.preventDefault();let f=e.getBoundingClientRect(),h=u.clientX-f.left,p=u.clientY-f.top,g=!1,y=null;s=!0;let v=_=>{_.preventDefault();let S=e.getBoundingClientRect(),x=_.clientX-S.left,T=_.clientY-S.top;g==!1&&i!=null&&(x-h)*(x-h)+(T-p)*(T-p)>c*c&&(g=!0,y=i({x:h,y:p},IT(u))),g&&y?.move!=null&&y.move({x,y:T})},b=()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b),s=!1,g&&y?.release!=null&&y.release(),g||r&&r({x:h,y:p},IT(u))};window.addEventListener("mousemove",v),window.addEventListener("mouseup",b)},mousemove:u=>{if(o==null||s||a)return;let f=e.getBoundingClientRect(),h=u.clientX-f.left,p=u.clientY-f.top;l={x:h,y:p},o({x:h,y:p})},mouseleave:()=>{l!=null&&o!=null&&(l=null,o(null))},preventHover:u=>{u!=a&&(u&&l!=null&&o!=null&&(l=null,o(null)),a=u)}}}function cSt(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function uSt(e){return"M "+e.map(({x:t,y:n})=>`${t},${n}`).join(" L ")+" Z"}function UV(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let{x:o,y:s}of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return{xMin:t,yMin:r,xMax:n,yMax:i}}async function fSt(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 bf(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(!bf(e[n],t[n]))return!1}else return!1;return!0}var hSt=Iu("");function dSt(e,t){Bd(t,!0);let n=se(()=>t.value.map(({x:i,y:o})=>t.pointLocation(i,o)));var r=hSt();xn(r,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)"}),Ms(i=>Qt(r,"d",i),[()=>uSt(X(n))]),Xr(e,r),Pd()}const pSt={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 gSt=Iu(''),mSt=rh("");function pD(e,t){let n=le(t,"active",3,!1);var r=mSt();r.__click=function(...a){t.onClick?.apply(this,a)};let i;var o=ki(r);{var s=a=>{var l=gSt();xn(l,"",{},{width:"14px",height:"14px"});var c=ki(l);xn(c,"",{},{fill:"currentColor"}),hi(l),Ms(()=>Qt(c,"d",pSt[t.icon])),Xr(a,l)};Vo(o,a=>{t.icon!=null&&a(s)})}hi(r),Ms(()=>{Qt(r,"title",t.title),i=xn(r,"",i,{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"})}),Xr(e,r)}JC(["click"]);var ySt=rh('
    ');function vSt(e,t){function n(h,p){let g=Math.log10(p*h),y=Math.round(g),v=[.1,.2,.5,1,2,5,10],b=0,_=1e10;for(let S of v){let x=Math.abs(Math.log10(S)+y-g);x<_&&(b=S,_=x)}return b*Math.pow(10,y)}let r=se(()=>n(t.distancePerPoint,30)),i=se(()=>X(r)/t.distancePerPoint);var o=ySt();xn(o,"",{},{display:"flex","align-items":"center"});var s=ki(o);xn(s,"",{},{"padding-right":"4px"});var a=ki(s,!0);hi(s);var l=Ir(s,2),c=ki(l);Qt(c,"x1",1),Qt(c,"y1",3),Qt(c,"y2",3),xn(c,"",{},{stroke:"currentColor","stroke-width":"2","stroke-cap":"butt"});var u=Ir(c);Qt(u,"x1",1),Qt(u,"x2",1),Qt(u,"y1",0),Qt(u,"y2",6),xn(u,"",{},{stroke:"currentColor"});var f=Ir(u);Qt(f,"y1",0),Qt(f,"y2",6),xn(f,"",{},{stroke:"currentColor"}),hi(l),hi(o),Ms(h=>{Xm(a,h),Qt(l,"width",`${X(i)+2}px`),Qt(c,"x2",X(i)+1),Qt(f,"x1",X(i)+1),Qt(f,"x2",X(i)+1)},[()=>X(r).toLocaleString()]),Xr(e,o)}var bSt=rh("
    "),_St=rh('
    ',1),wSt=rh('
    ');function xSt(e,t){Bd(t,!0);let n=le(t,"statusMessage",3,null);var r=wSt();let i;var o=ki(r);let s;var a=ki(o);{var l=T=>{var k=bSt();xn(k,"",{},{display:"inline-block"});var M=ki(k,!0);hi(k),Ms(()=>Xm(M,n())),Xr(T,k)};Vo(a,T=>{n()!=null&&T(l)})}hi(o);var c=Ir(o,2);xn(c,"",{},{flex:"1 1 0%"});var u=Ir(c,2);let f;var h=ki(u);{var p=T=>{var k=_St(),M=Pp(k);xn(M,"",{},{color:"currentColor","text-decoration":"underline"});var C=ki(M,!0);hi(M),E2t(2),Ms(()=>{Qt(M,"href",t.resolvedTheme.brandingLink.href),Xm(C,t.resolvedTheme.brandingLink.text)}),Xr(T,k)};Vo(h,T=>{t.resolvedTheme.brandingLink!=null&&T(p)})}var g=Ir(h,2);const y=se(()=>t.selectionMode=="marquee");pD(g,{icon:"marquee",get active(){return X(y)},title:"Toggle rectangle selection mode. In normal mode, use shift + drag for rectangle selection.",onClick:()=>t.onSelectionMode(t.selectionMode=="marquee"?"none":"marquee")});var v=Ir(g,2);const b=se(()=>t.selectionMode=="lasso");pD(v,{icon:"lasso",get active(){return X(b)},title:"Toggle lasso selection mode. In normal mode, use shift + meta + drag for lasso selection.",onClick:()=>t.onSelectionMode(t.selectionMode=="lasso"?"none":"lasso")});var _=Ir(v,4);vSt(_,{get distancePerPoint(){return t.distancePerPoint}});var S=Ir(_,4),x=ki(S);hi(S),hi(u),hi(r),Ms(T=>{i=xn(r,"",i,{"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"}),s=xn(o,"",s,{flex:"none",display:"flex","flex-direction":"row",gap:"4px",padding:"0px 4px","border-radius":"2px",background:t.resolvedTheme.statusBarBackgroundColor}),f=xn(u,"",f,{flex:"none",display:"flex","flex-direction":"row","align-items":"center",gap:"4px",padding:"0px 4px","border-radius":"2px",background:t.resolvedTheme.statusBarBackgroundColor}),Xm(x,`${T??""} points`)},[()=>t.pointCount.toLocaleString()]),Xr(e,r),Pd()}function SSt(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 OT=new WeakMap;function zV(e){let t=typeof e=="function"?e:e.class;if(OT.has(t))return OT.get(t);{let n=SSt(t);return OT.set(t,n),n}}function qV(e,t){return typeof e=="function"?t:{...e.props??{},...t}}var ESt=rh("
    ");function TSt(e,t){Bd(t,!0);let n=le(t,"margin",3,4),r,i,o=se(()=>zV(t.customTooltip)),s=se(()=>qV(t.customTooltip,{tooltip:t.tooltip}));KC(()=>{ix(()=>{let c=X(o),u=null;return ix(()=>{i.style.left="0px",i.style.top="0px",i.style.pointerEvents=t.allowInteraction?"all":"none",u==null?u=c(i,X(s)):u.update?.(X(s));function f(v,b,_,S){let x=t.location.x,T=t.location.y,k=2,M=v/2,C=b+(t.targetHeight+n());x-M<_&&(M=x-_),x-M>S-v&&(M=x-S+v),T-C{y=null;let v=i.getBoundingClientRect();(v.width!=p||v.height!=g)&&f(v.width,v.height,2,h.width-2)});return()=>{y!=null&&cancelAnimationFrame(y)}}),()=>{u?.destroy?.(),i.replaceChildren()}})});var a=ESt();xn(a,"",{},{position:"absolute",width:"100%"});var l=ki(a);xn(l,"",{},{display:"flex",position:"absolute",width:"fit-content",height:"fit-content","z-index":"100"}),sM(l,c=>i=c,()=>i),hi(a),sM(a,c=>r=c,()=>r),Xr(e,a),Pd()}function ZC(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function jV(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Uv(){}var Py=.7,sx=1/Py,l0="\\s*([+-]?\\d+)\\s*",Uy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kSt=/^#([0-9a-f]{3,8})$/,MSt=new RegExp(`^rgb\\(${l0},${l0},${l0}\\)$`),CSt=new RegExp(`^rgb\\(${Jl},${Jl},${Jl}\\)$`),ASt=new RegExp(`^rgba\\(${l0},${l0},${l0},${Uy}\\)$`),RSt=new RegExp(`^rgba\\(${Jl},${Jl},${Jl},${Uy}\\)$`),NSt=new RegExp(`^hsl\\(${Uy},${Jl},${Jl}\\)$`),ISt=new RegExp(`^hsla\\(${Uy},${Jl},${Jl},${Uy}\\)$`),gD={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};ZC(Uv,QC,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:mD,formatHex:mD,formatHex8:OSt,formatHsl:DSt,formatRgb:yD,toString:yD});function mD(){return this.rgb().formatHex()}function OSt(){return this.rgb().formatHex8()}function DSt(){return WV(this).formatHsl()}function yD(){return this.rgb().formatRgb()}function QC(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kSt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?vD(t):n===3?new Qo(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kb(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kb(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=MSt.exec(e))?new Qo(t[1],t[2],t[3],1):(t=CSt.exec(e))?new Qo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ASt.exec(e))?kb(t[1],t[2],t[3],t[4]):(t=RSt.exec(e))?kb(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=NSt.exec(e))?wD(t[1],t[2]/100,t[3]/100,1):(t=ISt.exec(e))?wD(t[1],t[2]/100,t[3]/100,t[4]):gD.hasOwnProperty(e)?vD(gD[e]):e==="transparent"?new Qo(NaN,NaN,NaN,0):null}function vD(e){return new Qo(e>>16&255,e>>8&255,e&255,1)}function kb(e,t,n,r){return r<=0&&(e=t=n=NaN),new Qo(e,t,n,r)}function LSt(e){return e instanceof Uv||(e=QC(e)),e?(e=e.rgb(),new Qo(e.r,e.g,e.b,e.opacity)):new Qo}function VV(e,t,n,r){return arguments.length===1?LSt(e):new Qo(e,t,n,r??1)}function Qo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ZC(Qo,VV,jV(Uv,{brighter(e){return e=e==null?sx:Math.pow(sx,e),new Qo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Py:Math.pow(Py,e),new Qo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qo(Zh(this.r),Zh(this.g),Zh(this.b),ax(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:bD,formatHex:bD,formatHex8:FSt,formatRgb:_D,toString:_D}));function bD(){return`#${zh(this.r)}${zh(this.g)}${zh(this.b)}`}function FSt(){return`#${zh(this.r)}${zh(this.g)}${zh(this.b)}${zh((isNaN(this.opacity)?1:this.opacity)*255)}`}function _D(){const e=ax(this.opacity);return`${e===1?"rgb(":"rgba("}${Zh(this.r)}, ${Zh(this.g)}, ${Zh(this.b)}${e===1?")":`, ${e})`}`}function ax(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zh(e){return e=Zh(e),(e<16?"0":"")+e.toString(16)}function wD(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ja(e,t,n,r)}function WV(e){if(e instanceof ja)return new ja(e.h,e.s,e.l,e.opacity);if(e instanceof Uv||(e=QC(e)),!e)return new ja;if(e instanceof ja)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new ja(s,a,l,e.opacity)}function $St(e,t,n,r){return arguments.length===1?WV(e):new ja(e,t,n,r??1)}function ja(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ZC(ja,$St,jV(Uv,{brighter(e){return e=e==null?sx:Math.pow(sx,e),new ja(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Py:Math.pow(Py,e),new ja(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 Qo(DT(e>=240?e-240:e+120,i,r),DT(e,i,r),DT(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ja(xD(this.h),Mb(this.s),Mb(this.l),ax(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=ax(this.opacity);return`${e===1?"hsl(":"hsla("}${xD(this.h)}, ${Mb(this.s)*100}%, ${Mb(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xD(e){return e=(e||0)%360,e<0?e+360:e}function Mb(e){return Math.max(0,Math.min(1,e||0))}function DT(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 SD=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Cb=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];function dg(e){if(e<1&&(e=1),e<=SD.length)return SD.slice(0,e);if(e<=Cb.length)return Cb.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,o)=>Math.max(i,o)),height:r}}function YV(){return[1,0,0,0,1,0,0,0,1]}function eA(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 HV(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 USt(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 GV(e){let t=USt(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 lx{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,o=r;this.width({x:o*t+r,y:s*n+i})}coordinateAtPixelFunction(){let t=this._pixel_kx,n=this._pixel_ky,r=this._pixel_bx,i=this._pixel_by;return(o,s)=>({x:(o-r)/t,y:(s-i)/n})}}class aM{_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 pg=class extends aM{_value=null;setValue(e){this._value!==e&&(this._value=e,this.setNeedsRunDownstream())}get value(){return this.run(),this._value}};class XV extends pg{constructor(t){super([]),this.setValue(t)}get value(){return super.value}set value(t){this.setValue(t)}}class zSt extends pg{fn;constructor(t,n){super(n),this.fn=t}update(){this.setValue(this.fn())}}class qSt extends pg{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 jSt extends pg{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 Ud(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 VSt extends pg{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 Ud(this.parent),o=new XV(r),s=this.build(i,o);return this.cache.set(r,{context:i,input:o,output:s}),this.addInput(s),s.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 WSt extends pg{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 Ud(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()}}class Ud{_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 XV(t);return this._nodes.add(n),n}derive(t,n){let r=t.map(o=>o instanceof aM?o:this.value(o)),i=new zSt(()=>n(...r.map(o=>o.value)),r);return this._nodes.add(i),i}statefulDerive(t,n){let r=t.map(o=>o instanceof aM?o:this.value(o)),i=new qSt(o=>n(o,...r.map(s=>s.value)),r);return this._nodes.add(i),i}if(t,n,r){let i=new jSt(this,t,n,r);return this._nodes.add(i),i}switch(t,n){let r=new WSt(this,t,n);return this._nodes.add(r),r}map(t,n){let r=new VSt(this,t,n);return this._nodes.add(r),r}assertNotNull(t){return t}subgraph(){return new Ud(this)}}function lc(e,t,n,r){if(e.program==null||e.vsSource!=n||e.fsSource!=r){e.destroy&&e.destroy();let o=ED(t,t.VERTEX_SHADER,n),s=ED(t,t.FRAGMENT_SHADER,r),a=t.createProgram();if(t.attachShader(a,o),t.attachShader(a,s),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(o),t.deleteShader(s)},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 ED(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 Kl(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 YSt(e,t,n,r,i){const o={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[s,a,l]=o[i][r];e.texImage2D(e.TEXTURE_2D,0,s,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 _f(e,t,n,r,i,o){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 s=`${n},${r},${i},${o}`;return e.cacheKey!=s&&(e.cacheKey=s,t.bindTexture(t.TEXTURE_2D,e.texture),YSt(t,n,r,i,o),t.bindTexture(t.TEXTURE_2D,null)),{framebuffer:e.framebuffer,texture:e.texture,width:n,height:r}}function HSt(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; + } + `,o=`#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:s,y:a,w:l})=>`color -= texture(image, uv + vec2(${s.toFixed(8)}, ${a.toFixed(8)}) / resolution) * (${l.toFixed(8)})`).join(";")}; + } + outColor = color * scaler; + } + `;return{vertex:r,fragment1:i,fragment2:o}}function GSt(e,t,n){let r=e.derive([n],XSt),i=e.derive([r],HSt),o=e.statefulDerive([t,e.derive([i],l=>l.vertex),e.derive([i],l=>l.fragment1)],lc),s=e.statefulDerive([t,e.derive([i],l=>l.vertex),e.derive([i],l=>l.fragment2)],lc),a=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,a,o,s,n,r],(l,c,u,f,h,p)=>(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 S=1/p.totalWeight*h*h*Math.PI;l.uniform1f(f.uniforms.scaler,S),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 TD(e,t,n){let r=Math.sqrt(t*t+n*n);if(re+Math.sqrt(2)/2)return 0;let i=2,o=0;for(let s=0;s0&&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 o=[];for(let{x:a,y:l,w:c}of i)if(o.length>0&&l==o[o.length-1].y&&a==o[o.length-1].x+1){let u=o[o.length-1].w,f=c;o[o.length-1].x+=1-u/(u+f),o[o.length-1].w=u+f}else o.push({x:a,y:l,w:c});let s=-o.reduce((a,l)=>a+l.w,0);return s+=r*(1+n*2)*(1+n*2),{squareMaxSize:n,squareWeight:r,samples:o,totalWeight:s}}function JSt(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 lM(e,t,n,r,i,o){let s=i!=null,a=JSt(s),l=e.statefulDerive([t,a.vertex,a.fragment],lc);return e.derive([t,l,n,r,i,o],(c,u,f,h,p,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),p!=null&&(c.enableVertexAttribArray(2),c.bindBuffer(c.ARRAY_BUFFER,p),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),p!=null&&c.disableVertexAttribArray(2),c.useProgram(null)})}function KSt(){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 JV(e,t){let{vertex:n,fragment:r}=KSt(),i=e.statefulDerive([t,n,r],lc),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,i,o],(s,a,l)=>(c,u,f,h)=>{s.disable(s.BLEND),s.enableVertexAttribArray(0),s.bindBuffer(s.ARRAY_BUFFER,l),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,null),s.bindTexture(s.TEXTURE_2D,c),s.useProgram(a.program),s.uniform1i(a.uniforms.source,0),s.uniform2f(a.uniforms.xyScaler,f??1,h??1),s.uniform1f(a.uniforms.gamma,u??2.2),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(null),s.bindTexture(s.TEXTURE_2D,null),s.disableVertexAttribArray(0)})}function KV(e){return Math.ceil(e*3)}function ZSt(e){let t=KV(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=t3t(n).map(([a,l])=>[a-t,l]),o=`#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; + } + `,s=`#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:o,fragment:s}}function QSt(e,t,n){let r=e.derive([n],ZSt),i=e.statefulDerive([t,e.derive([r],s=>s.vertex),e.derive([r],s=>s.fragment)],lc),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,o,i,n],(s,a,l,c)=>(u,f,h)=>{let{width:p,height:g}=f;s.disable(s.BLEND),s.enableVertexAttribArray(0),s.bindBuffer(s.ARRAY_BUFFER,a),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,null),s.useProgram(l.program),s.uniform2f(l.uniforms.resolution,p,g),s.uniform1i(l.uniforms.image,0),s.bindFramebuffer(s.FRAMEBUFFER,h.framebuffer),s.bindTexture(s.TEXTURE_2D,u),s.uniform2f(l.uniforms.direction,0,1),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.bindFramebuffer(s.FRAMEBUFFER,f.framebuffer),s.bindTexture(s.TEXTURE_2D,h.texture),s.uniform2f(l.uniforms.direction,1,0),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.bindFramebuffer(s.FRAMEBUFFER,null),s.useProgram(null),s.bindTexture(s.TEXTURE_2D,null),s.disableVertexAttribArray(0)})}function t3t(e){let t=[];for(let n=0;n=0&&o<=1){let s=r+i;s!=0&&t.push([n+o,s])}else t.push([n,e[n]]),t.push([n+1,e[n+1]])}else t.push([n,e[n]]);return t}function e3t(e){return Math.ceil(e*3)}function n3t(){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 r3t(e,t,n){let{vertex:r,fragment:i}=n3t(),o=e.statefulDerive([t,r,i],lc),s=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,s,o],(a,l,c)=>(u,f,h)=>{let{width:p,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,p,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[S,x,T]of i3t){a.bindFramebuffer(a.FRAMEBUFFER,v.framebuffer),a.bindTexture(a.TEXTURE_2D,y),a.uniform1fv(c.uniforms.weight0,x),a.uniform3fv(c.uniforms.distances,S),a.uniform3fv(c.uniforms.weights,T),a.drawArrays(a.TRIANGLE_STRIP,0,4),y=v.texture;let k=v;v=b,b=k}}a.bindFramebuffer(a.FRAMEBUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.disableVertexAttribArray(0)})}const i3t=[[[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 o3t(){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 s3t(e,t){let{vertex:n,fragment:r}=o3t(),i=e.statefulDerive([t,n,r],lc),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,i,o],(s,a,l)=>(c,u,f,h,p,g)=>{s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enableVertexAttribArray(0),s.bindBuffer(s.ARRAY_BUFFER,l),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,null),s.bindTexture(s.TEXTURE_2D,c.texture),s.useProgram(a.program),s.uniform1i(a.uniforms.source,0),s.uniform2f(a.uniforms.resolution,c.width,c.height),s.uniform1f(a.uniforms.densityScaler,u),s.uniform1f(a.uniforms.quantizationStep,f),s.uniform1f(a.uniforms.globalAlpha,h),s.uniform4fv(a.uniforms.channelMask,p),s.uniform4fv(a.uniforms.color,g),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(null),s.bindTexture(s.TEXTURE_2D,null),s.disableVertexAttribArray(0)})}function a3t(){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 l3t(e,t){let{vertex:n,fragment:r}=a3t(),i=e.statefulDerive([t,n,r],lc),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,i,o],(s,a,l)=>(c,u,f,h,p,g)=>{s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enableVertexAttribArray(0),s.bindBuffer(s.ARRAY_BUFFER,l),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,null),s.bindTexture(s.TEXTURE_2D,c.texture),s.useProgram(a.program),s.uniform1i(a.uniforms.source,0),s.uniform2f(a.uniforms.resolution,c.width,c.height),s.uniform1f(a.uniforms.densityScaler,u),s.uniform1f(a.uniforms.quantizationStep,f),s.uniform1f(a.uniforms.globalAlpha,h),s.uniform1i(a.uniforms.isDarkMode,g=="dark"?1:0),s.uniformMatrix4fv(a.uniforms.colorMatrix,!1,p),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(null),s.bindTexture(s.TEXTURE_2D,null),s.disableVertexAttribArray(0)})}function c3t(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 kD(e,t,n,r,i,o){let s=i!=null,a=c3t(s),l=e.statefulDerive([t,a.vertex,a.fragment],lc);return e.derive([t,l,n,r,i,o],(c,u,f,h,p,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),p!=null&&(c.enableVertexAttribArray(2),c.bindBuffer(c.ARRAY_BUFFER,p),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),s?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),p!=null&&c.disableVertexAttribArray(2),c.useProgram(null)})}function u3t(){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 f3t(e,t){let{vertex:n,fragment:r}=u3t(),i=e.statefulDerive([t,n,r],lc),o=e.statefulDerive([t,[-1,-1,-1,1,1,-1,1,1],"f32"],Kl);return e.derive([t,i,o],(s,a,l)=>(c,u,f,h,p)=>{s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.enableVertexAttribArray(0),s.bindBuffer(s.ARRAY_BUFFER,l),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0),s.bindBuffer(s.ARRAY_BUFFER,null),s.bindTexture(s.TEXTURE_2D,c.texture),s.useProgram(a.program),s.uniform1i(a.uniforms.source,0),s.uniform2f(a.uniforms.resolution,c.width,c.height),s.uniform1f(a.uniforms.pointAlpha,u),s.uniform1f(a.uniforms.globalAlpha,f),s.uniform1i(a.uniforms.isDarkMode,p=="dark"?1:0),s.uniformMatrix4fv(a.uniforms.colorMatrix,!1,h),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.useProgram(null),s.bindTexture(s.TEXTURE_2D,null),s.disableVertexAttribArray(0)})}class h3t{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 lx({x:0,y:0,scale:1},n,r);let i=new Ud,o=i.value(t);this.df=i,this.gl=o,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(YV()),width:i.value(n),height:i.value(r),pointSize:i.value(this.props.pointSize),densityBandwidth:i.value(this.props.densityBandwidth)},this.dataBuffers=d3t(i,o,this.renderInputs),this.renderer=p3t(i,o,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 o=this.df.subgraph(),s=y3t(o,this.gl,this.dataBuffers,o.value(t),o.value(n),o.value(r)),{x:a,y:l,scale:c}=i,u=[c,0,0,0,c,0,-a*c,-l*c,1],f=s.value(u),h=GV(u);return o.destroy(),{data:f,width:t,height:n,coordinateAtPixel:(p,g)=>{let y=p/t*2-1,v=g/n*2-1,b=HV([y,v,1],h);return{x:b[0],y:b[1]}}}}}function d3t(e,t,n){const r=e.statefulDerive([t,n.xData,"f32"],Kl),i=e.statefulDerive([t,n.yData,"f32"],Kl),o=e.if(e.derive([n.categoryData],a=>a!=null),a=>a.statefulDerive([t,a.assertNotNull(n.categoryData),"u8"],Kl),a=>a.value(null)),s=e.derive([n.xData],a=>a.length);return{x:r,y:i,category:o,count:s}}function p3t(e,t,n,r){return e.switch(n.mode,{points:i=>g3t(i,t,n,r),density:i=>m3t(i,t,n,r)})}function g3t(e,t,n,r){const i=e.derive([n.categoryCount],l=>l>1),o=e.statefulDerive([t,n.width,n.height,4,"f32"],_f);let s=e.if(i,l=>kD(l,t,r.x,r.y,l.assertNotNull(r.category),r.count),l=>kD(l,t,r.x,r.y,null,r.count)),a=JV(e,t);return e.derive([t,o,s,a,n.colorScheme,n.matrix,n.categoryCount],(l,c,u,f,h,p,g)=>y=>{let v=[],b=y.categoryColors??dg(y.categoryCount);for(let _=0;_e3t(S)+1),o=e.derive([n.width,i],(S,x)=>S+x*2),s=e.derive([n.height,i],(S,x)=>S+x*2);const a=e.derive([n.categoryCount],S=>S>1),l=e.statefulDerive([t,o,s,4,"f32"],_f),c=e.statefulDerive([t,o,s,4,"f32"],_f),u=e.statefulDerive([t,o,s,4,"f32"],_f),f=e.statefulDerive([t,o,s,4,"f32"],_f);let h=e.if(a,S=>lM(S,t,r.x,r.y,S.assertNotNull(r.category),r.count),S=>lM(S,t,r.x,r.y,null,r.count)),p=GSt(e,t,n.pointSize),g=r3t(e,t,n.densityBandwidth),y=f3t(e,t),v=l3t(e,t),b=s3t(e,t),_=JV(e,t);return e.derive([t,l,c,u,f,n.colorScheme,n.matrix,h,p,g,y,v,b,_],(S,x,T,k,M,C,R,O,N,L,$,I,F,D)=>P=>{let z=P.categoryColors??dg(P.categoryCount),q=[];for(let Z=0;Z<4;Z++)if(Z0&&P.pointsAlpha>0&&(N(x.texture,k,M),S.bindFramebuffer(S.FRAMEBUFFER,T.framebuffer),$(k,P.pointAlpha,P.pointsAlpha,q,C)),P.densityScaler>0&&(P.densityAlpha>0||P.contoursAlpha>0)&&(L(x.texture,k,M),S.bindFramebuffer(S.FRAMEBUFFER,T.framebuffer),P.densityAlpha>0&&I(k,P.densityScaler,P.densityQuantizationStep,P.densityAlpha,q,C),P.contoursAlpha>0))for(let Z=0;ZKV(g)+1),a=e.derive([r,s],(g,y)=>g+y*2),l=e.derive([i,s],(g,y)=>g+y*2);const c=e.statefulDerive([t,a,l,1,"f32"],_f),u=e.statefulDerive([t,a,l,1,"f32"],_f),f=e.statefulDerive([t,a,l,1,"f32"],_f);let h=lM(e,t,n.x,n.y,null,n.count),p=QSt(e,t,o);return e.derive([t,s,r,i,c,u,f,h,p],(g,y,v,b,_,S,x,T,k)=>M=>{let C=v/_.width,R=b/_.height,O=eA([C,0,0,0,R,0,0,0,1],M);g.bindFramebuffer(g.FRAMEBUFFER,_.framebuffer),g.viewport(0,0,_.width,_.height),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),T(O),k(_.texture,S,x),g.bindFramebuffer(g.FRAMEBUFFER,S.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 v3t{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 b3t(e,t){let n=new ArrayBuffer(4288),r=e.statefulDerive([t,4288,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX],s0);return{buffer:r,update:e.derive([t,r],(i,o)=>s=>{let a=new v3t(n);a.u32(s.count),a.u32(s.category_count),a.i32(s.framebuffer_width),a.i32(s.framebuffer_height),a.i32(s.density_width),a.i32(s.density_height),a.f32(s.gamma),a.f32(s.point_size),a.f32(s.point_alpha),a.f32(s.points_alpha),a.f32(s.density_scaler),a.f32(s.quantization_step),a.f32(s.density_alpha),a.f32(s.contours_alpha),a.mat3x3f(s.matrix),a.vec2f(...s.view_xy_scaler),a.vec4f(...s.kde_causal),a.vec4f(...s.kde_anticausal),a.vec4f(...s.kde_a),a.vec4f(...s.background_color);let l=s.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([s,r.group0,r.group1,r.group2A,o.countBuffer,i.count],(a,l,c,u,f,h)=>p=>{if(p.clearBuffer(f),h==0)return;let g=p.beginComputePass();g.setPipeline(a),g.setBindGroup(0,l),g.setBindGroup(1,c),g.setBindGroup(2,u),h<=LT*FT?g.dispatchWorkgroups(Math.ceil(h/LT)):g.dispatchWorkgroups(FT,Math.ceil(h/(LT*FT))),g.end()})}function _3t(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 QV(e,t,n,r,i){let o=e.derive([t],f=>_3t(f)),s=e.derive([t,o,n],(f,h,p)=>f.createBindGroup({layout:h.group0,entries:[{binding:0,resource:{buffer:p}}]})),a=e.derive([t,o,r.x,r.y,r.category],(f,h,p,g,y)=>f.createBindGroup({layout:h.group1,entries:[{binding:0,resource:{buffer:p}},{binding:1,resource:{buffer:g}},{binding:2,resource:{buffer:y??p}}]})),l=e.derive([t,o,i.countBuffer,i.blurBuffer],(f,h,p,g)=>f.createBindGroup({layout:h.group2A,entries:[{binding:0,resource:{buffer:p}}]})),c=e.derive([t,o,i.countBuffer,i.blurBuffer],(f,h,p,g)=>f.createBindGroup({layout:h.group2B,entries:[{binding:1,resource:{buffer:p}},{binding:2,resource:{buffer:g}}]})),u=e.derive([t,o,i.colorTexture,i.alphaTexture],(f,h,p,g)=>f.createBindGroup({layout:h.group3,entries:[{binding:0,resource:f.createSampler({})},{binding:1,resource:p.createView()},{binding:2,resource:g.createView()}]}));return{layouts:o,group0:s,group1:a,group2A:l,group2B:c,group3:u}}function w3t(e,t,n,r,i){const o=e.derive([t,n,r.layouts],(s,a,l)=>s.createRenderPipeline({layout:s.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([o,r.group0,r.group1,r.group2B,i.colorTexture,i.alphaTexture],(s,a,l,c,u,f)=>h=>{let p=h.beginRenderPass({colorAttachments:[{loadOp:"load",storeOp:"store",view:u.createView()},{loadOp:"load",storeOp:"store",view:f.createView()}]});p.setPipeline(s),p.setBindGroup(0,a),p.setBindGroup(1,l),p.setBindGroup(2,c),p.draw(4),p.end()})}function x3t(e,t,n,r,i,o){const s=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:o.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:o.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return e.derive([s,r.group0,r.group1,i.count,o.colorTexture,o.alphaTexture],(a,l,c,u,f,h)=>p=>{let g=p.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 S3t(e,t,n,r,i){const o=e.derive([t,n,i.layouts],(s,a,l)=>s.createRenderPipeline({layout:s.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([o,i.group0,i.group1,i.group2B,i.group3],(s,a,l,c,u)=>(f,h)=>{let p=f.beginRenderPass({colorAttachments:[{clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store",view:h}]});p.setPipeline(s),p.setBindGroup(0,a),p.setBindGroup(1,l),p.setBindGroup(2,c),p.setBindGroup(3,u),p.draw(4),p.end()})}const MD=64;function tW(e,t,n,r,i,o,s){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,o,s],(c,u,f,h,p,g,y,v,b)=>_=>{let S=_.beginComputePass();S.setBindGroup(0,f),S.setBindGroup(1,h),S.setBindGroup(2,p),S.setBindGroup(3,g),S.setPipeline(c),S.dispatchWorkgroups(Math.ceil(y/MD),b),S.setPipeline(u),S.dispatchWorkgroups(Math.ceil(v/MD),b),S.end()})}function E3t(e,t=!1){const n=new Float64Array(5),r=new Float64Array(4);T3t(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]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function T3t(e,t,n){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),o=Math.exp(-1.723/n),s=.6318/n,a=1.997/n,l=Float64Array.of(-i*Math.cos(s),i*Math.sin(s),-i*Math.cos(-s),i*Math.sin(-s),-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*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,p;for(p=2;p<8;p+=2){for(u[p]=l[p]*u[p-2]-l[p+1]*u[p-1],u[p+1]=l[p]*u[p-1]+l[p+1]*u[p-2],h=p-2;h>0;h-=2)u[h]+=l[p]*u[h-2]-l[p+1]*u[h-1],u[h+1]+=l[p]*u[h-1]+l[p+1]*u[h-2];for(h=0;h<=p;h+=2)u[h]+=r[p]*f[h]-r[p+1]*f[h+1],u[h+1]+=r[p]*f[h+1]+r[p+1]*f[h];for(f[p+2]=l[p]*f[p]-l[p+1]*f[p+1],f[p+3]=l[p]*f[p+1]+l[p+1]*f[p],h=p;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=u[h]/c,e[p+1]=f[h+2]}function eW(e){let t=E3t(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 k3t=`// 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 M3t{props;viewport;df;device;module;uniforms;context;renderInputs;dataBuffers;renderer;constructor(t,n,r,i,o){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:o},this.viewport=new lx({x:0,y:0,scale:1},i,o),this.df=new Ud;let s=this.df;this.renderInputs={mode:s.value(this.props.mode),colorScheme:s.value(this.props.colorScheme),xData:s.value(this.props.x),yData:s.value(this.props.y),categoryData:s.value(this.props.category),categoryCount:s.value(this.props.categoryCount),categoryColors:s.value(this.props.categoryColors),matrix:s.value(YV()),width:s.value(i),height:s.value(o),pointSize:s.value(this.props.pointSize),densityBandwidth:s.value(this.props.densityBandwidth)},this.device=s.value(n),this.dataBuffers=C3t(s,this.device,this.renderInputs),this.module=s.derive([this.device],a=>a.createShaderModule({code:k3t})),this.uniforms=b3t(s,this.device),this.renderer=A3t(s,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 o=this.df.subgraph(),{x:s,y:a,scale:l}=i,c=[l,0,0,0,l,0,-s*l,-a*l,1],u=GV(c),f=await R3t(o,this.device,this.module,this.uniforms,o.value(t),o.value(n),o.value(r),o.value(c),this.dataBuffers).value();return o.destroy(),{data:f,width:t,height:n,coordinateAtPixel:(h,p)=>{let g=h/t*2-1,y=p/n*2-1,v=HV([g,y,1],u);return{x:v[0],y:v[1]}}}}}function C3t(e,t,n){let r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;const i=e.derive([n.xData],u=>u.length),o=e.derive([i],u=>u*4),s=i,a=e.statefulDerive([t,e.statefulDerive([t,o,r],s0),n.xData],MT),l=e.statefulDerive([t,e.statefulDerive([t,o,r],s0),n.yData],MT),c=e.statefulDerive([t,e.statefulDerive([t,s,r],s0),n.categoryData],MT);return{x:a,y:l,category:c,count:i}}function nW(e,t,n,r,i,o,s){let a="rgba16float",l="r16float",c=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,u=e.statefulDerive([t,n,r,a,c],eD),f=e.statefulDerive([t,n,r,l,c],eD),h=e.derive([i,o,s],(v,b,_)=>v*b*_*4),p=e.derive([i,o,s],(v,b,_)=>v*b*_*2),g=e.statefulDerive([t,h,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC],s0),y=e.statefulDerive([t,p,GPUBufferUsage.STORAGE],s0);return{colorTexture:u,alphaTexture:f,colorTextureFormat:a,alphaTextureFormat:l,countBuffer:g,blurBuffer:y}}function A3t(e,t,n,r,i,o,s){let a=e.derive([o.densityBandwidth],T=>Math.ceil(T*3)+1),l=e.derive([o.width,a],(T,k)=>T+k*2),c=e.derive([o.height,a],(T,k)=>T+k*2),u=e.derive([l],T=>Math.ceil(T/4)),f=e.derive([c],T=>Math.ceil(T/4)),h=nW(e,t,l,c,u,f,o.categoryCount),p=QV(e,t,r.buffer,s,h),g=ZV(e,t,n,p,s,h),y=x3t(e,t,n,p,s,h),v=w3t(e,t,n,p,h),b=S3t(e,t,n,i,p),_=tW(e,t,n,p,l,c,o.categoryCount),S=e.derive([o.densityBandwidth,l,u],(T,k,M)=>eW(T/k*M)),x=e.derive([o.categoryColors,o.categoryCount],(T,k)=>(T==null&&(T=dg(k)),T.map(M=>tA(M))));return e.derive([t,l,c,u,f,r.update,s.count,o.matrix,x,y,b,g,_,v,S],(T,k,M,C,R,O,N,L,$,I,F,D,P,z,q)=>(U,V)=>{let G=U.colorScheme=="light"?[1,1,1,1]:[0,0,0,1],Z=U.width/k,lt=U.height/M,pt=eA([Z,0,0,0,lt,0,0,0,1],L);O({count:N,category_count:U.categoryCount,framebuffer_width:k,framebuffer_height:M,density_width:C,density_height:R,gamma:U.gamma,point_size:Math.max(U.mode=="points"?3:1,U.pointSize),point_alpha:U.pointAlpha,points_alpha:U.pointsAlpha,density_scaler:U.densityScaler/(4*4),quantization_step:U.densityQuantizationStep,density_alpha:U.densityAlpha,contours_alpha:U.contoursAlpha,matrix:pt,view_xy_scaler:[1/Z,1/lt],kde_causal:q.kde_causal,kde_anticausal:q.kde_anticausal,kde_a:q.kde_a,background_color:G,category_colors:$});let dt=T.createCommandEncoder();I(dt),U.mode=="density"&&(U.densityAlpha>0||U.contoursAlpha>0)&&(D(dt),P(dt),z(dt)),F(dt,V),T.queue.submit([dt.finish()])})}function R3t(e,t,n,r,i,o,s,a,l){let c=nW(e,t,i,o,i,o,e.value(1)),u=QV(e,t,r.buffer,l,c),f=ZV(e,t,n,u,l,c),h=tW(e,t,n,u,i,o,e.value(1));return e.derive([t,i,o,l.count,r.update,s,a,f,h,c.countBuffer],(p,g,y,v,b,_,S,x,T,k)=>()=>{let M=p.createCommandEncoder(),C=eW(_);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:S,view_xy_scaler:[1,1],kde_causal:C.kde_causal,kde_anticausal:C.kde_anticausal,kde_a:C.kde_a,background_color:[0,0,0,0],category_colors:[]}),x(M),T(M);let R=p.createBuffer({size:g*y*2,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});return M.copyBufferToBuffer(k,0,R,0,g*y*2),p.queue.submit([M.finish()]),R.mapAsync(GPUMapMode.READ,0,g*y*2).then(()=>N3t(R.getMappedRange()))})}function N3t(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+=p*g)}return h=a.x-u,p=a.y-f,h*h+p*p}function r(a,l){for(var c=a[0],u=[c],f,h=1,p=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,p,g=l+1;gh&&(p=g,h=y)}h>u&&(p-l>1&&i(a,l,p,u,f),f.push(a[p]),c-p>1&&i(a,p,c,u,f))}function o(a,l){var c=a.length-1,u=[a[0]];return i(a,0,c,l,u),u.push(a[c]),u}function s(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=o(a,u),a}e.exports=s,e.exports.default=s})()}(CD)),CD.exports}var D3t=O3t();const RD=I3t(D3t);function L3t(e,t){let n=e.slice();for(let r=0;rt&&s<20;)i*=1.1,s+=1,o=RD(n,i);return o}const ND={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:"#fff",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 $3t(e,t){return e==null?ND[t]:{...ND[t],...e,...e[t]!=null?e[t]:{}}}let $T=null,cM=new Map;function B3t(){return $T==null&&($T=new Promise((e,t)=>{let n=new Worker(new URL(""+new URL("clustering.worker-CcYaKFL9.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=cM.get(r.data.id);i!=null&&(cM.delete(r.data.id),i(r.data))}}})),$T}function rW(e,t,n=[]){return new Promise((r,i)=>{B3t().then(o=>{let s=new Date().getTime().toString()+"-"+Math.random().toString();cM.set(s,a=>{r(a.payload)}),o.postMessage({id:s,name:e,payload:t},n)})})}let P3t=(e,t,n,r)=>rW("findClusters",{density_map:e,width:t,height:n,options:r},[e.buffer]),U3t=(e,t)=>rW("dynamicLabelPlacement",{labels:e,options:t});function z3t(e,t,n,r,i,o){let s=Math.max(r,i)/o,a=e/(n*n)/(s*s),l=1/(a/(o*o))*.2,c=Math.sqrt(e/t/(s*s)),u=Math.log(c),f=Math.log(n),h=(Math.min(Math.max((f-u)*2,-1),1)+1)/2,p=.25/Math.sqrt(a),g=Math.max(.2,Math.min(5,p))*o,y=1-h,v=.5+h*.5;return{densityScaler:l,densityAlpha:y,contoursAlpha:y,pointSize:g,pointAlpha:.7,pointsAlpha:v,densityBandwidth:20}}var q3t=rh("
    "),j3t=Iu(""),V3t=Iu(""),W3t=Iu(' '),Y3t=Iu(""),H3t=Iu(""),G3t=Iu(""),X3t=rh('
    ');function J3t(e,t){Bd(t,!0);let n=le(t,"data",19,()=>({x:new Float32Array,y:new Float32Array,category:null})),r=le(t,"categoryCount",3,1),i=le(t,"categoryColors",3,null),o=le(t,"width",3,800),s=le(t,"height",3,800),a=le(t,"pixelRatio",3,2),l=le(t,"colorScheme",3,"light"),c=le(t,"theme",3,null),u=le(t,"mode",3,"density"),f=le(t,"minimumDensity",3,1/16),h=le(t,"totalCount",3,null),p=le(t,"maxDensity",3,null),g=le(t,"automaticLabels",3,!1),y=le(t,"queryClusterLabels",3,null),v=le(t,"tooltip",7,null),b=le(t,"selection",7,null),_=le(t,"querySelection",3,null),S=le(t,"rangeSelection",7,null),x=le(t,"defaultViewportState",3,null),T=le(t,"viewportState",7,null),k=le(t,"customTooltip",3,null),M=le(t,"customOverlay",3,null),C=le(t,"onViewportState",3,null),R=le(t,"onTooltip",3,null),O=le(t,"onSelection",3,null),N=le(t,"onRangeSelection",3,null),L=se(()=>$3t(c(),l())),$=se(()=>i()??dg(r())),I=se(()=>T()??x()??{x:0,y:0,scale:1}),F=se(()=>new lx(X(I),o(),s())),D=se(()=>X(F).pixelLocationFunction()),P=se(()=>X(F).coordinateAtPixelFunction());function z(Rt,Yt){return Rt.x==Yt.x&&Rt.y==Yt.y&&Rt.category==Yt.category&&Rt.text==Yt.text}let q=se(()=>b()?.length==1&&v()!=null&&z(b()[0],v()));function U(Rt){bf(T(),Rt)||(T(Rt),C()?.(Rt))}function V(Rt){bf(v(),Rt)||(v(Rt),R()?.(Rt))}function G(Rt){bf(b(),Rt)||(b(Rt),O()?.(Rt))}function Z(Rt){bf(S(),Rt)||(S(Rt),N()?.(Rt))}let lt=Sr(hf([])),pt=Sr(null),dt=Sr("none"),at=se(()=>o()*a()),yt=se(()=>s()*a()),nt=Sr(null),gt=Sr(null),vt=Sr(null),st=se(()=>z3t(p()??(h()??n().x.length)/4,f(),X(I).scale,X(at),X(yt),a())),Bt=se(()=>X(st).pointSize),Dt=!0;ix(()=>{X(gt)?.setProps({mode:u(),colorScheme:l(),viewportX:X(I).x,viewportY:X(I).y,viewportScale:X(I).scale,width:X(at),height:X(yt),x:n().x,y:n().y,category:n().category,categoryCount:r(),categoryColors:X($),...X(st)})&&(Ct(),g()!==!1&&Dt&&X(gt)!=null&&n().x!=null&&n().x.length>0&&x()!=null&&(Dt=!1,sr(x())))});function zt(){jt=null,!(!X(nt)||!X(gt))&&(X(nt).width=X(gt).props.width,X(nt).height=X(gt).props.height,X(nt).style.width=`${X(gt).props.width/a()}px`,X(nt).style.height=`${X(gt).props.height/a()}px`,X(gt).render())}let jt=null;function Ct(){jt==null&&(jt=requestAnimationFrame(zt))}function Xt(Rt){let Yt;function Wt(){Yt=Rt.getContext("webgl2",{antialias:!1}),Yt.getExtension("EXT_color_buffer_float"),Yt.getExtension("EXT_float_blend"),Yt.getExtension("OES_texture_float_linear"),De(gt,new h3t(Yt,X(at),X(yt)),!0)}Wt(),Rt.addEventListener("webglcontextlost",()=>{X(gt)?.destroy(),De(gt,null),Yt=null}),Rt.addEventListener("webglcontextrestored",()=>{Wt()})}function Pt(Rt){async function Yt(){let Wt=Rt.getContext("webgpu");if(Wt==null){console.error("Could not get WebGPU canvas context");return}let Ht=await navigator.gpu.requestAdapter();if(!Ht){console.error("Could not request WebGPU adapter");return}let Zt=512*1048576,qe=512*1048576;Zt=Math.min(Zt,Ht.limits.maxBufferSize),qe=Math.min(qe,Ht.limits.maxStorageBufferBindingSize);let an={requiredLimits:{maxBufferSize:Zt,maxStorageBufferBindingSize:qe},requiredFeatures:["shader-f16"]},xt=await Ht.requestDevice(an);xt.lost.then(Ut=>{console.info(`WebGPU device was lost: ${Ut.message}`),Ut.reason!="destroyed"&&(X(gt)?.destroy(),De(gt,null),Yt())});let Nt=navigator.gpu.getPreferredCanvasFormat();Wt.configure({device:xt,format:Nt,alphaMode:"premultiplied"}),De(gt,new M3t(Wt,xt,Nt,X(at),X(yt)),!0)}Yt()}function Lt(Rt){Rt!=null&&T()==null&&U(Rt)}ix(()=>Lt(x())),KC(()=>{X(nt)!=null&&(eV()?Pt(X(nt)):(Xt(X(nt)),De(vt,"WebGPU is unavailable. If you are using Safari, please enable the WebGPU feature flag.")))}),rSt(()=>{X(gt)?.destroy(),De(gt,null)});function Gt(Rt,Yt){let{x:Wt,y:Ht,scale:Zt}=X(I);V(null);let qe=Math.min(100,Math.max(.01,Zt*Rt)),an=X(nt).getBoundingClientRect(),xt=Math.max(an.width,an.height),Nt=(Yt.x-an.width/2)/xt*2,Ut=(an.height/2-Yt.y)/xt*2,Ge=Wt+Nt/Zt-Nt/qe,Ze=Ht+Ut/Zt-Ut/qe;U({x:Ge,y:Ze,scale:qe})}function we(Rt,Yt){V(null);let Wt="pan";switch(X(dt)!="none"?Yt.shift||(Wt=X(dt)):Yt.shift&&(Wt=Yt.meta?"lasso":"marquee"),Wt){case"marquee":return{move:Ht=>{if(V(null),X(gt)==null)return;let Zt=X(P)(Rt.x,Rt.y),qe=X(P)(Ht.x,Ht.y);Z({xMin:Math.min(Zt.x,qe.x),yMin:Math.min(Zt.y,qe.y),xMax:Math.max(Zt.x,qe.x),yMax:Math.max(Zt.y,qe.y)})}};case"lasso":{let Ht=[X(P)(Rt.x,Rt.y)];return{move:Zt=>{V(null),X(gt)!=null&&(Ht=[...Ht,X(P)(Zt.x,Zt.y)],Ht.length>=3&&Z(F3t(Ht,24)))}}}case"pan":{let Ht=X(P)(0,0),Zt=X(P)(1,1),qe=Ht.x-Zt.x,an=Ht.y-Zt.y,xt=X(I).x,Nt=X(I).y;return{move:Ut=>{U({x:xt+(Ut.x-Rt.x)*qe,y:Nt+(Ut.y-Rt.y)*an,scale:X(I).scale})}}}}}async function Jt(Rt,Yt){if(S()!=null)Z(null);else{const Wt=await Ye(Rt);if(Wt==null)G([]),V(null);else if(Yt.shift||Yt.ctrl||Yt.meta){let Ht=b()?.findIndex(Zt=>Zt.x==Wt.x&&Zt.y==Wt.y&&Zt.category==Wt.category);b()==null||Ht==null||Ht<0?(G([...b()??[],Wt]),V(Wt)):(G([...b().slice(0,Ht),...b().slice(Ht+1)]),V(null))}else G([Wt]),V(Wt)}}async function Be(Rt){if(b()!=null&&b().length==1){let Yt=X(D)(b()[0].x,b()[0].y);Rt!=null&&cSt(Rt,Yt)<10&&V(b()[0])}else V(await Ye(Rt))}async function Ye(Rt){if(X(gt)==null||Rt==null||_()==null)return null;let{x:Yt,y:Wt}=X(P)(Rt.x,Rt.y),Ht=Math.abs(X(P)(Rt.x+1,Rt.y).x-Yt);return await _()(Yt,Wt,Ht)}function Mn(){return v()!=null}let He=se(()=>X(nt)?lSt(X(nt),{zoom:Gt,drag:we,hover:aSt(Be,Mn),click:Jt}):null);async function $e(Rt,Yt,Wt){let Ht=await Rt.densityMap(1e3,1e3,Yt,Wt),Zt=await P3t(Ht.data,Ht.width,Ht.height,{union_threshold:Yt}),qe=[];for(let xt=0;xt{let ue=Ht.coordinateAtPixel(Ze,ln),Qn=Ht.coordinateAtPixel(ar,tn);return{xMin:Math.min(ue.x,Qn.x),xMax:Math.max(ue.x,Qn.x),yMin:Math.min(ue.y,Qn.y),yMax:Math.max(ue.y,Qn.y)}});qe.push({x:Ut.x,y:Ut.y,sum_density:Nt.sum_density,rects:Ge,bandwidth:Yt})}let an=qe.reduce((xt,Nt)=>Math.max(xt,Nt.sum_density),0)*.005;return qe.filter(xt=>xt.sum_density>an)}async function Ke(Rt){if(X(gt)==null)return[];let Yt=await fSt({generateLabels:Rt});if(typeof g()=="object"&&g().cache){let Zt=await g().cache.get(Yt);if(Zt!=null)return Zt}De(pt,"Generating clusters...");let Wt=await $e(X(gt),10,Rt);if(Wt=Wt.concat(await $e(X(gt),5,Rt)),De(pt,"Generating labels (initializing)..."),y())for(let Zt=0;ZtZt.label!=null).map(Zt=>({text:Zt.label,x:Zt.x,y:Zt.y,priority:Zt.sum_density,level:Zt.bandwidth==10?0:1}));return typeof g()=="object"&&g().cache&&await g().cache.set(Yt,Ht),Ht}async function sr(Rt){if(X(gt)==null)return;let Yt=new lx(Rt,o(),s()),Wt=await Ke(Rt),Ht=Rt.scale,Zt=Rt.scale/2,qe=Zt*4,an=Wt.map(Nt=>{let Ut=Yt.pixelLocation(Nt.x,Nt.y),Ge=Nt.level==0?14:12,Ze=PSt({text:Nt.text,fontSize:Ge,fontFamily:X(L).fontFamily});Ze.width+=4,Ze.height+=4;let ln=Ht/qe;return{text:Nt.text,fontSize:Ge,bounds:{xMin:Ut.x-Ze.width/2,xMax:Ut.x+Ze.width/2,yMin:Ut.y-Ze.height/2,yMax:Ut.y+Ze.height/2},locationAtZero:Ut,priority:Nt.priority,minScale:Nt.level==0?ln/1.2:null,maxScale:Nt.level==0?null:ln,coordinate:{x:Nt.x,y:Nt.y},placement:null}}),xt=await U3t(an,{globalMaxScale:Ht/Zt});for(let Nt=0;NtDe(nt,Rt),()=>X(nt));var Qr=Ir(li,2);let _l;var dh=ki(Qr);{var Pu=Rt=>{var Yt=om();const Wt=se(()=>zV(M())),Ht=se(()=>({location:X(D),width:o(),height:s()}));var Zt=Pp(Yt);H2t(Zt,()=>X(Wt),qe=>{var an=q3t();K2t(an,(xt,Nt)=>X(Wt)?.(xt,Nt),()=>qV(M(),{proxy:X(Ht)})),Xr(qe,an)}),Xr(Rt,Yt)};Vo(dh,Rt=>{M()&&Rt(Pu)})}hi(Qr);var io=Ir(Qr,2);io.__mousedown=function(...Rt){X(He)?.mousedown?.apply(this,Rt)},io.__mousemove=function(...Rt){X(He)?.mousemove?.apply(this,Rt)},xn(io,"",{},{position:"absolute",left:"0",top:"0"});var Uu=ki(io);{var ph=Rt=>{var Yt=om();const Wt=se(()=>{const{x:an,y:xt}=X(D)(v().x,v().y);return{x:an,y:xt}}),Ht=se(()=>Math.max(3,X(Bt)/a())+1);var Zt=Pp(Yt);{var qe=an=>{var xt=j3t();let Nt;Ms(()=>{Qt(xt,"cx",X(Wt).x),Qt(xt,"cy",X(Wt).y),Qt(xt,"r",X(Ht)),Nt=xn(xt,"",Nt,{stroke:l()=="light"?"#000":"#fff","stroke-width":1,fill:"none"})}),Xr(an,xt)};Vo(Zt,an=>{isFinite(X(Wt).x)&&isFinite(X(Wt).y)&&isFinite(X(Ht))&&an(qe)})}Xr(Rt,Yt)};Vo(Uu,Rt=>{v()!=null&&X(gt)!=null&&Rt(ph)})}var zu=Ir(Uu);{var Hd=Rt=>{var Yt=om(),Wt=Pp(Yt);RT(Wt,17,b,AT,(Ht,Zt)=>{var qe=om();const an=se(()=>{const{x:Ze,y:ln}=X(D)(X(Zt).x,X(Zt).y);return{x:Ze,y:ln}}),xt=se(()=>X(Zt).category!=null?X($)[X(Zt).category]:X($)[0]),Nt=se(()=>Math.max(3,X(Bt)/a())+1);var Ut=Pp(qe);{var Ge=Ze=>{var ln=V3t();let ar;Ms(()=>{Qt(ln,"cx",X(an).x),Qt(ln,"cy",X(an).y),Qt(ln,"r",X(Nt)),ar=xn(ln,"",ar,{stroke:l()=="light"?"#000":"#fff","stroke-width":2,fill:X(xt)})}),Xr(Ze,ln)};Vo(Ut,Ze=>{isFinite(X(an).x)&&isFinite(X(an).y)&&isFinite(X(Nt))&&Ze(Ge)})}Xr(Ht,qe)}),Xr(Rt,Yt)};Vo(zu,Rt=>{b()!=null&&X(gt)!=null&&Rt(Hd)})}var gh=Ir(zu);{var Ng=Rt=>{var Yt=G3t();RT(Yt,21,()=>X(lt),AT,(Wt,Ht)=>{var Zt=H3t();const qe=se(()=>X(Ht).text.split(` +`)),an=se(()=>X(D)(X(Ht).coordinate.x,X(Ht).coordinate.y)),xt=se(()=>X(Ht).placement!=null&&X(Ht).placement.minScale<=X(I).scale&&X(I).scale<=X(Ht).placement.maxScale);var Nt=ki(Zt);{var Ut=Ge=>{var Ze=Y3t();RT(Ze,21,()=>X(qe),AT,(ln,ar,tn)=>{var ue=W3t();Qt(ue,"x",0);let Qn;var Yr=ki(ue,!0);hi(ue),Ms(()=>{Qt(ue,"y",(tn-(X(qe).length-1)/2)*X(Ht).fontSize),Qt(ue,"font-size",X(Ht).fontSize),Qn=xn(ue,"",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}),Xm(Yr,X(ar))}),Xr(ln,ue)}),hi(Ze),Xr(Ge,Ze)};Vo(Nt,Ge=>{X(xt)&&Ge(Ut)})}hi(Zt),Ms(()=>Qt(Zt,"transform",`translate(${X(an).x??""},${X(an).y??""})`)),Xr(Wt,Zt)}),hi(Yt),Xr(Rt,Yt)};Vo(gh,Rt=>{Rt(Ng)})}var Gd=Ir(gh);{var mh=Rt=>{var Yt=om(),Wt=Pp(Yt);{var Ht=qe=>{dSt(qe,{get value(){return S()},get pointLocation(){return X(D)}})},Zt=qe=>{const an=se(()=>X(He)?.preventHover??(()=>{}));sSt(qe,{get value(){return S()},onChange:Z,get pointLocation(){return X(D)},get coordinateAtPoint(){return X(P)},get preventHover(){return X(an)}})};Vo(Wt,qe=>{S()instanceof Array?qe(Ht):qe(Zt,!1)})}Xr(Rt,Yt)};Vo(Gd,Rt=>{S()!=null&&X(gt)!=null&&Rt(mh)})}hi(io);var yh=Ir(io,2);{var Ig=Rt=>{const Yt=se(()=>X(D)(v().x,v().y)),Wt=se(()=>Math.max(3,X(Bt)/a())),Ht=se(()=>k()??{class:Pi,props:{colorScheme:l(),fontFamily:X(L).fontFamily}});TSt(Rt,{get location(){return X(Yt)},get allowInteraction(){return X(q)},get targetHeight(){return X(Wt)},get customTooltip(){return X(Ht)},get tooltip(){return v()}})};Vo(yh,Rt=>{v()!=null&&X(gt)!=null&&Rt(Ig)})}var Xd=Ir(yh,2);{var vh=Rt=>{const Yt=se(()=>X(pt)??X(vt)),Wt=se(()=>1/(X(D)(1,0).x-X(D)(0,0).x));xSt(Rt,{get resolvedTheme(){return X(L)},get statusMessage(){return X(Yt)},get distancePerPoint(){return X(Wt)},get pointCount(){return n().x.length},get selectionMode(){return X(dt)},onSelectionMode:Ht=>De(dt,Ht,!0)})};Vo(Xd,Rt=>{X(L).statusBar&&Rt(vh)})}return hi(Ui),Ms(()=>{hs=xn(Ui,"",hs,{width:`${o()??""}px`,height:`${s()??""}px`,position:"relative"}),_l=xn(Qr,"",_l,{width:`${o()??""}px`,height:`${s()??""}px`,position:"absolute",top:"0",left:"0"}),Qt(io,"width",o()),Qt(io,"height",s())}),lD("wheel",io,function(...Rt){X(He)?.wheel?.apply(this,Rt)}),lD("mouseleave",io,function(...Rt){X(He)?.mouseleave?.apply(this,Rt)}),Xr(e,Ui),Pd({updateLabels:sr})}JC(["mousedown","mousemove"]);let K3t="i|me|my|myself|we|our|ours|ourselves|you|you're|you've|you'll|you'd|your|yours|yourself|yourselves|he|him|his|himself|she|she's|her|hers|herself|it|it's|its|itself|they|them|their|theirs|themselves|what|which|who|whom|this|that|that'll|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|s|t|can|will|just|don|don't|should|should've|now|d|ll|m|o|re|ve|y|ain|aren|aren't|couldn|couldn't|didn|didn't|doesn|doesn't|hadn|hadn't|hasn|hasn't|haven|haven't|isn|isn't|ma|mightn|mightn't|mustn|mustn't|needn|needn't|shan|shan't|shouldn|shouldn't|wasn|wasn't|weren|weren't|won|won't|wouldn|wouldn't",Z3t="de|la|que|el|en|y|a|los|del|se|las|por|un|para|con|no|una|su|al|lo|como|más|pero|sus|le|ya|o|este|sí|porque|esta|entre|cuando|muy|sin|sobre|también|me|hasta|hay|donde|quien|desde|todo|nos|durante|todos|uno|les|ni|contra|otros|ese|eso|ante|ellos|e|esto|mí|antes|algunos|qué|unos|yo|otro|otras|otra|él|tanto|esa|estos|mucho|quienes|nada|muchos|cual|poco|ella|estar|estas|algunas|algo|nosotros|mi|mis|tú|te|ti|tu|tus|ellas|nosotras|vosotros|vosotras|os|mío|mía|míos|mías|tuyo|tuya|tuyos|tuyas|suyo|suya|suyos|suyas|nuestro|nuestra|nuestros|nuestras|vuestro|vuestra|vuestros|vuestras|esos|esas|estoy|estás|está|estamos|estáis|están|esté|estés|estemos|estéis|estén|estaré|estarás|estará|estaremos|estaréis|estarán|estaría|estarías|estaríamos|estaríais|estarían|estaba|estabas|estábamos|estabais|estaban|estuve|estuviste|estuvo|estuvimos|estuvisteis|estuvieron|estuviera|estuvieras|estuviéramos|estuvierais|estuvieran|estuviese|estuvieses|estuviésemos|estuvieseis|estuviesen|estando|estado|estada|estados|estadas|estad|he|has|ha|hemos|habéis|han|haya|hayas|hayamos|hayáis|hayan|habré|habrás|habrá|habremos|habréis|habrán|habría|habrías|habríamos|habríais|habrían|había|habías|habíamos|habíais|habían|hube|hubiste|hubo|hubimos|hubisteis|hubieron|hubiera|hubieras|hubiéramos|hubierais|hubieran|hubiese|hubieses|hubiésemos|hubieseis|hubiesen|habiendo|habido|habida|habidos|habidas|soy|eres|es|somos|sois|son|sea|seas|seamos|seáis|sean|seré|serás|será|seremos|seréis|serán|sería|serías|seríamos|seríais|serían|era|eras|éramos|erais|eran|fui|fuiste|fue|fuimos|fuisteis|fueron|fuera|fueras|fuéramos|fuerais|fueran|fuese|fueses|fuésemos|fueseis|fuesen|sintiendo|sentido|sentida|sentidos|sentidas|siente|sentid|tengo|tienes|tiene|tenemos|tenéis|tienen|tenga|tengas|tengamos|tengáis|tengan|tendré|tendrás|tendrá|tendremos|tendréis|tendrán|tendría|tendrías|tendríamos|tendríais|tendrían|tenía|tenías|teníamos|teníais|tenían|tuve|tuviste|tuvo|tuvimos|tuvisteis|tuvieron|tuviera|tuvieras|tuviéramos|tuvierais|tuvieran|tuviese|tuvieses|tuviésemos|tuvieseis|tuviesen|teniendo|tenido|tenida|tenidos|tenidas|tened",Q3t="au|aux|avec|ce|ces|dans|de|des|du|elle|en|et|eux|il|ils|je|la|le|les|leur|lui|ma|mais|me|même|mes|moi|mon|ne|nos|notre|nous|on|ou|par|pas|pour|qu|que|qui|sa|se|ses|son|sur|ta|te|tes|toi|ton|tu|un|une|vos|votre|vous|c|d|j|l|à|m|n|s|t|y|été|étée|étées|étés|étant|étante|étants|étantes|suis|es|est|sommes|êtes|sont|serai|seras|sera|serons|serez|seront|serais|serait|serions|seriez|seraient|étais|était|étions|étiez|étaient|fus|fut|fûmes|fûtes|furent|sois|soit|soyons|soyez|soient|fusse|fusses|fût|fussions|fussiez|fussent|ayant|ayante|ayantes|ayants|eu|eue|eues|eus|ai|as|avons|avez|ont|aurai|auras|aura|aurons|aurez|auront|aurais|aurait|aurions|auriez|auraient|avais|avait|avions|aviez|avaient|eut|eûmes|eûtes|eurent|aie|aies|ait|ayons|ayez|aient|eusse|eusses|eût|eussions|eussiez|eussent",tEt="aber|alle|allem|allen|aller|alles|als|also|am|an|ander|andere|anderem|anderen|anderer|anderes|anderm|andern|anderr|anders|auch|auf|aus|bei|bin|bis|bist|da|damit|dann|der|den|des|dem|die|das|dass|daß|derselbe|derselben|denselben|desselben|demselben|dieselbe|dieselben|dasselbe|dazu|dein|deine|deinem|deinen|deiner|deines|denn|derer|dessen|dich|dir|du|dies|diese|diesem|diesen|dieser|dieses|doch|dort|durch|ein|eine|einem|einen|einer|eines|einig|einige|einigem|einigen|einiger|einiges|einmal|er|ihn|ihm|es|etwas|euer|eure|eurem|euren|eurer|eures|für|gegen|gewesen|hab|habe|haben|hat|hatte|hatten|hier|hin|hinter|ich|mich|mir|ihr|ihre|ihrem|ihren|ihrer|ihres|euch|im|in|indem|ins|ist|jede|jedem|jeden|jeder|jedes|jene|jenem|jenen|jener|jenes|jetzt|kann|kein|keine|keinem|keinen|keiner|keines|können|könnte|machen|man|manche|manchem|manchen|mancher|manches|mein|meine|meinem|meinen|meiner|meines|mit|muss|musste|nach|nicht|nichts|noch|nun|nur|ob|oder|ohne|sehr|sein|seine|seinem|seinen|seiner|seines|selbst|sich|sie|ihnen|sind|so|solche|solchem|solchen|solcher|solches|soll|sollte|sondern|sonst|über|um|und|uns|unsere|unserem|unseren|unser|unseres|unter|viel|vom|von|vor|während|war|waren|warst|was|weg|weil|weiter|welche|welchem|welchen|welcher|welches|wenn|werde|werden|wie|wieder|will|wir|wird|wirst|wo|wollen|wollte|würde|würden|zu|zum|zur|zwar|zwischen";function eEt(...e){let t=[];for(let n of e){let r=n.split("|");t=t.concat(r)}return t}let nEt=eEt(K3t,Z3t,Q3t,tEt);class rEt{coordinator;tableName;xColumn;yColumn;textColumn;derivedTableDF;derivedTableBins;initialized;xBinSize;yBinSize;x0;y0;constructor(t){this.coordinator=t.coordinator,this.tableName=t.table,this.xColumn=t.x,this.yColumn=t.y,this.textColumn=t.text,this.derivedTableDF=this.tableName+"_df",this.derivedTableBins=this.tableName+"_bt",this.initialized=!1,this.xBinSize=1,this.yBinSize=1,this.x0=0,this.y0=0}async initialize(){if(this.initialized)return;let t=kt(this.xColumn),n=kt(this.yColumn),r=kt(this.textColumn),i=await this.coordinator.query(ee` + SELECT + MIN(${t}) AS xMin, QUANTILE_CONT(${t}, 0.99) - QUANTILE_CONT(${t}, 0.01) AS xDiff, + MIN(${n}) AS yMin, QUANTILE_CONT(${n}, 0.99) - QUANTILE_CONT(${n}, 0.01) AS yDiff, + COUNT(*) AS count + FROM ${this.tableName} + `),{xMin:o,yMin:s,xDiff:a,yDiff:l,count:c}=i.get(0);this.x0=o,this.y0=s,this.xBinSize=a/200,this.yBinSize=l/200;let u=c<1e4?1:5;await this.coordinator.exec(ee` + + `),await this.coordinator.exec(ee` + CREATE OR REPLACE TEMP MACRO embedding_view_tokenize(s) AS + unnest(string_split_regex(regexp_replace(lower(s), '[^a-z0-9'']', ' ', 'g'), '\\s+')); + + CREATE OR REPLACE TABLE ${this.derivedTableBins} AS ( + WITH tokens_all AS ( + SELECT + floor((${t} - ${this.x0}) / ${this.xBinSize})::INT + 32768 * (floor((${n} - ${this.y0}) / ${this.yBinSize})::INT) as xykey, + embedding_view_tokenize(${r}) AS token + FROM ${this.tableName} + ) + SELECT xykey, token, COUNT(*) AS count + FROM tokens_all + WHERE token NOT IN ('',${nEt.map(f=>ne(f)).join(",")}) AND LENGTH(token) >= 3 + GROUP BY xykey, token + HAVING count >= ${u} + ); + CREATE OR REPLACE TABLE ${this.derivedTableDF} AS ( + SELECT sum(count) AS count, stem(token, 'english') AS stem_token + FROM ${this.derivedTableBins} GROUP BY stem_token + ); + `),this.initialized=!0}indices(t){let n=new Set;for(let{xMin:r,yMin:i,xMax:o,yMax:s}of t){let a=Math.floor((r-this.x0)/this.xBinSize),l=Math.floor((o-this.x0)/this.xBinSize),c=Math.floor((i-this.y0)/this.yBinSize),u=Math.floor((s-this.y0)/this.yBinSize);for(let f=a;f<=l;f++)for(let h=c;h<=u;h++){let p=h*32768+f;n.add(p)}}return Array.from(n)}async summarize(t,n=4){await this.initialize();let r=this.indices(t),i=ee` + WITH tokens_tf AS ( + SELECT token, sum(count) AS count + FROM ${this.derivedTableBins} + WHERE xykey IN (${r.join(",")}) + GROUP BY token + ), + tokens_tf_stem AS ( + SELECT sum(count) AS count, stem(token, 'english') AS stem_token, ARG_MAX(token, count) AS token + FROM tokens_tf + GROUP BY stem_token + ) + SELECT + tokens_tf_stem.count AS tf, + ${this.derivedTableDF}.count AS df, + tf * log(1 + (SELECT sum(count) FROM tokens_tf_stem) / df) AS tfidf, + tokens_tf_stem.token AS token + FROM ${this.derivedTableDF}, tokens_tf_stem + WHERE ${this.derivedTableDF}.stem_token == tokens_tf_stem.stem_token + ORDER BY tfidf DESC limit ${n} + `;return(await this.coordinator.query(i)).getChild("token").toArray()}}function ID(e,t){if(t.length==0)return ne(!1);if(e.identifier!=null){let n=e.identifier;return Eo(...t.map(r=>Ss(kt(n),ne(r.identifier))))}else{let n=e.x,r=e.y,i=e.category;return i!=null?Eo(...t.map(o=>Ci(Ss(Jr(kt(n),"DOUBLE"),ne(o.x)),Ss(Jr(kt(r),"DOUBLE"),ne(o.y)),Ss(Jr(kt(i),"INTEGER"),ne(o.category))))):Eo(...t.map(o=>Ci(Ss(Jr(kt(n),"DOUBLE"),ne(o.x)),Ss(Jr(kt(r),"DOUBLE"),ne(o.y)))))}}function iEt(e,t,n){let r=[];for(let o=0;oHn(o,s));return Ss(ugt(i,ne(2)),ne(1))}function oEt(e,t){if(t instanceof Array){if(t.length<3)return ne(!1);let n=UV(t);return Ci(To(kt(e.x),[n.xMin,n.xMax]),To(kt(e.y),[n.yMin,n.yMax]),iEt(kt(e.x),kt(e.y),t))}else return Ci(To(kt(e.x),[t.xMin,t.xMax]),To(kt(e.y),[t.yMin,t.yMax]))}async function sEt(e,t){let{x:n,y:r,table:i}=t,o=await e.query(qt.from(i).select({centerX:ee`MEDIAN(${kt(n)})`,centerY:ee`MEDIAN(${kt(r)})`,stdX:ee`STDDEV(${kt(n)})`,stdY:ee`STDDEV(${kt(r)})`,...t.category!=null?{maxCategory:ee`MAX(${kt(t.category)}::UTINYINT)`}:{}})),{centerX:s,centerY:a,stdX:l,stdY:c,maxCategory:u}=o.get(0),f=1/(Math.max(l,c,.001)*3),h=.1/f,p=ee`FLOOR((${kt(n)} - ${s}) / ${h})`,g=ee`FLOOR((${kt(r)} - ${a}) / ${h})`,y=t.category!=null?kt(t.category):null,v=y!=null?[p,g,y]:[p,g],b=qt.from(qt.from(i).select({count:ee`COUNT(*)`}).groupby(...v)).select({totalCount:ee`SUM(count)::INT`,maxCount:ee`MAX(count)::INT`});o=await e.query(b);let{maxCount:_,totalCount:S}=o.get(0),x=_/(h*h);return{centerX:s,centerY:a,scaler:f,totalCount:S,categoryCount:(u??0)+1,maxDensity:x}}class aEt{coordinator;source;lastDistance;selectParams;constructor(t,n){this.coordinator=t,this.source=n,this.lastDistance=0;let{x:r,y:i,category:o,text:s,identifier:a}=this.source,l={},c=n.additionalFields??{};for(let u in c){let f=c[u];typeof f=="string"?l["field_"+u]=kt(f):l["field_"+u]=ee`${f.sql}`}this.selectParams={x:ee`${kt(r)}::DOUBLE`,y:ee`${kt(i)}::DOUBLE`,...o!=null?{category:ee`${kt(o)}::INT`}:{},...s!=null?{text:ee`${kt(s)}`}:{},...a!=null?{identifier:ee`${kt(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 o=i*12,{x:s,y:a}=this.source;for(let l of[this.lastDistance,o]){if(l==0||l>o)continue;let c=qt.from(this.source.table).select(this.selectParams);c=c.where(ee`${kt(s)} BETWEEN ${n-l} AND ${n+l}`),c=c.where(ee`${kt(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=qt.from(n).select(this.selectParams);return i=i.where(fd(kt(r),t.map(o=>ne(o)))),Array.from(await this.coordinator.query(i)).map(o=>this._convertToDataPoint(o))}}function lEt(e){let t=e.coordinator??Ia(),n=new cEt({...e,coordinator:t});return t.connect(n),n.destroy=()=>{t.disconnect(n)},n}class cEt extends Id{_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 uEt(e,t){Bd(t,!0);let n=le(t,"coordinator",19,Ia),r=le(t,"category",3,null),i=le(t,"text",3,null),o=le(t,"identifier",3,null),s=le(t,"filter",3,null),a=le(t,"categoryColors",3,null),l=le(t,"tooltip",3,null),c=le(t,"additionalFields",3,null),u=le(t,"selection",3,null),f=le(t,"rangeSelection",3,null),h=le(t,"rangeSelectionValue",3,null),p=le(t,"width",3,null),g=le(t,"height",3,null),y=le(t,"pixelRatio",3,null),v=le(t,"colorScheme",3,"light"),b=le(t,"theme",3,null),_=le(t,"viewportState",3,null),S=le(t,"automaticLabels",3,!1),x=le(t,"mode",3,"density"),T=le(t,"minimumDensity",3,1/16),k=le(t,"customTooltip",3,null),M=le(t,"customOverlay",3,null),C=le(t,"onViewportState",3,null),R=le(t,"onTooltip",3,null),O=le(t,"onSelection",3,null),N=le(t,"onRangeSelection",3,null),L=Sr(new Float32Array),$=Sr(new Float32Array),I=Sr(null),F=Sr(1),D=Sr(1),P=Sr(1),z=Sr(null),q=Sr(null),U=Sr(null),V=Sr(null),G=Sr(null);Pc(()=>{let Pt={coordinator:n(),source:{table:t.table,x:t.x,y:t.y,category:r()}},Lt=null,Gt=!1;async function we(){let Jt=Pt.source,Be=await sEt(Pt.coordinator,Jt);if(Gt)return;let Ye=Be.scaler*.95;De(z,{x:Be.centerX,y:Be.centerY,scale:Ye}),De(D,Be.totalCount),De(P,Be.maxDensity),De(F,Be.categoryCount),Lt=lEt({coordinator:Pt.coordinator,selection:s(),query:Mn=>qt.from(Jt.table).select({x:ee`${kt(Jt.x)}::FLOAT`,y:ee`${kt(Jt.y)}::FLOAT`,...Jt.category!=null?{c:ee`${kt(Jt.category)}::UTINYINT`}:{}}).where(Mn),queryResult:Mn=>{let He=Mn.getChild("x").toArray(),$e=Mn.getChild("y").toArray(),Ke=Mn.getChild("c")?.toArray()??null;He!=null&&!(He instanceof Float32Array)&&(He=new Float32Array(He)),$e!=null&&!($e instanceof Float32Array)&&($e=new Float32Array($e)),Ke!=null&&!(Ke instanceof Uint8Array)&&(Ke=new Uint8Array(Ke)),De(L,He),De($,$e),De(I,Ke),Z(null),lt(null)}}),Lt.reset=()=>{pt()},De(G,Lt)}return we(),()=>{De(G,null),Gt=!0,Lt?.destroy()}}),Pc(()=>{if(ko(l())){let Pt=X(G);if(Pt==null)return;let Lt=l();De(q,Lt.value);let Gt=()=>{De(q,Lt.value)};return Pc(()=>{let we=X(q),Jt={x:t.x,y:t.y,category:r(),identifier:o()};Lt.update({source:Pt,clients:new Set().add(Pt),predicate:we!=null?ID(Jt,[we]):null,value:we})}),Lt.addEventListener("value",Gt),()=>{Lt.removeEventListener("value",Gt),Lt.update({source:Pt,clients:new Set().add(Pt),value:null,predicate:null})}}else if(l()==null||typeof l()=="object")De(q,l());else{if(X(q)?.identifier==l())return;let Pt=!1;return yt([l()]).then(Lt=>{Pt||(Lt.length>0?De(q,Lt[0]):De(q,null))}),()=>{Pt=!0}}});function Z(Pt){bf(l(),Pt)||(De(q,Pt),R()?.(Pt))}Pc(()=>{if(ko(u())){let Pt=X(G);if(Pt==null)return;let Lt=u();De(U,Lt.value);let Gt=()=>{De(U,Lt.value)};return Pc(()=>{let we=X(U),Jt={x:t.x,y:t.y,category:r(),identifier:o()};Lt.update({source:Pt,clients:new Set().add(Pt),predicate:we!=null?ID(Jt,we):null,value:we})}),Lt.addEventListener("value",Gt),()=>{Lt.removeEventListener("value",Gt),Lt.update({source:Pt,clients:new Set().add(Pt),value:null,predicate:null})}}else if(u()==null)De(U,null);else if(u().length==0)De(U,[]);else if(u().every(Pt=>typeof Pt=="object"))De(U,u());else{let Pt=!1;return yt(u()).then(Lt=>{Pt||De(U,Lt)}),()=>{Pt=!0}}});function lt(Pt){bf(u(),Pt)||(De(U,Pt),O()?.(Pt))}Pc(()=>{let Pt=X(G);if(Pt==null)return;let Lt=f();if(Lt!=null)return Pc(()=>{let Gt=X(V),we={x:t.x,y:t.y},Jt={source:Pt,clients:new Set().add(Pt),predicate:Gt!=null?oEt(we,Gt):null,value:Gt};Lt.update(Jt),Lt.activate(Jt)}),()=>{Lt.update({source:Pt,clients:new Set().add(Pt),value:null,predicate:null})}}),Pc(()=>{bf(xd(()=>X(V)),h())||De(V,h())});function pt(){lt(null),Z(null),N()?.(null),De(V,null)}let dt=se(()=>new aEt(n(),{table:t.table,x:t.x,y:t.y,category:r(),text:i(),identifier:o(),additionalFields:c()}));async function at(Pt,Lt,Gt){return await X(dt).queryClosestPoint(s()?.predicate?.(X(G)),Pt,Lt,Gt)}async function yt(Pt){return await X(dt).queryPoints(Pt)}let nt=se(()=>i()!=null?new rEt({coordinator:n(),table:t.table,x:t.x,y:t.y,text:i()}):null);async function gt(Pt){if(X(nt)==null)return null;let Lt=await X(nt).summarize(Pt,4);return Lt.length>0?Lt.slice(0,2).join("-")+`- +`+Lt.slice(2).join("-"):null}const vt=se(()=>x()??"points"),st=se(()=>p()??800),Bt=se(()=>g()??800),Dt=se(()=>y()??2),zt=se(()=>v()??"light"),jt=se(()=>({x:X(L),y:X($),category:X(I)})),Ct=se(()=>i()!=null?S()??!1:!1),Xt=se(()=>T()??1/16);J3t(e,{get mode(){return X(vt)},get width(){return X(st)},get height(){return X(Bt)},get pixelRatio(){return X(Dt)},get colorScheme(){return X(zt)},get theme(){return b()},get data(){return X(jt)},get totalCount(){return X(D)},get maxDensity(){return X(P)},get categoryCount(){return X(F)},get categoryColors(){return a()},get defaultViewportState(){return X(z)},querySelection:at,queryClusterLabels:gt,get automaticLabels(){return X(Ct)},get minimumDensity(){return X(Xt)},get customTooltip(){return k()},get customOverlay(){return M()},get tooltip(){return X(q)},onTooltip:Z,get selection(){return X(U)},onSelection:lt,get viewportState(){return _()},get onViewportState(){return C()},get rangeSelection(){return X(V)},onRangeSelection:Pt=>{De(V,Pt),N()?.(Pt)}}),Pd()}let fEt=class{component;currentProps;constructor(t,n){this.currentProps={...n},this.component=V2t({component:uEt,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 hEt(){return eV()?32:4}let dEt;const pEt=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&pEt.decode();const iW=new Array(128).fill(void 0);iW.push(void 0,null,!0,!1);iW.length;const BT=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}};BT.encodeInto;typeof FinalizationRegistry>"u"||new FinalizationRegistry(e=>dEt.__wbg_densitymap_free(e>>>0));function oW(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 ${kt(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:cx(r.column_type),distinctCount:await this.distinctCount(r.column_name)});return n}async defaultViewportScale(t,n){let{stdX:r,stdY:i}=await this.queryOne(qt.from(this.table).select({stdX:ee`STDDEV(${kt(t)})::FLOAT`,stdY:ee`STDDEV(${kt(n)})::FLOAT`}));return 1/(Math.max(r,i,.001)*3)}defaultPlots(t){let n=[{id:Lh(),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:Lh(),title:r.name,spec:T_({name:r.name,type:"discrete"})});break;case"string[]":n.push({id:Lh(),title:r.name,spec:T_({name:r.name,type:"discrete[]"})});break;case"number":r.distinctCount<=10?n.push({id:Lh(),title:r.name,spec:T_({name:r.name,type:"discrete"})}):n.push({id:Lh(),title:r.name,spec:sW({name:r.name})});break}return n}async makeCategoryColumn(t,n){let r=`_ev_${t}_id`,i=Array.from(await this.query(qt.from(this.table).select({value:Jr(kt(t),"TEXT"),count:er()}).where(v0(Ga(Jr(kt(t),"TEXT")))).groupby(Jr(kt(t),"TEXT")).orderby(ig(er())).limit(n))),o=i.length,s=i.length+1;await this.exec(ee` + ALTER TABLE ${this.table} ADD COLUMN IF NOT EXISTS ${kt(r)} INTEGER DEFAULT 0; + UPDATE ${this.table} + SET ${kt(r)} = CASE ${kt(t)}::TEXT + ${i.map(({value:p},g)=>ee`WHEN ${ne(p)} THEN ${ne(g)}`).join(" ")} + ELSE (CASE WHEN ${kt(t)} IS NULL THEN ${ne(s)} ELSE ${ne(o)} END) END + `);let a=await this.query(ee` + SELECT ${kt(r)} AS index, COUNT(*)::INT AS count + FROM ${this.table} + GROUP BY ${kt(r)} + `),l=new Map;for(let p of a)l.set(p.index,p.count);let c=l.get(o)??0,u=l.get(s)??0,f=dg(i.length),h=i.map(({value:p},g)=>({label:p,color:f[g],predicate:Ss(Jr(kt(t),"TEXT"),ne(p)),count:l.get(g)??0}));if(c>0){let{otherCategoryCount:p}=await this.queryOne(ee` + SELECT COUNT(DISTINCT(${kt(t)}::TEXT)) AS otherCategoryCount + FROM ${this.table} + WHERE ${kt(r)} = ${ne(o)} AND ${kt(t)} IS NOT NULL + `);h.push({label:`(other ${p.toLocaleString()})`,color:"#9eabc2",predicate:i.length>0?ee`${kt(t)} IS NOT NULL AND ${kt(t)}::TEXT NOT IN (${i.map(g=>ne(g.value)).join(",")})`:ee`${kt(t)} IS NOT NULL`,count:c})}return u>0&&(c<=0&&(await this.exec(` + UPDATE ${this.table} + SET ${kt(r)} = ${kt(r)} - 1 WHERE ${kt(r)} = ${ne(s)} + `),s-=1),h.push({label:"(null)",color:"#aaaaaa",predicate:Ga(kt(t)),count:u})),{indexColumn:r,legend:h}}async makeBinnedNumericColumn(t){let n=await this.queryOne(qt.from(this.table).select({count:er(),min:tl(kt(t)),max:Ma(kt(t)),mean:Y2(kt(t)),median:H2(kt(t))}).where(Mf(kt(t)))),r=Kq(n),i=`_ev_${t}_id`,o=Jr(kt(t),"DOUBLE");o=r.scale.expr(o,r.scale.constant??0);let s=Xo(Mf(Jr(kt(t),"DOUBLE")),Ls(ze(Ue(o,r.binStart),1/r.binSize)),ne(null));await this.exec(ee` + ALTER TABLE ${this.table} ADD COLUMN IF NOT EXISTS ${kt(i)} INTEGER DEFAULT 0; + UPDATE ${this.table} + SET ${kt(i)} = ${s} + `);let a=await this.query(ee` + SELECT ${kt(i)} AS index, COUNT(*)::INT AS count + FROM ${this.table} + GROUP BY ${kt(i)} + ORDER BY ${kt(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=[],p=Oa(".6");if(l!=null&&c!=null){let g=oW(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:`[${p(v)}, ${p(b)})`,color:g[y-l],predicate:Ss(s,ne(y)),count:u.get(y)??0})}}if(u.has(null)){let g=h.length;await this.exec(` + UPDATE ${this.table} + SET ${kt(i)} = ${ne(g)} + WHERE ${kt(i)} IS NULL + `),h.push({label:"(null / nan / inf)",color:"#aaaaaa",predicate:Ga(s),count:u.get(null)??0})}return{indexColumn:i,legend:h}}}function cx(e){return TEt.has(e)?"number":kEt.has(e)?"string":e.match(/^(VARCHAR|TEXT)\[\d*\]$/)?"string[]":null}const TEt=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"]),kEt=new Set(["BOOLEAN","DATE","VARCHAR","CHAR","BPCHAR","TEXT","STRING"]);var MEt=(e,t,n)=>Y(t,n(),!0),CEt=St(""),AEt=St('
    X
    Y
    ',1),REt=St('
    Text
    Model

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

    ',1),NEt=St('
    Image
    Model

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

    ',1),IEt=St(`

    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 OEt(e,t){Ne(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=_t("precomputed"),o=_t(null),s=_t(null),a=_t(null),l=_t(null),c=_t(null),u=_t(null),f=_t(null),h=ht(()=>t.columns.filter(O=>cx(O.column_type)=="number")),p=ht(()=>t.columns.filter(O=>cx(O.column_type)=="string"));fe(()=>{let O=w(f);No(()=>w(a)==null)&&Y(a,O,!0)});function g(){let O={text:w(f),embedding:null};if(w(i)=="precomputed"&&w(o)!=null&&w(s)!=null&&(O.embedding={precomputed:{x:w(o),y:w(s)}}),w(i)=="from-text"&&w(a)!=null){let N=w(l)?.trim()??"";(N==null||N=="")&&(N=n[0]),O.embedding={compute:{column:w(a),type:"text",model:N}}}if(w(i)=="from-image"&&w(c)!=null){let N=w(u)?.trim()??"";(N==null||N=="")&&(N=r[0]),O.embedding={compute:{column:w(c),type:"image",model:N}}}t.onConfirm?.(O)}var y=IEt(),v=ot(y),b=mt(ot(v),4),_=mt(ot(b),2);const S=ht(()=>[{value:null,label:"(none)"},...w(p).map(O=>({value:O.column_name,label:`${O.column_name} (${O.column_type})`}))]);pa(_,{class:"flex-1",get value(){return w(f)},onChange:O=>Y(f,O,!0),get options(){return w(S)}}),et(b);var x=mt(b,8);Sn(x,20,()=>[["precomputed","Precomputed"],["from-text","From Text"],["from-image","From Image"],["none","Disabled"]],Fn,(O,N)=>{let L=()=>N[0],$=()=>N[1];var I=CEt();let F;I.__click=[MEt,i,L];var D=ot(I,!0);et(I),At(P=>{F=nr(I,1,"bg-slate-200 dark:bg-slate-700 dark:text-slate-400 px-2 py-1",null,F,P),ce(D,$())},[()=>({"!bg-slate-500":L()==w(i),"!text-slate-100":L()==w(i)})]),rt(O,I)}),et(x);var T=mt(x,2);{var k=O=>{var N=AEt(),L=re(N),$=mt(ot(L),2);const I=ht(()=>[{value:null,label:"(none)"},...w(h).map(z=>({value:z.column_name,label:`${z.column_name} (${z.column_type})`}))]);pa($,{class:"flex-1",get value(){return w(o)},onChange:z=>Y(o,z,!0),get options(){return w(I)}}),et(L);var F=mt(L,2),D=mt(ot(F),2);const P=ht(()=>[{value:null,label:"(none)"},...w(h).map(z=>({value:z.column_name,label:`${z.column_name} (${z.column_type})`}))]);pa(D,{class:"flex-1",get value(){return w(s)},onChange:z=>Y(s,z,!0),get options(){return w(P)}}),et(F),rt(O,N)},M=(O,N)=>{{var L=I=>{var F=REt(),D=re(F),P=mt(ot(D),2);const z=ht(()=>[{value:null,label:"(none)"},...w(p).map(V=>({value:V.column_name,label:`${V.column_name} (${V.column_type})`}))]);pa(P,{class:"flex-1",get value(){return w(a)},onChange:V=>Y(a,V,!0),get options(){return w(z)}}),et(D);var q=mt(D,2),U=mt(ot(q),2);yO(U,{className:"flex-1",get value(){return w(l)},get placeholder(){return`(default ${n[0]??""})`},onChange:V=>Y(l,V,!0),options:n}),et(q),ld(2),rt(I,F)},$=(I,F)=>{{var D=P=>{var z=NEt(),q=re(z),U=mt(ot(q),2);const V=ht(()=>[{value:null,label:"(none)"},...t.columns.map(lt=>({value:lt.column_name,label:`${lt.column_name} (${lt.column_type})`}))]);pa(U,{class:"flex-1",get value(){return w(c)},onChange:lt=>Y(c,lt,!0),get options(){return w(V)}}),et(q);var G=mt(q,2),Z=mt(ot(G),2);yO(Z,{className:"flex-1",get value(){return w(u)},get placeholder(){return`(default ${r[0]??""})`},onChange:lt=>Y(u,lt,!0),options:r}),et(G),ld(2),rt(P,z)};Ft(I,P=>{w(i)=="from-image"&&P(D)},F)}};Ft(O,I=>{w(i)=="from-text"?I(L):I($,!1)},N)}};Ft(T,O=>{w(i)=="precomputed"?O(k):O(M,!1)})}et(v);var C=mt(v,2),R=mt(ot(C),2);da(R,{label:"Confirm",class:"w-40 justify-center",onClick:()=>{g()}}),et(C),et(y),rt(e,y),Ie()}Fr(["click"]);function DEt(e,t,n){const r=Array.from(e.target.files);r.length==1&&t(r[0])&&n.onUpload(r[0])}var LEt=St('');function FEt(e,t){Ne(t,!0);let n=_t(!1),r;function i(p){p.preventDefault(),Y(n,!0)}function o(){Y(n,!1)}function s(p){if(p.preventDefault(),Y(n,!1),p.dataTransfer.files&&p.dataTransfer.files.length==1){let g=p.dataTransfer.files[0];a(g)&&t.onUpload(g)}}function a(p){if(t.extensions==null)return!0;for(let g of t.extensions)if(p.name.toLowerCase().endsWith(g.toLowerCase()))return!0;return!1}var l=LEt();l.__click=()=>{r.click()};var c=ot(l),u=ot(c),f=ot(u,!0);et(u),ld(2),et(c);var h=mt(c,2);h.__change=[DEt,a,t],rs(h,p=>r=p,()=>r),et(l),At(p=>{nr(l,1,`flex flex-col items-center w-[40rem] justify-center py-20 border-2 border-dashed rounded-md transition-all + ${w(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"}`),ce(f,w(n)?"Drop your files here":"Drag & drop files here or click to select"),ct(h,"accept",p)},[()=>t.extensions?.join(",")]),Jp("dragover",l,i),Jp("dragleave",l,o),Jp("drop",l,s),rt(e,l),Ie()}Fr(["click","change"]);function $Et(e){return e}function rA(e){const t=e-1;return t*t*t+1}function OD(e){return Object.prototype.toString.call(e)==="[object Date]"}function uM(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,o)=>uM(e[o],i));return i=>r.map(o=>o(i))}if(n==="object"){if(!e||!t)throw new Error("Object cannot be null");if(OD(e)&&OD(t)){const o=e.getTime(),a=t.getTime()-o;return l=>new Date(o+l*a)}const r=Object.keys(t),i={};return r.forEach(o=>{i[o]=uM(e[o],t[o])}),o=>{const s={};return r.forEach(a=>{s[a]=i[a](o)}),s}}if(n==="number"){const r=t-e;return i=>e+i*r}return()=>t}class iA{#t=ad(void 0);#e=ad(void 0);#n;#r=null;constructor(t,n={}){this.#t.v=this.#e.v=t,this.#n=n}static of(t,n){const r=new iA(t(),n);return Rd(()=>{r.set(t())}),r}set(t,n){Y(this.#e,t);let{delay:r=0,duration:i=400,easing:o=$Et,interpolate:s=uM}={...this.#n,...n};if(i===0)return this.#r?.abort(),Y(this.#t,t),Promise.resolve();const a=Il.now()+r;let l,c=!1,u=this.#r;return this.#r=QB(f=>{if(fi?(Y(this.#t,t),!1):(Y(this.#t,l(o(h/i))),!0)}),this.#r.promise}get current(){return w(this.#t)}get target(){return w(this.#e)}set target(t){this.set(t)}}function BEt(e){const t=e-1;return t*t*t+1}function ux(e,{delay:t=0,duration:n=400,easing:r=BEt,axis:i="y"}={}){const o=getComputedStyle(e),s=+o.opacity,a=i==="y"?"height":"width",l=parseFloat(o[a]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(b=>`${b[0].toUpperCase()}${b.slice(1)}`),f=parseFloat(o[`padding${u[0]}`]),h=parseFloat(o[`padding${u[1]}`]),p=parseFloat(o[`margin${u[0]}`]),g=parseFloat(o[`margin${u[1]}`]),y=parseFloat(o[`border${u[0]}Width`]),v=parseFloat(o[`border${u[1]}Width`]);return{delay:t,duration:n,easing:r,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*s};${a}: ${b*l}px;padding-${c[0]}: ${b*f}px;padding-${c[1]}: ${b*h}px;margin-${c[0]}: ${b*p}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 al=2,aW=4,TS=8,oA=16,Ou=32,gg=64,fx=128,Ds=256,hx=512,ls=1024,cc=2048,zd=4096,cu=8192,kS=16384,PEt=32768,MS=65536,UEt=1<<19,lW=1<<20,fM=1<<21,Qh=Symbol("$state"),cW=Symbol("legacy props"),zEt=Symbol(""),qEt=!1;var CS=Array.isArray,jEt=Array.prototype.indexOf,sA=Array.from,uW=Object.defineProperty,c0=Object.getOwnPropertyDescriptor,fW=Object.getOwnPropertyDescriptors,hW=Object.prototype,VEt=Array.prototype,AS=Object.getPrototypeOf,DD=Object.isExtensible;const WEt=()=>{};function dW(e){for(var t=0;t"u"?e=>setTimeout(e,1):requestIdleCallback;let zy=[],qy=[];function pW(){var e=zy;zy=[],dW(e)}function gW(){var e=qy;qy=[],dW(e)}function RS(e){zy.length===0&&queueMicrotask(pW),zy.push(e)}function HEt(e){qy.length===0&&YEt(gW),qy.push(e)}function LD(){zy.length>0&&pW(),qy.length>0&&gW()}function mW(e){return e===this.v}function aA(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function GEt(e,t){return e!==t}function yW(e){return!aA(e,this.v)}function XEt(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function JEt(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function KEt(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ZEt(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function QEt(){throw new Error("https://svelte.dev/e/hydration_failed")}function tTt(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function eTt(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function nTt(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let zv=!1,rTt=!1;function iTt(){zv=!0}const lA=1,cA=2,vW=4,oTt=8,sTt=16,aTt=1,lTt=2,uA="[",fA="[!",hA="]",Jm={},fo=Symbol(),cTt="http://www.w3.org/1999/xhtml",uTt=[];function bW(e,t=!1){return k_(e,new Map,"",uTt)}function k_(e,t,n,r,i=null){if(typeof e=="object"&&e!==null){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(CS(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var a=0;a{r.d=!0})}function ai(e){const t=Cr;if(t!==null){const s=t.e;if(s!==null){var n=Zn,r=dr;t.e=null;try{for(var i=0;i{var l=dr;uc(o);var c=a();return uc(l),c};return r&&n.set("length",te(e.length)),new Proxy(e,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&tTt();var u=n.get(l);return u===void 0?(u=s(()=>te(c.value)),n.set(l,u)):Mt(u,s(()=>Oi(c.value))),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0)l in a&&(n.set(l,s(()=>te(fo))),PT(i));else{if(r&&typeof l=="string"){var u=n.get("length"),f=Number(l);Number.isInteger(f)&&fte(Oi(f?a[l]:fo))),n.set(l,u)),u!==void 0){var h=H(u);return h===fo?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!==fo)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Qh)return!0;var c=n.get(l),u=c!==void 0&&c.v!==fo||Reflect.has(a,l);if(c!==void 0||Zn!==null&&(!u||c0(a,l)?.writable)){c===void 0&&(c=s(()=>te(u?Oi(a[l]):fo)),n.set(l,c));var f=H(c);if(f===fo)return!1}return u},set(a,l,c,u){var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;pte(fo)),n.set(p+"",g))}f===void 0?(!h||c0(a,l)?.writable)&&(f=s(()=>te(void 0)),Mt(f,s(()=>Oi(c))),n.set(l,f)):(h=f.v!==fo,Mt(f,s(()=>Oi(c))));var y=Reflect.getOwnPropertyDescriptor(a,l);if(y?.set&&y.set.call(u,c),!h){if(r&&typeof l=="string"){var v=n.get("length"),b=Number(l);Number.isInteger(b)&&b>=v.v&&Mt(v,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!==fo});for(var[c,u]of n)u.v!==fo&&!(c in a)&&l.push(c);return l},setPrototypeOf(){eTt()}})}function PT(e,t=1){Mt(e,e.v+t)}function NS(e){var t=al|cc,n=dr!==null&&(dr.f&al)!==0?dr:null;return Zn===null||n!==null&&(n.f&Ds)!==0?t|=Ds:Zn.f|=lW,{ctx:Cr,deps:null,effects:null,equals:mW,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:n??Zn}}function $t(e){const t=NS(e);return RW(t),t}function hTt(e){const t=NS(e);return t.equals=yW,t}function xW(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;ne.wv)return!0}(!r||Zn!==null&&!wf)&&ll(e,ls)}return!1}function gTt(e,t){for(var n=t;n!==null;){if((n.f&fx)!==0)try{n.fn(e);return}catch{n.f^=fx}n=n.parent}throw M_=!1,e}function BD(e){return(e.f&kS)===0&&(e.parent===null||(e.parent.f&fx)===0)}function IS(e,t,n,r){if(M_){if(n===null&&(M_=!1),BD(t))throw e;return}if(n!==null&&(M_=!0),gTt(e,t),BD(t))throw e}function OW(e,t,n=!0){var r=e.reactions;if(r!==null)for(var i=0;i0)for(f.length=ws+mo.length,h=0;h0;){t++>1e3&&yTt();var n=Km,r=n.length;Km=[];for(var i=0;i0;)dx=!0,LW(),LD();return t}function H(e){var t=e.f,n=(t&al)!==0;if(dr!==null&&!$l){if(!uu?.includes(e)){var r=dr.deps;e.rvnew Promise(r=>{n.outro?Wy(t,()=>{_u(t),r(void 0)}):(_u(t),r(void 0))})}function yg(e){return mg(aW,e,!1)}function $W(e){return mg(TS,e,!0)}function pi(e,t=[],n=NS){const r=t.map(n);return Hv(()=>e(...r.map(H)))}function Hv(e,t=0){return mg(TS|oA|t,e,!0)}function Ed(e,t=!0){return mg(TS|Ou,e,!0,t)}function BW(e){var t=e.teardown;if(t!==null){const n=Vv,r=dr;$D(!0),uc(null);try{t.call(null)}finally{$D(n),uc(r)}}}function PW(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){var r=n.next;(n.f&gg)!==0?n.parent=null:_u(n,t),n=r}}function kTt(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ou)===0&&_u(t),t=n}}function _u(e,t=!0){var n=!1;(t||(e.f&UEt)!==0)&&e.nodes_start!==null&&(MTt(e.nodes_start,e.nodes_end),n=!0),PW(e,t&&!n),mx(e,0),ll(e,kS);var r=e.transitions;if(r!==null)for(const o of r)o.stop();BW(e);var i=e.parent;i!==null&&i.first!==null&&UW(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function MTt(e,t){for(;e!==null;){var n=e===t?null:ih(e);e.remove(),e=n}}function UW(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 Wy(e,t){var n=[];mA(e,n,!0),zW(n,()=>{_u(e),t&&t()})}function zW(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function mA(e,t,n){if((e.f&cu)===0){if(e.f^=cu,e.transitions!==null)for(const s of e.transitions)(s.is_global||n)&&t.push(s);for(var r=e.first;r!==null;){var i=r.next,o=(r.f&MS)!==0||(r.f&Ou)!==0;mA(r,t,o?n:!1),r=i}}}function yx(e){qW(e,!0)}function qW(e,t){if((e.f&cu)!==0){e.f^=cu,(e.f&ls)===0&&(e.f^=ls),Wv(e)&&(ll(e,cc),OS(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&MS)!==0||(n.f&Ou)!==0;qW(n,i?t:!1),n=r}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}let PD=!1;function CTt(){PD||(PD=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function ATt(e){var t=dr,n=Zn;uc(null),jf(null);try{return e()}finally{uc(t),jf(n)}}const jW=new Set,yM=new Set;function RTt(e,t,n,r={}){function i(o){if(r.capture||Om.call(t,o),!o.cancelBubble)return ATt(()=>n?.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?RS(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Yy(e,t,n,r,i){var o={capture:r,passive:i},s=RTt(e,t,n,o);(t===document.body||t===window||t===document)&&FW(()=>{t.removeEventListener(e,s,o)})}function Du(e){for(var t=0;t{throw _});throw h}}finally{e.__root=t,delete e.currentTarget,uc(u),jf(f)}}}function NTt(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function u0(e,t){var n=Zn;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function On(e,t){var n=(t&aTt)!==0,r=(t&lTt)!==0,i,o=!e.startsWith("");return()=>{if(Nn)return u0(cr,null),cr;i===void 0&&(i=NTt(o?e:""+e),n||(i=Sd(i)));var s=r||kW?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Sd(s),l=s.lastChild;u0(a,l)}else u0(s,s);return s}}function vx(){if(Nn)return u0(cr,null),cr;var e=document.createDocumentFragment(),t=document.createComment(""),n=I0();return e.append(t,n),u0(t,n),e}function mn(e,t){if(Nn){Zn.nodes_end=cr,jv();return}e!==null&&e.before(t)}const ITt=["touchstart","touchmove"];function OTt(e){return ITt.includes(e)}function yc(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function VW(e,t){return WW(e,t)}function DTt(e,t){gM(),t.intro=t.intro??!1;const n=t.target,r=Nn,i=cr;try{for(var o=Sd(n);o&&(o.nodeType!==8||o.data!==uA);)o=ih(o);if(!o)throw Jm;eu(!0),Ka(o),jv();const s=WW(e,{...t,anchor:o});if(cr===null||cr.nodeType!==8||cr.data!==hA)throw pA(),Jm;return eu(!1),s}catch(s){if(s===Jm)return t.recover===!1&&QEt(),gM(),AW(n),eu(!1),VW(e,t);throw s}finally{eu(r),Ka(i)}}const vp=new Map;function WW(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:s=!0}){gM();var a=new Set,l=f=>{for(var h=0;h{var f=n??t.appendChild(I0());return Ed(()=>{if(o){si({});var h=Cr;h.c=o}i&&(r.$$events=i),Nn&&u0(f,null),c=e(f,r)||{},Nn&&(Zn.nodes_end=cr),o&&ai()}),()=>{for(var h of a){t.removeEventListener(h,Om);var p=vp.get(h);--p===0?(document.removeEventListener(h,Om),vp.delete(h)):vp.set(h,p)}yM.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return vM.set(c,u),c}let vM=new WeakMap;function LTt(e,t){const n=vM.get(e);return n?(vM.delete(e),n(t)):Promise.resolve()}function FTt(e){return new $Tt(e)}class $Tt{#t;#e;constructor(t){var n=new Map,r=(o,s)=>{var a=dA(s);return n.set(o,a),a};const i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return H(n.get(s)??r(s,Reflect.get(o,s)))},has(o,s){return s===cW?!0:(H(n.get(s)??r(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,a){return Mt(n.get(s)??r(s,a),a),Reflect.set(o,s,a)}});this.#e=(t.hydrate?DTt:VW)(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)&&_Tt(),this.#t=i.$$events;for(const o of Object.keys(this.#e))o==="$set"||o==="$destroy"||o==="$on"||uW(this,o,{get(){return this.#e[o]},set(s){this.#e[o]=s},enumerable:!0});this.#e.$set=o=>{Object.assign(i,o)},this.#e.$destroy=()=>{LTt(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 BTt="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(BTt);function Ts(e,t,[n,r]=[0,0]){Nn&&n===0&&jv();var i=e,o=null,s=null,a=fo,l=n>0?MS:0,c=!1;const u=(h,p=!0)=>{c=!0,f(p,h)},f=(h,p)=>{if(a===(a=h))return;let g=!1;if(Nn&&r!==-1){if(n===0){const v=i.data;v===uA?r=0:v===fA?r=1/0:(r=parseInt(v.substring(1)),r!==r&&(r=a?1/0:-1))}const y=r>n;!!a===y&&(i=dM(),Ka(i),eu(!1),g=!0,r=-1)}a?(o?yx(o):p&&(o=Ed(()=>p(i))),s&&Wy(s,()=>{s=null})):(s?yx(s):p&&(s=Ed(()=>p(i,[n+1,r]))),o&&Wy(o,()=>{o=null})),g&&eu(!0)};Hv(()=>{c=!1,t(u),c||f(null,null)},l),Nn&&(i=cr)}function PTt(e,t,n){Nn&&jv();var r=e,i=fo,o,s=qv()?GEt:aA;Hv(()=>{s(i,i=t())&&(o&&Wy(o),o=Ed(()=>n(r)))}),Nn&&(r=cr)}function UTt(e,t){return t}function zTt(e,t,n,r){for(var i=[],o=t.length,s=0;s0&&i.length===0&&n!==null;if(a){var l=n.parentNode;AW(l),l.append(n),r.clear(),cf(e,t[0].prev,t[o-1].next)}zW(i,()=>{for(var c=0;c{var p=n();return CS(p)?p:p==null?[]:sA(p)});Hv(()=>{var p=H(h),g=p.length;if(f&&g===0)return;f=g===0;let y=!1;if(Nn){var v=s.data===fA;v!==(g===0)&&(s=dM(),Ka(s),eu(!1),y=!0)}if(Nn){for(var b=null,_,S=0;S0&&Ka(dM())}Nn||qTt(p,a,s,i,t,r,n),o!==null&&(g===0?u?yx(u):u=Ed(()=>o(s)):u!==null&&Wy(u,()=>{u=null})),y&&eu(!0),H(h)}),Nn&&(s=cr)}function qTt(e,t,n,r,i,o,s){var a=(i&oTt)!==0,l=(i&(lA|cA))!==0,c=e.length,u=t.items,f=t.first,h=f,p,g=null,y,v=[],b=[],_,S,x,T;if(a)for(T=0;T0){var $=(i&vW)!==0&&c===0?n:null;if(a){for(T=0;T{if(y!==void 0)for(x of y)x.a?.apply()}),Zn.first=t.first&&t.first.e,Zn.last=g&&g.e}function jTt(e,t,n,r){(r&lA)!==0&&hM(e.v,t),(r&cA)!==0?hM(e.i,n):e.i=n}function YW(e,t,n,r,i,o,s,a,l,c){var u=(l&lA)!==0,f=(l&sTt)===0,h=u?f?dA(i):Vy(i):i,p=(l&cA)===0?s:Vy(s),g={i:p,v:h,k:o,a:null,e:null,prev:n,next:r};try{return g.e=Ed(()=>a(e,h,p,c),Nn),g.e.prev=n&&n.e,g.e.next=r&&r.e,n===null?t.first=g:(n.next=g,n.e.next=g.e),r!==null&&(r.prev=g,r.e.prev=g.e),g}finally{}}function UD(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,o=e.e.nodes_start;o!==r;){var s=ih(o);i.before(o),o=s}}function cf(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 yA(e,t,...n){var r=e,i=WEt,o;Hv(()=>{i!==(i=t())&&(o&&(_u(o),o=null),o=Ed(()=>i(r,...n)))},MS),Nn&&(r=cr)}function Zr(e,t){RS(()=>{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 vA(e,t,n){yg(()=>{var r=Yv(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,o={};$W(()=>{var s=n();xTt(s),i&&aA(o,s)&&(o=s,r.update(s))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function VTt(e,t,n){var r=e==null?"":""+e;return t&&(r=r?r+" "+t:t),r===""?null:r}function zD(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var o=e[i];o!=null&&o!==""&&(r+=" "+i+": "+o+n)}return r}function WTt(e,t){if(t){var n="",r,i;return Array.isArray(t)?(r=t[0],i=t[1]):r=t,r&&(n+=zD(r)),i&&(n+=zD(i,!0)),n=n.trim(),n===""?null:n}return String(e)}function Vf(e,t,n,r,i,o){var s=e.__className;if(Nn||s!==n||s===void 0){var a=VTt(n,r);(!Nn||a!==e.getAttribute("class"))&&(a==null?e.removeAttribute("class"):e.className=a),e.__className=n}return o}function UT(e,t={},n,r){for(var i in n){var o=n[i];t[i]!==o&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,o,r))}}function cs(e,t,n,r){var i=e.__style;if(Nn||i!==t){var o=WTt(t,r);(!Nn||o!==e.getAttribute("style"))&&(o==null?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else r&&(Array.isArray(r)?(UT(e,n?.[0],r[0]),UT(e,n?.[1],r[1],"important")):UT(e,n,r));return r}const YTt=Symbol("is custom element"),HTt=Symbol("is html");function GTt(e){if(Nn){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;bx(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var i=e.checked;bx(e,"checked",null),e.checked=i}}};e.__on_r=n,HEt(n),CTt()}}function XTt(e,t){var n=HW(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function bx(e,t,n,r){var i=HW(e);Nn&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[zEt]=n),n==null?e.removeAttribute(t):typeof n!="string"&&JTt(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function HW(e){return e.__attributes??={[YTt]:e.nodeName.includes("-"),[HTt]:e.namespaceURI===cTt}}var qD=new Map;function JTt(e){var t=qD.get(e.nodeName);if(t)return t;qD.set(e.nodeName,t=[]);for(var n,r=e,i=Element.prototype;i!==r;){n=fW(r);for(var o in n)n[o].set&&t.push(o);r=AS(r)}return t}class bA{#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){bA.entries.set(n.target,n);for(var r of this.#t.get(n.target)||[])r(n)}}))}}var KTt=new bA({box:"border-box"});function cl(e,t,n){var r=KTt.observe(e,()=>n(e[t]));yg(()=>(Yv(()=>n(e[t])),r))}function jD(e,t){return e===t||e?.[Qh]===t}function es(e={},t,n,r){return yg(()=>{var i,o;return $W(()=>{i=o,o=[],Yv(()=>{e!==n(...o)&&(t(e,...o),i&&jD(n(...i),e)&&t(null,...i))})}),()=>{RS(()=>{o&&jD(n(...o),e)&&t(null,...o)})}}),e}function vg(e){Cr===null&&_W(),zv&&Cr.l!==null?ZTt(Cr).m.push(e):Pr(()=>{const t=Yv(e);if(typeof t=="function")return t})}function ZTt(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}let Ab=!1;function QTt(e){var t=Ab;try{return Ab=!1,[e(),Ab]}finally{Ab=t}}function VD(e){return e.ctx?.d??!1}function Gv(e,t,n,r){var i=!1,o;[o,i]=QTt(()=>e[t]);var s=Qh in e||cW in e,a=(c0(e,t)?.set??(s&&t in e&&(b=>e[t]=b)))||void 0,l=r,c=!0,u=!1,f=()=>(u=!0,c&&(c=!1,l=r),l),h;if(h=()=>{var b=e[t];return b===void 0?f():(c=!0,u=!1,b)},a){var p=e.$$legacy;return function(b,_){return arguments.length>0?((!_||p||i)&&a(_?h():b),b):h()}}var g=!1,y=dA(o),v=NS(()=>{var b=h(),_=H(y);return g?(g=!1,_):y.v=b});return H(v),function(b,_){if(arguments.length>0){const S=_?H(v):Oi(b);if(!v.equals(S)){if(g=!0,Mt(y,S),u&&l!==void 0&&(l=S),VD(v))return b;Yv(()=>H(v))}return b}return VD(v)?v.v:H(v)}}var xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var C_={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 tkt=C_.exports,WD;function ekt(){return WD||(WD=1,function(e,t){(function(){var n,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",a="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",f=1,h=2,p=4,g=1,y=2,v=1,b=2,_=4,S=8,x=16,T=32,k=64,M=128,C=256,R=512,O=30,N="...",L=800,$=16,I=1,F=2,D=3,P=1/0,z=9007199254740991,q=17976931348623157e292,U=NaN,V=4294967295,G=V-1,Z=V>>>1,lt=[["ary",M],["bind",v],["bindKey",b],["curry",S],["curryRight",x],["flip",R],["partial",T],["partialRight",k],["rearg",C]],pt="[object Arguments]",dt="[object Array]",at="[object AsyncFunction]",yt="[object Boolean]",nt="[object Date]",gt="[object DOMException]",vt="[object Error]",st="[object Function]",Bt="[object GeneratorFunction]",Dt="[object Map]",zt="[object Number]",jt="[object Null]",Ct="[object Object]",Xt="[object Promise]",Pt="[object Proxy]",Lt="[object RegExp]",Gt="[object Set]",we="[object String]",Jt="[object Symbol]",Be="[object Undefined]",Ye="[object WeakMap]",Mn="[object WeakSet]",He="[object ArrayBuffer]",$e="[object DataView]",Ke="[object Float32Array]",sr="[object Float64Array]",Pi="[object Int8Array]",Ui="[object Int16Array]",hs="[object Int32Array]",li="[object Uint8Array]",Qr="[object Uint8ClampedArray]",_l="[object Uint16Array]",dh="[object Uint32Array]",Pu=/\b__p \+= '';/g,io=/\b(__p \+=) '' \+/g,Uu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ph=/&(?:amp|lt|gt|quot|#39);/g,zu=/[&<>"']/g,Hd=RegExp(ph.source),gh=RegExp(zu.source),Ng=/<%-([\s\S]+?)%>/g,Gd=/<%([\s\S]+?)%>/g,mh=/<%=([\s\S]+?)%>/g,yh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ig=/^\w*$/,Xd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vh=/[\\^$.*+?()[\]{}|]/g,Rt=RegExp(vh.source),Yt=/^\s+/,Wt=/\s/,Ht=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Zt=/\{\n\/\* \[wrapped with (.+)\] \*/,qe=/,? & /,an=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,xt=/[()=,{}\[\]\/\s]/,Nt=/\\(\\)?/g,Ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ge=/\w*$/,Ze=/^[-+]0x[0-9a-f]+$/i,ln=/^0b[01]+$/i,ar=/^\[object .+?Constructor\]$/,tn=/^0o[0-7]+$/i,ue=/^(?:0|[1-9]\d*)$/,Qn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yr=/($^)/,Bo=/['\n\r\u2028\u2029\\]/g,Dn="\\ud800-\\udfff",Cn="\\u0300-\\u036f",qs="\\ufe20-\\ufe2f",ci="\\u20d0-\\u20ff",zi=Cn+qs+ci,qu="\\u2700-\\u27bf",w1="a-z\\xdf-\\xf6\\xf8-\\xff",B3="\\xac\\xb1\\xd7\\xf7",P3="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Jd="\\u2000-\\u206f",Ait=" \\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",B8="A-Z\\xc0-\\xd6\\xd8-\\xde",P8="\\ufe0e\\ufe0f",U8=B3+P3+Jd+Ait,U3="['’]",Rit="["+Dn+"]",z8="["+U8+"]",x1="["+zi+"]",q8="\\d+",Nit="["+qu+"]",j8="["+w1+"]",V8="[^"+Dn+U8+q8+qu+w1+B8+"]",z3="\\ud83c[\\udffb-\\udfff]",Iit="(?:"+x1+"|"+z3+")",W8="[^"+Dn+"]",q3="(?:\\ud83c[\\udde6-\\uddff]){2}",j3="[\\ud800-\\udbff][\\udc00-\\udfff]",Kd="["+B8+"]",Y8="\\u200d",H8="(?:"+j8+"|"+V8+")",Oit="(?:"+Kd+"|"+V8+")",G8="(?:"+U3+"(?:d|ll|m|re|s|t|ve))?",X8="(?:"+U3+"(?:D|LL|M|RE|S|T|VE))?",J8=Iit+"?",K8="["+P8+"]?",Dit="(?:"+Y8+"(?:"+[W8,q3,j3].join("|")+")"+K8+J8+")*",Lit="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fit="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Z8=K8+J8+Dit,$it="(?:"+[Nit,q3,j3].join("|")+")"+Z8,Bit="(?:"+[W8+x1+"?",x1,q3,j3,Rit].join("|")+")",Pit=RegExp(U3,"g"),Uit=RegExp(x1,"g"),V3=RegExp(z3+"(?="+z3+")|"+Bit+Z8,"g"),zit=RegExp([Kd+"?"+j8+"+"+G8+"(?="+[z8,Kd,"$"].join("|")+")",Oit+"+"+X8+"(?="+[z8,Kd+H8,"$"].join("|")+")",Kd+"?"+H8+"+"+G8,Kd+"+"+X8,Fit,Lit,q8,$it].join("|"),"g"),qit=RegExp("["+Y8+Dn+zi+P8+"]"),jit=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Vit=["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"],Wit=-1,xr={};xr[Ke]=xr[sr]=xr[Pi]=xr[Ui]=xr[hs]=xr[li]=xr[Qr]=xr[_l]=xr[dh]=!0,xr[pt]=xr[dt]=xr[He]=xr[yt]=xr[$e]=xr[nt]=xr[vt]=xr[st]=xr[Dt]=xr[zt]=xr[Ct]=xr[Lt]=xr[Gt]=xr[we]=xr[Ye]=!1;var br={};br[pt]=br[dt]=br[He]=br[$e]=br[yt]=br[nt]=br[Ke]=br[sr]=br[Pi]=br[Ui]=br[hs]=br[Dt]=br[zt]=br[Ct]=br[Lt]=br[Gt]=br[we]=br[Jt]=br[li]=br[Qr]=br[_l]=br[dh]=!0,br[vt]=br[st]=br[Ye]=!1;var Yit={À:"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"},Hit={"&":"&","<":"<",">":">",'"':""","'":"'"},Git={"&":"&","<":"<",">":">",""":'"',"'":"'"},Xit={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Jit=parseFloat,Kit=parseInt,Q8=typeof xf=="object"&&xf&&xf.Object===Object&&xf,Zit=typeof self=="object"&&self&&self.Object===Object&&self,Ri=Q8||Zit||Function("return this")(),W3=t&&!t.nodeType&&t,bh=W3&&!0&&e&&!e.nodeType&&e,tN=bh&&bh.exports===W3,Y3=tN&&Q8.process,js=function(){try{var ut=bh&&bh.require&&bh.require("util").types;return ut||Y3&&Y3.binding&&Y3.binding("util")}catch{}}(),eN=js&&js.isArrayBuffer,nN=js&&js.isDate,rN=js&&js.isMap,iN=js&&js.isRegExp,oN=js&&js.isSet,sN=js&&js.isTypedArray;function ds(ut,wt,bt){switch(bt.length){case 0:return ut.call(wt);case 1:return ut.call(wt,bt[0]);case 2:return ut.call(wt,bt[0],bt[1]);case 3:return ut.call(wt,bt[0],bt[1],bt[2])}return ut.apply(wt,bt)}function Qit(ut,wt,bt,Kt){for(var Pe=-1,An=ut==null?0:ut.length;++Pe-1}function H3(ut,wt,bt){for(var Kt=-1,Pe=ut==null?0:ut.length;++Kt-1;);return bt}function pN(ut,wt){for(var bt=ut.length;bt--&&Zd(wt,ut[bt],0)>-1;);return bt}function lot(ut,wt){for(var bt=ut.length,Kt=0;bt--;)ut[bt]===wt&&++Kt;return Kt}var cot=K3(Yit),uot=K3(Hit);function fot(ut){return"\\"+Xit[ut]}function hot(ut,wt){return ut==null?n:ut[wt]}function Qd(ut){return qit.test(ut)}function dot(ut){return jit.test(ut)}function pot(ut){for(var wt,bt=[];!(wt=ut.next()).done;)bt.push(wt.value);return bt}function eE(ut){var wt=-1,bt=Array(ut.size);return ut.forEach(function(Kt,Pe){bt[++wt]=[Pe,Kt]}),bt}function gN(ut,wt){return function(bt){return ut(wt(bt))}}function Wu(ut,wt){for(var bt=-1,Kt=ut.length,Pe=0,An=[];++bt-1}function est(d,m){var E=this.__data__,A=U1(E,d);return A<0?(++this.size,E.push([d,m])):E[A][1]=m,this}Sc.prototype.clear=Kot,Sc.prototype.delete=Zot,Sc.prototype.get=Qot,Sc.prototype.has=tst,Sc.prototype.set=est;function Ec(d){var m=-1,E=d==null?0:d.length;for(this.clear();++m=m?d:m)),d}function Hs(d,m,E,A,B,W){var J,tt=m&f,ft=m&h,Et=m&p;if(E&&(J=B?E(d,A,B,W):E(d)),J!==n)return J;if(!Br(d))return d;var Tt=je(d);if(Tt){if(J=oat(d),!tt)return Po(d,J)}else{var Ot=ji(d),Vt=Ot==st||Ot==Bt;if(Ku(d))return KN(d,tt);if(Ot==Ct||Ot==pt||Vt&&!B){if(J=ft||Vt?{}:mI(d),!tt)return ft?Gst(d,yst(J,d)):Hst(d,MN(J,d))}else{if(!br[Ot])return B?d:{};J=sat(d,Ot,tt)}}W||(W=new La);var ie=W.get(d);if(ie)return ie;W.set(d,J),WI(d)?d.forEach(function(Se){J.add(Hs(Se,m,E,Se,d,W))}):jI(d)&&d.forEach(function(Se,cn){J.set(cn,Hs(Se,m,E,cn,d,W))});var xe=Et?ft?ME:kE:ft?zo:Si,Qe=Tt?n:xe(d);return Vs(Qe||d,function(Se,cn){Qe&&(cn=Se,Se=d[cn]),Pg(J,cn,Hs(Se,m,E,cn,d,W))}),J}function vst(d){var m=Si(d);return function(E){return CN(E,d,m)}}function CN(d,m,E){var A=E.length;if(d==null)return!A;for(d=lr(d);A--;){var B=E[A],W=m[B],J=d[B];if(J===n&&!(B in d)||!W(J))return!1}return!0}function AN(d,m,E){if(typeof d!="function")throw new Ws(s);return Yg(function(){d.apply(n,E)},m)}function Ug(d,m,E,A){var B=-1,W=S1,J=!0,tt=d.length,ft=[],Et=m.length;if(!tt)return ft;E&&(m=Rr(m,ps(E))),A?(W=H3,J=!1):m.length>=i&&(W=Og,J=!1,m=new xh(m));t:for(;++BB?0:B+E),A=A===n||A>B?B:Xe(A),A<0&&(A+=B),A=E>A?0:HI(A);E0&&E(tt)?m>1?Ni(tt,m-1,E,A,B):Vu(B,tt):A||(B[B.length]=tt)}return B}var lE=rI(),IN=rI(!0);function wl(d,m){return d&&lE(d,m,Si)}function cE(d,m){return d&&IN(d,m,Si)}function q1(d,m){return ju(m,function(E){return Ac(d[E])})}function Eh(d,m){m=Xu(m,d);for(var E=0,A=m.length;d!=null&&Em}function wst(d,m){return d!=null&&jn.call(d,m)}function xst(d,m){return d!=null&&m in lr(d)}function Sst(d,m,E){return d>=qi(m,E)&&d=120&&Tt.length>=120)?new xh(J&&Tt):n}Tt=d[0];var Ot=-1,Vt=tt[0];t:for(;++Ot-1;)tt!==d&&O1.call(tt,ft,1),O1.call(d,ft,1);return d}function jN(d,m){for(var E=d?m.length:0,A=E-1;E--;){var B=m[E];if(E==A||B!==W){var W=B;Cc(B)?O1.call(d,B,1):bE(d,B)}}return d}function mE(d,m){return d+F1(SN()*(m-d+1))}function Fst(d,m,E,A){for(var B=-1,W=yi(L1((m-d)/(E||1)),0),J=bt(W);W--;)J[A?W:++B]=d,d+=E;return J}function yE(d,m){var E="";if(!d||m<1||m>z)return E;do m%2&&(E+=d),m=F1(m/2),m&&(d+=d);while(m);return E}function en(d,m){return DE(bI(d,m,qo),d+"")}function $st(d){return kN(up(d))}function Bst(d,m){var E=up(d);return Q1(E,Sh(m,0,E.length))}function jg(d,m,E,A){if(!Br(d))return d;m=Xu(m,d);for(var B=-1,W=m.length,J=W-1,tt=d;tt!=null&&++BB?0:B+m),E=E>B?B:E,E<0&&(E+=B),B=m>E?0:E-m>>>0,m>>>=0;for(var W=bt(B);++A>>1,J=d[W];J!==null&&!ms(J)&&(E?J<=m:J=i){var Et=m?null:Zst(d);if(Et)return T1(Et);J=!1,B=Og,ft=new xh}else ft=m?[]:tt;t:for(;++A=A?d:Gs(d,m,E)}var JN=Aot||function(d){return Ri.clearTimeout(d)};function KN(d,m){if(m)return d.slice();var E=d.length,A=vN?vN(E):new d.constructor(E);return d.copy(A),A}function SE(d){var m=new d.constructor(d.byteLength);return new N1(m).set(new N1(d)),m}function jst(d,m){var E=m?SE(d.buffer):d.buffer;return new d.constructor(E,d.byteOffset,d.byteLength)}function Vst(d){var m=new d.constructor(d.source,Ge.exec(d));return m.lastIndex=d.lastIndex,m}function Wst(d){return Bg?lr(Bg.call(d)):{}}function ZN(d,m){var E=m?SE(d.buffer):d.buffer;return new d.constructor(E,d.byteOffset,d.length)}function QN(d,m){if(d!==m){var E=d!==n,A=d===null,B=d===d,W=ms(d),J=m!==n,tt=m===null,ft=m===m,Et=ms(m);if(!tt&&!Et&&!W&&d>m||W&&J&&ft&&!tt&&!Et||A&&J&&ft||!E&&ft||!B)return 1;if(!A&&!W&&!Et&&d=tt)return ft;var Et=E[A];return ft*(Et=="desc"?-1:1)}}return d.index-m.index}function tI(d,m,E,A){for(var B=-1,W=d.length,J=E.length,tt=-1,ft=m.length,Et=yi(W-J,0),Tt=bt(ft+Et),Ot=!A;++tt1?E[B-1]:n,J=B>2?E[2]:n;for(W=d.length>3&&typeof W=="function"?(B--,W):n,J&&so(E[0],E[1],J)&&(W=B<3?n:W,B=1),m=lr(m);++A-1?B[W?m[J]:J]:n}}function sI(d){return Mc(function(m){var E=m.length,A=E,B=Ys.prototype.thru;for(d&&m.reverse();A--;){var W=m[A];if(typeof W!="function")throw new Ws(s);if(B&&!J&&K1(W)=="wrapper")var J=new Ys([],!0)}for(A=J?A:E;++A1&&dn.reverse(),Tt&&fttt))return!1;var Et=W.get(d),Tt=W.get(m);if(Et&&Tt)return Et==m&&Tt==d;var Ot=-1,Vt=!0,ie=E&y?new xh:n;for(W.set(d,m),W.set(m,d);++Ot1?"& ":"")+m[A],m=m.join(E>2?", ":" "),d.replace(Ht,`{ +/* [wrapped with `+m+`] */ +`)}function lat(d){return je(d)||Mh(d)||!!(wN&&d&&d[wN])}function Cc(d,m){var E=typeof d;return m=m??z,!!m&&(E=="number"||E!="symbol"&&ue.test(d))&&d>-1&&d%1==0&&d0){if(++m>=L)return arguments[0]}else m=0;return d.apply(n,arguments)}}function Q1(d,m){var E=-1,A=d.length,B=A-1;for(m=m===n?A:m;++E1?d[m-1]:n;return E=typeof E=="function"?(d.pop(),E):n,NI(d,E)});function II(d){var m=j(d);return m.__chain__=!0,m}function blt(d,m){return m(d),d}function tb(d,m){return m(d)}var _lt=Mc(function(d){var m=d.length,E=m?d[0]:0,A=this.__wrapped__,B=function(W){return aE(W,d)};return m>1||this.__actions__.length||!(A instanceof hn)||!Cc(E)?this.thru(B):(A=A.slice(E,+E+(m?1:0)),A.__actions__.push({func:tb,args:[B],thisArg:n}),new Ys(A,this.__chain__).thru(function(W){return m&&!W.length&&W.push(n),W}))});function wlt(){return II(this)}function xlt(){return new Ys(this.value(),this.__chain__)}function Slt(){this.__values__===n&&(this.__values__=YI(this.value()));var d=this.__index__>=this.__values__.length,m=d?n:this.__values__[this.__index__++];return{done:d,value:m}}function Elt(){return this}function Tlt(d){for(var m,E=this;E instanceof P1;){var A=TI(E);A.__index__=0,A.__values__=n,m?B.__wrapped__=A:m=A;var B=A;E=E.__wrapped__}return B.__wrapped__=d,m}function klt(){var d=this.__wrapped__;if(d instanceof hn){var m=d;return this.__actions__.length&&(m=new hn(this)),m=m.reverse(),m.__actions__.push({func:tb,args:[LE],thisArg:n}),new Ys(m,this.__chain__)}return this.thru(LE)}function Mlt(){return GN(this.__wrapped__,this.__actions__)}var Clt=Y1(function(d,m,E){jn.call(d,E)?++d[E]:Tc(d,E,1)});function Alt(d,m,E){var A=je(d)?aN:bst;return E&&so(d,m,E)&&(m=n),A(d,ge(m,3))}function Rlt(d,m){var E=je(d)?ju:NN;return E(d,ge(m,3))}var Nlt=oI(kI),Ilt=oI(MI);function Olt(d,m){return Ni(eb(d,m),1)}function Dlt(d,m){return Ni(eb(d,m),P)}function Llt(d,m,E){return E=E===n?1:Xe(E),Ni(eb(d,m),E)}function OI(d,m){var E=je(d)?Vs:Hu;return E(d,ge(m,3))}function DI(d,m){var E=je(d)?tot:RN;return E(d,ge(m,3))}var Flt=Y1(function(d,m,E){jn.call(d,E)?d[E].push(m):Tc(d,E,[m])});function $lt(d,m,E,A){d=Uo(d)?d:up(d),E=E&&!A?Xe(E):0;var B=d.length;return E<0&&(E=yi(B+E,0)),sb(d)?E<=B&&d.indexOf(m,E)>-1:!!B&&Zd(d,m,E)>-1}var Blt=en(function(d,m,E){var A=-1,B=typeof m=="function",W=Uo(d)?bt(d.length):[];return Hu(d,function(J){W[++A]=B?ds(m,J,E):zg(J,m,E)}),W}),Plt=Y1(function(d,m,E){Tc(d,E,m)});function eb(d,m){var E=je(d)?Rr:$N;return E(d,ge(m,3))}function Ult(d,m,E,A){return d==null?[]:(je(m)||(m=m==null?[]:[m]),E=A?n:E,je(E)||(E=E==null?[]:[E]),zN(d,m,E))}var zlt=Y1(function(d,m,E){d[E?0:1].push(m)},function(){return[[],[]]});function qlt(d,m,E){var A=je(d)?G3:fN,B=arguments.length<3;return A(d,ge(m,4),E,B,Hu)}function jlt(d,m,E){var A=je(d)?eot:fN,B=arguments.length<3;return A(d,ge(m,4),E,B,RN)}function Vlt(d,m){var E=je(d)?ju:NN;return E(d,ib(ge(m,3)))}function Wlt(d){var m=je(d)?kN:$st;return m(d)}function Ylt(d,m,E){(E?so(d,m,E):m===n)?m=1:m=Xe(m);var A=je(d)?pst:Bst;return A(d,m)}function Hlt(d){var m=je(d)?gst:Ust;return m(d)}function Glt(d){if(d==null)return 0;if(Uo(d))return sb(d)?tp(d):d.length;var m=ji(d);return m==Dt||m==Gt?d.size:dE(d).length}function Xlt(d,m,E){var A=je(d)?X3:zst;return E&&so(d,m,E)&&(m=n),A(d,ge(m,3))}var Jlt=en(function(d,m){if(d==null)return[];var E=m.length;return E>1&&so(d,m[0],m[1])?m=[]:E>2&&so(m[0],m[1],m[2])&&(m=[m[0]]),zN(d,Ni(m,1),[])}),nb=Rot||function(){return Ri.Date.now()};function Klt(d,m){if(typeof m!="function")throw new Ws(s);return d=Xe(d),function(){if(--d<1)return m.apply(this,arguments)}}function LI(d,m,E){return m=E?n:m,m=d&&m==null?d.length:m,kc(d,M,n,n,n,n,m)}function FI(d,m){var E;if(typeof m!="function")throw new Ws(s);return d=Xe(d),function(){return--d>0&&(E=m.apply(this,arguments)),d<=1&&(m=n),E}}var $E=en(function(d,m,E){var A=v;if(E.length){var B=Wu(E,lp($E));A|=T}return kc(d,A,m,E,B)}),$I=en(function(d,m,E){var A=v|b;if(E.length){var B=Wu(E,lp($I));A|=T}return kc(m,A,d,E,B)});function BI(d,m,E){m=E?n:m;var A=kc(d,S,n,n,n,n,n,m);return A.placeholder=BI.placeholder,A}function PI(d,m,E){m=E?n:m;var A=kc(d,x,n,n,n,n,n,m);return A.placeholder=PI.placeholder,A}function UI(d,m,E){var A,B,W,J,tt,ft,Et=0,Tt=!1,Ot=!1,Vt=!0;if(typeof d!="function")throw new Ws(s);m=Js(m)||0,Br(E)&&(Tt=!!E.leading,Ot="maxWait"in E,W=Ot?yi(Js(E.maxWait)||0,m):W,Vt="trailing"in E?!!E.trailing:Vt);function ie(ei){var $a=A,Nc=B;return A=B=n,Et=ei,J=d.apply(Nc,$a),J}function xe(ei){return Et=ei,tt=Yg(cn,m),Tt?ie(ei):J}function Qe(ei){var $a=ei-ft,Nc=ei-Et,o7=m-$a;return Ot?qi(o7,W-Nc):o7}function Se(ei){var $a=ei-ft,Nc=ei-Et;return ft===n||$a>=m||$a<0||Ot&&Nc>=W}function cn(){var ei=nb();if(Se(ei))return dn(ei);tt=Yg(cn,Qe(ei))}function dn(ei){return tt=n,Vt&&A?ie(ei):(A=B=n,J)}function ys(){tt!==n&&JN(tt),Et=0,A=ft=B=tt=n}function ao(){return tt===n?J:dn(nb())}function vs(){var ei=nb(),$a=Se(ei);if(A=arguments,B=this,ft=ei,$a){if(tt===n)return xe(ft);if(Ot)return JN(tt),tt=Yg(cn,m),ie(ft)}return tt===n&&(tt=Yg(cn,m)),J}return vs.cancel=ys,vs.flush=ao,vs}var Zlt=en(function(d,m){return AN(d,1,m)}),Qlt=en(function(d,m,E){return AN(d,Js(m)||0,E)});function tct(d){return kc(d,R)}function rb(d,m){if(typeof d!="function"||m!=null&&typeof m!="function")throw new Ws(s);var E=function(){var A=arguments,B=m?m.apply(this,A):A[0],W=E.cache;if(W.has(B))return W.get(B);var J=d.apply(this,A);return E.cache=W.set(B,J)||W,J};return E.cache=new(rb.Cache||Ec),E}rb.Cache=Ec;function ib(d){if(typeof d!="function")throw new Ws(s);return function(){var m=arguments;switch(m.length){case 0:return!d.call(this);case 1:return!d.call(this,m[0]);case 2:return!d.call(this,m[0],m[1]);case 3:return!d.call(this,m[0],m[1],m[2])}return!d.apply(this,m)}}function ect(d){return FI(2,d)}var nct=qst(function(d,m){m=m.length==1&&je(m[0])?Rr(m[0],ps(ge())):Rr(Ni(m,1),ps(ge()));var E=m.length;return en(function(A){for(var B=-1,W=qi(A.length,E);++B=m}),Mh=DN(function(){return arguments}())?DN:function(d){return Hr(d)&&jn.call(d,"callee")&&!_N.call(d,"callee")},je=bt.isArray,yct=eN?ps(eN):Tst;function Uo(d){return d!=null&&ob(d.length)&&!Ac(d)}function ti(d){return Hr(d)&&Uo(d)}function vct(d){return d===!0||d===!1||Hr(d)&&oo(d)==yt}var Ku=Iot||XE,bct=nN?ps(nN):kst;function _ct(d){return Hr(d)&&d.nodeType===1&&!Hg(d)}function wct(d){if(d==null)return!0;if(Uo(d)&&(je(d)||typeof d=="string"||typeof d.splice=="function"||Ku(d)||cp(d)||Mh(d)))return!d.length;var m=ji(d);if(m==Dt||m==Gt)return!d.size;if(Wg(d))return!dE(d).length;for(var E in d)if(jn.call(d,E))return!1;return!0}function xct(d,m){return qg(d,m)}function Sct(d,m,E){E=typeof E=="function"?E:n;var A=E?E(d,m):n;return A===n?qg(d,m,n,E):!!A}function PE(d){if(!Hr(d))return!1;var m=oo(d);return m==vt||m==gt||typeof d.message=="string"&&typeof d.name=="string"&&!Hg(d)}function Ect(d){return typeof d=="number"&&xN(d)}function Ac(d){if(!Br(d))return!1;var m=oo(d);return m==st||m==Bt||m==at||m==Pt}function qI(d){return typeof d=="number"&&d==Xe(d)}function ob(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=z}function Br(d){var m=typeof d;return d!=null&&(m=="object"||m=="function")}function Hr(d){return d!=null&&typeof d=="object"}var jI=rN?ps(rN):Cst;function Tct(d,m){return d===m||hE(d,m,AE(m))}function kct(d,m,E){return E=typeof E=="function"?E:n,hE(d,m,AE(m),E)}function Mct(d){return VI(d)&&d!=+d}function Cct(d){if(fat(d))throw new Pe(o);return LN(d)}function Act(d){return d===null}function Rct(d){return d==null}function VI(d){return typeof d=="number"||Hr(d)&&oo(d)==zt}function Hg(d){if(!Hr(d)||oo(d)!=Ct)return!1;var m=I1(d);if(m===null)return!0;var E=jn.call(m,"constructor")&&m.constructor;return typeof E=="function"&&E instanceof E&&C1.call(E)==kot}var UE=iN?ps(iN):Ast;function Nct(d){return qI(d)&&d>=-9007199254740991&&d<=z}var WI=oN?ps(oN):Rst;function sb(d){return typeof d=="string"||!je(d)&&Hr(d)&&oo(d)==we}function ms(d){return typeof d=="symbol"||Hr(d)&&oo(d)==Jt}var cp=sN?ps(sN):Nst;function Ict(d){return d===n}function Oct(d){return Hr(d)&&ji(d)==Ye}function Dct(d){return Hr(d)&&oo(d)==Mn}var Lct=J1(pE),Fct=J1(function(d,m){return d<=m});function YI(d){if(!d)return[];if(Uo(d))return sb(d)?Da(d):Po(d);if(Dg&&d[Dg])return pot(d[Dg]());var m=ji(d),E=m==Dt?eE:m==Gt?T1:up;return E(d)}function Rc(d){if(!d)return d===0?d:0;if(d=Js(d),d===P||d===-1/0){var m=d<0?-1:1;return m*q}return d===d?d:0}function Xe(d){var m=Rc(d),E=m%1;return m===m?E?m-E:m:0}function HI(d){return d?Sh(Xe(d),0,V):0}function Js(d){if(typeof d=="number")return d;if(ms(d))return U;if(Br(d)){var m=typeof d.valueOf=="function"?d.valueOf():d;d=Br(m)?m+"":m}if(typeof d!="string")return d===0?d:+d;d=hN(d);var E=ln.test(d);return E||tn.test(d)?Kit(d.slice(2),E?2:8):Ze.test(d)?U:+d}function GI(d){return xl(d,zo(d))}function $ct(d){return d?Sh(Xe(d),-9007199254740991,z):d===0?d:0}function Ln(d){return d==null?"":gs(d)}var Bct=sp(function(d,m){if(Wg(m)||Uo(m)){xl(m,Si(m),d);return}for(var E in m)jn.call(m,E)&&Pg(d,E,m[E])}),XI=sp(function(d,m){xl(m,zo(m),d)}),ab=sp(function(d,m,E,A){xl(m,zo(m),d,A)}),Pct=sp(function(d,m,E,A){xl(m,Si(m),d,A)}),Uct=Mc(aE);function zct(d,m){var E=op(d);return m==null?E:MN(E,m)}var qct=en(function(d,m){d=lr(d);var E=-1,A=m.length,B=A>2?m[2]:n;for(B&&so(m[0],m[1],B)&&(A=1);++E1),W}),xl(d,ME(d),E),A&&(E=Hs(E,f|h|p,Qst));for(var B=m.length;B--;)bE(E,m[B]);return E});function sut(d,m){return KI(d,ib(ge(m)))}var aut=Mc(function(d,m){return d==null?{}:Dst(d,m)});function KI(d,m){if(d==null)return{};var E=Rr(ME(d),function(A){return[A]});return m=ge(m),qN(d,E,function(A,B){return m(A,B[0])})}function lut(d,m,E){m=Xu(m,d);var A=-1,B=m.length;for(B||(B=1,d=n);++Am){var A=d;d=m,m=A}if(E||d%1||m%1){var B=SN();return qi(d+B*(m-d+Jit("1e-"+((B+"").length-1))),m)}return mE(d,m)}var but=ap(function(d,m,E){return m=m.toLowerCase(),d+(E?t7(m):m)});function t7(d){return jE(Ln(d).toLowerCase())}function e7(d){return d=Ln(d),d&&d.replace(Qn,cot).replace(Uit,"")}function _ut(d,m,E){d=Ln(d),m=gs(m);var A=d.length;E=E===n?A:Sh(Xe(E),0,A);var B=E;return E-=m.length,E>=0&&d.slice(E,B)==m}function wut(d){return d=Ln(d),d&&gh.test(d)?d.replace(zu,uot):d}function xut(d){return d=Ln(d),d&&Rt.test(d)?d.replace(vh,"\\$&"):d}var Sut=ap(function(d,m,E){return d+(E?"-":"")+m.toLowerCase()}),Eut=ap(function(d,m,E){return d+(E?" ":"")+m.toLowerCase()}),Tut=iI("toLowerCase");function kut(d,m,E){d=Ln(d),m=Xe(m);var A=m?tp(d):0;if(!m||A>=m)return d;var B=(m-A)/2;return X1(F1(B),E)+d+X1(L1(B),E)}function Mut(d,m,E){d=Ln(d),m=Xe(m);var A=m?tp(d):0;return m&&A>>0,E?(d=Ln(d),d&&(typeof m=="string"||m!=null&&!UE(m))&&(m=gs(m),!m&&Qd(d))?Ju(Da(d),0,E):d.split(m,E)):[]}var Dut=ap(function(d,m,E){return d+(E?" ":"")+jE(m)});function Lut(d,m,E){return d=Ln(d),E=E==null?0:Sh(Xe(E),0,d.length),m=gs(m),d.slice(E,E+m.length)==m}function Fut(d,m,E){var A=j.templateSettings;E&&so(d,m,E)&&(m=n),d=Ln(d),m=ab({},m,A,fI);var B=ab({},m.imports,A.imports,fI),W=Si(B),J=tE(B,W),tt,ft,Et=0,Tt=m.interpolate||Yr,Ot="__p += '",Vt=nE((m.escape||Yr).source+"|"+Tt.source+"|"+(Tt===mh?Ut:Yr).source+"|"+(m.evaluate||Yr).source+"|$","g"),ie="//# sourceURL="+(jn.call(m,"sourceURL")?(m.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wit+"]")+` +`;d.replace(Vt,function(Se,cn,dn,ys,ao,vs){return dn||(dn=ys),Ot+=d.slice(Et,vs).replace(Bo,fot),cn&&(tt=!0,Ot+=`' + +__e(`+cn+`) + +'`),ao&&(ft=!0,Ot+=`'; +`+ao+`; +__p += '`),dn&&(Ot+=`' + +((__t = (`+dn+`)) == null ? '' : __t) + +'`),Et=vs+Se.length,Se}),Ot+=`'; +`;var xe=jn.call(m,"variable")&&m.variable;if(!xe)Ot=`with (obj) { +`+Ot+` +} +`;else if(xt.test(xe))throw new Pe(a);Ot=(ft?Ot.replace(Pu,""):Ot).replace(io,"$1").replace(Uu,"$1;"),Ot="function("+(xe||"obj")+`) { +`+(xe?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(tt?", __e = _.escape":"")+(ft?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+Ot+`return __p +}`;var Qe=r7(function(){return An(W,ie+"return "+Ot).apply(n,J)});if(Qe.source=Ot,PE(Qe))throw Qe;return Qe}function $ut(d){return Ln(d).toLowerCase()}function But(d){return Ln(d).toUpperCase()}function Put(d,m,E){if(d=Ln(d),d&&(E||m===n))return hN(d);if(!d||!(m=gs(m)))return d;var A=Da(d),B=Da(m),W=dN(A,B),J=pN(A,B)+1;return Ju(A,W,J).join("")}function Uut(d,m,E){if(d=Ln(d),d&&(E||m===n))return d.slice(0,mN(d)+1);if(!d||!(m=gs(m)))return d;var A=Da(d),B=pN(A,Da(m))+1;return Ju(A,0,B).join("")}function zut(d,m,E){if(d=Ln(d),d&&(E||m===n))return d.replace(Yt,"");if(!d||!(m=gs(m)))return d;var A=Da(d),B=dN(A,Da(m));return Ju(A,B).join("")}function qut(d,m){var E=O,A=N;if(Br(m)){var B="separator"in m?m.separator:B;E="length"in m?Xe(m.length):E,A="omission"in m?gs(m.omission):A}d=Ln(d);var W=d.length;if(Qd(d)){var J=Da(d);W=J.length}if(E>=W)return d;var tt=E-tp(A);if(tt<1)return A;var ft=J?Ju(J,0,tt).join(""):d.slice(0,tt);if(B===n)return ft+A;if(J&&(tt+=ft.length-tt),UE(B)){if(d.slice(tt).search(B)){var Et,Tt=ft;for(B.global||(B=nE(B.source,Ln(Ge.exec(B))+"g")),B.lastIndex=0;Et=B.exec(Tt);)var Ot=Et.index;ft=ft.slice(0,Ot===n?tt:Ot)}}else if(d.indexOf(gs(B),tt)!=tt){var Vt=ft.lastIndexOf(B);Vt>-1&&(ft=ft.slice(0,Vt))}return ft+A}function jut(d){return d=Ln(d),d&&Hd.test(d)?d.replace(ph,vot):d}var Vut=ap(function(d,m,E){return d+(E?" ":"")+m.toUpperCase()}),jE=iI("toUpperCase");function n7(d,m,E){return d=Ln(d),m=E?n:m,m===n?dot(d)?wot(d):iot(d):d.match(m)||[]}var r7=en(function(d,m){try{return ds(d,n,m)}catch(E){return PE(E)?E:new Pe(E)}}),Wut=Mc(function(d,m){return Vs(m,function(E){E=Sl(E),Tc(d,E,$E(d[E],d))}),d});function Yut(d){var m=d==null?0:d.length,E=ge();return d=m?Rr(d,function(A){if(typeof A[1]!="function")throw new Ws(s);return[E(A[0]),A[1]]}):[],en(function(A){for(var B=-1;++Bz)return[];var E=V,A=qi(d,V);m=ge(m),d-=V;for(var B=Q3(A,m);++E0||m<0)?new hn(E):(d<0?E=E.takeRight(-d):d&&(E=E.drop(d)),m!==n&&(m=Xe(m),E=m<0?E.dropRight(-m):E.take(m-d)),E)},hn.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},hn.prototype.toArray=function(){return this.take(V)},wl(hn.prototype,function(d,m){var E=/^(?:filter|find|map|reject)|While$/.test(m),A=/^(?:head|last)$/.test(m),B=j[A?"take"+(m=="last"?"Right":""):m],W=A||/^find/.test(m);B&&(j.prototype[m]=function(){var J=this.__wrapped__,tt=A?[1]:arguments,ft=J instanceof hn,Et=tt[0],Tt=ft||je(J),Ot=function(cn){var dn=B.apply(j,Vu([cn],tt));return A&&Vt?dn[0]:dn};Tt&&E&&typeof Et=="function"&&Et.length!=1&&(ft=Tt=!1);var Vt=this.__chain__,ie=!!this.__actions__.length,xe=W&&!Vt,Qe=ft&&!ie;if(!W&&Tt){J=Qe?J:new hn(this);var Se=d.apply(J,tt);return Se.__actions__.push({func:tb,args:[Ot],thisArg:n}),new Ys(Se,Vt)}return xe&&Qe?d.apply(this,tt):(Se=this.thru(Ot),xe?A?Se.value()[0]:Se.value():Se)})}),Vs(["pop","push","shift","sort","splice","unshift"],function(d){var m=k1[d],E=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",A=/^(?:pop|shift)$/.test(d);j.prototype[d]=function(){var B=arguments;if(A&&!this.__chain__){var W=this.value();return m.apply(je(W)?W:[],B)}return this[E](function(J){return m.apply(je(J)?J:[],B)})}}),wl(hn.prototype,function(d,m){var E=j[m];if(E){var A=E.name+"";jn.call(ip,A)||(ip[A]=[]),ip[A].push({name:m,func:E})}}),ip[H1(n,b).name]=[{name:"wrapper",func:n}],hn.prototype.clone=jot,hn.prototype.reverse=Vot,hn.prototype.value=Wot,j.prototype.at=_lt,j.prototype.chain=wlt,j.prototype.commit=xlt,j.prototype.next=Slt,j.prototype.plant=Tlt,j.prototype.reverse=klt,j.prototype.toJSON=j.prototype.valueOf=j.prototype.value=Mlt,j.prototype.first=j.prototype.head,Dg&&(j.prototype[Dg]=Elt),j},ep=xot();bh?((bh.exports=ep)._=ep,W3._=ep):Ri._=ep}).call(tkt)}(C_,C_.exports)),C_.exports}var bM=ekt();const GW=_A(bM),nkt={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 rkt{#t=te(Oi(nkt));get config(){return H(this.#t)}set config(t){Mt(this.#t,t,!0)}}const YD=Symbol("config");class tr{static initialize(){sa(YD,new rkt)}static get config(){const t=Jo(YD);if(t==null)throw new Error("config context not yet set");return t.config}}class ikt{tableModel;tableController;margin=2;isDragging=!1;lastDragX=0;#t=te(0);get elementWidth(){return H(this.#t)}set elementWidth(t){Mt(this.#t,t,!0)}#e=$t(()=>this.elementWidth-this.margin*2);get scrollbarWidth(){return H(this.#e)}set scrollbarWidth(t){Mt(this.#e,t)}#n=$t(()=>this.tableController.viewWidth/this.tableModel.colsRightmostPosition*this.scrollbarWidth);get pillWidth(){return H(this.#n)}set pillWidth(t){Mt(this.#n,t)}#r=$t(()=>-this.tableController.xScroll/this.tableModel.colsRightmostPosition*this.scrollbarWidth);get pillLeft(){return H(this.#r)}set pillLeft(t){Mt(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 HD="mosaic-coordinator";class _M{static get coordinator(){return Jo(HD)??Ia()}static set coordinator(t){sa(HD,t)}}const Yo="__oid",okt=120;class skt{schema;#t=te(Oi({}));get data(){return H(this.#t)}set data(t){Mt(this.#t,t,!0)}#e=te(Oi({}));get defaultColWidths(){return H(this.#e)}set defaultColWidths(t){Mt(this.#e,t,!0)}#n=te(Oi([]));get columns(){return H(this.#n)}set columns(t){Mt(this.#n,t,!0)}#r=te(0);get numRows(){return H(this.#r)}set numRows(t){Mt(this.#r,t,!0)}#i=te(0);get renderOffset(){return H(this.#i)}set renderOffset(t){Mt(this.#i,t,!0)}#o=te(Oi({}));get rowHeightAddition(){return H(this.#o)}set rowHeightAddition(t){Mt(this.#o,t,!0)}#s=$t(()=>this.columns.reduce((t,n)=>(tr.config.columnConfigs[n]?.hidden&&t.add(n),n===Yo&&tr.config.showRowNumber===!1&&t.add(Yo),t),new Set));get hiddenColumns(){return H(this.#s)}set hiddenColumns(t){Mt(this.#s,t)}rowKeyColumn=null;constructor(t){this.schema=t}#a=$t(()=>Object.keys(this.data).sort((t,n)=>this.data[t][Yo]-this.data[n][Yo]));get renderableRows(){return H(this.#a)}set renderableRows(t){Mt(this.#a,t)}#l=$t(()=>this.columns.filter(t=>!this.hiddenColumns.has(t)));get renderableCols(){return H(this.#l)}set renderableCols(t){Mt(this.#l,t)}#c=$t(()=>this.renderableRows.length===0?this.zeroRowPosition:Math.min(...this.renderableRows.map(t=>this.rowPositions[t])));get minRowPosition(){return H(this.#c)}set minRowPosition(t){Mt(this.#c,t)}#u=$t(()=>this.renderableRows.length===0?this.finalRowPosition:Math.max(...this.renderableRows.map(t=>this.rowPositions[t])));get maxRowPosition(){return H(this.#u)}set maxRowPosition(t){Mt(this.#u,t)}#f=$t(()=>{const t=Math.min(...this.renderableRows.map(n=>this.data[n][Yo]));return Number.isSafeInteger(t)?t:0});get minRowOID(){return H(this.#f)}set minRowOID(t){Mt(this.#f,t)}#h=$t(()=>{const t=Math.max(...this.renderableRows.map(n=>this.data[n][Yo]));return Number.isSafeInteger(t)?t:0});get maxRowOID(){return H(this.#h)}set maxRowOID(t){Mt(this.#h,t)}#d=$t(()=>0);get zeroRowPosition(){return H(this.#d)}set zeroRowPosition(t){Mt(this.#d,t)}#p=$t(()=>(this.numRows-1)*tr.config.rowHeight+this.rowPositionOffsets.cumulative);get finalRowPosition(){return H(this.#p)}set finalRowPosition(t){Mt(this.#p,t)}colsLeftmostPosition=0;#g=$t(()=>{const t=this.renderableCols[this.renderableCols.length-1];return this.colPositions[t]+this.colWidths[t]});get colsRightmostPosition(){return H(this.#g)}set colsRightmostPosition(t){Mt(this.#g,t)}#m=$t(()=>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){Mt(this.#m,t)}#y=$t(()=>this.renderableRows.reduce((t,n)=>{const r=(this.data[n][Yo]-1)*tr.config.rowHeight+this.rowPositionOffsets.offsets[n];return t[n]=r,t},{}));get rowPositions(){return H(this.#y)}set rowPositions(t){Mt(this.#y,t)}#v=$t(()=>{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){Mt(this.#v,t)}#b=$t(()=>this.renderableRows.reduce((t,n)=>(t[n]=tr.config.rowHeight+(this.rowHeightAddition[n]??0),t),{}));get rowHeights(){return H(this.#b)}set rowHeights(t){Mt(this.#b,t)}#_=$t(()=>this.columns.reduce((t,n,r)=>(t[n]=Math.max(tr.config.columnConfigs[n]?.width??this.defaultColWidths[n]??okt,tr.config.minColumnWidths[n]??0),this.isFirstCol(n)&&(t[n]+=tr.config.firstColLeftPadding),this.isLastCol(n)&&(t[n]+=tr.config.verticalScrollbarWidth),t),{}));get colWidths(){return H(this.#_)}set colWidths(t){Mt(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][Yo]%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 akt extends Id{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 qt.from(this.tableName).select({count:er()}).where(t)}}const Ho="__oid";class lkt extends Id{tableName;columns;onResult;onColumnInfo;limit=20;offset=0;sort=null;info=null;columnInfo=null;isReady=!1;constructor(t,n,r,i,o){super(r??void 0),this.tableName=t,this.columns=n,this.onResult=i,this.onColumnInfo=o}async prepare(){if(this.coordinator==null)return;const t=(await uC(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]=Jr(kt(i),"TEXT"):r[i]=kt(i),r),{});return t||delete n[Ho],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]=Jr(kt(i),"TEXT"):r[i]=kt(i),r),{});if(n[Ho]=wP(),this.sort){const r=this.sort.direction==="ascending"?this.sort.column:ig(this.sort.column);n[Ho]=n[Ho].orderby(r)}return qt.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 ckt{model;schema;config;#t=$t(()=>_M.coordinator);get coordinator(){return H(this.#t)}set coordinator(t){Mt(this.#t,t)}filterBy=null;rowsClient=null;numRowsClient=null;rowKeyColumn=null;#e=te(null);get element(){return H(this.#e)}set element(t){Mt(this.#e,t,!0)}#n=te(0);get viewHeight(){return H(this.#n)}set viewHeight(t){Mt(this.#n,t,!0)}#r=te(0);get viewWidth(){return H(this.#r)}set viewWidth(t){Mt(this.#r,t,!0)}#i=te(0);get yScroll(){return H(this.#i)}set yScroll(t){Mt(this.#i,t,!0)}#o=te(0);get xScroll(){return H(this.#o)}set xScroll(t){Mt(this.#o,t,!0)}#s=te(!1);get isFetching(){return H(this.#s)}set isFetching(t){Mt(this.#s,t,!0)}#a=te(!1);get isJumping(){return H(this.#a)}set isJumping(t){Mt(this.#a,t,!0)}#l=te(null);get sort(){return H(this.#l)}set sort(t){Mt(this.#l,t,!0)}#c=te(!1);get isReady(){return H(this.#c)}set isReady(t){Mt(this.#c,t,!0)}#u=te(0);get updateKey(){return H(this.#u)}set updateKey(t){Mt(this.#u,t,!0)}#f=te(!1);get isStale(){return H(this.#f)}set isStale(t){Mt(this.#f,t,!0)}#h=te(null);get flashedRowId(){return H(this.#h)}set flashedRowId(t){Mt(this.#h,t,!0)}#d=te(null);get hoveredRowId(){return H(this.#d)}set hoveredRowId(t){Mt(this.#d,t,!0)}#p=$t(()=>Math.ceil(this.viewHeight/tr.config.rowHeight));get rowsOnScreen(){return H(this.#p)}set rowsOnScreen(t){Mt(this.#p,t)}#g=$t(()=>this.isJumping?0:tr.config.renderWindowOffset);get renderWindowOffset(){return H(this.#g)}set renderWindowOffset(t){Mt(this.#g,t)}#m=$t(()=>{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/tr.config.rowHeight)));get offset(){return H(this.#y)}set offset(t){Mt(this.#y,t)}onFetchResolveBegin=null;onFetchResolveEnd=null;constructor(t,n){this.model=t,this.schema=n,this.config=tr.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 o=i[this.rowKeyColumn];r[o]=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 o=r.includes(this.rowKeyColumn)?r:[...r,this.rowKeyColumn];this.rowsClient=new lkt(t,o,i,s=>{this.updateData(s)},s=>{this.schema.columnInfo=s,this.computeColWidths(t,r),this.isReady=!0}),this.coordinator.connect(this.rowsClient),this.numRowsClient=new akt(t,i,s=>{this.model&&(this.model.numRows=s)}),this.coordinator.connect(this.numRowsClient),Pr(()=>{if(!this.rowsClient||this.isFetching||!this.isReady)return;const s=-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>s&&this.model.minRowOID!==1){const v=bM.clamp(Math.ceil((y-s)/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=bW(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 p=0;for(;this.model.rowPositions[u[p]]+this.yScroll+this.model.rowHeights[u[p]]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:o}=this.model.getDimensions(t),s=n+this.xScroll,a=r+this.yScroll;return s+i>=0&&s<=this.viewWidth&&a+o>=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=qt.with({original:this.rowsClient.query(this.rowsClient.filterBy?.predicate(this.rowsClient)).offset(0).limit(this.model.numRows)}).select([Ho]).from("original").where(Ss(kt(this.rowKeyColumn),ne(t))),i=(await this.coordinator.query(r)).toArray();if(i.length>0){const o=i[0][Ho]-1;this.onFetchResolveEnd=()=>{n&&this.flashRow(t)},this.jumpToOffset(o)}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===Ho?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===Ho?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!==Ho),i=this.rowsClient?.getSelect({includeRowNumber:!1}),o=r.reduce((l,c)=>(l[c]=0,l),{}),s=qt.from(t).select(i).offset(0).limit(10),a=(await this.coordinator.query(s)).toArray();for(const l of a)for(const c of r)o[c]=Math.max(o[c],ukt(l[c]));n.includes(Ho)&&(o[Ho]=this.config.DEFAULT_ROW_NUMBER_COL_WIDTH),this.model.defaultColWidths=o}}function ukt(e){const t=String(e).length;return t>200?600:t>100?300:t>20?200:t>10?150:120}class fkt{tableController;#t=$t(()=>this.tableController.element);get tableElement(){return H(this.#t)}set tableElement(t){Mt(this.#t,t)}constructor(t){this.tableController=t}mount(t,n,r,i,o){if(!this.tableElement)return;const s=n.getBoundingClientRect(),a=this.tableElement.getBoundingClientRect(),l=a.top,c=a.left;switch(r){case"inside":switch(o){case"top":t.style.top=s.top-l+"px";break;case"middle":case"bottom":throw new Error("not yet implemented"+r+o)}switch(i){case"left":t.style.left=s.left-c+"px";case"center":case"right":throw new Error("not yet implemented"+r+i)}break;case"outside":switch(o){case"top":t.style.top=s.bottom-l+"px";break;case"middle":case"bottom":throw new Error("not yet implemented"+r+o)}switch(i){case"left":t.style.left=s.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 zT,GD;function hkt(){if(GD)return zT;GD=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 zT=e,zT}var qT,XD;function dkt(){if(XD)return qT;XD=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return qT=t,qT}var jT,JD;function pkt(){if(JD)return jT;JD=1;var e=dkt(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return jT=n,jT}var VT,KD;function wA(){if(KD)return VT;KD=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return VT=e,VT}var WT,ZD;function gkt(){if(ZD)return WT;ZD=1;var e=typeof xf=="object"&&xf&&xf.Object===Object&&xf;return WT=e,WT}var YT,QD;function XW(){if(QD)return YT;QD=1;var e=gkt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return YT=n,YT}var HT,tL;function JW(){if(tL)return HT;tL=1;var e=XW(),t=e.Symbol;return HT=t,HT}var GT,eL;function mkt(){if(eL)return GT;eL=1;var e=JW(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function o(s){var a=n.call(s,i),l=s[i];try{s[i]=void 0;var c=!0}catch{}var u=r.call(s);return c&&(a?s[i]=l:delete s[i]),u}return GT=o,GT}var XT,nL;function ykt(){if(nL)return XT;nL=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return XT=n,XT}var JT,rL;function vkt(){if(rL)return JT;rL=1;var e=JW(),t=mkt(),n=ykt(),r="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function s(a){return a==null?a===void 0?i:r:o&&o in Object(a)?t(a):n(a)}return JT=s,JT}var KT,iL;function bkt(){if(iL)return KT;iL=1;function e(t){return t!=null&&typeof t=="object"}return KT=e,KT}var ZT,oL;function _kt(){if(oL)return ZT;oL=1;var e=vkt(),t=bkt(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return ZT=r,ZT}var QT,sL;function KW(){if(sL)return QT;sL=1;var e=pkt(),t=wA(),n=_kt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^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=o.test(c);return f||s.test(c)?a(c.slice(2),f?2:8):i.test(c)?r:+c}return QT=l,QT}var tk,aL;function wkt(){if(aL)return tk;aL=1;var e=hkt(),t=KW();function n(r,i,o){return o===void 0&&(o=i,i=void 0),o!==void 0&&(o=t(o),o=o===o?o:0),i!==void 0&&(i=t(i),i=i===i?i:0),e(t(r),i,o)}return tk=n,tk}var xkt=wkt();const Skt=_A(xkt);var ek,lL;function Ekt(){if(lL)return ek;lL=1;var e=XW(),t=function(){return e.Date.now()};return ek=t,ek}var nk,cL;function Tkt(){if(cL)return nk;cL=1;var e=wA(),t=Ekt(),n=KW(),r="Expected a function",i=Math.max,o=Math.min;function s(a,l,c){var u,f,h,p,g,y,v=0,b=!1,_=!1,S=!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,S="trailing"in c?!!c.trailing:S);function x($){var I=u,F=f;return u=f=void 0,v=$,p=a.apply(F,I),p}function T($){return v=$,g=setTimeout(C,l),b?x($):p}function k($){var I=$-y,F=$-v,D=l-I;return _?o(D,h-F):D}function M($){var I=$-y,F=$-v;return y===void 0||I>=l||I<0||_&&F>=h}function C(){var $=t();if(M($))return R($);g=setTimeout(C,k($))}function R($){return g=void 0,S&&u?x($):(u=f=void 0,p)}function O(){g!==void 0&&clearTimeout(g),v=0,u=y=f=g=void 0}function N(){return g===void 0?p:R(t())}function L(){var $=t(),I=M($);if(u=arguments,f=this,y=$,I){if(g===void 0)return T(y);if(_)return clearTimeout(g),g=setTimeout(C,l),x(y)}return g===void 0&&(g=setTimeout(C,l)),p}return L.cancel=O,L.flush=N,L}return nk=s,nk}var rk,uL;function kkt(){if(uL)return rk;uL=1;var e=Tkt(),t=wA(),n="Expected a function";function r(i,o,s){var a=!0,l=!0;if(typeof i!="function")throw new TypeError(n);return t(s)&&(a="leading"in s?!!s.leading:a,l="trailing"in s?!!s.trailing:l),e(i,o,{leading:a,maxWait:o,trailing:l})}return rk=r,rk}var Mkt=kkt();const fL=_A(Mkt);class Ckt{tableModel;tableController;isDragging=!1;#t=te(0);get elementHeight(){return H(this.#t)}set elementHeight(t){Mt(this.#t,t,!0)}#e=te(0);get labelHeight(){return H(this.#e)}set labelHeight(t){Mt(this.#e,t,!0)}#n=$t(()=>tr.config.verticalScrollbarPillHeight);get pillHeight(){return H(this.#n)}set pillHeight(t){Mt(this.#n,t)}#r=$t(()=>this.elementHeight-this.pillHeight);get scrollbarHeight(){return H(this.#r)}set scrollbarHeight(t){Mt(this.#r,t)}#i=$t(()=>this.tableController.firstVisibleRowOID?this.tableController.firstVisibleRowOID:this.tableController.offset+1);get displayRow(){return H(this.#i)}set displayRow(t){Mt(this.#i,t)}#o=$t(()=>(this.displayRow-1)/(this.tableModel.numRows-1)*this.scrollbarHeight);get pillPosition(){return H(this.#o)}set pillPosition(t){Mt(this.#o,t)}#s=$t(()=>{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){Mt(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 Skt(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=fL(this.pointerDown,50);pointerMove=t=>{if(this.isDragging){const n=this.computeOffsetFromPointer(t);this.tableController.jumpToOffset(n)}};handlePointerMove=fL(this.pointerMove,50);handlePointerUp=t=>{t.target.releasePointerCapture(t.pointerId),this.isDragging=!1,this.tableController.isJumping=!1}}class Akt{#t=te(null);get columnInfo(){return H(this.#t)}set columnInfo(t){Mt(this.#t,t,!0)}#e=$t(()=>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){Mt(this.#e,t)}#n=$t(()=>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){Mt(this.#n,t)}}class Rkt{tableController;#t=$t(()=>Math.floor(-this.tableController.yScroll/tr.config.scrollOverflowValue)*tr.config.scrollOverflowValue);get offset(){return H(this.#t)}set offset(t){Mt(this.#t,t)}constructor(t){this.tableController=t}y(t){return t-this.offset}yScroll(t){return t+this.offset}}const hL=Symbol("schema"),dL=Symbol("model"),pL=Symbol("controller"),gL=Symbol("vertical-scrollbar-controller"),mL=Symbol("horizontal-scrollbar-controller"),yL=Symbol("table-portal-controller"),vL=Symbol("overscroll-modifier");class Kn{static initialize(){const t=new Akt,n=new skt(t),r=new ckt(n,t),i=new Ckt({tableModel:n,tableController:r}),o=new ikt({tableModel:n,tableController:r}),s=new fkt(r),a=new Rkt(r);sa(hL,t),sa(dL,n),sa(pL,r),sa(gL,i),sa(mL,o),sa(yL,s),sa(vL,a)}static get schema(){return Jo(hL)}static get model(){return Jo(dL)}static get controller(){return Jo(pL)}static get verticalScrollbarController(){return Jo(gL)}static get horizontalScrollbarController(){return Jo(mL)}static get tablePortalController(){return Jo(yL)}static get overscrollModifier(){return Jo(vL)}}var Nkt=On('
    ');const Ikt={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 Okt(e,t){si(t,!0),Zr(e,Ikt);const n=Kn.horizontalScrollbarController,r=Kn.controller,i=tr.config;let o=te(0),s=te(null),a=te(null),l=0;vg(()=>(l=requestAnimationFrame(f),()=>{cancelAnimationFrame(l)}));function c(){H(s)&&(H(s).style.opacity="0")}const u=GW.debounce(c,1e3);Pr(()=>{H(s)&&(r.xScroll,H(s).style.opacity="1",u())});function f(){Mt(o,n.pillWidth,!0),H(a)&&(H(a).style.transform=`translate(${n.pillLeft}px, 0)`),l=requestAnimationFrame(f)}var h=Nkt();let p;var g=Bn(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;es(g,v=>Mt(a,v),()=>H(a)),Rn(h),es(h,v=>Mt(s,v),()=>H(s)),pi(()=>{p=cs(h,"",p,{"--height":i.horizontalScrollbarHeight+"px"}),y=cs(g,"",y,{"--width":H(o)+"px","--margin":n.margin+"px"})}),cl(h,"clientWidth",v=>n.elementWidth=v),mn(e,h),ai()}Du(["pointerdown","pointermove","pointerup"]);var Dkt=On('
    ');const Lkt={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 Fkt(e,t){si(t,!0),Zr(e,Lkt);const n=Kn.verticalScrollbarController,r=Kn.controller,i=tr.config;let o=te(0),s=te(0),a=te(null),l=te(null),c=te(null),u=$t(()=>new Intl.NumberFormat().format(H(s))),f=0;vg(()=>(f=requestAnimationFrame(g),()=>{cancelAnimationFrame(f)}));function h(){H(a)&&(H(a).style.opacity="0")}const p=GW.debounce(h,1e3);Pr(()=>{H(a)&&(r.yScroll,H(a).style.opacity="1",p())});function g(){Mt(o,n.pillPosition??H(o),!0),Mt(s,n.displayRow??H(s),!0),H(l)&&(H(l).style.transform=`translate3d(0, ${H(o)}px, 0)`),H(c)&&H(c).style.setProperty("--offset",n.labelOffset-1+"px"),f=requestAnimationFrame(g)}var y=Dkt();y.__pointerdown=function(...T){n.handlePointerDown?.apply(this,T)},y.__pointermove=function(...T){n.handlePointerMove?.apply(this,T)},y.__pointerup=function(...T){n.handlePointerUp?.apply(this,T)};let v;var b=Bn(y);let _;var S=Bn(b),x=Bn(S,!0);Rn(S),es(S,T=>Mt(c,T),()=>H(c)),Rn(b),es(b,T=>Mt(l,T),()=>H(l)),Rn(y),es(y,T=>Mt(a,T),()=>H(a)),pi(()=>{v=cs(y,"",v,{"--offset-bottom":i.horizontalScrollbarHeight+"px","--width":i.verticalScrollbarWidth+"px"}),_=cs(b,"",_,{"--pill-height":n.pillHeight+"px"}),yc(x,H(u))}),cl(S,"clientHeight",T=>n.labelHeight=T),cl(y,"clientHeight",T=>n.elementHeight=T),mn(e,y),ai()}Du(["pointerdown","pointermove","pointerup"]);var $kt=On(' '),Bkt=On('');const Pkt={hash:"svelte-3kpd",code:""};function Ukt(e,t){si(t,!0),Zr(e,Pkt);let n=Gv(t,"height");var r=Bkt(),i=Bn(r);{var o=s=>{var a=$kt(),l=Bn(a,!0);Rn(a),pi(()=>{bx(a,"href",t.url),yc(l,t.url)}),mn(s,a)};Ts(i,s=>{t.url&&s(o)})}Rn(r),cl(r,"clientHeight",n),mn(e,r),ai()}var zkt=On('
    ');const qkt={hash:"svelte-rqpfez",code:".number-content.svelte-rqpfez {text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"};function jkt(e,t){si(t,!0),Zr(e,qkt);let n=Gv(t,"height");function r(s){return s===null?null:Number.isInteger(s)?s.toString():s.toPrecision(4).toString()}var i=zkt(),o=Bn(i,!0);Rn(i),pi(s=>yc(o,s),[()=>r(t.number)]),cl(i,"clientHeight",n),mn(e,i),ai()}var Vkt=On("
    ");const Wkt={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 bL(e,t){si(t,!0),Zr(e,Wkt);let n=Gv(t,"height");const r=tr.config;let i=te(null),o=te(null);Pr(()=>{H(i)&&(n(H(i).scrollHeight),Mt(o,Math.floor(t.parentHeight/r.lineHeight),!0))});var s=Vkt();let a;var l=Bn(s,!0);Rn(s),es(s,c=>Mt(i,c),()=>H(i)),pi(()=>{Vf(s,1,`text-content ${(t.clamped?"clamped":null)??""}`,"svelte-122k9kr"),a=cs(s,"",a,{"--lines":H(o)}),yc(l,t.text)}),mn(e,s),ai()}class Ykt{#t=te(Oi({}));get config(){return H(this.#t)}set config(t){Mt(this.#t,t,!0)}}const ik="custom-cells";class A_{static initialize(){sa(ik,new Ykt)}static set config(t){const n=Jo(ik);n.config=t}static get config(){return Jo(ik).config}}var Hkt=On('
    ');const Gkt={hash:"svelte-35i9ld",code:".bigint-content.svelte-35i9ld {text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"};function Xkt(e,t){si(t,!0),Zr(e,Gkt);let n=Gv(t,"height");function r(s){return s===null?null:s.toLocaleString()}var i=Hkt(),o=Bn(i,!0);Rn(i),pi(s=>yc(o,s),[()=>r(t.bigint)]),cl(i,"clientHeight",n),mn(e,i),ai()}var Jkt=On("
    ");const Kkt={hash:"svelte-3kpd",code:""};function Zkt(e,t){si(t,!0),Zr(e,Kkt);let n=Gv(t,"height");const r=Kn.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 o=$t(()=>i(t.customCell)),s=$t(()=>r.getContent({row:t.row,col:t.col})),a=$t(()=>r.getRowData(t.row));var l=Jkt();vA(l,(c,u)=>H(o)?.(c,u),()=>({value:H(s),rowData:H(a)})),yg(()=>cl(l,"clientHeight",n)),mn(e,l),ai()}var Qkt=(e,t,n,r,i)=>{t.addHeightToRow(n.row,H(r)-H(i))},t4t=On(""),e4t=On('
    ');const n4t={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 r4t(e,t){si(t,!0),Zr(e,n4t);const n=Kn.model,r=Kn.controller,i=Kn.schema,o=tr.config,s=A_.config;let a=te(0),l=te(0),c=$t(()=>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";var p=e4t();let g;var y=Bn(p);{var v=x=>{Zkt(x,{get row(){return t.row},get col(){return t.col},get customCell(){return s[t.col]},get height(){return H(l)},set height(T){Mt(l,T,!0)}})},b=(x,T)=>{{var k=C=>{var R=vx(),O=Zl(R);{var N=$=>{Ukt($,{url:u,get height(){return H(l)},set height(I){Mt(l,I,!0)}})},L=$=>{bL($,{text:u,get clamped(){return H(c)},get parentHeight(){return H(a)},get height(){return H(l)},set height(I){Mt(l,I,!0)}})};Ts(O,$=>{u&&u.startsWith("http")?$(N):$(L,!1)})}mn(C,R)},M=(C,R)=>{{var O=L=>{var $=vx(),I=Zl($);{var F=P=>{const z=$t(()=>BigInt(u??""));Xkt(P,{get bigint(){return H(z)},get height(){return H(l)},set height(q){Mt(l,q,!0)}})},D=P=>{jkt(P,{number:u,get height(){return H(l)},set height(z){Mt(l,z,!0)}})};Ts(I,P=>{h==="BIGINT"?P(F):P(D,!1)})}mn(L,$)},N=L=>{bL(L,{text:u,get clamped(){return H(c)},get parentHeight(){return H(a)},get height(){return H(l)},set height($){Mt(l,$,!0)}})};Ts(C,L=>{f==="number"?L(O):L(N,!1)},R)}};Ts(x,C=>{f==="string"?C(k):C(M,!1)},T)}};Ts(y,x=>{s[t.col]?x(v):x(b,!1)})}var _=va(y,2);{var S=x=>{var T=t4t();T.__click=[Qkt,r,t,l,a],pi(()=>Vf(T,1,`expand-button ${t.hovered?"show":"hide"}`,"svelte-ix87lc")),mn(x,T)};Ts(_,x=>{H(c)&&x(S)})}Rn(p),pi(()=>g=cs(p,"",g,{"--lineHeight":o.lineHeight+"px","--num-lines":o.textMaxLines})),cl(p,"clientHeight",x=>Mt(a,x)),mn(e,p),ai()}Du(["click"]);var i4t=On('
    ');const o4t={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 s4t(e,t){si(t,!0),Zr(e,o4t);const n=Kn.model.getContent({row:t.row,col:t.col}),r=$t(()=>new Intl.NumberFormat().format(n??0));var i=i4t(),o=Bn(i,!0);Rn(i),pi(()=>yc(o,H(r))),mn(e,i),ai()}var a4t=(e,t)=>{e.key==="Enter"&&t()},l4t=On('
    ');const c4t={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 u4t(e,t){si(t,!0),Zr(e,c4t);const n=Kn.model,r=Kn.controller,i=Kn.overscrollModifier,o=tr.config;let s=$t(()=>n.getPosition({row:t.row,col:t.col})),a=$t(()=>H(s).x),l=$t(()=>H(s).y),c=$t(()=>i.y(H(l))),u=$t(()=>n.getDimensions({row:t.row,col:t.col})),f=$t(()=>H(u).width),h=$t(()=>H(u).height),p=$t(()=>n.isFirstCol(t.col)),g=$t(()=>n.isLastCol(t.col)),y=$t(()=>n.getRowParity(t.row)==="even"?"var(--primary-bg)":"var(--secondary-bg)"),v=()=>{o.onRowClick&&o.onRowClick(t.row)},b=te(!1);var _=l4t();_.__click=v,_.__keydown=[a4t,v];let S;var x=Bn(_);{var T=M=>{r4t(M,{get row(){return t.row},get col(){return t.col},get hovered(){return H(b)}})},k=M=>{s4t(M,{get row(){return t.row},get col(){return t.col}})};Ts(x,M=>{t.col!==Yo?M(T):M(k,!1)})}Rn(_),pi(()=>S=cs(_,"",S,{"--x":H(a)+"px","--y":H(c)+"px","--width":H(f)+"px","--height":H(h)+"px","--padding-x":o.betweenColPadding+"px","--padding-y":o.betweenRowPadding+"px","--extra-right-padding":(H(g)?o.verticalScrollbarWidth:0)+"px","--extra-left-padding":(H(p)?o.firstColLeftPadding:0)+"px","--background-color":H(y)})),Yy("pointerenter",_,()=>{Mt(b,!0),r.hoveredRowId=t.row}),Yy("pointerleave",_,()=>{Mt(b,!1),r.hoveredRowId=null}),mn(e,_),ai()}Du(["click","keydown"]);var f4t=On('
    ');const h4t={hash:"svelte-1wng68q",code:".header-title.svelte-1wng68q {flex-shrink:1;margin-right:2px;}"};function d4t(e,t){si(t,!0),Zr(e,h4t);const n=tr.config;var r=f4t(),i=Bn(r,!0);Rn(r),pi(()=>yc(i,n.columnConfigs[t.col]?.title??t.col)),mn(e,r),ai()}iTt();var p4t=On('
    #
    ');const g4t={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 m4t(e){Zr(e,g4t);var t=p4t();mn(e,t)}var y4t=(e,t,n,r,i)=>{const o=H(t)?H(n)==="ascending"?"descending":null:"ascending";o?r.handleSort({column:i.col,direction:o}):r.handleSort(null)},v4t=On('');const b4t={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 _4t(e,t){si(t,!0),Zr(e,b4t);const n=Kn.controller;let r=$t(()=>n.sort?n.sort.column===t.col:!1),i=$t(()=>n.sort?n.sort.direction:null),o=$t(()=>H(r)?H(i)==="ascending"?"↑":"↓":"⇅");var s=v4t();s.__click=[y4t,r,i,n,t];var a=Bn(s),l=Bn(a,!0);Rn(a),Rn(s),pi(()=>{Vf(a,1,`sort-button ${(H(r)?"selected":null)??""} sort-glyph`,"svelte-3f09kb"),yc(l,H(o))}),mn(e,s),ai()}Du(["click"]);class w4t{#t=te(Oi({}));get config(){return H(this.#t)}set config(t){Mt(this.#t,t,!0)}}const ok="custom-cells";class wM{static initialize(){sa(ok,new w4t)}static set config(t){const n=Jo(ok);n.config=t}static get config(){return Jo(ok).config}}var x4t=On("
    ");const S4t={hash:"svelte-3kpd",code:""};function E4t(e,t){si(t,!0),Zr(e,S4t),Kn.model;const n=o=>typeof o=="function"?(s,a)=>{let l=new o(s,a);return{...l.update?{update:l.update.bind(l)}:{},...l.destroy?{destroy:l.destroy.bind(l)}:{}}}:(s,a)=>{let l=new o.class(s,a);return{...l.update?{update:l.update.bind(l)}:{},...l.destroy?{destroy:l.destroy.bind(l)}:{}}};let r=$t(()=>n(t.customHeader));var i=x4t();vA(i,(o,s)=>H(r)?.(o,s),()=>({column:t.col})),mn(e,i),ai()}var T4t=On(" ",1),k4t=On('
    ');const M4t={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 C4t(e,t){si(t,!0),Zr(e,M4t);const n=Kn.model,r=Kn.schema,i=tr.config,o=wM.config;let s=te(null),a=te(0);Pr(()=>{i.minColumnWidths[t.col]=H(a)+i.betweenColPadding});const l=$t(()=>n.colWidths[t.col]),c=$t(()=>(r.dataType[t.col]??"string")==="number"),u=$t(()=>H(c)||t.col===Yo?"number":""),f=$t(()=>n.isFirstCol(t.col)),h=$t(()=>n.isLastCol(t.col));let p=$t(()=>i.headerHeight?i.headerHeight+"px":"auto");var g=k4t();let y;var v=Bn(g),b=Bn(v);{var _=M=>{E4t(M,{get col(){return t.col},get customHeader(){return o[t.col]}})};Ts(b,M=>{o[t.col]&&M(_)})}var S=va(b,2),x=Bn(S);{var T=M=>{var C=T4t(),R=Zl(C);d4t(R,{get col(){return t.col}});var O=va(R,2);_4t(O,{get col(){return t.col}}),mn(M,C)},k=M=>{m4t(M)};Ts(x,M=>{t.col!==Yo?M(T):M(k,!1)})}Rn(S),Rn(v),Rn(g),es(g,M=>Mt(s,M),()=>H(s)),pi(()=>{Vf(g,1,`header-cell ${H(u)??""}`,"svelte-12avjxu"),y=cs(g,"",y,{"--width":H(l)+"px","--height":H(p),"--padding-x":i.betweenColPadding+"px","--extra-padding-right":(H(h)?i.verticalScrollbarWidth:0)+"px","--extra-padding-left":(H(f)?i.firstColLeftPadding:0)+"px"})}),cl(v,"clientWidth",M=>Mt(a,M)),mn(e,g),ai()}class A4t{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=tr.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,bW(this.config.columnConfigs))}};handlePointerUp=t=>{t.target.releasePointerCapture(t.pointerId),this.isDragging=!1,this.startDragX=null}}var R4t=On('
    ');const N4t={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 I4t(e,t){si(t,!0),Zr(e,N4t);const n=Kn.model;let r=new A4t({tableModel:n,tableController:Kn.controller,col:t.col});const i=$t(()=>n.colPositions[t.col]+n.colWidths[t.col]);var o=R4t();o.__pointerdown=function(...a){r.handlePointerDown?.apply(this,a)},o.__pointermove=function(...a){r.handlePointerMove?.apply(this,a)},o.__pointerup=function(...a){r.handlePointerUp?.apply(this,a)};let s;pi(()=>s=cs(o,"",s,{"--x":H(i)+"px"})),mn(e,o),ai()}Du(["pointerdown","pointermove","pointerup"]);var O4t=e=>{e.stopPropagation()},D4t=On('
    ');const L4t={hash:"svelte-1qnjihj",code:".table-portal.svelte-1qnjihj {position:absolute;}"};function F4t(e,t){si(t,!0),Zr(e,L4t);const n=Kn.controller,r=Kn.tablePortalController;let i=te(null);const o=u=>{Pr(()=>(r.mount(u,t.relativeTo,t.anchor,t.horizontalAlign,t.verticalAlign),u.focus(),()=>{r.destroy(u)}))};let s=0;vg(()=>{s=n.xScroll,requestAnimationFrame(a)});function a(){H(i)&&t.stickyX&&(H(i).style.transform=`translateX(${n.xScroll-s}px)`),requestAnimationFrame(a)}var l=D4t();l.__click=[O4t];var c=Bn(l);yA(c,()=>t.children),Rn(l),es(l,u=>Mt(i,u),()=>H(i)),vA(l,u=>o?.(u)),Yy("wheel",l,u=>{u.stopPropagation()}),mn(e,l),ai()}Du(["click"]);var $4t=(e,t)=>{Mt(t,!0)},B4t=On(" ",1);const P4t={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 U4t(e,t){Zr(e,P4t);let n=te(!1),r=te(null),i=te(null);var o=B4t();Yy("click",pM,u=>{H(n)&&u.target!==H(r)&&Mt(n,!1)});var s=Zl(o);s.__click=[$4t,n];var a=Bn(s,!0);Rn(s),es(s,u=>Mt(r,u),()=>H(r));var l=va(s,2);{var c=u=>{F4t(u,{get relativeTo(){return t.relativeTo},anchor:"outside",horizontalAlign:"left",verticalAlign:"top",stickyX:!1,get element(){return H(i)},set element(f){Mt(i,f,!0)},children:(f,h)=>{var p=vx(),g=Zl(p);yA(g,()=>t.children),mn(f,p)},$$slots:{default:!0}})};Ts(l,u=>{H(n)&&u(c)})}pi(()=>{Vf(s,1,`dropdown ${H(n)?"unclickable":"clickable"}`,"svelte-8ns8fr"),yc(a,t.label)}),mn(e,o)}Du(["click"]);var z4t=(e,t,n)=>{e.target.checked?t.showColumn(H(n)):t.hideColumn(H(n))},q4t=On('
  • '),j4t=On('
      '),V4t=On(" ",1),W4t=On('
      ');const Y4t={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 H4t(e,t){si(t,!0),Zr(e,Y4t);const n=Kn.model,r=Kn.controller,i=tr.config;let o=te(null),s=te(null),a=te(null),l=$t(()=>n.renderableCols),c=0;vg(()=>(c=requestAnimationFrame(u),()=>{cancelAnimationFrame(c)}));function u(){H(s)&&(H(s).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=W4t(),h=Bn(f),p=Bn(h),g=Bn(p),y=Bn(g);U4t(y,{label:"⋮",get relativeTo(){return H(o)},children:(b,_)=>{var S=j4t();let x;Zm(S,21,()=>n.columns,UTt,(T,k)=>{var M=q4t(),C=Bn(M),R=Bn(C),O=va(R);GTt(O),O.__change=[z4t,r,k],cs(O,"",{},{float:"right"}),Rn(C),Rn(M),pi(()=>{yc(R,`${(H(k)===Yo?"row #":i.columnConfigs[H(k)]?.title??H(k))??""} `),bx(O,"id",`${H(k)??""}-checkbox`),XTt(O,H(k)===Yo?i.showRowNumber!==!1:!i.columnConfigs[H(k)]?.hidden)}),mn(T,M)}),Rn(S),pi(()=>x=cs(S,"",x,{"--max-height":r.viewHeight-48+"px","--max-width":r.viewWidth-48+"px"})),mn(b,S)}}),Rn(g),es(g,b=>Mt(a,b),()=>H(a)),Rn(p);var v=va(p,2);Zm(v,16,()=>H(l),b=>b,(b,_)=>{var S=V4t(),x=Zl(S);C4t(x,{get col(){return _}});var T=va(x,2);I4t(T,{get col(){return _}}),mn(b,S)}),Rn(h),es(h,b=>Mt(s,b),()=>H(s)),Rn(f),es(f,b=>Mt(o,b),()=>H(o)),mn(e,f),ai()}Du(["change"]);function G4t(e,t){return{...e,...e[t]!=null?e[t]:{}}}class X4t{#t=te(null);get colorScheme(){return H(this.#t)}set colorScheme(t){Mt(this.#t,t,!0)}#e=te(Oi({}));get theme(){return H(this.#e)}set theme(t){Mt(this.#e,t,!0)}}const _L=Symbol("style");class xM{static initialize(){sa(_L,new X4t)}static get style(){return Jo(_L)}}var J4t=On("
      ");const K4t={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 Z4t(e,t){si(t,!0),Zr(e,K4t);const n=xM.style;let r=$t(()=>n.colorScheme),i=$t(()=>n.theme),o=te(null),s=$t(()=>H(r)??H(o)??"light");const a=P=>{P.matches?Mt(o,"dark"):Mt(o,"light")},l="(prefers-color-scheme: dark";vg(()=>(Mt(o,window.matchMedia(l).matches?"dark":"light",!0),window.matchMedia(l).addEventListener("change",a),()=>{window.matchMedia(l).removeEventListener("change",a)}));let c=$t(()=>G4t(H(i),H(s))),u=$t(()=>H(c).primaryTextColor),f=$t(()=>H(c).secondaryTextColor),h=$t(()=>H(c).tertiaryTextColor),p=$t(()=>H(c).fontFamily),g=$t(()=>H(c).fontSize),y=$t(()=>H(c).primaryBackgroundColor),v=$t(()=>H(c).secondaryBackgroundColor),b=$t(()=>H(c).hoverBackgroundColor),_=$t(()=>H(c).headerFontFamily),S=$t(()=>H(c).headerFontSize),x=$t(()=>H(c).cellFontFamily),T=$t(()=>H(c).cellFontSize),k=$t(()=>H(c).scrollbarBackgroundColor),M=$t(()=>H(c).scrollbarPillColor),C=$t(()=>H(c).scrollbarLabelBackgroundColor),R=$t(()=>H(c).shadow),O=$t(()=>H(c).outlineColor),N=$t(()=>H(c).dimmedRowColor),L=$t(()=>H(c).rowScrollToColor),$=$t(()=>H(c).rowHoverColor);Pr(()=>{});var I=J4t();let F;var D=Bn(I);yA(D,()=>t.children),Rn(I),pi(()=>{Vf(I,1,`style-wrapper table-defaults ${H(s)??""}`,"svelte-vahitw"),F=cs(I,"",F,{"--user-primary-text-color":H(u),"--user-secondary-text-color":H(f),"--user-tertiary-text-color":H(h),"--user-font-family":H(p),"--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(S),"--user-cell-font-family":H(x),"--user-cell-font-size":H(T),"--user-scrollbar-bg":H(k),"--user-scrollbar-pill-bg":H(M),"--user-scrollbar-label-bg":H(C),"--user-shadow":H(R),"--user-outline-color":H(O),"--user-dimmed-row-color":H(N),"--user-row-scroll-to-color":H(L),"--user-row-hover-color":H($)})}),mn(e,I),ai()}function Q4t(){return Yo}function tMt(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 eMt(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function nMt(e,t){return e.concat(t)}var rMt=On("
      "),iMt=On("
      ",1);const oMt={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 sMt(e,t){si(t,!0),Zr(e,oMt);const n=Kn.controller,r=Kn.model,i=Kn.overscrollModifier,o=tr.config;let s=$t(()=>r.rowHeights[t.row]),a=$t(()=>Math.max(r.colsRightmostPosition,n.viewWidth)),l=$t(()=>i.y(r.rowPositions[t.row])),c=$t(()=>r.getRowParity(t.row)),u=$t(()=>n.flashedRowId===t.row),f=$t(()=>n.hoveredRowId===t.row),h=$t(()=>o.highlightedRows?o.highlightedRows?.has(t.row):null);var p=iMt(),g=Zl(p);let y;var v=va(g,2);{var b=_=>{var S=rMt();let x;pi(()=>{Vf(S,1,`row-background ${H(c)??""} dimmer`,"svelte-h8fig9"),x=cs(S,"",x,{"--width":H(a)+"px","--height":H(s)+"px","--y":H(l)+"px"})}),mn(_,S)};Ts(v,_=>{H(h)!==null&&!H(h)&&_(b)})}pi(()=>{Vf(g,1,`row-background ${H(c)??""} ${(H(u)?"flashed":null)??""} ${(H(f)&&o.highlightHoveredRow?"hovered":null)??""}`,"svelte-h8fig9"),y=cs(g,"",y,{"--width":H(a)+"px","--height":H(s)+"px","--y":H(l)+"px"})}),mn(e,p),ai()}var aMt=On(" ",1),lMt=On('
      ',1),cMt=On('
      ');const uMt={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 fMt(e,t){si(t,!0),Zr(e,uMt),tr.initialize(),A_.initialize(),xM.initialize(),Kn.initialize();const n=Kn.controller,r=Kn.model,i=Kn.overscrollModifier,o=tr.config,s=xM.style;Pr(()=>{t.scrollTo!=null&&n.scrollToRow(String(t.scrollTo))}),Pr(()=>{t.highlightedRows&&t.highlightedRows.length>0?o.highlightedRows=new Set(t.highlightedRows.map(_=>String(_))):o.highlightedRows=null}),Pr(()=>{t.onRowClick!=null?o.onRowClick=t.onRowClick:o.onRowClick=null}),Pr(()=>{t.coordinator?_M.coordinator=t.coordinator:_M.coordinator=null}),Pr(()=>{t.numLines!=null?o.textMaxLines=t.numLines:o.textMaxLines=o.DEFAULT_TEXT_MAX_LINES,t.lineHeight!=null?o.lineHeight=t.lineHeight:o.lineHeight=o.DEFAULT_LINE_HEIGHT}),Pr(()=>{t.colorScheme!=null?s.colorScheme=t.colorScheme:s.colorScheme=null}),Pr(()=>{t.theme!=null?s.theme=t.theme:s.theme={},t.colorScheme!=null?s.colorScheme=t.colorScheme:s.colorScheme=null}),Pr(()=>{t.columnConfigs!=null?o.columnConfigs=t.columnConfigs:o.columnConfigs={},t.onColumnConfigsChange!=null?o.onColumnConfigsChange=t.onColumnConfigsChange:o.onColumnConfigsChange=()=>{}}),Pr(()=>{o.showRowNumber=t.showRowNumber??null}),Pr(()=>{o.onShowRowNumberChange=t.onShowRowNumberChange??null}),Pr(()=>{n.initialize({tableName:t.table,rowKey:t.rowKey,columns:[Q4t(),...t.columns],filterBy:t.filter??null})}),Pr(()=>{t.customCells!=null?A_.config=t.customCells:A_.config={}}),Pr(()=>{t.additionalHeaderContents!=null?wM.config=t.additionalHeaderContents:wM.config={}}),Pr(()=>{t.headerHeight!=null?o.headerHeight=t.headerHeight:o.headerHeight=null}),Pr(()=>{t.highlightHoveredRow!=null?o.highlightHoveredRow=t.highlightHoveredRow:o.highlightHoveredRow=!1});let a=te([]),l=te(0),c=te(null),u=te(Oi([])),f=te(Oi([])),h=$t(()=>H(u).filter(_=>n.rowStillExists(_))),p=$t(()=>H(f)),g=0;vg(()=>(g=requestAnimationFrame(b),()=>{n.teardown(),r.teardown(),cancelAnimationFrame(g)}));function y(_,S){if(S.length>0){const x=S[S.length-1];return Math.abs(r.data[_][Ho]-r.data[x][Ho])}return 0}function v(){const{left:_,right:S}=tMt(H(a),r.renderableRows);_.length===0&&S.length===0||(Mt(a,eMt(H(a),_)),Mt(a,nMt(H(a),S.sort((x,T)=>y(x,H(a))-y(T,H(a))).slice(0,n.isJumping?n.rowsOnScreen:o.rowRenderBatchSize))))}function b(){v(),Mt(u,H(a).filter(x=>n.rowIsVisible(x)),!0),Mt(f,r.renderableCols.filter(x=>n.colIsVisible(x)),!0);const _=n.xScroll,S=i.yScroll(n.yScroll);H(c)&&(H(c).style.transform=`translate3d(${_}px, ${S}px, 0)`),Mt(l,n.updateKey,!0),g=requestAnimationFrame(b)}Z4t(e,{children:(_,S)=>{var x=cMt(),T=Bn(x);H4t(T,{});var k=va(T,2),M=Bn(k);{var C=R=>{var O=lMt(),N=Zl(O),L=Bn(N);PTt(L,()=>H(l),F=>{var D=aMt(),P=Zl(D);Zm(P,16,()=>H(h),q=>q,(q,U)=>{var V=vx(),G=Zl(V);Zm(G,16,()=>H(p),Z=>Z,(Z,lt)=>{u4t(Z,{get row(){return U},get col(){return lt}})}),mn(q,V)});var z=va(P,2);Zm(z,16,()=>r.renderableRows,q=>q,(q,U)=>{sMt(q,{get row(){return U}})}),mn(F,D)}),Rn(N),es(N,F=>Mt(c,F),()=>H(c));var $=va(N,2);Fkt($,{});var I=va($,2);Okt(I,{}),mn(R,O)};Ts(M,R=>{n.isReady&&R(C)})}Rn(k),Rn(x),es(x,R=>n.element=R,()=>n?.element),Yy("wheel",x,function(...R){n.handleWheel?.apply(this,R)}),cl(k,"clientHeight",R=>n.viewHeight=R),cl(k,"clientWidth",R=>n.viewWidth=R),mn(_,x)},$$slots:{default:!0}}),ai()}class hMt{component;currentProps;constructor(t,n){this.currentProps={...n},this.component=FTt({component:fMt,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 dMt=St("
      ");function pMt(e,t){Ne(t,!0);let n=Lo(t,["$$slots","$$events","$$legacy"]),r;eg(()=>{let o=new hMt(r,n);$i(()=>{o.update(n)}),u6(()=>{o.destroy()})});var i=dMt();Ce(i,"",{},{width:"100%",height:"100%"}),rs(i,o=>r=o,()=>r),rt(e,i),Ie()}const Xv=Symbol("Fixed"),ul=Symbol("Transient"),ZW=Symbol("Transform");function gMt(e){return e}var mMt=3,wL=1e-6;function yMt(e){return"translate("+e+",0)"}function vMt(e){return t=>+e(t)}function bMt(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function _Mt(){return!this.__axis}function wMt(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=1,u="y",f=yMt;function h(p){var g=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):gMt),v=Math.max(o,0)+a,b=t.range(),_=+b[0]+l,S=+b[b.length-1]+l,x=(t.bandwidth?bMt:vMt)(t.copy(),l),T=p.selection?p.selection():p,k=T.selectAll(".domain").data([null]),M=T.selectAll(".tick").data(g,t).order(),C=M.exit(),R=M.enter().append("g").attr("class","tick"),O=M.select("line"),N=M.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(R),O=O.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),N=N.merge(R.append("text").attr("fill","currentColor").attr(u,c*v).attr("dy","0.71em")),p!==T&&(k=k.transition(p),M=M.transition(p),O=O.transition(p),N=N.transition(p),C=C.transition(p).attr("opacity",wL).attr("transform",function(L){return isFinite(L=x(L))?f(L+l):this.getAttribute("transform")}),R.attr("opacity",wL).attr("transform",function(L){var $=this.parentNode.__axis;return f(($&&isFinite($=$(L))?$:x(L))+l)})),C.remove(),k.attr("d",s?"M"+_+","+c*s+"V"+l+"H"+S+"V"+c*s:"M"+_+","+l+"H"+S),M.attr("opacity",1).attr("transform",function(L){return f(x(L)+l)}),O.attr(u+"2",c*o),N.attr(u,c*v).text(y),T.filter(_Mt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),T.each(function(){this.__axis=x})}return h.scale=function(p){return arguments.length?(t=p,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(p){return arguments.length?(n=p==null?[]:Array.from(p),h):n.slice()},h.tickValues=function(p){return arguments.length?(r=p==null?null:Array.from(p),h):r&&r.slice()},h.tickFormat=function(p){return arguments.length?(i=p,h):i},h.tickSize=function(p){return arguments.length?(o=s=+p,h):o},h.tickSizeInner=function(p){return arguments.length?(o=+p,h):o},h.tickSizeOuter=function(p){return arguments.length?(s=+p,h):s},h.tickPadding=function(p){return arguments.length?(a=+p,h):a},h.offset=function(p){return arguments.length?(l=+p,h):l},h}function xMt(e){return wMt(mMt,e)}var SMt={value:()=>{}};function DS(){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}})}R_.prototype=DS.prototype={constructor:R_,on:function(e,t){var n=this._,r=EMt(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),wu.hasOwnProperty(t)?{space:wu[t],local:e}:e}function kMt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===SM&&t.documentElement.namespaceURI===SM?t.createElement(e):t.createElementNS(n,e)}}function MMt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function FS(e){var t=LS(e);return(t.local?MMt:kMt)(t)}function CMt(){}function xA(e){return e==null?CMt:function(){return this.querySelector(e)}}function AMt(e){typeof e!="function"&&(e=xA(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=S&&(S=_+1);!(T=v[S])&&++S=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function t5t(e){e||(e=e5t);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),o=0;ot?1:e>=t?0:NaN}function n5t(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function r5t(){return Array.from(this)}function i5t(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?g5t:typeof t=="function"?y5t:m5t)(e,t,n??"")):O0(this.node(),e)}function O0(e,t){return e.style.getPropertyValue(t)||rY(e).getComputedStyle(e,null).getPropertyValue(t)}function b5t(e){return function(){delete this[e]}}function _5t(e,t){return function(){this[e]=t}}function w5t(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function x5t(e,t){return arguments.length>1?this.each((t==null?b5t:typeof t=="function"?w5t:_5t)(e,t)):this.node()[e]}function iY(e){return e.trim().split(/^|\s+/)}function SA(e){return e.classList||new oY(e)}function oY(e){this._node=e,this._names=iY(e.getAttribute("class")||"")}oY.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 sY(e,t){for(var n=SA(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function J5t(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n=0&&e._call.call(void 0,t),e=e._next;--D0}function SL(){Td=(xx=Hy.now())+$S,D0=Dm=0;try{s6t()}finally{D0=0,l6t(),Td=0}}function a6t(){var e=Hy.now(),t=e-xx;t>hY&&($S-=t,xx=e)}function l6t(){for(var e,t=wx,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:wx=n);Lm=e,kM(r)}function kM(e){if(!D0){Dm&&(Dm=clearTimeout(Dm));var t=e-Td;t>24?(e<1/0&&(Dm=setTimeout(SL,e-Hy.now()-$S)),am&&(am=clearInterval(am))):(am||(xx=Hy.now(),am=setInterval(a6t,hY)),D0=1,dY(SL))}}function EL(e,t,n){var r=new Sx;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var c6t=DS("start","end","cancel","interrupt"),u6t=[],gY=0,TL=1,MM=2,N_=3,kL=4,CM=5,I_=6;function BS(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;f6t(e,n,{name:t,index:r,group:i,on:c6t,tween:u6t,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:gY})}function TA(e,t){var n=ml(e,t);if(n.state>gY)throw new Error("too late; already scheduled");return n}function vc(e,t){var n=ml(e,t);if(n.state>N_)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 f6t(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=pY(o,0,n.time);function o(c){n.state=TL,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,h,p;if(n.state!==TL)return l();for(u in r)if(p=r[u],p.name===n.name){if(p.state===N_)return EL(s);p.state===kL?(p.state=I_,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[u]):+uMM&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function z6t(e,t,n){var r,i,o=U6t(t)?TA:vc;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function q6t(e,t){var n=this._id;return arguments.length<2?ml(this.node(),n).on.on(e):this.each(z6t(n,e,t))}function j6t(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function V6t(){return this.on("end.remove",j6t(this._id))}function W6t(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xA(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function mCt(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){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:o}})}function yCt(e){e.stopImmediatePropagation()}function ak(e){e.preventDefault(),e.stopImmediatePropagation()}var ML={name:"drag"},lk={name:"space"},bp={name:"handle"},_p={name:"center"};const{abs:CL,max:Vi,min:Wi}=Math;function AL(e){return[+e[0],+e[1]]}function AM(e){return[AL(e[0]),AL(e[1])]}var O_={name:"x",handles:["w","e"].map(Gy),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]]}},D_={name:"y",handles:["n","s"].map(Gy),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]]}},vCt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Gy),input:function(e){return e==null?null:AM(e)},output:function(e){return e}},Oc={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"},RL={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},NL={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},bCt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},_Ct={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Gy(e){return{type:e}}function wCt(e){return!e.ctrlKey&&!e.button}function xCt(){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 SCt(){return navigator.maxTouchPoints||"ontouchstart"in this}function ck(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ECt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function TCt(){return MA(O_)}function kCt(){return MA(D_)}function MCt(){return MA(vCt)}function MA(e){var t=xCt,n=wCt,r=SCt,i=!0,o=DS("start","brush","end"),s=6,a;function l(v){var b=v.property("__brush",y).selectAll(".overlay").data([Gy("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Oc.overlay).merge(b).each(function(){var S=ck(this).extent;Er(this).attr("x",S[0][0]).attr("y",S[0][1]).attr("width",S[1][0]-S[0][0]).attr("height",S[1][1]-S[0][1])}),v.selectAll(".selection").data([Gy("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Oc.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var _=v.selectAll(".handle").data(e.handles,function(S){return S.type});_.exit().remove(),_.enter().append("rect").attr("class",function(S){return"handle handle--"+S.type}).attr("cursor",function(S){return Oc[S.type]}),v.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",p).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(S){u(this,arguments).beforestart().start(S)}).on("interrupt.brush end.brush",function(S){u(this,arguments).end(S)}).tween("brush",function(){var S=this,x=S.__brush,T=u(S,arguments),k=x.selection,M=e.input(typeof b=="function"?b.apply(this,arguments):b,x.extent),C=ug(k,M);function R(O){x.selection=O===1&&M===null?null:C(O),c.call(S),T.brush()}return k!==null&&M!==null?R:R(1)}):v.each(function(){var S=this,x=arguments,T=S.__brush,k=e.input(typeof b=="function"?b.apply(S,x):b,T.extent),M=u(S,x).beforestart();f0(S),T.selection=k===null?null:k,c.call(S),M.start(_).brush(_).end(_)})},l.clear=function(v,b){l.move(v,null,b)};function c(){var v=Er(this),b=ck(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]-s/2:b[0][0]-s/2}).attr("y",function(_){return _.type[0]==="s"?b[1][1]-s/2:b[0][1]-s/2}).attr("width",function(_){return _.type==="n"||_.type==="s"?b[1][0]-b[0][0]+s:s}).attr("height",function(_){return _.type==="e"||_.type==="w"?b[1][1]-b[0][1]+s:s})):v.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(v,b,_){var S=v.__brush.emitter;return S&&(!_||!S.clean)?S: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 S=Er(this.that).datum();o.call(v,this.that,new mCt(v,{sourceEvent:b,target:l,selection:e.output(this.state.selection),mode:_,dispatch:o}),S)}};function h(v){if(a&&!v.touches||!n.apply(this,arguments))return;var b=this,_=v.target.__data__.type,S=(i&&v.metaKey?_="overlay":_)==="selection"?ML:i&&v.altKey?_p:bp,x=e===D_?null:bCt[_],T=e===O_?null:_Ct[_],k=ck(b),M=k.extent,C=k.selection,R=M[0][0],O,N,L=M[0][1],$,I,F=M[1][0],D,P,z=M[1][1],q,U,V=0,G=0,Z,lt=x&&T&&i&&v.shiftKey,pt,dt,at=Array.from(v.touches||[v],Ct=>{const Xt=Ct.identifier;return Ct=za(Ct,b),Ct.point0=Ct.slice(),Ct.identifier=Xt,Ct});f0(b);var yt=u(b,arguments,!0).beforestart();if(_==="overlay"){C&&(Z=!0);const Ct=[at[0],at[1]||at[0]];k.selection=C=[[O=e===D_?R:Wi(Ct[0][0],Ct[1][0]),$=e===O_?L:Wi(Ct[0][1],Ct[1][1])],[D=e===D_?F:Vi(Ct[0][0],Ct[1][0]),q=e===O_?z:Vi(Ct[0][1],Ct[1][1])]],at.length>1&&Bt(v)}else O=C[0][0],$=C[0][1],D=C[1][0],q=C[1][1];N=O,I=$,P=D,U=q;var nt=Er(b).attr("pointer-events","none"),gt=nt.selectAll(".overlay").attr("cursor",Oc[_]);if(v.touches)yt.moved=st,yt.ended=Dt;else{var vt=Er(v.view).on("mousemove.brush",st,!0).on("mouseup.brush",Dt,!0);i&&vt.on("keydown.brush",zt,!0).on("keyup.brush",jt,!0),uY(v.view)}c.call(b),yt.start(v,S.name);function st(Ct){for(const Xt of Ct.changedTouches||[Ct])for(const Pt of at)Pt.identifier===Xt.identifier&&(Pt.cur=za(Xt,b));if(lt&&!pt&&!dt&&at.length===1){const Xt=at[0];CL(Xt.cur[0]-Xt[0])>CL(Xt.cur[1]-Xt[1])?dt=!0:pt=!0}for(const Xt of at)Xt.cur&&(Xt[0]=Xt.cur[0],Xt[1]=Xt.cur[1]);Z=!0,ak(Ct),Bt(Ct)}function Bt(Ct){const Xt=at[0],Pt=Xt.point0;var Lt;switch(V=Xt[0]-Pt[0],G=Xt[1]-Pt[1],S){case lk:case ML:{x&&(V=Vi(R-O,Wi(F-D,V)),N=O+V,P=D+V),T&&(G=Vi(L-$,Wi(z-q,G)),I=$+G,U=q+G);break}case bp:{at[1]?(x&&(N=Vi(R,Wi(F,at[0][0])),P=Vi(R,Wi(F,at[1][0])),x=1),T&&(I=Vi(L,Wi(z,at[0][1])),U=Vi(L,Wi(z,at[1][1])),T=1)):(x<0?(V=Vi(R-O,Wi(F-O,V)),N=O+V,P=D):x>0&&(V=Vi(R-D,Wi(F-D,V)),N=O,P=D+V),T<0?(G=Vi(L-$,Wi(z-$,G)),I=$+G,U=q):T>0&&(G=Vi(L-q,Wi(z-q,G)),I=$,U=q+G));break}case _p:{x&&(N=Vi(R,Wi(F,O-V*x)),P=Vi(R,Wi(F,D+V*x))),T&&(I=Vi(L,Wi(z,$-G*T)),U=Vi(L,Wi(z,q+G*T)));break}}P0&&(O=N-V),T<0?q=U-G:T>0&&($=I-G),S=lk,gt.attr("cursor",Oc.selection),Bt(Ct));break}default:return}ak(Ct)}function jt(Ct){switch(Ct.keyCode){case 16:{lt&&(pt=dt=lt=!1,Bt(Ct));break}case 18:{S===_p&&(x<0?D=P:x>0&&(O=N),T<0?q=U:T>0&&($=I),S=bp,Bt(Ct));break}case 32:{S===lk&&(Ct.altKey?(x&&(D=P-V*x,O=N+V*x),T&&(q=U-G*T,$=I+G*T),S=_p):(x<0?D=P:x>0&&(O=N),T<0?q=U:T>0&&($=I),S=bp),gt.attr("cursor",Oc[_]),Bt(Ct));break}default:return}ak(Ct)}}function p(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=AM(t.apply(this,arguments)),v.dim=e,v}return l.extent=function(v){return arguments.length?(t=typeof v=="function"?v:sk(AM(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?(s=+v,l):s},l.keyModifiers=function(v){return arguments.length?(i=!!v,l):i},l.on=function(){var v=o.on.apply(o,arguments);return v===o?l:v},l}const RM=Math.PI,NM=2*RM,Dh=1e-6,CCt=NM-Dh;function bY(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return bY;const n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;iDh)if(!(Math.abs(f*l-c*u)>Dh)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-s,g=i-a,y=l*l+c*c,v=p*p+g*g,b=Math.sqrt(y),_=Math.sqrt(h),S=o*Math.tan((RM-Math.acos((y+h-v)/(2*b*_)))/2),x=S/_,T=S/b;Math.abs(x-1)>Dh&&this._append`L${t+x*u},${n+x*f}`,this._append`A${o},${o},0,0,${+(f*p>u*g)},${this._x1=t+T*l},${this._y1=n+T*c}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,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^s,h=s?i-o:o-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Dh||Math.abs(this._y1-u)>Dh)&&this._append`L${c},${u}`,r&&(h<0&&(h=h%NM+NM),h>CCt?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>Dh&&this._append`A${r},${r},0,${+(h>=RM)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}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 nu(e=3){return new _Y(+e)}var RCt=Array.prototype,wY=RCt.slice;function NCt(e,t){return e-t}function ICt(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 OCt(e,t){for(var n=-1,r=t.length,i;++nr!=p>r&&n<(h-c)*(r-u)/(p-u)+c&&(i=-i)}return i}function LCt(e,t,n){var r;return FCt(e,t,n)&&$Ct(e[r=+(e[0]===t[0])],n[r],t[r])}function FCt(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function $Ct(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function BCt(){}var Dc=[[],[[[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 Ex(){var e=1,t=1,n=yC,r=l;function i(c){var u=n(c);if(Array.isArray(u))u=u.slice().sort(NCt);else{const f=di(c,PCt);for(u=Bf(...eq(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]o(c,f))}function o(c,u){const f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var h=[],p=[];return s(c,f,function(g){r(g,c,f),ICt(g)>0?h.push([g]):p.push(g)}),p.forEach(function(g){for(var y=0,v=h.length,b;y=u,Dc[_<<2].forEach(x);++g0&&p0&&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)?uf(wY.call(c)):uf(c),i):n},i.smooth=function(c){return arguments.length?(r=c?l:BCt,i):r===l},i}function PCt(e){return isFinite(e)?e:NaN}function Ah(e,t){return e==null?!1:+e>=t}function uk(e){return e==null||isNaN(e=+e)?-1/0:e}function IL(e,t,n,r){const i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function UCt(e){return e[0]}function zCt(e){return e[1]}function qCt(){return 1}function jCt(){var e=UCt,t=zCt,n=qCt,r=960,i=500,o=20,s=2,a=o*3,l=r+a*2>>s,c=i+a*2>>s,u=uf(20);function f(_){var S=new Float32Array(l*c),x=Math.pow(2,-s),T=-1;for(const $ of _){var k=(e($,++T,_)+a)*x,M=(t($,T,_)+a)*x,C=+n($,T,_);if(C&&k>=0&&k=0&&Mk*T))(S).map((k,M)=>(k.value=+x[M],p(k)))}h.contours=function(_){var S=f(_),x=Ex().size([l,c]),T=Math.pow(2,2*s),k=M=>{M=+M;var C=p(x.contour(S,M*T));return C.value=M,C};return Object.defineProperty(k,"max",{get:()=>Vr(S)/T}),k};function p(_){return _.coordinates.forEach(g),_}function g(_){_.forEach(y)}function y(_){_.forEach(v)}function v(_){_[0]=_[0]*Math.pow(2,s)-a,_[1]=_[1]*Math.pow(2,s)-a}function b(){return a=o*3,l=r+a*2>>s,c=i+a*2>>s,h}return h.x=function(_){return arguments.length?(e=typeof _=="function"?_:uf(+_),h):e},h.y=function(_){return arguments.length?(t=typeof _=="function"?_:uf(+_),h):t},h.weight=function(_){return arguments.length?(n=typeof _=="function"?_:uf(+_),h):n},h.size=function(_){if(!arguments.length)return[r,i];var S=+_[0],x=+_[1];if(!(S>=0&&x>=0))throw new Error("invalid size");return r=S,i=x,b()},h.cellSize=function(_){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(_)/Math.LN2),b()},h.thresholds=function(_){return arguments.length?(u=typeof _=="function"?_:Array.isArray(_)?uf(wY.call(_)):uf(_),h):u},h.bandwidth=function(_){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((_=+_)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*_*_+1)-1)/2,b()},h}const fu=11102230246251565e-32,Yi=134217729,VCt=(3+8*fu)*fu;function fk(e,t,n,r,i){let o,s,a,l,c=t[0],u=r[0],f=0,h=0;u>c==u>-c?(o=c,c=t[++f]):(o=u,u=r[++h]);let p=0;if(fc==u>-c?(s=c+o,a=o-(s-c),c=t[++f]):(s=u+o,a=o-(s-u),u=r[++h]),o=s,a!==0&&(i[p++]=a);fc==u>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++f]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++h]),o=s,a!==0&&(i[p++]=a);for(;f=I||-$>=I||(f=e-R,a=e-(R+f)+(f-i),f=n-O,c=n-(O+f)+(f-i),f=t-N,l=t-(N+f)+(f-o),f=r-L,u=r-(L+f)+(f-o),a===0&&l===0&&c===0&&u===0)||(I=GCt*s+VCt*Math.abs($),$+=R*u+L*a-(N*c+O*l),$>=I||-$>=I))return $;x=a*L,h=Yi*a,p=h-(h-a),g=a-p,h=Yi*L,y=h-(h-L),v=L-y,T=g*v-(x-p*y-g*y-p*v),k=l*O,h=Yi*l,p=h-(h-l),g=l-p,h=Yi*O,y=h-(h-O),v=O-y,M=g*v-(k-p*y-g*y-p*v),b=T-M,f=T-b,lo[0]=T-(b+f)+(f-M),_=x+b,f=_-x,S=x-(_-f)+(b-f),b=S-k,f=S-b,lo[1]=S-(b+f)+(f-k),C=_+b,f=C-_,lo[2]=_-(C-f)+(b-f),lo[3]=C;const F=fk(4,wp,4,lo,OL);x=R*u,h=Yi*R,p=h-(h-R),g=R-p,h=Yi*u,y=h-(h-u),v=u-y,T=g*v-(x-p*y-g*y-p*v),k=N*c,h=Yi*N,p=h-(h-N),g=N-p,h=Yi*c,y=h-(h-c),v=c-y,M=g*v-(k-p*y-g*y-p*v),b=T-M,f=T-b,lo[0]=T-(b+f)+(f-M),_=x+b,f=_-x,S=x-(_-f)+(b-f),b=S-k,f=S-b,lo[1]=S-(b+f)+(f-k),C=_+b,f=C-_,lo[2]=_-(C-f)+(b-f),lo[3]=C;const D=fk(F,OL,4,lo,DL);x=a*u,h=Yi*a,p=h-(h-a),g=a-p,h=Yi*u,y=h-(h-u),v=u-y,T=g*v-(x-p*y-g*y-p*v),k=l*c,h=Yi*l,p=h-(h-l),g=l-p,h=Yi*c,y=h-(h-c),v=c-y,M=g*v-(k-p*y-g*y-p*v),b=T-M,f=T-b,lo[0]=T-(b+f)+(f-M),_=x+b,f=_-x,S=x-(_-f)+(b-f),b=S-k,f=S-b,lo[1]=S-(b+f)+(f-k),C=_+b,f=C-_,lo[2]=_-(C-f)+(b-f),lo[3]=C;const P=fk(D,DL,4,lo,LL);return LL[P-1]}function Rb(e,t,n,r,i,o){const s=(t-o)*(n-i),a=(e-i)*(r-o),l=s-a,c=Math.abs(s+a);return Math.abs(l)>=YCt*c?l:-XCt(e,t,n,r,i,o,c)}const FL=Math.pow(2,-52),Nb=new Uint32Array(512);class Tx{static from(t,n=tAt,r=eAt){const i=t.length,o=new Float64Array(i*2);for(let s=0;s>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:o}=this,s=t.length>>1;let a=1/0,l=1/0,c=-1/0,u=-1/0;for(let R=0;Rc&&(c=O),N>u&&(u=N),this._ids[R]=R}const f=(a+c)/2,h=(l+u)/2;let p,g,y;for(let R=0,O=1/0;R0&&(g=R,O=N)}let _=t[2*g],S=t[2*g+1],x=1/0;for(let R=0;RL&&(R[O++]=$,L=I)}this.hull=R.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Rb(v,b,_,S,T,k)<0){const R=g,O=_,N=S;g=y,_=T,S=k,y=R,T=O,k=N}const M=QCt(v,b,_,S,T,k);this._cx=M.x,this._cy=M.y;for(let R=0;R0&&Math.abs($-O)<=FL&&Math.abs(I-N)<=FL||(O=$,N=I,L===p||L===g||L===y))continue;let F=0;for(let U=0,V=this._hashKey($,I);U=0;)if(D=P,D===F){D=-1;break}if(D===-1)continue;let z=this._addTriangle(D,L,r[D],-1,-1,i[D]);i[L]=this._legalize(z+2),i[D]=z,C++;let q=r[D];for(;P=r[q],Rb($,I,t[2*q],t[2*q+1],t[2*P],t[2*P+1])<0;)z=this._addTriangle(q,L,P,i[L],-1,i[q]),i[L]=this._legalize(z+2),r[q]=q,C--,q=P;if(D===F)for(;P=n[D],Rb($,I,t[2*P],t[2*P+1],t[2*D],t[2*D+1])<0;)z=this._addTriangle(P,L,D,-1,i[D],i[P]),this._legalize(z+2),i[P]=z,r[D]=D,C--,D=P;this._hullStart=n[L]=D,r[D]=n[q]=L,r[L]=q,o[this._hashKey($,I)]=L,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(C);for(let R=0,O=this._hullStart;R0?3-n:1+n)/4}function hk(e,t,n,r){const i=e-n,o=t-r;return i*i+o*o}function KCt(e,t,n,r,i,o,s,a){const l=e-s,c=t-a,u=n-s,f=r-a,h=i-s,p=o-a,g=l*l+c*c,y=u*u+f*f,v=h*h+p*p;return l*(f*v-y*p)-c*(u*v-y*h)+g*(u*p-f*h)<0}function ZCt(e,t,n,r,i,o){const s=n-e,a=r-t,l=i-e,c=o-t,u=s*s+a*a,f=l*l+c*c,h=.5/(s*c-a*l),p=(c*u-a*f)*h,g=(s*f-l*u)*h;return p*p+g*g}function QCt(e,t,n,r,i,o){const s=n-e,a=r-t,l=i-e,c=o-t,u=s*s+a*a,f=l*l+c*c,h=.5/(s*c-a*l),p=e+(c*u-a*f)*h,g=t+(s*f-l*u)*h;return{x:p,y:g}}function jp(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const o=e[i],s=t[o];let a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{const i=n+r>>1;let o=n+1,s=r;lm(e,i,o),t[e[n]]>t[e[r]]&&lm(e,n,r),t[e[o]]>t[e[r]]&&lm(e,o,r),t[e[n]]>t[e[o]]&&lm(e,n,o);const a=e[o],l=t[a];for(;;){do o++;while(t[e[o]]l);if(s=s-n?(jp(e,t,o,r),jp(e,t,n,s-1)):(jp(e,t,n,s-1),jp(e,t,o,r))}}function lm(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function tAt(e){return e[0]}function eAt(e){return e[1]}const $L=1e-6;class qh{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,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>$L||Math.abs(this._y1-o)>$L)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}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 IM{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 nAt=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(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=o,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 o,s;const a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let y=0,v=0,b=r.length,_,S;y1;)o-=2;for(let s=2;s0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)0){if(t>=this.xmax)return null;(s=(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 aAt(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class oh{static from(t,n=iAt,r=oAt,i){return new oh("length"in t?lAt(t,n,r,i):Float64Array.from(cAt(t,n,r,i)))}constructor(t){this._delaunator=new Tx(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&&sAt(t)){this.collinear=Int32Array.from({length:n.length/2},(h,p)=>p).sort((h,p)=>n[2*h]-n[2*p]||n[2*h+1]-n[2*p+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,p=n.length/2;h0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new nAt(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){const f=a.indexOf(t);f>0&&(yield a[f-1]),f=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){const{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:l,points:c}=this;if(i[t]===-1||!c.length)return(t+1)%(c.length>>1);let u=t,f=xp(n-c[t*2],2)+xp(r-c[t*2+1],2);const h=i[t];let p=h;do{let g=l[p];const y=xp(n-c[g*2],2)+xp(r-c[g*2+1],2);if(y0?1:e<0?-1:0},Io=Math.sqrt,CA=Math.tan;function SY(e){return e>1?0:e<-1?sn:Math.acos(e)}function us(e){return e>1?Kr:e<-1?-Kr:Math.asin(e)}function As(){}function Mx(e,t){e&&UL.hasOwnProperty(e.type)&&UL[e.type](e,t)}var PL={Feature:function(e,t){Mx(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rsn&&(e-=Math.round(e/Bs)*Bs),[e,t]}qM.invert=qM;function MY(e,t,n){return(e%=Bs)?t||n?zM(WL(e),YL(t,n)):WL(e):t||n?YL(t,n):qM}function VL(e){return function(t,n){return t+=e,In(t)>sn&&(t-=Math.round(t/Bs)*Bs),[t,n]}}function WL(e){var t=VL(e);return t.invert=VL(-e),t}function YL(e,t){var n=Re(e),r=he(e),i=Re(t),o=he(t);function s(a,l){var c=Re(l),u=Re(a)*c,f=he(a)*c,h=he(l),p=h*n+u*r;return[fl(f*i-p*o,u*n-h*r),us(p*i+f*o)]}return s.invert=function(a,l){var c=Re(l),u=Re(a)*c,f=he(a)*c,h=he(l),p=h*i-f*o;return[fl(f*i+h*o,u*n+p*r),us(p*n-u*r)]},s}function mAt(e){e=MY(e[0]*En,e[1]*En,e.length>2?e[2]*En:0);function t(n){return n=e(n[0]*En,n[1]*En),n[0]*=Ii,n[1]*=Ii,n}return t.invert=function(n){return n=e.invert(n[0]*En,n[1]*En),n[0]*=Ii,n[1]*=Ii,n},t}function yAt(e,t,n,r,i,o){if(n){var s=Re(t),a=he(t),l=r*n;i==null?(i=t+r*Bs,o=t-l/2):(i=HL(s,i),o=HL(s,o),(r>0?io)&&(i+=r*Bs));for(var c,u=i;r>0?u>o:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function L_(e,t){return In(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,p=!p}while(!h.v);i.lineEnd()}}}function GL(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n=0?1:-1,O=R*C,N=O>sn,L=v*k;if(l.add(fl(L*R*he(O),b*M+L*Re(O))),s+=N?C+R*Bs:C,N^g>=n^x>=n){var $=Cx(L0(p),L0(S));$M($);var I=Cx(o,$);$M(I);var F=(N^C>=0?-1:1)*us(I[2]);(r>F||r===F&&($[0]||$[1]))&&(a+=N^C>=0?1:-1)}}return(s<-1e-6||s0){for(l||(i.polygonStart(),l=!0),i.lineStart(),k=0;k1&&x&2&&T.push(T.pop().concat(T.shift())),u.push(T.filter(bAt))}}return h}}function bAt(e){return e.length>1}function _At(e,t){return((e=e.x)[0]<0?e[1]-Kr-Ae:Kr-e[1])-((t=t.x)[0]<0?t[1]-Kr-Ae:Kr-t[1])}const XL=RY(function(){return!0},wAt,SAt,[-sn,-Kr]);function wAt(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?sn:-sn,l=In(o-t);In(l-sn)0?Kr:-Kr),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&l>=sn&&(In(t-r)Ae?bg((he(t)*(o=Re(r))*he(n)-he(r)*(i=Re(t))*he(e))/(i*o*s)):(t+r)/2}function SAt(e,t,n,r){var i;if(e==null)i=n*Kr,r.point(-sn,i),r.point(0,i),r.point(sn,i),r.point(sn,0),r.point(sn,-i),r.point(0,-i),r.point(-sn,-i),r.point(-sn,0),r.point(-sn,i);else if(In(e[0]-t[0])>Ae){var o=e[0]0,i=In(t)>Ae;function o(u,f,h,p){yAt(p,e,n,h,u,f)}function s(u,f){return Re(u)*Re(f)>t}function a(u){var f,h,p,g,y;return{lineStart:function(){g=p=!1,y=1},point:function(v,b){var _=[v,b],S,x=s(v,b),T=r?x?0:c(v,b):x?c(v+(v<0?sn:-sn),b):0;if(!f&&(g=p=x)&&u.lineStart(),x!==p&&(S=l(f,_),(!S||L_(f,S)||L_(_,S))&&(_[2]=1)),x!==p)y=0,x?(u.lineStart(),S=l(_,f),u.point(S[0],S[1])):(S=l(f,_),u.point(S[0],S[1],2),u.lineEnd()),f=S;else if(i&&f&&r^x){var k;!(T&h)&&(k=l(_,f,!0))&&(y=0,r?(u.lineStart(),u.point(k[0][0],k[0][1]),u.point(k[1][0],k[1][1]),u.lineEnd()):(u.point(k[1][0],k[1][1]),u.lineEnd(),u.lineStart(),u.point(k[0][0],k[0][1],3)))}x&&(!f||!L_(f,_))&&u.point(_[0],_[1]),f=_,p=x,h=T},lineEnd:function(){p&&u.lineEnd(),f=null},clean:function(){return y|(g&&p)<<1}}}function l(u,f,h){var p=L0(u),g=L0(f),y=[1,0,0],v=Cx(p,g),b=Ob(v,v),_=v[0],S=b-_*_;if(!S)return!h&&u;var x=t*b/S,T=-t*_/S,k=Cx(y,v),M=Db(y,x),C=Db(v,T);pk(M,C);var R=k,O=Ob(M,R),N=Ob(R,R),L=O*O-N*(Ob(M,M)-1);if(!(L<0)){var $=Io(L),I=Db(R,(-O-$)/N);if(pk(I,M),I=FM(I),!h)return I;var F=u[0],D=f[0],P=u[1],z=f[1],q;D0^I[1]<(In(I[0]-F)sn^(F<=I[0]&&I[0]<=D)){var Z=Db(R,(-O+$)/N);return pk(Z,M),[I,FM(Z)]}}}function c(u,f){var h=r?e:sn-e,p=0;return u<-h?p|=1:u>h&&(p|=2),f<-h?p|=4:f>h&&(p|=8),p}return RY(s,a,o,r?[0,-e]:[-sn,e-sn])}function TAt(e,t,n,r,i,o){var s=e[0],a=e[1],l=t[0],c=t[1],u=0,f=1,h=l-s,p=c-a,g;if(g=n-s,!(!h&&g>0)){if(g/=h,h<0){if(g0){if(g>f)return;g>u&&(u=g)}if(g=i-s,!(!h&&g<0)){if(g/=h,h<0){if(g>f)return;g>u&&(u=g)}else if(h>0){if(g0)){if(g/=p,p<0){if(g0){if(g>f)return;g>u&&(u=g)}if(g=o-a,!(!p&&g<0)){if(g/=p,p<0){if(g>f)return;g>u&&(u=g)}else if(p>0){if(g0&&(e[0]=s+u*h,e[1]=a+u*p),f<1&&(t[0]=s+f*h,t[1]=a+f*p),!0}}}}}var Fb=1e9,$b=-1e9;function NY(e,t,n,r){function i(c,u){return e<=c&&c<=n&&t<=u&&u<=r}function o(c,u,f,h){var p=0,g=0;if(c==null||(p=s(c,f))!==(g=s(u,f))||l(c,u)<0^f>0)do h.point(p===0||p===3?e:n,p>1?r:t);while((p=(p+f+4)%4)!==g);else h.point(u[0],u[1])}function s(c,u){return In(c[0]-e)0?0:3:In(c[0]-n)0?2:1:In(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=s(c,1),h=s(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=CY(),h,p,g,y,v,b,_,S,x,T,k,M={point:C,lineStart:L,lineEnd:$,polygonStart:O,polygonEnd:N};function C(F,D){i(F,D)&&u.point(F,D)}function R(){for(var F=0,D=0,P=p.length;Dr&&(lt-G)*(r-Z)>(pt-Z)*(e-G)&&++F:pt<=r&&(lt-G)*(r-Z)<(pt-Z)*(e-G)&&--F;return F}function O(){u=f,h=[],p=[],k=!0}function N(){var F=R(),D=k&&F,P=(h=iq(h)).length;(D||P)&&(c.polygonStart(),D&&(c.lineStart(),o(null,null,1,c),c.lineEnd()),P&&AY(h,a,F,o,c),c.polygonEnd()),u=c,h=p=g=null}function L(){M.point=I,p&&p.push(g=[]),T=!0,x=!1,_=S=NaN}function $(){h&&(I(y,v),b&&x&&f.rejoin(),h.push(f.result())),M.point=C,x&&u.lineEnd()}function I(F,D){var P=i(F,D);if(p&&g.push([F,D]),T)y=F,v=D,b=P,T=!1,P&&(u.lineStart(),u.point(F,D));else if(P&&x)u.point(F,D);else{var z=[_=Math.max($b,Math.min(Fb,_)),S=Math.max($b,Math.min(Fb,S))],q=[F=Math.max($b,Math.min(Fb,F)),D=Math.max($b,Math.min(Fb,D))];TAt(z,q,e,t,n,r)?(x||(u.lineStart(),u.point(z[0],z[1])),u.point(q[0],q[1]),P||u.lineEnd(),k=!1):P&&(u.lineStart(),u.point(F,D),k=!1)}_=F,S=D,x=P}return M}}function JL(e,t,n){var r=Cs(e,t-Ae,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function KL(e,t,n){var r=Cs(e,t-Ae,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function kAt(){var e,t,n,r,i,o,s,a,l=10,c=l,u=90,f=360,h,p,g,y,v=2.5;function b(){return{type:"MultiLineString",coordinates:_()}}function _(){return Cs(Ib(r/u)*u,n,u).map(g).concat(Cs(Ib(a/f)*f,s,f).map(y)).concat(Cs(Ib(t/l)*l,e,l).filter(function(S){return In(S%u)>Ae}).map(h)).concat(Cs(Ib(o/c)*c,i,c).filter(function(S){return In(S%f)>Ae}).map(p))}return b.lines=function(){return _().map(function(S){return{type:"LineString",coordinates:S}})},b.outline=function(){return{type:"Polygon",coordinates:[g(r).concat(y(s).slice(1),g(n).reverse().slice(1),y(a).reverse().slice(1))]}},b.extent=function(S){return arguments.length?b.extentMajor(S).extentMinor(S):b.extentMinor()},b.extentMajor=function(S){return arguments.length?(r=+S[0][0],n=+S[1][0],a=+S[0][1],s=+S[1][1],r>n&&(S=r,r=n,n=S),a>s&&(S=a,a=s,s=S),b.precision(v)):[[r,a],[n,s]]},b.extentMinor=function(S){return arguments.length?(t=+S[0][0],e=+S[1][0],o=+S[0][1],i=+S[1][1],t>e&&(S=t,t=e,e=S),o>i&&(S=o,o=i,i=S),b.precision(v)):[[t,o],[e,i]]},b.step=function(S){return arguments.length?b.stepMajor(S).stepMinor(S):b.stepMinor()},b.stepMajor=function(S){return arguments.length?(u=+S[0],f=+S[1],b):[u,f]},b.stepMinor=function(S){return arguments.length?(l=+S[0],c=+S[1],b):[l,c]},b.precision=function(S){return arguments.length?(v=+S,h=JL(o,i,90),p=KL(t,e,v),g=JL(a,s,90),y=KL(r,n,v),b):v},b.extentMajor([[-180,-90+Ae],[180,90-Ae]]).extentMinor([[-180,-80-Ae],[180,80+Ae]])}function MAt(){return kAt()()}const jM=e=>e;var mk=new Hl,VM=new Hl,IY,OY,WM,YM,Jc={point:As,lineStart:As,lineEnd:As,polygonStart:function(){Jc.lineStart=CAt,Jc.lineEnd=RAt},polygonEnd:function(){Jc.lineStart=Jc.lineEnd=Jc.point=As,mk.add(In(VM)),VM=new Hl},result:function(){var e=mk/2;return mk=new Hl,e}};function CAt(){Jc.point=AAt}function AAt(e,t){Jc.point=DY,IY=WM=e,OY=YM=t}function DY(e,t){VM.add(YM*e-WM*t),WM=e,YM=t}function RAt(){DY(IY,OY)}var F0=1/0,Fx=F0,Xy=-F0,$x=Xy,Bx={point:NAt,lineStart:As,lineEnd:As,polygonStart:As,polygonEnd:As,result:function(){var e=[[F0,Fx],[Xy,$x]];return Xy=$x=-(Fx=F0=1/0),e}};function NAt(e,t){eXy&&(Xy=e),t$x&&($x=t)}var HM=0,GM=0,$m=0,Px=0,Ux=0,Vp=0,XM=0,JM=0,Bm=0,LY,FY,Bl,Pl,ga={point:kd,lineStart:ZL,lineEnd:QL,polygonStart:function(){ga.lineStart=DAt,ga.lineEnd=LAt},polygonEnd:function(){ga.point=kd,ga.lineStart=ZL,ga.lineEnd=QL},result:function(){var e=Bm?[XM/Bm,JM/Bm]:Vp?[Px/Vp,Ux/Vp]:$m?[HM/$m,GM/$m]:[NaN,NaN];return HM=GM=$m=Px=Ux=Vp=XM=JM=Bm=0,e}};function kd(e,t){HM+=e,GM+=t,++$m}function ZL(){ga.point=IAt}function IAt(e,t){ga.point=OAt,kd(Bl=e,Pl=t)}function OAt(e,t){var n=e-Bl,r=t-Pl,i=Io(n*n+r*r);Px+=i*(Bl+e)/2,Ux+=i*(Pl+t)/2,Vp+=i,kd(Bl=e,Pl=t)}function QL(){ga.point=kd}function DAt(){ga.point=FAt}function LAt(){$Y(LY,FY)}function FAt(e,t){ga.point=$Y,kd(LY=Bl=e,FY=Pl=t)}function $Y(e,t){var n=e-Bl,r=t-Pl,i=Io(n*n+r*r);Px+=i*(Bl+e)/2,Ux+=i*(Pl+t)/2,Vp+=i,i=Pl*e-Bl*t,XM+=i*(Bl+e),JM+=i*(Pl+t),Bm+=i*3,kd(Bl=e,Pl=t)}function BY(e){this._context=e}BY.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,Bs);break}}},result:As};var KM=new Hl,yk,PY,UY,Pm,Um,Jy={point:As,lineStart:function(){Jy.point=$At},lineEnd:function(){yk&&zY(PY,UY),Jy.point=As},polygonStart:function(){yk=!0},polygonEnd:function(){yk=null},result:function(){var e=+KM;return KM=new Hl,e}};function $At(e,t){Jy.point=zY,PY=Pm=e,UY=Um=t}function zY(e,t){Pm-=e,Um-=t,KM.add(Io(Pm*Pm+Um*Um)),Pm=e,Um=t}let tF,zx,eF,nF;class rF{constructor(t){this._append=t==null?qY:BAt(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!==eF||this._append!==zx){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`,eF=r,zx=this._append,nF=this._,this._=i}this._+=nF;break}}}result(){const t=this._;return this._="",t.length?t:null}}function qY(e){let t=1;this._+=e[0];for(const n=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return qY;if(t!==tF){const n=10**t;tF=t,zx=function(i){let o=1;this._+=i[0];for(const s=i.length;o=0))throw new RangeError(`invalid digits: ${a}`);n=l}return t===null&&(o=new rF(n)),s},s.projection(e).digits(n).context(t)}function qx(e){return{stream:PS(e)}}function PS(e){return function(t){var n=new ZM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function ZM(){}ZM.prototype={constructor:ZM,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 RA(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),df(n,e.stream(Bx)),t(Bx.result()),r!=null&&e.clipExtent(r),e}function NA(e,t,n){return RA(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,l=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,l])},n)}function jY(e,t,n){return NA(e,[[0,0],t],n)}function VY(e,t,n){return RA(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function WY(e,t,n){return RA(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var iF=16,PAt=Re(30*En);function oF(e,t){return+t?zAt(e,t):UAt(e)}function UAt(e){return PS({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function zAt(e,t){function n(r,i,o,s,a,l,c,u,f,h,p,g,y,v){var b=c-r,_=u-i,S=b*b+_*_;if(S>4*t&&y--){var x=s+h,T=a+p,k=l+g,M=Io(x*x+T*T+k*k),C=us(k/=M),R=In(In(k)-1)t||In((b*$+_*I)/S-.5)>.3||s*h+a*p+l*g2?F[2]%360*En:0,$()):[a*Ii,l*Ii,c*Ii]},N.angle=function(F){return arguments.length?(f=F%360*En,$()):f*Ii},N.reflectX=function(F){return arguments.length?(h=F?-1:1,$()):h<0},N.reflectY=function(F){return arguments.length?(p=F?-1:1,$()):p<0},N.precision=function(F){return arguments.length?(k=oF(M,T=F*F),I()):Io(T)},N.fitExtent=function(F,D){return NA(N,F,D)},N.fitSize=function(F,D){return jY(N,F,D)},N.fitWidth=function(F,D){return VY(N,F,D)},N.fitHeight=function(F,D){return WY(N,F,D)};function $(){var F=sF(n,0,0,h,p,f).apply(null,t(o,s)),D=sF(n,r-F[0],i-F[1],h,p,f);return u=MY(a,l,c),M=zM(t,D),C=zM(u,M),k=oF(M,T),I()}function I(){return R=O=null,N}return function(){return t=e.apply(this,arguments),N.invert=t.invert&&L,$()}}function IA(e){var t=0,n=sn/3,r=YY(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*En,n=o[1]*En):[t*Ii,n*Ii]},i}function WAt(e){var t=Re(e);function n(r,i){return[r*t,he(i)/t]}return n.invert=function(r,i){return[r/t,us(i*t)]},n}function YAt(e,t){var n=he(e),r=(n+he(t))/2;if(In(r)=.12&&v<.234&&y>=-.425&&y<-.214?i:v>=.166&&v<.234&&y>=-.214&&y<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=HAt([n.stream(t=h),i.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),s.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var p=n.scale(),g=+h[0],y=+h[1];return r=n.translate(h).clipExtent([[g-.455*p,y-.238*p],[g+.455*p,y+.238*p]]).stream(c),o=i.translate([g-.307*p,y+.201*p]).clipExtent([[g-.425*p+Ae,y+.12*p+Ae],[g-.214*p-Ae,y+.234*p-Ae]]).stream(c),a=s.translate([g-.205*p,y+.212*p]).clipExtent([[g-.214*p+Ae,y+.166*p+Ae],[g-.115*p-Ae,y+.234*p-Ae]]).stream(c),f()},u.fitExtent=function(h,p){return NA(u,h,p)},u.fitSize=function(h,p){return jY(u,h,p)},u.fitWidth=function(h,p){return VY(u,h,p)},u.fitHeight=function(h,p){return WY(u,h,p)};function f(){return e=t=null,u}return u.scale(1070)}function GY(e){return function(t,n){var r=Re(t),i=Re(n),o=e(r*i);return o===1/0?[2,0]:[o*i*he(t),o*he(n)]}}function t1(e){return function(t,n){var r=Io(t*t+n*n),i=e(r),o=he(i),s=Re(i);return[fl(t*o,r*s),us(r&&n*o/r)]}}var XY=GY(function(e){return Io(2/(1+e))});XY.invert=t1(function(e){return 2*us(e/2)});function XAt(){return sh(XY).scale(124.75).clipAngle(180-.001)}var JY=GY(function(e){return(e=SY(e))&&e/he(e)});JY.invert=t1(function(e){return e});function JAt(){return sh(JY).scale(79.4188).clipAngle(180-.001)}function US(e,t){return[e,kx(CA((Kr+t)/2))]}US.invert=function(e,t){return[e,2*bg(xY(t))-Kr]};function KAt(){return KY(US).scale(961/Bs)}function KY(e){var t=sh(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=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?s=a=l=c=null:(s=+f[0][0],a=+f[0][1],l=+f[1][0],c=+f[1][1]),u()):s==null?null:[[s,a],[l,c]]};function u(){var f=sn*r(),h=t(mAt(t.rotate()).invert([0,0]));return o(s==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===US?[[Math.max(h[0]-f,s),a],[Math.min(h[0]+f,l),c]]:[[s,Math.max(h[1]-f,a)],[l,Math.min(h[1]+f,c)]])}return u()}function Bb(e){return CA((Kr+e)/2)}function ZAt(e,t){var n=Re(e),r=e===t?he(e):kx(n/Re(t))/kx(Bb(t)/Bb(e)),i=n*dk(Bb(e),r)/r;if(!r)return US;function o(s,a){i>0?a<-Kr+Ae&&(a=-Kr+Ae):a>Kr-Ae&&(a=Kr-Ae);var l=i/dk(Bb(a),r);return[l*he(r*s),i-l*Re(r*s)]}return o.invert=function(s,a){var l=i-a,c=ba(r)*Io(s*s+l*l),u=fl(s,In(l))*ba(l);return l*r<0&&(u-=sn*ba(s)*ba(l)),[u/r,2*bg(dk(i/c,1/r))-Kr]},o}function QAt(){return IA(ZAt).scale(109.5).parallels([30,30])}function Vx(e,t){return[e,t]}Vx.invert=Vx;function tRt(){return sh(Vx).scale(152.63)}function eRt(e,t){var n=Re(e),r=e===t?he(e):(n-Re(t))/(t-e),i=n/r+e;if(In(r)2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function cRt(e,t){return e.parent===t.parent?1:2}function uRt(e){return e.reduce(fRt,0)/e.length}function fRt(e,t){return e+t.x}function hRt(e){return 1+e.reduce(dRt,0)}function dRt(e,t){return Math.max(e,t.y)}function pRt(e){for(var t;t=e.children;)e=t[0];return e}function gRt(e){for(var t;t=e.children;)e=t[t.length-1];return e}function rH(){var e=cRt,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(h){var p=h.children;p?(h.x=uRt(p),h.y=hRt(p)):(h.x=s?a+=e(h,s):0,h.y=0,s=h)});var l=pRt(o),c=gRt(o),u=l.x-e(l,c)/2,f=c.x+e(c,l)/2;return o.eachAfter(r?function(h){h.x=(h.x-o.x)*t,h.y=(o.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(o.y?h.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function mRt(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 yRt(){return this.eachAfter(mRt)}function vRt(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function bRt(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function _Rt(e,t){for(var n=this,r=[n],i=[],o,s,a,l=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s=0;)n+=r[i].value;t.value=n})}function SRt(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function ERt(e){for(var t=this,n=TRt(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 TRt(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 kRt(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function MRt(){return Array.from(this)}function CRt(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function ARt(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*RRt(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i=0;--a)i.push(o=s[a]=new $0(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(oH)}function NRt(){return iH(this).eachBefore(DRt)}function IRt(e){return e.children}function ORt(e){return Array.isArray(e)?e[1]:null}function DRt(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function oH(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function $0(e){this.data=e,this.depth=this.height=0,this.parent=null}$0.prototype=iH.prototype={constructor:$0,count:yRt,each:vRt,eachAfter:_Rt,eachBefore:bRt,find:wRt,sum:xRt,sort:SRt,path:ERt,ancestors:kRt,descendants:MRt,leaves:CRt,links:ARt,copy:NRt,[Symbol.iterator]:RRt};function vk(e){return e==null?null:LRt(e)}function LRt(e){if(typeof e!="function")throw new Error;return e}var FRt={depth:-1},aF={},bk={};function $Rt(e){return e.id}function BRt(e){return e.parentId}function sH(){var e=$Rt,t=BRt,n;function r(i){var o=Array.from(i),s=e,a=t,l,c,u,f,h,p,g,y,v=new Map;if(n!=null){const b=o.map((x,T)=>PRt(n(x,T,i))),_=b.map(lF),S=new Set(b).add("");for(const x of _)S.has(x)||(S.add(x),b.push(x),_.push(lF(x)),o.push(bk));s=(x,T)=>b[T],a=(x,T)=>_[T]}for(u=0,l=o.length;u=0&&(p=o[b],p.data===bk);--b)p.data=null}if(f.parent=FRt,f.eachBefore(function(b){b.depth=b.parent.depth+1,--l}).eachBefore(oH),f.parent=null,l>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=vk(i),r):e},r.parentId=function(i){return arguments.length?(t=vk(i),r):t},r.path=function(i){return arguments.length?(n=vk(i),r):n},r}function PRt(e){e=`${e}`;let t=e.length;return QM(e,t-1)&&!QM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function lF(e){let t=e.length;if(t<2)return"";for(;--t>1&&!QM(e,t););return e.slice(0,t)}function QM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function URt(e,t){return e.parent===t.parent?1:2}function _k(e){var t=e.children;return t?t[0]:e.t}function wk(e){var t=e.children;return t?t[t.length-1]:e.t}function zRt(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 qRt(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function jRt(e,t,n){return e.a.parent===t.parent?e.a:n}function F_(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}F_.prototype=Object.create($0.prototype);function VRt(e){for(var t=new F_(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new F_(o[s],s)),i.parent=n;return(t.parent=new F_(null,0)).children=[t],t}function Yx(){var e=URt,t=1,n=1,r=null;function i(c){var u=VRt(c);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)c.eachBefore(l);else{var f=c,h=c,p=c;c.eachBefore(function(_){_.xh.x&&(h=_),_.depth>p.depth&&(p=_)});var g=f===h?1:e(f,h)/2,y=g-f.x,v=t/(h.x+g+y),b=n/(p.depth||1);c.eachBefore(function(_){_.x=(_.x+y)*v,_.y=_.depth*b})}return c}function o(c){var u=c.children,f=c.parent.children,h=c.i?f[c.i-1]:null;if(u){qRt(c);var p=(u[0].z+u[u.length-1].z)/2;h?(c.z=h.z+e(c._,h._),c.m=c.z-p):c.z=p}else h&&(c.z=h.z+e(c._,h._));c.parent.A=a(c,h,c.parent.A||f[0])}function s(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function a(c,u,f){if(u){for(var h=c,p=c,g=u,y=h.parent.children[0],v=h.m,b=p.m,_=g.m,S=y.m,x;g=wk(g),h=_k(h),g&&h;)y=_k(y),p=wk(p),p.a=c,x=g.z+_-h.z-v+e(g._,h._),x>0&&(zRt(jRt(g,c,f),c,x),v+=x,b+=x),_+=g.m,v+=h.m,S+=y.m,b+=p.m;g&&!wk(p)&&(p.t=g,p.m+=_-b),h&&!_k(y)&&(y.t=h,y.m+=v-S,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 WRt=1664525,YRt=1013904223,cF=1/4294967296;function OA(e=Math.random()){let t=(0<=e&&e<1?e/cF:Math.abs(e))|0;return()=>(t=WRt*t+YRt|0,cF*(t>>>0))}function Ti(e){return function(){return e}}const aH=Math.cos,DA=Math.min,Hx=Math.sin,xi=Math.sqrt,uF=1e-12,Gx=Math.PI,zS=2*Gx;function lH(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 _Y(t)}function cH(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function uH(e){this._context=e}uH.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 e1(e){return new uH(e)}function fH(e){return e[0]}function hH(e){return e[1]}function dH(e,t){var n=Ti(!0),r=null,i=e1,o=null,s=lH(a);e=typeof e=="function"?e:e===void 0?fH:Ti(e),t=typeof t=="function"?t:t===void 0?hH:Ti(t);function a(l){var c,u=(l=cH(l)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),c=0;c<=u;++c)!(c=p;--g)a.point(S[g],x[g]);a.lineEnd(),a.areaEnd()}b&&(S[h]=+e(v,h,f),x[h]=+t(v,h,f),a.point(r?+r(v,h,f):S[h],n?+n(v,h,f):x[h]))}if(_)return a=null,_+""||null}function u(){return dH().defined(i).curve(s).context(o)}return c.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ti(+f),r=null,c):e},c.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ti(+f),c):e},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ti(+f),c):r},c.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ti(+f),n=null,c):t},c.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ti(+f),c):t},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ti(+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:Ti(!!f),c):i},c.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),c):s},c.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),c):o},c}class pH{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 HRt(e){return new pH(e,!0)}function GRt(e){return new pH(e,!1)}const XRt=xi(3),gH={draw(e,t){const n=xi(t+DA(t/28,.75))*.59436,r=n/2,i=r*XRt;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}},Ky={draw(e,t){const n=xi(t/Gx);e.moveTo(n,0),e.arc(0,0,n,0,zS)}},mH={draw(e,t){const n=xi(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()}},yH=xi(1/3),JRt=yH*2,vH={draw(e,t){const n=xi(t/JRt),r=n*yH;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},bH={draw(e,t){const n=xi(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}},_H={draw(e,t){const n=xi(t-DA(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}},wH={draw(e,t){const n=xi(t),r=-n/2;e.rect(r,r,n,n)}},xH={draw(e,t){const n=xi(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}},KRt=.8908130915292852,SH=Hx(Gx/10)/Hx(7*Gx/10),ZRt=Hx(zS/10)*SH,QRt=-aH(zS/10)*SH,EH={draw(e,t){const n=xi(t*KRt),r=ZRt*n,i=QRt*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){const s=zS*o/5,a=aH(s),l=Hx(s);e.lineTo(l*n,-a*n),e.lineTo(a*r-l*i,l*r+a*i)}e.closePath()}},xk=xi(3),TH={draw(e,t){const n=-xi(t/(xk*3));e.moveTo(0,n*2),e.lineTo(-xk*n,-n),e.lineTo(xk*n,-n),e.closePath()}},t8t=xi(3),kH={draw(e,t){const n=xi(t)*.6824,r=n/2,i=n*t8t/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}},Ks=-.5,Zs=xi(3)/2,t5=1/xi(12),e8t=(t5/2+1)*3,MH={draw(e,t){const n=xi(t/e8t),r=n/2,i=n*t5,o=r,s=n*t5+n,a=-o,l=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,l),e.lineTo(Ks*r-Zs*i,Zs*r+Ks*i),e.lineTo(Ks*o-Zs*s,Zs*o+Ks*s),e.lineTo(Ks*a-Zs*l,Zs*a+Ks*l),e.lineTo(Ks*r+Zs*i,Ks*i-Zs*r),e.lineTo(Ks*o+Zs*s,Ks*s-Zs*o),e.lineTo(Ks*a+Zs*l,Ks*l-Zs*a),e.closePath()}},CH={draw(e,t){const n=xi(t-DA(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}},n8t=[Ky,mH,vH,wH,EH,TH,MH],r8t=[Ky,_H,CH,kH,gH,xH,bH];function Wf(){}function Xx(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 qS(e){this._context=e}qS.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:Xx(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:Xx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function i8t(e){return new qS(e)}function AH(e){this._context=e}AH.prototype={areaStart:Wf,areaEnd:Wf,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:Xx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function o8t(e){return new AH(e)}function RH(e){this._context=e}RH.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:Xx(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function s8t(e){return new RH(e)}function NH(e,t){this._basis=new qS(e),this._beta=t}NH.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],o=e[n]-r,s=t[n]-i,a=-1,l;++a<=n;)l=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+l*o),this._beta*t[a]+(1-this._beta)*(i+l*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const a8t=function e(t){function n(r){return t===1?new qS(r):new NH(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Jx(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 FA(e,t){this._context=e,this._k=(1-t)/6}FA.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:Jx(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:Jx(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 l8t=function e(t){function n(r){return new FA(r,t)}return n.tension=function(r){return e(+r)},n}(0);function $A(e,t){this._context=e,this._k=(1-t)/6}$A.prototype={areaStart:Wf,areaEnd:Wf,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:Jx(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 c8t=function e(t){function n(r){return new $A(r,t)}return n.tension=function(r){return e(+r)},n}(0);function BA(e,t){this._context=e,this._k=(1-t)/6}BA.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:Jx(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 u8t=function e(t){function n(r){return new BA(r,t)}return n.tension=function(r){return e(+r)},n}(0);function PA(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>uF){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>uF){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);o=(o*c+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function IH(e,t){this._context=e,this._alpha=t}IH.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:PA(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 f8t=function e(t){function n(r){return t?new IH(r,t):new FA(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function OH(e,t){this._context=e,this._alpha=t}OH.prototype={areaStart:Wf,areaEnd:Wf,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:PA(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 h8t=function e(t){function n(r){return t?new OH(r,t):new $A(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function DH(e,t){this._context=e,this._alpha=t}DH.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:PA(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 d8t=function e(t){function n(r){return t?new DH(r,t):new BA(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function LH(e){this._context=e}LH.prototype={areaStart:Wf,areaEnd:Wf,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 p8t(e){return new LH(e)}function fF(e){return e<0?-1:1}function hF(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(fF(o)+fF(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function dF(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Sk(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function Kx(e){this._context=e}Kx.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:Sk(this,this._t0,dF(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,Sk(this,dF(this,n=hF(this,e,t)),n);break;default:Sk(this,this._t0,n=hF(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function FH(e){this._context=new $H(e)}(FH.prototype=Object.create(Kx.prototype)).point=function(e,t){Kx.prototype.point.call(this,t,e)};function $H(e){this._context=e}$H.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,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function g8t(e){return new Kx(e)}function m8t(e){return new FH(e)}function BH(e){this._context=e}BH.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=pF(e),i=pF(t),o=0,s=1;s=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[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 v8t(e){return new jS(e,.5)}function b8t(e){return new jS(e,0)}function _8t(e){return new jS(e,1)}const Pb=e=>()=>e;function w8t(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 jl(e,t,n){this.k=e,this.x=t,this.y=n}jl.prototype={constructor:jl,scale:function(e){return e===1?this:new jl(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jl(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 PH=new jl(1,0,0);jl.prototype;function Ek(e){e.stopImmediatePropagation()}function cm(e){e.preventDefault(),e.stopImmediatePropagation()}function x8t(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function S8t(){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 gF(){return this.__zoom||PH}function E8t(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function T8t(){return navigator.maxTouchPoints||"ontouchstart"in this}function k8t(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function M8t(){var e=x8t,t=S8t,n=k8t,r=E8t,i=T8t,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=awt,c=DS("start","zoom","end"),u,f,h,p=500,g=150,y=0,v=10;function b(I){I.property("__zoom",gF).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",O).filter(i).on("touchstart.zoom",N).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(I,F,D,P){var z=I.selection?I.selection():I;z.property("__zoom",gF),I!==z?T(I,F,D,P):z.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},b.scaleBy=function(I,F,D,P){b.scaleTo(I,function(){var z=this.__zoom.k,q=typeof F=="function"?F.apply(this,arguments):F;return z*q},D,P)},b.scaleTo=function(I,F,D,P){b.transform(I,function(){var z=t.apply(this,arguments),q=this.__zoom,U=D==null?x(z):typeof D=="function"?D.apply(this,arguments):D,V=q.invert(U),G=typeof F=="function"?F.apply(this,arguments):F;return n(S(_(q,G),U,V),z,s)},D,P)},b.translateBy=function(I,F,D,P){b.transform(I,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,P)},b.translateTo=function(I,F,D,P,z){b.transform(I,function(){var q=t.apply(this,arguments),U=this.__zoom,V=P==null?x(q):typeof P=="function"?P.apply(this,arguments):P;return n(PH.translate(V[0],V[1]).scale(U.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof D=="function"?-D.apply(this,arguments):-D),q,s)},P,z)};function _(I,F){return F=Math.max(o[0],Math.min(o[1],F)),F===I.k?I:new jl(F,I.x,I.y)}function S(I,F,D){var P=F[0]-D[0]*I.k,z=F[1]-D[1]*I.k;return P===I.x&&z===I.y?I:new jl(I.k,P,z)}function x(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function T(I,F,D,P){I.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var z=this,q=arguments,U=k(z,q).event(P),V=t.apply(z,q),G=D==null?x(V):typeof D=="function"?D.apply(z,q):D,Z=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),lt=z.__zoom,pt=typeof F=="function"?F.apply(z,q):F,dt=l(lt.invert(G).concat(Z/lt.k),pt.invert(G).concat(Z/pt.k));return function(at){if(at===1)at=pt;else{var yt=dt(at),nt=Z/yt[2];at=new jl(nt,G[0]-yt[0]*nt,G[1]-yt[1]*nt)}U.zoom(null,at)}})}function k(I,F,D){return!D&&I.__zooming||new M(I,F)}function M(I,F){this.that=I,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,F),this.taps=0}M.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,F){return this.mouse&&I!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var F=Er(this.that).datum();c.call(I,this.that,new w8t(I,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),F)}};function C(I,...F){if(!e.apply(this,arguments))return;var D=k(this,F).event(I),P=this.__zoom,z=Math.max(o[0],Math.min(o[1],P.k*Math.pow(2,r.apply(this,arguments)))),q=za(I);if(D.wheel)(D.mouse[0][0]!==q[0]||D.mouse[0][1]!==q[1])&&(D.mouse[1]=P.invert(D.mouse[0]=q)),clearTimeout(D.wheel);else{if(P.k===z)return;D.mouse=[q,P.invert(q)],f0(this),D.start()}cm(I),D.wheel=setTimeout(U,g),D.zoom("mouse",n(S(_(P,z),D.mouse[0],D.mouse[1]),D.extent,s));function U(){D.wheel=null,D.end()}}function R(I,...F){if(h||!e.apply(this,arguments))return;var D=I.currentTarget,P=k(this,F,!0).event(I),z=Er(I.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Z,!0),q=za(I,D),U=I.clientX,V=I.clientY;uY(I.view),Ek(I),P.mouse=[q,this.__zoom.invert(q)],f0(this),P.start();function G(lt){if(cm(lt),!P.moved){var pt=lt.clientX-U,dt=lt.clientY-V;P.moved=pt*pt+dt*dt>y}P.event(lt).zoom("mouse",n(S(P.that.__zoom,P.mouse[0]=za(lt,D),P.mouse[1]),P.extent,s))}function Z(lt){z.on("mousemove.zoom mouseup.zoom",null),fY(lt.view,P.moved),cm(lt),P.event(lt).end()}}function O(I,...F){if(e.apply(this,arguments)){var D=this.__zoom,P=za(I.changedTouches?I.changedTouches[0]:I,this),z=D.invert(P),q=D.k*(I.shiftKey?.5:2),U=n(S(_(D,q),P,z),t.apply(this,F),s);cm(I),a>0?Er(this).transition().duration(a).call(T,U,P,I):Er(this).call(b.transform,U,P,I)}}function N(I,...F){if(e.apply(this,arguments)){var D=I.touches,P=D.length,z=k(this,F,I.changedTouches.length===P).event(I),q,U,V,G;for(Ek(I),U=0;U0&&isFinite(e)?e:NaN}function VS(e){return e<0&&isFinite(e)?e:NaN}function C8t(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return t;const n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${A8t(e.getUTCFullYear())}-${Wc(e.getUTCMonth()+1,2)}-${Wc(e.getUTCDate(),2)}${n||r||i||o?`T${Wc(n,2)}:${Wc(r,2)}${i||o?`:${Wc(i,2)}${o?`.${Wc(o,3)}`:""}`:""}Z`:""}`}function A8t(e){return e<0?`-${Wc(-e,6)}`:e>9999?`+${Wc(e,6)}`:Wc(e,4)}function Wc(e,t){return`${e}`.padStart(t,"0")}const R8t=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function UH(e,t){return R8t.test(e+="")?new Date(e):t}function B0(e){if(e==null)return;const t=e[0],n=e[e.length-1];return md(t,n)}const Wp=1e3,Sf=Wp*60,Ef=Sf*60,fc=Ef*24,Cl=fc*7,ed=fc*30,nf=fc*365,Tk=[["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",Wp],["5 seconds",5*Wp],["15 seconds",15*Wp],["30 seconds",30*Wp],["minute",Sf],["5 minutes",5*Sf],["15 minutes",15*Sf],["30 minutes",30*Sf],["hour",Ef],["3 hours",3*Ef],["6 hours",6*Ef],["12 hours",12*Ef],["day",fc],["2 days",2*fc],["week",Cl],["2 weeks",2*Cl],["month",ed],["3 months",3*ed],["6 months",6*ed],["year",nf],["2 years",2*nf],["5 years",5*nf],["10 years",10*nf],["20 years",20*nf],["50 years",50*nf],["100 years",100*nf]],zA=new Map([["second",Wp],["minute",Sf],["hour",Ef],["day",fc],["monday",Cl],["tuesday",Cl],["wednesday",Cl],["thursday",Cl],["friday",Cl],["saturday",Cl],["sunday",Cl],["week",Cl],["month",ed],["year",nf]]),zH=new Map([["second",Wa],["minute",Rv],["hour",Iv],["day",Dd],["monday",Dy],["tuesday",Oq],["wednesday",Dq],["thursday",_d],["friday",Lq],["saturday",Fq],["sunday",C0],["week",C0],["month",Dv],["year",rl]]),qA=new Map([["second",Wa],["minute",Nv],["hour",Ov],["day",dS],["monday",Ly],["tuesday",$q],["wednesday",Bq],["thursday",wd],["friday",Pq],["saturday",Uq],["sunday",A0],["week",A0],["month",Lv],["year",il]]),n1=Symbol("intervalDuration"),WS=Symbol("intervalType");for(const[e,t]of zH)t[n1]=zA.get(e),t[WS]="time";for(const[e,t]of qA)t[n1]=zA.get(e),t[WS]="utc";const zm=[["year",il,"utc"],["month",Lv,"utc"],["day",dS,"utc",6*ed],["hour",Ov,"utc",3*fc],["minute",Nv,"utc",6*Ef],["second",Wa,"utc",30*Sf]],$_=[["year",rl,"time"],["month",Dv,"time"],["day",Dd,"time",6*ed],["hour",Iv,"time",3*fc],["minute",Rv,"time",6*Ef],["second",Wa,"time",30*Sf]],N8t=[zm[0],$_[0],zm[1],$_[1],zm[2],$_[2],...zm.slice(3)];function jA(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=qA.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 VA(e){return qH(jA(e),"time")}function YS(e){return qH(jA(e),"utc")}function qH([e,t],n){let r=(n==="time"?zH:qA).get(e);return t>1&&(r=r.every(t),r[n1]=zA.get(e)*t,r[WS]=n),r}function mF(e,t){if(!(t>1))return;const n=e[n1];if(!Tk.some(([,i])=>i===n)||n%fc===0&&fcMath.log(i)).center(Tk,Math.log(n*t))];return(e[WS]==="time"?VA:YS)(r)}function yF(e,t,n){const r=t==="time"?CC:Fv;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=I8t(n);switch(e){case"millisecond":return Sp(r(".%L"),r(":%M:%S"),i);case"second":return Sp(r(":%S"),r("%-I:%M"),i);case"minute":return Sp(r("%-I:%M"),r("%p"),i);case"hour":return Sp(r("%-I %p"),r("%b %-d"),i);case"day":return Sp(r("%-d"),r("%b"),i);case"month":return Sp(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function I8t(e){return e==="left"||e==="right"?(t,n)=>` +${t} +${n}`:e==="top"?(t,n)=>`${n} +${t}`:(t,n)=>`${t} +${n}`}function O8t(e){return e==="time"?$_:e==="utc"?zm:N8t}function D8t(e,t,n){const r=Vr(E_t(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return yF("millisecond","utc",n);for(const[i,o,s,a]of O8t(e)){if(r>a||i==="hour"&&!r)break;if(t.every(l=>o.floor(l)>=l))return yF(i,s,n)}}function Sp(e,t,n){return(r,i,o)=>{const s=e(r,i),a=t(r,i),l=i-B0(o);return i!==l&&o[l]!==void 0&&a===t(o[l],l)?s:n(s,a)}}const HS=Object.getPrototypeOf(Uint8Array),L8t=Object.prototype.toString;function Lu(e){return e instanceof Array||e instanceof HS}function jH(e){return e instanceof HS&&!F8t(e)}function VH(e){return e?.prototype instanceof HS&&!$8t(e)}function F8t(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function $8t(e){return e===BigInt64Array||e===BigUint64Array}const WH=Symbol("reindex");function fn(e,t,n){const r=typeof t;return r==="string"?oG(e)?WA(e.getChild(t),n):vF(e,YH(t),n):r==="function"?vF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?gr(e,Li(t),n):typeof t?.transform=="function"?e5(t.transform(e),n):B8t(e5(t,n),e?.[WH])}function B8t(e,t){return e!=null&&t?XS(e,t):e}function vF(e,t,n){return gr(e,VH(n)?(r,i)=>GA(t(r,i)):t,n)}function e5(e,t){return t===void 0?ah(e):sG(e)?WA(e,t):e instanceof t?e:t.from(e,VH(t)&&!jH(e)?GA:void 0)}function WA(e,t){return e==null?e:(t===void 0||t===Array)&&Z8t(e.type)?HH(bF(e)):e5(bF(e),t)}function bF(e){return e.nullCount?e.toJSON():e.toArray()}const ry=[null],YH=e=>t=>{const n=t[e];return n===void 0&&t.type==="Feature"?t.properties?.[e]:n},gi={transform:Fu},de={transform:e=>e},YA=()=>1,P8t=()=>!0,Di=e=>e==null?e:`${e}`,kr=e=>e==null?e:+e,GS=e=>e?e[0]:void 0,Zy=e=>e?e[1]:void 0,U8t=e=>e?e[2]:void 0,Li=e=>()=>e;function HA(e){const t=+`${e}`.slice(1)/100;return(n,r)=>Pf(n,t,r)}function ts(e){return jH(e)?e:gr(e,GA,Float64Array)}function GA(e){return e==null?NaN:Number(e)}function HH(e){return gr(e,GH)}function GH(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?UH(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Oo(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:r1(e)?[void 0,e]:[e,void 0]}function ri(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function XH(e,t,n){if(e!=null)return Us(e,t,n)}function Us(e,t,n){const r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function P0(e){return oG(e)?e:ah(e)}function ah(e){if(e==null||Lu(e))return e;if(sG(e))return WA(e);if(JH(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function JH(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 gr(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Qy(e,t=Array){return e instanceof t?e.slice():t.from(e)}function KH({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function ZH({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function _g(e){return KH(e)||ZH(e)||e.interval!==void 0}function zs(e){return e?.toString===L8t}function nd(e){return zs(e)&&(e.type!==void 0||e.domain!==void 0)}function Rl(e){return zs(e)&&typeof e.transform!="function"}function Yf(e){return Rl(e)&&e.value===void 0&&e.channel===void 0}function QH(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 yl(e,t){return e===void 0&&t===void 0?[GS,Zy]:[e,t]}function lh({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Oo(t)),e===void 0&&([e]=Oo(n)),e}function tv(e){return Lu(e)?e.length:e?.numRows}function Fu(e){const t=tv(e),n=new Uint32Array(t);for(let r=0;re[n],e.constructor):gr(t,n=>e.at(n))}function XA(e){return e.length===1?(t,n)=>e(XS(n,t)):e}function rd(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function ru(e){return e!==null&&typeof e=="object"?e.valueOf():e}function tG(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 Rs(e){let t;return[{transform:()=>t,label:bc(e)},n=>t=n]}function Go(e){return e==null?[e]:Rs(e)}function bc(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function t2(e,t){return{transform(n){const r=e.transform(n),i=t.transform(n);return Do(r)||Do(i)?gr(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):gr(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function e2(e,t){const n=eG(t?.interval,t?.type);return n?gr(e,n):e}function eG(e,t){const n=JS(e,t);return n&&(r=>Bi(r)?n.floor(r):r)}function JS(e,t){if(e!=null){if(typeof e=="number")return nG(e);if(typeof e=="string")return(t==="time"?VA:YS)(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 nG(e){e=+e,0Math.floor(n*t)/t,offset:(n,r=1)=>(n*t+Math.floor(r))/t,range:(n,r)=>Cs(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)=>Cs(Math.ceil(n/t),r/t).map(i=>i*t)}}function wg(e,t){if(e=JS(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function z8t(e,t){if(e=wg(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function q8t(e){return Yp(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Yp(e){return typeof e?.range=="function"}function xg(e){return e===void 0||Rl(e)?e:{value:e}}function j8t(e){return e==null?null:{transform:t=>fn(t,e,Float64Array),label:bc(e)}}function V8t(e){if(!$u(e))return!1;for(const t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function $u(e){return e&&typeof e[Symbol.iterator]=="function"}function rG(e){for(const t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Gr(e){for(const t of e){if(t==null)continue;const n=typeof t;return n==="string"||n==="boolean"}}function Do(e){for(const t of e)if(t!=null)return t instanceof Date}function W8t(e){for(const t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&UH(t)}function Y8t(e){for(const t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Hp(e){for(const t of e)if(t!=null)return typeof t=="number"}function kk(e,t){let n;for(const r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}const H8t=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 r1(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)||H8t.has(e))}function G8t(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Or(e){return e==null||U0(e)}function U0(e){return/^\s*none\s*$/i.test(e)}function X8t(e){return/^\s*round\s*$/i.test(e)}function n5(e,t){return XH(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function i1(e="middle"){return n5(e,"frameAnchor")}function J8t(e={},...t){let n=e;for(const r of t)for(const i in r)if(n[i]===void 0){const o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function K8t(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 JA(e){return $u(e)?K8t(e):e}function iG(e){return e===!0?e="frame":e===!1?e=null:!JH(e)&&e!=null&&(e=Us(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function oG(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function sG(e){return e&&typeof e.toArray=="function"&&e.type}function Z8t(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}const Vl=Symbol("position"),Bu=Symbol("color"),o1=Symbol("radius"),s1=Symbol("length"),a1=Symbol("opacity"),KS=Symbol("symbol"),aG=Symbol("projection"),qr=new Map([["x",Vl],["y",Vl],["fx",Vl],["fy",Vl],["r",o1],["color",Bu],["opacity",a1],["symbol",KS],["length",s1],["projection",aG]]);function Q8t(e){return e===Vl||e===aG}function tNt(e){return e===Vl||e===o1||e===s1||e===a1}const lG=Math.sqrt(3),cG=2/lG,eNt={draw(e,t){const n=Math.sqrt(t/Math.PI),r=n*cG,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()}},KA=new Map([["asterisk",gH],["circle",Ky],["cross",mH],["diamond",vH],["diamond2",bH],["hexagon",eNt],["plus",_H],["square",wH],["square2",xH],["star",EH],["times",CH],["triangle",TH],["triangle2",kH],["wye",MH]]);function ZA(e){return e&&typeof e.draw=="function"}function nNt(e){return ZA(e)?!0:typeof e!="string"?!1:KA.has(e.toLowerCase())}function QA(e){if(e==null||ZA(e))return e;const t=KA.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function rNt(e){if(e==null||ZA(e))return[void 0,e];if(typeof e=="string"){const t=KA.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function vl({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=tR(e)),t!=null&&!Yf(t)&&(r=Mk(r,nR(t))),n&&(r=Mk(r,eR))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Yf(t))&&{sort:t},transform:Mk(r,s)}}function no({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=tR(e)),t!=null&&!Yf(t)&&(r=Ck(r,nR(t))),n&&(r=Ck(r,eR))),{...i,...(t===null||Yf(t))&&{sort:t},initializer:Ck(r,o)}}function Mk(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,P0(n),r,i)}}function Ck(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,l,c,u,f;return{data:a=n,facets:l=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=l,channels:c}=t.call(this,a,l,{...i,...s},...o),{data:u,facets:f,channels:{...s,...c}}}}function ZS(e,t){return(e.initializer!=null?no:vl)(e,t)}function iNt(e,t){return ZS(t,tR(e))}function tR(e){return(t,n)=>{const r=fn(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function oNt({sort:e,...t}={}){return{...ZS(t,eR),sort:Yf(e)?e:null}}function eR(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function sNt({seed:e,sort:t,...n}={}){return{...ZS(n,fG(e==null?Math.random:OA(e))),sort:Yf(t)?t:null}}function uG(e,{sort:t,...n}={}){return{...(Rl(e)&&e.channel!==void 0?no:ZS)(n,nR(e)),sort:Yf(t)?t:null}}function nR(e){return(typeof e=="function"&&e.length!==1?aNt:fG)(e)}function aNt(e){return(t,n)=>{const r=Lu(t)?(i,o)=>e(t[i],t[o]):(i,o)=>e(t.get(i),t.get(o));return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function fG(e){let t,n;({channel:t,value:e,order:n}={...xg(e)});const r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?Zx:Ra),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=Ra;break;case"descending":n=Zx;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=fn(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}const l=(c,u)=>n(a[c],a[u]);return{data:i,facets:o.map(c=>c.slice().sort(l))}}}function rR(e,t){return QS(null,null,e,t)}function ev(e={y:"count"},t={}){const{x:n=de}=t;if(n==null)throw new Error("missing channel: x");return QS(n,null,e,t)}function nv(e={x:"count"},t={}){const{y:n=de}=t;if(n==null)throw new Error("missing channel: y");return QS(null,n,e,t)}function iR(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=yl(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return QS(n,r,e,t)}function QS(e,t,{data:n=lR,filter:r,sort:i,reverse:o,...s}={},a={}){s=dG(s,a),n=mG(n,de),i=i==null?void 0:pG("sort",i,a),r=r==null?void 0:gG("filter",r,a);const[l,c]=Go(e),[u,f]=Go(t),{z:h,fill:p,stroke:g,x1:y,x2:v,y1:b,y2:_,...S}=a,[x,T]=Go(h),[k]=Oo(p),[M]=Oo(g),[C,R]=Go(k),[O,N]=Go(M);return{..."z"in a&&{z:x||h},..."fill"in a&&{fill:C||p},..."stroke"in a&&{stroke:O||g},...vl(S,(L,$,I)=>{const F=e2(fn(L,e),I?.x),D=e2(fn(L,t),I?.y),P=fn(L,h),z=fn(L,k),q=fn(L,M),U=aR(s,{z:P,fill:z,stroke:q}),V=[],G=[],Z=F&&c([]),lt=D&&f([]),pt=P&&T([]),dt=z&&R([]),at=q&&N([]);let yt=0;for(const nt of s)nt.initialize(L);i&&i.initialize(L),r&&r.initialize(L);for(const nt of $){const gt=[];for(const vt of s)vt.scope("facet",nt);i&&i.scope("facet",nt),r&&r.scope("facet",nt);for(const[vt,st]of id(nt,U))for(const[Bt,Dt]of id(st,D))for(const[zt,jt]of id(Dt,F)){const Ct={data:L};if(F&&(Ct.x=zt),D&&(Ct.y=Bt),U&&(Ct.z=vt),!(r&&!r.reduce(jt,Ct))){gt.push(yt++),G.push(n.reduceIndex(jt,L,Ct)),F&&Z.push(zt),D&<.push(Bt),P&&pt.push(U===P?vt:P[jt[0]]),z&&dt.push(U===z?vt:z[jt[0]]),q&&at.push(U===q?vt:q[jt[0]]);for(const Xt of s)Xt.reduce(jt,Ct);i&&i.reduce(jt,Ct)}}V.push(gt)}return yG(V,i,o),{data:G,facets:V}}),...!Tf(s,"x")&&(l?{x:l}:{x1:y,x2:v}),...!Tf(s,"y")&&(u?{y:u}:{y1:b,y2:_}),...Object.fromEntries(s.map(({name:L,output:$})=>[L,$]))}}function Tf(e,...t){for(const{name:n}of e)if(t.includes(n))return!0;return!1}function hG(e,t,n=oR){const r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",dNt]),t.href!=null&&e.href===void 0&&r.push(["href",cR]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?lNt(i):n(i,o,t))}function oR(e,t,n,r=sR){let i;zs(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);const o=r(e,t,n),[s,a]=Rs(o.label);let l;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(c){o.initialize(c),l=a([])},scope(c,u){o.scope(c,u)},reduce(c,u){l.push(o.reduce(c,u))}}}function lNt(e){return{name:e,initialize(){},scope(){},reduce(){}}}function sR(e,t,n,r=t3){const i=tG(e,n),o=r(t,i);let s,a;return{label:bc(o===n2?null:i,o.label),initialize(l){s=i===void 0?l:fn(l,i),o.scope==="data"&&(a=o.reduceIndex(Fu(l),s))},scope(l,c){o.scope===l&&(a=o.reduceIndex(c,s))},reduce(l,c){return o.scope==null?o.reduceIndex(l,s,c):o.reduceIndex(l,s,a,c)}}}function id(e,t){return t?eh(e,n=>t[n]):[[,e]]}function t3(e,t,n=cNt){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&zs(e))return fNt(e);if(typeof e=="function")return hNt(e);if(/^p\d{2}$/i.test(e))return Uc(HA(e));switch(`${e}`.toLowerCase()){case"first":return cR;case"last":return pNt;case"identity":return lR;case"count":return n2;case"distinct":return gNt;case"sum":return t==null?n2:mNt;case"proportion":return wF(t,"data");case"proportion-facet":return wF(t,"facet");case"deviation":return Uc(Tv);case"min":return Uc(Dr);case"min-index":return Uc(__t);case"max":return Uc(Vr);case"max-index":return Uc(b_t);case"mean":return _F(sS);case"median":return _F(Ny);case"variance":return Uc(dC);case"mode":return Uc(oq)}return n(e)}function cNt(e){throw new Error(`invalid reduce: ${e}`)}function dG(e,t){return hG(e,t,pG)}function pG(e,t,n){return oR(e,t,n,gG)}function gG(e,t,n){return sR(e,t,n,mG)}function mG(e,t){return t3(e,t,uNt)}function uNt(e){switch(`${e}`.toLowerCase()){case"x":return yNt;case"y":return vNt;case"z":return vG}throw new Error(`invalid group reduce: ${e}`)}function aR(e,t){for(const n in t){const r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function yG(e,t,n){if(t){const r=t.output.transform(),i=(o,s)=>Ra(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function fNt(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function hNt(e){return{reduceIndex(t,n,r){return e(XS(n,t),r)}}}function Uc(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function _F(e){return{reduceIndex(t,n){const r=e(t,i=>n[i]);return Do(n)?new Date(r):r}}}const lR={reduceIndex(e,t){return XS(t,e)}},cR={reduceIndex(e,t){return t[e[0]]}},dNt={reduceIndex(e,t){const r=qw(r0(e,o=>o.length,o=>t[o]),Zy),i=r.slice(-5).reverse();if(i.length`${o} (${s.toLocaleString("en-US")})`).join(` +`)}},pNt={reduceIndex(e,t){return t[e[e.length-1]]}},n2={label:"Frequency",reduceIndex(e){return e.length}},gNt={label:"Distinct",reduceIndex(e,t){const n=new lg;for(const r of e)n.add(t[r]);return n.size}},mNt=Uc(el);function wF(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>el(n,o=>r[o])/i}}const yNt={reduceIndex(e,t,{x:n}){return n}},vNt={reduceIndex(e,t,{y:n}){return n}},vG={reduceIndex(e,t,{z:n}){return n}};function bNt(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(Lu(r)?i=>e(r[i],i,r):i=>e(r.get(i),i,r))]}}}function rv(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=bc(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),_G(a,{scale:t,type:n,value:fn(e,r),label:s,filter:i,hint:o})}function bG(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,rv(t,r,n)]))}function e3(e,t){const n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{const s=i==null?null:t[i];return[r,s==null?o:gr(o,s)]}));return n.channels=e,n}function _G(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&&kk(r,r1)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&kk(r,G8t)?null:"opacity",t.defaultScale="opacity";break;case"symbol":n!==!0&&kk(r,nNt)?(t.scale=null,t.value=gr(r,QA)):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 _Nt(e,t,n,r,i){const{order:o,reverse:s,reduce:a=!0,limit:l}=i;for(const c in i){if(!qr.has(c))continue;let{value:u,order:f=o,reverse:h=s,reduce:p=a,limit:g=l}=xg(i[c]);const y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?xG:wG:SNt(f),p==null||p===!1)continue;const v=c==="fx"||c==="fy"?xNt(t,r[c]):wNt(n,c);if(!v)throw new Error(`missing channel for scale: ${c}`);const b=v.value,[_=0,S=1/0]=$u(g)?g:g<0?[g]:[0,g];if(u==null)v.domain=()=>{let x=Array.from(new lg(b));return h&&(x=x.reverse()),(_!==0||S!==1/0)&&(x=x.slice(_,S)),x};else{const x=u==="data"?e:u==="height"?xF(n,"y1","y2"):u==="width"?xF(n,"x1","x2"):r5(n,u,u==="y"?"y2":u==="x"?"x2":void 0),T=t3(p===!0?"max":p,x);v.domain=()=>{let k=p_t(Fu(b),M=>T.reduceIndex(M,x),M=>b[M]);return f&&k.sort(f),h&&k.reverse(),(_!==0||S!==1/0)&&(k=k.slice(_,S)),k.map(GS)}}}}function wNt(e,t){for(const n in e){const r=e[n];if(r.scale===t)return r}}function xNt(e,t){const n=e.original;if(n===e)return t;const r=t.value,i=t.value=[];for(let o=0;oMath.abs(o-r[s]),Float64Array)}function r5(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 SNt(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return wG;case"descending":return xG}throw new Error(`invalid order: ${e}`)}function wG([e,t],[n,r]){return Ra(t,r)||Ra(e,n)}function xG([e,t],[n,r]){return Zx(t,r)||Ra(e,n)}function i5(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}const SG=new Map([["accent",Lxt],["category10",Dxt],["dark2",Fxt],["observable10",$xt],["paired",Bxt],["pastel1",Pxt],["pastel2",Uxt],["set1",zxt],["set2",qxt],["set3",jxt],["tableau10",Vxt]]);function ENt(e){return e!=null&&SG.has(`${e}`.toLowerCase())}const SF=new Map([...SG,["brbg",Lc(Zq,Qq)],["prgn",Lc(tj,ej)],["piyg",Lc(nj,rj)],["puor",Lc(ij,oj)],["rdbu",Lc(J4,Xw)],["rdgy",Lc(sj,aj)],["rdylbu",Lc(K4,Jw)],["rdylgn",Lc(lj,cj)],["spectral",Lc(uj,fj)],["burd",EF(J4,Xw)],["buylrd",EF(K4,Jw)],["blues",Ei(Dj,Lj)],["greens",Ei(Fj,$j)],["greys",Ei(Bj,Pj)],["oranges",Ei(Vj,Wj)],["purples",Ei(Uj,zj)],["reds",Ei(qj,jj)],["turbo",Fc(IC)],["viridis",Fc(Zj)],["magma",Fc(Qj)],["inferno",Fc(yS)],["plasma",Fc(tV)],["cividis",Fc(Yj)],["cubehelix",Fc(Hj)],["warm",Fc(Gj)],["cool",Fc(Xj)],["bugn",Ei(hj,dj)],["bupu",Ei(pj,gj)],["gnbu",Ei(mj,yj)],["orrd",Ei(vj,bj)],["pubu",Ei(wj,xj)],["pubugn",Ei(_j,RC)],["purd",Ei(Sj,Ej)],["rdpu",Ei(Tj,kj)],["ylgn",Ei(Cj,Aj)],["ylgnbu",Ei(Mj,NC)],["ylorbr",Ei(Rj,Nj)],["ylorrd",Ei(Ij,Oj)],["rainbow",TF(Jj)],["sinebow",TF(Kj)]]);function Ei(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?nl(t,n):e[n])}function Lc(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?nl(t,n):e[n])}function EF(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?nl(r=>t(1-r),n):e[n].slice().reverse())}function Fc(e){return({length:t})=>nl(e,Math.max(2,Math.floor(t)))}function TF(e){return({length:t})=>nl(e,Math.floor(t)+1).slice(0,-1)}function EG(e){const t=`${e}`.toLowerCase();if(!SF.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return SF.get(t)}function n3(e,t){const n=EG(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function TNt(e,t="greys"){const n=new Set,[r,i]=n3(t,2);for(const o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}const kF=new Map([["brbg",Qq],["prgn",ej],["piyg",rj],["puor",oj],["rdbu",Xw],["rdgy",aj],["rdylbu",Jw],["rdylgn",cj],["spectral",fj],["burd",e=>Xw(1-e)],["buylrd",e=>Jw(1-e)],["blues",Lj],["greens",$j],["greys",Pj],["purples",zj],["reds",jj],["oranges",Wj],["turbo",IC],["viridis",Zj],["magma",Qj],["inferno",yS],["plasma",tV],["cividis",Yj],["cubehelix",Hj],["warm",Gj],["cool",Xj],["bugn",dj],["bupu",gj],["gnbu",yj],["orrd",bj],["pubugn",RC],["pubu",xj],["purd",Ej],["rdpu",kj],["ylgnbu",NC],["ylgn",Aj],["ylorbr",Nj],["ylorrd",Oj],["rainbow",Jj],["sinebow",Kj]]);function uR(e){const t=`${e}`.toLowerCase();if(!kF.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return kF.get(t)}const kNt=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function MNt(e){return e!=null&&kNt.has(`${e}`.toLowerCase())}const TG=e=>t=>e(1-t),Ak=[0,1],MF=new Map([["number",Hi],["rgb",bd],["hsl",cwt],["hcl",hwt],["lab",uwt]]);function kG(e){const t=`${e}`.toLowerCase();if(!MF.has(t))throw new Error(`unknown interpolator: ${t}`);return MF.get(t)}function l1(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=CG(e,n),unknown:l,round:c,scheme:u,interval:f,range:h=qr.get(e)===o1?BNt(n,a):qr.get(e)===s1?PNt(n,a):qr.get(e)===a1?Ak:void 0,interpolate:p=qr.get(e)===Bu?u==null&&h!==void 0?bd:uR(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):c?EC:Hi,reverse:g}){if(a=CF(a),f=wg(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof p!="function"&&(p=kG(p)),g=!!g,h!==void 0){const y=a.length,v=(h=CF(h)).length;if(y!==v){if(p.length===1)throw new Error("invalid piecewise interpolator");p=uS(p,h),h=void 0}}if(p.length===1?(g&&(p=TG(p),g=!1),h===void 0&&(h=Float64Array.from(a,(y,v)=>v/(a.length-1)),h.length===2&&(h=Ak)),t.interpolate((h===Ak?Li:hR)(p))):t.interpolate(p),s){const[y,v]=di(a);(y>0||v<0)&&(a=Qy(a),(B0(a)||1)===Math.sign(y)?a[0]=0:a[a.length-1]=0)}return g&&(a=Vw(a)),t.domain(a).unknown(l),i&&(t.nice(CNt(i,r)),a=t.domain()),h!==void 0&&t.range(h),o&&t.clamp(o),{type:r,domain:a,range:h,scale:t,interpolate:p,interval:f}}function CF(e){return e=ah(e),e.length>=2?e:[e[0],e[0]]}function CNt(e,t){return e===!0?void 0:typeof e=="number"?e:z8t(e,t)}function ANt(e,t,n){return l1(e,Au(),t,n)}function RNt(e,t,n){return MG(e,t,{...n,exponent:.5})}function MG(e,t,{exponent:n=1,...r}){return l1(e,Rq().exponent(n),t,{...r,type:"pow"})}function NNt(e,t,{base:n=10,domain:r=UNt(t),...i}){return l1(e,M0().base(n),t,{...i,domain:r})}function INt(e,t,{constant:n=1,...r}){return l1(e,kC().constant(n),t,r)}function ONt(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=zNt(t),unknown:a,interpolate:l,reverse:c}){return n===void 0&&(n=l!==void 0?nl(l,i):qr.get(e)===Bu?n3(o,i):void 0),s.length>0&&(s=Nq(s,n===void 0?{length:i}:n).quantiles()),fR(e,t,{domain:s,range:n,reverse:c,unknown:a})}function DNt(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=CG(e,t),unknown:s,interpolate:a,reverse:l}){const[c,u]=di(o);let f;return n===void 0?(f=Bf(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?nl(a,r):qr.get(e)===Bu?n3(i,r):void 0):(f=nl(Hi(c,u),r+1).slice(1,-1),c instanceof Date&&(f=f.map(h=>new Date(h)))),B0(ah(o))<0&&f.reverse(),fR(e,t,{domain:f,range:n,reverse:l,unknown:s})}function fR(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?nl(o,n.length+1):qr.get(e)===Bu?n3(i,n.length+1):void 0,reverse:a}){n=ah(n);const l=B0(n);if(!isNaN(l)&&!LNt(n,l))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Vw(s)),{type:"threshold",scale:Iq(l<0?Vw(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function LNt(e,t){for(let n=1,r=e.length,i=e[0];nt}}function iv(e,t=Qx){return e.length?[Dr(e,({value:n})=>n===void 0?n:Dr(n,t)),Vr(e,({value:n})=>n===void 0?n:Vr(n,t))]:[0,1]}function CG(e,t){const n=qr.get(e);return(n===o1||n===a1||n===s1?$Nt:iv)(t)}function $Nt(e){return[0,e.length?Vr(e,({value:t})=>t===void 0?t:Vr(t,Qx)):1]}function BNt(e,t){const n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];const r=Pf(e,.5,({value:s})=>s===void 0?NaN:Pf(s,.25,hu)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Vr(i);return o<1?i.map(s=>s*o):i}function PNt(e,t){const n=Ny(e,({value:o})=>o===void 0?NaN:Ny(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Vr(r);return i<1?r.map(o=>o*i):r}function UNt(e){for(const{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return iv(e,hu);if(n<0)return iv(e,VS)}return[1,10]}function zNt(e){const t=[];for(const{value:n}of e)if(n!==void 0)for(const r of n)t.push(r);return t}function hR(e){return(t,n)=>r=>e(t+r*(n-t))}let o5=0,s5;function qNt(){const e=o5;return o5=0,s5=void 0,e}function du(e){e!==s5&&(s5=e,console.warn(e),++o5)}function r3(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=iv(r),unknown:l,pivot:c=0,scheme:u,range:f,symmetric:h=!0,interpolate:p=qr.get(e)===Bu?u==null&&f!==void 0?bd:uR(u!==void 0?u:"rdbu"):Hi,reverse:g}){c=+c,a=ah(a);let[y,v]=a;if(a.length>2&&du(`Warning: the diverging ${e} scale domain contains extra elements.`),md(y,v)<0&&([y,v]=[v,y],g=!g),y=Math.min(y,c),v=Math.max(v,c),typeof p!="function"&&(p=kG(p)),f!==void 0&&(p=p.length===1?hR(p)(...f):uS(p,f)),g&&(p=TG(p)),h){const b=n.apply(c),_=b-n.apply(y),S=n.apply(v)-b;_S&&(v=n.invert(b+_))}return t.domain([y,c,v]).unknown(l).interpolator(p),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,v],pivot:c,interpolate:p,scale:t}}function jNt(e,t,n){return r3(e,Hq(),HNt,t,n)}function VNt(e,t,n){return AG(e,t,{...n,exponent:.5})}function AG(e,t,{exponent:n=1,...r}){return r3(e,Jq().exponent(n=+n),JNt(n),t,{...r,type:"diverging-pow"})}function WNt(e,t,{base:n=10,pivot:r=1,domain:i=iv(t,r<0?VS:hu),...o}){return r3(e,Gq().base(n=+n),GNt,t,{domain:i,pivot:r,...o})}function YNt(e,t,{constant:n=1,...r}){return r3(e,Xq().constant(n=+n),KNt(n),t,r)}const HNt={apply(e){return e},invert(e){return e}},GNt={apply:Math.log,invert:Math.exp},XNt={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function JNt(e){return e===.5?XNt:{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 KNt(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 RG(e,t,n,r){return l1(e,t,n,r)}function ZNt(e,t,n){return RG(e,Nxt(),t,n)}function QNt(e,t,n){return RG(e,Ixt(),t,n)}const c1=Symbol("ordinal");function NG(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:l}){return i=wg(i,r),o===void 0&&(o=OG(n,i,e)),(r==="categorical"||r===c1)&&(r="ordinal"),a&&(o=Vw(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:l,interval:i}}function tIt(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...l}){r=wg(r,n),i===void 0&&(i=OG(t,r,e));let c;if(qr.get(e)===KS)c=rIt(t),o=o===void 0?iIt(c):gr(o,QA);else if(qr.get(e)===Bu&&(o===void 0&&(n==="ordinal"||n===c1)&&(o=TNt(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){const u=uR(s),f=o[0],h=o[1]-o[0];o=({length:p})=>nl(g=>u(f+h*g),p)}else o=EG(s);if(a===j4)throw new Error(`implicit unknown on ${e} scale is not supported`);return NG(e,bC().unknown(a),t,{...l,type:n,domain:i,range:o,hint:c})}function eIt(e,t,{align:n=.5,padding:r=.5,...i}){return IG(M_t().align(n).padding(r),t,i,e)}function nIt(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return IG(kv().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function IG(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=NG(r,e,t,n),e.round=i,e}function OG(e,t,n){const r=new lg;for(const{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(const s of i)r.add(s)}if(t!==void 0){const[i,o]=di(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&qr.get(n)===Vl)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return qw(r,Ra)}function AF(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 rIt(e){return{fill:AF(e,"fill"),stroke:AF(e,"stroke")}}function iIt(e){return Or(e.fill)?r8t:n8t}function a5(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:l,clamp:c,zero:u,align:f,padding:h,projection:p,facet:{label:g=t}={},...y}={}){const v={};for(const[b,_]of e){const S=y[b],x=BG(b,_,{round:qr.get(b)===Vl?a:void 0,nice:l,clamp:c,zero:u,align:f,padding:h,projection:p,...S});if(x){let{label:T=b==="fx"||b==="fy"?g:t,percent:k,transform:M,inset:C,insetTop:R=C!==void 0?C:b==="y"?r:0,insetRight:O=C!==void 0?C:b==="x"?i:0,insetBottom:N=C!==void 0?C:b==="y"?o:0,insetLeft:L=C!==void 0?C:b==="x"?s:0}=S||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");x.percent=!!k,x.label=T===void 0?sIt(_,x):T,x.transform=M,b==="x"||b==="fx"?(x.insetLeft=+L,x.insetRight=+O):(b==="y"||b==="fy")&&(x.insetTop=+R,x.insetBottom=+N),v[b]=x}}return v}function RF(e){const t={},n={scales:t};for(const[r,i]of Object.entries(e)){const{scale:o,type:s,interval:a,label:l}=i;t[r]=UG(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),l!=null&&(o.label=l)}return n}function oIt(e,t){const{x:n,y:r,fx:i,fy:o}=e,s=i||o?dR(t):t;i&&NF(i,s),o&&IF(o,s);const a=i||o?LG(e,t):t;n&&NF(n,a),r&&IF(r,a)}function sIt(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!qd(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function DG(e){return Math.sign(B0(e.domain()))*Math.sign(B0(e.range()))}function dR(e){const{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,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:o,height:s}}function LG({fx:e,fy:t},n){const{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:l}=dR(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:l,facet:{width:a,height:l}}}function NF(e,t){if(e.range===void 0){const{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,l=i-s-r;e.range=[a,Math.max(a,l)],qd(e)||(e.range=$G(e)),e.scale.range(e.range)}FG(e)}function IF(e,t){if(e.range===void 0){const{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,l=i-s-r;e.range=[Math.max(a,l),a],qd(e)?e.range.reverse():e.range=$G(e),e.scale.range(e.range)}FG(e)}function FG(e){e.round===void 0&&cIt(e)&&aIt(e)<=30&&e.scale.round(!0)}function aIt({scale:e}){const t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function $G(e){const t=e.scale.domain().length+PG(e);if(!(t>2))return e.range;const[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function l5(e,t,n){return BG(e,n===void 0?void 0:[{hint:n}],{...t})}function BG(e,t=[],n={}){const r=lIt(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&qd({type:r})){const i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Do)?du(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Ep(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 "${Ep(r)}".`):i.some(W8t)?du(`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 "${Ep(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 "${Ep(r)}".`):i.some(Y8t)&&du(`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 "${Ep(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 "${Ep(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=Ub(t,n,ts);break;case"identity":switch(qr.get(e)){case Vl:n=Ub(t,n,ts);break;case KS:n=Ub(t,n,uIt);break}break;case"utc":case"time":n=Ub(t,n,HH);break}switch(r){case"diverging":return jNt(e,t,n);case"diverging-sqrt":return VNt(e,t,n);case"diverging-pow":return AG(e,t,n);case"diverging-log":return WNt(e,t,n);case"diverging-symlog":return YNt(e,t,n);case"categorical":case"ordinal":case c1:return tIt(e,t,n);case"cyclical":case"sequential":case"linear":return ANt(e,t,n);case"sqrt":return RNt(e,t,n);case"threshold":return fR(e,t,n);case"quantile":return ONt(e,t,n);case"quantize":return DNt(e,t,n);case"pow":return MG(e,t,n);case"log":return NNt(e,t,n);case"symlog":return INt(e,t,n);case"utc":return QNt(e,t,n);case"time":return ZNt(e,t,n);case"point":return eIt(e,t,n);case"band":return nIt(e,t,n);case"identity":return FNt(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Ep(e){return typeof e=="symbol"?e.description:e}function OF(e){return typeof e=="string"?`${e}`.toLowerCase():e}const DF={toString:()=>"projection"};function lIt(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=OF(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=DF);for(const u of t){const f=OF(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===DF)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===o1)return"sqrt";if(l===a1||l===s1)return"linear";if(l===KS)return"ordinal";const c=(r??i)?.length;if(c<2||c>2)return Rk(l);if(r!==void 0){if(Gr(r))return Rk(l);if(Do(r))return"utc"}else{const u=t.map(({value:f})=>f).filter(f=>f!==void 0);if(u.some(Gr))return Rk(l);if(u.some(Do))return"utc"}if(l===Bu){if(s!=null||MNt(o))return"diverging";if(ENt(o))return"categorical"}return"linear"}function Rk(e){switch(e){case Vl:return"point";case Bu:return c1;default:return"ordinal"}}function qd({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===c1}function PG({type:e}){return e==="threshold"}function cIt({type:e}){return e==="point"||e==="band"}function hc(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 UG({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,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:Qy(n),...r!==void 0&&{range:Qy(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...c!==void 0&&{unknown:c},...o!==void 0&&{interval:o},...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 hIt(e,t){const{fx:n,fy:r}=a5(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?h_t(i,o).map(([s,a],l)=>({x:s,y:a,i:l})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function dIt(e,{x:t,y:n}){return t&&=c5(t),n&&=c5(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 pR(e,{fx:t,fy:n}){const r=Fu(e),i=t?.value,o=n?.value;return t&&n?r0(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?r0(r,s=>(s.fx=i[s[0]],s),s=>i[s]):r0(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function pIt(e,t,{marginTop:n,marginLeft:r}){const i=e?({x:s})=>e(s)-r:()=>0,o=t?({y:s})=>t(s)-n:()=>0;return function(s){this.tagName==="svg"?(this.setAttribute("x",i(s)),this.setAttribute("y",o(s))):this.setAttribute("transform",`translate(${i(s)},${o(s)})`)}}function gIt(e){const t=[],n=new Uint32Array(el(e,r=>r.length));for(const r of e){let i=0;for(const o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}const mIt=new Map([["top",Nk],["right",Dk],["bottom",Ik],["left",Ok],["top-left",zb(Nk,Ok)],["top-right",zb(Nk,Dk)],["bottom-left",zb(Ik,Ok)],["bottom-right",zb(Ik,Dk)],["top-empty",bIt],["right-empty",xIt],["bottom-empty",_It],["left-empty",wIt],["empty",SIt]]);function yIt(e){if(e==null)return null;const t=mIt.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}const LF=new WeakMap;function c5(e){let t=LF.get(e);return t||LF.set(e,t=new yd(gr(e,(n,r)=>[n,r]))),t}function ch(e,t){return c5(e).get(t)}function vIt(e,t,n){return t=ru(t),n=ru(n),e.find(r=>Object.is(ru(r.x),t)&&Object.is(ru(r.y),n))}function i3(e,t,n){return vIt(e,t,n)?.empty}function Nk(e,{y:t},{y:n}){return t?ch(t,n)===0:!0}function Ik(e,{y:t},{y:n}){return t?ch(t,n)===t.length-1:!0}function Ok(e,{x:t},{x:n}){return t?ch(t,n)===0:!0}function Dk(e,{x:t},{x:n}){return t?ch(t,n)===t.length-1:!0}function bIt(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const o=ch(t,r);if(o>0)return i3(e,n,t[o-1])}function _It(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const o=ch(t,r);if(o0)return i3(e,t[o-1],r)}function xIt(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;const o=ch(t,n);if(or.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}const zG=Math.PI,$c=2*zG,Fk=.618;function EIt({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,l,c="frame";if(zs(e)){let T;if({type:e,domain:l,inset:T,insetTop:n=T!==void 0?T:n,insetRight:r=T!==void 0?T:r,insetBottom:i=T!==void 0?T:i,insetLeft:o=T!==void 0?T:o,clip:c=c,...a}=e,e==null)return}typeof e!="function"&&({type:e}=u5(e));const{width:u,height:f,marginLeft:h,marginRight:p,marginTop:g,marginBottom:y}=s,v=u-h-p-o-r,b=f-g-y-n-i;if(e=e?.({width:v,height:b,clip:c,...a}),e==null)return;c=TIt(c,h,g,u-p,f-y);let _=h+o,S=g+n,x;if(l!=null){const[[T,k],[M,C]]=Qv(e).bounds(l),R=Math.min(v/(M-T),b/(C-k));R>0?(_-=(R*(T+M)-v)/2,S-=(R*(k+C)-b)/2,x=qx({point(O,N){this.stream.point(O*R+_,N*R+S)}})):du("Warning: the projection could not be fit to the specified domain; using the default scale.")}return x??=_===0&&S===0?qG():qx({point(T,k){this.stream.point(T+_,k+S)}}),{stream:T=>e.stream(x.stream(c(T)))}}function u5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Ba(GAt,.7463,.4673);case"albers":return qb(HY,.7463,.4673);case"azimuthal-equal-area":return Ba(XAt,4,4);case"azimuthal-equidistant":return Ba(JAt,$c,$c);case"conic-conformal":return qb(QAt,$c,$c);case"conic-equal-area":return qb(jx,6.1702,2.9781);case"conic-equidistant":return qb(nRt,7.312,3.6282);case"equal-earth":return Ba(iRt,5.4133,2.6347);case"equirectangular":return Ba(tRt,$c,zG);case"gnomonic":return Ba(oRt,3.4641,3.4641);case"identity":return{type:qG};case"reflect-y":return{type:kIt};case"mercator":return Ba(KAt,$c,$c);case"orthographic":return Ba(sRt,2,2);case"stereographic":return Ba(aRt,2,2);case"transverse-mercator":return Ba(lRt,$c,$c);default:throw new Error(`unknown projection type: ${e}`)}}function TIt(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return NY(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Ba(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{const l=e();return s!=null&&l.precision?.(s),o!=null&&l.rotate?.(o),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 qb(e,t,n){const{type:r,aspectRatio:i}=Ba(e,t,n);return{type:o=>{const{parallels:s,domain:a,width:l,height:c}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&l!=null&&u.fitSize([l,c],{type:"Sphere"})),u},aspectRatio:i}}const qG=Li({stream:e=>e}),kIt=Li(qx({point(e,t){this.stream.point(e,-t)}}));function jG(e,t,n,r){const i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),l=n[t]=new Float64Array(s).fill(NaN);let c;const u=r.stream({point(f,h){a[c]=f,l[c]=h}});for(c=0;c5?5:l:Fk}}if(e!=null){if(typeof e!="function"){const{aspectRatio:t}=u5(e);if(t)return t}return Fk}}function u1(e,t,{projection:n}){const{x:r,y:i}=e;let o={};return r&&(o.x=r),i&&(o.y=i),o=e3(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&jG("x","y",o,n),r&&(o.x=ts(o.x)),i&&(o.y=ts(o.y)),o}function AIt(e){const t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(const s of e.value)df(s,o);return[r,i]}function RIt({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,qx({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:iG(n)}}function _n(e,{document:t}){return Er(FS(e).call(t.documentElement))}const f5=Symbol("unset");function z0(e){return(e.length===1?NIt:IIt)(e)}function NIt(e){let t,n=f5;return r=>(Object.is(n,r)||(n=r,t=e(r)),t)}function IIt(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>!Object.is(i,r[o])))&&(n=r,t=e(...r)),t)}const OIt=z0(e=>new Intl.NumberFormat(e)),DIt=z0((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),LIt=z0((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function VG(e="en-US"){const t=OIt(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function FIt(e="en-US",t="short"){const n=DIt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function $It(e="en-US",t="short"){const n=LIt(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function WG(e){return C8t(e,"Invalid Date")}function BIt(e="en-US"){const t=VG(e);return n=>(n instanceof Date?WG:typeof n=="number"?t:Di)(n)}const q0=BIt(),Fi=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5;let PIt=0,UIt=0;function gR(){return`plot-clip-${++PIt}`}function zIt(){return`plot-pattern-${++UIt}`}function YG(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:l,stroke:c,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:p,strokeMiterlimit:g,strokeDasharray:y,strokeDashoffset:v,opacity:b,mixBlendMode:_,imageFilter:S,paintOrder:x,pointerEvents:T,shapeRendering:k,channels:M},{ariaLabel:C,fill:R="currentColor",fillOpacity:O,stroke:N="none",strokeOpacity:L,strokeWidth:$,strokeLinecap:I,strokeLinejoin:F,strokeMiterlimit:D,paintOrder:P}){R===null&&(a=null,l=null),N===null&&(c=null,f=null),Or(R)?!Or(N)&&(!Or(a)||M?.fill)&&(N="none"):Or(N)&&(!Or(c)||M?.stroke)&&(R="none");const[z,q]=Oo(a,R),[U,V]=ri(l,O),[G,Z]=Oo(c,N),[lt,pt]=ri(f,L),[dt,at]=ri(b);U0(Z)||(u===void 0&&(u=$),p===void 0&&(p=I),h===void 0&&(h=F),g===void 0&&!X8t(h)&&(g=D),!U0(q)&&x===void 0&&(x=P));const[yt,nt]=ri(u);return R!==null&&(e.fill=ui(q,"currentColor"),e.fillOpacity=um(V,1)),N!==null&&(e.stroke=ui(Z,"none"),e.strokeWidth=um(nt,1),e.strokeOpacity=um(pt,1),e.strokeLinejoin=ui(h,"miter"),e.strokeLinecap=ui(p,"butt"),e.strokeMiterlimit=um(g,4),e.strokeDasharray=ui(y,"none"),e.strokeDashoffset=ui(v,"0")),e.target=Di(s),e.ariaLabel=Di(C),e.ariaDescription=Di(i),e.ariaHidden=Di(o),e.opacity=um(at,1),e.mixBlendMode=ui(_,"normal"),e.imageFilter=ui(S,"none"),e.paintOrder=ui(x,"normal"),e.pointerEvents=ui(T,"auto"),e.shapeRendering=ui(k,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:z,scale:"auto",optional:!0},fillOpacity:{value:U,scale:"auto",optional:!0},stroke:{value:G,scale:"auto",optional:!0},strokeOpacity:{value:lt,scale:"auto",optional:!0},strokeWidth:{value:yt,optional:!0},opacity:{value:dt,scale:"auto",optional:!0}}}function qIt(e,t){t&&e.filter(n=>UA(t[n])).append("title").call(VIt,t)}function jIt(e,t){t&&e.filter(([n])=>UA(t[n])).append("title").call(WIt,t)}function VIt(e,t){t&&e.text(n=>q0(t[n]))}function WIt(e,t){t&&e.text(([n])=>q0(t[n]))}function Wr(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:l,strokeWidth:c,opacity:u,href:f}){r&&me(e,"aria-label",h=>r[h]),o&&me(e,"fill",h=>o[h]),s&&me(e,"fill-opacity",h=>s[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&&GG(e,h=>f[h],t),n||qIt(e,i)}function r2(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:l,strokeWidth:c,opacity:u,href:f}){r&&me(e,"aria-label",([h])=>r[h]),o&&me(e,"fill",([h])=>o[h]),s&&me(e,"fill-opacity",([h])=>s[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&&GG(e,([h])=>f[h],t),n||jIt(e,i)}function YIt({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:l},{tip:c}){return[e,c?void 0:t,n,r,i,o,s,a,l].filter(u=>u!==void 0)}function mR(e,t,n){const r=eh(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&du("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*HG(e,t,n,r){const{z:i}=n,{z:o}=r,s=YIt(r,n),a=[...t,...s];for(const l of o?mR(e,o,i):[e]){let c,u;t:for(const f of l){for(const h of a)if(!Bi(h[f])){u&&u.push(-1);continue t}if(c===void 0){u&&(yield u),c=s.map(h=>ru(h[f])),u=[f];continue}u.push(f);for(let h=0;hru(g[f])),u=[f];continue t}}u&&(yield u)}}function HIt(e,t,n,r){let i;const{clip:o=r.clip}=t;o==="frame"?(e=_n("svg:g",r).each(function(){this.appendChild(e.node()),e.node=()=>this}),i=XIt(r,n)):o&&(i=KIt(o,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 GIt(e){const t=new WeakMap;return(n,r)=>{let i=t.get(n);if(!i){const o=gR();Er(n.ownerSVGElement).append("clipPath").attr("id",o).call(e,n,r),t.set(n,i=`url(#${o})`)}return i}}const XIt=GIt((e,t,n)=>{const{width:r,height:i,marginLeft:o,marginRight:s,marginTop:a,marginBottom:l}=n;e.append("rect").attr("x",o).attr("y",a).attr("width",r-s-o).attr("height",i-a-l)}),FF=new WeakMap,JIt={type:"Sphere"};function KIt(e,t){let n,r;if((n=FF.get(t))||FF.set(t,n=new WeakMap),e.type==="Sphere"&&(e=JIt),!(r=n.get(e))){const i=gR();Er(t.ownerSVGElement).append("clipPath").attr("id",i).append("path").attr("d",t.path()(e)),n.set(e,r=`url(#${i})`)}return r}function Ar(e,t,n,r){HIt(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 or(e,t){ZIt(e,"mix-blend-mode",t.mixBlendMode),me(e,"opacity",t.opacity)}function GG(e,t,n){e.each(function(r){const i=t(r);if(i!=null){const o=this.ownerDocument.createElementNS(wu.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(wu.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function me(e,t,n){n!=null&&e.attr(t,n)}function ZIt(e,t,n){n!=null&&e.style(t,n)}function yr(e,t,{x:n,y:r},i=Fi,o=Fi){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function ui(e,t){if((e=Di(e))!==t)return e}function um(e,t){if((e=kr(e))!==t)return e}const QIt=/^-?([_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 yR(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!QIt.test(e))throw new Error(`invalid class name: ${e}`);return e}function vR(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 _c({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}let vr=class{constructor(t,n={},r={},i){const{facet:o="auto",facetAnchor:s,fx:a,fy:l,sort:c,dx:u=0,dy:f=0,margin:h=0,marginTop:p=h,marginRight:g=h,marginBottom:y=h,marginLeft:v=h,className:b,clip:_=i?.clip,channels:S,tip:x,render:T}=r;if(this.data=t,this.sort=Yf(c)?c:null,this.initializer=no(r).initializer,this.transform=this.initializer?r.transform:vl(r).transform,o===null||o===!1?this.facet=null:(this.facet=Us(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===ry&&typeof a=="string"?[a]:a,this.fy=t===ry&&typeof l=="string"?[l]:l),this.facetAnchor=yIt(s),n=JA(n),S!==void 0&&(n={...t7t(S),...n}),i!==void 0&&(n={...YG(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([k,M])=>{if(Rl(M.value)){const{value:C,label:R=M.label,scale:O=M.scale}=M.value;M={...M,label:R,scale:O,value:C}}if(t===ry&&typeof M.value=="string"){const{value:C}=M;M={...M,value:[C]}}return[k,M]}).filter(([k,{value:M,optional:C}])=>{if(M!=null)return!0;if(C)return!1;throw new Error(`missing channel value: ${k}`)})),this.dx=+u,this.dy=+f,this.marginTop=+p,this.marginRight=+g,this.marginBottom=+y,this.marginLeft=+v,this.clip=iG(_),this.tip=e7t(x),this.className=Di(b),this.facet==="super"){if(a||l)throw new Error("super-faceting cannot use fx or fy");for(const k in this.channels){const{scale:M}=n[k];if(!(M!=="x"&&M!=="y"))throw new Error("super-faceting cannot use x or y")}}T!=null&&(this.render=sv(T,this.render))}initialize(t,n,r){let i=P0(this.data);t===void 0&&i!=null&&(t=[Fu(i)]);const o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=P0(i)),t!==void 0&&(t.original=o);const s=bG(this.channels,i);return this.sort!=null&&_Nt(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(const i in n){const{filter:o=Bi}=n[i];if(o!==null){const s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(const i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){const o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&jG(i,o,n,r.projection)}}scale(t,n,r){const i=e3(t,n);return r.projection&&this.project(t,i,r),i}};function Na(...e){return e.plot=vr.prototype.plot,e}function sv(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,o,s,a){return e.call(this,n,r,i,o,s,(l,c,u,f,h)=>t.call(this,l,c,u,f,h,a))}}function t7t(e){return Object.fromEntries(Object.entries(JA(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:xg(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function e7t(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Us(e,"tip",["x","y","xy"]):e}function jd(e,t){return e?.tip===!0?{...e,tip:t}:zs(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function n7t(e,t,n={}){let r=.5-Fi,i=.5+Fi,o=.5+Fi,s=.5-Fi;for(const{marginTop:y,marginRight:v,marginBottom:b,marginLeft:_}of t)y>r&&(r=y),v>i&&(i=v),b>o&&(o=b),_>s&&(s=_);let{margin:a,marginTop:l=a!==void 0?a:r,marginRight:c=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;l=+l,c=+c,u=+u,f=+f;let{width:h=640,height:p=r7t(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,l-r+u-o)}=n;h=+h,p=+p;const g={width:h,height:p,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:S=y!==void 0?y:f}=n.facet??{};v=+v,b=+b,_=+_,S=+S,g.facet={marginTop:v,marginRight:b,marginBottom:_,marginLeft:S}}return g}function r7t({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:l,marginBottomDefault:c,marginLeftDefault:u}){const f=n&&n.scale.domain().length||1,h=CIt(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((s-u-l)*v+a+c)}const p=t?qd(t)?t.scale.domain().length||1:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);const g=$F("y",t)/($F("x",e)*o),y=r?r.scale.bandwidth():1,v=n?n.scale.bandwidth():1,b=y*(s-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,p*f))*20+!!r*30+60}function $F(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[o,s]=di(r);return Math.abs(i(s)-i(o))}const BF=new WeakMap;function bR(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:l,...c}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...c,render:sv(function(u,f,h,p,g,y){g={...g,pointerSticky:!1};const v=g.ownerSVGElement,{data:b}=g.getMarkState(this);let _=BF.get(v);_||BF.set(v,_={sticky:!1,roots:[],renders:[]});let S=_.renders.push(Z)-1;const{x,y:T,fx:k,fy:M}=f;let C=k?k(u.fx)-p.marginLeft:0,R=M?M(u.fy)-p.marginTop:0;x?.bandwidth&&(C+=x.bandwidth()/2),T?.bandwidth&&(R+=T.bandwidth()/2);const O=u.fi!=null;let N;if(O){let at=_.facetStates;at||(_.facetStates=at=new Map),N=at.get(this),N||at.set(this,N=new Map)}const[L,$]=_c(this,p),{px:I,py:F}=h,D=I?at=>I[at]:XG(h,L),P=F?at=>F[at]:JG(h,$);let z,q,U,V;function G(at,yt){if(O)if(V&&(V=cancelAnimationFrame(V)),at==null)N.delete(u.fi);else{N.set(u.fi,yt),V=requestAnimationFrame(()=>{V=null;for(const[nt,gt]of N)if(gt1)){const gt=z==null?null:Lu(b)?b[z]:b.get(z);g.dispatchValue(gt)}return nt}function lt(at){if(_.sticky||at.pointerType==="mouse"&&at.buttons===1)return;let[yt,nt]=za(at);yt-=C,nt-=R;const gt=ytp.width-p.marginRight?1:e,vt=ntp.height-p.marginBottom?1:t;let st=null,Bt=s*s;for(const Dt of u){const zt=gt*(D(Dt)-yt),jt=vt*(P(Dt)-nt),Ct=zt*zt+jt*jt;Ct<=Bt&&(st=Dt,Bt=Ct)}if(st!=null&&(e!==1||t!==1)){const Dt=D(st)-yt,zt=P(st)-nt;Bt=Dt*Dt+zt*zt}G(st,Bt)}function pt(at){at.pointerType==="mouse"&&z!=null&&(_.sticky&&_.roots.some(yt=>yt?.contains(at.target))||(_.sticky?(_.sticky=!1,_.renders.forEach(yt=>yt(null))):(_.sticky=!0,Z(z)),at.stopImmediatePropagation()))}function dt(at){at.pointerType==="mouse"&&(_.sticky||G(null))}return v.addEventListener("pointerenter",lt),v.addEventListener("pointermove",lt),v.addEventListener("pointerdown",pt),v.addEventListener("pointerleave",dt),Z(null)},l)}}function s3(e){return bR(1,1,e)}function a3(e){return bR(1,.01,e)}function av(e){return bR(.01,1,e)}function XG({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function JG({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function KG(e){return qd(e)&&e.interval===void 0?void 0:"tabular-nums"}function i7t(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:l=16+r,marginLeft:c=0,style:u,ticks:f=(i-c-a)/64,tickFormat:h,fontVariant:p=KG(e),round:g=!0,opacity:y,className:v}=t;const b=o3(t);v=yR(v),y=ri(y)[1],h===null&&(h=()=>null);const _=_n("svg",b).attr("class",`${v}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).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(vR,u);let S=L=>L.selectAll(".tick line").attr("y1",s+l-o),x;const T=g?(L,$)=>L.rangeRound($):(L,$)=>L.range($),{type:k,domain:M,range:C,interpolate:R,scale:O,pivot:N}=e;if(R){const L=C===void 0?R:uS(R.length===1?hR(R):R,C);x=T(O.copy(),nl(Hi(c,i-a),Math.min(M.length+(N!==void 0),C===void 0?1/0:C.length)));const $=256,I=b.document.createElement("canvas");I.width=$,I.height=1;const F=I.getContext("2d");for(let D=0,P=$-1;D<$;++D)F.fillStyle=L(D/P),F.fillRect(D,0,1,1);_.append("image").attr("opacity",y).attr("x",c).attr("y",s).attr("width",i-c-a).attr("height",o-s-l).attr("preserveAspectRatio","none").attr("xlink:href",I.toDataURL())}else if(k==="threshold"){const L=M,$=h===void 0?I=>I:typeof h=="string"?Oa(h):h;x=T(Au().domain([-1,C.length-1]),[c,i-a]),_.append("g").attr("fill-opacity",y).selectAll().data(C).enter().append("rect").attr("x",(I,F)=>x(F-1)).attr("y",s).attr("width",(I,F)=>x(F)-x(F-1)).attr("height",o-s-l).attr("fill",I=>I),f=gr(L,(I,F)=>F),h=I=>$(L[I],I)}else x=T(kv().domain(M),[c,i-a]),_.append("g").attr("fill-opacity",y).selectAll().data(M).enter().append("rect").attr("x",x).attr("y",s).attr("width",Math.max(0,x.bandwidth()-1)).attr("height",o-s-l).attr("fill",O),S=()=>{};return _.append("g").attr("transform",`translate(0,${o-l})`).call(xMt(x).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",ui(p,"normal")).call(S).call(L=>L.select(".domain").remove()),n!==void 0&&_.append("text").attr("x",c).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),_.node()}const i2=Math.PI/180;function Sg(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=$k(n),e.markerMid=$k(r),e.markerEnd=$k(i)}function $k(e){if(e==null||e===!1)return null;if(e===!0)return UF;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return PF("auto");case"arrow-reverse":return PF("auto-start-reverse");case"dot":return o7t;case"circle":case"circle-fill":return UF;case"circle-stroke":return s7t;case"tick":return Bk("auto");case"tick-x":return Bk(90);case"tick-y":return Bk(0)}throw new Error(`invalid marker: ${e}`)}function PF(e){return(t,n)=>_n("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 o7t(e,t){return _n("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 UF(e,t){return _n("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 s7t(e,t){return _n("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 Bk(e){return(t,n)=>_n("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 a7t=0;function f1(e,t,{stroke:n},r){return QG(e,t,n&&(i=>n[i]),null,r)}function l7t(e,t,{stroke:n,z:r},i){return QG(e,t,n&&(([o])=>n[o]),r,i)}const h5=1,ZG=2;function c7t(e,t){const n=new Uint8Array(t.length),r=e.data().filter(o=>o.length>1),i=r.length;for(let o=0,s=f5;o1){const l=a[0];s!==(s=ru(t[l]))&&(n[l]|=h5)}}for(let o=i-1,s=f5;o>=0;--o){const a=r[o];if(a.length>1){const l=a[0];s!==(s=ru(t[l]))&&(n[l]|=ZG)}}return([o])=>n[o]}function QG(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s,a){if(!t&&!n&&!r)return;const l=new Map,c=s&&c7t(e,s);function u(f,h,p){return function(g){if(p&&!p(g))return;const y=o(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),S=`plot-marker-${++a7t}`;_.setAttribute("id",S),v.set(y,b=`url(#${S})`)}this.setAttribute(f,b)}}t&&e.each(u("marker-start",t,c&&(f=>c(f)&h5))),n&&c&&e.each(u("marker-start",n,f=>!(c(f)&h5))),n&&e.each(u("marker-mid",n)),r&&e.each(u("marker-end",r,c&&(f=>c(f)&ZG)))}function h1({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=tX(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function d1({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=tX(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function tX(e,t,n){return e===void 0&&t===void 0&&n===void 0?Fi?[1,0]:[.5,.5]:[t,n]}function eX(e,{interval:t}){return e={...xg(e)},e.interval=JS(e.interval===void 0?t:e.interval),e}function l3(e,t,n,r){const{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:l}=eX(i,n);if(a==null||l==null&&!r)return n;const c=bc(i);if(l==null){let p;const g={transform:y=>p||(p=fn(y,a)),label:c};return{...n,[e]:void 0,[`${e}1`]:o===void 0?g:o,[`${e}2`]:s===void 0&&!(o===s&&r)?g:s}}let u,f;function h(p){return f!==void 0&&p===u?f:f=gr(fn(u=p,a),g=>l.floor(g))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:h,label:c}:o,[`${e}2`]:s===void 0?{transform:p=>h(p).map(g=>l.offset(g)),label:c}:s})}function nX(e,t,n){const{[e]:r}=n,{value:i,interval:o}=eX(r,n);return i==null||o==null?n:t({...n,[e]:{label:bc(r),transform:s=>{const a=gr(fn(s,i),c=>o.floor(c)),l=a.map(c=>o.offset(c));return a.map(Do(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 rX(e={}){return l3("x",h1,e,!0)}function iX(e={}){return l3("y",d1,e,!0)}function _R(e={}){return l3("x",h1,e)}function wR(e={}){return l3("y",d1,e)}function oX(e={}){return nX("x",h1,e)}function sX(e={}){return nX("y",d1,e)}const aX={ariaLabel:"rule",fill:null,stroke:"currentColor"};class lX extends vr{constructor(t,n={}){const{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:l=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},jd(n,"x"),aX),this.insetTop=kr(a),this.insetBottom=kr(l),Sg(this,n)}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y1:c,y2:u}=r,{width:f,height:h,marginTop:p,marginRight:g,marginLeft:y,marginBottom:v}=i,{insetTop:b,insetBottom:_}=this;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s},Fi,0).call(S=>S.selectAll().data(t).enter().append("line").call(or,this).attr("x1",l?x=>l[x]:(y+f-g)/2).attr("x2",l?x=>l[x]:(y+f-g)/2).attr("y1",c&&!hc(a)?x=>c[x]+b:p+b).attr("y2",u&&!hc(a)?a.bandwidth?x=>u[x]+a.bandwidth()-_:x=>u[x]-_:h-v-_).call(Wr,this,r).call(f1,this,r,o)).node()}}class cX extends vr{constructor(t,n={}){const{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:l=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},jd(n,"y"),aX),this.insetRight=kr(a),this.insetLeft=kr(l),Sg(this,n)}render(t,n,r,i,o){const{x:s,y:a}=n,{y:l,x1:c,x2:u}=r,{width:f,height:h,marginTop:p,marginRight:g,marginLeft:y,marginBottom:v}=i,{insetLeft:b,insetRight:_}=this;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{y:l&&a},0,Fi).call(S=>S.selectAll().data(t).enter().append("line").call(or,this).attr("x1",c&&!hc(s)?x=>c[x]+b:y+b).attr("x2",u&&!hc(s)?s.bandwidth?x=>u[x]+s.bandwidth()-_:x=>u[x]-_:f-g-_).attr("y1",l?x=>l[x]:(p+h-v)/2).attr("y2",l?x=>l[x]:(p+h-v)/2).call(Wr,this,r).call(f1,this,r,o)).node()}}function Hf(e,t){let{x:n=de,y:r,y1:i,y2:o,...s}=wR(t);return[i,o]=uX(r,i,o),new lX(e,{...s,x:n,y1:i,y2:o})}function Gf(e,t){let{y:n=de,x:r,x1:i,x2:o,...s}=_R(t);return[i,o]=uX(r,i,o),new cX(e,{...s,y:n,x1:i,x2:o})}function uX(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 p1(e,...t){let n=t.length;for(let r=0,i=!0;r{let i=e[0];for(let o=0;o=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=mX(this),this.clipLine=yX(this)}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y:c,rotate:u,text:f,title:h,fontSize:p}=r,{rotate:g}=this,[y,v]=_c(this,i);return _n("svg:g",o).call(Ar,this,i,o).call(gX,this,f,i).call(yr,this,{x:l&&s,y:c&&a}).call(b=>b.selectAll().data(t).enter().append("text").call(or,this).call(f7t,this,f,h).attr("transform",p1`translate(${l?_=>l[_]:y},${c?_=>c[_]:v})${u?_=>` rotate(${u[_]})`:g?` rotate(${g})`:""}`).call(me,"font-size",p&&(_=>p[_])).call(Wr,this,r)).node()}};function hX(e){return e==null?null:Us(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function f7t(e,t,n,r){if(!n)return;const{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:l}=t;e.each(function(c){const u=a(q0(n[c])??"").map(l),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let p=0;for(let g=0;gi&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===fX?"-":"")),i=s),l){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*m7t(e){let t=0,n=0;const r=e.length;for(;no.split(/\r\n?|\n/g);const r=e?SR:xR,i=t*100;return o=>g7t(o,i,r)}function yX({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;const r=e?SR:xR,i=t*100;switch(n){case"clip-start":return o=>jF(o,i,r,"");case"clip-end":return o=>qF(o,i,r,"");case"ellipsis-start":return o=>jF(o,i,r,h0);case"ellipsis-middle":return o=>y7t(o,i,r,h0);case"ellipsis-end":return o=>qF(o,i,r,h0)}}const h0="…";function V0(e,t,n,r){const i=[];let o=0;for(let s=0,a=0,l=e.length;st){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=c,i.push(s)}return[-1,0]}function qF(e,t,n,r){e=e.trim();const i=n(r),[o]=V0(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function y7t(e,t,n,r){e=e.trim();const i=n(e);if(i<=t)return e;const o=n(r)/2,[s,a]=V0(e,t/2,n,o),[l]=V0(e,i-t/2-a+o,n,-o);return l<0?r:e.slice(0,s).trimEnd()+r+e.slice(Eg(e,l)).trimStart()}function jF(e,t,n,r){e=e.trim();const i=n(e);if(i<=t)return e;const o=n(r),[s]=V0(e,i-t+o,n,-o);return s<0?r:r+e.slice(Eg(e,s)).trimStart()}const d5=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,VF=/\p{Extended_Pictographic}/uy;function Eg(e,t){return t+=v7t(e,t)?2:1,_7t(e,t)&&(t=d5.lastIndex),b7t(e,t)?Eg(e,t+1):t}function vX(e,t){return e.charCodeAt(t)<128}function v7t(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 b7t(e,t){return e.charCodeAt(t)===8205}function _7t(e,t){return vX(e,t)?!1:(d5.lastIndex=t,d5.test(e))}function bX(e,t){return vX(e,t)?!1:(VF.lastIndex=t,VF.test(e))}const _X={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},wX=3.5,w7t=wX*5,xX={draw(e,t,n){const r=t*n/w7t;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},SX={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},x7t=new Map([["arrow",xX],["spike",SX]]);function S7t(e){return e&&typeof e.draw=="function"}function E7t(e){if(S7t(e))return e;const t=x7t.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}class u3 extends vr{constructor(t,n={}){const{x:r,y:i,r:o=wX,length:s,rotate:a,shape:l=xX,anchor:c="middle",frameAnchor:u}=n,[f,h]=ri(s,12),[p,g]=ri(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:p,optional:!0}},n,_X),this.r=+o,this.length=h,this.rotate=g,this.shape=E7t(l),this.anchor=Us(c,"anchor",["start","middle","end"]),this.frameAnchor=i1(u)}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y:c,length:u,rotate:f}=r,{length:h,rotate:p,anchor:g,shape:y,r:v}=this,[b,_]=_c(this,i);return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s,y:c&&a}).call(S=>S.selectAll().data(t).enter().append("path").call(or,this).attr("transform",p1`translate(${l?x=>l[x]:b},${c?x=>c[x]:_})${f?x=>` rotate(${f[x]})`:p?` rotate(${p})`:""}${g==="start"?"":g==="end"?u?x=>` translate(0,${u[x]})`:` translate(0,${h})`:u?x=>` translate(0,${u[x]/2})`:` translate(0,${h/2})`}`).attr("d",u?x=>{const T=nu();return y.draw(T,u[x],v),T}:(()=>{const x=nu();return y.draw(x,h,v),x})()).call(Wr,this,r)).node()}}function EX(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=yl(n,r)),new u3(e,{...i,x:n,y:r})}function TX(e,t={}){const{x:n=de,...r}=t;return new u3(e,{...r,x:n})}function kX(e,t={}){const{y:n=de,...r}=t;return new u3(e,{...r,y:n})}function T7t(e,t={}){const{shape:n=SX,stroke:r=_X.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...l}=t;return EX(e,{...l,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function uh(e,t){return arguments.length<2&&!$u(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function f3({anchor:e}={},t){return e===void 0?t[0]:Us(e,"anchor",t)}function MX(e){return f3(e,["left","right"])}function CX(e){return f3(e,["right","left"])}function AX(e){return f3(e,["bottom","top"])}function RX(e){return f3(e,["top","bottom"])}function ER(){const[e,t]=uh(...arguments);return OX("y",MX(t),e,t)}function NX(){const[e,t]=uh(...arguments);return OX("fy",CX(t),e,t)}function TR(){const[e,t]=uh(...arguments);return DX("x",AX(t),e,t)}function IX(){const[e,t]=uh(...arguments);return DX("fx",RX(t),e,t)}function OX(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:l=r,fillOpacity:c=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:p,tickSize:g=e==="y"?6:0,tickPadding:y,tickRotate:v,x:b,margin:_,marginTop:S=_===void 0?20:_,marginRight:x=_===void 0?t==="right"?40:0:_,marginBottom:T=_===void 0?20:_,marginLeft:k=_===void 0?t==="left"?40:0:_,label:M,labelAnchor:C,labelArrow:R,labelOffset:O,ariaLabel:N=`${e}-axis`,...L}){return g=kr(g),y=kr(y),v=kr(v),C!==void 0&&(C=Us(C,"labelAnchor",["center","top","bottom"])),R=YX(R),Na(g&&!Or(o)?k7t(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:g,tickPadding:y,tickRotate:v,x:b,ariaLabel:N,...L}):null,Or(l)?null:C7t(e,t,n,{fill:l,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:p,textAnchor:u,tickSize:g,tickPadding:y,tickRotate:v,x:b,marginTop:S,marginRight:x,marginBottom:T,marginLeft:k,ariaLabel:N,...L}),!Or(l)&&M!==null?j0([],qX({fill:l,fillOpacity:c,...L},function($,I,F,D,P){const z=D[e],{marginTop:q,marginRight:U,marginBottom:V,marginLeft:G}=e==="y"&&P.inset||P,Z=C??(z.bandwidth?"center":"top"),lt=O??(t==="right"?U:G)-3;return Z==="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=Z,this.frameAnchor=`${Z}-${t}`,this.rotate=0),this.dy=Z==="top"?3-q:Z==="bottom"?V-3:0,this.dx=t==="right"?lt:-lt,this.ariaLabel=`${N} label`,{facets:[[0]],channels:{text:{value:[WX(e,z,{anchor:t,label:M,labelAnchor:Z,labelArrow:R})]}}}})):null)}function DX(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:l=r,fillOpacity:c=i,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:p,tickSize:g=e==="x"?6:0,tickPadding:y,tickRotate:v,y:b,margin:_,marginTop:S=_===void 0?t==="top"?30:0:_,marginRight:x=_===void 0?20:_,marginBottom:T=_===void 0?t==="bottom"?30:0:_,marginLeft:k=_===void 0?20:_,label:M,labelAnchor:C,labelArrow:R,labelOffset:O,ariaLabel:N=`${e}-axis`,...L}){return g=kr(g),y=kr(y),v=kr(v),C!==void 0&&(C=Us(C,"labelAnchor",["center","left","right"])),R=YX(R),Na(g&&!Or(o)?M7t(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:g,tickPadding:y,tickRotate:v,y:b,ariaLabel:N,...L}):null,Or(l)?null:A7t(e,t,n,{fill:l,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:p,textAnchor:u,tickSize:g,tickPadding:y,tickRotate:v,y:b,marginTop:S,marginRight:x,marginBottom:T,marginLeft:k,ariaLabel:N,...L}),!Or(l)&&M!==null?j0([],qX({fill:l,fillOpacity:c,...L},function($,I,F,D,P){const z=D[e],{marginTop:q,marginRight:U,marginBottom:V,marginLeft:G}=e==="x"&&P.inset||P,Z=C??(z.bandwidth?"center":"right"),lt=O??(t==="top"?q:V)-3;return Z==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${Z}`,this.textAnchor=Z==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-lt:lt,this.dx=Z==="right"?U-3:Z==="left"?3-G:0,this.ariaLabel=`${N} label`,{facets:[[0]],channels:{text:{value:[WX(e,z,{anchor:t,label:M,labelAnchor:Z,labelArrow:R})]}}}})):null)}function k7t(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:l,inset:c=0,insetLeft:u=c,insetRight:f=c,dx:h=0,y:p=e==="y"?void 0:null,ariaLabel:g,...y}){return Tg(kX,e,n,{ariaLabel:`${g} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:p,...y,dx:t==="left"?+h-Fi+ +u:+h+Fi-f,anchor:"start",length:l,shape:t==="left"?O7t:D7t})}function M7t(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:l,inset:c=0,insetTop:u=c,insetBottom:f=c,dy:h=0,x:p=e==="x"?void 0:null,ariaLabel:g,...y}){return Tg(TX,e,n,{ariaLabel:`${g} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:p,...y,dy:t==="bottom"?+h-Fi-f:+h+Fi+ +u,anchor:"start",length:l,shape:t==="bottom"?N7t:I7t})}function C7t(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*i2):0),text:l,textAnchor:c=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:h=0,insetLeft:p=h,insetRight:g=h,dx:y=0,ariaLabel:v,y:b=e==="y"?void 0:null,..._}){return Tg(pX,e,n,{ariaLabel:`${v} tick label`},{facetAnchor:r,frameAnchor:i,text:l,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:s,y:b,..._,dx:t==="left"?+y-o-a+ +p:+y+ +o+ +a-g},function(S,x,T,k,M){f===void 0&&(this.fontVariant=VX(S)),l===void 0&&(M.text=jX(S,x,T,k,t))})}function A7t(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*i2):0),text:l,textAnchor:c=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:h=0,insetTop:p=h,insetBottom:g=h,dy:y=0,x:v=e==="x"?void 0:null,ariaLabel:b,..._}){return Tg(dX,e,n,{ariaLabel:`${b} tick label`},{facetAnchor:r,frameAnchor:i,text:l===void 0?null:l,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:s,x:v,..._,dy:t==="bottom"?+y+ +o+ +a-g:+y-o-a+ +p},function(S,x,T,k,M){f===void 0&&(this.fontVariant=VX(S)),l===void 0&&(M.text=jX(S,x,T,k,t))})}function LX(){const[e,t]=uh(...arguments);return PX("y",MX(t),e,t)}function FX(){const[e,t]=uh(...arguments);return PX("fy",CX(t),e,t)}function $X(){const[e,t]=uh(...arguments);return UX("x",AX(t),e,t)}function BX(){const[e,t]=uh(...arguments);return UX("fx",RX(t),e,t)}function PX(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,ariaLabel:a=`${e}-grid`,ariaHidden:l=!0,...c}){return Tg(Gf,e,n,{ariaLabel:a,ariaHidden:l},{y:r,x1:o,x2:s,...zX(c)})}function UX(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,ariaLabel:a=`${e}-grid`,ariaHidden:l=!0,...c}){return Tg(Hf,e,n,{ariaLabel:a,ariaHidden:l},{x:r,y1:o,y2:s,...zX(c)})}function zX({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function qX({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:l,shapeRendering:c,clip:u=!1},f){return[,e]=Oo(e),[,t]=ri(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:l,shapeRendering:c,clip:u,initializer:f}}function Tg(e,t,n,r,i,o){let s;function a(u,f,h,p,g,y){const v=u==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);const _=b.domain();let{interval:S,ticks:x,tickFormat:T,tickSpacing:k=t==="x"?80:35}=i;if(typeof x=="string"&&HX(b)&&(S=x,x=void 0),x===void 0&&(x=wg(S,b.type)??R7t(b,k)),u==null){if($u(x))u=ah(x);else if(Yp(x))u=Pk(x,...di(_));else if(b.interval){let C=b.interval;if(b.ticks){const[R,O]=di(_),N=(O-R)/C[n1];C=mF(C,N/x)??C,u=Pk(C,R,O)}else{u=_;const R=u.length;C=mF(C,R/x)??C,C!==b.interval&&(u=Pk(C,...di(u)))}if(C===b.interval){const R=Math.round(u.length/x);R>1&&(u=u.filter((O,N)=>N%R===0))}}else b.ticks?u=b.ticks(x):u=_;if(!b.ticks&&u.length&&u!==_){const C=new lg(_);u=u.filter(R=>C.has(R)),u.length||du(`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=[Fu(u)]:s[t]={scale:t,value:de}}o?.call(this,b,u,x,T,s);const M=Object.fromEntries(Object.entries(s).map(([C,R])=>[C,{...R,value:fn(u,R.value)}]));return v&&(f=y.filterFacets(u,M)),{data:u,facets:f,channels:M}}const l=no(i).initializer,c=e(n,no({...i,initializer:a},l));return n==null?(s=c.channels,c.channels={}):s={},r!==void 0&&Object.assign(c,r),c.clip===void 0&&(c.clip=!1),c}function R7t(e,t){const[n,r]=di(e.range());return(r-n)/t}function jX(e,t,n,r,i){return{value:kR(e,t,n,r,i)}}function kR(e,t,n,r,i){return typeof r=="function"&&!(e.type==="log"&&e.tickFormat)?r:r===void 0&&t&&Do(t)?D8t(e.type,t,i)??q0:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):typeof r=="string"&&e.domain().length>0?(Do(e.domain())?Fv:Oa)(r):r===void 0?q0:Li(r)}function Pk(e,t,n){return e.range(t,e.offset(e.floor(n)))}const N7t={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},I7t={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},O7t={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},D7t={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function VX(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function WX(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&HX(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){const s=DG(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){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 YX(e="auto"){return Or(e)?!1:typeof e=="boolean"?e:Us(e,"labelArrow",["auto","up","right","down","left"])}function HX(e){return Do(e.domain())}function WF(e,t){if(t==null)return t;const n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function L7t(e,{opacity:t,...n}={}){if(!qd(e)&&!PG(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return GX(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ri(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function F7t(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:Or(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},l){const[c,u]=Oo(t),[f,h]=Oo(r),p=WF(l,c),g=WF(l,f),y=s*s*Math.PI;return n=ri(n)[1],i=ri(i)[1],o=ri(o)[1],GX(e,a,(v,b,_,S)=>v.append("svg").attr("viewBox","-8 -8 16 16").attr("width",_).attr("height",S).attr("fill",c==="color"?x=>p.scale(x):u).attr("fill-opacity",n).attr("stroke",f==="color"?x=>g.scale(x):h).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",x=>{const T=nu();return e.scale(x).draw(T,y),T}))}function GX(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=KG(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:l=s,marginLeft:c=0,className:u,style:f,width:h}=t;const p=o3(t);u=yR(u),i=kR(e.scale,e.domain,void 0,i);const g=_n("div",p).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",ui(o,"normal")).call(vR,f).node()}const o2=new Map([["symbol",F7t],["color",XX],["opacity",P7t]]);function $7t(e={}){for(const[t,n]of o2){const r=e[t];if(nd(r)){const i=o3(e);let o;if(t==="symbol"){const{fill:s,stroke:a=s===void 0&&nd(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(l5(t,r,o),MR(i,r,e),s=>nd(e[s])?l5(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function B7t(e,t,n={}){return(r,i)=>{if(!o2.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return o2.get(r)(e[r],MR(t,n[r],i),o=>e[o])}}function MR({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return J8t(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function XX(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return L7t(e,n);case"ramp":return i7t(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function P7t({type:e,interpolate:t,...n},{legend:r=!0,color:i=ss(0,0,0),...o}){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 XX({type:e,...n,interpolate:U7t(i)},{legend:r,...o})}function U7t(e){const{r:t,g:n,b:r}=ss(e)||ss(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function z7t(e,t,n){const r=[];for(const[i,o]of o2){const s=n[i];if(s?.legend&&i in e){const a=o(e[i],MR(t,e[i],s),l=>e[l]);a!=null&&r.push(a)}}return r}function h3(e={},t="x"){return KH(e)?e:{...e,[t]:de}}function d3(e={},t="y"){return ZH(e)?e:{...e,[t]:de}}function JX(e,t){if(t.length===1)return{data:e,facets:t};const n=tv(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=Qy(e);const o=e[WH]=new Uint32Array(n+i);t=t.map(a=>Qy(a,Uint32Array));let s=n;r.fill(0);for(const a of t)for(let l=0,c=a.length;l{({data:y,facets:v}=JX(y,v));const _=e==null?void 0:u(e2(fn(y,e),b?.[n])),S=fn(y,t,Float64Array),x=fn(y,l),T=o&&o(y,_,S,x),k=tv(y),M=h(new Float64Array(k)),C=g(new Float64Array(k)),R=[];for(const O of v){const N=_?Array.from(eh(O,L=>_[L]).values()):[O];if(T)for(const L of N)L.sort(T);for(const L of N){let $=0,I=0;s&&L.reverse();for(const F of L){const D=S[F];D<0?$=C[F]=(M[F]=$)+D:D>0?I=C[F]=(M[F]=I)+D:C[F]=M[F]=I}}R.push(N)}return i&&i(R,M,C,x),{data:y,facets:v}}),c,f,p]}function H7t(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return G7t;case"center":case"silhouette":return X7t;case"wiggle":return tJ}throw new Error(`unknown offset: ${e}`)}}function QX(e,t){let n=0,r=0;for(const i of e){const o=t[i];or&&(r=o)}return[n,r]}function G7t(e,t,n){for(const r of e)for(const i of r){const[o,s]=QX(i,n);for(const a of i){const l=1/(s-o||1);t[a]=l*(t[a]-o),n[a]=l*(n[a]-o)}}}function X7t(e,t,n){for(const r of e){for(const i of r){const[o,s]=QX(i,n);for(const a of i){const l=(s+o)/2;t[a]-=l,n[a]-=l}}eJ(r,t,n)}nJ(e,t,n)}function tJ(e,t,n,r){for(const i of e){const o=new yd;let s=0;for(const a of i){let l=-1;const c=a.map(p=>Math.abs(n[p]-t[p])),u=a.map(p=>{l=r?r[p]:++l;const g=n[p]-t[p],y=o.has(l)?g-o.get(l):0;return o.set(l,g),y}),f=[0,...d_t(u)];for(const p of a)t[p]+=s,n[p]+=s;const h=el(c);h&&(s-=el(c,(p,g)=>(u[g]/2+f[g])*p)/h)}eJ(i,t,n)}nJ(e,t,n)}function eJ(e,t,n){const r=Dr(e,i=>Dr(i,o=>t[o]));for(const i of e)for(const o of i)t[o]-=r,n[o]-=r}function nJ(e,t,n){const r=e.length;if(r===1)return;const i=e.map(a=>a.flat()),o=i.map(a=>(Dr(a,l=>t[l])+Vr(a,l=>n[l]))/2),s=Dr(o);for(let a=0;a(i,o)=>e(r[i],r[o])}function Z7t(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function Q7t(e){return m3(e,(t,n,r,i)=>mC(Fu(t),o=>el(o,s=>r[s]),o=>i[o]))}function tOt(e){return m3(e,(t,n,r,i)=>mC(Fu(t),o=>n[vC(o,s=>r[s])],o=>i[o]))}function YF(e){return m3(e,(t,n,r,i)=>{const o=Fu(t),s=mC(o,f=>n[vC(f,h=>r[h])],f=>i[f]),a=r0(o,f=>el(f,h=>r[h]),f=>i[f]),l=[],c=[];let u=0;for(const f of s)u<0?(u+=a.get(f),l.push(f)):(u-=a.get(f),c.push(f));return c.reverse().concat(l)})}function HF(e){return t=>{const n=fn(t,e);return(r,i)=>Ra(n[r],n[i])}}function eOt(e){return t=>Lu(t)?(n,r)=>e(t[n],t[r]):(n,r)=>e(t.get(n),t.get(r))}function nOt(e){return m3(Ra,()=>e)}function m3(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");const s=new yd(t(n,r,i,o).map((a,l)=>[a,l]));return(a,l)=>e(s.get(o[a]),s.get(o[l]))}}const rOt={ariaLabel:"rect"};class y3 extends vr{constructor(t,n={}){const{x1:r,y1:i,x2:o,y2:s}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,rOt),CR(this,n),AR(this,n)}render(t,n,r,i,o){const{x:s,y:a}=n;let{x1:l,y1:c,x2:u,y2:f}=r;const{marginTop:h,marginRight:p,marginBottom:g,marginLeft:y,width:v,height:b}=i,{projection:_}=o,{insetTop:S,insetRight:x,insetBottom:T,insetLeft:k}=this,{rx:M,ry:C,rx1y1:R,rx1y2:O,rx2y1:N,rx2y2:L}=this;(l||u)&&!_&&hc(s)&&(l=u=null),(c||f)&&!_&&hc(a)&&(c=f=null);const $=s?.bandwidth?s.bandwidth():0,I=a?.bandwidth?a.bandwidth():0;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{},0,0).call(F=>F.selectAll().data(t).enter().call(R||O||N||L?D=>D.append("path").call(or,this).call(RR,l&&u?P=>l[P]+(u[P]l[P]+k:y+k,c&&f?P=>c[P]+(f[P]c[P]+S:h+S,l&&u?P=>u[P]-(u[P]l[P]+$-x:v-p-x,c&&f?P=>f[P]-(f[P]c[P]+I-T:b-g-T,this).call(Wr,this,r):D=>D.append("rect").call(or,this).attr("x",l?u?P=>Math.min(l[P],u[P])+k:P=>l[P]+k:y+k).attr("y",c?f?P=>Math.min(c[P],f[P])+S:P=>c[P]+S:h+S).attr("width",l?u?P=>Math.max(0,Math.abs(u[P]-l[P])+$-k-x):$-k-x:v-p-y-x-k).attr("height",c?f?P=>Math.max(0,Math.abs(c[P]-f[P])+I-S-T):I-S-T:b-h-g-S-T).call(me,"rx",M).call(me,"ry",C).call(Wr,this,r))).node()}}function CR(e,{inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={}){e.insetTop=kr(n),e.insetRight=kr(r),e.insetBottom=kr(i),e.insetLeft=kr(o)}function AR(e,{r:t,rx:n,ry:r,rx1:i=t,ry1:o=t,rx2:s=t,ry2:a=t,rx1y1:l=i!==void 0?+i:o!==void 0?+o:0,rx1y2:c=i!==void 0?+i:a!==void 0?+a:0,rx2y1:u=s!==void 0?+s:o!==void 0?+o:0,rx2y2:f=s!==void 0?+s:a!==void 0?+a:0}={}){l||c||u||f?(e.rx1y1=l,e.rx1y2=c,e.rx2y1=u,e.rx2y2=f):(e.rx=ui(n,"auto"),e.ry=ui(r,"auto"))}function RR(e,t,n,r,i,o){const{rx1y1:s,rx1y2:a,rx2y1:l,rx2y2:c}=o;typeof t!="function"&&(t=Li(t)),typeof n!="function"&&(n=Li(n)),typeof r!="function"&&(r=Li(r)),typeof i!="function"&&(i=Li(i));const u=Math.max(Math.abs(s+l),Math.abs(a+c)),f=Math.max(Math.abs(s+a),Math.abs(l+c));e.attr("d",h=>{const p=t(h),g=n(h),y=r(h),v=i(h),b=p>y,_=g>v,S=b?y:p,x=b?p:y,T=_?v:g,k=_?g:v,M=Math.min(1,(x-S)/u,(k-T)/f),C=M*(b?_?c:l:_?a:s),R=M*(b?_?a:s:_?c:l),O=M*(b?_?s:a:_?l:c),N=M*(b?_?l:c:_?s:a);return`M${S},${T+Vb(C,N)}A${C},${C} 0 0 ${C<0?0:1} ${S+jb(C,N)},${T}H${x-jb(R,O)}A${R},${R} 0 0 ${R<0?0:1} ${x},${T+Vb(R,O)}V${k-Vb(O,R)}A${O},${O} 0 0 ${O<0?0:1} ${x-jb(O,R)},${k}H${S+jb(N,C)}A${N},${N} 0 0 ${N<0?0:1} ${S},${k-Vb(N,C)}Z`})}function jb(e,t){return t<0?e:Math.abs(e)}function Vb(e,t){return t<0?Math.abs(e):e}function NR(e,t){return new y3(e,rX(iX(t)))}function s2(e,t={}){return _g(t)||(t={...t,y:gi,x2:de,interval:1}),new y3(e,p3(iX(h3(t))))}function a2(e,t={}){return _g(t)||(t={...t,x:gi,y2:de,interval:1}),new y3(e,g3(rX(d3(t))))}const iOt={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},oOt={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class rJ extends vr{constructor(t={}){const{anchor:n=null}=t;super(ry,void 0,t,n==null?iOt:oOt),this.anchor=XH(n,"anchor",["top","right","bottom","left"]),CR(this,t),n||AR(this,t)}render(t,n,r,i,o){const{marginTop:s,marginRight:a,marginBottom:l,marginLeft:c,width:u,height:f}=i,{anchor:h,insetTop:p,insetRight:g,insetBottom:y,insetLeft:v}=this,{rx:b,ry:_,rx1y1:S,rx1y2:x,rx2y1:T,rx2y2:k}=this,M=c+v,C=u-a-g,R=s+p,O=f-l-y;return _n(h?"svg:line":S||x||T||k?"svg:path":"svg:rect",o).datum(0).call(Ar,this,i,o).call(or,this).call(Wr,this,r).call(yr,this,{}).call(h==="left"?N=>N.attr("x1",M).attr("x2",M).attr("y1",R).attr("y2",O):h==="right"?N=>N.attr("x1",C).attr("x2",C).attr("y1",R).attr("y2",O):h==="top"?N=>N.attr("x1",M).attr("x2",C).attr("y1",R).attr("y2",R):h==="bottom"?N=>N.attr("x1",M).attr("x2",C).attr("y1",O).attr("y2",O):S||x||T||k?N=>N.call(RR,M,R,C,O,this):N=>N.attr("x",M).attr("y",R).attr("width",C-M).attr("height",O-R).attr("rx",b).attr("ry",_)).node()}}function IR(e){return new rJ(e)}const Uk={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},sOt=new Set(["geometry","href","src","ariaLabel","scales"]);class iJ extends vr{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&$u(t)&&rG(t)&&(n={...n,title:de});const{x:r,y:i,x1:o,x2:s,y1:a,y2:l,anchor:c,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:g,fontVariant:y,fontWeight:v,lineHeight:b=1,lineWidth:_=20,frameAnchor:S,format:x,textAnchor:T="start",textOverflow:k,textPadding:M=8,title:C,pointerSize:R=12,pathFilter:O="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&l!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:l==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:l,scale:"y",optional:a==null},title:{value:C,optional:!0}},n,Uk),this.anchor=n5(c,"anchor"),this.preferredAnchor=n5(u,"preferredAnchor"),this.frameAnchor=i1(S),this.textAnchor=ui(T,"middle"),this.textPadding=+M,this.pointerSize=+R,this.pathFilter=Di(O),this.lineHeight=+b,this.lineWidth=+_,this.textOverflow=hX(k),this.monospace=!!f,this.fontFamily=Di(h),this.fontSize=kr(p),this.fontStyle=Di(g),this.fontVariant=Di(y),this.fontWeight=Di(v);for(const N in Uk)N in this.channels&&(this[N]=Uk[N]);this.splitLines=mX(this),this.clipLine=yX(this),this.format=typeof x=="string"||typeof x=="function"?{title:x}:{...x}}render(t,n,r,i,o){const s=this,{x:a,y:l,fx:c,fy:u}=n,{ownerSVGElement:f,document:h}=o,{anchor:p,monospace:g,lineHeight:y,lineWidth:v}=this,{textPadding:b,pointerSize:_,pathFilter:S}=this,{marginTop:x,marginLeft:T}=i,{x1:k,y1:M,x2:C,y2:R,x:O=k??C,y:N=M??R}=r,L=c?c(t.fx)-T:0,$=u?u(t.fy)-x:0,[I,F]=_c(this,i),D=XG(r,I),P=JG(r,F),z=g?SR:xR,q=z(h0);let U,V;"title"in r?(U=GF.call(this,{title:r.channels.title},n),V=uOt):(U=GF.call(this,r.channels,n),V=fOt);const G=_n("svg:g",o).call(Ar,this,i,o).call(gX,this).call(yr,this,{x:O&&a,y:N&&l}).call(pt=>pt.selectAll().data(t).enter().append("g").attr("transform",dt=>`translate(${Math.round(D(dt))},${Math.round(P(dt))})`).call(or,this).call(dt=>dt.append("path").attr("filter",S)).call(dt=>dt.append("text").each(function(at){const yt=Er(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");const nt=V.call(s,at,t,U,n,r);if(typeof nt=="string")for(const gt of s.splitLines(nt))Z(yt,{value:s.clipLine(gt)});else{const gt=new Set;for(const vt of nt){const{label:st=""}=vt;st&>.has(st)||(gt.add(st),Z(yt,vt))}}})));function Z(pt,{label:dt,value:at,color:yt,opacity:nt}){dt??="",at??="";const gt=yt!=null||nt!=null;let vt,st=v*100;const[Bt]=V0(dt,st,z,q);if(Bt>=0)dt=dt.slice(0,Bt).trimEnd()+h0,vt=at.trim(),at="";else{(dt||!at&&!gt)&&(at=" "+at);const[zt]=V0(at,st-z(dt),z,q);zt>=0&&(vt=at.trim(),at=at.slice(0,zt).trimEnd()+h0)}const Dt=pt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("​");dt&&Dt.append("tspan").attr("font-weight","bold").text(dt),at&&Dt.append(()=>h.createTextNode(at)),gt&&Dt.append("tspan").text(" ■").attr("fill",yt).attr("fill-opacity",nt).style("user-select","none"),vt&&Dt.append("title").text(vt)}function lt(){const{width:pt,height:dt}=i.facet??i;G.selectChildren().each(function(at){let{x:yt,width:nt,height:gt}=this.getBBox();nt=Math.round(nt),gt=Math.round(gt);let vt=p;if(vt===void 0){const Dt=D(at)+L,zt=P(at)+$,jt=Dt+nt+_+b*20,Xt=zt+gt+_+b*20;vt=jt&&Ct?Xt&&Pt?s.preferredAnchor:Pt?"bottom":"top":Xt&&Pt?jt?"left":"right":(jt||Ct)&&(Xt||Pt)?`${Pt?"bottom":"top"}-${jt?"left":"right"}`:s.preferredAnchor}const st=this.firstChild,Bt=this.lastChild;if(st.setAttribute("d",cOt(vt,_,b,nt,gt)),yt)for(const Dt of Bt.childNodes)Dt.setAttribute("x",-yt);Bt.setAttribute("y",`${+aOt(vt,Bt.childNodes.length,y).toFixed(6)}em`),Bt.setAttribute("transform",`translate(${lOt(vt,_,b,nt,gt)})`)}),G.attr("visibility",null)}return t.length&&(G.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(lt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(lt)),G.node()}}function oJ(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=yl(t,n)),new iJ(e,{...r,x:t,y:n})}function aOt(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function lOt(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 cOt(e,t,n,r,i){const o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function GF(e,t){const n={};let r=this.format;r=XF(r,e,"x"),r=XF(r,e,"y"),this.format=r;for(const i in r){const o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{const s=i5(e,i);s&&(n[i]=s)}}for(const i in e){if(i in n||i in r||sOt.has(i)||(i==="x"||i==="y")&&e.geometry)continue;const o=i5(e,i);if(o){if(o.scale==null&&o.defaultScale==="color")continue;n[i]=o}}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(const i in n){const o=this.format[i];if(typeof o=="string"){const s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Do(s)?Fv:Oa)(o)}else if(o===void 0||o===!0){const s=t[i];this.format[i]=s?.bandwidth?kR(s,s.domain()):q0}}return n}function XF(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 o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function uOt(e,t,{title:n}){return this.format.title(n.value[e],e)}function*fOt(e,t,n,r,i){for(const o in n){if(o==="fx"||o==="fy"){yield{label:l2(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;const s=n[o];if(o==="x2"&&"x1"in n)yield{label:KF(r,n,"x"),value:JF(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:KF(r,n,"y"),value:JF(this.format.y2,n.y1,s,e)};else{const a=s.value[e],l=s.scale;if(!Bi(a)&&l==null)continue;yield{label:l2(r,n,o),value:this.format[o](a,e),color:l==="color"?i[o][e]:null,opacity:l==="opacity"?i[o][e]:null}}}}function JF(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 KF(e,t,n){const r=l2(e,t,`${n}1`,n),i=l2(e,t,`${n}2`,n);return r===i?r:`${r}–${i}`}function l2(e,t,n,r=n){const i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function OR(e={}){const{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,l=yR(e.className),c=e.marks===void 0?[]:QF(e.marks);c.push(...vOt(c));const u=mOt(t,e),f=new Map;for(const q of c){const U=t$(q,u,e);U&&f.set(q,U)}const h=new Map;u&&fm(h,[u],e),fm(h,f,e);const p=QF(bOt(c,h,e));for(const q of p){const U=t$(q,u,e);U&&f.set(q,U)}c.unshift(...p);let g=hIt(h,e);if(g!==void 0){const q=u?Lk(g,u):void 0;for(const V of c){if(V.facet===null||V.facet==="super")continue;const G=f.get(V);G!==void 0&&(G.facetsIndex=V.fx!=null||V.fy!=null?Lk(g,G):q)}const U=new Set;for(const{facetsIndex:V}of f.values())V?.forEach((G,Z)=>{G?.length>0&&U.add(Z)});g.forEach(0V.empty=!U.has(G):V=>V.empty=!1);for(const V of c)if(V.facet==="exclude"){const G=f.get(V);G!==void 0&&(G.facetsIndex=gIt(G.facetsIndex))}}for(const q of qr.keys())nd(e[q])&&q!=="fx"&&q!=="fy"&&h.set(q,[]);const y=new Map;for(const q of c){if(y.has(q))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:U,channels:V}=f.get(q)??{},{data:G,facets:Z,channels:lt}=q.initialize(U,V,e);DR(lt,e),y.set(q,{data:G,facets:Z,channels:lt})}const v=a5(fm(h,y,e),e),b=n7t(v,c,e);oIt(v,b);const _=RF(v),{fx:S,fy:x}=_,T=S||x?LG(v,b):b,k=S||x?kOt(_,b):b,M=o3(e),C=M.document,R=FS("svg").call(C.documentElement);let O=R;M.ownerSVGElement=R,M.className=l,M.projection=EIt(e,T),M.path=function(){return Qv(this.projection??RIt(_))},M.filterFacets=(q,U)=>Lk(g,{channels:U,groups:pR(q,U)}),M.getMarkState=q=>{const U=y.get(q),V=f.get(q);return{...U,channels:{...U.channels,...V?.channels}}},M.dispatchValue=q=>{O.value!==q&&(O.value=q,O.dispatchEvent(new M.document.defaultView.Event("input",{bubbles:!0})))};const N=new Set;for(const[q,U]of y)if(q.initializer!=null){const V=q.facet==="super"?k:T,G=q.initializer(U.data,U.facets,U.channels,_,V,M);if(G.data!==void 0&&(U.data=G.data),G.facets!==void 0&&(U.facets=G.facets),G.channels!==void 0){const{fx:Z,fy:lt,...pt}=G.channels;gOt(pt),Object.assign(U.channels,pt);for(const dt of Object.values(pt)){const{scale:at}=dt;at!=null&&!Q8t(qr.get(at))&&(sJ(dt,e),N.add(at))}(Z!=null||lt!=null)&&f.set(q,!0)}}if(N.size){const q=new Map;fm(q,y,e,Z=>N.has(Z)),fm(h,y,e,Z=>N.has(Z));const U=TOt(a5(q,e),v),{scales:V,...G}=RF(U);Object.assign(v,U),Object.assign(_,G),Object.assign(_.scales,V)}let L,$;g!==void 0&&(L={x:S?.domain(),y:x?.domain()},g=dIt(g,L),$=pIt(S,x,b));for(const[q,U]of y)U.values=q.scale(U.channels,_,M);const{width:I,height:F}=b;Er(R).attr("class",l).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",I).attr("height",F).attr("viewBox",`0 0 ${I} ${F}`).attr("aria-label",s).attr("aria-description",a).call(q=>q.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(vR,n);for(const q of c){const{channels:U,values:V,facets:G}=y.get(q);if(g===void 0||q.facet==="super"){let Z=null;if(G&&(Z=G[0],Z=q.filter(Z,U,V),Z.length===0))continue;const lt=q.render(Z,_,V,k,M);if(lt==null)continue;R.appendChild(lt)}else{let Z;for(const lt of g){if(!(q.facetAnchor?.(g,L,lt)??!lt.empty))continue;let pt=null;if(G){const at=f.has(q);if(pt=G[at?lt.i:0],pt=q.filter(pt,U,V),pt.length===0)continue;!at&&pt===G[0]&&(pt=rd(pt)),pt.fx=lt.x,pt.fy=lt.y,pt.fi=lt.i}const dt=q.render(pt,_,V,T,M);if(dt!=null){(Z??=Er(R).append("g")).append(()=>dt).datum(lt);for(const at of["aria-label","aria-description","aria-hidden","transform"])dt.hasAttribute(at)&&(Z.attr(at,dt.getAttribute(at)),dt.removeAttribute(at))}}Z?.selectChildren().each($)}}const D=z7t(v,M,e),{figure:P=r!=null||i!=null||o!=null||D.length>0}=e;P&&(O=C.createElement("figure"),O.className=`${l}-figure`,O.style.maxWidth="initial",r!=null&&O.append(ZF(C,r,"h2")),i!=null&&O.append(ZF(C,i,"h3")),O.append(...D,R),o!=null&&O.append(hOt(C,o)),"value"in R&&(O.value=R.value,delete R.value)),O.scale=fIt(_.scales),O.legend=B7t(v,M,e);const z=qNt();return z>0&&Er(R).append("text").attr("x",I).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${z.toLocaleString("en-US")} warning${z===1?"":"s"}. Please check the console.`),O}function ZF(e,t,n){if(t.ownerDocument)return t;const r=e.createElement(n);return r.append(t),r}function hOt(e,t){const n=e.createElement("figcaption");return n.append(t),n}function QF(e){return e.flat(1/0).filter(t=>t!=null).map(dOt)}function dOt(e){return typeof e.render=="function"?e:new pOt(e)}class pOt extends vr{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}}function DR(e,t){for(const n in e)sJ(e[n],t);return e}function sJ(e,t){const{scale:n,transform:r=!0}=e;if(n==null||!r)return;const{type:i,percent:o,interval:s,transform:a=o?l=>l==null?NaN:l*100:eG(s,i)}=t[n]??{};a!=null&&(e.value=gr(e.value,a),e.transform=!1)}function gOt(e){for(const t in e)_G(t,e[t])}function fm(e,t,n,r=P8t){for(const{channels:i}of t.values())for(const o in i){const s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!MIt(n)){const l=n.x?.domain===void 0,c=n.y?.domain===void 0;if(l||c){const[u,f]=AIt(s);l&&zk(e,"x",u),c&&zk(e,"y",f)}}}else zk(e,a,s)}return e}function zk(e,t,n){const r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function mOt(e,t){if(e==null)return;const{x:n,y:r}=e;if(n==null&&r==null)return;const i=P0(e.data);if(i==null)throw new Error("missing facet data");const o={};n!=null&&(o.fx=rv(i,{value:n,scale:"fx"})),r!=null&&(o.fy=rv(i,{value:r,scale:"fy"})),DR(o,t);const s=pR(i,o);return{channels:o,groups:s,data:e.data}}function t$(e,t,n){if(e.facet===null||e.facet==="super")return;const{fx:r,fy:i}=e;if(r!=null||i!=null){const l=P0(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=rv(l,{value:r,scale:"fx"})),i!=null&&(c.fy=rv(l,{value:i,scale:"fy"})),DR(c,n),{channels:c,groups:pR(l,c)}}if(t===void 0)return;const{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&tv(P0(e.data))===tv(a)&&du(`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 yOt(e,t={}){return no({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function vOt(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:o}=r;i=/^x$/i.test(i)?a3:/^y$/i.test(i)?av:s3,r=i(yOt(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===av?"left":"bottom");const s=oJ(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function bOt(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:l,grid:c,facet:u={},facet:{axis:f=l,grid:h}=u,x:{axis:p=l,grid:g=p===null?null:c}=i,y:{axis:y=l,grid:v=y===null?null:c}=o,fx:{axis:b=f,grid:_=b===null?null:h}=s,fy:{axis:S=f,grid:x=S===null?null:h}=a}=n;(r||!nd(i)&&!e$("x",e))&&(p=g=null),(r||!nd(o)&&!e$("y",e))&&(y=v=null),t.has("fx")||(b=_=null),t.has("fy")||(S=x=null),p===void 0&&(p=!Hb(e,"x")),y===void 0&&(y=!Hb(e,"y")),b===void 0&&(b=!Hb(e,"fx")),S===void 0&&(S=!Hb(e,"fy")),p===!0&&(p="bottom"),y===!0&&(y="left"),b===!0&&(b=p==="top"||p===null?"bottom":"top"),S===!0&&(S=y==="right"||y===null?"left":"right");const T=[];return Yb(T,x,FX,a),Wb(T,S,NX,"right","left",u,a),Yb(T,_,BX,s),Wb(T,b,IX,"top","bottom",u,s),Yb(T,v,LX,o),Wb(T,y,ER,"left","right",n,o),Yb(T,g,$X,i),Wb(T,p,TR,"bottom","top",n,i),T}function Wb(e,t,n,r,i,o,s){if(!t)return;const a=_Ot(t);s=wOt(a?r:t,o,s);const{line:l}=s;(n===ER||n===TR)&&l&&!U0(l)&&e.push(IR(xOt(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function Yb(e,t,n,r){!t||U0(t)||e.push(n(SOt(t,r)))}function _Ot(e){return/^\s*both\s*$/i.test(e)}function wOt(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:l,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h=t.label,labelAnchor:p,labelArrow:g=t.labelArrow,labelOffset:y}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:l,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h,labelAnchor:p,labelArrow:g,labelOffset:y}}function xOt(e){const{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function SOt(e,{stroke:t=r1(e)?e:void 0,ticks:n=EOt(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function EOt(e){switch(typeof e){case"number":return!0;case"string":return!r1(e)}return $u(e)||typeof e?.range=="function"}function Hb(e,t){const n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function e$(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 TOt(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 kOt({fx:e,fy:t},n){const{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:l}=dR(n),c=e&&n$(e),u=t&&n$(t);return{marginTop:t?u[0]:r,marginRight:e?a-c[1]:i,marginBottom:t?l-u[1]:o,marginLeft:e?c[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:l}}function n$(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 vt=e2(fn(yt,_),gt?.[S]),st=fn(yt,C),Bt=fn(yt,G),Dt=fn(yt,Z),zt=aR(l,{z:st,fill:Bt,stroke:Dt}),jt=[],Ct=[],Xt=vt&&T([]),Pt=st&&V([]),Lt=Bt&&pt([]),Gt=Dt&&at([]),we=e&&f([]),Jt=e&&p([]),Be=t&&y([]),Ye=t&&b([]),Mn=IOt(e,t,yt);let He=0;for(const $e of l)$e.initialize(yt);s&&s.initialize(yt),o&&o.initialize(yt);for(const $e of nt){const Ke=[];for(const sr of l)sr.scope("facet",$e);s&&s.scope("facet",$e),o&&o.scope("facet",$e);for(const[sr,Pi]of id($e,zt))for(const[Ui,hs]of id(Pi,vt))for(const[li,Qr]of Mn(hs))if(zt&&(Qr.z=sr),!(o&&!o.reduce(li,Qr))){Ke.push(He++),Ct.push(i.reduceIndex(li,yt,Qr)),vt&&Xt.push(Ui),st&&Pt.push(zt===st?sr:st[(li.length>0?li:hs)[0]]),Bt&&Lt.push(zt===Bt?sr:Bt[(li.length>0?li:hs)[0]]),Dt&&Gt.push(zt===Dt?sr:Dt[(li.length>0?li:hs)[0]]),we&&(we.push(Qr.x1),Jt.push(Qr.x2)),Be&&(Be.push(Qr.y1),Ye.push(Qr.y2));for(const _l of l)_l.reduce(li,Qr);s&&s.reduce(li,Qr)}jt.push(Ke)}return yG(jt,s,a),{data:Ct,facets:jt}}),...!Tf(l,"x")&&(u?{x1:u,x2:h,x:t2(u,h)}:{x:k,x1:N,x2:L}),...!Tf(l,"y")&&(g?{y1:g,y2:v,y:t2(g,v)}:{y:M,y1:$,y2:I}),...x&&{[S]:x},...Object.fromEntries(l.map(({name:yt,output:nt})=>[yt,nt]))}}function PR({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function c2(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...xg(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=o),e.thresholds=cJ(e.thresholds,e.interval),e}function COt(e){let{x:t,y:n}=e;return t=c2(t,e),n=c2(n,e),[t.value,n.value]=yl(t.value,n.value),{x:t,y:n}}function r$(e){if(e==null)return;const{value:t,cumulative:n,domain:r=di,thresholds:i}=e,o=s=>{let a=fn(s,t),l;if(Do(a)||NOt(i)){a=gr(a,GH,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Yp(i)?i(a,u,f):i;typeof h=="number"&&(h=qq(u,f,h)),Yp(h)&&(r===di&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),l=h}else{a=ts(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Yp(i)?i(a,u,f):i;if(typeof h=="number")if(r===di){let p=Ry(u,f,h);if(isFinite(p))if(p>0){let g=Math.round(u/p),y=Math.round(f/p);g*p<=u||--g,y*p>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?OOt:UR)(c,l,a),c};return o.label=bc(t),o}function cJ(e,t,n=i$){if(e===void 0)return t===void 0?n:wg(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return x_t;case"scott":return rq;case"sturges":return yC;case"auto":return i$}return YS(e)}return e}function AOt(e,t){return hG(e,t,uJ)}function uJ(e,t,n){return oR(e,t,n,fJ)}function fJ(e,t,n){return sR(e,t,n,hJ)}function hJ(e,t){return t3(e,t,ROt)}function ROt(e){switch(`${e}`.toLowerCase()){case"x":return LOt;case"x1":return $Ot;case"x2":return BOt;case"y":return FOt;case"y1":return POt;case"y2":return UOt;case"z":return vG}throw new Error(`invalid bin reduce: ${e}`)}function i$(e,t,n){return Math.min(200,rq(e,t,n))}function NOt(e){return q8t(e)||$u(e)&&Do(e)}function IOt(e,t,n){const r=e?.(n),i=t?.(n);return r&&i?function*(o){const s=r.bin(o);for(const[a,[l,c]]of r.entries()){const u=i.bin(s[a]);for(const[f,[h,p]]of i.entries())yield[u[f],{data:n,x1:l,y1:h,x2:c,y2:p}]}}:r?function*(o){const s=r.bin(o);for(const[a,[l,c]]of r.entries())yield[s[a],{data:n,x1:l,x2:c}]}:function*(o){const s=i.bin(o);for(const[a,[l,c]]of i.entries())yield[s[a],{data:n,y1:l,y2:c}]}}function UR(e,t,n){return t=ts(t),r=>{const i=e.map(()=>[]);for(const o of r)i[iS(t,n[o])-1]?.push(o);return i}}function OOt(e,t,n){const r=UR(e,t,n);return i=>{const o=r(i);for(let s=1,a=o.length;s{const o=r(i);for(let s=o.length-2;s>=0;--s){const a=o[s+1],l=o[s];for(const c of a)l.push(c)}return o}}function dJ(e,t){const n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}const LOt={reduceIndex(e,t,{x1:n,x2:r}){return dJ(n,r)}},FOt={reduceIndex(e,t,{y1:n,y2:r}){return dJ(n,r)}},$Ot={reduceIndex(e,t,{x1:n}){return n}},BOt={reduceIndex(e,t,{x2:n}){return n}},POt={reduceIndex(e,t,{y1:n}){return n}},UOt={reduceIndex(e,t,{y2:n}){return n}},zOt={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class v3 extends vr{constructor(t,n={}){const{x1:r,y1:i,x2:o,y2:s,z:a,curve:l,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:lh(n),optional:!0}},n,zOt),this.z=a,this.curve=LR(l,c)}filter(t){return t}render(t,n,r,i,o){const{x1:s,y1:a,x2:l=s,y2:c=a}=r;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n,0,0).call(u=>u.selectAll().data(HG(t,[s,a,l,c],this,r)).enter().append("path").call(or,this).call(r2,this,r).attr("d",LA().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>l[f]).y1(f=>c[f]))).node()}}function p5(e,t){return t===void 0?Y0(e,{x:GS,y:Zy}):new v3(e,t)}function lv(e,t){const{y:n=gi,...r}=$R(t);return new v3(e,p3(h3({...r,y1:n,y2:void 0},n===gi?"x2":"x")))}function Y0(e,t){const{x:n=gi,...r}=FR(t);return new v3(e,g3(d3({...r,x1:n,x2:void 0},n===gi?"y2":"y")))}const qOt={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class pJ extends vr{constructor(t,n={}){const{x1:r,y1:i,x2:o,y2:s,curve:a,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,qOt),this.curve=aJ(a,l),Sg(this,n)}project(t,n,r){this.curve!==W0&&super.project(t,n,r)}render(t,n,r,i,o){const{x1:s,y1:a,x2:l=s,y2:c=a}=r,{curve:u}=this;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(or,this).attr("d",u===W0&&o.projection?jOt(o.path(),s,a,l,c):h=>{const p=nu(),g=u(p);return g.lineStart(),g.point(s[h],a[h]),g.point(l[h],c[h]),g.lineEnd(),p}).call(Wr,this,r).call(f1,this,r,o)).node()}}function jOt(e,t,n,r,i){return t=ts(t),n=ts(n),r=ts(r),i=ts(i),o=>e({type:"LineString",coordinates:[[t[o],n[o]],[r[o],i[o]]]})}function gJ(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=u2(t,n,r),[o,s]=u2(i,o,s),new pJ(e,{...a,x1:n,x2:r,y1:o,y2:s})}function u2(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 VOt={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class mJ extends vr{constructor(t,n={}){const{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:l=60,headLength:c=8,inset:u=0,insetStart:f=u,insetEnd:h=u,sweep:p}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,VOt),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=WOt(p)}render(t,n,r,i,o){const{x1:s,y1:a,x2:l=s,y2:c=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:p,headLength:g,insetStart:y,insetEnd:v}=this,b=u?x=>u[x]:Li(f===void 0?1:f),_=p*i2/2,S=g/1.5;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(x=>x.selectAll().data(t).enter().append("path").call(or,this).attr("d",T=>{let k=s[T],M=a[T],C=l[T],R=c[T];const O=Math.hypot(C-k,R-M);if(O<=y+v)return null;let N=Math.atan2(R-M,C-k);const L=Math.min(S*b(T),O/3),$=this.sweep(k,M,C,R)*h*i2,I=Math.hypot(O/Math.tan($),O)/2;if(y||v)if(I<1e5){const lt=Math.sign($),[pt,dt]=YOt([k,M],[C,R],I,lt);if(y&&([k,M]=o$([pt,dt,I],[k,M,y],-lt*Math.sign(y))),v){const[at,yt]=o$([pt,dt,I],[C,R,v],lt*Math.sign(v));N+=Math.atan2(yt-dt,at-pt)-Math.atan2(R-dt,C-pt),C=at,R=yt}}else{const lt=C-k,pt=R-M,dt=Math.hypot(lt,pt);y&&(k+=lt/dt*y,M+=pt/dt*y),v&&(C-=lt/dt*v,R-=pt/dt*v)}const F=N+$,D=F+_,P=F-_,z=C-L*Math.cos(D),q=R-L*Math.sin(D),U=C-L*Math.cos(P),V=R-L*Math.sin(P),G=I<1e5?`A${I},${I} 0,0,${$>0?1:0} `:"L",Z=L?`M${z},${q}L${C},${R}L${U},${V}`:"";return`M${k},${M}${G}${C},${R}${Z}`}).call(Wr,this,r)).node()}}function WOt(e=1){if(typeof e=="number")return Li(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Us(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Un(t,r);case"-x":return(t,n,r)=>md(t,r);case"+y":return(t,n,r,i)=>Un(n,i);case"-y":return(t,n,r,i)=>md(n,i)}}function YOt([e,t],[n,r],i,o){const s=n-e,a=r-t,l=Math.hypot(s,a),c=o*Math.sqrt(i*i-l*l/4)/l;return[(e+n)/2-a*c,(t+r)/2+s*c]}function o$([e,t,n],[r,i,o],s){const a=r-e,l=i-t,c=Math.hypot(a,l),u=(a*a+l*l-o*o+n*n)/(2*c),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+l*f)/c,t+(l*u-a*f)/c]}function HOt(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=u2(t,n,r),[o,s]=u2(i,o,s),new mJ(e,{...a,x1:n,x2:r,y1:o,y2:s})}const GOt={ariaLabel:"bar"};class zR extends vr{constructor(t,n,r={},i=GOt){super(t,n,r,i),CR(this,r),AR(this,r)}render(t,n,r,i,o){const{rx:s,ry:a,rx1y1:l,rx1y2:c,rx2y1:u,rx2y2:f}=this,h=this._x(n,r,i),p=this._y(n,r,i),g=this._width(n,r,i),y=this._height(n,r,i);return _n("svg:g",o).call(Ar,this,i,o).call(this._transform,this,n).call(v=>v.selectAll().data(t).enter().call(l||c||u||f?b=>b.append("path").call(or,this).call(RR,h,p,s$(h,g),s$(p,y),this).call(Wr,this,r):b=>b.append("rect").call(or,this).attr("x",h).attr("width",g).attr("y",p).attr("height",y).call(me,"rx",s).call(me,"ry",a).call(Wr,this,r))).node()}_x(t,{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){const{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){const{insetLeft:s,insetRight:a}=this,l=n&&t?t.bandwidth():o-r-i;return Math.max(0,l-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){const{insetTop:s,insetBottom:a}=this,l=n&&t?t.bandwidth():o-r-i;return Math.max(0,l-s-a)}}function s$(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 qR extends zR{constructor(t,n={},r){const{x1:i,x2:o,y:s}=n;super(t,{x1:{value:i,scale:"x"},x2:{value:o,scale:"x"},y:{value:s,scale:"y",type:"band",optional:!0}},n,r)}_transform(t,n,{x:r}){t.call(yr,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){const{insetLeft:o}=this;return hc(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){const{insetLeft:a,insetRight:l}=this;return hc(t)?s-i-o-a-l:c=>Math.max(0,Math.abs(r[c]-n[c])-a-l)}}class jR extends zR{constructor(t,n={},r){const{x:i,y1:o,y2:s}=n;super(t,{y1:{value:o,scale:"y"},y2:{value:s,scale:"y"},x:{value:i,scale:"x",type:"band",optional:!0}},n,r)}_transform(t,n,{y:r}){t.call(yr,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){const{insetTop:o}=this;return hc(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){const{insetTop:a,insetBottom:l}=this;return hc(t)?s-i-o-a-l:c=>Math.max(0,Math.abs(r[c]-n[c])-a-l)}}function jh(e,t={}){return _g(t)||(t={...t,y:gi,x2:de}),new qR(e,p3(_R(h3(t))))}function Vh(e,t={}){return _g(t)||(t={...t,x:gi,y2:de}),new jR(e,g3(wR(d3(t))))}const XOt={ariaLabel:"cell"};class b3 extends zR{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,XOt)}_transform(t,n){t.call(yr,n,{},0,0)}}function Gp(e,{x:t,y:n,...r}={}){return[t,n]=yl(t,n),new b3(e,{...r,x:t,y:n})}function JOt(e,{x:t=gi,fill:n,stroke:r,...i}={}){return n===void 0&&Oo(r)[0]===void 0&&(n=de),new b3(e,{...i,x:t,fill:n,stroke:r})}function KOt(e,{y:t=gi,fill:n,stroke:r,...i}={}){return n===void 0&&Oo(r)[0]===void 0&&(n=de),new b3(e,{...i,y:t,fill:n,stroke:r})}const ZOt={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function VR(e){return e.sort===void 0&&e.reverse===void 0?uG({channel:"-r"},e):e}class _3 extends vr{constructor(t,n={}){const{x:r,y:i,r:o,rotate:s,symbol:a=Ky,frameAnchor:l}=n,[c,u]=ri(s,0),[f,h]=rNt(a),[p,g]=ri(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:p,scale:"r",filter:hu,optional:!0},rotate:{value:c,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},VR(n),ZOt),this.r=g,this.rotate=u,this.symbol=h,this.frameAnchor=i1(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,o){const{x:s,y:a}=n,{x:l,y:c,r:u,rotate:f,symbol:h}=r,{r:p,rotate:g,symbol:y}=this,[v,b]=_c(this,i),_=y===Ky,S=u?void 0:p*p*Math.PI;return VS(p)&&(t=[]),_n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s,y:c&&a}).call(x=>x.selectAll().data(t).enter().append(_?"circle":"path").call(or,this).call(_?T=>{T.attr("cx",l?k=>l[k]:v).attr("cy",c?k=>c[k]:b).attr("r",u?k=>u[k]:p)}:T=>{T.attr("transform",p1`translate(${l?k=>l[k]:v},${c?k=>c[k]:b})${f?k=>` rotate(${f[k]})`:g?` rotate(${g})`:""}`).attr("d",u&&h?k=>{const M=nu();return h[k].draw(M,u[k]*u[k]*Math.PI),M}:u?k=>{const M=nu();return y.draw(M,u[k]*u[k]*Math.PI),M}:h?k=>{const M=nu();return h[k].draw(M,S),M}:(()=>{const k=nu();return y.draw(k,S),k})())}).call(Wr,this,r)).node()}}function fh(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=yl(t,n)),new _3(e,{...r,x:t,y:n})}function QOt(e,{x:t=de,...n}={}){return new _3(e,sX({...n,x:t}))}function tDt(e,{y:t=de,...n}={}){return new _3(e,oX({...n,y:t}))}function eDt(e,t){return fh(e,{...t,symbol:"circle"})}function nDt(e,t){return fh(e,{...t,symbol:"hexagon"})}const rDt={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class w3 extends vr{constructor(t,n={}){const{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:lh(n),optional:!0}},n,rDt),this.z=o,this.curve=aJ(s,a),Sg(this,n)}filter(t){return t}project(t,n,r){this.curve!==W0&&super.project(t,n,r)}render(t,n,r,i,o){const{x:s,y:a}=r,{curve:l}=this;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(c=>c.selectAll().data(HG(t,[s,a],this,r)).enter().append("path").call(or,this).call(r2,this,r).call(l7t,this,r,o).attr("d",l===W0&&o.projection?iDt(o.path(),s,a):dH().curve(l).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}}function iDt(e,t,n){return t=ts(t),n=ts(n),r=>{let i=[];const o=[i];for(const s of r)s===-1?(i=[],o.push(i)):i.push([t[s],n[s]]);return e({type:"MultiLineString",coordinates:o})}}function x3(e,{x:t,y:n,...r}={}){return[t,n]=yl(t,n),new w3(e,{...r,x:t,y:n})}function cv(e,{x:t=de,y:n=gi,...r}={}){return new w3(e,$R({...r,x:t,y:n}))}function uv(e,{x:t=gi,y:n=de,...r}={}){return new w3(e,FR({...r,x:t,y:n}))}function yJ(e,t){t=sDt(t);const{x:n,y:r,color:i,size:o}=t,s=Gb(e,n),a=Gb(e,r),l=Gb(e,i),c=Gb(e,o);let{fx:u,fy:f,x:{value:h,reduce:p,zero:g,...y},y:{value:v,reduce:b,zero:_,...S},color:{value:x,color:T,reduce:k},size:{value:M,reduce:C},mark:R}=t;if(p===void 0&&(p=b==null&&h==null&&M==null&&v!=null?"count":null),b===void 0&&(b=p==null&&v==null&&M==null&&h!=null?"count":null),C===void 0&&M==null&&k==null&&p==null&&b==null&&(h==null||Gr(s))&&(v==null||Gr(a))&&(C="count"),g===void 0&&(g=Xb(p)?!0:void 0),_===void 0&&(_=Xb(b)?!0:void 0),h==null&&v==null)throw new Error("must specify x or y");if(p!=null&&v==null)throw new Error("reducing x requires y");if(b!=null&&h==null)throw new Error("reducing y requires x");R===void 0&&(R=M!=null||C!=null?"dot":Xb(p)||Xb(b)||k!=null?"bar":h!=null&&v!=null?Gr(s)||Gr(a)||p==null&&b==null&&!hm(s)&&!hm(a)?"dot":"line":h!=null||v!=null?"rule":null);let O,N,L;switch(R){case"dot":L=fh,N="stroke";break;case"line":L=s&&a||p!=null||b!=null?_||b!=null||s&&hm(s)?uv:g||p!=null||a&&hm(a)?cv:x3:s?cv:uv,N="stroke",l$(l)&&(O=null);break;case"area":L=!(_||b!=null)&&(g||p!=null||a&&hm(a))?lv:Y0,N="fill",l$(l)&&(O=null);break;case"rule":L=s?Hf:Gf,N="stroke";break;case"bar":L=p!=null?Gr(a)?a$(p)&&s&&Gr(s)?Gp:jh:s2:b!=null?Gr(s)?a$(b)&&a&&Gr(a)?Gp:Vh:a2:k!=null||C!=null?s&&Gr(s)&&a&&Gr(a)?Gp:s&&Gr(s)?Vh:a&&Gr(a)?jh:NR:s&&Hp(s)&&!(a&&Hp(a))?jh:a&&Hp(a)&&!(s&&Hp(s))?Vh:Gp,N="fill";break;default:throw new Error(`invalid mark: ${R}`)}let $={fx:u,fy:f,x:s??void 0,y:a??void 0,[N]:l??T,z:O,r:c??void 0,tip:!0},I,F={[N]:k??void 0,r:C??void 0};if(p!=null&&b!=null)throw new Error("cannot reduce both x and y");return b!=null?(F.y=b,I=Gr(s)?ev:pf):p!=null?(F.x=p,I=Gr(a)?nv:gf):(k!=null||C!=null)&&(s&&a?I=Gr(s)&&Gr(a)?iR:Gr(s)?gf:Gr(a)?pf:Fh:s?I=Gr(s)?ev:pf:a&&(I=Gr(a)?nv:gf)),(I===Fh||I===pf)&&($.x={value:s,...y}),(I===Fh||I===gf)&&($.y={value:a,...S}),g===void 0&&(g=s&&!(I===Fh||I===pf)&&(L===jh||L===lv||L===s2||L===Gf)),_===void 0&&(_=a&&!(I===Fh||I===gf)&&(L===Vh||L===Y0||L===a2||L===Hf)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:p??null,zero:!!g,...y},y:{value:v??null,reduce:b??null,zero:!!_,...S},color:{value:x??null,reduce:k??null,...T!==void 0&&{color:T}},size:{value:M??null,reduce:C??null},mark:R,markImpl:c$[L],markOptions:$,transformImpl:c$[I],transformOptions:F,colorMode:N}}function oDt(e,t){const n=yJ(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:l,colorMode:c}=n,u=g5[n.markImpl],f=g5[n.transformImpl],h=r!=null||i!=null?IR({strokeOpacity:.1}):null,p=[o?Hf([0]):null,s?Gf([0]):null],g=u(e,f?f(l,a):a);return c==="stroke"?Na(h,p,g):Na(h,g,p)}function hm(e){let t,n;for(const r of e){if(r==null)continue;if(t===void 0){t=r;continue}const i=Math.sign(Un(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function sDt({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return Rl(e)||(e=Tp(e)),Rl(t)||(t=Tp(t)),Rl(n)||(n=r1(n)?{color:n}:Tp(n)),Rl(r)||(r=Tp(r)),Rl(i)&&({value:i}=Tp(i)),Rl(o)&&({value:o}=Tp(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function Gb(e,t){const n=fn(e,t.value);return n&&(n.label=bc(t.value)),n}function Tp(e){return aDt(e)?{reduce:e}:{value:e}}function Xb(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function a$(e){return/^(?:first|last|mode)$/i.test(e)}function aDt(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&zs(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 l$(e){return e?new lg(e).size>e.length>>1:!1}const g5={dot:fh,line:x3,lineX:cv,lineY:uv,areaX:lv,areaY:Y0,ruleX:Hf,ruleY:Gf,barX:jh,barY:Vh,rect:NR,rectX:s2,rectY:a2,cell:Gp,bin:Fh,binX:pf,binY:gf,group:iR,groupX:ev,groupY:nv},c$=Object.fromEntries(Object.entries(g5).map(([e,t])=>[t,e]));function WR(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 o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),dc(o,t)}function YR(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 o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),dc(o,t)}function dc(e={},t={}){const n=lh(t),r=Object.entries(e).map(([i,o])=>{const s=tG(i,t);if(s==null)throw new Error(`missing channel: ${i}`);const[a,l]=Rs(s);return{key:i,input:s,output:a,setOutput:l,map:lDt(o)}});return{...vl(t,(i,o)=>{const s=fn(i,n),a=r.map(({input:c})=>fn(i,c)),l=r.map(({setOutput:c})=>c(new Array(i.length)));for(const c of o)for(const u of s?eh(c,f=>s[f]).values():[c])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],l[h]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function lDt(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&zs(e))return cDt(e);if(typeof e=="function")return qk(XA(e));switch(`${e}`.toLowerCase()){case"cumsum":return fDt;case"rank":return qk((t,n)=>sq(t,r=>n[r]));case"quantile":return qk((t,n)=>uDt(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function cDt(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function uDt(e,t){const n=oS(e,t)-1;return sq(e,t).map(r=>r/n)}function qk(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 o=0,s=t.length;o0))throw new Error(`invalid k: ${t}`);return mDt(n)(t,pDt(i,t),o)}function pDt(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 gDt(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function mDt(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return Jb(HA(e));switch(e.toLowerCase()){case"deviation":return Jb(Tv);case"max":return Kb((t,n)=>Vr(t,r=>n[r]));case"mean":return yDt;case"median":return Jb(Ny);case"min":return Kb((t,n)=>Dr(t,r=>n[r]));case"mode":return Kb((t,n)=>oq(t,r=>n[r]));case"sum":return vJ;case"variance":return Jb(dC);case"difference":return _Dt;case"ratio":return wDt;case"first":return xDt;case"last":return SDt}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return Kb(XA(e))}function Jb(e){return(t,n,r)=>r?{mapIndex(i,o,s){const a=c=>o[c]==null?NaN:+o[c];let l=0;for(let c=0;co[l]==null?NaN:+o[l];for(let l=-n;l<0;++l)s[i[l+n]]=e(rd(i,0,l+t),a);for(let l=0,c=i.length-n;lr?{mapIndex(i,o,s){let a=0;for(let l=0;l=n;--i){const o=e[t[i]];if(Bi(o))return o}}function bJ(e,t,n,r){for(let i=n+r;n=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function _Dt(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;ssS(i)+t*(Tv(i)||0),strict:n,anchor:r})}const kDt={ariaLabel:"tick",fill:null,stroke:"currentColor"};class wJ extends vr{constructor(t,n,r){super(t,n,r,kDt),Sg(this,r)}render(t,n,r,i,o){return _n("svg:g",o).call(Ar,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(or,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(f1,this,r,o)).node()}}class xJ extends wJ{constructor(t,n={}){const{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=kr(s),this.insetBottom=kr(a)}_transform(t,n,{x:r}){t.call(yr,n,{x:r},Fi,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?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){const{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}}class SJ extends wJ{constructor(t,n={}){const{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=kr(s),this.insetLeft=kr(a)}_transform(t,n,{y:r}){t.call(yr,n,{y:r},0,Fi)}_x1({x:t},{x:n},{marginLeft:r}){const{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){const{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}}function EJ(e,{x:t=de,...n}={}){return new xJ(e,{...n,x:t})}function TJ(e,{y:t=de,...n}={}){return new SJ(e,{...n,y:t})}function MDt(e,{x:t=de,y:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:l=2,sort:c,...u}={}){const f=n!=null?nv:rR;return Na(Gf(e,f({x1:HR,x2:GR},{x:t,y:n,stroke:s,strokeOpacity:a,...u})),jh(e,f({x1:"p25",x2:"p75"},{x:t,y:n,fill:i,fillOpacity:o,...u})),EJ(e,f({x:"p50"},{x:t,y:n,stroke:s,strokeOpacity:a,strokeWidth:l,sort:c,...u})),fh(e,dc({x:kJ},{x:t,y:n,z:n,r,stroke:s,strokeOpacity:a,...u})))}function CDt(e,{y:t=de,x:n=null,r,fill:i="#ccc",fillOpacity:o,stroke:s="currentColor",strokeOpacity:a,strokeWidth:l=2,sort:c,...u}={}){const f=n!=null?ev:rR;return Na(Hf(e,f({y1:HR,y2:GR},{x:n,y:t,stroke:s,strokeOpacity:a,...u})),Vh(e,f({y1:"p25",y2:"p75"},{x:n,y:t,fill:i,fillOpacity:o,...u})),TJ(e,f({y:"p50"},{x:n,y:t,stroke:s,strokeOpacity:a,strokeWidth:l,sort:c,...u})),fh(e,dc({y:kJ},{x:n,y:t,z:n,r,stroke:s,strokeOpacity:a,...u})))}function kJ(e){const t=HR(e),n=GR(e);return e.map(r=>rn?r:NaN)}function HR(e){const t=MJ(e)*2.5-CJ(e)*1.5;return Dr(e,n=>n>=t?n:NaN)}function GR(e){const t=CJ(e)*2.5-MJ(e)*1.5;return Vr(e,n=>n<=t?n:NaN)}function MJ(e){return Pf(e,.25)}function CJ(e){return Pf(e,.75)}const ADt={ariaLabel:"raster",stroke:null,pixelSize:1};function kp(e,t){const n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function u$(e,t){const n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}class AJ extends vr{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:l,x1:c=a==null?0:void 0,y1:u=l==null?0:void 0,x2:f=a==null?o:void 0,y2:h=l==null?s:void 0,pixelSize:p=i.pixelSize,blur:g=0,interpolate:y}=r;if(o!=null&&(o=u$(o,"width")),s!=null&&(s=u$(s,"height")),c!=null&&(c=kp(c,"x1")),u!=null&&(u=kp(u,"y1")),f!=null&&(f=kp(f,"x2")),h!=null&&(h=kp(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&&o!=null&&s!=null&&(a===void 0&&c!=null&&f!=null&&(a=BDt(c,f,o)),l===void 0&&u!=null&&h!=null&&(l=PDt(u,h,o,s))),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=o,this.height=s,this.pixelSize=kp(p,"pixelSize"),this.blur=kp(g,"blur"),this.interpolate=a==null||l==null?null:NDt(y)}}let RJ=class extends AJ{constructor(t,n={}){const{imageRendering:r}=n;if(t==null){const{fill:i,fillOpacity:o}=n;ri(o)[0]!==void 0&&(n=m5("fillOpacity",n)),Oo(i)[0]!==void 0&&(n=m5("fill",n))}super(t,void 0,n,ADt),this.imageRendering=ui(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){const s=n[r.channels.fill?.scale]??(F=>F),{x:a,y:l}=r,{document:c}=o,[u,f,h,p]=IJ(r,i,o),g=h-u,y=p-f,{pixelSize:v,width:b=Math.round(Math.abs(g)/v),height:_=Math.round(Math.abs(y)/v)}=this,S=b*_;let{fill:x,fillOpacity:T}=r,k=0;if(this.interpolate){const F=b/g,D=_/y,P=gr(a,q=>(q-u)*F,Float64Array),z=gr(l,q=>(q-f)*D,Float64Array);x&&(x=this.interpolate(t,b,_,P,z,x)),T&&(T=this.interpolate(t,b,_,P,z,T))}else this.data==null&&t&&(k=t.fi*S);const M=c.createElement("canvas");M.width=b,M.height=_;const C=M.getContext("2d"),R=C.createImageData(b,_),O=R.data;let{r:N,g:L,b:$}=ss(this.fill)??{r:0,g:0,b:0},I=(this.fillOpacity??1)*255;for(let F=0;F0&&o_t(R,this.blur),C.putImageData(R,0,0),_n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(F=>F.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(p-f)})`).attr("width",Math.abs(g)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(me,"image-rendering",this.imageRendering).call(or,this).attr("xlink:href",M.toDataURL())).node()}};function NJ(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&V8t(t)&&(r=GS,i=Zy,o===void 0&&(o=U8t)),[t,{...s,x:r,y:i,[e]:o}]}function RDt(){const[e,t]=NJ("fill",...arguments);return new RJ(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:de})}function IJ({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){const{width:s,height:a,marginTop:l,marginRight:c,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:l,n&&o==null?n[0]:s-c,r&&o==null?r[0]:a-u]}function OJ({x1:e,y1:t,x2:n,y2:r},i,o,s){const a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),IJ(e3(a,i),o,s)}function m5(e,t={}){const{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return no({...t,[e]:void 0},function(r,i,o,s,a,l){const{x:c,y:u}=s;if(!c)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");const[f,h,p,g]=OJ(o,s,a,l),y=p-f,v=g-h,{pixelSize:b}=this,{width:_=Math.round(Math.abs(y)/b),height:S=Math.round(Math.abs(v)/b)}=t,x=new Array(_*S*(i?i.length:1)),T=y/_,k=v/S;let M=0;for(const C of i??[void 0])for(let R=.5;R=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function XR({random:e=OA(42)}={}){return(t,n,r,i,o,s)=>{const{points:a,triangles:l,hull:c}=oh.from(t,p=>i[p],p=>o[p]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=$Dt(s,e);for(let p=0;p=n||D<0||D>=r)continue;const P=F+.5,z=D+.5,q=Math.sign(N),U=(T-k)*(P-S)+(z-k)*(S-_);if(U*q<0)continue;const V=(k-x)*(P-S)+(z-k)*(b-S);if(V*q<0)continue;const G=N-(U+V);if(G*q<0)continue;const Z=F+n*D;u[Z]=h(L,U/N,$,V/N,I,G/N,F,D),f[Z]=1}}return IDt(u,f,i,o,s,n,r,c,t,h),u}}function IDt(e,t,n,r,i,o,s,a,l,c){n=Float64Array.from(a,p=>n[l[p]]),r=Float64Array.from(a,p=>r[l[p]]),i=Array.from(a,p=>i[l[p]]);const u=n.length,f=Array.from({length:u},(p,g)=>DDt(g,n,r));let h=0;for(let p=0;p0&&c>0?l/(l+c):+(l>c)}function dm(e,t,n,r){return e*r-n*t}function DDt(e,t,n){const r=t.length,i=t.at(e-2),o=n.at(e-2),s=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=s-l,p=a-c,g=i-s,y=o-a,v=l-u,b=c-f,_=Math.hypot(h,p),S=Math.hypot(g,y),x=Math.hypot(v,b);return(T,k)=>{const M=T-s,C=k-a,R=T-l,O=k-c;return dm(M,C,R,O)>-1e-6&&dm(M,C,h,p)*S-dm(M,C,g,y)*_>-1e-6&&dm(R,O,v,b)*_-dm(R,O,h,p)*x<=0}}function JR(e,t,n,r,i,o){const s=new o.constructor(t*n),a=oh.from(e,u=>r[u],u=>i[u]);let l,c;for(let u=.5,f=0;u{const c=new l.constructor(i*o),u=oh.from(r,g=>s[g],g=>a[g]);let f,h,p;for(let g=.5,y=0;gt&&x{const c=e(a,l);return cl.map(c=>c.value),label:bc(r)};for(const l in o)i[l]==="value"&&(i[l]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=m5("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}},UDt(i),f$);const s={geometry:{value:de}};for(const a in this.channels){const l=this.channels[a],{scale:c}=l;c==="x"||c==="y"||a==="value"||(s[a]=l,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){const{geometry:s}=r,a=Qv();return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(l=>{l.selectAll().data(t).enter().append("path").call(or,this).attr("d",c=>a(s[c])).call(Wr,this,r)}).node()}}function UDt({thresholds:e,interval:t,...n}){return e=cJ(e,t,yC),no(n,function(r,i,o,s,a,l){const[c,u,f,h]=OJ(o,s,a,l),p=f-c,g=h-u,{pixelSize:y,width:v=Math.round(Math.abs(p)/y),height:b=Math.round(Math.abs(g)/y)}=this,_=v/p,S=b/g,x=o.value.value,T=[];if(this.interpolate){const{x:O,y:N}=u1(o,s,l),L=gr(O,D=>(D-c)*_,Float64Array),$=gr(N,D=>(D-u)*S,Float64Array),I=[o.x,o.y,o.value],F=[L,$,x];for(const D of i){const P=this.filter(D,I,F);T.push(this.interpolate(P,v,b,L,$,x))}}else if(i){const O=v*b,N=i.length;for(let L=0;L0)for(const O of T)Xz({data:O,width:v,height:b},this.blur);const k=zDt(e,x,...jDt(T));if(k===null)throw new Error(`unsupported thresholds: ${e}`);const{contour:M}=Ex().size([v,b]).smooth(this.smooth),C=[],R=[];for(const O of T)R.push(Cs(C.length,C.push(...gr(k,N=>M(O,N)))));for(const{coordinates:O}of C)for(const N of O)for(const L of N)for(const $ of L)$[0]=$[0]/_+c,$[1]=$[1]/S+u;return{data:C,facets:R,channels:bG(this.contourChannels,C)}})}function zDt(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 ah(e);const i=Bf(...eq(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]Dr(t,h$)),Vr(e,t=>Vr(t,h$))]}function h$(e){return isFinite(e)?e:NaN}function VDt(e,t){return ZR(s3,e,t)}function WDt(e,t={}){return ZR(a3,e,t)}function YDt(e,t={}){return ZR(av,e,t)}function ZR(e,t,n={}){const{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Hf(t,d$("x",{...s,inset:-6},n))),i!=null&&a.push(Gf(t,d$("y",{...s,inset:-6},n))),r!=null&&a.push(j0(t,p$("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(j0(t,p$("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(const l of a)l.ariaLabel=`crosshair ${l.ariaLabel}`;return Na(...a)}function LJ(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:l,transform:c,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...l},transform:c,initializer:HDt(e,u)}}function HDt(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...l},...c){const{channels:{x:u,y:f,...h}={},...p}=t.call(this,n,r,{...l,x:s,y:a},...c);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...p}}}function d$(e,t,n){const{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...LJ(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function p$(e,t,n){const{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:l=5}=n;return{...LJ(e,t,GDt(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:l}}function GDt(e,t){return no(t,(n,r,i)=>({channels:{text:{value:i5(i,e)?.value}}}))}const XDt={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},JDt={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},KDt={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},ZDt={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},QDt={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class tLt extends vr{constructor(t,n={}){const{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,XDt),this.curve=LR(s,a),Sg(this,n)}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y:c,z:u}=r,{curve:f}=this,[h,p]=_c(this,i),g=l?_=>l[_]:Li(h),y=c?_=>c[_]:Li(p),v=this;function b(_){let S=-1;const x=[],T={};for(const I in r)T[I]=[];const k=[],M=[],C=[],R=[];function O(I,F){I=_[I],F=_[F],x.push(++S),k[S]=g(I),C[S]=y(I),M[S]=g(F),R[S]=y(F);for(const D in r)T[D].push(r[D][F])}const{halfedges:N,hull:L,triangles:$}=oh.from(_,g,y);for(let I=0;II&&O($[I],$[F])}for(let I=0;I{const F=nu(),D=f(F);return D.lineStart(),D.point(k[I],C[I]),D.point(M[I],R[I]),D.lineEnd(),F}).call(Wr,v,T).call(f1,v,T,o)}return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s,y:c&&a}).call(u?_=>_.selectAll().data(eh(t,S=>u[S]).values()).enter().append("g").each(b):_=>_.datum(t).each(b)).node()}}class QR extends vr{constructor(t,n={},r,i=({z:o})=>o){const{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y:c,z:u}=r,[f,h]=_c(this,i),p=l?b=>l[b]:Li(f),g=c?b=>c[b]:Li(h),y=this;function v(b){const _=oh.from(b,p,g);Er(this).append("path").datum(b[0]).call(or,y).attr("d",y._render(_,i)).call(Wr,y,r)}return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s,y:c&&a}).call(u?b=>b.selectAll().data(eh(t,_=>u[_]).values()).enter().append("g").each(v):b=>b.datum(t).each(v)).node()}}class eLt extends QR{constructor(t,n={}){super(t,n,JDt),this.fill="none"}_render(t){return t.render()}}class nLt extends QR{constructor(t,n={}){super(t,n,KDt,lh)}_render(t){return t.renderHull()}}class rLt extends vr{constructor(t,n={}){const{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},no(n,function(s,a,l,c,u,f){let{x:h,y:p,z:g}=l;({x:h,y:p}=u1(l,c,f)),g=g?.value;const y=new Array((h??p).length).fill(null),[v,b]=_c(this,u),_=h?x=>h[x]:Li(v),S=p?x=>p[x]:Li(b);for(let x of a){h&&(x=x.filter(T=>Bi(_(T)))),p&&(x=x.filter(T=>Bi(S(T))));for(const[,T]of id(x,g)){const k=oh.from(T,_,S),M=FJ(k,u);for(let C=0,R=T.length;C{f.selectAll().data(t).enter().append("path").call(or,this).attr("d",h=>u[h]).call(Wr,this,r)}).node()}}class iLt extends QR{constructor(t,n){super(t,n,QDt),this.fill="none"}_render(t,n){return FJ(t,n).render()}}function FJ(e,t){const{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function g1(e,t,{x:n,y:r,...i}={}){return[n,r]=yl(n,r),new e(t,{...i,x:n,y:r})}function oLt(e,t){return g1(tLt,e,t)}function sLt(e,t){return g1(eLt,e,t)}function aLt(e,t){return g1(nLt,e,t)}function lLt(e,{x:t,y:n,initializer:r,...i}={}){return g1(rLt,e,{...vl({...i,x:t,y:n},JX),initializer:r})}function cLt(e,t){return g1(iLt,e,t)}const uLt={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class $J extends vr{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...l}={}){const c=g$(s)&&(s="currentColor",!0),u=g$(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:lh({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},dLt({...l,fill:s,stroke:a},c,u),uLt),c&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){const{contours:s}=r,a=Qv();return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{}).call(l=>l.selectAll().data(t).enter().append("path").call(or,this).call(Wr,this,r).attr("d",c=>a(s[c]))).node()}}function fLt(e,{x:t,y:n,...r}={}){return[t,n]=yl(t,n),new $J(e,{...r,x:t,y:n})}const hLt=new Set(["x","y","z","weight"]);function dLt(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?ts(o):+o,no(e,function(s,a,l,c,u,f){const h=l.weight?ts(l.weight.value):null,p=l.z?.value,{z:g}=this,[y,v]=_c(this,u),{width:b,height:_}=u,{x:S,y:x}=u1(l,c,f),T=Object.fromEntries(Object.entries(l).filter(([$])=>!hLt.has($)).map(([$,I])=>[$,{...I,value:[]}])),k=t&&[],M=n&&[],C=jCt().x(S?$=>S[$]:y).y(x?$=>x[$]:v).weight(h?$=>h[$]:1).size([b,_]).bandwidth(i),R=[];for(const $ of a){const I=[];R.push(I);for(const F of p?mR($,p,g):[$]){const D=C.contours(F);I.push([F,D])}}let O=o;if(!(O instanceof HS)){let $=0;for(const I of R)for(const[,F]of I){const D=F.max;D>$&&($=D)}O=Float64Array.from({length:o-1},(I,F)=>$*100*(F+1)/o)}const N=[],L=[];for(const $ of R){const I=[];N.push(I);for(const[F,D]of $)for(const P of O){I.push(L.length),L.push(D(P/100)),k&&k.push(P),M&&M.push(P);for(const z in T)T[z].value.push(l[z].value[F[0]])}}return k&&k.push(0),M&&M.push(0),{data:s,facets:N,channels:{...T,...k&&{fill:{value:k,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:L}}}})}function g$(e){return/^density$/i.test(e)}function pLt(e,t){return BJ("x",e,t)}function gLt(e,t){return BJ("y",e,t)}function BJ(e,t,{x1:n,x2:r,y1:i,y2:o,x:s=n===void 0&&r===void 0?e==="y"?gi:de:void 0,y:a=i===void 0&&o===void 0?e==="x"?gi:de:void 0,fill:l,positiveFill:c="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:h=f,negativeFillOpacity:p=f,stroke:g,strokeOpacity:y,z:v=Oo(g)[0],clip:b,tip:_,render:S,...x}={}){return[n,r]=m$(s,n,r),[i,o]=m$(a,i,o),n===r&&i===o&&(e==="y"?i=Vc(0):n=Vc(0)),{tip:_}=jd({tip:_},e==="y"?"x":"y"),Na(Or(c)?null:Object.assign(p5(t,{x1:n,x2:r,y1:i,y2:o,z:v,fill:c,fillOpacity:h,render:sv(S,y$(e,!0)),clip:b,...x}),{ariaLabel:"positive difference"}),Or(u)?null:Object.assign(p5(t,{x1:n,x2:r,y1:i,y2:o,z:v,fill:u,fillOpacity:p,render:sv(S,y$(e,!1)),clip:b,...x}),{ariaLabel:"negative difference"}),x3(t,{x:r,y:o,z:v,stroke:g,strokeOpacity:y,tip:_,clip:!0,...x}))}function m$(e,t,n){return t===void 0&&n===void 0?t=n=Vc(e):t===void 0?(n=Vc(n),t=e===void 0?n:Vc(e)):n===void 0?(t=Vc(t),n=e===void 0?t:Vc(e)):(t=Vc(t),n=Vc(n)),[t,n]}function Vc(e){let t;const{value:n,label:r=bc(n)}=xg(e);return{transform:i=>t||(t=fn(i,n)),label:r}}function y$(e,t){const n=e==="x"?"y":"x",r=`${n}1`,i=`${n}2`,o=`${e}1`,s=`${e}2`;return(a,l,c,u,f,h)=>{const{[r]:p,[i]:g}=c,y=new Float32Array(p.length),v=new Float32Array(g.length),b=u[e==="y"?"height":"width"];(t===DG(l[e])<0?y:v).fill(b);const _=h(a,l,{...c,[i]:p,[s]:v},u,f),S=h(a,l,{...c,[r]:g,[o]:y},u,f),x=_.querySelector("g")??_,T=S.querySelector("g")??S;for(let k=0;x.firstChild;k+=2){const M=gR(),C=_n("svg:clipPath",f).attr("id",M).node();C.appendChild(x.firstChild),T.childNodes[k].setAttribute("clip-path",`url(#${M})`),T.insertBefore(C,T.childNodes[k])}return S}}function PJ({geometry:e=de,...t}={}){const n=z0(r=>fn(r,e));return no({...t,x:null,y:null,geometry:{transform:n}},(r,i,o,s,a,l)=>{const c=n(r),u=c.length,f=new Float64Array(u),h=new Float64Array(u),{centroid:p}=l.path();for(let g=0;gfn(i,e)),r=z0(i=>fn(n(i),gAt));return{...t,x:{transform:i=>Float64Array.from(r(i),([o])=>o)},y:{transform:i=>Float64Array.from(r(i),([,o])=>o)},geometry:{transform:n}}}const yLt={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class UJ extends vr{constructor(t,n={}){const[r,i]=ri(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:hu,optional:!0},geometry:{value:n.geometry,scale:"projection"}},VR(n),yLt),this.r=i}render(t,n,r,i,o){const{geometry:s,r:a}=r,l=o.path(),{r:c}=this;return VS(c)?t=[]:c!==void 0&&l.pointRadius(c),_n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(or,this).attr("d",a?f=>l.pointRadius(a[f])(s[f]):f=>l(s[f])).call(Wr,this,r)}).node()}}function t8(e,t={}){return t.tip&&t.x===void 0&&t.y===void 0?t=PJ(t):t.geometry===void 0&&(t={...t,geometry:de}),new UJ(e,t)}function vLt({strokeWidth:e=1.5,...t}={}){return t8({type:"Sphere"},{strokeWidth:e,...t})}function bLt({strokeOpacity:e=.1,...t}={}){return t8(MAt(),{strokeOpacity:e,...t})}const iy=.5,oy=0;function _Lt(e={fill:"count"},{binWidth:t,...n}={}){const{z:r}=n;return t=t===void 0?20:kr(t),e=dG(e,n),Tf(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Tf(e,"r")&&(n.r=t/2),no(n,(i,o,s,a,l,c)=>{let{x:u,y:f,z:h,fill:p,stroke:g,symbol:y}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=u1(s,a,c)),h=h?h.value:fn(i,r),p=p?.value,g=g?.value,y=y?.value;const v=aR(e,{z:h,fill:p,stroke:g,symbol:y}),b=h&&[],_=p&&[],S=g&&[],x=y&&[],T=[],k=[],M=[];let C=-1;for(const L of e)L.initialize(i);for(const L of o){const $=[];for(const I of e)I.scope("facet",L);for(const[I,F]of id(L,v))for(const{index:D,extent:P}of wLt(i,F,u,f,t)){$.push(++C),k.push(P.x),M.push(P.y),h&&b.push(v===h?I:h[D[0]]),p&&_.push(v===p?I:p[D[0]]),g&&S.push(v===g?I:g[D[0]]),y&&x.push(v===y?I:y[D[0]]);for(const z of e)z.reduce(D,P)}T.push($)}const R=s.x.scale,O=s.y.scale,N={x:{value:k,source:a[R]?{value:gr(k,a[R].invert),scale:R}:null},y:{value:M,source:a[O]?{value:gr(M,a[O].invert),scale:O}:null},...h&&{z:{value:b}},...p&&{fill:{value:_,scale:"auto"}},...g&&{stroke:{value:S,scale:"auto"}},...y&&{symbol:{value:x,scale:"auto"}},...Object.fromEntries(e.map(({name:L,output:$})=>[L,{scale:"auto",label:$.label,radius:L==="r"?t/2:void 0,value:$.transform()}]))};return{data:i,facets:T,channels:N}})}function wLt(e,t,n,r,i){const o=i*(1.5/lG),s=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-oy)/o),f=Math.round(l=(l-iy)/i-(u&1)/2),h=c-u;if(Math.abs(h)*3>1){let y=l-f,v=f+(l_*_+S*S&&(f=v+(u&1?1:-1)/2,u=b)}const p=`${f},${u}`;let g=s.get(p);g===void 0&&(g={index:[],extent:{data:e,x:(f+(u&1)/2)*i+iy,y:u*o+oy}},s.set(p,g)),g.index.push(a)}return s.values()}const xLt={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function SLt(e){return new zJ(e)}class zJ extends vr{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(ry,void 0,{clip:n,...r},xLt),this.binWidth=kr(t)}render(t,n,r,i,o){const{binWidth:s}=this,{marginTop:a,marginRight:l,marginBottom:c,marginLeft:u,width:f,height:h}=i,p=u-iy,g=f-l-iy,y=a-oy,v=h-c-oy,b=s/2,_=b*cG,S=_/2,x=b*2,T=_*1.5,k=Math.floor(p/x),M=Math.ceil(g/x),C=Math.floor((y+S)/T),R=Math.ceil((v-S)/T)+1,O=`m0,${Qu(-_)}l${Qu(b)},${Qu(S)}v${Qu(_)}l${Qu(-b)},${Qu(S)}`;let N=O;for(let L=C;LL.append("path").call(or,this).call(Wr,this,r).attr("d",N)).node()}}function Qu(e){return Math.round(e*1e3)/1e3}const ELt={ariaLabel:"image",fill:null,stroke:null};function TLt(e){return/^\.*\//.test(e)}function kLt(e){return/^(blob|data|file|http|https):/i.test(e)}function MLt(e){return typeof e=="string"&&(TLt(e)||kLt(e))?[void 0,e]:[e,void 0]}class qJ extends vr{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:l,src:c,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:p}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);const[g,y]=MLt(c),[v,b]=ri(o),[_,S]=ri(s,b!==void 0?b*2:void 0),[x,T]=ri(a,b!==void 0?b*2:void 0),[k,M]=ri(l,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:v,scale:"r",filter:hu,optional:!0},width:{value:_,filter:hu,optional:!0},height:{value:x,filter:hu,optional:!0},rotate:{value:k,optional:!0},src:{value:g,optional:!0}},VR(n),ELt),this.src=y,this.width=S,this.rotate=M,this.height=T,this.r=b,this.preserveAspectRatio=ui(u,"xMidYMid"),this.crossOrigin=Di(f),this.frameAnchor=i1(h),this.imageRendering=ui(p,"auto")}render(t,n,r,i,o){const{x:s,y:a}=n,{x:l,y:c,width:u,height:f,r:h,rotate:p,src:g}=r,{r:y,width:v,height:b,rotate:_}=this,[S,x]=_c(this,i);return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,{x:l&&s,y:c&&a}).call(T=>T.selectAll().data(t).enter().append("image").call(or,this).attr("x",v$(l,u,h,S,v,y)).attr("y",v$(c,f,h,x,b,y)).attr("width",u?k=>u[k]:v!==void 0?v:h?k=>h[k]*2:y*2).attr("height",f?k=>f[k]:b!==void 0?b:h?k=>h[k]*2:y*2).attr("transform",p?k=>`rotate(${p[k]})`:_?`rotate(${_})`:null).attr("transform-origin",p||_?p1`${l?k=>l[k]:S}px ${c?k=>c[k]:x}px`:null).call(me,"href",g?k=>g[k]:this.src).call(me,"preserveAspectRatio",this.preserveAspectRatio).call(me,"crossorigin",this.crossOrigin).call(me,"image-rendering",this.imageRendering).call(me,"clip-path",h?k=>`circle(${h[k]}px)`:y!==void 0?`circle(${y}px)`:null).call(Wr,this,r)).node()}}function v$(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function CLt(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=yl(t,n)),new qJ(e,{...r,x:t,y:n})}function ALt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,l,c,u,f,h,p,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,p=c+u,e=1&&(h=.5*(h+c+1)),Math.abs(c)0)break}return h}function RLt(e,t,n){var r=e===0||e===1?0:Math.exp(d0(t+n)-d0(t)-d0(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*b$(e,t,n)/t:1-r*b$(1-e,n,t)/n}function b$(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,l=1,c=1-o*e/s,u,f,h,p;for(Math.abs(c).5?n:-n}const ILt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class jJ extends vr{constructor(t,n={}){const{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:lh(n),optional:!0}},n,ILt),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){const{x:s,y:a,z:l}=r,{ci:c}=this;return _n("svg:g",o).call(Ar,this,i,o).call(yr,this,n).call(u=>u.selectAll().data(l?mR(t,l,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(or,this).call(r2,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,s,a)).call(c&&!U0(this.fill)?h=>h.select(OLt).attr("stroke","none").call(or,this).call(r2,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",p=>this._renderBand(p,s,a)):()=>{}))).node()}}function OLt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(wu.svg,"path"),this)}class DLt extends jJ{constructor(t,n){super(t,n)}_renderBand(t,n,r){const{ci:i,precision:o}=this,[s,a]=di(t,u=>r[u]),l=f2(t,r,n),c=VJ(t,r,n,(1-i)/2,l);return LA().y(u=>u).x0(u=>c(u,-1)).x1(u=>c(u,1))(Cs(s,a-o/2,o).concat(a))}_renderLine(t,n,r){const[i,o]=di(t,a=>r[a]),s=f2(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}}class LLt extends jJ{constructor(t,n){super(t,n)}_renderBand(t,n,r){const{ci:i,precision:o}=this,[s,a]=di(t,u=>n[u]),l=f2(t,n,r),c=VJ(t,n,r,(1-i)/2,l);return LA().x(u=>u).y0(u=>c(u,-1)).y1(u=>c(u,1))(Cs(s,a-o/2,o).concat(a))}_renderLine(t,n,r){const[i,o]=di(t,a=>n[a]),s=f2(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}}function FLt(e,{y:t=gi,x:n=de,stroke:r,fill:i=Or(r)?"currentColor":r,...o}={}){return new DLt(e,$R({...o,x:n,y:t,fill:i,stroke:r}))}function $Lt(e,{x:t=gi,y:n=de,stroke:r,fill:i=Or(r)?"currentColor":r,...o}={}){return new LLt(e,FR({...o,x:t,y:n,fill:i,stroke:r}))}function f2(e,t,n){let r=0,i=0,o=0,s=0;for(const u of e){const f=t[u],h=n[u];r+=f,i+=h,o+=f*h,s+=f*f}const a=e.length,l=(a*o-r*i)/(a*s-r*r),c=(i-l*r)/a;return u=>l*u+c}function VJ(e,t,n,r,i){const o=el(e,u=>t[u])/e.length;let s=0,a=0;for(const u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;const l=Math.sqrt(a/(e.length-2)),c=NLt(r,e.length-2);return(u,f)=>{const h=i(u),p=l*Math.sqrt(1/e.length+(u-o)**2/s);return h+f*c*p}}function v5({path:e=de,delimiter:t,frameAnchor:n,treeLayout:r=Yx,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...l}={}){s=e8(s),i=YJ(i),a!=null&&(a=_5(a)),n===void 0&&(n=s.frameAnchor);const c=HJ(t),u=tK(l,_5),[f,h]=Rs(),[p,g]=Rs();return{x:f,y:p,frameAnchor:n,...vl(l,(y,v)=>{const b=c(fn(y,e)),_=h([]),S=g([]);let x=-1;const T=[],k=[],M=sH().path(O=>b[O]),C=Lu(y)?O=>O.data=y[O.data]:O=>O.data=y.get(O.data),R=r();R.nodeSize&&R.nodeSize([1,1]),R.separation&&o!==void 0&&R.separation(o??YA);for(const O of u)O[h2]=O[ZJ]([]);for(const O of v){const N=[],L=M(O.filter($=>b[$]!=null)).each(C);i!=null&&L.sort(i),R(L);for(const $ of L.descendants())if(!(a!=null&&!a($))){N.push(++x),T[x]=$.data,s.position($,x,_,S);for(const I of u)I[h2][x]=I[QJ]($)}k.push(N)}return{data:T,facets:k}}),...Object.fromEntries(u)}}function WJ({path:e=de,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Yx,treeSort:a,treeSeparation:l,treeAnchor:c,treeFilter:u,...f}={}){c=e8(c),a=YJ(a),u!=null&&(u=w$(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};const h=HJ(t),p=tK(f,w$),[g,y]=Rs(),[v,b]=Rs(),[_,S]=Rs(),[x,T]=Rs();return{x1:g,x2:v,y1:_,y2:x,...vl(f,(k,M)=>{const C=h(fn(k,e)),R=y([]),O=b([]),N=S([]),L=T([]);let $=-1;const I=[],F=[],D=sH().path(z=>C[z]),P=s();P.nodeSize&&P.nodeSize([1,1]),P.separation&&l!==void 0&&P.separation(l??YA);for(const z of p)z[h2]=z[ZJ]([]);for(const z of M){const q=[],U=D(z.filter(V=>C[V]!=null)).each(V=>V.data=k[V.data]);a!=null&&U.sort(a),P(U);for(const{source:V,target:G}of U.links())if(!(u!=null&&!u(G,V))){q.push(++$),I[$]=G.data,c.position(V,$,R,N),c.position(G,$,O,L);for(const Z of p)Z[h2][$]=Z[QJ](G,V)}F.push(q)}return{data:I,facets:F}}),...Object.fromEntries(p)}}function e8(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return BLt;case"right":return PLt}throw new Error(`invalid tree anchor: ${e}`)}const BLt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},PLt={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function YJ(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?_$(_5(e)):_$(ULt(e))}function _$(e){return(t,n)=>Ra(e(t),e(n))}function ULt(e){return t=>t.data?.[e]}function HJ(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=>zLt(r,t))}const b5=92,GJ=47;function zLt(e,t){if(t===b5)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;rn==null?void 0:e(n)}function VLt(e){let t=e.length;for(;--t>0&&!WLt(e,t););return qLt(e.slice(t+1))}function WLt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}const ZJ=2,QJ=3,h2=4;function tK(e,t){const n=[];for(const r in e){const i=e[r],o=t(i);o!==void 0&&n.push([r,...Rs(i),o])}return n}function eK(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:l,strokeDashoffset:c,marker:u,markerStart:f=u,markerEnd:h=u,dot:p=Or(f)&&Or(h),text:g="node:name",textStroke:y="var(--plot-background)",title:v="node:path",dx:b,dy:_,textAnchor:S,treeLayout:x=Yx,textLayout:T=x===Yx||x===rH?"mirrored":"normal",tip:k,...M}={}){if(b===void 0&&(b=e8(M.treeAnchor).dx),S!==void 0)throw new Error("textAnchor is not a configurable tree option");T=Us(T,"textLayout",["mirrored","normal"]);function C(R){return j0(e,v5({treeLayout:x,text:g,fill:t===void 0?"currentColor":t,stroke:y,dx:b,dy:_,title:v,...R,...M}))}return Na(gJ(e,WJ({treeLayout:x,markerStart:f,markerEnd:h,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:l,strokeDashoffset:c,...M})),p?fh(e,v5({treeLayout:x,fill:t===void 0?"node:internal":t,title:v,tip:k,...M})):null,g!=null?T==="mirrored"?[C({textAnchor:"start",treeFilter:"node:external"}),C({textAnchor:"end",treeFilter:"node:internal",dx:-b})]:C():null)}function YLt(e,t){return eK(e,{...t,treeLayout:rH})}const nK={ariaLabel:"waffle"};class rK extends qR{constructor(t,{unit:n=1,gap:r=1,round:i,multiple:o,...s}={}){super(t,oK("x",s),nK),this.unit=Math.max(0,n),this.gap=+r,this.round=sK(i),this.multiple=aK(o)}}class iK extends jR{constructor(t,{unit:n=1,gap:r=1,round:i,multiple:o,...s}={}){super(t,oK("y",s),nK),this.unit=Math.max(0,n),this.gap=+r,this.round=sK(i),this.multiple=aK(o)}}function oK(e,t){const n=e==="y"?"x":"y",r=`${e}1`,i=`${e}2`;return no(HLt(t),function(o,s,a,l,c){const{round:u,unit:f}=this,h=a[r].value,p=a[i].value,g=e3({...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*JLt(l.scales[e]),{multiple:_=Math.max(1,Math.floor(Math.sqrt(y/b)))}=this,S=Math.min(y/_,b*_),x=b*_,T=(y-_*S)/2,k=typeof v=="function"?D=>v(D)+T:v+T,M=l[e](0),C=e==="y"?([D,P])=>[D*S,-P*x]:([D,P])=>[P*x,D*S],R=typeof k=="function"?D=>k(D)-y/2:()=>k,[O,N]=e==="y"?[0,1]:[1,0],L=p.length,$=new Array(L),I=new Float64Array(L),F=new Float64Array(L);for(let D=0;DC.selectAll().data(n).enter().append(()=>k.cloneNode(!0)).attr("id",R=>`${T}-${R}`).select("rect").call(or,this).call(Wr,this,g)).call(C=>C.selectAll().data(n).enter().append("path").attr("transform",p1`translate(${_},${x})`).attr("d",R=>`M${v[R].join("L")}Z`).attr("fill",R=>`url(#${T}-${R})`).attr("stroke",this.stroke==null?null:"none").call(Wr,this,{ariaLabel:f,href:h,title:p})).node()})}}function n8(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([s,c],[s,c+t%1],[o,c+t%1]),t%n<1||(f.push([o,u]),u>l&&f.push([0,u])),f.push(XLt(e,t,n)),f}function GLt(e,t,n,r){return n8(e+r*n,t+r*n,n).map(([i,o])=>[i,o-r])}function XLt(e,t,n){const r=Math.floor(t/n)-Math.floor(e/n);return r===0?jk(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?jk(t-t%n,t,n):jk(e,n*Math.ceil(e/n),n):[n/2,(Math.round(e/n)+Math.round(t/n))/2]}function jk(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 sK(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 aK(e){return e===void 0?void 0:Math.max(1,Math.floor(e))}function JLt({domain:e,range:t}){return x$(t)/x$(e)}function x$(e){const[t,n]=di(e);return n-t}function KLt(e,{tip:t,...n}={}){return _g(n)||(n={...n,y:gi,x2:de}),new rK(e,{tip:lK(t),...p3(_R(h3(n)))})}function ZLt(e,{tip:t,...n}={}){return _g(n)||(n={...n,x:gi,y2:de}),new iK(e,{tip:lK(t),...g3(wR(d3(n)))})}function lK(e){return e===!0?{maxRadius:1/0}:zs(e)&&e.maxRadius===void 0?{...e,maxRadius:1/0}:void 0}function cK(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vk,S$;function QLt(){if(S$)return Vk;S$=1;function e(s,a,l,c,u){for(var f=u+1;c<=u;){var h=c+u>>>1,p=s[h],g=l!==void 0?l(p,a):p-a;g>=0?(f=h,u=h-1):c=h+1}return f}function t(s,a,l,c,u){for(var f=u+1;c<=u;){var h=c+u>>>1,p=s[h],g=l!==void 0?l(p,a):p-a;g>0?(f=h,u=h-1):c=h+1}return f}function n(s,a,l,c,u){for(var f=c-1;c<=u;){var h=c+u>>>1,p=s[h],g=l!==void 0?l(p,a):p-a;g<0?(f=h,c=h+1):u=h-1}return f}function r(s,a,l,c,u){for(var f=c-1;c<=u;){var h=c+u>>>1,p=s[h],g=l!==void 0?l(p,a):p-a;g<=0?(f=h,c=h+1):u=h-1}return f}function i(s,a,l,c,u){for(;c<=u;){var f=c+u>>>1,h=s[f],p=l!==void 0?l(h,a):h-a;if(p===0)return f;p<=0?c=f+1:u=f-1}return-1}function o(s,a,l,c,u,f){return typeof l=="function"?f(s,a,l,c===void 0?0:c|0,u===void 0?s.length-1:u|0):f(s,a,void 0,l===void 0?0:l|0,c===void 0?s.length-1:c|0)}return Vk={ge:function(s,a,l,c,u){return o(s,a,l,c,u,e)},gt:function(s,a,l,c,u){return o(s,a,l,c,u,t)},lt:function(s,a,l,c,u){return o(s,a,l,c,u,n)},le:function(s,a,l,c,u){return o(s,a,l,c,u,r)},eq:function(s,a,l,c,u){return o(s,a,l,c,u,i)}},Vk}var Wk,E$;function tFt(){if(E$)return Wk;E$=1;var e=QLt(),t=0,n=1,r=2;Wk=S;function i(x,T,k,M,C){this.mid=x,this.left=T,this.right=k,this.leftPoints=M,this.rightPoints=C,this.count=(T?T.count:0)+(k?k.count:0)+M.length}var o=i.prototype;function s(x,T){x.mid=T.mid,x.left=T.left,x.right=T.right,x.leftPoints=T.leftPoints,x.rightPoints=T.rightPoints,x.count=T.count}function a(x,T){var k=v(T);x.mid=k.mid,x.left=k.left,x.right=k.right,x.leftPoints=k.leftPoints,x.rightPoints=k.rightPoints,x.count=k.count}function l(x,T){var k=x.intervals([]);k.push(T),a(x,k)}function c(x,T){var k=x.intervals([]),M=k.indexOf(T);return M<0?t:(k.splice(M,1),a(x,k),n)}o.intervals=function(x){return x.push.apply(x,this.leftPoints),this.left&&this.left.intervals(x),this.right&&this.right.intervals(x),x},o.insert=function(x){var T=this.count-this.leftPoints.length;if(this.count+=1,x[1]3*(T+1)?l(this,x):this.left.insert(x):this.left=v([x]);else if(x[0]>this.mid)this.right?4*(this.right.count+1)>3*(T+1)?l(this,x):this.right.insert(x):this.right=v([x]);else{var k=e.ge(this.leftPoints,x,g),M=e.ge(this.rightPoints,x,y);this.leftPoints.splice(k,0,x),this.rightPoints.splice(M,0,x)}},o.remove=function(x){var T=this.count-this.leftPoints;if(x[1]3*(T-1))return c(this,x);var M=this.left.remove(x);return M===r?(this.left=null,this.count-=1,n):(M===n&&(this.count-=1),M)}else if(x[0]>this.mid){if(!this.right)return t;var C=this.left?this.left.count:0;if(4*C>3*(T-1))return c(this,x);var M=this.right.remove(x);return M===r?(this.right=null,this.count-=1,n):(M===n&&(this.count-=1),M)}else{if(this.count===1)return this.leftPoints[0]===x?r:t;if(this.leftPoints.length===1&&this.leftPoints[0]===x){if(this.left&&this.right){for(var R=this,O=this.left;O.right;)R=O,O=O.right;if(R===this)O.right=this.right;else{var N=this.left,M=this.right;R.count-=O.count,R.right=O.left,O.left=N,O.right=M}s(this,O),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?s(this,this.left):s(this,this.right);return n}for(var N=e.ge(this.leftPoints,x,g);N=0&&x[M][1]>=T;--M){var C=k(x[M]);if(C)return C}}function h(x,T){for(var k=0;kthis.mid){if(this.right){var k=this.right.queryPoint(x,T);if(k)return k}return f(this.rightPoints,x,T)}else return h(this.leftPoints,T)},o.queryInterval=function(x,T,k){if(xthis.mid&&this.right){var M=this.right.queryInterval(x,T,k);if(M)return M}return Tthis.mid?f(this.rightPoints,x,k):h(this.leftPoints,k)};function p(x,T){return x-T}function g(x,T){var k=x[0]-T[0];return k||x[1]-T[1]}function y(x,T){var k=x[1]-T[1];return k||x[0]-T[0]}function v(x){if(x.length===0)return null;for(var T=[],k=0;k>1],C=[],R=[],O=[],k=0;k[1,e],iFt=({width:e,marginRight:t})=>[-1,e-t],oFt=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],sFt=({marginTop:e})=>[1,e],aFt=({height:e,marginBottom:t})=>[-1,e-t],lFt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function uK(e){return typeof e=="string"?{anchor:e}:e}function cFt(e={},t={}){arguments.length===1&&([e,t]=fK(e));let{anchor:n="left",padding:r=1,r:i=t.r}=uK(e);switch(`${n}`.toLowerCase()){case"left":n=rFt;break;case"right":n=iFt;break;case"middle":n=oFt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hK("x","y",n,kr(r),i,t)}function uFt(e={},t={}){arguments.length===1&&([e,t]=fK(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=uK(e);switch(`${n}`.toLowerCase()){case"top":n=sFt;break;case"bottom":n=aFt;break;case"middle":n=lFt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hK("y","x",n,kr(r),i,t)}function fK(e){const{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function hK(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:l}=o;s=JA(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&l===void 0&&(o.sort={channel:"-r"})}return no(o,function(s,a,l,c,u,f){let{[t]:h,r:p}=l;if(!l[t])throw new Error(`missing channel: ${t}`);({[t]:h}=u1(l,c,f));const g=p?void 0:i!==void 0?kr(i):this.r!==void 0?this.r:3;p&&(p=fn(p.value,c[p.scale]||de,Float64Array));let[y,v]=n(u);const b=y?hFt:fFt,_=new Float64Array(h.length),S=p?x=>p[x]:()=>g;for(let x of a){const T=nFt();x=x.filter(p?M=>Qx(h[M])&&hu(p[M]):M=>Qx(h[M]));const k=new Float64Array(2*x.length+2);for(const M of x){const C=S(M),R=y?C+r:0,O=h[M]-C,N=h[M]+C;let L=2;T.queryInterval(O-r,N+r,([,,I])=>{const F=_[I]-R,D=h[M]-h[I],P=r+(p?p[M]+p[I]:2*g),z=Math.sqrt(P*P-D*D);k[L++]=F-z,k[L++]=F+z});let $=k.slice(0,L);y&&($=$.filter(I=>I>=0));t:for(const I of $.sort(b)){for(let F=0;Fe(t,r=>n[r]))}const gFt={mapIndex(e,t,n){const[r,i]=di(e,s=>t[s]),o=i-r;for(const s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},T$=E3((e,t)=>{for(let n=0;n{for(let n=e.length-1;n>=0;--n){const r=t[e[n]];if(Bi(r))return r}}),yFt={mapIndex(e,t,n){const r=sS(e,o=>t[o]),i=Tv(e,o=>t[o]);for(const o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},vFt=Cg(Vr),bFt=Cg(sS),_Ft=Cg(Ny),wFt=Cg(Dr),xFt=Cg(el);function SFt(e,t){return dK("x",e,t)}function EFt(e,t){return dK("y",e,t)}function dK(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]=jA(t.replace(/^[+-]/,"")),i*=c}t=JS(t),r=(c,u)=>t.offset(c,u)}const o=`${e}1`,s=`${e}2`,a=dc({[o]:c=>c.map(u=>r(u,i)),[s]:c=>c},n),l=a[s].transform;return a[s].transform=()=>{const c=l(),[u,f]=di(c);return c.domain=i<0?[u,r(f,i)]:[r(u,i),f],c},a}function TFt(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return i8(t);case"last":return o8(t)}if(typeof e=="function")return Xf(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=kFt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return Xf(n,r,t)}function kFt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return s8;case"max":return a8}throw new Error(`unknown selector: ${e}`)}function i8(e){return Xf(null,MFt,e)}function o8(e){return Xf(null,CFt,e)}function pK(e){return Xf("x",s8,e)}function gK(e){return Xf("y",s8,e)}function mK(e){return Xf("x",a8,e)}function yK(e){return Xf("y",a8,e)}function*MFt(e){yield e[0]}function*CFt(e){yield e[e.length-1]}function*s8(e,t){yield k_t(e,n=>t[n])}function*a8(e,t){yield vC(e,n=>t[n])}function Xf(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}const r=lh(n);return vl(n,(i,o)=>{const s=fn(i,r),a=fn(i,e),l=[];for(const c of o){const u=[];for(const f of s?eh(c,h=>s[h]).values():[c])for(const h of t(f,a))u.push(h);l.push(u)}return{data:i,facets:l}})}vr.prototype.plot=function({marks:e=[],...t}={}){return OR({...t,marks:[...e,this]})};const AFt=Object.freeze(Object.defineProperty({__proto__:null,Area:v3,Arrow:mJ,BarX:qR,BarY:jR,Cell:b3,Contour:DJ,Density:$J,Dot:_3,Frame:rJ,Geo:UJ,Hexgrid:zJ,Image:qJ,Line:w3,Link:pJ,Mark:vr,Raster:RJ,Rect:y3,RuleX:lX,RuleY:cX,Text:c3,TickX:xJ,TickY:SJ,Tip:iJ,Vector:u3,WaffleX:rK,WaffleY:iK,area:p5,areaX:lv,areaY:Y0,arrow:HOt,auto:oDt,autoSpec:yJ,axisFx:IX,axisFy:NX,axisX:TR,axisY:ER,barX:jh,barY:Vh,bin:Fh,binX:pf,binY:gf,bollinger:od,bollingerX:EDt,bollingerY:TDt,boxX:MDt,boxY:CDt,cell:Gp,cellX:JOt,cellY:KOt,centroid:PJ,circle:eDt,cluster:YLt,column:Rs,contour:qDt,crosshair:VDt,crosshairX:WDt,crosshairY:YDt,delaunayLink:oLt,delaunayMesh:sLt,density:fLt,differenceX:pLt,differenceY:gLt,dodgeX:cFt,dodgeY:uFt,dot:fh,dotX:QOt,dotY:tDt,filter:iNt,find:bNt,formatIsoDate:WG,formatMonth:FIt,formatNumber:VG,formatWeekday:$It,frame:IR,geo:t8,geoCentroid:mLt,graticule:bLt,gridFx:BX,gridFy:FX,gridX:$X,gridY:LX,group:iR,groupX:ev,groupY:nv,groupZ:rR,hexagon:nDt,hexbin:_Lt,hexgrid:SLt,hull:aLt,identity:de,image:CLt,indexOf:gi,initializer:no,interpolateNearest:JR,interpolateNone:y5,interpolatorBarycentric:XR,interpolatorRandomWalk:KR,legend:$7t,line:x3,lineX:cv,lineY:uv,linearRegressionX:FLt,linearRegressionY:$Lt,link:gJ,map:dc,mapX:WR,mapY:YR,marks:Na,normalize:r8,normalizeX:dFt,normalizeY:pFt,numberInterval:nG,plot:OR,pointer:s3,pointerX:a3,pointerY:av,raster:RDt,rect:NR,rectX:s2,rectY:a2,reverse:oNt,ruleX:Hf,ruleY:Gf,scale:ov,select:TFt,selectFirst:i8,selectLast:o8,selectMaxX:mK,selectMaxY:yK,selectMinX:pK,selectMinY:gK,shiftX:SFt,shiftY:EFt,shuffle:sNt,sort:uG,sphere:vLt,spike:T7t,stackX:KX,stackX1:q7t,stackX2:j7t,stackY:ZX,stackY1:V7t,stackY2:W7t,text:j0,textX:dX,textY:pX,tickX:EJ,tickY:TJ,timeInterval:VA,tip:oJ,transform:vl,tree:eK,treeLink:WJ,treeNode:v5,utcInterval:YS,valueof:fn,vector:EX,vectorX:TX,vectorY:kX,voronoi:lLt,voronoiMesh:cLt,waffleX:KLt,waffleY:ZLt,window:S3,windowX:hDt,windowY:dDt},Symbol.toStringTag,{value:"Module"})),RFt=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 NFt(e,t,n){for(let r=0;r{const o=n[i];if(o===Xv){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);const s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function $Ft(e,t){const{marks:n}=t;Qb("x",e,n),Qb("y",e,n),Qb("fx",e,n),Qb("fy",e,n)}function Qb(e,t,n){const r=t[e]||{};if(r.axis===null||r.label!==void 0)return;const i=n.map(s=>s.channelField(e)?.field);if(i.every(s=>s==null))return;let o;for(let s=0;sthis.render())),this.synch.promise}async render(){this.pendingRender=!1;const t=await LFt(this),n=this.legends.flatMap(({legend:r,include:i})=>{const o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return DP(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(o=>o.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 qFt(e,t,n){const r=e.getAttribute("aspectRatio");if(r==null)return;const i=e.getAttribute("xDomain"),o=e.getAttribute("yDomain");if(!i||!o)return;const s=Math.abs(i[1]-i[0]);return Math.abs(o[1]-o[0])*e.innerWidth()/(r*s)+t+n}function bK(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Uf(e)!==null)}const jFt=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 VFt(e){return jFt.has(e)}const WFt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function YFt(e){return WFt.has(`${e}`.toLowerCase())}const _K=e=>e==="stroke"||e==="fill",HFt=e=>/opacity$/i.test(e),GFt=e=>e==="symbol",XFt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),Yk=(e,t)=>({channel:e,field:t,as:z2(t)&&!u0t(t)?t.column:e}),Hk=(e,t)=>({channel:e,value:t}),T5=e=>Array.isArray(e);let hh=class extends Id{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n;const o=this.channels=[],s=this.detail=new Set,a=this.params=new Set;T5(n)?this.data=gd(n):Sa(n?.table)&&a.add(n.table);const l=(c,u)=>{const f=typeof u;if(c==="channels")for(const h in u)s.add(h),l(h,u[h]);else if(f==="function"&&u[ZW]){const h=u(this,c);for(const p in h)l(p,h[p])}else if(f==="string")VFt(c)||_K(c)&&bK(u)||GFt(c)&&YFt(u)?o.push(Hk(c,u)):o.push(Yk(c,kt(u)));else if(yv(u)){const h=Hk(c,u.value);o.push(h),u.addEventListener("value",p=>(h.value=p,this.update()))}else mu(u)?(Bgt(u).forEach(h=>a.add(h)),o.push(Yk(c,u))):f==="object"&&XFt(c,u)?o.push(Yk(c,u)):u!==void 0&&o.push(Hk(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?Sa(t)?t.value:t:null}hasOwnData(){return this.source==null||T5(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(),o=await uC(this.coordinator,Array.from(r,([a,l])=>({table:i,column:a,stats:Array.from(l)}))),s=Object.fromEntries(o.map(a=>[a.column,a]));for(const a of this.channels){const{field:l}=a;l&&Object.assign(a,s[l.stats?.column??l])}this._fieldInfo=!0}query(t=[]){return this.hasOwnData()?null:l8(this.channels,this.sourceTable()).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=gd(t),this}update(){return this.plot.update(this)}plotSpecs(){const{type:t,data:n,detail:r,channels:i}=this;return wK(t,r,i,n)}};function aa(e,t){const n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:_K(e.channel)?{value:n,scale:"color"}:HFt(e.channel)?{value:n,scale:"opacity"}:n}function l8(e,t,n=[]){const r=qt.from({source:t}),i=new Set;let o=!1;for(const s of e){const{channel:a,field:l,as:c}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value??l);else if(l){if(Qf(l))o=!0;else{if(i.has(c))continue;i.add(c)}r.select({[c]:l})}}}return o&&r.groupby(Array.from(i)),r}function wK(e,t,n,r,i={}){const{numRows:o,values:s,columns:a}=r??{},l={};for(const f of n){const h=t.has(f.channel)?l:i;h[f.channel]=aa(f,a)}return t.size&&(i.channels=l),[{type:e,data:s??(r?{length:o}:null),options:i}]}function d2(e,t){const{plot:n}=e;let r=n.getAttribute(`${t}Scale`);if(!r){const{type:o}=e.channelField(t);r=o==="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 I6(i)}function Jf(e,t,n,r,i=1,o){const{field:s}=e.channelField(t);o=o??s;const{type:a,apply:l,sqlApply:c}=d2(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,h]=r.map(y=>l(y)),p=c(o),g=a==="time"||a==="utc"?p:o;return[Hgt(p,f,h,n-i,u),g]}const xK={x:["min","max"]},SK={y:["min","max"]},EK={...xK,...SK};function TK(e,t,n,r,i){const{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[ul])return s;{const{column:l,min:c,max:u}=e.channelField(n),f=kK(t,l)||(a?Au().domain([c,u]).nice().domain():[c,u]);return s!==Xv&&(f[ul]=!0),o.setAttribute(r,f,{silent:!0}),f}}function m1(e,t){return TK(e,t,"x","xDomain","xNice")}function y1(e,t){return TK(e,t,"y","yDomain","yNice")}function kK(e,t){if(!e)return;let n,r;return[e].flat().forEach(i=>hd(i,o=>{if(o instanceof aP&&`${o.expr}`===t){const s=(o.extent??[]).map(a=>a?.value??a);(n==null||s[0]r)&&(r=s[1])}})),n!=null&&r!=null&&n!==r?[n,r]:void 0}class JFt extends hh{constructor(t,n,r){const i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["count","min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){const{plot:n,dim:r,source:i}=this;let o=i.options?.optimize;const s=super.query(t);if(!r)return s;const a=r==="x"?"y":"x",l=this.channelField(a,{exact:!0})?.as,{field:c,as:u,type:f,count:h,min:p,max:g}=this.channelField(r),y=f==="date"||f==="number",v=r==="x"?n.innerWidth():n.innerHeight();if(o??=h/v>10,o&&y&&l){const[b,_]=kK(t,c)||[p,g],[S]=Jf(this,r,v,[b,_],1,u),x=s._select.map(T=>T.alias).filter(T=>T!==u&&T!==l);return dmt(s,S,u,l,x)}else return s.orderby(u)}}function k5(e,t=[]){return new t.constructor(e)}function KFt(e,t,n,r,i){const o=t.length,s={},a=[];if(i?.length){const l=new Int32Array(o),c=i.map(h=>r[h]),u={};for(let h=0;hg[h]);l[h]=u[p]??=a.push(p)-1}for(let h=0;hp[h]);const f=s._grid=a.map(()=>k5(e,n));for(let h=0;hr[p]),u={},f=[],h=new Int32Array(a);if(o?.length){const p=o.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(s){const p=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((S,x)=>s(y[x],e,t,p,g,_))})}else i.forEach((p,g)=>{const y=c[g],v=u[p]=f.map(()=>k5(l,y));for(let b=0;b{const i=r.length;for(let o=0;on&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function QFt(e){const t=new lg;return e.forEach(n=>{const r=n.length;for(let i=0;i0;p-=2)f[p]+=c[g]*f[p-2]-c[g+1]*f[p-1],f[p+1]+=c[g]*f[p-1]+c[g+1]*f[p-2];for(p=0;p<=g;p+=2)f[p]+=i[g]*h[p]-i[g+1]*h[p+1],f[p+1]+=i[g]*h[p+1]+i[g+1]*h[p];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],p=g;p>0;p-=2)h[p]+=c[g]*h[p-2]-c[g+1]*h[p-1],h[p+1]+=c[g]*h[p-1]+c[g+1]*h[p-2]}for(g=0;g<4;++g)p=g<<1,t[g]=f[p]/u,e[g+1]=h[p+2]}function e$t(e,t,n,[r,i]){const o=new Float64Array(Math.max(r,i)),s=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=Gi(o,h=>(this.interpolate=h,this.requestUpdate())),this.pixelSize=Gi(s,h=>(this.pixelSize=h,this.requestUpdate())),this.pad=Gi(a,h=>(this.pad=h,this.requestUpdate())),this.width=Gi(l,h=>(this.width=h,this.requestUpdate())),this.height=Gi(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[ul]&&!n[ul]}query(t=[]){const{interpolate:n,pad:r,channels:i,densityMap:o}=this,[s,a]=this.extentX=m1(this,t),[l,c]=this.extentY=y1(this,t),[u,f]=this.bins=this.binDimensions(),[h,p]=Jf(this,"x",u,[s,a],r),[g,y]=Jf(this,"y",f,[l,c],r),v=r?[To(p,[+s,+a]),To(y,[+l,+c])]:[Yl(+s,p),fi(p,+a),Yl(+l,y),fi(y,+c)],b=qt.from(this.sourceTable()).where(t.concat(v)),_=this.groupby=[],S={};for(const T of i)if(Object.hasOwn(T,"field")){const{as:k,channel:M,field:C}=T;Qf(C)?(S[M]=C,o[M]=!0):M==="weight"?S[Al]=Tr(C):M!=="x"&&M!=="y"&&(b.select({[k]:C}),_.push(k))}const x=this.aggr=Object.keys(S);if(S.density&&x.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(x.length||(x.push(Al),S[Al]=er()),n==="linear"){if(x.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!S[Al])throw new Error("Linear binning not applicable to custom aggregates.");const T=N6(S[Al])[0];return fmt(b,h,g,T,u,_)}else return Ggt(b,h,g,S,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=i$t(this.interpolate),{columns:o}=gd(t);return this.grids0=ZFt(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){const{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){const s=t.length===1?t[0]:t.includes(Al)?Al:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;const a=i.columns[s],l=o.innerWidth(),c=o.innerHeight(),[u,f]=r,h=a.some(y=>y.some(v=>v<0)),p=M5(n*(u-1)/l,h),g=M5(n*(f-1)/c,h);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(y=>e$t(p,g,y,r))}}}return this}}function r$t(e){const t={};for(const n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function i$t(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return JR;case"barycentric":return XR();case"random-walk":return KR()}throw new Error(`invalid interpolate: ${e}`)}class o$t extends T3{constructor(t,n){const{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=Gi(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){const{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r;let l=i,c;if(Array.isArray(l))c=l;else{const[,N]=c8(a.density);c=Array.from({length:l-1},(L,$)=>N*($+1)/l)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);const[u,f]=t,[h,p]=o.getAttribute("xDomain"),[g,y]=o.getAttribute("yDomain"),v=(p-h)/u,b=(y-g)/f,_=+h,S=+g,x=N=>_+N*v,T=N=>S+N*b,k=Ex().size(t),M=this.contourData=Array(s*c.length),{density:C,...R}=a,O=Object.entries(R);for(let N=0,L=0;N(F[D]=P[N],F),{});for(let F=0;Fn)}function MK(e,t){const n=t.reduce((i,o,s)=>(i[o]=s,i),{}),r=u8(e.length);return r.sort((i,o)=>n[e[i]]-n[e[o]]),r}function CK(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 a$t(e=1){const t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o{for(let s=0,a=0;s{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:o,columns:s}=n,{canvas:a,ctx:l,img:c}=m$t(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:p}=AK(this),g=s[f]??[],y=s[p]??[],v=o>1&&p&&this.groupby?.includes(p)?MK(y,this.plot.getAttribute("colorDomain")):u8(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(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,o={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:o}]}}class h$t extends f8{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}}function AK(e){const{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(Al),s=t.includes("fillOpacity"),a=e.channel("fill"),l=e.channel("fillOpacity");if(t.length>2||o&&s)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":bK(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof l?.value=="number"?l.value:o&&c!=="grid"?"grid":void 0;if(c!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");const f=a?.as??(c==="grid"?Al:null),h=l?.as??(u==="grid"?Al:null),p=c!=="grid"&&c!=="group"?c$t(c):p$t(e,f),g=u!=="grid"?a$t(u):d$t(e,h);return{alphaProp:h,colorProp:f,alpha:g,color:p}}function d$t(e,t){const{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===Xv,s=i?.[ul],a=!o&&!s&&i||c8(r.columns[t]);(o||s||!i)&&(o||(a[ul]=!0),n.setAttribute("opacityDomain",a));const l=ov({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 l$t(l)}function p$t(e,t){const{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),l=a===Xv,c=a?.[ul],u=!l&&!c&&a||(o?i.slice().sort(Un):s?QFt(i):c8(i));(l||c||!a)&&(l||(u[ul]=!0),n.setAttribute("colorDomain",u));const f=ov({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(s)return u$t(f);{const h=ov({x:{type:g$t(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return f$t(1024,f,h.apply)}}function g$t(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function m$t(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){const r=CK(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}class y$t extends f8{constructor(t,n){const{normalize:r=!0,...i}=n;super(t,i),this.normalize=Gi(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){const{channels:n,normalize:r,pad:i}=this,[o,s]=this.bins=this.binDimensions(),[a]=Jf(this,"x",o,m1(this,t),i),[l]=Jf(this,"y",s,y1(this,t),i),c=qt.from(this.sourceTable()).where(v$t(this,t));this.aggr=["density"];const u=this.groupby=[],f=[];for(const h of n)if(Object.hasOwn(h,"field")){const{channel:p,field:g}=h;p==="z"?(c.select({[p]:g}),f.push("z")):p!=="x"&&p!=="y"&&(c.select({[p]:g}),u.push(p))}return hmt(c,a,l,f,o,s,u,r)}}function v$t(e,t){if(Array.isArray(t)&&!t.length)return t;const n=e.channelField("x").column,r=e.channelField("y").column,i=s=>{const a=`${s.expr}`;return s.type!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?Ci(s.clauses.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}const b$t={fill:1,stroke:1,z:1};class RK extends hh{constructor(t,n,r){const{bins:i=1024,bandwidth:o=20,normalize:s=!1,stack:a=!1,...l}=r,c=t.endsWith("X")?"y":"x";super(t,n,l,c==="x"?xK:SK),this.dim=c,this.bins=Gi(i,u=>(this.bins=u,this.requestUpdate())),this.bandwidth=Gi(o,u=>(this.bandwidth=u,this.grids?this.convolve().update():null)),this.normalize=Gi(s,u=>(this.normalize=u,this.convolve().update())),this.stack=Gi(a,u=>(this.stack=u,this.update()))}get filterStable(){const t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[ul]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");const{bins:n,channels:r,dim:i}=this,o=this.extent=(i==="x"?m1:y1)(this,t),[s,a]=Jf(this,i,n,o),l=l8(r,this.sourceTable(),[i]).where(t.concat(To(a,o))),c=this.channelField("weight")?"weight":null,u=this.groupby=r.flatMap(f=>b$t[f.channel]&&f.field?f.as:[]);return cmt(l,s,c,u)}queryResult(t){const n=gd(t).columns;return this.grids=KFt(this.bins,n.index,n.density,n,this.groupby),this.convolve()}convolve(){const{bins:t,bandwidth:n,normalize:r,dim:i,grids:o,groupby:s,plot:a,extent:[l,c]}=this,u=o.columns,f=o.numRows,h=this.channelField(i).as,p=i==="x"?"y":"x",g=i==="x"?a.innerWidth():a.innerHeight(),y=u._grid.some(M=>M.some(C=>C<0)),v=M5(n*(t-1)/g,y),b=+l,_=(c-b)/(t-1),S=t*f,x=new Float64Array(S),T=new Float64Array(S),k=s.reduce((M,C)=>(M[C]=Array(S),M),{});for(let M=0,C=0;Ck[L].fill(u[L][C],M,M+t));const R=u._grid[C],O=C5(v,R,t),N=1/_$t(R,O,_,r);for(let L=0;La.apply(v)),[f,h]=i.map(v=>l.apply(v)),p=(u-c)/(o-n),g=(h-f)/(s-n),y=n?0:.5;return this.data=x$t(this.grids,t,c,f,p,g,a.invert,l.invert,y),this}plotSpecs(){const{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(const a of n){const{channel:l}=a;s[l]=l==="x"||l==="y"?o[l]:aa(a,o)}for(const a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}}function x$t(e,t,n,r,i,o,s,a,l){const c=1/(i*o),[u,f]=t,h=u*f,p=h*e.numRows,g=new Float64Array(p),y=new Float64Array(p),v=new Float64Array(p),b={x:g,y,density:v},{density:_,...S}=e.columns;for(const T in S)b[T]=new S[T].constructor(p);let x=0;for(let T=0;T=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,p=c+u,e=1&&(h=.5*(h+c+1)),Math.abs(c)0)break}return h}function E$t(e,t,n){var r=e===0||e===1?0:Math.exp(p0(t+n)-p0(t)-p0(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*k$(e,t,n)/t:1-r*k$(1-e,n,t)/n}function k$(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,l=1,c=1-o*e/s,u,f,h,p;for(Math.abs(c).5?n:-n}function k$t(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 NK extends hh{constructor(t,n,r){const i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=r;super(t,n,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=Gi(o,a=>(this.ci=a,this.update()))}query(t=[]){const{channels:n,field:r}=this,i=n.concat([{field:Y2(r),as:"__avg__"},{field:ur(pP(r),by(er(r))),as:"__se__"}]);return l8(i,this.sourceTable()).where(t)}queryResult(t){return this.data=gd(t),this}plotSpecs(){const{type:t,dim:n,detail:r,data:i,ci:o,channels:s}=this,a=Math.SQRT2*k$t(o),{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 wK(t,r,s,i,u)}}const M$t="geom";class C$t extends hh{constructor(t,n={},r){!T5(t)&&!n?.geometry&&(n.geometry=bP(M$t)),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 A$t extends hh{constructor(t,n){const{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},EK),this.binWidth=Gi(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterStable(){const t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ul]&&!n[ul]}query(t=[]){if(this.hasOwnData())return null;const{plot:n,binWidth:r,channels:i}=this;let o,s;const a=new Set,l={};for(const O of i)if(O.channel!=="orderby"){if(O.channel==="x")o=O;else if(O.channel==="y")s=O;else if(Object.hasOwn(O,"field")){const{as:N,field:L}=O;l[N]=L,Qf(L)||a.add(N)}}const[c,u]=m1(this,t),[f,h]=y1(this,t),p=.5-n.getAttribute("marginLeft"),g=0-n.getAttribute("marginTop"),y=vo(r),v=vo(r*(1.5/Math.sqrt(3))),b=vo(n.innerWidth()/(u-c)),_=vo(n.innerHeight()/(h-f)),S="_x",x="_y",T="_px",k="_py",M="_pi",C="_pj",R="_tt";return qt.select({[o.as]:Hn(vo(c),ur(Hn(ze(Hn(S,ze(.5,iT(x,1))),y),p),b)),[s.as]:Ue(vo(h),ur(Hn(ze(x,v),g),_)),...l}).groupby(S,x,...a).from(qt.select({[k]:ur(Ue(ze(_,Ue(h,s.field)),g),v),[C]:bi(_y(k)),[T]:Ue(ur(Ue(ze(b,Ue(o.field,c)),p),y),ze(.5,iT(C,1))),[M]:bi(_y(T)),[R]:Ci(fa(ze(po(Ue(k,C)),3),1),fa(Hn(Ji(Ue(T,M),2),Ji(Ue(k,C),2)),Hn(Ji(Ue(Ue(T,M),ze(.5,Xo(fi(T,M),-1,1))),2),Ji(Ue(Ue(k,C),Xo(fi(k,C),-1,1)),2)))),[S]:Xo(R,bi(Hn(Hn(M,Xo(fi(T,M),-.5,.5)),Xo(vv(iT(C,1),0),.5,-.5))),M),[x]:Xo(R,bi(Hn(C,Xo(fi(k,C),-1,1))),C)},"*").from(this.sourceTable()).where(ec(o.field),ec(s.field),t))}}class R$t extends T3{constructor(t,n){const{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),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:o}=this,[[s,a],[l,c]]=t,[u,f]=this.bins,[h,p]=Jf(this,"x",u,[s,a],r),[g,y]=Jf(this,"y",f,[l,c],r),v=r?[To(p,[+s,+a]),To(y,[+l,+c])]:[Yl(+s,p),fi(p,+a),Yl(+l,y),fi(y,+c)],b=qt.from(this.sourceTable()).where(v),_=this.groupby=[],S={};for(const T of i)if(Object.hasOwn(T,"field")){const{as:k,channel:M,field:C}=T;C.aggregate?(S[M]=C,o[M]=!0):M==="weight"?S.density=Tr(C):M!=="x"&&M!=="y"&&(b.select({[k]:C}),_.push(k))}const x=this.aggr=Object.keys(S);if(S.density&&x.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(x.length||(x.push("density"),S.density=er()),n==="linear"){if(x.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!S.density)throw new Error("Linear binning not applicable to custom aggregates.");return L$t(b,h,g,S.density,u,_)}else return D$t(b,h,g,S,u,_)}async requestTiles(){const t=Ia();this.prefetch&&t.cancel(this.prefetch);const{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,l]=this.bins=this.binDimensions(),[c,u]=m1(this,this._filter),[f,h]=y1(this,this._filter),p=u-c,g=h-f,y=Math.floor((c-o)*(a-n)/p),v=Math.floor((f-s)*(l-n)/g),b=(N,L)=>[[o+N*p,o+(N+1)*p],[s+L*g,s+(L+1)*g]],_=Math.floor((c-o)/p),S=r?M$((u-o)/p):_,x=Math.floor((f-s)/g),T=i?M$((h-s)/g):x,k=[];for(let N=_;N<=S;++N)for(let L=x;L<=T;++L)k.push([N,L]);const M=k.map(([N,L])=>t.query(this.tileQuery(b(N,L)))),C=[];if(r)for(let N=x;N<=T;++N)C.push([S+1,N]),C.push([_-1,N]);if(i){const N=r?_-1:_,L=r?S+1:S;for(let $=N;$<=L;++$)C.push([$,T+1]),C.push([$,x-1])}this.prefetch=C.map(([N,L])=>t.prefetch(this.tileQuery(b(N,L))));const R=await Promise.all(M),O=N$t(a,l,y,v,k,R);this.grids0={numRows:O.length,columns:{density:[O]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){const{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:l,img:c}=O$t(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:p}=AK(this),g=s[f]??[],y=s[p]??[],v=o>1&&p&&this.groupby?.includes(p)?MK(y,this.plot.getAttribute("colorDomain")):u8(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(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,o={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:o}]}}function N$t(e,t,n,r,i,o){const s=new Float64Array(e*t);return o.forEach((a,l)=>{const[c,u]=i[l],f=c*e-n,h=u*t-r;I$t(e,t,s,a,f,h)}),s}function I$t(e,t,n,r,i,o){const s=r.numRows;if(s===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:p}),l=a(ee`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,ee`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),c=a(ee`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,ee`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(ee`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,ee`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(ee`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,ee`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return qt.from(qt.unionAll(l,c,u,f)).select({index:"i",density:Tr("w")},o).groupby("index",o).having(vv("density",0))}function M$(e){const t=Math.floor(e);return t===e?t-1:t}class F$t extends hh{constructor(t,n){const{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);const s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=Gi(r,a=>(this.ci=a,s())),this.precision=Gi(i,a=>(this.precision=a,s()))}query(t=[]){const n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return qt.from(super.query(t)).select({intercept:W0t(r,n),slope:G0t(r,n),n:dP(r,n),ssy:H0t(r,n),ssx:Y0t(r,n),xm:hP(r,n),x0:vo(tl(n).where(ec(r))),x1:vo(Ma(n).where(ec(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=gd(t),this.lineData=$$t(this.modelFit),this.confidenceBand()}confidenceBand(){const{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?B$t(n,t,r,o):null,this}plotSpecs(){const{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},l={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(const c of r)switch(c.channel){case"x":case"y":case"fill":break;case"tip":l.tip=aa(c,s);break;case"stroke":a.stroke=aa(c,o),l.fill=aa(c,s);break;case"strokeOpacity":a.strokeOpacity=aa(c,o);break;case"fillOpacity":l.fillOpacity=aa(c,s);break;default:a[c.channel]=aa(c,o),l[c.channel]=aa(c,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:l}]:[],{type:"line",data:{length:t.numRows},options:a}]}}function Gk(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 $$t(e){const{x0:t=[],x1:n=[],xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:l,...c}=e.columns,u=(p,g)=>i[g]+p*o[g],f=Gk(t,n),h=Gk(t.map(u),n.map(u));for(const p in c)c[p]=Gk(c[p],c[p]);return{numRows:f.length,columns:{x:f,y:h,...c}}}function B$t(e,t,n,r){const i=e.numRows,{x0:o,x1:s,xm:a,intercept:l,slope:c,n:u,ssx:f,ssy:h,...p}=e.columns,g=Object.keys(p),y={x:[],y1:[],y2:[]};g.forEach(v=>y[v]=[]);for(let v=0;v{const x=l[v]+S*c[v],T=_*Math.sqrt(1/u[v]+(S-a[v])**2/f[v]);y.x.push(S),y.y1.push(x-T),y.y2.push(x+T),g.forEach(k=>y[k].push(p[k][v]))})}return{numRows:y.x.length,columns:y}}function h8(e){e.tagName==="a"&&(e=e.children[0]);const t=e.__data__;return Array.isArray(t)?t[0]:t}function P$t(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}"]`,o=`${i} > *:not(g), ${i} > g > *`,s=this.nodes=t.querySelectorAll(o),{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:o,selection:s}=this;if(!t)return;const a=await q$t(o,s);for(let l=0;l!0;const r=e.filterBy?.predicate(e,!0),i={__:Ci(n)},o=e.query(r);(o.queries||[o]).forEach(l=>{l._groupby.length?l.select(i):l.setSelect(i)});const s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?l=>a.at(l):l=>s[l].__:()=>!1}function IK(){const e=this,t=e.getScreenCTM;let n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}function d8(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 o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function OK(){return d8(MCt())}function j$t(){return d8(TCt())}function V$t(){return d8(kCt())}function DK(e,t,n,r,i){let o=Er(t??e).append("g").attr("class",i);const s=e.scale("fx"),a=e.scale("fy");if(s||a){const l=s?.domain.map(u=>s.apply(u)-n),c=a?.domain.map(u=>a.apply(u)-r);if(l&&c)for(let u=0;u{const o=i==="color"?["color","fill","stroke"]:i==="x"?["x","x1","x2"]:i==="y"?["y","y1","y2"]:[i];for(let s=0;sthis.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=>R5(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),A5(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:o}=this;return cC(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:o,pixelSize:r})}init(t,n){const{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);const s=this.value?.map(this.scale.apply).sort(Un),a=t.scale("x").range,l=t.scale("y").range;if(r.extent([[Dr(a),Dr(l)],[Vr(a),Vr(l)]]),this.g=DK(t,n,Dr(a),Dr(l),`interval-${i}`).call(r).call(r.moveSilent,s),o){const c=this.g.selectAll("rect.selection");for(const u in o)c.attr(u,o[u])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}}class Y$t{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||H0(t,"x"),this.yfield=i||H0(t,"y"),this.style=a&&k3(a),this.brush=OK(),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:o}=this;let s,a;if(t){const[l,c]=t;s=[l[0],c[0]].map(u=>R5(u,i,r)).sort(Un),a=[l[1],c[1]].map(u=>R5(u,o,r)).sort(Un)}(!A5(s,n?.[0])||!A5(a,n?.[1]))&&(this.value=t?[s,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:o,xscale:s,yscale:a}=this;return dbt([i,o],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}init(t){const{brush:n,style:r,value:i}=this,o=this.xscale=t.scale("x"),s=this.yscale=t.scale("y"),a=o.range,l=s.range;if(n.extent([[Dr(a),Dr(l)],[Vr(a),Vr(l)]]),this.g=DK(t,null,Dr(a),Dr(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(o.apply).sort(Un),[f,h]=i[1].map(s.apply).sort(Un);this.g.call(n.moveSilent,[[c,f],[u,h]])}t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}}class g8{constructor(t,{selection:n,pointer:r,channels:i,fields:o,maxRadius:s=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=o||this.channels.map(a=>H0(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){const{clients:n,fields:r}=this,i={source:this,clients:n};return r.length>1?nS(r,t&&[t],i):Uw(r[0],t?.[0],i)}init(t){const n=this,{mark:r,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=r,l=i.map(y=>r.channelField(y).as),c=!ko(o),[u,f]=H$t(t,r),h=this.pointer==="y"?.01:1,p=this.pointer==="x"?.01:1,g=Er(t);g.on("pointerenter pointerdown pointermove",function(y){const[v,b]=za(y,this),_=G$t(u,f,v,b,h,p,s);if(_!==this.valueIndex){this.valueIndex=_;const S=_<0?void 0:l.map(x=>a[x][_]);o.update(c?!S||S.length>1?S:S[0]:n.clause(S))}}),!c&&(g.on("pointerleave",()=>{o.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 H$t(e,t){const{data:{columns:n}}=t,r=f=>n[t.channelField(f)?.as],i=f=>e.scale(f),o=e.scale("x"),s=e.scale("y"),a=i("fx")?.apply,l=i("fy")?.apply,c=Array.from(r("x"),o.apply),u=Array.from(r("y"),s.apply);if(a){const f=Dr(o.range),h=r("fx");for(let p=0;pe-t;class X$t{constructor(t,{x:n=new b0,y:r=new b0,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:l=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||H0(t,"x"),this.yfield=o||H0(t,"y"),this.zoom=Xk(s,[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=J$t(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){const n=K$t(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return cC(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 o=this.xscale.range.slice().sort(A$),s=this.yscale.range.slice().sort(A$),a=Xk(n,[-1/0,1/0],o),l=Xk(r,[-1/0,1/0],s),c=M8t().extent([[o[0],s[0]],[o[1],s[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 jl(1,0,0)).on("zoom",({transform:u})=>this.publish(u));if(Er(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 Xk(e,t,n){return e?Array.isArray(e)?e:t:n}function J$t(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function K$t(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}const Z$t={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Q$t=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,tBt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,eBt=/^((\s+,?\s*)|(,\s*))/,nBt=/^[01]/,FK=e=>`Invalid SVG path, incorrect parameter ${e}`;function rBt(e){const t=[];return(e.match(Q$t)||[]).forEach(r=>{let i=r[0];const o=i.toLowerCase(),s=Z$t[o],a=iBt(o,s,r.slice(1).trim()),l=a.length;if(l=o&&p<=a&&g>=s&&y<=l)return!0;if(h<=a&&p>=o&&g<=l&&y>=s){let v=r.tagName;if(v==="a"&&(r=r.children[0],v=r.tagName),v==="rect"||v==="text"||v==="image")return!0;switch(o-=c,s-=u,a-=c,l-=u,v){case"circle":return BK(o,s,a,l,Rh(r.cx),Rh(r.cy),Rh(r.r));case"line":return PK(o,s,a,l,Rh(r.x1),Rh(r.y1),Rh(r.x2),Rh(r.y2));case"path":return sBt(o,s,a,l,r)}}return!1}function Rh(e){return e.baseVal.value}function $K(e){const t=e.transform.baseVal,n=t.length;let r=t[0]?.matrix;for(let i=1;ic)return!1;let u=o,f=a;const h=s-i;if(Math.abs(h)>1e-8){const y=(a-o)/h,v=o-y*i;u=y*l+v,f=y*c+v}const p=Math.max(Math.min(u,f),t),g=Math.min(Math.max(u,f),r);return p<=g}function sBt(e,t,n,r,i){const o=i.__path__||(i.__path__=rBt(i.getAttribute("d")));let s=0,a=0,l=0,c=0,u=!1,f=[0,0],h=2;const p=$K(i),g=(_,S)=>{f.length=h=2,f[0]=l=s=_,f[1]=c=a=S},y=p?(_,S)=>g(N$(p,_,S),I$(p,_,S)):(_,S)=>g(_,S),v=(_,S)=>(f[h]=_,f[h+1]=S,h+=2,PK(e,t,n,r,f[h-4],f[h-3],_,S)),b=p?(_,S)=>{u=v(N$(p,l=_,c=S),I$(p,_,S))}:(_,S)=>{u=v(l=_,c=S)};for(let _=0;_0)return!0;y(s,a);break;default:return console.warn("SVG path command not supported: ",S[0]),!1}if(u)return!0}return!1}function N$(e,t,n){return e.a*t+e.c*n+e.e}function I$(e,t,n){return e.b*t+e.d*n+e.f}function aBt(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 lBt(e,t,n){let r=0;const i=n.length-2;for(let o=0;ot&&O$(e,t,n,o)>0&&++r:n[o+3]<=t&&O$(e,t,n[o])<0&&--r;return r}function O$(e,t,n,r){return(n[r+2]-n[r])*(t-n[r+1])-(e-n[r])*(n[r+3]-n[r+1])}function UK(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>N5(n,t[r]))}function N5(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:s,as:a}=W$t(t,n);this.fields=s,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 nS(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}publish(t){const{as:n,group:r,mark:i,svg:o}=this;let s;if(t){const{data:{columns:a={}}={}}=i,l=new Map;oBt(o,r,t).forEach(c=>{const u=h8(c),f=n.map(h=>a[h][u]);l.set(f.join("|"),f)}),s=Array.from(l.values())}this.extent=t,UK(s,this.value)&&(this.value=s,this.selection.update(this.clause(s)))}init(t){const{brush:n,extent:r,mark:i,style:o}=this;this.svg=t;const s=t.width.baseVal.value,a=t.height.baseVal.value;if(n.extent([[0,0],[s,a]]),this.group=t.querySelector(`[data-index="${i.index}"]`),this.g=Er(t).append("g").attr("class","region-xy").each(IK).call(n).call(n.moveSilent,r),o){const l=this.g.selectAll("rect.selection");for(const c in o)l.attr(c,o[c])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}}class zK{constructor(t,{selection:n,channels:r,peers:i=!0}){this.mark=t,this.value=null,this.selection=n,this.peers=i;const o=this.fields=[],s=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;co.map(u=>a[u][h8(c)]),n??=`[data-index="${i.index}"]`;const l=Array.from(t.querySelectorAll(n));t.addEventListener("pointerdown",c=>{const u=s.single?s.value:this.value,f=c.target;let h=null;if(uBt(l,f)){const p=r(f);(c.shiftKey||c.metaKey)&&u?.length?(h=u.filter(g=>N5(g,p)),h.length===u.length&&h.push(p)):u?.length===1&&!N5(u[0],p)?h=null:h=[p]}this.value=h,UK(u,h)&&s.update(this.clause(h))}),t.addEventListener("pointerenter",c=>{c.buttons||this.activate()})}activate(){this.selection.activate(this.clause([this.fields.map(()=>0)]))}}function uBt(e,t){return e.some(n=>n.contains(t))}const qK=":scope > div, :scope > span",B_="swatch",D$="ramp";class L${constructor(t,n){const{as:r,field:i,...o}=n;this.channel=t,this.options=o,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=fBt(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,o=r?i:t.valueFor(n),s=o&&o.length?new Set(o.map(l=>l[0])):null,a=this.legend.querySelectorAll(qK);for(const l of a){const c=s?s.has(l.__data__):!0;l.style.opacity=c?1:.2}}}function fBt(e,t){const{channel:n,plot:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?B_:D$,a={label:r.getAttribute(`${n}Label`)??null,...e.options},l=s===B_?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&&s===D$){const f=l.width??240,h=gBt(o,f);h?c.scale=function(p){return p==="x"?{range:[0,f]}:p==="y"?{range:[-10,0]}:p===n?h:void 0}:u=!1}if(u){const f=hBt(e,s);s===B_?(f.init(c,qK,h=>[h.__data__]),e.update()):f.init(c,c.querySelector("g:last-of-type"))}return c}function hBt(e,t){const{channel:n,handler:r,selection:i}=e;if(r)return r;const o=dBt(e);return t===B_?(e.handler=new zK(o,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new p8(o,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function dBt(e){const{channel:t,plot:n}=e,r=e.field??pBt(n.marks,t)??"value";if(r){const i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function pBt(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 o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function gBt(e,t){const{apply:n,invert:r,interpolate:i,...o}=e;let s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return ov({x:{...o,type:a,range:[0,t]}})}const mBt=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function yBt(e,t){return mBt.has(`${e.type}-${t}`)}function vBt(e,t={}){const n=(r,i)=>yBt(r,i)?{[`${i}1`]:Jk(r,i,e,t),[`${i}2`]:Jk(r,i,e,{...t,offset:1})}:{[i]:Jk(r,i,e,t)};return n[ZW]=!0,n}function Jk(e,t,n,r){return new _Bt(n,e,t,r)}function bBt(e,t){const n=e.plot.getAttribute(`${t}Scale`);return n==="utc"||n==="time"}let _Bt=class extends oi{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:o,min:s,max:a}=t.channelField(n);return`${i.interval||o==="date"||bBt(t,n)?emt(r,[s,a],i):lmt(r,[s,a],i,d2(t,n))}`}},M3=class extends Id{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 wBt=e=>e&&typeof e=="object"&&!Array.isArray(e);class xBt extends M3{constructor({element:t,filterBy:n,as:r,from:i,column:o,label:s=o,format:a=f=>f,options:l,value:c,field:u=o}={}){super(n,t),this.from=i,this.column=o,this.format=a,this.field=u;const f=this.selection=r,h=document.createElement("label");if(h.innerText=s||o,this.element.appendChild(h),this.select=document.createElement("select"),this.element.appendChild(this.select),l&&(this.data=l.map(p=>wBt(p)?p:{value:p}),this.selectedValue(c===void 0?"":c),this.update()),f){const p=!ko(f);c!=null&&(!p||f.value===void 0)&&this.publish(c),this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),p?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(){ko(this.selection)&&this.selection.activate(Uw(this.field,0,{source:this}))}publish(t){const{selection:n,field:r}=this;if(ko(n)){t===""&&(t=void 0);const i=Uw(r,t,{source:this});n.update(i)}else Sa(n)&&n.update(t)}query(t=[]){const{from:n,column:r}=this;return n?qt.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:o,label:s}of t){const a=document.createElement("option");a.setAttribute("value",o),a.innerText=s??n(o),this.select.appendChild(a)}if(i){const o=ko(i)?i.valueFor(this):i.value;this.selectedValue(o===void 0?"":o)}return this}}let SBt=0;class EBt extends M3{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",field:a=i,as:l}={}){if(super(n,t),this.id="search_"+ ++SBt,this.type=s,this.from=r,this.column=i,this.selection=l,this.field=a,o){const c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,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)}),ko(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 gbt(n,t,{source:this,method:r})}activate(){ko(this.selection)&&this.selection.activate(this.clause(""))}publish(t){const{selection:n}=this;ko(n)?n.update(this.clause(t)):Sa(n)&&n.update(t)}query(t=[]){const{from:n,column:r}=this;return n?qt.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 TBt=0,kBt=class extends M3{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:l,label:c=l,value:u=r?.value,select:f="point",field:h=l,width:p}={}){if(super(n,t),this.id="slider_"+ ++TBt,this.from=a,this.column=l||"value",this.selection=r,this.selectionType=f,this.field=h,this.min=i,this.max=o,this.step=s,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"),p!=null&&(this.slider.style.width=`${+p}px`),i!=null&&this.slider.setAttribute("min",`${i}`),o!=null&&this.slider.setAttribute("max",`${o}`),s!=null&&this.slider.setAttribute("step",`${s}`),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&&(ko(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:qt.select({min:tl(r),max:Ma(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 cC(n,i,{source:this,bin:"ceil",scale:{type:"identity",domain:i},pixelSize:this.step})}else return Uw(n,t,{source:this})}activate(){ko(this.selection)&&this.selection.activate(this.clause(0))}publish(t){const{selection:n}=this;ko(n)?n.update(this.clause(t)):Sa(this.selection)&&n.update(t)}};const jK=WK(e=>{const t=m8(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?VK(n):`${n}`}),m8=WK(e=>t=>t===0?"0":t.toLocaleString(e));jK();m8();function VK(e){return MBt(e,"Invalid Date")}function WK(e){let t=null,n;return(r="en")=>r===t?n:n=e(t=r)}function MBt(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(+e))return t;const n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${CBt(e.getUTCFullYear())}-${Yc(e.getUTCMonth()+1,2)}-${Yc(e.getUTCDate(),2)}${n||r||i||o?`T${Yc(n,2)}:${Yc(r,2)}${i||o?`:${Yc(i,2)}${o?`.${Yc(o,3)}`:""}`:""}Z`:""}`}function CBt(e){return e<0?`-${Yc(-e,6)}`:e>9999?`+${Yc(e,6)}`:Yc(e,4)}function Yc(e,t){return`${e}`.padStart(t,"0")}let ABt=-1;class RBt extends M3{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:l,height:c=500,rowBatch:u=100,as:f}={}){super(n,t,null),this.id=`table-${++ABt}`,this.element.setAttribute("id",this.id),this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},Sa(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",p=>{const{isPending:g,loaded:y}=this,{scrollHeight:v,scrollTop:b,clientHeight:_}=p.target,S=b{const g=NBt(p.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 Sa(this.from)?this.from.value:this.from}clause(t=[]){const{data:n,limit:r,schema:i}=this,o=i.map(a=>a.column),s=t.map(a=>{const{columns:l}=n[~~(a/r)];return o.map(c=>l[c][a%r])});return nS(o,s,{source:this})}requestData(t=0){this.offset=t;const n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),Ia().prefetch(n.clone().offset(t+this.limit))}async prepare(){const t=this.sourceTable(),n=this.columns.map(s=>({column:s,table:t})),r=await uC(this.coordinator,n);this.schema=r;const i=this.head;i.innerHTML="";const o=document.createElement("tr");for(const{column:s}of r){const a=document.createElement("th");a.addEventListener("click",l=>this.sort(l,s)),a.appendChild(document.createElement("span")),a.appendChild(document.createTextNode(s)),o.appendChild(a)}i.appendChild(o),this.formats=IBt(this.format,r),this.style.innerText=LBt(this.id,OBt(this.align,r),DBt(this.widths,r))}query(t=[]){const{limit:n,offset:r,schema:i,sortColumn:o,sortDesc:s}=this;return qt.from(this.sourceTable()).select(i.map(a=>a.column)).where(t).orderby(o?s?ig(o):o:[]).limit(n).offset(r)}queryResult(t){return this.isPending||(this.loaded=!1,this.data=[],this.body.replaceChildren(),this.offset=0),this.data.push(gd(t)),this}update(){const{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=r.length-1,l=o*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 m8(n);case"date":return VK;default:return jK(n)}})}function OBt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function DBt(e={},t){return t.map(({column:n})=>e[n])}function LBt(e,t,n){const r=[];return t.forEach((i,o)=>{const s=+n[o];if(i!=="left"||s){const a=i!=="left"?`text-align:${i};`:"",l=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${l}}`)}}),r.join(" ")}function YK(e,...t){const n=e?.context?.coordinator??Ia();for(const r of t)n.connect(r)}function C3(e,t,n){const r=new t(n);return YK(e,r),r.element}function FBt(e){return C3(this,xBt,e)}function $Bt(e){return C3(this,EBt,e)}function BBt(e){return C3(this,kBt,e)}function PBt(e){return C3(this,RBt,e)}function HK({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 UBt(...e){return HK({direction:"vertical"},e.flat())}function zBt(...e){return HK({direction:"horizontal"},e.flat())}function GK({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 qBt(e){return GK({dim:"height",size:e})}function jBt(e){return GK({dim:"width",size:e})}class XK 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 JK=new XK;function VBt(e,t,n){(e?.context?.namedPlots??JK).request(t,n)}function WBt(e,t,n){(e?.context?.namedPlots??JK).set(t,n)}function KK(e){return t=>WBt(this,e,t)}function ZK(e,t,n){Sa(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 YBt(e,t){return n=>{ZK(n,e,t)}}function y8(e){return t=>{for(const[n,r]of Object.entries(e))ZK(t,n,r)}}function QK(e){const{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),y8(o)}function tZ(e){return y8({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function eZ(e){return y8({xDomain:e,yDomain:e})}const Q=e=>t=>YBt(e,t),nZ=Q("style"),rZ=Q("width"),iZ=Q("height"),oZ=Q("marginLeft"),sZ=Q("marginRight"),aZ=Q("marginTop"),lZ=Q("marginBottom"),cZ=Q("align"),uZ=Q("aspectRatio"),fZ=Q("axis"),hZ=Q("inset"),dZ=Q("grid"),pZ=Q("clip"),gZ=Q("padding"),mZ=Q("ariaLabel"),yZ=Q("ariaDescription"),vZ=Q("xScale"),bZ=Q("xDomain"),_Z=Q("xRange"),wZ=Q("xNice"),xZ=Q("xInset"),SZ=Q("xInsetLeft"),EZ=Q("xInsetRight"),TZ=Q("xClamp"),kZ=Q("xRound"),MZ=Q("xAlign"),CZ=Q("xPadding"),AZ=Q("xPaddingInner"),RZ=Q("xPaddingOuter"),NZ=Q("xAxis"),IZ=Q("xTicks"),OZ=Q("xTickSize"),DZ=Q("xTickSpacing"),LZ=Q("xTickPadding"),FZ=Q("xTickFormat"),$Z=Q("xTickRotate"),BZ=Q("xGrid"),PZ=Q("xLine"),UZ=Q("xLabel"),zZ=Q("xLabelAnchor"),qZ=Q("xLabelArrow"),jZ=Q("xLabelOffset"),VZ=Q("xFontVariant"),WZ=Q("xAriaLabel"),YZ=Q("xAriaDescription"),HZ=Q("xPercent"),GZ=Q("xReverse"),XZ=Q("xZero"),JZ=Q("xBase"),KZ=Q("xExponent"),ZZ=Q("xConstant"),QZ=Q("yScale"),tQ=Q("yDomain"),eQ=Q("yRange"),nQ=Q("yNice"),rQ=Q("yInset"),iQ=Q("yInsetTop"),oQ=Q("yInsetBottom"),sQ=Q("yClamp"),aQ=Q("yRound"),lQ=Q("yAlign"),cQ=Q("yPadding"),uQ=Q("yPaddingInner"),fQ=Q("yPaddingOuter"),hQ=Q("yAxis"),dQ=Q("yTicks"),pQ=Q("yTickSize"),gQ=Q("yTickSpacing"),mQ=Q("yTickPadding"),yQ=Q("yTickFormat"),vQ=Q("yTickRotate"),bQ=Q("yGrid"),_Q=Q("yLine"),wQ=Q("yLabel"),xQ=Q("yLabelAnchor"),SQ=Q("yLabelArrow"),EQ=Q("yLabelOffset"),TQ=Q("yFontVariant"),kQ=Q("yAriaLabel"),MQ=Q("yAriaDescription"),CQ=Q("yPercent"),AQ=Q("yReverse"),RQ=Q("yZero"),NQ=Q("yBase"),IQ=Q("yExponent"),OQ=Q("yConstant"),DQ=Q("facetMargin"),LQ=Q("facetMarginTop"),FQ=Q("facetMarginBottom"),$Q=Q("facetMarginLeft"),BQ=Q("facetMarginRight"),PQ=Q("facetGrid"),UQ=Q("facetLabel"),zQ=Q("fxDomain"),qQ=Q("fxRange"),jQ=Q("fxInset"),VQ=Q("fxInsetLeft"),WQ=Q("fxInsetRight"),YQ=Q("fxRound"),HQ=Q("fxAlign"),GQ=Q("fxPadding"),XQ=Q("fxPaddingInner"),JQ=Q("fxPaddingOuter"),KQ=Q("fxAxis"),ZQ=Q("fxTicks"),QQ=Q("fxTickSize"),ttt=Q("fxTickSpacing"),ett=Q("fxTickPadding"),ntt=Q("fxTickFormat"),rtt=Q("fxTickRotate"),itt=Q("fxGrid"),ott=Q("fxLine"),stt=Q("fxLabel"),att=Q("fxLabelAnchor"),ltt=Q("fxLabelOffset"),ctt=Q("fxFontVariant"),utt=Q("fxAriaLabel"),ftt=Q("fxAriaDescription"),htt=Q("fxReverse"),dtt=Q("fyDomain"),ptt=Q("fyRange"),gtt=Q("fyInset"),mtt=Q("fyInsetTop"),ytt=Q("fyInsetBottom"),vtt=Q("fyRound"),btt=Q("fyAlign"),_tt=Q("fyPadding"),wtt=Q("fyPaddingInner"),xtt=Q("fyPaddingOuter"),Stt=Q("fyAxis"),Ett=Q("fyTicks"),Ttt=Q("fyTickSize"),ktt=Q("fyTickSpacing"),Mtt=Q("fyTickPadding"),Ctt=Q("fyTickFormat"),Att=Q("fyTickRotate"),Rtt=Q("fyGrid"),Ntt=Q("fyLine"),Itt=Q("fyLabel"),Ott=Q("fyLabelAnchor"),Dtt=Q("fyLabelOffset"),Ltt=Q("fyFontVariant"),Ftt=Q("fyAriaLabel"),$tt=Q("fyAriaDescription"),Btt=Q("fyReverse"),Ptt=Q("colorScale"),Utt=Q("colorDomain"),ztt=Q("colorRange"),qtt=Q("colorClamp"),jtt=Q("colorN"),Vtt=Q("colorNice"),Wtt=Q("colorScheme"),Ytt=Q("colorInterpolate"),Htt=Q("colorPivot"),Gtt=Q("colorSymmetric"),Xtt=Q("colorLabel"),Jtt=Q("colorPercent"),Ktt=Q("colorReverse"),Ztt=Q("colorZero"),Qtt=Q("colorTickFormat"),tet=Q("colorBase"),eet=Q("colorExponent"),net=Q("colorConstant"),ret=Q("opacityScale"),iet=Q("opacityDomain"),oet=Q("opacityRange"),set=Q("opacityClamp"),aet=Q("opacityNice"),cet=Q("opacityLabel"),uet=Q("opacityPercent"),fet=Q("opacityReverse"),het=Q("opacityZero"),det=Q("opacityTickFormat"),pet=Q("opacityBase"),get=Q("opacityExponent"),met=Q("opacityConstant"),yet=Q("symbolScale"),vet=Q("symbolDomain"),bet=Q("symbolRange"),_et=Q("rScale"),wet=Q("rDomain"),xet=Q("rRange"),Eet=Q("rClamp"),Tet=Q("rNice"),ket=Q("rLabel"),Met=Q("rPercent"),Cet=Q("rZero"),Aet=Q("rBase"),Ret=Q("rExponent"),Net=Q("rConstant"),Iet=Q("lengthScale"),Oet=Q("lengthDomain"),Det=Q("lengthRange"),Let=Q("lengthClamp"),Fet=Q("lengthNice"),$et=Q("lengthPercent"),Bet=Q("lengthZero"),Pet=Q("lengthBase"),Uet=Q("lengthExponent"),zet=Q("lengthConstant"),qet=Q("projectionType"),jet=Q("projectionParallels"),Vet=Q("projectionPrecision"),Wet=Q("projectionRotate"),Yet=Q("projectionDomain"),Het=Q("projectionInset"),Get=Q("projectionInsetLeft"),Xet=Q("projectionInsetRight"),Jet=Q("projectionInsetTop"),Ket=Q("projectionInsetBottom"),Zet=Q("projectionClip"),HBt=Object.freeze(Object.defineProperty({__proto__:null,align:cZ,ariaDescription:yZ,ariaLabel:mZ,aspectRatio:uZ,axis:fZ,clip:pZ,colorBase:tet,colorClamp:qtt,colorConstant:net,colorDomain:Utt,colorExponent:eet,colorInterpolate:Ytt,colorLabel:Xtt,colorN:jtt,colorNice:Vtt,colorPercent:Jtt,colorPivot:Htt,colorRange:ztt,colorReverse:Ktt,colorScale:Ptt,colorScheme:Wtt,colorSymmetric:Gtt,colorTickFormat:Qtt,colorZero:Ztt,facetGrid:PQ,facetLabel:UQ,facetMargin:DQ,facetMarginBottom:FQ,facetMarginLeft:$Q,facetMarginRight:BQ,facetMarginTop:LQ,fxAlign:HQ,fxAriaDescription:ftt,fxAriaLabel:utt,fxAxis:KQ,fxDomain:zQ,fxFontVariant:ctt,fxGrid:itt,fxInset:jQ,fxInsetLeft:VQ,fxInsetRight:WQ,fxLabel:stt,fxLabelAnchor:att,fxLabelOffset:ltt,fxLine:ott,fxPadding:GQ,fxPaddingInner:XQ,fxPaddingOuter:JQ,fxRange:qQ,fxReverse:htt,fxRound:YQ,fxTickFormat:ntt,fxTickPadding:ett,fxTickRotate:rtt,fxTickSize:QQ,fxTickSpacing:ttt,fxTicks:ZQ,fyAlign:btt,fyAriaDescription:$tt,fyAriaLabel:Ftt,fyAxis:Stt,fyDomain:dtt,fyFontVariant:Ltt,fyGrid:Rtt,fyInset:gtt,fyInsetBottom:ytt,fyInsetTop:mtt,fyLabel:Itt,fyLabelAnchor:Ott,fyLabelOffset:Dtt,fyLine:Ntt,fyPadding:_tt,fyPaddingInner:wtt,fyPaddingOuter:xtt,fyRange:ptt,fyReverse:Btt,fyRound:vtt,fyTickFormat:Ctt,fyTickPadding:Mtt,fyTickRotate:Att,fyTickSize:Ttt,fyTickSpacing:ktt,fyTicks:Ett,grid:dZ,height:iZ,inset:hZ,lengthBase:Pet,lengthClamp:Let,lengthConstant:zet,lengthDomain:Oet,lengthExponent:Uet,lengthNice:Fet,lengthPercent:$et,lengthRange:Det,lengthScale:Iet,lengthZero:Bet,margin:tZ,marginBottom:lZ,marginLeft:oZ,marginRight:sZ,marginTop:aZ,margins:QK,name:KK,opacityBase:pet,opacityClamp:set,opacityConstant:met,opacityDomain:iet,opacityExponent:get,opacityLabel:cet,opacityNice:aet,opacityPercent:uet,opacityRange:oet,opacityReverse:fet,opacityScale:ret,opacityTickFormat:det,opacityZero:het,padding:gZ,projectionClip:Zet,projectionDomain:Yet,projectionInset:Het,projectionInsetBottom:Ket,projectionInsetLeft:Get,projectionInsetRight:Xet,projectionInsetTop:Jet,projectionParallels:jet,projectionPrecision:Vet,projectionRotate:Wet,projectionType:qet,rBase:Aet,rClamp:Eet,rConstant:Net,rDomain:wet,rExponent:Ret,rLabel:ket,rNice:Tet,rPercent:Met,rRange:xet,rScale:_et,rZero:Cet,style:nZ,symbolDomain:vet,symbolRange:bet,symbolScale:yet,width:rZ,xAlign:MZ,xAriaDescription:YZ,xAriaLabel:WZ,xAxis:NZ,xBase:JZ,xClamp:TZ,xConstant:ZZ,xDomain:bZ,xExponent:KZ,xFontVariant:VZ,xGrid:BZ,xInset:xZ,xInsetLeft:SZ,xInsetRight:EZ,xLabel:UZ,xLabelAnchor:zZ,xLabelArrow:qZ,xLabelOffset:jZ,xLine:PZ,xNice:wZ,xPadding:CZ,xPaddingInner:AZ,xPaddingOuter:RZ,xPercent:HZ,xRange:_Z,xReverse:GZ,xRound:kZ,xScale:vZ,xTickFormat:FZ,xTickPadding:LZ,xTickRotate:$Z,xTickSize:OZ,xTickSpacing:DZ,xTicks:IZ,xZero:XZ,xyDomain:eZ,yAlign:lQ,yAriaDescription:MQ,yAriaLabel:kQ,yAxis:hQ,yBase:NQ,yClamp:sQ,yConstant:OQ,yDomain:tQ,yExponent:IQ,yFontVariant:TQ,yGrid:bQ,yInset:rQ,yInsetBottom:oQ,yInsetTop:iQ,yLabel:wQ,yLabelAnchor:xQ,yLabelArrow:SQ,yLabelOffset:EQ,yLine:_Q,yNice:nQ,yPadding:cQ,yPaddingInner:uQ,yPaddingOuter:fQ,yPercent:CQ,yRange:eQ,yReverse:AQ,yRound:aQ,yScale:QZ,yTickFormat:yQ,yTickPadding:mQ,yTickRotate:vQ,yTickSize:pQ,yTickSpacing:gQ,yTicks:dQ,yZero:RQ},Symbol.toStringTag,{value:"Module"}));function GBt(e,t){return{table:e,options:t}}const XBt=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=XBt.has(e)?null:[{}]);const r=e.startsWith("area")||e.startsWith("line")?JFt:hh;return A3(r,e,t,n)}function A3(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function wc(e,t,n){return r=>{r.addMark(new e(t,n))}}const Qet=(...e)=>pe("area",...e),tnt=(...e)=>pe("areaX",...e),ent=(...e)=>pe("areaY",...e),nnt=(...e)=>pe("line",...e),rnt=(...e)=>pe("lineX",...e),int=(...e)=>pe("lineY",...e),ont=(...e)=>pe("barX",...e),snt=(...e)=>pe("barY",...e),ant=(...e)=>pe("cell",...e),lnt=(...e)=>pe("cellX",...e),cnt=(...e)=>pe("cellY",...e),unt=(...e)=>pe("rect",...e),fnt=(...e)=>pe("rectX",...e),hnt=(...e)=>pe("rectY",...e),dnt=(...e)=>pe("dot",...e),pnt=(...e)=>pe("dotX",...e),gnt=(...e)=>pe("dotY",...e),mnt=(...e)=>pe("circle",...e),ynt=(...e)=>pe("hexagon",...e),vnt=(...e)=>pe("text",...e),bnt=(...e)=>pe("textX",...e),_nt=(...e)=>pe("textY",...e),wnt=(...e)=>pe("ruleX",...e),xnt=(...e)=>pe("ruleY",...e),Snt=(...e)=>pe("tickX",...e),Ent=(...e)=>pe("tickY",...e),Tnt=(...e)=>pe("vector",...e),knt=(...e)=>pe("vectoX",...e),Mnt=(...e)=>pe("vectorY",...e),Cnt=(...e)=>pe("spike",...e),Ant=(...e)=>pe("image",...e),Rnt=(...e)=>A3(RK,"areaX",...e),Nnt=(...e)=>A3(RK,"areaY",...e),Int=(...e)=>wc(w$t,...e),Ont=(...e)=>wc(y$t,...e),Dnt=(...e)=>wc(o$t,...e),Lnt=(...e)=>wc(h$t,...e),Fnt=(...e)=>wc(f8,...e),$nt=(...e)=>wc(R$t,...e),Bnt=(...e)=>wc(A$t,...e),Pnt=(...e)=>pe("hexgrid",...e),Unt=(...e)=>wc(F$t,...e),znt=(...e)=>A3(NK,"ruleY",...e),qnt=(...e)=>wc(NK,"ruleX",...e),jnt=(...e)=>pe("voronoi",...e),Vnt=(...e)=>pe("voronoiMesh",...e),Wnt=(...e)=>pe("delaunayLink",...e),Ynt=(...e)=>pe("delaunayMesh",...e),Hnt=(...e)=>pe("hull",...e),Gnt=(...e)=>pe("arrow",...e),Xnt=(...e)=>pe("link",...e),Jnt=(...e)=>pe("frame",...e),Knt=(...e)=>pe("axisX",...e),Znt=(...e)=>pe("axisY",...e),Qnt=(...e)=>pe("axisFx",...e),trt=(...e)=>pe("axisFy",...e),ert=(...e)=>pe("gridX",...e),nrt=(...e)=>pe("gridY",...e),rrt=(...e)=>pe("gridFx",...e),irt=(...e)=>pe("gridFy",...e),ort=(...e)=>wc(C$t,...e),srt=(...e)=>pe("sphere",...e),art=(...e)=>pe("graticule",...e),lrt=(...e)=>pe("waffleX",...e),crt=(...e)=>pe("waffleY",...e),JBt=Object.freeze(Object.defineProperty({__proto__:null,area:Qet,areaX:tnt,areaY:ent,arrow:Gnt,axisFx:Qnt,axisFy:trt,axisX:Knt,axisY:Znt,barX:ont,barY:snt,cell:ant,cellX:lnt,cellY:cnt,circle:mnt,contour:Dnt,delaunayLink:Wnt,delaunayMesh:Ynt,denseLine:Ont,density:Int,densityX:Rnt,densityY:Nnt,dot:dnt,dotX:pnt,dotY:gnt,errorbarX:znt,errorbarY:qnt,frame:Jnt,geo:ort,graticule:art,gridFx:rrt,gridFy:irt,gridX:ert,gridY:nrt,heatmap:Lnt,hexagon:ynt,hexbin:Bnt,hexgrid:Pnt,hull:Hnt,image:Ant,line:nnt,lineX:rnt,lineY:int,link:Xnt,raster:Fnt,rasterTile:$nt,rect:unt,rectX:fnt,rectY:hnt,regressionY:Unt,ruleX:wnt,ruleY:xnt,sphere:srt,spike:Cnt,text:vnt,textX:bnt,textY:_nt,tickX:Snt,tickY:Ent,vector:Tnt,vectorX:knt,vectorY:Mnt,voronoi:jnt,voronoiMesh:Vnt,waffleX:lrt,waffleY:crt},Symbol.toStringTag,{value:"Module"}));function xc(e,t){return n=>{const r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function urt({by:e,...t}){return xc(z$t,{selection:e,channels:t})}function frt({as:e,...t}){return xc(p8,{...t,selection:e,channel:"x"})}function hrt({as:e,...t}){return xc(p8,{...t,selection:e,channel:"y"})}function drt({as:e,...t}){return xc(Y$t,{...t,selection:e})}function prt({as:e,...t}){return xc(g8,{...t,selection:e,pointer:"xy"})}function grt({as:e,...t}){return xc(g8,{...t,selection:e,pointer:"x"})}function mrt({as:e,...t}){return xc(g8,{...t,selection:e,pointer:"y"})}function yrt({as:e,...t}){return xc(cBt,{...t,selection:e})}function Ag({as:e,...t}){return xc(zK,{...t,selection:e})}function vrt(e){return Ag({...e,channels:["x"]})}function brt(e){return Ag({...e,channels:["y"]})}function _rt(e){return Ag({...e,channels:["z"]})}function wrt(e){return Ag({...e,channels:["color"]})}function Rg(e){return xc(X$t,e)}function xrt(e={}){return Rg({...e,zoom:!1})}function Srt(e={}){return Rg({...e,zoom:!1,pany:!1})}function Ert(e={}){return Rg({...e,zoom:!1,panx:!1})}function Trt(e={}){return Rg(e)}function krt(e={}){return Rg({...e,pany:!1})}function Mrt(e={}){return Rg({...e,panx:!1})}const KBt=Object.freeze(Object.defineProperty({__proto__:null,highlight:urt,intervalX:frt,intervalXY:drt,intervalY:hrt,nearest:prt,nearestX:grt,nearestY:mrt,pan:xrt,panX:Srt,panY:Ert,panZoom:Trt,panZoomX:krt,panZoomY:Mrt,region:yrt,toggle:Ag,toggleColor:wrt,toggleX:vrt,toggleY:brt,toggleZ:_rt},Symbol.toStringTag,{value:"Module"}));function v8(e,t={}){if(t.for){const{for:n,...r}=t,i=new L$(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?VBt(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new L$(e,t))}function Crt(e){return v8.call(this,"color",e)}function Art(e){return v8.call(this,"opacity",e)}function Rrt(e){return v8.call(this,"symbol",e)}const ZBt=Object.freeze(Object.defineProperty({__proto__:null,colorLegend:Crt,opacityLegend:Art,symbolLegend:Rrt},Symbol.toStringTag,{value:"Module"}));function QBt(...e){const t=new zFt;return e.flat().forEach(n=>n(t)),YK(this,...t.marks),t.update(),t.element}const t9t=Object.freeze(Object.defineProperty({__proto__:null,Fixed:Xv,Param:ha,Query:qt,Selection:b0,align:cZ,and:Ci,area:Qet,areaX:tnt,areaY:ent,argmax:sw,argmin:aw,ariaDescription:yZ,ariaLabel:mZ,arrayAgg:I0t,arrow:Gnt,aspectRatio:uZ,avg:Y2,axis:fZ,axisFx:Qnt,axisFy:trt,axisX:Knt,axisY:Znt,barX:ont,barY:snt,bin:vBt,cast:Jr,cell:ant,cellX:lnt,cellY:cnt,centroid:R6,centroidX:ygt,centroidY:vgt,circle:mnt,clip:pZ,colorBase:tet,colorClamp:qtt,colorConstant:net,colorDomain:Utt,colorExponent:eet,colorInterpolate:Ytt,colorLabel:Xtt,colorLegend:Crt,colorN:jtt,colorNice:Vtt,colorPercent:Jtt,colorPivot:Htt,colorRange:ztt,colorReverse:Ktt,colorScale:Ptt,colorScheme:Wtt,colorSymmetric:Gtt,colorTickFormat:Qtt,colorZero:Ztt,column:kt,contour:Dnt,coordinator:Ia,corr:O0t,count:er,covarPop:L0t,covariance:D0t,createSchema:Pgt,createTable:bv,cume_dist:Mgt,dateDay:sgt,dateMonth:igt,dateMonthDay:ogt,delaunayLink:Wnt,delaunayMesh:Ynt,denseLine:Ont,dense_rank:Tgt,density:Int,densityX:Rnt,densityY:Nnt,dot:dnt,dotX:pnt,dotY:gnt,entropy:F0t,eq:Ss,errorbarX:znt,errorbarY:qnt,facetGrid:PQ,facetLabel:UQ,facetMargin:DQ,facetMarginBottom:FQ,facetMarginLeft:$Q,facetMarginRight:BQ,facetMarginTop:LQ,first:$0t,first_value:Rgt,float32:tgt,float64:vo,frame:Jnt,from:GBt,fxAlign:HQ,fxAriaDescription:ftt,fxAriaLabel:utt,fxAxis:KQ,fxDomain:zQ,fxFontVariant:ctt,fxGrid:itt,fxInset:jQ,fxInsetLeft:VQ,fxInsetRight:WQ,fxLabel:stt,fxLabelAnchor:att,fxLabelOffset:ltt,fxLine:ott,fxPadding:GQ,fxPaddingInner:XQ,fxPaddingOuter:JQ,fxRange:qQ,fxReverse:htt,fxRound:YQ,fxTickFormat:ntt,fxTickPadding:ett,fxTickRotate:rtt,fxTickSize:QQ,fxTickSpacing:ttt,fxTicks:ZQ,fyAlign:btt,fyAriaDescription:$tt,fyAriaLabel:Ftt,fyAxis:Stt,fyDomain:dtt,fyFontVariant:Ltt,fyGrid:Rtt,fyInset:gtt,fyInsetBottom:ytt,fyInsetTop:mtt,fyLabel:Itt,fyLabelAnchor:Ott,fyLabelOffset:Dtt,fyLine:Ntt,fyPadding:_tt,fyPaddingInner:wtt,fyPaddingOuter:xtt,fyRange:ptt,fyReverse:Btt,fyRound:vtt,fyTickFormat:Ctt,fyTickPadding:Mtt,fyTickRotate:Att,fyTickSize:Ttt,fyTickSpacing:ktt,fyTicks:Ett,geo:ort,geojson:bP,geomean:B0t,graticule:art,grid:dZ,gridFx:rrt,gridFy:irt,gridX:ert,gridY:nrt,gt:fa,gte:fgt,hconcat:zBt,heatmap:Lnt,height:iZ,hexagon:ynt,hexbin:Bnt,hexgrid:Pnt,highlight:urt,hspace:jBt,hull:Hnt,image:Ant,inset:hZ,int32:bi,intervalX:frt,intervalXY:drt,intervalY:hrt,isBetween:To,isDistinct:hgt,isNotBetween:dgt,isNotDistinct:A6,isNotNull:ec,isNull:Ga,kurtosis:P0t,lag:Agt,last:q0t,last_value:Ngt,lead:_4,lengthBase:Pet,lengthClamp:Let,lengthConstant:zet,lengthDomain:Oet,lengthExponent:Uet,lengthNice:Fet,lengthPercent:$et,lengthRange:Det,lengthScale:Iet,lengthZero:Bet,line:nnt,lineX:rnt,lineY:int,link:Xnt,literal:ne,loadCSV:zgt,loadExtension:SP,loadJSON:qgt,loadObjects:Wgt,loadParquet:jgt,loadSpatial:Vgt,lt:fi,lte:Yl,mad:U0t,margin:tZ,marginBottom:lZ,marginLeft:oZ,marginRight:sZ,marginTop:aZ,margins:QK,max:Ma,median:H2,menu:FBt,min:tl,mode:z0t,name:KK,nearest:prt,nearestX:grt,nearestY:mrt,neq:vv,not:v0,nth_value:Igt,ntile:Cgt,opacityBase:pet,opacityClamp:set,opacityConstant:met,opacityDomain:iet,opacityExponent:get,opacityLabel:cet,opacityLegend:Art,opacityNice:aet,opacityPercent:uet,opacityRange:oet,opacityReverse:fet,opacityScale:ret,opacityTickFormat:det,opacityZero:het,or:Eo,padding:gZ,pan:xrt,panX:Srt,panY:Ert,panZoom:Trt,panZoomX:krt,panZoomY:Mrt,percent_rank:kgt,plot:QBt,product:j0t,projectionClip:Zet,projectionDomain:Yet,projectionInset:Het,projectionInsetBottom:Ket,projectionInsetLeft:Get,projectionInsetRight:Xet,projectionInsetTop:Jet,projectionParallels:jet,projectionPrecision:Vet,projectionRotate:Wet,projectionType:qet,quantile:b4,rBase:Aet,rClamp:Eet,rConstant:Net,rDomain:wet,rExponent:Ret,rLabel:ket,rNice:Tet,rPercent:Met,rRange:xet,rScale:_et,rZero:Cet,rank:Egt,raster:Fnt,rasterTile:$nt,rect:unt,rectX:fnt,rectY:hnt,region:yrt,regressionY:Unt,row_number:wP,ruleX:wnt,ruleY:xnt,search:$Bt,skewness:X0t,slider:BBt,sphere:srt,spike:Cnt,sql:ee,stddev:pP,stddevPop:J0t,stringAgg:K0t,style:nZ,sum:Tr,symbolDomain:vet,symbolLegend:Rrt,symbolRange:bet,symbolScale:yet,table:PBt,text:vnt,textX:bnt,textY:_nt,tickX:Snt,tickY:Ent,toggle:Ag,toggleColor:wrt,toggleX:vrt,toggleY:brt,toggleZ:_rt,varPop:Q0t,variance:Z0t,vconcat:UBt,vector:Tnt,vectorX:knt,vectorY:Mnt,voronoi:jnt,voronoiMesh:Vnt,vspace:qBt,waffleX:lrt,waffleY:crt,width:rZ,xAlign:MZ,xAriaDescription:YZ,xAriaLabel:WZ,xAxis:NZ,xBase:JZ,xClamp:TZ,xConstant:ZZ,xDomain:bZ,xExponent:KZ,xFontVariant:VZ,xGrid:BZ,xInset:xZ,xInsetLeft:SZ,xInsetRight:EZ,xLabel:UZ,xLabelAnchor:zZ,xLabelArrow:qZ,xLabelOffset:jZ,xLine:PZ,xNice:wZ,xPadding:CZ,xPaddingInner:AZ,xPaddingOuter:RZ,xPercent:HZ,xRange:_Z,xReverse:GZ,xRound:kZ,xScale:vZ,xTickFormat:FZ,xTickPadding:LZ,xTickRotate:$Z,xTickSize:OZ,xTickSpacing:DZ,xTicks:IZ,xZero:XZ,xyDomain:eZ,yAlign:lQ,yAriaDescription:MQ,yAriaLabel:kQ,yAxis:hQ,yBase:NQ,yClamp:sQ,yConstant:OQ,yDomain:tQ,yExponent:IQ,yFontVariant:TQ,yGrid:bQ,yInset:rQ,yInsetBottom:oQ,yInsetTop:iQ,yLabel:wQ,yLabelAnchor:xQ,yLabelArrow:SQ,yLabelOffset:EQ,yLine:_Q,yNice:nQ,yPadding:cQ,yPaddingInner:uQ,yPaddingOuter:fQ,yPercent:CQ,yRange:eQ,yReverse:AQ,yRound:aQ,yScale:QZ,yTickFormat:yQ,yTickPadding:mQ,yTickRotate:vQ,yTickSize:pQ,yTickSpacing:gQ,yTicks:dQ,yZero:RQ},Symbol.toStringTag,{value:"Module"}));function Nrt({coordinator:e=Ia(),namedPlots:t=new XK,extensions:n=null,...r}={}){return{...t9t,...n,context:{coordinator:e,namedPlots:t,...r}}}var e9t=St("
      ");function n9t(e,t){Ne(t,!0);let n=Lo(t,["$$slots","$$events","$$legacy"]),r;eg(()=>{let o=new fEt(r,n);$i(()=>{o.update(n)}),u6(()=>{o.destroy()})});var i=e9t();Ce(i,"",{},{display:"flex"}),rs(i,o=>r=o,()=>r),rt(e,i),Ie()}var r9t=(e,t,n)=>{t(w(n),e)},i9t=St('
      '),o9t=St('
      ');function s9t(e,t){Ne(t,!0);let n=ae(t,"selection",3,null),r=_t(new Set);const i={reset:()=>{Y(r,new Set)}};function o(c,u){if(u.shiftKey||u.metaKey){let f=new Set(w(r));f.has(c)?f.delete(c):f.add(c),Y(r,f)}else w(r).has(c)&&w(r).size==1?Y(r,new Set):Y(r,new Set([c]))}fe(()=>{let c=n();if(c!=null)return fe(()=>{let u=w(r),f=u.size!=0?Array.from(u).map(p=>p.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&&Y(r,new Set(t.items.filter(h=>f.selectedItems.indexOf(h.label)>=0)))});return fe(()=>{c.set({selectedItems:Array.from(w(r)).map(f=>f.label)})}),u});var s=o9t(),a=ot(s),l=ot(a);Sn(l,21,()=>t.items,Fn,(c,u)=>{var f=i9t();const h=ht(()=>w(r).has(w(u))||w(r).size==0);let p;f.__click=[r9t,o,u];var g=ot(f),y=ot(g);let v;et(g);var b=mt(g),_=ot(b),S=ot(_,!0);et(_),et(b);var x=mt(b),T=ot(x,!0);et(x),et(f),At((k,M)=>{p=nr(f,1,"hover:bg-slate-200 dark:hover:bg-slate-700 select-none leading-7",null,p,k),v=Ce(y,"",v,{"background-color":w(u).color}),ct(_,"title",w(u).label),ce(S,w(u).label),ce(T,M)},[()=>({"opacity-20":!w(h)}),()=>w(u).count.toLocaleString()]),rt(c,f)}),et(l),et(a),et(s),rt(e,s),Ie()}Fr(["click"]);const F$=Symbol("coordinator"),$$=Symbol("darkMode");class Lr{static get coordinator(){return l7(F$)??Ia()}static set coordinator(t){c7(F$,t)}static get darkMode(){return l7($$)}static set darkMode(t){c7($$,t)}}function t_(e,t,n){return e+(t-e)*n}function a9t(e,t,n){let r=Math.log(e.scale),i=Math.log(t.scale);if(Math.abs(i-r)<1e-5)return{x:t_(e.x,t.x,n),y:t_(e.y,t.y,n),scale:t_(e.scale,t.scale,n)};let o=Math.exp(t_(r,i,n));return{x:(t.x*t.scale-e.x*e.scale+(e.x-t.x)*(e.scale*t.scale/o))/(t.scale-e.scale),y:(t.y*t.scale-e.y*e.scale+(e.y-t.y)*(e.scale*t.scale/o))/(t.scale-e.scale),scale:o}}var l9t=St('
      ');function c9t(e,t){Ne(t,!0);const[n,r]=fs(),i=()=>Zi(l,"$darkMode",n),o=800;let s=ae(t,"onClickPoint",3,null);const a=Lr.coordinator,l=Lr.darkMode;let c=_t(null),u=_t(null),f=_t(null),h=_t([]),p=_t(750),g=_t(750),y=ht(()=>t.stateStore?.child("legend")),v;function b(I){Y(f,null);let F=w(c);if(F==null){Y(c,I);return}let D=o,P=new Date().getTime(),z=()=>{let q=(new Date().getTime()-P)/D;q>1?q=1:v=requestAnimationFrame(z),Y(c,a9t(F,I,rA(q)))};v&&cancelAnimationFrame(v),v=requestAnimationFrame(z)}function _(I){Y(h,[I]),Y(f,I)}function S(){v&&cancelAnimationFrame(v)}function x(I){s()?.(I)}$i(()=>{w(h)?.[0]!=null&&x(w(h)?.[0])}),fe(()=>{let I=t.stateStore;if(!I)return;let F=I.subscribe(D=>{D!=null&&(Y(c,D.viewportState),Y(u,D.rangeSelection))});return $i(()=>{I.set({viewportState:w(c),rangeSelection:w(u)})}),F});var T=l9t(),k=ot(T);const M=ht(()=>i()?"dark":"light"),C=ht(()=>t.categoryLegend?.indexColumn),R=ht(()=>t.categoryLegend?.legend.map(I=>I.color)),O=ht(()=>1/16*Math.exp(-(t.minimumDensityExpFactor??0)));n9t(k,{coordinator:a,get table(){return t.table},get identifier(){return t.id},get x(){return t.x},get y(){return t.y},get colorScheme(){return w(M)},get text(){return t.text},get category(){return w(C)},get categoryColors(){return w(R)},get minimumDensity(){return w(O)},get additionalFields(){return t.additionalFields},get viewportState(){return w(c)},onViewportState:I=>{Y(c,I),S()},get tooltip(){return w(f)},onTooltip:I=>Y(f,I),get selection(){return w(h)},onSelection:I=>{Y(h,I)},get filter(){return t.filter},get rangeSelection(){return t.filter},get rangeSelectionValue(){return w(u)},onRangeSelection:I=>{Y(u,I)},get automaticLabels(){return t.automaticLabels},get width(){return w(p)},get height(){return w(g)},get mode(){return t.mode},get customTooltip(){return t.customTooltip},get customOverlay(){return t.customOverlay}});var N=mt(k,2);{var L=I=>{var F=pr(),D=re(F);I2(D,()=>t.categoryLegend,P=>{s9t(P,{get items(){return t.categoryLegend.legend},get selection(){return t.filter},get stateStore(){return w(y)}})}),rt(I,F)};Ft(N,I=>{t.categoryLegend!=null&&I(L)})}et(T),ud(T,"clientWidth",I=>Y(p,I)),ud(T,"clientHeight",I=>Y(g,I)),rt(e,T);var $=Ie({startViewportAnimation:b,showTooltip:_});return r(),$}function u9t(e,{from:t,to:n},r={}){var{delay:i=0,duration:o=k=>Math.sqrt(k)*120,easing:s=rA}=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=f9t(e),h=e.clientWidth/n.width/f,p=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,S=(y-b)*p,x=t.width/n.width,T=t.height/n.height;return{delay:i,duration:typeof o=="function"?o(Math.sqrt(_*_+S*S)):o,easing:s,css:(k,M)=>{var C=M*_,R=M*S,O=k+M*x,N=k+M*T;return`transform: ${l} translate(${C}px, ${R}px) scale(${O}, ${N});`}}}function f9t(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 h9t="spec",Irt="literal",d9t="options",p9t="selection",g9t="paramref",m9t="columnparamref",y9t="param",v9t="include",Ort="select",I5="value",b9t="crossfilter",Drt="intersect",_9t="union",w9t="single",x9t="data",S9t="expression",sy="sql",b8="input",p2="hconcat",g2="vconcat",m2="hspace",y2="vspace",Lrt="mark",B$="from",v2="plot",_8="legend",E9t="attribute",Frt="transform",T9t="interactor",P_="Fixed";function O5(e){const t=typeof e;return t==="object"?e?.param:t==="string"?k9t(e):null}function k9t(e){return e?.[0]==="$"?e.slice(1):null}function P$(e){return`$${e}`}function $rt(e){return[e].flat()}function sd(e){return Array.isArray(e)}function Brt(e){return e!==null&&typeof e=="object"&&!sd(e)}function U_(e){return typeof e=="string"}function Prt(e,t){throw Object.assign(Error(e),{data:t})}const M9t=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function C9t(e,t){return M9t.test(e+="")?new Date(e):t}class $r{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 bl(e,t){const n={};for(const r in e)n[r]=t.maybeSelection(e[r]);return new v1(n)}class v1 extends $r{constructor(t){super(d9t),this.options=t}filter(t){const n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new v1(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 Urt="table",zrt="parquet",qrt="csv",w8="json",x8="spatial",U$=new Map([[Urt,O9t],[zrt,D9t],[qrt,L9t],[w8,F9t],[x8,$9t]]);function A9t(e,t,n){const r=R9t(t);if(U$.has(r.type))return U$.get(r.type)(e,r,n);n.error("Unrecognized data format type.",t)}function R9t(e){return sd(e)&&(e={type:"json",data:e}),U_(e)&&(e={type:"table",query:e}),{...e,type:N9t(e)}}function N9t(e){return e.type||I9t(e.file)||"table"}function I9t(e){const t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function O9t(e,t,n){const{query:r,type:i,...o}=t;return new U9t(e,r,bl(o,n))}function D9t(e,t,n){const{file:r,type:i,...o}=t;return new q9t(e,r,bl(o,n))}function L9t(e,t,n){const{file:r,type:i,...o}=t;return new j9t(e,r,bl(o,n))}function F9t(e,t,n){const{data:r,file:i,type:o,...s}=t,a=bl(s,n);return r?new W9t(e,r,a):new V9t(e,i,a)}function $9t(e,t,n){const{file:r,type:i,...o}=t;return new z9t(e,r,bl(o,n))}function z$(e,t){return t?new URL(e,t).toString():e}function B9t(e,t){const n=e?.codegen(t);return n?`, ${n}`:""}class P9t extends $r{constructor(t,n){super(x9t),this.name=t,this.format=n}}class S8 extends P9t{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 U9t extends S8{constructor(t,n,r){super(t,Urt),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`\`${bv(n,r,i.instantiate(t))}\``}toJSON(){const{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}}class R3 extends S8{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){const{name:n,method:r,file:i,options:o}=this,s=z$(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){const{name:n,method:r,file:i,options:o}=this,s=z$(i,t.baseURL),a=B9t(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){const{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}}class z9t extends R3{constructor(t,n,r){super(t,x8,"loadSpatial",n,r)}}class q9t extends R3{constructor(t,n,r){super(t,zrt,"loadParquet",n,r)}}class j9t extends R3{constructor(t,n,r){super(t,qrt,"loadCSV",n,r)}}class V9t extends R3{constructor(t,n,r){super(t,w8,"loadJSON",n,r)}}class W9t extends S8{constructor(t,n,r){super(t,w8),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,o=i?","+i.codegen(t):"",s=`[ + `+r.map(a=>JSON.stringify(a)).join(`, + `)+` + ]`;return`${t.ns()}loadObjects("${n}", ${s}${o})`}toJSON(){const{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}}function Y9t(e){const t=e.config?.extensions,n=new Set(t?$rt(t):[]);for(const r of Object.values(e.data))r.format===x8&&n.add("spatial");return n}async function H9t(e,t){const{data:n,params:r,plotDefaults:i}=e,o=new G9t({plotDefaults:i,...t}),s=[],a=Y9t(e);s.push(...Array.from(a).map(l=>SP(l)));for(const l of Object.values(n)){const c=l.instantiate(o);c&&s.push(c)}s.length>0&&await o.coordinator.exec(s);for(const[l,c]of Object.entries(r))if(!o.activeParams.has(l)){const u=c.instantiate(o);o.activeParams.set(l,u)}return{element:e.root.instantiate(o),params:o.activeParams}}class G9t{constructor({api:t=Nrt(),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){Prt(t,n)}}class D5 extends $r{constructor(t){super(Irt),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}}function X9t(e,t){const{select:n,include:r,...i}=e,o=bl(i,t);return r&&(o.options.include=new J9t($rt(r).map(s=>t.selectionRef(O5(s))))),new L5(n,o)}class L5 extends $r{constructor(t=Drt,n=new v1({})){super(p9t),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 J9t extends $r{constructor(t){super(v9t),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 K9t=new Set([I5,w9t,b9t,Drt,_9t]);function Z9t(e,t){const n=Brt(e)?e:{value:e},{select:r=I5,value:i,date:o}=n;return K9t.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==I5?X9t(e,t):sd(i)?new F5(i.map(s=>t.maybeParam(s))):new F5(i,o)}class F5 extends $r{constructor(t,n){super(y9t),this.value=t,this.date=n}instantiate(t){const{date:n,value:r}=this,{Param:i}=t.api;return sd(r)?i.array(r.map(o=>o.instantiate(t))):i.value(C9t(n,r))}codegen(t){const{value:n,date:r}=this,i=`${t.ns()}Param.`;return sd(n)?`${i}array([${n.map(o=>o.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){const{date:t,value:n}=this;return sd(n)?n.map(r=>r.toJSON()):t?{date:t}:n}}class Q9t extends $r{constructor(t){super(g9t),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(t){return P$(this.name)}toJSON(){return P$(this.name)}}function jrt(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new tPt(e,t===P_?new ePt:n.maybeParam(t))}class tPt extends $r{constructor(t,n){super(E9t),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 ePt extends $r{constructor(){super(Irt),this.value=P_}instantiate(t){return t.api[P_]}codegen(t){return`${t.ns()}${P_}`}toJSON(){return this.value}}class nPt extends $r{constructor(t,n,r,i,o,s){super(h9t,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){const{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){const l=a.data={};for(const[c,u]of o)l[c]=u.toJSON()}if(s?.size){const l=a.params={};for(const[c,u]of s)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 rPt(e,t){const n=e[p2].map(r=>t.parseComponent(r));return new iPt(n)}class iPt extends $r{constructor(t){super(p2,t)}instantiate(t){return t.api[p2](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 oPt(e){return new sPt(e[m2])}class sPt extends $r{constructor(t){super(m2),this.value=t}instantiate(t){return t.api[m2](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${t.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}}function aPt(e,t){const{[b8]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new lPt(n,bl(r,t))}class lPt extends $r{constructor(t,n){super(b8),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 Vrt(e,t){const{[_8]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new cPt(i,n,bl(r,t))}class cPt extends $r{constructor(t,n,r){super(_8),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 uPt(e,t){const{[Ort]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new fPt(n,bl(r,t))}class fPt extends $r{constructor(t,n){super(T9t),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{[Ort]:t,...n.toJSON()}}}class hPt extends $r{constructor(t){super(m9t),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 dPt=/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\${1,2}\w+)/g;function pPt(e,t){const n=e[sy],r=n.split(dPt),i=[""],o=[];for(let s=0,a=0;ss.instantiate(t));return i(n,...o)}codegen(t){const{spans:n,params:r}=this;let i="";const o=r.length;for(let s=0;st.maybeParam(n))}function vPt(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,[o]=e_(r,t);return new _Pt(n,o,bl(i,t))}else{const r=n==="count"&&!e[n]?[]:e_(e[n],t),i={distinct:e.distinct,orderby:e_(e.orderby,t),partitionby:e_(e.partitionby,t),rows:e.rows?t.maybeParam(e.rows):null,range:e.range?t.maybeParam(e.range):null};return new bPt(n,r,i)}}class bPt extends $r{constructor(t,n,r){super(Frt),this.name=t,this.args=n,this.options=r}instantiate(t){const{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:l,range:c}=i;let u=t.api[n](...r.map(f=>f.instantiate(t)));return o&&(u=u.distinct()),s.length&&(u=u.orderby(s.map(f=>f.instantiate(t)))),a.length&&(u=u.partitionby(a.map(f=>f.instantiate(t)))),l!=null?u=u.rows(l.instantiate(t)):c!=null&&(u=u.range(c.instantiate(t))),u}codegen(t){const{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:l,range:c}=i;let u=`${t.ns()}${n}(`+r.map(f=>f.codegen(t)).join(", ")+")";if(o&&(u+=".distinct()"),s.length){const f=s.map(h=>h.codegen(t));u+=`.orderby(${f.join(", ")})`}if(a.length){const f=a.map(h=>h.codegen(t));u+=`.partitionby(${f.join(", ")})`}return l?u+=`.rows(${l.codegen(t)})`:c&&(u+=`.range(${c.codegen(t)})`),u}toJSON(){const{name:t,args:n,options:r}=this,{distinct:i,orderby:o,partitionby:s,rows:a,range:l}=r,c={[t]:Kk(n.map(u=>u.toJSON()))};return i&&(c.distinct=!0),o.length&&(c.orderby=Kk(o.map(u=>u.toJSON()))),s.length&&(c.partitionby=Kk(s.map(u=>u.toJSON()))),a?c.rows=a.toJSON():l&&(c.range=l.toJSON()),c}}class _Pt extends $r{constructor(t,n,r){super(Frt),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,o=i.codegen(t);return`${t.ns()}${n}(`+r.codegen(t)+(o?`, ${o}`:"")+")"}toJSON(){const{name:t,arg:n,options:r}=this;return{[t]:n.toJSON(),...r.toJSON()}}}function Kk(e){return e.length===0?"":e.length===1?e[0]:e}function wPt(e,t){if(Brt(e))return e[sy]?pPt(e,t):vPt(e,t)}function xPt(e,t){const{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);const o=mPt(r,t),s={};for(const a in i){const l=i[a];s[a]=wPt(l,t)||t.maybeParam(l)}return new SPt(n,o,new v1(s))}class SPt extends $r{constructor(t,n,r){super(Lrt),this.name=t,this.data=n,this.options=r}instantiate(t){const{name:n,data:r,options:i}=this,o=i.instantiate(t);return r?t.api[n](r.instantiate(t),o):t.api[n](o)}codegen(t){const{name:n,data:r,options:i}=this,o=r?r.codegen(t):"",s=i.codegen(t);let a;if(o&&s){t.indent();const l=i.codegen(t);a=` +${t.tab()}${o}, +${t.tab()}${l} +`,t.undent(),a+=t.tab()}else a=`${o}${s}`;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 EPt(e,t){return Wrt({plot:[e]},t)}function Wrt(e,t){const{[v2]:n,...r}=e,i=Object.entries(r).map(([s,a])=>jrt(s,a,t)),o=n.map(s=>U_(s.mark)?xPt(s,t):U_(s.legend)?Vrt(s,t):U_(s.select)?uPt(s,t):t.error("Invalid plot entry.",s));return new TPt(o,i)}class TPt extends $r{constructor(t,n){super(v2,t),this.attributes=n}instantiate(t){const n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[v2](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 o=[...r.map(s=>s.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(s=>s.codegen(t))].join(`, +`);return t.undent(),`${t.tab()}${t.ns()}${n}( +${o} +${t.tab()})`}toJSON(){const{type:t,children:n,attributes:r}=this,i={[t]:n.map(o=>o.toJSON())};for(const o of r)Object.assign(i,o.toJSON());return i}}function kPt(e,t){const n=e[g2].map(r=>t.parseComponent(r));return new MPt(n)}class MPt extends $r{constructor(t){super(g2,t)}instantiate(t){return t.api[g2](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 CPt(e){return new APt(e[y2])}class APt extends $r{constructor(t){super(y2),this.value=t}instantiate(t){return t.api[y2](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${t.stringify(this.value)})`}toJSON(){return{[this.type]:this.value}}}function RPt(e=[]){return new Map([[v2,Wrt],[Lrt,EPt],[_8,Vrt],[b8,aPt],[p2,rPt],[g2,kPt],[m2,oPt],[y2,CPt],...e])}function NPt(e=[]){return new Set(["menu","search","slider","table",...e])}function IPt({attributes:e=OPt(),interactors:t=DPt(),legends:n=LPt(),marks:r=FPt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function OPt(e=[]){return new Set([...Object.keys(HBt),...e])}function DPt(e=[]){return new Set([...Object.keys(KBt),...e])}function LPt(e=[]){return new Set([...Object.keys(ZBt),...e])}function FPt(e=[]){return new Set([...Object.keys(JBt),...e])}function $Pt(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",...e])}function E8(e,t){return new BPt(t).parse(e)}class BPt{constructor({components:t=RPt(),transforms:n=$Pt(),inputs:r=NPt(),plot:i=IPt(),params:o=[],datasets:s=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(o),this.datasets=new Map(s)}parse(t){const{meta:n,config:r,data:i={},params:o,plotDefaults:s={},...a}=t;for(const l in i)this.datasets.set(l,A9t(l,i[l],this));this.plotDefaults=Object.entries(s).map(([l,c])=>jrt(l,c,this));for(const l in o)this.params.set(l,Z9t(o[l],this));return new nPt(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=O5(t);return n?this.paramRef(n):new D5(t)}maybeSelection(t){const n=O5(t);return n?this.selectionRef(n):new D5(t)}paramRef(t,n=()=>new F5){const{params:r}=this;if(!t)return null;let i=r.get(t);return i||(i=n(),r.set(t,i)),new Q9t(t)}selectionRef(t,n=!1){const r=this.params.get(t);return n&&r&&!(r instanceof L5)?null:this.paramRef(t,()=>new L5)}error(t,n){Prt(t,n)}}var n_={},q$=Symbol(),PPt=Symbol(),Yrt=e=>typeof e=="string"?fv[e]:e,fv={plain:n_,plaintext:n_,text:n_,txt:n_},Hrt=(e,t)=>(t[PPt]||UPt)(e,t),UPt=(e,t)=>{for(var n=[e],r,i=[],o=0;r=Yrt(t[q$]);)delete t[q$],Object.assign(t,r);for(Krt(e,t,n,0);i[o++]=n[0],n=n[1];);return i},Grt=(e,t,n)=>e.replace(/&/g,"&").replace(t,n),j$="",r_="",pm="",Xrt=e=>{for(var t="",n=e.length,r=0;r{if(e instanceof qm){var{type:t,alias:n,content:r}=e,i=r_,o=pm,s=``;pm+=j$,r_+=s;var a=Jrt(r);return r_=i,pm=o,s+a+j$}return typeof e!="string"?Xrt(e):(e=Grt(e,/{for(var o in t)if(t[o])for(var s=0,a=t[o],l=Array.isArray(a)?a:[a];s=v+(k=y[0].length);y=y[1],v+=k);if(y[0]instanceof qm)continue;for(var M=y,a=v;(a+=M[0].length)i[2]&&(i[2]=N)}}}}};function qm(e,t,n,r){this.type=e,this.content=t,this.alias=r,this.length=n.length}const zPt=(e,t,...n)=>{let r,i=[],o,s="",a,l=!1,c=!0,u=[],f,h=0;const p=VPt(),g=p.firstChild,y=g.children,v=y[0],b=v.firstChild,_={language:"text",value:s},S=new Set(n),x={},T=F=>{Object.assign(_,F);let D=s!=(s=F.value??s),P=r!=(r=_.language);f=!!_.readOnly,p.style.tabSize=_.tabSize||2,b.inputMode=f?"none":"",b.setAttribute("aria-readonly",f),C(),M(),D&&(l||b.remove(),b.value=s,b.selectionEnd=0,l||v.prepend(b)),(D||P)&&k()},k=()=>{u=Hrt(s=b.value,fv[r]||{}),L("tokenize",u,r,s);let F=Xrt(u).split(` +`),D=0,P=h,z=h=F.length;for(;F[D]==i[D]&&D