Socket
Socket
Sign inDemoInstall

d3-shape

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-shape - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

190

build/d3-shape.js

@@ -1,9 +0,9 @@

// https://d3js.org/d3-shape/ Version 1.0.4. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-shape/ Version 1.0.5. Copyright 2017 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3));
}(this, (function (exports,d3Path) { 'use strict';
var constant$1 = function(x) {
var constant = function(x) {
return function constant() {

@@ -14,2 +14,10 @@ return x;

var abs = Math.abs;
var atan2 = Math.atan2;
var cos = Math.cos;
var max = Math.max;
var min = Math.min;
var sin = Math.sin;
var sqrt = Math.sqrt;
var epsilon = 1e-12;

@@ -20,2 +28,10 @@ var pi = Math.PI;

function acos(x) {
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
}
function asin(x) {
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}
function arcInnerRadius(d) {

@@ -41,6 +57,2 @@ return d.innerRadius;

function asin(x) {
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {

@@ -58,3 +70,3 @@ var x10 = x1 - x0, y10 = y1 - y0,

y01 = y0 - y1,
lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01),
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
ox = lo * y01,

@@ -73,3 +85,3 @@ oy = -lo * x01,

D = x11 * y10 - x10 * y11,
d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)),
d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
cx0 = (D * dy - dx * d) / d2,

@@ -101,3 +113,3 @@ cy0 = (-D * dx - dy * d) / d2,

outerRadius = arcOuterRadius,
cornerRadius = constant$1(0),
cornerRadius = constant(0),
padRadius = null,

@@ -116,3 +128,3 @@ startAngle = arcStartAngle,

a1 = endAngle.apply(this, arguments) - halfPi,
da = Math.abs(a1 - a0),
da = abs(a1 - a0),
cw = a1 > a0;

@@ -130,6 +142,6 @@

else if (da > tau - epsilon) {
context.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0));
context.moveTo(r1 * cos(a0), r1 * sin(a0));
context.arc(0, 0, r1, a0, a1, !cw);
if (r0 > epsilon) {
context.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1));
context.moveTo(r0 * cos(a1), r0 * sin(a1));
context.arc(0, 0, r0, a1, a0, cw);

@@ -148,4 +160,4 @@ }

ap = padAngle.apply(this, arguments) / 2,
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : Math.sqrt(r0 * r0 + r1 * r1)),
rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
rc0 = rc,

@@ -158,4 +170,4 @@ rc1 = rc,

if (rp > epsilon) {
var p0 = asin(rp / r0 * Math.sin(ap)),
p1 = asin(rp / r1 * Math.sin(ap));
var p0 = asin(rp / r0 * sin(ap)),
p1 = asin(rp / r1 * sin(ap));
if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;

@@ -167,13 +179,13 @@ else da0 = 0, a00 = a10 = (a0 + a1) / 2;

var x01 = r1 * Math.cos(a01),
y01 = r1 * Math.sin(a01),
x10 = r0 * Math.cos(a10),
y10 = r0 * Math.sin(a10);
var x01 = r1 * cos(a01),
y01 = r1 * sin(a01),
x10 = r0 * cos(a10),
y10 = r0 * sin(a10);
// Apply rounded corners?
if (rc > epsilon) {
var x11 = r1 * Math.cos(a11),
y11 = r1 * Math.sin(a11),
x00 = r0 * Math.cos(a00),
y00 = r0 * Math.sin(a00);
var x11 = r1 * cos(a11),
y11 = r1 * sin(a11),
x00 = r0 * cos(a00),
y00 = r0 * sin(a00);

@@ -187,6 +199,6 @@ // Restrict the corner radius according to the sector angle.

by = y11 - oc[1],
kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2),
lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = min(rc, (r0 - lc) / (kc - 1));
rc1 = min(rc, (r1 - lc) / (kc + 1));
}

@@ -206,9 +218,9 @@ }

// Have the corners merged?
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw);
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw);
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}

@@ -232,9 +244,9 @@ }

// Have the corners merged?
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw);
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw);
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}

@@ -255,31 +267,31 @@ }

a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
return [Math.cos(a) * r, Math.sin(a) * r];
return [cos(a) * r, sin(a) * r];
};
arc.innerRadius = function(_) {
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : innerRadius;
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
};
arc.outerRadius = function(_) {
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : outerRadius;
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
};
arc.cornerRadius = function(_) {
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : cornerRadius;
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
};
arc.padRadius = function(_) {
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), arc) : padRadius;
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
};
arc.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : startAngle;
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
};
arc.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : endAngle;
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
};
arc.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : padAngle;
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
};

@@ -337,3 +349,3 @@

y$$1 = y,
defined = constant$1(true),
defined = constant(true),
context = null,

@@ -364,11 +376,11 @@ curve = curveLinear,

line.x = function(_) {
return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$1(+_), line) : x$$1;
return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant(+_), line) : x$$1;
};
line.y = function(_) {
return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$1(+_), line) : y$$1;
return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant(+_), line) : y$$1;
};
line.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), line) : defined;
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
};

@@ -390,5 +402,5 @@

x1 = null,
y0 = constant$1(0),
y0 = constant(0),
y1 = y,
defined = constant$1(true),
defined = constant(true),
context = null,

@@ -441,23 +453,23 @@ curve = curveLinear,

area.x = function(_) {
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), x1 = null, area) : x0;
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0;
};
area.x0 = function(_) {
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), area) : x0;
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0;
};
area.x1 = function(_) {
return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : x1;
return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1;
};
area.y = function(_) {
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), y1 = null, area) : y0;
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0;
};
area.y0 = function(_) {
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), area) : y0;
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0;
};
area.y1 = function(_) {
return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : y1;
return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1;
};

@@ -479,3 +491,3 @@

area.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), area) : defined;
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined;
};

@@ -506,5 +518,5 @@

sort = null,
startAngle = constant$1(0),
endAngle = constant$1(tau),
padAngle = constant$1(0);
startAngle = constant(0),
endAngle = constant(tau),
padAngle = constant(0);

@@ -552,3 +564,3 @@ function pie(data) {

pie.value = function(_) {
return arguments.length ? (value = typeof _ === "function" ? _ : constant$1(+_), pie) : value;
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
};

@@ -565,11 +577,11 @@

pie.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$1(+_), pie) : startAngle;
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
};
pie.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$1(+_), pie) : endAngle;
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
};
pie.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$1(+_), pie) : padAngle;
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
};

@@ -781,4 +793,4 @@

var symbol = function() {
var type = constant$1(circle),
size = constant$1(64),
var type = constant(circle),
size = constant(64),
context = null;

@@ -794,7 +806,7 @@

symbol.type = function(_) {
return arguments.length ? (type = typeof _ === "function" ? _ : constant$1(_), symbol) : type;
return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type;
};
symbol.size = function(_) {
return arguments.length ? (size = typeof _ === "function" ? _ : constant$1(+_), symbol) : size;
return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size;
};

@@ -993,3 +1005,3 @@

var bundle = (function custom(beta) {
var bundle = ((function custom(beta) {

@@ -1005,3 +1017,3 @@ function bundle(context) {

return bundle;
})(0.85);
}))(0.85);

@@ -1057,3 +1069,3 @@ function point$1(that, x, y) {

var cardinal = (function custom(tension) {
var cardinal = ((function custom(tension) {

@@ -1069,3 +1081,3 @@ function cardinal(context) {

return cardinal;
})(0);
}))(0);

@@ -1118,3 +1130,3 @@ function CardinalClosed(context, tension) {

var cardinalClosed = (function custom(tension) {
var cardinalClosed = ((function custom(tension) {

@@ -1130,3 +1142,3 @@ function cardinal(context) {

return cardinal;
})(0);
}))(0);

@@ -1168,3 +1180,3 @@ function CardinalOpen(context, tension) {

var cardinalOpen = (function custom(tension) {
var cardinalOpen = ((function custom(tension) {

@@ -1180,3 +1192,3 @@ function cardinal(context) {

return cardinal;
})(0);
}))(0);

@@ -1256,3 +1268,3 @@ function point$2(that, x, y) {

var catmullRom = (function custom(alpha) {
var catmullRom = ((function custom(alpha) {

@@ -1268,3 +1280,3 @@ function catmullRom(context) {

return catmullRom;
})(0.5);
}))(0.5);

@@ -1329,3 +1341,3 @@ function CatmullRomClosed(context, alpha) {

var catmullRomClosed = (function custom(alpha) {
var catmullRomClosed = ((function custom(alpha) {

@@ -1341,3 +1353,3 @@ function catmullRom(context) {

return catmullRom;
})(0.5);
}))(0.5);

@@ -1391,3 +1403,3 @@ function CatmullRomOpen(context, alpha) {

var catmullRomOpen = (function custom(alpha) {
var catmullRomOpen = ((function custom(alpha) {

@@ -1403,3 +1415,3 @@ function catmullRom(context) {

return catmullRom;
})(0.5);
}))(0.5);

@@ -1678,3 +1690,3 @@ function LinearClosed(context) {

var stack = function() {
var keys = constant$1([]),
var keys = constant([]),
order = none$1,

@@ -1709,11 +1721,11 @@ offset = none,

stack.keys = function(_) {
return arguments.length ? (keys = typeof _ === "function" ? _ : constant$1(slice.call(_)), stack) : keys;
return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys;
};
stack.value = function(_) {
return arguments.length ? (value = typeof _ === "function" ? _ : constant$1(+_), stack) : value;
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value;
};
stack.order = function(_) {
return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant$1(slice.call(_)), stack) : order;
return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order;
};

@@ -1720,0 +1732,0 @@

@@ -1,2 +0,2 @@

// https://d3js.org/d3-shape/ Version 1.0.4. Copyright 2016 Mike Bostock.
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],i):i(t.d3=t.d3||{},t.d3)}(this,function(t,i){"use strict";function n(t){return t.innerRadius}function e(t){return t.outerRadius}function s(t){return t.startAngle}function h(t){return t.endAngle}function o(t){return t&&t.padAngle}function _(t){return t>=1?K:t<=-1?-K:Math.asin(t)}function a(t,i,n,e,s,h,o,_){var a=n-t,r=e-i,c=o-s,l=_-h,u=(c*(i-h)-l*(t-s))/(l*a-c*r);return[t+u*a,i+u*r]}function r(t,i,n,e,s,h,o){var _=t-n,a=i-e,r=(o?h:-h)/Math.sqrt(_*_+a*a),c=r*a,l=-r*_,u=t+c,f=i+l,x=n+c,y=e+l,p=(u+x)/2,v=(f+y)/2,d=x-u,T=y-f,M=d*d+T*T,g=s-h,b=u*y-x*f,w=(T<0?-1:1)*Math.sqrt(Math.max(0,g*g*M-b*b)),m=(b*T-d*w)/M,k=(-b*d-T*w)/M,N=(b*T+d*w)/M,S=(-b*d+T*w)/M,E=m-p,A=k-v,P=N-p,q=S-v;return E*E+A*A>P*P+q*q&&(m=N,k=S),{cx:m,cy:k,x01:-c,y01:-l,x11:m*(s/g-1),y11:k*(s/g-1)}}function c(t){this._context=t}function l(t){return t[0]}function u(t){return t[1]}function f(t){this._curve=t}function x(t){function i(i){return new f(t(i))}return i._curve=t,i}function y(t){var i=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?i(x(t)):i()._curve},t}function p(t,i,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+i)/6,(t._y0+4*t._y1+n)/6)}function v(t){this._context=t}function d(t){this._context=t}function T(t){this._context=t}function M(t,i){this._basis=new v(t),this._beta=i}function g(t,i,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-i),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function b(t,i){this._context=t,this._k=(1-i)/6}function w(t,i){this._context=t,this._k=(1-i)/6}function m(t,i){this._context=t,this._k=(1-i)/6}function k(t,i,n){var e=t._x1,s=t._y1,h=t._x2,o=t._y2;if(t._l01_a>H){var _=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,a=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*_-t._x0*t._l12_2a+t._x2*t._l01_2a)/a,s=(s*_-t._y0*t._l12_2a+t._y2*t._l01_2a)/a}if(t._l23_a>H){var r=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*r+t._x1*t._l23_2a-i*t._l12_2a)/c,o=(o*r+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(e,s,h,o,t._x2,t._y2)}function N(t,i){this._context=t,this._alpha=i}function S(t,i){this._context=t,this._alpha=i}function E(t,i){this._context=t,this._alpha=i}function A(t){this._context=t}function P(t){return t<0?-1:1}function q(t,i,n){var e=t._x1-t._x0,s=i-t._x1,h=(t._y1-t._y0)/(e||s<0&&-0),o=(n-t._y1)/(s||e<0&&-0),_=(h*s+o*e)/(e+s);return(P(h)+P(o))*Math.min(Math.abs(h),Math.abs(o),.5*Math.abs(_))||0}function C(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function O(t,i,n){var e=t._x0,s=t._y0,h=t._x1,o=t._y1,_=(h-e)/3;t._context.bezierCurveTo(e+_,s+_*i,h-_,o-_*n,h,o)}function R(t){this._context=t}function z(t){this._context=new X(t)}function X(t){this._context=t}function Y(t){return new R(t)}function B(t){return new z(t)}function j(t){this._context=t}function I(t){var i,n,e=t.length-1,s=new Array(e),h=new Array(e),o=new Array(e);for(s[0]=0,h[0]=2,o[0]=t[0]+2*t[1],i=1;i<e-1;++i)s[i]=1,h[i]=4,o[i]=4*t[i]+2*t[i+1];for(s[e-1]=2,h[e-1]=7,o[e-1]=8*t[e-1]+t[e],i=1;i<e;++i)n=s[i]/h[i-1],h[i]-=n,o[i]-=n*o[i-1];for(s[e-1]=o[e-1]/h[e-1],i=e-2;i>=0;--i)s[i]=(o[i]-s[i+1])/h[i];for(h[e-1]=(t[e]+s[e-1])/2,i=0;i<e-1;++i)h[i]=2*t[i+1]-s[i+1];return[s,h]}function L(t,i){this._context=t,this._t=i}function D(t){return new L(t,0)}function W(t){return new L(t,1)}function V(t,i){return t[i]}function F(t){for(var i,n=0,e=-1,s=t.length;++e<s;)(i=+t[e][1])&&(n+=i);return n}var G=function(t){return function(){return t}},H=1e-12,J=Math.PI,K=J/2,Q=2*J,U=function(){function t(){var t,n,e=+c.apply(this,arguments),s=+l.apply(this,arguments),h=x.apply(this,arguments)-K,o=y.apply(this,arguments)-K,d=Math.abs(o-h),T=o>h;if(v||(v=t=i.path()),s<e&&(n=s,s=e,e=n),s>H)if(d>Q-H)v.moveTo(s*Math.cos(h),s*Math.sin(h)),v.arc(0,0,s,h,o,!T),e>H&&(v.moveTo(e*Math.cos(o),e*Math.sin(o)),v.arc(0,0,e,o,h,T));else{var M,g,b=h,w=o,m=h,k=o,N=d,S=d,E=p.apply(this,arguments)/2,A=E>H&&(f?+f.apply(this,arguments):Math.sqrt(e*e+s*s)),P=Math.min(Math.abs(s-e)/2,+u.apply(this,arguments)),q=P,C=P;if(A>H){var O=_(A/e*Math.sin(E)),R=_(A/s*Math.sin(E));(N-=2*O)>H?(O*=T?1:-1,m+=O,k-=O):(N=0,m=k=(h+o)/2),(S-=2*R)>H?(R*=T?1:-1,b+=R,w-=R):(S=0,b=w=(h+o)/2)}var z=s*Math.cos(b),X=s*Math.sin(b),Y=e*Math.cos(k),B=e*Math.sin(k);if(P>H){var j=s*Math.cos(w),I=s*Math.sin(w),L=e*Math.cos(m),D=e*Math.sin(m);if(d<J){var W=N>H?a(z,X,L,D,j,I,Y,B):[Y,B],V=z-W[0],F=X-W[1],G=j-W[0],U=I-W[1],Z=1/Math.sin(Math.acos((V*G+F*U)/(Math.sqrt(V*V+F*F)*Math.sqrt(G*G+U*U)))/2),$=Math.sqrt(W[0]*W[0]+W[1]*W[1]);q=Math.min(P,(e-$)/(Z-1)),C=Math.min(P,(s-$)/(Z+1))}}S>H?C>H?(M=r(L,D,z,X,s,C,T),g=r(j,I,Y,B,s,C,T),v.moveTo(M.cx+M.x01,M.cy+M.y01),C<P?v.arc(M.cx,M.cy,C,Math.atan2(M.y01,M.x01),Math.atan2(g.y01,g.x01),!T):(v.arc(M.cx,M.cy,C,Math.atan2(M.y01,M.x01),Math.atan2(M.y11,M.x11),!T),v.arc(0,0,s,Math.atan2(M.cy+M.y11,M.cx+M.x11),Math.atan2(g.cy+g.y11,g.cx+g.x11),!T),v.arc(g.cx,g.cy,C,Math.atan2(g.y11,g.x11),Math.atan2(g.y01,g.x01),!T))):(v.moveTo(z,X),v.arc(0,0,s,b,w,!T)):v.moveTo(z,X),e>H&&N>H?q>H?(M=r(Y,B,j,I,e,-q,T),g=r(z,X,L,D,e,-q,T),v.lineTo(M.cx+M.x01,M.cy+M.y01),q<P?v.arc(M.cx,M.cy,q,Math.atan2(M.y01,M.x01),Math.atan2(g.y01,g.x01),!T):(v.arc(M.cx,M.cy,q,Math.atan2(M.y01,M.x01),Math.atan2(M.y11,M.x11),!T),v.arc(0,0,e,Math.atan2(M.cy+M.y11,M.cx+M.x11),Math.atan2(g.cy+g.y11,g.cx+g.x11),T),v.arc(g.cx,g.cy,q,Math.atan2(g.y11,g.x11),Math.atan2(g.y01,g.x01),!T))):v.arc(0,0,e,k,m,T):v.lineTo(Y,B)}else v.moveTo(0,0);if(v.closePath(),t)return v=null,t+""||null}var c=n,l=e,u=G(0),f=null,x=s,y=h,p=o,v=null;return t.centroid=function(){var t=(+c.apply(this,arguments)+ +l.apply(this,arguments))/2,i=(+x.apply(this,arguments)+ +y.apply(this,arguments))/2-J/2;return[Math.cos(i)*t,Math.sin(i)*t]},t.innerRadius=function(i){return arguments.length?(c="function"==typeof i?i:G(+i),t):c},t.outerRadius=function(i){return arguments.length?(l="function"==typeof i?i:G(+i),t):l},t.cornerRadius=function(i){return arguments.length?(u="function"==typeof i?i:G(+i),t):u},t.padRadius=function(i){return arguments.length?(f=null==i?null:"function"==typeof i?i:G(+i),t):f},t.startAngle=function(i){return arguments.length?(x="function"==typeof i?i:G(+i),t):x},t.endAngle=function(i){return arguments.length?(y="function"==typeof i?i:G(+i),t):y},t.padAngle=function(i){return arguments.length?(p="function"==typeof i?i:G(+i),t):p},t.context=function(i){return arguments.length?(v=null==i?null:i,t):v},t};c.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,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,i)}}};var Z=function(t){return new c(t)},$=function(){function t(t){var a,r,c,l=t.length,u=!1;for(null==h&&(_=o(c=i.path())),a=0;a<=l;++a)!(a<l&&s(r=t[a],a,t))===u&&((u=!u)?_.lineStart():_.lineEnd()),u&&_.point(+n(r,a,t),+e(r,a,t));if(c)return _=null,c+""||null}var n=l,e=u,s=G(!0),h=null,o=Z,_=null;return t.x=function(i){return arguments.length?(n="function"==typeof i?i:G(+i),t):n},t.y=function(i){return arguments.length?(e="function"==typeof i?i:G(+i),t):e},t.defined=function(i){return arguments.length?(s="function"==typeof i?i:G(!!i),t):s},t.curve=function(i){return arguments.length?(o=i,null!=h&&(_=o(h)),t):o},t.context=function(i){return arguments.length?(null==i?h=_=null:_=o(h=i),t):h},t},tt=function(){function t(t){var n,l,u,f,x,y=t.length,p=!1,v=new Array(y),d=new Array(y);for(null==a&&(c=r(x=i.path())),n=0;n<=y;++n){if(!(n<y&&_(f=t[n],n,t))===p)if(p=!p)l=n,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),u=n-1;u>=l;--u)c.point(v[u],d[u]);c.lineEnd(),c.areaEnd()}p&&(v[n]=+e(f,n,t),d[n]=+h(f,n,t),c.point(s?+s(f,n,t):v[n],o?+o(f,n,t):d[n]))}if(x)return c=null,x+""||null}function n(){return $().defined(_).curve(r).context(a)}var e=l,s=null,h=G(0),o=u,_=G(!0),a=null,r=Z,c=null;return t.x=function(i){return arguments.length?(e="function"==typeof i?i:G(+i),s=null,t):e},t.x0=function(i){return arguments.length?(e="function"==typeof i?i:G(+i),t):e},t.x1=function(i){return arguments.length?(s=null==i?null:"function"==typeof i?i:G(+i),t):s},t.y=function(i){return arguments.length?(h="function"==typeof i?i:G(+i),o=null,t):h},t.y0=function(i){return arguments.length?(h="function"==typeof i?i:G(+i),t):h},t.y1=function(i){return arguments.length?(o=null==i?null:"function"==typeof i?i:G(+i),t):o},t.lineX0=t.lineY0=function(){return n().x(e).y(h)},t.lineY1=function(){return n().x(e).y(o)},t.lineX1=function(){return n().x(s).y(h)},t.defined=function(i){return arguments.length?(_="function"==typeof i?i:G(!!i),t):_},t.curve=function(i){return arguments.length?(r=i,null!=a&&(c=r(a)),t):r},t.context=function(i){return arguments.length?(null==i?a=c=null:c=r(a=i),t):a},t},it=function(t,i){return i<t?-1:i>t?1:i>=t?0:NaN},nt=function(t){return t},et=function(){function t(t){var _,a,r,c,l,u=t.length,f=0,x=new Array(u),y=new Array(u),p=+s.apply(this,arguments),v=Math.min(Q,Math.max(-Q,h.apply(this,arguments)-p)),d=Math.min(Math.abs(v)/u,o.apply(this,arguments)),T=d*(v<0?-1:1);for(_=0;_<u;++_)(l=y[x[_]=_]=+i(t[_],_,t))>0&&(f+=l);for(null!=n?x.sort(function(t,i){return n(y[t],y[i])}):null!=e&&x.sort(function(i,n){return e(t[i],t[n])}),_=0,r=f?(v-u*T)/f:0;_<u;++_,p=c)a=x[_],l=y[a],c=p+(l>0?l*r:0)+T,y[a]={data:t[a],index:_,value:l,startAngle:p,endAngle:c,padAngle:d};return y}var i=nt,n=it,e=null,s=G(0),h=G(Q),o=G(0);return t.value=function(n){return arguments.length?(i="function"==typeof n?n:G(+n),t):i},t.sortValues=function(i){return arguments.length?(n=i,e=null,t):n},t.sort=function(i){return arguments.length?(e=i,n=null,t):e},t.startAngle=function(i){return arguments.length?(s="function"==typeof i?i:G(+i),t):s},t.endAngle=function(i){return arguments.length?(h="function"==typeof i?i:G(+i),t):h},t.padAngle=function(i){return arguments.length?(o="function"==typeof i?i:G(+i),t):o},t},st=x(Z);f.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,i){this._curve.point(i*Math.sin(t),i*-Math.cos(t))}};var ht=function(){return y($().curve(st))},ot=function(){var t=tt().curve(st),i=t.curve,n=t.lineX0,e=t.lineX1,s=t.lineY0,h=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return y(n())},delete t.lineX0,t.lineEndAngle=function(){return y(e())},delete t.lineX1,t.lineInnerRadius=function(){return y(s())},delete t.lineY0,t.lineOuterRadius=function(){return y(h())},delete t.lineY1,t.curve=function(t){return arguments.length?i(x(t)):i()._curve},t},_t={draw:function(t,i){var n=Math.sqrt(i/J);t.moveTo(n,0),t.arc(0,0,n,0,Q)}},at={draw:function(t,i){var n=Math.sqrt(i/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},rt=Math.sqrt(1/3),ct=2*rt,lt={draw:function(t,i){var n=Math.sqrt(i/ct),e=n*rt;t.moveTo(0,-n),t.lineTo(e,0),t.lineTo(0,n),t.lineTo(-e,0),t.closePath()}},ut=.8908130915292852,ft=Math.sin(J/10)/Math.sin(7*J/10),xt=Math.sin(Q/10)*ft,yt=-Math.cos(Q/10)*ft,pt={draw:function(t,i){var n=Math.sqrt(i*ut),e=xt*n,s=yt*n;t.moveTo(0,-n),t.lineTo(e,s);for(var h=1;h<5;++h){var o=Q*h/5,_=Math.cos(o),a=Math.sin(o);t.lineTo(a*n,-_*n),t.lineTo(_*e-a*s,a*e+_*s)}t.closePath()}},vt={draw:function(t,i){var n=Math.sqrt(i),e=-n/2;t.rect(e,e,n,n)}},dt=Math.sqrt(3),Tt={draw:function(t,i){var n=-Math.sqrt(i/(3*dt));t.moveTo(0,2*n),t.lineTo(-dt*n,-n),t.lineTo(dt*n,-n),t.closePath()}},Mt=-.5,gt=Math.sqrt(3)/2,bt=1/Math.sqrt(12),wt=3*(bt/2+1),mt={draw:function(t,i){var n=Math.sqrt(i/wt),e=n/2,s=n*bt,h=e,o=n*bt+n,_=-h,a=o;t.moveTo(e,s),t.lineTo(h,o),t.lineTo(_,a),t.lineTo(Mt*e-gt*s,gt*e+Mt*s),t.lineTo(Mt*h-gt*o,gt*h+Mt*o),t.lineTo(Mt*_-gt*a,gt*_+Mt*a),t.lineTo(Mt*e+gt*s,Mt*s-gt*e),t.lineTo(Mt*h+gt*o,Mt*o-gt*h),t.lineTo(Mt*_+gt*a,Mt*a-gt*_),t.closePath()}},kt=[_t,at,lt,vt,pt,Tt,mt],Nt=function(){function t(){var t;if(s||(s=t=i.path()),n.apply(this,arguments).draw(s,+e.apply(this,arguments)),t)return s=null,t+""||null}var n=G(_t),e=G(64),s=null;return t.type=function(i){return arguments.length?(n="function"==typeof i?i:G(i),t):n},t.size=function(i){return arguments.length?(e="function"==typeof i?i:G(+i),t):e},t.context=function(i){return arguments.length?(s=null==i?null:i,t):s},t},St=function(){};v.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:p(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:p(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var Et=function(t){return new v(t)};d.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x2=t,this._y2=i;break;case 1:this._point=2,this._x3=t,this._y3=i;break;case 2:this._point=3,this._x4=t,this._y4=i,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+i)/6);break;default:p(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var At=function(t){return new d(t)};T.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+i)/6;this._line?this._context.lineTo(n,e):this._context.moveTo(n,e);break;case 3:this._point=4;default:p(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var Pt=function(t){return new T(t)};M.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,i=this._y,n=t.length-1;if(n>0)for(var e,s=t[0],h=i[0],o=t[n]-s,_=i[n]-h,a=-1;++a<=n;)e=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(s+e*o),this._beta*i[a]+(1-this._beta)*(h+e*_));this._x=this._y=null,this._basis.lineEnd()},point:function(t,i){this._x.push(+t),this._y.push(+i)}};var qt=function t(i){function n(t){return 1===i?new v(t):new M(t,i)}return n.beta=function(i){return t(+i)},n}(.85);b.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:g(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2,this._x1=t,this._y1=i;break;case 2:this._point=3;default:g(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Ct=function t(i){function n(t){return new b(t,i)}return n.tension=function(i){return t(+i)},n}(0);w.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:g(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Ot=function t(i){function n(t){return new w(t,i)}return n.tension=function(i){return t(+i)},n}(0);m.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:g(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Rt=function t(i){function n(t){return new m(t,i)}return n.tension=function(i){return t(+i)},n}(0);N.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3;default:k(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var zt=function t(i){function n(t){return i?new N(t,i):new b(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);S.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:k(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Xt=function t(i){function n(t){return i?new S(t,i):new w(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);E.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:k(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Yt=function t(i){function n(t){return i?new E(t,i):new m(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);A.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,i){t=+t,i=+i,this._point?this._context.lineTo(t,i):(this._point=1,this._context.moveTo(t,i))}};var Bt=function(t){return new A(t)};R.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:O(this,this._t0,C(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){var n=NaN;if(t=+t,i=+i,t!==this._x1||i!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,O(this,C(this,n=q(this,t,i)),n);break;default:O(this,this._t0,n=q(this,t,i))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._t0=n}}},(z.prototype=Object.create(R.prototype)).point=function(t,i){R.prototype.point.call(this,i,t)},X.prototype={moveTo:function(t,i){this._context.moveTo(i,t)},closePath:function(){this._context.closePath()},lineTo:function(t,i){this._context.lineTo(i,t)},bezierCurveTo:function(t,i,n,e,s,h){this._context.bezierCurveTo(i,t,e,n,h,s)}},j.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,i=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],i[0]):this._context.moveTo(t[0],i[0]),2===n)this._context.lineTo(t[1],i[1]);else for(var e=I(t),s=I(i),h=0,o=1;o<n;++h,++o)this._context.bezierCurveTo(e[0][h],s[0][h],e[1][h],s[1][h],t[o],i[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,i){this._x.push(+t),this._y.push(+i)}};var jt=function(t){return new j(t)};L.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,i),this._context.lineTo(t,i);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,i)}}this._x=t,this._y=i}};var It=function(t){return new L(t,.5)},Lt=Array.prototype.slice,Dt=function(t,i){if((e=t.length)>1)for(var n,e,s=1,h=t[i[0]],o=h.length;s<e;++s){n=h,h=t[i[s]];for(var _=0;_<o;++_)h[_][1]+=h[_][0]=isNaN(n[_][1])?n[_][0]:n[_][1]}},Wt=function(t){for(var i=t.length,n=new Array(i);--i>=0;)n[i]=i;return n},Vt=function(){function t(t){var h,o,_=i.apply(this,arguments),a=t.length,r=_.length,c=new Array(r);for(h=0;h<r;++h){for(var l,u=_[h],f=c[h]=new Array(a),x=0;x<a;++x)f[x]=l=[0,+s(t[x],u,x,t)],l.data=t[x];f.key=u}for(h=0,o=n(c);h<r;++h)c[o[h]].index=h;return e(c,o),c}var i=G([]),n=Wt,e=Dt,s=V;return t.keys=function(n){return arguments.length?(i="function"==typeof n?n:G(Lt.call(n)),t):i},t.value=function(i){return arguments.length?(s="function"==typeof i?i:G(+i),t):s},t.order=function(i){return arguments.length?(n=null==i?Wt:"function"==typeof i?i:G(Lt.call(i)),t):n},t.offset=function(i){return arguments.length?(e=null==i?Dt:i,t):e},t},Ft=function(t,i){if((e=t.length)>0){for(var n,e,s,h=0,o=t[0].length;h<o;++h){for(s=n=0;n<e;++n)s+=t[n][h][1]||0;if(s)for(n=0;n<e;++n)t[n][h][1]/=s}Dt(t,i)}},Gt=function(t,i){if((n=t.length)>0){for(var n,e=0,s=t[i[0]],h=s.length;e<h;++e){for(var o=0,_=0;o<n;++o)_+=t[o][e][1]||0;s[e][1]+=s[e][0]=-_/2}Dt(t,i)}},Ht=function(t,i){if((s=t.length)>0&&(e=(n=t[i[0]]).length)>0){for(var n,e,s,h=0,o=1;o<e;++o){for(var _=0,a=0,r=0;_<s;++_){for(var c=t[i[_]],l=c[o][1]||0,u=c[o-1][1]||0,f=(l-u)/2,x=0;x<_;++x){var y=t[i[x]],p=y[o][1]||0,v=y[o-1][1]||0;f+=p-v}a+=l,r+=f*l}n[o-1][1]+=n[o-1][0]=h,a&&(h-=r/a)}n[o-1][1]+=n[o-1][0]=h,Dt(t,i)}},Jt=function(t){var i=t.map(F);return Wt(t).sort(function(t,n){return i[t]-i[n]})},Kt=function(t){return Jt(t).reverse()},Qt=function(t){var i,n,e=t.length,s=t.map(F),h=Wt(t).sort(function(t,i){return s[i]-s[t]}),o=0,_=0,a=[],r=[];for(i=0;i<e;++i)n=h[i],o<_?(o+=s[n],a.push(n)):(_+=s[n],r.push(n));return r.reverse().concat(a)},Ut=function(t){return Wt(t).reverse()};t.arc=U,t.area=tt,t.line=$,t.pie=et,t.radialArea=ot,t.radialLine=ht,t.symbol=Nt,t.symbols=kt,t.symbolCircle=_t,t.symbolCross=at,t.symbolDiamond=lt,t.symbolSquare=vt,t.symbolStar=pt,t.symbolTriangle=Tt,t.symbolWye=mt,t.curveBasisClosed=At,t.curveBasisOpen=Pt,t.curveBasis=Et,t.curveBundle=qt,t.curveCardinalClosed=Ot,t.curveCardinalOpen=Rt,t.curveCardinal=Ct,t.curveCatmullRomClosed=Xt,t.curveCatmullRomOpen=Yt,t.curveCatmullRom=zt,t.curveLinearClosed=Bt,t.curveLinear=Z,t.curveMonotoneX=Y,t.curveMonotoneY=B,t.curveNatural=jt,t.curveStep=It,t.curveStepAfter=W,t.curveStepBefore=D,t.stack=Vt,t.stackOffsetExpand=Ft,t.stackOffsetNone=Dt,t.stackOffsetSilhouette=Gt,t.stackOffsetWiggle=Ht,t.stackOrderAscending=Jt,t.stackOrderDescending=Kt,t.stackOrderInsideOut=Qt,t.stackOrderNone=Wt,t.stackOrderReverse=Ut,Object.defineProperty(t,"__esModule",{value:!0})});
// https://d3js.org/d3-shape/ Version 1.0.5. Copyright 2017 Mike Bostock.
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],i):i(t.d3=t.d3||{},t.d3)}(this,function(t,i){"use strict";function n(t){return t>1?0:t<-1?nt:Math.acos(t)}function e(t){return t>=1?et:t<=-1?-et:Math.asin(t)}function s(t){return t.innerRadius}function h(t){return t.outerRadius}function o(t){return t.startAngle}function _(t){return t.endAngle}function r(t){return t&&t.padAngle}function a(t,i,n,e,s,h,o,_){var r=n-t,a=e-i,c=o-s,l=_-h,u=(c*(i-h)-l*(t-s))/(l*r-c*a);return[t+u*r,i+u*a]}function c(t,i,n,e,s,h,o){var _=t-n,r=i-e,a=(o?h:-h)/tt(_*_+r*r),c=a*r,l=-a*_,u=t+c,f=i+l,x=n+c,y=e+l,p=(u+x)/2,v=(f+y)/2,d=x-u,T=y-f,g=d*d+T*T,b=s-h,w=u*y-x*f,m=(T<0?-1:1)*tt(U(0,b*b*g-w*w)),k=(w*T-d*m)/g,N=(-w*d-T*m)/g,M=(w*T+d*m)/g,S=(-w*d+T*m)/g,E=k-p,A=N-v,P=M-p,C=S-v;return E*E+A*A>P*P+C*C&&(k=M,N=S),{cx:k,cy:N,x01:-c,y01:-l,x11:k*(s/b-1),y11:N*(s/b-1)}}function l(t){this._context=t}function u(t){return t[0]}function f(t){return t[1]}function x(t){this._curve=t}function y(t){function i(i){return new x(t(i))}return i._curve=t,i}function p(t){var i=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?i(y(t)):i()._curve},t}function v(t,i,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+i)/6,(t._y0+4*t._y1+n)/6)}function d(t){this._context=t}function T(t){this._context=t}function g(t){this._context=t}function b(t,i){this._basis=new d(t),this._beta=i}function w(t,i,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-i),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function m(t,i){this._context=t,this._k=(1-i)/6}function k(t,i){this._context=t,this._k=(1-i)/6}function N(t,i){this._context=t,this._k=(1-i)/6}function M(t,i,n){var e=t._x1,s=t._y1,h=t._x2,o=t._y2;if(t._l01_a>it){var _=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,r=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*_-t._x0*t._l12_2a+t._x2*t._l01_2a)/r,s=(s*_-t._y0*t._l12_2a+t._y2*t._l01_2a)/r}if(t._l23_a>it){var a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*a+t._x1*t._l23_2a-i*t._l12_2a)/c,o=(o*a+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(e,s,h,o,t._x2,t._y2)}function S(t,i){this._context=t,this._alpha=i}function E(t,i){this._context=t,this._alpha=i}function A(t,i){this._context=t,this._alpha=i}function P(t){this._context=t}function C(t){return t<0?-1:1}function q(t,i,n){var e=t._x1-t._x0,s=i-t._x1,h=(t._y1-t._y0)/(e||s<0&&-0),o=(n-t._y1)/(s||e<0&&-0),_=(h*s+o*e)/(e+s);return(C(h)+C(o))*Math.min(Math.abs(h),Math.abs(o),.5*Math.abs(_))||0}function O(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function R(t,i,n){var e=t._x0,s=t._y0,h=t._x1,o=t._y1,_=(h-e)/3;t._context.bezierCurveTo(e+_,s+_*i,h-_,o-_*n,h,o)}function z(t){this._context=t}function X(t){this._context=new Y(t)}function Y(t){this._context=t}function B(t){return new z(t)}function j(t){return new X(t)}function I(t){this._context=t}function L(t){var i,n,e=t.length-1,s=new Array(e),h=new Array(e),o=new Array(e);for(s[0]=0,h[0]=2,o[0]=t[0]+2*t[1],i=1;i<e-1;++i)s[i]=1,h[i]=4,o[i]=4*t[i]+2*t[i+1];for(s[e-1]=2,h[e-1]=7,o[e-1]=8*t[e-1]+t[e],i=1;i<e;++i)n=s[i]/h[i-1],h[i]-=n,o[i]-=n*o[i-1];for(s[e-1]=o[e-1]/h[e-1],i=e-2;i>=0;--i)s[i]=(o[i]-s[i+1])/h[i];for(h[e-1]=(t[e]+s[e-1])/2,i=0;i<e-1;++i)h[i]=2*t[i+1]-s[i+1];return[s,h]}function D(t,i){this._context=t,this._t=i}function W(t){return new D(t,0)}function V(t){return new D(t,1)}function F(t,i){return t[i]}function G(t){for(var i,n=0,e=-1,s=t.length;++e<s;)(i=+t[e][1])&&(n+=i);return n}var H=function(t){return function(){return t}},J=Math.abs,K=Math.atan2,Q=Math.cos,U=Math.max,Z=Math.min,$=Math.sin,tt=Math.sqrt,it=1e-12,nt=Math.PI,et=nt/2,st=2*nt,ht=function(){function t(){var t,s,h=+l.apply(this,arguments),o=+u.apply(this,arguments),_=y.apply(this,arguments)-et,r=p.apply(this,arguments)-et,T=J(r-_),g=r>_;if(d||(d=t=i.path()),o<h&&(s=o,o=h,h=s),o>it)if(T>st-it)d.moveTo(o*Q(_),o*$(_)),d.arc(0,0,o,_,r,!g),h>it&&(d.moveTo(h*Q(r),h*$(r)),d.arc(0,0,h,r,_,g));else{var b,w,m=_,k=r,N=_,M=r,S=T,E=T,A=v.apply(this,arguments)/2,P=A>it&&(x?+x.apply(this,arguments):tt(h*h+o*o)),C=Z(J(o-h)/2,+f.apply(this,arguments)),q=C,O=C;if(P>it){var R=e(P/h*$(A)),z=e(P/o*$(A));(S-=2*R)>it?(R*=g?1:-1,N+=R,M-=R):(S=0,N=M=(_+r)/2),(E-=2*z)>it?(z*=g?1:-1,m+=z,k-=z):(E=0,m=k=(_+r)/2)}var X=o*Q(m),Y=o*$(m),B=h*Q(M),j=h*$(M);if(C>it){var I=o*Q(k),L=o*$(k),D=h*Q(N),W=h*$(N);if(T<nt){var V=S>it?a(X,Y,D,W,I,L,B,j):[B,j],F=X-V[0],G=Y-V[1],H=I-V[0],U=L-V[1],ht=1/$(n((F*H+G*U)/(tt(F*F+G*G)*tt(H*H+U*U)))/2),ot=tt(V[0]*V[0]+V[1]*V[1]);q=Z(C,(h-ot)/(ht-1)),O=Z(C,(o-ot)/(ht+1))}}E>it?O>it?(b=c(D,W,X,Y,o,O,g),w=c(I,L,B,j,o,O,g),d.moveTo(b.cx+b.x01,b.cy+b.y01),O<C?d.arc(b.cx,b.cy,O,K(b.y01,b.x01),K(w.y01,w.x01),!g):(d.arc(b.cx,b.cy,O,K(b.y01,b.x01),K(b.y11,b.x11),!g),d.arc(0,0,o,K(b.cy+b.y11,b.cx+b.x11),K(w.cy+w.y11,w.cx+w.x11),!g),d.arc(w.cx,w.cy,O,K(w.y11,w.x11),K(w.y01,w.x01),!g))):(d.moveTo(X,Y),d.arc(0,0,o,m,k,!g)):d.moveTo(X,Y),h>it&&S>it?q>it?(b=c(B,j,I,L,h,-q,g),w=c(X,Y,D,W,h,-q,g),d.lineTo(b.cx+b.x01,b.cy+b.y01),q<C?d.arc(b.cx,b.cy,q,K(b.y01,b.x01),K(w.y01,w.x01),!g):(d.arc(b.cx,b.cy,q,K(b.y01,b.x01),K(b.y11,b.x11),!g),d.arc(0,0,h,K(b.cy+b.y11,b.cx+b.x11),K(w.cy+w.y11,w.cx+w.x11),g),d.arc(w.cx,w.cy,q,K(w.y11,w.x11),K(w.y01,w.x01),!g))):d.arc(0,0,h,M,N,g):d.lineTo(B,j)}else d.moveTo(0,0);if(d.closePath(),t)return d=null,t+""||null}var l=s,u=h,f=H(0),x=null,y=o,p=_,v=r,d=null;return t.centroid=function(){var t=(+l.apply(this,arguments)+ +u.apply(this,arguments))/2,i=(+y.apply(this,arguments)+ +p.apply(this,arguments))/2-nt/2;return[Q(i)*t,$(i)*t]},t.innerRadius=function(i){return arguments.length?(l="function"==typeof i?i:H(+i),t):l},t.outerRadius=function(i){return arguments.length?(u="function"==typeof i?i:H(+i),t):u},t.cornerRadius=function(i){return arguments.length?(f="function"==typeof i?i:H(+i),t):f},t.padRadius=function(i){return arguments.length?(x=null==i?null:"function"==typeof i?i:H(+i),t):x},t.startAngle=function(i){return arguments.length?(y="function"==typeof i?i:H(+i),t):y},t.endAngle=function(i){return arguments.length?(p="function"==typeof i?i:H(+i),t):p},t.padAngle=function(i){return arguments.length?(v="function"==typeof i?i:H(+i),t):v},t.context=function(i){return arguments.length?(d=null==i?null:i,t):d},t};l.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,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,i)}}};var ot=function(t){return new l(t)},_t=function(){function t(t){var r,a,c,l=t.length,u=!1;for(null==h&&(_=o(c=i.path())),r=0;r<=l;++r)!(r<l&&s(a=t[r],r,t))===u&&((u=!u)?_.lineStart():_.lineEnd()),u&&_.point(+n(a,r,t),+e(a,r,t));if(c)return _=null,c+""||null}var n=u,e=f,s=H(!0),h=null,o=ot,_=null;return t.x=function(i){return arguments.length?(n="function"==typeof i?i:H(+i),t):n},t.y=function(i){return arguments.length?(e="function"==typeof i?i:H(+i),t):e},t.defined=function(i){return arguments.length?(s="function"==typeof i?i:H(!!i),t):s},t.curve=function(i){return arguments.length?(o=i,null!=h&&(_=o(h)),t):o},t.context=function(i){return arguments.length?(null==i?h=_=null:_=o(h=i),t):h},t},rt=function(){function t(t){var n,l,u,f,x,y=t.length,p=!1,v=new Array(y),d=new Array(y);for(null==r&&(c=a(x=i.path())),n=0;n<=y;++n){if(!(n<y&&_(f=t[n],n,t))===p)if(p=!p)l=n,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),u=n-1;u>=l;--u)c.point(v[u],d[u]);c.lineEnd(),c.areaEnd()}p&&(v[n]=+e(f,n,t),d[n]=+h(f,n,t),c.point(s?+s(f,n,t):v[n],o?+o(f,n,t):d[n]))}if(x)return c=null,x+""||null}function n(){return _t().defined(_).curve(a).context(r)}var e=u,s=null,h=H(0),o=f,_=H(!0),r=null,a=ot,c=null;return t.x=function(i){return arguments.length?(e="function"==typeof i?i:H(+i),s=null,t):e},t.x0=function(i){return arguments.length?(e="function"==typeof i?i:H(+i),t):e},t.x1=function(i){return arguments.length?(s=null==i?null:"function"==typeof i?i:H(+i),t):s},t.y=function(i){return arguments.length?(h="function"==typeof i?i:H(+i),o=null,t):h},t.y0=function(i){return arguments.length?(h="function"==typeof i?i:H(+i),t):h},t.y1=function(i){return arguments.length?(o=null==i?null:"function"==typeof i?i:H(+i),t):o},t.lineX0=t.lineY0=function(){return n().x(e).y(h)},t.lineY1=function(){return n().x(e).y(o)},t.lineX1=function(){return n().x(s).y(h)},t.defined=function(i){return arguments.length?(_="function"==typeof i?i:H(!!i),t):_},t.curve=function(i){return arguments.length?(a=i,null!=r&&(c=a(r)),t):a},t.context=function(i){return arguments.length?(null==i?r=c=null:c=a(r=i),t):r},t},at=function(t,i){return i<t?-1:i>t?1:i>=t?0:NaN},ct=function(t){return t},lt=function(){function t(t){var _,r,a,c,l,u=t.length,f=0,x=new Array(u),y=new Array(u),p=+s.apply(this,arguments),v=Math.min(st,Math.max(-st,h.apply(this,arguments)-p)),d=Math.min(Math.abs(v)/u,o.apply(this,arguments)),T=d*(v<0?-1:1);for(_=0;_<u;++_)(l=y[x[_]=_]=+i(t[_],_,t))>0&&(f+=l);for(null!=n?x.sort(function(t,i){return n(y[t],y[i])}):null!=e&&x.sort(function(i,n){return e(t[i],t[n])}),_=0,a=f?(v-u*T)/f:0;_<u;++_,p=c)r=x[_],l=y[r],c=p+(l>0?l*a:0)+T,y[r]={data:t[r],index:_,value:l,startAngle:p,endAngle:c,padAngle:d};return y}var i=ct,n=at,e=null,s=H(0),h=H(st),o=H(0);return t.value=function(n){return arguments.length?(i="function"==typeof n?n:H(+n),t):i},t.sortValues=function(i){return arguments.length?(n=i,e=null,t):n},t.sort=function(i){return arguments.length?(e=i,n=null,t):e},t.startAngle=function(i){return arguments.length?(s="function"==typeof i?i:H(+i),t):s},t.endAngle=function(i){return arguments.length?(h="function"==typeof i?i:H(+i),t):h},t.padAngle=function(i){return arguments.length?(o="function"==typeof i?i:H(+i),t):o},t},ut=y(ot);x.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,i){this._curve.point(i*Math.sin(t),i*-Math.cos(t))}};var ft=function(){return p(_t().curve(ut))},xt=function(){var t=rt().curve(ut),i=t.curve,n=t.lineX0,e=t.lineX1,s=t.lineY0,h=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return p(n())},delete t.lineX0,t.lineEndAngle=function(){return p(e())},delete t.lineX1,t.lineInnerRadius=function(){return p(s())},delete t.lineY0,t.lineOuterRadius=function(){return p(h())},delete t.lineY1,t.curve=function(t){return arguments.length?i(y(t)):i()._curve},t},yt={draw:function(t,i){var n=Math.sqrt(i/nt);t.moveTo(n,0),t.arc(0,0,n,0,st)}},pt={draw:function(t,i){var n=Math.sqrt(i/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},vt=Math.sqrt(1/3),dt=2*vt,Tt={draw:function(t,i){var n=Math.sqrt(i/dt),e=n*vt;t.moveTo(0,-n),t.lineTo(e,0),t.lineTo(0,n),t.lineTo(-e,0),t.closePath()}},gt=.8908130915292852,bt=Math.sin(nt/10)/Math.sin(7*nt/10),wt=Math.sin(st/10)*bt,mt=-Math.cos(st/10)*bt,kt={draw:function(t,i){var n=Math.sqrt(i*gt),e=wt*n,s=mt*n;t.moveTo(0,-n),t.lineTo(e,s);for(var h=1;h<5;++h){var o=st*h/5,_=Math.cos(o),r=Math.sin(o);t.lineTo(r*n,-_*n),t.lineTo(_*e-r*s,r*e+_*s)}t.closePath()}},Nt={draw:function(t,i){var n=Math.sqrt(i),e=-n/2;t.rect(e,e,n,n)}},Mt=Math.sqrt(3),St={draw:function(t,i){var n=-Math.sqrt(i/(3*Mt));t.moveTo(0,2*n),t.lineTo(-Mt*n,-n),t.lineTo(Mt*n,-n),t.closePath()}},Et=-.5,At=Math.sqrt(3)/2,Pt=1/Math.sqrt(12),Ct=3*(Pt/2+1),qt={draw:function(t,i){var n=Math.sqrt(i/Ct),e=n/2,s=n*Pt,h=e,o=n*Pt+n,_=-h,r=o;t.moveTo(e,s),t.lineTo(h,o),t.lineTo(_,r),t.lineTo(Et*e-At*s,At*e+Et*s),t.lineTo(Et*h-At*o,At*h+Et*o),t.lineTo(Et*_-At*r,At*_+Et*r),t.lineTo(Et*e+At*s,Et*s-At*e),t.lineTo(Et*h+At*o,Et*o-At*h),t.lineTo(Et*_+At*r,Et*r-At*_),t.closePath()}},Ot=[yt,pt,Tt,Nt,kt,St,qt],Rt=function(){function t(){var t;if(s||(s=t=i.path()),n.apply(this,arguments).draw(s,+e.apply(this,arguments)),t)return s=null,t+""||null}var n=H(yt),e=H(64),s=null;return t.type=function(i){return arguments.length?(n="function"==typeof i?i:H(i),t):n},t.size=function(i){return arguments.length?(e="function"==typeof i?i:H(+i),t):e},t.context=function(i){return arguments.length?(s=null==i?null:i,t):s},t},zt=function(){};d.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:v(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:v(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var Xt=function(t){return new d(t)};T.prototype={areaStart:zt,areaEnd:zt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x2=t,this._y2=i;break;case 1:this._point=2,this._x3=t,this._y3=i;break;case 2:this._point=3,this._x4=t,this._y4=i,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+i)/6);break;default:v(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var Yt=function(t){return new T(t)};g.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+i)/6;this._line?this._context.lineTo(n,e):this._context.moveTo(n,e);break;case 3:this._point=4;default:v(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};var Bt=function(t){return new g(t)};b.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,i=this._y,n=t.length-1;if(n>0)for(var e,s=t[0],h=i[0],o=t[n]-s,_=i[n]-h,r=-1;++r<=n;)e=r/n,this._basis.point(this._beta*t[r]+(1-this._beta)*(s+e*o),this._beta*i[r]+(1-this._beta)*(h+e*_));this._x=this._y=null,this._basis.lineEnd()},point:function(t,i){this._x.push(+t),this._y.push(+i)}};var jt=function t(i){function n(t){return 1===i?new d(t):new b(t,i)}return n.beta=function(i){return t(+i)},n}(.85);m.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:w(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2,this._x1=t,this._y1=i;break;case 2:this._point=3;default:w(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var It=function t(i){function n(t){return new m(t,i)}return n.tension=function(i){return t(+i)},n}(0);k.prototype={areaStart:zt,areaEnd:zt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:w(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Lt=function t(i){function n(t){return new k(t,i)}return n.tension=function(i){return t(+i)},n}(0);N.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:w(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Dt=function t(i){function n(t){return new N(t,i)}return n.tension=function(i){return t(+i)},n}(0);S.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3;default:M(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Wt=function t(i){function n(t){return i?new S(t,i):new m(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);E.prototype={areaStart:zt,areaEnd:zt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:M(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Vt=function t(i){function n(t){return i?new E(t,i):new k(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);A.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:M(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var Ft=function t(i){function n(t){return i?new A(t,i):new N(t,0)}return n.alpha=function(i){return t(+i)},n}(.5);P.prototype={areaStart:zt,areaEnd:zt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,i){t=+t,i=+i,this._point?this._context.lineTo(t,i):(this._point=1,this._context.moveTo(t,i))}};var Gt=function(t){return new P(t)};z.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:R(this,this._t0,O(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){var n=NaN;if(t=+t,i=+i,t!==this._x1||i!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,R(this,O(this,n=q(this,t,i)),n);break;default:R(this,this._t0,n=q(this,t,i))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._t0=n}}},(X.prototype=Object.create(z.prototype)).point=function(t,i){z.prototype.point.call(this,i,t)},Y.prototype={moveTo:function(t,i){this._context.moveTo(i,t)},closePath:function(){this._context.closePath()},lineTo:function(t,i){this._context.lineTo(i,t)},bezierCurveTo:function(t,i,n,e,s,h){this._context.bezierCurveTo(i,t,e,n,h,s)}},I.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,i=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],i[0]):this._context.moveTo(t[0],i[0]),2===n)this._context.lineTo(t[1],i[1]);else for(var e=L(t),s=L(i),h=0,o=1;o<n;++h,++o)this._context.bezierCurveTo(e[0][h],s[0][h],e[1][h],s[1][h],t[o],i[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,i){this._x.push(+t),this._y.push(+i)}};var Ht=function(t){return new I(t)};D.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,i),this._context.lineTo(t,i);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,i)}}this._x=t,this._y=i}};var Jt=function(t){return new D(t,.5)},Kt=Array.prototype.slice,Qt=function(t,i){if((e=t.length)>1)for(var n,e,s=1,h=t[i[0]],o=h.length;s<e;++s){n=h,h=t[i[s]];for(var _=0;_<o;++_)h[_][1]+=h[_][0]=isNaN(n[_][1])?n[_][0]:n[_][1]}},Ut=function(t){for(var i=t.length,n=new Array(i);--i>=0;)n[i]=i;return n},Zt=function(){function t(t){var h,o,_=i.apply(this,arguments),r=t.length,a=_.length,c=new Array(a);for(h=0;h<a;++h){for(var l,u=_[h],f=c[h]=new Array(r),x=0;x<r;++x)f[x]=l=[0,+s(t[x],u,x,t)],l.data=t[x];f.key=u}for(h=0,o=n(c);h<a;++h)c[o[h]].index=h;return e(c,o),c}var i=H([]),n=Ut,e=Qt,s=F;return t.keys=function(n){return arguments.length?(i="function"==typeof n?n:H(Kt.call(n)),t):i},t.value=function(i){return arguments.length?(s="function"==typeof i?i:H(+i),t):s},t.order=function(i){return arguments.length?(n=null==i?Ut:"function"==typeof i?i:H(Kt.call(i)),t):n},t.offset=function(i){return arguments.length?(e=null==i?Qt:i,t):e},t},$t=function(t,i){if((e=t.length)>0){for(var n,e,s,h=0,o=t[0].length;h<o;++h){for(s=n=0;n<e;++n)s+=t[n][h][1]||0;if(s)for(n=0;n<e;++n)t[n][h][1]/=s}Qt(t,i)}},ti=function(t,i){if((n=t.length)>0){for(var n,e=0,s=t[i[0]],h=s.length;e<h;++e){for(var o=0,_=0;o<n;++o)_+=t[o][e][1]||0;s[e][1]+=s[e][0]=-_/2}Qt(t,i)}},ii=function(t,i){if((s=t.length)>0&&(e=(n=t[i[0]]).length)>0){for(var n,e,s,h=0,o=1;o<e;++o){for(var _=0,r=0,a=0;_<s;++_){for(var c=t[i[_]],l=c[o][1]||0,u=c[o-1][1]||0,f=(l-u)/2,x=0;x<_;++x){var y=t[i[x]];f+=(y[o][1]||0)-(y[o-1][1]||0)}r+=l,a+=f*l}n[o-1][1]+=n[o-1][0]=h,r&&(h-=a/r)}n[o-1][1]+=n[o-1][0]=h,Qt(t,i)}},ni=function(t){var i=t.map(G);return Ut(t).sort(function(t,n){return i[t]-i[n]})},ei=function(t){return ni(t).reverse()},si=function(t){var i,n,e=t.length,s=t.map(G),h=Ut(t).sort(function(t,i){return s[i]-s[t]}),o=0,_=0,r=[],a=[];for(i=0;i<e;++i)n=h[i],o<_?(o+=s[n],r.push(n)):(_+=s[n],a.push(n));return a.reverse().concat(r)},hi=function(t){return Ut(t).reverse()};t.arc=ht,t.area=rt,t.line=_t,t.pie=lt,t.radialArea=xt,t.radialLine=ft,t.symbol=Rt,t.symbols=Ot,t.symbolCircle=yt,t.symbolCross=pt,t.symbolDiamond=Tt,t.symbolSquare=Nt,t.symbolStar=kt,t.symbolTriangle=St,t.symbolWye=qt,t.curveBasisClosed=Yt,t.curveBasisOpen=Bt,t.curveBasis=Xt,t.curveBundle=jt,t.curveCardinalClosed=Lt,t.curveCardinalOpen=Dt,t.curveCardinal=It,t.curveCatmullRomClosed=Vt,t.curveCatmullRomOpen=Ft,t.curveCatmullRom=Wt,t.curveLinearClosed=Gt,t.curveLinear=ot,t.curveMonotoneX=B,t.curveMonotoneY=j,t.curveNatural=Ht,t.curveStep=Jt,t.curveStepAfter=V,t.curveStepBefore=W,t.stack=Zt,t.stackOffsetExpand=$t,t.stackOffsetNone=Qt,t.stackOffsetSilhouette=ti,t.stackOffsetWiggle=ii,t.stackOrderAscending=ni,t.stackOrderDescending=ei,t.stackOrderInsideOut=si,t.stackOrderNone=Ut,t.stackOrderReverse=hi,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-shape",
"version": "1.0.4",
"version": "1.0.5",
"description": "Graphical primitives for visualization, such as lines and areas.",

@@ -30,3 +30,3 @@ "keywords": [

"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-shape.js -c -m -o build/d3-shape.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-shape/build/d3-shape.js d3-shape.v1.js && cp ../d3-shape/build/d3-shape.min.js d3-shape.v1.min.js && git add d3-shape.v1.js d3-shape.v1.min.js && git commit -m \"d3-shape ${VERSION}\" && git push && cd - && zip -j build/d3-shape.zip -- LICENSE README.md build/d3-shape.js build/d3-shape.min.js"
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-shape/build/d3-shape.js d3-shape.v1.js && cp ../d3-shape/build/d3-shape.min.js d3-shape.v1.min.js && git add d3-shape.v1.js d3-shape.v1.min.js && git commit -m \"d3-shape ${npm_package_version}\" && git push && cd - && zip -j build/d3-shape.zip -- LICENSE README.md build/d3-shape.js build/d3-shape.min.js"
},

@@ -40,3 +40,3 @@ "dependencies": {

"package-preamble": "0.0",
"rollup": "0.36",
"rollup": "0.41",
"tape": "4",

@@ -43,0 +43,0 @@ "uglify-js": "2"

import {path} from "d3-path";
import constant from "./constant";
import {epsilon, pi, halfPi, tau} from "./math";
import {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from "./math";

@@ -25,6 +25,2 @@ function arcInnerRadius(d) {

function asin(x) {
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {

@@ -42,3 +38,3 @@ var x10 = x1 - x0, y10 = y1 - y0,

y01 = y0 - y1,
lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01),
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
ox = lo * y01,

@@ -57,3 +53,3 @@ oy = -lo * x01,

D = x11 * y10 - x10 * y11,
d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)),
d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
cx0 = (D * dy - dx * d) / d2,

@@ -99,3 +95,3 @@ cy0 = (-D * dx - dy * d) / d2,

a1 = endAngle.apply(this, arguments) - halfPi,
da = Math.abs(a1 - a0),
da = abs(a1 - a0),
cw = a1 > a0;

@@ -113,6 +109,6 @@

else if (da > tau - epsilon) {
context.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0));
context.moveTo(r1 * cos(a0), r1 * sin(a0));
context.arc(0, 0, r1, a0, a1, !cw);
if (r0 > epsilon) {
context.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1));
context.moveTo(r0 * cos(a1), r0 * sin(a1));
context.arc(0, 0, r0, a1, a0, cw);

@@ -131,4 +127,4 @@ }

ap = padAngle.apply(this, arguments) / 2,
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : Math.sqrt(r0 * r0 + r1 * r1)),
rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
rc0 = rc,

@@ -141,4 +137,4 @@ rc1 = rc,

if (rp > epsilon) {
var p0 = asin(rp / r0 * Math.sin(ap)),
p1 = asin(rp / r1 * Math.sin(ap));
var p0 = asin(rp / r0 * sin(ap)),
p1 = asin(rp / r1 * sin(ap));
if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;

@@ -150,13 +146,13 @@ else da0 = 0, a00 = a10 = (a0 + a1) / 2;

var x01 = r1 * Math.cos(a01),
y01 = r1 * Math.sin(a01),
x10 = r0 * Math.cos(a10),
y10 = r0 * Math.sin(a10);
var x01 = r1 * cos(a01),
y01 = r1 * sin(a01),
x10 = r0 * cos(a10),
y10 = r0 * sin(a10);
// Apply rounded corners?
if (rc > epsilon) {
var x11 = r1 * Math.cos(a11),
y11 = r1 * Math.sin(a11),
x00 = r0 * Math.cos(a00),
y00 = r0 * Math.sin(a00);
var x11 = r1 * cos(a11),
y11 = r1 * sin(a11),
x00 = r0 * cos(a00),
y00 = r0 * sin(a00);

@@ -170,6 +166,6 @@ // Restrict the corner radius according to the sector angle.

by = y11 - oc[1],
kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2),
lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = min(rc, (r0 - lc) / (kc - 1));
rc1 = min(rc, (r1 - lc) / (kc + 1));
}

@@ -189,9 +185,9 @@ }

// Have the corners merged?
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw);
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw);
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}

@@ -215,9 +211,9 @@ }

// Have the corners merged?
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw);
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw);
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}

@@ -238,3 +234,3 @@ }

a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
return [Math.cos(a) * r, Math.sin(a) * r];
return [cos(a) * r, sin(a) * r];
};

@@ -241,0 +237,0 @@

@@ -0,1 +1,9 @@

export var abs = Math.abs;
export var atan2 = Math.atan2;
export var cos = Math.cos;
export var max = Math.max;
export var min = Math.min;
export var sin = Math.sin;
export var sqrt = Math.sqrt;
export var epsilon = 1e-12;

@@ -5,1 +13,9 @@ export var pi = Math.PI;

export var tau = 2 * pi;
export function acos(x) {
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
}
export function asin(x) {
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc