From 723eaabb761e5f407592655cbb724745296b6896 Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Wed, 14 Mar 2012 20:18:33 +0100 Subject: [PATCH] website update --- js/kartograph-chroma.min.js | 4 +- js/kartograph.js | 139 +++++++++++++++++++++++++++--------- js/kartograph.min.js | 4 +- 3 files changed, 108 insertions(+), 39 deletions(-) diff --git a/js/kartograph-chroma.min.js b/js/kartograph-chroma.min.js index 8fb70e3..c881def 100644 --- a/js/kartograph-chroma.min.js +++ b/js/kartograph-chroma.min.js @@ -17,8 +17,8 @@ * along with this program. If not, see . * * - */(function(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL,bM,bN,bO,bP=function(a,b){return function(){return a.apply(b,arguments)}},bQ=Object.prototype.hasOwnProperty,bR=function(a,b){function d(){this.constructor=a}for(var c in b)bQ.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a};bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=bt.$K=(bC=bt.kartograph)!=null?bC:bt.kartograph={},bm.version="0.1.1",bz=!1,bv=function(a){if(bz)return console.warn("kartograph ("+bm.version+"): ",a)},bn=function(a){if(bz)return console.log("kartograph ("+bm.version+"): ",a)},(bH=(bA=String.prototype).trim)==null&&(bA.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this==null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;es.left&&a.tops.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bm.BBox(d,e,c,b)},bm.BBox=c,(bI=bm.geom)==null&&(bm.geom={}),(bJ=(bB=bm.geom).clipping)==null&&(bB.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,ba.right&&(d|=e.RIGHT),ca.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bm.geom.clipping.CohenSutherland=k,z=function(){function a(a,b,d){var e,f;f=this,f.container=e=$(a),b==null&&(b=e.width()),d==null&&(d=e.height()),d===0&&(d=b*.5),f.viewport=new c(0,0,b,d),f.paper=f.createSVGLayer(),f.markers=[],f.pathById={},f.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bm.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('
'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bm.__mapCache[a]!=null?d._mapLoaded(bm.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bv(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((i=bm.__mapCache)==null&&(bm.__mapCache={}),bm.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){bv("something went horribly wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bm.View.fromXML(b),f=(j=e.opts.padding)!=null?j:0,d=(k=e.opts.halign)!=null?k:"center",g=(l=e.opts.valign)!=null?l:"center",e.viewBC=new bm.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bm.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(q=h.layerIds)==null&&(h.layerIds=[]),(r=h.layers)==null&&(h.layers={}),by(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new I(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(n=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(o=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,p=f.split(",");for(j=0,l=p.length;j1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],q=e._regardStyles;for(k=0,m=q.length;k=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,by(d)==="string"?k=d:by(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=(bL=bt.kartograph)!=null?bL:bt.kartograph={},bm.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=bp(a),j=a.split("`b%");for(h=0,i=j.length;h=g;0<=g?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;m=this;if(m._centroid!=null)return m._centroid;b=m.area(),d=e=0;for(h=0,w=m.contours.length-1;0<=w?h<=w:h>=w;0<=w?h++:h--){c=m.contours[h],a=m.areas[h],r=s=0,k=c.length,t=[],p=0;for(i=0,u=k-1;0<=u?i<=u:i>=u;0<=u?i++:i--)n=c[i],o=c[(i+1)%k],f=o[0]-n[0],g=o[1]-n[1],l=Math.sqrt(f*f+g*g),t.push(l),p+=l;for(i=0,v=k-1;0<=v?i<=v:i>=v;0<=v?i++:i--)n=c[i],o=c[(i+1)%k],q=t[i]/p,r+=q*n[0],s+=q*n[1];j=a/b,d+=r*j,e+=s*j}m._centroid=[d,e];return m._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(ac[2]||bc[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(bw(d,[a,b]))return!0}return!1};return a}(),bm.geom.Path=P,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bR(a,P),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bm.geom.Circle=j,P.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),v=h.split(l);for(p=0,r=v.length;p=t;0<=t?d++:d--){q=l.points[d],g=q[0],h=q[1],r=l.points[d+1],i=r[0],j=r[1];try{s=c(b,g,h,i,j),m=s[0],o=s[1],n=s[2],p=s[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],h=b.points;for(e=0,f=h.length;e=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=(bO=bt.kartograph)!=null?bO:bt.kartograph={},bx=bm.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},R=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.parameters=[],a.title="Projection",a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bm.BBox;for(e=0,f=d.length;e=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bm.proj[d](e),f.name=d;return f},bm.Proj=R,n=function(){function a(b){var c,d,e;b==null&&(b={}),c=this,c.flip=Number((d=b.flip)!=null?d:0),c.flip===1&&(b.lon0=(e=-b.lon0)!=null?e:0),a.__super__.constructor.call(this,b)}bR(a,R),a.parameters=["lon0","flip"],a.title="Cylindrical Projection",a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,n),a.title="Equirectangular Projection",a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bx.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bR(a,n),a.parameters=["lon0","lat1","flip"],a.title="Cylindrical Equal Area",a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bx.cea=h,t=function(){function a(b){b.lat1=45,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Gall-Peters Projection",a.parameters=["lon0","flip"];return a}(),bx.gallpeters=t,w=function(){function a(b){b.lat1=37.7,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Hobo-Dyer Projection",a.parameters=["lon0","flip"];return a}(),bx.hobodyer=w,e=function(){function a(b){b.lat1=30,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Behrmann Projection",a.parameters=["lon0","flip"];return a}(),bx.behrmann=e,d=function(){function a(b){b.lat1=50,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Balthasart Projection",a.parameters=["lon0","flip"];return a}(),bx.balthasart=d,K=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bR(a,n),a.title="Mercator Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bx.mercator=K,T=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,n),a.title="Pseudo-Cylindrical Projection";return a}(),M=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bR(a,T),a.title="Natural Earth Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bx.naturalearth=M,Z=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bR(a,T),a.title="Robinson Projection",a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bx.robinson=Z,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bR(a,T),a.title="Eckert IV Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bx.mollweide=L,bi=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bR(a,L),a.title="Wagner IV Projection";return a}(),bx.wagner4=bi,bj=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bR(a,L),a.title="Wagner V Projection";return a}(),bx.wagner5=bj,H=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bR(c,T),b=-89,a=89,c.parameters=["lon0","lat0","flip"],c.title="Loximuthal Projection (equidistant)",c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bx.loximuthal=H,i=function(){function f(){f.__super__.constructor.apply(this,arguments)}var a,b,c,d,e;bR(f,T),f.title="Canters Modified Sinusoidal I",f.parameters=["lon0"],a=1.1966,b=-0.129,c=3*b,d=-0.0076,e=5*d,f.prototype.project=function(f,g){var h,i,j,k,l,m;h=this,m=h.ll(f,g),f=m[0],g=m[1],f=h.rad(h.clon(f)),g=h.rad(g),k=g*g,l=k*k,i=1e3*f*Math.cos(g)/(a+c*k+e*l),j=1e3*g*(a+b*k+d*l);return[i,j*-1]};return f}(),bx.canters1=i,v=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.lat1=41.737,c.p1=new L,c.p0=new bb}bR(a,T),a.title="Goode Homolosine Projection",a.parameters=["lon0"],a.prototype.project=function(a,b){var c,d;c=this,d=c.ll(a,b),a=d[0],b=d[1],a=c.clon(a);return Math.abs(b)>c.lat1?c.p1.project(a,b):c.p0.project(a,b)};return a}(),bx.goodehomolosine=v,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bR(a,R),a.parameters=["lon0","lat0"],a.title="Azimuthal Projection",a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bm.BBox(0,0,a*2,a*2)};return a}(),N=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Orthographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bx.ortho=N,A=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bR(a,b),a.title="Lambert Azimuthal Equal-Area Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bx.laea=A,bd=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Stereographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bx.stereo=bd,_=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bR(a,b),a.parameters=["lon0","lat0","tilt","dist","up"],a.title="Satellite Projection",a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a,b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bx.satellite=_,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Equidistant Azimuthal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;i=this.rad(b),g=this.rad(a),h=Math,j=h.sin,d=h.cos,e=j(this.phi0)*j(i)+d(this.phi0)*d -(i)*d(g-this.lam0),c=h.acos(e),f=.325*c/j(c),l=this.r*f*d(i)*j(g-this.lam0),n=-this.r*f*(d(this.phi0)*j(i)-j(this.phi0)*d(i)*d(g-this.lam0)),k=this.r+l,m=this.r+n;return[k,m]},a.prototype._visible=function(a,b){return!0};return a}(),bx.equi=p,a=function(){function a(b){var c;c=this,b.lat0=0,a.__super__.constructor.call(this,b),c.lam0=0}bR(a,p),a.title="Aitoff Projection",a.parameters=["lon0"],a.prototype.project=function(b,c){var d,e,f,g;d=this,b=d.clon(b),g=a.__super__.project.call(this,b*.5,c),e=g[0],f=g[1];return[e,f*.5]},a.prototype._visible=function(a,b){return!0},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d*.51,d*.5+a.sin(this.rad(c))*d*.258]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bm.BBox(a*.5,a*.25,a,a*.5)},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),bx.aitoff=a,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bR(a,R),a.title="Conic Projection",a.parameters=["lon0","lat0","lat1"],a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),B=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bn=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bn(f/e(k.phi2))/bn(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bR(a,l),a.title="Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bn=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),S=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,l);return a}(),bh=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k0?(by(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?by(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},bm.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;r=this,q=(J=a.layer)!=null?J:r.layerIds[r.layerIds.length-1];if(!r.layers.hasOwnProperty(q))bv('dotgrid error: layer "'+q+'" not found');else{p=r.layers[q],c=a.data,d=a.value,e=a.key,t={};if(e!=null&&by(c)==="array")for(B=0,F=c.length;B0){if(h.grid.length===0)for(z=0,O=r.viewport.width;0<=O?z<=O:z>=O;z+=n)for(A=0,P=r.viewport.height;0<=P?A<=P:A>=P;A+=n){m={x:z+(Math.random()-.5)*n*.2,y:A+(Math.random()-.5)*n*.2,pathid:!1},l=!1,Q=p.pathsById;for(o in Q){u=Q[o];for(D=0,H=u.length;D0&&Raphael.svg?(b=Raphael.animation({r:x*.5},k),m.shape.animate(b.delay(g))):m.shape.attr({r:x*.5}),by(i)==="function"?j=i(v):j=i,m.shape.attr(j))}}},bl=(bF=bm.filter)!=null?bF:bm.filter={},bl.__knownFilter={},bl.__patternFills=0,I.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a},bm.Kartograph.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bm.filter[b]!=null)e=(new bm.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},I.prototype.applyFilter=function(a){var b;b=this;return $("."+b.id,b.paper.canvas).attr({filter:"url(#"+a+")"})},I.prototype.applyTexture=function(a,b,c,d){var e,f,g,h,i,j;d==null&&(d="#fff"),f=this,bl.__patternFills+=1,i=f.paths,j=[];for(g=0,h=i.length;g0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,bn("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 1",result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bl.glow=u,bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=bt.$K=(bG=bt.kartograph)!=null?bG:bt.kartograph={},bm.Kartograph.prototype.addGeoPath=function(a,b,c){var d,e,f;b==null&&(b=[]),c==null&&(c=""),d=this,f=d.getGeoPathStr(a,b),e=d.paper.path(f),c!==""&&e.node.setAttribute("class",c);return e},bm.Kartograph.prototype.getGeoPathStr=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=[]),e=this,type(b)==="string"&&(b=b.split("")),b.length===0&&b.push("M"),f="";for(d in a){g=a[d],c=(i=b[d])!=null?i:"L",h=e.lonlat2xy(g);if(isNaN(h[0])||isNaN(h[1]))continue;f+=c+h[0]+","+h[1]}return f},O=function(){function a(a){this.zoomOut=bP(this.zoomOut,this),this.zoomIn=bP(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('
');for(e=0,f=b.length;ef&&ah+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.mapcanvas.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]),a.title!=null&&b.attr("title",a.title);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class","title"],g.layers=[],bm.Bubble=g,y=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$(""),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),y.props=["icon","offset","class","title","iconsize"],y.layers=[],bm.Icon=y,be=function(){function a(b){var c,d,e,f,g;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:"",c.offset=(g=b.offset)!=null?g:[0,0]}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x+a.offset[0],y:a.y+a.offset[1]}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),be.props=["text","style","class","offset"],be.layers=[],bm.Label=be,x=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c,d;d=this,b=$("
"+d.text+"
"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('
'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),x.props=["text","style","class"],x.layers=[{id:"lbl",type:"html"}],bm.HtmlLabel=x,Q=function(){function b(c){var d,e,f,g,h,i,j,k,l,m;a=this,b.__super__.constructor.call(this,c),a.radius=(e=c.radius)!=null?e:4,a.styles=(f=c.styles)!=null?f:"",a.colors=(g=c.colors)!=null?g:["#3cc","#c3c","#33c","#cc3"],a.titles=(h=c.titles)!=null?h:["","","","",""],a.values=(i=c.values)!=null?i:[],a.border=(j=c.border)!=null?j:!1,a.borderWidth=(k=c.borderWidth)!=null?k:2,a["class"]=(l=c["class"])!=null?l:"piechart",(m=(d=Raphael.fn).pieChart)==null&&(d.pieChart=bk)}var a;bR(b,bf),a=null,b.prototype.overlaps=function(b){var c,d,e,f,g,h,i,j,k,l;k=[a.x,a.y,a.radius],g=k[0],i=k[1],e=k[2],l=[b.x,b.y,b.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},b.prototype.render=function(b){var c;a=this,a.border!=null&&(c=a.layers.mapcanvas.circle(a.x,a.y,a.radius+a.borderWidth).attr({stroke:"none",fill:a.border})),a.chart=a.layers.mapcanvas.pieChart(a.x,a.y,a.radius,a.values,a.titles,a.colors,"none"),a.chart.push(c);return a},b.prototype.update=function(b){var c;return},b.prototype.clear=function(){var b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c180),0,h,j,"z"]).attr(f)},h=-270,o=0,l=function(e){var j,k,l,m,p,q,r;r=d[e],j=360*r/o,q=h+j*.5,k=f[e],m=500,l=30,p=n(a,b,c,h,h+j,{fill:k,stroke:g,"stroke-width":1}),p.mouseover(function(){p.stop().animate({transform:"s1.1 1.1 "+a+" "+b},m,"elastic")}),p.mouseout(function(){p.stop().animate({transform:""},m,"elastic")}),h+=j,i.push(p)};for(q=0,r=d.length;qh+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b,c,d,e,f,g;d=this,e=d.width,c=d.height,f=d.x,g=d.y,b=d.layers.mapcanvas.rect(f-e*.5-2,g-c*.5-2,e+4,c+4).attr({stroke:"none",fill:"#fff"}),d.chart=d.layers.mapcanvas.drawStackedBarChart(d.x,d.y,d.width,d.height,d.values,d.titles,d.colors,"none"),d.chart.push(b);return d},a.prototype.update=function(){var a,b;a=this;return},a.prototype.clear=function(){var a,b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;cg&&h-g>180?e=h-(g+360):h180?e=h+360-g:e=h-g,f=g+b*e;else if(!isNaN(g)){f=g;if(l===1||l===0)n=o}else if(!isNaN(h)){f=h;if(k===1||k===0)n=p}else f=void 0;n==null&&(n=o+b*(p-o)),j=k+b*(l-k);return new a(f,n,j,d)}if(d==="rgb"){q=m.rgb,r=c.rgb;return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}if(d==="lab"){q=m.lab(),r=c.lab();return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}throw"color mode "+d+" is not supported"};return a}(),c.hex2rgb=function(a){var b,c,d,e;if(!a.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))if(g.colors!=null&&g.colors[a])a=g.colors[a];else throw"unknown color format: "+a;if(a.length===4||a.length===7)a=a.substr(1);a.length===3&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),e=parseInt(a,16),d=e>>16,c=e>>8&255,b=e&255;return[d,c,b]},c.rgb2hex=function(a,b,c){var d,e,f;a!==void 0&&a.length===3&&(f=a,a=f[0],b=f[1],c=f[2]),e=a<<16|b<<8|c,d="000000"+e.toString(16).toUpperCase();return"#"+d.substr(d.length-6)},c.hsv2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t;i(a)==="array"&&a.length===3&&(n=a,a=n[0],b=n[1],h=n[2]),c*=255;if(b===0&&isNaN(a))l=f=d=c;else{a===360&&(a=0),a>360&&(a-=360),a<0&&(a+=360),a/=60,g=Math.floor(a),e=a-g,j=c*(1-b),k=c*(1-b*e),m=c*(1-b*(1-e));switch(g){case 0:o=[c,m,j],l=o[0],f=o[1],d=o[2];break;case 1:p=[k,c,j],l=p[0],f=p[1],d=p[2];break;case 2:q=[j,c,m],l=q[0],f=q[1],d=q[2];break;case 3:r=[j,k,c],l=r[0],f=r[1],d=r[2];break;case 4:s=[m,j,c],l=s[0],f=s[1],d=s[2];break;case 5:t=[c,j,k],l=t[0],f=t[1],d=t[2]}}l=Math.round(l),f=Math.round(f),d=Math.round(d);return[l,f,d]},c.rgb2hsv=function(a,b,c){var d,e,f,g,h,i,j;a!==void 0&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),g=Math.min(a,b,c),f=Math.max(a,b,c),d=f-g,i=f/255,h=d/f,h===0?(e=void 0,h=0):(a===f&&(e=(b-c)/d),b===f&&(e=2+(c-a)/d),c===f&&(e=4+(a-b)/d),e*=60,e<0&&(e+=360));return[e,h,i]},c.hsl2rgb=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;a!==void 0&&a.length===3&&(l=a,a=l[0],b=l[1],c=l[2]);if(b===0)h=f=d=c*255;else{k=[0,0,0],e=[0,0,0],j=c<.5?c*(1+b):c+b-c*b,i=2*c-j,a/=360,k[0]=a+1/3,k[1]=a,k[2]=a-1/3;for(g=0;g<=2;g++)k[g]<0&&(k[g]+=1),k[g]>1&&(k[g]-=1),6*k[g]<1?e[g]=i+(j-i)*6*k[g]:2*k[g]<1?e[g]=j:3*k[g]<2?e[g]=i+(j-i)*(2/3-k[g])*6:e[g]=i;m=[Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)],h=m[0],f=m[1],d=m[2]}return[h,f,d]},c.rgb2hsl=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=Math.max(a,b,c),e=(f+g)/2,f===g?(h=0,d=void 0):h=e<.5?(f-g)/(f+g):(f-g)/(2-f-g),a===f?d=(b-c)/(f-g):b===f?d=2+(c-a)/(f-g):c===f&&(d=4+(a-b)/(f-g)),d*=60,d<0&&(d+=360);return[d,h,e]},c.lab2xyz=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=function(a){return a>6/29?a*a*a:3*(6/29)*(6/29)*(a-4/29)},f=(a+.16)/1.16,e=[.96421,1,.82519],h=e[1]*d(f),g=e[0]*d(f+b/5),j=e[2]*d(f-c/2);return[g,h,j]},c.xyz2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n;i(a)==="array"&&a.length===3&&(m=a,a=m[0],b=m[1],c=m[2]),l=3.2406*a-1.5372*b-.4986*c,j=-0.9689*a+1.8758*b+.0415*c,e=.0557*a-.204*b+1.057*c,f=Math.min(l,j,e)<-0.001||Math.max(l,j,e)>1.001,f&&(l=l<0?0:l>1?1:l,j=j<0?0:j>1?1:j,e=e<0?0:e>1?1:e),f&&(n=[void 0,void 0,void 0],l=n[0],j=n[1],e=n[2]),g=function(a){var b;b=.055;return a<=.0031308?12.92*a:(1+b)*Math.pow(a,1/2.4)-b},k=Math.round(255*g(l)),h=Math.round(255*g(j)),d=Math.round(255*g(e));return[k,h,d]},c.lab2rgb=function(a,b,d){var e,f,g,h,i,j;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],d=i[2]),j=c.lab2xyz(a,b,d),e=j[0],f=j[1],g=j[2];return c.xyz2rgb(e,f,g)},c.csl2lab=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),a/=360,e=6.283185307179586,d=c*.61+.09,g=e/6-a*e,j=(c*.311+.125)*b,f=Math.sin(g)*j,h=Math.cos(g)*j;return[d,f,h]},c.csl2rgb=function(a,b,d){var e,f,g,h;h=c.csl2lab(a,b,d),e=h[0],f=h[1],g=h[2];return c.lab2rgb(e,f,g)},c.rgb2xyz=function(a,b,c){var d,e,f,g,h,i,j,k;a!==void 0&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=function(a){var b;b=.055;return a<=.04045?a/12.92:Math.pow((a+b)/(1+b),2.4)},g=e(a/255),f=e(b/255),d=e(c/255),h=.4124*g+.3576*f+.1805*d,i=.2126*g+.7152*f+.0722*d,j=.0193*g+.1192*f+.9505*d;return[h,i,j]},c.xyz2lab=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),g=[.96421,1,.82519],f=function(a){return a>Math.pow(6/29,3)?Math.pow(a,1/3):7.787037037037035*a+4/29},h=1.16*f(b/g[1])-.16,d=5*(f(a/g[0])-f(b/g[1])),e=2*(f(b/g[1])-f(c/g[2]));return[h,d,e]},c.rgb2lab=function(a,b,d){var e,f,g,h,i;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),i=c.rgb2xyz(a,b,d),e=i[0],f=i[1],g=i[2];return c.xyz2lab(e,f,g)},c.lab2csl=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=a,a=(a-.09)/.61,h=Math.sqrt(b*b+c*c),j=h/(a*.311+.125),e=6.283185307179586,f=Math.atan2(b,c),g=(e/6-f)/e,g*=360,g<0&&(g+=360);return[g,j,a]},c.rgb2csl=function(a,b,d){var e,f,g,h;i(a)==="array"&&a.length===3&&(g=a,a=g[0],b=g[1],d=g[2]),h=c.rgb2lab(a,b,d),f=h[0],e=h[1],d=h[2];return c.lab2csl(f,e,d)},c.rgb2hsi=function(a,b,c){var d,e,f,g,h,j;i(a)==="array"&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),d=Math.PI*2,a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=(a+b+c)/3,h=1-g/f,h===0?e=0:(e=(a-b+(a-c))/2,e/=Math.sqrt((a-b)*(a-b)+(a-c)*(b-c)),e=Math.acos(e),c>b&&(e=d-e),e/=d);return[e*360,h,f]},c.hsi2rgb=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=Math.PI*2,d=Math.PI/3,g=Math.cos,a<0&&(a+=360),a>360&&(a-=360),a/=360,a<1/3?(f=(1-b)/3,j=(1+b*g(e*a)/g(d-e*a))/3,h=1-(f+j)):a<2/3?(a-=1/3,j=(1-b)/3,h=(1+b*g(e*a)/g(d-e*a))/3,f=1-(j+h)):(a-=2/3,h=(1-b)/3,f=(1+b*g(e*a)/g(d-e*a))/3,j=1-(h+f)),j=c*j*3,h=c*h*3,f=c*f*3;return[j*255,h*255,f*255]},g.Color=c,g.hsl=function(a,b,d){return new c(a,b,d,"hsl")},g.hsv=function(a,b,d){return new c(a,b,d,"hsv")},g.rgb=function(a,b,d){return new c(a,b,d,"rgb")},g.hex=function(a){return new c(a)},g.lab=function(a,b,d){return new c(a,b,d,"lab")},g.csl=function(a,b,d){return new c(a,b,d,"csl")},g.hsi=function(a,b,d){return new c(a,b,d,"hsi")},g.interpolate=function(a,b,d,e){i(a)==="string"&&(a=new c(a)),i(b)==="string"&&(b=new c(b));return a.interpolate(d,b,e)},d=function(){function a(a){var b,d,e,f,g,h,j,k,l,m;f=this,f.colors=e=(g=a.colors)!=null?g:["#ddd","#222"];for(b=0,h=e.length-1;0<=h?b<=h:b>=h;0<=h?b++:b--)d=e[b],i(d)==="string"&&(e[b]=new c(d));if(a.positions!=null)f.pos=a.positions;else{f.pos=[];for(b=0,j=e.length-1;0<=j?b<=j:b>=j;0<=j?b++:b--)f.pos.push(b/(e.length-1))}f.mode=(k=a.mode)!=null?k:"hsv",f.nacol=(l=a.nacol)!=null?l:"#ccc",f.setClasses((m=a.limits)!=null?m:[0,1]),f}a.prototype.getColor=function(a){var b,c,d,e;e=this;if(isNaN(a))return e.nacol;e.classLimits.length>2?(b=e.getClass(a),c=b/(e.numClasses-1)):(c=d=(a-e.min)/(e.max-e.min),c=Math.min(1,Math.max(0,c)));return e.fColor(c)},a.prototype.fColor=function(a){var b,c,d,e,f,h;e=this,c=e.colors;for(d=0,h=e.pos.length-1;0<=h?d<=h:d>=h;0<=h?d++:d--){f=e.pos[d];if(a<=f){b=c[d];break}if(a>=f&&d===e.pos.length-1){b=c[d];break}if(a>f&&a2&&(f=c.length-1,b=g.getClass(a),a=c[b]+(c[b+1]-c[b])*.5,e=c[0],d=c[f-1],a=g.min+(a-e)/(d-e)*(g.max-g.min));return a},a.prototype.setClasses=function(a){var b;a==null&&(a=[]),b=this,b.classLimits=a,b.min=a[0],b.max=a[a.length-1];return a.length===2?b.numClasses=0:b.numClasses=a.length-1},a.prototype.getClass=function(a){var b,c,d,e;e=this,c=e.classLimits;if(c!=null){d=c.length-1,b=0;while(b=c[b])b++;return b-1}},a.prototype.validValue=function(a){return!isNaN(a)};return a}(),g.ColorScale=d,f=function(){function a(b,c,d){b==null&&(b="#fe0000"),c==null&&(c="#feeeee"),d==null&&(d="hsl"),a.__super__.constructor.call(this,[b,c],[0,1],d)}m(a,d);return a}(),g.Ramp=f,e=function(){function a(b,c,d,e,f){var g;b==null&&(b="#d73027"),c==null&&(c="#ffffbf"),d==null&&(d="#1E6189"),e==null&&(e="mean"),f==null&&(f="hsl"),g=this,g.mode=f,g.center=e,a.__super__.constructor.call(this,[b,c,d],[0,.5,1],f)}m(a,d),a.prototype.parseData=function(b,c){var d,e;a.__super__.parseData.call(this,b,c),e=this,d=e.center,d==="median"?d=e.median:d==="mean"&&(d=e.mean);return e.pos[1]=(d-e.min)/(e.max-e.min)};return a}(),g.Diverging=e,b=function(){function a(a){var b;b=this,b.colors=a}m(a,d),a.prototype.parseData=function(a,b){},a.prototype.getColor=function(a){var b;b=this;return b.colors.hasOwnProperty(a)?b.colors[a]:"#cccccc"},a.prototype.validValue=function(a){return this.colors.hasOwnProperty(a)};return a}(),g.Categories=b,a=function(){function a(a){var b;b=this,b.name=a,b.setClasses(7),b}m(a,d),a.prototype.getColor=function(a){var b,c;c=this,b=c.getClass(a);return c.name+" l"+c.numClasses+" c"+b};return a}(),g.CSSColors=a,(k=g.scales)==null&&(g.scales={}),g.scales.cool=function(){return new f(g.hsl(180,1,.9),g.hsl(250,.7,.4))},g.scales.hot=function(){return new d({colors:["#000000","#ff0000","#ffff00","#ffffff"],positions:[0,.25,.75,1],mode:"rgb"})},g.scales.BlWhOr=function(){return new e(g.hsl(30,1,.55),"#ffffff",new c(220,1,.55))},g.scales.GrWhPu=function(){return new e(g.hsl(120,.8,.4),"#ffffff",new c(280,.8,.4))},g.limits=function(a,b,c,d){var e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;b==null&&(b="equal"),c==null&&(c=7),d==null&&(d=null),r=Number.MAX_VALUE,q=Number.MAX_VALUE*-1,B=0,F=[];if(i(a)==="array")if(i(a[0])!=="object"&&i(a[0])!=="array")for(G=0,J=a.length;Gq&&(q=D),B+=D;else continue}F=F.sort(),p=[],b.substr(0,1)==="c"&&(p.push(r),p.push(q));if(b.substr(0,1)==="e"){p.push(r);for(l=1,T=c-1;1<=T?l<=T:l>=T;1<=T?l++:l--)p.push(r+l/c*(q-r));p.push(q)}else if(b.substr(0,1)==="q"){p.push(r);for(l=1,U=c-1;1<=U?l<=U:l>=U;1<=U?l++:l--)w=F.length*l/c,x=Math.floor(w),x===w?p.push(F[x]):(y=w-x,p.push(F[x]*y+F[x+1]*(1-y)));p.push(q)}else if(b.substr(0,1)==="k"){t=F.length,e=Array(t),j=Array(c),z=!0,u=0,g=null,g=[],g.push(r);for(l=1,V=c-1;1<=V?l<=V:l>=V;1<=V?l++:l--)g.push(r+l/c*(q-r));g.push(q);while(z){for(m=0,W=c-1;0<=W?m<=W:m>=W;0<=W?m++:m--)j[m]=0;for(l=0,X=t-1;0<=X?l<=X:l>=X;0<=X?l++:l--){E=F[l],s=Number.MAX_VALUE;for(m=0,Y=c-1;0<=Y?m<=Y:m>=Y;0<=Y?m++:m--)k=Math.abs(g[m]-E),k=Z;0<=Z?m++:m--)v[m]=null;for(l=0,M=t-1;0<=M?l<=M:l>=M;0<=M?l++:l--)h=e[l],v[h]===null?v[h]=F[l]:v[h]+=F[l];for(m=0,N=c-1;0<=N?m<=N:m>=N;0<=N?m++:m--)v[m]*=1/j[m];z=!1;for(m=0,O=c-1;0<=O?m<=O:m>=O;0<=O?m++:m--)if(v[m]!==g[l]){z=!0;break}g=v,u++,u>200&&(z=!1)}o={};for(m=0,P=c-1;0<=P?m<=P:m>=P;0<=P?m++:m--)o[m]=[];for(l=0,Q=t-1;0<=Q?l<=Q:l>=Q;0<=Q?l++:l--)h=e[l],o[h].push(F[l]);C=[];for(m=0,R=c-1;0<=R?m<=R:m>=R;0<=R?m++:m--)C.push(o[m][0]),C.push(o[m][o[m].length-1]);C=C.sort(function(a,b){return a-b}),p.push(C[0]);for(l=1,S=C.length-1;l<=S;l+=2)isNaN(C[l])||p.push(C[l])}return p},i=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;es.left&&a.tops.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bo.BBox(d,e,c,b)},bo.BBox=c,(bK=bo.geom)==null&&(bo.geom={}),(bL=(bD=bo.geom).clipping)==null&&(bD.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,ba.right&&(d|=e.RIGHT),ca.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bo.geom.clipping.CohenSutherland=k,A=function(){function a(a,b,d){var e,f;f=this,f.container=e=$(a),b==null&&(b=e.width()),d==null&&(d=e.height()),d===0&&(d=b*.5),f.viewport=new c(0,0,b,d),f.paper=f.createSVGLayer(),f.markers=[],f.pathById={},f.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bo.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('
'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bo.__mapCache[a]!=null?d._mapLoaded(bo.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bx(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((i=bo.__mapCache)==null&&(bo.__mapCache={}),bo.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){bx("something went horribly wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bo.View.fromXML(b),f=(j=e.opts.padding)!=null?j:0,d=(k=e.opts.halign)!=null?k:"center",g=(l=e.opts.valign)!=null?l:"center",e.viewBC=new bo.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bo.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(q=h.layerIds)==null&&(h.layerIds=[]),(r=h.layers)==null&&(h.layers={}),bA(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new J(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(n=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(o=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,p=f.split(",");for(j=0,l=p.length;j1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],q=e._regardStyles;for(k=0,m=q.length;k=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,bA(d)==="string"?k=d:bA(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=(bN=bv.kartograph)!=null?bN:bv.kartograph={},bo.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=br(a),j=a.split("`b%");for(h=0,i=j.length;h=g;0<=g?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;m=this;if(m._centroid!=null)return m._centroid;b=m.area(),d=e=0;for(h=0,w=m.contours.length-1;0<=w?h<=w:h>=w;0<=w?h++:h--){c=m.contours[h],a=m.areas[h],r=s=0,k=c.length,t=[],p=0;for(i=0,u=k-1;0<=u?i<=u:i>=u;0<=u?i++:i--)n=c[i],o=c[(i+1)%k],f=o[0]-n[0],g=o[1]-n[1],l=Math.sqrt(f*f+g*g),t.push(l),p+=l;for(i=0,v=k-1;0<=v?i<=v:i>=v;0<=v?i++:i--)n=c[i],o=c[(i+1)%k],q=t[i]/p,r+=q*n[0],s+=q*n[1];j=a/b,d+=r*j,e+=s*j}m._centroid=[d,e];return m._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(ac[2]||bc[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(by(d,[a,b]))return!0}return!1};return a}(),bo.geom.Path=Q,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bT(a,Q),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bo.geom.Circle=j,Q.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),v=h.split(l);for(p=0,r=v.length;p=t;0<=t?d++:d--){q=l.points[d],g=q[0],h=q[1],r=l.points[d+1],i=r[0],j=r[1];try{s=c(b,g,h,i,j),m=s[0],o=s[1],n=s[2],p=s[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],h=b.points;for(e=0,f=h.length;e=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=(bQ=bv.kartograph)!=null?bQ:bv.kartograph={},bz=bo.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},S=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.parameters=[],a.title="Projection",a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bo.BBox;for(e=0,f=d.length;e=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bo.proj[d](e),f.name=d;return f},bo.Proj=S,n=function(){function a(b){var c,d,e;b==null&&(b={}),c=this,c.flip=Number((d=b.flip)!=null?d:0),c.flip===1&&(b.lon0=(e=-b.lon0)!=null?e:0),a.__super__.constructor.call(this,b)}bT(a,S),a.parameters=["lon0","flip"],a.title="Cylindrical Projection",a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,n),a.title="Equirectangular Projection",a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bz.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bT(a,n),a.parameters=["lon0","lat1","flip"],a.title="Cylindrical Equal Area",a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bz.cea=h,t=function(){function a(b){b.lat1=45,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Gall-Peters Projection",a.parameters=["lon0","flip"];return a}(),bz.gallpeters=t,x=function(){function a(b){b.lat1=37.7,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Hobo-Dyer Projection",a.parameters=["lon0","flip"];return a}(),bz.hobodyer=x,e=function(){function a(b){b.lat1=30,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Behrmann Projection",a.parameters=["lon0","flip"];return a}(),bz.behrmann=e,d=function(){function a(b){b.lat1=50,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Balthasart Projection",a.parameters=["lon0","flip"];return a}(),bz.balthasart=d,L=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bT(a,n),a.title="Mercator Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bz.mercator=L,U=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,n),a.title="Pseudo-Cylindrical Projection";return a}(),N=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bT(a,U),a.title="Natural Earth Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bz.naturalearth=N,_=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bT(a,U),a.title="Robinson Projection",a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bz.robinson=_,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bT(a,U),a.title="Eckert IV Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bz.mollweide=M,bj=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bT(a,M),a.title="Wagner IV Projection";return a}(),bz.wagner4=bj,bk=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bT(a,M),a.title="Wagner V Projection";return a}(),bz.wagner5=bk,I=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bT(c,U),b=-89,a=89,c.parameters=["lon0","lat0","flip"],c.title="Loximuthal Projection (equidistant)",c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bz.loximuthal=I,i=function(){function f(){f.__super__.constructor.apply(this,arguments)}var a,b,c,d,e;bT(f,U),f.title="Canters Modified Sinusoidal I",f.parameters=["lon0"],a=1.1966,b=-0.129,c=3*b,d=-0.0076,e=5*d,f.prototype.project=function(f,g){var h,i,j,k,l,m;h=this,m=h.ll(f,g),f=m[0],g=m[1],f=h.rad(h.clon(f)),g=h.rad(g),k=g*g,l=k*k,i=1e3*f*Math.cos(g)/(a+c*k+e*l),j=1e3*g*(a+b*k+d*l);return[i,j*-1]};return f}(),bz.canters1=i,w=function(){function n(a){n.__super__.constructor.call(this,a)}var a,b,c,d,e,f,g,h,i,j,k,l,m;bT(n,U),n.title="Hatano Projection",g=20,c=1e-7,h=1.000001,a=2.67595,b=2.43763,i=.3736990601468637,j=.4102345310814193,e=1.75859,f=1.93052,l=.5686373742600607,m=.5179951515653813,d=.85,k=1.1764705882352942,n.prototype.project=function(h,i){var j,k,l,m,n,o,p,q,r;m=this,r=m.ll(h,i),h=r[0],i=r[1],l=m.rad(m.clon(h)),n=m.rad(i),j=Math.sin(n)*(n<0?b:a);for(k=g;k>=1;k+=-1){o=(n+Math.sin(n)-j)/(1+Math.cos(n)),n-=o;if(Math.abs(o)c.lat1?c.p1.project(a,b):c.p0.project(a,b)};return a}(),bz.goodehomolosine=v,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bT(a,S),a.parameters=["lon0","lat0"],a.title="Azimuthal Projection",a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bo.BBox(0,0,a*2,a*2)};return a}(),O=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Orthographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bz.ortho=O,B=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bT(a,b),a.title="Lambert Azimuthal Equal-Area Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bz.laea=B,be=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Stereographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bz.stereo=be,ba=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bT(a,b),a.parameters=["lon0","lat0","tilt","dist","up"],a.title="Satellite Projection",a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a, +b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bz.satellite=ba,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Equidistant Azimuthal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;i=this,j=i.rad(b),g=i.rad(a),h=Math,k=h.sin,d=h.cos,e=k(this.phi0)*k(j)+d(this.phi0)*d(j)*d(g-this.lam0),c=h.acos(e),f=.325*c/k(c),m=this.r*f*d(j)*k(g-this.lam0),o=-this.r*f*(d(this.phi0)*k(j)-k(this.phi0)*d(j)*d(g-this.lam0)),l=this.r+m,n=this.r+o;return[l,n]},a.prototype._visible=function(a,b){return!0};return a}(),bz.equi=p,a=function(){function b(a){var c;c=this,a.lat0=0,b.__super__.constructor.call(this,a),c.lam0=0}var a;bT(b,U),b.title="Aitoff Projection",b.parameters=["lon0"],a=.6366197723675814,b.prototype.project=function(b,c){var d,e,f,g,h,i,j,k;g=this,k=g.ll(b,c),b=k[0],c=k[1],b=g.clon(b),f=g.rad(b),h=g.rad(c),d=.5*f,e=Math.acos(Math.cos(h)*Math.cos(d)),e!==0?(j=1/Math.sin(e),i=2*e*Math.cos(h)*Math.sin(d)*j,j*=e*Math.sin(h)):i=j=0,g.winkel&&(i=(i+f*a)*.5,j=(j+h)*.5);return[i*1e3,j*-1e3]},b.prototype._visible=function(a,b){return!0};return b}(),bz.aitoff=a,bl=function(){function b(a){b.__super__.constructor.call(this,a),this.winkel=!0}bT(b,a),b.title="Winkel Tripel Projection";return b}(),bz.winkel3=bl,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bT(a,S),a.title="Conic Projection",a.parameters=["lon0","lat0","lat1"],a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),C=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bp=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bp(f/e(k.phi2))/bp(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bT(a,l),a.title="Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bp=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),T=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,l);return a}(),bi=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k0?(bA(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?bA(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},bo.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;r=this,q=(J=a.layer)!=null?J:r.layerIds[r.layerIds.length-1];if(!r.layers.hasOwnProperty(q))bx('dotgrid error: layer "'+q+'" not found');else{p=r.layers[q],c=a.data,d=a.value,e=a.key,t={};if(e!=null&&bA(c)==="array")for(B=0,F=c.length;B0){if(h.grid.length===0)for(z=0,O=r.viewport.width;0<=O?z<=O:z>=O;z+=n)for(A=0,P=r.viewport.height;0<=P?A<=P:A>=P;A+=n){m={x:z+(Math.random()-.5)*n*.2,y:A+(Math.random()-.5)*n*.2,pathid:!1},l=!1,Q=p.pathsById;for(o in Q){u=Q[o];for(D=0,H=u.length;D0&&Raphael.svg?(b=Raphael.animation({r:x*.5},k),m.shape.animate(b.delay(g))):m.shape.attr({r:x*.5}),bA(i)==="function"?j=i(v):j=i,m.shape.attr(j))}}},bn=(bH=bo.filter)!=null?bH:bo.filter={},bn.__knownFilter={},bn.__patternFills=0,J.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a},bo.Kartograph.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bo.filter[b]!=null)e=(new bo.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},J.prototype.applyFilter=function(a){var b;b=this;return $("."+b.id,b.paper.canvas).attr({filter:"url(#"+a+")"})},J.prototype.applyTexture=function(a,b,c,d){var e,f,g,h,i,j;d==null&&(d="#fff"),f=this,bn.__patternFills+=1,i=f.paths,j=[];for(g=0,h=i.length;g0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,bp("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 1",result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bn.glow=u,bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=bv.$K=(bI=bv.kartograph)!=null?bI:bv.kartograph={},bo.Kartograph.prototype.addGeoPath=function(a,b,c){var d,e,f;b==null&&(b=[]),c==null&&(c=""),d=this,f=d.getGeoPathStr(a,b),e=d.paper.path(f),c!==""&&e.node.setAttribute("class",c);return e},bo.Kartograph.prototype.getGeoPathStr=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=[]),e=this,type(b)==="string"&&(b=b.split("")),b.length===0&&b.push("M"),f="";for(d in a){g=a[d],c=(i=b[d])!=null?i:"L",h=e.lonlat2xy(g);if(isNaN(h[0])||isNaN(h[1]))continue;f+=c+h[0]+","+h[1]}return f},P=function(){function a(a){this.zoomOut=bR(this.zoomOut,this),this.zoomIn=bR(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('
');for(e=0,f=b.length;ef&&ah+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.mapcanvas.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]),a.title!=null&&b.attr("title",a.title);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class","title"],g.layers=[],bo.Bubble=g,z=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$(""),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),z.props=["icon","offset","class","title","iconsize"],z.layers=[],bo.Icon=z,bf=function(){function a(b){var c,d,e,f,g;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:"",c.offset=(g=b.offset)!=null?g:[0,0]}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x+a.offset[0],y:a.y+a.offset[1]}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),bf.props=["text","style","class","offset"],bf.layers=[],bo.Label=bf,y=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c,d;d=this,b=$("
"+d.text+"
"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('
'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),y.props=["text","style","class"],y.layers=[{id:"lbl",type:"html"}],bo.HtmlLabel=y,R=function(){function b(c){var d,e,f,g,h,i,j,k,l,m;a=this,b.__super__.constructor.call(this,c),a.radius=(e=c.radius)!=null?e:4,a.styles=(f=c.styles)!=null?f:"",a.colors=(g=c.colors)!=null?g:["#3cc","#c3c","#33c","#cc3"],a.titles=(h=c.titles)!=null?h:["","","","",""],a.values=(i=c.values)!=null?i:[],a.border=(j=c.border)!=null?j:!1,a.borderWidth=(k=c.borderWidth)!=null?k:2,a["class"]=(l=c["class"])!=null?l:"piechart",(m=(d=Raphael.fn).pieChart)==null&&(d.pieChart=bm)}var a;bT(b,bg),a=null,b.prototype.overlaps=function(b){var c,d,e,f,g,h,i,j,k,l;k=[a.x,a.y,a.radius],g=k[0],i=k[1],e=k[2],l=[b.x,b.y,b.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},b.prototype.render=function(b){var c;a=this,a.border!=null&&(c=a.layers.mapcanvas.circle(a.x,a.y,a.radius+a.borderWidth).attr({stroke:"none",fill:a.border})),a.chart=a.layers.mapcanvas.pieChart(a.x,a.y,a.radius,a.values,a.titles,a.colors,"none"),a.chart.push(c);return a},b.prototype.update=function(b){var c;return},b.prototype.clear=function(){var b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c180),0,h,j,"z"]).attr(f)},h=-270,o=0,l=function(e){var j,k,l,m,p,q,r;r=d[e],j=360*r/o,q=h+j*.5,k=f[e],m=500,l=30,p=n(a,b,c,h,h+j,{fill:k,stroke:g,"stroke-width":1}),p.mouseover(function(){p.stop().animate({transform:"s1.1 1.1 "+a+" "+b},m,"elastic")}),p.mouseout(function(){p.stop().animate({transform:""},m,"elastic")}),h+=j,i.push(p)};for(q=0,r=d.length;qh+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b,c,d,e,f,g;d=this,e=d.width,c=d.height,f=d.x,g=d.y,b=d.layers.mapcanvas.rect(f-e*.5-2,g-c*.5-2,e+4,c+4).attr({stroke:"none",fill:"#fff"}),d.chart=d.layers.mapcanvas.drawStackedBarChart(d.x,d.y,d.width,d.height,d.values,d.titles,d.colors,"none"),d.chart.push(b);return d},a.prototype.update=function(){var a,b;a=this;return},a.prototype.clear=function(){var a,b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;cg&&h-g>180?e=h-(g+360):h180?e=h+360-g:e=h-g,f=g+b*e;else if(!isNaN(g)){f=g;if(l===1||l===0)n=o}else if(!isNaN(h)){f=h;if(k===1||k===0)n=p}else f=void 0;n==null&&(n=o+b*(p-o)),j=k+b*(l-k);return new a(f,n,j,d)}if(d==="rgb"){q=m.rgb,r=c.rgb;return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}if(d==="lab"){q=m.lab(),r=c.lab();return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}throw"color mode "+d+" is not supported"};return a}(),c.hex2rgb=function(a){var b,c,d,e;if(!a.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))if(g.colors!=null&&g.colors[a])a=g.colors[a];else throw"unknown color format: "+a;if(a.length===4||a.length===7)a=a.substr(1);a.length===3&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),e=parseInt(a,16),d=e>>16,c=e>>8&255,b=e&255;return[d,c,b]},c.rgb2hex=function(a,b,c){var d,e,f;a!==void 0&&a.length===3&&(f=a,a=f[0],b=f[1],c=f[2]),e=a<<16|b<<8|c,d="000000"+e.toString(16).toUpperCase();return"#"+d.substr(d.length-6)},c.hsv2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t;i(a)==="array"&&a.length===3&&(n=a,a=n[0],b=n[1],h=n[2]),c*=255;if(b===0&&isNaN(a))l=f=d=c;else{a===360&&(a=0),a>360&&(a-=360),a<0&&(a+=360),a/=60,g=Math.floor(a),e=a-g,j=c*(1-b),k=c*(1-b*e),m=c*(1-b*(1-e));switch(g){case 0:o=[c,m,j],l=o[0],f=o[1],d=o[2];break;case 1:p=[k,c,j],l=p[0],f=p[1],d=p[2];break;case 2:q=[j,c,m],l=q[0],f=q[1],d=q[2];break;case 3:r=[j,k,c],l=r[0],f=r[1],d=r[2];break;case 4:s=[m,j,c],l=s[0],f=s[1],d=s[2];break;case 5:t=[c,j,k],l=t[0],f=t[1],d=t[2]}}l=Math.round(l),f=Math.round(f),d=Math.round(d);return[l,f,d]},c.rgb2hsv=function(a,b,c){var d,e,f,g,h,i,j;a!==void 0&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),g=Math.min(a,b,c),f=Math.max(a,b,c),d=f-g,i=f/255,h=d/f,h===0?(e=void 0,h=0):(a===f&&(e=(b-c)/d),b===f&&(e=2+(c-a)/d),c===f&&(e=4+(a-b)/d),e*=60,e<0&&(e+=360));return[e,h,i]},c.hsl2rgb=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;a!==void 0&&a.length===3&&(l=a,a=l[0],b=l[1],c=l[2]);if(b===0)h=f=d=c*255;else{k=[0,0,0],e=[0,0,0],j=c<.5?c*(1+b):c+b-c*b,i=2*c-j,a/=360,k[0]=a+1/3,k[1]=a,k[2]=a-1/3;for(g=0;g<=2;g++)k[g]<0&&(k[g]+=1),k[g]>1&&(k[g]-=1),6*k[g]<1?e[g]=i+(j-i)*6*k[g]:2*k[g]<1?e[g]=j:3*k[g]<2?e[g]=i+(j-i)*(2/3-k[g])*6:e[g]=i;m=[Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)],h=m[0],f=m[1],d=m[2]}return[h,f,d]},c.rgb2hsl=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=Math.max(a,b,c),e=(f+g)/2,f===g?(h=0,d=void 0):h=e<.5?(f-g)/(f+g):(f-g)/(2-f-g),a===f?d=(b-c)/(f-g):b===f?d=2+(c-a)/(f-g):c===f&&(d=4+(a-b)/(f-g)),d*=60,d<0&&(d+=360);return[d,h,e]},c.lab2xyz=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=function(a){return a>6/29?a*a*a:3*(6/29)*(6/29)*(a-4/29)},f=(a+.16)/1.16,e=[.96421,1,.82519],h=e[1]*d(f),g=e[0]*d(f+b/5),j=e[2]*d(f-c/2);return[g,h,j]},c.xyz2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n;i(a)==="array"&&a.length===3&&(m=a,a=m[0],b=m[1],c=m[2]),l=3.2406*a-1.5372*b-.4986*c,j=-0.9689*a+1.8758*b+.0415*c,e=.0557*a-.204*b+1.057*c,f=Math.min(l,j,e)<-0.001||Math.max(l,j,e)>1.001,f&&(l=l<0?0:l>1?1:l,j=j<0?0:j>1?1:j,e=e<0?0:e>1?1:e),f&&(n=[void 0,void 0,void 0],l=n[0],j=n[1],e=n[2]),g=function(a){var b;b=.055;return a<=.0031308?12.92*a:(1+b)*Math.pow(a,1/2.4)-b},k=Math.round(255*g(l)),h=Math.round(255*g(j)),d=Math.round(255*g(e));return[k,h,d]},c.lab2rgb=function(a,b,d){var e,f,g,h,i,j;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],d=i[2]),j=c.lab2xyz(a,b,d),e=j[0],f=j[1],g=j[2];return c.xyz2rgb(e,f,g)},c.csl2lab=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),a/=360,e=6.283185307179586,d=c*.61+.09,g=e/6-a*e,j=(c*.311+.125)*b,f=Math.sin(g)*j,h=Math.cos(g)*j;return[d,f,h]},c.csl2rgb=function(a,b,d){var e,f,g,h;h=c.csl2lab(a,b,d),e=h[0],f=h[1],g=h[2];return c.lab2rgb(e,f,g)},c.rgb2xyz=function(a,b,c){var d,e,f,g,h,i,j,k;a!==void 0&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=function(a){var b;b=.055;return a<=.04045?a/12.92:Math.pow((a+b)/(1+b),2.4)},g=e(a/255),f=e(b/255),d=e(c/255),h=.4124*g+.3576*f+.1805*d,i=.2126*g+.7152*f+.0722*d,j=.0193*g+.1192*f+.9505*d;return[h,i,j]},c.xyz2lab=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),g=[.96421,1,.82519],f=function(a){return a>Math.pow(6/29,3)?Math.pow(a,1/3):7.787037037037035*a+4/29},h=1.16*f(b/g[1])-.16,d=5*(f(a/g[0])-f(b/g[1])),e=2*(f(b/g[1])-f(c/g[2]));return[h,d,e]},c.rgb2lab=function(a,b,d){var e,f,g,h,i;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),i=c.rgb2xyz(a,b,d),e=i[0],f=i[1],g=i[2];return c.xyz2lab(e,f,g)},c.lab2csl=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=a,a=(a-.09)/.61,h=Math.sqrt(b*b+c*c),j=h/(a*.311+.125),e=6.283185307179586,f=Math.atan2(b,c),g=(e/6-f)/e,g*=360,g<0&&(g+=360);return[g,j,a]},c.rgb2csl=function(a,b,d){var e,f,g,h;i(a)==="array"&&a.length===3&&(g=a,a=g[0],b=g[1],d=g[2]),h=c.rgb2lab(a,b,d),f=h[0],e=h[1],d=h[2];return c.lab2csl(f,e,d)},c.rgb2hsi=function(a,b,c){var d,e,f,g,h,j;i(a)==="array"&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),d=Math.PI*2,a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=(a+b+c)/3,h=1-g/f,h===0?e=0:(e=(a-b+(a-c))/2,e/=Math.sqrt((a-b)*(a-b)+(a-c)*(b-c)),e=Math.acos(e),c>b&&(e=d-e),e/=d);return[e*360,h,f]},c.hsi2rgb=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=Math.PI*2,d=Math.PI/3,g=Math.cos,a<0&&(a+=360),a>360&&(a-=360),a/=360,a<1/3?(f=(1-b)/3,j=(1+b*g(e*a)/g(d-e*a))/3,h=1-(f+j)):a<2/3?(a-=1/3,j=(1-b)/3,h=(1+b*g(e*a)/g(d-e*a))/3,f=1-(j+h)):(a-=2/3,h=(1-b)/3,f=(1+b*g(e*a)/g(d-e*a))/3,j=1-(h+f)),j=c*j*3,h=c*h*3,f=c*f*3;return[j*255,h*255,f*255]},g.Color=c,g.hsl=function(a,b,d){return new c(a,b,d,"hsl")},g.hsv=function(a,b,d){return new c(a,b,d,"hsv")},g.rgb=function(a,b,d){return new c(a,b,d,"rgb")},g.hex=function(a){return new c(a)},g.lab=function(a,b,d){return new c(a,b,d,"lab")},g.csl=function(a,b,d){return new c(a,b,d,"csl")},g.hsi=function(a,b,d){return new c(a,b,d,"hsi")},g.interpolate=function(a,b,d,e){i(a)==="string"&&(a=new c(a)),i(b)==="string"&&(b=new c(b));return a.interpolate(d,b,e)},d=function(){function a(a){var b,d,e,f,g,h,j,k,l,m;f=this,f.colors=e=(g=a.colors)!=null?g:["#ddd","#222"];for(b=0,h=e.length-1;0<=h?b<=h:b>=h;0<=h?b++:b--)d=e[b],i(d)==="string"&&(e[b]=new c(d));if(a.positions!=null)f.pos=a.positions;else{f.pos=[];for(b=0,j=e.length-1;0<=j?b<=j:b>=j;0<=j?b++:b--)f.pos.push(b/(e.length-1))}f.mode=(k=a.mode)!=null?k:"hsv",f.nacol=(l=a.nacol)!=null?l:"#ccc",f.setClasses((m=a.limits)!=null?m:[0,1]),f}a.prototype.getColor=function(a){var b,c,d,e;e=this;if(isNaN(a))return e.nacol;e.classLimits.length>2?(b=e.getClass(a),c=b/(e.numClasses-1)):(c=d=(a-e.min)/(e.max-e.min),c=Math.min(1,Math.max(0,c)));return e.fColor(c)},a.prototype.fColor=function(a){var b,c,d,e,f,h;e=this,c=e.colors;for(d=0,h=e.pos.length-1;0<=h?d<=h:d>=h;0<=h?d++:d--){f=e.pos[d];if(a<=f){b=c[d];break}if(a>=f&&d===e.pos.length-1){b=c[d];break}if(a>f&&a2&&(f=c.length-1,b=g.getClass(a),a=c[b]+(c[b+1]-c[b])*.5,e=c[0],d=c[f-1],a=g.min+(a-e)/(d-e)*(g.max-g.min));return a},a.prototype.setClasses=function(a){var b;a==null&&(a=[]),b=this,b.classLimits=a,b.min=a[0],b.max=a[a.length-1];return a.length===2?b.numClasses=0:b.numClasses=a.length-1},a.prototype.getClass=function(a){var b,c,d,e;e=this,c=e.classLimits;if(c!=null){d=c.length-1,b=0;while(b=c[b])b++;return b-1}},a.prototype.validValue=function(a){return!isNaN(a)};return a}(),g.ColorScale=d,f=function(){function a(b,c,d){b==null&&(b="#fe0000"),c==null&&(c="#feeeee"),d==null&&(d="hsl"),a.__super__.constructor.call(this,[b,c],[0,1],d)}m(a,d);return a}(),g.Ramp=f,e=function(){function a(b,c,d,e,f){var g;b==null&&(b="#d73027"),c==null&&(c="#ffffbf"),d==null&&(d="#1E6189"),e==null&&(e="mean"),f==null&&(f="hsl"),g=this,g.mode=f,g.center=e,a.__super__.constructor.call(this,[b,c,d],[0,.5,1],f)}m(a,d),a.prototype.parseData=function(b,c){var d,e;a.__super__.parseData.call(this,b,c),e=this,d=e.center,d==="median"?d=e.median:d==="mean"&&(d=e.mean);return e.pos[1]=(d-e.min)/(e.max-e.min)};return a}(),g.Diverging=e,b=function(){function a(a){var b;b=this,b.colors=a}m(a,d),a.prototype.parseData=function(a,b){},a.prototype.getColor=function(a){var b;b=this;return b.colors.hasOwnProperty(a)?b.colors[a]:"#cccccc"},a.prototype.validValue=function(a){return this.colors.hasOwnProperty(a)};return a}(),g.Categories=b,a=function(){function a(a){var b;b=this,b.name=a,b.setClasses(7),b}m(a,d),a.prototype.getColor=function(a){var b,c;c=this,b=c.getClass(a);return c.name+" l"+c.numClasses+" c"+b};return a}(),g.CSSColors=a,(k=g.scales)==null&&(g.scales={}),g.scales.cool=function(){return new f(g.hsl(180,1,.9),g.hsl(250,.7,.4))},g.scales.hot=function(){return new d({colors:["#000000","#ff0000","#ffff00","#ffffff"],positions:[0,.25,.75,1],mode:"rgb"})},g.scales.BlWhOr=function(){return new e(g.hsl(30,1,.55),"#ffffff",new c(220,1,.55))},g.scales.GrWhPu=function(){return new e(g.hsl(120,.8,.4),"#ffffff",new c(280,.8,.4))},g.limits=function(a,b,c,d){var e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;b==null&&(b="equal"),c==null&&(c=7),d==null&&(d=null),r=Number.MAX_VALUE,q=Number.MAX_VALUE*-1,B=0,F=[];if(i(a)==="array")if(i(a[0])!=="object"&&i(a[0])!=="array")for(G=0,J=a.length;Gq&&(q=D),B+=D;else continue}F=F.sort(),p=[],b.substr(0,1)==="c"&&(p.push(r),p.push(q));if(b.substr(0,1)==="e"){p.push(r);for(l=1,T=c-1;1<=T?l<=T:l>=T;1<=T?l++:l--)p.push(r+l/c*(q-r));p.push(q)}else if(b.substr(0,1)==="q"){p.push(r);for(l=1,U=c-1;1<=U?l<=U:l>=U;1<=U?l++:l--)w=F.length*l/c,x=Math.floor(w),x===w?p.push(F[x]):(y=w-x,p.push(F[x]*y+F[x+1]*(1-y)));p.push(q)}else if(b.substr(0,1)==="k"){t=F.length,e=Array(t),j=Array(c),z=!0,u=0,g=null,g=[],g.push(r);for(l=1,V=c-1;1<=V?l<=V:l>=V;1<=V?l++:l--)g.push(r+l/c*(q-r));g.push(q);while(z){for(m=0,W=c-1;0<=W?m<=W:m>=W;0<=W?m++:m--)j[m]=0;for(l=0,X=t-1;0<=X?l<=X:l>=X;0<=X?l++:l--){E=F[l],s=Number.MAX_VALUE;for(m=0,Y=c-1;0<=Y?m<=Y:m>=Y;0<=Y?m++:m--)k=Math.abs(g[m]-E),k=Z;0<=Z?m++:m--)v[m]=null;for(l=0,M=t-1;0<=M?l<=M:l>=M;0<=M?l++:l--)h=e[l],v[h]===null?v[h]=F[l]:v[h]+=F[l];for(m=0,N=c-1;0<=N?m<=N:m>=N;0<=N?m++:m--)v[m]*=1/j[m];z=!1;for(m=0,O=c-1;0<=O?m<=O:m>=O;0<=O?m++:m--)if(v[m]!==g[l]){z=!0;break}g=v,u++,u>200&&(z=!1)}o={};for(m=0,P=c-1;0<=P?m<=P:m>=P;0<=P?m++:m--)o[m]=[];for(l=0,Q=t-1;0<=Q?l<=Q:l>=Q;0<=Q?l++:l--)h=e[l],o[h].push(F[l]);C=[];for(m=0,R=c-1;0<=R?m<=R:m>=R;0<=R?m++:m--)C.push(o[m][0]),C.push(o[m][o[m].length-1]);C=C.sort(function(a,b){return a-b}),p.push(C[0]);for(l=1,S=C.length-1;l<=S;l+=2)isNaN(C[l])||p.push(C[l])}return p},i=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c. */ - var Aitoff, Azimuthal, BBox, Balthasart, Behrmann, BlurFilter, Bubble, CEA, CantersModifiedSinusoidalI, Circle, CohenSutherland, Conic, Cylindrical, EckertIV, EquidistantAzimuthal, Equirectangular, Filter, GallPeters, GlowFilter, GoodeHomolosine, HoboDyer, HtmlLabel, Icon, Kartograph, LAEA, LCC, LatLon, Line, LinearScale, LogScale, LonLat, Loximuthal, MapLayer, MapLayerPath, Mercator, Mollweide, NaturalEarth, Orthographic, PanAndZoomControl, Path, PieChart, Proj, PseudoConic, PseudoCylindrical, QuantileScale, REbraces, REcomment_string, REfull, REmunged, Robinson, Satellite, Scale, Sinusoidal, StackedBarChart, Stereographic, SvgLabel, Symbol, SymbolGroup, View, WagnerIV, WagnerV, drawPieChart, filter, kartograph, log, map_layer_path_uid, munge, munged, parsedeclarations, restore, root, uid, warn, __point_in_polygon, __proj, __type, __verbose__, _base, _base2, _ref, _ref10, _ref11, _ref12, _ref13, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; + var Aitoff, Azimuthal, BBox, Balthasart, Behrmann, BlurFilter, Bubble, CEA, CantersModifiedSinusoidalI, Circle, CohenSutherland, Conic, Cylindrical, EckertIV, EquidistantAzimuthal, Equirectangular, Filter, GallPeters, GlowFilter, GoodeHomolosine, Hatano, HoboDyer, HtmlLabel, Icon, Kartograph, LAEA, LCC, LatLon, Line, LinearScale, LogScale, LonLat, Loximuthal, MapLayer, MapLayerPath, Mercator, Mollweide, NaturalEarth, Orthographic, PanAndZoomControl, Path, PieChart, Proj, PseudoConic, PseudoCylindrical, QuantileScale, REbraces, REcomment_string, REfull, REmunged, Robinson, Satellite, Scale, Sinusoidal, StackedBarChart, Stereographic, SvgLabel, Symbol, SymbolGroup, View, WagnerIV, WagnerV, Winkel3, drawPieChart, filter, kartograph, log, map_layer_path_uid, munge, munged, parsedeclarations, restore, root, uid, warn, __point_in_polygon, __proj, __type, __verbose__, _base, _base2, _ref, _ref10, _ref11, _ref12, _ref13, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; root = typeof exports !== "undefined" && exports !== null ? exports : this; kartograph = root.$K = (_ref = root.kartograph) != null ? _ref : root.kartograph = {}; - kartograph.version = "0.1.1"; + kartograph.version = "0.1.3"; __verbose__ = false && (typeof console !== "undefined" && console !== null); @@ -2310,6 +2310,66 @@ __proj['canters1'] = CantersModifiedSinusoidalI; + Hatano = (function() { + var CN, CS, EPS, FXC, FYCN, FYCS, NITER, ONETOL, RCN, RCS, RXC, RYCN, RYCS; + + __extends(Hatano, PseudoCylindrical); + + Hatano.title = "Hatano Projection"; + + NITER = 20; + + EPS = 1e-7; + + ONETOL = 1.000001; + + CN = 2.67595; + + CS = 2.43763; + + RCN = 0.37369906014686373063; + + RCS = 0.41023453108141924738; + + FYCN = 1.75859; + + FYCS = 1.93052; + + RYCN = 0.56863737426006061674; + + RYCS = 0.51799515156538134803; + + FXC = 0.85; + + RXC = 1.17647058823529411764; + + function Hatano(opts) { + Hatano.__super__.constructor.call(this, opts); + } + + Hatano.prototype.project = function(lon, lat) { + var c, i, lam, me, phi, th1, x, y, _ref10; + me = this; + _ref10 = me.ll(lon, lat), lon = _ref10[0], lat = _ref10[1]; + lam = me.rad(me.clon(lon)); + phi = me.rad(lat); + c = Math.sin(phi) * (phi < 0.0 ? CS : CN); + for (i = NITER; i >= 1; i += -1) { + th1 = (phi + Math.sin(phi) - c) / (1.0 + Math.cos(phi)); + phi -= th1; + if (Math.abs(th1) < EPS) break; + } + x = FXC * lam * Math.cos(phi *= 0.5); + y = Math.sin(phi) * (phi < 0.0 ? FYCS : FYCN); + return [x, y * -1]; + }; + + return Hatano; + + })(); + + __proj['hatano'] = Hatano; + GoodeHomolosine = (function() { __extends(GoodeHomolosine, PseudoCylindrical); @@ -2654,9 +2714,10 @@ EquidistantAzimuthal.title = "Equidistant Azimuthal Projection"; EquidistantAzimuthal.prototype.project = function(lon, lat) { - var c, cos, cos_c, k, lam, math, phi, sin, x, xo, y, yo; - phi = this.rad(lat); - lam = this.rad(lon); + var c, cos, cos_c, k, lam, math, me, phi, sin, x, xo, y, yo; + me = this; + phi = me.rad(lat); + lam = me.rad(lon); math = Math; sin = math.sin; cos = math.cos; @@ -2681,8 +2742,9 @@ __proj['equi'] = EquidistantAzimuthal; Aitoff = (function() { + var COSPHI1; - __extends(Aitoff, EquidistantAzimuthal); + __extends(Aitoff, PseudoCylindrical); /* Aitoff projection @@ -2695,6 +2757,8 @@ Aitoff.parameters = ['lon0']; + COSPHI1 = 0.636619772367581343; + function Aitoff(opts) { var me; me = this; @@ -2704,49 +2768,54 @@ } Aitoff.prototype.project = function(lon, lat) { - var me, x, y, _ref10; + var c, d, lam, me, phi, x, y, _ref10; me = this; + _ref10 = me.ll(lon, lat), lon = _ref10[0], lat = _ref10[1]; lon = me.clon(lon); - _ref10 = Aitoff.__super__.project.call(this, lon * 0.5, lat), x = _ref10[0], y = _ref10[1]; - return [x, y * 0.5]; + lam = me.rad(lon); + phi = me.rad(lat); + c = 0.5 * lam; + d = Math.acos(Math.cos(phi) * Math.cos(c)); + if (d !== 0) { + y = 1.0 / Math.sin(d); + x = 2.0 * d * Math.cos(phi) * Math.sin(c) * y; + y *= d * Math.sin(phi); + } else { + x = y = 0; + } + if (me.winkel) { + x = (x + lam * COSPHI1) * 0.5; + y = (y + phi) * 0.5; + } + return [x * 1000, y * -1000]; }; Aitoff.prototype._visible = function(lon, lat) { return true; }; - Aitoff.prototype.sea = function() { - var math, out, phi, r; - out = []; - r = this.r; - math = Math; - for (phi = 0; phi <= 360; phi++) { - out.push([r + math.cos(this.rad(phi)) * r * 0.51, r * 0.5 + math.sin(this.rad(phi)) * r * 0.258]); - } - return out; - }; + return Aitoff; - Aitoff.prototype.world_bbox = function() { - var r; - r = this.r; - return new kartograph.BBox(r * 0.5, r * 0.25, r, r * 0.5); - }; + })(); - Aitoff.prototype.clon = function(lon) { - lon -= this.lon0; - if (lon < -180) { - lon += 360; - } else if (lon > 180) { - lon -= 360; - } - return lon; - }; + __proj['aitoff'] = Aitoff; - return Aitoff; + Winkel3 = (function() { + + __extends(Winkel3, Aitoff); + + Winkel3.title = "Winkel Tripel Projection"; + + function Winkel3(opts) { + Winkel3.__super__.constructor.call(this, opts); + this.winkel = true; + } + + return Winkel3; })(); - __proj['aitoff'] = Aitoff; + __proj['winkel3'] = Winkel3; Conic = (function() { diff --git a/js/kartograph.min.js b/js/kartograph.min.js index 2693ea8..5722cc8 100644 --- a/js/kartograph.min.js +++ b/js/kartograph.min.js @@ -17,5 +17,5 @@ * along with this program. If not, see . * * - */(function(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL,bM,bN,bO,bP=function(a,b){return function(){return a.apply(b,arguments)}},bQ=Object.prototype.hasOwnProperty,bR=function(a,b){function d(){this.constructor=a}for(var c in b)bQ.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a};bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=bt.$K=(bC=bt.kartograph)!=null?bC:bt.kartograph={},bm.version="0.1.1",bz=!1,bv=function(a){if(bz)return console.warn("kartograph ("+bm.version+"): ",a)},bn=function(a){if(bz)return console.log("kartograph ("+bm.version+"): ",a)},(bH=(bA=String.prototype).trim)==null&&(bA.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this==null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;es.left&&a.tops.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bm.BBox(d,e,c,b)},bm.BBox=c,(bI=bm.geom)==null&&(bm.geom={}),(bJ=(bB=bm.geom).clipping)==null&&(bB.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,ba.right&&(d|=e.RIGHT),ca.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bm.geom.clipping.CohenSutherland=k,z=function(){function a(a,b,d){var e,f;f=this,f.container=e=$(a),b==null&&(b=e.width()),d==null&&(d=e.height()),d===0&&(d=b*.5),f.viewport=new c(0,0,b,d),f.paper=f.createSVGLayer(),f.markers=[],f.pathById={},f.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bm.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('
'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bm.__mapCache[a]!=null?d._mapLoaded(bm.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bv(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((i=bm.__mapCache)==null&&(bm.__mapCache={}),bm.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){bv("something went horribly wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bm.View.fromXML(b),f=(j=e.opts.padding)!=null?j:0,d=(k=e.opts.halign)!=null?k:"center",g=(l=e.opts.valign)!=null?l:"center",e.viewBC=new bm.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bm.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(q=h.layerIds)==null&&(h.layerIds=[]),(r=h.layers)==null&&(h.layers={}),by(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new I(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(n=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(o=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,p=f.split(",");for(j=0,l=p.length;j1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],q=e._regardStyles;for(k=0,m=q.length;k=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,by(d)==="string"?k=d:by(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=(bL=bt.kartograph)!=null?bL:bt.kartograph={},bm.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=bp(a),j=a.split("`b%");for(h=0,i=j.length;h=g;0<=g?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;m=this;if(m._centroid!=null)return m._centroid;b=m.area(),d=e=0;for(h=0,w=m.contours.length-1;0<=w?h<=w:h>=w;0<=w?h++:h--){c=m.contours[h],a=m.areas[h],r=s=0,k=c.length,t=[],p=0;for(i=0,u=k-1;0<=u?i<=u:i>=u;0<=u?i++:i--)n=c[i],o=c[(i+1)%k],f=o[0]-n[0],g=o[1]-n[1],l=Math.sqrt(f*f+g*g),t.push(l),p+=l;for(i=0,v=k-1;0<=v?i<=v:i>=v;0<=v?i++:i--)n=c[i],o=c[(i+1)%k],q=t[i]/p,r+=q*n[0],s+=q*n[1];j=a/b,d+=r*j,e+=s*j}m._centroid=[d,e];return m._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(ac[2]||bc[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(bw(d,[a,b]))return!0}return!1};return a}(),bm.geom.Path=P,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bR(a,P),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bm.geom.Circle=j,P.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),v=h.split(l);for(p=0,r=v.length;p=t;0<=t?d++:d--){q=l.points[d],g=q[0],h=q[1],r=l.points[d+1],i=r[0],j=r[1];try{s=c(b,g,h,i,j),m=s[0],o=s[1],n=s[2],p=s[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],h=b.points;for(e=0,f=h.length;e=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=(bO=bt.kartograph)!=null?bO:bt.kartograph={},bx=bm.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},R=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.parameters=[],a.title="Projection",a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bm.BBox;for(e=0,f=d.length;e=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bm.proj[d](e),f.name=d;return f},bm.Proj=R,n=function(){function a(b){var c,d,e;b==null&&(b={}),c=this,c.flip=Number((d=b.flip)!=null?d:0),c.flip===1&&(b.lon0=(e=-b.lon0)!=null?e:0),a.__super__.constructor.call(this,b)}bR(a,R),a.parameters=["lon0","flip"],a.title="Cylindrical Projection",a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,n),a.title="Equirectangular Projection",a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bx.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bR(a,n),a.parameters=["lon0","lat1","flip"],a.title="Cylindrical Equal Area",a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bx.cea=h,t=function(){function a(b){b.lat1=45,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Gall-Peters Projection",a.parameters=["lon0","flip"];return a}(),bx.gallpeters=t,w=function(){function a(b){b.lat1=37.7,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Hobo-Dyer Projection",a.parameters=["lon0","flip"];return a}(),bx.hobodyer=w,e=function(){function a(b){b.lat1=30,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Behrmann Projection",a.parameters=["lon0","flip"];return a}(),bx.behrmann=e,d=function(){function a(b){b.lat1=50,a.__super__.constructor.call(this,b)}bR(a,h),a.title="Balthasart Projection",a.parameters=["lon0","flip"];return a}(),bx.balthasart=d,K=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bR(a,n),a.title="Mercator Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bx.mercator=K,T=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,n),a.title="Pseudo-Cylindrical Projection";return a}(),M=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bR(a,T),a.title="Natural Earth Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bx.naturalearth=M,Z=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bR(a,T),a.title="Robinson Projection",a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bx.robinson=Z,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bR(a,T),a.title="Eckert IV Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bx.mollweide=L,bi=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bR(a,L),a.title="Wagner IV Projection";return a}(),bx.wagner4=bi,bj=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bR(a,L),a.title="Wagner V Projection";return a}(),bx.wagner5=bj,H=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bR(c,T),b=-89,a=89,c.parameters=["lon0","lat0","flip"],c.title="Loximuthal Projection (equidistant)",c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bx.loximuthal=H,i=function(){function f(){f.__super__.constructor.apply(this,arguments)}var a,b,c,d,e;bR(f,T),f.title="Canters Modified Sinusoidal I",f.parameters=["lon0"],a=1.1966,b=-0.129,c=3*b,d=-0.0076,e=5*d,f.prototype.project=function(f,g){var h,i,j,k,l,m;h=this,m=h.ll(f,g),f=m[0],g=m[1],f=h.rad(h.clon(f)),g=h.rad(g),k=g*g,l=k*k,i=1e3*f*Math.cos(g)/(a+c*k+e*l),j=1e3*g*(a+b*k+d*l);return[i,j*-1]};return f}(),bx.canters1=i,v=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.lat1=41.737,c.p1=new L,c.p0=new bb}bR(a,T),a.title="Goode Homolosine Projection",a.parameters=["lon0"],a.prototype.project=function(a,b){var c,d;c=this,d=c.ll(a,b),a=d[0],b=d[1],a=c.clon(a);return Math.abs(b)>c.lat1?c.p1.project(a,b):c.p0.project(a,b)};return a}(),bx.goodehomolosine=v,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bR(a,R),a.parameters=["lon0","lat0"],a.title="Azimuthal Projection",a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bm.BBox(0,0,a*2,a*2)};return a}(),N=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Orthographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bx.ortho=N,A=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bR(a,b),a.title="Lambert Azimuthal Equal-Area Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bx.laea=A,bd=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Stereographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bx.stereo=bd,_=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bR(a,b),a.parameters=["lon0","lat0","tilt","dist","up"],a.title="Satellite Projection",a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a,b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bx.satellite=_,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,b),a.title="Equidistant Azimuthal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;i=this.rad(b),g=this.rad(a),h=Math,j=h.sin,d=h.cos,e=j(this.phi0)*j(i)+d(this.phi0)*d -(i)*d(g-this.lam0),c=h.acos(e),f=.325*c/j(c),l=this.r*f*d(i)*j(g-this.lam0),n=-this.r*f*(d(this.phi0)*j(i)-j(this.phi0)*d(i)*d(g-this.lam0)),k=this.r+l,m=this.r+n;return[k,m]},a.prototype._visible=function(a,b){return!0};return a}(),bx.equi=p,a=function(){function a(b){var c;c=this,b.lat0=0,a.__super__.constructor.call(this,b),c.lam0=0}bR(a,p),a.title="Aitoff Projection",a.parameters=["lon0"],a.prototype.project=function(b,c){var d,e,f,g;d=this,b=d.clon(b),g=a.__super__.project.call(this,b*.5,c),e=g[0],f=g[1];return[e,f*.5]},a.prototype._visible=function(a,b){return!0},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d*.51,d*.5+a.sin(this.rad(c))*d*.258]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bm.BBox(a*.5,a*.25,a,a*.5)},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),bx.aitoff=a,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bR(a,R),a.title="Conic Projection",a.parameters=["lon0","lat0","lat1"],a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),B=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bn=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bn(f/e(k.phi2))/bn(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bR(a,l),a.title="Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bn=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),S=function(){function a(){a.__super__.constructor.apply(this,arguments)}bR(a,l);return a}(),bh=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k0?(by(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?by(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},bm.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;r=this,q=(J=a.layer)!=null?J:r.layerIds[r.layerIds.length-1];if(!r.layers.hasOwnProperty(q))bv('dotgrid error: layer "'+q+'" not found');else{p=r.layers[q],c=a.data,d=a.value,e=a.key,t={};if(e!=null&&by(c)==="array")for(B=0,F=c.length;B0){if(h.grid.length===0)for(z=0,O=r.viewport.width;0<=O?z<=O:z>=O;z+=n)for(A=0,P=r.viewport.height;0<=P?A<=P:A>=P;A+=n){m={x:z+(Math.random()-.5)*n*.2,y:A+(Math.random()-.5)*n*.2,pathid:!1},l=!1,Q=p.pathsById;for(o in Q){u=Q[o];for(D=0,H=u.length;D0&&Raphael.svg?(b=Raphael.animation({r:x*.5},k),m.shape.animate(b.delay(g))):m.shape.attr({r:x*.5}),by(i)==="function"?j=i(v):j=i,m.shape.attr(j))}}},bl=(bF=bm.filter)!=null?bF:bm.filter={},bl.__knownFilter={},bl.__patternFills=0,I.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a},bm.Kartograph.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bm.filter[b]!=null)e=(new bm.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},I.prototype.applyFilter=function(a){var b;b=this;return $("."+b.id,b.paper.canvas).attr({filter:"url(#"+a+")"})},I.prototype.applyTexture=function(a,b,c,d){var e,f,g,h,i,j;d==null&&(d="#fff"),f=this,bl.__patternFills+=1,i=f.paths,j=[];for(g=0,h=i.length;g0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,bn("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 1",result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bl.glow=u,bt=typeof exports!="undefined"&&exports!==null?exports:this,bm=bt.$K=(bG=bt.kartograph)!=null?bG:bt.kartograph={},bm.Kartograph.prototype.addGeoPath=function(a,b,c){var d,e,f;b==null&&(b=[]),c==null&&(c=""),d=this,f=d.getGeoPathStr(a,b),e=d.paper.path(f),c!==""&&e.node.setAttribute("class",c);return e},bm.Kartograph.prototype.getGeoPathStr=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=[]),e=this,type(b)==="string"&&(b=b.split("")),b.length===0&&b.push("M"),f="";for(d in a){g=a[d],c=(i=b[d])!=null?i:"L",h=e.lonlat2xy(g);if(isNaN(h[0])||isNaN(h[1]))continue;f+=c+h[0]+","+h[1]}return f},O=function(){function a(a){this.zoomOut=bP(this.zoomOut,this),this.zoomIn=bP(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('
');for(e=0,f=b.length;ef&&ah+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.mapcanvas.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]),a.title!=null&&b.attr("title",a.title);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class","title"],g.layers=[],bm.Bubble=g,y=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$(""),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),y.props=["icon","offset","class","title","iconsize"],y.layers=[],bm.Icon=y,be=function(){function a(b){var c,d,e,f,g;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:"",c.offset=(g=b.offset)!=null?g:[0,0]}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x+a.offset[0],y:a.y+a.offset[1]}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),be.props=["text","style","class","offset"],be.layers=[],bm.Label=be,x=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bR(a,bm.Symbol),a.prototype.render=function(a){var b,c,d;d=this,b=$("
"+d.text+"
"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('
'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),x.props=["text","style","class"],x.layers=[{id:"lbl",type:"html"}],bm.HtmlLabel=x,Q=function(){function b(c){var d,e,f,g,h,i,j,k,l,m;a=this,b.__super__.constructor.call(this,c),a.radius=(e=c.radius)!=null?e:4,a.styles=(f=c.styles)!=null?f:"",a.colors=(g=c.colors)!=null?g:["#3cc","#c3c","#33c","#cc3"],a.titles=(h=c.titles)!=null?h:["","","","",""],a.values=(i=c.values)!=null?i:[],a.border=(j=c.border)!=null?j:!1,a.borderWidth=(k=c.borderWidth)!=null?k:2,a["class"]=(l=c["class"])!=null?l:"piechart",(m=(d=Raphael.fn).pieChart)==null&&(d.pieChart=bk)}var a;bR(b,bf),a=null,b.prototype.overlaps=function(b){var c,d,e,f,g,h,i,j,k,l;k=[a.x,a.y,a.radius],g=k[0],i=k[1],e=k[2],l=[b.x,b.y,b.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},b.prototype.render=function(b){var c;a=this,a.border!=null&&(c=a.layers.mapcanvas.circle(a.x,a.y,a.radius+a.borderWidth).attr({stroke:"none",fill:a.border})),a.chart=a.layers.mapcanvas.pieChart(a.x,a.y,a.radius,a.values,a.titles,a.colors,"none"),a.chart.push(c);return a},b.prototype.update=function(b){var c;return},b.prototype.clear=function(){var b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c180),0,h,j,"z"]).attr(f)},h=-270,o=0,l=function(e){var j,k,l,m,p,q,r;r=d[e],j=360*r/o,q=h+j*.5,k=f[e],m=500,l=30,p=n(a,b,c,h,h+j,{fill:k,stroke:g,"stroke-width":1}),p.mouseover(function(){p.stop().animate({transform:"s1.1 1.1 "+a+" "+b},m,"elastic")}),p.mouseout(function(){p.stop().animate({transform:""},m,"elastic")}),h+=j,i.push(p)};for(q=0,r=d.length;qh+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b,c,d,e,f,g;d=this,e=d.width,c=d.height,f=d.x,g=d.y,b=d.layers.mapcanvas.rect(f-e*.5-2,g-c*.5-2,e+4,c+4).attr({stroke:"none",fill:"#fff"}),d.chart=d.layers.mapcanvas.drawStackedBarChart(d.x,d.y,d.width,d.height,d.values,d.titles,d.colors,"none"),d.chart.push(b);return d},a.prototype.update=function(){var a,b;a=this;return},a.prototype.clear=function(){var a,b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;es.left&&a.tops.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bo.BBox(d,e,c,b)},bo.BBox=c,(bK=bo.geom)==null&&(bo.geom={}),(bL=(bD=bo.geom).clipping)==null&&(bD.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,ba.right&&(d|=e.RIGHT),ca.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bo.geom.clipping.CohenSutherland=k,A=function(){function a(a,b,d){var e,f;f=this,f.container=e=$(a),b==null&&(b=e.width()),d==null&&(d=e.height()),d===0&&(d=b*.5),f.viewport=new c(0,0,b,d),f.paper=f.createSVGLayer(),f.markers=[],f.pathById={},f.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bo.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('
'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bo.__mapCache[a]!=null?d._mapLoaded(bo.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bx(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((i=bo.__mapCache)==null&&(bo.__mapCache={}),bo.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){bx("something went horribly wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bo.View.fromXML(b),f=(j=e.opts.padding)!=null?j:0,d=(k=e.opts.halign)!=null?k:"center",g=(l=e.opts.valign)!=null?l:"center",e.viewBC=new bo.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bo.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(q=h.layerIds)==null&&(h.layerIds=[]),(r=h.layers)==null&&(h.layers={}),bA(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new J(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(n=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(o=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,p=f.split(",");for(j=0,l=p.length;j1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],q=e._regardStyles;for(k=0,m=q.length;k=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,bA(d)==="string"?k=d:bA(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=(bN=bv.kartograph)!=null?bN:bv.kartograph={},bo.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=br(a),j=a.split("`b%");for(h=0,i=j.length;h=g;0<=g?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;m=this;if(m._centroid!=null)return m._centroid;b=m.area(),d=e=0;for(h=0,w=m.contours.length-1;0<=w?h<=w:h>=w;0<=w?h++:h--){c=m.contours[h],a=m.areas[h],r=s=0,k=c.length,t=[],p=0;for(i=0,u=k-1;0<=u?i<=u:i>=u;0<=u?i++:i--)n=c[i],o=c[(i+1)%k],f=o[0]-n[0],g=o[1]-n[1],l=Math.sqrt(f*f+g*g),t.push(l),p+=l;for(i=0,v=k-1;0<=v?i<=v:i>=v;0<=v?i++:i--)n=c[i],o=c[(i+1)%k],q=t[i]/p,r+=q*n[0],s+=q*n[1];j=a/b,d+=r*j,e+=s*j}m._centroid=[d,e];return m._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(ac[2]||bc[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(by(d,[a,b]))return!0}return!1};return a}(),bo.geom.Path=Q,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bT(a,Q),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bo.geom.Circle=j,Q.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),v=h.split(l);for(p=0,r=v.length;p=t;0<=t?d++:d--){q=l.points[d],g=q[0],h=q[1],r=l.points[d+1],i=r[0],j=r[1];try{s=c(b,g,h,i,j),m=s[0],o=s[1],n=s[2],p=s[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],h=b.points;for(e=0,f=h.length;e=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=(bQ=bv.kartograph)!=null?bQ:bv.kartograph={},bz=bo.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},S=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.parameters=[],a.title="Projection",a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bo.BBox;for(e=0,f=d.length;e=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bo.proj[d](e),f.name=d;return f},bo.Proj=S,n=function(){function a(b){var c,d,e;b==null&&(b={}),c=this,c.flip=Number((d=b.flip)!=null?d:0),c.flip===1&&(b.lon0=(e=-b.lon0)!=null?e:0),a.__super__.constructor.call(this,b)}bT(a,S),a.parameters=["lon0","flip"],a.title="Cylindrical Projection",a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,n),a.title="Equirectangular Projection",a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bz.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bT(a,n),a.parameters=["lon0","lat1","flip"],a.title="Cylindrical Equal Area",a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bz.cea=h,t=function(){function a(b){b.lat1=45,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Gall-Peters Projection",a.parameters=["lon0","flip"];return a}(),bz.gallpeters=t,x=function(){function a(b){b.lat1=37.7,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Hobo-Dyer Projection",a.parameters=["lon0","flip"];return a}(),bz.hobodyer=x,e=function(){function a(b){b.lat1=30,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Behrmann Projection",a.parameters=["lon0","flip"];return a}(),bz.behrmann=e,d=function(){function a(b){b.lat1=50,a.__super__.constructor.call(this,b)}bT(a,h),a.title="Balthasart Projection",a.parameters=["lon0","flip"];return a}(),bz.balthasart=d,L=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bT(a,n),a.title="Mercator Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bz.mercator=L,U=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,n),a.title="Pseudo-Cylindrical Projection";return a}(),N=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bT(a,U),a.title="Natural Earth Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bz.naturalearth=N,_=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bT(a,U),a.title="Robinson Projection",a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bz.robinson=_,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bT(a,U),a.title="Eckert IV Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bz.mollweide=M,bj=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bT(a,M),a.title="Wagner IV Projection";return a}(),bz.wagner4=bj,bk=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bT(a,M),a.title="Wagner V Projection";return a}(),bz.wagner5=bk,I=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bT(c,U),b=-89,a=89,c.parameters=["lon0","lat0","flip"],c.title="Loximuthal Projection (equidistant)",c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bz.loximuthal=I,i=function(){function f(){f.__super__.constructor.apply(this,arguments)}var a,b,c,d,e;bT(f,U),f.title="Canters Modified Sinusoidal I",f.parameters=["lon0"],a=1.1966,b=-0.129,c=3*b,d=-0.0076,e=5*d,f.prototype.project=function(f,g){var h,i,j,k,l,m;h=this,m=h.ll(f,g),f=m[0],g=m[1],f=h.rad(h.clon(f)),g=h.rad(g),k=g*g,l=k*k,i=1e3*f*Math.cos(g)/(a+c*k+e*l),j=1e3*g*(a+b*k+d*l);return[i,j*-1]};return f}(),bz.canters1=i,w=function(){function n(a){n.__super__.constructor.call(this,a)}var a,b,c,d,e,f,g,h,i,j,k,l,m;bT(n,U),n.title="Hatano Projection",g=20,c=1e-7,h=1.000001,a=2.67595,b=2.43763,i=.3736990601468637,j=.4102345310814193,e=1.75859,f=1.93052,l=.5686373742600607,m=.5179951515653813,d=.85,k=1.1764705882352942,n.prototype.project=function(h,i){var j,k,l,m,n,o,p,q,r;m=this,r=m.ll(h,i),h=r[0],i=r[1],l=m.rad(m.clon(h)),n=m.rad(i),j=Math.sin(n)*(n<0?b:a);for(k=g;k>=1;k+=-1){o=(n+Math.sin(n)-j)/(1+Math.cos(n)),n-=o;if(Math.abs(o)c.lat1?c.p1.project(a,b):c.p0.project(a,b)};return a}(),bz.goodehomolosine=v,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bT(a,S),a.parameters=["lon0","lat0"],a.title="Azimuthal Projection",a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bo.BBox(0,0,a*2,a*2)};return a}(),O=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Orthographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bz.ortho=O,B=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bT(a,b),a.title="Lambert Azimuthal Equal-Area Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bz.laea=B,be=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Stereographic Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bz.stereo=be,ba=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bT(a,b),a.parameters=["lon0","lat0","tilt","dist","up"],a.title="Satellite Projection",a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a, +b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bz.satellite=ba,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,b),a.title="Equidistant Azimuthal Projection",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;i=this,j=i.rad(b),g=i.rad(a),h=Math,k=h.sin,d=h.cos,e=k(this.phi0)*k(j)+d(this.phi0)*d(j)*d(g-this.lam0),c=h.acos(e),f=.325*c/k(c),m=this.r*f*d(j)*k(g-this.lam0),o=-this.r*f*(d(this.phi0)*k(j)-k(this.phi0)*d(j)*d(g-this.lam0)),l=this.r+m,n=this.r+o;return[l,n]},a.prototype._visible=function(a,b){return!0};return a}(),bz.equi=p,a=function(){function b(a){var c;c=this,a.lat0=0,b.__super__.constructor.call(this,a),c.lam0=0}var a;bT(b,U),b.title="Aitoff Projection",b.parameters=["lon0"],a=.6366197723675814,b.prototype.project=function(b,c){var d,e,f,g,h,i,j,k;g=this,k=g.ll(b,c),b=k[0],c=k[1],b=g.clon(b),f=g.rad(b),h=g.rad(c),d=.5*f,e=Math.acos(Math.cos(h)*Math.cos(d)),e!==0?(j=1/Math.sin(e),i=2*e*Math.cos(h)*Math.sin(d)*j,j*=e*Math.sin(h)):i=j=0,g.winkel&&(i=(i+f*a)*.5,j=(j+h)*.5);return[i*1e3,j*-1e3]},b.prototype._visible=function(a,b){return!0};return b}(),bz.aitoff=a,bl=function(){function b(a){b.__super__.constructor.call(this,a),this.winkel=!0}bT(b,a),b.title="Winkel Tripel Projection";return b}(),bz.winkel3=bl,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bT(a,S),a.title="Conic Projection",a.parameters=["lon0","lat0","lat1"],a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),C=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bp=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bp(f/e(k.phi2))/bp(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bT(a,l),a.title="Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bp=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),T=function(){function a(){a.__super__.constructor.apply(this,arguments)}bT(a,l);return a}(),bi=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k0?(bA(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?bA(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},bo.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V;r=this,q=(J=a.layer)!=null?J:r.layerIds[r.layerIds.length-1];if(!r.layers.hasOwnProperty(q))bx('dotgrid error: layer "'+q+'" not found');else{p=r.layers[q],c=a.data,d=a.value,e=a.key,t={};if(e!=null&&bA(c)==="array")for(B=0,F=c.length;B0){if(h.grid.length===0)for(z=0,O=r.viewport.width;0<=O?z<=O:z>=O;z+=n)for(A=0,P=r.viewport.height;0<=P?A<=P:A>=P;A+=n){m={x:z+(Math.random()-.5)*n*.2,y:A+(Math.random()-.5)*n*.2,pathid:!1},l=!1,Q=p.pathsById;for(o in Q){u=Q[o];for(D=0,H=u.length;D0&&Raphael.svg?(b=Raphael.animation({r:x*.5},k),m.shape.animate(b.delay(g))):m.shape.attr({r:x*.5}),bA(i)==="function"?j=i(v):j=i,m.shape.attr(j))}}},bn=(bH=bo.filter)!=null?bH:bo.filter={},bn.__knownFilter={},bn.__patternFills=0,J.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a},bo.Kartograph.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bo.filter[b]!=null)e=(new bo.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},J.prototype.applyFilter=function(a){var b;b=this;return $("."+b.id,b.paper.canvas).attr({filter:"url(#"+a+")"})},J.prototype.applyTexture=function(a,b,c,d){var e,f,g,h,i,j;d==null&&(d="#fff"),f=this,bn.__patternFills+=1,i=f.paths,j=[];for(g=0,h=i.length;g0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,bp("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 1",result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bn.glow=u,bv=typeof exports!="undefined"&&exports!==null?exports:this,bo=bv.$K=(bI=bv.kartograph)!=null?bI:bv.kartograph={},bo.Kartograph.prototype.addGeoPath=function(a,b,c){var d,e,f;b==null&&(b=[]),c==null&&(c=""),d=this,f=d.getGeoPathStr(a,b),e=d.paper.path(f),c!==""&&e.node.setAttribute("class",c);return e},bo.Kartograph.prototype.getGeoPathStr=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=[]),e=this,type(b)==="string"&&(b=b.split("")),b.length===0&&b.push("M"),f="";for(d in a){g=a[d],c=(i=b[d])!=null?i:"L",h=e.lonlat2xy(g);if(isNaN(h[0])||isNaN(h[1]))continue;f+=c+h[0]+","+h[1]}return f},P=function(){function a(a){this.zoomOut=bR(this.zoomOut,this),this.zoomIn=bR(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('
');for(e=0,f=b.length;ef&&ah+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.mapcanvas.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]),a.title!=null&&b.attr("title",a.title);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class","title"],g.layers=[],bo.Bubble=g,z=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$(""),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),z.props=["icon","offset","class","title","iconsize"],z.layers=[],bo.Icon=z,bf=function(){function a(b){var c,d,e,f,g;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:"",c.offset=(g=b.offset)!=null?g:[0,0]}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x+a.offset[0],y:a.y+a.offset[1]}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),bf.props=["text","style","class","offset"],bf.layers=[],bo.Label=bf,y=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bT(a,bo.Symbol),a.prototype.render=function(a){var b,c,d;d=this,b=$("
"+d.text+"
"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('
'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),y.props=["text","style","class"],y.layers=[{id:"lbl",type:"html"}],bo.HtmlLabel=y,R=function(){function b(c){var d,e,f,g,h,i,j,k,l,m;a=this,b.__super__.constructor.call(this,c),a.radius=(e=c.radius)!=null?e:4,a.styles=(f=c.styles)!=null?f:"",a.colors=(g=c.colors)!=null?g:["#3cc","#c3c","#33c","#cc3"],a.titles=(h=c.titles)!=null?h:["","","","",""],a.values=(i=c.values)!=null?i:[],a.border=(j=c.border)!=null?j:!1,a.borderWidth=(k=c.borderWidth)!=null?k:2,a["class"]=(l=c["class"])!=null?l:"piechart",(m=(d=Raphael.fn).pieChart)==null&&(d.pieChart=bm)}var a;bT(b,bg),a=null,b.prototype.overlaps=function(b){var c,d,e,f,g,h,i,j,k,l;k=[a.x,a.y,a.radius],g=k[0],i=k[1],e=k[2],l=[b.x,b.y,b.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},b.prototype.render=function(b){var c;a=this,a.border!=null&&(c=a.layers.mapcanvas.circle(a.x,a.y,a.radius+a.borderWidth).attr({stroke:"none",fill:a.border})),a.chart=a.layers.mapcanvas.pieChart(a.x,a.y,a.radius,a.values,a.titles,a.colors,"none"),a.chart.push(c);return a},b.prototype.update=function(b){var c;return},b.prototype.clear=function(){var b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c180),0,h,j,"z"]).attr(f)},h=-270,o=0,l=function(e){var j,k,l,m,p,q,r;r=d[e],j=360*r/o,q=h+j*.5,k=f[e],m=500,l=30,p=n(a,b,c,h,h+j,{fill:k,stroke:g,"stroke-width":1}),p.mouseover(function(){p.stop().animate({transform:"s1.1 1.1 "+a+" "+b},m,"elastic")}),p.mouseout(function(){p.stop().animate({transform:""},m,"elastic")}),h+=j,i.push(p)};for(q=0,r=d.length;qh+f||g+ej+f||i+e(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b,c,d,e,f,g;d=this,e=d.width,c=d.height,f=d.x,g=d.y,b=d.layers.mapcanvas.rect(f-e*.5-2,g-c*.5-2,e+4,c+4).attr({stroke:"none",fill:"#fff"}),d.chart=d.layers.mapcanvas.drawStackedBarChart(d.x,d.y,d.width,d.height,d.values,d.titles,d.colors,"none"),d.chart.push(b);return d},a.prototype.update=function(){var a,b;a=this;return},a.prototype.clear=function(){var a,b,c,d,e;a=this,e=a.chart;for(c=0,d=e.length;c