scrapbox-local-graph
code:mod.js
var ie,C,Rn,Po,Ot,Mn,Ao,ne={},Pn=[],Oo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|inech|zoo|^ord|itera/i;function dt(t,e){for(var n in e)tn=en;return t}function An(t){var e=t.parentNode;e&&e.removeChild(t)}function O(t,e,n){var r,o,i,s={};for(i in e)i=="key"?r=ei:i=="ref"?o=ei:si=ei;if(arguments.length>2&&(s.children=arguments.length>3?ie.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)si===void 0&&(si=t.defaultPropsi);return te(t,s,r,o,null)}function te(t,e,n,r,o){var i={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:o??++Rn};return o==null&&C.vnode!=null&&C.vnode(i),i}function at(t){return t.children}function ee(t,e){this.props=t,this.context=e}function Dt(t,e){if(e==null)return t.__?Dt(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if((n=t.__ke)!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Dt(t):null}function On(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__ke)!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return On(t)}}function Tn(t){(!t.__d&&(t.__d=!0)&&Ot.push(t)&&!re.__r++||Mn!==C.debounceRendering)&&((Mn=C.debounceRendering)||setTimeout)(re)}function re(){for(var t;re.__r=Ot.length;)t=Ot.sort(function(e,n){return e.__v.__b-n.__v.__b}),Ot=[],t.some(function(e){var n,r,o,i,s,u;e.__d&&(s=(i=(n=e).__v).__e,(u=n.__P)&&(r=[],(o=dt({},i)).__v=i.__v+1,Ae(u,i,o,n.__n,u.ownerSVGElement!==void 0,i.__h!=null?s:null,r,s??Dt(i),i.__h),Fn(r,i),i.__e!=s&&On(i)))})}function Dn(t,e,n,r,o,i,s,u,c,l){var a,d,h,f,v,y,_,p=r&&r.__k||Pn,w=p.length;for(n.__k=[],a=0;a<e.length;a++)if((f=n.__ka=(f=ea)==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?te(null,f,null,null,f):Array.isArray(f)?te(at,{children:f},null,null,null):f.__b>0?te(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(h=pa)===null||h&&f.key==h.key&&f.type===h.type)pa=void 0;else for(d=0;d<w;d++){if((h=pd)&&f.key==h.key&&f.type===h.type){pd=void 0;break}h=null}Ae(t,f,h=h||ne,o,i,s,u,c,l),v=f.__e,(d=f.ref)&&h.ref!=d&&(_||(_=[]),h.ref&&_.push(h.ref,null,f),_.push(d,f.__c||v,f)),v!=null?(y==null&&(y=v),typeof f.type=="function"&&f.__k===h.__k?f.__d=c=Hn(f,c,t):c=Bn(t,f,h,p,v,c),typeof n.type=="function"&&(n.__d=c)):c&&h.__e==c&&c.parentNode!=t&&(c=Dt(h))}for(n.__e=y,a=w;a--;)pa!=null&&$n(pa,pa);if(_)for(a=0;a<_.length;a++)zn(_a,_++a,_++a)}function Hn(t,e,n){for(var r,o=t.__k,i=0;o&&i<o.length;i++)(r=oi)&&(r.__=t,e=typeof r.type=="function"?Hn(r,e,n):Bn(n,r,r,o,r.__e,e));return e}function Bn(t,e,n,r,o,i){var s,u,c;if(e.__d!==void 0)s=e.__d,e.__d=void 0;else if(n==null||o!=i||o.parentNode==null)t:if(i==null||i.parentNode!==t)t.appendChild(o),s=null;else{for(u=i,c=0;(u=u.nextSibling)&&c<r.length;c+=1)if(u==o)break t;t.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function Do(t,e,n,r,o){var i;for(i in n)i==="children"||i==="key"||i in e||oe(t,i,null,ni,r);for(i in e)o&&typeof ei!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||ni===ei||oe(t,i,ei,ni,r)}function In(t,e,n){e0==="-"?t.setProperty(e,n):te=n==null?"":typeof n!="number"||Oo.test(e)?n:n+"px"}function oe(t,e,n,r,o){var i;t:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||In(t.style,e,"");if(n)for(e in n)r&&ne===re||In(t.style,e,ne)}else if(e0==="o"&&e1==="n")i=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.le+i=n,n?r||t.addEventListener(e,i?Sn:Cn,i):t.removeEventListener(e,i?Sn:Cn,i);else if(e!=="dangerouslySetInnerHTML"){if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{te=n??"";break t}catch{}typeof n=="function"||(n==null||n===!1&&e.indexOf("-")==-1?t.removeAttribute(e):t.setAttribute(e,n))}}function Cn(t){this.lt.type+!1(C.event?C.event(t):t)}function Sn(t){this.lt.type+!0(C.event?C.event(t):t)}function Ae(t,e,n,r,o,i,s,u,c){var l,a,d,h,f,v,y,_,p,w,k,m,b,L,M,T=e.type;if(e.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,u=e.__e=n.__e,e.__h=null,i=u),(l=C.__b)&&l(e);try{t:if(typeof T=="function"){if(_=e.props,p=(l=T.contextType)&&rl.__c,w=l?p?p.props.value:l.__:r,n.__c?y=(a=e.__c=n.__c).__=a.__E:("prototype"in T&&T.prototype.render?e.__c=a=new T(_,w):(e.__c=a=new ee(_,w),a.constructor=T,a.render=Bo),p&&p.sub(a),a.props=_,a.state||(a.state={}),a.context=w,a.__n=r,d=a.__d=!0,a.__h=[],a._sb=[]),a.__s==null&&(a.__s=a.state),T.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=dt({},a.__s)),dt(a.__s,T.getDerivedStateFromProps(_,a.__s))),h=a.props,f=a.state,d)T.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(T.getDerivedStateFromProps==null&&_!==h&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(_,w),!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(_,a.__s,w)===!1||e.__v===n.__v){for(a.props=_,a.state=a.__s,e.__v!==n.__v&&(a.__d=!1),a.__v=e,e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(P){P&&(P.__=e)}),k=0;k<a._sb.length;k++)a.__h.push(a._sbk);a._sb=[],a.__h.length&&s.push(a);break t}a.componentWillUpdate!=null&&a.componentWillUpdate(_,a.__s,w),a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(h,f,v)})}if(a.context=w,a.props=_,a.__v=e,a.__P=t,m=C.__r,b=0,"prototype"in T&&T.prototype.render){for(a.state=a.__s,a.__d=!1,m&&m(e),l=a.render(a.props,a.state,a.context),L=0;L<a._sb.length;L++)a.__h.push(a._sbL);a._sb=[]}else do a.__d=!1,m&&m(e),l=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++b<25);a.state=a.__s,a.getChildContext!=null&&(r=dt(dt({},r),a.getChildContext())),d||a.getSnapshotBeforeUpdate==null||(v=a.getSnapshotBeforeUpdate(h,f)),M=l!=null&&l.type===at&&l.key==null?l.props.children:l,Dn(t,Array.isArray(M)?M:M,e,n,r,o,i,s,u,c),a.base=e.__e,e.__h=null,a.__h.length&&s.push(a),y&&(a.__E=a.__=null),a.__e=!1}else i==null&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=Ho(n.__e,e,n,r,o,i,s,c);(l=C.diffed)&&l(e)}catch(P){e.__v=null,(c||i!=null)&&(e.__e=u,e.__h=!!c,ii.indexOf(u)=null),C.__e(P,e,n)}}function Fn(t,e){C.__c&&C.__c(e,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(r){r.call(n)})}catch(r){C.__e(r,n.__v)}})}function Ho(t,e,n,r,o,i,s,u){var c,l,a,d=n.props,h=e.props,f=e.type,v=0;if(f==="svg"&&(o=!0),i!=null){for(;v<i.length;v++)if((c=iv)&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){t=c,iv=null;break}}if(t==null){if(f===null)return document.createTextNode(h);t=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,h.is&&h),i=null,u=!1}if(f===null)d===h||u&&t.data===h||(t.data=h);else{if(i=i&&ie.call(t.childNodes),l=(d=n.props||ne).dangerouslySetInnerHTML,a=h.dangerouslySetInnerHTML,!u){if(i!=null)for(d={},v=0;v<t.attributes.length;v++)d[t.attributes[v].name]=t.attributes[v].value;(a||l)&&(a&&(l&&a.__html==l.__html||a.__html===t.innerHTML)||(t.innerHTML=a&&a.__html||""))}if(Do(t,h,d,o,u),a)e.__k=[];else if(v=e.props.children,Dn(t,Array.isArray(v)?v:v,e,n,r,o&&f!=="foreignObject",i,s,i?i0:n.__k&&Dt(n,0),u),i!=null)for(v=i.length;v--;)iv!=null&&An(iv);u||("value"in h&&(v=h.value)!==void 0&&(v!==t.value||f==="progress"&&!v||f==="option"&&v!==d.value)&&oe(t,"value",v,d.value,!1),"checked"in h&&(v=h.checked)!==void 0&&v!==t.checked&&oe(t,"checked",v,d.checked,!1))}return t}function zn(t,e,n){try{typeof t=="function"?t(e):t.current=e}catch(r){C.__e(r,n)}}function $n(t,e,n){var r,o;if(C.unmount&&C.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||zn(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){C.__e(i,e)}r.base=r.__P=null,t.__c=void 0}if(r=t.__k)for(o=0;o<r.length;o++)ro&&$n(ro,e,n||typeof t.type!="function");n||t.__e==null||An(t.__e),t.__=t.__e=t.__d=void 0}function Bo(t,e,n){return this.constructor(t,n)}function Oe(t,e,n){var r,o,i;C.__&&C.__(t,e),o=(r=typeof n=="function")?null:n&&n.__k||e.__k,i=[],Ae(e,t=(!r&&n||e).__k=O(at,null,t),o||ne,ne,e.ownerSVGElement!==void 0,!r&&n?n:o?null:e.firstChild?ie.call(e.childNodes):null,i,!r&&n?n:o?o.__e:e.firstChild,r),Fn(i,t)}ie=Pn.slice,C={__e:function(t,e,n,r){for(var o,i,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,r||{}),s=o.__d),s)return o.__E=o}catch(u){t=u}throw t}},Rn=0,Po=function(t){return t!=null&&t.constructor===void 0},ee.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=dt({},this.state),typeof t=="function"&&(t=t(dt({},n),this.props)),t&&dt(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),Tn(this))},ee.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Tn(this))},ee.prototype.render=at,Ot=[],re.__r=0,Ao=0;var ue,B,De,qn,Ht=0,Yn=[],se=[],Un=C.__b,jn=C.__r,Gn=C.diffed,Kn=C.__c,Vn=C.unmount;function Be(t,e){C.__h&&C.__h(B,t,Ht||e),Ht=0;var n=B.__H||(B.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:se}),n.__t}function Bt(t){return Ht=1,Fo(Jn,t)}function Fo(t,e,n){var r=Be(ue++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Jn(void 0,e),function(i){var s=r.__N?r.__N0:r.__0,u=r.t(s,i);s!==u&&(r.__N=[u,r.__1],r.__c.setState({}))}],r.__c=B,!B.u)){B.u=!0;var o=B.shouldComponentUpdate;B.shouldComponentUpdate=function(i,s,u){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(a){return a.__c});if(c.every(function(a){return!a.__N}))return!o||o.call(this,i,s,u);var l=!1;return c.forEach(function(a){if(a.__N){var d=a.__0;a.__=a.__N,a.__N=void 0,d!==a.__0&&(l=!0)}}),!(!l&&r.__c.props===i)&&(!o||o.call(this,i,s,u))}}return r.__N||r.__}function ce(t,e){var n=Be(ue++,3);!C.__s&&Qn(n.__H,e)&&(n.__=t,n.i=e,B.__H.__h.push(n))}function Wn(t){return Ht=5,Lt(function(){return{current:t}},[])}function Lt(t,e){var n=Be(ue++,7);return Qn(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function mt(t,e){return Ht=8,Lt(function(){return t},e)}function zo(){for(var t;t=Yn.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ae),t.__H.__h.forEach(He),t.__H.__h=[]}catch(e){t.__H.__h=[],C.__e(e,t.__v)}}C.__b=function(t){B=null,Un&&Un(t)},C.__r=function(t){jn&&jn(t),ue=0;var e=(B=t.__c).__H;e&&(De===B?(e.__h=[],B.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=se,n.__N=n.i=void 0})):(e.__h.forEach(ae),e.__h.forEach(He),e.__h=[])),De=B},C.diffed=function(t){Gn&&Gn(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Yn.push(e)!==1&&qn===C.requestAnimationFrame||((qn=C.requestAnimationFrame)||$o)(zo)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==se&&(n.__=n.__V),n.i=void 0,n.__V=se})),De=B=null},C.__c=function(t,e){e.some(function(n){try{n.__h.forEach(ae),n.__h=n.__h.filter(function(r){return!r.__||He(r)})}catch(r){e.some(function(o){o.__h&&(o.__h=[])}),e=[],C.__e(r,n.__v)}}),Kn&&Kn(t,e)},C.unmount=function(t){Vn&&Vn(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{ae(r)}catch(o){e=o}}),n.__H=void 0,e&&C.__e(e,n.__v))};var Xn=typeof requestAnimationFrame=="function";function $o(t){var e,n=function(){clearTimeout(r),Xn&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);Xn&&(e=requestAnimationFrame(n))}function ae(t){var e=B,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),B=e}function He(t){var e=B;t.__c=t.__(),B=e}function Qn(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==tr})}function Jn(t,e){return typeof e=="function"?e(t):e}var Fe="http://www.w3.org/1999/xhtml",Zn={svg:"http://www.w3.org/2000/svg",xhtml:Fe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ft(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Zn.hasOwnProperty(e)?{space:Zne,local:t}:t}function qo(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Fe&&e.documentElement.namespaceURI===Fe?e.createElement(t):e.createElementNS(n,t)}}function Uo(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function tr(t){var e=Ft(t);return(e.local?Uo:qo)(e)}function jo(){}function fe(t){return t==null?jo:function(){return this.querySelector(t)}}function Go(t){typeof t!="function"&&(t=fe(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=eo,s=i.length,u=ro=new Array(s),c,l,a=0;a<s;++a)(c=ia)&&(l=t.call(c,c.__data__,a,i))&&("__data__"in c&&(l.__data__=c.__data__),ua=l);return new X(r,this._parents)}function Ko(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Vo(){return[]}function $e(t){return t==null?Vo:function(){return this.querySelectorAll(t)}}function Xo(t){return function(){return Ko(t.apply(this,arguments))}}function Yo(t){typeof t=="function"?t=Xo(t):t=$e(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=ei,u=s.length,c,l=0;l<u;++l)(c=sl)&&(r.push(t.call(c,c.__data__,l,s)),o.push(c));return new X(r,o)}function qe(t){return function(){return this.matches(t)}}function er(t){return function(e){return e.matches(t)}}var Wo=Array.prototype.find;function Qo(t){return function(){return Wo.call(this.children,t)}}function Jo(){return this.firstElementChild}function Zo(t){return this.select(t==null?Jo:Qo(typeof t=="function"?t:er(t)))}var ti=Array.prototype.filter;function ei(){return Array.from(this.children)}function ni(t){return function(){return ti.call(this.children,t)}}function ri(t){return this.selectAll(t==null?ei:ni(typeof t=="function"?t:er(t)))}function oi(t){typeof t!="function"&&(t=qe(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=eo,s=i.length,u=ro=[],c,l=0;l<s;++l)(c=il)&&t.call(c,c.__data__,l,i)&&u.push(c);return new X(r,this._parents)}function nr(t){return new Array(t.length)}function ii(){return new X(this._enter||this._groups.map(nr),this._parents)}function le(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}le.prototype={constructor:le,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function si(t){return function(){return t}}function ai(t,e,n,r,o,i){for(var s=0,u,c=e.length,l=i.length;s<l;++s)(u=es)?(u.__data__=is,rs=u):ns=new le(t,is);for(;s<c;++s)(u=es)&&(os=u)}function ui(t,e,n,r,o,i,s){var u,c,l=new Map,a=e.length,d=i.length,h=new Array(a),f;for(u=0;u<a;++u)(c=eu)&&(hu=f=s.call(c,c.__data__,u,e)+"",l.has(f)?ou=c:l.set(f,c));for(u=0;u<d;++u)f=s.call(t,iu,u,i)+"",(c=l.get(f))?(ru=c,c.__data__=iu,l.delete(f)):nu=new le(t,iu);for(u=0;u<a;++u)(c=eu)&&l.get(hu)===c&&(ou=c)}function ci(t){return t.__data__}function li(t,e){if(!arguments.length)return Array.from(this,ci);var n=e?ui:ai,r=this._parents,o=this._groups;typeof t!="function"&&(t=si(t));for(var i=o.length,s=new Array(i),u=new Array(i),c=new Array(i),l=0;l<i;++l){var a=rl,d=ol,h=d.length,f=fi(t.call(a,a&&a.__data__,l,r)),v=f.length,y=ul=new Array(v),_=sl=new Array(v),p=cl=new Array(h);n(a,d,y,_,p,f,e);for(var w=0,k=0,m,b;w<v;++w)if(m=yw){for(w>=k&&(k=w+1);!(b=_k)&&++k<v;);m._next=b||null}}return s=new X(s,r),s._enter=u,s._exit=c,s}function fi(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function hi(){return new X(this._exit||this._groups.map(nr),this._parents)}function pi(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function di(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),u=new Array(o),c=0;c<s;++c)for(var l=nc,a=rc,d=l.length,h=uc=new Array(d),f,v=0;v<d;++v)(f=lv||av)&&(hv=f);for(;c<o;++c)uc=nc;return new X(u,this._parents)}function mi(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=te,o=r.length-1,i=ro,s;--o>=0;)(s=ro)&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function gi(t){t||(t=_i);function e(d,h){return d&&h?t(d.__data__,h.__data__):!d-!h}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=ni,u=s.length,c=oi=new Array(u),l,a=0;a<u;++a)(l=sa)&&(ca=l);c.sort(e)}return new X(o,this._parents).order()}function _i(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function yi(){var t=arguments0;return arguments0=this,t.apply(null,arguments),this}function vi(){return Array.from(this)}function wi(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=te,o=0,i=r.length;o<i;++o){var s=ro;if(s)return s}return null}function xi(){let t=0;for(let e of this)++t;return t}function bi(){return!this.node()}function Ei(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=en,i=0,s=o.length,u;i<s;++i)(u=oi)&&t.call(u,u.__data__,i,o);return this}function ki(t){return function(){this.removeAttribute(t)}}function Ni(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Li(t,e){return function(){this.setAttribute(t,e)}}function Mi(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ti(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Ii(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ci(t,e){var n=Ft(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Ni:ki:typeof e=="function"?n.local?Ii:Ti:n.local?Mi:Li)(n,e))}function rr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Si(t){return function(){this.style.removeProperty(t)}}function Ri(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Pi(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ai(t,e,n){return arguments.length>1?this.each((e==null?Si:typeof e=="function"?Pi:Ri)(t,e,n??"")):wt(this.node(),t)}function wt(t,e){return t.style.getPropertyValue(e)||rr(t).getComputedStyle(t,null).getPropertyValue(e)}function Oi(t){return function(){delete thist}}function Di(t,e){return function(){thist=e}}function Hi(t,e){return function(){var n=e.apply(this,arguments);n==null?delete thist:thist=n}}function Bi(t,e){return arguments.length>1?this.each((e==null?Oi:typeof e=="function"?Hi:Di)(t,e)):this.node()t}function or(t){return t.trim().split(/^|\s+/)}function Ue(t){return t.classList||new ir(t)}function ir(t){this._node=t,this._names=or(t.getAttribute("class")||"")}ir.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function sr(t,e){for(var n=Ue(t),r=-1,o=e.length;++r<o;)n.add(er)}function ar(t,e){for(var n=Ue(t),r=-1,o=e.length;++r<o;)n.remove(er)}function Fi(t){return function(){sr(this,t)}}function zi(t){return function(){ar(this,t)}}function $i(t,e){return function(){(e.apply(this,arguments)?sr:ar)(this,t)}}function qi(t,e){var n=or(t+"");if(arguments.length<2){for(var r=Ue(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(no))return!1;return!0}return this.each((typeof e=="function"?$i:e?Fi:zi)(n,e))}function Ui(){this.textContent=""}function ji(t){return function(){this.textContent=t}}function Gi(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ki(t){return arguments.length?this.each(t==null?Ui:(typeof t=="function"?Gi:ji)(t)):this.node().textContent}function Vi(){this.innerHTML=""}function Xi(t){return function(){this.innerHTML=t}}function Yi(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Wi(t){return arguments.length?this.each(t==null?Vi:(typeof t=="function"?Yi:Xi)(t)):this.node().innerHTML}function Qi(){this.nextSibling&&this.parentNode.appendChild(this)}function Ji(){return this.each(Qi)}function Zi(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ts(){return this.each(Zi)}function es(t){var e=typeof t=="function"?t:tr(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ns(){return null}function rs(t,e){var n=typeof t=="function"?t:tr(t),r=e==null?ns:typeof e=="function"?e:fe(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function os(){var t=this.parentNode;t&&t.removeChild(this)}function is(){return this.each(os)}function ss(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function as(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function us(t){return this.select(t?as:ss)}function cs(t){return arguments.length?this.property("__data__",t):this.node().__data__}function ls(t){return function(e){t.call(this,e,this.__data__)}}function fs(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function hs(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=en,(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e++r=i;++r?e.length=r:delete this.__on}}}function ps(t,e,n){return function(){var r=this.__on,o,i=ls(e);if(r){for(var s=0,u=r.length;s<u;++s)if((o=rs).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=o}}function ds(t,e,n){var r=fs(t+""),o,i=r.length,s;if(arguments.length<2){var u=this.node().__on;if(u){for(var c=0,l=u.length,a;c<l;++c)for(o=0,a=uc;o<i;++o)if((s=ro).type===a.type&&s.name===a.name)return a.value}return}for(u=e?ps:hs,o=0;o<i;++o)this.each(u(ro,e,n));return this}function ur(t,e,n){var r=rr(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function ms(t,e){return function(){return ur(this,t,e)}}function gs(t,e){return function(){return ur(this,t,e.apply(this,arguments))}}function _s(t,e){return this.each((typeof e=="function"?gs:ms)(t,e))}function*ys(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=te,o=0,i=r.length,s;o<i;++o)(s=ro)&&(yield s)}var cr=null;function X(t,e){this._groups=t,this._parents=e}function xt(){return new X(document.documentElement,cr)}function vs(){return this}X.prototype=xt.prototype={constructor:X,select:Go,selectAll:Yo,selectChild:Zo,selectChildren:ri,filter:oi,data:li,enter:ii,exit:hi,join:pi,merge:di,selection:vs,order:mi,sort:gi,call:yi,nodes:vi,node:wi,size:xi,empty:bi,each:Ei,attr:Ci,style:Ai,property:Bi,classed:qi,text:Ki,html:Wi,raise:Ji,lower:ts,append:es,insert:rs,remove:is,clone:us,datum:cs,on:ds,dispatch:_s,Symbol.iterator:ys};function Y(t){return typeof t=="string"?new X(document.querySelector(t),document.documentElement):new X(t,cr)}var ws=0;function xs(){return new ze}function ze(){this._="@"+(++ws).toString(36)}ze.prototype=xs.prototype={constructor:ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return te},set:function(t,e){return tthis._=e},remove:function(t){return this._ in t&&delete tthis._},toString:function(){return this._}};function bs(t){let e;for(;e=t.sourceEvent;)t=e;return t}function J(t,e){if(t=bs(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),r.x,r.y}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();returnt.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop}}returnt.pageX,t.pageY}var Es={value:()=>{}};function ut(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=argumentst+"")||r in n||/\s./.test(r))throw new Error("illegal type: "+r);nr=[]}return new he(n)}function he(t){this._=t}function ks(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}he.prototype=ut.prototype={constructor:he,on:function(t,e){var n=this._,r=ks(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=ri).type)&&(o=Ns(no,t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=ri).type)no=lr(no,t.name,e);else if(e==null)for(o in n)no=lr(no,t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)tn=en.slice();return new he(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)nr=argumentsr+2;if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._t,r=0,o=i.length;r<o;++r)ir.value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._t,o=0,i=r.length;o<i;++o)ro.value.apply(e,n)}};function Ns(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=tn).name===e)return o.value}function lr(t,e,n){for(var r=0,o=t.length;r<o;++r)if(tr.name===e){tr=Es,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Ls={passive:!1},zt={capture:!0,passive:!1};function je(t){t.stopImmediatePropagation()}function Mt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ke(t){var e=t.document.documentElement,n=Y(t).on("dragstart.drag",Mt,zt);"onselectstart"in e?n.on("selectstart.drag",Mt,zt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ve(t,e){var n=t.document.documentElement,r=Y(t).on("dragstart.drag",null);e&&(r.on("click.drag",Mt,zt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var pe=t=>()=>t;function Ge(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:i,x:s,y:u,dx:c,dy:l,dispatch:a}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}Ge.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Ms(t){return!t.ctrlKey&&!t.button}function Ts(){return this.parentNode}function Is(t,e){return e??{x:t.x,y:t.y}}function Cs(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var t=Ms,e=Ts,n=Is,r=Cs,o={},i=ut("start","drag","end"),s=0,u,c,l,a,d=0;function h(m){m.on("mousedown.drag",f).filter(r).on("touchstart.drag",_).on("touchmove.drag",p,Ls).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(m,b){if(!(a||!t.call(this,m,b))){var L=k(this,e.call(this,m,b),m,b,"mouse");L&&(Y(m.view).on("mousemove.drag",v,zt).on("mouseup.drag",y,zt),Ke(m.view),je(m),l=!1,u=m.clientX,c=m.clientY,L("start",m))}}function v(m){if(Mt(m),!l){var b=m.clientX-u,L=m.clientY-c;l=b*b+L*L>d}o.mouse("drag",m)}function y(m){Y(m.view).on("mousemove.drag mouseup.drag",null),Ve(m.view,l),Mt(m),o.mouse("end",m)}function _(m,b){if(t.call(this,m,b)){var L=m.changedTouches,M=e.call(this,m,b),T=L.length,P,D;for(P=0;P<T;++P)(D=k(this,M,m,b,LP.identifier,LP))&&(je(m),D("start",m,LP))}}function p(m){var b=m.changedTouches,L=b.length,M,T;for(M=0;M<L;++M)(T=o[bM.identifier])&&(Mt(m),T("drag",m,bM))}function w(m){var b=m.changedTouches,L=b.length,M,T;for(a&&clearTimeout(a),a=setTimeout(function(){a=null},500),M=0;M<L;++M)(T=o[bM.identifier])&&(je(m),T("end",m,bM))}function k(m,b,L,M,T,P){var D=i.copy(),z=J(P||L,b),yt,vt,g;if((g=n.call(m,new Ge("beforestart",{sourceEvent:L,target:h,identifier:T,active:s,x:z0,y:z1,dx:0,dy:0,dispatch:D}),M))!=null)return yt=g.x-z0||0,vt=g.y-z1||0,function E(x,N,I){var S=z,R;switch(x){case"start":oT=E,R=s++;break;case"end":delete oT,--s;case"drag":z=J(I||N,b),R=s;break}D.call(x,m,new Ge(x,{sourceEvent:N,subject:g,target:h,identifier:T,active:R,x:z0+yt,y:z1+vt,dx:z0-S0,dy:z1-S1,dispatch:D}),M)}}return h.filter=function(m){return arguments.length?(t=typeof m=="function"?m:pe(!!m),h):t},h.container=function(m){return arguments.length?(e=typeof m=="function"?m:pe(m),h):e},h.subject=function(m){return arguments.length?(n=typeof m=="function"?m:pe(m),h):n},h.touchable=function(m){return arguments.length?(r=typeof m=="function"?m:pe(!!m),h):r},h.on=function(){var m=i.on.apply(i,arguments);return m===i?h:m},h.clickDistance=function(m){return arguments.length?(d=(m=+m)*m,h):Math.sqrt(d)},h}function St(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ut(t,e){var n=Object.create(t.prototype);for(var r in e)nr=er;return n}function gt(){}var Et=.7,Ct=1/Et,Tt="\\s*(+-?\\d+)\\s*",$t="\\s*(+-?\\d*\\.?\\d+(?:eE+-?\\d+)?)\\s*",nt="\\s*(+-?\\d*\\.?\\d+(?:eE+-?\\d+)?)%\\s*",Ss=/^#(0-9a-f{3,8})$/,Rs=new RegExp("^rgb\\("+Tt,Tt,Tt+"\\)$"),Ps=new RegExp("^rgb\\("+nt,nt,nt+"\\)$"),As=new RegExp("^rgba\\("+Tt,Tt,Tt,$t+"\\)$"),Os=new RegExp("^rgba\\("+nt,nt,nt,$t+"\\)$"),Ds=new RegExp("^hsl\\("+$t,nt,nt+"\\)$"),Hs=new RegExp("^hsla\\("+$t,nt,nt,$t+"\\)$"),hr={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};St(gt,kt,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:pr,formatHex:pr,formatHsl:Bs,formatRgb:dr,toString:dr});function pr(){return this.rgb().formatHex()}function Bs(){return br(this).formatHsl()}function dr(){return this.rgb().formatRgb()}function kt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ss.exec(t))?(n=e1.length,e=parseInt(e1,16),n===6?mr(e):n===3?new q(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?de(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?de(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Rs.exec(t))?new q(e1,e2,e3,1):(e=Ps.exec(t))?new q(e1*255/100,e2*255/100,e3*255/100,1):(e=As.exec(t))?de(e1,e2,e3,e4):(e=Os.exec(t))?de(e1*255/100,e2*255/100,e3*255/100,e4):(e=Ds.exec(t))?yr(e1,e2/100,e3/100,1):(e=Hs.exec(t))?yr(e1,e2/100,e3/100,e4):hr.hasOwnProperty(t)?mr(hrt):t==="transparent"?new q(NaN,NaN,NaN,0):null}function mr(t){return new q(t>>16&255,t>>8&255,t&255,1)}function de(t,e,n,r){return r<=0&&(t=e=n=NaN),new q(t,e,n,r)}function tn(t){return t instanceof gt||(t=kt(t)),t?(t=t.rgb(),new q(t.r,t.g,t.b,t.opacity)):new q}function jt(t,e,n,r){return arguments.length===1?tn(t):new q(t,e,n,r??1)}function q(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}St(q,jt,Ut(gt,{brighter:function(t){return t=t==null?Ct:Math.pow(Ct,t),new q(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=t==null?Et:Math.pow(Et,t),new q(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:gr,formatHex:gr,formatRgb:_r,toString:_r}));function gr(){return"#"+Xe(this.r)+Xe(this.g)+Xe(this.b)}function _r(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function Xe(t){return t=Math.max(0,Math.min(255,Math.round(t)||0)),(t<16?"0":"")+t.toString(16)}function yr(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new et(t,e,n,r)}function br(t){if(t instanceof et)return new et(t.h,t.s,t.l,t.opacity);if(t instanceof gt||(t=kt(t)),!t)return new et;if(t instanceof et)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,u=i-o,c=(i+o)/2;return u?(e===i?s=(n-r)/u+(n<r)*6:n===i?s=(r-e)/u+2:s=(e-n)/u+4,u/=c<.5?i+o:2-i-o,s*=60):u=c>0&&c<1?0:s,new et(s,u,c,t.opacity)}function ge(t,e,n,r){return arguments.length===1?br(t):new et(t,e,n,r??1)}function et(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}St(et,ge,Ut(gt,{brighter:function(t){return t=t==null?Ct:Math.pow(Ct,t),new et(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=t==null?Et:Math.pow(Et,t),new et(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new q(Ye(t>=240?t-240:t+120,o,r),Ye(t,o,r),Ye(t<120?t+240:t-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function Ye(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Er=Math.PI/180,kr=180/Math.PI,me=18,Nr=.96422,Lr=1,Mr=.82521,Tr=4/29,It=6/29,Ir=3*It*It,Fs=It*It*It;function Cr(t){if(t instanceof rt)return new rt(t.l,t.a,t.b,t.opacity);if(t instanceof ct)return Rr(t);t instanceof q||(t=tn(t));var e=Ze(t.r),n=Ze(t.g),r=Ze(t.b),o=We((.2225045*e+.7168786*n+.0606169*r)/Lr),i,s;return e===n&&n===r?i=s=o:(i=We((.4360747*e+.3850649*n+.1430804*r)/Nr),s=We((.0139322*e+.0971045*n+.7141733*r)/Mr)),new rt(116*o-16,500*(i-o),200*(o-s),t.opacity)}function Sr(t,e,n,r){return arguments.length===1?Cr(t):new rt(t,e,n,r??1)}function rt(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}St(rt,Sr,Ut(gt,{brighter:function(t){return new rt(this.l+me*(t??1),this.a,this.b,this.opacity)},darker:function(t){return new rt(this.l-me*(t??1),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=Nr*Qe(e),t=Lr*Qe(t),n=Mr*Qe(n),new q(Je(3.1338561*e-1.6168667*t-.4906146*n),Je(-.9787684*e+1.9161415*t+.033454*n),Je(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function We(t){return t>Fs?Math.pow(t,1/3):t/Ir+Tr}function Qe(t){return t>It?t*t*t:Ir*(t-Tr)}function Je(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ze(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function zs(t){if(t instanceof ct)return new ct(t.h,t.c,t.l,t.opacity);if(t instanceof rt||(t=Cr(t)),t.a===0&&t.b===0)return new ct(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*kr;return new ct(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function _e(t,e,n,r){return arguments.length===1?zs(t):new ct(t,e,n,r??1)}function ct(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Rr(t){if(isNaN(t.h))return new rt(t.l,0,0,t.opacity);var e=t.h*Er;return new rt(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}St(ct,_e,Ut(gt,{brighter:function(t){return new ct(this.h,this.c,this.l+me*(t??1),this.opacity)},darker:function(t){return new ct(this.h,this.c,this.l-me*(t??1),this.opacity)},rgb:function(){return Rr(this).rgb()}}));var Pr=-.14861,en=1.78277,nn=-.29227,ye=-.90649,qt=1.97294,vr=qt*ye,wr=qt*en,xr=en*nn-ye*Pr;function $s(t){if(t instanceof bt)return new bt(t.h,t.s,t.l,t.opacity);t instanceof q||(t=tn(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(xr*r+vr*e-wr*n)/(xr+vr-wr),i=r-o,s=(qt*(n-o)-nn*i)/ye,u=Math.sqrt(s*s+i*i)/(qt*o*(1-o)),c=u?Math.atan2(s,i)*kr-120:NaN;return new bt(c<0?c+360:c,u,o,t.opacity)}function ve(t,e,n,r){return arguments.length===1?$s(t):new bt(t,e,n,r??1)}function bt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}St(bt,ve,Ut(gt,{brighter:function(t){return t=t==null?Ct:Math.pow(Ct,t),new bt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=t==null?Et:Math.pow(Et,t),new bt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Er,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new q(255*(e+n*(Pr*r+en*o)),255*(e+n*(nn*r+ye*o)),255*(e+n*(qt*r)),this.opacity)}}));function Dr(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function qs(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=tr,i=tr+1,s=r>0?tr-1:2*o-i,u=r<e-1?tr+2:2*i-o;return Dr((n-r/e)*e,s,o,i,u)}}function Us(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t(r+e-1)%e,i=tr%e,s=t(r+1)%e,u=t(r+2)%e;return Dr((n-r/e)*e,o,i,s,u)}}var an=t=>()=>t;function Hr(t,e){return function(n){return t+n*e}}function js(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function un(t,e){var n=e-t;return n?Hr(t,n>180||n<-180?n-360*Math.round(n/360):n):an(isNaN(t)?e:t)}function Gs(t){return(t=+t)==1?K:function(e,n){return n-e?js(e,n,t):an(isNaN(e)?n:e)}}function K(t,e){var n=e-t;return n?Hr(t,n):an(isNaN(t)?e:t)}var cn=function t(e){var n=Gs(e);function r(o,i){var s=n((o=jt(o)).r,(i=jt(i)).r),u=n(o.g,i.g),c=n(o.b,i.b),l=K(o.opacity,i.opacity);return function(a){return o.r=s(a),o.g=u(a),o.b=c(a),o.opacity=l(a),o+""}}return r.gamma=t,r}(1);function Br(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,u;for(s=0;s<n;++s)u=jt(es),rs=u.r||0,os=u.g||0,is=u.b||0;return r=t(r),o=t(o),i=t(i),u.opacity=1,function(c){return u.r=r(c),u.g=o(c),u.b=i(c),u+""}}}var Mc=Br(qs),Tc=Br(Us);function lt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var on=/-+?(?:\d+\.?\d*|\.?\d+)(?:eE-+?\d+)?/g,rn=new RegExp(on.source,"g");function Ks(t){return function(){return t}}function Vs(t){return function(e){return t(e)+""}}function Fr(t,e){var n=on.lastIndex=rn.lastIndex=0,r,o,i,s=-1,u=[],c=[];for(t=t+"",e=e+"";(r=on.exec(t))&&(o=rn.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),us?us+=i:u++s=i),(r=r0)===(o=o0)?us?us+=o:u++s=o:(u++s=null,c.push({i:s,x:lt(r,o)})),n=rn.lastIndex;return n<e.length&&(i=e.slice(n),us?us+=i:u++s=i),u.length<2?c0?Vs(c0.x):Ks(e):(e=c.length,function(l){for(var a=0,d;a<e;++a)u[(d=ca).i]=d.x(l);return u.join("")})}var Ar=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zr(t,e,n,r,o,i){var s,u,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,c/=u),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Ar,skewX:Math.atan(c)*Ar,scaleX:s,scaleY:u}}var we;function Xs(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?sn:zr(e.a,e.b,e.c,e.d,e.e,e.f)}function Ys(t){return t==null||(we||(we=document.createElementNS("http://www.w3.org/2000/svg","g")),we.setAttribute("transform",t),!(t=we.transform.baseVal.consolidate()))?sn:(t=t.matrix,zr(t.a,t.b,t.c,t.d,t.e,t.f))}function $r(t,e,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,a,d,h,f,v){if(l!==d||a!==h){var y=f.push("translate(",null,e,null,n);v.push({i:y-4,x:lt(l,d)},{i:y-2,x:lt(a,h)})}else(d||h)&&f.push("translate("+d+e+h+n)}function s(l,a,d,h){l!==a?(l-a>180?a+=360:a-l>180&&(l+=360),h.push({i:d.push(o(d)+"rotate(",null,r)-2,x:lt(l,a)})):a&&d.push(o(d)+"rotate("+a+r)}function u(l,a,d,h){l!==a?h.push({i:d.push(o(d)+"skewX(",null,r)-2,x:lt(l,a)}):a&&d.push(o(d)+"skewX("+a+r)}function c(l,a,d,h,f,v){if(l!==d||a!==h){var y=f.push(o(f)+"scale(",null,",",null,")");v.push({i:y-4,x:lt(l,d)},{i:y-2,x:lt(a,h)})}else(d!==1||h!==1)&&f.push(o(f)+"scale("+d+","+h+")")}return function(l,a){var d=[],h=[];return l=t(l),a=t(a),i(l.translateX,l.translateY,a.translateX,a.translateY,d,h),s(l.rotate,a.rotate,d,h),u(l.skewX,a.skewX,d,h),c(l.scaleX,l.scaleY,a.scaleX,a.scaleY,d,h),l=a=null,function(f){for(var v=-1,y=h.length,_;++v<y;)d[(_=hv).i]=_.x(f);return d.join("")}}}var qr=$r(Xs,"px, ","px)","deg)"),Ur=$r(Ys,", ",")",")"),Ws=1e-12;function Or(t){return((t=Math.exp(t))+1/t)/2}function Qs(t){return((t=Math.exp(t))-1/t)/2}function Js(t){return((t=Math.exp(2*t))-1)/(t+1)}var jr=function t(e,n,r){function o(i,s){var u=i0,c=i1,l=i2,a=s0,d=s1,h=s2,f=a-u,v=d-c,y=f*f+v*v,_,p;if(y<Ws)p=Math.log(h/l)/e,_=function(M){returnu+M*f,c+M*v,l*Math.exp(e*M*p)};else{var w=Math.sqrt(y),k=(h*h-l*l+r*y)/(2*l*n*w),m=(h*h-l*l-r*y)/(2*h*n*w),b=Math.log(Math.sqrt(k*k+1)-k),L=Math.log(Math.sqrt(m*m+1)-m);p=(L-b)/e,_=function(M){var T=M*p,P=Or(b),D=l/(n*w)*(P*Js(e*T+b)-Qs(b));returnu+D*f,c+D*v,l*P/Or(e*T+b)}}return _.duration=p*1e3*e/Math.SQRT2,_}return o.rho=function(i){var s=Math.max(.001,+i),u=s*s,c=u*u;return t(s,u,c)},o}(Math.SQRT2,2,4);function Gr(t){return function(e,n){var r=t((e=ge(e)).h,(n=ge(n)).h),o=K(e.s,n.s),i=K(e.l,n.l),s=K(e.opacity,n.opacity);return function(u){return e.h=r(u),e.s=o(u),e.l=i(u),e.opacity=s(u),e+""}}}var Ic=Gr(un),Cc=Gr(K);function Kr(t){return function(e,n){var r=t((e=_e(e)).h,(n=_e(n)).h),o=K(e.c,n.c),i=K(e.l,n.l),s=K(e.opacity,n.opacity);return function(u){return e.h=r(u),e.c=o(u),e.l=i(u),e.opacity=s(u),e+""}}}var Sc=Kr(un),Rc=Kr(K);function Vr(t){return function e(n){n=+n;function r(o,i){var s=t((o=ve(o)).h,(i=ve(i)).h),u=K(o.s,i.s),c=K(o.l,i.l),l=K(o.opacity,i.opacity);return function(a){return o.h=s(a),o.s=u(a),o.l=c(Math.pow(a,n)),o.opacity=l(a),o+""}}return r.gamma=e,r}(1)}var Pc=Vr(un),Ac=Vr(K);var Rt=0,Kt=0,Gt=0,Yr=1e3,xe,Vt,be=0,Nt=0,ke=0,Xt=typeof performance=="object"&&performance.now?performance:Date,Wr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ne(){return Nt||(Wr(Zs),Nt=Xt.now()+ke)}function Zs(){Nt=0}function Ee(){this._call=this._time=this._next=null}Ee.prototype=Yt.prototype={constructor:Ee,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ne():+n)+(e==null?0:+e),!this._next&&Vt!==this&&(Vt?Vt._next=this:xe=this,Vt=this),this._call=t,this._time=n,ln()},stop:function(){this._call&&(this._call=null,this._time=1/0,ln())}};function Yt(t,e,n){var r=new Ee;return r.restart(t,e,n),r}function ta(){Ne(),++Rt;for(var t=xe,e;t;)(e=Nt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Xr(){Nt=(be=Xt.now())+ke,Rt=Kt=0;try{ta()}finally{Rt=0,na(),Nt=0}}function ea(){var t=Xt.now(),e=t-be;e>Yr&&(ke-=e,be=t)}function na(){for(var t,e=xe,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:xe=n);Vt=t,ln(r)}function ln(t){if(!Rt){Kt&&(Kt=clearTimeout(Kt));var e=t-Nt;e>24?(t<1/0&&(Kt=setTimeout(Xr,t-Xt.now()-ke)),Gt&&(Gt=clearInterval(Gt))):(Gt||(be=Xt.now(),Gt=setInterval(ea,Yr)),Rt=1,Wr(Xr))}}function fn(t,e,n){var r=new Ee;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}function Jr(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var hn=3,Hc=function t(e){e=+e;function n(r){return Math.pow(r,e)}return n.exponent=t,n}(hn),Bc=function t(e){e=+e;function n(r){return 1-Math.pow(1-r,e)}return n.exponent=t,n}(hn),Fc=function t(e){e=+e;function n(r){return((r*=2)<=1?Math.pow(r,e):2-Math.pow(2-r,e))/2}return n.exponent=t,n}(hn),ra=Math.PI,zc=ra/2;function Le(t){return(Math.pow(2,-10*t)-.0009765625)*1.0009775171065494}var Qr=4/11,$c=6/11,qc=8/11,Uc=3/4,jc=9/11,Gc=10/11,Kc=15/16,Vc=21/22,Xc=63/64,Yc=1/Qr/Qr;var pn=1.70158,Wc=function t(e){e=+e;function n(r){return(r=+r)*r*(e*(r-1)+r)}return n.overshoot=t,n}(pn),Qc=function t(e){e=+e;function n(r){return--r*r*((r+1)*e+r)+1}return n.overshoot=t,n}(pn),Jc=function t(e){e=+e;function n(r){return((r*=2)<1?r*r*((e+1)*r-e):(r-=2)*r*((e+1)*r+e)+2)/2}return n.overshoot=t,n}(pn),Pt=2*Math.PI,dn=1,mn=.3,Zc=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Pt);function o(i){return e*Le(- --i)*Math.sin((r-i)/n)}return o.amplitude=function(i){return t(i,n*Pt)},o.period=function(i){return t(e,i)},o}(dn,mn),tl=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Pt);function o(i){return 1-e*Le(i=+i)*Math.sin((i+r)/n)}return o.amplitude=function(i){return t(i,n*Pt)},o.period=function(i){return t(e,i)},o}(dn,mn),el=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Pt);function o(i){return((i=i*2-1)<0?e*Le(-i)*Math.sin((r-i)/n):2-e*Le(i)*Math.sin((r+i)/n))/2}return o.amplitude=function(i){return t(i,n*Pt)},o.period=function(i){return t(e,i)},o}(dn,mn);var oa=ut("start","end","cancel","interrupt"),ia=[],eo=0,Zr=1,gn=2,Me=3,to=4,_n=5,Te=6;function Ie(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;sa(t,n,{name:e,index:r,group:o,on:oa,tween:ia,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:eo})}function yn(t,e){var n=Z(t,e);if(n.state>eo)throw new Error("too late; already scheduled");return n}function ot(t,e){var n=Z(t,e);if(n.state>Me)throw new Error("too late; already running");return n}function Z(t,e){var n=t.__transition;if(!n||!(n=ne))throw new Error("transition not found");return n}function sa(t,e,n){var r=t.__transition,o;re=n,n.timer=Yt(i,0,n.time);function i(l){n.state=Zr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var a,d,h,f;if(n.state!==Zr)return c();for(a in r)if(f=ra,f.name===n.name){if(f.state===Me)return fn(s);f.state===to?(f.state=Te,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete ra):+a<e&&(f.state=Te,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete ra)}if(fn(function(){n.state===Me&&(n.state=to,n.timer.restart(u,n.delay,n.time),u(l))}),n.state=gn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===gn){for(n.state=Me,o=new Array(h=n.tween.length),a=0,d=-1;a<h;++a)(f=n.tweena.value.call(t,t.__data__,n.index,n.group))&&(o++d=f);o.length=d+1}}function u(l){for(var a=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=_n,1),d=-1,h=o.length;++d<h;)od.call(t,a);n.state===_n&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Te,n.timer.stop(),delete re;for(var l in r)return;delete t.__transition}}function Wt(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=ns).name!==e){i=!1;continue}o=r.state>gn&&r.state<_n,r.state=Te,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete ns}i&&delete t.__transition}}function aa(t){return this.each(function(){Wt(this,t)})}function ua(t,e){var n,r;return function(){var o=ot(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,u=r.length;s<u;++s)if(rs.name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function ca(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=ot(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var u={name:e,value:n},c=0,l=o.length;c<l;++c)if(oc.name===e){oc=u;break}c===l&&o.push(u)}i.tween=o}}function la(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Z(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=ro).name===t)return s.value;return null}return this.each((e==null?ua:ca)(n,t,e))}function vn(t,e,n){var r=t._id;return t.each(function(){var o=ot(this,r);(o.value||(o.value={}))e=n.apply(this,arguments)}),function(o){return Z(o,r).valuee}}function no(t,e){var n;return(typeof e=="number"?lt:e instanceof kt?cn:(n=kt(e))?(e=n,cn):Fr)(t,e)}function fa(t){return function(){this.removeAttribute(t)}}function ha(t){return function(){this.removeAttributeNS(t.space,t.local)}}function pa(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function da(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function ma(t,e,n){var r,o,i;return function(){var s,u=n(this),c;return u==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=u+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,u)))}}function ga(t,e,n){var r,o,i;return function(){var s,u=n(this),c;return u==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=u+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,u)))}}function _a(t,e){var n=Ft(t),r=n==="transform"?Ur:no;return this.attrTween(t,typeof e=="function"?(n.local?ga:ma)(n,r,vn(this,"attr."+t,e)):e==null?(n.local?ha:fa)(n):(n.local?da:pa)(n,r,e))}function ya(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function va(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function wa(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&va(t,i)),n}return o._value=e,o}function xa(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&ya(t,i)),n}return o._value=e,o}function ba(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Ft(t);return this.tween(n,(r.local?wa:xa)(r,e))}function Ea(t,e){return function(){yn(this,t).delay=+e.apply(this,arguments)}}function ka(t,e){return e=+e,function(){yn(this,t).delay=e}}function Na(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ea:ka)(e,t)):Z(this.node(),e).delay}function La(t,e){return function(){ot(this,t).duration=+e.apply(this,arguments)}}function Ma(t,e){return e=+e,function(){ot(this,t).duration=e}}function Ta(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?La:Ma)(e,t)):Z(this.node(),e).duration}function Ia(t,e){if(typeof e!="function")throw new Error;return function(){ot(this,t).ease=e}}function Ca(t){var e=this._id;return arguments.length?this.each(Ia(e,t)):Z(this.node(),e).ease}function Sa(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;ot(this,t).ease=n}}function Ra(t){if(typeof t!="function")throw new Error;return this.each(Sa(this._id,t))}function Pa(t){typeof t!="function"&&(t=qe(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=eo,s=i.length,u=ro=[],c,l=0;l<s;++l)(c=il)&&t.call(c,c.__data__,l,i)&&u.push(c);return new ht(r,this._parents,this._name,this._id)}function Aa(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),u=0;u<i;++u)for(var c=eu,l=nu,a=c.length,d=su=new Array(a),h,f=0;f<a;++f)(h=cf||lf)&&(df=h);for(;u<r;++u)su=eu;return new ht(s,this._parents,this._name,this._id)}function Oa(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Da(t,e,n){var r,o,i=Oa(e)?yn:ot;return function(){var s=i(this,t),u=s.on;u!==r&&(o=(r=u).copy()).on(e,n),s.on=o}}function Ha(t,e){var n=this._id;return arguments.length<2?Z(this.node(),n).on.on(t):this.each(Da(n,t,e))}function Ba(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Fa(){return this.on("end.remove",Ba(this._id))}function za(t){var e=this._name,n=this._id;typeof t!="function"&&(t=fe(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var u=rs,c=u.length,l=is=new Array(c),a,d,h=0;h<c;++h)(a=uh)&&(d=t.call(a,a.__data__,h,u))&&("__data__"in a&&(d.__data__=a.__data__),lh=d,Ie(lh,e,n,h,l,Z(a,n)));return new ht(i,this._parents,e,n)}function $a(t){var e=this._name,n=this._id;typeof t!="function"&&(t=$e(t));for(var r=this._groups,o=r.length,i=[],s=[],u=0;u<o;++u)for(var c=ru,l=c.length,a,d=0;d<l;++d)if(a=cd){for(var h=t.call(a,a.__data__,d,c),f,v=Z(a,n),y=0,_=h.length;y<_;++y)(f=hy)&&Ie(f,e,n,y,h,v);i.push(h),s.push(a)}return new ht(i,s,e,n)}var qa=xt.prototype.constructor;function Ua(){return new qa(this._groups,this._parents)}function ja(t,e){var n,r,o;return function(){var i=wt(this,t),s=(this.style.removeProperty(t),wt(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function ro(t){return function(){this.style.removeProperty(t)}}function Ga(t,e,n){var r,o=n+"",i;return function(){var s=wt(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function Ka(t,e,n){var r,o,i;return function(){var s=wt(this,t),u=n(this),c=u+"";return u==null&&(c=u=(this.style.removeProperty(t),wt(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,u))}}function Va(t,e){var n,r,o,i="style."+e,s="end."+i,u;return function(){var c=ot(this,t),l=c.on,a=c.valuei==null?u||(u=ro(e)):void 0;(l!==n||o!==a)&&(r=(n=l).copy()).on(s,o=a),c.on=r}}function Xa(t,e,n){var r=(t+="")=="transform"?qr:no;return e==null?this.styleTween(t,ja(t,r)).on("end.style."+t,ro(t)):typeof e=="function"?this.styleTween(t,Ka(t,r,vn(this,"style."+t,e))).each(Va(this._id,t)):this.styleTween(t,Ga(t,r,e),n).on("end.style."+t,null)}function Ya(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Wa(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&Ya(t,s,n)),r}return i._value=e,i}function Qa(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Wa(t,e,n??""))}function Ja(t){return function(){this.textContent=t}}function Za(t){return function(){var e=t(this);this.textContent=e??""}}function tu(t){return this.tween("text",typeof t=="function"?Za(vn(this,"text",t)):Ja(t==null?"":t+""))}function eu(t){return function(e){this.textContent=t.call(this,e)}}function nu(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&eu(o)),e}return r._value=t,r}function ru(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,nu(t))}function ou(){for(var t=this._name,e=this._id,n=oo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=ri,u=s.length,c,l=0;l<u;++l)if(c=sl){var a=Z(c,e);Ie(c,t,n,l,s,{time:a.time+a.delay+a.duration,delay:0,duration:a.duration,ease:a.ease})}return new ht(r,this._parents,t,n)}function iu(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var u={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=ot(this,r),a=l.on;a!==t&&(e=(t=a).copy(),e._.cancel.push(u),e._.interrupt.push(u),e._.end.push(c)),l.on=e}),o===0&&i()})}var su=0;function ht(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function au(t){return xt().transition(t)}function oo(){return++su}var ft=xt.prototype;ht.prototype=au.prototype={constructor:ht,select:za,selectAll:$a,selectChild:ft.selectChild,selectChildren:ft.selectChildren,filter:Pa,merge:Aa,selection:Ua,transition:ou,call:ft.call,nodes:ft.nodes,node:ft.node,size:ft.size,empty:ft.empty,each:ft.each,on:Ha,attr:_a,attrTween:ba,style:Xa,styleTween:Qa,text:tu,textTween:ru,remove:Fa,tween:la,delay:Na,duration:Ta,ease:Ca,easeVarying:Ra,end:iu,Symbol.iterator:ftSymbol.iterator};var uu={time:null,delay:0,duration:250,ease:Jr};function cu(t,e){for(var n;!(n=t.__transition)||!(n=ne);)if(!(t=t.parentNode))throw new Error(transition ${e} not found);return n}function lu(t){var e,n;t instanceof ht?(e=t._id,t=t._name):(e=oo(),(n=uu).time=Ne(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=ri,u=s.length,c,l=0;l<u;++l)(c=sl)&&Ie(c,t,e,l,s,n||cu(c,e));return new ht(r,this._parents,t,e)}xt.prototype.interrupt=aa;xt.prototype.transition=lu;var Ce=t=>()=>t;function fu(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function pt(t,e,n){this.k=t,this.x=e,this.y=n}pt.prototype={constructor:pt,scale:function(t){return t===1?this:new pt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new pt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t0*this.k+this.x,t1*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t0-this.x)/this.k,(t1-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var xn=new pt(1,0,0);hu.prototype=pt.prototype;function hu(t){for(;!t.__zoom;)if(!(t=t.parentNode))return xn;return t.__zoom}function wn(t){t.stopImmediatePropagation()}function Qt(t){t.preventDefault(),t.stopImmediatePropagation()}function pu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function du(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,t.x,t.y],[t.x+t.width,t.y+t.height):0,0],[t.width.baseVal.value,t.height.baseVal.value):0,0],[t.clientWidth,t.clientHeight}function io(){return this.__zoom||xn}function mu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function gu(){return navigator.maxTouchPoints||"ontouchstart"in this}function _u(t,e,n){var r=t.invertX(e00)-n00,o=t.invertX(e10)-n10,i=t.invertY(e01)-n01,s=t.invertY(e11)-n11;return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function so(){var t=pu,e=du,n=_u,r=mu,o=gu,i=0,1/0,s=-1/0,-1/0],[1/0,1/0,u=250,c=jr,l=ut("start","zoom","end"),a,d,h,f=500,v=150,y=0,_=10;function p(g){g.property("__zoom",io).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",D).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",yt).on("touchend.zoom touchcancel.zoom",vt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(g,E,x,N){var I=g.selection?g.selection():g;I.property("__zoom",io),g!==I?b(g,E,x,N):I.interrupt().each(function(){L(this,arguments).event(N).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},p.scaleBy=function(g,E,x,N){p.scaleTo(g,function(){var I=this.__zoom.k,S=typeof E=="function"?E.apply(this,arguments):E;return I*S},x,N)},p.scaleTo=function(g,E,x,N){p.transform(g,function(){var I=e.apply(this,arguments),S=this.__zoom,R=x==null?m(I):typeof x=="function"?x.apply(this,arguments):x,A=S.invert(R),H=typeof E=="function"?E.apply(this,arguments):E;return n(k(w(S,H),R,A),I,s)},x,N)},p.translateBy=function(g,E,x,N){p.transform(g,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof x=="function"?x.apply(this,arguments):x),e.apply(this,arguments),s)},null,N)},p.translateTo=function(g,E,x,N,I){p.transform(g,function(){var S=e.apply(this,arguments),R=this.__zoom,A=N==null?m(S):typeof N=="function"?N.apply(this,arguments):N;return n(xn.translate(A0,A1).scale(R.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof x=="function"?-x.apply(this,arguments):-x),S,s)},N,I)};function w(g,E){return E=Math.max(i0,Math.min(i1,E)),E===g.k?g:new pt(E,g.x,g.y)}function k(g,E,x){var N=E0-x0*g.k,I=E1-x1*g.k;return N===g.x&&I===g.y?g:new pt(g.k,N,I)}function m(g){return[(+g00+ +g10)/2,(+g01+ +g11)/2]}function b(g,E,x,N){g.on("start.zoom",function(){L(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(N).end()}).tween("zoom",function(){var I=this,S=arguments,R=L(I,S).event(N),A=e.apply(I,S),H=x==null?m(A):typeof x=="function"?x.apply(I,S):x,tt=Math.max(A10-A00,A11-A01),$=I.__zoom,W=typeof E=="function"?E.apply(I,S):E,it=c($.invert(H).concat(tt/$.k),W.invert(H).concat(tt/W.k));return function(Q){if(Q===1)Q=W;else{var st=it(Q),Pe=tt/st2;Q=new pt(Pe,H0-st0*Pe,H1-st1*Pe)}R.zoom(null,Q)}})}function L(g,E,x){return!x&&g.__zooming||new M(g,E)}function M(g,E){this.that=g,this.args=E,this.active=0,this.sourceEvent=null,this.extent=e.apply(g,E),this.taps=0}M.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,E){return this.mouse&&g!=="mouse"&&(this.mouse1=E.invert(this.mouse0)),this.touch0&&g!=="touch"&&(this.touch01=E.invert(this.touch00)),this.touch1&&g!=="touch"&&(this.touch11=E.invert(this.touch10)),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var E=Y(this.that).datum();l.call(g,this.that,new fu(g,{sourceEvent:this.sourceEvent,target:p,type:g,transform:this.that.__zoom,dispatch:l}),E)}};function T(g,...E){if(!t.apply(this,arguments))return;var x=L(this,E).event(g),N=this.__zoom,I=Math.max(i0,Math.min(i1,N.k*Math.pow(2,r.apply(this,arguments)))),S=J(g);if(x.wheel)(x.mouse00!==S0||x.mouse01!==S1)&&(x.mouse1=N.invert(x.mouse0=S)),clearTimeout(x.wheel);else{if(N.k===I)return;x.mouse=S,N.invert(S),Wt(this),x.start()}Qt(g),x.wheel=setTimeout(R,v),x.zoom("mouse",n(k(w(N,I),x.mouse0,x.mouse1),x.extent,s));function R(){x.wheel=null,x.end()}}function P(g,...E){if(h||!t.apply(this,arguments))return;var x=g.currentTarget,N=L(this,E,!0).event(g),I=Y(g.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",tt,!0),S=J(g,x),R=g.clientX,A=g.clientY;Ke(g.view),wn(g),N.mouse=S,this.__zoom.invert(S),Wt(this),N.start();function H($){if(Qt($),!N.moved){var W=$.clientX-R,it=$.clientY-A;N.moved=W*W+it*it>y}N.event($).zoom("mouse",n(k(N.that.__zoom,N.mouse0=J($,x),N.mouse1),N.extent,s))}function tt($){I.on("mousemove.zoom mouseup.zoom",null),Ve($.view,N.moved),Qt($),N.event($).end()}}function D(g,...E){if(t.apply(this,arguments)){var x=this.__zoom,N=J(g.changedTouches?g.changedTouches0:g,this),I=x.invert(N),S=x.k*(g.shiftKey?.5:2),R=n(k(w(x,S),N,I),e.apply(this,E),s);Qt(g),u>0?Y(this).transition().duration(u).call(b,R,N,g):Y(this).call(p.transform,R,N,g)}}function z(g,...E){if(t.apply(this,arguments)){var x=g.touches,N=x.length,I=L(this,E,g.changedTouches.length===N).event(g),S,R,A,H;for(wn(g),R=0;R<N;++R)A=xR,H=J(A,this),H=H,this.__zoom.invert(H),A.identifier,I.touch0?!I.touch1&&I.touch02!==H2&&(I.touch1=H,I.taps=0):(I.touch0=H,S=!0,I.taps=1+!!a);a&&(a=clearTimeout(a)),S&&(I.taps<2&&(d=H0,a=setTimeout(function(){a=null},f)),Wt(this),I.start())}}function yt(g,...E){if(this.__zooming){var x=L(this,E).event(g),N=g.changedTouches,I=N.length,S,R,A,H;for(Qt(g),S=0;S<I;++S)R=NS,A=J(R,this),x.touch0&&x.touch02===R.identifier?x.touch00=A:x.touch1&&x.touch12===R.identifier&&(x.touch10=A);if(R=x.that.__zoom,x.touch1){var tt=x.touch00,$=x.touch01,W=x.touch10,it=x.touch11,Q=(Q=W0-tt0)*Q+(Q=W1-tt1)*Q,st=(st=it0-$0)*st+(st=it1-$1)*st;R=w(R,Math.sqrt(Q/st)),A=[(tt0+W0)/2,(tt1+W1)/2],H=[($0+it0)/2,($1+it1)/2]}else if(x.touch0)A=x.touch00,H=x.touch01;else return;x.zoom("touch",n(k(R,A,H),x.extent,s))}}function vt(g,...E){if(this.__zooming){var x=L(this,E).event(g),N=g.changedTouches,I=N.length,S,R;for(wn(g),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),S=0;S<I;++S)R=NS,x.touch0&&x.touch02===R.identifier?delete x.touch0:x.touch1&&x.touch12===R.identifier&&delete x.touch1;if(x.touch1&&!x.touch0&&(x.touch0=x.touch1,delete x.touch1),x.touch0)x.touch01=this.__zoom.invert(x.touch00);else if(x.end(),x.taps===2&&(R=J(R,this),Math.hypot(d0-R0,d1-R1)<_)){var A=Y(this).on("dblclick.zoom");A&&A.apply(this,arguments)}}}return p.wheelDelta=function(g){return arguments.length?(r=typeof g=="function"?g:Ce(+g),p):r},p.filter=function(g){return arguments.length?(t=typeof g=="function"?g:Ce(!!g),p):t},p.touchable=function(g){return arguments.length?(o=typeof g=="function"?g:Ce(!!g),p):o},p.extent=function(g){return arguments.length?(e=typeof g=="function"?g:Ce(+g00,+g0[1,[+g10,+g11]]),p):e},p.scaleExtent=function(g){return arguments.length?(i0=+g0,i1=+g1,p):[i0,i1]},p.translateExtent=function(g){return arguments.length?(s00=+g00,s10=+g10,s01=+g01,s11=+g11,p):s00,s0[1,[s10,s11]]},p.constrain=function(g){return arguments.length?(n=g,p):n},p.duration=function(g){return arguments.length?(u=+g,p):u},p.interpolate=function(g){return arguments.length?(c=g,p):c},p.on=function(){var g=l.on.apply(l,arguments);return g===l?p:g},p.clickDistance=function(g){return arguments.length?(y=(g=+g)*g,p):Math.sqrt(y)},p.tapDistance=function(g){return arguments.length?(_=+g,p):_},p}function yu(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return uo(this.cover(e,n),e,n,t)}function uo(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var o,i=t._root,s={data:r},u=t._x0,c=t._y0,l=t._x1,a=t._y1,d,h,f,v,y,_,p,w;if(!i)return t._root=s,t;for(;i.length;)if((y=e>=(d=(u+l)/2))?u=d:l=d,(_=n>=(h=(c+a)/2))?c=h:a=h,o=i,!(i=ip=_<<1|y))return op=s,t;if(f=+t._x.call(null,i.data),v=+t._y.call(null,i.data),e===f&&n===v)return s.next=i,o?op=s:t._root=s,t;do o=o?op=new Array(4):t._root=new Array(4),(y=e>=(d=(u+l)/2))?u=d:l=d,(_=n>=(h=(c+a)/2))?c=h:a=h;while((p=_<<1|y)===(w=(v>=h)<<1|f>=d));return ow=i,op=s,t}function vu(t){var e,n,r=t.length,o,i,s=new Array(r),u=new Array(r),c=1/0,l=1/0,a=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(o=+this._x.call(null,e=tn))||isNaN(i=+this._y.call(null,e))||(sn=o,un=i,o<c&&(c=o),o>a&&(a=o),i<l&&(l=i),i>d&&(d=i));if(c>a||l>d)return this;for(this.cover(c,l).cover(a,d),n=0;n<r;++n)uo(this,sn,un,tn);return this}function wu(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,o=this._x1,i=this._y1;if(isNaN(n))o=(n=Math.floor(t))+1,i=(r=Math.floor(e))+1;else{for(var s=o-n||1,u=this._root,c,l;n>t||t>=o||r>e||e>=i;)switch(l=(e<r)<<1|t<n,c=new Array(4),cl=u,u=c,s*=2,l){case 0:o=n+s,i=r+s;break;case 1:n=o-s,i=r+s;break;case 2:o=n+s,r=i-s;break;case 3:n=o-s,r=i-s;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this}function xu(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function bu(t){return arguments.length?this.cover(+t00,+t01).cover(+t10,+t11):isNaN(this._x0)?void 0:this._x0,this._y0],[this._x1,this._y1}function U(t,e,n,r,o){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=o}function Eu(t,e,n){var r,o=this._x0,i=this._y0,s,u,c,l,a=this._x1,d=this._y1,h=[],f=this._root,v,y;for(f&&h.push(new U(f,o,i,a,d)),n==null?n=1/0:(o=t-n,i=e-n,a=t+n,d=e+n,n*=n);v=h.pop();)if(!(!(f=v.node)||(s=v.x0)>a||(u=v.y0)>d||(c=v.x1)<o||(l=v.y1)<i))if(f.length){var _=(s+c)/2,p=(u+l)/2;h.push(new U(f3,_,p,c,l),new U(f2,s,p,_,l),new U(f1,_,u,c,p),new U(f0,s,u,_,p)),(y=(e>=p)<<1|t>=_)&&(v=hh.length-1,hh.length-1=hh.length-1-y,hh.length-1-y=v)}else{var w=t-+this._x.call(null,f.data),k=e-+this._y.call(null,f.data),m=w*w+k*k;if(m<n){var b=Math.sqrt(n=m);o=t-b,i=e-b,a=t+b,d=e+b,r=f.data}}return r}function ku(t){if(isNaN(a=+this._x.call(null,t))||isNaN(d=+this._y.call(null,t)))return this;var e,n=this._root,r,o,i,s=this._x0,u=this._y0,c=this._x1,l=this._y1,a,d,h,f,v,y,_,p;if(!n)return this;if(n.length)for(;;){if((v=a>=(h=(s+c)/2))?s=h:c=h,(y=d>=(f=(u+l)/2))?u=f:l=f,e=n,!(n=n_=y<<1|v))return this;if(!n.length)break;(e_+1&3||e_+2&3||e_+3&3)&&(r=e,p=_)}for(;n.data!==t;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):e?(i?e_=i:delete e_,(n=e0||e1||e2||e3)&&n===(e3||e2||e1||e0)&&!n.length&&(r?rp=n:this._root=n),this):(this._root=i,this)}function Nu(t){for(var e=0,n=t.length;e<n;++e)this.remove(te);return this}function Lu(){return this._root}function Mu(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function Tu(t){var e=[],n,r=this._root,o,i,s,u,c;for(r&&e.push(new U(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,i=n.x0,s=n.y0,u=n.x1,c=n.y1)&&r.length){var l=(i+u)/2,a=(s+c)/2;(o=r3)&&e.push(new U(o,l,a,u,c)),(o=r2)&&e.push(new U(o,i,a,l,c)),(o=r1)&&e.push(new U(o,l,s,u,a)),(o=r0)&&e.push(new U(o,i,s,l,a))}return this}function Iu(t){var e=[],n=[],r;for(this._root&&e.push(new U(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var o=r.node;if(o.length){var i,s=r.x0,u=r.y0,c=r.x1,l=r.y1,a=(s+c)/2,d=(u+l)/2;(i=o0)&&e.push(new U(i,s,u,a,d)),(i=o1)&&e.push(new U(i,a,u,c,d)),(i=o2)&&e.push(new U(i,s,d,a,l)),(i=o3)&&e.push(new U(i,a,d,c,l))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Cu(t){return t0}function Su(t){return arguments.length?(this._x=t,this):this._x}function Ru(t){return t1}function Pu(t){return arguments.length?(this._y=t,this):this._y}function bn(t,e,n){var r=new En(e??Cu,n??Ru,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function En(t,e,n,r,o,i){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=o,this._y1=i,this._root=void 0}function ao(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var j=bn.prototype=En.prototype;j.copy=function(){var t=new En(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=ao(e),t;for(n={source:e,target:t._root=new Array(4)};e=n.pop();)for(var o=0;o<4;++o)(r=e.sourceo)&&(r.length?n.push({source:r,target:e.targeto=new Array(4)}):e.targeto=ao(r));return t};j.add=yu;j.addAll=vu;j.cover=wu;j.data=xu;j.extent=bu;j.find=Eu;j.remove=ku;j.removeAll=Nu;j.root=Lu;j.size=Mu;j.visit=Tu;j.visitAfter=Iu;j.x=Su;j.y=Pu;function fo(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function o(){var i,s=n.length,u,c=0,l=0;for(i=0;i<s;++i)u=ni,c+=u.x,l+=u.y;for(c=(c/s-t)*r,l=(l/s-e)*r,i=0;i<s;++i)u=ni,u.x-=c,u.y-=l}return o.initialize=function(i){n=i},o.x=function(i){return arguments.length?(t=+i,o):t},o.y=function(i){return arguments.length?(e=+i,o):e},o.strength=function(i){return arguments.length?(r=+i,o):r},o}function Jt(t){return function(){return t}}function At(t){return(t()-.5)*1e-6}function Au(t){return t.index}function co(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function ho(t){var e=Au,n=d,r,o=Jt(30),i,s,u,c,l,a=1;t==null&&(t=[]);function d(_){return 1/Math.min(u_.source.index,u_.target.index)}function h(_){for(var p=0,w=t.length;p<a;++p)for(var k=0,m,b,L,M,T,P,D;k<w;++k)m=tk,b=m.source,L=m.target,M=L.x+L.vx-b.x-b.vx||At(l),T=L.y+L.vy-b.y-b.vy||At(l),P=Math.sqrt(M*M+T*T),P=(P-ik)/P*_*rk,M*=P,T*=P,L.vx-=M*(D=ck),L.vy-=T*D,b.vx+=M*(D=1-D),b.vy+=T*D}function f(){if(s){var _,p=s.length,w=t.length,k=new Map(s.map((b,L)=>e(b,L,s),b)),m;for(_=0,u=new Array(p);_<w;++_)m=t_,m.index=_,typeof m.source!="object"&&(m.source=co(k,m.source)),typeof m.target!="object"&&(m.target=co(k,m.target)),um.source.index=(um.source.index||0)+1,um.target.index=(um.target.index||0)+1;for(_=0,c=new Array(w);_<w;++_)m=t_,c_=um.source.index/(um.source.index+um.target.index);r=new Array(w),v(),i=new Array(w),y()}}function v(){if(s)for(var _=0,p=t.length;_<p;++_)r_=+n(t_,_,t)}function y(){if(s)for(var _=0,p=t.length;_<p;++_)i_=+o(t_,_,t)}return h.initialize=function(_,p){s=_,l=p,f()},h.links=function(_){return arguments.length?(t=_,f(),h):t},h.id=function(_){return arguments.length?(e=_,h):e},h.iterations=function(_){return arguments.length?(a=+_,h):a},h.strength=function(_){return arguments.length?(n=typeof _=="function"?_:Jt(+_),v(),h):n},h.distance=function(_){return arguments.length?(o=typeof _=="function"?_:Jt(+_),y(),h):o},h}var Ou=1664525,Du=1013904223,lo=4294967296;function Hu(){let t=1;return()=>(t=(Ou*t+Du)%lo)/lo}function Bu(t){return t.x}function Fu(t){return t.y}var zu=10,$u=Math.PI*(3-Math.sqrt(5));function po(t){var e,n=1,r=.001,o=1-Math.pow(r,1/300),i=0,s=.6,u=new Map,c=Yt(d),l=ut("tick","end"),a=Hu();t==null&&(t=[]);function d(){h(),l.call("tick",e),n<r&&(c.stop(),l.call("end",e))}function h(y){var _,p=t.length,w;y===void 0&&(y=1);for(var k=0;k<y;++k)for(n+=(i-n)*o,u.forEach(function(m){m(n)}),_=0;_<p;++_)w=t_,w.fx==null?w.x+=w.vx*=s:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=s:(w.y=w.fy,w.vy=0);return e}function f(){for(var y=0,_=t.length,p;y<_;++y){if(p=ty,p.index=y,p.fx!=null&&(p.x=p.fx),p.fy!=null&&(p.y=p.fy),isNaN(p.x)||isNaN(p.y)){var w=zu*Math.sqrt(.5+y),k=y*$u;p.x=w*Math.cos(k),p.y=w*Math.sin(k)}(isNaN(p.vx)||isNaN(p.vy))&&(p.vx=p.vy=0)}}function v(y){return y.initialize&&y.initialize(t,a),y}return f(),e={tick:h,restart:function(){return c.restart(d),e},stop:function(){return c.stop(),e},nodes:function(y){return arguments.length?(t=y,f(),u.forEach(v),e):t},alpha:function(y){return arguments.length?(n=+y,e):n},alphaMin:function(y){return arguments.length?(r=+y,e):r},alphaDecay:function(y){return arguments.length?(o=+y,e):+o},alphaTarget:function(y){return arguments.length?(i=+y,e):i},velocityDecay:function(y){return arguments.length?(s=1-y,e):1-s},randomSource:function(y){return arguments.length?(a=y,u.forEach(v),e):a},force:function(y,_){return arguments.length>1?(_==null?u.delete(y):u.set(y,v(_)),e):u.get(y)},find:function(y,_,p){var w=0,k=t.length,m,b,L,M,T;for(p==null?p=1/0:p*=p,w=0;w<k;++w)M=tw,m=y-M.x,b=_-M.y,L=m*m+b*b,L<p&&(T=M,p=L);return T},on:function(y,_){return arguments.length>1?(l.on(y,_),e):l.on(y)}}}function mo(){var t,e,n,r,o=Jt(-30),i,s=1,u=1/0,c=.81;function l(f){var v,y=t.length,_=bn(t,Bu,Fu).visitAfter(d);for(r=f,v=0;v<y;++v)e=tv,_.visit(h)}function a(){if(t){var f,v=t.length,y;for(i=new Array(v),f=0;f<v;++f)y=tf,iy.index=+o(y,f,t)}}function d(f){var v=0,y,_,p=0,w,k,m;if(f.length){for(w=k=m=0;m<4;++m)(y=fm)&&(_=Math.abs(y.value))&&(v+=y.value,p+=_,w+=_*y.x,k+=_*y.y);f.x=w/p,f.y=k/p}else{y=f,y.x=y.data.x,y.y=y.data.y;do v+=iy.data.index;while(y=y.next)}f.value=v}function h(f,v,y,_){if(!f.value)return!0;var p=f.x-e.x,w=f.y-e.y,k=_-v,m=p*p+w*w;if(k*k/c<m)return m<u&&(p===0&&(p=At(n),m+=p*p),w===0&&(w=At(n),m+=w*w),m<s&&(m=Math.sqrt(s*m)),e.vx+=p*f.value*r/m,e.vy+=w*f.value*r/m),!0;if(f.length||m>=u)return;(f.data!==e||f.next)&&(p===0&&(p=At(n),m+=p*p),w===0&&(w=At(n),m+=w*w),m<s&&(m=Math.sqrt(s*m)));do f.data!==e&&(k=if.data.index*r/m,e.vx+=p*k,e.vy+=w*k);while(f=f.next)}return l.initialize=function(f,v){t=f,n=v,a()},l.strength=function(f){return arguments.length?(o=typeof f=="function"?f:Jt(+f),a(),l):o},l.distanceMin=function(f){return arguments.length?(s=f*f,l):Math.sqrt(s)},l.distanceMax=function(f){return arguments.length?(u=f*f,l):Math.sqrt(u)},l.theta=function(f){return arguments.length?(c=f*f,l):Math.sqrt(c)},l}var qu=t=>typeof t=="object"&&t!==null,Uu=t=>qu(t)?(t.name===void 0||typeof t.name=="string")&&typeof t.message=="string":!1,go=t=>{try{let e=typeof t=="string"?JSON.parse(t):t;return Uu(e)?e:!1}catch(e){if(e instanceof SyntaxError)return!1;throw e}};var _t=t=>t.replaceAll(" ","_").toLowerCase();var Nn=t=>...t.map((e,n)=>e===" "?"_":!Wu.includes(e)||n===t.length-1&&Qu.includes(e)?encodeURIComponent(e):e).join(""),Wu='@$&+=:;",',Qu=':;",';var yo=async(t,e)=>{let n=await globalThis.caches.keys();for(let r of n.sort().reverse()){let i=await(await caches.open(r)).match(t,e);if(i)return i}};var F=t=>{let{fetch:e=globalThis.fetch,hostName:n="scrapbox.io",...r}=t;return{fetch:e,hostName:n,...r}};var Se=class t extends Error{constructor(n){super(${n.status} ${n.statusText} when fetching ${n.url});this.response=n;Error.captureStackTrace&&Error.captureStackTrace(this,t)}name="UnexpectedResponseError"},V=async t=>{let e=t.clone(),n=await e.text(),r=go(n);if(!r)throw new Se(e);return{ok:!1,value:r}};var G=t=>connect.sid=${t};var vo=(t,e,n)=>{let{sid:r,hostName:o,followRename:i,projects:s}=F(n??{}),u=new URLSearchParams;u.append("followRename",${i??!0});for(let l of s??[])u.append("projects",l);let c=https://${o}/api/pages/${t}/${Nn(e)}?${u.toString()};return new Request(c,r?{headers:{Cookie:G(r)}}:void 0)},wo=async t=>t.ok?{ok:!0,value:await t.json()}:t.status===414?{ok:!1,value:{name:"TooLongURIError",message:"project ids may be too much."}}:V(t),Zt=async(t,e,n)=>{let{fetch:r}=F(n??{}),o=vo(t,e,n),i=await r(o);return await wo(i)};Zt.toRequest=vo;Zt.fromResponse=wo;var xo=(t,e)=>{let{sid:n,hostName:r,sort:o,limit:i,skip:s}=F(e??{}),u=new URLSearchParams;o!==void 0&&u.append("sort",o),i!==void 0&&u.append("limit",${i}),s!==void 0&&u.append("skip",${s});let c=https://${r}/api/pages/${t}?${u.toString()};return new Request(c,n?{headers:{Cookie:G(n)}}:void 0)},bo=async t=>t.ok?{ok:!0,value:await t.json()}:V(t),Eo=async(t,e)=>{let{fetch:n}=F(e??{}),r=await n(xo(t,e));return await bo(r)};Eo.toRequest=xo;Eo.fromResponse=bo;var ko=(t,e)=>{let{sid:n,hostName:r}=F(e??{});return new Request(https://${r}/api/projects/${t},n?{headers:{Cookie:G(n)}}:void 0)},No=async t=>t.ok?{ok:!0,value:await t.json()}:V(t),Lo=async(t,e)=>{let{fetch:n}=F(e??{}),r=ko(t,e),o=await n(r);return No(o)};Lo.toRequest=ko;Lo.fromResponse=No;var Mo=(t,e)=>{let{sid:n,hostName:r}=F(e??{}),o=new URLSearchParams;for(let i of t)o.append("ids",i);return new Request(https://${r}/api/projects?${o.toString()},n?{headers:{Cookie:G(n)}}:void 0)},To=async t=>t.ok?{ok:!0,value:await t.json()}:V(t),Io=async(t,e)=>{let{fetch:n}=F(e??{}),r=await n(Mo(t,e));return To(r)};Io.toRequest=Mo;Io.fromResponse=To;var Zu=.7,tc=5,Re=1.2;var Co=t=>{let{incoming:e,outgoing:n}=t.linkData,r,o=Bt(""),i=Lt(()=>({nodes:[...new Set(...e.keys(),...n.keys())].map(a=>({titleLc:a})),links:...n.entries().flatMap((a,d)=>d.map(h=>({source:a,target:h})))}),e,n),s=Wn(null),u,c=Bt(""),l=mt(a=>{let d=n.get(a.titleLc)?.length??0,h=e.get(a.titleLc)?.size??0;return 2+Math.sqrt(d+h)},e,n);return ce(()=>{if(!s.current)return;let a=Y(s.current),d=structuredClone(i.nodes),h=structuredClone(i.links),f=po(d).force("link",ho(h).id(p=>p.titleLc).distance(50)).force("charge",mo().strength(-100*Zu)).force("center",fo());a.selectAll("g.node").data(d).call(fr().on("start",(p,w)=>{p.active||f.alphaTarget(1).restart(),w.fx=w.x,w.fy=w.y}).on("drag",(p,w)=>{w.fx=p.x,w.fy=p.y}).on("end",(p,w)=>{p.active||f.alphaTarget(0),w.fx=null,w.fy=null})),a.selectAll("g.link").data(h);let v=so().scaleExtent(.25,4).on("zoom",({transform:p})=>{c(p.toString())});a.call(v),f.on("tick",()=>{a.selectAll("path").attr("d",(p,w)=>{let k=hw.source,m=hw.target,b=k.x??0,L=k.y??0,M=m.x??0,T=m.y??0,P=M-b,D=T-L,z=(P**2+D**2)**.5,yt=l(k),vt=l(m);returnM${b+P/z*yt},${L+D/z*yt}L${M-P/z*vt},${T-D/z*vt}}),a.selectAll("circle").attr("cx",(p,w)=>dw.x??null).attr("cy",(p,w)=>dw.y??null),a.selectAll("text").attr("x",(p,w)=>dw.x??null).attr("y",(p,w)=>dw.y??null)});let y=(p,w)=>{a.attr("viewBox",${-p/2*1/Re} ${-w/2*1/Re} ${p*1/Re} ${w*1/Re}),v.extent()};{let p=s.current.getBoundingClientRect();y(p.width,p.height)}let _=new ResizeObserver(({contentRect:p})=>y(p.width,p.height));return _.observe(s.current),()=>{f.stop(),_.disconnect()}},s.current,i),O(at,null,O("style",null,`svg { width: 100%;
min-height: 250px;
box-shadow: 0 4px 0 rgba(0,0,0,.16);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
margin: .5em 0;
--graph-node-font-size: 0.7em;
--graph-label-color: var(--page-text-color, #4a4a4a); --graph-node-opacity-factor: 1.0;
}
.node {
opacity: calc(var(--graph-node-opacity-factor) * 1.0);
transition: opacity 0.2s linear;
}
.node.empty{
opacity: calc(var(--graph-node-opacity-factor) * 0.5);
}
circle {
fill: var(--graph-node);
cursor: pointer;
}
.current circle {
fill: var(--graph-node-current);
}
.link {
color: var(--graph-link);
}
text {
font-size: var(--graph-node-font-size);
fill: var(--graph-label-color);
}
text, .link {
transition: color,font-size;
transition-duration: 0.2s;
transition-timing-function: linear;
}),O("style",null,t.css),O("style",null,r),O("svg",{ref:s},O("defs",null,O("polygon",{id:"arrow",points:"0,0 10,5, 0,10 5,5"})),O("g",{transform:u},i.links.map((a,d)=>O(nc,{key:${a.source}-${a.target},source:a.source,target:a.target,index:d})),i.nodes.map(a=>O(rc,{node:a,changeCSS:o,...t.linkData})))))},ec=t=>{let e=CSS.escape(t.titleLc);return.node:not(data-title="${e}"):not(data-targets*="\\"${e}\\""):not(data-sources*="\\"${e}\\"") { --graph-node-opacity-factor: 0.6;
}
opacity: 1 !important;
font-size: calc(var(--graph-node-font-size) * 1.5) !important;
}
color: var(--graph-link-active);
}},nc=t=>O("g",{className:"link","data-source":t.source,"data-target":t.target},O("marker",{id:m${t.index},viewBox:"0 0 10 10",refX:8,refY:5,"marker-width":4,"marker-height":4,orient:"auto"},O("use",{xlinkHref:"#arrow",fill:"currentColor"})),O("path",{stroke:"currentColor","stroke-width":2,"marker-end":url(#m${t.index})})),rc=t=>{let{node:e,changeCSS:n,outgoing:r,incoming:o,toTitle:i}=t,s=Lt(()=>scrapbox.Layout==="page"?_t(scrapbox.Page.title)===e.titleLc:e.titleLc==="",[e.titleLc]),u=mt(h=>{let f=r.get(h.titleLc)?.length??0,v=o.get(h.titleLc)?.size??0;return 2+Math.sqrt(f+v)},[o,r]),c=mt(h=>{let f=o.get(h)?.size??0,v=r.get(h)?.length??0;return f<2&&v===0},[o,r]),l=Lt(()=>{let h=["node"];return s&&h.push("current"),c(e.titleLc)&&h.push("empty"),h.join(" ")},[s,e.titleLc]),a=mt(()=>n(ec(e)),[n,e]),d=mt(()=>n(""),[n]);return O("g",{className:l,"data-title":e.titleLc,"data-targets":JSON.stringify(r.get(e.titleLc)??[]),"data-sources":JSON.stringify([...o.get(e.titleLc)??[]])},O("a",{xlinkHref:/${scrapbox.Project.name}/${e.titleLc}`},O("circle",{r:u(e),onMouseOver:a,onMouseLeave:d})),O("text",{dx:0,dy:"8px","text-anchor":"middle","dominant-baseline":"text-before-edge",style:{opacity:tc,"pointer-events":"none"}},i.get(e.titleLc)??e.titleLc))};var So=t=>{let e={outgoing:new Map,incoming:new Map,toTitle:new Map(t.links.map(r=>_t(r),r))},n={title:t.title,titleLc:_t(t.title),linksLc:t.links.map(r=>_t(r))},...t.relatedPages.links1hop,...t.relatedPages.links2hop;for(let{title:r,titleLc:o,linksLc:i}of n){e.outgoing.set(o,i),e.toTitle.set(o,r);for(let s of i){let u=_t(s),c=e.incoming.get(u)??new Set;c.add(o),e.incoming.set(u,c)}}return e};var Ro=t=>{lete,n=Bt(),r=mt(async()=>{if(n(void 0),scrapbox.Layout!=="page")return;let o=Zt.toRequest(scrapbox.Project.name,scrapbox.Page.title),i=await yo(o,{ignoreSearch:!0})??await fetch(o),s=await Zt.fromResponse(i);if(!s.ok){n(void 0);return}let u=s.value;n(So(u))},[]);return ce(()=>(r(),scrapbox.addListener("layout:changed",r),scrapbox.addListener("page:changed",r),()=>{scrapbox.removeListener("layout:changed",r),scrapbox.removeListener("page:changed",r)}),r),e?O(Co,{css:t.css,linkData:e}):O(at,null)};var Nd=t=>{let e=document.createElement("div");e.dataset.userscriptName="scrapbox-local-graph";let n=e.attachShadow({mode:"open"}),r=document.querySelector(".related-page-list");return r.parentNode.insertBefore(e,r),Oe(O(Ro,{css:t?.style??""}),n),{open:()=>{e.hidden=!1},close:()=>{e.hidden=!0},isOpen:()=>!e.hidden}};export{Nd as setup};