{"size": 12583, "ext": "js", "max_stars_repo_path": "public/highchart/code/modules/venn.js", "max_stars_repo_name": "nhatquyen/Laravel-Hue_cit", "max_stars_repo_stars_event_min_datetime": "2020-10-29T20:31:03.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-21T20:23:22.000Z", "max_issues_repo_path": "public/highchart/code/modules/venn.js", "max_issues_repo_name": "nhatquyen/Laravel-Hue_cit", "max_issues_repo_issues_event_min_datetime": "2020-05-31T03:00:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-24T04:28:31.000Z", "max_forks_repo_path": "public/highchart/code/modules/venn.js", "max_forks_repo_name": "nhatquyen/Laravel-Hue_cit", "max_forks_repo_forks_event_min_datetime": "2020-05-31T18:14:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-16T14:38:49.000Z"}
{"max_stars_count": 4, "max_issues_count": 113, "max_forks_count": 10, "avg_line_length": 370.0882352941, "max_line_length": 532, "alphanum_fraction": 0.668679965}
/*
 Highcharts JS v8.0.0 (2019-12-10)

 (c) 2017-2019 Highsoft AS
 Authors: Jon Arild Nygard

 License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/venn",["highcharts"],function(q){a(q);a.Highcharts=q;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function q(g,e,f,k){g.hasOwnProperty(e)||(g[e]=k.apply(null,f))}a=a?a._modules:{};q(a,"mixins/draw-point.js",[],function(){var g=function(e){var f=this,k=f.graphic,g=e.animatableAttribs,a=e.onComplete,y=e.css,w=e.renderer;
if(f.shouldDraw())k||(f.graphic=k=w[e.shapeType](e.shapeArgs).add(e.group)),k.css(y).attr(e.attribs).animate(g,e.isNew?!1:void 0,a);else if(k){var x=function(){f.graphic=k=k.destroy();"function"===typeof a&&a()};Object.keys(g).length?k.animate(g,void 0,function(){x()}):x()}};return function(e){(e.attribs=e.attribs||{})["class"]=this.getClassName();g.call(this,e)}});q(a,"mixins/geometry.js",[],function(){return{getAngleBetweenPoints:function(g,e){return Math.atan2(e.x-g.x,e.y-g.y)},getCenterOfPoints:function(g){var e=
g.reduce(function(e,g){e.x+=g.x;e.y+=g.y;return e},{x:0,y:0});return{x:e.x/g.length,y:e.y/g.length}},getDistanceBetweenPoints:function(g,e){return Math.sqrt(Math.pow(e.x-g.x,2)+Math.pow(e.y-g.y,2))}}});q(a,"mixins/geometry-circles.js",[a["mixins/geometry.js"]],function(g){function e(b,c){c=Math.pow(10,c);return Math.round(b*c)/c}function f(b){if(0>=b)throw Error("radius of circle must be a positive number.");return Math.PI*b*b}function k(b,c){return b*b*Math.acos(1-c/b)-(b-c)*Math.sqrt(c*(2*b-c))}
function a(b,c){var h=u(b,c),v=b.r,f=c.r,g=[];if(h<v+f&&h>Math.abs(v-f)){v*=v;var a=(v-f*f+h*h)/(2*h);f=Math.sqrt(v-a*a);v=b.x;g=c.x;b=b.y;var k=c.y;c=v+a*(g-v)/h;a=b+a*(k-b)/h;b=f/h*-(k-b);h=f/h*-(g-v);g=[{x:e(c+b,14),y:e(a-h,14)},{x:e(c-b,14),y:e(a+h,14)}]}return g}function n(b){return b.reduce(function(b,e,f,g){g=g.slice(f+1).reduce(function(b,c,g){var h=[f,g+f+1];return b.concat(a(e,c).map(function(b){b.indexes=h;return b}))},[]);return b.concat(g)},[])}function y(b,c){return u(b,c)<=c.r+1e-10}
function w(b,c){return!c.some(function(c){return!y(b,c)})}function x(b){return n(b).filter(function(c){return w(c,b)})}var r=g.getAngleBetweenPoints,t=g.getCenterOfPoints,u=g.getDistanceBetweenPoints;return{getAreaOfCircle:f,getAreaOfIntersectionBetweenCircles:function(b){var c=x(b);if(1<c.length){var e=t(c);c=c.map(function(b){b.angle=r(e,b);return b}).sort(function(b,c){return c.angle-b.angle});var f=c[c.length-1];c=c.reduce(function(c,e){var f=c.startPoint,g=t([f,e]),h=e.indexes.filter(function(b){return-1<
f.indexes.indexOf(b)}).reduce(function(c,h){h=b[h];var a=r(h,e),k=r(h,f);a=k-(k-a+(k<a?2*Math.PI:0))/2;a=u(g,{x:h.x+h.r*Math.sin(a),y:h.y+h.r*Math.cos(a)});h=h.r;a>2*h&&(a=2*h);if(!c||c.width>a)c={r:h,largeArc:a>h?1:0,width:a,x:e.x,y:e.y};return c},null);if(h){var a=h.r;c.arcs.push(["A",a,a,0,h.largeArc,1,h.x,h.y]);c.startPoint=e}return c},{startPoint:f,arcs:[]}).arcs;if(0!==c.length&&1!==c.length){c.unshift(["M",f.x,f.y]);var g={center:e,d:c}}}return g},getCircleCircleIntersection:a,getCirclesIntersectionPoints:n,
getCirclesIntersectionPolygon:x,getCircularSegmentArea:k,getOverlapBetweenCircles:function(b,c,h){var a=0;h<b+c&&(h<=Math.abs(c-b)?a=f(b<c?b:c):(a=(b*b-c*c+h*h)/(2*h),h-=a,a=k(b,b-a)+k(c,c-h)),a=e(a,14));return a},isCircle1CompletelyOverlappingCircle2:function(b,c){return u(b,c)+c.r<b.r+1e-10},isPointInsideCircle:y,isPointInsideAllCircles:w,isPointOutsideAllCircles:function(b,c){return!c.some(function(c){return y(b,c)})},round:e}});q(a,"mixins/nelder-mead.js",[],function(){var a=function(a){a=a.slice(0,
-1);for(var e=a.length,g=[],q=function(a,e){a.sum+=e[a.i];return a},n=0;n<e;n++)g[n]=a.reduce(q,{sum:0,i:n}).sum/e;return g};return{getCentroid:a,nelderMead:function(e,f){var g=function(b,c){return b.fx-c.fx},q=function(b,c,a,e){return c.map(function(c,h){return b*c+a*e[h]})},n=function(b,c){c.fx=e(c);b[b.length-1]=c;return b},y=function(b){var c=b[0];return b.map(function(b){b=q(.5,c,.5,b);b.fx=e(b);return b})},w=function(b,c,a,f){b=q(a,b,f,c);b.fx=e(b);return b};f=function(b){var c=b.length,a=Array(c+
1);a[0]=b;a[0].fx=e(b);for(var f=0;f<c;++f){var g=b.slice();g[f]=g[f]?1.05*g[f]:.001;g.fx=e(g);a[f+1]=g}return a}(f);for(var x=0;100>x;x++){f.sort(g);var r=f[f.length-1],t=a(f),u=w(t,r,2,-1);u.fx<f[0].fx?(r=w(t,r,3,-2),f=n(f,r.fx<u.fx?r:u)):u.fx>=f[f.length-2].fx?u.fx>r.fx?(t=w(t,r,.5,.5),f=t.fx<r.fx?n(f,t):y(f)):(t=w(t,r,1.5,-.5),f=t.fx<u.fx?n(f,t):y(f)):f=n(f,u)}return f[0]}}});q(a,"modules/venn.src.js",[a["parts/Globals.js"],a["mixins/draw-point.js"],a["mixins/geometry.js"],a["mixins/geometry-circles.js"],
a["mixins/nelder-mead.js"],a["parts/Utilities.js"]],function(a,e,f,k,q,n){function g(d,b){var a=d.sets,m=b.reduce(function(d,b){var l=-1<a.indexOf(b.sets[0]);d[l?"internal":"external"].push(b.circle);return d},{internal:[],external:[]});m.external=m.external.filter(function(d){return m.internal.some(function(b){return!c(d,b)})});d=Y(m.internal,m.external);b=J(d,m.internal,m.external);return{position:d,width:b}}function w(d){var b={},a={};if(0<d.length){var c=K(d),l=d.filter(B);d.forEach(function(d){var p=
d.sets,m=p.join();if(p=B(d)?c[m]:r(p.map(function(d){return c[d]})))b[m]=p,a[m]=g(d,l)})}return{mapOfIdToShape:b,mapOfIdToLabelValues:a}}var x=k.getAreaOfCircle,r=k.getAreaOfIntersectionBetweenCircles,t=k.getCircleCircleIntersection,u=k.getCirclesIntersectionPolygon,b=k.getOverlapBetweenCircles,c=k.isCircle1CompletelyOverlappingCircle2,h=k.isPointInsideAllCircles,v=k.isPointInsideCircle,G=k.isPointOutsideAllCircles,T=q.nelderMead,U=n.animObject,A=n.isArray,z=n.isNumber,C=n.isObject,X=n.isString;n=
a.addEvent;var V=a.Color,H=a.extend,W=f.getCenterOfPoints,D=f.getDistanceBetweenPoints,L=a.merge,Z=a.seriesType,M=a.seriesTypes,aa=function(d){return Object.keys(d).map(function(b){return d[b]})},ba=function(d){var a=0;2===d.length&&(a=d[0],d=d[1],a=b(a.r,d.r,D(a,d)));return a},N=function(d,b){return b.reduce(function(b,a){var l=0;1<a.sets.length&&(l=a.value,a=ba(a.sets.map(function(b){return d[b]})),a=l-a,l=Math.round(a*a*1E11)/1E11);return b+l},0)},O=function(b,a,c,m,l){var d=b(a),p=b(c);l=l||100;
m=m||1e-10;var e=c-a,f=1;if(a>=c)throw Error("a must be smaller than b.");if(0<d*p)throw Error("f(a) and f(b) must have opposite signs.");if(0===d)var g=a;else if(0===p)g=c;else for(;f++<=l&&0!==I&&e>m;){e=(c-a)/2;g=a+e;var I=b(g);0<d*I?a=g:c=g}return g},E=function(a,c,p){var d=a+c;return 0>=p?d:x(a<c?a:c)<=p?0:O(function(d){d=b(a,c,d);return p-d},0,d)},B=function(a){return A(a.sets)&&1===a.sets.length},F=function(a,b,c){b=b.reduce(function(b,d){d=d.r-D(a,d);return d<=b?d:b},Number.MAX_VALUE);return b=
c.reduce(function(b,d){d=D(a,d)-d.r;return d<=b?d:b},b)},Y=function(a,b){var d=a.reduce(function(d,c){var e=c.r/2;return[{x:c.x,y:c.y},{x:c.x+e,y:c.y},{x:c.x-e,y:c.y},{x:c.x,y:c.y+e},{x:c.x,y:c.y-e}].reduce(function(d,c){var e=F(c,a,b);d.margin<e&&(d.point=c,d.margin=e);return d},d)},{point:void 0,margin:-Number.MAX_VALUE}).point;d=T(function(d){return-F({x:d[0],y:d[1]},a,b)},[d.x,d.y]);d={x:d[0],y:d[1]};h(d,a)&&G(d,b)||(d=1<a.length?W(u(a)):{x:a[0].x,y:a[0].y});return d},J=function(a,b,c){var d=
b.reduce(function(a,b){return Math.min(b.r,a)},Infinity),e=c.filter(function(b){return!v(a,b)});c=function(d,c){return O(function(f){var l={x:a.x+c*f,y:a.y};l=h(l,b)&&G(l,e);return-(d-f)+(l?0:Number.MAX_VALUE)},0,d)};return 2*Math.min(c(d,-1),c(d,1))},P=function(a){var b=a.filter(function(a){return 2===a.sets.length}).reduce(function(a,b){b.sets.forEach(function(d,c,e){C(a[d])||(a[d]={overlapping:{},totalOverlap:0});a[d].totalOverlap+=b.value;a[d].overlapping[e[1-c]]=b.value});return a},{});a.filter(B).forEach(function(a){H(a,
b[a.sets[0]])});return a},Q=function(a,b){return b.totalOverlap-a.totalOverlap},K=function(a){var b=[],d={};a.filter(function(a){return 1===a.sets.length}).forEach(function(a){d[a.sets[0]]=a.circle={x:Number.MAX_VALUE,y:Number.MAX_VALUE,r:Math.sqrt(a.value/Math.PI)}});var c=function(a,d){var c=a.circle;c.x=d.x;c.y=d.y;b.push(a)};P(a);var e=a.filter(B).sort(Q);c(e.shift(),{x:0,y:0});var f=a.filter(function(a){return 2===a.sets.length});e.forEach(function(a){var e=a.circle,g=e.r,l=a.overlapping,h=b.reduce(function(a,
c,h){var m=c.circle,p=E(g,m.r,l[c.sets[0]]),k=[{x:m.x+p,y:m.y},{x:m.x-p,y:m.y},{x:m.x,y:m.y+p},{x:m.x,y:m.y-p}];b.slice(h+1).forEach(function(a){var b=a.circle;a=E(g,b.r,l[a.sets[0]]);k=k.concat(t({x:m.x,y:m.y,r:p},{x:b.x,y:b.y,r:a}))});k.forEach(function(b){e.x=b.x;e.y=b.y;var c=N(d,f);c<a.loss&&(a.loss=c,a.coordinates=b)});return a},{loss:Number.MAX_VALUE,coordinates:void 0});c(a,h.coordinates)});return d},R=function(a){var b={};return C(a)&&z(a.value)&&-1<a.value&&A(a.sets)&&0<a.sets.length&&!a.sets.some(function(a){var c=
!1;!b[a]&&X(a)?b[a]=!0:c=!0;return c})},S=function(a){a=A(a)?a:[];var b=a.reduce(function(a,b){R(b)&&B(b)&&0<b.value&&-1===a.indexOf(b.sets[0])&&a.push(b.sets[0]);return a},[]).sort(),c=a.reduce(function(a,c){R(c)&&!c.sets.some(function(a){return-1===b.indexOf(a)})&&(a[c.sets.sort().join()]=c);return a},{});b.reduce(function(a,b,c,d){d.slice(c+1).forEach(function(c){a.push(b+","+c)});return a},[]).forEach(function(a){if(!c[a]){var b={sets:a.split(","),value:0};c[a]=b}});return aa(c)},ca=function(a,
b,c){var d=c.bottom-c.top,e=c.right-c.left;d=Math.min(0<e?1/e*a:1,0<d?1/d*b:1);return{scale:d,centerX:a/2-(c.right+c.left)/2*d,centerY:b/2-(c.top+c.bottom)/2*d}};Z("venn","scatter",{borderColor:"#cccccc",borderDashStyle:"solid",borderWidth:1,brighten:0,clip:!1,colorByPoint:!0,dataLabels:{enabled:!0,verticalAlign:"middle",formatter:function(){return this.point.name}},inactiveOtherPoints:!0,marker:!1,opacity:.75,showInLegend:!1,states:{hover:{opacity:1,borderColor:"#333333"},select:{color:"#cccccc",
borderColor:"#000000",animation:!1}},tooltip:{pointFormat:"{point.name}: {point.value}"}},{isCartesian:!1,axisTypes:[],directTouch:!0,pointArrayMap:["value"],translate:function(){var a=this.chart;this.processedXData=this.xData;this.generatePoints();var b=S(this.options.data);b=w(b);var c=b.mapOfIdToShape,e=b.mapOfIdToLabelValues;b=Object.keys(c).filter(function(a){return(a=c[a])&&z(a.r)}).reduce(function(a,b){var d=c[b];b=d.x-d.r;var e=d.x+d.r,f=d.y+d.r;d=d.y-d.r;if(!z(a.left)||a.left>b)a.left=b;
if(!z(a.right)||a.right<e)a.right=e;if(!z(a.top)||a.top>d)a.top=d;if(!z(a.bottom)||a.bottom<f)a.bottom=f;return a},{top:0,bottom:0,left:0,right:0});a=ca(a.plotWidth,a.plotHeight,b);var f=a.scale,g=a.centerX,h=a.centerY;this.points.forEach(function(a){var b=A(a.sets)?a.sets:[],d=b.join(),k=c[d],m,l=e[d]||{};d=l.width;l=l.position;var p=a.options&&a.options.dataLabels;k&&(k.r?m={x:g+k.x*f,y:h+k.y*f,r:k.r*f}:k.d&&(m={d:k.d.reduce(function(a,b){"M"===b[0]?(b[1]=g+b[1]*f,b[2]=h+b[2]*f):"A"===b[0]&&(b[1]*=
f,b[2]*=f,b[6]=g+b[6]*f,b[7]=h+b[7]*f);return a.concat(b)},[]).join(" ")}),l?(l.x=g+l.x*f,l.y=h+l.y*f):l={},z(d)&&(d=Math.round(d*f)));a.shapeArgs=m;l&&m&&(a.plotX=l.x,a.plotY=l.y);d&&m&&(a.dlOptions=L(!0,{style:{width:d}},C(p)&&p));a.name=a.options.name||b.join("\u2229")})},drawPoints:function(){var a=this,b=a.chart,c=a.group,e=b.renderer;(a.points||[]).forEach(function(d){var f={zIndex:A(d.sets)?d.sets.length:0},g=d.shapeArgs;b.styledMode||H(f,a.pointAttribs(d,d.state));d.draw({isNew:!d.graphic,
animatableAttribs:g,attribs:f,group:c,renderer:e,shapeType:g&&g.d?"path":"circle"})})},pointAttribs:function(a,b){var c=this.options||{};a=L(c,{color:a&&a.color},a&&a.options||{},b&&c.states[b]||{});return{fill:V(a.color).setOpacity(a.opacity).brighten(a.brightness).get(),stroke:a.borderColor,"stroke-width":a.borderWidth,dashstyle:a.borderDashStyle}},animate:function(a){if(!a){var b=U(this.options.animation);this.points.forEach(function(a){var c=a.shapeArgs;if(a.graphic&&c){var d={},e={};c.d?d.opacity=
.001:(d.r=0,e.r=c.r);a.graphic.attr(d).animate(e,b);c.d&&setTimeout(function(){a&&a.graphic&&a.graphic.animate({opacity:1})},b.duration)}},this);this.animate=null}},utils:{addOverlapToSets:P,geometry:f,geometryCircles:k,getLabelWidth:J,getMarginFromCircles:F,getDistanceBetweenCirclesByOverlap:E,layoutGreedyVenn:K,loss:N,nelderMead:q,processVennData:S,sortByTotalOverlap:Q}},{draw:e,shouldDraw:function(){return!!this.shapeArgs},isValid:function(){return z(this.value)}});n(M.venn,"afterSetOptions",function(a){var b=
a.options.states;this instanceof M.venn&&Object.keys(b).forEach(function(a){b[a].halo=!1})})});q(a,"masters/modules/venn.src.js",[],function(){})});
//# sourceMappingURL=venn.js.map