@skydesign/tf 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +364 -362
- package/dist/{render-BqWiqrE9.mjs → render-Dzu8gXVX.mjs} +1287 -1249
- package/dist/render-wQ_Mruy4.js +106 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +2 -2
- package/dist/server.mjs +2 -1
- package/package.json +2 -1
- package/dist/render-cE_lsgcR.js +0 -94
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";function En(t){return JSON.stringify(JSON.stringify(t)).slice(1,-1)}function pt(t){try{return JSON.parse(t)}catch{const e=JSON.parse(`"${t}"`);return JSON.parse(e)}}var Nn={value:()=>{}};function ie(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new kt(n)}function kt(t){this._=t}function $n(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}kt.prototype=ie.prototype={constructor:kt,on:function(t,e){var n=this._,r=$n(t+"",n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(t=r[a]).type)&&(i=Sn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(t=r[a]).type)n[i]=de(n[i],t.name,e);else if(e==null)for(i in n)n[i]=de(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new kt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],r=0,i=a.length;r<i;++r)a[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};function Sn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function de(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Nn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Xt="http://www.w3.org/1999/xhtml";const ge={svg:"http://www.w3.org/2000/svg",xhtml:Xt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ot(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ge.hasOwnProperty(e)?{space:ge[e],local:t}:t}function An(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Xt&&e.documentElement.namespaceURI===Xt?e.createElement(t):e.createElementNS(n,t)}}function kn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ye(t){var e=Ot(t);return(e.local?kn:An)(e)}function Tn(){}function oe(t){return t==null?Tn:function(){return this.querySelector(t)}}function In(t){typeof t!="function"&&(t=oe(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,c=r[i]=new Array(o),s,l,u=0;u<o;++u)(s=a[u])&&(l=t.call(s,s.__data__,u,a))&&("__data__"in s&&(l.__data__=s.__data__),c[u]=l);return new F(r,this._parents)}function Cn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Mn(){return[]}function ze(t){return t==null?Mn:function(){return this.querySelectorAll(t)}}function Dn(t){return function(){return Cn(t.apply(this,arguments))}}function Pn(t){typeof t=="function"?t=Dn(t):t=ze(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o=e[a],c=o.length,s,l=0;l<c;++l)(s=o[l])&&(r.push(t.call(s,s.__data__,l,o)),i.push(s));return new F(r,i)}function Re(t){return function(){return this.matches(t)}}function Le(t){return function(e){return e.matches(t)}}var Yn=Array.prototype.find;function zn(t){return function(){return Yn.call(this.children,t)}}function Rn(){return this.firstElementChild}function Ln(t){return this.select(t==null?Rn:zn(typeof t=="function"?t:Le(t)))}var On=Array.prototype.filter;function Hn(){return Array.from(this.children)}function Bn(t){return function(){return On.call(this.children,t)}}function Fn(t){return this.selectAll(t==null?Hn:Bn(typeof t=="function"?t:Le(t)))}function Wn(t){typeof t!="function"&&(t=Re(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,c=r[i]=[],s,l=0;l<o;++l)(s=a[l])&&t.call(s,s.__data__,l,a)&&c.push(s);return new F(r,this._parents)}function Oe(t){return new Array(t.length)}function Gn(){return new F(this._enter||this._groups.map(Oe),this._parents)}function Dt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Dt.prototype={constructor:Dt,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 Vn(t){return function(){return t}}function Xn(t,e,n,r,i,a){for(var o=0,c,s=e.length,l=a.length;o<l;++o)(c=e[o])?(c.__data__=a[o],r[o]=c):n[o]=new Dt(t,a[o]);for(;o<s;++o)(c=e[o])&&(i[o]=c)}function qn(t,e,n,r,i,a,o){var c,s,l=new Map,u=e.length,f=a.length,h=new Array(u),g;for(c=0;c<u;++c)(s=e[c])&&(h[c]=g=o.call(s,s.__data__,c,e)+"",l.has(g)?i[c]=s:l.set(g,s));for(c=0;c<f;++c)g=o.call(t,a[c],c,a)+"",(s=l.get(g))?(r[c]=s,s.__data__=a[c],l.delete(g)):n[c]=new Dt(t,a[c]);for(c=0;c<u;++c)(s=e[c])&&l.get(h[c])===s&&(i[c]=s)}function Un(t){return t.__data__}function Zn(t,e){if(!arguments.length)return Array.from(this,Un);var n=e?qn:Xn,r=this._parents,i=this._groups;typeof t!="function"&&(t=Vn(t));for(var a=i.length,o=new Array(a),c=new Array(a),s=new Array(a),l=0;l<a;++l){var u=r[l],f=i[l],h=f.length,g=Kn(t.call(u,u&&u.__data__,l,r)),m=g.length,x=c[l]=new Array(m),y=o[l]=new Array(m),p=s[l]=new Array(h);n(u,f,x,y,p,g,e);for(var w=0,E=0,S,$;w<m;++w)if(S=x[w]){for(w>=E&&(E=w+1);!($=y[E])&&++E<m;);S._next=$||null}}return o=new F(o,r),o._enter=c,o._exit=s,o}function Kn(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Qn(){return new F(this._exit||this._groups.map(Oe),this._parents)}function Jn(t,e,n){var r=this.enter(),i=this,a=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function jn(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,o=Math.min(i,a),c=new Array(i),s=0;s<o;++s)for(var l=n[s],u=r[s],f=l.length,h=c[s]=new Array(f),g,m=0;m<f;++m)(g=l[m]||u[m])&&(h[m]=g);for(;s<i;++s)c[s]=n[s];return new F(c,this._parents)}function tr(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function er(t){t||(t=nr);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o=n[a],c=o.length,s=i[a]=new Array(c),l,u=0;u<c;++u)(l=o[u])&&(s[u]=l);s.sort(e)}return new F(i,this._parents).order()}function nr(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function rr(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ir(){return Array.from(this)}function or(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ar(){let t=0;for(const e of this)++t;return t}function sr(){return!this.node()}function cr(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],a=0,o=i.length,c;a<o;++a)(c=i[a])&&t.call(c,c.__data__,a,i);return this}function lr(t){return function(){this.removeAttribute(t)}}function ur(t){return function(){this.removeAttributeNS(t.space,t.local)}}function fr(t,e){return function(){this.setAttribute(t,e)}}function hr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dr(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function gr(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 pr(t,e){var n=Ot(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?ur:lr:typeof e=="function"?n.local?gr:dr:n.local?hr:fr)(n,e))}function He(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mr(t){return function(){this.style.removeProperty(t)}}function yr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function xr(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _r(t,e,n){return arguments.length>1?this.each((e==null?mr:typeof e=="function"?xr:yr)(t,e,n??"")):lt(this.node(),t)}function lt(t,e){return t.style.getPropertyValue(e)||He(t).getComputedStyle(t,null).getPropertyValue(e)}function wr(t){return function(){delete this[t]}}function vr(t,e){return function(){this[t]=e}}function br(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Er(t,e){return arguments.length>1?this.each((e==null?wr:typeof e=="function"?br:vr)(t,e)):this.node()[t]}function Be(t){return t.trim().split(/^|\s+/)}function ae(t){return t.classList||new Fe(t)}function Fe(t){this._node=t,this._names=Be(t.getAttribute("class")||"")}Fe.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 We(t,e){for(var n=ae(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ge(t,e){for(var n=ae(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Nr(t){return function(){We(this,t)}}function $r(t){return function(){Ge(this,t)}}function Sr(t,e){return function(){(e.apply(this,arguments)?We:Ge)(this,t)}}function Ar(t,e){var n=Be(t+"");if(arguments.length<2){for(var r=ae(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Sr:e?Nr:$r)(n,e))}function kr(){this.textContent=""}function Tr(t){return function(){this.textContent=t}}function Ir(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Cr(t){return arguments.length?this.each(t==null?kr:(typeof t=="function"?Ir:Tr)(t)):this.node().textContent}function Mr(){this.innerHTML=""}function Dr(t){return function(){this.innerHTML=t}}function Pr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Yr(t){return arguments.length?this.each(t==null?Mr:(typeof t=="function"?Pr:Dr)(t)):this.node().innerHTML}function zr(){this.nextSibling&&this.parentNode.appendChild(this)}function Rr(){return this.each(zr)}function Lr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Or(){return this.each(Lr)}function Hr(t){var e=typeof t=="function"?t:Ye(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Br(){return null}function Fr(t,e){var n=typeof t=="function"?t:Ye(t),r=e==null?Br:typeof e=="function"?e:oe(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Wr(){var t=this.parentNode;t&&t.removeChild(this)}function Gr(){return this.each(Wr)}function Vr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Xr(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qr(t){return this.select(t?Xr:Vr)}function Ur(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Zr(t){return function(e){t.call(this,e,this.__data__)}}function Kr(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 Qr(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,a;n<i;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++r]=a;++r?e.length=r:delete this.__on}}}function Jr(t,e,n){return function(){var r=this.__on,i,a=Zr(e);if(r){for(var o=0,c=r.length;o<c;++o)if((i=r[o]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=e;return}}this.addEventListener(t.type,a,n),i={type:t.type,name:t.name,value:e,listener:a,options:n},r?r.push(i):this.__on=[i]}}function jr(t,e,n){var r=Kr(t+""),i,a=r.length,o;if(arguments.length<2){var c=this.node().__on;if(c){for(var s=0,l=c.length,u;s<l;++s)for(i=0,u=c[s];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(c=e?Jr:Qr,i=0;i<a;++i)this.each(c(r[i],e,n));return this}function Ve(t,e,n){var r=He(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ti(t,e){return function(){return Ve(this,t,e)}}function ei(t,e){return function(){return Ve(this,t,e.apply(this,arguments))}}function ni(t,e){return this.each((typeof e=="function"?ei:ti)(t,e))}function*ri(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Xe=[null];function F(t,e){this._groups=t,this._parents=e}function vt(){return new F([[document.documentElement]],Xe)}function ii(){return this}F.prototype=vt.prototype={constructor:F,select:In,selectAll:Pn,selectChild:Ln,selectChildren:Fn,filter:Wn,data:Zn,enter:Gn,exit:Qn,join:Jn,merge:jn,selection:ii,order:tr,sort:er,call:rr,nodes:ir,node:or,size:ar,empty:sr,each:cr,attr:pr,style:_r,property:Er,classed:Ar,text:Cr,html:Yr,raise:Rr,lower:Or,append:Hr,insert:Fr,remove:Gr,clone:qr,datum:Ur,on:jr,dispatch:ni,[Symbol.iterator]:ri};function P(t){return typeof t=="string"?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],Xe)}function oi(t){let e;for(;e=t.sourceEvent;)t=e;return t}function rt(t,e){if(t=oi(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 i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const qt={capture:!0,passive:!1};function Ut(t){t.preventDefault(),t.stopImmediatePropagation()}function ai(t){var e=t.document.documentElement,n=P(t).on("dragstart.drag",Ut,qt);"onselectstart"in e?n.on("selectstart.drag",Ut,qt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function si(t,e){var n=t.document.documentElement,r=P(t).on("dragstart.drag",null);e&&(r.on("click.drag",Ut,qt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function se(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function qe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function bt(){}var mt=.7,Pt=1/mt,ct="\\s*([+-]?\\d+)\\s*",yt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",U="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ci=/^#([0-9a-f]{3,8})$/,li=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),ui=new RegExp(`^rgb\\(${U},${U},${U}\\)$`),fi=new RegExp(`^rgba\\(${ct},${ct},${ct},${yt}\\)$`),hi=new RegExp(`^rgba\\(${U},${U},${U},${yt}\\)$`),di=new RegExp(`^hsl\\(${yt},${U},${U}\\)$`),gi=new RegExp(`^hsla\\(${yt},${U},${U},${yt}\\)$`),pe={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};se(bt,xt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:me,formatHex:me,formatHex8:pi,formatHsl:mi,formatRgb:ye,toString:ye});function me(){return this.rgb().formatHex()}function pi(){return this.rgb().formatHex8()}function mi(){return Ue(this).formatHsl()}function ye(){return this.rgb().formatRgb()}function xt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ci.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xe(e):n===3?new B(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Nt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Nt(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=li.exec(t))?new B(e[1],e[2],e[3],1):(e=ui.exec(t))?new B(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fi.exec(t))?Nt(e[1],e[2],e[3],e[4]):(e=hi.exec(t))?Nt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=di.exec(t))?ve(e[1],e[2]/100,e[3]/100,1):(e=gi.exec(t))?ve(e[1],e[2]/100,e[3]/100,e[4]):pe.hasOwnProperty(t)?xe(pe[t]):t==="transparent"?new B(NaN,NaN,NaN,0):null}function xe(t){return new B(t>>16&255,t>>8&255,t&255,1)}function Nt(t,e,n,r){return r<=0&&(t=e=n=NaN),new B(t,e,n,r)}function yi(t){return t instanceof bt||(t=xt(t)),t?(t=t.rgb(),new B(t.r,t.g,t.b,t.opacity)):new B}function Zt(t,e,n,r){return arguments.length===1?yi(t):new B(t,e,n,r??1)}function B(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}se(B,Zt,qe(bt,{brighter(t){return t=t==null?Pt:Math.pow(Pt,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?mt:Math.pow(mt,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new B(at(this.r),at(this.g),at(this.b),Yt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_e,formatHex:_e,formatHex8:xi,formatRgb:we,toString:we}));function _e(){return`#${ot(this.r)}${ot(this.g)}${ot(this.b)}`}function xi(){return`#${ot(this.r)}${ot(this.g)}${ot(this.b)}${ot((isNaN(this.opacity)?1:this.opacity)*255)}`}function we(){const t=Yt(this.opacity);return`${t===1?"rgb(":"rgba("}${at(this.r)}, ${at(this.g)}, ${at(this.b)}${t===1?")":`, ${t})`}`}function Yt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function at(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ot(t){return t=at(t),(t<16?"0":"")+t.toString(16)}function ve(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new X(t,e,n,r)}function Ue(t){if(t instanceof X)return new X(t.h,t.s,t.l,t.opacity);if(t instanceof bt||(t=xt(t)),!t)return new X;if(t instanceof X)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,c=a-i,s=(a+i)/2;return c?(e===a?o=(n-r)/c+(n<r)*6:n===a?o=(r-e)/c+2:o=(e-n)/c+4,c/=s<.5?a+i:2-a-i,o*=60):c=s>0&&s<1?0:o,new X(o,c,s,t.opacity)}function _i(t,e,n,r){return arguments.length===1?Ue(t):new X(t,e,n,r??1)}function X(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}se(X,_i,qe(bt,{brighter(t){return t=t==null?Pt:Math.pow(Pt,t),new X(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?mt:Math.pow(mt,t),new X(this.h,this.s,this.l*t,this.opacity)},rgb(){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,i=2*n-r;return new B(Wt(t>=240?t-240:t+120,i,r),Wt(t,i,r),Wt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new X(be(this.h),$t(this.s),$t(this.l),Yt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Yt(this.opacity);return`${t===1?"hsl(":"hsla("}${be(this.h)}, ${$t(this.s)*100}%, ${$t(this.l)*100}%${t===1?")":`, ${t})`}`}}));function be(t){return t=(t||0)%360,t<0?t+360:t}function $t(t){return Math.max(0,Math.min(1,t||0))}function Wt(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ze=t=>()=>t;function wi(t,e){return function(n){return t+n*e}}function vi(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 bi(t){return(t=+t)==1?Ke:function(e,n){return n-e?vi(e,n,t):Ze(isNaN(e)?n:e)}}function Ke(t,e){var n=e-t;return n?wi(t,n):Ze(isNaN(t)?e:t)}const Ee=(function t(e){var n=bi(e);function r(i,a){var o=n((i=Zt(i)).r,(a=Zt(a)).r),c=n(i.g,a.g),s=n(i.b,a.b),l=Ke(i.opacity,a.opacity);return function(u){return i.r=o(u),i.g=c(u),i.b=s(u),i.opacity=l(u),i+""}}return r.gamma=t,r})(1);function et(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gt=new RegExp(Kt.source,"g");function Ei(t){return function(){return t}}function Ni(t){return function(e){return t(e)+""}}function $i(t,e){var n=Kt.lastIndex=Gt.lastIndex=0,r,i,a,o=-1,c=[],s=[];for(t=t+"",e=e+"";(r=Kt.exec(t))&&(i=Gt.exec(e));)(a=i.index)>n&&(a=e.slice(n,a),c[o]?c[o]+=a:c[++o]=a),(r=r[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,s.push({i:o,x:et(r,i)})),n=Gt.lastIndex;return n<e.length&&(a=e.slice(n),c[o]?c[o]+=a:c[++o]=a),c.length<2?s[0]?Ni(s[0].x):Ei(e):(e=s.length,function(l){for(var u=0,f;u<e;++u)c[(f=s[u]).i]=f.x(l);return c.join("")})}var Ne=180/Math.PI,Qt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qe(t,e,n,r,i,a){var o,c,s;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,s/=c),t*r<e*n&&(t=-t,e=-e,s=-s,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*Ne,skewX:Math.atan(s)*Ne,scaleX:o,scaleY:c}}var St;function Si(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Qt:Qe(e.a,e.b,e.c,e.d,e.e,e.f)}function Ai(t){return t==null||(St||(St=document.createElementNS("http://www.w3.org/2000/svg","g")),St.setAttribute("transform",t),!(t=St.transform.baseVal.consolidate()))?Qt:(t=t.matrix,Qe(t.a,t.b,t.c,t.d,t.e,t.f))}function Je(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function a(l,u,f,h,g,m){if(l!==f||u!==h){var x=g.push("translate(",null,e,null,n);m.push({i:x-4,x:et(l,f)},{i:x-2,x:et(u,h)})}else(f||h)&&g.push("translate("+f+e+h+n)}function o(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:et(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function c(l,u,f,h){l!==u?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:et(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function s(l,u,f,h,g,m){if(l!==f||u!==h){var x=g.push(i(g)+"scale(",null,",",null,")");m.push({i:x-4,x:et(l,f)},{i:x-2,x:et(u,h)})}else(f!==1||h!==1)&&g.push(i(g)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=t(l),u=t(u),a(l.translateX,l.translateY,u.translateX,u.translateY,f,h),o(l.rotate,u.rotate,f,h),c(l.skewX,u.skewX,f,h),s(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(g){for(var m=-1,x=h.length,y;++m<x;)f[(y=h[m]).i]=y.x(g);return f.join("")}}}var ki=Je(Si,"px, ","px)","deg)"),Ti=Je(Ai,", ",")",")"),Ii=1e-12;function $e(t){return((t=Math.exp(t))+1/t)/2}function Ci(t){return((t=Math.exp(t))-1/t)/2}function Mi(t){return((t=Math.exp(2*t))-1)/(t+1)}const Di=(function t(e,n,r){function i(a,o){var c=a[0],s=a[1],l=a[2],u=o[0],f=o[1],h=o[2],g=u-c,m=f-s,x=g*g+m*m,y,p;if(x<Ii)p=Math.log(h/l)/e,y=function(A){return[c+A*g,s+A*m,l*Math.exp(e*A*p)]};else{var w=Math.sqrt(x),E=(h*h-l*l+r*x)/(2*l*n*w),S=(h*h-l*l-r*x)/(2*h*n*w),$=Math.log(Math.sqrt(E*E+1)-E),v=Math.log(Math.sqrt(S*S+1)-S);p=(v-$)/e,y=function(A){var z=A*p,C=$e($),D=l/(n*w)*(C*Mi(e*z+$)-Ci($));return[c+D*g,s+D*m,l*C/$e(e*z+$)]}}return y.duration=p*1e3*e/Math.SQRT2,y}return i.rho=function(a){var o=Math.max(.001,+a),c=o*o,s=c*c;return t(o,c,s)},i})(Math.SQRT2,2,4);var ut=0,dt=0,ft=0,je=1e3,zt,gt,Rt=0,st=0,Ht=0,_t=typeof performance=="object"&&performance.now?performance:Date,tn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ce(){return st||(tn(Pi),st=_t.now()+Ht)}function Pi(){st=0}function Lt(){this._call=this._time=this._next=null}Lt.prototype=en.prototype={constructor:Lt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ce():+n)+(e==null?0:+e),!this._next&>!==this&&(gt?gt._next=this:zt=this,gt=this),this._call=t,this._time=n,Jt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jt())}};function en(t,e,n){var r=new Lt;return r.restart(t,e,n),r}function Yi(){ce(),++ut;for(var t=zt,e;t;)(e=st-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ut}function Se(){st=(Rt=_t.now())+Ht,ut=dt=0;try{Yi()}finally{ut=0,Ri(),st=0}}function zi(){var t=_t.now(),e=t-Rt;e>je&&(Ht-=e,Rt=t)}function Ri(){for(var t,e=zt,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:zt=n);gt=t,Jt(r)}function Jt(t){if(!ut){dt&&(dt=clearTimeout(dt));var e=t-st;e>24?(t<1/0&&(dt=setTimeout(Se,t-_t.now()-Ht)),ft&&(ft=clearInterval(ft))):(ft||(Rt=_t.now(),ft=setInterval(zi,je)),ut=1,tn(Se))}}function Ae(t,e,n){var r=new Lt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Li=ie("start","end","cancel","interrupt"),Oi=[],nn=0,ke=1,jt=2,Tt=3,Te=4,te=5,It=6;function Bt(t,e,n,r,i,a){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Hi(t,n,{name:e,index:r,group:i,on:Li,tween:Oi,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:nn})}function le(t,e){var n=q(t,e);if(n.state>nn)throw new Error("too late; already scheduled");return n}function Z(t,e){var n=q(t,e);if(n.state>Tt)throw new Error("too late; already running");return n}function q(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Hi(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=en(a,0,n.time);function a(l){n.state=ke,n.timer.restart(o,n.delay,n.time),n.delay<=l&&o(l-n.delay)}function o(l){var u,f,h,g;if(n.state!==ke)return s();for(u in r)if(g=r[u],g.name===n.name){if(g.state===Tt)return Ae(o);g.state===Te?(g.state=It,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=It,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(Ae(function(){n.state===Tt&&(n.state=Te,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=jt,n.on.call("start",t,t.__data__,n.index,n.group),n.state===jt){for(n.state=Tt,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++f]=g);i.length=f+1}}function c(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(s),n.state=te,1),f=-1,h=i.length;++f<h;)i[f].call(t,u);n.state===te&&(n.on.call("end",t,t.__data__,n.index,n.group),s())}function s(){n.state=It,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Ct(t,e){var n=t.__transition,r,i,a=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){a=!1;continue}i=r.state>jt&&r.state<te,r.state=It,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}a&&delete t.__transition}}function Bi(t){return this.each(function(){Ct(this,t)})}function Fi(t,e){var n,r;return function(){var i=Z(this,t),a=i.tween;if(a!==n){r=n=a;for(var o=0,c=r.length;o<c;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Wi(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var a=Z(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var c={name:e,value:n},s=0,l=i.length;s<l;++s)if(i[s].name===e){i[s]=c;break}s===l&&i.push(c)}a.tween=i}}function Gi(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((e==null?Fi:Wi)(n,t,e))}function ue(t,e,n){var r=t._id;return t.each(function(){var i=Z(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return q(i,r).value[e]}}function rn(t,e){var n;return(typeof e=="number"?et:e instanceof xt?Ee:(n=xt(e))?(e=n,Ee):$i)(t,e)}function Vi(t){return function(){this.removeAttribute(t)}}function Xi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function qi(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttribute(t);return o===i?null:o===r?a:a=e(r=o,n)}}function Ui(t,e,n){var r,i=n+"",a;return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?a:a=e(r=o,n)}}function Zi(t,e,n){var r,i,a;return function(){var o,c=n(this),s;return c==null?void this.removeAttribute(t):(o=this.getAttribute(t),s=c+"",o===s?null:o===r&&s===i?a:(i=s,a=e(r=o,c)))}}function Ki(t,e,n){var r,i,a;return function(){var o,c=n(this),s;return c==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),s=c+"",o===s?null:o===r&&s===i?a:(i=s,a=e(r=o,c)))}}function Qi(t,e){var n=Ot(t),r=n==="transform"?Ti:rn;return this.attrTween(t,typeof e=="function"?(n.local?Ki:Zi)(n,r,ue(this,"attr."+t,e)):e==null?(n.local?Xi:Vi)(n):(n.local?Ui:qi)(n,r,e))}function Ji(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ji(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function to(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&ji(t,a)),n}return i._value=e,i}function eo(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Ji(t,a)),n}return i._value=e,i}function no(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=Ot(t);return this.tween(n,(r.local?to:eo)(r,e))}function ro(t,e){return function(){le(this,t).delay=+e.apply(this,arguments)}}function io(t,e){return e=+e,function(){le(this,t).delay=e}}function oo(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ro:io)(e,t)):q(this.node(),e).delay}function ao(t,e){return function(){Z(this,t).duration=+e.apply(this,arguments)}}function so(t,e){return e=+e,function(){Z(this,t).duration=e}}function co(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ao:so)(e,t)):q(this.node(),e).duration}function lo(t,e){if(typeof e!="function")throw new Error;return function(){Z(this,t).ease=e}}function uo(t){var e=this._id;return arguments.length?this.each(lo(e,t)):q(this.node(),e).ease}function fo(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Z(this,t).ease=n}}function ho(t){if(typeof t!="function")throw new Error;return this.each(fo(this._id,t))}function go(t){typeof t!="function"&&(t=Re(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],o=a.length,c=r[i]=[],s,l=0;l<o;++l)(s=a[l])&&t.call(s,s.__data__,l,a)&&c.push(s);return new tt(r,this._parents,this._name,this._id)}function po(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),c=0;c<a;++c)for(var s=e[c],l=n[c],u=s.length,f=o[c]=new Array(u),h,g=0;g<u;++g)(h=s[g]||l[g])&&(f[g]=h);for(;c<r;++c)o[c]=e[c];return new tt(o,this._parents,this._name,this._id)}function mo(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 yo(t,e,n){var r,i,a=mo(e)?le:Z;return function(){var o=a(this,t),c=o.on;c!==r&&(i=(r=c).copy()).on(e,n),o.on=i}}function xo(t,e){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(t):this.each(yo(n,t,e))}function _o(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function wo(){return this.on("end.remove",_o(this._id))}function vo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=oe(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var c=r[o],s=c.length,l=a[o]=new Array(s),u,f,h=0;h<s;++h)(u=c[h])&&(f=t.call(u,u.__data__,h,c))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,Bt(l[h],e,n,h,l,q(u,n)));return new tt(a,this._parents,e,n)}function bo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ze(t));for(var r=this._groups,i=r.length,a=[],o=[],c=0;c<i;++c)for(var s=r[c],l=s.length,u,f=0;f<l;++f)if(u=s[f]){for(var h=t.call(u,u.__data__,f,s),g,m=q(u,n),x=0,y=h.length;x<y;++x)(g=h[x])&&Bt(g,e,n,x,h,m);a.push(h),o.push(u)}return new tt(a,o,e,n)}var Eo=vt.prototype.constructor;function No(){return new Eo(this._groups,this._parents)}function $o(t,e){var n,r,i;return function(){var a=lt(this,t),o=(this.style.removeProperty(t),lt(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}function on(t){return function(){this.style.removeProperty(t)}}function So(t,e,n){var r,i=n+"",a;return function(){var o=lt(this,t);return o===i?null:o===r?a:a=e(r=o,n)}}function Ao(t,e,n){var r,i,a;return function(){var o=lt(this,t),c=n(this),s=c+"";return c==null&&(s=c=(this.style.removeProperty(t),lt(this,t))),o===s?null:o===r&&s===i?a:(i=s,a=e(r=o,c))}}function ko(t,e){var n,r,i,a="style."+e,o="end."+a,c;return function(){var s=Z(this,t),l=s.on,u=s.value[a]==null?c||(c=on(e)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),s.on=r}}function To(t,e,n){var r=(t+="")=="transform"?ki:rn;return e==null?this.styleTween(t,$o(t,r)).on("end.style."+t,on(t)):typeof e=="function"?this.styleTween(t,Ao(t,r,ue(this,"style."+t,e))).each(ko(this._id,t)):this.styleTween(t,So(t,r,e),n).on("end.style."+t,null)}function Io(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Co(t,e,n){var r,i;function a(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Io(t,o,n)),r}return a._value=e,a}function Mo(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,Co(t,e,n??""))}function Do(t){return function(){this.textContent=t}}function Po(t){return function(){var e=t(this);this.textContent=e??""}}function Yo(t){return this.tween("text",typeof t=="function"?Po(ue(this,"text",t)):Do(t==null?"":t+""))}function zo(t){return function(e){this.textContent=t.call(this,e)}}function Ro(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&zo(i)),e}return r._value=t,r}function Lo(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,Ro(t))}function Oo(){for(var t=this._name,e=this._id,n=an(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],c=o.length,s,l=0;l<c;++l)if(s=o[l]){var u=q(s,e);Bt(s,t,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tt(r,this._parents,t,n)}function Ho(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var c={value:o},s={value:function(){--i===0&&a()}};n.each(function(){var l=Z(this,r),u=l.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(c),e._.interrupt.push(c),e._.end.push(s)),l.on=e}),i===0&&a()})}var Bo=0;function tt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function an(){return++Bo}var J=vt.prototype;tt.prototype={constructor:tt,select:vo,selectAll:bo,selectChild:J.selectChild,selectChildren:J.selectChildren,filter:go,merge:po,selection:No,transition:Oo,call:J.call,nodes:J.nodes,node:J.node,size:J.size,empty:J.empty,each:J.each,on:xo,attr:Qi,attrTween:no,style:To,styleTween:Mo,text:Yo,textTween:Lo,remove:wo,tween:Gi,delay:oo,duration:co,ease:uo,easeVarying:ho,end:Ho,[Symbol.iterator]:J[Symbol.iterator]};function Fo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Wo={time:null,delay:0,duration:250,ease:Fo};function Go(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Vo(t){var e,n;t instanceof tt?(e=t._id,t=t._name):(e=an(),(n=Wo).time=ce(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],c=o.length,s,l=0;l<c;++l)(s=o[l])&&Bt(s,t,e,l,o,n||Go(s,e));return new tt(r,this._parents,t,e)}vt.prototype.interrupt=Bi;vt.prototype.transition=Vo;const At=t=>()=>t;function Xo(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){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:i}})}function j(t,e,n){this.k=t,this.x=e,this.y=n}j.prototype={constructor:j,scale:function(t){return t===1?this:new j(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new j(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*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[(t[0]-this.x)/this.k,(t[1]-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 Et=new j(1,0,0);sn.prototype=j.prototype;function sn(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Et;return t.__zoom}function Vt(t){t.stopImmediatePropagation()}function ht(t){t.preventDefault(),t.stopImmediatePropagation()}function qo(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Uo(){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 Ie(){return this.__zoom||Et}function Zo(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ko(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function cn(){var t=qo,e=Uo,n=Qo,r=Zo,i=Ko,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],c=250,s=Di,l=ie("start","zoom","end"),u,f,h,g=500,m=150,x=0,y=10;function p(d){d.property("__zoom",Ie).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(d,b,_,N){var k=d.selection?d.selection():d;k.property("__zoom",Ie),d!==k?$(d,b,_,N):k.interrupt().each(function(){v(this,arguments).event(N).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},p.scaleBy=function(d,b,_,N){p.scaleTo(d,function(){var k=this.__zoom.k,T=typeof b=="function"?b.apply(this,arguments):b;return k*T},_,N)},p.scaleTo=function(d,b,_,N){p.transform(d,function(){var k=e.apply(this,arguments),T=this.__zoom,I=_==null?S(k):typeof _=="function"?_.apply(this,arguments):_,Y=T.invert(I),M=typeof b=="function"?b.apply(this,arguments):b;return n(E(w(T,M),I,Y),k,o)},_,N)},p.translateBy=function(d,b,_,N){p.transform(d,function(){return n(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),o)},null,N)},p.translateTo=function(d,b,_,N,k){p.transform(d,function(){var T=e.apply(this,arguments),I=this.__zoom,Y=N==null?S(T):typeof N=="function"?N.apply(this,arguments):N;return n(Et.translate(Y[0],Y[1]).scale(I.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof _=="function"?-_.apply(this,arguments):-_),T,o)},N,k)};function w(d,b){return b=Math.max(a[0],Math.min(a[1],b)),b===d.k?d:new j(b,d.x,d.y)}function E(d,b,_){var N=b[0]-_[0]*d.k,k=b[1]-_[1]*d.k;return N===d.x&&k===d.y?d:new j(d.k,N,k)}function S(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function $(d,b,_,N){d.on("start.zoom",function(){v(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(N).end()}).tween("zoom",function(){var k=this,T=arguments,I=v(k,T).event(N),Y=e.apply(k,T),M=_==null?S(Y):typeof _=="function"?_.apply(k,T):_,H=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),L=k.__zoom,G=typeof b=="function"?b.apply(k,T):b,K=s(L.invert(M).concat(H/L.k),G.invert(M).concat(H/G.k));return function(V){if(V===1)V=G;else{var Q=K(V),Ft=H/Q[2];V=new j(Ft,M[0]-Q[0]*Ft,M[1]-Q[1]*Ft)}I.zoom(null,V)}})}function v(d,b,_){return!_&&d.__zooming||new A(d,b)}function A(d,b){this.that=d,this.args=b,this.active=0,this.sourceEvent=null,this.extent=e.apply(d,b),this.taps=0}A.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,b){return this.mouse&&d!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&d!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(d){var b=P(this.that).datum();l.call(d,this.that,new Xo(d,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),b)}};function z(d,...b){if(!t.apply(this,arguments))return;var _=v(this,b).event(d),N=this.__zoom,k=Math.max(a[0],Math.min(a[1],N.k*Math.pow(2,r.apply(this,arguments)))),T=rt(d);if(_.wheel)(_.mouse[0][0]!==T[0]||_.mouse[0][1]!==T[1])&&(_.mouse[1]=N.invert(_.mouse[0]=T)),clearTimeout(_.wheel);else{if(N.k===k)return;_.mouse=[T,N.invert(T)],Ct(this),_.start()}ht(d),_.wheel=setTimeout(I,m),_.zoom("mouse",n(E(w(N,k),_.mouse[0],_.mouse[1]),_.extent,o));function I(){_.wheel=null,_.end()}}function C(d,...b){if(h||!t.apply(this,arguments))return;var _=d.currentTarget,N=v(this,b,!0).event(d),k=P(d.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",H,!0),T=rt(d,_),I=d.clientX,Y=d.clientY;ai(d.view),Vt(d),N.mouse=[T,this.__zoom.invert(T)],Ct(this),N.start();function M(L){if(ht(L),!N.moved){var G=L.clientX-I,K=L.clientY-Y;N.moved=G*G+K*K>x}N.event(L).zoom("mouse",n(E(N.that.__zoom,N.mouse[0]=rt(L,_),N.mouse[1]),N.extent,o))}function H(L){k.on("mousemove.zoom mouseup.zoom",null),si(L.view,N.moved),ht(L),N.event(L).end()}}function D(d,...b){if(t.apply(this,arguments)){var _=this.__zoom,N=rt(d.changedTouches?d.changedTouches[0]:d,this),k=_.invert(N),T=_.k*(d.shiftKey?.5:2),I=n(E(w(_,T),N,k),e.apply(this,b),o);ht(d),c>0?P(this).transition().duration(c).call($,I,N,d):P(this).call(p.transform,I,N,d)}}function R(d,...b){if(t.apply(this,arguments)){var _=d.touches,N=_.length,k=v(this,b,d.changedTouches.length===N).event(d),T,I,Y,M;for(Vt(d),I=0;I<N;++I)Y=_[I],M=rt(Y,this),M=[M,this.__zoom.invert(M),Y.identifier],k.touch0?!k.touch1&&k.touch0[2]!==M[2]&&(k.touch1=M,k.taps=0):(k.touch0=M,T=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(k.taps<2&&(f=M[0],u=setTimeout(function(){u=null},g)),Ct(this),k.start())}}function O(d,...b){if(this.__zooming){var _=v(this,b).event(d),N=d.changedTouches,k=N.length,T,I,Y,M;for(ht(d),T=0;T<k;++T)I=N[T],Y=rt(I,this),_.touch0&&_.touch0[2]===I.identifier?_.touch0[0]=Y:_.touch1&&_.touch1[2]===I.identifier&&(_.touch1[0]=Y);if(I=_.that.__zoom,_.touch1){var H=_.touch0[0],L=_.touch0[1],G=_.touch1[0],K=_.touch1[1],V=(V=G[0]-H[0])*V+(V=G[1]-H[1])*V,Q=(Q=K[0]-L[0])*Q+(Q=K[1]-L[1])*Q;I=w(I,Math.sqrt(V/Q)),Y=[(H[0]+G[0])/2,(H[1]+G[1])/2],M=[(L[0]+K[0])/2,(L[1]+K[1])/2]}else if(_.touch0)Y=_.touch0[0],M=_.touch0[1];else return;_.zoom("touch",n(E(I,Y,M),_.extent,o))}}function W(d,...b){if(this.__zooming){var _=v(this,b).event(d),N=d.changedTouches,k=N.length,T,I;for(Vt(d),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),T=0;T<k;++T)I=N[T],_.touch0&&_.touch0[2]===I.identifier?delete _.touch0:_.touch1&&_.touch1[2]===I.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(I=rt(I,this),Math.hypot(f[0]-I[0],f[1]-I[1])<y)){var Y=P(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return p.wheelDelta=function(d){return arguments.length?(r=typeof d=="function"?d:At(+d),p):r},p.filter=function(d){return arguments.length?(t=typeof d=="function"?d:At(!!d),p):t},p.touchable=function(d){return arguments.length?(i=typeof d=="function"?d:At(!!d),p):i},p.extent=function(d){return arguments.length?(e=typeof d=="function"?d:At([[+d[0][0],+d[0][1]],[+d[1][0],+d[1][1]]]),p):e},p.scaleExtent=function(d){return arguments.length?(a[0]=+d[0],a[1]=+d[1],p):[a[0],a[1]]},p.translateExtent=function(d){return arguments.length?(o[0][0]=+d[0][0],o[1][0]=+d[1][0],o[0][1]=+d[0][1],o[1][1]=+d[1][1],p):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},p.constrain=function(d){return arguments.length?(n=d,p):n},p.duration=function(d){return arguments.length?(c=+d,p):c},p.interpolate=function(d){return arguments.length?(s=d,p):s},p.on=function(){var d=l.on.apply(l,arguments);return d===l?p:d},p.clickDistance=function(d){return arguments.length?(x=(d=+d)*d,p):Math.sqrt(x)},p.tapDistance=function(d){return arguments.length?(y=+d,p):y},p}const nt=72,ln=240,un=74,Jo=40/74,wt=16,fn=6,hn="tf-chain-icon",dn=50,jo=80,ta=20,ea=20,ee=.9,na=16,ra=32,ia=3,gn=800,pn=[0,0,1e3,800],fe=40;class mn{constructor(e,n,r,i,a){this.type=e,this._gvid=n,this.name=r,this._draw_=i,this._ldraw_=a}}class yn extends mn{constructor({_gvid:e,name:n,_draw_:r,_ldraw_:i,bb:a,pos:o,width:c,height:s,label:l}){super("node",e,n,r,i),this.virtualNode=!1,this.bb=a,this.pos=o,this.width=c,this.height=s,this.label=l}getPosition(){if(!this.pos)return null;const[e,n]=this.pos.split(",").map(Number);return[e,n]}getWidthPoints(){return parseFloat(this.width||"1")*nt}getHeightPoints(){return parseFloat(this.height||"0.5")*nt}getBounds(){const e=this.getPosition();if(!e)return null;const[n,r]=e,i=this.getWidthPoints(),a=this.getHeightPoints();return{x:n-i/2,y:r-a/2,width:i,height:a}}leftIn(){const e=this.getBounds();return e?{x:e.x,y:Math.trunc(e.y+e.height/4)}:null}leftOut(){const e=this.getBounds();return e?{x:e.x,y:Math.trunc(e.y+e.height/4*3)}:null}rightOut(){const e=this.getBounds();return e?{x:e.x+e.width,y:Math.trunc(e.y+e.height/4)}:null}rightIn(){const e=this.getBounds();return e?{x:e.x+e.width,y:Math.trunc(e.y+e.height/4*3)}:null}}class oa extends mn{constructor({_gvid:e,name:n,_draw_:r,_ldraw_:i,_hdraw_:a,_tdraw_:o,head:c,tail:s,label:l}){if(super("edge",e,n,r,i),this.isBaseEdge=!1,this.depth=0,this.baseOffset=0,this.midY=0,this._hdraw_=a,this._tdraw_=o,this.head=c,this.tail=s,this.label=l,l)try{this.edgeContent=pt(l),this.edgeIndex=this.edgeContent.index,this.edgeColor=this.edgeContent.color}catch(u){/^\s*</.test(l)||console.warn(`Failed to decode edge label for ${n}:`,u)}}setNodes(e,n){this.sourceNode=e,this.targetNode=n}getDirection(){if(!this.sourceNode||!this.targetNode)return null;const e=this.sourceNode.getPosition(),n=this.targetNode.getPosition();return!e||!n?null:this.sourceNode._gvid===this.targetNode._gvid?"self":e[0]<n[0]?"right":"left"}getStartPoint(){if(!this.sourceNode)return null;const e=this.getDirection();if(!e)return null;switch(e){case"right":return this.sourceNode.rightOut();case"left":return this.sourceNode.leftOut();case"self":return this.sourceNode.leftOut()}}getEndPoint(){if(!this.targetNode)return null;const e=this.getDirection();if(!e)return null;switch(e){case"right":return this.targetNode.leftIn();case"left":return this.targetNode.rightIn();case"self":return this.targetNode.rightIn()}}getLabelText(){var e;if((e=this.edgeContent)!=null&&e.elems&&this.edgeContent.elems.length>0)return this.edgeContent.elems.map(n=>n.text).join(" ");if(this.label)return this.label.replace(/<[^>]*>/g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/ /g," ").replace(/\s+/g," ").trim()||null;if(this._ldraw_){const n=[];if(this._ldraw_.forEach(r=>{r.op==="T"&&r.text&&n.push(r.text)}),n.length>0)return n.join(" ")}return null}getColor(){const e="#9AA4B2";if(this.edgeColor)return this.edgeColor;if(this._draw_){for(const n of this._draw_)if(n.op==="c"&&n.color)return n.color}if(this._hdraw_){for(const n of this._hdraw_)if(n.op==="c"&&n.color)return n.color}return e}}class xn{constructor(e,n=0){this.index=e,this.aboveY=n,this.belowY=n}allocateAbove(e){return this.aboveY-=e,this.aboveY}allocateBelow(e){const n=this.belowY;return this.belowY+=e,n}getRange(){return{above:this.aboveY,below:this.belowY}}}class aa extends xn{constructor(e,n=0){super(e,n),this.nodes=[]}addNode(e,n=!0){if(this.nodes.push(e),!n)return;const r=e.getPosition();if(r){const i=e.height?parseFloat(e.height)*nt:fe,a=r[1]-i/2,o=r[1]+i/2;this.aboveY=Math.min(this.aboveY,a),this.belowY=Math.max(this.belowY,o)}}}class sa extends xn{constructor(e,n,r=0){super(Math.min(e,n),r),this.edges=[],this.baseEdgeIndex=-1,this.sourceColIndex=e,this.targetColIndex=n}addEdge(e){this.edges.push(e)}setBaseEdge(e,n){this.baseEdge=e,this.baseEdgeIndex=n??this.edges.indexOf(e)}getKey(){const e=Math.min(this.sourceColIndex,this.targetColIndex),n=Math.max(this.sourceColIndex,this.targetColIndex);return`${e}-${n}`}}const ca=.6,la=/mono|fira|consolas|courier|menlo|roboto mono|ui-monospace/i,Ce={i:.27,l:.27,j:.27,I:.29,".":.28,",":.28,":":.28,";":.28,"'":.2,"|":.26,"!":.3,f:.32,t:.34,r:.38,"(":.34,")":.34,"[":.34,"]":.34," ":.28},Me={m:.85,w:.74,M:.83,W:.86,"@":.92};function ua(t){if(t in Ce)return Ce[t];if(t in Me)return Me[t];const e=t.charCodeAt(0);return e>=48&&e<=57?.57:e>=65&&e<=90?.66:e>=97&&e<=122?.53:e>=33&&e<=126?.5:e>11904?1:.55}function fa(t){return!!t&&la.test(t)}function ha(t,e,n){if(!t)return 0;if(fa(e))return t.length*n*ca;let r=0;for(const i of t)r+=ua(i);return r*n}function ne(t,e,n){const r=t.attr("font-family")||void 0,i=parseFloat(t.attr("font-size")||"12")||12,a=l=>ha(l,r,i);if(t.text(n),a(n)<=e)return;const o="...";let c=0,s=n.length;for(;c<s;){const l=Math.floor((c+s+1)/2);a(n.slice(0,l)+o)<=e?c=l:s=l-1}c>0?t.text(n.slice(0,c)+o):t.text(o)}function da(t){if(!t)return[];const e=[],n=/<TD[^>]*>(.*?)<\/TD>/gi;let r;for(;(r=n.exec(t))!==null;){let i=r[1];i=i.replace(/<[^>]+>/g,"").trim(),i&&e.push(i)}if(e.length===0){const i=t.replace(/<[^>]+>/g,"").trim();i&&e.push(i)}return e}function ga(t){var a;if(!t||!/<TABLE/i.test(t))return null;const e=/<B>([\s\S]*?)<\/B>/i.exec(t),n=e?e[1].replace(/<[^>]+>/g,"").trim():"",r=t.replace(/<[^>]+>/g," "),i=((a=/0x[0-9a-fA-F]{8,}/.exec(r))==null?void 0:a[0])??"";return!n&&!i?null:{tags:[],label:n,text:i}}function _n(t,e){const n=/^\[(\d+)\]$/.exec(t);return n?`[${n[1]}/${e}]`:t}function pa(t,e){return!t||t.length===0?t:t.map((n,r)=>r===0?{...n,text:_n(n.text,e)}:n)}function wn(t,e,n){var l;const r=pa((l=t.edgeContent)==null?void 0:l.elems,n);let i="";r&&r.length>0&&(i=r.map(u=>u.text).join(" ")),i||(i=da(t.label??"").map((f,h)=>h===0?_n(f,n):f).map(f=>f.length>20?f.slice(0,20)+"...":f).join(" "));const a=i.length>60?i.slice(0,60)+"...":i,o=e.labelFontSize,c=o*.6,s=e.labelPadding;return{displayElems:r,finalText:a,boxWidth:a.length*c+s*2,boxHeight:o+s*2}}const he={horizontalExtension:50,minEdgeDistance:50,minVerticalSegment:20,loopRadius:40,edgeSpacing:80,cornerRadius:4,arrowWidth:10,arrowHeight:6,labelHeight:15,labelFontSize:12,labelPadding:6,labelCornerRadius:4,nodeSpacing:50,nearlyHorizontalThreshold:5,nearlyAlignedThreshold:30};function vn(t){return{...he,...t}}function ma(t){if(t.length<2)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const r=e[e.length-1];(Math.abs(t[n].x-r.x)>.1||Math.abs(t[n].y-r.y)>.1)&&e.push(t[n])}return e}function De(t,e,n){const{start:r,pathEnd:i,isNearlyHorizontal:a,startExtensionX:o,endExtensionX:c}=n,s=n.minVerticalSegment,l=Math.abs(r.y-e),u=Math.abs(e-i.y);let f=[],h=e;switch(t){case"straight":if(a){const m=(r.y+i.y)/2;Math.abs(e-m)<s?(f=[r,i],h=m):(f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},{x:c,y:i.y},i],h=e)}else return null;break;case"2seg":l<u?Math.abs(e-r.y)<s?(f=[r,{x:i.x,y:r.y},i],h=r.y):(f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},{x:c,y:i.y},i],h=e):Math.abs(e-i.y)<s?(f=[r,{x:o,y:r.y},{x:o,y:i.y},i],h=i.y):(f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},{x:c,y:i.y},i],h=e);break;case"3seg":{const m=e;f=[r,{x:o,y:r.y},{x:o,y:m},{x:c,y:m},{x:c,y:i.y},i],h=m;break}case"4seg":f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},i],h=e;break;case"5seg":if(l<s)f=[r,{x:o,y:r.y},{x:c,y:e},{x:c,y:i.y},i],h=e;else if(u<s)f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},i],h=e;else return null;break;case"6seg":f=[r,{x:o,y:r.y},{x:o,y:e},{x:c,y:e},{x:c,y:i.y},i],h=e;break}const g=ma(f);return g.length>0?{points:g,actualMidY:h}:null}function Mt(t,e,n,r=he){const i=t.getStartPoint(),a=t.getEndPoint(),o=t.getDirection();if(!i||!a||!o||o==="self")return;const c={x:i.x,y:e-i.y},s={x:a.x,y:e-a.y};let l={x:s.x,y:s.y};o==="right"?l={x:s.x-r.arrowWidth,y:s.y}:o==="left"&&(l={x:s.x+r.arrowWidth,y:s.y});const u=r.minEdgeDistance,f=t.baseDirection===void 0;let g=(c.y+l.y)/2;if(!f&&n&&n.midY!==void 0){if(t.baseDirection==="above"){const w=n.midY-u;g>w&&(g=w)}else if(t.baseDirection==="below"){const w=n.midY+u;g<w&&(g=w)}}const m=r.horizontalExtension-r.arrowWidth,x={start:c,pathEnd:l,isNearlyHorizontal:Math.abs(c.y-l.y)<5,startExtensionX:o==="right"?c.x+r.horizontalExtension:c.x-r.horizontalExtension,endExtensionX:o==="right"?l.x-m:l.x+m,minVerticalSegment:r.minVerticalSegment};let y;f?y=x.isNearlyHorizontal?["straight","3seg"]:["3seg"]:y=x.isNearlyHorizontal?["straight","3seg","4seg","5seg","6seg"]:["3seg","4seg","5seg","6seg"];for(const w of y){const E=De(w,g,x);if(E)return{midY:E.actualMidY,points:E.points}}const p=De("6seg",g,x);return p?{midY:p.actualMidY,points:p.points}:void 0}function Pe(t,e){if(t.length<2)return"";if(e===0||t.length===2)return`M${t[0].x},${t[0].y} ${t.slice(1).map(i=>`L${i.x},${i.y}`).join(" ")}`;const n=[];n.push(`M${t[0].x},${t[0].y}`);for(let i=1;i<t.length-1;i++){const a=t[i-1],o=t[i],c=t[i+1],s=Math.sqrt((o.x-a.x)**2+(o.y-a.y)**2),l=Math.sqrt((c.x-o.x)**2+(c.y-o.y)**2),u=Math.min(s,l)/2,f=Math.min(e,u);if(f>0){const h=f/s,g=f/l,m={x:o.x-(o.x-a.x)*h,y:o.y-(o.y-a.y)*h},x={x:o.x+(c.x-o.x)*g,y:o.y+(c.y-o.y)*g};n.push(`L${m.x},${m.y}`),n.push(`Q${o.x},${o.y} ${x.x},${x.y}`)}else n.push(`L${o.x},${o.y}`)}const r=t[t.length-1];return n.push(`L${r.x},${r.y}`),n.join(" ")}function re(t,e,n,r,i){const a=i.topLeft||0,o=i.topRight||0,c=i.bottomRight||0,s=i.bottomLeft||0;return`
|
|
2
|
+
M ${t+a} ${e}
|
|
3
|
+
L ${t+n-o} ${e}
|
|
4
|
+
${o?`Q ${t+n} ${e} ${t+n} ${e+o}`:""}
|
|
5
|
+
L ${t+n} ${e+r-c}
|
|
6
|
+
${c?`Q ${t+n} ${e+r} ${t+n-c} ${e+r}`:""}
|
|
7
|
+
L ${t+s} ${e+r}
|
|
8
|
+
${s?`Q ${t} ${e+r} ${t} ${e+r-s}`:""}
|
|
9
|
+
L ${t} ${e+a}
|
|
10
|
+
${a?`Q ${t} ${e} ${t+a} ${e}`:""}
|
|
11
|
+
Z
|
|
12
|
+
`.trim().replace(/\s+/g," ")}function ya(t,e,n,r,i,a,o){const c=a.loopRadius,s=a.horizontalExtension,l=a.cornerRadius,u=()=>{const g=n.x-c,m=n.y-c,x=r.x+c,y=r.y-c;return`M${n.x},${n.y} C${g},${m} ${x},${y} ${r.x},${r.y}`};if(!o){if(e==="self")return u();const g=r.x-n.x,m=.4,x=n.x+g*m,y=n.y,p=r.x-g*m,w=r.y;return`M${n.x},${n.y} C${x},${y} ${p},${w} ${r.x},${r.y}`}const f=s-a.arrowWidth;if(e==="self"){if(t.virtualNode){const g=t.virtualNode.getPosition();if(g){const m=i-g[1];t.midY=m;const x=[n,{x:n.x-s,y:n.y},{x:n.x-s,y:m},{x:r.x+f,y:m},{x:r.x+f,y:r.y},r];return Pe(x,l)}return u()}return u()}let h;if(t.orthogonalPathPoints&&t.orthogonalPathPoints.length>0)h=t.orthogonalPathPoints;else{const g=Math.abs(n.y-t.midY),m=Math.abs(t.midY-r.y),x=20,y=g>=x,p=m>=x,w=e==="right"?n.x+s:n.x-s,E=e==="right"?r.x-f:r.x+f;if(h=[],!y&&!p){const S=(n.y+r.y)/2;h.push(n,{x:w,y:S},{x:E,y:S},r)}else y?p?h.push(n,{x:w,y:n.y},{x:w,y:t.midY},{x:E,y:t.midY},{x:E,y:r.y},r):h.push(n,{x:w,y:n.y},{x:w,y:t.midY},{x:E,y:t.midY},r):h.push(n,{x:w,y:t.midY},{x:E,y:t.midY},{x:E,y:r.y},r)}return Pe(h,l)}function xa(t,e,n,r,i){_a(t,r,i),wa(t,e,n,r,i)}function _a(t,e,n){const r=n.loopRadius,i=n.edgeSpacing,a=n.labelHeight;t.forEach(o=>{const c=o.edges;if(c.length===0)return;const s=o.baseEdge,l=o.baseEdgeIndex;if(!s||l<0)return;const u=s.getStartPoint(),f=s.getEndPoint();if(!u||!f)return;const h=e-u.y,g=e-f.y;s.midY=(h+g)/2;const m=Mt(s,e,void 0,n);m&&(s.midY=m.midY,s.orthogonalPathPoints=m.points),o.aboveY=s.midY,o.belowY=s.midY;for(let x=l-1;x>=0;x--){const y=c[x];if(y.depth!==0)continue;if(y.getDirection()==="self"){const $=y.getStartPoint();$&&(y.midY=e-$.y-r);continue}const w=y.label?i+a:i;y.midY=o.aboveY-w,o.aboveY=y.midY,y.baseDirection="above",y.baseOffset=-(l-x);const E=x<c.length-1?c[x+1]:void 0,S=Mt(y,e,E,n);S&&(y.midY=S.midY,y.orthogonalPathPoints=S.points,o.aboveY=y.midY)}for(let x=l+1;x<c.length;x++){const y=c[x];if(y.depth!==0)continue;if(y.getDirection()==="self"){const $=y.getStartPoint();$&&(y.midY=e-$.y-r);continue}const w=y.label?i+a:i;y.midY=o.belowY+w,o.belowY=y.midY,y.baseDirection="below",y.baseOffset=x-l;const E=x>0?c[x-1]:void 0,S=Mt(y,e,E,n);S&&(y.midY=S.midY,y.orthogonalPathPoints=S.points,o.belowY=y.midY)}})}function wa(t,e,n,r,i){const a=i.loopRadius,o=i.edgeSpacing,c=i.labelHeight,s=[];t.forEach(f=>{const h=f.edges;h.length===0||f.baseEdge||!h.every(m=>m.depth>0)||h.forEach(m=>{if(m.getDirection()!=="self")s.push(m);else{const x=m.getStartPoint();x&&(m.midY=r-x.y-a)}})}),s.sort((f,h)=>f.depth-h.depth);let l=1/0,u=-1/0;t.forEach(f=>{f.aboveY!==0&&(l=Math.min(l,f.aboveY)),f.belowY!==0&&(u=Math.max(u,f.belowY))}),e.forEach(f=>{f.aboveY!==0&&(l=Math.min(l,f.aboveY)),f.belowY!==0&&(u=Math.max(u,f.belowY))}),s.forEach(f=>{if(!f.sourceNode||!f.targetNode)return;const h=n.get(f.sourceNode._gvid),g=n.get(f.targetNode._gvid);if(h===void 0||g===void 0)return;const m=Math.min(h,g),x=Math.max(h,g),y=[];for(let D=m;D<=x;D++){const R=e.get(D);R&&y.push(...R.nodes)}const p=y.map(D=>{const R=D.getPosition();if(!R)return null;const O=r-R[1],W=D.height?parseFloat(D.height)*nt:fe;return{y:O,height:W,bottomY:O+W/2}}).filter(D=>D!==null).sort((D,R)=>D.y-R.y);let w;if(p.length===0)w=(l+u)/2;else if(p.length%2===1)w=p[Math.floor(p.length/2)].bottomY;else{const D=p.length/2;w=(p[D-1].bottomY+p[D].bottomY)/2}const E=f.getStartPoint(),S=f.getEndPoint(),v=(E&&S?r-(E.y+S.y)/2:w)<w?"above":"below";f.baseDirection=v;const A=f.label?o+c:o;let z;v==="above"?(f.midY=l-A,z=l,l=f.midY):(f.midY=u+A,z=u,u=f.midY);const C=Mt(f,r,{midY:z},i);C&&(f.midY=C.midY,f.orthogonalPathPoints=C.points,v==="above"?l=Math.min(l,C.midY):u=Math.max(u,C.midY))})}function va(t){if(!t.sourceNode)return null;const e=t.sourceNode.getPosition();if(!e)return null;const n=dn/nt,r=new yn({_gvid:-1e3-t._gvid,name:`virtual_edge_${t._gvid}`,label:t.label,pos:`${e[0]},${e[1]}`,width:"0.5",height:n.toString()});return r.virtualNode=!0,r.edge=t,t.virtualNode=r,r}function ba(t,e,n){const r=e.nodes,i=r.findIndex(a=>a._gvid===n._gvid);if(i===-1){r.push(t);return}r.splice(i,0,t)}function Ea(t,e){const n=ta,r=[],i=new Map;t.forEach(l=>{const u=l.getPosition();if(!u)return;const f=u[0];let h=r.findIndex(g=>Math.abs(f-g)<=n);h===-1&&(h=r.length,r.push(f)),i.set(l._gvid,h)});const a=r.map((l,u)=>({x:l,i:u})).sort((l,u)=>l.x-u.x).map((l,u)=>({oldIndex:l.i,newIndex:u})),o=new Map;a.forEach(({oldIndex:l,newIndex:u})=>{o.set(l,u)});for(const[l,u]of i)i.set(l,o.get(u)??u);const c=new Map;t.forEach(l=>{const u=i.get(l._gvid);u!==void 0&&(c.has(u)||c.set(u,new aa(u,0)),c.get(u).addNode(l,!1))}),e.forEach(l=>{if(!l.sourceNode||!l.targetNode||l.sourceNode._gvid!==l.targetNode._gvid)return;const u=i.get(l.sourceNode._gvid);if(u===void 0)return;const f=c.get(u);if(!f)return;const h=va(l);h&&ba(h,f,l.sourceNode)});const s=new Map;return e.forEach(l=>{if(!l.sourceNode||!l.targetNode)return;const u=i.get(l.sourceNode._gvid),f=i.get(l.targetNode._gvid);if(u===void 0||f===void 0)return;l.depth=Math.abs(f-u)-1,l.depth<0&&(l.depth=0);const h=Math.min(u,f),g=Math.max(u,f),m=`${h}-${g}`;s.has(m)||s.set(m,new sa(u,f,0)),s.get(m).addEdge(l)}),s.forEach(l=>{l.edges.sort((u,f)=>{const h=u.getStartPoint(),g=u.getEndPoint(),m=h&&g?(h.y+g.y)/2:0,x=f.getStartPoint(),y=f.getEndPoint();return(x&&y?(x.y+y.y)/2:0)-m})}),{nodeColumnMap:i,nodeColumns:c,edgeColumns:s}}function Na(t,e){t.forEach(n=>{if(n.nodes.length===0)return;let r=!0;n.nodes.forEach(i=>{const a=i.getPosition();if(!a)return;const o=i.height?parseFloat(i.height)*nt:fe,c=e-a[1],s=c-o/2,l=c+o/2;r?(n.aboveY=s,n.belowY=l,r=!1):(n.aboveY=Math.min(n.aboveY,s),n.belowY=Math.max(n.belowY,l))})})}function $a(t,e){t.length!==0&&e.forEach(n=>{const r=n.edges;if(r.length===0)return;const i=r.filter(f=>f.depth===0);if(i.length===0)return;const a=Math.floor(i.length/2),o=i[a];o.isBaseEdge=!0,o.baseDirection=void 0;const c=r.indexOf(o);n.setBaseEdge(o,c);const s=o.getStartPoint(),l=o.getEndPoint(),u=s&&l?(s.y+l.y)/2:0;i.forEach(f=>{if(f===o)return;const h=f.getStartPoint(),g=f.getEndPoint();(h&&g?(h.y+g.y)/2:0)>u?f.baseDirection="above":f.baseDirection="below"})})}function Sa(t,e,n){const i=(t.objects||[]).map(s=>new yn({_gvid:s._gvid,name:s.name,_draw_:s._draw_,_ldraw_:s._ldraw_,bb:s.bb,pos:s.pos,width:e!==null?String(e/nt):s.width,height:n!==null?String(n/nt):s.height,label:s.label})),a=new Map;i.forEach(s=>{a.set(s._gvid,s)});const c=(t.edges||[]).map(s=>{const l=new oa({_gvid:s._gvid,name:s.name,_draw_:s._draw_,_ldraw_:s._ldraw_,_hdraw_:s._hdraw_,_tdraw_:s._tdraw_,head:s.head,tail:s.tail,label:s.label}),u=s.tail!==void 0?a.get(s.tail):void 0,f=s.head!==void 0?a.get(s.head):void 0;return u&&f&&l.setNodes(u,f),l});return{nodes:i,edges:c}}function Aa(t,e,n,r){let i=0;t.forEach(o=>{i=Math.max(i,o.getWidthPoints())});let a=0;return e.forEach(o=>{if(o.depth!==0||!o.label||o.getDirection()==="self")return;const{boxWidth:c}=wn(o,n,r);a=Math.max(a,c)}),i+2*n.horizontalExtension+a+2*ea}function ka(t,e,n){const r=Array.from(t.keys()).sort((l,u)=>l-u),i=r.length,a=jo,o=n,s=(i>1?(i-1)*o:0)+2*a;return r.forEach((l,u)=>{const f=t.get(l);if(!f)return;const h=f.nodes;if(h.length===0)return;const g=i>1?a+u*o:s/2;h.sort((v,A)=>{const z=v.getPosition(),C=A.getPosition();return!z||!C?0:C[1]-z[1]});const m=dn,x=h.filter(v=>!v.virtualNode),y=x.length;if(y===0){let v=(e+h.reduce((A,z)=>A+z.getHeightPoints(),0))/2;h.forEach(A=>{const z=A.getHeightPoints();v-=z/2,A.pos=`${g},${v}`,v-=z/2});return}let p,w;if(y%2===1){const v=Math.floor(y/2),A=x[v];w=h.indexOf(A),p=e/2}else{const v=y/2-1,A=x[v];w=h.indexOf(A),p=e/2}const E=h[w],S=E.getHeightPoints();E.pos=`${g},${p}`;let $=p+S/2;for(let v=w-1;v>=0;v--){const A=h[v],z=h[v+1],C=A.getHeightPoints(),D=A.virtualNode||z.virtualNode?0:m;$+=D+C/2,A.pos=`${g},${$}`,$+=C/2}$=p-S/2;for(let v=w+1;v<h.length;v++){const A=h[v],z=h[v-1],C=A.getHeightPoints(),D=A.virtualNode||z.virtualNode?0:m;$-=D+C/2,A.pos=`${g},${$}`,$-=C/2}}),s}function bn(t,e,n){t.append("use").attr("href",`#${hn}`).attr("x",e).attr("y",n-wt/2)}function Ta(t,e,n){t.style("cursor","pointer").on("mouseenter",function(){if(e.attr("opacity",1),n.select(".edge.selected").size()>0)return;const i=P(this).attr("data-node-id"),a=new Set([i]);n.selectAll(".edge").each(function(){const o=P(this).attr("data-source-node-id"),c=P(this).attr("data-target-node-id");o===i||c===i?o===i?a.add(c):a.add(o):P(this).classed("dimmed",!0)}),n.selectAll(".node").each(function(){const o=P(this).attr("data-node-id");a.has(o)||P(this).classed("dimmed",!0)})}).on("mouseleave",function(){e.attr("opacity",0),n.selectAll(".edge.dimmed").classed("dimmed",!1),n.selectAll(".node.dimmed").classed("dimmed",!1)})}function Ia(t){const{nodeGroup:e,g:n,x:r,y:i,w:a,h:o,height:c,badges:s,labelText:l,addressText:u,nodeTextColor:f,nodeBackground:h,hasCustomBackground:g,hasChainIcon:m}=t,x=o*Jo,y=o-x,p=c-i-o/2,w=4,E="var(--border-primary, #D3D1D4)";e.append("path").attr("d",re(r-a/2,p,a,x,{topLeft:w,topRight:w})).attr("fill",g?h:"var(--bg-quaternary, #F2F2F3)").attr("stroke",E).attr("stroke-width",1),g&&e.append("line").attr("x1",r-a/2).attr("y1",p+x).attr("x2",r+a/2).attr("y2",p+x).attr("stroke",f).attr("stroke-width",1),e.append("path").attr("d",re(r-a/2,p+x,a,y,{bottomLeft:w,bottomRight:w})).attr("fill",g?h:"var(--bg-primary, #fff)").attr("stroke",E).attr("stroke-width",1);const S=e.append("rect").attr("x",r-a/2-4).attr("y",p-4).attr("width",a+8).attr("height",o+8).attr("rx",5).attr("ry",5).attr("fill","none").attr("stroke","var(--gray-700, #43444C)").attr("stroke-width",2).attr("opacity",0).style("pointer-events","none");Ta(e,S,n);let $=r-a/2+8;const v=p+x/2,A=7.2,z=6,C=18,D=4;if(s.forEach(R=>{const W=R.length*A+z*2;e.append("rect").attr("x",$).attr("y",v-C/2).attr("width",W).attr("height",C).attr("rx",5).attr("ry",5).attr("fill","var(--bg-warning-primary, #FFF8E1)").attr("stroke","var(--border-warning-light, #FFD66D)").attr("stroke-width",1),e.append("text").attr("x",$+z).attr("y",v).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family","var(--font-inter), Inter, Helvetica, Arial").attr("font-size","12px").attr("font-weight","500").attr("fill","var(--text-warning-primary, #CD7004)").text(R),$+=W+D}),l){const R=r+a/2-8-$,O=e.append("text").attr("x",$).attr("y",v).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family","var(--font-inter), Inter, Helvetica, Arial").attr("font-size","16px").attr("font-weight","500").attr("fill",f);ne(O,R,l)}if(u){const R=p+x+y/2,O=m?wt+fn:0;m&&bn(e,r-a/2+8,R);const W=a-16-O,d=e.append("text").attr("x",r-a/2+8+O).attr("y",R).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family","var(--font-fira-code), Fira Code, monospace").attr("font-size","12px").attr("font-weight","400").attr("fill",f);ne(d,W,u)}}function Ca(t){const{nodeGroup:e,x:n,y:r,w:i,h:a,height:o,isVirtual:c,showVirtualStyle:s,nodeContent:l,labelText:u,addressText:f,nodeTextColor:h,nodeBackground:g,hasCustomBackground:m,hasChainIcon:x}=t,y=4,p=s?"#EF4444":"var(--border-primary, #D3D1D4)",w=e.append("path").attr("d",re(n-i/2,o-r-a/2,i,a,{topLeft:y,topRight:y,bottomLeft:y,bottomRight:y})).attr("fill",m?g:"var(--bg-primary, #fff)").attr("stroke",p).attr("stroke-width",s?2:1);if(!c){const E=e.append("rect").attr("x",n-i/2-4).attr("y",o-r-a/2-4).attr("width",i+8).attr("height",a+8).attr("rx",5).attr("ry",5).attr("fill","none").attr("stroke","#000000").attr("stroke-width",2).attr("opacity",0).style("pointer-events","none");w.style("cursor","pointer").on("mouseenter",function(){E.attr("opacity",1)}).on("mouseleave",function(){E.attr("opacity",0)})}if(l)if(c){const E=u||f;e.append("text").attr("x",n).attr("y",o-r).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-family","Inter, Helvetica, Arial").attr("font-size","10px").attr("fill","#991B1B").text(E.length>20?E.slice(0,20)+"...":E)}else{const E=f||u,S=o-r,$=x?wt+fn:0;x&&bn(e,n-i/2+8,S);const v=i-16-$,A=e.append("text").attr("x",n-i/2+8+$).attr("y",S).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family","var(--font-fira-code), Fira Code, monospace").attr("font-size","12px").attr("font-weight","400").attr("fill",h);ne(A,v,E)}}function Ma(t,e,n,r,i){const a=t.getPosition();if(!a)return;const[o,c]=a,s=t.getWidthPoints(),l=t.getHeightPoints(),u=t.virtualNode;if(u&&!r)return;const f=e.append("g").attr("class",u?"node virtual-node":"node").attr("id",t.name).attr("data-node-id",t.name);let h=null;try{t.label&&(h=pt(t.label))}catch(v){h=ga(t.label),h||console.warn(`Failed to decode node label for ${t.name}:`,v)}h!=null&&h.key&&f.attr("data-key",h.key);const g=r&&u,m=(h==null?void 0:h.tags)||[],x=(h==null?void 0:h.label)||"",y=(h==null?void 0:h.text)||"",p=(h==null?void 0:h.color)||"var(--text-primary, #1A171B)",w=(h==null?void 0:h.background)||"white",E=w!=="white",S=m.length>0||x.length>0,$={nodeGroup:f,g:e,x:o,y:c,w:s,h:l,height:n,isVirtual:u,showVirtualStyle:g,nodeContent:h,badges:m,labelText:x,addressText:y,nodeTextColor:p,nodeBackground:w,hasCustomBackground:E,hasChainIcon:i};S&&!u?Ia($):Ca($),!t.label&&t._ldraw_&&t._ldraw_.length>0&&!u&&t._ldraw_.forEach(v=>{v.op==="T"&&v.text&&f.append("text").attr("x",o-s/2+8).attr("y",n-c).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family",v.face||"Inter, Helvetica, Arial").attr("font-size",`${v.size||11}px`).attr("fill",v.color||"#334155").text(v.text)})}function Da(t,e,n,r,i){e.forEach(a=>{a.nodes.forEach(o=>{Ma(o,t,n,r,i)})})}const Pa=`
|
|
13
|
+
<style>
|
|
14
|
+
@keyframes selected-pulse {
|
|
15
|
+
0%, 100% {
|
|
16
|
+
stroke-opacity: 1;
|
|
17
|
+
}
|
|
18
|
+
50% {
|
|
19
|
+
stroke-opacity: 0.7;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.edge {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
.edge path {
|
|
26
|
+
/* No transition on dash properties to avoid conflict with animation */
|
|
27
|
+
}
|
|
28
|
+
.edge use {
|
|
29
|
+
transition: transform 0.2s ease;
|
|
30
|
+
}
|
|
31
|
+
.edge text {
|
|
32
|
+
transition: font-weight 0.2s ease;
|
|
33
|
+
}
|
|
34
|
+
/* Marching ants animation keyframe */
|
|
35
|
+
@keyframes marching-ants {
|
|
36
|
+
0% { stroke-dashoffset: 0; }
|
|
37
|
+
100% { stroke-dashoffset: -12; }
|
|
38
|
+
}
|
|
39
|
+
/* Arrow group scaling transition (JS handles actual transform) */
|
|
40
|
+
.edge .arrow-group {
|
|
41
|
+
transition: transform 0.15s ease;
|
|
42
|
+
}
|
|
43
|
+
/* Hover effect: marching ants dashed line */
|
|
44
|
+
.edge:hover:not(.selected) path.edge-path {
|
|
45
|
+
stroke-dasharray: 6 6;
|
|
46
|
+
stroke-width: 4px;
|
|
47
|
+
animation: marching-ants 0.6s linear infinite;
|
|
48
|
+
}
|
|
49
|
+
/* Selected effect: marching ants dashed line */
|
|
50
|
+
.edge.selected path.edge-path {
|
|
51
|
+
stroke-dasharray: 6 6;
|
|
52
|
+
stroke-width: 4px;
|
|
53
|
+
animation: marching-ants 0.6s linear infinite;
|
|
54
|
+
}
|
|
55
|
+
/* Selected edge label: solid pill in the edge's own color, white text */
|
|
56
|
+
.edge.selected .label-bg {
|
|
57
|
+
fill: var(--edge-color);
|
|
58
|
+
stroke: var(--edge-color);
|
|
59
|
+
}
|
|
60
|
+
.edge.selected .label-text,
|
|
61
|
+
.edge.selected .label-text-elem {
|
|
62
|
+
fill: #fff;
|
|
63
|
+
}
|
|
64
|
+
.edge.selected .label-elem-bg {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
/* Dimmed state for edge hover focus effect */
|
|
68
|
+
.edge.dimmed,
|
|
69
|
+
.node.dimmed {
|
|
70
|
+
opacity: 0.3;
|
|
71
|
+
transition: opacity 0.2s ease;
|
|
72
|
+
}
|
|
73
|
+
.edge:not(.dimmed),
|
|
74
|
+
.node:not(.dimmed) {
|
|
75
|
+
transition: opacity 0.2s ease;
|
|
76
|
+
}
|
|
77
|
+
/* Selection-based dimming - unrelated elements when edge is selected */
|
|
78
|
+
.edge.selection-dimmed,
|
|
79
|
+
.node.selection-dimmed {
|
|
80
|
+
opacity: 0.3;
|
|
81
|
+
transition: opacity 0.2s ease;
|
|
82
|
+
}
|
|
83
|
+
/* Hover highlight overrides selection-dimmed to restore visibility */
|
|
84
|
+
.edge.hover-highlight,
|
|
85
|
+
.node.hover-highlight {
|
|
86
|
+
opacity: 1 !important;
|
|
87
|
+
transition: opacity 0.2s ease;
|
|
88
|
+
}
|
|
89
|
+
/* Selected edge should always be at full opacity */
|
|
90
|
+
.edge.selected {
|
|
91
|
+
opacity: 1 !important;
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
94
|
+
<symbol id="arrow-right" viewBox="0 0 12 12">
|
|
95
|
+
<path d="M11.53 5.46967C11.8229 5.76256 11.8229 6.23744 11.53 6.53033L6.75736 11.303C6.46447 11.5959 5.98959 11.5959 5.6967 11.303C5.40381 11.0101 5.40381 10.5352 5.6967 10.2423L9.93934 6L5.6967 1.75736C5.40381 1.46447 5.40381 0.989593 5.6967 0.696699C5.98959 0.403806 6.46447 0.403806 6.75736 0.696699L11.53 5.46967ZM0 5.25H11V6.75H0V5.25Z"/>
|
|
96
|
+
</symbol>
|
|
97
|
+
`,Ya=`
|
|
98
|
+
<style>
|
|
99
|
+
.node rect, .node ellipse, .node polygon {
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
.edge {
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
106
|
+
`;function it(t,e,n){let r="#000000",i="#000000",a="#000000";e.forEach(o=>{switch(o.op){case"c":o.color&&(r=o.color);break;case"C":o.color&&(i=o.color);break;case"F":o.color&&(a=o.color);break;case"T":o.pt&&o.text&&t.append("text").attr("x",o.pt[0]).attr("y",n-o.pt[1]).attr("text-anchor",o.align==="l"?"start":o.align==="r"?"end":"middle").attr("font-family",o.face||"Inter, Helvetica, Arial").attr("font-size",`${o.size||12}px`).attr("fill",o.color||a).text(o.text);break;case"p":if(o.points){const c=o.points.map(([s,l])=>[s,n-l]);t.append("polygon").attr("points",c.map(s=>s.join(",")).join(" ")).attr("fill",i).attr("stroke",r)}break;case"P":if(o.points){const c=o.points.map(([s,l])=>[s,n-l]);t.append("polygon").attr("points",c.map(s=>s.join(",")).join(" ")).attr("fill","none").attr("stroke",r)}break;case"e":if(o.rect){const[c,s,l,u]=o.rect;t.append("ellipse").attr("cx",c).attr("cy",n-s).attr("rx",l).attr("ry",u).attr("fill",i).attr("stroke",r)}break;case"E":if(o.rect){const[c,s,l,u]=o.rect;t.append("ellipse").attr("cx",c).attr("cy",n-s).attr("rx",l).attr("ry",u).attr("fill","none").attr("stroke",r)}break;case"b":if(o.points){const c=o.points.map(([l,u])=>[l,n-u]),s=`M${c[0][0]},${c[0][1]} C${c.slice(1).map(l=>`${l[0]},${l[1]}`).join(" ")}`;t.append("path").attr("d",s).attr("fill","none").attr("stroke",r).attr("stroke-width",1)}break;case"B":if(o.points){const c=o.points.map(([l,u])=>[l,n-u]),s=`M${c[0][0]},${c[0][1]} C${c.slice(1).map(l=>`${l[0]},${l[1]}`).join(" ")}`;t.append("path").attr("d",s).attr("fill",i).attr("stroke",r).attr("stroke-width",1)}break;case"L":if(o.points){const s=`M${o.points.map(([l,u])=>[l,n-u]).map(l=>`${l[0]},${l[1]}`).join(" L")}`;t.append("path").attr("d",s).attr("fill","none").attr("stroke",r).attr("stroke-width",1)}break}})}function za(t,e,n=14){var y;t.innerHTML="";const r=((y=e.bb)==null?void 0:y.split(",").map(Number))||pn,[,,i,a]=r,o=P(t).append("svg").attr("width","100%").attr("height","100%").attr("viewBox",`0 0 ${i} ${a}`);o.append("defs").html(Ya);const c=o.append("g").attr("id","graph0");(e.objects||[]).forEach(p=>{const w=c.append("g").attr("class","node").attr("id",p.name);p._draw_&&it(w,p._draw_,a),p._ldraw_&&it(w,p._ldraw_,a)});const l=e.edges||[];l.forEach(p=>{const w=c.append("g").attr("class","edge").attr("id",`edge_${p._gvid}`);p._draw_&&it(w,p._draw_,a),p._hdraw_&&it(w,p._hdraw_,a),p._tdraw_&&it(w,p._tdraw_,a),p._ldraw_&&it(w,p._ldraw_,a)});const u=cn().scaleExtent([.1,10]).on("zoom",p=>{c.attr("transform",p.transform.toString())});o.call(u);const f=t.clientWidth||gn,h=n*(f/i),g=l.filter(p=>{if(!p.label)return!1;try{const w=pt(p.label);return(w==null?void 0:w.index)!==void 0}catch{return!1}}).map(p=>{var E;const w=pt(p.label);return{id:p._gvid,index:w.index,sourceNodeId:String(p.tail??""),targetNodeId:String(p.head??""),label:((E=w.elems)==null?void 0:E.map(S=>S.text).join(" "))||null}}).sort((p,w)=>p.index-w.index),m=o.node(),x=c.node();if(!m||!x)throw new Error("Failed to construct SVG elements");return{zoomBehavior:u,svgElement:m,gElement:x,baseFontSize:h,viewBoxWidth:i,edges:g}}const Ra="data-label-center-x",La="data-label-center-y";function Oa(t,e,n){const i=(t.clientWidth||gn)/e,a=ra/(n*i);return Math.max(ia,a)}function Ha(t,e,n,r){if(e.initialTransform)return e.initialTransform;if(e.headless){const l=ee;return{x:n/2-n/2*l,y:r/2-r/2*l,k:l}}const i=t.node(),a=i?i.getBBox():{x:0,y:0,width:n,height:r},o=ee*n/a.width,c=a.x+a.width/2,s=a.y+a.height/2;return{x:n/2-c*o,y:r/2-s*o,k:o}}function Ba(t,e){return ee*t/e}function Fa(t,e,n){const r=e/n;return na/(t*r)}function Wa(t,e,n,r){return cn().scaleExtent([.1,Oa(e,n,r)]).on("zoom",i=>{const a=i.transform;!isNaN(a.x)&&!isNaN(a.y)&&!isNaN(a.k)&&t.attr("transform",a.toString())})}function Ga(t,e){t.on("mouseenter",function(){P(this).raise();const n=P(this).select(".arrow-group");if(!n.empty()){const s=n.attr("data-base-transform")||"";n.attr("transform",s+" scale(1.3)")}const r=e.select(".edge.selected").size()>0,i=P(this).classed("selected"),a=P(this).attr("data-source-node-id"),o=P(this).attr("data-target-node-id"),c=P(this).attr("id");r&&!i?(P(this).classed("hover-highlight",!0),e.selectAll(".node").each(function(){const s=P(this).attr("data-node-id");(s===a||s===o)&&P(this).classed("hover-highlight",!0)})):(e.selectAll(".edge").each(function(){P(this).attr("id")!==c&&P(this).classed("dimmed",!0)}),e.selectAll(".node").each(function(){const s=P(this).attr("data-node-id");s!==a&&s!==o&&P(this).classed("dimmed",!0)}))}).on("mouseleave",function(){const n=P(this).select(".arrow-group");if(!n.empty()){const r=n.attr("data-base-transform")||"";n.attr("transform",r)}e.selectAll(".edge.hover-highlight").classed("hover-highlight",!1),e.selectAll(".node.hover-highlight").classed("hover-highlight",!1),e.selectAll(".edge.dimmed").classed("dimmed",!1),e.selectAll(".node.dimmed").classed("dimmed",!1)})}function Va(t,e,n,r,i,a,o){if(e&&e.length>0){const c=o*.62,s=1,l=0,u=2,f=e.map(m=>{const x=m.text.length*c,y=m.background&&m.background!=="transparent",p=x+s*2;return{textWidth:x,hasBackground:y,totalWidth:p}}),h=f.reduce((m,x,y)=>m+x.totalWidth+(y>0?l:0),0);let g=n-h/2;e.forEach((m,x)=>{const y=f[x];x>0&&(g+=l),y.hasBackground&&t.append("rect").attr("class","label-elem-bg").attr("x",g).attr("y",r-o/2-u).attr("width",y.totalWidth).attr("height",o+u*2).attr("rx",2).attr("ry",2).attr("fill",m.background).style("pointer-events","none"),t.append("text").attr("class","label-text-elem").attr("x",g+s).attr("y",r).attr("text-anchor","start").attr("dominant-baseline","middle").attr("font-family","Inter, Helvetica, Arial").attr("font-size",o+"px").attr("font-weight","500").attr("fill",m.color&&m.color.length>0?m.color:i).style("pointer-events","none").text(m.text),g+=y.totalWidth})}else t.append("text").attr("class","label-text").attr("x",n).attr("y",r).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-family","Inter, Helvetica, Arial").attr("font-size",o+"px").attr("font-weight","500").attr("fill",i).style("pointer-events","none").text(a)}function Xa(t){const{edge:e,edgeGroup:n,labelMidpoint:r,edgeColor:i,isSelected:a,ctx:o}=t,{config:c,onEdgeSelect:s,debug:l}=o,{displayElems:u,finalText:f,boxWidth:h,boxHeight:g}=wn(e,c,o.edgeCount),m=e.edgeIndex!==void 0,x=h,y=g,p=r.y,w=r.x,E=n.append("g").attr("class","label-area");E.append("rect").attr("class","label-bg").attr("x",w-x/2).attr("y",p-y/2).attr("width",x).attr("height",y).attr("rx",5).attr("ry",5).attr("fill","var(--bg-primary, #fff)").attr("stroke","var(--border-tertiary, #F2F2F3)").attr("stroke-width",1.5);const S=w;m&&s&&n.style("cursor","pointer").on("click",function($){$.stopPropagation(),!a&&s(e.edgeIndex)}),Va(E,u,S,p,i,f,c.labelFontSize),l&&n.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",4).attr("fill","blue").attr("opacity",.8).style("pointer-events","none").attr("class","debug-label-center")}function qa(t,e,n){e._ldraw_.forEach(r=>{if(r.op==="T"&&r.text){const i=r.size||10,a=i*.6,o=r.text.length*a,c=i,s=6,l=o+s*2,u=c+s*2,f=4,h=n.y;t.append("rect").attr("x",n.x-l/2).attr("y",h-u/2).attr("width",l).attr("height",u).attr("rx",f).attr("ry",f).attr("fill","white").attr("stroke","#d0d0d0").attr("stroke-width",.5),t.append("text").attr("x",n.x).attr("y",h).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-family",r.face||"Inter, Helvetica, Arial").attr("font-size",`${i}px`).attr("fill",r.color||"#666").text(r.text)}})}function Ua(t,e,n){e._draw_&&e._draw_.forEach(r=>{if(r.op==="b"&&r.points){const i=r.points.map(([o,c])=>[o,n-c]),a=`M${i[0][0]},${i[0][1]} C${i.slice(1).map(o=>`${o[0]},${o[1]}`).join(" ")}`;t.append("path").attr("d",a).attr("fill","none").attr("stroke",r.color||"#9AA4B2").attr("stroke-width",2)}}),e._hdraw_&&e._hdraw_.forEach(r=>{if(r.op==="P"&&r.points){const i=r.points.map(([a,o])=>[a,n-o]);t.append("polygon").attr("points",i.map(a=>a.join(",")).join(" ")).attr("fill",r.color||"#9AA4B2")}}),e._ldraw_&&it(t,e._ldraw_,n)}function Za(t,e){var D,R;const{g:n,height:r,config:i,useOrthogonalRendering:a,selectedEdgeId:o,debug:c}=e,s=o!=null&&t.edgeIndex===o,l=t.getColor(),u=n.append("g").attr("class",s?"edge selected":"edge").attr("id",`edge_${t._gvid}`).attr("data-edge-id",t.edgeIndex!==void 0?String(t.edgeIndex):"").attr("data-is-base",t.isBaseEdge?"true":"false").attr("data-color",l).attr("data-source-node-id",((D=t.sourceNode)==null?void 0:D.name)||"").attr("data-target-node-id",((R=t.targetNode)==null?void 0:R.name)||"").attr("style",`--edge-color: ${l}`),f=t.getStartPoint(),h=t.getEndPoint(),g=t.getDirection(),m=i.arrowWidth;if(!(f&&h&&g)){Ua(u,t,r);return}const x={x:f.x,y:r-f.y},y={x:h.x,y:r-h.y},p={x:y.x,y:y.y};let w={x:y.x,y:y.y};g==="right"?w={x:y.x-m,y:y.y}:g==="left"?w={x:y.x+m,y:y.y}:g==="self"&&(w={x:y.x+m,y:y.y});const E=ya(t,g,x,w,r,i,a),S=c&&t.isBaseEdge?"#000000":t.getColor(),$=c&&t.isBaseEdge?4:1.5;u.append("path").attr("d",E).attr("fill","none").attr("stroke","transparent").attr("stroke-width",10).attr("class","edge-hit-area").style("cursor","pointer"),u.append("path").attr("d",E).attr("fill","none").attr("stroke",S).attr("stroke-width",$).attr("class","edge-path").style("pointer-events","none"),Ga(u,n);const v=12;let A="";g==="right"?A=`translate(${p.x-v/2}, ${p.y})`:g==="left"?A=`translate(${p.x+v/2}, ${p.y}) rotate(180)`:g==="self"&&(A=`translate(${p.x+v/2}, ${p.y}) rotate(180)`),u.append("g").attr("class","arrow-group").attr("transform",A).attr("data-base-transform",A).append("use").attr("class","edge-arrow").attr("href","#arrow-right").attr("width",v).attr("height",v).attr("x",-v/2).attr("y",-v/2).attr("fill",S).attr("stroke",S).style("stroke-width",0);const C={x:(x.x+y.x)/2,y:t.midY};if(u.attr(Ra,C.x).attr(La,C.y),t.label?Xa({edge:t,edgeGroup:u,labelMidpoint:C,edgeColor:S,isSelected:s,ctx:e}):t._ldraw_&&qa(u,t,C),c){let O;t.depth===0?O=`d:0 dir:${t.baseDirection||"base"} off:${t.baseOffset} id:${t._gvid}`:O=`d:${t.depth} dir:${t.baseDirection||"?"} midY:${Math.round(t.midY)} id:${t._gvid}`,u.append("text").attr("x",C.x).attr("y",C.y+15).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-family","monospace").attr("font-size","9px").attr("fill","#999").text(O)}}function Ka(t){const e=t.node();if(!e)return;const n=e.getBBox(),r=n.x+n.width/2,i=n.y+n.height/2;t.append("rect").attr("x",n.x).attr("y",n.y).attr("width",n.width).attr("height",n.height).attr("fill","none").attr("stroke","yellow").attr("stroke-width",3).attr("opacity",.8).style("pointer-events","none").attr("class","debug-root-border"),t.append("circle").attr("cx",r).attr("cy",i).attr("r",10).attr("fill","yellow").attr("stroke","orange").attr("stroke-width",2).attr("opacity",.9).style("pointer-events","none").attr("class","debug-geometric-center")}function Qa(t,e,n){const r=Math.max(e,n)*.003;t.append("circle").attr("cx",e/2).attr("cy",n/2).attr("r",r).attr("fill","red").attr("opacity",.9).style("pointer-events","none").attr("class","debug-center-marker")}function Ja(t={}){return{nodeMapping:{},maxDepth:null,includeLesserDepths:!0,config:vn(),useOrthogonalRendering:!0,svgFontSize:14,debug:!1,selectedEdgeId:null,onEdgeSelect:void 0,nodeWidth:ln,nodeHeight:un,nodeColumnSpacing:null,enableWheelZoom:!0,headless:!1,initialTransform:void 0,chainIcon:void 0,...t}}function ja(t){return t.replace(/<svg\b([^>]*)>/i,(e,n)=>{const r=n.replace(/\s+(width|height|id)="[^"]*"/gi,"");return`<svg id="${hn}" width="${wt}" height="${wt}"${r}>`})}function ts(t,e,n){var Y;const{maxDepth:r,includeLesserDepths:i,config:a,useOrthogonalRendering:o,svgFontSize:c,debug:s,selectedEdgeId:l,onEdgeSelect:u,nodeWidth:f,nodeHeight:h,nodeColumnSpacing:g,enableWheelZoom:m,headless:x,chainIcon:y}=n;t.innerHTML="";const p=((Y=e.bb)==null?void 0:Y.split(",").map(Number))||pn,[,,w,E]=p;let S=w;const $=E,v=P(t).append("svg").attr("width","100%").attr("height","100%").attr("viewBox",`0 0 ${S} ${$}`);v.append("defs").html(Pa+(y?ja(y):""));const A=v.append("g").attr("id","graph0"),{nodes:z,edges:C}=Sa(e,f,h),{nodeColumnMap:D,nodeColumns:R,edgeColumns:O}=Ea(z,C),W=C.length,d=g??Aa(z,C,a,W);S=ka(R,$,d),v.attr("viewBox",`0 0 ${S} ${$}`),Da(A,R,$,s,y!==void 0),o&&(Na(R,$),$a(C,O),xa(O,R,D,$,a));const b=Wa(A,t,S,c);x||v.call(b),!x&&!m&&(v.on("wheel.zoom",null),v.on("dblclick.zoom",null)),C.forEach(M=>{if(r!==null){if(i){if(M.depth>r)return}else if(M.depth!==r)return}Za(M,{g:A,height:$,config:a,useOrthogonalRendering:o,zoomBehavior:b,svgSelection:v,container:t,svgWidth:S,svgHeight:$,selectedEdgeId:l,onEdgeSelect:u,debug:s,edgeCount:W})}),s&&Ka(A);const _=Ha(A,n,S,$),N=`translate(${_.x},${_.y}) scale(${_.k})`;x?A.attr("transform",N):v.call(b.transform,Et.translate(_.x,_.y).scale(_.k)),s&&Qa(v,S,$);const k=C.filter(M=>M.edgeIndex!==void 0).map(M=>{var H,L;return{id:M._gvid,index:M.edgeIndex,sourceNodeId:((H=M.sourceNode)==null?void 0:H.name)||"",targetNodeId:((L=M.targetNode)==null?void 0:L.name)||"",label:M.getLabelText()}}).sort((M,H)=>M.index-H.index),T=v.node(),I=A.node();if(!T||!I)throw new Error("Failed to construct SVG elements");return{zoomBehavior:b,svgElement:T,gElement:I,baseFontSize:c,viewBoxWidth:S,edges:k,initialTransform:_}}exports.DEFAULT_LAYOUT_CONFIG=he;exports.DEFAULT_NODE_HEIGHT=un;exports.DEFAULT_NODE_WIDTH=ln;exports.computeDetailScale=Fa;exports.computeOverviewScale=Ba;exports.createLayoutConfig=vn;exports.createRenderOptions=Ja;exports.decodeDotString=pt;exports.encodeDotString=En;exports.identity=Et;exports.renderCustomGraph=ts;exports.renderNativeGraph=za;exports.select=P;exports.transform=sn;
|
package/dist/server.d.ts
CHANGED
|
@@ -129,6 +129,8 @@ export declare interface RenderToStringOptions {
|
|
|
129
129
|
nodeWidth?: number;
|
|
130
130
|
nodeHeight?: number;
|
|
131
131
|
nodeColumnSpacing?: number;
|
|
132
|
+
/** Chain icon SVG markup shown before node address lines (16x16); omit to hide. */
|
|
133
|
+
chainIcon?: string;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
export declare interface RenderToStringResult {
|