var g="http://www.w3.org/1999/xhtml";const N={svg:"http://www.w3.org/2000/svg",xhtml:g,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function E(t){var n=t+="",e=n.indexOf(":");return e>=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),N.hasOwnProperty(n)?{space:N[n],local:t}:t}function H(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===g&&n.documentElement.namespaceURI===g?n.createElement(t):n.createElementNS(e,t)}}function U(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function b(t){var n=E(t);return(n.local?U:H)(n)}function k(){}function L(t){return t==null?k:function(){return this.querySelector(t)}}function z(t){typeof t!="function"&&(t=L(t));for(var n=this._groups,e=n.length,i=new Array(e),r=0;r<e;++r)for(var s=n[r],l=s.length,o=i[r]=new Array(l),c,u,f=0;f<l;++f)(c=s[f])&&(u=t.call(c,c.__data__,f,s))&&("__data__"in c&&(u.__data__=c.__data__),o[f]=u);return new h(i,this._parents)}function F(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function K(){return[]}function X(t){return t==null?K:function(){return this.querySelectorAll(t)}}function J(t){return function(){var n=t.apply(this,arguments);return n==null?[]:F(n)}}function Q(t){typeof t=="function"?t=J(t):t=X(t);for(var n=this._groups,e=n.length,i=[],r=[],s=0;s<e;++s)for(var l=n[s],o=l.length,c,u=0;u<o;++u)(c=l[u])&&(i.push(t.call(c,c.__data__,u,l)),r.push(c));return new h(i,r)}function W(t){return function(){return this.matches(t)}}function R(t){return function(n){return n.matches(t)}}var Y=Array.prototype.find;function Z(t){return function(){return Y.call(this.children,t)}}function $(){return this.firstElementChild}function G(t){return this.select(t==null?$:Z(typeof t=="function"?t:R(t)))}var j=Array.prototype.filter;function tt(){return this.children}function nt(t){return function(){return j.call(this.children,t)}}function et(t){return this.selectAll(t==null?tt:nt(typeof t=="function"?t:R(t)))}function rt(t){typeof t!="function"&&(t=W(t));for(var n=this._groups,e=n.length,i=new Array(e),r=0;r<e;++r)for(var s=n[r],l=s.length,o=i[r]=[],c,u=0;u<l;++u)(c=s[u])&&t.call(c,c.__data__,u,s)&&o.push(c);return new h(i,this._parents)}function B(t){return new Array(t.length)}function it(){return new h(this._enter||this._groups.map(B),this._parents)}function m(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}m.prototype={constructor:m,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function st(t){return function(){return t}}function ot(t,n,e,i,r,s){for(var l=0,o,c=n.length,u=s.length;l<u;++l)(o=n[l])?(o.__data__=s[l],i[l]=o):e[l]=new m(t,s[l]);for(;l<c;++l)(o=n[l])&&(r[l]=o)}function lt(t,n,e,i,r,s,l){var o,c,u=new Map,f=n.length,p=s.length,_=new Array(f),a;for(o=0;o<f;++o)(c=n[o])&&(_[o]=a=l.call(c,c.__data__,o,n)+"",u.has(a)?r[o]=c:u.set(a,c));for(o=0;o<p;++o)a=l.call(t,s[o],o,s)+"",(c=u.get(a))?(i[o]=c,c.__data__=s[o],u.delete(a)):e[o]=new m(t,s[o]);for(o=0;o<f;++o)(c=n[o])&&u.get(_[o])===c&&(r[o]=c)}function ct(t){return t.__data__}function ut(t,n){if(!arguments.length)return Array.from(this,ct);var e=n?lt:ot,i=this._parents,r=this._groups;typeof t!="function"&&(t=st(t));for(var s=r.length,l=new Array(s),o=new Array(s),c=new Array(s),u=0;u<s;++u){var f=i[u],p=r[u],_=p.length,a=F(t.call(f,f&&f.__data__,u,i)),d=a.length,A=o[u]=new Array(d),x=l[u]=new Array(d),T=c[u]=new Array(_);e(f,p,A,x,T,a,n);for(var y=0,v=0,S,C;y<d;++y)if(S=A[y]){for(y>=v&&(v=y+1);!(C=x[v])&&++v<d;);S._next=C||null}}return l=new h(l,i),l._enter=o,l._exit=c,l}function ft(){return new h(this._exit||this._groups.map(B),this._parents)}function at(t,n,e){var i=this.enter(),r=this,s=this.exit();return i=typeof t=="function"?t(i):i.append(t+""),n!=null&&(r=n(r)),e==null?s.remove():e(s),i&&r?i.merge(r).order():r}function ht(t){if(!(t instanceof h))throw new Error("invalid merge");for(var n=this._groups,e=t._groups,i=n.length,r=e.length,s=Math.min(i,r),l=new Array(i),o=0;o<s;++o)for(var c=n[o],u=e[o],f=c.length,p=l[o]=new Array(f),_,a=0;a<f;++a)(_=c[a]||u[a])&&(p[a]=_);for(;o<i;++o)l[o]=n[o];return new h(l,this._parents)}function _t(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var i=t[n],r=i.length-1,s=i[r],l;--r>=0;)(l=i[r])&&(s&&l.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(l,s),s=l);return this}function pt(t){t||(t=yt);function n(p,_){return p&&_?t(p.__data__,_.__data__):!p-!_}for(var e=this._groups,i=e.length,r=new Array(i),s=0;s<i;++s){for(var l=e[s],o=l.length,c=r[s]=new Array(o),u,f=0;f<o;++f)(u=l[f])&&(c[f]=u);c.sort(n)}return new h(r,this._parents).order()}function yt(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function dt(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function vt(){return Array.from(this)}function mt(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var i=t[n],r=0,s=i.length;r<s;++r){var l=i[r];if(l)return l}return null}function gt(){let t=0;for(const n of this)++t;return t}function wt(){return!this.node()}function At(t){for(var n=this._groups,e=0,i=n.length;e<i;++e)for(var r=n[e],s=0,l=r.length,o;s<l;++s)(o=r[s])&&t.call(o,o.__data__,s,r);return this}function xt(t){return function(){this.removeAttribute(t)}}function St(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ct(t,n){return function(){this.setAttribute(t,n)}}function Nt(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function Et(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttribute(t):this.setAttribute(t,e)}}function bt(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function Lt(t,n){var e=E(t);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((n==null?e.local?St:xt:typeof n=="function"?e.local?bt:Et:e.local?Nt:Ct)(e,n))}function V(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ft(t){return function(){this.style.removeProperty(t)}}function Rt(t,n,e){return function(){this.style.setProperty(t,n,e)}}function Bt(t,n,e){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,e)}}function Vt(t,n,e){return arguments.length>1?this.each((n==null?Ft:typeof n=="function"?Bt:Rt)(t,n,e??"")):Dt(this.node(),t)}function Dt(t,n){return t.style.getPropertyValue(n)||V(t).getComputedStyle(t,null).getPropertyValue(n)}function Mt(t){return function(){delete this[t]}}function Pt(t,n){return function(){this[t]=n}}function qt(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function It(t,n){return arguments.length>1?this.each((n==null?Mt:typeof n=="function"?qt:Pt)(t,n)):this.node()[t]}function D(t){return t.trim().split(/^|\s+/)}function w(t){return t.classList||new M(t)}function M(t){this._node=t,this._names=D(t.getAttribute("class")||"")}M.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function P(t,n){for(var e=w(t),i=-1,r=n.length;++i<r;)e.add(n[i])}function q(t,n){for(var e=w(t),i=-1,r=n.length;++i<r;)e.remove(n[i])}function Ot(t){return function(){P(this,t)}}function Tt(t){return function(){q(this,t)}}function Ht(t,n){return function(){(n.apply(this,arguments)?P:q)(this,t)}}function Ut(t,n){var e=D(t+"");if(arguments.length<2){for(var i=w(this.node()),r=-1,s=e.length;++r<s;)if(!i.contains(e[r]))return!1;return!0}return this.each((typeof n=="function"?Ht:n?Ot:Tt)(e,n))}function kt(){this.textContent=""}function zt(t){return function(){this.textContent=t}}function Kt(t){return function(){var n=t.apply(this,arguments);this.textContent=n??""}}function Xt(t){return arguments.length?this.each(t==null?kt:(typeof t=="function"?Kt:zt)(t)):this.node().textContent}function Jt(){this.innerHTML=""}function Qt(t){return function(){this.innerHTML=t}}function Wt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=n??""}}function Yt(t){return arguments.length?this.each(t==null?Jt:(typeof t=="function"?Wt:Qt)(t)):this.node().innerHTML}function Zt(){this.nextSibling&&this.parentNode.appendChild(this)}function $t(){return this.each(Zt)}function Gt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jt(){return this.each(Gt)}function tn(t){var n=typeof t=="function"?t:b(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function nn(){return null}function en(t,n){var e=typeof t=="function"?t:b(t),i=n==null?nn:typeof n=="function"?n:L(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)})}function rn(){var t=this.parentNode;t&&t.removeChild(this)}function sn(){return this.each(rn)}function on(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ln(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function cn(t){return this.select(t?ln:on)}function un(t){return arguments.length?this.property("__data__",t):this.node().__data__}function fn(t){return function(n){t.call(this,n,this.__data__)}}function an(t){return t.trim().split(/^|\s+/).map(function(n){var e="",i=n.indexOf(".");return i>=0&&(e=n.slice(i+1),n=n.slice(0,i)),{type:n,name:e}})}function hn(t){return function(){var n=this.__on;if(n){for(var e=0,i=-1,r=n.length,s;e<r;++e)s=n[e],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):n[++i]=s;++i?n.length=i:delete this.__on}}}function _n(t,n,e){return function(){var i=this.__on,r,s=fn(n);if(i){for(var l=0,o=i.length;l<o;++l)if((r=i[l]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=e),r.value=n;return}}this.addEventListener(t.type,s,e),r={type:t.type,name:t.name,value:n,listener:s,options:e},i?i.push(r):this.__on=[r]}}function pn(t,n,e){var i=an(t+""),r,s=i.length,l;if(arguments.length<2){var o=this.node().__on;if(o){for(var c=0,u=o.length,f;c<u;++c)for(r=0,f=o[c];r<s;++r)if((l=i[r]).type===f.type&&l.name===f.name)return f.value}return}for(o=n?_n:hn,r=0;r<s;++r)this.each(o(i[r],n,e));return this}function I(t,n,e){var i=V(t),r=i.CustomEvent;typeof r=="function"?r=new r(n,e):(r=i.document.createEvent("Event"),e?(r.initEvent(n,e.bubbles,e.cancelable),r.detail=e.detail):r.initEvent(n,!1,!1)),t.dispatchEvent(r)}function yn(t,n){return function(){return I(this,t,n)}}function dn(t,n){return function(){return I(this,t,n.apply(this,arguments))}}function vn(t,n){return this.each((typeof n=="function"?dn:yn)(t,n))}function*mn(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var i=t[n],r=0,s=i.length,l;r<s;++r)(l=i[r])&&(yield l)}var O=[null];function h(t,n){this._groups=t,this._parents=n}function gn(){return new h([[document.documentElement]],O)}function wn(){return this}h.prototype=gn.prototype={constructor:h,select:z,selectAll:Q,selectChild:G,selectChildren:et,filter:rt,data:ut,enter:it,exit:ft,join:at,merge:ht,selection:wn,order:_t,sort:pt,call:dt,nodes:vt,node:mt,size:gt,empty:wt,each:At,attr:Lt,style:Vt,property:It,classed:Ut,text:Xt,html:Yt,raise:$t,lower:jt,append:tn,insert:en,remove:sn,clone:cn,datum:un,on:pn,dispatch:vn,[Symbol.iterator]:mn};function An(t){return typeof t=="string"?new h([[document.querySelector(t)]],[document.documentElement]):new h([[t]],O)}export{h as S,F as a,X as b,gn as c,Dt as d,An as e,W as m,E as n,O as r,L as s};