vizabi-bubblechart
Advanced tools
Comparing version 1.0.17-0 to 1.0.17-1
@@ -1,2 +0,2 @@ | ||
!function(e){function t(a){if(i[a])return i[a].exports;var r=i[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,a){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i(5);var a=i(1),r=function(e){return e&&e.__esModule?e:{default:e}}(a),o={version:"1.0.17-0",build:1495645620236};t.default=Vizabi.Tool.extend("BubbleChart",{init:function(e,t){this.name="bubblechart",this.components=[{component:r.default,placeholder:".vzb-tool-viz",model:["state.time","state.entities","state.marker","locale","ui"]},{component:Vizabi.Component.get("timeslider"),placeholder:".vzb-tool-timeslider",model:["state.time","state.entities","state.marker","ui"]},{component:Vizabi.Component.get("dialogs"),placeholder:".vzb-tool-dialogs",model:["state","ui","locale"]},{component:Vizabi.Component.get("buttonlist"),placeholder:".vzb-tool-buttonlist",model:["state","ui","locale"]},{component:Vizabi.Component.get("treemenu"),placeholder:".vzb-tool-treemenu",model:["state.marker","state.marker_tags","state.time","locale"]},{component:Vizabi.Component.get("datawarning"),placeholder:".vzb-tool-datawarning",model:["locale"]},{component:Vizabi.Component.get("datanotes"),placeholder:".vzb-tool-datanotes",model:["state.marker","locale"]},{component:Vizabi.Component.get("steppedspeedslider"),placeholder:".vzb-tool-stepped-speed-slider",model:["state.time","locale"]}],this._super(e,t)},validate:function(e){if(e=this.model||e,this._super(e),e.ui.chart.lockNonSelected){var t=e.state.time.parse(""+e.ui.chart.lockNonSelected);t<e.state.time.start&&(e.ui.chart.lockNonSelected=e.state.time.formatDate(e.state.time.start)),t>e.state.time.end&&(e.ui.chart.lockNonSelected=e.state.time.formatDate(e.state.time.end))}},default_model:{state:{time:{autogenerate:{data:"data",conceptIndex:0,conceptType:"time"}},entities:{autogenerate:{data:"data",conceptIndex:0}},entities_colorlegend:{autogenerate:{data:"data",conceptIndex:0}},entities_tags:{},marker_tags:{space:["entities_tags"],label:{},hook_parent:{}},marker:{space:["entities","time"],axis_x:{use:"indicator",autogenerate:{conceptIndex:1,conceptType:"measure"}},axis_y:{use:"indicator",autogenerate:{conceptIndex:0,conceptType:"measure"}},label:{use:"property",autogenerate:{conceptIndex:0}},size:{autogenerate:{conceptIndex:2,conceptType:"measure"}},color:{syncModels:["marker_colorlegend"],autogenerate:{conceptIndex:0,conceptType:"entity_set"}},size_label:{use:"constant",which:"_default",scaleType:"ordinal",_important:!1,extent:[0,.33],allow:{names:["_default"]}}},marker_colorlegend:{space:["entities_colorlegend"],label:{use:"property",which:"name"},hook_rank:{use:"property",which:"rank"},hook_geoshape:{use:"property",which:"shape_lores_svg"}}},locale:{},ui:{chart:{whenHovering:{showProjectionLineX:!0,showProjectionLineY:!0,higlightValueX:!0,higlightValueY:!0},labels:{dragging:!0,removeLabelBox:!1},trails:!0,lockNonSelected:0},datawarning:{doubtDomain:[],doubtRange:[]},presentation:!1,panWithArrow:!1,adaptMinMaxZoom:!1,cursorMode:"arrow",zoomOnScrolling:!1,buttons:["colors","find","trails","lock","moreoptions","fullscreen","presentation"],dialogs:{popup:["colors","find","size","zoom","moreoptions"],sidebar:["colors","find","size","zoom"],moreoptions:["opacity","speed","axes","size","colors","label","zoom","presentation","about"]}}},versionInfo:o})},function(e,t,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(3),o=a(r),n=i(2),l=a(n),s=Vizabi,c=s.utils,d=Vizabi.helpers,h=d.svgexport,u=d.labels,m=d["d3.axisWithLabelPicker"],g=d["d3.dynamicBackground"],v=Vizabi.iconset,f=v.warn,p=v.question,x=Vizabi.Component.extend("bubblechart",{init:function(e,t){var a=this;this.name="bubblechart",this.template=i(6),this.model_expects=[{name:"time",type:"time"},{name:"entities",type:"entities"},{name:"marker",type:"model"},{name:"locale",type:"locale"},{name:"ui",type:"ui"}],this.model_binds={"change:time.playing":function(e,t){c.isTouchDevice()&&a.model.time.playing&&a.someHighlighted&&a.model.marker.clearHighlighted()},"change:time.start":function(e,t){"time"===a.model.marker.color.scaleType&&(a.model.marker.color.scale=null),a._readyOnce&&!a.model.time.splash&&a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])})},"change:time.end":function(e,t){a._readyOnce&&!a.model.time.splash&&a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])})},"change:time.record":function(){a.model.time.record?a._export.open(this.element,this.name):a._export.reset()},"change:ui.chart.trails":function(e){a._trails.toggle(a.model.ui.chart.trails),a.redrawDataPoints()},"change:ui.chart.lockNonSelected":function(e){a.redrawDataPoints(500)},"change:marker":function(e,t){if(a._readyOnce){if(t.indexOf("scaleType")>-1)return void a.ready();if(-1===t.indexOf("marker.color")&&-1===t.indexOf("marker.size")&&-1===t.indexOf("marker.size_label"))if(t.indexOf("domainMin")>-1||t.indexOf("domainMax")>-1){if(!a.yScale||!a.xScale)return;a.updateSize(),a.updateMarkerSizeLimits(),a._trails.run("findVisible"),a.redrawDataPoints(),a._trails.run("resize",null,500)}else if(t.indexOf("zoomedMin")>-1||t.indexOf("zoomedMax")>-1){if(a.draggingNow)return;if(c.approxEqual(a._zoomedXYMinMax.axis_x.zoomedMin,a.model.marker.axis_x.zoomedMin,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_x.zoomedMax,a.model.marker.axis_x.zoomedMax,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_y.zoomedMin,a.model.marker.axis_y.zoomedMin,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_y.zoomedMax,a.model.marker.axis_y.zoomedMax,.01))return;var i=!1;a.model.time.playing&&(i=!0,a.model.time.pause(!0)),a._trails.run("abortAnimation"),a._panZoom.zoomToMaxMin(a.model.marker.axis_x.getZoomedMin(),a.model.marker.axis_x.getZoomedMax(),a.model.marker.axis_y.getZoomedMin(),a.model.marker.axis_y.getZoomedMax(),500,"don't feed these zoom values back to state"),i&&(a.model.time.postponePause=!1)}}},"change:marker.select":function(e,t){a._readyOnce&&a.entityBubbles&&((e.source._val||[]).length-(e.source._previousVal||[]).length>50&&(a.model.ui.chart.trails=!1),a.selectDataPoints(),a.redrawDataPoints(),a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])}),a.updateBubbleOpacity(),a._updateDoubtOpacity())},"change:marker.highlight":function(e,t){if(a._readyOnce)if("highlight"==t)a.highlightDataPoints();else if(null!==t){var i=a._formatSTitleValues(t.size,t.color);a._updateSTitle(i[0],i[1])}else a._updateSTitle()},"change:time.value":function(){a._readyOnce&&a.entityBubbles&&(a.calculationQueue?a.calculationQueue.push(a.model.time.value.toString()):a.calculationQueue=[a.model.time.value.toString()],function(e){a.model.marker.getFrame(e,function(e,t){if(!a._frameIsValid(e))return c.warn("change:time.value: empty data received from marker.getFrame(). doing nothing");var i=a.calculationQueue.indexOf(t.toString());-1!=i&&(a.calculationQueue.splice(0,i+1),a.frameChanged(e,t))})}(a.model.time.value))},"change:ui.adaptMinMaxZoom":function(){a.model.ui.adaptMinMaxZoom?a._panZoom.expandCanvas(500):a._panZoom.reset()},"change:marker.size.extent":function(e,t){a._readyOnce&&(a.updateMarkerSizeLimits(),a.redrawDataPointsOnlySize(),a._trails.run("resize"))},"change:marker.color":function(e,t){a._readyOnce&&(a.redrawDataPointsOnlyColors(),a._trails.run("recolor"))},"change:marker.opacitySelectDim":function(){a.updateBubbleOpacity()},"change:marker.opacityRegular":function(){a.updateBubbleOpacity(),a._trails.run("opacityHandler")},"change:ui.cursorMode":function(){var e=a.chartSvg;"plus"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!0),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!1)):"minus"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!0),e.classed("vzb-panhand",!1)):"hand"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!0)):(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!1))},"change:entities.dim":function(){a.someHighlighted&&a.model.marker.clearHighlighted(),a.someSelected&&a.model.marker.clearSelected()},ready:function(){}},this._super(e,t),this.xScale=null,this.yScale=null,this.sScale=null,this.cScale=null,this.xAxis=m("bottom"),this.yAxis=m("left"),a.COLOR_BLACKISH="#333",a.COLOR_WHITEISH="#fdfdfd",this.isCanvasPreviouslyExpanded=!1,this.draggingNow=null,this._trails=new o.default(this),this._panZoom=new l.default(this),this._export=new h(this),this._export.prefix("vzb-bc-").deleteClasses(["vzb-bc-bubbles-crop","vzb-hidden","vzb-bc-year","vzb-bc-zoom-rect","vzb-bc-projection-x","vzb-bc-projection-y","vzb-bc-axis-c-title"]),this._labels=new u(this),this._labels.config({CSS_PREFIX:"vzb-bc",LABELS_CONTAINER_CLASS:"vzb-bc-labels",LINES_CONTAINER_CLASS:"vzb-bc-bubbles",LINES_CONTAINER_SELECTOR_PREFIX:"bubble-"})},_rangeBump:function(e,t){var i=this.activeProfile.maxRadiusPx/2;if(t=t?-1:1,c.isArray(e)&&e.length>1){var a=e[0],r=e[e.length-1];return a<r?(a+=i*t,r-=i*t,a>r&&(a=r=(a+r)/2)):a>r&&(a-=i*t,r+=i*t,a<r&&(a=r=(a+r)/2)),[a,r]}c.warn("rangeBump error: input is not an array or empty")},readyOnce:function(){var e=this;this._readyOnce=!1,this.scrollableAncestor=c.findScrollableAncestor(this.element),this.element=d3.select(this.element),this.chartSvg=this.element.select("svg"),this.graph=this.element.select(".vzb-bc-graph"),this.yAxisElContainer=this.graph.select(".vzb-bc-axis-y"),this.yAxisEl=this.yAxisElContainer.select("g"),this.xAxisElContainer=this.graph.select(".vzb-bc-axis-x"),this.xAxisEl=this.xAxisElContainer.select("g"),this.yTitleEl=this.graph.select(".vzb-bc-axis-y-title"),this.xTitleEl=this.graph.select(".vzb-bc-axis-x-title"),this.sTitleEl=this.graph.select(".vzb-bc-axis-s-title"),this.cTitleEl=this.graph.select(".vzb-bc-axis-c-title"),this.yearEl=this.graph.select(".vzb-bc-year"),this.year=new g(this.yearEl),this.yInfoEl=this.graph.select(".vzb-bc-axis-y-info"),this.xInfoEl=this.graph.select(".vzb-bc-axis-x-info"),this.dataWarningEl=this.graph.select(".vzb-data-warning"),this.projectionX=this.graph.select(".vzb-bc-projection-x"),this.projectionY=this.graph.select(".vzb-bc-projection-y"),this.lineEqualXY=this.graph.select(".vzb-bc-line-equal-xy"),this.trailsContainer=this.graph.select(".vzb-bc-trails"),this.bubbleContainerCrop=this.graph.select(".vzb-bc-bubbles-crop"),this.zoomSelection=this.graph.select(".vzb-zoom-selection"),this.labelsContainerCrop=this.graph.select(".vzb-bc-labels-crop"),this.bubbleContainer=this.graph.select(".vzb-bc-bubbles"),this.labelsContainer=this.graph.select(".vzb-bc-labels"),this.linesContainer=this.graph.select(".vzb-bc-lines"),this.zoomRect=this.element.select(".vzb-bc-zoom-rect"),this.eventArea=this.element.select(".vzb-bc-eventarea"),this.entityBubbles=null,this.bubbleCrown=this.element.select(".vzb-bc-bubble-crown"),this.bubbleCrown.selectAll(".vzb-crown-glow").attr("filter","url("+location.pathname+"#vzb-glow-filter)"),this.tooltip=this.element.select(".vzb-bc-tooltip"),this.tooltip.select(".vzb-tooltip-glow").attr("filter","url("+location.pathname+"#vzb-glow-filter)"),this.tooltipMobile=this.element.select(".vzb-tooltip-mobile"),this.on("resize",function(){e._trails.run("abortAnimation"),e.updateSize()||(e.updateMarkerSizeLimits(),e._labels.updateSize(),function(t,i,a,r){e._panZoom.zoomer.dontFeedToState=!0,e._panZoom.rerun(),e._panZoom.zoomToMaxMin(t,i,a,r,0,!0)}(e._zoomedXYMinMax.axis_x.zoomedMin,e._zoomedXYMinMax.axis_x.zoomedMax,e._zoomedXYMinMax.axis_y.zoomedMin,e._zoomedXYMinMax.axis_y.zoomedMax))}),d3.select("body").on("keydown",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||(d3.event.metaKey||d3.event.ctrlKey)&&e.element.select("svg").classed("vzb-zoomin",!0)}).on("keyup",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||d3.event.metaKey||d3.event.ctrlKey||e.element.select("svg").classed("vzb-zoomin",!1)}).on("mouseenter",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||d3.event.metaKey||d3.event.ctrlKey||e.element.select("svg").classed("vzb-zoomin",!1)}),this.root.on("resetZoom",function(){e._panZoom.reset(null,500)}),this._panZoom.zoomSelection(this.bubbleContainerCrop),this.bubbleContainerCrop.call(this._panZoom.dragRectangle).call(this._panZoom.zoomer).on("dblclick.zoom",null).on("mouseup",function(){e.draggingNow=!1}).on("click",function(){var t=e.model.ui.cursorMode;d3.event.defaultPrevented||"arrow"===t||"hand"===t||e._panZoom.zoomByIncrement(t,500)}),this.KEY=this.model.entities.getDimension(),this.TIMEDIM=this.model.time.getDimension(),this.updateUIStrings(),this.wScale=d3.scale.linear().domain(this.model.ui.datawarning.doubtDomain).range(this.model.ui.datawarning.doubtRange),this._labels.readyOnce(),e._readyOnce=!0},_frameIsValid:function(e){return!(!e||0===Object.keys(e.axis_y).length||0===Object.keys(e.axis_x).length||0===Object.keys(e.size).length)},ready:function(){var e=this;this.KEY=this.model.entities.getDimension(),this.updateUIStrings();this.model.time.end;this.updateIndicators(),this.updateTime(),e.model.time.splash||e._trails.create(),this.model.marker.getFrame(this.model.time.value,function(t,i){return i.toString()!=e.model.time.value.toString()?void c.defer(function(){e.ready()}):e._frameIsValid(t)?(e.frame=t,e.updateSize(),e.updateMarkerSizeLimits(),e.updateEntities(),e._labels.ready(),e.redrawDataPoints(),e.selectDataPoints(),e.updateBubbleOpacity(),e._updateDoubtOpacity(),e.zoomToMarkerMaxMin(),e.model.time.splash||e._trails.run(["findVisible","reveal","opacityHandler"]),void(e.model.ui.adaptMinMaxZoom&&e._panZoom.expandCanvas())):c.warn("ready: empty data received from marker.getFrame(). doing nothing")})},zoomToMarkerMaxMin:function(){this._panZoom.resetZoomState();var e=this.model.marker.axis_x,t=this.model.marker.axis_y,i=(e.getScale().domain(),t.getScale().domain(),e.getZoomedMin()),a=e.getZoomedMax(),r=t.getZoomedMin(),o=t.getZoomedMax();this._panZoom.zoomToMaxMin(i,a,r,o,0,"don't feed these zoom values back to state")},updateIndicators:function(){var e=this;this.yScale=this.model.marker.axis_y.getScale(),this.xScale=this.model.marker.axis_x.getScale(),this.sScale=this.model.marker.size.getScale(),this.cScale=this.model.marker.color.getScale(),this._labels.setScales(this.xScale,this.yScale),this.yAxis.tickFormat(e.model.marker.axis_y.getTickFormatter()),this.xAxis.tickFormat(e.model.marker.axis_x.getTickFormatter())},frameChanged:function(e,t){this.frame=e,this.updateTime(),this._updateDoubtOpacity(),this._trails.run("findVisible"),this.model.ui.adaptMinMaxZoom?this._panZoom.expandCanvas():this.redrawDataPoints(),this._trails.run("reveal",null,this.duration),this.tooltipMobile.classed("vzb-hidden",!0),this._reorderEntities()},updateUIStrings:function(){var e=this,t=e.model.marker.axis_y.getConceptprops(),i=e.model.marker.axis_x.getConceptprops(),a=e.model.marker.size.getConceptprops(),r=e.model.marker.color.getConceptprops();this.translator=this.model.locale.getTFunction(),this.strings={title:{Y:t.name,X:i.name,S:a.name,C:r.name},unit:{Y:t.unit||"",X:i.unit||"",S:a.unit||"",C:r.unit||""}};var o=this.yTitleEl.selectAll("text").data([0]);o.enter().append("text"),o.on("click",function(){e.parent.findChildByName("gapminder-treemenu").markerID("axis_y").alignX(e.model.locale.isRTL()?"right":"left").alignY("top").updateView().toggle()});var n=this.xTitleEl.selectAll("text").data([0]);n.enter().append("text"),n.on("click",function(){e.parent.findChildByName("gapminder-treemenu").markerID("axis_x").alignX(e.model.locale.isRTL()?"right":"left").alignY("bottom").updateView().toggle()});var l=this.sTitleEl.selectAll("text").data([0]);l.enter().append("text"),l.attr("text-anchor","end"),c.setIcon(this.dataWarningEl,f).select("svg").attr("width","0px").attr("height","0px"),this.dataWarningEl.append("text").attr("text-anchor","end").text(this.translator("hints/dataWarning")),c.setIcon(this.yInfoEl,p).select("svg").attr("width","0px").attr("height","0px").style("opacity",Number(Boolean(t.description||t.sourceLink))),c.setIcon(this.xInfoEl,p).select("svg").attr("width","0px").attr("height","0px").style("opacity",Number(Boolean(i.description||i.sourceLink))),this.yInfoEl.on("click",function(){e.parent.findChildByName("gapminder-datanotes").pin()}),this.yInfoEl.on("mouseover",function(){var t=this.getBBox(),i=c.makeAbsoluteContext(this,this.farthestViewportElement)(t.x-10,t.y+t.height+10),a=e.root.element.getBoundingClientRect(),r=e.element.node().getBoundingClientRect();e.parent.findChildByName("gapminder-datanotes").setHook("axis_y").show().setPos(i.x+r.left-a.left,i.y)}),this.yInfoEl.on("mouseout",function(){e.parent.findChildByName("gapminder-datanotes").hide()}),this.xInfoEl.on("click",function(){e.parent.findChildByName("gapminder-datanotes").pin()}),this.xInfoEl.on("mouseover",function(){if(!e.model.time.dragging){var t=this.getBBox(),i=c.makeAbsoluteContext(this,this.farthestViewportElement)(t.x-10,t.y+t.height+10),a=e.root.element.getBoundingClientRect(),r=e.element.node().getBoundingClientRect();e.parent.findChildByName("gapminder-datanotes").setHook("axis_x").show().setPos(i.x+r.left-a.left,i.y)}}),this.xInfoEl.on("mouseout",function(){e.model.time.dragging||e.parent.findChildByName("gapminder-datanotes").hide()}),this.dataWarningEl.on("click",function(){e.parent.findChildByName("gapminder-datawarning").toggle()}).on("mouseover",function(){e._updateDoubtOpacity(1)}).on("mouseout",function(){e._updateDoubtOpacity()})},_updateDoubtOpacity:function(e){null==e&&(e=this.wScale(+this.model.time.formatDate(this.time))),this.someSelected&&(e=1),this.dataWarningEl.style("opacity",e)},updateEntities:function(){var e=this,t=this.KEY,i=this.TIMEDIM,a=function(a){return a=a||"",e.model.marker.getKeys().map(function(o){var n={};return n[t]=o[t],n[i]=r,n.sortValue=e.frame.size[o[t]]||0,n[t]=a+o[t],n}).sort(function(e,t){return t.sortValue-e.sortValue})},r=this.model.time.end,o=a.call(this);this.model.marker.setVisible(o),this.model.time.splash||this.unselectBubblesWithNoData(o),this.entityBubbles=this.bubbleContainer.selectAll("circle.vzb-bc-entity").data(this.model.marker.getVisible(),function(e){return e[t]}),this.entityBubbles.exit().remove(),this.entityBubbles=this.entityBubbles.enter().append("circle").attr("class",function(e){return"vzb-bc-entity bubble-"+e[t]}).on("mouseover",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||e._bubblesInteract().mouseover(t,i)}).on("mouseout",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||e._bubblesInteract().mouseout(t,i)}).on("click",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||e._bubblesInteract().click(t,i)}).onTap(function(t,i){d3.event.stopPropagation(),e._bubblesInteract().click(t,i)}).onLongTap(function(e,t){}).merge(this.entityBubbles),this._reorderEntities()},unselectBubblesWithNoData:function(e){var t=this,i=this.KEY;if(this.model.marker.select.length){var a=[],r=e.map(function(e){return e[i]});this.model.marker.select.forEach(function(e){-1!==r.indexOf(e[i])&&a.push(e)}),a.length!==t.model.marker.select.length&&(t.model.marker.select=a)}},_reorderEntities:function(){var e=this,t=this.KEY;this.bubbleContainer.selectAll(".vzb-bc-entity").sort(function(i,a){var r=e.frame.size[i[t]],o=e.frame.size[a[t]];return"undefined"===typeof r&&"undefined"!==typeof o?-1:"undefined"!==typeof r&&"undefined"===typeof o?1:r!=o?d3.descending(r,o):i[t]!=a[t]?d3.ascending(i[t],a[t]):"undefined"!==typeof i.trailStartTime||"undefined"!==typeof a.trailStartTime?"undefined"!==typeof i.trailStartTime?-1:1:"undefined"!==typeof i.limits||"undefined"!==typeof a.limits?"undefined"!==typeof i.limits?-1:1:d3.descending(r,o)})},_bubblesInteract:function(){var e=this;this.KEY,this.TIMEDIM;return{mouseover:function(t,i){e.model.marker.highlightMarker(t),e._labels.showCloseCross(t,!0)},mouseout:function(t,i){e.model.marker.clearHighlighted(),e._labels.showCloseCross(t,!1)},click:function(t,i){if(!e.draggingNow){var a=e.model.marker.isSelected(t);e.model.marker.selectMarker(t),c.isTouchDevice()||(a&&e.model.marker.highlightMarker(t),e.highlightDataPoints())}}}},updateTime:function(){this.time_1=null==this.time?this.model.time.value:this.time,this.time=this.model.time.value,this.duration=this.model.time.playing&&this.time-this.time_1>0?this.model.time.delayAnimations:0,this.year.setText(this.model.time.formatDate(this.time,"ui"),this.duration)},updateSize:function(){var e={small:{margin:{top:30,right:10,left:40,bottom:35},padding:2,minRadiusPx:.5,maxRadiusEm:.05,infoElHeight:16,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:4},medium:{margin:{top:40,right:15,left:60,bottom:55},padding:2,minRadiusPx:1,maxRadiusEm:.05,infoElHeight:20,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:5},large:{margin:{top:50,right:20,left:60,bottom:60},padding:2,minRadiusPx:1,maxRadiusEm:.05,infoElHeight:22,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:5,hideSTitle:!0}},t={medium:{margin:{top:80,bottom:80,left:100},yAxisTitleBottomMargin:20,xAxisTitleBottomMargin:20,infoElHeight:26},large:{margin:{top:80,bottom:100,left:100},yAxisTitleBottomMargin:20,xAxisTitleBottomMargin:20,infoElHeight:32,hideSTitle:!0}},i=this;this.activeProfile=this.getActiveProfile(e,t);var a=this.root.getVizWidthHeight();this.activeProfile.maxRadiusPx=Math.max(this.activeProfile.minRadiusPx,this.activeProfile.maxRadiusEm*c.hypotenuse(a.width,a.height));var r=this.activeProfile.margin,o=this.activeProfile.infoElHeight;i._labels.setCloseCrossHeight(1.2*i.activeProfile.infoElHeight),this.height=parseInt(this.element.style("height"),10)-r.top-r.bottom||0,this.width=parseInt(this.element.style("width"),10)-r.left-r.right||0,(this.height<=0||this.width<=0)&&(this.height=0,this.width=0,c.warn("Bubble chart updateSize(): vizabi container is too little or has display:none")),this.graph.attr("transform","translate("+r.left+","+r.top+")"),this.year.resize(this.width,this.height),this.eventArea.attr("width",this.width).attr("height",Math.max(0,this.height)),"ordinal"!==this.model.marker.axis_y.scaleType?this.yScale.range(this._rangeBump([this.height,0])):this.yScale.rangePoints([this.height,0],i.activeProfile.padding).range(),"ordinal"!==this.model.marker.axis_x.scaleType?this.xScale.range(this._rangeBump([0,this.width])):this.xScale.rangePoints([0,this.width],i.activeProfile.padding).range(),this.yAxis.scale(this.yScale).tickSizeInner(-this.width).tickSizeOuter(0).tickPadding(6).tickSizeMinor(-this.width,0).labelerOptions({scaleType:this.model.marker.axis_y.scaleType,toolMargin:r,limitMaxTickNumber:6,bump:this.activeProfile.maxRadiusPx/2,viewportLength:this.height,formatter:this.model.marker.axis_y.getTickFormatter()}),this.xAxis.scale(this.xScale).tickSizeInner(-this.height).tickSizeOuter(0).tickPadding(6).tickSizeMinor(-this.height,0).labelerOptions({scaleType:this.model.marker.axis_x.scaleType,toolMargin:r,bump:this.activeProfile.maxRadiusPx/2,viewportLength:this.width,formatter:this.model.marker.axis_x.getTickFormatter()}),this.bubbleContainerCrop.attr("width",this.width).attr("height",Math.max(0,this.height)),this.labelsContainerCrop.attr("width",this.width).attr("height",Math.max(0,this.height)),this.xAxisElContainer.attr("width",this.width+1).attr("height",this.activeProfile.margin.bottom+this.height).attr("y",-1).attr("x",-1),this.xAxisEl.attr("transform","translate(1,"+(1+this.height)+")"),this.yAxisElContainer.attr("width",this.activeProfile.margin.left+this.width).attr("height",Math.max(0,this.height)).attr("x",-this.activeProfile.margin.left),this.yAxisEl.attr("transform","translate("+(this.activeProfile.margin.left-1)+",0)"),this.yAxisEl.call(this.yAxis),this.xAxisEl.call(this.xAxis),this.projectionX.attr("y1",i.yScale.range()[0]+this.activeProfile.maxRadiusPx/2),this.projectionY.attr("x2",i.xScale.range()[0]-this.activeProfile.maxRadiusPx/2),this._updateSTitle(),this.sTitleEl.attr("transform","translate("+this.width+",20) rotate(-90)");var n=this.model.locale.isRTL();this.yTitleEl.style("font-size",o+"px").attr("transform","translate("+(n?this.width:10-this.activeProfile.margin.left)+", -"+this.activeProfile.yAxisTitleBottomMargin+")"),this.xTitleEl.style("font-size",o+"px").attr("transform","translate("+(n?this.width:0)+","+(this.height+r.bottom-this.activeProfile.xAxisTitleBottomMargin)+")");var l=this.strings.unit.Y?", ":"",s=this.yTitleEl.select("text").text(this.strings.title.Y+l+this.strings.unit.Y);s.node().getBBox().width>this.width&&s.text(this.strings.title.Y);var d=this.strings.unit.Y?", ":"",h=this.xTitleEl.select("text").text(this.strings.title.X+d+this.strings.unit.X);if(h.node().getBBox().width>this.width-100&&h.text(this.strings.title.X),this.yInfoEl.select("svg").node()){var u=this.yTitleEl.node().getBBox(),m=c.transform(this.yTitleEl.node()),g=n?u.x+m.translateX-1.4*o:u.x+m.translateX+u.width+.4*o;this.yInfoEl.select("svg").attr("width",o+"px").attr("height",o+"px"),this.yInfoEl.attr("transform","translate("+g+","+(m.translateY-.8*o)+")")}if(this.xInfoEl.select("svg").node()){var v=this.xTitleEl.node().getBBox(),f=c.transform(this.xTitleEl.node()),p=n?v.x+f.translateX-1.4*o:v.x+f.translateX+v.width+.4*o;this.xInfoEl.select("svg").attr("width",o+"px").attr("height",o+"px"),this.xInfoEl.attr("transform","translate("+p+","+(f.translateY-.8*o)+")")}this._resizeDataWarning()},_updateLineEqualXY:function(e){var t=this.model.marker.axis_x.which==this.model.marker.axis_y.which;if(this.lineEqualXY.classed("vzb-invisible",!t),t){var i=d3.min(this.yScale.domain().concat(this.xScale.domain())),a=d3.max(this.yScale.domain().concat(this.xScale.domain()));this.lineEqualXY.transition().duration(e||0).attr("y1",this.yScale(i)).attr("y2",this.yScale(a)).attr("x1",this.xScale(i)).attr("x2",this.xScale(a))}},_resizeDataWarning:function(){var e=this.dataWarningEl.select("text").style("font-size",null),t=e.node().getBBox().width+3*e.node().getBBox().height,i=this.width-this.xTitleEl.node().getBBox().width-this.activeProfile.infoElHeight,a=parseInt(e.style("font-size"))*i/t;e.style("font-size",t>i?a+"px":null);var r=e.node().getBBox();this.dataWarningEl.select("svg").attr("width",.75*r.height).attr("height",.75*r.height).attr("x",-r.width-1.2*r.height).attr("y",.65*-r.height),this.dataWarningEl.attr("transform","translate("+(this.model.locale.isRTL()?r.width+r.height:this.width)+","+(this.height+this.activeProfile.margin.bottom-this.activeProfile.xAxisTitleBottomMargin)+")")},updateMarkerSizeLimits:function(){var e=this.model.marker.size.extent||[0,1];if(!this.activeProfile)return c.warn("updateMarkerSizeLimits() is called before ready(). This can happen if events get unfrozen and getFrame() still didn't return data");var t=this.activeProfile.minRadiusPx,i=this.activeProfile.maxRadiusPx,a=c.radiusToArea(Math.max(i*e[0],t)),r=c.radiusToArea(Math.max(i*e[1],t)),o=a===r?[a,r]:d3.range(a,r,(r-a)/this.sScale.domain().length).concat(r);this.sScale.range(o)},redrawDataPointsOnlyColors:function(){var e=this;if(!this.entityBubbles)return c.warn("redrawDataPointsOnlyColors(): no entityBubbles defined. likely a premature call, fix it!");var t=void 0,i=this.KEY,a=this.model.time.value;this.model.ui.chart.lockNonSelected&&this.someSelected&&(a=this.model.time.parse(""+this.model.ui.chart.lockNonSelected)),this.model.marker.getFrame(a,function(a){if(!e._frameIsValid(a))return c.warn("redrawDataPointsOnlyColor: empty data received from marker.getFrame(). doing nothing");t=e.frame,e.entityBubbles.each(function(r,o){var n=e.model.marker.isSelected(r),l=n?t.color[r[i]]:a.color[r[i]],s=null!=l?e.cScale(l):e.COLOR_WHITEISH;if(d3.select(this).style("fill",s),n){var d=c.find(e.model.marker.select,function(e){return e[i]==r[i]}),h=e.model.time.parse(""+d.trailStartTime);e.model.marker.getFrame(h,function(t){if(!t)return c.warn("redrawDataPointsOnlyColor: empty data received from marker.getFrames(). doing nothing");var a={};if(e.model.ui.chart.trails&&h-e.time!=0){var n=t.color[r[i]];a.scaledC0=null!=n?e.cScale(n):e.COLOR_WHITEISH}else a.scaledC0=s;e._labels.updateLabelOnlyColor(r,o,a)})}})})},redrawDataPointsOnlySize:function(){var e=this,t=void 0,i=this.KEY,a=this.model.time.value;this.model.ui.chart.lockNonSelected&&this.someSelected&&(a=this.model.time.parse(""+this.model.ui.chart.lockNonSelected)),this.model.marker.getFrame(a,function(a){if(!e._frameIsValid(a))return c.warn("redrawDataPointsOnlySize: empty data received from marker.getFrame(). doing nothing");t=e.frame,e.entityBubbles.each(function(r,o){var n=e.model.marker.isSelected(r),l=n?t.size[r[i]]:a.size[r[i]];if(null!=l){var s=c.areaToRadius(e.sScale(l));if(d3.select(this).attr("r",s),n){var d=c.find(e.model.marker.select,function(e){return e[i]==r[i]}),h=e.model.time.parse(""+d.trailStartTime);e.model.marker.getFrame(h,function(t){if(!t)return c.warn("redrawDataPointsOnlySize: empty data received from marker.getFrames(). doing nothing");var a={};e.model.ui.chart.trails&&h-e.time!=0?a.scaledS0=c.areaToRadius(e.sScale(t.size[r[i]])):a.scaledS0=s,e._labels.updateLabelOnlyPosition(r,o,a)})}}})})},redrawDataPoints:function(e){var t=this;this.KEY;if(null==e&&(e=t.duration),this.model.ui.chart.lockNonSelected&&this.someSelected){var i=this.model.time.parse(""+this.model.ui.chart.lockNonSelected);this.model.marker.getFrame(i,function(i){if(!i)return c.warn("redrawDataPoints: empty data received from marker.getFrames(). doing nothing");t.entityBubbles.each(function(a,r){var o=t.model.marker.isSelected(a)?t.frame:i;t._updateBubble(a,o,r,d3.select(this),e)})})}else t.entityBubbles.each(function(i,a){t._updateBubble(i,t.frame,a,d3.select(this),e)});this._updateLineEqualXY(e)},_updateBubble:function(e,t,i,a,r){var o=this,n=this.KEY,l=!1,s=t.axis_y[e[n]],d=t.axis_x[e[n]],h=t.size[e[n]],u=t.label[e[n]],m=t.color[e[n]],g=t.size_label[e[n]];if(!u&&0!==u||!s&&0!==s||!d&&0!==d||!h&&0!==h){if(e.hidden||(e.hidden=!0,l=!0),l)if(r){var v=a.style("opacity");a.transition().duration(r).ease(d3.easeExp).style("opacity",0).on("end",function(){a.classed("vzb-invisible",e.hidden),a.style("opacity",v)})}else a.classed("vzb-invisible",e.hidden)}else{(e.hidden||a.classed("vzb-invisible"))&&(e.hidden=!1,l=!0);var f=c.areaToRadius(o.sScale(h));if(a.style("fill",null!=m?o.cScale(m):o.COLOR_WHITEISH),r)if(l){var p=a.style("opacity");a.classed("vzb-invisible",e.hidden),a.style("opacity",0).attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f).transition().duration(r).ease(d3.easeExp).style("opacity",p)}else a.transition().duration(r).ease(d3.easeLinear).attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f);else a.interrupt().attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f).transition(),l&&a.classed("vzb-invisible",e.hidden);this.model.time.record&&o._export.write({type:"circle",id:e[n],time:this.model.time.value.getUTCFullYear(),fill:null!=m?o.cScale(m):o.COLOR_WHITEISH,cx:o.xScale(d),cy:o.yScale(s),r:f})}o._updateLabel(e,i,d,s,h,m,u,g,r,l)},_updateLabel:function(e,t,i,a,r,o,n,l,s,d){var h=this,u=this.KEY;if(h.model.marker.isSelected(e)){var m={},g=c.find(h.model.marker.select,function(t){return t[u]==e[u]}),v=h.model.time.formatDate(h.time);this.model.ui.chart.trails&&g.trailStartTime!=v&&null!=g.trailStartTime||(this.model.ui.chart.trails&&null==g.trailStartTime&&(g.trailStartTime=v),m.labelX0=i,m.labelY0=a,m.scaledC0=null!=o?h.cScale(o):h.COLOR_WHITEISH,m.scaledS0=r||0===r?c.areaToRadius(h.sScale(r)):null);var f=h.model.time.parse(""+g.trailStartTime),p=n+(h.model.ui.chart.trails?" "+g.trailStartTime:"");d&&e.hidden&&h.model.ui.chart.trails&&f&&f<h.time&&(d=!1),e.hidden&&!h.model.ui.chart.trails&&(d=!0),this._labels.updateLabel(e,t,m,i,a,r,o,p,l,s,d)}},_formatSTitleValues:function(e,t){var i=this.strings.unit.S,a=this.strings.unit.C,r=this.model.marker.size.getTickFormatter(),o=this.model.marker.color.getTickFormatter();return this.model.marker.color.isDiscrete()&&"constant"!==this.model.marker.color.use&&t&&this.model.marker.color.getColorlegendMarker()&&(t=this.model.marker.color.getColorlegendMarker().label.getItems()[t]||""),[r(e)+" "+i,t||0===t?o(t)+" "+a:this.translator("hints/nodata")]},_updateSTitle:function(e,t){if(this.activeProfile.hideSTitle&&this.model.ui.dialogs.sidebar.indexOf("colors")>-1&&this.model.ui.dialogs.sidebar.indexOf("size")>-1)return void this.sTitleEl.classed("vzb-invisible",!0);this.sTitleEl.classed("vzb-invisible")&&this.sTitleEl.classed("vzb-invisible",!1);var i="constant"!==this.model.marker.size.use,a="constant"!==this.model.marker.color.use,r=this.sTitleEl.select("text").style("font-size",null).text((i?this.translator("buttons/size")+": "+(e||this.strings.title.S):"")+(i&&a?", ":"")+(a?this.translator("buttons/colors")+": "+(t||this.strings.title.C):"")),o=r.node().getBBox().width,n=this.height-30,l=parseInt(r.style("font-size"))*n/o;r.style("font-size",o>n?l+"px":null)},selectDataPoints:function(){var e=this;this.KEY;c.isTouchDevice()?(e.model.marker.clearHighlighted(),e._labels.showCloseCross(null,!1)):(e._setTooltip(),e._setBubbleCrown()),e.someSelected=e.model.marker.select.length>0,e.nonSelectedOpacityZero=!1},_setBubbleCrown:function(e,t,i,a,r){null!=e?(this.bubbleCrown.classed("vzb-hidden",!1),this.bubbleCrown.select(".vzb-crown").attr("cx",e).attr("cy",t).attr("r",i).attr("fill",r?"none":a),this.bubbleCrown.selectAll(".vzb-crown-glow").attr("cx",e).attr("cy",t).attr("r",i+10).attr("stroke",a)):this.bubbleCrown.classed("vzb-hidden",!0)},_setTooltip:function(e,t,i,a,r){if(e){var o=void 0,n=void 0,l=-1,s=-1,c=0,d=0;a&&(c=.71*a,d=.71*a),this.tooltip.classed("vzb-hidden",!1).selectAll("text").text(e);var h=this.tooltip.select("text").node().getBBox();t-c-h.width<0?(l=1,t+=h.width+5):t-=5,i-d-h.height<0?(s=1,i+=h.height):i-=11,o=t+c*l,n=i+d*s,this.tooltip.attr("transform","translate("+o+","+n+")"),this.tooltip.selectAll("rect").attr("width",h.width+8).attr("height",1.2*h.height).attr("x",-h.width-4).attr("y",.85*-h.height).attr("rx",.2*h.height).attr("ry",.2*h.height),this.tooltip.select(".vzb-tooltip-glow").attr("stroke",r)}else this.tooltip.classed("vzb-hidden",!0)},_axisProjections:function(e){var t=this,i=this.TIMEDIM,a=this.KEY;null!=e?this.model.marker.getFrame(e[i],function(i){var r=i.axis_y[e[a]],o=i.axis_x[e[a]],n=i.size[e[a]],l=c.areaToRadius(t.sScale(n));!r&&0!==r||!o&&0!==o||!n&&0!==n||(t.model.ui.chart.whenHovering.showProjectionLineX&&t.xScale(o)>0&&t.xScale(o)<t.width&&t.yScale(r)+l<t.height&&t.projectionX.style("opacity",1).attr("y2",t.yScale(r)+l).attr("x1",t.xScale(o)).attr("x2",t.xScale(o)),t.model.ui.chart.whenHovering.showProjectionLineY&&t.yScale(r)>0&&t.yScale(r)<t.height&&t.xScale(o)-l>0&&t.projectionY.style("opacity",1).attr("y1",t.yScale(r)).attr("y2",t.yScale(r)).attr("x1",t.xScale(o)-l),t.model.ui.chart.whenHovering.higlightValueX&&t.xAxisEl.call(t.xAxis.highlightValue(o)),t.model.ui.chart.whenHovering.higlightValueY&&t.yAxisEl.call(t.yAxis.highlightValue(r)))}):(this.projectionX.style("opacity",0),this.projectionY.style("opacity",0),this.xAxisEl.call(this.xAxis.highlightValue("none")),this.yAxisEl.call(this.yAxis.highlightValue("none")))},highlightDataPoints:function(){var e=this,t=this.TIMEDIM,i=this.KEY;if(this.someHighlighted=this.model.marker.highlight.length>0,this.updateBubbleOpacity(),1===this.model.marker.highlight.length){var a=c.clone(this.model.marker.highlight[0]);e.model.ui.chart.lockNonSelected&&e.someSelected&&!e.model.marker.isSelected(a)?a[t]=e.model.time.parse(""+e.model.ui.chart.lockNonSelected):a[t]=e.model.time.parse(""+a.trailStartTime)||e.time,e.model.marker.getFrame(a[t],function(r){if(r){var o=e.xScale(r.axis_x[a[i]]),n=e.yScale(r.axis_y[a[i]]),l=c.areaToRadius(e.sScale(r.size[a[i]])),s=null!=r.color[a[i]]?e.cScale(r.color[a[i]]):e.COLOR_WHITEISH,d=!1,h=e._formatSTitleValues(r.size[a[i]],r.color[a[i]]);e._updateSTitle(h[0],h[1]),(o+l<0||o-l>e.width||n+l<0||n-l>e.height)&&(d=!0);var u="",m=!1;if(e.model.marker.isSelected(a)&&e.model.ui.chart.trails){u=e.model.time.formatDate(e.time);var g=c.find(e.model.marker.select,function(e){return e[i]==a[i]});m=u!==g.trailStartTime&&!d3.select(d3.event.target).classed("bubble-"+a[i]),u=u!==g.trailStartTime&&e.time===a[t]?u:""}else u=e.model.marker.isSelected(a)?"":r.label[a[i]];if(e._labels.highlight(null,!1),e._labels.highlight(a,!0),e.model.marker.isSelected(a)){var v=!a.trailStartTime||a.trailStartTime==e.model.time.formatDate(e.time);e._setBubbleCrown(o,n,l,s,v)}d||m||e._axisProjections(a),!u||d||m||e._setTooltip(u,o,n,l+3,s);var f=c.find(e.model.marker.select,function(e){return e[i]==a[i]});if(f){var p=c.clone(f);p.opacity=1,e._trails.run(["opacityHandler"],p)}}})}else this._axisProjections(),this._trails.run(["opacityHandler"]),e._updateSTitle(),this._setTooltip(),this._setBubbleCrown(),this._labels.highlight(null,!1)},updateBubbleOpacity:function(e){var t=this,i=this.model.marker.opacityHighlightDim,a=this.model.marker.opacityRegular,r=this.model.marker.opacityRegular,o=this.model.marker.opacitySelectDim;this.entityBubbles.style("opacity",function(e){return t.someHighlighted&&t.model.marker.isHighlighted(e)?1:t.someSelected?t.model.marker.isSelected(e)?a:o:t.someHighlighted?i:r});var n=t.model.marker.opacitySelectDim<.01;n!=this.nonSelectedOpacityZero&&this.entityBubbles.style("pointer-events",function(e){return t.someSelected&&n&&!t.model.marker.isSelected(e)?"none":"visible"}),this.nonSelectedOpacityZero=t.model.marker.opacitySelectDim<.01}});t.default=x},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=Vizabi,r=a.utils,o=Vizabi.Class.extend({init:function(e){this.context=e,this.dragRectangle=d3.drag(),this.zoomer=d3.zoom(),this.dragRectangle.subject(this.dragSubject()).on("start",this.drag().start).on("drag",this.drag().go).on("end",this.drag().stop),this.zoomer.filter(this.zoomFilter()).scaleExtent([.0625,1/0]).on("start",this.zoom().start).on("zoom",this.zoom().go).on("end",this.zoom().stop),this.zoomer.ratioX=1,this.zoomer.ratioY=1,e._zoomedXYMinMax={axis_x:{zoomedMin:null,zoomedMax:null},axis_y:{zoomedMin:null,zoomedMax:null}}},dragSubject:function(){var e=this.context;return function(t){return!d3.event.sourceEvent.ctrlKey&&!d3.event.sourceEvent.metaKey&&"plus"!==e.ui.cursorMode||"minus"===e.ui.cursorMode||("touchmove"===d3.event.sourceEvent.type||"touchstart"===d3.event.sourceEvent.type)&&(d3.event.sourceEvent.touches.length>1||d3.event.sourceEvent.targetTouches.length>1)?null:{x:d3.mouse(this)[0],y:d3.mouse(this)[1]}}},drag:function(){var e=this.context,t=this;return{start:function(t,i){this.origin={x:d3.mouse(this)[0],y:d3.mouse(this)[1]},e.zoomRect.classed("vzb-invisible",!1)},go:function(t,i){var a=this.origin,r={x:d3.event.x,y:d3.event.y};e.zoomRect.attr("x",Math.min(r.x,a.x)).attr("y",Math.min(r.y,a.y)).attr("width",Math.abs(r.x-a.x)).attr("height",Math.abs(r.y-a.y))},stop:function(i){if(e.zoomRect.attr("width",0).attr("height",0).classed("vzb-invisible",!0),this.target={x:d3.mouse(this)[0],y:d3.mouse(this)[1]},!(Math.abs(this.origin.x-this.target.x)<10||Math.abs(this.origin.y-this.target.y)<10)){var a=d3.event.sourceEvent.ctrlKey||d3.event.sourceEvent.metaKey||"plus"===e.ui.cursorMode;t._zoomOnRectangle(d3.select(this),this.origin.x,this.origin.y,this.target.x,this.target.y,a,500)}}}},zoomFilter:function(){var e=this.context;return function(t){var i=d3.event;return!i.ctrlKey&&!i.metaKey&&(("touchmove"===i.type||"touchstart"===i.type)&&(i.touches.length>1||i.targetTouches.length>1)||(!("wheel"!==i.type&&"mousewheel"!==i.type||!e.ui.zoomOnScrolling)||!("mousedown"!==i.type&&"touchstart"!==i.type||"plus"===e.ui.cursorMode||"minus"===e.ui.cursorMode||!e.ui.panWithArrow&&"hand"!==e.ui.cursorMode)))}},zoom:function(){var e=this.context,t=this.zoomer,i=this;return{start:function(){"plus"!==e.ui.cursorMode&&"minus"!==e.ui.cursorMode&&e.chartSvg.classed("vzb-zooming",!0),e.model._data.marker.clearHighlighted(),e._setTooltip()},go:function(){var a=d3.event.sourceEvent,o=d3.event.transform.k,n=[d3.event.transform.x,d3.event.transform.y],l=t.ratioY,s=t.ratioX;e.draggingNow=!0,(isNaN(o)||null==o)&&(o=t.scale),(isNaN(o)||null==o)&&(o=1),1===o&&null!==a&&(("wheel"===a.type||"mousewheel"===a.type)&&(a.deltaY||-a.wheelDelta)>0||"touchmove"===a.type&&a.touches.length>1)&&(t.ratioX=1,s=1,t.ratioY=1,l=1),(isNaN(n[0])||isNaN(n[1])||null==n[0]||null==n[1])&&(n=[0,0]);var c=t.scaleExtent()[0];o*l<c&&(l=c/o,t.ratioY=l),o*s<c&&(s=c/o,t.ratioX=s);var d=o*s<1,h=o*l<1;d?(n[0]<0&&(n[0]=0),n[0]>(1-o*s)*e.width&&(n[0]=(1-o*s)*e.width)):(n[0]>0&&(n[0]=0),n[0]<(1-o*s)*e.width&&(n[0]=(1-o*s)*e.width)),h?(n[1]<0&&(n[1]=0),n[1]>(1-o*l)*e.height&&(n[1]=(1-o*l)*e.height)):(n[1]>0&&(n[1]=0),n[1]<(1-o*l)*e.height&&(n[1]=(1-o*l)*e.height)),i.zoomSelection.property("__zoom",d3.zoomIdentity.translate(n[0],n[1]).scale(o));var u=e.width*o*s,m=e.height*o*l,g=[0*o*s+n[0],u+n[0]],v=[m+n[1],0*o*l+n[1]],f=e._rangeBump(g),p=e._rangeBump(v),x=(f[0]-g[0])*o*s,b=(f[1]-g[1])*o*s,y=(p[0]-v[0])*o*l,S=(p[1]-v[1])*o*l;g[0]+=x,g[1]+=b,v[0]+=y,v[1]+=S;var z=[0,e.width],_=[e.height,0],k=e._rangeBump(z),w=e._rangeBump(_);d?(g[0]<k[0]&&(n[0]=k[0]-x),g[1]>k[1]&&(n[0]=k[1]-b-u)):(g[0]>k[0]&&(n[0]=k[0]-x),g[1]<k[1]&&(n[0]=k[1]-b-u)),h?(v[0]>w[0]&&(n[1]=w[0]-y-m),v[1]<w[1]&&(n[1]=w[1]-S)):(v[0]<w[0]&&(n[1]=w[0]-y-m),v[1]>w[1]&&(n[1]=w[1]-S)),d?(g[0]<k[0]&&(g[1]+=Math.abs(g[0]-k[0]),g[0]=k[0]),g[1]>k[1]&&(g[0]-=Math.abs(g[1]-k[1]),g[1]=k[1])):(g[0]>k[0]&&(g[1]-=Math.abs(g[0]-k[0]),g[0]=k[0]),g[1]<k[1]&&(g[0]+=Math.abs(g[1]-k[1]),g[1]=k[1])),h?(v[0]>w[0]&&(v[1]-=Math.abs(v[0]-w[0]),v[0]=w[0]),v[1]<w[1]&&(v[0]+=Math.abs(v[1]-w[1]),v[1]=w[1])):(v[0]<w[0]&&(v[1]+=Math.abs(v[0]-w[0]),v[0]=w[0]),v[1]>w[1]&&(v[0]-=Math.abs(v[1]-w[1]),v[1]=w[1])),"ordinal"===e.model.marker.axis_x.scaleType?e.xScale.rangeBands(g):e.xScale.range(g),"ordinal"===e.model.marker.axis_y.scaleType?e.yScale.rangeBands(v):e.yScale.range(v);var M=function(e){return r.isDate(e)?e:d3.round(e,2)},T=k,E=w;e._zoomedXYMinMax={axis_x:{zoomedMin:M(e.xScale.invert(T[0])),zoomedMax:M(e.xScale.invert(T[1]))},axis_y:{zoomedMin:M(e.yScale.invert(E[0])),zoomedMax:M(e.yScale.invert(E[1]))}},t.dontFeedToState||e.model.marker.set(e._zoomedXYMinMax,null,!1);var C=e.yAxis.labelerOptions(),I=e.xAxis.labelerOptions();C.limitMaxTickNumber=o*l<1.5?8:o*l*8,I.limitMaxTickNumber=o*s<1.5?8:o*s*8,C.transitionDuration=t.duration,I.transitionDuration=t.duration,e.xAxisEl.call(e.xAxis.labelerOptions(I)),e.yAxisEl.call(e.yAxis.labelerOptions(C)),e.redrawDataPoints(t.duration),e._trails.run("resize",null,t.duration),t.duration=0},stop:function(){e.chartSvg.classed("vzb-zooming",!1),e.draggingNow=!1,t.dontFeedToState||e.model.marker.set(e._zoomedXYMinMax,!0,!0),t.dontFeedToState=null}}},expandCanvas:function(e){var t=this.context;e||(e=t.duration);var i=d3.extent(r.values(t.frame.axis_x)),a=d3.extent(r.values(t.frame.axis_y));if(!i[0]&&0!==i[0]||!i[1]&&0!==i[1]||!a[0]&&0!==a[0]||!a[1]&&0!==a[1])return r.warn("panZoom.expandCanvas: X or Y min/max are broken. Aborting with no action");var o={x1:t.xScale(i[0]),y1:t.yScale(a[0]),x2:t.xScale(i[1]),y2:t.yScale(a[1])},n=[0,t.width],l=[t.height,0],s={x1:n[0],x2:n[1],y1:l[0],y2:l[1]};if(!t.isCanvasPreviouslyExpanded||o.x1<1*s.x1||o.x2>1*s.x2||o.y2<1*s.y2||o.y1>1*s.y1){if(t.isCanvasPreviouslyExpanded){var c=t._rangeBump(n),d=t._rangeBump(l);o.x1>c[0]&&(o.x1=c[0]),o.x2<c[1]&&(o.x2=c[1]),o.y1<d[0]&&(o.y1=d[0]),o.y2>d[0]&&(o.y2=d[1])}t.isCanvasPreviouslyExpanded=!0,this._zoomOnRectangle(t.element,o.x1,o.y1,o.x2,o.y2,!1,e)}else t.redrawDataPoints(e)},zoomToMaxMin:function(e,t,i,a,r,o){var n=this.context,l=e,s=t,c=i,d=a,h=n.xScale.domain(),u=n.yScale.domain();l<h[0]&&s<h[1]&&(l=h[0]),l>h[0]&&s>h[1]&&(s=h[1]),c<u[0]&&d<u[1]&&(c=u[0]),c>u[0]&&d>u[1]&&(d=u[1]);var m=[n.xScale(l),n.xScale(s)],g=[n.yScale(c),n.yScale(d)];this._zoomOnRectangle(n.element,m[0],g[0],m[1],g[1],!1,r,o)},_zoomOnRectangle:function(e,t,i,a,o,n,l,s){var c=this.context,d=this.zoomer,h=d3.zoomTransform(this.zoomSelection.node()),u=t,m=i,g=a,v=o;n&&h.translate(u-g,m-v);var f=[0,c.width],p=[c.height,0],x=c._rangeBump(f),b=c._rangeBump(p),y=d.scaleExtent()[0],S=d.scaleExtent()[1],z=void 0,_=void 0,k=void 0;if(u==g||m==v||x[0]==x[1]||b[0]==b[1])return r.warn("_zoomOnRectangle(): can not proceed because this may result in infinity zooms");Math.abs(u-g)>Math.abs(m-v)?(z=Math.abs(b[0]-b[1])/Math.abs(m-v)*h.k,z<y&&(d.ratioY*=z/h.k,z=y),z>S&&(z=S),_=Math.abs(x[0]-x[1])/Math.abs(u-g)*h.k/z*d.ratioX,k=d.ratioY):(z=Math.abs(x[0]-x[1])/Math.abs(u-g)*h.k,z<y&&(d.ratioX*=z/h.k,z=y),z>S&&(z=S),k=Math.abs(b[0]-b[1])/Math.abs(m-v)*h.k/z*d.ratioY,_=d.ratioX);var w=[(h.x-Math.min(u,g))/h.k/d.ratioX*z*_+(x[0]-f[0]),(h.y-Math.min(m,v))/h.k/d.ratioY*z*k+(b[1]-p[1])];d.dontFeedToState=s,d.ratioY=k||1,d.ratioX=_||1,d.duration=l||0,this.zoomSelection.call(d.transform,d3.zoomIdentity.translate(w[0],w[1]).scale(z))},zoomByIncrement:function(e,t){var i=(this.context,d3.zoomTransform(this.zoomSelection.node())),a=i.k,r=[i.x,i.y],o=d3.mouse(this.zoomSelection.node()),n=Math.log(a)/Math.LN2;"plus"!=e&&e||(n=Math.floor(n)+1),"minus"==e&&(n=Math.ceil(n)-1);var l=[(o[0]-r[0])/a,(o[1]-r[1])/a],s=this.zoomer.scaleExtent();a==s[0]&&(this.zoomer.ratioY=1,this.zoomer.ratioX=1),a=Math.max(s[0],Math.min(s[1],Math.pow(2,n))),l=[l[0]*a+r[0],l[1]*a+r[1]],r[0]+=o[0]-l[0],r[1]+=o[1]-l[1],this.zoomer.duration=t||0,this.zoomSelection.call(this.zoomer.transform,d3.zoomIdentity.translate(r[0],r[1]).scale(a))},resetZoomState:function(e){this.zoomer.ratioY=1,this.zoomer.ratioX=1,(e||this.zoomSelection).property("__zoom",d3.zoomIdentity)},reset:function(e,t){this.context.isCanvasPreviouslyExpanded=!1,this.zoomer.ratioY=1,this.zoomer.ratioX=1,this.zoomer.duration=t||0,(e||this.zoomSelection).call(this.zoomer.transform,d3.zoomIdentity)},rerun:function(e){this.context;(e||this.zoomSelection).call(this.zoomer.scaleBy,1)},zoomSelection:function(e){this.zoomSelection=e}});t.default=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=i(4),r=function(e){return e&&e.__esModule?e:{default:e}}(a),o=Vizabi,n=o.utils,l=Vizabi.Class.extend({init:function(e){this.context=e,this._isCreated=null,this.actionsQueue={},this.entityTrails={},this.trailsData=[],this.trailsInProgress={},this.activePromises={},this.trailTransitions={},this.delayedIterations={},this.drawingQueue={}},toggle:function(e){var t=this.context;e?t._trails.create().then(function(){t._trails.run(["findVisible","reveal","opacityHandler"])}):(t._trails.run("remove"),t.model.marker.select.forEach(function(e){e.trailStartTime=null}))},create:function(e){var t=this.context,i=this,a=t.KEY,o=t.TIMEDIM;return this._isCreated=new Promise(function(l,s){if(t.model.ui.chart.trails){var c=t.model.time.getAllSteps(),d=[];e=null==e?t.model.marker.select:[e],i._clearActions(e),i.trailsData=t.model.marker.select.map(function(e){var t={status:"created",selectedEntityData:e};return t[a]=e[a],t}),i.trailTransitions={};var h=t.bubbleContainer.selectAll("g.vzb-bc-entity.entity-trail").data(i.trailsData,function(e){return e[a]});h.exit().remove(),h.enter().insert("g",function(e){return this.querySelector(".bubble-"+(0,r.default)(e[a]))}).attr("class",function(e){return"vzb-bc-entity entity-trail trail-"+e[a]}).merge(h).each(function(e,r){var l=this;d.push(new Promise(function(r,s){var d=c.map(function(t){return{t:t,key:e[a]}}),h=d3.select(l).selectAll("g").data(d).classed("vzb-invisible",!0);h.exit().remove(),i.entityTrails[e[a]]=h.enter().append("g").attr("class","vzb-bc-trailsegment").on("mouseover",function(i,r){if(!n.isTouchDevice()){var l={};l[a]=i.key,l[o]=i.t,t._axisProjections(l),t._labels.highlight(e,!0);var s=t.model.time.formatDate(i.t),c=n.find(t.model.marker.select,function(t){return t[a]==e[a]});t.model.marker.getFrame(l[o],function(e){var i=t.xScale(e.axis_x[l[a]]),r=t.yScale(e.axis_y[l[a]]),o=n.areaToRadius(t.sScale(e.size[l[a]])),d=null!=e.color[l[a]]?t.cScale(e.color[l[a]]):t.COLOR_WHITEISH;s!==c.trailStartTime&&t._setTooltip(s,i,r,o+3,d),t._setBubbleCrown(i,r,o,d),t.model.marker.getModelObject("highlight").trigger("change",{size:e.size[l[a]],color:e.color[l[a]]})}),d3.select(this).style("opacity",1)}}).on("mouseout",function(e,i){n.isTouchDevice()||(t._axisProjections(),t._setTooltip(),t._setBubbleCrown(),t._labels.highlight(null,!1),t.model.marker.getModelObject("highlight").trigger("change",null),d3.select(this).style("opacity",t.model.marker.opacityRegular))}).each(function(e,t){var i=d3.select(this);i.append("circle"),i.append("line")}).merge(h),r()}))}),d.length>0?Promise.all(d).then(function(e){l(!0)}):l(!0)}}),this._isCreated},_addActions:function(e,t){var i=this.context,a=this,r=i.KEY;e.forEach(function(e){a.actionsQueue[e[r]]||(a.actionsQueue[e[r]]=[]),a.actionsQueue[e[r]]=[].concat(a.actionsQueue[e[r]].filter(function(e){return-1==t.indexOf(e)}),t)})},_clearActions:function(e){var t=this.context,i=this,a=t.KEY;e.forEach(function(e){i.actionsQueue[e[a]]||(i.actionsQueue[e[a]]=[]),i.actionsQueue[e[a]]=[],i.drawingQueue[e[a]]={},i.delayedIterations[e[a]]={},i.activePromises[e[a]]||(i.activePromises[e[a]]=[]),n.forEach(i.activePromises[e[a]],function(e,t){"pending"===e.status&&e.reject()}),i.trailsInProgress[e[a]]=null,i.activePromises[e[a]]=[]})},_getNextAction:function(e){return this.actionsQueue[e].shift()},run:function(e,t,i){var a=this.context,r=this,o=a.KEY;this._isCreated&&!a.model.time.splash&&("string"===typeof e&&(e=[e]),this._isCreated.then(function(){if(a.model.ui.chart.trails&&a.model.marker.select.length||"remove"==e){i||(i=0),t=null==t?a.model.marker.select:[t];for(var n=0;n<e.length;n++)-1!=["resize","recolor","remove"].indexOf(e[n])&&function(){var t=e.splice(n,1).pop();--n,r.trailsData.forEach(function(e){var n=r.entityTrails[e[o]];a._trails["_"+t](n,i,e)})}();0!=e.length&&(r._addActions(t,e),r.trailsData.forEach(function(t){-1!=e.indexOf("findVisible")&&(r.drawingQueue[t[o]]={},r.delayedIterations[t[o]]={});var n=r.entityTrails[t[o]];r.trailsInProgress[t[o]]||function e(l){var s=r._getNextAction(t[o]);if(s){r.trailsInProgress[t[o]]=s;var c=a._trails["_"+s](n,i,t);c&&c instanceof Promise?c.then(function(){r.trailsInProgress[t[o]]=null,e(l+1)},function(){r.trailsInProgress[t[o]]=null}):(r.trailsInProgress[t[o]]=null,e(l+1))}}(0)}))}}))},_remove:function(e,t,i){this.actionsQueue[i[this.context.KEY]]=[],e&&(d3.select(this.entityTrails[i[this.context.KEY]].node().parentNode).remove(),this.entityTrails[i[this.context.KEY]]=null)},_resize:function(e,t,i){var a=this.context;if(!a.model.time.splash){var r=!1;e.each(function(e,o){if(null!=e.valueY&&null!=e.valueX&&null!=e.valueS){var l=d3.select(this);if(t?l.select("circle").transition().duration(t).ease(d3.easeLinear).attr("cy",a.yScale(e.valueY)).attr("cx",a.xScale(e.valueX)).attr("r",n.areaToRadius(a.sScale(e.valueS))):l.select("circle").interrupt().attr("cy",a.yScale(e.valueY)).attr("cx",a.xScale(e.valueX)).attr("r",n.areaToRadius(a.sScale(e.valueS))).transition(),r||e.transparent||(r=!0,a._labels.updateLabelOnlyPosition(i,null,{scaledS0:n.areaToRadius(a.sScale(e.valueS))})),e.next){var s=e.next;if(null!=s&&null!=s.valueY&&null!=s.valueX){var c=Math.sqrt(Math.pow(a.xScale(e.valueX)-a.xScale(s.valueX),2)+Math.pow(a.yScale(e.valueY)-a.yScale(s.valueY),2));t?l.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(s.valueX)).attr("y1",a.yScale(s.valueY)).attr("x2",a.xScale(e.valueX)).attr("y2",a.yScale(e.valueY)).attr("stroke-dasharray",c).attr("stroke-dashoffset",n.areaToRadius(a.sScale(e.valueS))):l.select("line").interrupt().attr("x1",a.xScale(s.valueX)).attr("y1",a.yScale(s.valueY)).attr("x2",a.xScale(e.valueX)).attr("y2",a.yScale(e.valueY)).attr("stroke-dasharray",c).attr("stroke-dashoffset",n.areaToRadius(a.sScale(e.valueS))).transition()}}}})}},_recolor:function(e,t,i){var a=this.context;e.each(function(e,t){var i=d3.select(this),r="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:e.valueC,shadeID:"shade"}):null!=e.valueC?a.cScale(e.valueC):a.COLOR_BLACKISH;i.select("circle").style("fill",null!=e.valueC?a.cScale(e.valueC):a.COLOR_WHITEISH),i.select("line").style("stroke",r)})},_opacityHandler:function(e,t,i){var a=this.context;e.each(function(e,t){d3.select(this).style("opacity",i.opacity||a.model.marker.opacityRegular)})},_findVisible:function(e,t,i){var a=this.context,r=this,o=a.KEY;return new Promise(function(t,l){new Promise(function(e,t){i.limits?e():a.model.marker.getEntityLimits(i[o]).then(function(t){i.limits=t,e()})}).then(function(){i.selectedEntityData.trailStartTime||(i.selectedEntityData.trailStartTime=a.model.time.formatDate(a.time));var l=a.model.time.parse(""+i.selectedEntityData.trailStartTime);if(a.time-l<0||i.limits.min-l>0){a.time-l<0?(i.selectedEntityData.trailStartTime=a.model.time.formatDate(d3.max([a.time,i.limits.min])),l=a.model.time.parse(""+i.selectedEntityData.trailStartTime)):(i.selectedEntityData.trailStartTime=a.model.time.formatDate(i.limits.min),l=a.model.time.parse(""+i.selectedEntityData.trailStartTime));var s=a._labels.cached[i[o]],c=a.frame.size[i[o]],d=a.frame.color[i[o]];s.labelX0=a.frame.axis_x[i[o]],s.labelY0=a.frame.axis_y[i[o]],s.scaledS0=c||0===c?n.areaToRadius(a.sScale(c)):null,s.scaledC0=null!=d?a.cScale(d):a.COLOR_WHITEISH,a._updateLabel(i,0,a.frame.axis_x[i[o]],a.frame.axis_y[i[o]],a.frame.size[i[o]],a.frame.color[i[o]],a.frame.label[i[o]],a.frame.size_label[i[o]],0,!0)}e.each(function(t,r){var o=t.transparent;t.transparent=null==i.selectedEntityData.trailStartTime||t.t-a.time>0||l-t.t>0||i.selectedEntityData.trailStartTime-a.model.time.formatDate(a.time)>=0,(o!=t.transparent||Math.abs(a.model.time.formatDate(t.t)-a.model.time.formatDate(a.time))<2)&&(t.visibilityChanged=!0),t.transparent&&d3.select(e._groups[0][r]).classed("vzb-invisible",t.transparent)}),r.drawingQueue[i[o]]={},r.delayedIterations[i[o]]={},t()})})},_abortAnimation:function(){var e=this.context,t=this,i=e.KEY;t.trailsData.forEach(function(e){t.trailTransitions[e[i]]&&t.trailTransitions[e[i]].select("line").interrupt().transition()})},_reveal:function(e,t,i){var a=this.context;a.model.time.playing&&(t=a.model.time.delay);var r=this,o=a.KEY;i.status="reveal";var l=a.model.time.parse(""+i.selectedEntityData.trailStartTime),s=function(e,s,c,h){return new Promise(function(h,u){var m=d3.select(e._groups[0][s]),g=m.datum();if(c-s==1){if(g.transparent)return m.classed("vzb-invisible",g.transparent),h();if(!g.visibilityChanged)return h()}a.model.marker.getFrame(g.t,function(u){if("reveal"!=i.status)return h();if(!u)return h();if(g.valueY=u.axis_y[i[o]],g.valueX=u.axis_x[i[o]],g.valueS=u.size[i[o]],g.valueC=u.color[i[o]],null==g.valueY||null==g.valueX||null==g.valueS)return h();if(l&&l.toString()==g.t.toString()){var v=a._labels.cached[i[o]];v.labelX0=g.valueX,v.labelY0=g.valueY;var f=g.valueS;v.scaledS0=f||0===f?n.areaToRadius(a.sScale(f)):null,v.scaledC0=null!=g.valueC?a.cScale(g.valueC):a.COLOR_WHITEISH,a._updateLabel(i,s,g.valueX,g.valueY,g.valueS,g.valueC,u.label[i[o]],u.size_label[i[o]],0,!0)}if(m.select("circle").attr("cy",a.yScale(g.valueY)).attr("cx",a.xScale(g.valueX)).attr("r",n.areaToRadius(a.sScale(g.valueS))).style("fill",null!=g.valueC?a.cScale(g.valueC):a.COLOR_WHITEISH),m.select("line").attr("x2",a.xScale(g.valueX)).attr("y2",a.yScale(g.valueY)).attr("x1",a.xScale(g.valueX)).attr("y1",a.yScale(g.valueY)),a.time-g.t>0?(g.visibilityChanged=!1,m.classed("vzb-invisible",g.transparent)):m.classed("vzb-invisible",!0),!e._groups[0][c]||a.time.toString()==g.t.toString())return h();var p=d3.select(e._groups[0][c]),x=p.datum();x.previous=g,g.next=x;var b=x.t;a.time-x.t<0&&(g.visibilityChanged=!0,b=a.time),a.model.marker.getFrame(b,function(e){if("reveal"!=i.status)return h();if(!e||null==g.valueY||null==g.valueX||null==g.valueS)return h();if(null==e.axis_x[i[o]]||null==e.axis_y[i[o]])return h();x.valueY=e.axis_y[i[o]],x.valueX=e.axis_x[i[o]],x.valueS=e.size[i[o]],x.valueC=e.color[i[o]],r.trailTransitions[i[o]]=m;var l="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:g.valueC,shadeID:"shade"}):null!=g.valueC?a.cScale(g.valueC):a.COLOR_BLACKISH,u=Math.sqrt(Math.pow(a.xScale(g.valueX)-a.xScale(e.axis_x[i[o]]),2)+Math.pow(a.yScale(g.valueY)-a.yScale(e.axis_y[i[o]]),2));return m.select("line").attr("stroke-dasharray",u).attr("stroke-dashoffset",n.areaToRadius(a.sScale(g.valueS))).style("stroke",l).transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(x.valueX)).attr("y1",a.yScale(x.valueY)).attr("x2",a.xScale(g.valueX)).attr("y2",a.yScale(g.valueY)),c-s>1?(d(s,c),h()):h()})})})},c=function(r,l,s){return new Promise(function(c,h){var u=d3.select(e._groups[0][r]),m=d3.select(e._groups[0][l]),g=d3.select(e._groups[0][s]),v=u.datum(),f=m.datum(),p=g.datum();if(!v.previous&&!v.next||!f.previous&&!f.next)return c();a.model.marker.getFrame(p.t,function(e){if("reveal"!=i.status)return c();if(!e||"undefined"===typeof e.axis_x||null==e.axis_x[i[o]]||"undefined"===typeof e.axis_y||null==e.axis_y[i[o]])return n.warn("Frame for trail missed: "+p.t),c();if(p.valueY=e.axis_y[i[o]],p.valueX=e.axis_x[i[o]],p.valueS=e.size[i[o]],p.valueC=e.color[i[o]],p.previous=v,p.next=f,v.next=p,f.previous=p,null==p.valueY||null==p.valueX||null==p.valueS)return n.warn("Data for trail point missed: "+p.t),c();var h="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:p.valueC,shadeID:"shade"}):null!=p.valueC?a.cScale(p.valueC):a.COLOR_BLACKISH,m=Math.sqrt(Math.pow(a.xScale(v.valueX)-a.xScale(p.valueX),2)+Math.pow(a.yScale(v.valueY)-a.yScale(p.valueX),2));if(u.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(p.valueX)).attr("y1",a.yScale(p.valueY)).attr("x2",a.xScale(v.valueX)).attr("y2",a.yScale(v.valueY)).attr("stroke-dasharray",m).attr("stroke-dashoffset",n.areaToRadius(a.sScale(v.valueS))).style("stroke",h),g.classed("vzb-invisible",p.transparent),!p.transparent){g.select("circle").attr("cy",a.yScale(p.valueY)).attr("cx",a.xScale(p.valueX)).attr("r",n.areaToRadius(a.sScale(p.valueS))).style("fill",null!=p.valueC?a.cScale(p.valueC):a.COLOR_WHITEISH);var x=Math.sqrt(Math.pow(a.xScale(p.valueX)-a.xScale(f.valueX),2)+Math.pow(a.yScale(p.valueY)-a.yScale(f.valueY),2));g.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(f.valueX)).attr("y1",a.yScale(f.valueY)).attr("x2",a.xScale(p.valueX)).attr("y2",a.yScale(p.valueY)).attr("stroke-dasharray",x).attr("stroke-dashoffset",n.areaToRadius(a.sScale(p.valueS))).style("stroke",h)}d(r,s,l),c()})})},d=function(e,t,a){var n=void 0;t-e>1&&(n=h(e,t),r.delayedIterations[i[o]][e]={first:e,next:t,medium:n}),a&&a-t>1&&(n=h(t,a),r.delayedIterations[i[o]][t]={first:t,next:a,medium:n})},h=function(e,t){return Math.round(e+(t-e)/2)},u=function(e,t,i){var r=[],o=0,l=0,s=d3.min([e.limits.max,a.time]),c=d3.max([e.limits.min,a.model.time.parse(""+e.selectedEntityData.trailStartTime)]);return n.forEach(t._groups[0],function(e,t){var n=e.__data__;n.t-c==0?o=t:n.t-s==0?l=t:n.t>c&&n.t<s&&(a.model.time.formatDate(n.t)%i==0||n.next&&n.previous)&&r.push(t)}),r.unshift(o),l>0&&r.push(l),r},m=function(){return new Promise(function(e,t){Object.keys(r.drawingQueue[i[o]]).length>0?function t(){var a=Object.keys(r.drawingQueue[i[o]])[Math.floor(Math.random()*Object.keys(r.drawingQueue[i[o]]).length)],n=JSON.parse(JSON.stringify(r.drawingQueue[i[o]][a]));delete r.drawingQueue[i[o]][a],c(n.first,n.next,n.medium).then(function(){Object.keys(r.drawingQueue[i[o]]).length>0?t():e()})}(r.drawingQueue[i[o]]):e()})};return new Promise(function(t,n){var l=function e(){m().then(function(){if(0==Object.keys(r.delayedIterations[i[o]]).length)return t();r.drawingQueue[i[o]]=r.delayedIterations[i[o]],r.delayedIterations[i[o]]={},e()},function(){return t()})};if(a.model.marker.framesAreReady())!function e(i,a){if(a<0||a>=i._groups[0].length)return t();s(i,a,a+1).then(function(){e(i,a+1)},function(){return t()})}(e,0);else{r.delayedIterations[i[o]]={},r.drawingQueue[i[o]]={};var c=u(i,e,50),d=[];if(c.length<=1)return t();r.delayedIterations[i[o]]={};for(var h=0;h<c.length-1;h++)d.push(s(e,c[h],c[h+1]));Promise.all(d).then(function(){0==Object.keys(r.delayedIterations[i[o]]).length?t():(r.drawingQueue[i[o]]=r.delayedIterations[i[o]],r.delayedIterations[i[o]]={},l())},function(){t()})}})}});t.default=l},function(e,t,i){(function(t){!function(t,i){e.exports=i(t)}("undefined"!=typeof t?t:this,function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,i=String(e),a=i.length,r=-1,o="",n=i.charCodeAt(0);++r<a;)t=i.charCodeAt(r),o+=0!=t?t>=1&&t<=31||127==t||0==r&&t>=48&&t<=57||1==r&&t>=48&&t<=57&&45==n?"\\"+t.toString(16)+" ":(0!=r||1!=a||45!=t)&&(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?i.charAt(r):"\\"+i.charAt(r):"�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t})}).call(t,i(7))},function(e,t){},function(e,t){e.exports='\x3c!-- Bubble Chart Component --\x3e\n<div class="vzb-bubblechart">\n <svg class="vzb-bubblechart-svg vzb-export">\n <g class="vzb-bc-graph">\n <g class="vzb-bc-year"></g>\n\n <svg class="vzb-bc-axis-x"><g></g></svg>\n <svg class="vzb-bc-axis-y"><g></g></svg>\n <line class="vzb-bc-projection-x"></line>\n <line class="vzb-bc-projection-y"></line>\n\n <svg class="vzb-bc-bubbles-crop">\n <g class="vzb-zoom-selection"></g>\n <line class="vzb-bc-line-equal-xy vzb-invisible"></line>\n <rect class="vzb-bc-eventarea"></rect>\n <g class="vzb-bc-trails"></g>\n <g class="vzb-bc-bubbles"></g>\n <g class="vzb-bc-lines"></g>\n <g class="vzb-bc-bubble-crown vzb-hidden">\n <circle class="vzb-crown-glow"></circle>\n <circle class="vzb-crown"></circle>\n </g>\n </svg>\n\n <g class="vzb-bc-axis-y-title"></g>\n <g class="vzb-bc-axis-x-title"></g>\n <g class="vzb-bc-axis-s-title"></g>\n <g class="vzb-bc-axis-c-title"></g>\n\n <g class="vzb-bc-axis-y-info vzb-noexport"></g>\n <g class="vzb-bc-axis-x-info vzb-noexport"></g>\n\n <svg class="vzb-bc-labels-crop">\n <g class="vzb-bc-labels"></g>\n </svg>\n\n <g class="vzb-data-warning vzb-noexport">\n <svg></svg>\n <text></text>\n </g>\n\n <rect class="vzb-bc-zoom-rect"></rect>\n <g class="vzb-bc-tooltip vzb-hidden">\n <rect class="vzb-tooltip-glow"></rect>\n <rect class="vzb-tooltip-border"></rect>\n <text class="vzb-tooltip-text"></text>\n </g>\n </g>\n </svg>\n <svg>\n <defs>\n <filter id="vzb-glow-filter" x="-50%" y="-50%" width="200%" height="200%">\n <feGaussianBlur in="SourceGraphic" stdDeviation="2"></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n \x3c!-- This could possibly be another component --\x3e\n <div class="vzb-tooltip vzb-hidden vzb-tooltip-mobile"></div>\n</div>\n'},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(i=window)}e.exports=i},function(e,t,i){e.exports=i(0)}]); | ||
!function(e){function t(a){if(i[a])return i[a].exports;var r=i[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var i={};t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,a){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i(5);var a=i(1),r=function(e){return e&&e.__esModule?e:{default:e}}(a),o={version:"1.0.17-1",build:1495710954354};t.default=Vizabi.Tool.extend("BubbleChart",{init:function(e,t){this.name="bubblechart",this.components=[{component:r.default,placeholder:".vzb-tool-viz",model:["state.time","state.entities","state.marker","locale","ui"]},{component:Vizabi.Component.get("timeslider"),placeholder:".vzb-tool-timeslider",model:["state.time","state.entities","state.marker","ui"]},{component:Vizabi.Component.get("dialogs"),placeholder:".vzb-tool-dialogs",model:["state","ui","locale"]},{component:Vizabi.Component.get("buttonlist"),placeholder:".vzb-tool-buttonlist",model:["state","ui","locale"]},{component:Vizabi.Component.get("treemenu"),placeholder:".vzb-tool-treemenu",model:["state.marker","state.marker_tags","state.time","locale"]},{component:Vizabi.Component.get("datawarning"),placeholder:".vzb-tool-datawarning",model:["locale"]},{component:Vizabi.Component.get("datanotes"),placeholder:".vzb-tool-datanotes",model:["state.marker","locale"]},{component:Vizabi.Component.get("steppedspeedslider"),placeholder:".vzb-tool-stepped-speed-slider",model:["state.time","locale"]}],this._super(e,t)},validate:function(e){if(e=this.model||e,this._super(e),e.ui.chart.lockNonSelected){var t=e.state.time.parse(""+e.ui.chart.lockNonSelected);t<e.state.time.start&&(e.ui.chart.lockNonSelected=e.state.time.formatDate(e.state.time.start)),t>e.state.time.end&&(e.ui.chart.lockNonSelected=e.state.time.formatDate(e.state.time.end))}},default_model:{state:{time:{autogenerate:{data:"data",conceptIndex:0,conceptType:"time"}},entities:{autogenerate:{data:"data",conceptIndex:0}},entities_colorlegend:{autogenerate:{data:"data",conceptIndex:0}},entities_tags:{},marker_tags:{space:["entities_tags"],label:{},hook_parent:{}},marker:{space:["entities","time"],axis_x:{use:"indicator",autogenerate:{conceptIndex:1,conceptType:"measure"}},axis_y:{use:"indicator",autogenerate:{conceptIndex:0,conceptType:"measure"}},label:{use:"property",autogenerate:{conceptIndex:0}},size:{autogenerate:{conceptIndex:2,conceptType:"measure"}},color:{syncModels:["marker_colorlegend"],autogenerate:{conceptIndex:0,conceptType:"entity_set"}},size_label:{use:"constant",which:"_default",scaleType:"ordinal",_important:!1,extent:[0,.33],allow:{names:["_default"]}}},marker_colorlegend:{space:["entities_colorlegend"],label:{use:"property",which:"name"},hook_rank:{use:"property",which:"rank"},hook_geoshape:{use:"property",which:"shape_lores_svg"}}},locale:{},ui:{chart:{whenHovering:{showProjectionLineX:!0,showProjectionLineY:!0,higlightValueX:!0,higlightValueY:!0},labels:{dragging:!0,removeLabelBox:!1},trails:!0,lockNonSelected:0},datawarning:{doubtDomain:[],doubtRange:[]},presentation:!1,panWithArrow:!1,adaptMinMaxZoom:!1,cursorMode:"arrow",zoomOnScrolling:!1,buttons:["colors","find","trails","lock","moreoptions","fullscreen","presentation"],dialogs:{popup:["colors","find","size","zoom","moreoptions"],sidebar:["colors","find","size","zoom"],moreoptions:["opacity","speed","axes","size","colors","label","zoom","presentation","about"]}}},versionInfo:o})},function(e,t,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=i(3),o=a(r),n=i(2),l=a(n),s=Vizabi,c=s.utils,d=Vizabi.helpers,h=d.svgexport,u=d.labels,m=d["d3.axisWithLabelPicker"],g=d["d3.dynamicBackground"],v=Vizabi.iconset,f=v.warn,p=v.question,x=Vizabi.Component.extend("bubblechart",{init:function(e,t){var a=this;this.name="bubblechart",this.template=i(6),this.model_expects=[{name:"time",type:"time"},{name:"entities",type:"entities"},{name:"marker",type:"model"},{name:"locale",type:"locale"},{name:"ui",type:"ui"}],this.model_binds={"change:time.playing":function(e,t){c.isTouchDevice()&&a.model.time.playing&&a.someHighlighted&&a.model.marker.clearHighlighted()},"change:time.start":function(e,t){"time"===a.model.marker.color.scaleType&&(a.model.marker.color.scale=null),a._readyOnce&&!a.model.time.splash&&a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])})},"change:time.end":function(e,t){a._readyOnce&&!a.model.time.splash&&a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])})},"change:time.record":function(){a.model.time.record?a._export.open(this.element,this.name):a._export.reset()},"change:ui.chart.trails":function(e){a._trails.toggle(a.model.ui.chart.trails),a.redrawDataPoints()},"change:ui.chart.lockNonSelected":function(e){a.redrawDataPoints(500)},"change:marker":function(e,t){if(a._readyOnce){if(t.indexOf("scaleType")>-1)return void a.ready();if(-1===t.indexOf("marker.color")&&-1===t.indexOf("marker.size")&&-1===t.indexOf("marker.size_label"))if(t.indexOf("domainMin")>-1||t.indexOf("domainMax")>-1){if(!a.yScale||!a.xScale)return;a.updateSize(),a.updateMarkerSizeLimits(),a._trails.run("findVisible"),a.redrawDataPoints(),a._trails.run("resize",null,500)}else if(t.indexOf("zoomedMin")>-1||t.indexOf("zoomedMax")>-1){if(a.draggingNow)return;if(c.approxEqual(a._zoomedXYMinMax.axis_x.zoomedMin,a.model.marker.axis_x.zoomedMin,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_x.zoomedMax,a.model.marker.axis_x.zoomedMax,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_y.zoomedMin,a.model.marker.axis_y.zoomedMin,.01)&&c.approxEqual(a._zoomedXYMinMax.axis_y.zoomedMax,a.model.marker.axis_y.zoomedMax,.01))return;var i=!1;a.model.time.playing&&(i=!0,a.model.time.pause(!0)),a._trails.run("abortAnimation"),a._panZoom.zoomToMaxMin(a.model.marker.axis_x.getZoomedMin(),a.model.marker.axis_x.getZoomedMax(),a.model.marker.axis_y.getZoomedMin(),a.model.marker.axis_y.getZoomedMax(),500,"don't feed these zoom values back to state"),i&&(a.model.time.postponePause=!1)}}},"change:marker.select":function(e,t){a._readyOnce&&a.entityBubbles&&((e.source._val||[]).length-(e.source._previousVal||[]).length>50&&(a.model.ui.chart.trails=!1),a.selectDataPoints(),a.redrawDataPoints(),a._trails.create().then(function(){a._trails.run(["findVisible","reveal","opacityHandler"])}),a.updateBubbleOpacity(),a._updateDoubtOpacity())},"change:marker.highlight":function(e,t){if(a._readyOnce)if("highlight"==t)a.highlightDataPoints();else if(null!==t){var i=a._formatSTitleValues(t.size,t.color);a._updateSTitle(i[0],i[1])}else a._updateSTitle()},"change:time.value":function(){a._readyOnce&&a.entityBubbles&&(a.calculationQueue?a.calculationQueue.push(a.model.time.value.toString()):a.calculationQueue=[a.model.time.value.toString()],function(e){a.model.marker.getFrame(e,function(e,t){if(!a._frameIsValid(e))return c.warn("change:time.value: empty data received from marker.getFrame(). doing nothing");var i=a.calculationQueue.indexOf(t.toString());-1!=i&&(a.calculationQueue.splice(0,i+1),a.frameChanged(e,t))})}(a.model.time.value))},"change:ui.adaptMinMaxZoom":function(){a.model.ui.adaptMinMaxZoom?a._panZoom.expandCanvas(500):a._panZoom.reset()},"change:marker.size.extent":function(e,t){a._readyOnce&&(a.updateMarkerSizeLimits(),a.redrawDataPointsOnlySize(),a._trails.run("resize"))},"change:marker.color":function(e,t){a._readyOnce&&(a.redrawDataPointsOnlyColors(),a._trails.run("recolor"))},"change:marker.opacitySelectDim":function(){a.updateBubbleOpacity()},"change:marker.opacityRegular":function(){a.updateBubbleOpacity(),a._trails.run("opacityHandler")},"change:ui.cursorMode":function(){var e=a.chartSvg;"plus"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!0),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!1)):"minus"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!0),e.classed("vzb-panhand",!1)):"hand"===a.model.ui.cursorMode?(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!0)):(e.classed("vzb-zoomin",!1),e.classed("vzb-zoomout",!1),e.classed("vzb-panhand",!1))},"change:entities.dim":function(){a.someHighlighted&&a.model.marker.clearHighlighted(),a.someSelected&&a.model.marker.clearSelected()},ready:function(){}},this._super(e,t),this.xScale=null,this.yScale=null,this.sScale=null,this.cScale=null,this.xAxis=m("bottom"),this.yAxis=m("left"),a.COLOR_BLACKISH="#333",a.COLOR_WHITEISH="#fdfdfd",this.isCanvasPreviouslyExpanded=!1,this.draggingNow=null,this._trails=new o.default(this),this._panZoom=new l.default(this),this._export=new h(this),this._export.prefix("vzb-bc-").deleteClasses(["vzb-bc-bubbles-crop","vzb-hidden","vzb-bc-year","vzb-bc-zoom-rect","vzb-bc-projection-x","vzb-bc-projection-y","vzb-bc-axis-c-title"]),this._labels=new u(this),this._labels.config({CSS_PREFIX:"vzb-bc",LABELS_CONTAINER_CLASS:"vzb-bc-labels",LINES_CONTAINER_CLASS:"vzb-bc-bubbles",LINES_CONTAINER_SELECTOR_PREFIX:"bubble-"})},_rangeBump:function(e,t){var i=this.activeProfile.maxRadiusPx/2;if(t=t?-1:1,c.isArray(e)&&e.length>1){var a=e[0],r=e[e.length-1];return a<r?(a+=i*t,r-=i*t,a>r&&(a=r=(a+r)/2)):a>r&&(a-=i*t,r+=i*t,a<r&&(a=r=(a+r)/2)),[a,r]}c.warn("rangeBump error: input is not an array or empty")},readyOnce:function(){var e=this;this._readyOnce=!1,this.scrollableAncestor=c.findScrollableAncestor(this.element),this.element=d3.select(this.element),this.chartSvg=this.element.select("svg"),this.graph=this.element.select(".vzb-bc-graph"),this.yAxisElContainer=this.graph.select(".vzb-bc-axis-y"),this.yAxisEl=this.yAxisElContainer.select("g"),this.xAxisElContainer=this.graph.select(".vzb-bc-axis-x"),this.xAxisEl=this.xAxisElContainer.select("g"),this.yTitleEl=this.graph.select(".vzb-bc-axis-y-title"),this.xTitleEl=this.graph.select(".vzb-bc-axis-x-title"),this.sTitleEl=this.graph.select(".vzb-bc-axis-s-title"),this.cTitleEl=this.graph.select(".vzb-bc-axis-c-title"),this.yearEl=this.graph.select(".vzb-bc-year"),this.year=new g(this.yearEl),this.yInfoEl=this.graph.select(".vzb-bc-axis-y-info"),this.xInfoEl=this.graph.select(".vzb-bc-axis-x-info"),this.dataWarningEl=this.graph.select(".vzb-data-warning"),this.projectionX=this.graph.select(".vzb-bc-projection-x"),this.projectionY=this.graph.select(".vzb-bc-projection-y"),this.lineEqualXY=this.graph.select(".vzb-bc-line-equal-xy"),this.trailsContainer=this.graph.select(".vzb-bc-trails"),this.bubbleContainerCrop=this.graph.select(".vzb-bc-bubbles-crop"),this.zoomSelection=this.graph.select(".vzb-zoom-selection"),this.labelsContainerCrop=this.graph.select(".vzb-bc-labels-crop"),this.bubbleContainer=this.graph.select(".vzb-bc-bubbles"),this.labelsContainer=this.graph.select(".vzb-bc-labels"),this.linesContainer=this.graph.select(".vzb-bc-lines"),this.zoomRect=this.element.select(".vzb-bc-zoom-rect"),this.eventArea=this.element.select(".vzb-bc-eventarea"),this.entityBubbles=null,this.bubbleCrown=this.element.select(".vzb-bc-bubble-crown"),this.bubbleCrown.selectAll(".vzb-crown-glow").attr("filter","url("+location.pathname+"#vzb-glow-filter)"),this.tooltip=this.element.select(".vzb-bc-tooltip"),this.tooltip.select(".vzb-tooltip-glow").attr("filter","url("+location.pathname+"#vzb-glow-filter)"),this.tooltipMobile=this.element.select(".vzb-tooltip-mobile"),this.on("resize",function(){e._trails.run("abortAnimation"),e.updateSize()||(e.updateMarkerSizeLimits(),e._labels.updateSize(),function(t,i,a,r){e._panZoom.zoomer.dontFeedToState=!0,e._panZoom.rerun(),e._panZoom.zoomToMaxMin(t,i,a,r,0,!0)}(e._zoomedXYMinMax.axis_x.zoomedMin,e._zoomedXYMinMax.axis_x.zoomedMax,e._zoomedXYMinMax.axis_y.zoomedMin,e._zoomedXYMinMax.axis_y.zoomedMax))}),d3.select("body").on("keydown",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||(d3.event.metaKey||d3.event.ctrlKey)&&e.element.select("svg").classed("vzb-zoomin",!0)}).on("keyup",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||d3.event.metaKey||d3.event.ctrlKey||e.element.select("svg").classed("vzb-zoomin",!1)}).on("mouseenter",function(){"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||d3.event.metaKey||d3.event.ctrlKey||e.element.select("svg").classed("vzb-zoomin",!1)}),this.root.on("resetZoom",function(){e._panZoom.reset(null,500)}),this._panZoom.zoomSelection(this.bubbleContainerCrop),this.bubbleContainerCrop.call(this._panZoom.dragRectangle).call(this._panZoom.zoomer).on("dblclick.zoom",null).on("mouseup",function(){e.draggingNow=!1}).on("click",function(){var t=e.model.ui.cursorMode;d3.event.defaultPrevented||"arrow"===t||"hand"===t||e._panZoom.zoomByIncrement(t,500)}),this.KEY=this.model.entities.getDimension(),this.TIMEDIM=this.model.time.getDimension(),this.updateUIStrings(),this.wScale=d3.scale.linear().domain(this.model.ui.datawarning.doubtDomain).range(this.model.ui.datawarning.doubtRange),this._labels.readyOnce(),e._readyOnce=!0},_frameIsValid:function(e){return!(!e||0===Object.keys(e.axis_y).length||0===Object.keys(e.axis_x).length||0===Object.keys(e.size).length)},ready:function(){var e=this;this.KEY=this.model.entities.getDimension(),this.updateUIStrings();this.model.time.end;this.updateIndicators(),this.updateTime(),e.model.time.splash||e._trails.create(),this.model.marker.getFrame(this.model.time.value,function(t,i){return i.toString()!=e.model.time.value.toString()?void c.defer(function(){e.ready()}):e._frameIsValid(t)?(e.frame=t,e.updateSize(),e.updateMarkerSizeLimits(),e.updateEntities(),e._labels.ready(),e.redrawDataPoints(),e.selectDataPoints(),e.updateBubbleOpacity(),e._updateDoubtOpacity(),e.zoomToMarkerMaxMin(),e.model.time.splash||e._trails.run(["findVisible","reveal","opacityHandler"]),void(e.model.ui.adaptMinMaxZoom&&e._panZoom.expandCanvas())):c.warn("ready: empty data received from marker.getFrame(). doing nothing")})},zoomToMarkerMaxMin:function(){this._panZoom.resetZoomState();var e=this.model.marker.axis_x,t=this.model.marker.axis_y,i=(e.getScale().domain(),t.getScale().domain(),e.getZoomedMin()),a=e.getZoomedMax(),r=t.getZoomedMin(),o=t.getZoomedMax();this._panZoom.zoomToMaxMin(i,a,r,o,0,"don't feed these zoom values back to state")},updateIndicators:function(){var e=this;this.yScale=this.model.marker.axis_y.getScale(),this.xScale=this.model.marker.axis_x.getScale(),this.sScale=this.model.marker.size.getScale(),this.cScale=this.model.marker.color.getScale(),this._labels.setScales(this.xScale,this.yScale),this.yAxis.tickFormat(e.model.marker.axis_y.getTickFormatter()),this.xAxis.tickFormat(e.model.marker.axis_x.getTickFormatter())},frameChanged:function(e,t){this.frame=e,this.updateTime(),this._updateDoubtOpacity(),this._trails.run("findVisible"),this.model.ui.adaptMinMaxZoom?this._panZoom.expandCanvas():this.redrawDataPoints(),this._trails.run("reveal",null,this.duration),this.tooltipMobile.classed("vzb-hidden",!0),this._reorderEntities()},updateUIStrings:function(){var e=this,t=e.model.marker.axis_y.getConceptprops(),i=e.model.marker.axis_x.getConceptprops(),a=e.model.marker.size.getConceptprops(),r=e.model.marker.color.getConceptprops();this.translator=this.model.locale.getTFunction(),this.strings={title:{Y:t.name,X:i.name,S:a.name,C:r.name},unit:{Y:t.unit||"",X:i.unit||"",S:a.unit||"",C:r.unit||""}};var o=this.yTitleEl.selectAll("text").data([0]);o.enter().append("text"),o.on("click",function(){e.parent.findChildByName("gapminder-treemenu").markerID("axis_y").alignX(e.model.locale.isRTL()?"right":"left").alignY("top").updateView().toggle()});var n=this.xTitleEl.selectAll("text").data([0]);n.enter().append("text"),n.on("click",function(){e.parent.findChildByName("gapminder-treemenu").markerID("axis_x").alignX(e.model.locale.isRTL()?"right":"left").alignY("bottom").updateView().toggle()});var l=this.sTitleEl.selectAll("text").data([0]);l.enter().append("text"),l.attr("text-anchor","end"),c.setIcon(this.dataWarningEl,f).select("svg").attr("width","0px").attr("height","0px"),this.dataWarningEl.append("text").attr("text-anchor","end").text(this.translator("hints/dataWarning")),c.setIcon(this.yInfoEl,p).select("svg").attr("width","0px").attr("height","0px").style("opacity",Number(Boolean(t.description||t.sourceLink))),c.setIcon(this.xInfoEl,p).select("svg").attr("width","0px").attr("height","0px").style("opacity",Number(Boolean(i.description||i.sourceLink))),this.yInfoEl.on("click",function(){e.parent.findChildByName("gapminder-datanotes").pin()}),this.yInfoEl.on("mouseover",function(){var t=this.getBBox(),i=c.makeAbsoluteContext(this,this.farthestViewportElement)(t.x-10,t.y+t.height+10),a=e.root.element.getBoundingClientRect(),r=e.element.node().getBoundingClientRect();e.parent.findChildByName("gapminder-datanotes").setHook("axis_y").show().setPos(i.x+r.left-a.left,i.y)}),this.yInfoEl.on("mouseout",function(){e.parent.findChildByName("gapminder-datanotes").hide()}),this.xInfoEl.on("click",function(){e.parent.findChildByName("gapminder-datanotes").pin()}),this.xInfoEl.on("mouseover",function(){if(!e.model.time.dragging){var t=this.getBBox(),i=c.makeAbsoluteContext(this,this.farthestViewportElement)(t.x-10,t.y+t.height+10),a=e.root.element.getBoundingClientRect(),r=e.element.node().getBoundingClientRect();e.parent.findChildByName("gapminder-datanotes").setHook("axis_x").show().setPos(i.x+r.left-a.left,i.y)}}),this.xInfoEl.on("mouseout",function(){e.model.time.dragging||e.parent.findChildByName("gapminder-datanotes").hide()}),this.dataWarningEl.on("click",function(){e.parent.findChildByName("gapminder-datawarning").toggle()}).on("mouseover",function(){e._updateDoubtOpacity(1)}).on("mouseout",function(){e._updateDoubtOpacity()})},_updateDoubtOpacity:function(e){null==e&&(e=this.wScale(+this.model.time.formatDate(this.time))),this.someSelected&&(e=1),this.dataWarningEl.style("opacity",e)},updateEntities:function(){var e=this,t=this.KEY,i=this.TIMEDIM,a=function(a){return a=a||"",e.model.marker.getKeys().map(function(o){var n={};return n[t]=o[t],n[i]=r,n.sortValue=e.frame.size[o[t]]||0,n[t]=a+o[t],n}).sort(function(e,t){return t.sortValue-e.sortValue})},r=this.model.time.end,o=a.call(this);this.model.marker.setVisible(o),this.model.time.splash||this.unselectBubblesWithNoData(o),this.entityBubbles=this.bubbleContainer.selectAll("circle.vzb-bc-entity").data(this.model.marker.getVisible(),function(e){return e[t]}),this.entityBubbles.exit().remove(),this.entityBubbles=this.entityBubbles.enter().append("circle").attr("class",function(e){return"vzb-bc-entity bubble-"+e[t]}).on("mouseover",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||e._bubblesInteract().mouseover(t,i)}).on("mouseout",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode&&"hand"!==e.model.ui.cursorMode||e._bubblesInteract().mouseout(t,i)}).on("click",function(t,i){c.isTouchDevice()||"arrow"!==e.model.ui.cursorMode||e._bubblesInteract().click(t,i)}).onTap(function(t,i){d3.event.stopPropagation(),e._bubblesInteract().click(t,i)}).onLongTap(function(e,t){}).merge(this.entityBubbles),this._reorderEntities()},unselectBubblesWithNoData:function(e){var t=this,i=this.KEY;if(this.model.marker.select.length){var a=[],r=e.map(function(e){return e[i]});this.model.marker.select.forEach(function(e){-1!==r.indexOf(e[i])&&a.push(e)}),a.length!==t.model.marker.select.length&&(t.model.marker.select=a)}},_reorderEntities:function(){var e=this,t=this.KEY;this.bubbleContainer.selectAll(".vzb-bc-entity").sort(function(i,a){var r=e.frame.size[i[t]],o=e.frame.size[a[t]];return"undefined"===typeof r&&"undefined"!==typeof o?-1:"undefined"!==typeof r&&"undefined"===typeof o?1:r!=o?d3.descending(r,o):i[t]!=a[t]?d3.ascending(i[t],a[t]):"undefined"!==typeof i.trailStartTime||"undefined"!==typeof a.trailStartTime?"undefined"!==typeof i.trailStartTime?-1:1:"undefined"!==typeof i.limits||"undefined"!==typeof a.limits?"undefined"!==typeof i.limits?-1:1:d3.descending(r,o)})},_bubblesInteract:function(){var e=this;this.KEY,this.TIMEDIM;return{mouseover:function(t,i){e.model.marker.highlightMarker(t),e._labels.showCloseCross(t,!0)},mouseout:function(t,i){e.model.marker.clearHighlighted(),e._labels.showCloseCross(t,!1)},click:function(t,i){if(!e.draggingNow){var a=e.model.marker.isSelected(t);e.model.marker.selectMarker(t),c.isTouchDevice()||(a&&e.model.marker.highlightMarker(t),e.highlightDataPoints())}}}},updateTime:function(){this.time_1=null==this.time?this.model.time.value:this.time,this.time=this.model.time.value,this.duration=this.model.time.playing&&this.time-this.time_1>0?this.model.time.delayAnimations:0,this.year.setText(this.model.time.formatDate(this.time,"ui"),this.duration)},updateSize:function(){var e={small:{margin:{top:30,right:10,left:40,bottom:35},padding:2,minRadiusPx:.5,maxRadiusEm:.05,infoElHeight:16,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:4},medium:{margin:{top:40,right:15,left:60,bottom:55},padding:2,minRadiusPx:1,maxRadiusEm:.05,infoElHeight:20,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:5},large:{margin:{top:50,right:20,left:60,bottom:60},padding:2,minRadiusPx:1,maxRadiusEm:.05,infoElHeight:22,yAxisTitleBottomMargin:6,xAxisTitleBottomMargin:5,hideSTitle:!0}},t={medium:{margin:{top:80,bottom:80,left:100},yAxisTitleBottomMargin:20,xAxisTitleBottomMargin:20,infoElHeight:26},large:{margin:{top:80,bottom:100,left:100},yAxisTitleBottomMargin:20,xAxisTitleBottomMargin:20,infoElHeight:32,hideSTitle:!0}},i=this;this.activeProfile=this.getActiveProfile(e,t);var a=this.root.getVizWidthHeight();this.activeProfile.maxRadiusPx=Math.max(this.activeProfile.minRadiusPx,this.activeProfile.maxRadiusEm*c.hypotenuse(a.width,a.height));var r=this.activeProfile.margin,o=this.activeProfile.infoElHeight;i._labels.setCloseCrossHeight(1.2*i.activeProfile.infoElHeight),this.height=parseInt(this.element.style("height"),10)-r.top-r.bottom||0,this.width=parseInt(this.element.style("width"),10)-r.left-r.right||0,(this.height<=0||this.width<=0)&&(this.height=0,this.width=0,c.warn("Bubble chart updateSize(): vizabi container is too little or has display:none")),this.graph.attr("transform","translate("+r.left+","+r.top+")"),this.year.resize(this.width,this.height),this.eventArea.attr("width",this.width).attr("height",Math.max(0,this.height)),"ordinal"!==this.model.marker.axis_y.scaleType?this.yScale.range(this._rangeBump([this.height,0])):this.yScale.rangePoints([this.height,0],i.activeProfile.padding).range(),"ordinal"!==this.model.marker.axis_x.scaleType?this.xScale.range(this._rangeBump([0,this.width])):this.xScale.rangePoints([0,this.width],i.activeProfile.padding).range(),this.yAxis.scale(this.yScale).tickSizeInner(-this.width).tickSizeOuter(0).tickPadding(6).tickSizeMinor(-this.width,0).labelerOptions({scaleType:this.model.marker.axis_y.scaleType,toolMargin:r,limitMaxTickNumber:6,bump:this.activeProfile.maxRadiusPx/2,viewportLength:this.height,formatter:this.model.marker.axis_y.getTickFormatter()}),this.xAxis.scale(this.xScale).tickSizeInner(-this.height).tickSizeOuter(0).tickPadding(6).tickSizeMinor(-this.height,0).labelerOptions({scaleType:this.model.marker.axis_x.scaleType,toolMargin:r,bump:this.activeProfile.maxRadiusPx/2,viewportLength:this.width,formatter:this.model.marker.axis_x.getTickFormatter()}),this.bubbleContainerCrop.attr("width",this.width).attr("height",Math.max(0,this.height)),this.labelsContainerCrop.attr("width",this.width).attr("height",Math.max(0,this.height)),this.xAxisElContainer.attr("width",this.width+1).attr("height",this.activeProfile.margin.bottom+this.height).attr("y",-1).attr("x",-1),this.xAxisEl.attr("transform","translate(1,"+(1+this.height)+")"),this.yAxisElContainer.attr("width",this.activeProfile.margin.left+this.width).attr("height",Math.max(0,this.height)).attr("x",-this.activeProfile.margin.left),this.yAxisEl.attr("transform","translate("+(this.activeProfile.margin.left-1)+",0)"),this.yAxisEl.call(this.yAxis),this.xAxisEl.call(this.xAxis),this.projectionX.attr("y1",i.yScale.range()[0]+this.activeProfile.maxRadiusPx/2),this.projectionY.attr("x2",i.xScale.range()[0]-this.activeProfile.maxRadiusPx/2),this._updateSTitle(),this.sTitleEl.attr("transform","translate("+this.width+",20) rotate(-90)");var n=this.model.locale.isRTL();this.yTitleEl.style("font-size",o+"px").attr("transform","translate("+(n?this.width:10-this.activeProfile.margin.left)+", -"+this.activeProfile.yAxisTitleBottomMargin+")"),this.xTitleEl.style("font-size",o+"px").attr("transform","translate("+(n?this.width:0)+","+(this.height+r.bottom-this.activeProfile.xAxisTitleBottomMargin)+")");var l=this.strings.unit.Y?", ":"",s=this.yTitleEl.select("text").text(this.strings.title.Y+l+this.strings.unit.Y);s.node().getBBox().width>this.width&&s.text(this.strings.title.Y);var d=this.strings.unit.Y?", ":"",h=this.xTitleEl.select("text").text(this.strings.title.X+d+this.strings.unit.X);if(h.node().getBBox().width>this.width-100&&h.text(this.strings.title.X),this.yInfoEl.select("svg").node()){var u=this.yTitleEl.node().getBBox(),m=c.transform(this.yTitleEl.node()),g=n?u.x+m.translateX-1.4*o:u.x+m.translateX+u.width+.4*o;this.yInfoEl.select("svg").attr("width",o+"px").attr("height",o+"px"),this.yInfoEl.attr("transform","translate("+g+","+(m.translateY-.8*o)+")")}if(this.xInfoEl.select("svg").node()){var v=this.xTitleEl.node().getBBox(),f=c.transform(this.xTitleEl.node()),p=n?v.x+f.translateX-1.4*o:v.x+f.translateX+v.width+.4*o;this.xInfoEl.select("svg").attr("width",o+"px").attr("height",o+"px"),this.xInfoEl.attr("transform","translate("+p+","+(f.translateY-.8*o)+")")}this._resizeDataWarning()},_updateLineEqualXY:function(e){var t=this.model.marker.axis_x.which==this.model.marker.axis_y.which;if(this.lineEqualXY.classed("vzb-invisible",!t),t){var i=d3.min(this.yScale.domain().concat(this.xScale.domain())),a=d3.max(this.yScale.domain().concat(this.xScale.domain()));this.lineEqualXY.transition().duration(e||0).attr("y1",this.yScale(i)).attr("y2",this.yScale(a)).attr("x1",this.xScale(i)).attr("x2",this.xScale(a))}},_resizeDataWarning:function(){var e=this.dataWarningEl.select("text").style("font-size",null),t=e.node().getBBox().width+3*e.node().getBBox().height,i=this.width-this.xTitleEl.node().getBBox().width-this.activeProfile.infoElHeight,a=parseInt(e.style("font-size"))*i/t;e.style("font-size",t>i?a+"px":null);var r=e.node().getBBox();this.dataWarningEl.select("svg").attr("width",.75*r.height).attr("height",.75*r.height).attr("x",-r.width-1.2*r.height).attr("y",.65*-r.height),this.dataWarningEl.attr("transform","translate("+(this.model.locale.isRTL()?r.width+r.height:this.width)+","+(this.height+this.activeProfile.margin.bottom-this.activeProfile.xAxisTitleBottomMargin)+")")},updateMarkerSizeLimits:function(){var e=this.model.marker.size.extent||[0,1];if(!this.activeProfile)return c.warn("updateMarkerSizeLimits() is called before ready(). This can happen if events get unfrozen and getFrame() still didn't return data");var t=this.activeProfile.minRadiusPx,i=this.activeProfile.maxRadiusPx,a=c.radiusToArea(Math.max(i*e[0],t)),r=c.radiusToArea(Math.max(i*e[1],t)),o=a===r?[a,r]:d3.range(a,r,(r-a)/this.sScale.domain().length).concat(r);this.sScale.range(o)},redrawDataPointsOnlyColors:function(){var e=this;if(!this.entityBubbles)return c.warn("redrawDataPointsOnlyColors(): no entityBubbles defined. likely a premature call, fix it!");var t=void 0,i=this.KEY,a=this.model.time.value;this.model.ui.chart.lockNonSelected&&this.someSelected&&(a=this.model.time.parse(""+this.model.ui.chart.lockNonSelected)),this.model.marker.getFrame(a,function(a){if(!e._frameIsValid(a))return c.warn("redrawDataPointsOnlyColor: empty data received from marker.getFrame(). doing nothing");t=e.frame,e.entityBubbles.each(function(r,o){var n=e.model.marker.isSelected(r),l=n?t.color[r[i]]:a.color[r[i]],s=null!=l?e.cScale(l):e.COLOR_WHITEISH;if(d3.select(this).style("fill",s),n){var d=c.find(e.model.marker.select,function(e){return e[i]==r[i]}),h=e.model.time.parse(""+d.trailStartTime);e.model.marker.getFrame(h,function(t){if(!t)return c.warn("redrawDataPointsOnlyColor: empty data received from marker.getFrames(). doing nothing");var a={};if(e.model.ui.chart.trails&&h-e.time!=0){var n=t.color[r[i]];a.scaledC0=null!=n?e.cScale(n):e.COLOR_WHITEISH}else a.scaledC0=s;e._labels.updateLabelOnlyColor(r,o,a)})}})})},redrawDataPointsOnlySize:function(){var e=this,t=void 0,i=this.KEY,a=this.model.time.value;this.model.ui.chart.lockNonSelected&&this.someSelected&&(a=this.model.time.parse(""+this.model.ui.chart.lockNonSelected)),this.model.marker.getFrame(a,function(a){if(!e._frameIsValid(a))return c.warn("redrawDataPointsOnlySize: empty data received from marker.getFrame(). doing nothing");t=e.frame,e.entityBubbles.each(function(r,o){var n=e.model.marker.isSelected(r),l=n?t.size[r[i]]:a.size[r[i]];if(null!=l){var s=c.areaToRadius(e.sScale(l));if(d3.select(this).attr("r",s),n){var d=c.find(e.model.marker.select,function(e){return e[i]==r[i]}),h=e.model.time.parse(""+d.trailStartTime);e.model.marker.getFrame(h,function(t){if(!t)return c.warn("redrawDataPointsOnlySize: empty data received from marker.getFrames(). doing nothing");var a={};e.model.ui.chart.trails&&h-e.time!=0?a.scaledS0=c.areaToRadius(e.sScale(t.size[r[i]])):a.scaledS0=s,e._labels.updateLabelOnlyPosition(r,o,a)})}}})})},redrawDataPoints:function(e){var t=this;this.KEY;if(null==e&&(e=t.duration),this.model.ui.chart.lockNonSelected&&this.someSelected){var i=this.model.time.parse(""+this.model.ui.chart.lockNonSelected);this.model.marker.getFrame(i,function(i){if(!i)return c.warn("redrawDataPoints: empty data received from marker.getFrames(). doing nothing");t.entityBubbles.each(function(a,r){var o=t.model.marker.isSelected(a)?t.frame:i;t._updateBubble(a,o,r,d3.select(this),e)})})}else t.entityBubbles.each(function(i,a){t._updateBubble(i,t.frame,a,d3.select(this),e)});this._updateLineEqualXY(e)},_updateBubble:function(e,t,i,a,r){var o=this,n=this.KEY,l=!1,s=t.axis_y[e[n]],d=t.axis_x[e[n]],h=t.size[e[n]],u=t.label[e[n]],m=t.color[e[n]],g=t.size_label[e[n]];if(!u&&0!==u||!s&&0!==s||!d&&0!==d||!h&&0!==h){if(e.hidden||(e.hidden=!0,l=!0),l)if(r){var v=a.style("opacity");a.transition().duration(r).ease(d3.easeExp).style("opacity",0).on("end",function(){a.classed("vzb-invisible",e.hidden),a.style("opacity",v)})}else a.classed("vzb-invisible",e.hidden)}else{(e.hidden||a.classed("vzb-invisible"))&&(e.hidden=!1,l=!0);var f=c.areaToRadius(o.sScale(h));if(a.style("fill",null!=m?o.cScale(m):o.COLOR_WHITEISH),r)if(l){var p=a.style("opacity");a.classed("vzb-invisible",e.hidden),a.style("opacity",0).attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f).transition().duration(r).ease(d3.easeExp).style("opacity",p)}else a.transition().duration(r).ease(d3.easeLinear).attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f);else a.interrupt().attr("cy",o.yScale(s)).attr("cx",o.xScale(d)).attr("r",f).transition(),l&&a.classed("vzb-invisible",e.hidden);this.model.time.record&&o._export.write({type:"circle",id:e[n],time:this.model.time.value.getUTCFullYear(),fill:null!=m?o.cScale(m):o.COLOR_WHITEISH,cx:o.xScale(d),cy:o.yScale(s),r:f})}o._updateLabel(e,i,d,s,h,m,u,g,r,l)},_updateLabel:function(e,t,i,a,r,o,n,l,s,d){var h=this,u=this.KEY;if(h.model.marker.isSelected(e)){var m={},g=c.find(h.model.marker.select,function(t){return t[u]==e[u]}),v=h.model.time.formatDate(h.time);this.model.ui.chart.trails&&g.trailStartTime!=v&&null!=g.trailStartTime||(this.model.ui.chart.trails&&null==g.trailStartTime&&(g.trailStartTime=v),m.labelX0=i,m.labelY0=a,m.scaledC0=null!=o?h.cScale(o):h.COLOR_WHITEISH,m.scaledS0=r||0===r?c.areaToRadius(h.sScale(r)):null);var f=h.model.time.parse(""+g.trailStartTime),p=n+(h.model.ui.chart.trails?" "+g.trailStartTime:"");d&&e.hidden&&h.model.ui.chart.trails&&f&&f<h.time&&(d=!1),e.hidden&&!h.model.ui.chart.trails&&(d=!0),this._labels.updateLabel(e,t,m,i,a,r,o,p,l,s,d)}},_formatSTitleValues:function(e,t){var i=this.strings.unit.S,a=this.strings.unit.C,r=this.model.marker.size.getTickFormatter(),o=this.model.marker.color.getTickFormatter();return this.model.marker.color.isDiscrete()&&"constant"!==this.model.marker.color.use&&t&&this.model.marker.color.getColorlegendMarker()&&(t=this.model.marker.color.getColorlegendMarker().label.getItems()[t]||""),[r(e)+" "+i,t||0===t?o(t)+" "+a:this.translator("hints/nodata")]},_updateSTitle:function(e,t){if(this.activeProfile.hideSTitle&&this.model.ui.dialogs.sidebar.indexOf("colors")>-1&&this.model.ui.dialogs.sidebar.indexOf("size")>-1)return void this.sTitleEl.classed("vzb-invisible",!0);this.sTitleEl.classed("vzb-invisible")&&this.sTitleEl.classed("vzb-invisible",!1);var i="constant"!==this.model.marker.size.use,a="constant"!==this.model.marker.color.use,r=this.sTitleEl.select("text").style("font-size",null).text((i?this.translator("buttons/size")+": "+(e||this.strings.title.S):"")+(i&&a?", ":"")+(a?this.translator("buttons/colors")+": "+(t||this.strings.title.C):"")),o=r.node().getBBox().width,n=this.height-30,l=parseInt(r.style("font-size"))*n/o;r.style("font-size",o>n?l+"px":null)},selectDataPoints:function(){var e=this;this.KEY;c.isTouchDevice()?(e.model.marker.clearHighlighted(),e._labels.showCloseCross(null,!1)):(e._setTooltip(),e._setBubbleCrown()),e.someSelected=e.model.marker.select.length>0,e.nonSelectedOpacityZero=!1},_setBubbleCrown:function(e,t,i,a,r){null!=e?(this.bubbleCrown.classed("vzb-hidden",!1),this.bubbleCrown.select(".vzb-crown").attr("cx",e).attr("cy",t).attr("r",i).attr("fill",r?"none":a),this.bubbleCrown.selectAll(".vzb-crown-glow").attr("cx",e).attr("cy",t).attr("r",i+10).attr("stroke",a)):this.bubbleCrown.classed("vzb-hidden",!0)},_setTooltip:function(e,t,i,a,r){if(e){var o=void 0,n=void 0,l=-1,s=-1,c=0,d=0;a&&(c=.71*a,d=.71*a),this.tooltip.classed("vzb-hidden",!1).selectAll("text").text(e);var h=this.tooltip.select("text").node().getBBox();t-c-h.width<0?(l=1,t+=h.width+5):t-=5,i-d-h.height<0?(s=1,i+=h.height):i-=11,o=t+c*l,n=i+d*s,this.tooltip.attr("transform","translate("+o+","+n+")"),this.tooltip.selectAll("rect").attr("width",h.width+8).attr("height",1.2*h.height).attr("x",-h.width-4).attr("y",.85*-h.height).attr("rx",.2*h.height).attr("ry",.2*h.height),this.tooltip.select(".vzb-tooltip-glow").attr("stroke",r)}else this.tooltip.classed("vzb-hidden",!0)},_axisProjections:function(e){var t=this,i=this.TIMEDIM,a=this.KEY;null!=e?this.model.marker.getFrame(e[i],function(i){var r=i.axis_y[e[a]],o=i.axis_x[e[a]],n=i.size[e[a]],l=c.areaToRadius(t.sScale(n));!r&&0!==r||!o&&0!==o||!n&&0!==n||(t.model.ui.chart.whenHovering.showProjectionLineX&&t.xScale(o)>0&&t.xScale(o)<t.width&&t.yScale(r)+l<t.height&&t.projectionX.style("opacity",1).attr("y2",t.yScale(r)+l).attr("x1",t.xScale(o)).attr("x2",t.xScale(o)),t.model.ui.chart.whenHovering.showProjectionLineY&&t.yScale(r)>0&&t.yScale(r)<t.height&&t.xScale(o)-l>0&&t.projectionY.style("opacity",1).attr("y1",t.yScale(r)).attr("y2",t.yScale(r)).attr("x1",t.xScale(o)-l),t.model.ui.chart.whenHovering.higlightValueX&&t.xAxisEl.call(t.xAxis.highlightValue(o)),t.model.ui.chart.whenHovering.higlightValueY&&t.yAxisEl.call(t.yAxis.highlightValue(r)))}):(this.projectionX.style("opacity",0),this.projectionY.style("opacity",0),this.xAxisEl.call(this.xAxis.highlightValue("none")),this.yAxisEl.call(this.yAxis.highlightValue("none")))},highlightDataPoints:function(){var e=this,t=this.TIMEDIM,i=this.KEY;if(this.someHighlighted=this.model.marker.highlight.length>0,this.updateBubbleOpacity(),1===this.model.marker.highlight.length){var a=c.clone(this.model.marker.highlight[0]);e.model.ui.chart.lockNonSelected&&e.someSelected&&!e.model.marker.isSelected(a)?a[t]=e.model.time.parse(""+e.model.ui.chart.lockNonSelected):a[t]=e.model.time.parse(""+a.trailStartTime)||e.time,e.model.marker.getFrame(a[t],function(r){if(r){var o=e.xScale(r.axis_x[a[i]]),n=e.yScale(r.axis_y[a[i]]),l=c.areaToRadius(e.sScale(r.size[a[i]])),s=null!=r.color[a[i]]?e.cScale(r.color[a[i]]):e.COLOR_WHITEISH,d=!1,h=e._formatSTitleValues(r.size[a[i]],r.color[a[i]]);e._updateSTitle(h[0],h[1]),(o+l<0||o-l>e.width||n+l<0||n-l>e.height)&&(d=!0);var u="",m=!1;if(e.model.marker.isSelected(a)&&e.model.ui.chart.trails){u=e.model.time.formatDate(e.time);var g=c.find(e.model.marker.select,function(e){return e[i]==a[i]});m=u!==g.trailStartTime&&!d3.select(d3.event.target).classed("bubble-"+a[i]),u=u!==g.trailStartTime&&e.time===a[t]?u:""}else u=e.model.marker.isSelected(a)?"":r.label[a[i]];if(e._labels.highlight(null,!1),e._labels.highlight(a,!0),e.model.marker.isSelected(a)){var v=!a.trailStartTime||a.trailStartTime==e.model.time.formatDate(e.time);e._setBubbleCrown(o,n,l,s,v)}d||m||e._axisProjections(a),!u||d||m||e._setTooltip(u,o,n,l+3,s);var f=c.find(e.model.marker.select,function(e){return e[i]==a[i]});if(f){var p=c.clone(f);p.opacity=1,e._trails.run(["opacityHandler"],p)}}})}else this._axisProjections(),this._trails.run(["opacityHandler"]),e._updateSTitle(),this._setTooltip(),this._setBubbleCrown(),this._labels.highlight(null,!1)},updateBubbleOpacity:function(e){var t=this,i=this.model.marker.opacityHighlightDim,a=this.model.marker.opacityRegular,r=this.model.marker.opacityRegular,o=this.model.marker.opacitySelectDim;this.entityBubbles.style("opacity",function(e){return t.someHighlighted&&t.model.marker.isHighlighted(e)?1:t.someSelected?t.model.marker.isSelected(e)?a:o:t.someHighlighted?i:r});var n=t.model.marker.opacitySelectDim<.01;n!=this.nonSelectedOpacityZero&&this.entityBubbles.style("pointer-events",function(e){return t.someSelected&&n&&!t.model.marker.isSelected(e)?"none":"visible"}),this.nonSelectedOpacityZero=t.model.marker.opacitySelectDim<.01}});t.default=x},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=Vizabi,r=a.utils,o=Vizabi.Class.extend({init:function(e){this.context=e,this.dragRectangle=d3.drag(),this.zoomer=d3.zoom(),this.dragRectangle.subject(this.dragSubject()).on("start",this.drag().start).on("drag",this.drag().go).on("end",this.drag().stop),this.zoomer.filter(this.zoomFilter()).scaleExtent([.0625,1/0]).on("start",this.zoom().start).on("zoom",this.zoom().go).on("end",this.zoom().stop),this.zoomer.ratioX=1,this.zoomer.ratioY=1,e._zoomedXYMinMax={axis_x:{zoomedMin:null,zoomedMax:null},axis_y:{zoomedMin:null,zoomedMax:null}}},dragSubject:function(){var e=this.context;return function(t){return!d3.event.sourceEvent.ctrlKey&&!d3.event.sourceEvent.metaKey&&"plus"!==e.ui.cursorMode||"minus"===e.ui.cursorMode||("touchmove"===d3.event.sourceEvent.type||"touchstart"===d3.event.sourceEvent.type)&&(d3.event.sourceEvent.touches.length>1||d3.event.sourceEvent.targetTouches.length>1)?null:{x:d3.mouse(this)[0],y:d3.mouse(this)[1]}}},drag:function(){var e=this.context,t=this;return{start:function(t,i){this.origin={x:d3.mouse(this)[0],y:d3.mouse(this)[1]},e.zoomRect.classed("vzb-invisible",!1)},go:function(t,i){var a=this.origin,r={x:d3.event.x,y:d3.event.y};e.zoomRect.attr("x",Math.min(r.x,a.x)).attr("y",Math.min(r.y,a.y)).attr("width",Math.abs(r.x-a.x)).attr("height",Math.abs(r.y-a.y))},stop:function(i){if(e.zoomRect.attr("width",0).attr("height",0).classed("vzb-invisible",!0),this.target={x:d3.mouse(this)[0],y:d3.mouse(this)[1]},!(Math.abs(this.origin.x-this.target.x)<10||Math.abs(this.origin.y-this.target.y)<10)){var a=d3.event.sourceEvent.ctrlKey||d3.event.sourceEvent.metaKey||"plus"===e.ui.cursorMode;t._zoomOnRectangle(d3.select(this),this.origin.x,this.origin.y,this.target.x,this.target.y,a,500)}}}},zoomFilter:function(){var e=this.context;return function(t){var i=d3.event;return!i.ctrlKey&&!i.metaKey&&(("touchmove"===i.type||"touchstart"===i.type)&&(i.touches.length>1||i.targetTouches.length>1)||(!("wheel"!==i.type&&"mousewheel"!==i.type||!e.ui.zoomOnScrolling)||!("mousedown"!==i.type&&"touchstart"!==i.type||"plus"===e.ui.cursorMode||"minus"===e.ui.cursorMode||!e.ui.panWithArrow&&"hand"!==e.ui.cursorMode)))}},zoom:function(){var e=this.context,t=this.zoomer,i=this;return{start:function(){"plus"!==e.ui.cursorMode&&"minus"!==e.ui.cursorMode&&e.chartSvg.classed("vzb-zooming",!0),e.model._data.marker.clearHighlighted(),e._setTooltip()},go:function(){var a=d3.event.sourceEvent,o=d3.event.transform.k,n=[d3.event.transform.x,d3.event.transform.y],l=t.ratioY,s=t.ratioX;e.draggingNow=!0,(isNaN(o)||null==o)&&(o=t.scale),(isNaN(o)||null==o)&&(o=1),1===o&&null!==a&&(("wheel"===a.type||"mousewheel"===a.type)&&(a.deltaY||-a.wheelDelta)>0||"touchmove"===a.type&&a.touches.length>1)&&(t.ratioX=1,s=1,t.ratioY=1,l=1),(isNaN(n[0])||isNaN(n[1])||null==n[0]||null==n[1])&&(n=[0,0]);var c=t.scaleExtent()[0];o*l<c&&(l=c/o,t.ratioY=l),o*s<c&&(s=c/o,t.ratioX=s);var d=o*s<1,h=o*l<1;d?(n[0]<0&&(n[0]=0),n[0]>(1-o*s)*e.width&&(n[0]=(1-o*s)*e.width)):(n[0]>0&&(n[0]=0),n[0]<(1-o*s)*e.width&&(n[0]=(1-o*s)*e.width)),h?(n[1]<0&&(n[1]=0),n[1]>(1-o*l)*e.height&&(n[1]=(1-o*l)*e.height)):(n[1]>0&&(n[1]=0),n[1]<(1-o*l)*e.height&&(n[1]=(1-o*l)*e.height)),i.zoomSelection.property("__zoom",d3.zoomIdentity.translate(n[0],n[1]).scale(o));var u=e.width*o*s,m=e.height*o*l,g=[0*o*s+n[0],u+n[0]],v=[m+n[1],0*o*l+n[1]],f=e._rangeBump(g),p=e._rangeBump(v),x=(f[0]-g[0])*o*s,b=(f[1]-g[1])*o*s,y=(p[0]-v[0])*o*l,S=(p[1]-v[1])*o*l;g[0]+=x,g[1]+=b,v[0]+=y,v[1]+=S;var z=[0,e.width],_=[e.height,0],k=e._rangeBump(z),w=e._rangeBump(_);d?(g[0]<k[0]&&(n[0]=k[0]-x),g[1]>k[1]&&(n[0]=k[1]-b-u)):(g[0]>k[0]&&(n[0]=k[0]-x),g[1]<k[1]&&(n[0]=k[1]-b-u)),h?(v[0]>w[0]&&(n[1]=w[0]-y-m),v[1]<w[1]&&(n[1]=w[1]-S)):(v[0]<w[0]&&(n[1]=w[0]-y-m),v[1]>w[1]&&(n[1]=w[1]-S)),d?(g[0]<k[0]&&(g[1]+=Math.abs(g[0]-k[0]),g[0]=k[0]),g[1]>k[1]&&(g[0]-=Math.abs(g[1]-k[1]),g[1]=k[1])):(g[0]>k[0]&&(g[1]-=Math.abs(g[0]-k[0]),g[0]=k[0]),g[1]<k[1]&&(g[0]+=Math.abs(g[1]-k[1]),g[1]=k[1])),h?(v[0]>w[0]&&(v[1]-=Math.abs(v[0]-w[0]),v[0]=w[0]),v[1]<w[1]&&(v[0]+=Math.abs(v[1]-w[1]),v[1]=w[1])):(v[0]<w[0]&&(v[1]+=Math.abs(v[0]-w[0]),v[0]=w[0]),v[1]>w[1]&&(v[0]-=Math.abs(v[1]-w[1]),v[1]=w[1])),"ordinal"===e.model.marker.axis_x.scaleType?e.xScale.rangeBands(g):e.xScale.range(g),"ordinal"===e.model.marker.axis_y.scaleType?e.yScale.rangeBands(v):e.yScale.range(v);var M=function(e){return r.isDate(e)?e:d3.round(e,2)},T=k,E=w;e._zoomedXYMinMax={axis_x:{zoomedMin:M(e.xScale.invert(T[0])),zoomedMax:M(e.xScale.invert(T[1]))},axis_y:{zoomedMin:M(e.yScale.invert(E[0])),zoomedMax:M(e.yScale.invert(E[1]))}},t.dontFeedToState||e.model.marker.set(e._zoomedXYMinMax,null,!1);var C=e.yAxis.labelerOptions(),I=e.xAxis.labelerOptions();C.limitMaxTickNumber=o*l<1.5?8:o*l*8,I.limitMaxTickNumber=o*s<1.5?8:o*s*8,C.transitionDuration=t.duration,I.transitionDuration=t.duration,e.xAxisEl.call(e.xAxis.labelerOptions(I)),e.yAxisEl.call(e.yAxis.labelerOptions(C)),e.redrawDataPoints(t.duration),e._trails.run("resize",null,t.duration),t.duration=0},stop:function(){e.chartSvg.classed("vzb-zooming",!1),e.draggingNow=!1,t.dontFeedToState||e.model.marker.set(e._zoomedXYMinMax,!0,!0),t.dontFeedToState=null}}},expandCanvas:function(e){var t=this.context;e||(e=t.duration);var i=d3.extent(r.values(t.frame.axis_x)),a=d3.extent(r.values(t.frame.axis_y));if(!i[0]&&0!==i[0]||!i[1]&&0!==i[1]||!a[0]&&0!==a[0]||!a[1]&&0!==a[1])return r.warn("panZoom.expandCanvas: X or Y min/max are broken. Aborting with no action");var o={x1:t.xScale(i[0]),y1:t.yScale(a[0]),x2:t.xScale(i[1]),y2:t.yScale(a[1])},n=[0,t.width],l=[t.height,0],s={x1:n[0],x2:n[1],y1:l[0],y2:l[1]};if(!t.isCanvasPreviouslyExpanded||o.x1<1*s.x1||o.x2>1*s.x2||o.y2<1*s.y2||o.y1>1*s.y1){if(t.isCanvasPreviouslyExpanded){var c=t._rangeBump(n),d=t._rangeBump(l);o.x1>c[0]&&(o.x1=c[0]),o.x2<c[1]&&(o.x2=c[1]),o.y1<d[0]&&(o.y1=d[0]),o.y2>d[0]&&(o.y2=d[1])}t.isCanvasPreviouslyExpanded=!0,this._zoomOnRectangle(t.element,o.x1,o.y1,o.x2,o.y2,!1,e)}else t.redrawDataPoints(e)},zoomToMaxMin:function(e,t,i,a,r,o){var n=this.context,l=e,s=t,c=i,d=a,h=n.xScale.domain(),u=n.yScale.domain();l<h[0]&&s<h[1]&&(l=h[0]),l>h[0]&&s>h[1]&&(s=h[1]),c<u[0]&&d<u[1]&&(c=u[0]),c>u[0]&&d>u[1]&&(d=u[1]);var m=[n.xScale(l),n.xScale(s)],g=[n.yScale(c),n.yScale(d)];this._zoomOnRectangle(n.element,m[0],g[0],m[1],g[1],!1,r,o)},_zoomOnRectangle:function(e,t,i,a,o,n,l,s){var c=this.context,d=this.zoomer,h=d3.zoomTransform(this.zoomSelection.node()),u=t,m=i,g=a,v=o;n&&h.translate(u-g,m-v);var f=[0,c.width],p=[c.height,0],x=c._rangeBump(f),b=c._rangeBump(p),y=d.scaleExtent()[0],S=d.scaleExtent()[1],z=void 0,_=void 0,k=void 0;if(u==g||m==v||x[0]==x[1]||b[0]==b[1])return r.warn("_zoomOnRectangle(): can not proceed because this may result in infinity zooms");Math.abs(u-g)>Math.abs(m-v)?(z=Math.abs(b[0]-b[1])/Math.abs(m-v)*h.k,z<y&&(d.ratioY*=z/h.k,z=y),z>S&&(z=S),_=Math.abs(x[0]-x[1])/Math.abs(u-g)*h.k/z*d.ratioX,k=d.ratioY):(z=Math.abs(x[0]-x[1])/Math.abs(u-g)*h.k,z<y&&(d.ratioX*=z/h.k,z=y),z>S&&(z=S),k=Math.abs(b[0]-b[1])/Math.abs(m-v)*h.k/z*d.ratioY,_=d.ratioX);var w=[(h.x-Math.min(u,g))/h.k/d.ratioX*z*_+(x[0]-f[0]),(h.y-Math.min(m,v))/h.k/d.ratioY*z*k+(b[1]-p[1])];d.dontFeedToState=s,d.ratioY=k||1,d.ratioX=_||1,d.duration=l||0,this.zoomSelection.call(d.transform,d3.zoomIdentity.translate(w[0],w[1]).scale(z))},zoomByIncrement:function(e,t){var i=(this.context,d3.zoomTransform(this.zoomSelection.node())),a=i.k,r=[i.x,i.y],o=d3.mouse(this.zoomSelection.node()),n=Math.log(a)/Math.LN2;"plus"!=e&&e||(n=Math.floor(n)+1),"minus"==e&&(n=Math.ceil(n)-1);var l=[(o[0]-r[0])/a,(o[1]-r[1])/a],s=this.zoomer.scaleExtent();a==s[0]&&(this.zoomer.ratioY=1,this.zoomer.ratioX=1),a=Math.max(s[0],Math.min(s[1],Math.pow(2,n))),l=[l[0]*a+r[0],l[1]*a+r[1]],r[0]+=o[0]-l[0],r[1]+=o[1]-l[1],this.zoomer.duration=t||0,this.zoomSelection.call(this.zoomer.transform,d3.zoomIdentity.translate(r[0],r[1]).scale(a))},resetZoomState:function(e){this.zoomer.ratioY=1,this.zoomer.ratioX=1,(e||this.zoomSelection).property("__zoom",d3.zoomIdentity)},reset:function(e,t){this.context.isCanvasPreviouslyExpanded=!1,this.zoomer.ratioY=1,this.zoomer.ratioX=1,this.zoomer.duration=t||0,(e||this.zoomSelection).call(this.zoomer.transform,d3.zoomIdentity)},rerun:function(e){this.context;(e||this.zoomSelection).call(this.zoomer.scaleBy,1)},zoomSelection:function(e){this.zoomSelection=e}});t.default=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=i(4),r=function(e){return e&&e.__esModule?e:{default:e}}(a),o=Vizabi,n=o.utils,l=Vizabi.Class.extend({init:function(e){this.context=e,this._isCreated=null,this.actionsQueue={},this.entityTrails={},this.trailsData=[],this.trailsInProgress={},this.activePromises={},this.trailTransitions={},this.delayedIterations={},this.drawingQueue={}},toggle:function(e){var t=this.context;e?t._trails.create().then(function(){t._trails.run(["findVisible","reveal","opacityHandler"])}):(t._trails.run("remove"),t.model.marker.select.forEach(function(e){e.trailStartTime=null}))},create:function(e){var t=this.context,i=this,a=t.KEY,o=t.TIMEDIM;return this._isCreated=new Promise(function(l,s){if(t.model.ui.chart.trails){var c=t.model.time.getAllSteps(),d=[];e=null==e?t.model.marker.select:[e],i._clearActions(e),i.trailsData=t.model.marker.select.map(function(e){var t={status:"created",selectedEntityData:e};return t[a]=e[a],t}),i.trailTransitions={};var h=t.bubbleContainer.selectAll("g.vzb-bc-entity.entity-trail").data(i.trailsData,function(e){return e[a]});h.exit().remove(),h.enter().insert("g",function(e){return this.querySelector(".bubble-"+(0,r.default)(e[a]))}).attr("class",function(e){return"vzb-bc-entity entity-trail trail-"+e[a]}).merge(h).each(function(e,r){var l=this;d.push(new Promise(function(r,s){var d=c.map(function(t){return{t:t,key:e[a]}}),h=d3.select(l).selectAll("g").data(d).classed("vzb-invisible",!0);h.exit().remove(),i.entityTrails[e[a]]=h.enter().append("g").attr("class","vzb-bc-trailsegment").on("mouseover",function(i,r){if(!n.isTouchDevice()){var l={};l[a]=i.key,l[o]=i.t,t._axisProjections(l),t._labels.highlight(e,!0);var s=t.model.time.formatDate(i.t),c=n.find(t.model.marker.select,function(t){return t[a]==e[a]});t.model.marker.getFrame(l[o],function(e){var i=t.xScale(e.axis_x[l[a]]),r=t.yScale(e.axis_y[l[a]]),o=n.areaToRadius(t.sScale(e.size[l[a]])),d=null!=e.color[l[a]]?t.cScale(e.color[l[a]]):t.COLOR_WHITEISH;s!==c.trailStartTime&&t._setTooltip(s,i,r,o+3,d),t._setBubbleCrown(i,r,o,d),t.model.marker.getModelObject("highlight").trigger("change",{size:e.size[l[a]],color:e.color[l[a]]})}),d3.select(this).style("opacity",1)}}).on("mouseout",function(e,i){n.isTouchDevice()||(t._axisProjections(),t._setTooltip(),t._setBubbleCrown(),t._labels.highlight(null,!1),t.model.marker.getModelObject("highlight").trigger("change",null),d3.select(this).style("opacity",t.model.marker.opacityRegular))}).each(function(e,t){var i=d3.select(this);i.append("circle"),i.append("line")}).merge(h),r()}))}),d.length>0?Promise.all(d).then(function(e){l(!0)}):l(!0)}}),this._isCreated},_addActions:function(e,t){var i=this.context,a=this,r=i.KEY;e.forEach(function(e){a.actionsQueue[e[r]]||(a.actionsQueue[e[r]]=[]),a.actionsQueue[e[r]]=[].concat(a.actionsQueue[e[r]].filter(function(e){return-1==t.indexOf(e)}),t)})},_clearActions:function(e){var t=this.context,i=this,a=t.KEY;e.forEach(function(e){i.actionsQueue[e[a]]||(i.actionsQueue[e[a]]=[]),i.actionsQueue[e[a]]=[],i.drawingQueue[e[a]]={},i.delayedIterations[e[a]]={},i.activePromises[e[a]]||(i.activePromises[e[a]]=[]),n.forEach(i.activePromises[e[a]],function(e,t){"pending"===e.status&&e.reject()}),i.trailsInProgress[e[a]]=null,i.activePromises[e[a]]=[]})},_getNextAction:function(e){return this.actionsQueue[e].shift()},run:function(e,t,i){var a=this.context,r=this,o=a.KEY;this._isCreated&&!a.model.time.splash&&("string"===typeof e&&(e=[e]),this._isCreated.then(function(){if(a.model.ui.chart.trails&&a.model.marker.select.length||"remove"==e){i||(i=0),t=null==t?a.model.marker.select:[t];for(var n=0;n<e.length;n++)-1!=["resize","recolor","remove"].indexOf(e[n])&&function(){var t=e.splice(n,1).pop();--n,r.trailsData.forEach(function(e){var n=r.entityTrails[e[o]];a._trails["_"+t](n,i,e)})}();0!=e.length&&(r._addActions(t,e),r.trailsData.forEach(function(t){-1!=e.indexOf("findVisible")&&(r.drawingQueue[t[o]]={},r.delayedIterations[t[o]]={});var n=r.entityTrails[t[o]];r.trailsInProgress[t[o]]||function e(l){var s=r._getNextAction(t[o]);if(s){r.trailsInProgress[t[o]]=s;var c=a._trails["_"+s](n,i,t);c&&c instanceof Promise?c.then(function(){r.trailsInProgress[t[o]]=null,e(l+1)},function(){r.trailsInProgress[t[o]]=null}):(r.trailsInProgress[t[o]]=null,e(l+1))}}(0)}))}}))},_remove:function(e,t,i){this.actionsQueue[i[this.context.KEY]]=[],e&&(d3.select(this.entityTrails[i[this.context.KEY]].node().parentNode).remove(),this.entityTrails[i[this.context.KEY]]=null)},_resize:function(e,t,i){var a=this.context;if(!a.model.time.splash){var r=!1;e.each(function(e,o){if(null!=e.valueY&&null!=e.valueX&&null!=e.valueS){var l=d3.select(this);if(t?l.select("circle").transition().duration(t).ease(d3.easeLinear).attr("cy",a.yScale(e.valueY)).attr("cx",a.xScale(e.valueX)).attr("r",n.areaToRadius(a.sScale(e.valueS))):l.select("circle").interrupt().attr("cy",a.yScale(e.valueY)).attr("cx",a.xScale(e.valueX)).attr("r",n.areaToRadius(a.sScale(e.valueS))).transition(),r||e.transparent||(r=!0,a._labels.updateLabelOnlyPosition(i,null,{scaledS0:n.areaToRadius(a.sScale(e.valueS))})),e.next){var s=e.next;if(null!=s&&null!=s.valueY&&null!=s.valueX){var c=Math.sqrt(Math.pow(a.xScale(e.valueX)-a.xScale(s.valueX),2)+Math.pow(a.yScale(e.valueY)-a.yScale(s.valueY),2));t?l.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(s.valueX)).attr("y1",a.yScale(s.valueY)).attr("x2",a.xScale(e.valueX)).attr("y2",a.yScale(e.valueY)).attr("stroke-dasharray",c).attr("stroke-dashoffset",n.areaToRadius(a.sScale(e.valueS))):l.select("line").interrupt().attr("x1",a.xScale(s.valueX)).attr("y1",a.yScale(s.valueY)).attr("x2",a.xScale(e.valueX)).attr("y2",a.yScale(e.valueY)).attr("stroke-dasharray",c).attr("stroke-dashoffset",n.areaToRadius(a.sScale(e.valueS))).transition()}}}})}},_recolor:function(e,t,i){var a=this.context;e.each(function(e,t){var i=d3.select(this),r="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:e.valueC,shadeID:"shade"}):null!=e.valueC?a.cScale(e.valueC):a.COLOR_BLACKISH;i.select("circle").style("fill",null!=e.valueC?a.cScale(e.valueC):a.COLOR_WHITEISH),i.select("line").style("stroke",r)})},_opacityHandler:function(e,t,i){var a=this.context;e.each(function(e,t){d3.select(this).style("opacity",i.opacity||a.model.marker.opacityRegular)})},_findVisible:function(e,t,i){var a=this.context,r=this,o=a.KEY;return new Promise(function(t,l){new Promise(function(e,t){i.limits?e():a.model.marker.getEntityLimits(i[o]).then(function(t){i.limits=t,e()})}).then(function(){i.selectedEntityData.trailStartTime||(i.selectedEntityData.trailStartTime=a.model.time.formatDate(a.time));var l=a.model.time.parse(""+i.selectedEntityData.trailStartTime);if(a.time-l<0||i.limits.min-l>0){a.time-l<0?(i.selectedEntityData.trailStartTime=a.model.time.formatDate(d3.max([a.time,i.limits.min])),l=a.model.time.parse(""+i.selectedEntityData.trailStartTime)):(i.selectedEntityData.trailStartTime=a.model.time.formatDate(i.limits.min),l=a.model.time.parse(""+i.selectedEntityData.trailStartTime));var s=a._labels.cached[i[o]],c=a.frame.size[i[o]],d=a.frame.color[i[o]];s.labelX0=a.frame.axis_x[i[o]],s.labelY0=a.frame.axis_y[i[o]],s.scaledS0=c||0===c?n.areaToRadius(a.sScale(c)):null,s.scaledC0=null!=d?a.cScale(d):a.COLOR_WHITEISH,a._updateLabel(i,0,a.frame.axis_x[i[o]],a.frame.axis_y[i[o]],a.frame.size[i[o]],a.frame.color[i[o]],a.frame.label[i[o]],a.frame.size_label[i[o]],0,!0)}e.each(function(t,r){var o=t.transparent;t.transparent=null==i.selectedEntityData.trailStartTime||t.t-a.time>0||l-t.t>0||i.selectedEntityData.trailStartTime-a.model.time.formatDate(a.time)>=0,(o!=t.transparent||Math.abs(a.model.time.formatDate(t.t)-a.model.time.formatDate(a.time))<2)&&(t.visibilityChanged=!0),t.transparent&&d3.select(e._groups[0][r]).classed("vzb-invisible",t.transparent)}),r.drawingQueue[i[o]]={},r.delayedIterations[i[o]]={},t()})})},_abortAnimation:function(){var e=this.context,t=this,i=e.KEY;t.trailsData.forEach(function(e){t.trailTransitions[e[i]]&&t.trailTransitions[e[i]].select("line").interrupt().transition()})},_reveal:function(e,t,i){var a=this.context;a.model.time.playing&&(t=a.model.time.delay);var r=this,o=a.KEY;i.status="reveal";var l=a.model.time.parse(""+i.selectedEntityData.trailStartTime),s=function(e,s,c,h){return new Promise(function(h,u){var m=d3.select(e._groups[0][s]),g=m.datum();if(c-s==1){if(g.transparent)return m.classed("vzb-invisible",g.transparent),h();if(!g.visibilityChanged)return h()}a.model.marker.getFrame(g.t,function(u){if("reveal"!=i.status)return h();if(!u)return h();if(g.valueY=u.axis_y[i[o]],g.valueX=u.axis_x[i[o]],g.valueS=u.size[i[o]],g.valueC=u.color[i[o]],null==g.valueY||null==g.valueX||null==g.valueS)return h();if(l&&l.toString()==g.t.toString()){var v=a._labels.cached[i[o]];v.labelX0=g.valueX,v.labelY0=g.valueY;var f=g.valueS;v.scaledS0=f||0===f?n.areaToRadius(a.sScale(f)):null,v.scaledC0=null!=g.valueC?a.cScale(g.valueC):a.COLOR_WHITEISH,a._updateLabel(i,s,g.valueX,g.valueY,g.valueS,g.valueC,u.label[i[o]],u.size_label[i[o]],0,!0)}if(m.select("circle").attr("cy",a.yScale(g.valueY)).attr("cx",a.xScale(g.valueX)).attr("r",n.areaToRadius(a.sScale(g.valueS))).style("fill",null!=g.valueC?a.cScale(g.valueC):a.COLOR_WHITEISH),m.select("line").attr("x2",a.xScale(g.valueX)).attr("y2",a.yScale(g.valueY)).attr("x1",a.xScale(g.valueX)).attr("y1",a.yScale(g.valueY)),a.time-g.t>0?(g.visibilityChanged=!1,m.classed("vzb-invisible",g.transparent)):m.classed("vzb-invisible",!0),!e._groups[0][c]||a.time.toString()==g.t.toString())return h();var p=d3.select(e._groups[0][c]),x=p.datum();x.previous=g,g.next=x;var b=x.t;a.time-x.t<0&&(g.visibilityChanged=!0,b=a.time),a.model.marker.getFrame(b,function(e){if("reveal"!=i.status)return h();if(!e||null==g.valueY||null==g.valueX||null==g.valueS)return h();if(null==e.axis_x[i[o]]||null==e.axis_y[i[o]])return h();x.valueY=e.axis_y[i[o]],x.valueX=e.axis_x[i[o]],x.valueS=e.size[i[o]],x.valueC=e.color[i[o]],r.trailTransitions[i[o]]=m;var l="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:g.valueC,shadeID:"shade"}):null!=g.valueC?a.cScale(g.valueC):a.COLOR_BLACKISH,u=Math.sqrt(Math.pow(a.xScale(g.valueX)-a.xScale(e.axis_x[i[o]]),2)+Math.pow(a.yScale(g.valueY)-a.yScale(e.axis_y[i[o]]),2));return m.select("line").attr("stroke-dasharray",u).attr("stroke-dashoffset",n.areaToRadius(a.sScale(g.valueS))).style("stroke",l).transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(x.valueX)).attr("y1",a.yScale(x.valueY)).attr("x2",a.xScale(g.valueX)).attr("y2",a.yScale(g.valueY)),c-s>1?(d(s,c),h()):h()})})})},c=function(r,l,s){return new Promise(function(c,h){var u=d3.select(e._groups[0][r]),m=d3.select(e._groups[0][l]),g=d3.select(e._groups[0][s]),v=u.datum(),f=m.datum(),p=g.datum();if(!v.previous&&!v.next||!f.previous&&!f.next)return c();a.model.marker.getFrame(p.t,function(e){if("reveal"!=i.status)return c();if(!e||"undefined"===typeof e.axis_x||null==e.axis_x[i[o]]||"undefined"===typeof e.axis_y||null==e.axis_y[i[o]])return n.warn("Frame for trail missed: "+p.t),c();if(p.valueY=e.axis_y[i[o]],p.valueX=e.axis_x[i[o]],p.valueS=e.size[i[o]],p.valueC=e.color[i[o]],p.previous=v,p.next=f,v.next=p,f.previous=p,null==p.valueY||null==p.valueX||null==p.valueS)return n.warn("Data for trail point missed: "+p.t),c();var h="geo.world_4region"==a.model.marker.color.which?a.model.marker.color.getColorShade({colorID:p.valueC,shadeID:"shade"}):null!=p.valueC?a.cScale(p.valueC):a.COLOR_BLACKISH,m=Math.sqrt(Math.pow(a.xScale(v.valueX)-a.xScale(p.valueX),2)+Math.pow(a.yScale(v.valueY)-a.yScale(p.valueX),2));if(u.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(p.valueX)).attr("y1",a.yScale(p.valueY)).attr("x2",a.xScale(v.valueX)).attr("y2",a.yScale(v.valueY)).attr("stroke-dasharray",m).attr("stroke-dashoffset",n.areaToRadius(a.sScale(v.valueS))).style("stroke",h),g.classed("vzb-invisible",p.transparent),!p.transparent){g.select("circle").attr("cy",a.yScale(p.valueY)).attr("cx",a.xScale(p.valueX)).attr("r",n.areaToRadius(a.sScale(p.valueS))).style("fill",null!=p.valueC?a.cScale(p.valueC):a.COLOR_WHITEISH);var x=Math.sqrt(Math.pow(a.xScale(p.valueX)-a.xScale(f.valueX),2)+Math.pow(a.yScale(p.valueY)-a.yScale(f.valueY),2));g.select("line").transition().duration(t).ease(d3.easeLinear).attr("x1",a.xScale(f.valueX)).attr("y1",a.yScale(f.valueY)).attr("x2",a.xScale(p.valueX)).attr("y2",a.yScale(p.valueY)).attr("stroke-dasharray",x).attr("stroke-dashoffset",n.areaToRadius(a.sScale(p.valueS))).style("stroke",h)}d(r,s,l),c()})})},d=function(e,t,a){var n=void 0;t-e>1&&(n=h(e,t),r.delayedIterations[i[o]][e]={first:e,next:t,medium:n}),a&&a-t>1&&(n=h(t,a),r.delayedIterations[i[o]][t]={first:t,next:a,medium:n})},h=function(e,t){return Math.round(e+(t-e)/2)},u=function(e,t,i){var r=[],o=0,l=0,s=d3.min([e.limits.max,a.time]),c=d3.max([e.limits.min,a.model.time.parse(""+e.selectedEntityData.trailStartTime)]);return n.forEach(t._groups[0],function(e,t){var n=e.__data__;n.t-c==0?o=t:n.t-s==0?l=t:n.t>c&&n.t<s&&(a.model.time.formatDate(n.t)%i==0||n.next&&n.previous)&&r.push(t)}),r.unshift(o),l>0&&r.push(l),r},m=function(){return new Promise(function(e,t){Object.keys(r.drawingQueue[i[o]]).length>0?function t(){var a=Object.keys(r.drawingQueue[i[o]])[Math.floor(Math.random()*Object.keys(r.drawingQueue[i[o]]).length)],n=JSON.parse(JSON.stringify(r.drawingQueue[i[o]][a]));delete r.drawingQueue[i[o]][a],c(n.first,n.next,n.medium).then(function(){Object.keys(r.drawingQueue[i[o]]).length>0?t():e()})}(r.drawingQueue[i[o]]):e()})};return new Promise(function(t,n){var l=function e(){m().then(function(){if(0==Object.keys(r.delayedIterations[i[o]]).length)return t();r.drawingQueue[i[o]]=r.delayedIterations[i[o]],r.delayedIterations[i[o]]={},e()},function(){return t()})};if(a.model.marker.framesAreReady())!function e(i,a){if(a<0||a>=i._groups[0].length)return t();s(i,a,a+1).then(function(){e(i,a+1)},function(){return t()})}(e,0);else{r.delayedIterations[i[o]]={},r.drawingQueue[i[o]]={};var c=u(i,e,50),d=[];if(c.length<=1)return t();r.delayedIterations[i[o]]={};for(var h=0;h<c.length-1;h++)d.push(s(e,c[h],c[h+1]));Promise.all(d).then(function(){0==Object.keys(r.delayedIterations[i[o]]).length?t():(r.drawingQueue[i[o]]=r.delayedIterations[i[o]],r.delayedIterations[i[o]]={},l())},function(){t()})}})}});t.default=l},function(e,t,i){(function(t){!function(t,i){e.exports=i(t)}("undefined"!=typeof t?t:this,function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,i=String(e),a=i.length,r=-1,o="",n=i.charCodeAt(0);++r<a;)t=i.charCodeAt(r),o+=0!=t?t>=1&&t<=31||127==t||0==r&&t>=48&&t<=57||1==r&&t>=48&&t<=57&&45==n?"\\"+t.toString(16)+" ":(0!=r||1!=a||45!=t)&&(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?i.charAt(r):"\\"+i.charAt(r):"�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t})}).call(t,i(7))},function(e,t){},function(e,t){e.exports='\x3c!-- Bubble Chart Component --\x3e\n<div class="vzb-bubblechart">\n <svg class="vzb-bubblechart-svg vzb-export">\n <g class="vzb-bc-graph">\n <g class="vzb-bc-year"></g>\n\n <svg class="vzb-bc-axis-x"><g></g></svg>\n <svg class="vzb-bc-axis-y"><g></g></svg>\n <line class="vzb-bc-projection-x"></line>\n <line class="vzb-bc-projection-y"></line>\n\n <svg class="vzb-bc-bubbles-crop">\n <g class="vzb-zoom-selection"></g>\n <line class="vzb-bc-line-equal-xy vzb-invisible"></line>\n <rect class="vzb-bc-eventarea"></rect>\n <g class="vzb-bc-trails"></g>\n <g class="vzb-bc-bubbles"></g>\n <g class="vzb-bc-lines"></g>\n <g class="vzb-bc-bubble-crown vzb-hidden">\n <circle class="vzb-crown-glow"></circle>\n <circle class="vzb-crown"></circle>\n </g>\n </svg>\n\n <g class="vzb-bc-axis-y-title"></g>\n <g class="vzb-bc-axis-x-title"></g>\n <g class="vzb-bc-axis-s-title"></g>\n <g class="vzb-bc-axis-c-title"></g>\n\n <g class="vzb-bc-axis-y-info vzb-noexport"></g>\n <g class="vzb-bc-axis-x-info vzb-noexport"></g>\n\n <svg class="vzb-bc-labels-crop">\n <g class="vzb-bc-labels"></g>\n </svg>\n\n <g class="vzb-data-warning vzb-noexport">\n <svg></svg>\n <text></text>\n </g>\n\n <rect class="vzb-bc-zoom-rect"></rect>\n <g class="vzb-bc-tooltip vzb-hidden">\n <rect class="vzb-tooltip-glow"></rect>\n <rect class="vzb-tooltip-border"></rect>\n <text class="vzb-tooltip-text"></text>\n </g>\n </g>\n </svg>\n <svg>\n <defs>\n <filter id="vzb-glow-filter" x="-50%" y="-50%" width="200%" height="200%">\n <feGaussianBlur in="SourceGraphic" stdDeviation="2"></feGaussianBlur>\n </filter>\n </defs>\n </svg>\n \x3c!-- This could possibly be another component --\x3e\n <div class="vzb-tooltip vzb-hidden vzb-tooltip-mobile"></div>\n</div>\n'},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"===typeof window&&(i=window)}e.exports=i},function(e,t,i){e.exports=i(0)}]); | ||
//# sourceMappingURL=bubblechart.js.map |
@@ -18,3 +18,3 @@ { | ||
"name": "vizabi-bubblechart", | ||
"version": "1.0.17-0", | ||
"version": "1.0.17-1", | ||
"repository": { | ||
@@ -21,0 +21,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
605261