UNPKG

d3-radial-axis

Version:
3 lines (2 loc) 27.2 kB
// Version 1.8.1 d3-radial-axis - https://github.com/vasturiano/d3-radial-axis#readme !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t){return function(){return t}}const r=Math.PI,e=2*r,i=1e-6,a=e-i;function o(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=arguments[n]+t[n]}class u{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?o:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return o;const r=10**n;return function(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=Math.round(arguments[n]*r)/r+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,e){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+e}`}bezierCurveTo(t,n,r,e,i,a){this._append`C${+t},${+n},${+r},${+e},${this._x1=+i},${this._y1=+a}`}arcTo(t,n,e,a,o){if(t=+t,n=+n,e=+e,a=+a,(o=+o)<0)throw new Error(`negative radius: ${o}`);let u=this._x1,s=this._y1,l=e-t,c=a-n,h=u-t,f=s-n,g=h*h+f*f;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(g>i)if(Math.abs(f*l-c*h)>i&&o){let p=e-u,d=a-s,y=l*l+c*c,m=p*p+d*d,v=Math.sqrt(y),b=Math.sqrt(g),x=o*Math.tan((r-Math.acos((y+g-m)/(2*v*b)))/2),w=x/b,M=x/v;Math.abs(w-1)>i&&this._append`L${t+w*h},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*p>h*d)},${this._x1=t+M*l},${this._y1=n+M*c}`}else this._append`L${this._x1=t},${this._y1=n}`;else;}arc(t,n,o,u,s,l){if(t=+t,n=+n,l=!!l,(o=+o)<0)throw new Error(`negative radius: ${o}`);let c=o*Math.cos(u),h=o*Math.sin(u),f=t+c,g=n+h,p=1^l,d=l?u-s:s-u;null===this._x1?this._append`M${f},${g}`:(Math.abs(this._x1-f)>i||Math.abs(this._y1-g)>i)&&this._append`L${f},${g}`,o&&(d<0&&(d=d%e+e),d>a?this._append`A${o},${o},0,1,${p},${t-c},${n-h}A${o},${o},0,1,${p},${this._x1=f},${this._y1=g}`:d>i&&this._append`A${o},${o},0,${+(d>=r)},${p},${this._x1=t+o*Math.cos(s)},${this._y1=n+o*Math.sin(s)}`)}rect(t,n,r,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+e}h${-r}Z`}toString(){return this._}}function s(t){this._context=t}function l(t){return new s(t)}function c(t){return t[0]}function h(t){return t[1]}function f(t,r){var e=n(!0),i=null,a=l,o=null,s=function(t){let n=3;return t.digits=function(r){if(!arguments.length)return n;if(null==r)n=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);n=t}return t},()=>new u(n)}(f);function f(n){var u,l,c,h=(n=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(n)).length,f=!1;for(null==i&&(o=a(c=s())),u=0;u<=h;++u)!(u<h&&e(l=n[u],u,n))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(l,u,n),+r(l,u,n));if(c)return o=null,c+""||null}return t="function"==typeof t?t:void 0===t?c:n(t),r="function"==typeof r?r:void 0===r?h:n(r),f.x=function(r){return arguments.length?(t="function"==typeof r?r:n(+r),f):t},f.y=function(t){return arguments.length?(r="function"==typeof t?t:n(+t),f):r},f.defined=function(t){return arguments.length?(e="function"==typeof t?t:n(!!t),f):e},f.curve=function(t){return arguments.length?(a=t,null!=i&&(o=a(i)),f):a},f.context=function(t){return arguments.length?(null==t?i=o=null:o=a(i=t),f):i},f}s.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var g=d(l);function p(t){this._curve=t}function d(t){function n(n){return new p(t(n))}return n._curve=t,n}function y(){return t=f().curve(g),n=t.curve,t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(d(t)):n()._curve},t;var t,n}function m(t){this._context=t}function v(t){var n,r,e=t.length-1,i=new Array(e),a=new Array(e),o=new Array(e);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],n=1;n<e-1;++n)i[n]=1,a[n]=4,o[n]=4*t[n]+2*t[n+1];for(i[e-1]=2,a[e-1]=7,o[e-1]=8*t[e-1]+t[e],n=1;n<e;++n)r=i[n]/a[n-1],a[n]-=r,o[n]-=r*o[n-1];for(i[e-1]=o[e-1]/a[e-1],n=e-2;n>=0;--n)i[n]=(o[n]-i[n+1])/a[n];for(a[e-1]=(t[e]+i[e-1])/2,n=0;n<e-1;++n)a[n]=2*t[n+1]-i[n+1];return[i,a]}function b(t){return new m(t)}function x(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function w(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function M(t){let n,r,e;function i(t,e,i=0,a=t.length){if(i<a){if(0!==n(e,e))return a;do{const n=i+a>>>1;r(t[n],e)<0?i=n+1:a=n}while(i<a)}return i}return 2!==t.length?(n=x,r=(n,r)=>x(t(n),r),e=(n,r)=>t(n)-r):(n=t===x||t===w?t:_,r=t,e=t),{left:i,center:function(t,n,r=0,a=t.length){const o=i(t,n,r,a-1);return o>r&&e(t[o-1],n)>-e(t[o],n)?o-1:o},right:function(t,e,i=0,a=t.length){if(i<a){if(0!==n(e,e))return a;do{const n=i+a>>>1;r(t[n],e)<=0?i=n+1:a=n}while(i<a)}return i}}}function _(){return 0}p.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}},m.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===r)this._context.lineTo(t[1],n[1]);else for(var e=v(t),i=v(n),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(e[0][a],i[0][a],e[1][a],i[1][a],t[o],n[o]);(this._line||0!==this._line&&1===r)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}};const $=M(x).right;M((function(t){return null===t?NaN:+t})).center;var k=$;const N=Math.sqrt(50),A=Math.sqrt(10),E=Math.sqrt(2);function S(t,n,r){const e=(n-t)/Math.max(0,r),i=Math.floor(Math.log10(e)),a=e/Math.pow(10,i),o=a>=N?10:a>=A?5:a>=E?2:1;let u,s,l;return i<0?(l=Math.pow(10,-i)/o,u=Math.round(t*l),s=Math.round(n*l),u/l<t&&++u,s/l>n&&--s,l=-l):(l=Math.pow(10,i)*o,u=Math.round(t/l),s=Math.round(n/l),u*l<t&&++u,s*l>n&&--s),s<u&&.5<=r&&r<2?S(t,n,2*r):[u,s,l]}function j(t,n,r){return S(t=+t,n=+n,r=+r)[2]}function R(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function T(t,n,r){t.prototype=n.prototype=r,r.constructor=t}function q(t,n){var r=Object.create(t.prototype);for(var e in n)r[e]=n[e];return r}function P(){}var z=.7,I=1/z,H="\\s*([+-]?\\d+)\\s*",C="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",F="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",L=/^#([0-9a-f]{3,8})$/,O=new RegExp(`^rgb\\(${H},${H},${H}\\)$`),D=new RegExp(`^rgb\\(${F},${F},${F}\\)$`),V=new RegExp(`^rgba\\(${H},${H},${H},${C}\\)$`),Z=new RegExp(`^rgba\\(${F},${F},${F},${C}\\)$`),X=new RegExp(`^hsl\\(${C},${F},${F}\\)$`),B=new RegExp(`^hsla\\(${C},${F},${F},${C}\\)$`),G={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 Q(){return this.rgb().formatHex()}function U(){return this.rgb().formatRgb()}function Y(t){var n,r;return t=(t+"").trim().toLowerCase(),(n=L.exec(t))?(r=n[1].length,n=parseInt(n[1],16),6===r?J(n):3===r?new tt(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===r?K(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===r?K(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=O.exec(t))?new tt(n[1],n[2],n[3],1):(n=D.exec(t))?new tt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=V.exec(t))?K(n[1],n[2],n[3],n[4]):(n=Z.exec(t))?K(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=X.exec(t))?ot(n[1],n[2]/100,n[3]/100,1):(n=B.exec(t))?ot(n[1],n[2]/100,n[3]/100,n[4]):G.hasOwnProperty(t)?J(G[t]):"transparent"===t?new tt(NaN,NaN,NaN,0):null}function J(t){return new tt(t>>16&255,t>>8&255,255&t,1)}function K(t,n,r,e){return e<=0&&(t=n=r=NaN),new tt(t,n,r,e)}function W(t,n,r,e){return 1===arguments.length?((i=t)instanceof P||(i=Y(i)),i?new tt((i=i.rgb()).r,i.g,i.b,i.opacity):new tt):new tt(t,n,r,null==e?1:e);var i}function tt(t,n,r,e){this.r=+t,this.g=+n,this.b=+r,this.opacity=+e}function nt(){return`#${at(this.r)}${at(this.g)}${at(this.b)}`}function rt(){const t=et(this.opacity);return`${1===t?"rgb(":"rgba("}${it(this.r)}, ${it(this.g)}, ${it(this.b)}${1===t?")":`, ${t})`}`}function et(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function it(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function at(t){return((t=it(t))<16?"0":"")+t.toString(16)}function ot(t,n,r,e){return e<=0?t=n=r=NaN:r<=0||r>=1?t=n=NaN:n<=0&&(t=NaN),new st(t,n,r,e)}function ut(t){if(t instanceof st)return new st(t.h,t.s,t.l,t.opacity);if(t instanceof P||(t=Y(t)),!t)return new st;if(t instanceof st)return t;var n=(t=t.rgb()).r/255,r=t.g/255,e=t.b/255,i=Math.min(n,r,e),a=Math.max(n,r,e),o=NaN,u=a-i,s=(a+i)/2;return u?(o=n===a?(r-e)/u+6*(r<e):r===a?(e-n)/u+2:(n-r)/u+4,u/=s<.5?a+i:2-a-i,o*=60):u=s>0&&s<1?0:o,new st(o,u,s,t.opacity)}function st(t,n,r,e){this.h=+t,this.s=+n,this.l=+r,this.opacity=+e}function lt(t){return(t=(t||0)%360)<0?t+360:t}function ct(t){return Math.max(0,Math.min(1,t||0))}function ht(t,n,r){return 255*(t<60?n+(r-n)*t/60:t<180?r:t<240?n+(r-n)*(240-t)/60:n)}T(P,Y,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Q,formatHex:Q,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ut(this).formatHsl()},formatRgb:U,toString:U}),T(tt,W,q(P,{brighter(t){return t=null==t?I:Math.pow(I,t),new tt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?z:Math.pow(z,t),new tt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new tt(it(this.r),it(this.g),it(this.b),et(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nt,formatHex:nt,formatHex8:function(){return`#${at(this.r)}${at(this.g)}${at(this.b)}${at(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:rt,toString:rt})),T(st,(function(t,n,r,e){return 1===arguments.length?ut(t):new st(t,n,r,null==e?1:e)}),q(P,{brighter(t){return t=null==t?I:Math.pow(I,t),new st(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?z:Math.pow(z,t),new st(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,e=r+(r<.5?r:1-r)*n,i=2*r-e;return new tt(ht(t>=240?t-240:t+120,i,e),ht(t,i,e),ht(t<120?t+240:t-120,i,e),this.opacity)},clamp(){return new st(lt(this.h),ct(this.s),ct(this.l),et(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=et(this.opacity);return`${1===t?"hsl(":"hsla("}${lt(this.h)}, ${100*ct(this.s)}%, ${100*ct(this.l)}%${1===t?")":`, ${t})`}`}}));var ft=t=>()=>t;function gt(t){return 1==(t=+t)?pt:function(n,r){return r-n?function(t,n,r){return t=Math.pow(t,r),n=Math.pow(n,r)-t,r=1/r,function(e){return Math.pow(t+e*n,r)}}(n,r,t):ft(isNaN(n)?r:n)}}function pt(t,n){var r=n-t;return r?function(t,n){return function(r){return t+r*n}}(t,r):ft(isNaN(t)?n:t)}var dt=function t(n){var r=gt(n);function e(t,n){var e=r((t=W(t)).r,(n=W(n)).r),i=r(t.g,n.g),a=r(t.b,n.b),o=pt(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=i(n),t.b=a(n),t.opacity=o(n),t+""}}return e.gamma=t,e}(1);function yt(t,n){n||(n=[]);var r,e=t?Math.min(n.length,t.length):0,i=n.slice();return function(a){for(r=0;r<e;++r)i[r]=t[r]*(1-a)+n[r]*a;return i}}function mt(t,n){var r,e=n?n.length:0,i=t?Math.min(e,t.length):0,a=new Array(i),o=new Array(e);for(r=0;r<i;++r)a[r]=$t(t[r],n[r]);for(;r<e;++r)o[r]=n[r];return function(t){for(r=0;r<i;++r)o[r]=a[r](t);return o}}function vt(t,n){var r=new Date;return t=+t,n=+n,function(e){return r.setTime(t*(1-e)+n*e),r}}function bt(t,n){return t=+t,n=+n,function(r){return t*(1-r)+n*r}}function xt(t,n){var r,e={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)r in t?e[r]=$t(t[r],n[r]):i[r]=n[r];return function(t){for(r in e)i[r]=e[r](t);return i}}var wt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(wt.source,"g");function _t(t,n){var r,e,i,a=wt.lastIndex=Mt.lastIndex=0,o=-1,u=[],s=[];for(t+="",n+="";(r=wt.exec(t))&&(e=Mt.exec(n));)(i=e.index)>a&&(i=n.slice(a,i),u[o]?u[o]+=i:u[++o]=i),(r=r[0])===(e=e[0])?u[o]?u[o]+=e:u[++o]=e:(u[++o]=null,s.push({i:o,x:bt(r,e)})),a=Mt.lastIndex;return a<n.length&&(i=n.slice(a),u[o]?u[o]+=i:u[++o]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var r,e=0;e<n;++e)u[(r=s[e]).i]=r.x(t);return u.join("")})}function $t(t,n){var r,e=typeof n;return null==n||"boolean"===e?ft(n):("number"===e?bt:"string"===e?(r=Y(n))?(n=r,dt):_t:n instanceof Y?dt:n instanceof Date?vt:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(n)?yt:Array.isArray(n)?mt:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?xt:bt)(t,n)}function kt(t,n){return t=+t,n=+n,function(r){return Math.round(t*(1-r)+n*r)}}function Nt(t){return+t}var At=[0,1];function Et(t){return t}function St(t,n){return(n-=t=+t)?function(r){return(r-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function jt(t,n,r){var e=t[0],i=t[1],a=n[0],o=n[1];return i<e?(e=St(i,e),a=r(o,a)):(e=St(e,i),a=r(a,o)),function(t){return a(e(t))}}function Rt(t,n,r){var e=Math.min(t.length,n.length)-1,i=new Array(e),a=new Array(e),o=-1;for(t[e]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++o<e;)i[o]=St(t[o],t[o+1]),a[o]=r(n[o],n[o+1]);return function(n){var r=k(t,n,1,e)-1;return a[r](i[r](n))}}function Tt(){var t,n,r,e,i,a,o=At,u=At,s=$t,l=Et;function c(){var t,n,r,s=Math.min(o.length,u.length);return l!==Et&&(t=o[0],n=o[s-1],t>n&&(r=t,t=n,n=r),l=function(r){return Math.max(t,Math.min(n,r))}),e=s>2?Rt:jt,i=a=null,h}function h(n){return null==n||isNaN(n=+n)?r:(i||(i=e(o.map(t),u,s)))(t(l(n)))}return h.invert=function(r){return l(n((a||(a=e(u,o.map(t),bt)))(r)))},h.domain=function(t){return arguments.length?(o=Array.from(t,Nt),c()):o.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=kt,c()},h.clamp=function(t){return arguments.length?(l=!!t||Et,c()):l!==Et},h.interpolate=function(t){return arguments.length?(s=t,c()):s},h.unknown=function(t){return arguments.length?(r=t,h):r},function(r,e){return t=r,n=e,c()}}function qt(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function Pt(t){return(t=qt(Math.abs(t)))?t[1]:NaN}var zt,It=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ht(t){if(!(n=It.exec(t)))throw new Error("invalid format: "+t);var n;return new Ct({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Ct(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 Ft(t,n){var r=qt(t,n);if(!r)return t+"";var e=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+e:e.length>i+1?e.slice(0,i+1)+"."+e.slice(i+1):e+new Array(i-e.length+2).join("0")}Ht.prototype=Ct.prototype,Ct.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 Lt={"%":(t,n)=>(100*t).toFixed(n),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,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Ft(100*t,n),r:Ft,s:function(t,n){var r=qt(t,n);if(!r)return t+"";var e=r[0],i=r[1],a=i-(zt=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=e.length;return a===o?e:a>o?e+new Array(a-o+1).join("0"):a>0?e.slice(0,a)+"."+e.slice(a):"0."+new Array(1-a).join("0")+qt(t,Math.max(0,n+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ot(t){return t}var Dt,Vt,Zt,Xt=Array.prototype.map,Bt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gt(t){var n,r,e=void 0===t.grouping||void 0===t.thousands?Ot:(n=Xt.call(t.grouping,Number),r=t.thousands+"",function(t,e){for(var i=t.length,a=[],o=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>e&&(u=Math.max(1,e-s)),a.push(t.substring(i-=u,i+u)),!((s+=u+1)>e));)u=n[o=(o+1)%n.length];return a.reverse().join(r)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ot:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Xt.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=Ht(t)).fill,r=t.align,h=t.sign,f=t.symbol,g=t.zero,p=t.width,d=t.comma,y=t.precision,m=t.trim,v=t.type;"n"===v?(d=!0,v="g"):Lt[v]||(void 0===y&&(y=12),m=!0,v="g"),(g||"0"===n&&"="===r)&&(g=!0,n="0",r="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===f?a:/[%p]/.test(v)?s:"",w=Lt[v],M=/[defgprs%]/.test(v);function _(t){var i,a,s,f=b,_=x;if("c"===v)_=w(t)+_,t="";else{var $=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),y),m&&(t=function(t){t:for(var n,r=t.length,e=1,i=-1;e<r;++e)switch(t[e]){case".":i=n=e;break;case"0":0===i&&(i=e),n=e;break;default:if(!+t[e])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),$&&0==+t&&"+"!==h&&($=!1),f=($?"("===h?h:l:"-"===h||"("===h?"":h)+f,_=("s"===v?Bt[8+zt/3]:"")+_+($&&"("===h?")":""),M)for(i=-1,a=t.length;++i<a;)if(48>(s=t.charCodeAt(i))||s>57){_=(46===s?o+t.slice(i+1):t.slice(i))+_,t=t.slice(0,i);break}}d&&!g&&(t=e(t,1/0));var k=f.length+t.length+_.length,N=k<p?new Array(p-k+1).join(n):"";switch(d&&g&&(t=e(N+t,N.length?p-_.length:1/0),N=""),r){case"<":t=f+t+_+N;break;case"=":t=f+N+t+_;break;case"^":t=N.slice(0,k=N.length>>1)+f+t+_+N.slice(k);break;default:t=N+f+t+_}return u(t)}return y=void 0===y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),_.toString=function(){return t+""},_}return{format:h,formatPrefix:function(t,n){var r=h(((t=Ht(t)).type="f",t)),e=3*Math.max(-8,Math.min(8,Math.floor(Pt(n)/3))),i=Math.pow(10,-e),a=Bt[8+e/3];return function(t){return r(i*t)+a}}}}function Qt(t,n,r,e){var i,a=function(t,n,r){r=+r;const e=(n=+n)<(t=+t),i=e?j(n,t,r):j(t,n,r);return(e?-1:1)*(i<0?1/-i:i)}(t,n,r);switch((e=Ht(null==e?",f":e)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(n));return null!=e.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pt(n)/3)))-Pt(Math.abs(t)))}(a,o))||(e.precision=i),Zt(e,o);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Pt(n)-Pt(t))+1}(a,Math.max(Math.abs(t),Math.abs(n))))||(e.precision=i-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(i=function(t){return Math.max(0,-Pt(Math.abs(t)))}(a))||(e.precision=i-2*("%"===e.type))}return Vt(e)}function Ut(t){var n=t.domain;return t.ticks=function(t){var r=n();return function(t,n,r){if(!((r=+r)>0))return[];if((t=+t)==(n=+n))return[t];const e=n<t,[i,a,o]=e?S(n,t,r):S(t,n,r);if(!(a>=i))return[];const u=a-i+1,s=new Array(u);if(e)if(o<0)for(let t=0;t<u;++t)s[t]=(a-t)/-o;else for(let t=0;t<u;++t)s[t]=(a-t)*o;else if(o<0)for(let t=0;t<u;++t)s[t]=(i+t)/-o;else for(let t=0;t<u;++t)s[t]=(i+t)*o;return s}(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var e=n();return Qt(e[0],e[e.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var e,i,a=n(),o=0,u=a.length-1,s=a[o],l=a[u],c=10;for(l<s&&(i=s,s=l,l=i,i=o,o=u,u=i);c-- >0;){if((i=j(s,l,r))===e)return a[o]=s,a[u]=l,n(a);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}e=i}return t},t}function Yt(){var t=Tt()(Et,Et);return t.copy=function(){return n=t,Yt().domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());var n},R.apply(t,arguments),Ut(t)}function Jt(t){return t}function Kt(t,n){return"translate("+t+","+n+")"}function Wt(t){var n=t.bandwidth()/2;return t.round()&&(n=Math.round(n)),function(r){return t(r)+n}}function tn(){return!this.__axis}function nn(t,n,r,e){var i=[],a=null,o=null,u=6,s=6,l=12;function c(t,n){return Kt.apply(Kt,h(t,n))}function h(t,n){return[Math.sin(t)*n,-Math.cos(t)*n]}function f(f){var g=void 0!==r&&n!==r;r=g?r:n;var p=null==a?t.ticks?t.ticks.apply(t,i):t.domain():a,d=null==o?t.tickFormat?t.tickFormat.apply(t,i):Jt:o,m=Math.max(u,0)+l,v=t.copy().range([n,r]),x=t.range(),w=(t.bandwidth?Wt:Jt)(t.copy()),M=f.selection?f.selection():f,_=M.selectAll(".domain").data([null]),$=M.selectAll(".tick").data(p,t).order(),k=$.exit(),N=$.enter().append("g").attr("class","tick"),A=$.select("line"),E=$.select("text");function S(t,n){return"M"+h(t,n+s*(e?1:-1)).join(",")+"L"+h(t,n).join(",")}_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),$=$.merge(N),A=A.merge(N.append("line").attr("stroke","#000")),E=E.merge(N.append("text").attr("fill","#000").attr("dy",".35em").attr("text-anchor","middle")),f!==M&&(_=_.transition(f),$=$.transition(f),A=A.transition(f),E=E.transition(f),k=k.transition(f).attr("opacity",0).attr("transform",(function(t){return isFinite(w(t))?c(w(t),v(t)):this.getAttribute("transform")})),N.attr("opacity",0).attr("transform",(function(t){var n=this.parentNode.__axis;return c(n&&isFinite(n=n(t))?n:w(t),v(t))}))),k.remove(),_.attr("d",(g?function(t,n,r,e){var i=(n-t)/(2*Math.PI)*40,a=y().angle(Yt().range([t,n])).radius(Yt().range([r,e])).curve(b);return"M"+h(t,r).join(",")+a(Yt().ticks(i))}:function(t,n,r){return"M"+h(t,r).join(",")+(Math.abs(n-t)>=2*Math.PI?"A"+[r,r,0,1,1].concat(h(t+Math.PI,r)).join(",")+"A"+[r,r,0,1,1].concat(h(t,r)).join(","):"")+"A"+[r,r,0,Math.abs(n-t)%(2*Math.PI)>Math.PI?1:0,n>t?1:0].concat(h(n,r)).join(",")})(x[0],x[1],n,r)+S(x[0],n)+S(x[1],r)),$.attr("opacity",1).attr("transform",(function(t){return c(w(t),v(t))})),A.attr("x1",0).attr("y1",0).attr("x2",(function(t){return h(w(t),u)[0]*(e?1:-1)})).attr("y2",(function(t){return h(w(t),u)[1]*(e?1:-1)})),E.attr("x",(function(t){return h(w(t),m)[0]*(e?1:-1)})).attr("y",(function(t){return h(w(t),m)[1]*(e?1:-1)})).text(d),M.filter(tn).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif"),M.each((function(){this.__axis=w}))}return f.angleScale=function(n){return arguments.length?(t=n,f):t},f.radius=function(t){return arguments.length?(n=r=+t,f):n},f.startRadius=function(t){return arguments.length?(n=+t,f):n},f.endRadius=function(t){return arguments.length?(r=+t,f):r},f.ticks=function(){return i=Array.prototype.slice.call(arguments),f},f.tickArguments=function(t){return arguments.length?(i=null==t?[]:Array.prototype.slice.call(t),f):i.slice()},f.tickValues=function(t){return arguments.length?(a=null==t?null:Array.prototype.slice.call(t),f):a&&a.slice()},f.tickFormat=function(t){return arguments.length?(o=t,f):o},f.tickSize=function(t){return arguments.length?(u=s=+t,f):u},f.tickSizeInner=function(t){return arguments.length?(u=+t,f):u},f.tickSizeOuter=function(t){return arguments.length?(s=+t,f):s},f.tickPadding=function(t){return arguments.length?(l=+t,f):l},f}Dt=Gt({thousands:",",grouping:[3],currency:["$",""]}),Vt=Dt.format,Zt=Dt.formatPrefix,t.axisRadialInner=function(t,n,r){return nn(t,n,r,!1)},t.axisRadialOuter=function(t,n,r){return nn(t,n,r,!0)}}));