12345678 |
- /* 百度地图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/(1<c/d?d:c);f=Math.floor(b)+f;for(d=360/(2*Math.pow(2,f-2)*c);512<d;)f++,d=360/(2*Math.pow(2,f-2)*c);f>Uh&&(d*=Math.pow(2,f-Uh),f=Uh);f<ai&&(f=ai);d=Math.round(d);return{VL:f,AK:d}}var ci=5063,ei=5062,fi=5061,gi=5060,Uh=5,ai=1; x.extend(Na.prototype,{wb:function(){this.KQ();for(var a=0;a<z.rr.length;a++)z.rr[a](this);this.Xa!=p?"inter"===this.Ge?this.rF(this.Xa):this.dispatchEvent(new N("onid_changed")):this.Kb!=p&&(this.dispatchEvent(new N("onposition_changed")),this.dispatchEvent(new N("onposition_changed_inner")));this.k.visible?this.show():this.U();this.Jf!=p&&this.dispatchEvent(new N("onvisible_poi_type_changed"),{visiblePOIType:this.Jf});var a=p,b;for(b in this.Fe)a=this.Fe[b],delete this.Fe[b],this.Ia(a)},Pt:function(a){this.Jf= a||"none";this.dispatchEvent(new N("onvisible_poi_type_changed"),{visiblePOIType:this.Jf})},Ia:function(a){this.Fe[a.jd]=a;this.dispatchEvent(new N("onadd_overlay"),{overlay:a})},Sb:function(a){delete this.Fe[a.jd];this.dispatchEvent(new N("onremove_overlay"),{overlay:a})},C0:function(a,b){var c=K("div"),d=c.style;c.className="pano_m_indoor_exit";c.title=a;c.onclick=b;d.display="none";d.zIndex=1201;c.innerHTML=\'<span style="float:right;margin-right:12px;">\\u51fa\\u53e3</span>\';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;e<b.length;e++)d=b[e],c[d]=this.uv[d];this.uv=p}return c},sa:function(a,b){a.mb(this.Kb)||(this.ol=this.Xa,this.pl=this._position,this.Kb=a,this.Xa=p,b=b||{Wl:q},this.qJ=b.Wl,this.dispatchEvent(new N("onposition_changed_inner")))},Nc:function(a){var b={heading:this.Ca.heading,pitch:this.Ca.pitch};this.Ca= a;a=a=this.Ca.pitch;a>this.Wj?a=this.Wj:a<this.Yj&&(a=this.Yj);this.Ca.pitch=a;if(b.heading!=this.Ca.heading||b.pitch!=this.Ca.pitch)this.yr=o,this.dispatchEvent(new N("onpov_changed"))},xy:function(a){var b=this.Ca,c=a.heading-b.heading,d=a.pitch-b.pitch,e=this;new sb({Ic:30,duration:200,hc:tb.NK,ua:function(a){e.Nc({heading:b.heading+a*c,pitch:b.pitch+a*d})},finish:function(){e.Nc(a)}})},Oc:function(a,b){if(a!=this.Lc){a>Jd&&(a=Jd);a<Kd&&(a=Kd);if(a!=this.Lc){this.Lc=a;var c=new N("onzoom_changed_inner"), b=b||{};c.sp=b.sp||q;this.dispatchEvent(c);(!Ma()||c.sp)&&this.dispatchEvent(new N("onzoom_changed"))}"cssRender"===this.Yq()&&this.Nc(this.Ca)}},uB:function(){if(this.C){for(var a=this.C.tx(),b=0;b<a.length;b++)(a[b]instanceof T||a[b]instanceof rc)&&a[b].point&&this.va.push(a[b]);this.dispatchEvent(new N("onoverlay_changed"))}},Ak:function(){this.xl.style.visibility="hidden"},Cy:function(){this.dispatchEvent(new N("onoverlay_show"));this.xl.style.visibility="visible"},show:function(){this.k.visible= o;this.le&&x.D.show(this.le);this.k.closeControl&&(this.wf&&this.C&&this.C.Na()===this.B)&&x.D.show(this.wf);this.VA&&this.VA.show();this.uB();this.dispatchEvent(new N("onvisible_changed"))},U:function(){this.k.visible=q;this.le&&x.D.U(this.le);this.k.closeControl&&this.wf&&x.D.U(this.wf);this.VA&&this.VA.U();this.dispatchEvent(new N("onvisible_changed"))},tF:function(a){this.C=a;this.uB()},KQ:function(){var a=K("div"),b=a.style;b.overflow="hidden";b.position="absolute";b.zIndex=1200;b.top=b.left= "0px";b.height=b.width="100%";b.backgroundColor="#e5e3df";this.le=a;this.Xh=this.Nj("1");this.Vj=this.Nj("4");this.xl=this.Nj("5");a.appendChild(this.Xh);a.appendChild(this.Vj);a.appendChild(this.xl);Ma()||(this.lr=this.Nj("3"),this.lr.style.width=this.B.clientWidth+"px",this.lr.style.height=this.B.clientHeight+"px",this.lr.style.overflow="hidden",this.lr.style.WebkitUserSelect="none",a.appendChild(this.lr),Td()&&(this.Rv=this.bH(),this.Xh.appendChild(this.Rv),this.Sv=this.bH(),this.Xh.appendChild(this.Sv))); this.B.appendChild(a);"absolute"!=Ua(this.B).position&&(this.B.style.position="relative")},Nj:function(a){var b=K("div"),c=b.style;c.position="absolute";c.top=c.left="0";c.zIndex=a||"0";c.WebkitUserSelect="none";return b},bH:function(){var a=K("img");thumbStyle=a.style;thumbStyle.position="absolute";thumbStyle.top=thumbStyle.left="0";thumbStyle.zIndex="1";thumbStyle.opacity="0";thumbStyle.hc=thumbStyle.WebkitTransition="opacity 300ms ease-out";a.onload=function(){this.style.visibility="";this.style.opacity= "1"};return a},Na:t("B"),gh:function(){return new L(this.B.clientWidth,this.B.clientHeight)},B2:t("dk"),KX:t("Uv"),WN:ba("Uv"),rF:function(a){a!=this.qA&&(this.qA=a,this.Xa=p,this.dispatchEvent(new N("oniid_changed")),this.dispatchEvent(new N("onid_changed")),Pa(5045,{type:this.k.panoramaRenderer}))},clear:function(){this.Kb=this.Xa=this.da=p;this.Zn=[];this.dispatchEvent(new N("onclear"))},Qo:function(){var a=this.da.$l;this.uR=this.da.kV;this.clear();this.jH=o;this.rc(a)}});var hi=Na.prototype; S(hi,{setId:hi.rc,setPosition:hi.sa,setPov:hi.Nc,setZoom:hi.Oc,show:hi.show,hide:hi.U,setPanoramaPOIType:hi.Pt,addOverlay:hi.Ia,removeOverlay:hi.Sb,exitInter:hi.Qo});function ii(a){a.kg=this;var b=x.platform.Gm?"android":"ios";Ma()?(this.Ud=new ji(a),this.ld=new ki(a,this.Ud.Wa),this.Ud.KU(this.ld),"android"===b?Pa(gi):Pa(fi)):(this.Ud=new li(a),this.ld=new mi(a),"android"===b?Pa(ei):Pa(ci));a.k.linksControl?this.ld.show():this.ld.U();a.k.clickOnRoad?this.ld.dD():this.ld.JC();this.P=a;this.ca();this.lT=new ni(a,this)}z.Sm(function(a){a.kg=new ii(a)});x.lang.ta(ii,x.lang.Ba,"PanoramaRenderer"); x.extend(ii.prototype,{ca:function(){var a=this.P,b=this;a.addEventListener("links_visible_changed",function(){a.k.linksControl===o?b.ld.show():b.ld.U()});a.addEventListener("clickonroad_changed",function(){a.k.clickOnRoad===o?b.ld.dD():b.ld.JC()});a.addEventListener("dataload",function(c){b.da=c.data;b.Ou();b.VI(c.data);b.ua(a.Da(),b.$e,b.Xg)});a.addEventListener("pov_changed",function(){b.da&&b.ua(a.Da(),b.$e,b.Xg)});a.addEventListener("clear",function(){b.da=p;b.VI(p);b.Ud.ua();b.ld&&b.ld.ua()}); a.addEventListener("zoom_changed_inner",function(c){b.da&&(b.Ou(),b.dU(a.Da(),b.$e,b.Xg,c.sp))});a.addEventListener("size_changed",function(a){b.nB(a)});a.addEventListener("dblclick",function(){var b=a.fa();4===b?a.Oc(1):a.Oc(b+1);a.dispatchEvent(new N("ondblclickzoomend"))});a.bl=a.gh();setInterval(function(){if(a.Yb()){var c=a.gh();if(!c.mb(a.bl)){a.bl=c;var d=new N("onsize_changed");d.E3=a.bl;d.size=c;a.dispatchEvent(d);c=b.$e;b.Ou();c!=b.$e&&b.Ud.np&&b.Ud.np();b.ua(a.Da(),b.$e,b.Xg)}}},80)},nB:function(){var a= this.$e;this.Ou();a!=this.$e&&this.Ud.np&&this.Ud.np();this.Ud.Ik&&this.Ud.Ik();this.ld.Ik&&this.ld.Ik();a=this.P;this.ua(a.Da(),this.$e,this.Xg);"cssRender"===a.Yq()&&a.Nc(a.Da())},VI:function(a){a&&("number"===typeof a.heading&&this.P.yr===q)&&(this.P.Ca.heading=a.heading,this.P.Ca.pitch=a.pitch);var b=this.P.mX(a&&a.id,["pov"]);b&&b.pov&&(this.P.Ca.heading=b.pov.heading,this.P.Ca.pitch=b.pov.pitch);if(this.P.jH&&a.indoorPois){for(var b=p,c=this.P.uR,d=0,e=a.indoorPois.length;d<e;d++)c==a.indoorPois[d].panoIId&& (b=a.indoorPois[d]);b&&(this.P.Ca.heading=Od(b.pointX-a.vh,b.pointY-a.wh),this.P.Ca.pitch=0);this.P.jH=q;this.P.I0=p}this.P.yr&&(this.P.yr=q);this.P.Xs();a&&a.$l?this.P.yy("inter"):this.P.yy("street");this.Ud.setData(a,this.TD(),this.$e);this.ld.setData(a)},dU:function(a,b,c,d){var e=this;this.Ud.Oc(e.TD(),e.$e,{sp:d,qZ:function(a){e.lT.Ar(a)}});"cvsRender"!=this.P.dk&&this.Ud.ua(a,b,c);this.ld.ua(a,b,c)},ua:function(a,b,c){this.Ud.ua(a,b,c);this.ld.ua(a,b,c)},r2:t("$e"),TD:function(){return this.P.fa()}, i2:t("Xg"),Ou:function(){var a=bi(this.P.gh(),this.P.fa());this.Xg=a.AK;this.$e=a.VL}});function oi(a){this.P=a}z.Sm(function(a){var b=new oi(a);a.addEventListener("dataload",function(a){b.da=a.data;b.Ri()});a.addEventListener("zoom_changed_inner",function(){b.lb&&(b.lb.stop(),b.lb=p)})}); oi.prototype.Ri=function(){function a(a,b){E.kg.Ud.Qg||(g=o,M.lb&&M.lb.stop(),i=a,k=b,A=E.Da().heading,B=E.Da().pitch,E.dispatchEvent(new N("ontouchstart")))}function b(a,b){g&&!E.Jl&&(y=o,M.EA||(M.EA=o,M.G0=ab()),e(a,b),n=l-a,u=m-b,l=a,m=b,M.aI=ab())}function c(a){g&&(g=q,!y&&(!C&&Y)&&M.YG&&(M.YG=q,M.Tn?(M.Oi&&(clearTimeout(M.Oi),M.Oi=p),10>i-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(!(100<b||10<b&&10>Math.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=[0<c.x-a.x?1:-1,0<c.y-a.y?1:-1],d=Math.abs(a.x-c.x),f=0,g=0;0==Math.abs(a.y-c.y)?f=d:(a=Math.abs(a.x-c.x)/Math.abs(a.y-c.y),g= Math.round(Math.sqrt(24336/(1+a*a))),f=Math.round(a*g));-1==b[0]&&(f=-f);-1==b[1]&&(g=-g);M.lb&&M.lb.stop();A=E.Da().heading;B=E.Da().pitch;M.lb=new sb({duration:625,Ic:60,hc:function(a){return a*0.3125-0.15625*a*a},ua:function(a){a=a*6.4;e(a*f,a*g)},finish:function(){M.lb=p},yt:function(){M.lb=p}})}}}function e(a,b){v=-a*M.Ju;w=b*M.Ju;var c=A+v,d=B+w;d>E.Wj&&(d=E.Wj);d<E.Yj&&(d=E.Yj);E.Nc({heading:c,pitch:d})}function f(a){if(E.k.enableScrollWheelZoom){var a=window.event||a,b=new N("onmousewheel"); b.Up=0<=a.wheelDelta||0>a.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(-1<navigator.userAgent.indexOf("Opera")&&"svg"!=d.tagName){if(d=x.lang.Mc(d.ba))d=d.Gd(),e+=M.ac(d.re()).x,f+=M.ac(d.kf()).y;break}if(g&&(!x.ea.la||9<=x.ea.la&&"svg"==d.nodeName.toLowerCase()))e+=parseInt(g.style.left),f+=parseInt(g.style.top)}d=d.offsetParent}c.x=e;c.y=f;E.fa();E.Da();E.Da();var i;if(b.Up==o){if(E.fa()==Jd){Bb(a);return}i=E.fa()+2/3}else if(b.Up==q){if(E.fa()== Kd){Bb(a);return}i=E.fa()-2/3}E.Oc(i)}Bb(a)}}if(!this.ES){this.ES=o;var g=q,i,k,l=0,m=0,n,u,v=0,w=0,y=q,C=q,A,B,D,E=this.P,J=q,O=0;this.Ju=pi(this);this.aI=0;this.EA=q;this.Tn=p;this.lg=1;var M=this,Y=q;G()?(x.M(E.le,"touchstart",function(b){Y=o;for(var c=b.target;c&&c!=E.le;){if(c===E.xl){Y=q;break}c=c.offsetParent}M.YG=o;var c=b.touches[0].clientX,d=b.touches[0].clientY,e=E.KA;if(Ma())e&&e.AH(b.touches[0].pageX*e.jg,b.touches[0].pageY*e.jg)!=p&&(Y=q);else if(!Lb()&&e){var f=Ab(E.le);-1!=e.rL(c- f.left,d-f.top)&&(Y=q)}a(c,d);(!x.platform.Gm||-1==navigator.userAgent.indexOf("QQBrowser"))&&b.preventDefault();b.stopPropagation()}),x.M(E.le,"touchmove",function(a){if(!J){b(a.touches[0].clientX-i,a.touches[0].clientY-k);var c=new N("ontouchmove");c.n4=new Q(a.touches[0].pageX,a.touches[0].pageY);E.dispatchEvent(c)}a.preventDefault();a.stopPropagation()}),x.M(document,"touchend",function(a){c(a);Y=q}),E.le.addEventListener("gesturestart",function(){O=E.fa()},q),E.le.addEventListener("gesturechange", function(a){M.lg=a.scale;C=J=o;a=M.lg*O;4<a?a=4:1>a&&(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<e;d++)b==a.Rh[d]&&a.Rh.splice(d,1);b.remove();a.Cr()});b.addEventListener("clear",function(){a.aB=q});b.addEventListener("zoom_changed",function(){a.Ar()});b.addEventListener("dataload",function(){a.Cr()});b.addEventListener("pov_changed", function(){a.Ar()});b.addEventListener("size_changed",function(){a.Ar()});b.addEventListener("onoverlay_property_changed",function(){a.Cr()})},Cr:function(){this.GT();if(0!=this.Rh.length&&this.aB){for(var a,b,c,d=this.Rh.length-1;0<=d;d--)if(b=this.Rh[d],ovarlayDom=b.Hd(),c=b.Da())a=c.heading,b.EO(),b=b.jd,this.Th[a]||(this.Th[a]={}),this.Th[a][b]={dom:ovarlayDom,pov:c},this.P.xl.appendChild(ovarlayDom);this.Ar()}},Ar:function(a){this.P.Da();var a=a||this.za.$e,b=this.za.Xg,c=function(){function a(c){var d= b[c.top];if(!d)return q;for(var e=d.length-1;0<=e;e--)if(c.left>=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);180<f?f-=360:-180>f&&(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();100<a?(a/=1E3,a=100>a?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);100<a?(a/=1E3,a=100>a?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\'<svg version="1.1" overflow="hidden" width="82px" height="82px" viewBox="0 0 82 82" style="position: absolute; top: 0px; left: 0px;"><g transform="rotate(0, 41, 41)"><rect x="33" y="1" width="14" height="12" rx="4" ry="4" stroke="#868685" stroke-width="1" fill="#f8f8f8"></rect><polyline points="37.5,9.5 37.5,3.5 42.5,9.5 42.5,3.5" stroke-linejoin="bevel" stroke-width="1.5" fill="#f2f4f6" stroke="#868685"></polyline></g></svg>\'; if(Kb())return\'<div style="position:absolute;top:0;left:0;z-index:0"><v:group style="position:absolute;width:82px;height:82px; behavior:url(#default#VML);rotation:0" unselectable="on" coordsize="82,82" coordorigin="-41,-41"><v:roundrect style="width:14px;height:12px;top:-40px; behavior:url(#default#VML);left:-7px;z-index:2" fillcolor="#f8f8f8" arcsize ="19661f" coordsize="21600,21600" strokecolor="#868685" strokeweight="1pt"></v:roundrect><v:polyline style="behavior: url(#default#VML);z-index:3" fillcolor="#f2f4f6" points="-3,-31,-3,-37,3,-31,3,-37" strokeweight="1.2pt"><v:stroke style="behavior:url(#default#VML)" color="#868685" joinstyle="bevel"></v:stroke></v:polyline></v:group></div>\'}, $z:function(){return\'<div style="position:absolute;top:4px;left:4px;width:74px;height:74px;background:url(\'+F.pa+\'st-navictrl.png) no-repeat;-webkit-user-select:none;overflow:hidden"><div></div></div>\'},IR:function(){return\'<div style="position:absolute;top:0px;left:0;width:82px;height:82px;-webkit-user-select:none;cursor:\'+F.Wb+\'"><div style="position:absolute;left:32px;top:13px;cursor:pointer;width:17px;height:17px;" title="\\u5411\\u4e0a\\u5e73\\u79fb"></div><div style="position:absolute;left:14px;top:32px;cursor:pointer;width:17px;height:17px;" title="\\u5411\\u5de6\\u5e73\\u79fb"></div><div style="position:absolute;left:51px;top:32px;cursor:pointer;width:17px;height:17px;" title="\\u5411\\u53f3\\u5e73\\u79fb"></div><div style="position:absolute;left:33px;top:51px;cursor:pointer;width:17px;height:17px;" title="\\u5411\\u4e0b\\u5e73\\u79fb"></div></div>\'}, 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\'<div style="position:absolute;top:84px;left:30px;width:24px;height:52px;\'+a+\'-webkit-user-select:none;overflow:hidden"><div style="position:absolute;cursor:pointer;width:22px;height:24px;top:0;left:0;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)" title="\\u653e\\u5927\\u4e00\\u7ea7"></div><div style="position:absolute;cursor:pointer;width:22px;height:24px;top:25px;left:0;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)" title="\\u7f29\\u5c0f\\u4e00\\u7ea7"></div><div></div></div>\'}, 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;c<this.eo.length;c++)x.M(this.eo[c],"mousedown",ma);b.tv=q;x.M(this.kd,"mousedown", function(c){b.tv=o;b.kd.style.cursor=F.Ed;x.ea.la&&b.kd.setCapture&&b.kd.setCapture();b.fJ=b.QG(c);b.VQ=a.Da().heading;x.ea.la||Bb(c)});x.M(document,"mousemove",function(c){b.tv&&a.Nc({heading:b.VQ+360-(b.QG(c)-b.fJ),pitch:a.Da().pitch})});x.M(document,"mouseup",function(){b.tv&&(b.tv=q,b.kd.style.cursor=F.Wb,x.ea.la&&b.kd.releaseCapture&&b.kd.releaseCapture(),b.fJ=p)});a.addEventListener("position_changed",function(){var c=360-this.Da().heading;Lb()?b.hJ.setAttribute("transform","rotate("+c+", 41, 41)"): Kb()&&(b.sJ.style.rotation=c);a.removeEventListener("position_changed",arguments.callee)});a.addEventListener("pov_changed",function(){var a=360-this.Da().heading;Lb()?b.hJ.setAttribute("transform","rotate("+a+", 41, 41)"):Kb()&&(b.sJ.style.rotation=a)})}x.M(this.B,"mousemove",function(){a.dispatchEvent(new N("hide_ellipse"))});x.M(this.B,"mouseout",function(){a.dispatchEvent(new N("show_ellipse"))});x.M(this.Dh,"click",function(){a.Oc(a.fa()+1)});x.M(this.ag,"click",function(){a.Oc(a.fa()-1)});Ta()? (x.M(this.Dh,"mousedown",function(){b.ck(b.so,-98)}),x.M(this.ag,"mousedown",function(){b.ck(b.to,-122)}),x.M(this.Dh,"mouseup",function(){b.ck(b.so,-74)}),x.M(this.ag,"mouseup",function(){b.ck(b.to,-74)})):G()&&(x.M(this.Dh,"touchstart",function(){b.ck(b.so,-98)}),x.M(this.ag,"touchstart",function(){b.ck(b.to,-122)}),x.M(this.Dh,"touchend",function(){b.ck(b.so,-74)}),x.M(this.ag,"touchend",function(){b.ck(b.to,-74)}));this.P.addEventListener("zoom_changed_inner",function(){if(this.fa()==Jd)b.ko("zoomIn", q);else if(this.fa()==Kd)b.ko("zoomOut",q);else{b.ko("zoomIn",o);b.ko("zoomOut",o)}})},ck:function(a,b){a&&(6==x.ea.la?this.Xd.children[2].style.left=b+"px":(G()&&(b=36*((b+74)/24)),this.Xd.style.backgroundPosition=b+"px 0"))},ST:function(){var a=this.B.children[0];a.style.background="";a.children[0].style.cssText+="position:absolute;left:0;top:0;width:98px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+F.pa+"st-navictrl.png\')";this.Xd.style.background="";this.Xd.children[2].style.cssText+= "position:absolute;z-index:-1;left:-74px;top:0;width:98px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+F.pa+"st-navictrl.png\')"},show:function(){this.B.style.display=""},U:function(){this.B.style.display="none"},QG:function(a){var a=window.event||a,b=a.pageX||a.clientX,a=a.pageY||a.clientY,c=Ab(this.P.Na()),b=b-c.left-50,a=-(a-c.top-50),b=180*(Math.atan2(a,b)/Math.PI);return 90>b?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;d<c;d++){var e=this.We[d].$H;this.oc.Eo&&this.oc.Eo(this.We[e]);delete this.We[e]}this.We.splice(0,c)}this.We[a]||this.We.push(b);this.We[a]=b;b.$H=a}};ri.prototype.getData=function(a){return this.We[a]}; ri.prototype.clear=function(){for(var a=0;a<this.We.length;a++){var b=this.We[a].$H;this.oc.Eo&&this.oc.Eo(this.We[b]);delete this.We[b]}this.We=[]};function si(){this.Jz=0;this.Mg={}}si.prototype.jx=function(){var a=p,b;for(b in this.Mg)if(this.Mg[b]&&this.Mg[b].Zz===o)return this.Mg[b].Zz=q,this.Mg[b];a=new Image;this.Jz++;b="img_"+this.Jz;return this.Mg[b]=a};si.prototype.clear=function(){for(var a in this.Mg)this.Mg[a]&&(this.Mg[a].onload=this.Mg[a].onerror=p);this.Mg={};this.Jz=0};function li(a){this.P=a;return"cvsRender"==a.dk?new ti(a):new ui(a)};function ti(a){this.P=a;this.Xh=a.Xh;this.Nj();this.P.ra=this;this.ca()} x.extend(ti.prototype,{ca:function(){var a=this,b=a.P;b.addEventListener("size_changed",function(c){a.xe(b.kg.$e,b.kg.TD(),c.size)})},setData:function(a,b,c){a&&(this.da=a,this.OS(b,c))},Nj:function(){var a=K("canvas");a.width=this.P.Na().clientWidth;a.height=this.P.Na().clientHeight;var b=a.style;b.position="absolute";b.left=b.top="0";this.Xh.appendChild(a);this.qV=a.getContext("2d");this.vi=[];this.PJ=[];this.Wc=new vi(this.qV,this.vi,0,a.width,a.height,this.P);for(a=b=a=0;16>a;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;m<e+Math.pow(2,7-b);){for(var n=f;n<g+Math.pow(2, 7-b);){k=m+i;63<k?k%=64:0>k&&(k+=64);k=Math.floor(k*Math.pow(2,b-7));l=Math.floor(n*Math.pow(2,b-7));if(k<Math.pow(2,b-1)&&l<Math.pow(2,b-2)&&0==d[k][l].jm){var u=c.getTilesUrl(this.da.id,{x:k,y:l},b);d[k][l].XN(u)}n+=Math.pow(2,7-b)}m+=Math.pow(2,7-b)}},iA:function(a,b){var c=q;b&&(c=o);if(!c)if(this.Ty)this.Ty=q;else return;if(this.da&&this.da.tiles){for(var c=this.da.tiles,d=[],e=Math.pow(2,a-1),f=Math.pow(2,a-2),d=this.vi,g=0;g<e;g++)for(var i=0;i<f;i++)d[g][i].uZ();for(var g=this.Wc.BD(),e=g.nu, f=g.ys,k=g.nt,g=g.Ht,l=g>k?g-k:64+g-k,m=0,n=0,g=0;g<l+Math.pow(2,7-a);){for(i=e;i<f+Math.pow(2,7-a);){m=g+k;63<m?m%=64:0>m&&(m+=64);m=Math.floor(m*Math.pow(2,a-7));n=Math.floor(i*Math.pow(2,a-7));if(m<Math.pow(2,a-1)&&n<Math.pow(2,a-2)){var u=c.getTilesUrl(this.da.id,{x:m,y:n},a);d[m][n].XN(u)}i+=Math.pow(2,7-a)}g+=Math.pow(2,7-a)}}},xe:function(a,b,c){a!=this.Wc.ra.zoom&&(this.Ty=o);this.Wc.Ik(a,b,c);this.iA(a);this.kA();this.Wc.refresh()},MI:function(a,b){var c=q;b==this.Wc.ra.zoom?this.Ty=q:(this.Ty= o,b<this.Wc.ra.zoom&&(c=o));this.Wc.vZ(a,b);return c},rX:function(a){return this.Wc.tX(a)},ED:function(a,b){return this.Wc.ED(a,b)},E2:function(){return this.Wc.ra.Aa}}); function wi(a){this.se=new Image;this.src="";this.canvas=p;this.zM=this.yM=this.jm=0;this.P=a;var b=this;this.UL=function(){-1!=b.src.indexOf("pos=0_0&z=1")&&b.P.dispatchEvent(new N("onthumbnail_complete"));b.jm=2;b.canvas.oW(b.yM,b.zM)};this.se.onload=this.UL;this.XN=function(a){this.src==a?0==this.jm&&b.UL():(this.src=this.se.src=a,this.jm=1)};this.uZ=function(){this.src=this.se.src="";this.jm=0}} function vi(a,b,c,d,e,f){this.heading=this.pitch=0;this.zoom=2;this.vi=b;this.Hk=[];this.pg=a;this.Ul=q;this.ra={a:d,Za:e,Mf:0,$r:0,Aa:0,s0:512,heading:0,pitch:0,dd:32,zoom:0,Ep:0,Ao:0,Vp:0,m1:0,Rm:0,n1:0,Sp:0,Dt:0};this.P=f;this.dt=q;this.NP()} x.extend(vi.prototype,{NP:function(){if(x.ea.eC){var a=navigator.userAgent.substr(navigator.userAgent.indexOf("Chrome"),12);27<Number(/[1-9][0-9]*/.exec(a+"1")[0])?(this.ra.Ao=0.0078125,this.ra.Dt=2):(this.ra.Ao=0.015625,this.ra.Dt=4);this.ra.Rm=0;this.ra.Sp=0}else x.ea.la?(this.ra.Ao=0.0078125,this.ra.Rm=0,this.ra.Sp=6):(this.ra.Ao=0.0078125,this.ra.Rm=0,this.ra.Sp=4),this.ra.Dt=2},c_:ba("Hk"),hx:function(){var a=this.ra,b=Math.PI/Math.pow(2,this.ra.Ep);b>Math.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(1<this.ra.Ep)this.refresh();else{var c=this.ra,d=c.dd,e=512/d,f=c.yp,g=Math.cos(c.pitch),i=Math.cos(c.heading),k=Math.sin(c.heading), l=c.Aa*Math.sin(c.pitch),m=c.Aa*g*k;c.iq=-c.Aa*g*i;c.jq=l;c.kq=m;c.cs=i;c.Wt=k;for(g=0;g<e;g++)for(i=0;i<e;i++){k={ob:{x:g*d,y:i*d-1},pb:{x:g*d-1,y:i*d+d+1},qb:{x:g*d+d+1,y:i*d+d}};l={ob:{x:g*d-1,y:i*d},pb:{x:g*d+d+1,y:i*d-1},qb:{x:g*d+d,y:i*d+d+1}};if(0==g)var n=-1;else g==f-1&&(n=1);if(0==i)var u=-1;else i==f-1&&(u=1);this.ZC(k,a,b,c.zoom,n,u);this.$C(l,a,b,c.zoom,n,u)}}},lR:function(){var a=this.ra;this.pg.clearRect(0,0,a.a,a.Za);a.heading-=a.Mf/180*Math.PI;a.Mf=this.ME.XU.F3;a.heading+=a.Mf/180* Math.PI;this.Hk=this.ME.data.se;this.Ul=q;this.P.Cy();this.refresh()},Dn:function(a,b,c,d,e){var c=this.ra,b=2*(0.5*a.x/512+b/2)*Math.PI,f=(0.5-a.y/512)*Math.PI,g=c.Aa,a=Math.cos(f),i=Math.sin(Math.abs(f));0.4>i?i=0.4:0.98<i&&(i=c.Dt);var b=b+d*i,k=-a*Math.cos(b),i=Math.sin(f+e*i),l=a*Math.sin(b),e=c.cs,d=c.Wt,b=c.iq,a=c.jq,f=c.kq,m=b*k+i*a+l*f;0>m&&(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,1<m?m=1:-1>m&&(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;k<c;k++)for(l=d;l<e;l++){u=k+f;63<u?u%=64:0>u&&(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;k<c;k++)for(l=d;l<e;l++){var u=k+f;63<u?u%=64:0>u&&(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(2<k)return q;g=2.08/(2.08-k);i*=g;e*=g;return{yG:i,zG:e,Aa:Math.sqrt(Math.pow(i,2)+Math.pow(e,2)),jF:c.Aa,heading:f.heading}},BD:function(a){var b=this.ra;a&&(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),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(0<b.pitch)var w=this.Da(a+k+u,g+l+0,i+m+v),y=this.Da(a+n,g+c,i+d),C=this.Da(a+n+f,g+c+0,i+d+e);else var A=a+k,B=g+l,m=i+m,D=this.Da(A,B,m),B=this.Da(A+u,B+0,m+v),A=this.Da(a+n+f,g+c+0,i+d+e);a=Math.atan(b.Za/2/b.Aa);b.pitch+a>Math.PI/2?(D=0,y=y.pitch<C.pitch?y.pitch:C.pitch,y=Math.ceil(32*(Math.PI/2-y)/Math.PI)):b.pitch-a<-Math.PI/2?(y=D.pitch>B.pitch? D.pitch:B.pitch,D=Math.floor(32*(Math.PI/2-y)/Math.PI),y=32):0<b.pitch?(D=Math.floor(32*(Math.PI/2-b.pitch-a)/Math.PI),y=y.pitch>C.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):0<b.pitch?(A=Math.floor(32*w.heading/Math.PI),w=b.heading>w.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);64<w&&(w-=64);32<y&&(y=32);0>D&&(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.98<a&&(a=d.Dt);var b=b+(e+f)*a,c=c+(g+i)*a,k=d.Aa,e=Math.cos(c),a=-e*Math.cos(b),c=Math.sin(c),l=e*Math.sin(b),b=d.cs,e=d.Wt,f=d.iq,g=d.jq,i=d.kq,m=f*a+c*g+l*i;if(0>m)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,1<m?m=1:-1>m&&(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,1<n?n=1:-1>n&&(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:0<c?Math.PI-Math.acos(a/Math.sqrt(d+e)):Math.PI+Math.acos(a/Math.sqrt(d+e)),pitch:Math.asin(b/Math.sqrt(d+Math.pow(b,2)+e))}},yk:function(a,b){var c=a.ob.x,d=a.ob.y,e=a.pb.y,f=a.qb.y,g=b.ob.x,i=b.ob.y,k=b.pb.x,l=b.pb.y,m=b.qb.x,n=b.qb.y,u=e-d,v=f-d,w=a.pb.x-c,y=a.qb.x- c,u=e-d,v=f-d,e=m-g,l=l-i,k=k-g,n=n-i,f=y*u-w*v,u=[(e*u-k*v)/f,(n*u-l*v)/f,(e*w-k*y)/-f,(l*y-n*w)/f];u[4]=g-u[0]*c-u[2]*d;u[5]=i-u[3]*d-u[1]*c;return u}});function ui(a){this.P=a;this.Xa=this.da=p;this.vv=0;this.Xh=a.Xh;this.rA=new si;this.Wg={};this.lo={};this.Go={ai:0.0010,width:0,height:0,heading:0,pitch:0};this.P.ra=this;this.cH=0;this.Pd={};this.ca()} x.extend(ui.prototype,{ca:function(){var a=this,b=a.P;b.addEventListener("size_changed",function(){a.Pd={}});b.addEventListener("zoom_changed_inner",function(){a.Pd={}})},setData:function(a){if(!this.da||!(a&&a.id==this.da.id))a?(this.np(),this.Bl=this.da?this.da.id:p,this.fB=this.da?this.da.tiles.dirNorth:p,this.AI=this.nA||p):this.fB=this.Bl=p,this.kJ=q,this.Pd={},this.da=a,this.nA=this.P.Da().heading},np:function(){if(Td()){var a=this.P.Rv.style,b=this.P.Sv.style;a.hc=a.WebkitTransition="";b.hc= b.WebkitTransition="";a.visibility=b.visibility="hidden";a.opacity=b.opacity="0"}for(var c in this.Wg)this.lo[c]=this.Wg[c],this.lo[c].style.zIndex="0"},ua:function(a,b,c){if(this.da){var d=a.heading,e=a.pitch,f=this.P,g,i,k,l,m,n;this.Pd[this.da.id]?(f=this.Pd[this.da.id],i=f.Mf,k=f.sO,l=f.uO,m=f.zK,g=f.ai,n=f.qC,f=f.pC):(g=this.da.tiles,i=g.dirNorth,n=f.Na().clientWidth,f=f.Na().clientHeight,k=g.ep(b),l=g.yx(b),m=360/k,g=360/(k*c),this.Pd[this.da.id]={Mf:i,sO:k,uO:l,zK:m,ai:g,qC:n,pC:f},this.lQ()); this.AI=this.nA||p;this.nA=d;Td()&&this.nU(d,e,b,c,g,n,f,i,k,l);this.Xg=c;i+=d;k=90-e;var e=Math.floor(i/m),d=Math.floor(k/m),u=n/2;i=Math.round(u-i%m/g);0>e&&(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;c<l.length;c++)this.oU(l[c][0],l[c][1],b,e,d,i,k,v,w);this.Go.ai=g;this.Go.width=n;this.Go.height=f;this.Go.heading=a.heading;this.Go.pitch=a.pitch}else{for(var B in this.Wg)(c=this.Wg[B])&&c.parentNode&&c.parentNode.removeChild(c),delete this.Wg[B];Td()&&(a=this.P.Rv, b=this.P.Sv,a&&(a.src=b.src="",a.style.visibility=b.style.visibility="hidden"))}},nU:function(a,b,c,d,e,f,g,i,k,l){var c=this.P.Rv,m=this.P.Sv,n=this,d=[k*d,l*d];if(!this.kJ||d!==this.cH)this.kJ=o,c.style.hc=c.style.WebkitTransition=m.style.hc=m.style.WebkitTransition="opacity 300ms ease-out",c.style.width=m.style.width=d[0]+"px",c.style.height=m.style.height=d[1]+"px",c.style.$U=m.style.$U=d[0]+"px, "+d[1]+"px",c.style.left=Math.round((0-i-a)/e+f/2)+"px",m.style.left=parseInt(c.style.left)+d[0]+ "px",c.onload=function(){-1!=this.src.indexOf("pos=0_0&z=1")&&n.P.dispatchEvent(new N("onthumbnail_complete"))},k="http://pcsv0.map.bdimg.com/scape/?qt=pdata&sid="+this.da.id+"&pos=0_0&z=1",c.src!=k&&(c.src=m.src=k);this.cH=d;a=Math.round((0-i-a)%360/e+f/2);c.style.top=m.style.top=Math.round(-(90-b)/e+g/2)+"px";0<a&&0>a-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]<f&&0<=a+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"):(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<v.width&&(l.opacity="1");v.EB={id:this.da.id,zoom:c,x:a,y:b};v.ontouchstart=function(a){a.preventDefault()};this.Wg[i]=v}},vS:function(a){var b=this.Wg[a];b&&(delete b.EB,b.onerror=b.onload=b.ontouchstart=p,b.style.display= "none");delete this.Wg[a];delete this.lo[a];b&&(b.Zz=o,b.src="")},Oc:function(a,b){var c=this.Ze;this.Ze=b;c!=this.Ze&&this.np()},Ik:function(){this.Pd={}},vf:function(){var a=this;this.vv--;if(0==this.vv){for(var b in this.lo)(function(){var c=b;setTimeout(function(){a.vS(c)},300)})();this.P.dispatchEvent(new N("ontilesloaded"))}},zq:function(a,b,c,d){var e=this.da.tiles.ep(d),f=(b+e)%e;0==d&&(f=(b+2*e)%(2*e));return a+"_"+f+"_"+c+"_"+d},rX:function(a){var b=this.Go,c=this.P.ha();if(c){var d=6378137* -(a.lat-c.lat)/180*Math.PI,e=6378137*(a.lng-c.lng)/180*Math.PI,a=Math.sqrt(Math.pow(d,2)+Math.pow(e,2)),c=b.heading%360-b.ai*b.width/2,f=b.pitch+b.ai*b.height/2,d=this.Da(d,-2.08,e);return{x:(180*(d.heading%360/Math.PI)-c)/b.ai,y:(f-180*(d.pitch/Math.PI))/b.ai,Aa:a}}return q},Da:function(a,b,c){var d=Math.pow(a,2),e=Math.pow(c,2);return{heading:0<c?Math.PI-Math.acos(a/Math.sqrt(d+e)):Math.PI+Math.acos(a/Math.sqrt(d+e)),pitch:Math.asin(b/Math.sqrt(d+Math.pow(b,2)+e))}},lQ:function(){var a=this.P,b= a.gh().height/2*this.Pd[this.da.id].ai;a.a_(-90+b,90-b)}});function mi(a){this.P=a;a.KA=this;this.$f=[];this.PG=[];this.uq=[];this.OG=[];this.jl=[];this.PH=[];this.Qv=[];this.LE=this.tI=this.sI=this.Vu=this.Uu=0;this.pK={};this.vt=this.Rx=q;Lb()?this.cf=this.Nz():Mb()?(this.Wa=this.Kz(),this.Ih=this.Wa.getContext("2d"),this.WP(),this.Wn=[]):Kb()&&(this.aw=this.SQ());this.Xa=p;this.Uy="#549eef";this.Pd={};this.Sn=this.Uj=o;this.ca()} var xi=[[0,-11],[4,-6.5],[2,-6.5],[2,-3],[-2,-3],[-2,-6.5],[-4,-6.5]],yi=[[5,-2],[5,-12],[-5,-12],[-5,-2]],zi=[[0,-110],[40,-65],[20,-65],[20,-30],[-20,-30],[-20,-65],[-40,-65]],Ai=[[45,-20],[45,-120],[-45,-120],[-45,-20]],Bi="\\u5317 \\u4e1c\\u5317 \\u4e1c \\u4e1c\\u5357 \\u5357 \\u897f\\u5357 \\u897f \\u897f\\u5317 \\u5317".split(" "); x.extend(mi.prototype,{Nz:function(){var a=K("svg",{version:"1.1",overflow:"hidden"},"http://www.w3.org/2000/svg"),b=this.P,c=b.Na().clientWidth,d=b.Na().clientHeight;this.cf=a;this.Uu=c;this.Vu=d;this.sI=b.Na().offsetLeft||0;this.tI=b.Na().offsetTop||0;this.YI(c,d);a.style.position="absolute";a.style.left="0";a.style.top="0";a.style.WebkitUserSelect=a.style.qP=a.style.MozUserSelect="none";b.Vj.appendChild(a);Lb()&&"cvsRender"==this.P.dk&&this.VZ(a);return a},VZ:function(a){var b=this,c=K("ellipse", {fill:"white","fill-rule":"evenodd","fill-opacity":"0.4",cx:"100",cy:"100",rx:"20",ry:"20"},"http://www.w3.org/2000/svg");c.setAttribute("visibility","hidden");this.cD=c;a.appendChild(c);a=this.P.Na();x.M(a,"mousedown",function(a){b.LE=(new Date).valueOf();b.CZ(a.offsetX||a.layerX||0,a.offsetY||a.layerY||0)});x.M(a,"mouseup",function(){200>(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,[\'<v:group style="behavior:url(#default#VML);z-index:1;width:\',b+"px;height:"+a+\'px;position:absolute;left:0;top:0;"\',\'coordsize="\'+b+","+a+\'" \',\'coordorigin="-\'+b/2+",-"+0.75*a+\'">\',"</v:group>"].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;f<k/2&&(f=k/2);k=(90-a)/200;c=10;Lb()?this.CI(this.da.id,this.da.links):Mb()?(this.Ih.clearRect(0,0,this.Wa.width,this.Wa.height),this.da.id!=this.Xa&&(this.Wn.length=0)):Kb()&&(c=36,this.zT(this.da.id, this.da.links));for(l=0;l<this.da.links.length;l++){var b=this.da.links[l].dir-e,b=(360+b)%360,g=i/2+50*Math.sin(Nb(b)),m=f-60*Math.cos(Nb(b))*k;if(Lb())this.cR(l,[i/2,f],[c,c*k],b),this.nR(l,[g,m]);else if(Mb()){var n="#444";d==l&&(n=this.Uy);this.gH([i/2,f+3],[c,c*k],b,"#000",0.4);this.gH([i/2,f],[c,c*k],b,"#fff",0.95,n);this.oR(l,[g,m],n);b=[i/2+60*Math.sin(Nb(b)),f-50*Math.cos(Nb(b))*k];this.Wn[l]=[Math.round(b[0]),Math.round(b[1])]}else Kb()&&(g=1,-30<a&&(g=80>a- -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;e<c;e++){var f=K("path",{fill:"black","fill-rule":"evenodd","fill-opacity":"0.4",stroke:"none"},"http://www.w3.org/2000/svg"),g=K("path",{fill:"white", "fill-rule":"evenodd","fill-opacity":"0.9",stroke:"#444","stroke-width":"0.2","stroke-linecap":"round"},"http://www.w3.org/2000/svg"),i=["M"],k=xi;i.push(k[0][0]);i.push(k[0][1]);for(var l=1;l<k.length;l++)i.push("L"),i.push(k[l][0]),i.push(k[l][1]);i.push(k[0][0]);i.push(k[0][1]);f.setAttribute("d",i.join(" "));this.uq.push(f);d.appendChild(f);g.setAttribute("d",i.join(" "));this.$f.push(g);d.appendChild(g);l=K("text",{fill:"#444","fill-rule":"evenodd",stroke:"none","font-size":"16px","font-family":"arial", "text-anchor":"middle","alignment-baseline":"middle"},"http://www.w3.org/2000/svg");l.style.WebkitUserSelect=l.style.qP=l.style.MozUserSelect="none";this.Qv.push(l);d.appendChild(l);var f=K("path",{fill:"white","fill-rule":"evenodd","fill-opacity":"0",stroke:"none",cursor:"pointer"},"http://www.w3.org/2000/svg"),m=this;f.MG=g;f.jJ=l;f.style.MozUserSelect="none";g=["M"];i=yi;g.push(i[0][0]);g.push(i[0][1]);for(l=1;l<i.length;l++)g.push("L"),g.push(i[l][0]),g.push(i[l][1]);f.setAttribute("d",g.join(" ")); x.M(f,G()?"touchstart":"mousedown",function(a){m.oo={heading:m.Ca.heading,pitch:m.Ca.pitch};m.Fq=this;this.MG.setAttribute("stroke",m.Uy);this.jJ.setAttribute("fill",m.Uy);Bb(a)});this.jl.push(f);d.appendChild(f);x.M(f,"mousemove",function(){m.vt=o});x.M(f,"mouseout",function(){m.vt=q})}x.M(this.P.B,G()?"touchend":"mouseup",function(a){if(m.Fq){if(m.Ca.heading==m.oo.heading&&m.Ca.pitch==m.oo.pitch){var b=m.Fq.getAttribute("sid");b&&(m.P.dispatchEvent(new N("onlinkclick")),m.P.rc(b));m.a1=m.b1=p}m.Fq.MG.setAttribute("stroke", "#444");m.Fq.jJ.setAttribute("fill","#444");m.oo=p;m.Fq=p;a.stopPropagation()}})}for(e=0;e<this.$f.length;e++)c="",e<linksCount?(d=this.Qv[e],0<d.childNodes.length&&d.removeChild(d.childNodes[0]),l=this.yH(b[e].dir),d.appendChild(document.createTextNode(l)),this.jl[e].setAttribute("sid",b[e].id)):c="none",this.$f[e].style.display=c,this.uq[e].style.display=c,this.Qv[e].style.display=c,this.jl[e].style.display=c}},WP:function(){var a=this,b=a.P;x.M(this.Wa,"touchstart",function(b){a.oo={heading:a.Ca.heading, pitch:a.Ca.pitch};var d=Ab(a.Wa);a.kv=a.rL(b.touches[0].clientX-d.left,b.touches[0].clientY-d.top);a.ua(a.Ca,a.Lc,a.Xg,a.kv)});x.M(this.Wa,"touchend",function(){a.Ca.heading==a.oo.heading&&a.Ca.pitch==a.oo.pitch&&a.da.links[a.kv]&&(b.dispatchEvent(new N("onlinkclick")),b.rc(a.da.links[a.kv].id));a.kv=p})},rL:function(a,b){for(var c=0;c<this.Wn.length;c++)if(30>Math.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<c;d++){for(var e=[],f=zi,g=0;g<f.length;g++)e.push(f[g][0]),e.push(f[g][1]);e.push(f[0][0]);e.push(f[0][1]);g=zb(this.aw,["<v:polyline ",\'points="\'+e.join(" ")+\'"\',\' style="behavior:url(#default#VML);z-index:1;left:0;top:0;" stroked="false"><v:fill style="behavior:url(#default#VML)" color="black" opacity="0.5"></v:fill><v:skew style="behavior:url(#default#VML)" on="true" origin="0,1.5" matrix="1,0,0,1,0,0" offset="0,0.05"></v:skew></v:polyline>\'].join("")); this.uq.push(g);this.OG.push(g.getElementsByTagName("skew")[0]);g=zb(this.aw,["<v:polyline ",\'points="\'+e.join(" ")+\'"\',\'fillcolor="white" stroked="true" strokecolor="#444" strokeweight="1" style="behavior:url(#default#VML);z-index:2;left:0;top:0;"><v:fill style="behavior:url(#default#VML)" color="white" opacity="1"></v:fill><v:skew style="behavior:url(#default#VML)" on="true" origin="0,1.5" matrix="1,0,0,1,0,0" offset="0,0"></v:skew></v:polyline>\'].join(""));this.$f.push(g);this.PG.push(g.getElementsByTagName("skew")[0]); e=[];f=Ai;for(g=0;g<f.length;g++)e.push(f[g][0]),e.push(f[g][1]);var g=zb(this.aw,[\'<v:polyline style="cursor:pointer;z-index:3;behavior:url(#default#VML);"\',\' points="\'+e.join(" ")+\'" stroked="false">\',\'<v:fill style="behavior:url(#default#VML);" color="white" opacity="0"></v:fill><v:skew style="behavior:url(#default#VML);" on="true" origin="0,1.2" matrix="1,0,0,1,0,0"></v:skew></v:polyline>\'].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;d<this.$f.length;d++)c="",d<linksCount?this.jl[d].sid=b[d].id:c="none",this.$f[d].style.display=c,this.uq[d].style.display=c,this.jl[d].style.display=c}},cR:function(a,b,c,d){this.$f[a]&&(this.$f[a].setAttribute("transform","translate("+b[0]+" "+b[1]+")scale("+c[0]+" "+c[1]+")rotate("+d+")"),this.uq[a].setAttribute("transform","translate("+b[0]+" "+(b[1]+4)+")scale("+c[0]+" "+c[1]+")rotate("+d+")"),this.jl[a].setAttribute("transform","translate("+b[0]+" "+b[1]+")scale("+c[0]+" "+c[1]+")rotate("+ d+")"))},nR:function(a,b){this.Qv[a].setAttribute("transform","translate("+b[0]+" "+b[1]+")")},dR:function(a,b,c){this.mz(this.PG[a],b,0,c);this.mz(this.OG[a],b,0.6,c);this.mz(this.PH[a],b,0,c)},mz:function(a,b,c,d){var e=Nb(b),b=Math.cos(e),e=Math.sin(e);a.matrix=[Number(b).toFixed(4),Number(-e).toFixed(4),Number(e*d).toFixed(4),Number(b*d).toFixed(4),0,0].join();a.offset="0,"+Math.round(50*c)/1E3},gH:function(a,b,c,d,e,f){var g=this.Ih;g.save();g.fillStyle=d;g.globalAlpha=e;g.translate(a[0],a[1]); g.scale(b[0],b[1]);g.rotate(Nb(c));g.beginPath();g.moveTo(xi[0][0],xi[0][1]);for(a=1;a<xi.length;a++)g.lineTo(xi[a][0],xi[a][1]);g.closePath();g.fill();f&&(g.lineWidth="0.2",g.lineCap="round",g.lineJoin="round",g.strokeStyle=f,g.stroke());g.restore()},oR:function(a,b,c){var d=this.Ih;d.save();a=this.yH(this.da.links[a].dir);d.font="16px sans-serif";d.textAlign="center";d.textBaseline="middle";d.fillStyle=c;d.fillText(a,b[0],b[1]);d.restore()},yH:function(a){return Bi[Math.ceil(Math.floor((a+360)% 360/22.5)/2)]},IL:ca(0),click:function(){if(!(2<Math.abs(this.mW-this.KY)||2<Math.abs(this.FK-this.FK))){var a=this.pK;if(a){for(var b=this.da.links,c=this.dX(a.yG,a.zG),d=30,e=0,f=0;f<b.length;f++)e=b[f].dir-c,e=180<Math.abs(e)?b[f].dir>c?360+c-b[f].dir:360-c+b[f].dir:Math.abs(e),e<d&&(d=e);29>d&&(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(4<coord.Aa){if(100<e){var f=e/100,e=100,d=d/f;d>e&&(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;0<a?c=180*(Math.atan(b/a)/Math.PI): 0>a?c=180*(Math.atan(b/a)/Math.PI)+180:0==a&&(c=0<b?90:-90);heading=180-c;360<heading?heading-=360:0>heading&&(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;a<b;a++)this.Ku[a]=0},No:function(a){this.Ku[a]=1;0===this.Oq[a]&&(this.fb.enableVertexAttribArray(a),this.Oq[a]=1)},MC:function(){for(var a=0,b=this.Oq.length;a<b;a++)this.Oq[a]!==this.Ku[a]&&(this.fb.disableVertexAttribArray(a),this.Oq[a]=0)}});if(!Ei)var Ei=1.0E-6;if(!Fi)var Fi="undefined"!==typeof Float32Array?Float32Array:Array;if(!Gi)var Gi=Math.random;var Hi={a4:function(a){Fi=a}};"undefined"!==typeof exports&&(exports.J2=Hi);var Ii=Math.PI/180;Hi.k4=function(a){return a*Ii}; var Ji={create:function(){var a=new Fi(2);a[0]=0;a[1]=0;return a},di:function(a){var b=new Fi(2);b[0]=a[0];b[1]=a[1];return b},sg:function(a,b){var c=new Fi(2);c[0]=a;c[1]=b;return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];return a},set:function(a,b,c){a[0]=b;a[1]=c;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a},du:function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a}};Ji.sub=Ji.du;Ji.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a};Ji.Pm=Ji.multiply; Ji.ss=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a};Ji.DK=Ji.ss;Ji.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a};Ji.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a};Ji.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a};Ji.IN=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;return a};Ji.nd=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return Math.sqrt(c*c+d*d)};Ji.Aa=Ji.nd; Ji.$t=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d};Ji.bO=Ji.$t;Ji.length=function(a){var b=a[0],a=a[1];return Math.sqrt(b*b+a*a)};Ji.BE=Ji.length;Ji.Qk=function(a){var b=a[0],a=a[1];return b*b+a*a};Ji.EF=Ji.Qk;Ji.TM=function(a,b){a[0]=-b[0];a[1]=-b[1];return a};Ji.normalize=function(a,b){var c=b[0],d=b[1],c=c*c+d*d;if(c>0){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;d<e;d=d+c){a[0]=b[d];a[1]=b[d+1];f(a,a,g);b[d]=a[0];b[d+1]=a[1]}return b}}();Ji.kn=function(a){return"vec2("+a[0]+", "+a[1]+")"};"undefined"!==typeof exports&&(exports.v4=Ji); var Li={create:function(){var a=new Fi(3);a[0]=0;a[1]=0;a[2]=0;return a},di:function(a){var b=new Fi(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b},sg:function(a,b,c){var d=new Fi(3);d[0]=a;d[1]=b;d[2]=c;return d},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a},set:function(a,b,c,d){a[0]=b;a[1]=c;a[2]=d;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];return a},du:function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}};Li.sub=Li.du; Li.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a};Li.Pm=Li.multiply;Li.ss=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a};Li.DK=Li.ss;Li.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a};Li.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a};Li.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a}; Li.IN=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;return a};Li.nd=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];return Math.sqrt(c*c+d*d+e*e)};Li.Aa=Li.nd;Li.$t=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];return c*c+d*d+e*e};Li.bO=Li.$t;Li.length=function(a){var b=a[0],c=a[1],a=a[2];return Math.sqrt(b*b+c*c+a*a)};Li.BE=Li.length;Li.Qk=function(a){var b=a[0],c=a[1],a=a[2];return b*b+c*c+a*a};Li.EF=Li.Qk; Li.TM=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};Li.normalize=function(a,b){var c=b[0],d=b[1],e=b[2],c=c*c+d*d+e*e;if(c>0){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;d<e;d=d+c){a[0]=b[d];a[1]=b[d+1];a[2]=b[d+2];f(a,a,g);b[d]=a[0];b[d+1]=a[1];b[d+2]=a[2]}return b}}();Li.kn=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};"undefined"!==typeof exports&&(exports.w4=Li); var Z={create:function(){var a=new Fi(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a},di:function(a){var b=new Fi(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},sg:function(a,b,c,d){var e=new Fi(4);e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},set:function(a,b,c,d,e){a[0]=b;a[1]=c;a[2]=d;a[3]=e;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a},du:function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1]; a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}};Z.sub=Z.du;Z.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];a[3]=b[3]*c[3];return a};Z.Pm=Z.multiply;Z.ss=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];a[3]=b[3]/c[3];return a};Z.DK=Z.ss;Z.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);a[3]=Math.min(b[3],c[3]);return a}; Z.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a};Z.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;return a};Z.IN=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;return a};Z.nd=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2],f=b[3]-a[3];return Math.sqrt(c*c+d*d+e*e+f*f)};Z.Aa=Z.nd; Z.$t=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2],f=b[3]-a[3];return c*c+d*d+e*e+f*f};Z.bO=Z.$t;Z.length=function(a){var b=a[0],c=a[1],d=a[2],a=a[3];return Math.sqrt(b*b+c*c+d*d+a*a)};Z.BE=Z.length;Z.Qk=function(a){var b=a[0],c=a[1],d=a[2],a=a[3];return b*b+c*c+d*d+a*a};Z.EF=Z.Qk;Z.TM=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a}; Z.normalize=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],c=c*c+d*d+e*e+f*f;if(c>0){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;d<e;d=d+c){a[0]=b[d];a[1]=b[d+1];a[2]=b[d+2];a[3]=b[d+3];f(a,a,g);b[d]=a[0];b[d+1]=a[1];b[d+2]=a[2];b[d+3]=a[3]}return b}}();Z.kn=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};"undefined"!==typeof exports&&(exports.x4=Z); var Mi={create:function(){var a=new Fi(4);a[0]=1;a[1]=0;a[2]=0;a[3]=1;return a},di:function(a){var b=new Fi(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},Dm:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=1;return a},AO:function(a,b){if(a===b){var c=b[1];a[1]=b[2];a[2]=c}else{a[0]=b[0];a[1]=b[2];a[2]=b[1];a[3]=b[3]}return a},lp:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c*f-e*d;if(!g)return p;g=1/g;a[0]=f*g;a[1]=-d*g;a[2]=-e*g; a[3]=c*g;return a},MJ:function(a,b){var c=b[0];a[0]=b[3];a[1]=-b[1];a[2]=-b[2];a[3]=c;return a},GC:function(a){return a[0]*a[3]-a[2]*a[1]},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*g+f*i;a[1]=e*g+b*i;a[2]=d*k+f*c;a[3]=e*k+b*c;return a}};Mi.Pm=Mi.multiply;Mi.rotate=function(a,b,c){var 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]=d*-g+f*c;a[3]=e*-g+b*c;return a}; Mi.scale=function(a,b,c){var d=b[1],e=b[2],f=b[3],g=c[0],c=c[1];a[0]=b[0]*g;a[1]=d*g;a[2]=e*c;a[3]=f*c;return a};Mi.kn=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};Mi.tD=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2))};Mi.q0=function(a,b,c,d){a[2]=d[2]/d[0];c[0]=d[0];c[1]=d[1];c[3]=d[3]-a[2]*c[1];return[a,b,c]};"undefined"!==typeof exports&&(exports.g3=Mi); var Ni={create:function(){var a=new Fi(6);a[0]=1;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;return a},di:function(a){var b=new Fi(6);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];return a},Dm:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;return a},lp:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=c*f-d*e;if(!k)return p;k=1/k;a[0]=f*k;a[1]=-d*k;a[2]=-e*k;a[3]=c*k;a[4]=(e*i-f*g)*k;a[5]= (d*g-c*i)*k;return a},GC:function(a){return a[0]*a[3]-a[1]*a[2]},multiply:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],b=b[5],k=c[0],l=c[1],m=c[2],n=c[3],u=c[4],c=c[5];a[0]=d*k+f*l;a[1]=e*k+g*l;a[2]=d*m+f*n;a[3]=e*m+g*n;a[4]=d*u+f*c+i;a[5]=e*u+g*c+b;return a}};Ni.Pm=Ni.multiply;Ni.rotate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],b=b[5],k=Math.sin(c),c=Math.cos(c);a[0]=d*c+f*k;a[1]=e*c+g*k;a[2]=d*-k+f*c;a[3]=e*-k+g*c;a[4]=i;a[5]=b;return a}; Ni.scale=function(a,b,c){var d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=c[0],c=c[1];a[0]=b[0]*k;a[1]=d*k;a[2]=e*c;a[3]=f*c;a[4]=g;a[5]=i;return a};Ni.translate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],b=b[5],k=c[0],c=c[1];a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=d*k+f*c+i;a[5]=e*k+g*c+b;return a};Ni.kn=function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"}; Ni.tD=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};"undefined"!==typeof exports&&(exports.h3=Ni); var Oi={create:function(){var a=new Fi(9);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a},T1:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a},di:function(a){var b=new Fi(9);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a},Dm:function(a){a[0]= 1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a},AO:function(a,b){if(a===b){var c=b[1],d=b[2],e=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=d;a[7]=e}else{a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8]}return a},lp:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],l=b[7],m=b[8],n=m*g-i*l,u=-m*f+i*k,v=l*f-g*k,w=c*n+d*u+e*v;if(!w)return p;w=1/w;a[0]=n*w;a[1]=(-m*d+e*l)*w;a[2]=(i*d-e*g)*w;a[3]=u*w;a[4]=(m*c-e*k)*w;a[5]= (-i*c+e*f)*w;a[6]=v*w;a[7]=(-l*c+d*k)*w;a[8]=(g*c-d*f)*w;return a},MJ:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],l=b[7],m=b[8];a[0]=g*m-i*l;a[1]=e*l-d*m;a[2]=d*i-e*g;a[3]=i*k-f*m;a[4]=c*m-e*k;a[5]=e*f-c*i;a[6]=f*l-g*k;a[7]=d*k-c*l;a[8]=c*g-d*f;return a},GC:function(a){var b=a[3],c=a[4],d=a[5],e=a[6],f=a[7],g=a[8];return a[0]*(g*c-d*f)+a[1]*(-g*b+d*e)+a[2]*(f*b-c*e)},multiply:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],k=b[5],l=b[6],m=b[7],b=b[8],n=c[0],u=c[1],v= c[2],w=c[3],y=c[4],C=c[5],A=c[6],B=c[7],c=c[8];a[0]=n*d+u*g+v*l;a[1]=n*e+u*i+v*m;a[2]=n*f+u*k+v*b;a[3]=w*d+y*g+C*l;a[4]=w*e+y*i+C*m;a[5]=w*f+y*k+C*b;a[6]=A*d+B*g+c*l;a[7]=A*e+B*i+c*m;a[8]=A*f+B*k+c*b;return a}};Oi.Pm=Oi.multiply;Oi.translate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],k=b[5],l=b[6],m=b[7],b=b[8],n=c[0],c=c[1];a[0]=d;a[1]=e;a[2]=f;a[3]=g;a[4]=i;a[5]=k;a[6]=n*d+c*g+l;a[7]=n*e+c*i+m;a[8]=n*f+c*k+b;return a}; Oi.rotate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],k=b[5],l=b[6],m=b[7],b=b[8],n=Math.sin(c),c=Math.cos(c);a[0]=c*d+n*g;a[1]=c*e+n*i;a[2]=c*f+n*k;a[3]=c*g-n*d;a[4]=c*i-n*e;a[5]=c*k-n*f;a[6]=l;a[7]=m;a[8]=b;return a};Oi.scale=function(a,b,c){var d=c[0],c=c[1];a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=c*b[3];a[4]=c*b[4];a[5]=c*b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};Oi.S1=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a}; Oi.JW=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c+c,i=d+d,k=e+e,c=c*g,l=d*g,d=d*i,m=e*g,n=e*i,e=e*k,g=f*g,i=f*i,f=f*k;a[0]=1-d-e;a[3]=l-f;a[6]=m+i;a[1]=l+f;a[4]=1-c-e;a[7]=n-g;a[2]=m-i;a[5]=n+g;a[8]=1-c-d;return a}; Oi.m3=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],l=b[7],m=b[8],n=b[9],u=b[10],v=b[11],w=b[12],y=b[13],C=b[14],A=b[15],B=c*i-d*g,D=c*k-e*g,E=c*l-f*g,J=d*k-e*i,O=d*l-f*i,M=e*l-f*k,Y=m*y-n*w,oa=m*C-u*w,m=m*A-v*w,ka=n*C-u*y,n=n*A-v*y,u=u*A-v*C,v=B*u-D*n+E*ka+J*m-O*oa+M*Y;if(!v)return p;v=1/v;a[0]=(i*u-k*n+l*ka)*v;a[1]=(k*m-g*u-l*oa)*v;a[2]=(g*n-i*m+l*Y)*v;a[3]=(e*n-d*u-f*ka)*v;a[4]=(c*u-e*m+f*oa)*v;a[5]=(d*m-c*n-f*Y)*v;a[6]=(y*M-C*O+A*J)*v;a[7]=(C*E-w*M-A*D)*v;a[8]=(w*O-y*E+A* B)*v;return a};Oi.kn=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};Oi.tD=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};"undefined"!==typeof exports&&(exports.i3=Oi); var qi={create:function(){var a=new Fi(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},di:function(a){var b=new Fi(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9]; a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},Dm:function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a},AO:function(a,b){if(a===b){var c=b[1],d=b[2],e=b[3],f=b[6],g=b[7],i=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=d;a[9]=f;a[11]=b[14];a[12]=e;a[13]=g;a[14]=i}else{a[0]=b[0];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=b[1];a[5]=b[5];a[6]=b[9];a[7]=b[13];a[8]=b[2]; a[9]=b[6];a[10]=b[10];a[11]=b[14];a[12]=b[3];a[13]=b[7];a[14]=b[11];a[15]=b[15]}return a},lp:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],l=b[7],m=b[8],n=b[9],u=b[10],v=b[11],w=b[12],y=b[13],C=b[14],A=b[15],B=c*i-d*g,D=c*k-e*g,E=c*l-f*g,J=d*k-e*i,O=d*l-f*i,M=e*l-f*k,Y=m*y-n*w,oa=m*C-u*w,ka=m*A-v*w,Qa=n*C-u*y,cb=n*A-v*y,Ya=u*A-v*C,Ea=B*Ya-D*cb+E*Qa+J*ka-O*oa+M*Y;if(!Ea)return p;Ea=1/Ea;a[0]=(i*Ya-k*cb+l*Qa)*Ea;a[1]=(e*cb-d*Ya-f*Qa)*Ea;a[2]=(y*M-C*O+A*J)*Ea;a[3]=(u*O-n*M-v*J)* Ea;a[4]=(k*ka-g*Ya-l*oa)*Ea;a[5]=(c*Ya-e*ka+f*oa)*Ea;a[6]=(C*E-w*M-A*D)*Ea;a[7]=(m*M-u*E+v*D)*Ea;a[8]=(g*cb-i*ka+l*Y)*Ea;a[9]=(d*ka-c*cb-f*Y)*Ea;a[10]=(w*O-y*E+A*B)*Ea;a[11]=(n*E-m*O-v*B)*Ea;a[12]=(i*oa-g*Qa-k*Y)*Ea;a[13]=(c*Qa-d*oa+e*Y)*Ea;a[14]=(y*D-w*J-C*B)*Ea;a[15]=(m*J-n*D+u*B)*Ea;return a},MJ:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],i=b[5],k=b[6],l=b[7],m=b[8],n=b[9],u=b[10],v=b[11],w=b[12],y=b[13],C=b[14],A=b[15];a[0]=i*(u*A-v*C)-n*(k*A-l*C)+y*(k*v-l*u);a[1]=-(d*(u*A-v*C)-n*(e* A-f*C)+y*(e*v-f*u));a[2]=d*(k*A-l*C)-i*(e*A-f*C)+y*(e*l-f*k);a[3]=-(d*(k*v-l*u)-i*(e*v-f*u)+n*(e*l-f*k));a[4]=-(g*(u*A-v*C)-m*(k*A-l*C)+w*(k*v-l*u));a[5]=c*(u*A-v*C)-m*(e*A-f*C)+w*(e*v-f*u);a[6]=-(c*(k*A-l*C)-g*(e*A-f*C)+w*(e*l-f*k));a[7]=c*(k*v-l*u)-g*(e*v-f*u)+m*(e*l-f*k);a[8]=g*(n*A-v*y)-m*(i*A-l*y)+w*(i*v-l*n);a[9]=-(c*(n*A-v*y)-m*(d*A-f*y)+w*(d*v-f*n));a[10]=c*(i*A-l*y)-g*(d*A-f*y)+w*(d*l-f*i);a[11]=-(c*(i*v-l*n)-g*(d*v-f*n)+m*(d*l-f*i));a[12]=-(g*(n*C-u*y)-m*(i*C-k*y)+w*(i*u-k*n));a[13]=c*(n* C-u*y)-m*(d*C-e*y)+w*(d*u-e*n);a[14]=-(c*(i*C-k*y)-g*(d*C-e*y)+w*(d*k-e*i));a[15]=c*(i*u-k*n)-g*(d*u-e*n)+m*(d*k-e*i);return a},GC:function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],i=a[6],k=a[7],l=a[8],m=a[9],n=a[10],u=a[11],v=a[12],w=a[13],y=a[14],a=a[15];return(b*g-c*f)*(n*a-u*y)-(b*i-d*f)*(m*a-u*w)+(b*k-e*f)*(m*y-n*w)+(c*i-d*g)*(l*a-u*v)-(c*k-e*g)*(l*y-n*v)+(d*k-e*i)*(l*w-m*v)},multiply:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=b[4],k=b[5],l=b[6],m=b[7],n=b[8],u=b[9],v=b[10],w= b[11],y=b[12],C=b[13],A=b[14],b=b[15],B=c[0],D=c[1],E=c[2],J=c[3];a[0]=B*d+D*i+E*n+J*y;a[1]=B*e+D*k+E*u+J*C;a[2]=B*f+D*l+E*v+J*A;a[3]=B*g+D*m+E*w+J*b;B=c[4];D=c[5];E=c[6];J=c[7];a[4]=B*d+D*i+E*n+J*y;a[5]=B*e+D*k+E*u+J*C;a[6]=B*f+D*l+E*v+J*A;a[7]=B*g+D*m+E*w+J*b;B=c[8];D=c[9];E=c[10];J=c[11];a[8]=B*d+D*i+E*n+J*y;a[9]=B*e+D*k+E*u+J*C;a[10]=B*f+D*l+E*v+J*A;a[11]=B*g+D*m+E*w+J*b;B=c[12];D=c[13];E=c[14];J=c[15];a[12]=B*d+D*i+E*n+J*y;a[13]=B*e+D*k+E*u+J*C;a[14]=B*f+D*l+E*v+J*A;a[15]=B*g+D*m+E*w+J*b;return a}}; qi.Pm=qi.multiply; qi.translate=function(a,b,c){var d=c[0],e=c[1],c=c[2],f,g,i,k,l,m,n,u,v,w,y,C;if(b===a){a[12]=b[0]*d+b[4]*e+b[8]*c+b[12];a[13]=b[1]*d+b[5]*e+b[9]*c+b[13];a[14]=b[2]*d+b[6]*e+b[10]*c+b[14];a[15]=b[3]*d+b[7]*e+b[11]*c+b[15]}else{f=b[0];g=b[1];i=b[2];k=b[3];l=b[4];m=b[5];n=b[6];u=b[7];v=b[8];w=b[9];y=b[10];C=b[11];a[0]=f;a[1]=g;a[2]=i;a[3]=k;a[4]=l;a[5]=m;a[6]=n;a[7]=u;a[8]=v;a[9]=w;a[10]=y;a[11]=C;a[12]=f*d+l*e+v*c+b[12];a[13]=g*d+m*e+w*c+b[13];a[14]=i*d+n*e+y*c+b[14];a[15]=k*d+u*e+C*c+b[15]}return a}; qi.scale=function(a,b,c){var d=c[0],e=c[1],c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*e;a[5]=b[5]*e;a[6]=b[6]*e;a[7]=b[7]*e;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a}; qi.rotate=function(a,b,c,d){var e=d[0],f=d[1],d=d[2],g=Math.sqrt(e*e+f*f+d*d),i,k,l,m,n,u,v,w,y,C,A,B,D,E,J,O,M,Y,oa,ka;if(Math.abs(g)<Ei)return p;g=1/g;e=e*g;f=f*g;d=d*g;i=Math.sin(c);k=Math.cos(c);l=1-k;c=b[0];g=b[1];m=b[2];n=b[3];u=b[4];v=b[5];w=b[6];y=b[7];C=b[8];A=b[9];B=b[10];D=b[11];E=e*e*l+k;J=f*e*l+d*i;O=d*e*l-f*i;M=e*f*l-d*i;Y=f*f*l+k;oa=d*f*l+e*i;ka=e*d*l+f*i;e=f*d*l-e*i;f=d*d*l+k;a[0]=c*E+u*J+C*O;a[1]=g*E+v*J+A*O;a[2]=m*E+w*J+B*O;a[3]=n*E+y*J+D*O;a[4]=c*M+u*Y+C*oa;a[5]=g*M+v*Y+A*oa;a[6]= m*M+w*Y+B*oa;a[7]=n*M+y*Y+D*oa;a[8]=c*ka+u*e+C*f;a[9]=g*ka+v*e+A*f;a[10]=m*ka+w*e+B*f;a[11]=n*ka+y*e+D*f;if(b!==a){a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]}return a};qi.CN=function(a,b,c){var d=Math.sin(c),c=Math.cos(c),e=b[4],f=b[5],g=b[6],i=b[7],k=b[8],l=b[9],m=b[10],n=b[11];if(b!==a){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]}a[4]=e*c+k*d;a[5]=f*c+l*d;a[6]=g*c+m*d;a[7]=i*c+n*d;a[8]=k*c-e*d;a[9]=l*c-f*d;a[10]=m*c-g*d;a[11]=n*c-i*d;return a}; qi.DN=function(a,b,c){var d=Math.sin(c),c=Math.cos(c),e=b[0],f=b[1],g=b[2],i=b[3],k=b[8],l=b[9],m=b[10],n=b[11];if(b!==a){a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]}a[0]=e*c-k*d;a[1]=f*c-l*d;a[2]=g*c-m*d;a[3]=i*c-n*d;a[8]=e*d+k*c;a[9]=f*d+l*c;a[10]=g*d+m*c;a[11]=i*d+n*c;return a}; qi.EN=function(a,b,c){var d=Math.sin(c),c=Math.cos(c),e=b[0],f=b[1],g=b[2],i=b[3],k=b[4],l=b[5],m=b[6],n=b[7];if(b!==a){a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]}a[0]=e*c+k*d;a[1]=f*c+l*d;a[2]=g*c+m*d;a[3]=i*c+n*d;a[4]=k*c-e*d;a[5]=l*c-f*d;a[6]=m*c-g*d;a[7]=n*c-i*d;return a}; qi.U1=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],i=d+d,k=e+e,l=f+f,b=d*i,m=d*k,d=d*l,n=e*k,e=e*l,f=f*l,i=g*i,k=g*k,g=g*l;a[0]=1-(n+f);a[1]=m+g;a[2]=d-k;a[3]=0;a[4]=m-g;a[5]=1-(b+f);a[6]=e+i;a[7]=0;a[8]=d+k;a[9]=e-i;a[10]=1-(b+n);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a}; qi.JW=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c+c,i=d+d,k=e+e,c=c*g,l=d*g,d=d*i,m=e*g,n=e*i,e=e*k,g=f*g,i=f*i,f=f*k;a[0]=1-d-e;a[1]=l+f;a[2]=m-i;a[3]=0;a[4]=l-f;a[5]=1-c-e;a[6]=n+g;a[7]=0;a[8]=m+i;a[9]=n-g;a[10]=1-c-d;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};qi.W1=function(a,b,c,d,e,f,g){var i=1/(c-b),k=1/(e-d),l=1/(f-g);a[0]=f*2*i;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=f*2*k;a[6]=0;a[7]=0;a[8]=(c+b)*i;a[9]=(e+d)*k;a[10]=(g+f)*l;a[11]=-1;a[12]=0;a[13]=0;a[14]=g*f*2*l;a[15]=0;return a}; qi.gZ=function(a,b,c){var b=1/Math.tan(b/2),d=1/-999.99;a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1000.01*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=20*d;a[15]=0};qi.v3=function(a,b,c,d,e,f,g){var i=1/(b-c),k=1/(d-e),l=1/(f-g);a[0]=-2*i;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*k;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*l;a[11]=0;a[12]=(b+c)*i;a[13]=(e+d)*k;a[14]=(g+f)*l;a[15]=1;return a}; qi.e3=function(a,b,c,d){var e,f,g,i,k,l,m,n,u=b[0],v=b[1],b=b[2];g=d[0];i=d[1];f=d[2];m=c[0];d=c[1];e=c[2];if(Math.abs(u-m)<Ei&&Math.abs(v-d)<Ei&&Math.abs(b-e)<Ei)return qi.Dm(a);c=u-m;d=v-d;m=b-e;n=1/Math.sqrt(c*c+d*d+m*m);c=c*n;d=d*n;m=m*n;e=i*m-f*d;f=f*c-g*m;g=g*d-i*c;if(n=Math.sqrt(e*e+f*f+g*g)){n=1/n;e=e*n;f=f*n;g=g*n}else g=f=e=0;i=d*g-m*f;k=m*e-c*g;l=c*f-d*e;if(n=Math.sqrt(i*i+k*k+l*l)){n=1/n;i=i*n;k=k*n;l=l*n}else l=k=i=0;a[0]=e;a[1]=i;a[2]=c;a[3]=0;a[4]=f;a[5]=k;a[6]=d;a[7]=0;a[8]=g;a[9]= l;a[10]=m;a[11]=0;a[12]=-(e*u+f*v+g*b);a[13]=-(i*u+k*v+l*b);a[14]=-(c*u+d*v+m*b);a[15]=1;return a};qi.kn=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"}; qi.tD=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};"undefined"!==typeof exports&&(exports.j3=qi);var Pi={create:function(){var a=new Fi(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}}; Pi.Q3=function(){var a=Li.create(),b=Li.sg(1,0,0),c=Li.sg(0,1,0);return function(d,e,f){var g=Li.xs(e,f);if(g<-0.999999){Li.Lw(a,b,e);Li.length(a)<1.0E-6&&Li.Lw(a,c,e);Li.normalize(a,a);Pi.LZ(d,a);return d}if(g>0.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;b<a;b++)this.Jg.push(0,b,b+1);this.Jg.push(0,b,1)},HD:function(){0==this.Jg.length&&this.kE();return this.Jg}});function Ri(a,b){this.Gf=a;this.vq=b||2;this.AA=a-this.vq;this.vc=[];this.Jg=[];this.lE()} x.extend(Ri.prototype,{lE:function(){for(var a,b,c=0;360>c;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;Zf<a-1;Zf++)this.Jg.push(Zf,Zf+a+1,Zf+a),this.Jg.push(Zf,Zf+1,Zf+a+1);this.Jg.push(Zf,a,Zf+a);this.Jg.push(Zf,0,a)},HD:function(){0==this.Jg.length&&this.kE();return this.Jg}});function Si(a){this.Gf=a;this.Qd=Math.pow(2,4);this.Er=this.Qd/2;this.vc=[];this.Yz=[];a=360/this.Qd;this.vJ=Math.cos(Nb(3*a))*this.Gf;this.wJ=Math.cos(Nb(2*a))*this.Gf;this.xJ=Math.cos(Nb(1*a))*this.Gf;this.gY()} x.extend(Si.prototype,{gY:function(){if(!(0<this.vc.length))for(var a=this.Gf,b=[],c=64/this.Qd,d=64/c,e=[],f=0,g=0,i,k=0;33>k;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;f<this.Er&&(this.vc[i]||(this.vc[i]=[]),this.vc[i].push(u,m,v));if(0<f&&0==k%c){var w= g+(f-1)*d;this.vc[w].push(u,m,v);0<n&&0==n%c&&this.vc[w-1]&&this.vc[w-1].push(u,m,v);63==n&&this.vc[w].push(e[0],e[1],e[2])}0==g&&0==n&&(e=[u,m,v]);0<n&&0==n%c&&this.vc[i-1]&&this.vc[i-1].push(u,m,v);f<this.Er&&63==n&&this.vc[i].push(e[0],e[1],e[2])}},fY:function(){for(var a=64/this.Qd,b=a+1,c=0;c<a;c++)for(var d=0;d<a;d++){var e=c*b,f=e+d+1;this.Yz.push(e+d,f,e+d+1+b);f=e+d+1+b;this.Yz.push(e+d,f,e+b+d)}return this.Yz},NW:function(a,b,c){var d=this.vc[Math.round(this.vc.length/2)];if(d){for(var e= [],f=Math.pow(2,5-a),b=b%f,c=c%f,g=64/this.Qd,i=1/g,k=1/(32/this.Er),l=0;l<d.length/3;l++){var m=l%(g+1)*i,n=Math.floor(l/(g+1))*k,m=m/f+1*b/f,n=n/f+1*c/f;1===a&&(n*=2);e.push(m,n)}return e}},ZW:function(a){var b=0,c=0,c=a[0],b=a[1],d=a[2],a=Math.round(180*Math.atan(Math.abs(d)/Math.abs(c))/Math.PI);0<c?0>d&&(a=360-a):a=0<d?180-a:180+a;c=b>this.xJ?7:b>this.wJ?6:b>this.vJ?5:0<b?4:b>-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.length;d++)if(a[d])for(var e=0;e<a[d].length;e++)a[d][e]&&(b.fb.deleteTexture(a[d][e].Ly),a[d][e].ws=q)}});this.lJ=new ri(32,{Eo:function(a){a&&(a.Zz=o,a.src="")}});this.rA=new si;this.Qd=16;this.Er=8;this.Gf=500;this.Sj=this.aj=0;this.Ef=[qi.create(),qi.create()];this.Sh=qi.create();this.UA=[qi.create(),qi.create()];this.pr=qi.create();this.SA=[];this.Ol=this.po=this.Vv=p;this.Mr= {};this.CR();this.FB=0;this.av=[p,p];this.sA=[p,p];this.kg=[];this.jg=G()?2:1;this.Qi()} x.extend(ji.prototype,{CR:function(){this.kl=[];for(var a=2;5>=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<a[3]&&0<d&&d<e?o:q},Oc:function(a,b,c){var c=c||{},d=c.sp||q,e=c.qZ||p;this.ho=this.Ze; this.Ze=b;this.Pq=p;var f=this,g=this.$i,i=a-g;f.$q&&(f.$q.stop(),f.$q=p);d?(f.$i=a,f.GU=q,f.ua(f.Ca,b)):f.$q=new sb({duration:600,Ic:60,hc:tb.OK,ua:function(a){if(a!=0){f.Pq=p;f.$i=g+i*a;a<0.5?f.ua(f.Ca,f.ho):f.ua(f.Ca,b);e&&e(f.$i)}},finish:function(){f.$q=p;f.$i=a;f.GU=q;f.P.dispatchEvent(new N("onzoom_changed"))},yt:function(){f.P.dispatchEvent(new N("onzoom_changed"));f.$q=p}})},QS:function(){var a=this;this.DI(0,0,1,function(){a.Qg||a.eI()})},eI:function(){for(var a=this.sA[0],b=a[0],c=a[1], d=a[3],a=a[2];a<=d;a++){var e=b,f=c;"number"===typeof this.tA&&(a>=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;b<this.kg.length;b++)this.kg[b].Dv(this.Sh,this.Ef[0],this.pr,this.UA[0])},mB:function(a,b){if(!this.da)return q;var c=this.av[a];if(!c)return q;var d=0==a?this.da.id:this.Bl;if(!d)return q;b&&qi.translate(this.Ef[a],this.SA[a],b);var e=c[0],f=c[1],g=c[2],c=c[3];this.Qg&&0==a&&(e-=2,f+=2,g-=2,c+=2,g=0>g?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,1<e&&(e=1,a.Tl=p)):(e=e.vC*(1-b),0>e&&(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];e<d&&(e+=this.Qd);i=k[1];k=this.Rj(0,c/2,a);k[0]>e&&(k[0]-=this.Qd);k[0]<d&&(d=k[0]);k=this.Rj(b,c/2,a);k[0]<d&&(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]<d&&(d=k[0]);f=k[1];k=this.Rj(b/2,c,a);k[1]<f&&(f=k[1]);k=this.Rj(b,c,a);k[0]<d&&(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&&g<this.Pl&&(g=this.Pl);this.jk!=p&&f>this.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(400<a)this.wI();else{var a=a/400,a=-a*(a-2),b=this.eB.links[this.$S];if(b){var c=b.dir+this.da.tiles.dirNorth;360<c&&(c%=360);var d=this.Rz*(1-a),e=Math.cos(Nb(c))*d,c=Math.sin(Nb(c))*d;try{this.mB(0,[e,0,c])}catch(f){}d=this.Sz*a;e=Math.cos(Nb(b.yh))* d;c=Math.sin(Nb(b.yh))*d;try{this.mB(1,[-e,0,-c])}catch(g){}}else this.wI()}},EC:function(){cancelAnimationFrame(this.RT);this.Qr.clear()}});function ki(a,b){this.P=a;this.Wa=b;this.aj=b.width;this.Sj=b.height;this.fb=b.getContext("webgl",{alpha:q});this.cw=Ci.get(this.fb,this.P.ba);this.da=this.ie=p;this.Pa=q;this.Qi();this.Sn=this.Uj=o;this.Ln=[0,-20,0];this.jg=G()?2:1;this.Gn=this.Hn=this.Fn=p;this.Pd={};a.KA=this;this.mo=a.kg.Ud;this.Sd=new R}var Ti=[10,-20,30,10,-20,10,-10,-20,10,-10,-20,30],Ui=[0,0,0,1,1,1,1,0],Vi=[2.2,-20,22.3,2.2,-20,13.7,-2.2,-20,13.7,-2.2,-20,22.3],Wi=[0,0,0,0.5,0.25,0.5,0.25,0]; x.extend(ki.prototype,{Qi:function(){this.UG=new Qi(8.5);this.NI=new Ri(10,1.5);this.RS();this.xA();this.DS();this.ca();this.bA();this.cA()},RS:function(){var a=new Image,b=this;a.crossOrigin="anonymous";a.onload=function(){this.kr=o;b.Fn=b.fb.createTexture();b.yA(b.Fn,this)};a.src="http://map.baidu.com/res_mobile2/images/link-arrow-shadow.png";a=new Image;a.crossOrigin="anonymous";a.onload=function(){this.kr=o;b.Hn=b.fb.createTexture();b.yA(b.Hn,this)};a.src="http://map.baidu.com/res_mobile2/images/link-arrow.png"; a=new Image;a.crossOrigin="anonymous";a.onload=function(){this.kr=o;b.Gn=b.fb.createTexture();b.yA(b.Gn,this)};a.src="http://map.baidu.com/res_mobile2/images/dir-texture.png"},xA:function(){var a=this.fb,b=this.ie=a.createProgram(),c=this.ql("attribute vec3 aVertexPosition;\\nuniform mat4 uMVMatrix;\\nuniform mat4 uPMatrix;\\nvoid main(void) {\\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\\n}",a.VERTEX_SHADER),d=this.ql("precision mediump float;\\nuniform float uColor;\\nuniform float uAlpha;\\nvoid main(void) {\\n gl_FragColor = vec4(uColor, uColor, uColor, 1.0) * uAlpha;\\n}", a.FRAGMENT_SHADER);a.attachShader(b,c);a.attachShader(b,d);a.linkProgram(b);a.useProgram(b)},DS:function(){var a=this.fb,b=this.hv=a.createProgram(),c=this.ql("attribute vec3 aVertexPosition;\\nattribute vec2 aVertexTextureCoord;\\nvarying highp vec2 vTextureCoord;\\nuniform mat4 uMVMatrix;\\nuniform mat4 uPMatrix;\\nvoid main(void) {\\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\\n vTextureCoord = aVertexTextureCoord;\\n}",a.VERTEX_SHADER),d=this.ql("precision mediump float;\\nuniform sampler2D uSampler;\\nvarying highp vec2 vTextureCoord;\\nvoid main(void) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}", a.FRAGMENT_SHADER);a.attachShader(b,c);a.attachShader(b,d);a.linkProgram(b);a.useProgram(b)},ql:function(a,b){var c=this.fb,d=c.createShader(b);c.shaderSource(d,a);c.compileShader(d);return d},yA:function(a,b){var c=this.fb;c.activeTexture(c.TEXTURE2);c.bindTexture(c.TEXTURE_2D,a);c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,q);c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR);c.bindTexture(c.TEXTURE_2D,p)},ca:function(){var a=this;x.M(this.Wa,"touchstart",function(b){if(!a.mo.Qg){a.nI=[a.P.Da().heading,a.P.Da().pitch];var c=b.changedTouches[0].pageX*a.jg,d=b.changedTouches[0].pageY*a.jg,e=p;a.Uj&&(e=a.AH(c,d));a.$0=[c,d];a.OH=e;e!==p&&(a.P.dispatchEvent(new N("onlinktouchstart")),a.kU=setTimeout(function(){for(var d= a.da.links,g=0;g<d.length;g++)if(d[g].id===e){a.UQ=d[g].dir;a.jb=g;break}a.NH=o;a.Jl=o;a.P.Jl=o;d=[c,(b.changedTouches[0].pageY-60)*a.jg];a.Ln=a.Uq(d);a.$G=a.vz(d);a.P.dispatchEvent(new N("onlongjumpstart"))},300))}});x.M(this.Wa,"touchend",function(){clearTimeout(a.kU);if(!a.mo.Qg)if(a.mo.QN(a.jb),a.Jl){a.Jl=q;a.P.Jl=q;a.NH=q;var b=a.UQ,c=a.vz();if(5>c)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=1<Math.abs(Math.round(a.nI[0])-Math.round(d.heading))||1<Math.abs(Math.round(a.nI[1])-Math.round(d.pitch))?q:o,a.CU&&a.da&&a.OH&&(a.P.dispatchEvent(new N("onlinkclick")),a.P.rc(a.OH,{Wl:o}),a.P.dispatchEvent(new N("onlinktouchend")))});x.M(this.Wa,"touchmove",function(b){!a.mo.Qg&&a.Jl&&(a.$G=a.vz([b.changedTouches[0].pageX*a.jg,(b.changedTouches[0].pageY-60)*a.jg]))})},wS:function(a,b){var c=a[2],d=[(b[0]+b[3]+b[6]+b[9])/4,(b[2]+b[5]+b[8]+ b[11])/4];return 12>Math.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<f;e++){var g=c.slice(12*e,12*e+12);if(this.wS(d,g)){this.jb=e;break}}return this.da.links[e]?this.da.links[e].id:p},IL:function(a,b){if(0===this.da.links.length||this.Sn===q)return 0;var c=this.Uq([a,b]),d=q;if(!c){d=this.P.fa();c=this.Uq([a,b+50*Math.pow(2,d-2)]);if(!c)return 0;d=o}for(var e=this.P.Da().heading;0> 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(100<i||-100>i)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(c<f)return this.P.rc(g.id,{Wl:o}),this.P.dispatchEvent(new N("onclickonroad")),c;300<c&&(c=300);d&&(c=300);e=this.da.links[e].dir;d=this.da.vh+Math.sin(Nb(e))*c;e=this.da.wh+Math.cos(Nb(e))*c;this.P.dispatchEvent(new N("onclickonroad"));this.P.sa(this.Sd.qh(new H(d, e)),{Wl:o});return c},vz:function(a){var b=this.Ln;a&&(b=this.Uq(a));if(!b)return 300;var c=this.da.links[this.jb].yh,d=Math.sin(Nb(c)),e=Math.cos(Nb(c)),a=Math.sin(Nb(-c)),c=Math.cos(Nb(-c)),f=e*b[0]+d*b[2],d=-d*b[0]+e*b[2];70<d&&(d=70);-70>d&&(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 300<b?300:b},xR:function(a){for(var b=360,c=-1,d=0;d<this.da.links.length;d++){var e=Math.abs(a-this.da.links[d].dir);e<b&&(b=e,c=d)}d=c==this.da.links.length-1?0:c+1;e=this.da.links[d].dir; if(e<this.da.links[c].dir&&(e=Math.abs(a-(e+360)),e<b))return d;d=0==c?this.da.links.length-1:c-1;e=this.da.links[d].dir;return e>this.da.links[c].dir&&(e=Math.abs(360+a-e),e<b)?d:c},mQ:function(a,b){return Math.sqrt(Math.pow(a[0]-b[0],2)+Math.pow(a[2]-b[2],2))},bA:function(){var a=this.ie,b=this.fb;a.zt=b.getUniformLocation(a,"uPMatrix");a.wt=b.getUniformLocation(a,"uMVMatrix");a.alpha=b.getUniformLocation(a,"uAlpha");a.color=b.getUniformLocation(a,"uColor");a=this.hv;a.zt=b.getUniformLocation(a, "uPMatrix");a.wt=b.getUniformLocation(a,"uMVMatrix");a.zZ=b.getUniformLocation(a,"uSampler")},cA:function(){var a=this.ie,b=this.fb;a.wn=b.getAttribLocation(a,"aVertexPosition");a=this.hv;a.wn=b.getAttribLocation(a,"aVertexPosition");a.qu=b.getAttribLocation(a,"aVertexTextureCoord")},sB:function(){var a=this.ie,b=this.fb;b.uniformMatrix4fv(a.zt,q,this.Sh);b.uniformMatrix4fv(a.wt,q,this.TA)},ua:s(),setData:function(a){if(this.da=a)this.Pd={},this.ZQ=this.da.tiles.dirNorth,this.Pa=o},Dv:function(a, b,c,d){this.fb&&(this.Pa&&this.da)&&(this.fb.useProgram(this.ie),this.Sh=a,this.TA=b,this.pr=c,this.cT=d,this.sB(),this.wb())},wb:function(){if(this.Sh&&this.TA){var a=this.yT(),b=this.fb,c=this.ie,d=this.hv;b.depthMask(q);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);var e=this.cw;e.jE();e.No(c.wn);e.MC();this.Jl&&(c=0.6,5>this.$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;i<this.da.links.length;i++){var m=this.da.links[i],n=Math.cos(Nb(m.yh))*g,u=Math.sin(Nb(m.yh))*g,l=qi.create();qi.Dm(l);qi.rotate(l,l,Nb(m.yh-90),[0,1,0]);for(var m=[n,k,u],n=Ti,u=Vi,v=0;v<f;v++){var w=this.RG(l,n,3*v);a.push(w[0]+m[0],m[1]-1,w[2]+m[2]);b.push(w[0]+m[0],m[1], w[2]+m[2]);w=this.RG(l,u,3*v);c.push(w[0]+m[0],m[1],w[2]+m[2])}}f=this.kQ(d,[],e,[]);return this.MS=a=[a,b,c,d,f[0],e,f[1]]},kQ:function(a,b,c,d){for(var e=0;e<this.da.links.length;e++){var f=4*e;a.push(f,f+1,f+2);a.push(f,f+2,f+3);c.push(f,f+1,f+3);c.push(f+2,f+3,f+1);b=b.concat(Ui);d=d.concat(this.PR(this.da.links[e].dir))}return[b,d]},RG:function(a,b,c){return[a[0]*b[c]+a[1]*b[c+1]+a[2]*b[c+2],0,a[8]*b[c]+a[9]*b[c+1]+a[10]*b[c+2]]},Mq:function(a,b,c,d,e,f,g){var i=this.fb,k=this.ie;f&&(k=this.hv); var l=[0,0,0],m=[];if(c){l[0]=c[0];l[2]=c[2];for(var n=0;n<a.length/3;n++){var u=3*n;m.push(a[u]+l[0],c[1],a[u+2]+l[2])}}else m=a;f?(this.Ol||(this.Ol=i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,this.Ol),i.bufferData(i.ARRAY_BUFFER,new Float32Array(g),i.STATIC_DRAW),i.vertexAttribPointer(k.qu,2,i.FLOAT,q,0,0)):(i.uniform1f(k.color,d),i.uniform1f(k.alpha,e));this.cI||(this.cI=i.createBuffer());i.bindBuffer(i.ARRAY_BUFFER,this.cI);i.bufferData(i.ARRAY_BUFFER,new Float32Array(m),i.STATIC_DRAW);this.ov|| (this.ov=i.createBuffer());i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.ov);i.bufferData(i.ELEMENT_ARRAY_BUFFER,new Uint16Array(b),i.STATIC_DRAW);this.ov.SF=b.length;i.vertexAttribPointer(k.wn,3,i.FLOAT,q,0,0);i.drawElements(i.TRIANGLES,this.ov.SF,i.UNSIGNED_SHORT,0)},Uq:function(a,b){var c=this.pr,d=this.cT;if(c){var e=a[0],f=a[1],g=this.aj,i=this.Sj,k=Z.create(),e=Z.sg(2*e/g-1,1-2*f/i,-1,1);qi.multiply(k,c,e);qi.multiply(k,d,k);c=200*k[0];d=200*k[1];k=200*k[2];e=(b||-20)/d;if(!(0>e))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<a.length;d++)a[d]=0==d%2?a[d]+0.25*c:a[d]+0.5*b;return a},yV:function(){this.Pd={}},show:function(){this.Uj=o},U:function(){this.Uj=q},dD:function(){this.Sn=o},JC:function(){this.Sn=q},EC:function(){this.yV();var a=this.fb;a.deleteTexture(this.Fn);a.deleteTexture(this.Hn);a.deleteTexture(this.Gn);this.Gn= this.Hn=this.Fn=p}}); ');
|