var earthjs=function(){"use strict";var t=function(){function t(t){var n=t[0]/2*d,e=u(n),o=s(n),r=t[1]/2*d,a=u(r),i=s(r),l=t[2]/2*d,c=u(l),h=s(l);return[o*i*h+e*a*c,e*i*h-o*a*c,o*a*h+e*i*c,o*i*c-e*a*h]}function n(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function e(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}var o=Math.acos,r=Math.asin,a=Math.atan2,s=Math.cos,i=Math.max,l=Math.min,c=Math.PI,u=Math.sin,h=Math.sqrt,d=c/180,p=180/c;return t.cartesian=function(t){var n=t[0]*d,e=t[1]*d,o=s(e);return[o*s(n),o*u(n),u(e)]},t.rotation=function(t){return[a(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*p,r(i(-1,l(1,2*(t[0]*t[2]-t[3]*t[1]))))*p,a(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*p]},t.delta=function(t,r){var a=n(t,r),c=h(e(a,a));if(!c)return[1,0,0,0];var d=o(i(-1,l(1,e(t,r))))/2,p=u(d);return[s(d),a[2]/c*p,-a[1]/c*p,a[0]/c*p]},t.multiply=function(t,n){return[t[0]*n[0]-t[1]*n[1]-t[2]*n[2]-t[3]*n[3],t[0]*n[1]+t[1]*n[0]+t[2]*n[3]-t[3]*n[2],t[0]*n[2]-t[1]*n[3]+t[2]*n[0]+t[3]*n[1],t[0]*n[3]+t[1]*n[2]-t[2]*n[1]+t[3]*n[0]]},t}(),n=function n(){function e(t,n){t[n]&&(r[n][t.name]=t[n],r[n+"Keys"]=Object.keys(r[n]),r[n+"Vals"]=Object.values(r[n]))}var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};clearInterval(n.ticker),o=Object.assign({transparent:!1,select:"#earth",rotate:130},o);var r={onCreate:{},onCreateKeys:[],onCreateVals:[],onRefresh:{},onRefreshKeys:[],onRefreshVals:[],onResize:{},onResizeKeys:[],onResizeVals:[],onInterval:{},onIntervalKeys:[],onIntervalVals:[],ready:null,promeses:[],loadingData:null,recreateSvgOrCanvas:function(){return r.onCreateVals.forEach(function(t){t.call(c)}),c}};window.__=r;var a=d3.selectAll(o.select),s=a.attr("width"),i=a.attr("height");s&&i||(s=o.width||700,i=o.height||500,a.attr("width",s).attr("height",i));var l=[s/2,i/2];Object.defineProperty(o,"width",{get:function(){return s},set:function(t){s=t,l[0]=t/2}}),Object.defineProperty(o,"height",{get:function(){return i},set:function(t){i=t,l[1]=t/2}});var c={_:{svg:a,drag:!1,versor:t,center:l,options:o},$slc:{},ready:function(t){if(t&&r.promeses.length>0){var n=d3.queue();r.loadingData=!0,r.promeses.forEach(function(t){t.urls.forEach(function(t){var e=t.split(".").pop();"geojson"===e&&(e="json"),n.defer(d3[e],t)})}),n.await(function(){var n=[].slice.call(arguments),e=n.shift();r.promeses.forEach(function(t){var o=t.urls.length,r=n.slice(0,o),a=c[t.name].ready;r.unshift(e),a?a.apply(c,r):t.onReady.apply(c,r),n=n.slice(o)}),r.loadingData=!1,t.call(c)})}else if(0===arguments.length)return r.loadingData},register:function(t){var n={};return c[t.name]=n,Object.keys(t).forEach(function(e){-1===["urls","onReady","onInit","onCreate","onRefresh","onResize","onInterval"].indexOf(e)&&"function"==typeof t[e]&&(n[e]=function(){return t[e].apply(c,arguments)})}),t.onInit&&t.onInit.call(c),e(t,"onCreate"),e(t,"onResize"),e(t,"onRefresh"),e(t,"onInterval"),t.urls&&t.onReady&&r.promeses.push({name:t.name,urls:t.urls,onReady:t.onReady}),c}},u=[],h=null,d=c._;return c.create=function(t){return u=t||[],r.recreateSvgOrCanvas(),u.forEach(function(t){t.create(null)}),null===h&&u!==[]&&d.ticker(),c},c.$slc.defs=d.svg.append("defs"),d.ticker=function(t){var e=d.interval;return t=t||50,h=setInterval(function(){e.call(c),u.forEach(function(t){t._.interval.call(t)})},t),n.ticker=h,c},d.scale=function(t){return d.proj.scale(t),d.resize(),d.refresh(),c},d.rotate=function(t){return d.proj.rotate(t),d.refresh(),c},d.interval=function(){return r.onIntervalVals.forEach(function(t){t.call(c)}),c},d.refresh=function(t){if(t){(t?r.onRefreshKeys.filter(function(n){return t.test(n)}):r.onRefreshKeys).forEach(function(t){r.onRefresh[t].call(c)})}else r.onRefreshVals.forEach(function(t){t.call(c)});return c},d.resize=function(){return r.onResizeVals.forEach(function(t){t.call(c)}),c},d.orthoGraphic=function(){return d3.geoOrthographic().rotate([d.options.rotate,0]).scale(d.options.width/3.5).translate(d.center).precision(.1).clipAngle(90)},d.proj=d.orthoGraphic(),d.path=d3.geoPath().projection(d.proj),c},e=function(){function t(){function t(t){var n=t[0]-l[0];t[0]=n+this._.proj.rotate()[0],t[0]>=180&&(t[0]-=360),this._.rotate(t)}function e(){var t=d3.mouse(this);i=s.cartesian(a.proj.invert(d3.mouse(this))),l=a.proj.rotate(),c=s(l),a.drag=null,a.refresh(),n.mouse=t,n._this=this}function o(){var t=d3.mouse(this),e=s.cartesian(a.proj.rotate(l).invert(t)),o=s.multiply(c,s.delta(i,e));n.r=s.rotation(o),n.mouse=t,n._this=this,a.drag=!0}function r(){null===a.drag?n.onClickKeys.forEach(function(t){n.onClick[t].call(n._this,n.mouse)}):(a.drag=!1,a.rotate(n.r),n.onDragKeys.forEach(function(t){n.onDrag[t].call(n._this,n.mouse)}),n.sync.forEach(function(e){t.call(e,n.r)})),n.mouse=null,n.r=null}var a=this._,s=a.versor;n.svg.call(d3.drag().on("start",e).on("end",r).on("drag",o));var i=void 0,l=void 0,c=void 0}var n={svg:null,q:null,sync:[],mouse:null,onDrag:{},onDragKeys:[],onClick:{},onClickKeys:[]};return{name:"versorMousePlugin",onInit:function(){n.svg=this._.svg,t.call(this)},onInterval:function(){var t=this,e=this._;e.drag&&n.r&&(e.rotate(n.r),n.onDragKeys.forEach(function(e){n.onDrag[e].call(t,n.mouse)}))},selectAll:function(e){return e&&(n.q=e,n.svg.call(d3.drag().on("start",null).on("end",null).on("drag",null)),n.svg=d3.selectAll(e),t.call(this)),n.svg},sync:function(t){n.sync=t},mouse:function(){return n.mouse},onDrag:function(t){Object.assign(n.onDrag,t),n.onDragKeys=Object.keys(n.onDrag)},onClick:function(t){Object.assign(n.onClick,t),n.onClickKeys=Object.keys(n.onClick)}}},o=function(){function t(){var t=this._;n.svg.on("wheel",function(){var e=d3.event.deltaY+t.proj.scale();e=e<20?20:e>999?1e3:e,t.scale(e),n.sync.forEach(function(t){t._.scale.call(t,e)})})}var n={svg:null,q:null,sync:[]};return{name:"wheelZoomPlugin",onInit:function(){n.svg=this._.svg,t.call(this)},selectAll:function(e){return e&&(n.q=e,n.svg.on("wheel",null),n.svg=d3.selectAll(e),t.call(this)),n.svg},sync:function(t){n.sync=t}}},r=function(){function t(){setTimeout(function(){n.renderer.render(n.scene,n.camera)},1)}var n={renderer:null,scene:null,camera:null,scale:null};return{name:"threejsPlugin",onInit:function(){var e=this._.options.width,o=this._.options.height;n.scene=new THREE.Scene,n.yAxis=new THREE.Vector3(0,1,0),n.camera=new THREE.OrthographicCamera(-e/2,e/2,o/2,-o/2,.1,1e4),n.camera.position.z=500,this._.camera=n.camera,n.renderer=new THREE.WebGLRenderer({antialias:!0}),n.renderer.domElement.id="three-js",n.renderer.setClearColor("white",1),n.renderer.setSize(e,o),document.body.appendChild(n.renderer.domElement),this.renderThree=t},onRefresh:function(){t.call(this)},addObject:function(t){n.scene.add(t)}}},a=function(){function t(){var t=this._;if(t.options.showCanvas){if(!e.canvas){var o=t.svg.append("g").attr("class","canvas").append("foreignObject").attr("x",0).attr("y",0).attr("width",t.options.width).attr("height",t.options.height),r=o.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","none").style("width",t.options.width+"px").style("height",t.options.height+"px");e.canvas=r.append("canvas")}e.canvas.attr("x",0).attr("y",0).attr("width",t.options.width).attr("height",t.options.height)}e.canvas&&n.call(this)}function n(){var t=this._.options,n=t.width,o=t.height;e.canvas.each(function(){this.getContext("2d").clearRect(0,0,n,o)})}var e={canvas:null,path:null,q:null};return{name:"canvasPlugin",onInit:function(){this._.options.showCanvas=!0,e.path=d3.geoPath().projection(this._.proj)},onCreate:function(){t.call(this)},onRefresh:function(){n.call(this)},selectAll:function(t){return t&&(e.q=t,e.canvas=d3.selectAll(t)),e.canvas},render:function(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=this._;if(r.options.showCanvas){var a=!1,s=r.proj,i=s.rotate(),l=this;e.canvas.each(function(r,c){if(!n||n.indexOf(c)>-1){var u=o[c]||{};u.rotate?(a=!0,s.rotate([i[0]+u.rotate,i[1],i[2]])):a&&(a=!1,s.rotate(i));var h=this.getContext("2d");t.call(l,h,e.path.context(h))}}),a&&(a=!1,s.rotate(i))}}}},s=function(){function t(t){return e.countries.features.find(function(n){return n.geometry.coordinates.find(function(n){return d3.polygonContains(n,t)||n.find(function(n){return d3.polygonContains(n,t)})})})}function n(){if(this.worldCanvas){var n=this.worldCanvas.data(),o=n.world;o&&(e.countries=topojson.feature(o,o.objects.countries))}var r=this._,a=function(){var n=this,o=d3.event;if(o){o.sourceEvent&&(o=o.sourceEvent);var a=[o.clientX,o.clientY],s=r.proj.invert(d3.mouse(this));e.pos=s,e.dot=null,e.mouse=a,e.country=null,r.options.showDots&&e.onCircleKeys.forEach(function(t){e.dot=e.onCircle[t].call(n,e.mouse,s)}),r.options.showLand&&e.countries&&!e.dot&&(r.drag||(e.country=t(s)),e.onCountryKeys.forEach(function(t){e.onCountry[t].call(n,e.mouse,e.country)}))}};r.svg.on("mousemove",a),this.versorMousePlugin&&this.versorMousePlugin.onDrag({hoverCanvas:a})}var e={mouse:null,country:null,countries:null,onCircle:{},onCircleKeys:[],onCountry:{},onCountryKeys:[]};return{name:"hoverCanvas",onInit:function(){n.call(this)},onCircle:function(t){Object.assign(e.onCircle,t),e.onCircleKeys=Object.keys(e.onCircle)},onCountry:function(t){Object.assign(e.onCountry,t),e.onCountryKeys=Object.keys(e.onCountry)},world:function(t){e.countries=topojson.feature(t,t.objects.countries)},data:function(){return{pos:e.pos,dot:e.dot,mouse:e.mouse,country:e.country}}}},i=function(){function t(t){return e.countries.features.find(function(n){return n.geometry.coordinates.find(function(n){return d3.polygonContains(n,t)||n.find(function(n){return d3.polygonContains(n,t)})})})}function n(){if(this.worldCanvas){var n=this.worldCanvas.data(),o=n.world;o&&(e.countries=topojson.feature(o,o.objects.countries))}var r=this._,a=function(){var n=this,o=d3.event;if(o){o.sourceEvent&&(o=o.sourceEvent);var a=[o.clientX,o.clientY],s=r.proj.invert(d3.mouse(this));e.pos=s,e.dot=null,e.mouse=a,e.country=null,r.options.showDots&&e.onCircleKeys.forEach(function(t){e.dot=e.onCircle[t].call(n,e.mouse,s)}),r.options.showLand&&!e.dot&&(r.drag||(e.country=t(s)),e.onCountryKeys.forEach(function(t){e.onCountry[t].call(n,e.mouse,e.country)}))}};this.versorMousePlugin&&this.versorMousePlugin.onClick({clickCanvas:a})}var e={mouse:null,country:null,countries:null,onCircle:{},onCircleKeys:[],onCountry:{},onCountryKeys:[]};return{name:"clickCanvas",onInit:function(){n.call(this)},onCircle:function(t){Object.assign(e.onCircle,t),e.onCircleKeys=Object.keys(e.onCircle)},onCountry:function(t){Object.assign(e.onCountry,t),e.onCountryKeys=Object.keys(e.onCountry)},world:function(t){e.countries=topojson.feature(t,t.objects.countries)},data:function(){return{pos:e.pos,dot:e.dot,mouse:e.mouse,country:e.country}}}},l=function(){function t(){if(o.svg.selectAll("#ocean,.ocean").remove(),this._.options.showOcean){var t=o.oceanColor,r=this.$slc.defs.append("radialGradient").attr("id","ocean").attr("cx","75%").attr("cy","25%");"number"==typeof t?(t=e[t],r.append("stop").attr("offset","5%").attr("stop-color",t[0])):"string"==typeof t&&(t=[t,t]),r.append("stop").attr("offset","100%").attr("stop-color",t[1]),o.ocean=o.svg.append("g").attr("class","ocean").append("circle").attr("cx",this._.center[0]).attr("cy",this._.center[1]).attr("class","noclicks"),n.call(this)}}function n(){o.ocean&&this._.options.showOcean&&o.ocean.attr("r",this._.proj.scale()+o.scale)}var e={0:["rgba(221, 221, 255, 0.6)","rgba(153, 170, 187,0.8)"],1:["rgba(159, 240, 232, 0.6)","rgba( 5, 242, 219,0.8)"],2:["rgba(152, 234, 242, 0.6)","rgba( 5, 219, 242,0.8)"],3:["rgba(114, 162, 181, 0.6)","rgba( 4, 138, 191,0.8)"],4:["rgba( 96, 123, 148, 0.6)","rgba( 10, 93, 166,0.8)"],5:["rgba( 87, 102, 131, 0.6)","rgba( 8, 52, 140,0.8)"]},o={svg:null,q:null,scale:0,oceanColor:0};return{name:"oceanSvg",onInit:function(){this._.options.showOcean=!0,Object.defineProperty(this._.options,"oceanColor",{get:function(){return o.oceanColor},set:function(t){o.oceanColor=t}}),o.svg=this._.svg},onCreate:function(){t.call(this)},onResize:function(){n.call(this)},selectAll:function(t){return t&&(o.q=t,o.svg=d3.selectAll(t)),o.svg},scale:function(t){if(!t)return o.scale;o.scale=t,n.call(this)},recreate:function(){t.call(this)}}},c=function(){return{name:"configPlugin",set:function(t){if(t){if(Object.assign(this._.options,t),void 0!==t.spin){var n=this.autorotatePlugin;t.spin?n.start():n.stop()}this.create()}return Object.assign({},this._.options)}}},u=function(){function t(){var t=this._;t.options.showGraticule&&((t.options.transparent||t.options.transparentGraticule)&&t.proj.clipAngle(180),this.canvasPlugin.render(function(t,o){t.beginPath(),o(n),t.lineWidth=.3,t.strokeStyle=e.style.line||"rgba(119,119,119,0.4)",t.stroke()},e.drawTo),(t.options.transparent||t.options.transparentGraticule)&&t.proj.clipAngle(90))}var n=d3.geoGraticule()(),e={style:{},drawTo:null};return{name:"graticuleCanvas",onInit:function(){this._.options.transparentGraticule=!1,this._.options.showGraticule=!0},onCreate:function(){t.call(this)},onRefresh:function(){t.call(this)},style:function(t){return t&&(e.style=t),e.style},drawTo:function(t){e.drawTo=t}}},h=function(){function t(){e.svg.selectAll(".graticule").remove(),this._.options.showGraticule&&(o.graticule=e.svg.append("g").attr("class","graticule").append("path").datum(e.graticule).attr("class","noclicks"),n.call(this))}function n(){var t=this._;o.graticule&&t.options.showGraticule&&(t.options.transparent||t.options.transparentGraticule?(t.proj.clipAngle(180),o.graticule.attr("d",this._.path),t.proj.clipAngle(90)):o.graticule.attr("d",this._.path))}var e={svg:null,q:null,graticule:d3.geoGraticule()},o={};return{name:"graticuleSvg",onInit:function(){this._.options.showGraticule=!0,e.svg=this._.svg},onCreate:function(){t.call(this)},onRefresh:function(){n.call(this)},selectAll:function(t){return t&&(e.q=t,e.svg=d3.selectAll(t)),e.svg}}},d=function(){function t(){var t=this._;if(e.svg.selectAll("#drop_shadow,.drop_shadow").remove(),t.options.showDropShadow){var r=this.$slc.defs.append("radialGradient").attr("id","drop_shadow").attr("cx","50%").attr("cy","50%");r.append("stop").attr("offset","20%").attr("stop-color","#000").attr("stop-opacity",".5"),r.append("stop").attr("offset","100%").attr("stop-color","#000").attr("stop-opacity","0"),o.dropShadow=e.svg.append("g").attr("class","drop_shadow").append("ellipse").attr("cx",t.center[0]).attr("class","noclicks").style("fill","url(#drop_shadow)"),n.call(this)}}function n(){var t=this._.proj.scale();o.dropShadow.attr("cy",t+this._.center[1]).attr("rx",.9*t).attr("ry",.25*t)}var e={svg:null,q:null},o={};return{name:"dropShadowSvg",onInit:function(){this._.options.showDropShadow=!0,e.svg=this._.svg},onCreate:function(){t.call(this)},onResize:function(){o.dropShadow&&this._.options.showDropShadow&&n.call(this)},selectAll:function(t){return t&&(e.q=t,e.svg=d3.selectAll(t)),e.svg}}},p=function(){function t(){n.call(this),e.call(this)}function n(){var t=this._;if(o.svg.selectAll("#shading,.shading").remove(),t.options.showGlobeShading){var n=this.$slc.defs.append("radialGradient").attr("id","shading").attr("cx","50%").attr("cy","40%");n.append("stop").attr("offset","50%").attr("stop-color","#9ab").attr("stop-opacity","0"),n.append("stop").attr("offset","100%").attr("stop-color","#3e6184").attr("stop-opacity","0.3"),r.globeShading=o.svg.append("g").attr("class","shading").append("circle").attr("cx",t.center[0]).attr("cy",t.center[1]).attr("r",t.proj.scale()).attr("class","noclicks").style("fill","url(#shading)")}}function e(){var t=this._;if(o.svg.selectAll("#hilight,.hilight").remove(),t.options.showGlobeHilight){var n=this.$slc.defs.append("radialGradient").attr("id","hilight").attr("cx","75%").attr("cy","25%");n.append("stop").attr("offset","5%").attr("stop-color","#ffd").attr("stop-opacity","0.6"),n.append("stop").attr("offset","100%").attr("stop-color","#ba9").attr("stop-opacity","0.2"),r.globeHilight=o.svg.append("g").attr("class","hilight").append("circle").attr("cx",t.center[0]).attr("cy",t.center[1]).attr("r",t.proj.scale()).attr("class","noclicks").style("fill","url(#hilight)")}}var o={svg:null,q:null},r={};return{name:"fauxGlobeSvg",onInit:function(){var t=this._.options;t.showGlobeShading=!0,t.showGlobeHilight=!0,o.svg=this._.svg},onCreate:function(){t.call(this)},onResize:function(){var t=this._,n=t.options,e=t.proj.scale();r.globeShading&&n.showGlobeShading&&r.globeShading.attr("r",e),r.globeHilight&&n.showGlobeHilight&&r.globeHilight.attr("r",e)},selectAll:function(t){return t&&(o.q=t,o.svg=d3.selectAll(t)),o.svg}}},f=function(t){function n(t){var n=this._.proj.rotate();n[0]+=e.degree*t,this._.rotate(n)}var e={lastTick:new Date,degree:t/1e3,sync:[]};return{name:"autorotatePlugin",onInit:function(){this._.options.spin=!0},onInterval:function(){var t=new Date;if(this._.options.spin&&!this._.drag){var o=t-e.lastTick;n.call(this,o),e.sync.forEach(function(t){return n.call(t,o)})}e.lastTick=t},speed:function(t){e.degree=t/1e3},start:function(){this._.options.spin=!0},stop:function(){this._.options.spin=!1},sync:function(t){e.sync=t}}},v=function(){var t=d3.select("body").append("div").attr("class","dotTooltip");return{name:"dotTooltipCanvas",onInit:function(){var n=this,e=function(e,o){o?(n.dotTooltipCanvas.onShow&&(o=n.dotTooltipCanvas.onShow.call(n,o,t)),n.dotTooltipCanvas.show(o.properties).style("display","block").style("opacity",1).style("left",e[0]+7+"px").style("top",e[1]-15+"px")):t.style("opacity",0).style("display","none")};this.dotsCanvas.addSelectDotEvent({dotTooltipCanvas:e})},show:function(n){var e=Object.keys(n).map(function(t){return t+": "+n[t]}).join("
");return t.html(e)}}},g=function(){function t(t){return e.style("left",t[0]+7+"px").style("top",t[1]-15+"px")}function n(){e.style("opacity",0).style("display","none")}var e=d3.select("body").append("div").attr("class","countryTooltip");return{name:"countryTooltipCanvas",onInit:function(){var e=this,o=function(){var o=e.hoverCanvas.data(),r=o.country,a=o.mouse;if(!e._.drag&&r&&e._.options.showCountryTooltip){var s=e.worldCanvas.countryName(r);!s||e.barTooltipSvg&&e.barTooltipSvg.visible()?n():t(a).style("display","block").style("opacity",1).text(s.name)}else n()};this.hoverCanvas.onCountry({countryTooltipCanvas:o}),this.versorMousePlugin&&this.versorMousePlugin.onDrag({countryTooltipCanvas:o}),this._.options.showCountryTooltip=!0},onRefresh:function(){this._.drag&&t(this.versorMousePlugin.mouse())}}},y=function(){function t(){var t=this;this.worldSvg.$countries().on("mouseover",function(o){if(t._.options.showCountryTooltip){e.show=!0;var r=t.worldSvg.countryName.call(t,o);n().style("display","block").style("opacity",1).text(r.name)}}).on("mouseout",function(){e.show=!1,o.style("opacity",0).style("display","none")}).on("mousemove",function(){t._.options.showCountryTooltip&&n()})}function n(t){return t||(t=[d3.event.pageX,d3.event.pageY]),o.style("left",t[0]+7+"px").style("top",t[1]-15+"px")}var e={show:!1},o=d3.select("body").append("div").attr("class","countryTooltip");return{name:"countryTooltipSvg",onInit:function(){this._.options.showCountryTooltip=!0},onCreate:function(){t.call(this)},onRefresh:function(){this._.drag&&e.show&&n(this.versorMousePlugin.mouse())}}};return n.plugins={versorMousePlugin:e,wheelZoomPlugin:o,threejsPlugin:r,canvasPlugin:a,hoverCanvas:s,clickCanvas:i,oceanSvg:l,configPlugin:c,graticuleCanvas:u,graticuleSvg:h,dropShadowSvg:d,fauxGlobeSvg:p,autorotatePlugin:f,dotTooltipCanvas:v,countryTooltipCanvas:g,countryTooltipSvg:y,barTooltipSvg:function(){function t(){var t=this;this.barSvg.$bar().on("mouseover",function(){if(t._.options.showBarTooltip){e.visible=!0,e.mouseXY=[d3.event.pageX+7,d3.event.pageY-15];var r=+this.dataset.index,a=t.barSvg.data().features[r];t.barTooltipSvg.onShow&&(a=t.barTooltipSvg.onShow.call(this,a,o)),t.barTooltipSvg.show(a).style("display","block").style("opacity",1),n()}}).on("mouseout",function(){e.visible=!1,o.style("opacity",0).style("display","none")}).on("mousemove",function(){t._.options.showBarTooltip&&(e.mouseXY=[d3.event.pageX+7,d3.event.pageY-15],n())})}function n(){o.style("left",e.mouseXY[0]+7+"px").style("top",e.mouseXY[1]-15+"px")}var e={mouseXY:[0,0],visible:!1},o=d3.select("body").append("div").attr("class","barTooltip");return{name:"barTooltipSvg",onInit:function(){this._.options.showBarTooltip=!0},onCreate:function(){t.call(this)},onResize:function(){t.call(this),o.style("opacity",0).style("display","none")},onRefresh:function(){n.call(this)},show:function(t){var n=t.properties,e=Object.keys(n).map(function(t){return t+": "+n[t]}).join("
");return o.html(e)},visible:function(){return e.visible}}},placesSvg:function(t){function n(){s.svg.selectAll(".points,.labels").remove(),s.places&&this._.options.showPlaces&&(o.call(this),r.call(this),e.call(this))}function e(){i.placePoints&&(i.placePoints.attr("d",this._.path),a.call(this))}function o(){i.placePoints=s.svg.append("g").attr("class","points").selectAll("path").data(s.places.features).enter().append("path").attr("class","point")}function r(){i.placeLabels=s.svg.append("g").attr("class","labels").selectAll("text").data(s.places.features).enter().append("text").attr("class","label").text(function(t){return t.properties.name})}function a(){var t=this,n=this._.proj.invert(this._.center);i.placeLabels.attr("text-anchor",function(n){var e=t._.proj(n.geometry.coordinates)[0];return e1.57?"none":"inline"})}var s={svg:null,q:null,places:null},i={};return{name:"placesSvg",urls:t&&[t],onReady:function(t,n){s.places=n},onInit:function(){this._.options.showPlaces=!0,s.svg=this._.svg},onCreate:function(){n.call(this)},onRefresh:function(){e.call(this)},selectAll:function(t){return t&&(s.q=t,s.svg=d3.selectAll(t)),s.svg},data:function(t){if(!t)return{places:s.places};var n=t.placesSvg.data();s.places=n.places}}},worldCanvas:function(t,n){function e(){var t=this._;i.world&&t.options.showLand&&((t.options.transparent||t.options.transparentLand)&&(t.proj.clipAngle(180),this.canvasPlugin.render(function(t,n){t.beginPath(),n(i.land),t.fillStyle=i.style.backLand||"rgba(119,119,119,0.2)",t.fill()},i.drawTo,i.options),t.proj.clipAngle(90)),t.options.showCountries?r.call(this):o.call(this),t.drag||(t.options.showLakes&&a.call(this),this.hoverCanvas&&t.options.showSelectedCountry&&this.canvasPlugin.render(function(t,n){t.beginPath(),n(this.hoverCanvas.data().country),t.fillStyle="rgba(117, 0, 0, 0.4)",t.fill()},i.drawTo,i.options)))}function o(){this.canvasPlugin.render(function(t,n){var e=i.landColor;t.beginPath(),n(i.land),t.fillStyle=i.style.land||"number"==typeof e?s[e]:e,t.fill()},i.drawTo,i.options)}function r(){this.canvasPlugin.render(function(t,n){var e=i.landColor;t.beginPath(),n(i.countries),t.fillStyle=i.style.land||"number"==typeof e?s[e]:e,t.fill(),t.lineWidth=.1,t.strokeStyle=i.style.countries||"rgb(239, 237, 234)",t.stroke()},i.drawTo,i.options)}function a(){this.canvasPlugin.render(function(t,n){t.beginPath(),n(i.lakes),t.fillStyle=i.style.lakes||"rgba(80, 87, 97, 0.4)",t.fill()},i.drawTo,i.options)}var s={0:"rgba(117, 87, 57, 0.6)",1:"rgba(138, 96, 56, 0.6)",2:"rgba(140,104, 63, 0.6)",3:"rgba(149,114, 74, 0.6)",4:"rgba(153,126, 87, 0.6)",5:"rgba(155,141,115, 0.6)"},i={world:null,countryNames:null,style:{},drawTo:null,options:{},landColor:0},l=null;return t&&(l=[t],n&&l.push(n)),{name:"worldCanvas",urls:l,onReady:function(t,n,e){this.worldCanvas.data({world:n,countryNames:e}),Object.defineProperty(this._.options,"landColor",{get:function(){return i.landColor},set:function(t){i.landColor=t}})},onInit:function(){var t=this._.options;t.showLand=!0,t.showLakes=!0,t.showCountries=!0,t.transparentLand=!1,t.showSelectedCountry=!1,t.landColor=0},onCreate:function(){var t=this;if(e.call(this),this.hoverCanvas){var n=function(){t._.options.spin||t._.refresh()};this.hoverCanvas.onCountry({worldCanvas:n})}},onRefresh:function(){e.call(this)},countries:function(){return i.countries.features},data:function(t){return t&&(i.world=t.world,i.countryNames=t.countryNames,i.land=topojson.feature(i.world,i.world.objects.land),i.lakes=topojson.feature(i.world,i.world.objects.ne_110m_lakes),i.countries=topojson.feature(i.world,i.world.objects.countries)),{world:i.world,countryNames:i.countryNames}},countryName:function(t){var n="";return i.countryNames&&(n=i.countryNames.find(function(n){return n.id==t.id})),n},style:function(t){return t&&(i.style=t),i.style},drawTo:function(t){i.drawTo=t},options:function(t){i.options=t}}},worldSvg:function(t,n){function e(){var t=this._;l.svg.selectAll(".landbg,.land,.lakes,.countries").remove(),t.options.showLand&&(l.world&&((t.options.transparent||t.options.transparentLand)&&l.svgAddWorldBg.call(this),!t.drag&&t.options.showCountries?l.svgAddCountries.call(this):l.svgAddWorld.call(this),!t.drag&&t.options.showLakes&&l.svgAddLakes.call(this)),o.call(this))}function o(){var t=this._;l.world&&t.options.showLand&&((t.options.transparent||t.options.transparentLand)&&(t.proj.clipAngle(180),c.worldBg.attr("d",t.path),t.proj.clipAngle(90)),t.options.showCountries?c.countries.attr("d",t.path):c.world.attr("d",t.path),t.options.showLakes&&c.lakes.attr("d",t.path))}function r(){c.worldBg=l.svg.append("g").attr("class","landbg").append("path").datum(l.land).attr("fill","rgba(119,119,119,0.2)")}function a(){c.world=l.svg.append("g").attr("class","land").append("path").datum(l.land)}function s(){c.countries=l.svg.append("g").attr("class","countries").selectAll("path").data(l.countries.features).enter().append("path").attr("id",function(t){return"x"+t.id})}function i(){c.lakes=l.svg.append("g").attr("class","lakes").append("path").datum(l.lakes)}var l={svg:null,q:null,world:null,countryNames:null},c={},u=null;return t&&(u=[t],n&&u.push(n)),{name:"worldSvg",urls:u,onReady:function(t,n,e){this.worldSvg.data({world:n,countryNames:e})},onInit:function(){var t=this._,n=t.options;n.showLand=!0,n.showLakes=!0,n.showCountries=!0,n.transparentLand=!1,l.svgAddCountries=s,l.svgAddWorldBg=r,l.svgAddLakes=i,l.svgAddWorld=a,l.svg=t.svg},onCreate:function(){e.call(this)},onRefresh:function(){o.call(this)},countries:function(){return l.countries.features},data:function(t){return t&&(l.world=t.world,l.countryNames=t.countryNames,l.land=topojson.feature(l.world,l.world.objects.land),l.lakes=topojson.feature(l.world,l.world.objects.ne_110m_lakes),l.countries=topojson.feature(l.world,l.world.objects.countries)),{world:l.world,countryNames:l.countryNames}},countryName:function(t){var n="";return l.countryNames&&(n=l.countryNames.find(function(n){return n.id==t.id})),n},selectAll:function(t){return t&&(l.q=t,l.svg=d3.selectAll(t)),l.svg},$countries:function(){return c.countries}}},worldThreejs:function(){function t(){if(!e.sphereObject){var t=this,o=new THREE.Group;(new THREE.TextureLoader).load("./d/world.jpg",function(r){var a=new THREE.SphereGeometry(200,20,20),s=new THREE.MeshBasicMaterial({map:r,overdraw:.5});e.sphereObject=new THREE.Mesh(a,s),o.add(e.sphereObject),n.call(t)}),t.threejsPlugin.addObject(o)}}function n(){var t=this._.proj.rotate();t[0]-=90;var n=this._.versor(t),o=new THREE.Quaternion(-n[2],n[1],n[3],n[0]);e.sphereObject.setRotationFromQuaternion(o)}var e={sphereObject:null};return{name:"worldThreejs",onInit:function(){t.call(this)},onRefresh:function(){e.sphereObject&&n.call(this)}}},centerCanvas:function(){function t(t,n){n=n.replace("x","");for(var e=0,o=t.length;e1.57?"none":o.fillStyle||"rgba(100,0,0,.4)"}),a.dots.attr("d",t.path),t.proj.clipAngle(90)):(a.dots.style("display",function(o,r){return n=o.coordinates[0][r],e=d3.geoDistance(n,t.proj.invert(t.center)),e>1.57?"none":"inline"}),a.dots.style("fill",o.fillStyle||"rgba(100,0,0,.4)"),a.dots.attr("d",t.path))}}function o(){var t=d3.geoCircle(),n=r.dataDots.geometry||{},e=n.radius||.5;r.circles=r.dataDots.features.map(function(n){var o=n.geometry.coordinates,r=n.geometry.radius||e;return{coordinates:o,circle:t.center(o).radius(r)()}})}var r={dataDots:null,radiusPath:null},a={};return{name:"dotsSvg",urls:t&&[t],onReady:function(t,n){this.dotsSvg.data(n)},onInit:function(){this._.options.showDots=!0,r.svg=this._.svg},onCreate:function(){n.call(this)},onRefresh:function(){e.call(this)},radiusPath:function(t){r.radiusPath=t},data:function(t){var n=this;if(!t)return r.dataDots;if(r.radiusPath){var a=r.radiusPath.split("."),s=t.features.map(function(t){var n=t;return a.forEach(function(t){return n=n[t]}),n}).sort(),i=d3.scaleLinear().domain([s[0],s.pop()]).range([.5,2]);t.features.forEach(function(t){var n=t;a.forEach(function(t){return n=n[t]}),t.geometry.radius=i(n)})}r.dataDots=t,o(),setTimeout(function(){return e.call(n)},1)},selectAll:function(t){return t&&(r.q=t,r.svg=d3.selectAll(t)),r.svg}}},dotsCanvas:function(t){function n(){var t=this._;if(!t.drag&&r.dataDots&&this._.options.showDots){var n=this._.proj,e=r.dataDots.geometry||{},o=n.invert(this._.center),a=[],s=[];r.circles.forEach(function(t){d3.geoDistance(t.coordinates,o)>1.57?a.push(t.circle):s.push(t.circle)}),(t.options.transparent||t.options.transparentDots)&&(t.proj.clipAngle(180),this.canvasPlugin.render(function(t,n){t.beginPath(),n({type:"GeometryCollection",geometries:a}),t.lineWidth=.2,t.strokeStyle="rgba(119,119,119,.4)",t.stroke(),t.closePath()},r.drawTo),t.proj.clipAngle(90)),this.canvasPlugin.render(function(t,n){t.beginPath(),n({type:"GeometryCollection",geometries:s}),t.lineWidth=e.lineWidth||.2,t.fillStyle=e.fillStyle||"rgba(100,0,0,.4)",t.strokeStyle=e.strokeStyle||"rgba(100,0,0,.6)",t.fill(),t.stroke(),t.closePath()},r.drawTo)}}function e(){var t=d3.geoCircle(),n=r.dataDots.geometry||{},e=n.radius||.5;r.circles=r.dataDots.features.map(function(n){var o=n.geometry.coordinates,r=n.properties,a=n.geometry.radius||e;return{properties:r,coordinates:o,circle:t.center(o).radius(a)()}})}function o(){var t=this,n=function(n,e){var o=null;return r.circles.forEach(function(t){n&&!o&&d3.geoDistance(t.coordinates,e)<=.02&&(o=t)}),r.onDotKeys.forEach(function(e){r.onDot[e].call(t,n,o)}),o};this.hoverCanvas.onCircle({dotsCanvas:n})}var r={dataDots:null,circles:[],radiusPath:null,onDot:{},onDotKeys:[]};return{name:"dotsCanvas",urls:t&&[t],onReady:function(t,n){this.dotsCanvas.data(n)},onInit:function(){o.call(this),this._.options.transparentDots=!1,this._.options.showDots=!0},onCreate:function(){n.call(this)},onRefresh:function(){n.call(this)},radiusPath:function(t){r.radiusPath=t},data:function(t){var o=this;if(!t)return r.dataDots;if(r.radiusPath){var a=r.radiusPath.split("."),s=t.features.map(function(t){var n=t;return a.forEach(function(t){return n=n[t]}),n}).sort(),i=d3.scaleLinear().domain([s[0],s.pop()]).range([.5,2]);t.features.forEach(function(t){var n=t;a.forEach(function(t){return n=n[t]}),t.geometry.radius=i(n)})}r.dataDots=t,e(),setTimeout(function(){return n.call(o)},1)},drawTo:function(t){r.drawTo=t},addSelectDotEvent:function(t){Object.assign(r.onDot,t),r.onDotKeys=Object.keys(r.onDot)}}},pingsCanvas:function(){var t={dataPings:null,pings:[]};return{name:"pingsCanvas",onInit:function(){this._.options.showPings=!0},onInterval:function(){if(!this._.drag&&this._.options.showPings){var n=void 0,e=this._.proj;if(t.pings.length<=7){n=this._.proj.invert(this._.center);var o=t.dataPings.features.filter(function(t){return d3.geoDistance(t.geometry.coordinates,n)<=1.57}),r=o[Math.floor(Math.random()*(o.length-1))];t.pings.push({r:2.5,l:r.geometry.coordinates})}var a=t.pings[0];d3.geoDistance(a.l,this._.proj.invert(this._.center))>1.57?t.pings.shift():(this._.options.spin||this._.refresh(/anvas/),this.canvasPlugin.render(function(n){if(n.beginPath(),n.fillStyle="#F80",n.arc(e(a.l)[0],e(a.l)[1],a.r,0,2*Math.PI),n.fill(),n.closePath(),a.r=a.r+.2,a.r>5)t.pings.shift();else if(t.pings.length>1){var o=t.pings.shift();t.pings.push(o)}},t.drawTo))}},data:function(n){t.dataPings=n},drawTo:function(n){t.drawTo=n}}},pingsSvg:function(){function t(){if(o.svg.selectAll(".pings").remove(),o.dataPings&&this._.options.showPings){var t=o.svg.append("g").attr("class","pings");r.ping2=t.selectAll(".ping-2").data(o.dataPings.features).enter().append("circle").attr("class","ping-2").attr("id",function(t,n){return"ping-"+n}),r.pings=t.selectAll(".ping-2"),e.call(this),n.call(this)}}function n(){var t=r.ping2.nodes().filter(function(t){return"inline"==t.style.display});t.length>0&&d3.select("#"+t[Math.floor(Math.random()*(t.length-1))].id).attr("r",2).attr("stroke","#F00").attr("stroke-opacity",1).attr("stroke-width","10px").transition().duration(1e3).attr("r",30).attr("fill","none").attr("stroke-width","0.1px")}function e(){if(null==this._.drag)r.pings.style("display","none");else if(!this._.drag&&r.pings&&this._.options.showPings){var t=this._.proj,n=this._.proj.invert(this._.center);r.pings.attr("cx",function(n){return t(n.geometry.coordinates)[0]}).attr("cy",function(n){return t(n.geometry.coordinates)[1]}).style("display",function(t){return d3.geoDistance(t.geometry.coordinates,n)>1.57?"none":"inline"})}}var o={svg:null,dataPings:null},r={};return{name:"pingsSvg",onInit:function(){var t=this;this._.options.showPings=!0,setInterval(function(){return n.call(t)},3e3),o.svg=this._.svg},onCreate:function(){t.call(this)},onRefresh:function(){e.call(this)},data:function(t){o.dataPings=t},selectAll:function(t){return t&&(o.q=t,o.svg=d3.selectAll(t)),o.svg}}},debugThreejs:function(){function t(){if(!e.sphereObject){var t=this._.proj.scale(),o=new THREE.SphereGeometry(t,100,100),r=new THREE.MeshNormalMaterial({wireframe:!1}),a=new THREE.Mesh(o,r),s=new THREE.SphereGeometry(30,10,10),i=new THREE.SphereGeometry(30,10,10),l=new THREE.SphereGeometry(30,10,10);s.translate(0,0,t),i.translate(t,0,0),l.translate(0,-t,0);var c=new THREE.MeshBasicMaterial({color:"blue"}),u=new THREE.MeshBasicMaterial({color:"red"}),h=new THREE.MeshBasicMaterial({color:"green"}),d=new THREE.Mesh(s,c),p=new THREE.Mesh(i,u),f=new THREE.Mesh(l,h);e.sphereObject=new THREE.Object3D,e.sphereObject.add(a,d,p,f),n.call(this),this.threejsPlugin.addObject(e.sphereObject)}}function n(){var t=this._.proj.rotate();t[0]-=90;var n=this._.versor(t),o=new THREE.Quaternion(-n[2],n[1],n[3],n[0]);e.sphereObject.setRotationFromQuaternion(o)}var e={sphereObject:null};return{name:"debugThreejs",onInit:function(){this._.options.showDebugSpahre=!0,t.call(this)},onRefresh:function(){e.sphereObject&&n.call(this)}}},commonPlugins:function(t,n){function e(){var e=this,o=this.register,r=earthjs.plugins;o(r.configPlugin()),o(r.wheelZoomPlugin()),o(r.versorMousePlugin()),o(r.autorotatePlugin(10)),o(r.dropShadowSvg()),o(r.oceanSvg()),o(r.canvasPlugin()),o(r.graticuleCanvas()),o(r.worldCanvas(t,n)),this._.options.oceanColor=2,this._.options.transparent=!0,this.canvasPlugin.selectAll(".canvas"),this.graticuleCanvas.drawTo([1]),this.worldCanvas.drawTo([0]),a.options=this.configPlugin.set(),a.buttonClick=function(t){var n=t.split(":"),o=n[2],r={},a=e.configPlugin.set();a[o]=!a[o],r[o]=a[o],"transparent"==o?((a.transparentGraticule||a.transparentLand)&&(r.transparent=!1),r.transparentGraticule=!1,r.transparentLand=!1):"showCountries"==o||"showLakes"==o?r.showLand=!0:"transparentGraticule"!=o&&"transparentLand"!=o||(a.transparent&&(r.transparentGraticule=!1,r.transparentLand=!1),r.transparent=!1),e.configPlugin.set(r)}}function o(t,n,e,o,r,a,s){t.append("br"),t.append("input").attr("id",n).attr("type","range").attr("min",e).attr("max",o).attr("step",r).attr("value",a).on("input",s)}function r(){var t=this,n=this,e=d3.select(".set-options"),r=d3.select(".set-options2");if(e.selectAll("button, input, br").remove(),r.selectAll("button, input, br").remove(),this._.options.showControll){e.selectAll("button").data(a.checker).enter().append("button").text(function(t){return t[1]}).on("click",function(n){return a.buttonClick.call(t,n.join(":"))}),o(r,"pan",0,400,1,a.pan,function(){a.pan=+this.value;for(var t=1;t