/* 百度地图API V2 模块 * 此模块必须配套使用baidumap_offline_v2_20160822.js对 * 获取模块的方法: * http://api0.map.bdimg.com/getmodules?v=2.0&mod=模块1,模块2 * 模块名称就是文件名 * www.xiaoguo123.com 整理 */ _jsload2&&_jsload2('panorama', 'Fe.prototype.EC=ga(2,function(){this.Nb.style[ie]="";this.Ci=this.mi=q;this.Ev("h");this.Ev("v");this.Vd(we,window);this.Vd(xe);this.Vd(ye,window);this.Vd(ze,window);this.Vd(Ae,window);this.options.zk||(this.Vd("DOMMouseScroll"),this.Vd("mousewheel"));this.options.Bi&&this.Vd(Be);this.options.Bw&&clearInterval(this.tV);this.options.ZM&&this.options.ZM.call(this)});var ai=1; function bi(a,b){var c=a.width,d=a.height,e=180/Math.pow(2,b),f=1;G()&&(f=2);c=e/(1Uh&&(d*=Math.pow(2,f-Uh),f=Uh);f\\u51fa\\u53e3\';return c},B0:function(a, b){var c=K("div"),d=c.style;d.position="absolute";d.zIndex=1201;d.right=d.top="10px";d.width="17px";d.height="16px";d.background=\'url("\'+F.pa+\'st-close.png") no-repeat 50% 50%\';G()&&(d.right=d.top="0px",d.width="42.5px",d.height="40px",d.backgroundSize="25.5px 24px");d.cursor="pointer";c.title=a;c.onclick=b;d.display="none";return c},rc:function(a,b,c){"object"===typeof b&&(c=b,b=j);a!=this.Xa&&(this.ol=this.Xa,this.pl=this._position,this.Xa=a,this.qA=p,this.Ge=b||"street",c=c||{Wl:q},this.qJ=c.Wl, "inter"===b?this.rF(a):this.dispatchEvent(new N("onid_changed")),this.XZ(c))},XZ:function(a){this.uv={id:this.Yb(),pov:a.pov}},mX:function(a,b){var c,d;if(this.uv&&a===this.uv.id){c={};for(var e=0;ethis.Wj?a=this.Wj:aJd&&(a=Jd);ai-M.Tn.x&&10>k-M.Tn.y&&E.dispatchEvent(new N("ondblclick")),M.Tn=p):(M.Tn={x:i,y:k},M.Oi=setTimeout(function(){var a,b,c=E.KA;a=E.le;var d=0;for(b=0;a.offsetParent;)d+= a.offsetLeft,b+=a.offsetTop,a=a.offsetParent;a=i-d;b=k-b;Ma()&&(a*=2,b*=2);0===c.IL(a,b)&&E.dispatchEvent(new N("onclick"));M.Tn=p},400))),M.EA=q,d(a),C=y=q)}function d(a){if(a){var b=ab()-M.aI;if(!(100Math.abs(n)&&10>Math.abs(u))){var c;G()?(b=a.changedTouches[0].clientX,c=a.changedTouches[0].clientY):(b=a.clientX,c=a.clientY);a=new Q(i,k);c=new Q(b,c);var b=[0E.Wj&&(d=E.Wj);da.detail;var c=new Date;if(!(220>c-oa)&&(oa=c,"path"!=(a.srcElement||a.target).tagName)){var c=la(b,a),d=a.srcElement||a.target,e=a.offsetX||a.layerX||0,f=a.offsetY||a.layerY||0;1!=d.nodeType&&(d=d.parentNode);for(;d&&d!=E.Na();){d.ba&&(x.lang.Mc(d.ba)instanceof gb&&(overlay=x.lang.Mc(d.ba)),x.lang.Mc(d.ba)instanceof qc&&(infoWindow=x.lang.Mc(d.ba)));if(!(0==d.clientWidth&&0==d.clientHeight&&d.offsetParent&&"TD"==d.offsetParent.nodeName)&&"http://www.w3.org/2000/svg"!=d.namespaceURI)e+= d.offsetLeft||0,f+=d.offsetTop||0;else if("http://www.w3.org/2000/svg"==d.namespaceURI){var g=E.kg.ld&&E.kg.ld.cf||p;if(-1a&&(a=1);a=Math.round(100*a)/100;E.Oc(a,{sp:o})},q),E.le.addEventListener("gestureend",function(){J=q;E.fa()!=O&&E.dispatchEvent(new N("onpinchtozoomend"))},q)):(x.M(E.le,"mousedown",function(b){a(b.clientX||b.pageX||0,b.clientY||b.pageY||0);D=b.target||b.srcElement;x.ea.la&&D.setCapture&&D.setCapture();M.AT=E.le.style.cursor;E.le.style.cursor=F.Ed;x.ea.la||Bb(b)}),x.M(document,"mousemove",function(a){b((a.clientX||a.pageX||0)-i,(a.clientY||a.pageY|| 0)-k);na(a)}),x.M(document,"mouseup",function(a){ma(a);c(a);x.ea.la&&(D&&D.releaseCapture)&&D.releaseCapture();E.le.style.cursor=M.AT||F.Wb}));E.addEventListener("zoom_changed_inner",function(){M.Ju=pi(M)});E.addEventListener("size_changed",function(){M.Ju=pi(M)});var oa=new Date;x.M(E.Na(),"mousewheel",f);window.addEventListener&&E.Na().addEventListener("DOMMouseScroll",f,q)}}; function pi(a){if(!a.da)return p;var b=a.P,c=bi(b.gh(),b.fa()),d=c.VL,c=c.AK;if("cssRender"===b.Yq()&&!Ma())return 360/(a.da.tiles.ep(d)*c);b=a.P.fa();return 180/Math.pow(2,b)/a.P.gh().height};function ni(a,b){x.lang.Ba.call(this);this.P=a;this.za=b;this.Rh=[];this.Th={};this.aB=q;this.tz()}x.lang.ta(ni,x.lang.Ba,"PanoramaOverlayMgr"); x.extend(ni.prototype,{tz:function(){var a=this,b=this.P;b.addEventListener("add_overlay",function(c){c=c.overlay;c.qa(b);a.Rh.push(c);a.Cr()});b.addEventListener("dataload",function(){a.aB=o;a.Cr()});b.addEventListener("remove_overlay",function(b){for(var b=b.overlay,d=0,e=a.Rh.length;d=d[e].left&&c.left<=d[e].right||c.right>=d[e].left&&c.right<=d[e].right)return o;return q}var b={};return function(c){for(;a(c);)c.top+=-36;b[c.top]?b[c.top].push(c):b[c.top]=[c];return c}}(),d;for(d in this.Th)for(var e in this.Th[d]){var f=this.Th[d][e],g=this.rT(d,f.pov.pitch,a,b),f=f.dom,g=c({top:g[1],left:g[0],right:g[0]+f.offsetWidth});f.style.left=g.left-f.offsetWidth/2+"px";f.style.top=g.top+f.offsetHeight/2+"px"}},rT:function(a, b,c,d){if(Ma())return this.sT(a,b);var e=this.P;for(svHeading=e.Da().heading%360;0>svHeading;)svHeading=(svHeading+360)%360;var f=(a-svHeading)%360,a=e.gh(),c=360/(2*Math.pow(2,c-2)*d);180f&&(f+=360);d=Math.round(a.width/2+f/c);b=Math.round(a.height/2-(b-e.Da().pitch)/c);return[d,b]},sT:function(a,b){var c=500*Math.cos(Nb(b)),c=Math.round(100*c)/100;"string"==typeof a&&(a=parseFloat(a));var d;d=a+this.P.da.tiles.dirNorth;d%=360;var e=this.P.kg.Ud;d=Z.sg(Math.cos(Nb(d))*c,500*Math.sin(Nb(b)), Math.sin(Nb(d))*c,1);var c=Z.create(),f=e.Sh;qi.multiply(c,e.Ef[0],d);qi.multiply(c,f,c);if(0>c[3])return[-1E3,-1E3];e=this.P.bl;return[(c[0]/c[3]+1)/2*e.width,(1-c[1]/c[3])/2*e.height]},GT:function(){for(var a in this.Th)for(var b in this.Th[a]){var c=this.Th[a][b].dom;c.parentNode.removeChild(c)}this.Th={}}});x.extend(Nd.prototype,{qa:function(a){this.P=a;this.ha()||this.sa(this.P.ha());this.Mz();this.qz()},Hd:t("ed"),hide:function(){this.Pa=q;this.ed&&(this.ed.style.display="none")},show:function(){this.Pa=o;this.ed&&(this.ed.style.display="block")},isVisible:t("Pa"),EO:function(){var a=this.Un();100a?a.toFixed(2):a.toFixed(0),a+="\\u516c\\u91cc"):(a=100>a?a.toFixed(2):a.toFixed(0),a+="\\u7c73");this.Iq.innerHTML=a},Mz:function(){var a=this.uk(),b=K("div"),c=b.style;c.position="absolute"; c.backgroundColor="rgba(29, 29, 29, 0.8)";c.padding="7px 0";c.height="19px";c.font="16px arial";c.color="white";c.whiteSpace="nowrap";c.borderRadius="4px";c.left="-1000px";c.top="-1000px";c=K("div");c.style["float"]="left";c.style.lineHeight="19px";b.appendChild(c);var d=K("span");d.style.margin="0 14px";d.innerHTML=a;c.appendChild(d);a=K("span");a.style.color="color:rgba(255,255,255,0.3)";a.innerHTML="|";c.appendChild(a);var e=K("span");e.style.margin="0 8px";e.style.color="#60c7fa";e.style.fontSize= "12px";e.innerHTML="0\\u7c73";c.appendChild(e);this.$Q===q&&(e.style.display="none",a.style.display="none");this.ed=b;this.Iq=e;this.Sr=d},qz:function(){var a=this;this.BQ(this.ed,function(b){a.dispatchEvent(new N("onclick"),{type:"click",target:a});Bb(b)});x.M(this.ed,"mouseenter",function(){a.dispatchEvent(new N("onmouseover"),{type:"mouseover",target:a})});x.M(this.ed,"mouseleave",function(){a.dispatchEvent(new N("onmouseout"),{type:"mouseout",target:a})})},BQ:function(a,b){if(G()){var c=0,d=0, e=0;a.addEventListener("touchstart",function(a){c=(new Date).getTime();d=a.touches[0].pageX;e=a.touches[0].pageY},q);a.addEventListener("touchend",function(a){200<=(new Date).getTime()-c||(5<=Math.abs(a.changedTouches[0].pageX-d)||5<=Math.abs(a.changedTouches[0].pageY-e))||b.call(this,a)},q)}else x.M(this.ed,"click",b)},If:function(a,b){this.ed&&("content"===a&&(this.Sr.innerHTML=b),this.P.dispatchEvent(new N("onoverlay_property_changed")))},remove:function(){this.ed=this.Iq=this.Sr=p;this.dispatchEvent(new N("onremove"), {type:"remove",target:this})}});x.extend(Qd.prototype,{qa:function(a){this.P=a;this.Mz();(a=this.RD())&&(a.panoId||a.panoIId)&&this.qz(a)},Hd:t("ed"),hide:function(){this.Pa=q;this.ed.style.display="none"},show:function(){this.Pa=o;this.ed.style.display="block"},isVisible:t("Pa"),EO:function(){var a=this.P.ha(),b=this.ha(),a=R.Vo(a,b);100a?a.toFixed(2):a.toFixed(0),a+="\\u516c\\u91cc"):(a=100>a?a.toFixed(2):a.toFixed(0),a+="\\u7c73");this.Iq.innerHTML=a},qz:function(a){var b=this;if(a.panoIId){var c=function(c){b.P.rF(a.panoIId); c.stopPropagation();c.preventDefault()};G()?x.M(this.Zq,"touchend",function(a){c(a)}):(this.Zq.style.cursor="pointer",x.M(this.Zq,"click",function(a){c(a)}))}if(a.panoId){var d=function(c){function d(){b.P.Nc(b.Da());b.P.removeEventListener("dataload",d)}var g=a.panoId;b.P.Yb()!=g&&(b.P.rc(g),b.P.addEventListener("dataload",d));c.stopPropagation();c.preventDefault()};x.M(this.ed,"touchend",function(a){d(a)});this.ed.style.cursor="pointer";x.M(this.ed,"click",function(a){d(a)})}},Mz:function(){var a= this.dp(),b=K("div"),c=b.style;c.position="absolute";c.backgroundColor="rgba(29, 29, 29, 0.8)";c.padding="7px 0";c.height="19px";c.font="16px arial";c.color="white";c.whiteSpace="nowrap";c.borderRadius="4px";c.left="-1000px";c.top="-1000px";var d=K("img");d.src=this.Wo();d.style.width="24px";d.style.height="24px";d.style.position="absolute";d.style.left="5px";d.style.top="5px";c.paddingLeft="40px";b.appendChild(d);c=K("div");c.style["float"]="left";c.style.lineHeight="19px";b.appendChild(c);var e= K("span");e.style.margin="0 14px";e.innerHTML=a;c.appendChild(e);a=K("span");a.style.color="color:rgba(255,255,255,0.3)";a.innerHTML="|";c.appendChild(a);a=K("span");a.style.margin="0 8px";a.style.color="#60c7fa";a.style.fontSize="12px";a.innerHTML="0\\u7c73";c.appendChild(a);this.ed=b;this.Zq=d;this.Iq=a;this.Sr=e},If:function(a,b){switch(a){case "title":this.Sr.innerHTML=b;break;case "altitude":this.P.dispatchEvent(new N("onoverlay_position_changed"));break;case "position":this.P.dispatchEvent(new N("onoverlay_position_changed"))}}, remove:function(){this.Sr=this.Iq=this.Zq=this.ed=p;this.dispatchEvent(new N("onremove"),{type:"remove",target:this})}});x.extend(function(a){this.Ri(a)}.prototype,{Ri:function(a){this.P=a;this.to=this.so=o;this.za();this.ca()},za:function(){this.B=K("div");var a=this.B.style;a.position="absolute";a.left="10px";a.top="10px";a.zIndex=1201;a=this.B;a.innerHTML=this.Rq();Ta()?(this.kd=x.$(a.children[2]),this.eo=[x.$(this.kd.children[0]),x.$(this.kd.children[1]),x.$(this.kd.children[2]),x.$(this.kd.children[3])],Lb()?this.hJ=x.$(a.children[1].childNodes[0]):Kb()&&(this.sJ=x.$(a.children[1].childNodes[0])),this.Xd=x.$(a.children[3])): G()&&(this.Xd=x.$(a.children[0]));this.Dh=x.$(this.Xd.children[0]);this.ag=x.$(this.Xd.children[1]);x.ea.la&&(this.kd.style.background=\'url("\'+F.pa+\'blank.gif") repeat\');6==x.ea.la&&this.ST();G()&&(this.Xd.style.left=this.Xd.style.top="0",this.Xd.style.width="36px",this.Xd.style.height="78px",this.Dh.style.width=this.ag.style.width="33px",this.Dh.style.height=this.ag.style.height="36px",this.ag.style.top="37.5px");this.P.fa()==Jd&&this.ko("zoomIn",q);this.P.fa()==Kd&&this.ko("zoomOut",q);this.P.Na().appendChild(a)}, Rq:function(){var a=[];Ta()&&(a.push(this.$z()),a.push(this.GR()),a.push(this.IR()));a.push(this.aA());return a.join("")},GR:function(){if(Lb())return\'\'; if(Kb())return\'
\'}, $z:function(){return\'
\'},IR:function(){return\'
\'}, aA:function(){var a="background-image:url(\'"+F.pa+"st-navictrl.png\');background-repeat:no-repeat;background-position:-74px 0;";G()&&(a="background-image:url(\'"+F.pa+"st-navictrl-hd.png\');background-repeat:no-repeat;background-position:0 0;background-size:180px 78px;");return\'
\'}, ca:function(){var a=this.P,b=this;if(Ta()){x.M(this.eo[0],"click",function(){var b=a.Da();a.xy({heading:b.heading,pitch:b.pitch+30})});x.M(this.eo[1],"click",function(){var b=a.Da();a.xy({heading:b.heading-45,pitch:b.pitch})});x.M(this.eo[2],"click",function(){var b=a.Da();a.xy({heading:b.heading+45,pitch:b.pitch})});x.M(this.eo[3],"click",function(){var b=a.Da();a.xy({heading:b.heading,pitch:b.pitch-30})});for(var c=0;cb?90-b:450-b},ko:function(a,b){var c=this.Xd.children[2];if("zoomIn"==a)if(b)if(this.so= o,this.Dh.style.cursor="pointer",6==x.ea.la)c.style.left="-74px";else{var d=-74;G()&&(d=0);this.Xd.style.backgroundPosition=d+"px 0"}else this.so=q,this.Dh.style.cursor="",6==x.ea.la?c.style.left="-170px":(d=-170,G()&&(d=-144),this.Xd.style.backgroundPosition=d+"px 0");"zoomOut"==a&&(b?(this.to=o,this.ag.style.cursor="pointer",6==x.ea.la?c.style.left="-74px":(d=-74,G()&&(d=0),this.Xd.style.backgroundPosition=d+"px 0")):(this.to=q,this.ag.style.cursor="",6==x.ea.la?c.style.left="-146px":(d=-146,G()&& (d=-108),this.Xd.style.backgroundPosition=d+"px 0")))}});function ri(a,b){this.yB=a;this.We=[];this.oc={Eo:p};var b=b||{},c;for(c in b)this.oc[c]=b[c]}ri.prototype.setData=function(a,b){if(0!==this.yB){if(this.We.length>this.yB){for(var c=Math.round(0.6*this.yB),d=0;da;a++){this.vi[a]= [];for(b=0;8>b;b++){var c=new wi(this.P);c.yM=a;c.zM=b;c.canvas=this.Wc;this.vi[a][b]=c}}this.P.r1=this.Wc},ua:function(a,b){if(a&&b){var c=a.heading%360,d=a.pitch;this.kA({heading:c,pitch:d},b);this.Wc.hi({heading:c,pitch:d},b)}},OS:function(a,b){this.Wc.WV();this.JR(this.da);this.Wc.QX(this.da);this.MI(a,b);this.iA(b,o)},Oc:function(a,b){var c=this,d=o;b==this.Wc.ra.zoom&&(d=q);this.MI(a,b);d&&this.iA(b,o);setTimeout(function(){c.kA()},1E3)},JR:function(a){var b=this,c=a.tiles,d={se:[]};d.se[0]= new Image;d.se[0].src=c.getTilesUrl(a.id,{x:0,y:0},2);d.se[1]=new Image;d.se[1].src=c.getTilesUrl(a.id,{x:1,y:0},2);b.QO=0;d.se[0].onload=function(){b.Sx()};d.se[1].onload=function(){b.Sx()};this.PJ[0]=d},Sx:function(){this.QO++;2==this.QO&&(this.Wc.c_(this.PJ[0].se),this.Wc.Sx())},kA:function(a,b){if(this.da&&this.da.tiles)for(var c=this.da.tiles,d=[],b=b||this.Wc.ra.zoom,d=this.vi,e=this.Wc.BD(a),f=e.nu,g=e.ys,i=e.nt,e=e.Ht,e=e>i?e-i:64+e-i,k=0,l=0,m=0;mk&&(k+=64);k=Math.floor(k*Math.pow(2,b-7));l=Math.floor(n*Math.pow(2,b-7));if(kk?g-k:64+g-k,m=0,n=0,g=0;gm&&(m+=64);m=Math.floor(m*Math.pow(2,a-7));n=Math.floor(i*Math.pow(2,a-7));if(mMath.PI/2+0.1&&(b=2*Math.PI/3);return a.a/ 2/Math.tan(b/2)},Ik:function(a,b,c){var d=this.ra;d.a=c.width;d.Za=c.height;this.pg.canvas.width=c.width;this.pg.canvas.height=c.height;d.zoom=a;d.Ep=b;d.Aa=this.hx();d.dd=16*Math.pow(2,a-2);d.Et=Math.pow(2,a-1);d.Vm=Math.pow(2,a-2);d.yp=Math.pow(2,7-a)},vZ:function(a,b){var c=this.ra;if(0==this.ra.Aa)c.zoom=b,c.Ep=a,c.Aa=this.hx(),c.dd=16*Math.pow(2,b-2),c.Et=Math.pow(2,b-1),c.Vm=Math.pow(2,b-2),c.yp=Math.pow(2,7-b),c.Vp=c.Ao*Math.pow(2,-a);else if(!(a==c.Ep&&b==c.zoom)){this.Ul=o;var d=this.ra.Aa; c.dd=16*Math.pow(2,b-2);c.zoom=b;c.Ep=a;c.Et=Math.pow(2,b-1);c.Vm=Math.pow(2,b-2);c.yp=Math.pow(2,7-b);d=(this.hx()-d)/32;this.P.Ak();this.zJ(0,d);c.Vp=c.Ao*Math.pow(2,-a)}},QX:function(a){this.ra.heading-=this.ra.Mf/180*Math.PI;this.ra.Mf=a.tiles.dirNorth;this.ra.heading+=a.tiles.dirNorth/180*Math.PI;this.ra.$r=a.tiles.pitch||0},zJ:function(a,b){var c=this;if(5>a)this.ra.Aa+=b*Math.pow(2,a),this.qR(),setTimeout(function(){c.zJ(a+1,b)},0);else if(5==a){this.Ul=q;var d=this.ra.zoom;this.ra.Aa=this.hx(); this.ra.dd=16*Math.pow(2,d-2);this.ra.Et=Math.pow(2,d-1);this.ra.Vm=Math.pow(2,d-2);this.ra.yp=Math.pow(2,7-d);this.P.Cy();this.refresh()}},A3:function(a,b){this.Ul=o;var c=this.ra;this.ME={data:a,XU:b};this.ME.nd=0;var d=Math.cos((a.dir+c.Mf)/180*Math.PI),c=-Math.sin((a.dir+c.Mf)/180*Math.PI),c=d=0;this.P.Ak();this.lR({index:1,C1:d,D1:c})},oW:function(a,b){if(!this.Ul&&this.dt)if(1i?i=0.4:0.98m&&(m=q);m=g*g/m;g=m*k-b;k=m*i-a;l=m*l-f;m=Math.pow(g,2)+Math.pow(k,2)+Math.pow(l,2);i=Math.sqrt(m);0==m?d=e=0:(m=(g*d+l*e)/i,1m&&(m=-1),m=Math.acos(m), 0>g*e*a+k*d*f-k*e*b-l*a*d&&(m=2*Math.PI-m),e=i*Math.cos(m),d=i*Math.sin(m));return{x:c.a/2+e,y:c.Za/2-d}},IK:function(a,b,c,d,e,f){var g=this.pg,i=0,k=0,l=0,m=0,n=this.ra.Vp;d&&(1==d?k=n:-1==d&&(i=n));e&&(-1==e?l=n:1==e&&(m=n));d=this.ra.Rm;i=this.Dn(a.ob,b,c,-d-i,l,f);if(!i)return q;l=this.Dn(a.pb,b,c,d+k,d+l,f);if(!l)return q;c=this.Dn(a.qb,b,c,k,-d-m,f);if(!c)return q;c={ob:i,pb:l,qb:c};f=c.ob;k=c.pb;m=c.qb;g.save();g.beginPath();g.moveTo(f.x,f.y);g.lineTo(k.x,k.y);g.lineTo(m.x,m.y);g.closePath(); g.clip();a=this.yk(a,c);g.transform(a[0],a[1],a[2],a[3],a[4],a[5]);g.drawImage(this.Hk[b],0,0);g.restore()},HK:function(a,b,c,d,e,f){var g=this.pg,i=0,k=0,l=0,m=0,n=this.ra.Vp;d&&(1==d?k=n:-1==d&&(i=n));e&&(-1==e?l=n:1==e&&(m=n));d=this.ra.Rm;l=this.Dn(a.ob,b,c,-i,d+l,f);if(!l)return q;i=this.Dn(a.pb,b,c,-d-i,-d-m,f);if(!i)return q;c=this.Dn(a.qb,b,c,d+k,-m,f);if(!c)return q;c={ob:l,pb:i,qb:c};f=c.ob;k=c.pb;m=c.qb;g.save();g.beginPath();g.moveTo(f.x,f.y);g.lineTo(k.x,k.y);g.lineTo(m.x,m.y);g.closePath(); g.clip();a=this.yk(a,c);g.transform(a[0],a[1],a[2],a[3],a[4],a[5]);g.drawImage(this.Hk[b],0,0);g.restore()},WV:function(){this.dt=q;this.P.Ak()},Sx:function(){this.dt=o;this.refresh();this.P.Cy()},hi:function(a){if(this.dt&&!this.Ul){var b=this.ra;b.pitch=a.pitch/180*Math.PI-b.$r/180*Math.PI;b.heading=(a.heading+b.Mf)/180*Math.PI;b.heading>2*Math.PI?b.heading-=2*Math.PI:0>b.heading&&(b.heading+=2*Math.PI);a=b.dd;this.pg.clearRect(0,0,b.a,b.Za);var c=b.bound,d=c.nu,e=c.ys,f=c.nt,c=c.Ht,c=c>f?c-f:64+ c-f,g=b.yp,i=b.Sp,k=Math.cos(b.pitch),l=Math.cos(b.heading),m=Math.sin(b.heading),n=b.Aa*Math.sin(b.pitch),u=b.Aa*k*m;b.iq=-b.Aa*k*l;b.jq=n;b.kq=u;b.cs=l;b.Wt=m;for(k=0;ku&&(u+=64);var m=Math.floor(u/g),n=Math.floor(l/g),u=u%g,v=l%g,w={ob:{x:u*a,y:v*a-i},pb:{x:u*a-i,y:v*a+a+i},qb:{x:u*a+a+i,y:v*a+a}},y={ob:{x:u*a-i,y:v*a},pb:{x:u*a+a+i,y:v*a-i},qb:{x:u*a+a,y:v*a+a+i}};if(0==u)var C=-1;else u==g-1&&(C=1);if(0==v)var A=-1;else v==g-1&&(A=1);this.ZC(w,m,n,b.zoom, C,A);this.$C(y,m,n,b.zoom,C,A)}}},refresh:function(){if(this.dt&&!this.Ul){var a=this.ra,b=a.dd;this.pg.clearRect(0,0,a.a,a.Za);var c=this.BD(),d=c.nu,e=c.ys,f=c.nt,c=c.Ht,c=c>f?c-f:64+c-f,g=a.yp,i=Math.cos(a.pitch),k=Math.cos(a.heading),l=Math.sin(a.heading),m=a.Aa*Math.sin(a.pitch),n=a.Aa*i*l;a.iq=-a.Aa*i*k;a.jq=m;a.kq=n;a.cs=k;a.Wt=l;i=a.Sp;for(k=0;ku&&(u+=64);var m=Math.floor(u/g),n=Math.floor(l/g),u=u%g,v=l%g,w={ob:{x:u*b,y:v*b-i},pb:{x:u*b-i,y:v* b+b+i},qb:{x:u*b+b+i,y:v*b+b}},y={ob:{x:u*b-i,y:v*b},pb:{x:u*b+b+i,y:v*b-i},qb:{x:u*b+b,y:v*b+b+i}};if(0==u)var C=-1;else u==g-1&&(C=1);if(0==v)var A=-1;else v==g-1&&(A=1);this.ZC(w,m,n,a.zoom,C,A);this.$C(y,m,n,a.zoom,C,A)}}},qR:function(){var a=this.ra;this.pg.clearRect(0,0,a.a,a.Za);var b=a.Sp,c=Math.cos(a.pitch),d=Math.cos(a.heading),e=Math.sin(a.heading),f=a.Aa*Math.sin(a.pitch),g=a.Aa*c*e;a.iq=-a.Aa*c*d;a.jq=f;a.kq=g;a.cs=d;a.Wt=e;for(a=0;16>a;a++)for(c=0;16>c;c++){d={ob:{x:32*a,y:32*c-b},pb:{x:32* a-b,y:32*c+32+b},qb:{x:32*a+32+b,y:32*c+32}};e={ob:{x:32*a-b,y:32*c},pb:{x:32*a+32+b,y:32*c-b},qb:{x:32*a+32,y:32*c+32+b}};if(0==a)var i=-1;else 15==a&&(i=1);if(0==c)var k=-1;else 15==c&&(k=1);this.HK(d,0,2,i,k);this.IK(e,0,2,i,k);this.HK(d,1,2,i,k);this.IK(e,1,2,i,k)}},ED:function(a,b){var c=this.ra,d=a-c.a/2,e=c.Za/2-b,f=c.pitch+c.$r/180*Math.PI,g=c.heading-c.Mf/180*Math.PI,i=-c.Aa*Math.cos(f)*Math.cos(g),k=c.Aa*Math.sin(f),l=c.Aa*Math.cos(f)*Math.sin(g),m=d*Math.sin(g),d=d*Math.cos(g),n=e*Math.sin(f)* Math.cos(g),e=e*Math.cos(f),i=i+m+n,k=k+e,e=l+d+-e*Math.sin(f)*Math.sin(g),f=this.Da(i,k,e);if(22*Math.PI?b.heading-=2*Math.PI:0>b.heading&&(b.heading+=2*Math.PI),b.pitch=a.pitch/180*Math.PI-b.$r/180*Math.PI);var c=Math.cos(b.pitch),d=Math.sin(b.pitch),e=Math.cos(b.heading),f=Math.sin(b.heading), a=-b.Aa*c*e,g=b.Aa*d,i=b.Aa*c*f,k=b.Za/2*d*e,l=b.Za/2*c,m=-b.Za/2*d*f,n=-b.Za/2*d*e,c=-b.Za/2*c,d=b.Za/2*d*f,u=-b.a/2*f,v=-b.a/2*e,f=b.a/2*f,e=b.a/2*e;if(0Math.PI/2?(D=0,y=y.pitchB.pitch? D.pitch:B.pitch,D=Math.floor(32*(Math.PI/2-y)/Math.PI),y=32):0C.pitch?C.pitch:y.pitch,y=Math.ceil(32*(Math.PI/2-y)/Math.PI)):(y=D.pitch>B.pitch?D.pitch:B.pitch,D=Math.floor(32*(Math.PI/2-y)/Math.PI),y=Math.ceil(32*(Math.PI/2-b.pitch+a)/Math.PI));Math.abs(b.pitch)>=Math.PI/2-a?(A=0,w=64):0w.heading?Math.ceil(32*(2*b.heading-w.heading)/Math.PI):Math.ceil(32*(2*b.heading+2*Math.PI- w.heading)/Math.PI)):(w=Math.ceil(32*A.heading/Math.PI),A=b.heading>A.heading?Math.floor(32*(2*b.heading-2*Math.PI-A.heading)/Math.PI):Math.floor(32*(2*b.heading-A.heading)/Math.PI));0>A&&(A+=64);64D&&(D=0);b.bound={nu:D,ys:y,nt:A,Ht:w};return{nu:D,ys:y,nt:A,Ht:w}},ZC:function(a,b,c,d,e,f){if(2==this.vi[b][c].jm){var g=this.pg,i=0,k=0,l=0,m=0,n=this.ra.Vp;e&&(1==e?k=n:-1==e&&(i=n));f&&(-1==f?l=n:1==f&&(m=n));e=this.ra.Rm;l=this.ig(a.ob,b,c,d,0,-i,e,l);if(!l)return q;i=this.ig(a.pb, b,c,d,-e,-i,-e,-m);if(!i)return q;d=this.ig(a.qb,b,c,d,e,k,0,-m);if(!d)return q;d={ob:l,pb:i,qb:d};k=d.ob;m=d.pb;i=d.qb;g.save();g.beginPath();g.moveTo(k.x,k.y);g.lineTo(m.x,m.y);g.lineTo(i.x,i.y);g.closePath();g.clip();a=this.yk(a,d);g.transform(a[0],a[1],a[2],a[3],a[4],a[5]);g.drawImage(this.vi[b][c].se,0,0)}else{g=this.pg;m=l=k=i=0;n=0.0078125;e&&(1==e?k=n:-1==e&&(i=n));f&&(-1==f?l=n:1==f&&(m=n));e=0.0078125;l=this.ig(a.ob,b,c,d,0,-i,e,l);if(!l)return q;i=this.ig(a.pb,b,c,d,-e,-i,-e,-m);if(!i)return q; d=this.ig(a.qb,b,c,d,e,k,0,-m);if(!d)return q;d={ob:l,pb:i,qb:d};k=d.ob;m=d.pb;i=d.qb;g.save();g.beginPath();g.moveTo(k.x,k.y);g.lineTo(m.x,m.y);g.lineTo(i.x,i.y);g.closePath();g.clip();k=a.ob;m=a.pb;i=a.qb;l=this.ra.Vm;e=512*b;c*=512;b>=l?(a.ob={x:(e+k.x)/l-512,y:(c+k.y)/l},a.pb={x:(e+m.x)/l-512,y:(c+m.y)/l},a.qb={x:(e+i.x)/l-512,y:(c+i.y)/l},a=this.yk(a,d),g.transform(a[0],a[1],a[2],a[3],a[4],a[5]),g.drawImage(this.Hk[1],0,0)):(a.ob={x:(e+k.x)/l,y:(c+k.y)/l},a.pb={x:(e+m.x)/l,y:(c+m.y)/l},a.qb= {x:(e+i.x)/l,y:(c+i.y)/l},a=this.yk(a,d),g.transform(a[0],a[1],a[2],a[3],a[4],a[5]),g.drawImage(this.Hk[0],0,0))}g.restore()},$C:function(a,b,c,d,e,f){if(2==this.vi[b][c].jm){var g=this.pg,i=0,k=0,l=0,m=0,n=this.ra.Vp;e&&(1==e?k=n:-1==e&&(i=n));f&&(-1==f?l=n:1==f&&(m=n));e=this.ra.Rm;i=this.ig(a.ob,b,c,d,-e,-i,0,l);if(!i)return q;l=this.ig(a.pb,b,c,d,e,k,e,l);if(!l)return q;d=this.ig(a.qb,b,c,d,0,k,-e,-m);if(!d)return q;d={ob:i,pb:l,qb:d};k=d.ob;m=d.pb;l=d.qb;g.save();g.beginPath();g.moveTo(k.x,k.y); g.lineTo(m.x,m.y);g.lineTo(l.x,l.y);g.closePath();g.clip();a=this.yk(a,d);g.transform(a[0],a[1],a[2],a[3],a[4],a[5]);g.drawImage(this.vi[b][c].se,0,0)}else{g=this.pg;m=l=k=i=0;n=0.0078125;e&&(1==e?k=n:-1==e&&(i=n));f&&(-1==f?l=n:1==f&&(m=n));e=0.0078125;i=this.ig(a.ob,b,c,d,-e,-i,0,l);if(!i)return q;l=this.ig(a.pb,b,c,d,e,k,e,l);if(!l)return q;d=this.ig(a.qb,b,c,d,0,k,-e,-m);if(!d)return q;d={ob:i,pb:l,qb:d};k=d.ob;m=d.pb;l=d.qb;g.save();g.beginPath();g.moveTo(k.x,k.y);g.lineTo(m.x,m.y);g.lineTo(l.x, l.y);g.closePath();g.clip();k=a.ob;m=a.pb;l=a.qb;i=this.ra.Vm;e=512*b;c*=512;b>=i?(a.ob={x:(e+k.x)/i-512,y:(c+k.y)/i},a.pb={x:(e+m.x)/i-512,y:(c+m.y)/i},a.qb={x:(e+l.x)/i-512,y:(c+l.y)/i},a=this.yk(a,d),g.transform(a[0],a[1],a[2],a[3],a[4],a[5]),g.drawImage(this.Hk[1],0,0)):(a.ob={x:(e+k.x)/i,y:(c+k.y)/i},a.pb={x:(e+m.x)/i,y:(c+m.y)/i},a.qb={x:(e+l.x)/i,y:(c+l.y)/i},a=this.yk(a,d),g.transform(a[0],a[1],a[2],a[3],a[4],a[5]),g.drawImage(this.Hk[0],0,0))}g.restore()},ig:function(a,b,c,d,e,f,g,i){d=this.ra; b=2*(1/d.Et*a.x/512+b/d.Et)*Math.PI;c=(0.5-1/d.Vm*a.y/512-c/d.Vm)*Math.PI;a=Math.sin(Math.abs(c));0.4>a?a=0.4:0.98m)return q;k=k*k/m;a=k*a-f;c=k*c-g;l=k*l-i;m=Math.pow(a,2)+Math.pow(c,2)+Math.pow(l,2);k=Math.sqrt(m);0==m?e=b=0:(m=(a*e+l*b)/k,1m&&(m=-1),m=Math.acos(m),0>a*b*g+c*e*i-c*b*f-l*g*e&&(m=2*Math.PI-m),b=k*Math.cos(m),e= k*Math.sin(m));return{x:d.a/2+b,y:d.Za/2-e}},tX:function(a){var b=this.P.ha();if(b){var c=this.ra,d=c.heading,e=c.Aa,f=c.pitch+c.$r/180*Math.PI,d=d-c.Mf/180*Math.PI,g=6378137*-(a.lat-b.lat)/180*Math.PI,i=6378137*(a.lng-b.lng)/180*Math.PI,a=Math.sqrt(Math.pow(g,2)+Math.pow(i,2)),k=Math.cos(f),b=Math.cos(d),d=Math.sin(d),l=-e*k*b,f=e*Math.sin(f),k=e*k*d,m=l*g+-2.08*f+i*k;if(0>m)return q;var m=e*e/m,g=m*g-l,e=-2.08*m-f,m=m*i-k,n=Math.pow(g,2)+Math.pow(e,2)+Math.pow(m,2),i=Math.sqrt(n);0==n?d=b=0:(n= (g*d+m*b)/i,1n&&(n=-1),n=Math.acos(n),0>g*b*f+e*d*k-e*b*l-m*f*d&&(n=2*Math.PI-n),b=i*Math.cos(n),d=i*Math.sin(n));return{x:c.a/2+b,y:c.Za/2-d,Aa:a}}return q},Da:function(a,b,c){var d=Math.pow(a,2),e=Math.pow(c,2);return{heading:0e&&(i-=c);k=Math.round(f/2-k%m/g);var v,w;this.fB&&(v=this.fB+this.AI,w=Math.round(u-v%m/g),v=Math.floor(v/m));v&&0>v&&(w-=c);m=d-Math.ceil(k/c);u=d+Math.ceil((f-k-c)/c);m=0>m?0:m;var u=u>l-1?l-1:u,y=e+Math.ceil((n-i-c)/c);l=[];for(var C={},c=e-Math.ceil(i/c);c<=y;c++)for(var A=m;A<=u;A++)l.push([c,A]),C[this.zq(this.da.id,c,A,b)]=o;for(B in this.Wg)if(!C[B]&& !this.lo[B]&&(c=this.Wg[B]))c.style.display="none";this.vv+=l.length;l.sort(function(a){return function(b,c){return 0.4*Math.abs(b[0]-a[0])+0.6*Math.abs(b[1]-a[1])-(0.4*Math.abs(c[0]-a[0])+0.6*Math.abs(c[1]-a[1]))}}([e,d]));for(c=0;ca-d[0]?(c.style.left=a+"px",m.style.left=parseInt(c.style.left)-d[0]+"px"):0<=a-d[0]?(m.style.left=a-d[0]+"px",c.style.left=parseInt(m.style.left)-d[0]+"px"):a+d[0]a+d[0]?(m.style.left=a+d[0]+"px",c.style.left=parseInt(m.style.left)+d[0]+"px"):(c.style.left=a+"px",m.style.left=a+d[0]+"px")},oU:function(a,b,c,d,e,f,g,i,k){var l=this.da.tiles,m=this.Xg,n=l.ep(c),u=this.lo[this.zq(this.Bl,a,b,c)];u&&(u=u.style,u.top=Math.round((b-e)*m+g)+"px",u.left=Math.round((a-(i||d))*m+(k||f))+"px",u.width=u.height=Math.ceil(m)+"px");var i=this.zq(this.da.id,a,b,c),v=this.Wg[i];if(v)l=v.style,l.top=Math.round((b-e)*m+ g)+"px",l.left=Math.round((a-d)*m+f)+"px",l.width=l.height=Math.ceil(m)+"px",l.zIndex="2",l.display="",this.vf(),v.EB.x=a,v.EB.y=b;else{v=this.rA.jx();v.setAttribute("errorCount",0);for(k=a;0>k;)k=n+k;var w=l.getTilesUrl(this.da.id,new Q((k+n)%n,b),c),y=this;v.onload=function(){y.vf();y.Xh.appendChild(this);v.style.opacity="1"};v.onerror=function(){var a=this,b=a.getAttribute("errorCount");if(b<3){b++;setTimeout(function(){a.src=w},100);a.setAttribute("errorCount",b)}else y.vf()};l=v.style;l.position= "absolute";l.zIndex="2";l.border="none";l.display="";l.WebkitUserSelect="none";l.WebkitUserDrag="none";l.width=l.height=Math.ceil(m)+"px";l.top=Math.round((b-e)*m+g)+"px";l.left=Math.round((a-d)*m+f)+"px";l.opacity="0";l.hc=l.WebkitTransition="opacity 300ms ease-out";v.src=w;0(new Date).valueOf()-b.LE&&(b.Rx&&b.P.k.visible)&&b.click();b.LE=0});x.M(a,"mousemove",function(a){b.DZ(a.offsetX||a.layerX||0,a.offsetY||a.layerY||0);b.PZ(a.offsetX|| a.layerX||0,a.offsetY||a.layerY||0)});x.ea.rg?x.M(a,"mouseout",function(a){var c=a.clientX||a.pageX||0,a=a.clientY||a.pageY||0,c=c-b.sI,a=a-b.tI;(40>Math.abs(Math.abs(c-b.Uu/2)-b.Uu/2)||40>Math.abs(Math.abs(a-b.Vu/2)-b.Vu/2))&&b.cD.setAttribute("visibility","hidden")}):x.M(a,"mouseout",function(){b.cD.setAttribute("visibility","hidden")});b.P.addEventListener("hide_ellipse",function(){b.vt=o});b.P.addEventListener("show_ellipse",function(){b.vt=q})},Kz:function(){var a=K("canvas"),b=this.P,c=b.Na().clientWidth, d=b.Na().clientHeight;this.Wa=a;a.width=c;a.height=d;var e=a.style;e.position="absolute";e.top=e.left="0";e.width=c+"px";e.height=d+"px";e.v0="rgba(0, 0, 0, 0)";b.Vj.appendChild(a);return a},SQ:function(){var a=this.P.Na(),b=a.clientWidth,a=a.clientHeight;return zb(this.P.Vj,[\'\',""].join(""))},ca:function(){var a= this,b=a.P;b.addEventListener("size_changed",function(b){b=b.size;a.xe(b.width,b.height);a.Pd={}});b.addEventListener("zoom_changed_inner",function(){a.Pd={}})},xe:function(a,b){if(Lb())this.YI(a,b);else if(Mb()){var c=this.Wa;c.width=a;c.height=b;c.style.width=a+"px";c.style.height=b+"px"}},YI:function(a,b){this.cf&&(this.cf.setAttribute("width",a+"px"),this.cf.setAttribute("height",b+"px"),this.cf.setAttribute("viewBox","0 0 "+a+" "+b),this.Uu=a,this.Vu=b)},setData:ba("da"),ua:function(a,b,c,d){if(this.da){this.Ca= a;this.Lc=b;this.Xg=c;var e=(a.heading+360)%360,a=a.pitch,f=this.P,g=this.da.tiles,i,k,l;this.Pd[this.da.id]?(c=this.Pd[this.da.id],i=c.qC,k=c.pC,c=c.ai):(i=f.Na().clientWidth,k=f.Na().clientHeight,l=g.ep(b),b=g.yx(b),c=360/(l*c),this.Pd[this.da.id]={qC:i,pC:k,sO:l,uO:b,zK:360/l,ai:c});f=f.fa()+1;f=0.75*k+1*(a/c)/f;fa- -30?g+Math.tan(Nb(a- -30)):g+ 6),g=-Math.sin(Nb(Math.min(a,-30)))/g,this.aw.coordorigin=Math.round(-i/2)+","+Math.round(-f+40),this.dR(l,b,g))}}else Lb()?this.CI(p,[]):(this.Ih.clearRect(0,0,this.Wa.width,this.Wa.height),this.Wn.length=0)},CI:function(a,b){if(a!=this.Xa){this.Xa=a;linksCount=b.length;if(linksCount>this.$f.length){for(var c=linksCount-this.$f.length,d=this.cf,e=0;eMath.abs(a-this.Wn[c][0])&&30>Math.abs(b-this.Wn[c][1]))return c;return-1},zT:function(a,b){if(a!=this.Xa){this.Xa=a;linksCount=b.length;if(linksCount> this.$f.length)for(var c=linksCount-this.$f.length,d=0;d\'].join("")); this.uq.push(g);this.OG.push(g.getElementsByTagName("skew")[0]);g=zb(this.aw,["\'].join(""));this.$f.push(g);this.PG.push(g.getElementsByTagName("skew")[0]); e=[];f=Ai;for(g=0;g\',\'\'].join("")),i=this;x.M(g,"click",function(a){(a=a.srcElement.sid)&&i.P.rc(a)});this.jl.push(g);this.PH.push(g.getElementsByTagName("skew")[0])}for(d= 0;dc?360+c-b[f].dir:360-c+b[f].dir:Math.abs(e),ed&&(b=this.P.ha(),this.P.sa(new H(b.lng+180*a.zG/Math.PI/6378137,b.lat-180*a.yG/Math.PI/6378137)))}}},CZ:function(a,b){this.mW=a;this.FK=b},DZ:ba("KY"),PZ:function(a,b){this.pK=coord=this.P.ra.ED(a,b);var c= this.cD;if(coord&&!this.vt&&this.P.k.visible){c.setAttribute("cx",a);c.setAttribute("cy",b);var d=Math.abs(2*coord.jF/(coord.Aa-2)-2*coord.jF/(coord.Aa+2))/2,e=2*coord.jF/coord.Aa;if(4e&&(d=e)}c.setAttribute("rx",e);c.setAttribute("ry",d);c.setAttribute("visibility","visible");this.Rx=o}else this.Rx=q,c.setAttribute("visibility","hidden")}else this.Rx=q,c.setAttribute("visibility","hidden")},dX:function(a,b){var c=0;0a?c=180*(Math.atan(b/a)/Math.PI)+180:0==a&&(c=0heading&&(heading+=360);return heading},U:function(){this.Uj=q;this.P.Vj&&(this.P.Vj.style.visibility="hidden")},show:function(){this.Uj=o;this.P.Vj&&(this.P.Vj.style.visibility="visible")},dD:function(){this.Sn=o},JC:function(){this.Sn=q}});var Ci={get:function(a,b){var c="inst_"+b;Ci[c]||(Ci[c]=new Di(a));return Ci[c]}};function Di(a){this.fb=a;this.Ku=new Uint8Array(16);this.Oq=new Uint8Array(16)}x.extend(Di.prototype,{jE:function(){for(var a=0,b=this.Ku.length;a0){c=1/Math.sqrt(c);a[0]=b[0]*c;a[1]=b[1]*c}return a};Ji.xs=function(a,b){return a[0]*b[0]+a[1]*b[1]};Ji.Lw=function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a}; Ji.Ox=function(a,b,c,d){var e=b[0],b=b[1];a[0]=e+d*(c[0]-e);a[1]=b+d*(c[1]-b);return a};Ji.random=function(a,b){var b=b||1,c=Gi()*2*Math.PI;a[0]=Math.cos(c)*b;a[1]=Math.sin(c)*b;return a};Ji.q4=function(a,b,c){var d=b[0],b=b[1];a[0]=c[0]*d+c[2]*b;a[1]=c[1]*d+c[3]*b;return a};Ji.r4=function(a,b,c){var d=b[0],b=b[1];a[0]=c[0]*d+c[2]*b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a};Ji.O_=function(a,b,c){var d=b[0],b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a}; Ji.yO=function(a,b,c){var d=b[0],b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a};Ji.forEach=function(){var a=Ji.create();return function(b,c,d,e,f,g){c||(c=2);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d0){c=1/Math.sqrt(c);a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c}return a};Li.xs=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};Li.Lw=function(a,b,c){var d=b[0],e=b[1],b=b[2],f=c[0],g=c[1],c=c[2];a[0]=e*c-b*g;a[1]=b*f-d*c;a[2]=d*g-e*f;return a};Li.Ox=function(a,b,c,d){var e=b[0],f=b[1],b=b[2];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=b+d*(c[2]-b);return a}; Li.random=function(a,b){var b=b||1,c=Gi()*2*Math.PI,d=Gi()*2-1,e=Math.sqrt(1-d*d)*b;a[0]=Math.cos(c)*e;a[1]=Math.sin(c)*e;a[2]=d*b;return a};Li.yO=function(a,b,c){var d=b[0],e=b[1],b=b[2];a[0]=c[0]*d+c[4]*e+c[8]*b+c[12];a[1]=c[1]*d+c[5]*e+c[9]*b+c[13];a[2]=c[2]*d+c[6]*e+c[10]*b+c[14];return a};Li.O_=function(a,b,c){var d=b[0],e=b[1],b=b[2];a[0]=d*c[0]+e*c[3]+b*c[6];a[1]=d*c[1]+e*c[4]+b*c[7];a[2]=d*c[2]+e*c[5]+b*c[8];return a}; Li.Q_=function(a,b,c){var d=b[0],e=b[1],f=b[2],b=c[0],g=c[1],i=c[2],c=c[3],k=c*d+g*f-i*e,l=c*e+i*d-b*f,m=c*f+b*e-g*d,d=-b*d-g*e-i*f;a[0]=k*c+d*-b+l*-i-m*-g;a[1]=l*c+d*-g+m*-b-k*-i;a[2]=m*c+d*-i+k*-g-l*-b;return a};Li.CN=function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[0];f[1]=e[1]*Math.cos(d)-e[2]*Math.sin(d);f[2]=e[1]*Math.sin(d)+e[2]*Math.cos(d);a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a}; Li.DN=function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[2]*Math.sin(d)+e[0]*Math.cos(d);f[1]=e[1];f[2]=e[2]*Math.cos(d)-e[0]*Math.sin(d);a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a};Li.EN=function(a,b,c,d){var e=[],f=[];e[0]=b[0]-c[0];e[1]=b[1]-c[1];e[2]=b[2]-c[2];f[0]=e[0]*Math.cos(d)-e[1]*Math.sin(d);f[1]=e[0]*Math.sin(d)+e[1]*Math.cos(d);f[2]=e[2];a[0]=f[0]+c[0];a[1]=f[1]+c[1];a[2]=f[2]+c[2];return a}; Li.forEach=function(){var a=Li.create();return function(b,c,d,e,f,g){c||(c=3);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d0){c=1/Math.sqrt(c);a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c}return a};Z.xs=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};Z.Ox=function(a,b,c,d){var e=b[0],f=b[1],g=b[2],b=b[3];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=g+d*(c[2]-g);a[3]=b+d*(c[3]-b);return a};Z.random=function(a,b){b=b||1;a[0]=Gi();a[1]=Gi();a[2]=Gi();a[3]=Gi();Z.normalize(a,a);Z.scale(a,a,b);return a}; Z.yO=function(a,b,c){var d=b[0],e=b[1],f=b[2],b=b[3];a[0]=c[0]*d+c[4]*e+c[8]*f+c[12]*b;a[1]=c[1]*d+c[5]*e+c[9]*f+c[13]*b;a[2]=c[2]*d+c[6]*e+c[10]*f+c[14]*b;a[3]=c[3]*d+c[7]*e+c[11]*f+c[15]*b;return a};Z.Q_=function(a,b,c){var d=b[0],e=b[1],f=b[2],b=c[0],g=c[1],i=c[2],c=c[3],k=c*d+g*f-i*e,l=c*e+i*d-b*f,m=c*f+b*e-g*d,d=-b*d-g*e-i*f;a[0]=k*c+d*-b+l*-i-m*-g;a[1]=l*c+d*-g+m*-b-k*-i;a[2]=m*c+d*-i+k*-g-l*-b;return a}; Z.forEach=function(){var a=Z.create();return function(b,c,d,e,f,g){c||(c=4);d||(d=0);for(e=e?Math.min(e*c+d,b.length):b.length;d0.999999){d[0]=0;d[1]=0;d[2]=0;d[3]=1;return d}Li.Lw(a,e,f);d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=1+g;return Pi.normalize(d,d)}}(); Pi.T3=function(){var a=Oi.create();return function(b,c,d,e){a[0]=d[0];a[3]=d[1];a[6]=d[2];a[1]=e[0];a[4]=e[1];a[7]=e[2];a[2]=-c[0];a[5]=-c[1];a[8]=-c[2];return Pi.normalize(b,Pi.IW(b,a))}}();Pi.di=Z.di;Pi.sg=Z.sg;Pi.copy=Z.copy;Pi.set=Z.set;Pi.Dm=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};Pi.LZ=function(a,b){var c=Math.PI,c=c*0.5,d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c)};Pi.add=Z.add; Pi.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2],b=b[3],g=c[0],i=c[1],k=c[2],c=c[3];a[0]=d*c+b*g+e*k-f*i;a[1]=e*c+b*i+f*g-d*k;a[2]=f*c+b*k+d*i-e*g;a[3]=b*c-d*g-e*i-f*k;return a};Pi.Pm=Pi.multiply;Pi.scale=Z.scale;Pi.CN=function(a,b,c){var c=c*0.5,d=b[0],e=b[1],f=b[2],b=b[3],g=Math.sin(c),c=Math.cos(c);a[0]=d*c+b*g;a[1]=e*c+f*g;a[2]=f*c-e*g;a[3]=b*c-d*g;return a}; Pi.DN=function(a,b,c){var c=c*0.5,d=b[0],e=b[1],f=b[2],b=b[3],g=Math.sin(c),c=Math.cos(c);a[0]=d*c-f*g;a[1]=e*c+b*g;a[2]=f*c+d*g;a[3]=b*c-e*g;return a};Pi.EN=function(a,b,c){var c=c*0.5,d=b[0],e=b[1],f=b[2],b=b[3],g=Math.sin(c),c=Math.cos(c);a[0]=d*c+e*g;a[1]=e*c-d*g;a[2]=f*c+b*g;a[3]=b*c-f*g;return a};Pi.q1=function(a,b){var c=b[0],d=b[1],e=b[2];a[0]=c;a[1]=d;a[2]=e;a[3]=-Math.sqrt(Math.abs(1-c*c-d*d-e*e));return a};Pi.xs=Z.xs;Pi.Ox=Z.Ox; Pi.c4=function(a,b,c,d){var e=b[0],f=b[1],g=b[2],b=b[3],i=c[0],k=c[1],l=c[2],c=c[3],m,n,u;n=e*i+f*k+g*l+b*c;if(n<0){n=-n;i=-i;k=-k;l=-l;c=-c}if(1-n>1.0E-6){m=Math.acos(n);u=Math.sin(m);n=Math.sin((1-d)*m)/u;d=Math.sin(d*m)/u}else n=1-d;a[0]=n*e+d*i;a[1]=n*f+d*k;a[2]=n*g+d*l;a[3]=n*b+d*c;return a};Pi.lp=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c*c+d*d+e*e+f*f,g=g?1/g:0;a[0]=-c*g;a[1]=-d*g;a[2]=-e*g;a[3]=f*g;return a};Pi.w1=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a}; Pi.length=Z.length;Pi.BE=Pi.length;Pi.Qk=Z.Qk;Pi.EF=Pi.Qk;Pi.normalize=Z.normalize;Pi.IW=function(a,b){var c=b[0]+b[4]+b[8];if(c>0){c=Math.sqrt(c+1);a[3]=0.5*c;c=0.5/c;a[0]=(b[7]-b[5])*c;a[1]=(b[2]-b[6])*c;a[2]=(b[3]-b[1])*c}else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[d*3+d]&&(d=2);var e=(d+1)%3,f=(d+2)%3,c=Math.sqrt(b[d*3+d]-b[e*3+e]-b[f*3+f]+1);a[d]=0.5*c;c=0.5/c;a[3]=(b[f*3+e]-b[e*3+f])*c;a[e]=(b[e*3+d]+b[d*3+e])*c;a[f]=(b[f*3+d]+b[d*3+f])*c}return a}; Pi.kn=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};"undefined"!==typeof exports&&(exports.H3=Pi);function Qi(a,b){this.Gf=a;this.vq=b||2;this.AA=a-this.vq;this.vc=[];this.Jg=[];this.lE()}x.extend(Qi.prototype,{lE:function(){var a,b;this.vc.push(0,-20,0);for(Zf=0;360>Zf;Zf+=6)a=Math.cos(Nb(Zf))*this.Gf,b=Math.sin(Nb(Zf))*this.Gf,this.vc.push(a,-20,b)},kE:function(){for(var a=(this.vc.length-3)/3,b=1;bc;c+=6)a=Math.cos(Nb(c))*this.AA,b=Math.sin(Nb(c))*this.AA,this.vc.push(a,-20,b);for(c=0;360>c;c+=6)a=Math.cos(Nb(c))*this.Gf,b=Math.sin(Nb(c))*this.Gf,this.vc.push(a,-20,b)},kE:function(){var a=this.vc.length/3/2;for(Zf=0;Zfk;k++)for(var l=Math.cos(Nb(5.625*k-90))*a,l=Math.round(100*l)/100,m=Math.sin(Nb(5.625*k-90))*a,m=Math.round(100*m)/100,f=Math.floor(k/c),n=0;64>n;n++){var u=Math.cos(Nb(5.625*n))*l,v=Math.sin(Nb(5.625*n))*l,u=Math.round(100*u)/100,v=Math.round(100*v)/100;b.push(u,m,v);g=Math.floor(n/c);i=g+f*d;fd&&(a=360-a):a=0this.xJ?7:b>this.wJ?6:b>this.vJ?5:0-this.vJ?3:b>-this.wJ?2:b>-this.xJ?1:0;b=Math.floor(a/22.5);return[b,c,b+c*(64/(64/this.Qd))]}});function ji(a){this.P=a;this.ie=this.fb=this.Wa=this.$i=p;var b=this;this.Qr=new ri(6,{Eo:function(a){for(var d=0;d=a;a++)this.kl[a]={cols:Math.pow(2,a-1),rows:Math.pow(2,a-1)/2};this.kl[1]={cols:1,rows:1}},Qi:function(){this.Kz();this.fb=this.Wa.getContext("webgl",{alpha:q});this.cw=Ci.get(this.fb,this.P.ba);this.xA();this.gU();this.bA();this.cA();this.xT();this.cw.jE();this.Dv()},Kz:function(){var a=this.Wa=K("canvas"),b=this.Wa.style,c=this.P.B,d=c.clientWidth,c=c.clientHeight;b.width=d+"px";b.height=c+"px";this.aj=a.width=d*this.jg;this.Sj=a.height= c*this.jg;this.P.Xh.appendChild(this.Wa)},gU:function(){var a=this.fb,b=this.Wa;a.clearColor(0,0,0,1);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);a.disable(a.DEPTH_TEST);a.enable(a.BLEND);a.depthMask(o);a.viewport(0,0,b.width,b.height)},Ik:function(){var a=this.P.B,b=a.clientWidth,a=a.clientHeight;this.Wa.style.width=b+"px";this.Wa.style.height=a+"px";this.aj=this.Wa.width=b*this.jg;this.Sj=this.Wa.height=a*this.jg;this.Pq=p;b=this.Wa;this.fb.viewport(0,0,b.width,b.height)},xA:function(){var a= this.fb,b=this.ie=a.createProgram(),c=this.ql("attribute vec3 aVertexPosition;\\nattribute vec2 aVertexTextureCoordBack;\\nattribute vec2 aVertexTextureCoord;\\nvarying mediump vec2 vTextureCoordBack;\\nvarying mediump vec2 vTextureCoord;\\nuniform mat4 uMVMatrix;\\nuniform mat4 uPMatrix;\\nvoid main(void) {\\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\\n vTextureCoordBack = aVertexTextureCoordBack;\\n vTextureCoord = aVertexTextureCoord;\\n}",a.VERTEX_SHADER),d=this.ql("precision mediump float;\\nvarying vec2 vTextureCoordBack;\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSamplerBack;\\nuniform sampler2D uSampler;\\nuniform bool uDrawThumb;\\nuniform bool uDrawBack;\\nuniform float uAlpha;\\nvoid main(void) {\\n if (uDrawThumb) {\\n gl_FragColor = texture2D(uSamplerBack, vTextureCoordBack);\\n return;\\n }\\n if (uAlpha == 1.0) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n if (uDrawBack) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha + texture2D(uSamplerBack, vTextureCoordBack) * (1.0 - uAlpha);\\n } else {\\n vec4 textureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\\n gl_FragColor = vec4(textureColor.rgb, textureColor.a * uAlpha);\\n }\\n}", a.FRAGMENT_SHADER);a.attachShader(b,c);a.attachShader(b,d);a.bindAttribLocation(b,0,"aVertexPosition");a.linkProgram(b)},ql:function(a,b){var c=this.fb,d=c.createShader(b);c.shaderSource(d,a);c.compileShader(d);return d},xT:function(){var a=new Si(this.Gf),b=a.fY();this.Mr={aO:a,BW:b,AW:a.vc}},setData:function(a){a!==p&&(this.Bl=this.da?this.da.id:p,this.eB=this.da||p);(this.da=a)&&this.Qr.setData(a.id,[])},ua:function(a,b){if(this.da){this.Ca=a;this.Ze=b;var c=this.Wa;this.$i||(this.$i=this.P.fa()); this.Pq||(this.Pq=180/Math.pow(2,this.$i),this.FU=c.width/c.height,qi.gZ(this.Sh,Nb(this.Pq),this.FU),qi.lp(this.pr,this.Sh));this.wz(0);c=this.dA(0);this.av[0]=c[0];this.sA[0]=c[1];this.QS()}},wz:function(a){qi.Dm(this.Ef[a]);qi.rotate(this.Ef[a],this.Ef[a],Nb(this.Ca.pitch),[-1,0,0]);var b=this.da.tiles.dirNorth;1==a&&this.eB&&(b=this.eB.tiles.dirNorth);qi.rotate(this.Ef[a],this.Ef[a],Nb(b+this.Ca.heading+90),[0,1,0]);qi.lp(this.UA[a],this.Ef[a])},Rj:function(a,b,c){var d=this.aj,e=this.Sj,f=Z.create(), g=this.pr,c=this.UA[c],a=Z.sg(2*a/d-1,1-2*b/e,-1,1);qi.multiply(f,g,a);qi.multiply(f,c,f);b=this.Gf;g=200*f[0];a=200*f[1];f=200*f[2];b=Math.sqrt(-(-b*b)/(g*g+a*a+f*f));return this.Mr.aO.ZW([g*b,a*b,f*b])},RH:function(a,b,c,d){var e=this.Sj,b=Z.sg(a,b,c,1),a=Z.create();qi.multiply(a,this.Ef[d],b);b=Z.sg(a[0],a[1],a[2],a[3]);qi.multiply(a,this.Sh,b);if(0!==a[3])return d=(1-Li.sg(a[0]/a[3],a[1]/a[3],a[2]/a[3])[1])*e/2,0=this.tA&&a<=this.SH)&&(e=0,f=this.kl[this.Ze].cols-1);for(;e<=f;e++)this.DI(e,a)}},DI:function(a,b,c,d){var c=c||this.Ze,e=this.kl[c].cols,f=this.kl[c].rows,g=this,a=g.hB(a,c);0>b&&(a=g.hB(e-1-a,c),b=0);b>f-1&&(a=g.hB(e-1-a,c),b=f-1);var i=a+b*e,k=g.Qr.getData(g.da.id);k[c]||(k[c]=[]);k[c][i]||(k[c][i]={});var l=k[c][i];l.loaded?(g.aJ(c)&&g.gJ(),d&&d()):(l.index=i,l.loaded=q,l.$Y=g.da.id,g.PS(a,b,c,function(a){if(l.$Y==g.da.id){l.loaded= o;var b=k[c][i];if(!b.ws){g.fU(b,a,c);if(c>1)b.Tl={duration:300,startTime:Date.now(),vC:0,Jo:1};b.ws=o}g.aJ(c)&&g.gJ();d&&d()}}))},aJ:function(a){return 1===a&&this.Bl&&this.P.qJ?o:q},QN:ba("$S"),hB:function(a,b){for(var c=a,d=this.kl[b||this.Ze].cols;0>c;)c+=d;return c%d},vf:function(){this.FB--;0===this.FB&&this.P.dispatchEvent(new N("ontilesloaded"))},Dv:function(){var a=this;a.RT=requestAnimationFrame(function(){a.Dv()});var b=this.ie;this.fb.useProgram(b);var c=this.cw;c.No(b.wn);c.No(b.PO); c.No(b.qu);c.MC();b=q;this.Qg?this.CT():b=this.mB(0);if(b&&!this.Qg)for(b=0;bg?0:g);d=this.Qr.getData(d);if(!d)return q;for(;g<=c;g++){var i=e,k=f;"number"===typeof this.jk&&(g>=this.jk&&g<=this.Pl)&& (i=0,k=this.Qd-1);for(;i<=k;i++){for(var l=i;0>l;)l+=this.Qd;var l=l%this.Qd,m=this.hl(l,g)[2],n=this.hl(l,g,this.ho)[2],u=this.hl(l,g,1)[2],v=p,w=p,y=1;d[this.Ze]&&(d[this.Ze][m]&&d[this.Ze][m].ws)&&(v=m);d[this.ho]&&d[this.ho][n]&&d[this.ho][n].ws?(w=n,y=this.ho):d[1][u]&&d[1][u].ws&&(w=u);if(v===p&&w===p)return q;m=this.fb;n=this.ie;u=this.Ze;this.Qg&&1==a?(m.uniform1i(n.KK,q),v===p&&(v=w,u=1),w=p):m.uniform1i(n.KK,o);this.IS(v,u,w,y,a);this.eU(l,g,u,y);this.sB(a);this.mR()}}return o},hl:function(a, b,c){var c=c||this.Ze,d=Math.pow(2,5-c),a=Math.floor(a/d),b=Math.floor(b/d),b=this.kl[c].rows-b-1;return[a,b,a+b*this.Qd/d]},fU:function(a,b,c){if(a){var d=this.fb;1===c?d.activeTexture(d.TEXTURE0):d.activeTexture(d.TEXTURE1);a.Ly=d.createTexture();d.bindTexture(d.TEXTURE_2D,a.Ly);d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,o);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,b);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE); d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR)}},IS:function(a,b,c,d,e){var f=0==e?this.da.id:this.Bl;if(f){var g=this.Qr.getData(f),f=this.fb,i=this.ie;a===p?f.uniform1i(i.LK,o):f.uniform1i(i.LK,q);var k=p;g[d]&&g[d][c]&&(f.activeTexture(f.TEXTURE0),k=g[d][c].Ly,f.bindTexture(f.TEXTURE_2D,k),f.uniform1i(i.AZ,0));if("number"===typeof a){f.activeTexture(f.TEXTURE1);f.bindTexture(f.TEXTURE_2D,g[b][a].Ly);f.uniform1i(i.BZ,1);a= g[b][a];"number"!=typeof a.Jo&&(a.Jo=1);if(1==e&&(!a.Tl||0!=a.Tl.Jo))a.Tl={duration:400,startTime:this.Ov,vC:1,Jo:0},a.Jo=0;a.Tl?(e=a.Tl,b=(Date.now()-e.startTime)/e.duration,0==e.vC?(e=b,1e&&(e=0,a.Tl=p)),f.uniform1f(i.alpha,e)):f.uniform1f(i.alpha,a.Jo)}}},eU:function(a,b,c,d){var e=this.rS(a,b),f=this.Mr.BW,c=this.KH(a,b,c),a=this.KH(a,b,d),b=this.fb;this.Vv||(this.Vv=b.createBuffer());b.bindBuffer(b.ARRAY_BUFFER,this.Vv);b.bufferData(b.ARRAY_BUFFER,new Float32Array(e), b.STATIC_DRAW);this.po||(this.po=b.createBuffer(),this.po.SF=f.length,b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.po),b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(f),b.STATIC_DRAW));this.KB||(this.KB=b.createBuffer());b.bindBuffer(b.ARRAY_BUFFER,this.KB);b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);c&&(this.Ol||(this.Ol=b.createBuffer()),b.bindBuffer(b.ARRAY_BUFFER,this.Ol),b.bufferData(b.ARRAY_BUFFER,new Float32Array(c),b.STATIC_DRAW))},mR:function(){var a=this.fb,b=this.ie; a.bindBuffer(a.ARRAY_BUFFER,this.Vv);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.po);a.vertexAttribPointer(b.wn,3,a.FLOAT,q,0,0);a.bindBuffer(a.ARRAY_BUFFER,this.KB);a.vertexAttribPointer(b.PO,2,a.FLOAT,q,0,0);a.bindBuffer(a.ARRAY_BUFFER,this.Ol);a.vertexAttribPointer(b.qu,2,a.FLOAT,q,0,0);a.drawElements(a.TRIANGLES,this.po.SF,a.UNSIGNED_SHORT,0)},rS:function(a,b){return this.Mr.AW[a+b*(64/(64/this.Qd))]},KH:function(a,b,c){return this.Mr.aO.NW(c||this.Ze,a,b)},bA:function(){var a=this.ie,b=this.fb; a.zt=b.getUniformLocation(a,"uPMatrix");a.wt=b.getUniformLocation(a,"uMVMatrix");a.LK=b.getUniformLocation(a,"uDrawThumb");a.KK=b.getUniformLocation(a,"uDrawBack");a.alpha=b.getUniformLocation(a,"uAlpha");a.AZ=b.getUniformLocation(a,"uSamplerBack");a.BZ=b.getUniformLocation(a,"uSampler")},cA:function(){var a=this.ie,b=this.fb;a.wn=b.getAttribLocation(a,"aVertexPosition");a.PO=b.getAttribLocation(a,"aVertexTextureCoordBack");a.qu=b.getAttribLocation(a,"aVertexTextureCoord")},sB:function(a){var b=this.ie, c=this.fb;c.uniformMatrix4fv(b.zt,q,this.Sh);c.uniformMatrix4fv(b.wt,q,this.Ef[a])},zq:function(a,b,c,d){return a+"_"+b+"_"+c+"_"+d},PS:function(a,b,c,d){var e=this.zq(this.da.id,a,b,c),f=this.lJ.getData(e);this.FB++;if(f)f.kr&&(d(f),this.vf());else{f=this.rA.jx();f.crossOrigin="anonymous";f.kr=q;var g=this;f.onload=function(){-1!=this.src.indexOf("pos=0_0&z=1")&&g.P.dispatchEvent(new N("onthumbnail_complete"));d(this);g.vf();this.kr=o};f.src=this.da.tiles.getTilesUrl(this.da.id,new Q(a,b),c);this.lJ.setData(e, f)}},dA:function(a){var b=this.aj,c=this.Sj,d,e,f,g,i,k=this.Rj(0,0,a);d=k[0];g=k[1];k=this.Rj(b/2,0,a);k[1]>g&&(g=k[1]);k=this.Rj(b,0,a);e=k[0];ee&&(k[0]-=this.Qd);k[0]e&&(e=k[0]);k=this.Rj(0,c,a);k[0]>e&&(k[0]-=this.Qd);k[0]e&&(e=k[0]);b=k[1];this.RH(0,100,0,a)?(this.Pl=this.Er-1,this.jk= i):this.RH(0,-100,0,a)?(this.jk=0,this.Pl=b):this.SH=this.tA=this.Pl=this.jk=p;this.Pl!=p&&gthis.jk&&(f=this.jk);b=this.hl(d,g);c=this.hl(e,f);a=b[0];i=c[0];b=b[1];c=c[1];this.tA=this.hl(0,this.jk)[1];this.SH=this.hl(0,this.Pl)[1];return[[d,e,f,g],[a,i,b,c]]},KU:function(a){this.kg.push(a)},gJ:function(){if(!this.Qg&&(this.wz(1),this.SA[0]=qi.di(this.Ef[0]),this.SA[1]=qi.di(this.Ef[1]),this.av[1]=this.dA(1)[0],this.Qg=o,this.Rz=160,this.Sz=120,"number"==typeof this.P.eH)){var a= Math.pow(this.P.eH,0.25);this.Rz*=a;this.Sz*=a}},wI:function(){this.Qg=q;this.Ov=this.Bl=p;this.wz(0);var a=this.dA(0);this.av[0]=a[0];this.sA[0]=a[1];this.eI()},CT:function(){this.Ov||(this.Ov=Date.now());this.TQ=Date.now();var a=this.TQ-this.Ov;if(400c)a.P.dispatchEvent(new N("onlongjumpcancel"));else{var d=a.da.vh+Math.sin(Nb(b))*c,b=a.da.wh+Math.cos(Nb(b))*c;a.P.dispatchEvent(new N("onlongjumpend")); d=new H(d,b);a.P.sa(a.Sd.qh(d),{Wl:o})}}else d=a.P.Da(),a.CU=1Math.abs(a[0]-d[0])&&12>Math.abs(c-d[1])?o:q},AH:function(a,b){if(!this.Uj)return p;var c=this.MS[1],d=this.Uq([a,b],c[1]);if(!d)return p;for(var e=0,f=this.da.links.length;e e;)e+=360;var e=this.xR(e%360),f=this.da.links[e].yh,g=Math.sin(Nb(f)),f=Math.cos(Nb(f)),i=-g*c[0]+f*c[2];if(100i)return 0;c=(f*c[0]+g*c[2])/9;if(3.6>c)return 0;g=this.da.links[e];f=this.mQ([this.da.vh,0,this.da.wh],[g.x,0,g.y]);this.mo.QN(e);if(cd&&(d=-70);b[0]=c*f+a*d;b[2]=-a*f+c*d;this.Ln[0]=b[0];this.Ln[2]=b[2];b=f/9;return 300this.da.links[c].dir&&(e=Math.abs(360+a-e),ethis.$G&&(c=0.2),this.Mq(this.UG.vc,this.UG.HD(),this.Ln,1,c,q),this.Mq(this.NI.vc,this.NI.HD(),this.Ln,1,c+0.3,q));if(!(this.NH||this.Uj===q)){var c=a[0],f=a[1],g=a[2],i=a[3], k=a[4],l=a[5],a=a[6];b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA);b.activeTexture(b.TEXTURE2);b.useProgram(d);e.jE();e.No(d.wn);e.No(d.qu);e.MC();b.uniformMatrix4fv(d.zt,q,this.Sh);b.uniformMatrix4fv(d.wt,q,this.TA);b.uniform1i(d.zZ,2);this.Fn&&(b.bindTexture(b.TEXTURE_2D,this.Fn),this.Mq(c,i,p,1,1,o,k));this.Hn&&(b.bindTexture(b.TEXTURE_2D,this.Hn),this.Mq(f,i,p,1,1,o,k));this.Gn&&(b.bindTexture(b.TEXTURE_2D,this.Gn),this.Mq(g,l,p,1,1,o,a));b.depthMask(o)}}}, yT:function(){for(var a=[],b=[],c=[],d=[],e=[],f=Ti.length/3,g=this.P.Da().heading+this.ZQ;0>g;)g+=360;var i=this.P.Da().pitch,g=20,k=-30,l=this.mo.$i||this.P.fa(),g=g+20*l;0>i&&(i=Math.abs(i),g*=(90-i)/90,k-=20*i/90);for(i=0;ie))return[c*e,d*e, k*e]}},Ik:function(){this.aj=this.Wa.width;this.Sj=this.Wa.height},PR:function(a){var b=Math.ceil(Math.floor((a+360)%360/22.5)/2);8===b&&(b=0);for(var a=Wi.slice(0),c=Math.floor(b/2),b=b%2,d=0;d