From 64f896750f9c1d21ad6127646777dc57fe536edf Mon Sep 17 00:00:00 2001 From: shahghasiadil Date: Wed, 24 Nov 2021 21:35:24 +0430 Subject: [PATCH] fix: yarn build --- assets/js/fan-chart/fan-chart.js | 2 +- assets/js/fan-chart/fan-chart.min.js | 2 +- pages/fanchart/show.vue | 2 +- pages/trees/show.vue | 1247 +++++++++++++------------- 4 files changed, 643 insertions(+), 610 deletions(-) diff --git a/assets/js/fan-chart/fan-chart.js b/assets/js/fan-chart/fan-chart.js index 8e87c71b..adf90eb5 100644 --- a/assets/js/fan-chart/fan-chart.js +++ b/assets/js/fan-chart/fan-chart.js @@ -2790,7 +2790,7 @@ let compare1 = f; let compare2 = f; - if (f.length === 1) { + if (f.length !== 2) { delta = (d, x) => f(d) - x; compare1 = ascending; compare2 = (d, x) => ascending(f(d), x); diff --git a/assets/js/fan-chart/fan-chart.min.js b/assets/js/fan-chart/fan-chart.min.js index e8c1f2be..05fbae7c 100644 --- a/assets/js/fan-chart/fan-chart.min.js +++ b/assets/js/fan-chart/fan-chart.min.js @@ -1 +1 @@ -var t,e;t=this,e=function(t){var e="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var e=r(t);return(e.local?o:i)(e)}function s(){}function u(t){return null==t?s:function(){return this.querySelector(t)}}function l(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function h(){return[]}function c(t){return null==t?h:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function d(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function g(){return this.firstElementChild}var m=Array.prototype.filter;function v(){return Array.from(this.children)}function _(t){return new Array(t.length)}function y(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function w(t){return function(){return t}}function x(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}function k(t){return function(){this.removeAttribute(t)}}function E(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,e){return function(){this.setAttribute(t,e)}}function T(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function z(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function R(t){return function(){this.style.removeProperty(t)}}function D(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function O(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function B(t,e){return function(){this[t]=e}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function X(t){return t.trim().split(/^|\s+/)}function j(t){return t.classList||new G(t)}function G(t){this._node=t,this._names=X(t.getAttribute("class")||"")}function H(t,e){for(var n=j(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function st(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ft=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ft)}function gt(t){return"string"==typeof t?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],ft)}function mt(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(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())).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]}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=u(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=k&&(k=N+1);!(y=m[k])&&++k=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=N);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?R:"function"==typeof e?I:D)(t,e,null==n?"":n)):O(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?q:B)(t,e)):this.node()[t]},classed:function(t,e){var n=X(t+"");if(arguments.length<2){for(var r=j(this.node()),i=-1,o=n.length;++i{}};function _t(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function xt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--Nt}()}finally{Nt=0,function(){for(var t,e,n=Mt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Mt=e);At=t,qt(r)}(),Tt=0}}function Bt(){var t=zt.now(),e=t-St;e>1e3&&(Pt-=e,St=t)}function qt(t){Nt||(kt&&(kt=clearTimeout(kt)),t-Tt>24?(t<1/0&&(kt=setTimeout(Lt,t-zt.now()-Pt)),Et&&(Et=clearInterval(Et))):(Et||(St=zt.now(),Et=setInterval(Bt,1e3)),Nt=1,Ct(Lt)))}function Xt(t,e,n){var r=new It;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}It.prototype=Ot.prototype={constructor:It,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Rt():+n)+(null==e?0:+e),this._next||At===this||(At?At._next=this:Mt=this,At=this),this._call=t,this._time=n,qt()},stop:function(){this._call&&(this._call=null,this._time=1/0,qt())}};var jt=_t("start","end","cancel","interrupt"),Gt=[];function Ht(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var l,h,c,f;if(1!==n.state)return u();for(l in i)if((f=i[l]).name===n.name){if(3===f.state)return Xt(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return n}function Vt(t,e){var n=Ft(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ut(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function $t(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Wt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Kt(){}var Qt=.7,Zt=1/Qt,Jt="\\s*([+-]?\\d+)\\s*",te="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ee="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ne=/^#([0-9a-f]{3,8})$/,re=new RegExp("^rgb\\("+[Jt,Jt,Jt]+"\\)$"),ie=new RegExp("^rgb\\("+[ee,ee,ee]+"\\)$"),oe=new RegExp("^rgba\\("+[Jt,Jt,Jt,te]+"\\)$"),ae=new RegExp("^rgba\\("+[ee,ee,ee,te]+"\\)$"),se=new RegExp("^hsl\\("+[te,ee,ee]+"\\)$"),ue=new RegExp("^hsla\\("+[te,ee,ee,te]+"\\)$"),le={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};function he(){return this.rgb().formatHex()}function ce(){return this.rgb().formatRgb()}function fe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ne.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?de(e):3===n?new ve(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?pe(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?pe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=re.exec(t))?new ve(e[1],e[2],e[3],1):(e=ie.exec(t))?new ve(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=oe.exec(t))?pe(e[1],e[2],e[3],e[4]):(e=ae.exec(t))?pe(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=se.exec(t))?xe(e[1],e[2]/100,e[3]/100,1):(e=ue.exec(t))?xe(e[1],e[2]/100,e[3]/100,e[4]):le.hasOwnProperty(t)?de(le[t]):"transparent"===t?new ve(NaN,NaN,NaN,0):null}function de(t){return new ve(t>>16&255,t>>8&255,255&t,1)}function pe(t,e,n,r){return r<=0&&(t=e=n=NaN),new ve(t,e,n,r)}function ge(t){return t instanceof Kt||(t=fe(t)),t?new ve((t=t.rgb()).r,t.g,t.b,t.opacity):new ve}function me(t,e,n,r){return 1===arguments.length?ge(t):new ve(t,e,n,null==r?1:r)}function ve(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function _e(){return"#"+we(this.r)+we(this.g)+we(this.b)}function ye(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function we(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Me(t,e,n,r)}function be(t){if(t instanceof Me)return new Me(t.h,t.s,t.l,t.opacity);if(t instanceof Kt||(t=fe(t)),!t)return new Me;if(t instanceof Me)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new Me(a,s,u,t.opacity)}function Me(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ae(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}$t(Kt,fe,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:he,formatHex:he,formatHsl:function(){return be(this).formatHsl()},formatRgb:ce,toString:ce}),$t(ve,me,Wt(Kt,{brighter:function(t){return t=null==t?Zt:Math.pow(Zt,t),new ve(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Qt:Math.pow(Qt,t),new ve(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:_e,formatHex:_e,formatRgb:ye,toString:ye})),$t(Me,(function(t,e,n,r){return 1===arguments.length?be(t):new Me(t,e,n,null==r?1:r)}),Wt(Kt,{brighter:function(t){return t=null==t?Zt:Math.pow(Zt,t),new Me(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Qt:Math.pow(Qt,t),new Me(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),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 ve(Ae(t>=240?t-240:t+120,i,r),Ae(t,i,r),Ae(t<120?t+240:t-120,i,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(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ne=t=>()=>t;function ke(t){return 1==(t=+t)?Ee:function(e,n){return n-e?function(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)}}(e,n,t):Ne(isNaN(e)?n:e)}}function Ee(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Ne(isNaN(t)?e:t)}var Se=function t(e){var n=ke(e);function r(t,e){var r=n((t=me(t)).r,(e=me(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Ee(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Te(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Ce(n,r)})),o=Ie.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ce(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ce(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ce(t,n)},{i:s-2,x:Ce(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Yt:Vt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var gn=pt.prototype.constructor;function mn(t){return function(){this.style.removeProperty(t)}}function vn(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function _n(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&vn(t,o,n)),r}return o._value=e,o}function yn(t){return function(e){this.textContent=t.call(this,e)}}function wn(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&yn(r)),e}return r._value=t,r}var xn=0;function bn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Mn(t){return pt().transition(t)}function An(){return++xn}var Nn=pt.prototype;bn.prototype=Mn.prototype={constructor:bn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=u(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;ae?1:t>=e?0:NaN}function Tn(t){let e=t,n=t,r=t;function i(t,e,i=0,o=t.length){if(i>>1;r(t[n],e)<0?i=n+1:o=n}while(it(e)-n,n=Sn,r=(e,n)=>Sn(t(e),n)),{left:i,center:function(t,n,r=0,o=t.length){const a=i(t,n,r,o-1);return a>r&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,i=0,o=t.length){if(i>>1;r(t[n],e)<=0?i=n+1:o=n}while(i=0?(o>=Cn?10:o>=Rn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Cn?10:o>=Rn?5:o>=Dn?2:1)}function On(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ln(t){return+t}var Bn=[0,1];function qn(t){return t}function Xn(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function jn(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return ie&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?Gn:jn,i=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return c.invert=function(n){return l(e((o||(o=r(s,a.map(t),Ce)))(n)))},c.domain=function(t){return arguments.length?(a=Array.from(t,Ln),h()):a.slice()},c.range=function(t){return arguments.length?(s=Array.from(t),h()):s.slice()},c.rangeRound=function(t){return s=Array.from(t),u=Be,h()},c.clamp=function(t){return arguments.length?(l=!!t||qn,h()):l!==qn},c.interpolate=function(t){return arguments.length?(u=t,h()):u},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,h()}}function Vn(){return Yn()(qn,qn)}function Fn(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Un(t){return(t=Fn(Math.abs(t)))?t[1]:NaN}var $n,Wn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Kn(t){if(!(e=Wn.exec(t)))throw new Error("invalid format: "+t);var e;return new Qn({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Qn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Zn(t,e){var n=Fn(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Kn.prototype=Qn.prototype,Qn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Jn={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Zn(100*t,e),r:Zn,s:function(t,e){var n=Fn(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-($n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Fn(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tr(t){return t}var er,nr,rr,ir=Array.prototype.map,or=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ar(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?tr:(e=ir.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?tr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ir.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=Kn(t)).fill,n=t.align,c=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,_=t.type;"n"===_?(g=!0,_="g"):Jn[_]||(void 0===m&&(m=12),v=!0,_="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===f?i:"#"===f&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",w="$"===f?o:/[%p]/.test(_)?u:"",x=Jn[_],b=/[defgprs%]/.test(_);function M(t){var i,o,u,f=y,M=w;if("c"===_)M=x(t)+M,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==c&&(A=!1),f=(A?"("===c?c:l:"-"===c||"("===c?"":c)+f,M=("s"===_?or[8+$n/3]:"")+M+(A&&"("===c?")":""),b)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var N=f.length+t.length+M.length,k=N>1)+f+t+M+k.slice(N);break;default:t=k+f+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:c,formatPrefix:function(t,e){var n=c(((t=Kn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Un(e)/3))),i=Math.pow(10,-r),o=or[8+r/3];return function(t){return n(i*t)+o}}}}function sr(t,e,n,r){var i,o=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Cn?i*=10:o>=Rn?i*=5:o>=Dn&&(i*=2),e0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s0;){if((i=In(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function lr(){var t=Vn();return t.copy=function(){return Hn(t,lr())},On.apply(t,arguments),ur(t)}er=ar({thousands:",",grouping:[3],currency:["$",""]}),nr=er.format,rr=er.formatPrefix;const hr={capture:!0,passive:!1};function cr(t){t.preventDefault(),t.stopImmediatePropagation()}function fr(t){var e=t.document.documentElement,n=gt(t).on("dragstart.drag",cr,hr);"onselectstart"in e?n.on("selectstart.drag",cr,hr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function dr(t,e){var n=t.document.documentElement,r=gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",cr,hr),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 pr=t=>()=>t;function gr(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 mr(t,e,n){this.k=t,this.x=e,this.y=n}mr.prototype={constructor:mr,scale:function(t){return 1===t?this:new mr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new mr(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 vr=new mr(1,0,0);function _r(t){for(;!t.__zoom;)if(!(t=t.parentNode))return vr;return t.__zoom}function yr(t){t.stopImmediatePropagation()}function wr(t){t.preventDefault(),t.stopImmediatePropagation()}function xr(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function br(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).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 Mr(){return this.__zoom||vr}function Ar(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Nr(){return navigator.maxTouchPoints||"ontouchstart"in this}function kr(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Er(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Sr(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Pr)):void 0===e&&(e=Tr);for(var n,r,i,o,a,s=new Rr(t),u=[s];n=u.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)u.push(r=i[o]=new Rr(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Cr)}function Tr(t){return t.children}function Pr(t){return Array.isArray(t)?t[1]:null}function zr(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Cr(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Rr(t){this.data=t,this.depth=this.height=0,this.parent=null}function Dr(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ir(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&function(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&&(r-e)/t.value;++s=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Sr(this).eachBefore(zr)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;nBr)if(Math.abs(h*s-u*l)>Br&&i){var f=n-o,d=r-a,p=s*s+u*u,g=f*f+d*d,m=Math.sqrt(p),v=Math.sqrt(c),_=i*Math.tan((Or-Math.acos((p+c-g)/(2*m*v)))/2),y=_/v,w=_/m;Math.abs(y-1)>Br&&(this._+="L"+(t+y*l)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*f>l*d)+","+(this._x1=t+w*s)+","+(this._y1=e+w*u)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),s=n*Math.sin(r),u=t+a,l=e+s,h=1^o,c=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+u+","+l:(Math.abs(this._x1-u)>Br||Math.abs(this._y1-l)>Br)&&(this._+="L"+u+","+l),n&&(c<0&&(c=c%Lr+Lr),c>qr?this._+="A"+n+","+n+",0,1,"+h+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+h+","+(this._x1=u)+","+(this._y1=l):c>Br&&(this._+="A"+n+","+n+",0,"+ +(c>=Or)+","+h+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var Hr=Math.abs,Yr=Math.atan2,Vr=Math.cos,Fr=Math.max,Ur=Math.min,$r=Math.sin,Wr=Math.sqrt,Kr=1e-12,Qr=Math.PI,Zr=Qr/2,Jr=2*Qr;function ti(t){return t>1?0:t<-1?Qr:Math.acos(t)}function ei(t){return t>=1?Zr:t<=-1?-Zr:Math.asin(t)}function ni(t){return t.innerRadius}function ri(t){return t.outerRadius}function ii(t){return t.startAngle}function oi(t){return t.endAngle}function ai(t){return t&&t.padAngle}function si(t,e,n,r,i,o,a,s){var u=n-t,l=r-e,h=a-i,c=s-o,f=c*u-h*l;if(!(f*fP*P+z*z&&(A=k,N=E),{cx:A,cy:N,x01:-h,y01:-c,x11:A*(i/x-1),y11:N*(i/x-1)}}function li(){var t=ni,e=ri,n=Gr(0),r=null,i=ii,o=oi,a=ai,s=null;function u(){var u,l,h=+t.apply(this,arguments),c=+e.apply(this,arguments),f=i.apply(this,arguments)-Zr,d=o.apply(this,arguments)-Zr,p=Hr(d-f),g=d>f;if(s||(s=u=jr()),cKr)if(p>Jr-Kr)s.moveTo(c*Vr(f),c*$r(f)),s.arc(0,0,c,f,d,!g),h>Kr&&(s.moveTo(h*Vr(d),h*$r(d)),s.arc(0,0,h,d,f,g));else{var m,v,_=f,y=d,w=f,x=d,b=p,M=p,A=a.apply(this,arguments)/2,N=A>Kr&&(r?+r.apply(this,arguments):Wr(h*h+c*c)),k=Ur(Hr(c-h)/2,+n.apply(this,arguments)),E=k,S=k;if(N>Kr){var T=ei(N/h*$r(A)),P=ei(N/c*$r(A));(b-=2*T)>Kr?(w+=T*=g?1:-1,x-=T):(b=0,w=x=(f+d)/2),(M-=2*P)>Kr?(_+=P*=g?1:-1,y-=P):(M=0,_=y=(f+d)/2)}var z=c*Vr(_),C=c*$r(_),R=h*Vr(x),D=h*$r(x);if(k>Kr){var I,O=c*Vr(y),L=c*$r(y),B=h*Vr(w),q=h*$r(w);if(pKr?S>Kr?(m=ui(B,q,z,C,c,S,g),v=ui(O,L,R,D,c,S,g),s.moveTo(m.cx+m.x01,m.cy+m.y01),SKr&&b>Kr?E>Kr?(m=ui(R,D,O,L,h,-E,g),v=ui(z,C,B,q,h,-E,g),s.lineTo(m.cx+m.x01,m.cy+m.y01),E{let t=1;return function(e=!1){return e&&(t=0),t++}})()}get generations(){return this._generations}set generations(t){this._generations=t}get fanDegree(){return this._fanDegree}set fanDegree(t){this._fanDegree=t}get fontScale(){return this._fontScale}set fontScale(t){this._fontScale=t}get hideEmptySegments(){return this._hideEmptySegments}set hideEmptySegments(t){this._hideEmptySegments=t}get showColorGradients(){return this._showColorGradients}set showColorGradients(t){this._showColorGradients=t}get showParentMarriageDates(){return this._showParentMarriageDates}set showParentMarriageDates(t){this._showParentMarriageDates=t}get numberOfInnerCircles(){return this._numberOfInnerCircles}set numberOfInnerCircles(t){this._numberOfInnerCircles=t}get fontSize(){return this._fontSize}}const di="M",pi="F";class gi{constructor(t){this._configuration=t,this._nodes=null}init(t){let e=Sr(t,(t=>(!t.children&&t.generation{t.data.id=this._configuration.id()})),this._configuration.id(!0)}get nodes(){return this._nodes}createEmptyNode(t,e){return{id:0,xref:"",url:"",updateUrl:"",generation:t,name:"",firstNames:[],lastNames:[],preferredName:"",alternativeNames:[],isAltRtl:!1,sex:e,timespan:"",color:this._configuration.defaultColor,colors:[[],[]]}}}class mi{constructor(t){this._element=t.append("div").attr("class","overlay").style("opacity",1e-6)}show(t,e=0,n=null){this._element.select("p").remove(),this._element.append("p").attr("class","tooltip").text(t),this._element.transition().duration(e).style("opacity",1).on("end",(()=>{"function"==typeof n&&n()}))}hide(t=0,e=0){this._element.transition().delay(t).duration(e).style("opacity",1e-6)}get(){return this._element}}class vi{constructor(t){this._element=t.append("defs")}get(){return this._element}}class _i{constructor(t){this._zoom=null,this._parent=t,this.init()}init(){this._zoom=function(){var t,e,n,r=xr,i=br,o=kr,a=Ar,s=Nr,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],h=250,c=Ue,f=_t("start","zoom","end"),d=500,p=0,g=10;function m(t){t.property("__zoom",Mr).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",N).filter(s).on("touchstart.zoom",k).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new mr(e,t.x,t.y)}function _(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new mr(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=x(t,o).event(r),s=i.apply(t,o),u=null==n?y(s):"function"==typeof n?n.apply(t,o):n,l=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),h=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=c(h.invert(u).concat(l/h.k),f.invert(u).concat(l/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=l/e[2];t=new mr(n,u[0]-e[0]*n,u[1]-e[1]*n)}a.zoom(null,t)}}))}function x(t,e,n){return!n&&t.__zooming||new b(t,e)}function b(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function M(t,...e){if(r.apply(this,arguments)){var n=x(this,e).event(t),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),h=mt(t);if(n.wheel)n.mouse[0][0]===h[0]&&n.mouse[0][1]===h[1]||(n.mouse[1]=i.invert(n.mouse[0]=h)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[h,i.invert(h)],Ut(this),n.start()}wr(t),n.wheel=setTimeout(c,150),n.zoom("mouse",o(_(v(i,s),n.mouse[0],n.mouse[1]),n.extent,l))}function c(){n.wheel=null,n.end()}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=x(this,e,!0).event(t),s=gt(t.view).on("mousemove.zoom",f,!0).on("mouseup.zoom",d,!0),u=mt(t,i),h=t.clientX,c=t.clientY;fr(t.view),yr(t),a.mouse=[u,this.__zoom.invert(u)],Ut(this),a.start()}function f(t){if(wr(t),!a.moved){var e=t.clientX-h,n=t.clientY-c;a.moved=e*e+n*n>p}a.event(t).zoom("mouse",o(_(a.that.__zoom,a.mouse[0]=mt(t,i),a.mouse[1]),a.extent,l))}function d(t){s.on("mousemove.zoom mouseup.zoom",null),dr(t.view,a.moved),wr(t),a.event(t).end()}}function N(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=mt(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),u=n.k*(t.shiftKey?.5:2),c=o(_(v(n,u),a,s),i.apply(this,e),l);wr(t),h>0?gt(this).transition().duration(h).call(w,c,a,t):gt(this).call(m.transform,c,a,t)}}function k(n,...i){if(r.apply(this,arguments)){var o,a,s,u,l=n.touches,h=l.length,c=x(this,i,n.changedTouches.length===h).event(n);for(yr(n),a=0;a{t.sourceEvent&&"touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length<2||this._parent.attr("transform",t.transform)})),this._zoom.wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002))),this._zoom.filter((t=>{if("wheel"===t.type){if(!t.ctrlKey)return!1;var e=_r(this);if(e.k){if(e.k<=.5&&t.deltaY>0)return t.preventDefault(),!1;if(e.k>=5&&t.deltaY<0)return t.preventDefault(),!1}return!0}return t.button||"touchmove"!==t.type?!(t.ctrlKey&&"wheel"!==t.type||t.button):2===t.touches.length}))}get(){return this._zoom}}class yi{constructor(t){this._element=t,this._element.append("filter").attr("id","drop-shadow").append("feDropShadow").attr("stdDeviation","7 7").attr("dx","0").attr("dy","0").attr("flood-opacity","0.3").attr("flood-color","rgb(0,0,0)")}get(){return this._element}}class wi{triggerDownload(t,e){let n=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),r=document.createElement("a");r.setAttribute("download",e),r.setAttribute("href",t),r.setAttribute("target","_blank"),r.dispatchEvent(n)}}class xi extends wi{copyStylesInline(t,e){let n=["svg","g","text","textPath"];for(let r=0;r{let i=(new XMLSerializer).serializeToString(t),o=window.URL||window.webkitURL||window,a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),s=o.createObjectURL(a),u=new Image;u.onload=()=>{let t=this.createCanvas(e,n),i=t.getContext("2d");i.fillStyle="rgb(255,255,255)",i.fillRect(0,0,t.width,t.height),i.drawImage(u,0,0),o.revokeObjectURL(s);let a=t.toDataURL("image/png").replace("image/png","image/octet-stream");r(a)},u.src=s}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e){const n=[3508,2480];this.cloneSvg(t.get().node()).then((r=>{this.copyStylesInline(t.get().node(),r);const i=this.calculateViewBox(t.get().node()),o=Math.max(n[0],i[2]),a=Math.max(n[1],i[3]);r.setAttribute("width",o),r.setAttribute("height",a),r.setAttribute("viewBox",i),this.convertToDataUrl(r,o,a).then((t=>this.triggerDownload(t,e))).catch((()=>{console.log("Failed to save chart as PNG image")}))}))}}class bi extends wi{copyStylesInline(t,e){return new Promise((n=>{(function(t,e){return fetch(t,e).then(hi)})(t).then((t=>{t=t.replace(/#webtrees-fan-chart-container /g,"");let r=document.createElementNS("http://www.w3.org/2000/svg","style");r.appendChild(document.createTextNode(t)),e.prepend(r),n(e)}))}))}convertToObjectUrl(t){return new Promise((e=>{let n=(new XMLSerializer).serializeToString(t),r=window.URL||window.webkitURL||window,i=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=r.createObjectURL(i),a=new Image;a.onload=()=>{e(o)},a.src=o}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e,n){this.cloneSvg(t.get().node()).then((t=>this.copyStylesInline(e,t))).then((t=>this.convertToObjectUrl(t))).then((t=>this.triggerDownload(t,n))).catch((()=>{console.log("Failed to save chart as SVG image")}))}}class Mi{constructor(){this._exportClass=null}setExportClass(t){switch(t){case"png":this._exportClass=xi;break;case"svg":this._exportClass=bi}}createExport(t){switch(this.setExportClass(t),t){case"png":case"svg":return new this._exportClass}}}class Ai{constructor(t,e){this._element=t.append("svg"),this._defs=new vi(this._element),this._visual=null,this._zoom=null,this._div=null,this._configuration=e,this.init()}init(){this._element.attr("width","100%").attr("height","100%").attr("text-rendering","geometricPrecision").attr("text-anchor","middle").attr("xmlns:xlink","https://www.w3.org/1999/xlink"),new yi(this._defs.get())}initEvents(t){this._element.on("contextmenu",(t=>t.preventDefault())).on("wheel",(e=>{e.ctrlKey||t.show(this._configuration.labels.zoom,300,(()=>{t.hide(700,800)}))})).on("touchend",(e=>{e.touches.length<2&&t.hide(0,800)})).on("touchmove",(e=>{e.touches.length>=2?t.hide():t.show(this._configuration.labels.move)})).on("click",(t=>this.doStopPropagation(t)),!0),this._configuration.rtl&&this._element.classed("rtl",!0);const e=gt("div.tooltip");e.empty()?this._div=gt("body").append("div").attr("class","tooltip").style("opacity",0):this._div=e.style("opacity",0),this._visual=this._element.append("g"),this._visual.append("g").attr("class","personGroup"),this._zoom=new _i(this._visual),this._element.call(this._zoom.get())}doStopPropagation(t){t.defaultPrevented&&t.stopPropagation()}export(t){return(new Mi).createExport(t)}get defs(){return this._defs}get zoom(){return this._zoom}get visual(){return this._visual}get(){return this._element}get div(){return this._div}}const Ni=Math.PI/180,ki=180/Math.PI,Ei=2*Math.PI;class Si{constructor(t){this._configuration=t}get startPi(){return 90===this._configuration.fanDegree?0:-this._configuration.fanDegree/2*Ni}get endPi(){return 90===this._configuration.fanDegree?this._configuration.fanDegree*Ni:this._configuration.fanDegree/2*Ni}get scale(){return lr().range([this.startPi,this.endPi])}innerRadius(t){return 0===t?0:t<=this._configuration.numberOfInnerCircles?(t-1)*this._configuration.innerArcHeight+this._configuration.centerCircleRadius+this._configuration.circlePadding:this._configuration.numberOfInnerCircles*this._configuration.innerArcHeight+(t-this._configuration.numberOfInnerCircles-1)*this._configuration.outerArcHeight+this._configuration.centerCircleRadius+this._configuration.circlePadding}outerRadius(t){return 0===t?this._configuration.centerCircleRadius:t<=this._configuration.numberOfInnerCircles?(t-1)*this._configuration.innerArcHeight+this._configuration.centerCircleRadius+this._configuration.innerArcHeight:this._configuration.numberOfInnerCircles*this._configuration.innerArcHeight+(t-this._configuration.numberOfInnerCircles-1)*this._configuration.outerArcHeight+this._configuration.centerCircleRadius+this._configuration.outerArcHeight}centerRadius(t){return(this.innerRadius(t)+this.outerRadius(t))/2}relativeRadius(t,e){const n=this.outerRadius(t);return n-(100-e)*(n-this.innerRadius(t))/100}calcAngle(t){return Math.max(this.startPi,Math.min(this.endPi,this.scale(t)))}startAngle(t,e){return 0===t?0:this.calcAngle(e)}endAngle(t,e){return 0===t?Ei:this.calcAngle(e)}arcLength(t,e){return(this.endAngle(t.depth,t.x1)-this.startAngle(t.depth,t.x0))*this.relativeRadius(t.depth,e)}}class Ti{constructor(t,e){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration)}createLabels(t,e){if(this.isInnerLabel(e)){let n=this.createTextElement(t,e),r=gt(t.node().parentNode).attr("id"),i=this.createPathDefinition(r,0,e),o=this.createTextPath(n,i);this.addFirstNames(o,e),this.truncateNames(o,e,0);let a=this.createPathDefinition(r,1,e),s=this.createTextPath(n,a);if(this.addLastNames(s,e),this.truncateNames(s,e,1),e.data.alternativeNames.length>0){let t=this.createPathDefinition(r,2,e),i=this.createTextPath(n,t).attr("class","alternativeName").classed("rtl",e.data.isAltRtl);this.addAlternativeNames(i,e),this.truncateNames(i,e,2)}let u=this.createPathDefinition(r,3,e),l=this.createTextPath(n,u).attr("class","date");this.addTimeSpan(l,e)}else{if(e.depth>=7){let n=this.createTextElement(t,e).attr("dy","2px");this.addFirstNames(n,e),this.addLastNames(n,e,.25),this.truncateNames(n,e,0)}if(e.depth<7){let n=this.createTextElement(t,e).attr("dy","2px");this.addFirstNames(n,e),this.truncateNames(n,e,0);let r=this.createTextElement(t,e).attr("dy","2px");if(this.addLastNames(r,e),this.truncateNames(r,e,1),e.depth<6){let n=this.createTextElement(t,e).attr("class","date").attr("dy","2px");this.addTimeSpan(n,e)}}this.transformOuterText(t,e)}if(this._configuration.showParentMarriageDates&&e.children&&e.depth<5){let n=this.createTextElement(t,e),r=gt(t.node().parentNode).attr("id"),i=this.createPathDefinition(r,4,e),o=this.createTextPath(n,i).attr("class","marriage-date");this.addMarriageDate(o,e)}}addFirstNames(t,e){let n=0;for(let r of e.data.firstNames){let i=t.append("tspan").text(r);r===e.data.preferredName&&i.attr("class","preferred"),0!==n&&i.attr("dx","0.25em"),++n}}addLastNames(t,e,n=0){let r=0;for(let i of e.data.lastNames){let e=t.append("tspan").attr("class","lastName").text(i);0!==r&&e.attr("dx","0.25em"),0!==n&&e.attr("dx",n+"em"),++r}}addAlternativeNames(t,e,n=0){let r=0;for(let n of e.data.alternativeNames){let i=t.append("tspan").text(n);0!==r&&i.attr("dx",(e.data.isAltRtl?-.25:.25)+"em"),++r}}addTimeSpan(t,e){t.append("tspan").text(e.data.timespan)}addMarriageDate(t,e){e.data.parentMarriage&&t.append("tspan").text("⚭ "+e.data.parentMarriage)}truncateNames(t,e,n,r=!1){let i=this.getAvailableWidth(e,n),o=t.selectAll("tspan:not(.preferred):not(.lastName)");o.size()&&o.nodes().reverse().forEach((e=>{gt(e).each(this.truncateText(t,i,r))})),t.selectAll("tspan.preferred").each(this.truncateText(t,i,r)),t.selectAll("tspan.lastName").each(this.truncateText(t,i,r))}getTextLength(t){let e=0;return t.selectAll("tspan").each((function(){e+=this.getComputedTextLength()})),e}truncateText(t,e,n=!1){let r=this;return function(){let i=r.getTextLength(t),o=gt(this),a=o.text();i>e&&(n?o.text(""):a.length>1&&o.text(a.slice(0,1)+"."))}}isInnerLabel(t){return t.depth>0&&t.depth<=this._configuration.numberOfInnerCircles}createTextElement(t,e){return t.append("text")}createTextPath(t,e){return t.append("textPath").attr("xlink:href","#"+e).attr("startOffset","25%")}createPathDefinition(t,e,n){let r="path-"+t+"-"+e;if(this._svg.defs.get().select("path#"+r).node())return r;let i=this.isPositionFlipped(n.depth,n.x0,n.x1),o=this._geometry.startAngle(n.depth,n.x0),a=this._geometry.endAngle(n.depth,n.x1),s=this._geometry.relativeRadius(n.depth,this.getTextOffset(i,e));this._configuration.showParentMarriageDates&&4===e&&n.depth<1&&(o=this._geometry.calcAngle(n.x0),a=this._geometry.calcAngle(n.x1));let u=li().startAngle(i?a:o).endAngle(i?o:a).innerRadius(s).outerRadius(s);return u.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius).cornerRadius(this._configuration.cornerRadius),this._svg.defs.get().append("path").attr("id",r).attr("d",u),r}isPositionFlipped(t,e,n){if(360!==this._configuration.fanDegree||t<=1)return!1;const r=this._geometry.startAngle(t,e),i=this._geometry.endAngle(t,n);return r>=90*Ni&&i<=180*Ni||r>=-180*Ni&&i<=-90*Ni}getTextOffset(t,e){return t?[23,42,61,84,125][e]:[73,54,35,12,120][e]}getAvailableWidth(t,e){if(t.depth>this._configuration.numberOfInnerCircles)return this._configuration.outerArcHeight-2*this._configuration.textPadding-this._configuration.circlePadding;let n=2*this._configuration.centerCircleRadius-.15*this._configuration.centerCircleRadius;if(t.depth>=1){let r=this.isPositionFlipped(t.depth,t.x0,t.x1);n=this._geometry.arcLength(t,this.getTextOffset(r,e))}return n-2*this._configuration.textPadding-this._configuration.padDistance/2}transformOuterText(t,e){let n=this,r=t.selectAll("text"),i=r.size(),o=1;switch(e.depth){case 0:case 5:o=1.5;break;case 1:o=6.5;break;case 2:o=3.5;break;case 3:o=2.2;break;case 4:o=1.9;break;case 6:o=.5}let a=lr().domain([0,i-1]).range([-o,o]);r.each((function(t,r){const i=a(r)*n._configuration.fontScale/100;0===e.depth?gt(this).attr("dy",14*i+7+"px"):gt(this).attr("transform",(function(){let t=e.x1-e.x0,r=n._geometry.scale(e.x0+t/2)*ki,o=r-i*(r>0?-1:1),a=n._geometry.centerRadius(e.depth)-n._configuration.colorArcWidth/2;return r>0?o-=90:(a=-a,o+=90),"rotate("+o+") translate("+a+")"}))}))}}class Pi{constructor(t,e,n,r){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration),this.init(n,r)}init(t,e){if(t.classed("new")&&this._configuration.hideEmptySegments?this.addArcToPerson(t,e):t.classed("new")||t.classed("update")||t.classed("remove")||""===e.data.xref&&this._configuration.hideEmptySegments||this.addArcToPerson(t,e),""!==e.data.xref){this.addTitleToPerson(t,e.data.name);let n=new Ti(this._svg,this._configuration),r=this.addLabelToPerson(t,e);n.createLabels(r,e),this.addColorGroup(t,e),t.on("contextmenu",((t,e)=>{this._svg.div.property("active")?(this._svg.div.transition().duration(200).style("opacity",0),this._svg.div.property("active",!1),t.preventDefault()):(this._svg.div.property("active",!0),this.setTooltipHtml(e),t.preventDefault())})).on("mouseenter",((t,e)=>{""===e.data.xref&&this._svg.div.style("opacity",0),this.setTooltipHtml(e)})).on("mouseleave",((t,e)=>{""===e.data.xref&&this._svg.div.style("opacity",0)})).on("mousemove",((t,e)=>{this._svg.div.style("left",t.pageX+"px").style("top",t.pageY-30+"px")})).on("mouseover",(function(e,n){const r=t.nodes(),i=r.indexOf(this);gt(r[i]).classed("hover",!0).raise()})).on("mouseout",(function(e,n){const r=t.nodes(),i=r.indexOf(this);gt(r[i]).classed("hover",!1)}))}}setTooltipHtml(t){if(""===t.data.xref)return;const e=t.data.thumbnail?'':'',n=t.data.birth||t.data.marriage||t.data.death;this._svg.div.html('
'+e+'
'+t.data.name+"
"+(n?""+(t.data.birth?'":"")+(t.data.marriage?'":"")+(t.data.death?'":"")+"
'+t.data.birth+"
'+t.data.marriage+"
'+t.data.death+"
":"")).style("left",event.pageX+"px").style("top",event.pageY-30+"px"),this._svg.div.property("active")&&this._svg.div.transition().duration(200).style("opacity",1)}addColorGroup(t,e){let n=li().startAngle(this._geometry.startAngle(e.depth,e.x0)).endAngle(this._geometry.endAngle(e.depth,e.x1)).innerRadius(this._geometry.outerRadius(e.depth)-this._configuration.colorArcWidth).outerRadius(this._geometry.outerRadius(e.depth)+1);n.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius),t.append("g").attr("class","color").append("path").attr("fill",(()=>this._configuration.showColorGradients?e.depth?"url(#grad-"+e.data.id+")":"rgb(225, 225, 225)":e.data.color)).attr("d",n)}addArcToPerson(t,e){let n=li().startAngle(this._geometry.startAngle(e.depth,e.x0)).endAngle(this._geometry.endAngle(e.depth,e.x1)).innerRadius(this._geometry.innerRadius(e.depth)).outerRadius(this._geometry.outerRadius(e.depth));n.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius).cornerRadius(this._configuration.cornerRadius);let r=t.append("g").attr("class","arc").append("path").attr("d",n);t.classed("new")&&r.style("opacity",1e-6)}addTitleToPerson(t,e){t.insert("title",":first-child").text(e)}addLabelToPerson(t,e){return t.append("g").attr("class","name").style("font-size",this.getFontSize(e)+"px").style("fill",this._configuration.fontColor)}getFontSize(t){let e=this._configuration.fontSize;return t.depth>=this._configuration.numberOfInnerCircles+1&&(e+=1),(e-t.depth)*this._configuration.fontScale/100}}class zi{constructor(t,e){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration)}init(t){if(t.depth<1)return;if(1===t.depth){let e=[64,143,222],n=[161,219,117];t.data.sex===pi&&(e=[218,102,13],n=[235,201,33]),t.data.colors=[e,n]}else{let e=[Math.ceil((t.parent.data.colors[0][0]+t.parent.data.colors[1][0])/2),Math.ceil((t.parent.data.colors[0][1]+t.parent.data.colors[1][1])/2),Math.ceil((t.parent.data.colors[0][2]+t.parent.data.colors[1][2])/2)];t.data.sex===di&&(t.data.colors[0]=t.parent.data.colors[0],t.data.colors[1]=e),t.data.sex===pi&&(t.data.colors[0]=e,t.data.colors[1]=t.parent.data.colors[1])}let e=this._svg.defs.get().append("svg:linearGradient").attr("id","grad-"+t.data.id);e.append("svg:stop").attr("offset","0%").attr("stop-color","rgb("+t.data.colors[0].join(",")+")"),e.append("svg:stop").attr("offset","100%").attr("stop-color","rgb("+t.data.colors[1].join(",")+")")}}class Ci{constructor(t,e,n){this._svg=t,this._configuration=e,this._hierarchy=n}update(t,e){let n=this;this._svg.get().selectAll("g.person").classed("hover",!1).on("click",null).on("mouseover",null).on("mouseout",null),function(t,e){return fetch(t,e).then(ci)}(t).then((t=>{this._hierarchy.init(t),this._svg.get().selectAll("g.person").data(this._hierarchy.nodes,(t=>t.data.id)).each((function(t){let e=""===t.data.xref,r=gt(this);r.classed("remove",e).classed("update",!e&&r.classed("available")).classed("new",!e&&!r.classed("available")),r.classed("new")||r.selectAll("g.name, g.color, title").classed("old",!0),new Pi(n._svg,n._configuration,r,t)})),this._svg.get().selectAll("g.person:not(.remove)").selectAll("g.name:not(.old), g.color:not(.old)").style("opacity",1e-6);let r=Mn().duration(this._configuration.updateDuration).call(this.endAll,(()=>this.updateDone(e)));this._svg.get().selectAll("g.person.remove g.arc path").transition(r).style("fill",(()=>this._configuration.hideEmptySegments?null:"rgb(235, 235, 235)")).style("opacity",(()=>this._configuration.hideEmptySegments?1e-6:null)),this._svg.get().selectAll("g.person.new g.arc path").transition(r).style("fill","rgb(250, 250, 250)").style("opacity",(()=>this._configuration.hideEmptySegments?1:null)),this._svg.get().selectAll("g.person.update, g.person.remove").selectAll("g.name.old, g.color.old").transition(r).style("opacity",1e-6),this._svg.get().selectAll("g.person:not(.remove)").selectAll("g.name:not(.old), g.color:not(.old)").transition(r).style("opacity",1)}))}updateDone(t){this._configuration.hideEmptySegments&&this._svg.get().selectAll("g.person.remove").selectAll("g.arc").remove();let e=Ot((()=>{this._svg.get().selectAll("g.person g.arc path").attr("style",null),this._svg.get().selectAll("g.person g.name, g.person g.color").style("opacity",null),e.stop()}),10);this._svg.get().selectAll("g.person.new, g.person.update, g.person.remove").classed("new",!1).classed("update",!1).classed("remove",!1).selectAll("g.name.old, g.color.old, title.old").remove(),this._svg.get().selectAll("g.person.available").classed("available",!1),t()}endAll(t,e){let n=0;t.on("start",(()=>++n)).on("end",(()=>{--n||e.apply(t)}))}}class Ri{constructor(t,e){this._configuration=e,this._parent=t,this._hierarchy=new gi(this._configuration),this._data={}}get svg(){return this._svg}updateViewBox(){let t=this._svg.visual.node().getBBox(),e=this._parent.node().getBoundingClientRect(),n=Math.max(e.width,t.width),r=Math.max(e.height,t.height,500),i=(n-t.width)/2,o=(r-t.height)/2,a=Math.ceil(t.x-i-10),s=Math.ceil(t.y-o-10);n=Math.ceil(n+20),r=Math.ceil(r+20),this._svg.get().attr("viewBox",[a,s,n,r])}get data(){return this._data}set data(t){this._data=t,this._hierarchy.init(this._data)}draw(){this._parent.html(""),this._svg=new Ai(this._parent,this._configuration),this._overlay=new mi(this._parent),this._svg.initEvents(this._overlay);let t=this._svg.get().select("g.personGroup"),e=new zi(this._svg,this._configuration),n=this;t.selectAll("g.person").data(this._hierarchy.nodes,(t=>t.data.id)).enter().append("g").attr("class","person").attr("id",(t=>"person-"+t.data.id)),t.selectAll("g.person").each((function(t){let r=gt(this);n._configuration.showColorGradients&&e.init(t),new Pi(n._svg,n._configuration,r,t)})),this.bindClickEventListener(),this.updateViewBox()}bindClickEventListener(){this._svg.get().select("g.personGroup").selectAll("g.person").filter((t=>""!==t.data.xref)).classed("available",!0).on("click",this.personClick.bind(this))}personClick(t,e){0===e.depth?this.redirectToIndividual(e.data.url):this.update(e.data.updateUrl)}redirectToIndividual(t){window.location=t}update(t){new Ci(this._svg,this._configuration,this._hierarchy).update(t,(()=>this.bindClickEventListener()))}}t.FanChart=class{constructor(t,e){this._selector=t,this._parent=gt(this._selector),this._configuration=new fi(e.labels,e.generations,e.fanDegree,e.defaultColor,e.fontScale,e.fontColor,e.hideEmptySegments,e.showColorGradients,e.showParentMarriageDates,e.rtl,e.innerArcs),this._chart=new Ri(this._parent,this._configuration),this.init()}init(){gt("#centerButton").on("click",(()=>this.center())),gt("#exportPNG").on("click",(()=>this.exportPNG())),gt("#exportSVG").on("click",(()=>this.exportSVG()))}center(){this._chart.svg.get().transition().duration(750).call(this._chart.svg.zoom.get().transform,vr)}get configuration(){return this._configuration}set cssFile(t){this._cssFile=t}draw(t){this._chart.data=t,this._chart.draw()}exportPNG(){this._chart.svg.export("png").svgToImage(this._chart.svg,"fan-chart.png")}exportSVG(){this._chart.svg.export("svg").svgToImage(this._chart.svg,this._cssFile,"fan-chart.svg")}},t.Storage=class{constructor(t){this._name=t,this._storage=JSON.parse(localStorage.getItem(this._name))||{}}register(t){let e=document.getElementById(t),n=this.read(t);n?e.type&&"checkbox"===e.type?e.checked=n:e.value=n:this.onInput(e),e.addEventListener("input",(t=>{this.onInput(t.target)}))}onInput(t){t.type&&"checkbox"===t.type?this.write(t.name,t.checked):this.write(t.name,t.value)}read(t){return this._storage[t]}write(t,e){this._storage[t]=e,localStorage.setItem(this._name,JSON.stringify(this._storage))}},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WebtreesFanChart={}); +var t,e;t=this,e=function(t){var e="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var e=r(t);return(e.local?o:i)(e)}function s(){}function u(t){return null==t?s:function(){return this.querySelector(t)}}function l(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function h(){return[]}function c(t){return null==t?h:function(){return this.querySelectorAll(t)}}function f(t){return function(){return this.matches(t)}}function d(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function g(){return this.firstElementChild}var m=Array.prototype.filter;function v(){return Array.from(this.children)}function _(t){return new Array(t.length)}function y(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function w(t){return function(){return t}}function x(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}function k(t){return function(){this.removeAttribute(t)}}function E(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,e){return function(){this.setAttribute(t,e)}}function T(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function P(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function z(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function R(t){return function(){this.style.removeProperty(t)}}function D(t,e,n){return function(){this.style.setProperty(t,e,n)}}function I(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function O(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function L(t){return function(){delete this[t]}}function B(t,e){return function(){this[t]=e}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function X(t){return t.trim().split(/^|\s+/)}function j(t){return t.classList||new G(t)}function G(t){this._node=t,this._names=X(t.getAttribute("class")||"")}function H(t,e){for(var n=j(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function st(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ft=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ft)}function gt(t){return"string"==typeof t?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],ft)}function mt(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(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())).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]}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=u(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=k&&(k=N+1);!(y=m[k])&&++k=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=N);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?R:"function"==typeof e?I:D)(t,e,null==n?"":n)):O(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?L:"function"==typeof e?q:B)(t,e)):this.node()[t]},classed:function(t,e){var n=X(t+"");if(arguments.length<2){for(var r=j(this.node()),i=-1,o=n.length;++i{}};function _t(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function xt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--Nt}()}finally{Nt=0,function(){for(var t,e,n=Mt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Mt=e);At=t,qt(r)}(),Tt=0}}function Bt(){var t=zt.now(),e=t-St;e>1e3&&(Pt-=e,St=t)}function qt(t){Nt||(kt&&(kt=clearTimeout(kt)),t-Tt>24?(t<1/0&&(kt=setTimeout(Lt,t-zt.now()-Pt)),Et&&(Et=clearInterval(Et))):(Et||(St=zt.now(),Et=setInterval(Bt,1e3)),Nt=1,Ct(Lt)))}function Xt(t,e,n){var r=new It;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}It.prototype=Ot.prototype={constructor:It,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Rt():+n)+(null==e?0:+e),this._next||At===this||(At?At._next=this:Mt=this,At=this),this._call=t,this._time=n,qt()},stop:function(){this._call&&(this._call=null,this._time=1/0,qt())}};var jt=_t("start","end","cancel","interrupt"),Gt=[];function Ht(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var l,h,c,f;if(1!==n.state)return u();for(l in i)if((f=i[l]).name===n.name){if(3===f.state)return Xt(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return n}function Vt(t,e){var n=Ft(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ut(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function $t(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Wt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Kt(){}var Qt=.7,Zt=1/Qt,Jt="\\s*([+-]?\\d+)\\s*",te="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ee="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ne=/^#([0-9a-f]{3,8})$/,re=new RegExp("^rgb\\("+[Jt,Jt,Jt]+"\\)$"),ie=new RegExp("^rgb\\("+[ee,ee,ee]+"\\)$"),oe=new RegExp("^rgba\\("+[Jt,Jt,Jt,te]+"\\)$"),ae=new RegExp("^rgba\\("+[ee,ee,ee,te]+"\\)$"),se=new RegExp("^hsl\\("+[te,ee,ee]+"\\)$"),ue=new RegExp("^hsla\\("+[te,ee,ee,te]+"\\)$"),le={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};function he(){return this.rgb().formatHex()}function ce(){return this.rgb().formatRgb()}function fe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ne.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?de(e):3===n?new ve(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?pe(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?pe(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=re.exec(t))?new ve(e[1],e[2],e[3],1):(e=ie.exec(t))?new ve(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=oe.exec(t))?pe(e[1],e[2],e[3],e[4]):(e=ae.exec(t))?pe(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=se.exec(t))?xe(e[1],e[2]/100,e[3]/100,1):(e=ue.exec(t))?xe(e[1],e[2]/100,e[3]/100,e[4]):le.hasOwnProperty(t)?de(le[t]):"transparent"===t?new ve(NaN,NaN,NaN,0):null}function de(t){return new ve(t>>16&255,t>>8&255,255&t,1)}function pe(t,e,n,r){return r<=0&&(t=e=n=NaN),new ve(t,e,n,r)}function ge(t){return t instanceof Kt||(t=fe(t)),t?new ve((t=t.rgb()).r,t.g,t.b,t.opacity):new ve}function me(t,e,n,r){return 1===arguments.length?ge(t):new ve(t,e,n,null==r?1:r)}function ve(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function _e(){return"#"+we(this.r)+we(this.g)+we(this.b)}function ye(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"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))+(1===t?")":", "+t+")")}function we(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Me(t,e,n,r)}function be(t){if(t instanceof Me)return new Me(t.h,t.s,t.l,t.opacity);if(t instanceof Kt||(t=fe(t)),!t)return new Me;if(t instanceof Me)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new Me(a,s,u,t.opacity)}function Me(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ae(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}$t(Kt,fe,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:he,formatHex:he,formatHsl:function(){return be(this).formatHsl()},formatRgb:ce,toString:ce}),$t(ve,me,Wt(Kt,{brighter:function(t){return t=null==t?Zt:Math.pow(Zt,t),new ve(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Qt:Math.pow(Qt,t),new ve(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:_e,formatHex:_e,formatRgb:ye,toString:ye})),$t(Me,(function(t,e,n,r){return 1===arguments.length?be(t):new Me(t,e,n,null==r?1:r)}),Wt(Kt,{brighter:function(t){return t=null==t?Zt:Math.pow(Zt,t),new Me(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Qt:Math.pow(Qt,t),new Me(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),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 ve(Ae(t>=240?t-240:t+120,i,r),Ae(t,i,r),Ae(t<120?t+240:t-120,i,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(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ne=t=>()=>t;function ke(t){return 1==(t=+t)?Ee:function(e,n){return n-e?function(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)}}(e,n,t):Ne(isNaN(e)?n:e)}}function Ee(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Ne(isNaN(t)?e:t)}var Se=function t(e){var n=ke(e);function r(t,e){var r=n((t=me(t)).r,(e=me(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Ee(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Te(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Ce(n,r)})),o=Ie.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ce(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ce(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ce(t,n)},{i:s-2,x:Ce(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Yt:Vt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var gn=pt.prototype.constructor;function mn(t){return function(){this.style.removeProperty(t)}}function vn(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function _n(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&vn(t,o,n)),r}return o._value=e,o}function yn(t){return function(e){this.textContent=t.call(this,e)}}function wn(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&yn(r)),e}return r._value=t,r}var xn=0;function bn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Mn(t){return pt().transition(t)}function An(){return++xn}var Nn=pt.prototype;bn.prototype=Mn.prototype={constructor:bn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=u(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;ae?1:t>=e?0:NaN}function Tn(t){let e=t,n=t,r=t;function i(t,e,i=0,o=t.length){if(i>>1;r(t[n],e)<0?i=n+1:o=n}while(it(e)-n,n=Sn,r=(e,n)=>Sn(t(e),n)),{left:i,center:function(t,n,r=0,o=t.length){const a=i(t,n,r,o-1);return a>r&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,i=0,o=t.length){if(i>>1;r(t[n],e)<=0?i=n+1:o=n}while(i=0?(o>=Cn?10:o>=Rn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Cn?10:o>=Rn?5:o>=Dn?2:1)}function On(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ln(t){return+t}var Bn=[0,1];function qn(t){return t}function Xn(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function jn(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return ie&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?Gn:jn,i=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return c.invert=function(n){return l(e((o||(o=r(s,a.map(t),Ce)))(n)))},c.domain=function(t){return arguments.length?(a=Array.from(t,Ln),h()):a.slice()},c.range=function(t){return arguments.length?(s=Array.from(t),h()):s.slice()},c.rangeRound=function(t){return s=Array.from(t),u=Be,h()},c.clamp=function(t){return arguments.length?(l=!!t||qn,h()):l!==qn},c.interpolate=function(t){return arguments.length?(u=t,h()):u},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,h()}}function Vn(){return Yn()(qn,qn)}function Fn(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Un(t){return(t=Fn(Math.abs(t)))?t[1]:NaN}var $n,Wn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Kn(t){if(!(e=Wn.exec(t)))throw new Error("invalid format: "+t);var e;return new Qn({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Qn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Zn(t,e){var n=Fn(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Kn.prototype=Qn.prototype,Qn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Jn={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Zn(100*t,e),r:Zn,s:function(t,e){var n=Fn(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-($n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Fn(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tr(t){return t}var er,nr,rr,ir=Array.prototype.map,or=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ar(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?tr:(e=ir.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?tr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ir.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=Kn(t)).fill,n=t.align,c=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,_=t.type;"n"===_?(g=!0,_="g"):Jn[_]||(void 0===m&&(m=12),v=!0,_="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===f?i:"#"===f&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",w="$"===f?o:/[%p]/.test(_)?u:"",x=Jn[_],b=/[defgprs%]/.test(_);function M(t){var i,o,u,f=y,M=w;if("c"===_)M=x(t)+M,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==c&&(A=!1),f=(A?"("===c?c:l:"-"===c||"("===c?"":c)+f,M=("s"===_?or[8+$n/3]:"")+M+(A&&"("===c?")":""),b)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var N=f.length+t.length+M.length,k=N>1)+f+t+M+k.slice(N);break;default:t=k+f+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:c,formatPrefix:function(t,e){var n=c(((t=Kn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Un(e)/3))),i=Math.pow(10,-r),o=or[8+r/3];return function(t){return n(i*t)+o}}}}function sr(t,e,n,r){var i,o=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Cn?i*=10:o>=Rn?i*=5:o>=Dn&&(i*=2),e0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s0;){if((i=In(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function lr(){var t=Vn();return t.copy=function(){return Hn(t,lr())},On.apply(t,arguments),ur(t)}er=ar({thousands:",",grouping:[3],currency:["$",""]}),nr=er.format,rr=er.formatPrefix;const hr={capture:!0,passive:!1};function cr(t){t.preventDefault(),t.stopImmediatePropagation()}function fr(t){var e=t.document.documentElement,n=gt(t).on("dragstart.drag",cr,hr);"onselectstart"in e?n.on("selectstart.drag",cr,hr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function dr(t,e){var n=t.document.documentElement,r=gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",cr,hr),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 pr=t=>()=>t;function gr(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 mr(t,e,n){this.k=t,this.x=e,this.y=n}mr.prototype={constructor:mr,scale:function(t){return 1===t?this:new mr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new mr(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 vr=new mr(1,0,0);function _r(t){for(;!t.__zoom;)if(!(t=t.parentNode))return vr;return t.__zoom}function yr(t){t.stopImmediatePropagation()}function wr(t){t.preventDefault(),t.stopImmediatePropagation()}function xr(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function br(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).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 Mr(){return this.__zoom||vr}function Ar(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Nr(){return navigator.maxTouchPoints||"ontouchstart"in this}function kr(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Er(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Sr(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Pr)):void 0===e&&(e=Tr);for(var n,r,i,o,a,s=new Rr(t),u=[s];n=u.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)u.push(r=i[o]=new Rr(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Cr)}function Tr(t){return t.children}function Pr(t){return Array.isArray(t)?t[1]:null}function zr(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Cr(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Rr(t){this.data=t,this.depth=this.height=0,this.parent=null}function Dr(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ir(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&function(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&&(r-e)/t.value;++s=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Sr(this).eachBefore(zr)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;nBr)if(Math.abs(h*s-u*l)>Br&&i){var f=n-o,d=r-a,p=s*s+u*u,g=f*f+d*d,m=Math.sqrt(p),v=Math.sqrt(c),_=i*Math.tan((Or-Math.acos((p+c-g)/(2*m*v)))/2),y=_/v,w=_/m;Math.abs(y-1)>Br&&(this._+="L"+(t+y*l)+","+(e+y*h)),this._+="A"+i+","+i+",0,0,"+ +(h*f>l*d)+","+(this._x1=t+w*s)+","+(this._y1=e+w*u)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),s=n*Math.sin(r),u=t+a,l=e+s,h=1^o,c=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+u+","+l:(Math.abs(this._x1-u)>Br||Math.abs(this._y1-l)>Br)&&(this._+="L"+u+","+l),n&&(c<0&&(c=c%Lr+Lr),c>qr?this._+="A"+n+","+n+",0,1,"+h+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+h+","+(this._x1=u)+","+(this._y1=l):c>Br&&(this._+="A"+n+","+n+",0,"+ +(c>=Or)+","+h+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var Hr=Math.abs,Yr=Math.atan2,Vr=Math.cos,Fr=Math.max,Ur=Math.min,$r=Math.sin,Wr=Math.sqrt,Kr=1e-12,Qr=Math.PI,Zr=Qr/2,Jr=2*Qr;function ti(t){return t>1?0:t<-1?Qr:Math.acos(t)}function ei(t){return t>=1?Zr:t<=-1?-Zr:Math.asin(t)}function ni(t){return t.innerRadius}function ri(t){return t.outerRadius}function ii(t){return t.startAngle}function oi(t){return t.endAngle}function ai(t){return t&&t.padAngle}function si(t,e,n,r,i,o,a,s){var u=n-t,l=r-e,h=a-i,c=s-o,f=c*u-h*l;if(!(f*fP*P+z*z&&(A=k,N=E),{cx:A,cy:N,x01:-h,y01:-c,x11:A*(i/x-1),y11:N*(i/x-1)}}function li(){var t=ni,e=ri,n=Gr(0),r=null,i=ii,o=oi,a=ai,s=null;function u(){var u,l,h=+t.apply(this,arguments),c=+e.apply(this,arguments),f=i.apply(this,arguments)-Zr,d=o.apply(this,arguments)-Zr,p=Hr(d-f),g=d>f;if(s||(s=u=jr()),cKr)if(p>Jr-Kr)s.moveTo(c*Vr(f),c*$r(f)),s.arc(0,0,c,f,d,!g),h>Kr&&(s.moveTo(h*Vr(d),h*$r(d)),s.arc(0,0,h,d,f,g));else{var m,v,_=f,y=d,w=f,x=d,b=p,M=p,A=a.apply(this,arguments)/2,N=A>Kr&&(r?+r.apply(this,arguments):Wr(h*h+c*c)),k=Ur(Hr(c-h)/2,+n.apply(this,arguments)),E=k,S=k;if(N>Kr){var T=ei(N/h*$r(A)),P=ei(N/c*$r(A));(b-=2*T)>Kr?(w+=T*=g?1:-1,x-=T):(b=0,w=x=(f+d)/2),(M-=2*P)>Kr?(_+=P*=g?1:-1,y-=P):(M=0,_=y=(f+d)/2)}var z=c*Vr(_),C=c*$r(_),R=h*Vr(x),D=h*$r(x);if(k>Kr){var I,O=c*Vr(y),L=c*$r(y),B=h*Vr(w),q=h*$r(w);if(pKr?S>Kr?(m=ui(B,q,z,C,c,S,g),v=ui(O,L,R,D,c,S,g),s.moveTo(m.cx+m.x01,m.cy+m.y01),SKr&&b>Kr?E>Kr?(m=ui(R,D,O,L,h,-E,g),v=ui(z,C,B,q,h,-E,g),s.lineTo(m.cx+m.x01,m.cy+m.y01),E{let t=1;return function(e=!1){return e&&(t=0),t++}})()}get generations(){return this._generations}set generations(t){this._generations=t}get fanDegree(){return this._fanDegree}set fanDegree(t){this._fanDegree=t}get fontScale(){return this._fontScale}set fontScale(t){this._fontScale=t}get hideEmptySegments(){return this._hideEmptySegments}set hideEmptySegments(t){this._hideEmptySegments=t}get showColorGradients(){return this._showColorGradients}set showColorGradients(t){this._showColorGradients=t}get showParentMarriageDates(){return this._showParentMarriageDates}set showParentMarriageDates(t){this._showParentMarriageDates=t}get numberOfInnerCircles(){return this._numberOfInnerCircles}set numberOfInnerCircles(t){this._numberOfInnerCircles=t}get fontSize(){return this._fontSize}}const di="M",pi="F";class gi{constructor(t){this._configuration=t,this._nodes=null}init(t){let e=Sr(t,(t=>(!t.children&&t.generation{t.data.id=this._configuration.id()})),this._configuration.id(!0)}get nodes(){return this._nodes}createEmptyNode(t,e){return{id:0,xref:"",url:"",updateUrl:"",generation:t,name:"",firstNames:[],lastNames:[],preferredName:"",alternativeNames:[],isAltRtl:!1,sex:e,timespan:"",color:this._configuration.defaultColor,colors:[[],[]]}}}class mi{constructor(t){this._element=t.append("div").attr("class","overlay").style("opacity",1e-6)}show(t,e=0,n=null){this._element.select("p").remove(),this._element.append("p").attr("class","tooltip").text(t),this._element.transition().duration(e).style("opacity",1).on("end",(()=>{"function"==typeof n&&n()}))}hide(t=0,e=0){this._element.transition().delay(t).duration(e).style("opacity",1e-6)}get(){return this._element}}class vi{constructor(t){this._element=t.append("defs")}get(){return this._element}}class _i{constructor(t){this._zoom=null,this._parent=t,this.init()}init(){this._zoom=function(){var t,e,n,r=xr,i=br,o=kr,a=Ar,s=Nr,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],h=250,c=Ue,f=_t("start","zoom","end"),d=500,p=0,g=10;function m(t){t.property("__zoom",Mr).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",N).filter(s).on("touchstart.zoom",k).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new mr(e,t.x,t.y)}function _(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new mr(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=x(t,o).event(r),s=i.apply(t,o),u=null==n?y(s):"function"==typeof n?n.apply(t,o):n,l=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),h=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=c(h.invert(u).concat(l/h.k),f.invert(u).concat(l/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=l/e[2];t=new mr(n,u[0]-e[0]*n,u[1]-e[1]*n)}a.zoom(null,t)}}))}function x(t,e,n){return!n&&t.__zooming||new b(t,e)}function b(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function M(t,...e){if(r.apply(this,arguments)){var n=x(this,e).event(t),i=this.__zoom,s=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),h=mt(t);if(n.wheel)n.mouse[0][0]===h[0]&&n.mouse[0][1]===h[1]||(n.mouse[1]=i.invert(n.mouse[0]=h)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[h,i.invert(h)],Ut(this),n.start()}wr(t),n.wheel=setTimeout(c,150),n.zoom("mouse",o(_(v(i,s),n.mouse[0],n.mouse[1]),n.extent,l))}function c(){n.wheel=null,n.end()}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=x(this,e,!0).event(t),s=gt(t.view).on("mousemove.zoom",f,!0).on("mouseup.zoom",d,!0),u=mt(t,i),h=t.clientX,c=t.clientY;fr(t.view),yr(t),a.mouse=[u,this.__zoom.invert(u)],Ut(this),a.start()}function f(t){if(wr(t),!a.moved){var e=t.clientX-h,n=t.clientY-c;a.moved=e*e+n*n>p}a.event(t).zoom("mouse",o(_(a.that.__zoom,a.mouse[0]=mt(t,i),a.mouse[1]),a.extent,l))}function d(t){s.on("mousemove.zoom mouseup.zoom",null),dr(t.view,a.moved),wr(t),a.event(t).end()}}function N(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=mt(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),u=n.k*(t.shiftKey?.5:2),c=o(_(v(n,u),a,s),i.apply(this,e),l);wr(t),h>0?gt(this).transition().duration(h).call(w,c,a,t):gt(this).call(m.transform,c,a,t)}}function k(n,...i){if(r.apply(this,arguments)){var o,a,s,u,l=n.touches,h=l.length,c=x(this,i,n.changedTouches.length===h).event(n);for(yr(n),a=0;a{t.sourceEvent&&"touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length<2||this._parent.attr("transform",t.transform)})),this._zoom.wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002))),this._zoom.filter((t=>{if("wheel"===t.type){if(!t.ctrlKey)return!1;var e=_r(this);if(e.k){if(e.k<=.5&&t.deltaY>0)return t.preventDefault(),!1;if(e.k>=5&&t.deltaY<0)return t.preventDefault(),!1}return!0}return t.button||"touchmove"!==t.type?!(t.ctrlKey&&"wheel"!==t.type||t.button):2===t.touches.length}))}get(){return this._zoom}}class yi{constructor(t){this._element=t,this._element.append("filter").attr("id","drop-shadow").append("feDropShadow").attr("stdDeviation","7 7").attr("dx","0").attr("dy","0").attr("flood-opacity","0.3").attr("flood-color","rgb(0,0,0)")}get(){return this._element}}class wi{triggerDownload(t,e){let n=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),r=document.createElement("a");r.setAttribute("download",e),r.setAttribute("href",t),r.setAttribute("target","_blank"),r.dispatchEvent(n)}}class xi extends wi{copyStylesInline(t,e){let n=["svg","g","text","textPath"];for(let r=0;r{let i=(new XMLSerializer).serializeToString(t),o=window.URL||window.webkitURL||window,a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),s=o.createObjectURL(a),u=new Image;u.onload=()=>{let t=this.createCanvas(e,n),i=t.getContext("2d");i.fillStyle="rgb(255,255,255)",i.fillRect(0,0,t.width,t.height),i.drawImage(u,0,0),o.revokeObjectURL(s);let a=t.toDataURL("image/png").replace("image/png","image/octet-stream");r(a)},u.src=s}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e){const n=[3508,2480];this.cloneSvg(t.get().node()).then((r=>{this.copyStylesInline(t.get().node(),r);const i=this.calculateViewBox(t.get().node()),o=Math.max(n[0],i[2]),a=Math.max(n[1],i[3]);r.setAttribute("width",o),r.setAttribute("height",a),r.setAttribute("viewBox",i),this.convertToDataUrl(r,o,a).then((t=>this.triggerDownload(t,e))).catch((()=>{console.log("Failed to save chart as PNG image")}))}))}}class bi extends wi{copyStylesInline(t,e){return new Promise((n=>{(function(t,e){return fetch(t,e).then(hi)})(t).then((t=>{t=t.replace(/#webtrees-fan-chart-container /g,"");let r=document.createElementNS("http://www.w3.org/2000/svg","style");r.appendChild(document.createTextNode(t)),e.prepend(r),n(e)}))}))}convertToObjectUrl(t){return new Promise((e=>{let n=(new XMLSerializer).serializeToString(t),r=window.URL||window.webkitURL||window,i=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=r.createObjectURL(i),a=new Image;a.onload=()=>{e(o)},a.src=o}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e,n){this.cloneSvg(t.get().node()).then((t=>this.copyStylesInline(e,t))).then((t=>this.convertToObjectUrl(t))).then((t=>this.triggerDownload(t,n))).catch((()=>{console.log("Failed to save chart as SVG image")}))}}class Mi{constructor(){this._exportClass=null}setExportClass(t){switch(t){case"png":this._exportClass=xi;break;case"svg":this._exportClass=bi}}createExport(t){switch(this.setExportClass(t),t){case"png":case"svg":return new this._exportClass}}}class Ai{constructor(t,e){this._element=t.append("svg"),this._defs=new vi(this._element),this._visual=null,this._zoom=null,this._div=null,this._configuration=e,this.init()}init(){this._element.attr("width","100%").attr("height","100%").attr("text-rendering","geometricPrecision").attr("text-anchor","middle").attr("xmlns:xlink","https://www.w3.org/1999/xlink"),new yi(this._defs.get())}initEvents(t){this._element.on("contextmenu",(t=>t.preventDefault())).on("wheel",(e=>{e.ctrlKey||t.show(this._configuration.labels.zoom,300,(()=>{t.hide(700,800)}))})).on("touchend",(e=>{e.touches.length<2&&t.hide(0,800)})).on("touchmove",(e=>{e.touches.length>=2?t.hide():t.show(this._configuration.labels.move)})).on("click",(t=>this.doStopPropagation(t)),!0),this._configuration.rtl&&this._element.classed("rtl",!0);const e=gt("div.tooltip");e.empty()?this._div=gt("body").append("div").attr("class","tooltip").style("opacity",0):this._div=e.style("opacity",0),this._visual=this._element.append("g"),this._visual.append("g").attr("class","personGroup"),this._zoom=new _i(this._visual),this._element.call(this._zoom.get())}doStopPropagation(t){t.defaultPrevented&&t.stopPropagation()}export(t){return(new Mi).createExport(t)}get defs(){return this._defs}get zoom(){return this._zoom}get visual(){return this._visual}get(){return this._element}get div(){return this._div}}const Ni=Math.PI/180,ki=180/Math.PI,Ei=2*Math.PI;class Si{constructor(t){this._configuration=t}get startPi(){return 90===this._configuration.fanDegree?0:-this._configuration.fanDegree/2*Ni}get endPi(){return 90===this._configuration.fanDegree?this._configuration.fanDegree*Ni:this._configuration.fanDegree/2*Ni}get scale(){return lr().range([this.startPi,this.endPi])}innerRadius(t){return 0===t?0:t<=this._configuration.numberOfInnerCircles?(t-1)*this._configuration.innerArcHeight+this._configuration.centerCircleRadius+this._configuration.circlePadding:this._configuration.numberOfInnerCircles*this._configuration.innerArcHeight+(t-this._configuration.numberOfInnerCircles-1)*this._configuration.outerArcHeight+this._configuration.centerCircleRadius+this._configuration.circlePadding}outerRadius(t){return 0===t?this._configuration.centerCircleRadius:t<=this._configuration.numberOfInnerCircles?(t-1)*this._configuration.innerArcHeight+this._configuration.centerCircleRadius+this._configuration.innerArcHeight:this._configuration.numberOfInnerCircles*this._configuration.innerArcHeight+(t-this._configuration.numberOfInnerCircles-1)*this._configuration.outerArcHeight+this._configuration.centerCircleRadius+this._configuration.outerArcHeight}centerRadius(t){return(this.innerRadius(t)+this.outerRadius(t))/2}relativeRadius(t,e){const n=this.outerRadius(t);return n-(100-e)*(n-this.innerRadius(t))/100}calcAngle(t){return Math.max(this.startPi,Math.min(this.endPi,this.scale(t)))}startAngle(t,e){return 0===t?0:this.calcAngle(e)}endAngle(t,e){return 0===t?Ei:this.calcAngle(e)}arcLength(t,e){return(this.endAngle(t.depth,t.x1)-this.startAngle(t.depth,t.x0))*this.relativeRadius(t.depth,e)}}class Ti{constructor(t,e){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration)}createLabels(t,e){if(this.isInnerLabel(e)){let n=this.createTextElement(t,e),r=gt(t.node().parentNode).attr("id"),i=this.createPathDefinition(r,0,e),o=this.createTextPath(n,i);this.addFirstNames(o,e),this.truncateNames(o,e,0);let a=this.createPathDefinition(r,1,e),s=this.createTextPath(n,a);if(this.addLastNames(s,e),this.truncateNames(s,e,1),e.data.alternativeNames.length>0){let t=this.createPathDefinition(r,2,e),i=this.createTextPath(n,t).attr("class","alternativeName").classed("rtl",e.data.isAltRtl);this.addAlternativeNames(i,e),this.truncateNames(i,e,2)}let u=this.createPathDefinition(r,3,e),l=this.createTextPath(n,u).attr("class","date");this.addTimeSpan(l,e)}else{if(e.depth>=7){let n=this.createTextElement(t,e).attr("dy","2px");this.addFirstNames(n,e),this.addLastNames(n,e,.25),this.truncateNames(n,e,0)}if(e.depth<7){let n=this.createTextElement(t,e).attr("dy","2px");this.addFirstNames(n,e),this.truncateNames(n,e,0);let r=this.createTextElement(t,e).attr("dy","2px");if(this.addLastNames(r,e),this.truncateNames(r,e,1),e.depth<6){let n=this.createTextElement(t,e).attr("class","date").attr("dy","2px");this.addTimeSpan(n,e)}}this.transformOuterText(t,e)}if(this._configuration.showParentMarriageDates&&e.children&&e.depth<5){let n=this.createTextElement(t,e),r=gt(t.node().parentNode).attr("id"),i=this.createPathDefinition(r,4,e),o=this.createTextPath(n,i).attr("class","marriage-date");this.addMarriageDate(o,e)}}addFirstNames(t,e){let n=0;for(let r of e.data.firstNames){let i=t.append("tspan").text(r);r===e.data.preferredName&&i.attr("class","preferred"),0!==n&&i.attr("dx","0.25em"),++n}}addLastNames(t,e,n=0){let r=0;for(let i of e.data.lastNames){let e=t.append("tspan").attr("class","lastName").text(i);0!==r&&e.attr("dx","0.25em"),0!==n&&e.attr("dx",n+"em"),++r}}addAlternativeNames(t,e,n=0){let r=0;for(let n of e.data.alternativeNames){let i=t.append("tspan").text(n);0!==r&&i.attr("dx",(e.data.isAltRtl?-.25:.25)+"em"),++r}}addTimeSpan(t,e){t.append("tspan").text(e.data.timespan)}addMarriageDate(t,e){e.data.parentMarriage&&t.append("tspan").text("⚭ "+e.data.parentMarriage)}truncateNames(t,e,n,r=!1){let i=this.getAvailableWidth(e,n),o=t.selectAll("tspan:not(.preferred):not(.lastName)");o.size()&&o.nodes().reverse().forEach((e=>{gt(e).each(this.truncateText(t,i,r))})),t.selectAll("tspan.preferred").each(this.truncateText(t,i,r)),t.selectAll("tspan.lastName").each(this.truncateText(t,i,r))}getTextLength(t){let e=0;return t.selectAll("tspan").each((function(){e+=this.getComputedTextLength()})),e}truncateText(t,e,n=!1){let r=this;return function(){let i=r.getTextLength(t),o=gt(this),a=o.text();i>e&&(n?o.text(""):a.length>1&&o.text(a.slice(0,1)+"."))}}isInnerLabel(t){return t.depth>0&&t.depth<=this._configuration.numberOfInnerCircles}createTextElement(t,e){return t.append("text")}createTextPath(t,e){return t.append("textPath").attr("xlink:href","#"+e).attr("startOffset","25%")}createPathDefinition(t,e,n){let r="path-"+t+"-"+e;if(this._svg.defs.get().select("path#"+r).node())return r;let i=this.isPositionFlipped(n.depth,n.x0,n.x1),o=this._geometry.startAngle(n.depth,n.x0),a=this._geometry.endAngle(n.depth,n.x1),s=this._geometry.relativeRadius(n.depth,this.getTextOffset(i,e));this._configuration.showParentMarriageDates&&4===e&&n.depth<1&&(o=this._geometry.calcAngle(n.x0),a=this._geometry.calcAngle(n.x1));let u=li().startAngle(i?a:o).endAngle(i?o:a).innerRadius(s).outerRadius(s);return u.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius).cornerRadius(this._configuration.cornerRadius),this._svg.defs.get().append("path").attr("id",r).attr("d",u),r}isPositionFlipped(t,e,n){if(360!==this._configuration.fanDegree||t<=1)return!1;const r=this._geometry.startAngle(t,e),i=this._geometry.endAngle(t,n);return r>=90*Ni&&i<=180*Ni||r>=-180*Ni&&i<=-90*Ni}getTextOffset(t,e){return t?[23,42,61,84,125][e]:[73,54,35,12,120][e]}getAvailableWidth(t,e){if(t.depth>this._configuration.numberOfInnerCircles)return this._configuration.outerArcHeight-2*this._configuration.textPadding-this._configuration.circlePadding;let n=2*this._configuration.centerCircleRadius-.15*this._configuration.centerCircleRadius;if(t.depth>=1){let r=this.isPositionFlipped(t.depth,t.x0,t.x1);n=this._geometry.arcLength(t,this.getTextOffset(r,e))}return n-2*this._configuration.textPadding-this._configuration.padDistance/2}transformOuterText(t,e){let n=this,r=t.selectAll("text"),i=r.size(),o=1;switch(e.depth){case 0:case 5:o=1.5;break;case 1:o=6.5;break;case 2:o=3.5;break;case 3:o=2.2;break;case 4:o=1.9;break;case 6:o=.5}let a=lr().domain([0,i-1]).range([-o,o]);r.each((function(t,r){const i=a(r)*n._configuration.fontScale/100;0===e.depth?gt(this).attr("dy",14*i+7+"px"):gt(this).attr("transform",(function(){let t=e.x1-e.x0,r=n._geometry.scale(e.x0+t/2)*ki,o=r-i*(r>0?-1:1),a=n._geometry.centerRadius(e.depth)-n._configuration.colorArcWidth/2;return r>0?o-=90:(a=-a,o+=90),"rotate("+o+") translate("+a+")"}))}))}}class Pi{constructor(t,e,n,r){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration),this.init(n,r)}init(t,e){if(t.classed("new")&&this._configuration.hideEmptySegments?this.addArcToPerson(t,e):t.classed("new")||t.classed("update")||t.classed("remove")||""===e.data.xref&&this._configuration.hideEmptySegments||this.addArcToPerson(t,e),""!==e.data.xref){this.addTitleToPerson(t,e.data.name);let n=new Ti(this._svg,this._configuration),r=this.addLabelToPerson(t,e);n.createLabels(r,e),this.addColorGroup(t,e),t.on("contextmenu",((t,e)=>{this._svg.div.property("active")?(this._svg.div.transition().duration(200).style("opacity",0),this._svg.div.property("active",!1),t.preventDefault()):(this._svg.div.property("active",!0),this.setTooltipHtml(e),t.preventDefault())})).on("mouseenter",((t,e)=>{""===e.data.xref&&this._svg.div.style("opacity",0),this.setTooltipHtml(e)})).on("mouseleave",((t,e)=>{""===e.data.xref&&this._svg.div.style("opacity",0)})).on("mousemove",((t,e)=>{this._svg.div.style("left",t.pageX+"px").style("top",t.pageY-30+"px")})).on("mouseover",(function(e,n){const r=t.nodes(),i=r.indexOf(this);gt(r[i]).classed("hover",!0).raise()})).on("mouseout",(function(e,n){const r=t.nodes(),i=r.indexOf(this);gt(r[i]).classed("hover",!1)}))}}setTooltipHtml(t){if(""===t.data.xref)return;const e=t.data.thumbnail?'':'',n=t.data.birth||t.data.marriage||t.data.death;this._svg.div.html('
'+e+'
'+t.data.name+"
"+(n?""+(t.data.birth?'":"")+(t.data.marriage?'":"")+(t.data.death?'":"")+"
'+t.data.birth+"
'+t.data.marriage+"
'+t.data.death+"
":"")).style("left",event.pageX+"px").style("top",event.pageY-30+"px"),this._svg.div.property("active")&&this._svg.div.transition().duration(200).style("opacity",1)}addColorGroup(t,e){let n=li().startAngle(this._geometry.startAngle(e.depth,e.x0)).endAngle(this._geometry.endAngle(e.depth,e.x1)).innerRadius(this._geometry.outerRadius(e.depth)-this._configuration.colorArcWidth).outerRadius(this._geometry.outerRadius(e.depth)+1);n.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius),t.append("g").attr("class","color").append("path").attr("fill",(()=>this._configuration.showColorGradients?e.depth?"url(#grad-"+e.data.id+")":"rgb(225, 225, 225)":e.data.color)).attr("d",n)}addArcToPerson(t,e){let n=li().startAngle(this._geometry.startAngle(e.depth,e.x0)).endAngle(this._geometry.endAngle(e.depth,e.x1)).innerRadius(this._geometry.innerRadius(e.depth)).outerRadius(this._geometry.outerRadius(e.depth));n.padAngle(this._configuration.padAngle).padRadius(this._configuration.padRadius).cornerRadius(this._configuration.cornerRadius);let r=t.append("g").attr("class","arc").append("path").attr("d",n);t.classed("new")&&r.style("opacity",1e-6)}addTitleToPerson(t,e){t.insert("title",":first-child").text(e)}addLabelToPerson(t,e){return t.append("g").attr("class","name").style("font-size",this.getFontSize(e)+"px").style("fill",this._configuration.fontColor)}getFontSize(t){let e=this._configuration.fontSize;return t.depth>=this._configuration.numberOfInnerCircles+1&&(e+=1),(e-t.depth)*this._configuration.fontScale/100}}class zi{constructor(t,e){this._svg=t,this._configuration=e,this._geometry=new Si(this._configuration)}init(t){if(t.depth<1)return;if(1===t.depth){let e=[64,143,222],n=[161,219,117];t.data.sex===pi&&(e=[218,102,13],n=[235,201,33]),t.data.colors=[e,n]}else{let e=[Math.ceil((t.parent.data.colors[0][0]+t.parent.data.colors[1][0])/2),Math.ceil((t.parent.data.colors[0][1]+t.parent.data.colors[1][1])/2),Math.ceil((t.parent.data.colors[0][2]+t.parent.data.colors[1][2])/2)];t.data.sex===di&&(t.data.colors[0]=t.parent.data.colors[0],t.data.colors[1]=e),t.data.sex===pi&&(t.data.colors[0]=e,t.data.colors[1]=t.parent.data.colors[1])}let e=this._svg.defs.get().append("svg:linearGradient").attr("id","grad-"+t.data.id);e.append("svg:stop").attr("offset","0%").attr("stop-color","rgb("+t.data.colors[0].join(",")+")"),e.append("svg:stop").attr("offset","100%").attr("stop-color","rgb("+t.data.colors[1].join(",")+")")}}class Ci{constructor(t,e,n){this._svg=t,this._configuration=e,this._hierarchy=n}update(t,e){let n=this;this._svg.get().selectAll("g.person").classed("hover",!1).on("click",null).on("mouseover",null).on("mouseout",null),function(t,e){return fetch(t,e).then(ci)}(t).then((t=>{this._hierarchy.init(t),this._svg.get().selectAll("g.person").data(this._hierarchy.nodes,(t=>t.data.id)).each((function(t){let e=""===t.data.xref,r=gt(this);r.classed("remove",e).classed("update",!e&&r.classed("available")).classed("new",!e&&!r.classed("available")),r.classed("new")||r.selectAll("g.name, g.color, title").classed("old",!0),new Pi(n._svg,n._configuration,r,t)})),this._svg.get().selectAll("g.person:not(.remove)").selectAll("g.name:not(.old), g.color:not(.old)").style("opacity",1e-6);let r=Mn().duration(this._configuration.updateDuration).call(this.endAll,(()=>this.updateDone(e)));this._svg.get().selectAll("g.person.remove g.arc path").transition(r).style("fill",(()=>this._configuration.hideEmptySegments?null:"rgb(235, 235, 235)")).style("opacity",(()=>this._configuration.hideEmptySegments?1e-6:null)),this._svg.get().selectAll("g.person.new g.arc path").transition(r).style("fill","rgb(250, 250, 250)").style("opacity",(()=>this._configuration.hideEmptySegments?1:null)),this._svg.get().selectAll("g.person.update, g.person.remove").selectAll("g.name.old, g.color.old").transition(r).style("opacity",1e-6),this._svg.get().selectAll("g.person:not(.remove)").selectAll("g.name:not(.old), g.color:not(.old)").transition(r).style("opacity",1)}))}updateDone(t){this._configuration.hideEmptySegments&&this._svg.get().selectAll("g.person.remove").selectAll("g.arc").remove();let e=Ot((()=>{this._svg.get().selectAll("g.person g.arc path").attr("style",null),this._svg.get().selectAll("g.person g.name, g.person g.color").style("opacity",null),e.stop()}),10);this._svg.get().selectAll("g.person.new, g.person.update, g.person.remove").classed("new",!1).classed("update",!1).classed("remove",!1).selectAll("g.name.old, g.color.old, title.old").remove(),this._svg.get().selectAll("g.person.available").classed("available",!1),t()}endAll(t,e){let n=0;t.on("start",(()=>++n)).on("end",(()=>{--n||e.apply(t)}))}}class Ri{constructor(t,e){this._configuration=e,this._parent=t,this._hierarchy=new gi(this._configuration),this._data={}}get svg(){return this._svg}updateViewBox(){let t=this._svg.visual.node().getBBox(),e=this._parent.node().getBoundingClientRect(),n=Math.max(e.width,t.width),r=Math.max(e.height,t.height,500),i=(n-t.width)/2,o=(r-t.height)/2,a=Math.ceil(t.x-i-10),s=Math.ceil(t.y-o-10);n=Math.ceil(n+20),r=Math.ceil(r+20),this._svg.get().attr("viewBox",[a,s,n,r])}get data(){return this._data}set data(t){this._data=t,this._hierarchy.init(this._data)}draw(){this._parent.html(""),this._svg=new Ai(this._parent,this._configuration),this._overlay=new mi(this._parent),this._svg.initEvents(this._overlay);let t=this._svg.get().select("g.personGroup"),e=new zi(this._svg,this._configuration),n=this;t.selectAll("g.person").data(this._hierarchy.nodes,(t=>t.data.id)).enter().append("g").attr("class","person").attr("id",(t=>"person-"+t.data.id)),t.selectAll("g.person").each((function(t){let r=gt(this);n._configuration.showColorGradients&&e.init(t),new Pi(n._svg,n._configuration,r,t)})),this.bindClickEventListener(),this.updateViewBox()}bindClickEventListener(){this._svg.get().select("g.personGroup").selectAll("g.person").filter((t=>""!==t.data.xref)).classed("available",!0).on("click",this.personClick.bind(this))}personClick(t,e){0===e.depth?this.redirectToIndividual(e.data.url):this.update(e.data.updateUrl)}redirectToIndividual(t){window.location=t}update(t){new Ci(this._svg,this._configuration,this._hierarchy).update(t,(()=>this.bindClickEventListener()))}}t.FanChart=class{constructor(t,e){this._selector=t,this._parent=gt(this._selector),this._configuration=new fi(e.labels,e.generations,e.fanDegree,e.defaultColor,e.fontScale,e.fontColor,e.hideEmptySegments,e.showColorGradients,e.showParentMarriageDates,e.rtl,e.innerArcs),this._chart=new Ri(this._parent,this._configuration),this.init()}init(){gt("#centerButton").on("click",(()=>this.center())),gt("#exportPNG").on("click",(()=>this.exportPNG())),gt("#exportSVG").on("click",(()=>this.exportSVG()))}center(){this._chart.svg.get().transition().duration(750).call(this._chart.svg.zoom.get().transform,vr)}get configuration(){return this._configuration}set cssFile(t){this._cssFile=t}draw(t){this._chart.data=t,this._chart.draw()}exportPNG(){this._chart.svg.export("png").svgToImage(this._chart.svg,"fan-chart.png")}exportSVG(){this._chart.svg.export("svg").svgToImage(this._chart.svg,this._cssFile,"fan-chart.svg")}},t.Storage=class{constructor(t){this._name=t,this._storage=JSON.parse(localStorage.getItem(this._name))||{}}register(t){let e=document.getElementById(t),n=this.read(t);n?e.type&&"checkbox"===e.type?e.checked=n:e.value=n:this.onInput(e),e.addEventListener("input",(t=>{this.onInput(t.target)}))}onInput(t){t.type&&"checkbox"===t.type?this.write(t.name,t.checked):this.write(t.name,t.value)}read(t){return this._storage[t]}write(t,e){this._storage[t]=e,localStorage.setItem(this._name,JSON.stringify(this._storage))}},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WebtreesFanChart={}); diff --git a/pages/fanchart/show.vue b/pages/fanchart/show.vue index 2734c841..8f58cecb 100644 --- a/pages/fanchart/show.vue +++ b/pages/fanchart/show.vue @@ -7,7 +7,7 @@ }