// https://github.com/BastiTee/d3-cooltip Version 0.1.0. Copyright 2017 Basti Tee. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3")):"function"==typeof define&&define.amd?define(["exports","d3"],e):e(t.d3=t.d3||{},t.d3)}(this,function(t,e){"use strict";var n=function(){function t(t){t.each(function(){var t,l,d,c=e.select(this),f=this.ownerSVGElement,s=f.getBBox(),g=!1,p=function(){var n=e.mouse(f),r=l.node().getBBox(),i=n[0],a=n[1]-r.height;i=i-r.width/2<0?r.width/2:i,i=i+r.width/2>s.width?s.width-r.width/2:i,a=a-o<0?o:a,a=a+r.height-o>s.height?s.height-r.height+o:a,t.attr("transform","translate("+i+","+a+")")},x=function(){g&&(g=!1,t.remove())},y=function(c){if(!g){g=!0,t=e.select(f).append("g").style("pointer-events","none"),l=t.append("rect"),d=t.append("text").attr("class","cooltip-text");var s=""+u(c),p=s.split("\n");for(var x in p)d.append("tspan").style("text-anchor","middle").style("dominant-baseline","hanging").style("fill",r).attr("x",0).attr("dy",function(){return 0==x?0:a}).text(p[x]);var y=d.node().getBBox();l.attr("class","cooltip-box").attr("rx",h).attr("ry",h).attr("width",y.width+2*o).attr("height",y.height+2*o).attr("x",-y.width/2-o).attr("y",-o).attr("opacity",n).style("fill",i)}};c.on("mouseover",y),c.on("mouseout",x),c.on("mousemove",p)})}var n=.8,o=5,r="white",i="black",a=20,h=5,u=function(){return(new Date).toDateString()+"\n"+String(Math.floor(9e8*Math.random()))};return t.opacity=function(e){return arguments.length?(n=e,t):n},t.padding=function(e){return arguments.length?(o=e,t):o},t.color=function(e){return arguments.length?(r=e,t):r},t.fill=function(e){return arguments.length?(i=e,t):i},t.lineHeight=function(e){return arguments.length?(a=e,t):a},t.roundCorners=function(e){return arguments.length?(h=e,t):h},t.selector=function(e){return arguments.length?(u=e,t):u},t};t.cooltip=n,Object.defineProperty(t,"__esModule",{value:!0})});