{"size": 329532, "ext": "js", "max_stars_repo_path": "js/maptalks.min.js", "max_stars_repo_name": "zakbnou/Changementclim", "max_stars_repo_stars_event_min_datetime": "2020-11-29T19:17:20.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-30T18:45:08.000Z", "max_issues_repo_path": "js/maptalks.min.js", "max_issues_repo_name": "zakbnou/Changementclim", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/maptalks.min.js", "max_forks_repo_name": "zakbnou/Changementclim", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 54922.0, "max_line_length": 329448, "alphanum_fraction": 0.7376734278}
/*!
 * maptalks v0.27.0
 * LICENSE : BSD-3-Clause
 * (c) 2016-2017 maptalks.org
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.maptalks=t.maptalks||{})}(this,(function(t){"use strict";function e(t,e){for(var i=Object.getOwnPropertyNames(e),n=0;n<i.length;n++){var r=i[n],o=Object.getOwnPropertyDescriptor(e,r);o&&o.configurable&&void 0===t[r]&&Object.defineProperty(t,r,o)}return t}function i(){return Date.now()}function n(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)t[n]=i[n]}return t}function r(t){return null==t}function o(t){return"number"==typeof t&&!isNaN(t)}function s(t){return(0|t)===t}function a(t){return"object"===(void 0===t?"undefined":me(t))&&!!t}function h(t){return!r(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function l(t){return!r(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function p(t,e){return Ce.call(t,e)}function u(t,e){return t.join?t.join(e||","):Array.prototype.join.call(t,e||",")}function c(t){return t.length>4&&".svg"===t.slice(-4)?1:"data:image/svg+xml"===t.slice(0,"data:image/svg+xml".length)?2:0}function d(t,e){be&&d.node?d.node(t,e):t.src=e[0]}function f(){return Se++}function g(t){return t&&h(t)?JSON.parse(t):t}function y(t,e){!function i(){e()?t():Me(i)}()}function _(t,e){for(var i=0,n=e.length;i<n;i++)t.push(e[i]);return t.length}function m(t,e){var i=e.indexOf(t);i>-1&&e.splice(i,1)}function v(t,e,i){if(!Array.isArray(t))return i?e.call(i,t):e(t);for(var n=[],o=void 0,s=void 0,a=0,h=t.length;a<h;a++)r(o=t[a])?n.push(null):Array.isArray(o)?n.push(v(o,e,i)):(s=i?e.call(i,o):e(o),n.push(s));return n}function x(t,e){return void 0===t?e:t}function w(t){return t>0?.5+t<<0:t-.5<<0}function C(t){return Math.sign?Math.sign(t):0===(t=+t)||isNaN(t)?Number(t):t>0?1:-1}function b(t,e,i){return t*(1-i)+e*i}function M(t,e,i){var n=i-e,r=((t-e)%n+n)%n+e;return r===e?i:r}function P(t,e,i){return Math.min(i,Math.max(e,t))}function S(t){return Array.isArray(t)&&t.length>0}function T(t){if(!t)return!1;var e=t.slice(0,6);return"http:/"===e||"https:"===e||"file:/"===e}function k(t){if(!h(t))return 0;var e=t.slice(0,6);return"http:/"===e||"https:"===e?3:Oe.test(t)?1:ke.test(t)?2:0}function O(t){var e=k(t),i=void 0;return 3===e?t:1===e?(i=Oe.exec(t))[1]:2===e?(i=ke.exec(t))[2]:t}function E(t){if("undefined"!=typeof window&&window.btoa)return window.btoa(t);for(var e,i,n=String(t),r="",o=0,s=Ee;n.charAt(0|o)||(s="=",o%1);r+=s.charAt(63&e>>8-o%1*8)){if((i=n.charCodeAt(o+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|i}return r}function L(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.atan2(n,i)}function D(t){return new Function("f","var p = (f && f.properties || {}); return "+R(t))}function R(t){if(!t)return"true";var e=t[0];return t.length<=1?"any"===e?"false":"true":"("+("=="===e?I(t[1],t[2],"===",!1):"!="===e?I(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?I(t[1],t[2],e,!0):"any"===e?z(t.slice(1),"||"):"all"===e?z(t.slice(1),"&&"):"none"===e?H(z(t.slice(1),"||")):"in"===e?j(t[1],t.slice(2)):"!in"===e?H(j(t[1],t.slice(2))):"has"===e?Z(t[1]):"!has"===e?H(Z([t[1]])):"true")+")"}function A(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function I(t,e,i,n){var r=A(t),o="$type"===t?De.indexOf(e):JSON.stringify(e);return(n?"typeof "+r+"=== typeof "+o+"&&":"")+r+i+o}function z(t,e){return t.map(R).join(e)}function j(t,e){"$type"===t&&(e=e.map((function(t){return De.indexOf(t)})));var i=JSON.stringify(e.sort(F)),n=A(t);return e.length<=200?i+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1;    if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+i+",0,"+(e.length-1)+")"}function Z(t){return JSON.stringify(t)+" in p"}function H(t){return"!("+t+")"}function F(t,e){return t<e?-1:t>e?1:0}function G(t){var e=t._toJSON(),i=e.feature;return i.type=De.indexOf(i.geometry.type),i.subType=e.subType,i}function N(t){if(!Array.isArray(t))return N([t]);for(var e=[],i=0;i<t.length;i++)!0===t[i].filter?e.push({filter:function(){return!0},symbol:t[i].symbol}):e.push({filter:D(t[i].filter),symbol:t[i].symbol});return e}function W(t,e){var i;if(Q(t)){var n,r="object"===me(t.stops[0][0]),o=r||void 0!==t.property,s=r||!o,a=t.type||e||"exponential";if("exponential"===a)n=J;else if("interval"===a)n=V;else{if("categorical"!==a)throw new Error('Unknown function type "'+a+'"');n=B}if(r){for(var h={},l=[],p=0;p<t.stops.length;p++){var u=t.stops[p];void 0===h[u[0].zoom]&&(h[u[0].zoom]={zoom:u[0].zoom,type:t.type,property:t.property,stops:[]}),h[u[0].zoom].stops.push([u[0].value,u[1]])}for(var c in h)l.push([h[c].zoom,W(h[c])]);(i=function(e,i){return J({stops:l,base:t.base},e)(e,i)}).isFeatureConstant=!1,i.isZoomConstant=!1}else s?((i=function(e){return n(t,e)}).isFeatureConstant=!0,i.isZoomConstant=!1):((i=function(e,i){return n(t,i[t.property])}).isFeatureConstant=!1,i.isZoomConstant=!0)}else(i=function(){return t}).isFeatureConstant=!0,i.isZoomConstant=!0;return i}function B(t,e){for(var i=0;i<t.stops.length;i++)if(e===t.stops[i][0])return t.stops[i][1];return t.stops[0][1]}function V(t,e){for(var i=0;i<t.stops.length&&!(e<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function J(t,e){for(var i=void 0!==t.base?t.base:1,n=0;!(n>=t.stops.length)&&!(e<=t.stops[n][0]);)n++;return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:U(e,i,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function U(t,e,i,n,r,o){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),a=o.apply(void 0,arguments);return U(t,e,i,n,s,a)}:r.length?Y(t,e,i,n,r,o):q(t,e,i,n,r,o)}function q(t,e,i,n,r,o){var s,a=n-i,h=t-i;return r*(1-(s=1===e?h/a:(Math.pow(e,h)-1)/(Math.pow(e,a)-1)))+o*s}function Y(t,e,i,n,r,o){for(var s=[],a=0;a<r.length;a++)s[a]=q(t,e,i,n,r[a],o[a]);return s}function Q(t){return t&&"object"===(void 0===t?"undefined":me(t))&&t.stops}function X(t){for(var e in t)if(Q(t[e]))return!0;return!1}function K(t){return W(t,"exponential")}function $(t){return W(t,"interval")}function tt(t,e){if(!t)return null;var i=!1;if(Array.isArray(t)){for(var n,r=[],o=0;o<t.length;o++)(n=tt(t[o],e))?(r.push(n),i=!0):r.push(t[o]);return i?r:t}var s,a={__fn_types_loaded:!0},h=[];for(s in t)t.hasOwnProperty(s)&&h.push(s);for(var l=0,p=h.length;l<p;l++)Q(t[s=h[l]])?(i=!0,a["_"+s]=t[s],function(t){Object.defineProperty(a,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=K(this["_"+t])),this["__fn_"+t].apply(this,e())},set:function(e){this["_"+t]=e},configurable:!0,enumerable:!0})}(s)):a[s]=t[s];return i?a:t}function et(t){if(!t||!t.stops)return[];for(var e=[],i=0,n=t.stops.length;i<n;i++)e.push(t.stops[i][1]);return e}function it(t){return t&&t.colorStops}function nt(t){var e=[t.type];if(t.places&&e.push(t.places.join()),t.colorStops){for(var i=[],n=t.colorStops.length-1;n>=0;n--)i.push(t.colorStops[n].join());e.push(i.join(","))}return e.join("_")}function rt(t){var e=[];if(Array.isArray(t)){for(var i=0;i<t.length;i++)e.push(rt(t[i]));return"[ "+e.join(" , ")+" ]"}for(var n in t)p(t,n)&&(it(t[n])?e.push(n+"="+nt(t[n])):e.push(n+"="+t[n]));return e.join(";")}function ot(t,e){function i(t,e){r(t.opacity)?t.opacity=e:t.opacity*=e}var o=void 0;if(Array.isArray(t)){o=[];for(var s=0;s<t.length;s++){var a=n({},t[s]);i(a,e),o.push(a)}}else i(o=n({},t),e);return o}function st(t){var e=Array.prototype.slice.call(arguments,1);if(e&&e.length||(e=[{}]),Array.isArray(t)){for(var i=void 0,o=void 0,s=[],a=0,h=t.length;a<h;a++){i=t[a],o={};for(var l=0,p=e.length;l<p;l++)Array.isArray(e[l])?r(e[l][a])?n(o,i||{}):n(o,i,e[l][a]):n(o,i,e[l]?e[l]:{});s.push(o)}return s}var u=[{},t];return u.push.apply(u,e),n.apply(this,u)}function at(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ht(t){return h(t)?t.replace(Ze,""):t}function lt(t){return at(t).split(/\s+/)}function pt(t,e){if(pt.env)return pt.env(t,e);var i=Gt("span");i.style.font=e,i.innerHTML=t;var n=new je(i.clientWidth,i.clientHeight);return mt(i),n}function ut(t,e,i){for(var n=Math.ceil(e/i),r=e/t.length,o=Math.floor(i/r),s=[],a=0;a<n;a++)a<n-1?s.push(t.substring(a*o,(a+1)*o)):s.push(t.substring(a*o));return s}function ct(t,e){return a(e)&&h(t)?t.replace(He,(function(t,i){var n=e[i];return r(n)?t:n})):t}function dt(t,e,i){var n=t.width,r=t.height,o=void 0,s=void 0;return"left"===e?o=-n:"middle"===e?o=-n/2:"right"===e&&(o=0),"top"===i?s=-r:"middle"===i?s=-r/2:"bottom"===i&&(s=0),new ze(o,s)}function ft(t){return t.textFont?t.textFont:(t.textStyle&&"normal"!==t.textStyle?t.textStyle+" ":"")+(t.textWeight&&"normal"!==t.textWeight?t.textWeight+" ":"")+t.textSize+"px "+('"'===t.textFaceName[0]?t.textFaceName:'"'+t.textFaceName+'"')}function gt(t,e){var i=ft(e),n=e.textLineSpacing||0,r=pt(t,i),o=r.width,s=r.height,a=e.textWrapCharacter,l=[],p=e.textWrapWidth;(!p||p>o)&&(p=o),h(t)||(t+="");var u=0,c=void 0;if(a&&t.indexOf(a)>=0)for(var d=t.split(a),f=void 0,g=void 0,y=void 0,_=void 0,m=0,v=d.length;m<v;m++)if((y=(g=pt(f=d[m],i)).width)>p)for(var x=0,w=(_=ut(f,y,p)).length;x<w;x++)(c=pt(_[x],i)).width>u&&(u=c.width),l.push({text:_[x],size:c});else g.width>u&&(u=g.width),l.push({text:f,size:g});else if(o>p)for(var C=ut(t,o,p),b=0;b<C.length;b++)(c=pt(C[b],i)).width>u&&(u=c.width),l.push({text:C[b],size:c});else r.width>u&&(u=r.width),l.push({text:t,size:r});var M=l.length;return{total:M,size:new je(u,s*M+n*(M-1)),rows:l,rawSize:r}}function yt(t,e){var i=document.createElement(t);return e&&Dt(i,e),i}function _t(t,e,i){var n=yt(t);return e&&Ot(n,e),i&&i.appendChild(n),n}function mt(t){if(!t)return this;if(ki.ielt9||ki.ie9){var e=yt("div");e.appendChild(t),e.innerHTML="",e=null}else t.parentNode&&t.parentNode.removeChild(t);return this}function vt(t,e,i,n){if(!(t&&t.addEventListener&&e&&i))return this;for(var r=function(e){e||(e=window.event),i.call(n||t,e)},o=e.split(" "),s=o.length-1;s>=0;s--){var a=o[s];a&&(t["Z__"+a]||(t["Z__"+a]=[]),wt(t,a,i)>=0&&xt(t,a,i),t["Z__"+a].push({callback:r,src:i}),"mousewheel"===a&&ki.gecko&&(a="DOMMouseScroll"),t.addEventListener(a,r,!1))}return this}function xt(t,e,i){function n(e,i){"mousewheel"===e&&ki.gecko&&(e="DOMMouseScroll"),t.removeEventListener(e,i,!1)}if(!t||!t.removeEventListener||!e)return this;for(var r=e.split(" "),o=r.length-1;o>=0;o--){var s=r[o];if(s){if(!i&&t["Z__"+s]){for(var a=t["Z__"+s],h=0,l=a.length;h<l;h++)n(a[h].callback);return delete t["Z__"+s],this}var p=wt(t,s,i);if(p<0)return this;n(s,t["Z__"+s][p].callback),t["Z__"+s].splice(p,1)}}return this}function wt(t,e,i){if(!t||!t["Z__"+e]||!i)return-1;for(var n=t["Z__"+e],r=0,o=n.length;r<o;r++)if(n[r].src===i)return r;return-1}function Ct(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function bt(t){return t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,this}function Mt(t){return t.onselectstart=function(){return!1},t.ondragstart=function(){return!1},t.setAttribute("unselectable","on"),this}function Pt(t,e){return t?(ki.any3d?zt(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px"),e):null}function St(t){var e=window.getComputedStyle(t),i=[parseInt(e["padding-left"]),parseInt(e["padding-top"])],n=t.getBoundingClientRect();return t.__position=[n.left+i[0],n.top+i[1]],t.__position}function Tt(t,e){t||(t=window.event);var i=e.__position;return i||(i=St(e)),new ze(t.clientX-i[0]-e.clientLeft,t.clientY-i[1]-e.clientTop)}function kt(t,e){var i=t.length-e.length;return i>=0&&t.indexOf(e,i)===i}function Ot(t,e){var i=t.style.cssText;return kt(i,";")||(i+=";"),t.style.cssText=i+e,this}function Et(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=Rt(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function Lt(t,e){if(void 0===t.classList||Et(t,e)){var i=Rt(t);Dt(t,(i?i+" ":"")+e)}else for(var n=lt(e),r=0,o=n.length;r<o;r++)t.classList.add(n[r]);return this}function Dt(t,e){return r(t.className.baseVal)?t.className=e:t.className.baseVal=e,this}function Rt(t){return r(t.className.baseVal)?t.className:t.className.baseVal}function At(t,e){return t.style.opacity=e,this}function It(t){if(be)return null;var e=yt("canvas");return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e}function zt(t,e){var i=e||new ze(0,0);return t.style[We]=ki.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)",this}function jt(t,e){var i="matrix("+(h(e)?e:e.join())+")";return t.style[We]!==i&&(t.style[We]=i),this}function Zt(t){return t.style[We]&&(t.style[We]=""),this}function Ht(t){return/<[a-z\][\s\S]*>/i.test(t)}function Ft(t,e){var i=Gt(t);h(e)?i.innerHTML=e:i.appendChild(e);var n=new je(i.clientWidth,i.clientHeight);return mt(i),n}function Gt(t){var e=document.createElement(t);return e.style.cssText="position:absolute;left:-10000px;top:-10000px;",document.body.appendChild(e),e}function Nt(t,e){var i=[t];for(var n in e)e.hasOwnProperty(n)&&n.length>4&&"text"===n.substring(0,4)&&i.push(n+"="+e[n]);return i.join("-")}function Wt(t){var e={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return"butt"===e.stroke["stroke-linecap"]&&ki.vml&&(e.stroke["stroke-linecap"]="flat"),0===e.stroke["stroke-width"]&&(e.stroke["stroke-opacity"]=0),e}function Bt(t,e,i){if(!t.markerPath)return null;var s=1,a=Wt(t);o(t.markerOpacity)&&(s=t.markerOpacity),o(t.opacity)&&(s*=t.opacity);var l={};if(a){for(var p in a.stroke)a.stroke.hasOwnProperty(p)&&(r(a.stroke[p])||(l[p]=a.stroke[p]));for(var u in a.fill)a.fill.hasOwnProperty(u)&&(r(a.fill[u])||(l[u]=a.fill[u]))}for(var c=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath],d=void 0,f=[],g=0;g<c.length;g++)(d=n({},d=h(c[g])?{path:c[g]}:c[g],l)).d=d.path,delete d.path,f.push(d);var y=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];s<1&&y.push('opacity="'+s+'"'),t.markerPathWidth&&t.markerPathHeight&&y.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),y.push('preserveAspectRatio="none"'),e&&y.push('width="'+e+'"'),i&&y.push('height="'+i+'"'),y.push("><defs></defs>");for(var _=0;_<f.length;_++){var m="<path ";for(var v in f[_])f[_].hasOwnProperty(v)&&(m+=" "+v+'="'+f[_][v]+'"');m+="></path>",y.push(m)}return y.push("</svg>"),"data:image/svg+xml;base64,"+E(y.join(" "))}function Vt(t,e){if(!t)return[];var i=t;Array.isArray(t)||(i=[t]);for(var n=[],r=Ae.resourceProperties,o=void 0,s=void 0,a=void 0,h=void 0,l=i.length-1;l>=0;l--)if(t=i[l]){e&&(t=Jt(t));for(var p=0;p<r.length;p++)if(Q(o=t[r[p]])&&(o=et(o)),o){Array.isArray(o)||(o=[o]);for(var u=0;u<o.length;u++)"url("===o[u].slice(0,4)&&(o[u]=O(o[u])),s=Ae.resourceSizeProperties[p],n.push([o[u],t[s[0]],t[s[1]]])}if("path"===t.markerType&&t.markerPath)if(a=Q(t.markerWidth)?200:t.markerWidth,h=Q(t.markerHeight)?200:t.markerHeight,Q(t.markerPath)){o=et(t.markerPath);for(var c=t.markerPath,d=0;d<o.length;d++)t.markerPath=o[d],n.push([Bt(t),a,h]);t.markerPath=c}else n.push([Bt(t),a,h])}return n}function Jt(t){if(!t)return null;var e=t;if(be)return e;for(var i=Ae.resourceProperties,n=void 0,r=0,o=i.length;r<o;r++)(n=e[i[r]])&&(e[i[r]]=Ut(n));return e}function Ut(t){if(Q(t)){for(var e=t.stops,i=0;i<e.length;i++)e[i][1]=Ut(e[i][1]);return t}return"url("===t.slice(0,4)&&(t=O(t)),!T(t)&&(t.length<="data:".length||"data:"!==t.substring(0,"data:".length))&&(t=qt(location.href,t)),t}function qt(t,e){var i=t.split("/"),n=e.split("/");if(0===e.slice(0,1))return i.slice(0,3).join("/")+e;i.pop();for(var r=0;r<n.length;r++)"."!==n[r]&&(".."===n[r]?i.pop():i.push(n[r]));return i.join("/")}function Yt(t){Qi[t.measure]=t}function Qt(t,e){return t(e={exports:{}},e.exports),e.exports}function Xt(t,e,i){var n=t.x,r=t.y,o=e.x,s=e.y,a=i.x,h=i.y,l=(a-o)*(n-o)+(h-s)*(r-s);if(l<=0)return Math.sqrt((n-o)*(n-o)+(r-s)*(r-s));var p=(a-o)*(a-o)+(h-s)*(h-s);if(l>=p)return Math.sqrt((n-a)*(n-a)+(r-h)*(r-h));var u=l/p,c=o+(a-o)*u,d=s+(h-s)*u;return Math.sqrt((n-c)*(n-c)+(r-d)*(r-d))}function Kt(t,e){for(var i=void 0,n=void 0,r=e.length,o=!1,s=0,a=r-1;s<r;a=s++)i=e[s],n=e[a],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(o=!o);return o}function $t(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*s,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*s,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*s,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*s,t}function te(t,e,i,n,r){var o=1/Math.tan(e/2),s=1/(n-r);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(r+n)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*r*n*s,t[15]=0,t}function ee(t,e,i){var n,r,o,s,a,h,l,p,u,c,d,f,g=i[0],y=i[1],_=i[2];return e===t?(t[12]=e[0]*g+e[4]*y+e[8]*_+e[12],t[13]=e[1]*g+e[5]*y+e[9]*_+e[13],t[14]=e[2]*g+e[6]*y+e[10]*_+e[14],t[15]=e[3]*g+e[7]*y+e[11]*_+e[15]):(n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],h=e[5],l=e[6],p=e[7],u=e[8],c=e[9],d=e[10],f=e[11],t[0]=n,t[1]=r,t[2]=o,t[3]=s,t[4]=a,t[5]=h,t[6]=l,t[7]=p,t[8]=u,t[9]=c,t[10]=d,t[11]=f,t[12]=n*g+a*y+u*_+e[12],t[13]=r*g+h*y+c*_+e[13],t[14]=o*g+l*y+d*_+e[14],t[15]=s*g+p*y+f*_+e[15]),t}function ie(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function ne(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[4],s=e[5],a=e[6],h=e[7],l=e[8],p=e[9],u=e[10],c=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*r+l*n,t[5]=s*r+p*n,t[6]=a*r+u*n,t[7]=h*r+c*n,t[8]=l*r-o*n,t[9]=p*r-s*n,t[10]=u*r-a*n,t[11]=c*r-h*n,t}function re(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[0],s=e[1],a=e[2],h=e[3],l=e[4],p=e[5],u=e[6],c=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r+l*n,t[1]=s*r+p*n,t[2]=a*r+u*n,t[3]=h*r+c*n,t[4]=l*r-o*n,t[5]=p*r-s*n,t[6]=u*r-a*n,t[7]=c*r-h*n,t}function oe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function se(){var t=new nr(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ae(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],h=e[5],l=e[6],p=e[7],u=e[8],c=e[9],d=e[10],f=e[11],g=e[12],y=e[13],_=e[14],m=e[15],v=i[0],x=i[1],w=i[2],C=i[3];return t[0]=v*n+x*a+w*u+C*g,t[1]=v*r+x*h+w*c+C*y,t[2]=v*o+x*l+w*d+C*_,t[3]=v*s+x*p+w*f+C*m,v=i[4],x=i[5],w=i[6],C=i[7],t[4]=v*n+x*a+w*u+C*g,t[5]=v*r+x*h+w*c+C*y,t[6]=v*o+x*l+w*d+C*_,t[7]=v*s+x*p+w*f+C*m,v=i[8],x=i[9],w=i[10],C=i[11],t[8]=v*n+x*a+w*u+C*g,t[9]=v*r+x*h+w*c+C*y,t[10]=v*o+x*l+w*d+C*_,t[11]=v*s+x*p+w*f+C*m,v=i[12],x=i[13],w=i[14],C=i[15],t[12]=v*n+x*a+w*u+C*g,t[13]=v*r+x*h+w*c+C*y,t[14]=v*o+x*l+w*d+C*_,t[15]=v*s+x*p+w*f+C*m,t}function he(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],h=e[6],l=e[7],p=e[8],u=e[9],c=e[10],d=e[11],f=e[12],g=e[13],y=e[14],_=e[15],m=i*a-n*s,v=i*h-r*s,x=i*l-o*s,w=n*h-r*a,C=n*l-o*a,b=r*l-o*h,M=p*g-u*f,P=p*y-c*f,S=p*_-d*f,T=u*y-c*g,k=u*_-d*g,O=c*_-d*y,E=m*O-v*k+x*T+w*S-C*P+b*M;return E?(E=1/E,t[0]=(a*O-h*k+l*T)*E,t[1]=(r*k-n*O-o*T)*E,t[2]=(g*b-y*C+_*w)*E,t[3]=(c*C-u*b-d*w)*E,t[4]=(h*S-s*O-l*P)*E,t[5]=(i*O-r*S+o*P)*E,t[6]=(y*x-f*b-_*v)*E,t[7]=(p*b-c*x+d*v)*E,t[8]=(s*k-a*S+l*M)*E,t[9]=(n*S-i*k-o*M)*E,t[10]=(f*C-g*x+_*m)*E,t[11]=(u*x-p*C-d*m)*E,t[12]=(a*P-s*T-h*M)*E,t[13]=(i*T-n*P+r*M)*E,t[14]=(g*v-f*w-y*m)*E,t[15]=(p*w-u*v+c*m)*E,t):null}function le(t){for(var e=t.tileInfo,i=[e.cols,e.rows],n=[],r=e.lods,o=0,s=r.length;o<s;o++)n.push(r[o].resolution);var a=t.fullExtent,h=e.origin,l=[1,-1,h.x,h.y];return delete a.spatialReference,{spatialReference:{resolutions:n,fullExtent:a},tileSystem:l,tileSize:i}}function pe(t){return t?ki.any3d?"translate3d("+t.x+"px,"+t.y+"px, 0px)":"translate("+t.x+"px,"+t.y+"px)":""}function ue(t,e,i){var n=[];for(var r in t)n.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}function ce(t){return t||(t=[]),Array.isArray(t)||(t=[t]),t}function de(t,e){return{markerType:t,markerFill:"#fff",markerLineColor:"#000",markerLineWidth:2,markerWidth:10,markerHeight:10,opacity:e}}function fe(t){t.layer.options.drawImmediate&&t.render(),t.setToRedraw()}function ge(t,e){for(var i in t)if(t[i]!==e[i])return!1;return!0}var ye=["MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"],_e=["FeatureCollection","Feature","Point","LineString","Polygon"].concat(ye),me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},xe=function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):e(t,i))},we=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Ce=Object.prototype.hasOwnProperty,be=new Function("try { return this === global; } catch(e) { return false; }")(),Me=void 0,Pe=void 0;!function(){function t(t){return setTimeout(t,r)}function e(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}if(be)return Me=function(t){return setTimeout(t,16)},void(Pe=clearTimeout);var i=void 0,n=void 0,r=1e3/30;"undefined"!=typeof window?(i=window.requestAnimationFrame||e("RequestAnimationFrame")||t,n=window.cancelAnimationFrame||e("CancelAnimationFrame")||e("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)}):(i=t,n=clearTimeout),Me=function(t){return i(t)},Pe=function(t){t&&n(t)}}();var Se=0,Te=f,ke=/^url\(([\'\"])(.+)\1\)$/i,Oe=/^url\(([^\'\"].*[^\'\"])\)$/i,Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Le="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",De=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"],Re=Object.freeze({createFilter:D,getFilterFeature:G,compileStyle:N,isFunctionDefinition:Q,hasFunctionDefinition:X,interpolated:K,piecewiseConstant:$,loadFunctionTypes:tt,getFunctionTypeResources:et}),Ae=function(){function t(){ve(this,t)}return t.prototype.getMap=function(){return this.geometry.getMap()},t.prototype.getPainter=function(){return this.painter},t.testColor=function(e){return!(!e||!h(e))&&t.colorProperties.indexOf(e)>=0},t}();Ae.resourceProperties=["markerFile","polygonPatternFile","linePatternFile","markerFillPatternFile","markerLinePatternFile"],Ae.resourceSizeProperties=[["markerWidth","markerHeight"],[],[null,"lineWidth"],[],[null,"markerLineWidth"]],Ae.numericalProperties={lineWidth:1,lineOpacity:1,lineDx:1,lineDy:1,polygonOpacity:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerOpacity:1,markerFillOpacity:1,markerLineWidth:1,markerLineOpacity:1,textSize:1,textOpacity:1,textHaloRadius:1,textWrapWidth:1,textLineSpacing:1,textDx:1,textDy:1},Ae.colorProperties=["lineColor","polygonFill","markerFill","markerLineColor","textFill"];var Ie=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._prepareContext=function(t){o(this.symbol.opacity)?t.globalAlpha!==this.symbol.opacity&&(t.globalAlpha=this.symbol.opacity):1!==t.globalAlpha&&(t.globalAlpha=1)},e.prototype.remove=function(){},e.prototype.setZIndex=function(){},e.prototype.show=function(){},e.prototype.hide=function(){},e.prototype._defineStyle=function(t){var e=this;return tt(t,(function(){return[e.getMap().getZoom(),e.geometry.getProperties()]}))},e}(Ae),ze=function(){function t(e,i){if(ve(this,t),r(e)||r(i)?r(e.x)||r(e.y)?S(e)&&(this.x=e[0],this.y=e[1]):(this.x=e.x,this.y=e.y):(this.x=e,this.y=i),this._isNaN())throw new Error("point is NaN")}return t.prototype.abs=function(){return new t(Math.abs(this.x),Math.abs(this.y))},t.prototype._abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.copy=function(){return new t(this.x,this.y)},t.prototype._round=function(){return this.x=w(this.x),this.y=w(this.y),this},t.prototype.round=function(){return new t(w(this.x),w(this.y))},t.prototype._ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.ceil=function(){return new t(Math.ceil(this.x),Math.ceil(this.y))},t.prototype._floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.floor=function(){return new t(Math.floor(this.x),Math.floor(this.y))},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.distanceTo=function(t){var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},t.prototype._add=function(e,i){return e instanceof t?(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this},t.prototype.add=function(e,i){var n=void 0,r=void 0;return e instanceof t?(n=this.x+e.x,r=this.y+e.y):(n=this.x+e,r=this.y+i),new t(n,r)},t.prototype._sub=function(e,i){return e instanceof t?(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this},t.prototype._substract=function(){return this._sub.apply(this,arguments)},t.prototype.sub=function(e,i){var n=void 0,r=void 0;return e instanceof t?(n=this.x-e.x,r=this.y-e.y):(n=this.x-e,r=this.y-i),new t(n,r)},t.prototype.substract=function(){return this.sub.apply(this,arguments)},t.prototype._multi=function(t){return this.x*=t,this.y*=t,this},t.prototype.multi=function(e){return new t(this.x*e,this.y*e)},t.prototype.div=function(t){return this.multi(1/t)},t.prototype._div=function(t){return this._multi(1/t)},t.prototype._isNaN=function(){return isNaN(this.x)||isNaN(this.y)},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.toJSON=function(){return{x:this.x,y:this.y}},t.prototype.mag=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.unit=function(){return this.copy()._unit()},t.prototype._unit=function(){return this._div(this.mag()),this},t.prototype.perp=function(){return this.copy()._perp()},t.prototype._perp=function(){var t=this.y;return this.y=this.x,this.x=-t,this},t.prototype.isZero=function(){return 0===this.x&&0===this.y},t}(),je=function(){function t(e,i){ve(this,t),o(e)&&o(i)?(this.width=e,this.height=i):o(e.width)?(this.width=e.width,this.height=e.height):Array.isArray(e)&&(this.width=e[0],this.height=e[1])}return t.prototype.copy=function(){return new t(this.width,this.height)},t.prototype.add=function(e){return new t(this.width+e.width,this.height+e.height)},t.prototype.equals=function(t){return this.width===t.width&&this.height===t.height},t.prototype.multi=function(e){return new t(this.width*e,this.height*e)},t.prototype._multi=function(t){return this.width*=t,this.height*=t,this},t.prototype._round=function(){return this.width=w(this.width),this.height=w(this.height),this},t.prototype.toPoint=function(){return new ze(this.width,this.height)},t.prototype.toArray=function(){return[this.width,this.height]},t.prototype.toJSON=function(){return{width:this.width,height:this.height}},t}(),Ze=/[\b\t\r\v\f]/gim,He=/\{([\w_]+)\}/g,Fe=Object.freeze({trim:at,escapeSpecialChars:ht,splitWords:lt,stringLength:pt,splitContent:ut,replaceVariable:ct,getAlignPoint:dt,getFont:ft,splitTextToRow:gt}),Ge,Ne=be?function(t){return t[0]}:function(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1},We=Ne(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]),Be=Ne(["transformOrigin","WebkitTransformOrigin","OTransformOrigin","MozTransformOrigin","msTransformOrigin"]),Ve=Ne(["transition","WebkitTransition","OTransition","MozTransition","msTransition"]),Je=Ne(["filter","WebkitFilter","OFilter","MozFilter","msFilter"]),Ue=vt,qe=xt,Ye=Object.freeze({TRANSFORM:We,TRANSFORMORIGIN:Be,TRANSITION:Ve,CSSFILTER:Je,createEl:yt,createElOn:_t,removeDomNode:mt,addDomEvent:vt,removeDomEvent:xt,listensDomEvent:wt,preventDefault:Ct,stopPropagation:bt,preventSelection:Mt,offsetDom:Pt,computeDomPosition:St,getEventContainerPoint:Tt,setStyle:Ot,hasClass:Et,addClass:Lt,setClass:Dt,getClass:Rt,setOpacity:At,copyCanvas:It,setTransform:zt,setTransformMatrix:jt,removeTransform:Zt,isHTML:Ht,measureDom:Ft,getDomRuler:Gt,on:Ue,off:qe}),Qe={createCanvas:function(t,e,i){var n=void 0;return be?n=new i(t,e):((n=yt("canvas")).width=t,n.height=e),n},setDefaultCanvasSetting:function(t){t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.strokeStyle="rgba(0,0,0,1)",t.fillStyle="rgba(255,255,255,0)",t.textAlign="start",t.textBaseline="top",t.font="11px monospace",t.shadowBlur=null,t.shadowColor=null,t.setLineDash&&t.setLineDash([]),t.globalAlpha=1},prepareCanvasFont:function(t,e){t.textBaseline="top",t.font=ft(e);var i=e.textFill;i||(i="#000"),t.fillStyle=Qe.getRgba(i,e.textOpacity)},prepareCanvas:function(t,e,i){if(e){var n=e.lineWidth;r(n)||t.lineWidth===n||(t.lineWidth=n);var o=e.linePatternFile||e.lineColor||"#000";k(o)&&i?(Qe._setStrokePattern(t,o,n,i),e.lineDasharray=[]):it(o)?e.lineGradientExtent?t.strokeStyle=Qe._createGradient(t,o,e.lineGradientExtent):t.strokeStyle="rgba(0,0,0,1)":t.strokeStyle=o,e.lineJoin&&(t.lineJoin=e.lineJoin),e.lineCap&&(t.lineCap=e.lineCap),t.setLineDash&&S(e.lineDasharray)&&t.setLineDash(e.lineDasharray);var s=e.polygonPatternFile||e.polygonFill||"rgba(255,255,255,0)";if(k(s)){var a=O(s),h=i.getImage([a,null,null]);if(h||(h=i.getImage([a+"-texture",null,n])),c(a)&&h instanceof Image&&(ki.edge||ki.ie)){var l=h.width||20,p=h.height||20,u=Qe.createCanvas(l,p);Qe.image(u.getContext("2d"),h,0,0,l,p),h=u}h?t.fillStyle=t.createPattern(h,"repeat"):"undefined"!=typeof console&&console.warn("img not found for",a)}else it(s)?e.polygonGradientExtent?t.fillStyle=Qe._createGradient(t,s,e.polygonGradientExtent):t.fillStyle="rgba(255,255,255,0)":t.fillStyle=s}},_createGradient:function(t,e,i){var n=null,r=e.places,o=i.getMin(),s=i.getMax(),a=i.getWidth(),h=i.getHeight();if(e.type&&"linear"!==e.type){if("radial"===e.type){if(r){if(6!==r.length)throw new Error("A radial gradient's places should have 6 numbers.");r=[o.x+r[0]*a,o.y+r[1]*h,a*r[2],o.x+r[3]*a,o.y+r[4]*h,a*r[5]]}else{var l=i.getCenter()._round();r=[l.x,l.y,Math.abs(l.x-o.x),l.x,l.y,0]}n=t.createRadialGradient.apply(t,r)}}else{if(r){if(4!==r.length)throw new Error("A linear gradient's places should have 4 numbers.");r=[o.x+r[0]*a,o.y+r[1]*h,o.x+r[2]*a,o.y+r[3]*h]}else r=[o.x,o.y,s.x,o.y];n=t.createLinearGradient.apply(t,r)}return e.colorStops.forEach((function(t){n.addColorStop.apply(n,t)})),n},_setStrokePattern:function(t,e,i,n){var r=O(e),o=void 0;if(be)o=n.getImage([r,null,i]);else{var s=r+"-texture-"+i;if(!(o=n.getImage(s))){var a=n.getImage([r,null,null]);if(a){var h=void 0;h=a.width&&a.height?w(a.width*i/a.height):i;var l=Qe.createCanvas(h,i,t.canvas.constructor);Qe.image(l.getContext("2d"),a,0,0,h,i),n.addResource([s,null,i],l),o=l}}}o?t.strokeStyle=t.createPattern(o,"repeat"):"undefined"!=typeof console&&console.warn("img not found for",r)},clearRect:function(t,e,i,n,r){t.canvas._drawn=!1,t.clearRect(e,i,n,r)},fillCanvas:function(t,e,i,n){if(t.canvas._drawn=!0,0!==e){var o=Qe._isPattern(t.fillStyle);r(e)&&(e=1);var s=void 0;e<1&&(s=t.globalAlpha,t.globalAlpha*=e),o&&t.translate(i,n),t.fill(),o&&t.translate(-i,-n),e<1&&(t.globalAlpha=s)}},getRgba:function(t,e){if(r(e)&&(e=1),"#"!==t[0])return t;var i=void 0,n=void 0,o=void 0;return 7===t.length?(i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),o=parseInt(t.substring(5,7),16)):(i=17*parseInt(t.substring(1,2),16),n=17*parseInt(t.substring(2,3),16),o=17*parseInt(t.substring(3,4),16)),"rgba("+i+","+n+","+o+","+e+")"},image:function(t,e,i,n,r,s){t.canvas._drawn=!0;try{o(r)&&o(s)?t.drawImage(e,i,n,r,s):t.drawImage(e,i,n)}catch(t){console&&(console.warn("error when drawing image on canvas:",t),console.warn(e))}},text:function(t,e,i,n,r){Qe._textOnMultiRow(t,r.rows,n,i,r.size,r.rawSize)},_textOnMultiRow:function(t,e,i,n,r,o){for(var s=dt(r,i.textHorizontalAlignment,i.textVerticalAlignment),a=o.height+i.textLineSpacing,h=n.add(0,s.y),l=void 0,p=void 0,u=0,c=e.length;u<c;u++)l=e[u].text,p=dt(e[u].size,i.textHorizontalAlignment,i.textVerticalAlignment),Qe._textOnLine(t,l,h.add(p.x,u*a),i.textHaloRadius,i.textHaloFill,i.textHaloOpacity)},_textOnLine:function(t,e,i,n,r,o){if(t.textBaseline="top",0!==o&&0!==n){var s=t.globalAlpha;o&&(t.globalAlpha*=o),n&&(t.miterLimit=2,t.lineJoin="round",t.lineCap="round",t.lineWidth=2*n-1,t.strokeStyle=r,t.strokeText(e,w(i.x),w(i.y)),t.lineWidth=1,t.miterLimit=10),o&&(t.globalAlpha=s)}Qe.fillText(t,e,i)},fillText:function(t,e,i,n){t.canvas._drawn=!0,n&&(t.fillStyle=n),t.fillText(e,w(i.x),w(i.y))},_stroke:function(t,e,i,n){t.canvas._drawn=!0;var o=Qe._isPattern(t.strokeStyle)&&!r(i)&&!r(n);r(e)&&(e=1);var s=void 0;e<1&&(s=t.globalAlpha,t.globalAlpha*=e),o&&t.translate(i,n),t.stroke(),o&&t.translate(-i,-n),e<1&&(t.globalAlpha=s)},_path:function(t,e,i,n,r){if(S(e))for(var o=S(i),s=!0!==r&&Qe._isPattern(t.strokeStyle),a=void 0,h=void 0,l=void 0,p=0,u=e.length;p<u;p++)if(a=e[p],!o||t.setLineDash)t.lineTo(a.x,a.y),s&&p>0&&(function(e,i){var r=L(e,i);t.save(),t.translate(e.x,e.y-t.lineWidth/2/Math.cos(r)),t.rotate(r),Qe._stroke(t,n),t.restore()}(h=e[p-1],a),t.beginPath(),t.moveTo(a.x,a.y));else if(o){if(p===u-1)break;(function(e,i,n){var r=e.x,o=e.y,s=i.x,a=i.y,h=n,l=function(t,e){return t<=e},p=function(t,e){return t>=e},u=function(t,e){return Math.min(t,e)},c=function(t,e){return Math.max(t,e)},d={thereYet:p,cap:u},f={thereYet:p,cap:u};o-a>0&&(f.thereYet=l,f.cap=c),r-s>0&&(d.thereYet=l,d.cap=c),t.moveTo(r,o);for(var g=r,y=o,_=0,m=!0,v=void 0,x=void 0;!d.thereYet(g,s)||!f.thereYet(y,a);)v=Math.atan2(a-o,s-r),x=h[_],g=d.cap(s,g+Math.cos(v)*x),y=f.cap(a,y+Math.sin(v)*x),m?t.lineTo(g,y):t.moveTo(g,y),_=(_+1)%h.length,m=!m})(a,l=e[p+1],i)}},path:function(t,e,i,n,r){t.beginPath(),t.moveTo(e[0].x,e[0].y),Qe._path(t,e,r,i),Qe._stroke(t,i)},polygon:function(t,e,i,n,r){function o(e,i,n){Qe.fillCanvas(t,n,e[i][0].x,e[i][0].y)}var s=Qe._isPattern(t.strokeStyle),a=S(r)&&!t.setLineDash||s;S(e[0])||(e=[e]);var h=void 0,l=void 0,p=void 0;if(a){for(t.save(),l=0,p=e.length;l<p;l++)Qe._ring(t,e[l],null,0,!0),h=n,l>0&&(t.globalCompositeOperation="destination-out",h=1),o(e,l,h),l>0?t.globalCompositeOperation="source-over":t.fillStyle="#fff",Qe._stroke(t,0);t.restore()}for(l=0,p=e.length;l<p;l++)Qe._ring(t,e[l],r,i),a||(h=n,l>0&&(t.globalCompositeOperation="destination-out",h=1),o(e,l,h),l>0?t.globalCompositeOperation="source-over":t.fillStyle="#fff"),Qe._stroke(t,i)},_ring:function(t,e,i,n,r){var o=Qe._isPattern(t.strokeStyle);r||!o||e[0].equals(e[e.length-1])||(e=e.concat([e[0]])),t.beginPath(),t.moveTo(e[0].x,e[0].y),Qe._path(t,e,i,n,r),o||t.closePath()},_arcBetween:function(t,e,i,n){var r=n,o=e.distanceTo(i),s=o/2/Math.sin(r/2),a=Math.asin((i.y-e.y)/o);e.x>i.x&&(a=Math.PI-a);var h,l=a-(90*Math.PI/180-r/2),p=Math.cos(l)*s,u=Math.sin(l)*s,c=e.x+p,d=e.y+u,f=Math.asin((i.y-d)/s);c>i.x&&(f=Math.PI-f);var g=f+r;t.beginPath(),t.arc(c,d,s,f,g)},_lineTo:function(t,e){t.lineTo(e.x,e.y)},bezierCurveAndFill:function(t,e,i,n){t.beginPath();var r=e[0];t.moveTo(r.x,r.y);var o=[t];o.push.apply(o,e.splice(1)),Qe._bezierCurveTo.apply(Qe,o),Qe.fillCanvas(t,n),Qe._stroke(t,i)},_bezierCurveTo:function(t,e,i,n){t.bezierCurveTo(e.x,e.y,i.x,i.y,n.x,n.y)},ellipse:function(t,e,i,n,r,o){i===n?(t.beginPath(),t.arc(e.x,e.y,i,0,2*Math.PI),Qe.fillCanvas(t,o,e.x-i,e.y-n),Qe._stroke(t,r,e.x-i,e.y-n)):function(s,a,h,l){var p=.5522848,u=h*p,c=l*p;t.beginPath(),t.moveTo(s-h,a),t.bezierCurveTo(s-h,a-c,s-u,a-l,s,a-l),t.bezierCurveTo(s+u,a-l,s+h,a-c,s+h,a),t.bezierCurveTo(s+h,a+c,s+u,a+l,s,a+l),t.bezierCurveTo(s-u,a+l,s-h,a+c,s-h,a),t.closePath(),Qe.fillCanvas(t,o,e.x-i,e.y-n),Qe._stroke(t,r,e.x-i,e.y-n)}(e.x,e.y,i,n)},rectangle:function(t,e,i,n,r){t.beginPath(),t.rect(e.x,e.y,i.width,i.height),Qe.fillCanvas(t,r,e.x,e.y),Qe._stroke(t,n,e.x,e.y)},sector:function(t,e,i,n,r,o){var s=n[0],a=n[1];!function(t,e,i,n,s,a){var h=Math.PI/180,l=h*-a,p=h*-s;t.beginPath(),t.moveTo(e,i),t.arc(e,i,n,l,p),t.lineTo(e,i),Qe.fillCanvas(t,o,e-n,i-n),Qe._stroke(t,r,e-n,i-n)}(t,e.x,e.y,i,s,a)},_isPattern:function(t){return!(h(t)||"addColorStop"in t)},quadraticCurve:function(t,e){if(e&&!(e.length<=2)){var i=(e[0].x+e[1].x)/2,n=(e[0].y+e[1].y)/2;t.lineTo(i,n);for(var r=Qe._getQuadCurvePoints(e),o=0,s=r.length;o<s;o+=4)t.quadraticCurveTo(r[o],r[o+1],r[o+2],r[o+3]);t.lineTo(e[e.length-1].x,e[e.length-1].y)}},_getQuadCurvePoints:function(t){for(var e=[],i=void 0,n=void 0,r=1,o=t.length;r<o-1;r++)i=(t[r].x+t[r+1].x)/2,n=(t[r].y+t[r+1].y)/2,e.push(t[r].x,t[r].y,i,n);return e},drawCross:function(t,e,i,n){t.canvas._drawn=!0,t.strokeStyle=n,t.lineWidth=i,t.beginPath(),t.moveTo(e.x-5,e.y),t.lineTo(e.x+5,e.y),t.moveTo(e.x,e.y-5),t.lineTo(e.x,e.y+5),t.stroke()}},Xe=function(){function t(e,i){if(ve(this,t),r(e)||r(i)?Array.isArray(e)?(this.x=+e[0],this.y=+e[1]):r(e.x)||r(e.y)||(this.x=+e.x,this.y=+e.y):(this.x=+e,this.y=+i),this._isNaN())throw new Error("coordinate is NaN")}return t.toNumberArrays=function(t){return Array.isArray(t)?v(t,(function(t){return[t.x,t.y]})):[t.x,t.y]},t.toCoordinates=function(e){if(o(e[0])&&o(e[1]))return new t(e);for(var i=[],n=0,r=e.length;n<r;n++){var s=e[n];Array.isArray(s)?o(s[0])?i.push(new t(s)):i.push(t.toCoordinates(s)):i.push(new t(s))}return i},t.prototype.copy=function(){return new t(this.x,this.y)},t.prototype._add=function(e,i){return e instanceof t?(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this},t.prototype.add=function(e,i){var n=void 0,r=void 0;return e instanceof t?(n=this.x+e.x,r=this.y+e.y):(n=this.x+e,r=this.y+i),new t(n,r)},t.prototype._sub=function(e,i){return e instanceof t?(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this},t.prototype._substract=function(){return this._sub.apply(this,arguments)},t.prototype.sub=function(e,i){var n=void 0,r=void 0;return e instanceof t?(n=this.x-e.x,r=this.y-e.y):(n=this.x-e,r=this.y-i),new t(n,r)},t.prototype.substract=function(){return this.sub.apply(this,arguments)},t.prototype.multi=function(e){return new t(this.x*e,this.y*e)},t.prototype._multi=function(t){return this.x*=t,this.y*=t,this},t.prototype.equals=function(e){return e instanceof t&&this.x===e.x&&this.y===e.y},t.prototype._isNaN=function(){return isNaN(this.x)||isNaN(this.y)},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.toFixed=function(e){return new t(this.x.toFixed(e),this.y.toFixed(e))},t.prototype.toJSON=function(){return{x:this.x,y:this.y}},t}(),Ke=function(){function t(e,i,n,r){ve(this,t),this._clazz=Xe,this._initialize(e,i,n,r)}return t.prototype._initialize=function(t,e,i,n){if(this.xmin=null,this.xmax=null,this.ymin=null,this.ymax=null,!r(t))return o(t)&&o(e)&&o(i)&&o(n)?(this.xmin=Math.min(t,i),this.ymin=Math.min(e,n),this.xmax=Math.max(t,i),void(this.ymax=Math.max(e,n))):void(o(t.x)&&o(e.x)&&o(t.y)&&o(e.y)?(t.x>e.x?(this.xmin=e.x,this.xmax=t.x):(this.xmin=t.x,this.xmax=e.x),t.y>e.y?(this.ymin=e.y,this.ymax=t.y):(this.ymin=t.y,this.ymax=e.y)):o(t.xmin)&&o(t.xmax)&&o(t.ymin)&&o(t.ymax)&&(this.xmin=t.xmin,this.ymin=t.ymin,this.xmax=t.xmax,this.ymax=t.ymax))},t.prototype._add=function(t){return r(t.x)?r(t.xmin)?r(t[0])||(this.xmin+=t[0],this.ymin+=t[1],this.xmax+=t[0],this.ymax+=t[1]):(this.xmin+=t.xmin,this.ymin+=t.ymin,this.xmax+=t.xmax,this.ymax+=t.ymax):(this.xmin+=t.x,this.ymin+=t.y,this.xmax+=t.x,this.ymax+=t.y),this},t.prototype.add=function(){var t=new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax);return t._add.apply(t,arguments)},t.prototype._sub=function(t){return r(t.x)?r(t.xmin)?r(t[0])||(this.xmin-=t[0],this.ymin-=t[1],this.xmax-=t[0],this.ymax-=t[1]):(this.xmin-=t.xmin,this.ymin-=t.ymin,this.xmax-=t.xmax,this.ymax-=t.ymax):(this.xmin-=t.x,this.ymin-=t.y,this.xmax-=t.x,this.ymax-=t.y),this},t.prototype._substract=function(){return this._sub.apply(this,arguments)},t.prototype.sub=function(){var t=new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax);return t._sub.apply(t,arguments)},t.prototype.substract=function(){return this.sub.apply(this,arguments)},t.prototype.round=function(){return new this.constructor(w(this.xmin),w(this.ymin),w(this.xmax),w(this.ymax))},t.prototype._round=function(){return this.xmin=w(this.xmin),this.ymin=w(this.ymin),this.xmax=w(this.xmax),this.ymax=w(this.ymax),this},t.prototype.getMin=function(){return new this._clazz(this.xmin,this.ymin)},t.prototype.getMax=function(){return new this._clazz(this.xmax,this.ymax)},t.prototype.getCenter=function(){return new this._clazz((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)},t.prototype.isValid=function(){return o(this.xmin)&&o(this.ymin)&&o(this.xmax)&&o(this.ymax)},t.prototype.equals=function(t){return this.xmin===t.xmin&&this.xmax===t.xmax&&this.ymin===t.ymin&&this.ymax===t.ymax},t.prototype.intersects=function(t){var e=Math.max(this.xmin,t.xmin),i=Math.max(this.ymin,t.ymin),n=Math.min(this.xmax,t.xmax),r=Math.min(this.ymax,t.ymax);return!(e>n||i>r)},t.prototype.contains=function(t){return t.x>=this.xmin&&t.x<=this.xmax&&t.y>=this.ymin&&t.y<=this.ymax},t.prototype.getWidth=function(){return this.xmax-this.xmin},t.prototype.getHeight=function(){return this.ymax-this.ymin},t.prototype.__combine=function(t){(t instanceof ze||t instanceof Xe)&&(t={xmin:t.x,xmax:t.x,ymin:t.y,ymax:t.y});var e=this.xmin;o(e)?o(t.xmin)&&e>t.xmin&&(e=t.xmin):e=t.xmin;var i=this.xmax;o(i)?o(t.xmax)&&i<t.xmax&&(i=t.xmax):i=t.xmax;var n=this.ymin;o(n)?o(t.ymin)&&n>t.ymin&&(n=t.ymin):n=t.ymin;var r=this.ymax;return o(r)?o(t.ymax)&&r<t.ymax&&(r=t.ymax):r=t.ymax,[e,n,i,r]},t.prototype._combine=function(t){if(!t)return this;var e=this.__combine(t);return this.xmin=e[0],this.ymin=e[1],this.xmax=e[2],this.ymax=e[3],this},t.prototype.combine=function(t){if(!t)return this;var e=this.__combine(t);return new this.constructor(e[0],e[1],e[2],e[3])},t.prototype.intersection=function(t){return this.intersects(t)?new this.constructor(Math.max(this.xmin,t.xmin),Math.max(this.ymin,t.ymin),Math.min(this.xmax,t.xmax),Math.min(this.ymax,t.ymax)):null},t.prototype.expand=function(t){return t instanceof je?new this.constructor(this.xmin-t.width,this.ymin-t.height,this.xmax+t.width,this.ymax+t.height):new this.constructor(this.xmin-t,this.ymin-t,this.xmax+t,this.ymax+t)},t.prototype._expand=function(t){return t instanceof je?(this.xmin-=t.width,this.ymin-=t.height,this.xmax+=t.width,this.ymax+=t.height):(this.xmin-=t,this.ymin-=t,this.xmax+=t,this.ymax+=t),this},t.prototype.toJSON=function(){return{xmin:this.xmin,ymin:this.ymin,xmax:this.xmax,ymax:this.ymax}},t.prototype.toArray=function(){var t=this.xmin,e=this.ymin,i=this.xmax,n=this.ymax;return[new this._clazz([t,n]),new this._clazz([i,n]),new this._clazz([i,e]),new this._clazz([t,e]),new this._clazz([t,n])]},t.prototype.copy=function(){return new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax)},t.prototype.convertTo=function(t){if(!this.isValid())return null;var e=new this.constructor;return this.toArray().forEach((function(i){e._combine(t(i))})),e},t}(),$e=function(t){function e(i,n,r,o){ve(this,e);var s=we(this,t.call(this,i,n,r,o));return s._clazz=ze,s}return xe(e,t),e.prototype.getSize=function(){return new je(this.getWidth(),this.getHeight())},e}(Ke),ti=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this));return o.symbol=i,o.geometry=n,o.painter=r,o}return xe(e,t),e.prototype.get2DExtent=function(){for(var t=this.getMap(),e=t.getMaxNativeZoom(),i=new $e,n=this._getRenderPoints()[0],r=n.length-1;r>=0;r--)i._combine(t._pointToPoint(n[r],e));return i},e.prototype._getRenderPoints=function(){return this.getPainter().getRenderPoints(this.getPlacement())},e.prototype._getRenderContainerPoints=function(){var t=this.getPainter(),e=this._getRenderPoints()[0];if(t.isSpriting())return e;var i=this.getMap(),n=i.getMaxNativeZoom(),r=this.getDxDy(),o=this.painter.getHeight(),s=i._pointToContainerPoint(this.geometry.getLayer()._getRenderer()._northWest);return v(e,(function(t){return i._pointToContainerPoint(t,n,o)._add(r)._sub(s)}))},e.prototype._getRotationAt=function(t){var e=this.getRotation(),i=this._getRenderPoints()[1];if(!i)return e;e||(e=0);var n=this.getMap(),r=i[t][0],o=i[t][1];if(n.isTransforming()){var s=n.getMaxNativeZoom();r=n._pointToContainerPoint(i[t][0],s),o=n._pointToContainerPoint(i[t][1],s)}return e+L(r,o)},e.prototype._rotate=function(t,e,i){return r(i)?null:(t.save(),t.translate(e.x,e.y),t.rotate(i),new ze(0,0))},e}(Ie),ei=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,i,n,r));o._dynamic=X(i),o.style=o._defineStyle(o.translate()),o.strokeAndFill=o._defineStyle(e.translateLineAndFill(o.style));var s=o.strokeAndFill.lineWidth;return o.padding=s%2==0?[2,2]:[3,3],o}return xe(e,t),e.test=function(t){return!!t&&!(!r(t.markerFile)||r(t.markerType)||"path"===t.markerType)},e.prototype.symbolize=function(t,e){var i=this.style;if(0!==i.markerWidth&&0!==i.markerHeight&&(0!==i.polygonOpacity||0!==i.lineOpacity)){var n=this._getRenderContainerPoints();S(n)&&(this._prepareContext(t),this.getPainter().isSpriting()||this.geometry.getLayer().getMask()===this.geometry||this._dynamic||!1===this.geometry.getLayer().options.cacheVectorOnCanvas?this._drawMarkers(t,n,e):this._drawMarkersWithCache(t,n,e))}},e.prototype._drawMarkers=function(t,e,i){var n=this.strokeAndFill;it(n.lineColor)||it(n.polygonFill)||Qe.prepareCanvas(t,n,i);for(var r=e.length-1;r>=0;r--){var o=e[r],s=this._rotate(t,o,this._getRotationAt(r));s&&(o=s),this._drawVectorMarker(t,o,i),s&&t.restore()}},e.prototype._drawMarkersWithCache=function(t,e,i){var n=this._stampSymbol(),r=i.getImage(n);r||(r=this._createMarkerImage(t,i),i.addResource([n,r.width,r.height],r));for(var o=this._getAnchor(r.width,r.height),s=e.length-1;s>=0;s--){var a=e[s],h=this._rotate(t,a,this._getRotationAt(s));h&&(a=h),Qe.image(t,r,a.x-o.x,a.y-o.y),h&&t.restore()}},e.prototype._createMarkerImage=function(t,e){var i=t.canvas.constructor,n=this.strokeAndFill.lineWidth,r=this.geometry.options.shadowBlur,o=w(this.style.markerWidth+n+2*r+2*this.padding[0]),s=w(this.style.markerHeight+n+2*r+2*this.padding[1]),a=Qe.createCanvas(o,s,i),h=this._getAnchor(o,s),l=a.getContext("2d");return it(this.strokeAndFill.lineColor)||it(this.strokeAndFill.polygonFill)||Qe.prepareCanvas(l,this.strokeAndFill,e),this._drawVectorMarker(l,h,e),a},e.prototype._stampSymbol=function(){return this._stamp||(this._stamp=[this.style.markerType,it(this.style.markerFill)?nt(this.style.markerFill):this.style.markerFill,this.style.markerFillOpacity,this.style.markerFillPatternFile,it(this.style.markerLineColor)?nt(this.style.markerLineColor):this.style.markerLineColor,this.style.markerLineWidth,this.style.markerLineOpacity,this.style.markerLineDasharray?this.style.markerLineDasharray.join(","):"",this.style.markerLinePatternFile,this.style.markerWidth,this.style.markerHeight].join("_")),this._stamp},e.prototype._getAnchor=function(t,e){var i=this.strokeAndFill.lineWidth,n=this.geometry.options.shadowBlur,r=this.style.markerType.toLowerCase();return new ze(t/2,"bar"===r||"pie"===r||"pin"===r?e-this.padding[1]-i/2-n:e/2)},e.prototype._getGraidentExtent=function(t){var e=new $e,i=this.getMarkerExtent();if(Array.isArray(t))for(var n=t.length-1;n>=0;n--)e._combine(t[n]);else e._combine(t);return e.xmin+=i.xmin,e.ymin+=i.ymin,e.xmax+=i.xmax,e.ymax+=i.ymax,e},e.prototype._drawVectorMarker=function(t,i,n){var r=this.style,o=this.strokeAndFill,s=r.markerType.toLowerCase(),a=e._getVectorPoints(s,r.markerWidth,r.markerHeight),h=o.lineOpacity,l=o.polygonOpacity;if(it(o.lineColor)||it(o.polygonFill)){var p=void 0;it(o.lineColor)&&(p=this._getGraidentExtent(i),o.lineGradientExtent=p.expand(o.lineWidth)),it(o.polygonFill)&&(p||(p=this._getGraidentExtent(i)),o.polygonGradientExtent=p),Qe.prepareCanvas(t,o,n)}var u=r.markerWidth,c=r.markerHeight;if("ellipse"===s)Qe.ellipse(t,i,u/2,c/2,h,l);else if("cross"===s||"x"===s){for(var d=a.length-1;d>=0;d--)a[d]._add(i);Qe.path(t,a.slice(0,2),h),Qe.path(t,a.slice(2,4),h)}else if("diamond"===s||"bar"===s||"square"===s||"triangle"===s){"bar"===s&&(i=i.add(0,-r.markerLineWidth/2));for(var f=a.length-1;f>=0;f--)a[f]._add(i);Qe.polygon(t,a,h,l)}else if("pin"===s){i=i.add(0,-r.markerLineWidth/2);for(var g=a.length-1;g>=0;g--)a[g]._add(i);var y=t.lineCap;t.lineCap="round",Qe.bezierCurveAndFill(t,a,h,l),t.lineCap=y}else{if("pie"!==s)throw new Error("unsupported markerType: "+s);i=i.add(0,-r.markerLineWidth/2);var _=180*Math.atan(u/2/c)/Math.PI,m=t.lineCap;t.lineCap="round",Qe.sector(t,i,c,[90-_,90+_],h,l),t.lineCap=m}},e.prototype.getPlacement=function(){return this.symbol.markerPlacement},e.prototype.getRotation=function(){var t=this.style.markerRotation;return o(t)?t*Math.PI/180:null},e.prototype.getDxDy=function(){var t=this.style,e=t.markerDx,i=t.markerDy;return new ze(e,i)},e.prototype.getMarkerExtent=function(){var t=this.getDxDy(),e=this.style,i=e.markerType.toLowerCase(),n=e.markerWidth,r=e.markerHeight,o=void 0;return o="bar"===i||"pie"===i||"pin"===i?new $e(t.add(-n/2,-r),t.add(n/2,0)):new $e(t.add(-n/2,-r/2),t.add(n/2,r/2)),this.style.markerLineWidth&&o._expand(this.style.markerLineWidth/2),o},e.prototype.translate=function(){var t=this.symbol,e={markerType:x(t.markerType,"ellipse"),markerFill:x(t.markerFill,"#00f"),markerFillOpacity:x(t.markerFillOpacity,1),markerFillPatternFile:x(t.markerFillPatternFile,null),markerLineColor:x(t.markerLineColor,"#000"),markerLineWidth:x(t.markerLineWidth,1),markerLineOpacity:x(t.markerLineOpacity,1),markerLineDasharray:x(t.markerLineDasharray,[]),markerLinePatternFile:x(t.markerLinePatternFile,null),markerWidth:x(t.markerWidth,10),markerHeight:x(t.markerHeight,10),markerDx:x(t.markerDx,0),markerDy:x(t.markerDy,0),markerRotation:x(t.markerRotation,0)};return o(t.markerOpacity)&&(e.markerFillOpacity*=t.markerOpacity,e.markerLineOpacity*=t.markerOpacity),e},e.translateLineAndFill=function(t){var e={lineColor:t.markerLineColor,linePatternFile:t.markerLinePatternFile,lineWidth:t.markerLineWidth,lineOpacity:t.markerLineOpacity,lineDasharray:null,lineCap:"butt",lineJoin:"round",polygonFill:t.markerFill,polygonPatternFile:t.markerFillPatternFile,polygonOpacity:t.markerFillOpacity};return 0===e.lineWidth&&(e.lineOpacity=0),e},e._getVectorPoints=function(t,e,i){var n=i/2,r=e/2,o=void 0,s=void 0,a=void 0,h=void 0;if("triangle"===t)return[o=new ze(0,0-n),s=new ze(0-r,0+n),a=new ze(0+r,0+n)];if("cross"===t)return[o=new ze(0-r,0),s=new ze(0+r,0),a=new ze(0,0-n),h=new ze(0,0+n)];if("diamond"===t)return[o=new ze(0-r,0),s=new ze(0,0-n),a=new ze(0+r,0),h=new ze(0,0+n)];if("square"===t)return[o=new ze(0-r,0+n),s=new ze(0+r,0+n),a=new ze(0+r,0-n),h=new ze(0-r,0-n)];if("x"===t)return[o=new ze(0-r,0+n),s=new ze(0+r,0-n),a=new ze(0+r,0+n),h=new ze(0-r,0-n)];if("bar"===t)return[o=new ze(0-r,0-i),s=new ze(0+r,0-i),a=new ze(0+r,0),h=new ze(0-r,0)];if("pin"===t){var l=i*Math.atan(r/n);return[o=new ze(0,0),s=new ze(0-l,0-i),a=new ze(0+l,0-i),h=new ze(0,0)]}return[]},e}(ti),ii=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.getPlacement=function(){return"point"},e.prototype.getDxDy=function(){return new ze(0,0)},e.prototype.symbolize=function(t){var e=this.geometry,i=e.getLayer();if(e.options.debug||!i||i.options.debug){var n=this.getMap();if(n&&!n.isZooming()){var o=i.options.debugOutline;t.strokeStyle=o,t.fillStyle=o;var s=this.getPainter().getContainerExtent().toArray();Qe.polygon(t,[s],1,0);for(var a=this._getRenderContainerPoints(),h=this.geometry.getId(),l=ei._getVectorPoints("cross",10,10),p=0;p<a.length;p++){var u=a[p];r(h)||Qe.fillText(t,h,u.add(8,-4),o);for(var c=[],d=0;d<l.length;d++)c.push(l[d].add(u));Qe.path(t,c.slice(0,2),1),Qe.path(t,c.slice(2,4),1)}}}},e}(ti),ni=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,i,n,r));return o.style=o._defineStyle(o.translate()),o}return xe(e,t),e.test=function(t){return!!t&&!r(t.markerFile)},e.prototype.symbolize=function(t,e){var i=this.style;if(0!==i.markerWidth&&0!==i.markerHeight&&0!==i.markerOpacity){var n=this._getRenderContainerPoints();if(S(n)){var r=this._getImage(e);if(!r)return void("undefined"!=typeof console&&console.warn("no img found for "+(this.style.markerFile||this._url[0])));this._prepareContext(t);var s=i.markerWidth,a=i.markerHeight;if(!o(s)||!o(a)){s=r.width,a=r.height,i.markerWidth=s,i.markerHeight=a;var h=[i.markerFile,i.markerWidth,i.markerHeight];e.isResourceLoaded(h)||e.addResource(h,r);var l=this.getPainter();l.isSpriting()||l.removeCache()}var p=void 0;"path"!==this.symbol.markerType&&o(i.markerOpacity)&&i.markerOpacity<1&&(p=t.globalAlpha,t.globalAlpha*=i.markerOpacity);for(var u=0,c=n.length;u<c;u++){var d=n[u],f=this._rotate(t,d,this._getRotationAt(u));f&&(d=f),Qe.image(t,r,d.x-s/2,d.y-a,s,a),f&&t.restore()}void 0!==p&&(t.globalAlpha=p)}}},e.prototype._getImage=function(t){return t?t.getImage([this.style.markerFile,this.style.markerWidth,this.style.markerHeight]):null},e.prototype.getPlacement=function(){return this.symbol.markerPlacement},e.prototype.getRotation=function(){var t=this.style.markerRotation;return o(t)?t*Math.PI/180:null},e.prototype.getDxDy=function(){var t=this.style,e=t.markerDx||0,i=t.markerDy||0;return new ze(e,i)},e.prototype.getMarkerExtent=function(t){var e=this.style.markerFile,i=t?t.getImage(e):null,n=this.style.markerWidth||(i?i.width:0),r=this.style.markerHeight||(i?i.height:0),o=this.getDxDy();return new $e(o.add(-n/2,0),o.add(n/2,-r))},e.prototype.translate=function(){var t=this.symbol;return{markerFile:t.markerFile,markerOpacity:x(t.markerOpacity,1),markerWidth:x(t.markerWidth,null),markerHeight:x(t.markerHeight,null),markerDx:x(t.markerDx,0),markerDy:x(t.markerDy,0),markerRotation:x(t.markerRotation,0)}},e}(ti),ri=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this));return o.symbol=i,o.geometry=n,o.painter=r,"Point"===n.type?we(o):(o.style=o._defineStyle(o.translate()),o)}return xe(e,t),e.test=function(t,e){if(!t)return!1;if(e&&"Point"===e.type)return!1;for(var i in t){var n=i.slice(0,4);if("line"===n||"poly"===n)return!0}return!1},e.prototype.symbolize=function(t,e){if("Point"!==this.geometry.type){var i=this.style;if(0!==i.polygonOpacity||0!==i.lineOpacity){var n=this._getPaintParams();if(n){this._prepareContext(t);var r=it(i.lineColor),o="Polygon"===this.geometry.getJSONType()||"LineString"===this.geometry.type;!r||!i.lineColor.places&&o||(i.lineGradientExtent=this.getPainter().getContainerExtent()._expand(i.lineWidth)),it(i.polygonFill)&&(i.polygonGradientExtent=this.getPainter().getContainerExtent());var s=n[0];if("Polygon"===this.geometry.getJSONType()&&s.length>1&&Array.isArray(s[0][0])||"LineString"===this.geometry.type&&s.length>1&&Array.isArray(s[0]))for(var a=0;a<s.length;a++){Qe.prepareCanvas(t,i,e),r&&o&&!i.lineColor.places&&this._createGradient(t,s[a],i.lineColor);var h=[t,s[a]];n.length>1&&h.push.apply(h,n.slice(1)),h.push(i.lineOpacity,i.polygonOpacity,i.lineDasharray),this.geometry._paintOn.apply(this.geometry,h)}else{Qe.prepareCanvas(t,i,e),r&&o&&!i.lineColor.places&&this._createGradient(t,s,i.lineColor);var l=[t];l.push.apply(l,n),l.push(i.lineOpacity,i.polygonOpacity,i.lineDasharray),this.geometry._paintOn.apply(this.geometry,l)}t.setLineDash&&Array.isArray(i.lineDasharray)&&t.setLineDash([])}}}},e.prototype.get2DExtent=function(){if("Point"===this.geometry.type)return null;var t=this.getMap(),e=this.geometry._getPrjExtent();if(!e)return null;this._extMin&&this._extMax||(this._extMin=new Xe(0,0),this._extMax=new Xe(0,0)),this._extMin.x=e.xmin,this._extMin.y=e.ymin,this._extMax.x=e.xmax,this._extMax.y=e.ymax;var i=t._prjToPoint(this._extMin),n=t._prjToPoint(this._extMax);return this._pxExtent?(i.x<n.x?(this._pxExtent.xmin=i.x,this._pxExtent.xmax=n.x):(this._pxExtent.xmax=i.x,this._pxExtent.xmin=n.x),i.y<n.y?(this._pxExtent.ymin=i.y,this._pxExtent.ymax=n.y):(this._pxExtent.ymax=i.y,this._pxExtent.ymin=n.y)):this._pxExtent=new $e(i,n),this._pxExtent._expand(this.style.lineWidth/2)},e.prototype._getPaintParams=function(){return this.getPainter().getPaintParams(this.style.lineDx,this.style.lineDy)},e.prototype.translate=function(){var t=this.symbol,e={lineColor:x(t.lineColor,"#000"),lineWidth:x(t.lineWidth,2),lineOpacity:x(t.lineOpacity,1),lineDasharray:x(t.lineDasharray,[]),lineCap:x(t.lineCap,"butt"),lineJoin:x(t.lineJoin,"miter"),linePatternFile:x(t.linePatternFile,null),lineDx:x(t.lineDx,0),lineDy:x(t.lineDy,0),polygonFill:x(t.polygonFill,null),polygonOpacity:x(t.polygonOpacity,1),polygonPatternFile:x(t.polygonPatternFile,null)};return 0===e.lineWidth&&(e.lineOpacity=0),"LineString"!==this.geometry.type||e.polygonFill||(e.polygonFill=e.lineColor),e},e.prototype._createGradient=function(t,e,i){if(Array.isArray(e)){var n=e.length,r=t.createLinearGradient(e[0].x,e[0].y,e[n-1].x,e[n-1].y);i.colorStops.forEach((function(t){r.addColorStop.apply(r,t)})),t.strokeStyle=r}},e}(Ie),oi="___text_symbol_cache",si=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,i,n,r));o._dynamic=X(i),o.style=o._defineStyle(o.translate()),o.strokeAndFill=o._defineStyle(o.translateLineAndFill(o.style));var s=ct(o.style.textName,o.geometry.getProperties());return o._dynamic||(o._cacheKey=Nt(s,o.style)),o._descText(s),o}return xe(e,t),e.test=function(t){return!!t&&!r(t.textName)},e.prototype.symbolize=function(t,e){if(0!==this.style.textSize&&0!==this.style.textOpacity){var i=this._getRenderContainerPoints();if(S(i)){var n=this.style,r=this.strokeAndFill,o=ct(this.style.textName,this.geometry.getProperties());this._descText(o),this._prepareContext(t),Qe.prepareCanvas(t,r,e),Qe.prepareCanvasFont(t,n);for(var s=0,a=i.length;s<a;s++){var h=i[s],l=this._rotate(t,h,this._getRotationAt(s));l&&(h=l),Qe.text(t,o,h,n,this.textDesc),l&&t.restore()}}}},e.prototype.getPlacement=function(){return this.symbol.textPlacement},e.prototype.getRotation=function(){var t=this.style.textRotation;return o(t)?t*Math.PI/180:null},e.prototype.getDxDy=function(){var t=this.style,e=t.textDx,i=t.textDy;return new ze(e,i)},e.prototype.getMarkerExtent=function(){var t=this.getDxDy(),e=this.style,i=this.textDesc.size,n=dt(i,e.textHorizontalAlignment,e.textVerticalAlignment),r=n.x,o=n.y;return new $e(t.add(r,o),t.add(r+i.width,o+i.height))},e.prototype.translate=function(){var t=this.symbol;return{textName:t.textName,textFaceName:x(t.textFaceName,"monospace"),textWeight:x(t.textWeight,"normal"),textStyle:x(t.textStyle,"normal"),textSize:x(t.textSize,10),textFont:x(t.textFont,null),textFill:x(t.textFill,"#000"),textOpacity:x(t.textOpacity,1),textHaloFill:x(t.textHaloFill,"#ffffff"),textHaloRadius:x(t.textHaloRadius,0),textHaloOpacity:x(t.textHaloOpacity,1),textWrapWidth:x(t.textWrapWidth,null),textWrapCharacter:x(t.textWrapCharacter,"\n"),textLineSpacing:x(t.textLineSpacing,0),textDx:x(t.textDx,0),textDy:x(t.textDy,0),textHorizontalAlignment:x(t.textHorizontalAlignment,"middle"),textVerticalAlignment:x(t.textVerticalAlignment,"middle"),textAlign:x(t.textAlign,"center"),textRotation:x(t.textRotation,0)}},e.prototype.translateLineAndFill=function(t){return{lineColor:t.textHaloRadius?t.textHaloFill:t.textFill,lineWidth:t.textHaloRadius,lineOpacity:t.textOpacity,lineDasharray:null,lineCap:"butt",lineJoin:"round",polygonFill:t.textFill,polygonOpacity:t.textOpacity}},e.prototype._descText=function(t){this._dynamic?this.textDesc=gt(t,this.style):(this.textDesc=this._loadFromCache(),this.textDesc||(this.textDesc=gt(t,this.style),this._storeToCache(this.textDesc)))},e.prototype._storeToCache=function(t){be||(this.geometry[oi]||(this.geometry[oi]={}),this.geometry[oi][this._cacheKey]=t)},e.prototype._loadFromCache=function(){return this.geometry[oi]?this.geometry[oi][this._cacheKey]:null},e}(ti),ai=function(t){function e(i,n,o){ve(this,e);var s=we(this,t.call(this,i,n,o));return s.style=s._defineStyle(s.translate()),r(s.style.markerWidth)&&(s.style.markerWidth=80),r(s.style.markerHeight)&&(s.style.markerHeight=80),ki.gecko?s._url=[Bt(i,s.style.markerWidth,s.style.markerHeight),s.style.markerWidth,s.style.markerHeight]:s._url=[Bt(i),i.markerWidth,i.markerHeight],s}return xe(e,t),e.test=function(t){return!!t&&!(!r(t.markerFile)||"path"!==t.markerType)},e.prototype._prepareContext=function(){},e.prototype._getImage=function(t){if(t&&t.isResourceLoaded(this._url))return t.getImage(this._url);var e=new Image;return e.src=this._url[0],t&&t.addResource(this._url,e),e},e}(ni),hi=Object.freeze({Symbolizer:Ae,CanvasSymbolizer:Ie,DebugSymbolizer:ii,ImageMarkerSymbolizer:ni,PointSymbolizer:ti,StrokeAndFillSymbolizer:ri,TextMarkerSymbolizer:si,VectorMarkerSymbolizer:ei,VectorPathMarkerSymbolizer:ai}),li=Object.freeze({now:i,extend:n,isNil:r,isNumber:o,isInteger:s,isObject:a,isString:h,isFunction:l,hasOwn:p,join:u,IS_NODE:be,get requestAnimFrame(){return Me},get cancelAnimFrame(){return Pe},isSVG:c,loadImage:d,UID:f,GUID:Te,parseJSON:g,executeWhen:y,pushIn:_,removeFromArray:m,mapArrayRecursively:v,getValueOrDefault:x,round:w,sign:C,interpolate:b,wrap:M,clamp:P,isArrayHasData:S,isURL:T,isCssUrl:k,extractCssUrl:O,btoa:E,computeDegree:L,emptyImageUrl:Le,translateToSVGStyles:Wt,getMarkerPathBase64:Bt,getExternalResources:Vt,convertResourceUrl:Jt,isGradient:it,getGradientStamp:nt,getSymbolStamp:rt,lowerSymbolOpacity:ot,extendSymbol:st}),pi={};if(!be){var ui=navigator.userAgent.toLowerCase(),ci=document.documentElement,di="ActiveXObject"in window,fi=-1!==ui.indexOf("webkit"),gi=-1!==ui.indexOf("phantom"),yi=-1!==ui.search("android [23]"),_i=-1!==ui.indexOf("chrome"),mi=-1!==ui.indexOf("gecko")&&!fi&&!window.opera&&!di,vi="undefined"!=typeof orientation||-1!==ui.indexOf("mobile"),xi=!window.PointerEvent&&window.MSPointerEvent,wi=window.PointerEvent&&navigator.pointerEnabled||xi,Ci=di&&"transition"in ci.style,bi="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!yi,Mi="MozPerspective"in ci.style,Pi="OTransition"in ci.style,Si=(Ci||bi||Mi)&&!Pi&&!gi,Ti=!gi&&(wi||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch);pi={ie:di,ielt9:di&&!document.addEventListener,edge:"msLaunchUri"in navigator&&!("documentMode"in document),webkit:fi,gecko:mi,android:-1!==ui.indexOf("android"),android23:yi,chrome:_i,safari:!_i&&-1!==ui.indexOf("safari"),phantomjs:gi,ie3d:Ci,webkit3d:bi,gecko3d:Mi,opera12:Pi,any3d:Si,mobile:vi,mobileWebkit:vi&&fi,mobileWebkit3d:vi&&bi,mobileOpera:vi&&window.opera,mobileGecko:vi&&mi,touch:!!Ti,msPointer:!!xi,pointer:!!wi,retina:(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,language:navigator.browserLanguage?navigator.browserLanguage:navigator.language,ie9:di&&9===document.documentMode,ie10:di&&10===document.documentMode}}var ki=pi,Oi={get:function(t,e){if(be&&Oi.get.node)return Oi.get.node(t,e);var i=this._getClient(e);return i.open("GET",t,!0),i.send(null),this},post:function(t,e,i){if(be&&Oi.post.node)return Oi.post.node(t,e,i);var n=this._getClient(i);if(n.open("POST",t.url,!0),t.headers||(t.headers={}),t.headers["Content-Type"]||(t.headers["Content-Type"]="application/x-www-form-urlencoded"),"setRequestHeader"in n)for(var r in t.headers)t.headers.hasOwnProperty(r)&&n.setRequestHeader(r,t.headers[r]);return h(e)||(e=JSON.stringify(e)),n.send(e),this},_wrapCallback:function(t,e){var i=this;return function(){if(void 0!==t.withCredentials||i._isIE8())e(null,t.responseText);else if(4===t.readyState)if(200===t.status)e(null,t.responseText);else{if(0===t.status)return;e(null,'{"success":false,"error":"Status:'+t.status+","+t.statusText+'"}')}}},_isIE8:function(){return ki.ie&&8===document.documentMode},_getClient:function(t){var e=void 0;if(this._isIE8())try{e=new XDomainRequest}catch(t){}else try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return this._isIE8()||void 0!==e.withCredentials?e.onload=this._wrapCallback(e,t):e.onreadystatechange=this._wrapCallback(e,t),e},getJSON:function(t,e){var i=function(t,i){var n=i?g(i):null;e(t,n)};return Oi.get(t,i)}},Ei=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.on=function(t,e,i){if(!t||!e)return this;if(!h(t))return this._switch("on",t,e);this._eventMap||(this._eventMap={});var n=t.toLowerCase().split(" "),r=void 0;i||(i=this);for(var o=void 0,s=0,a=n.length;s<a;s++){r=n[s],(o=this._eventMap[r])||(o=[],this._eventMap[r]=o);var l=o.length;if(l>0)for(var p=0;p<l;p++)if(e===o[p].handler&&o[p].context===i)return this;o.push({handler:e,context:i})}return this},e.prototype.addEventListener=function(){return this.on.apply(this,arguments)},e.prototype.once=function(t,e,i){if(!h(t)){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=this._wrapOnceHandler(r,t[r],i));return this._switch("on",n)}for(var o=t.split(" "),s=0,a=o.length;s<a;s++)this.on(o[s],this._wrapOnceHandler(o[s],e,i));return this},e.prototype.off=function(t,e,i){if(!t||!this._eventMap||!e)return this;if(!h(t))return this._switch("off",t,e);var n=t.split(" "),r=void 0,o=void 0;i||(i=this);for(var s=0,a=n.length;s<a;s++){if(r=n[s].toLowerCase(),!(o=this._eventMap[r]))return this;for(var l=o.length-1;l>=0;l--)e===o[l].handler&&o[l].context===i&&o.splice(l,1)}return this},e.prototype.removeEventListener=function(){return this.off.apply(this,arguments)},e.prototype.listens=function(t,e,i){if(!this._eventMap||!h(t))return 0;var n=this._eventMap[t.toLowerCase()];if(!n||!n.length)return 0;for(var o=0,s=0,a=n.length;s<a;s++)if(e){if(e===n[s].handler&&(r(i)||n[s].context===i))return 1}else o++;return o},e.prototype.copyEventListeners=function(t){var e=t._eventMap;if(!e)return this;var i=void 0;for(var n in e)for(var r=0,o=(i=e[n]).length;r<o;r++)this.on(n,i[r].handler,i[r].context);return this},e.prototype.fire=function(){return this._eventParent?this._eventParent.fire.apply(this._eventParent,arguments):this._fire.apply(this,arguments)},e.prototype._wrapOnceHandler=function(t,e,i){var n=this,r=!1;return function o(){r||(r=!0,i?e.apply(i,arguments):e.apply(this,arguments),n.off(t,o,this))}},e.prototype._switch=function(t,e,i){for(var n in e)e.hasOwnProperty(n)&&this[t](n,e[n],i);return this},e.prototype._clearListeners=function(t){this._eventMap&&h(t)&&this._eventMap[t.toLowerCase()]&&(this._eventMap[t]=null)},e.prototype._clearAllListeners=function(){this._eventMap=null},e.prototype._setEventParent=function(t){return this._eventParent=t,this},e.prototype._fire=function(t,e){if(!this._eventMap)return this;var i=this._eventMap[t.toLowerCase()];if(!i)return this;e||(e={}),e.type=t,e.target=this;for(var r=i.slice(0),o=void 0,s=void 0,a=0,h=r.length;a<h;a++)r[a]&&(o=r[a].context,s=n({},e),!1===(o?r[a].handler.call(o,s):r[a].handler(s))&&e.domEvent&&bt(e.domEvent));return this},e}(t)},Li,Di=Ei(function(){function t(e){ve(this,t),this.target=e}return t.prototype.enable=function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},t.prototype.disable=function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},t.prototype.enabled=function(){return!!this._enabled},t.prototype.remove=function(){this.disable(),delete this.target,delete this.dom},t}()),Ri=function(){function t(e){if(ve(this,t),!this||!this.setOptions)throw new Error('Class instance is being created without "new" operator.');this.setOptions(e),this.callInitHooks()}return t.prototype.callInitHooks=function(){var t=Object.getPrototypeOf(this);return this._visitInitHooks(t),this},t.prototype.setOptions=function(t){if(this.hasOwnProperty("options")||(this.options=this.options?Object.create(this.options):{}),!t)return this;for(var e in t)this.options[e]=t[e];return this},t.prototype.config=function(t){if(!t){var e={};for(var i in this.options)this.options.hasOwnProperty(i)&&(e[i]=this.options[i]);return e}if(2===arguments.length){var n={};n[t]=arguments[1],t=n}for(var r in t)this.options[r]=t[r],this[r]&&this[r]instanceof Di&&(t[r]?this[r].enable():this[r].disable());return this.onConfig&&this.onConfig(t),this},t.prototype._visitInitHooks=function(t){if(!this._initHooksCalled){var e=Object.getPrototypeOf(t);e._visitInitHooks&&e._visitInitHooks.call(this,e),this._initHooksCalled=!0;var i=t._initHooks;if(i&&i!==e._initHooks)for(var n=0;n<i.length;n++)i[n].call(this)}},t.addInitHook=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var r="function"==typeof t?t:function(){this[t].apply(this,i)},o=this.prototype,s=Object.getPrototypeOf(o);return o._initHooks&&o._initHooks!==s._initHooks||(o._initHooks=[]),o._initHooks.push(r),this},t.include=function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0;r<e.length;r++)n(this.prototype,e[r]);return this},t.mergeOptions=function(t){var e=this.prototype,i=Object.getPrototypeOf(e);return e.options&&e.options!==i.options||(e.options=e.options?Object.create(e.options):{}),n(e.options,t),this},t}(),Ai={},Ii=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.registerJSONType=function(t){return t?(Ai[t]=this,this):this},e.getClass=function(t){return t?Ai[t]:null},e.prototype.getJSONType=function(){if(void 0===this._jsonType){var t=Object.getPrototypeOf(this).constructor;for(var e in Ai)if(Ai[e]===t){this._jsonType=e;break}}if(!this._jsonType)throw new Error("Found an unregistered geometry class!");return this._jsonType},e}(t)},zi=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHandler=function(t,e){if(!e)return this;if(this._handlers||(this._handlers=[]),this[t])return this[t].enable(),this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},e.prototype.removeHandler=function(t){if(!t)return this;var e=this[t];if(e){var i=this._handlers.indexOf(e);i>=0&&this._handlers.splice(i,1),this[t].remove(),delete this[t]}return this},e.prototype._clearHandlers=function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].remove();this._handlers=[]},e}(t)},ji=ki.touch?"touchstart mousedown":"mousedown",Zi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},Hi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},Fi=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,null));return r.dom=i,r.options=n||{},r}return xe(e,t),e.prototype.enable=function(){this.dom&&Ue(this.dom,ji,this.onMouseDown,this)},e.prototype.disable=function(){this.dom&&qe(this.dom,ji,this.onMouseDown)},e.prototype.onMouseDown=function(t){if((this.options.rightclick||2!==t.button)&&(!this.options.cancelOn||!0!==this.options.cancelOn(t))){var e=this.dom;e.setCapture?e.setCapture():window.captureEvents&&window.captureEvents(window.Event.MOUSEMOVE|window.Event.MOUSEUP),e.ondragstart=function(){return!1},this.moved=!1;var i=t.touches?t.touches[0]:t;this.startPos=new ze(i.clientX,i.clientY),Ue(document,Zi[t.type],this.onMouseMove,this),Ue(document,Hi[t.type],this.onMouseUp,this),Ue(this.dom,"mouseleave",this.onMouseUp,this),this.fire("mousedown",{domEvent:t,mousePos:new ze(i.clientX,i.clientY)})}},e.prototype.onMouseMove=function(t){if(!(t.touches&&t.touches.length>1)){var e=t.touches?t.touches[0]:t,i,n=new ze(e.clientX,e.clientY).sub(this.startPos);(n.x||n.y)&&(this.moved?this.fire("dragging",{domEvent:t,mousePos:new ze(e.clientX,e.clientY)}):(this.fire("dragstart",{domEvent:t,mousePos:this.startPos.copy()}),this.moved=!0))}},e.prototype.onMouseUp=function(t){var e=this.dom,i=t.changedTouches?t.changedTouches[0]:t;for(var n in Zi)qe(document,Zi[n],this.onMouseMove,this),qe(document,Hi[n],this.onMouseUp,this);qe(this.dom,"mouseleave",this.onMouseUp,this),e.releaseCapture?e.releaseCapture():window.captureEvents&&window.captureEvents(window.Event.MOUSEMOVE|window.Event.MOUSEUP);var r={domEvent:t};o(i.clientX)&&(r.mousePos=new ze(parseInt(i.clientX,0),parseInt(i.clientY,0))),this.moved&&this.fire("dragend",r),this.fire("mouseup",r)},e}(Di),Gi=function(){function t(e,i){ve(this,t),this.type=e,this.properties=i}return t.createProj4=function(e){return new t("proj4",{proj:e})},t}();Gi.WGS84=Gi.createProj4("+proj=longlat +datum=WGS84 +no_defs"),Gi.EPSG4326=Gi.WGS84,Gi.EPSG3857=Gi.createProj4("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"),Gi.IDENTITY=Gi.createProj4("+proj=identity +no_defs"),Gi.CGCS2000=Gi.createProj4("+proj=longlat +datum=CGCS2000"),Gi.EPSG4490=Gi.CGCS2000,Gi.BD09LL=Gi.createProj4("+proj=longlat +datum=BD09"),Gi.GCJ02=Gi.createProj4("+proj=longlat +datum=GCJ02");var Ni=function(){function t(e){ve(this,t),this.matrix=e}return t.prototype.transform=function(t,e){return new ze(this.matrix[0]*(t.x-this.matrix[2])/e,this.matrix[1]*(t.y-this.matrix[3])/e)},t.prototype.untransform=function(t,e){return new Xe(t.x*e/this.matrix[0]+this.matrix[2],t.y*e/this.matrix[1]+this.matrix[3])},t}(),Wi={project:function(){},unproject:function(){},projectCoords:function(t){return t?v(t,this.project,this):[]},unprojectCoords:function(t){return t?v(t,this.unproject,this):[]}},Bi={measureLength:function(t,e){if(!Array.isArray(t))return this.measureLenBetween(t,e);for(var i=0,n=0,r=t.length;n<r-1;n++)i+=this.measureLenBetween(t[n],t[n+1]);return i}},Vi=n({measure:"IDENTITY",measureLenBetween:function(t,e){if(!t||!e)return 0;try{return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}catch(t){return 0}},measureArea:function(t){if(!Array.isArray(t))return 0;for(var e=0,i=0,n=t.length;i<n;i++){var r=t[i],o=null;o=i===n-1?t[0]:t[i+1],e+=r.x*o.y-r.y*o.x}return Math.abs(e/2)},locate:function(t,e,i){return t?(e||(e=0),i||(i=0),e||i?new Xe(t.x+e,t.y+i):t):null}},Bi),Ji=function(){function t(e){ve(this,t),this.radius=e}return t.prototype.rad=function(t){return t*Math.PI/180},t.prototype.measureLenBetween=function(t,e){if(!t||!e)return 0;var i=this.rad(t.y),n=this.rad(e.y),r=i-n,o=this.rad(t.x)-this.rad(e.x);return i=2*Math.asin(Math.sqrt(Math.pow(Math.sin(r/2),2)+Math.cos(i)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),i*=this.radius,Math.round(1e5*i)/1e5},t.prototype.measureArea=function(t){var e=this.radius*Math.PI/180,i=0,n=t,r=n.length;if(r<3)return 0;var o=void 0;for(o=0;o<r-1;o++){var s=n[o],a=n[o+1];i+=s.x*e*Math.cos(s.y*Math.PI/180)*a.y*e-a.x*e*Math.cos(a.y*Math.PI/180)*s.y*e}return r=n[o],n=n[0],i+=r.x*e*Math.cos(r.y*Math.PI/180)*n.y*e-n.x*e*Math.cos(n.y*Math.PI/180)*r.y*e,.5*Math.abs(i)},t.prototype.locate=function(t,e,i){if(!t)return null;if(e||(e=0),i||(i=0),!e&&!i)return t;var n=Math.abs(e),r=Math.abs(i),o=this.rad(t.y),s=this.rad(t.x);return o+=2*Math.sin(r/(2*this.radius))*(i>0?1:-1),s+=2*Math.sqrt(Math.pow(Math.sin(n/(2*this.radius)),2)/Math.pow(Math.cos(o),2))*(e>0?1:-1),new Xe(180*s/Math.PI,180*o/Math.PI)},t}(),Ui=n({measure:"EPSG:4326",sphere:new Ji(6378137),measureLenBetween:function(){return this.sphere.measureLenBetween.apply(this.sphere,arguments)},measureArea:function(){return this.sphere.measureArea.apply(this.sphere,arguments)},locate:function(){return this.sphere.locate.apply(this.sphere,arguments)}},Bi),qi=n({measure:"BAIDU",sphere:new Ji(6370996.81),measureLenBetween:function(){return this.sphere.measureLenBetween.apply(this.sphere,arguments)},measureArea:function(){return this.sphere.measureArea.apply(this.sphere,arguments)},locate:function(){return this.sphere.locate.apply(this.sphere,arguments)}},Bi),Yi=Ui,Qi={};Yt(Vi),Yt(Ui),Yt(qi);var Xi={getInstance:function(t){if(!t)return Yi;for(var e in Qi)if(p(Qi,e)){var i=Qi[e].measure;if(!i)continue;if(t.toLowerCase()===i.toLowerCase())return Qi[e]}return null},isSphere:function(t){return!!t&&!r(t.sphere)}},Ki=Object.freeze({Identity:Vi,DEFAULT:Yi,Measurer:Xi,WGS84Sphere:Ui,BaiduSphere:qi}),$i=n({},Wi,{code:"EPSG:3857",rad:Math.PI/180,metersPerDegree:6378137*Math.PI/180,maxLatitude:85.0511287798,project:function(t){var e=this.rad,i=this.metersPerDegree,n=this.maxLatitude,r=t.x,o=Math.max(Math.min(n,t.y),-n),s=void 0;return s=0===o?0:Math.log(Math.tan((90+o)*e/2))/e,new Xe(r*i,s*i)},unproject:function(t){var e=t.x,i=t.y,n=this.rad,r=this.metersPerDegree,o=void 0;return 0===i?o=0:(o=i/r,o=(2*Math.atan(Math.exp(o*n))-Math.PI/2)/n),new Xe(e/r,o)}},Ui),tn=n({},Wi,{code:"EPSG:4326",project:function(t){return new Xe(t)},unproject:function(t){return new Xe(t)}},Ui),en=n({},Wi,{code:"BAIDU",project:function(t){return this.convertLL2MC(t)},unproject:function(t){return this.convertMC2LL(t)}},qi,{EARTHRADIUS:6370996.81,MCBAND:[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],LLBAND:[75,60,45,30,15,0],MC2LL:[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],LL2MC:[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],convertMC2LL:function(t){for(var e={x:Math.abs(t.x),y:Math.abs(t.y)},i=void 0,n=0,r=this.MCBAND.length;n<r;n++)if(e.y>=this.MCBAND[n]){i=this.MC2LL[n];break}var o=this.convertor(t,i);return new Xe(o.x.toFixed(6),o.y.toFixed(6))},convertLL2MC:function(t){var e=void 0,i=void 0,n=void 0;t.x=this.getLoop(t.x,-180,180),t.y=this.getRange(t.y,-74,74);var r=new Xe(t.x,t.y);for(i=0,n=this.LLBAND.length;i<n;i++)if(r.y>=this.LLBAND[i]){e=this.LL2MC[i];break}if(!e)for(i=this.LLBAND.length-1;i>=0;i--)if(r.y<=-this.LLBAND[i]){e=this.LL2MC[i];break}var o=this.convertor(t,e);return new Xe(o.x.toFixed(2),o.y.toFixed(2))},convertor:function(t,e){if(!t||!e)return null;var i=e[0]+e[1]*Math.abs(t.x),n=Math.abs(t.y)/e[9],r=e[2]+e[3]*n+e[4]*n*n+e[5]*n*n*n+e[6]*n*n*n*n+e[7]*n*n*n*n*n+e[8]*n*n*n*n*n*n;return i*=t.x<0?-1:1,r*=t.y<0?-1:1,new Xe(i,r)},toRadians:function(t){return Math.PI*t/180},toDegrees:function(t){return 180*t/Math.PI},getRange:function(t,e,i){return null!=e&&(t=Math.max(t,e)),null!=i&&(t=Math.min(t,i)),t},getLoop:function(t,e,i){for(;t>i;)t-=i-e;for(;t<e;)t+=i-e;return t}}),nn=n({},Wi,{code:"IDENTITY",project:function(t){return t.copy()},unproject:function(t){return t.copy()}},Vi),rn=$i,on=Object.freeze({EPSG3857:$i,DEFAULT:rn,EPSG4326:tn,BAIDU:en,IDENTITY:nn,Common:Wi}),sn=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.registerRenderer=function(t,e){var i=this.prototype,n=Object.getPrototypeOf(i);return i._rendererClasses&&i._rendererClasses!==n._rendererClasses||(i._rendererClasses=i._rendererClasses?Object.create(i._rendererClasses):{}),i._rendererClasses[t.toLowerCase()]=e,this},e.getRendererClass=function(t){var e=this.prototype;return e._rendererClasses?e._rendererClasses[t.toLowerCase()]:null},e}(t)},an="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},hn=Qt((function(t){!function(e){function i(t){if(t){var e=this;t((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}}function n(t,e){if("function"==typeof t.y)try{var i=t.y.call(s,e);t.p.resolve(i)}catch(e){t.p.reject(e)}else t.p.resolve(e)}function r(t,e){if("function"==typeof t.n)try{var i=t.n.call(s,e);t.p.resolve(i)}catch(e){t.p.reject(e)}else t.p.reject(e)}var o,s,a="fulfilled",h="undefined",l=function(){function t(){for(;i.length-n;){try{i[n]()}catch(t){e.console&&e.console.error(t)}i[n++]=s,n==r&&(i.splice(0,r),n=0)}}var i=[],n=0,r=1024,o=function(){if(("undefined"==typeof MutationObserver?"undefined":me(MutationObserver))!==h){var e=document.createElement("div");return new MutationObserver(t).observe(e,{attributes:!0}),function(){e.setAttribute("a",0)}}return("undefined"==typeof setImmediate?"undefined":me(setImmediate))!==h?function(){setImmediate(t)}:function(){setTimeout(t,0)}}();return function(t){i.push(t),i.length-n==1&&o()}}();i.prototype={resolve:function(t){if(this.state===o){if(t===this)return this.reject(new TypeError("Attempt to resolve promise with self"));var e=this;if(t&&("function"==typeof t||"object"==(void 0===t?"undefined":me(t))))try{var i=!0,r=t.then;if("function"==typeof r)return void r.call(t,(function(t){i&&(i=!1,e.resolve(t))}),(function(t){i&&(i=!1,e.reject(t))}))}catch(t){return void(i&&this.reject(t))}this.state=a,this.v=t,e.c&&l((function(){for(var i=0,r=e.c.length;r>i;i++)n(e.c[i],t)}))}},reject:function(t){if(this.state===o){this.state="rejected",this.v=t;var n=this.c;n?l((function(){for(var e=0,i=n.length;i>e;e++)r(n[e],t)})):!i.suppressUncaughtRejectionError&&e.console&&e.console.log("You upset Zousan. Please catch rejections: ",t,t?t.stack:null)}},then:function(t,e){var s=new i,h={y:t,n:e,p:s};if(this.state===o)this.c?this.c.push(h):this.c=[h];else{var p=this.state,u=this.v;l((function(){p===a?n(h,u):r(h,u)}))}return s},catch:function(t){return this.then(null,t)},finally:function(t){return this.then(t,t)},timeout:function(t,e){e=e||"Timeout";var n=this;return new i((function(i,r){setTimeout((function(){r(Error(e))}),t),n.then((function(t){i(t)}),(function(t){r(t)}))}))}},i.resolve=function(t){var e=new i;return e.resolve(t),e},i.reject=function(t){var e=new i;return e.reject(t),e},i.all=function(t){for(var e=[],n=0,r=new i,o=0;o<t.length;o++)!function(o,s){o&&"function"==typeof o.then||(o=i.resolve(o)),o.then((function(i){e[s]=i,++n==t.length&&r.resolve(e)}),(function(t){r.reject(t)}))}(t[o],o);return t.length||r.resolve(e),r},t.exports&&(t.exports=i),e.define&&e.define.amd&&e.define([],(function(){return i})),e.Zousan=i,i.soon=l}(an)})),ln=void 0,pn=ln="undefined"!=typeof Promise?Promise:hn,un=function(t){function e(i){ve(this,e);var n=we(this,t.call(this));return n.layer=i,n._drawTime=0,n.setToRedraw(),n}return xe(e,t),e.prototype.render=function(){var t=this;if(this.prepareRender(),this.getMap()&&this.layer.isVisible())if(this.resources||(this.resources=new cn),this.checkResources){var e=this.checkResources();e.length>0?(this._loadingResource=!0,this.loadResources(e).then((function(){t._loadingResource=!1,t.layer&&(t.layer.fire("resourceload"),t.setToRedraw())}))):this._tryToDraw(this)}else this._tryToDraw(this)},e.prototype.isAnimating=function(){return!1},e.prototype.needToRedraw=function(){if(this._loadingResource)return!1;if(this._toRedraw)return!0;if(!this.drawOnInteracting)return!1;var t=this.getMap();return!(!t.isInteracting()||!t.getPitch()&&t.isMoving()&&!this.layer.options.forceRenderOnMoving)},e.prototype.isRenderComplete=function(){return!!this._renderComplete},e.prototype.setToRedraw=function(){return this._toRedraw=!0,this},e.prototype.setCanvasUpdated=function(){return this._canvasUpdated=!0,this},e.prototype.isCanvasUpdated=function(){return!!this._canvasUpdated},e.prototype.skipDrawOnInteracting=function(){},e.prototype.remove=function(){this.onRemove&&this.onRemove(),delete this._loadingResource,delete this._northWest,delete this.canvas,delete this.context,delete this._extent2D,delete this.resources,delete this.layer},e.prototype.getMap=function(){return this.layer?this.layer.getMap():null},e.prototype.getCanvasImage=function(){if(this._canvasUpdated=!1,this._renderZoom!==this.getMap().getZoom()||!this.canvas||!this._extent2D)return null;if(this.isBlank())return null;if(this.layer.isEmpty&&this.layer.isEmpty())return null;var t=this.getMap(),e=this._extent2D.getSize(),i=t._pointToContainerPoint(this._northWest);return{image:this.canvas,layer:this.layer,point:i,size:e}},e.prototype.clear=function(){this.clearCanvas()},e.prototype.isBlank=function(){return!this._painted},e.prototype.show=function(){this.setToRedraw()},e.prototype.hide=function(){this.clear(),this.setToRedraw()},e.prototype.setZIndex=function(){this.setToRedraw()},e.prototype.hitDetect=function(t){if(!this.context||this.layer.isEmpty&&this.layer.isEmpty()||this.isBlank()||this._errorThrown)return!1;var e,i=this.getMap().getSize();if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return!1;try{if(this.context.getImageData(t.x,t.y,1,1).data[3]>0)return!0}catch(t){return this._errorThrown||(console&&console.warn("hit detect failed with tainted canvas, some geometries have external resources in another domain:\n",t),this._errorThrown=!0),!1}return!1},e.prototype.loadResources=function(t){this.resources||(this.resources=new cn);var e=this.resources,i=[];if(S(t))for(var n={},r=t.length-1;r>=0;r--){var o=t[r];o&&o.length&&!n[o.join("-")]&&(n[o.join("-")]=1,e.isResourceLoaded(o,!0)||i.push(new pn(this._promiseResource(o))))}return pn.all(i)},e.prototype.prepareRender=function(){delete this._renderComplete;var t=this.getMap();this._renderZoom=t.getZoom(),this._extent2D=t._get2DExtent(),this._northWest=t._containerPointToPoint(new ze(0,0))},e.prototype.createCanvas=function(){if(!this.canvas){var t=this.getMap(),e=t.getSize(),i=ki.retina?2:1;this.canvas=Qe.createCanvas(i*e.width,i*e.height,t.CanvasClass),this.context=this.canvas.getContext("2d"),this.layer.options.globalCompositeOperation&&(this.context.globalCompositeOperation=this.layer.options.globalCompositeOperation),ki.retina&&this.context.scale(i,i),Qe.setDefaultCanvasSetting(this.context),this.onCanvasCreate&&this.onCanvasCreate()}},e.prototype.resizeCanvas=function(t){if(this.canvas){var e=void 0;e=t||this.getMap().getSize();var i=ki.retina?2:1;this.canvas.width===i*e.width&&this.canvas.height===i*e.height||(this.canvas.height=i*e.height,this.canvas.width=i*e.width,ki.retina&&this.context.scale(i,i))}},e.prototype.clearCanvas=function(){this.canvas&&Qe.clearRect(this.context,0,0,this.canvas.width,this.canvas.height)},e.prototype.prepareCanvas=function(){this._clipped&&(this.context.restore(),this._clipped=!1),this.canvas?this.clearCanvas():this.createCanvas(),delete this._maskExtent;var t=this.layer.getMask();if(!t)return this.layer.fire("renderstart",{context:this.context}),null;var e=this._maskExtent=t._getPainter().get2DExtent();return e.intersects(this._extent2D)?(this.context.save(),t._paint(),this.context.clip(),this._clipped=!0,this.layer.fire("renderstart",{context:this.context}),e):(this.layer.fire("renderstart",{context:this.context}),e)},e.prototype.getViewExtent=function(){return{extent:this._extent2D,maskExtent:this._maskExtent,zoom:this._renderZoom,northWest:this._northWest}},e.prototype.completeRender=function(){this.getMap()&&this.context&&(this._renderComplete=!0,this.layer.fire("renderend",{context:this.context}),this.setCanvasUpdated())},e.prototype.getEvents=function(){return{_zoomstart:this.onZoomStart,_zoomend:this.onZoomEnd,_resize:this.onResize,_movestart:this.onMoveStart,_moveend:this.onMoveEnd,_dragrotatestart:this.onDragRotateStart,_dragrotateend:this.onDragRotateEnd,_spatialreferencechange:this.onSpatialReferenceChange}},e.prototype.onZoomStart=function(){},e.prototype.onZoomEnd=function(){this.setToRedraw()},e.prototype.onMoveStart=function(){},e.prototype.onMoveEnd=function(){this.setToRedraw()},e.prototype.onResize=function(){delete this._extent2D,this.resizeCanvas(),this.setToRedraw()},e.prototype.onDragRotateStart=function(){},e.prototype.onDragRotateEnd=function(){this.setToRedraw()},e.prototype.onSpatialReferenceChange=function(){},e.prototype.getDrawTime=function(){return this._drawTime},e.prototype._tryToDraw=function(){this._toRedraw=!1,!this.canvas&&this.layer.isEmpty&&this.layer.isEmpty()?this._renderComplete=!0:(!this._painted&&this.onAdd&&this.onAdd(),this._drawAndRecord())},e.prototype._drawAndRecord=function(){if(this.getMap()){this._painted=!0;var t=i();this.draw(),this._drawTime=i()-t}},e.prototype._promiseResource=function(t){var e=this,i=this.resources,n=this.layer.options.crossOrigin;return function(r){if(i.isResourceLoaded(t,!0))r(t);else{var o=new Image;n&&(o.crossOrigin=n),c(t[0])&&!be&&(t[1]&&(t[1]*=2),t[2]&&(t[2]*=2)),o.onload=function(){e._cacheResource(t,o),r(t)},o.onabort=function(e){console&&console.warn("image loading aborted: "+t[0]),e&&console&&console.warn(e),r(t)},o.onerror=function(e){e&&"undefined"!=typeof console&&console.warn(e),i.markErrorResource(t),r(t)},d(o,t)}}},e.prototype._cacheResource=function(t,e){if(this.layer&&this.resources){var i=t[1],n=t[2];if(this.layer.options.cacheSvgOnCanvas&&1===c(t[0])&&(ki.edge||ki.ie)){r(i)&&(i=e.width||this.layer.options.defaultIconSize[0]),r(n)&&(n=e.height||this.layer.options.defaultIconSize[1]);var o=Qe.createCanvas(i,n);Qe.image(o.getContext("2d"),e,0,0,i,n),e=o}this.resources.addResource(t,e)}},e}(Ri),cn=function(){function t(){ve(this,t),this.resources={},this._errors={}}return t.prototype.addResource=function(t,e){this.resources[t[0]]={image:e,width:+t[1],height:+t[2]}},t.prototype.isResourceLoaded=function(t,e){if(!t)return!1;var i=this._getImgUrl(t);if(this._errors[i])return!0;var n=this.resources[i];return!(!n||e&&c(t[0])&&(+t[1]>n.width||+t[2]>n.height))},t.prototype.getImage=function(t){var e=this._getImgUrl(t);return!this.isResourceLoaded(t)||this._errors[e]?null:this.resources[e].image},t.prototype.markErrorResource=function(t){this._errors[this._getImgUrl(t)]=1},t.prototype.merge=function(t){if(!t)return this;for(var e in t.resources){var i=t.resources[e];this.addResource([e,i.width,i.height],i.image)}return this},t.prototype._getImgUrl=function(t){return Array.isArray(t)?t[0]:t},t}(),dn={minZoom:null,maxZoom:null,visible:!0,opacity:1,drawImmediate:!1,globalCompositeOperation:null,renderer:"canvas",debugOutline:"#0f0"},fn=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r.setId(i),r}return xe(e,t),e.prototype.load=function(){if(!this.getMap())return this;if(this.onLoad()){this._initRenderer();var t=this.getZIndex();r(t)||(this._renderer.setZIndex(t),this.isCanvasRender()||this._renderer.render())}return this},e.prototype.getId=function(){return this._id},e.prototype.setId=function(t){var e=this._id;return r(t)||(t+=""),this._id=t,this.fire("idchange",{old:e,new:t}),this},e.prototype.addTo=function(t){return t.addLayer(this),this},e.prototype.setZIndex=function(t){return this._zIndex=t,this.map&&this.map._sortLayersByZIndex(),this._renderer&&this._renderer.setZIndex(t),this},e.prototype.getZIndex=function(){return this._zIndex},e.prototype.isCanvasRender=function(){var t=this._getRenderer();return t&&t instanceof un},e.prototype.getMap=function(){return this.map?this.map:null},e.prototype.bringToFront=function(){var t=this._getLayerList();if(!t.length)return this;var e=t[t.length-1];if(1===t.length||e===this)return this;var i=e.getZIndex();return this.setZIndex(i+1),this},e.prototype.bringToBack=function(){var t=this._getLayerList();if(!t.length)return this;var e=t[0];if(1===t.length||e===this)return this;var i=e.getZIndex();return this.setZIndex(i-1),this},e.prototype.show=function(){var t=this;if(!this.options.visible){this.options.visible=!0,this._getRenderer()&&this._getRenderer().show();var e=this.getMap();e?e.once("renderend",(function(){t.fire("show")})):this.fire("show")}return this},e.prototype.hide=function(){var t=this;if(this.options.visible){this.options.visible=!1,this._getRenderer()&&this._getRenderer().hide();var e=this.getMap();e?e.once("renderend",(function(){t.fire("hide")})):this.fire("hide")}return this},e.prototype.isVisible=function(){if(o(this.options.opacity)&&this.options.opacity<=0)return!1;var t=this.getMap();if(t){var e=t.getZoom();if(!r(this.options.maxZoom)&&this.options.maxZoom<e||!r(this.options.minZoom)&&this.options.minZoom>e)return!1}return r(this.options.visible)&&(this.options.visible=!0),this.options.visible},e.prototype.remove=function(){return this.map&&this.map.removeLayer(this),this},e.prototype.getMask=function(){return this._mask},e.prototype.setMask=function(t){if(!("Point"===t.type&&t._isVectorMarker()||"Polygon"===t.type))throw new Error("Mask for a layer must be a marker with vector marker symbol, a Polygon or a MultiPolygon.");if("Point"===t.type?t.updateSymbol({markerLineColor:"rgba(0, 0, 0, 0)",markerFillOpacity:0}):t.setSymbol({lineColor:"rgba(0, 0, 0, 0)",polygonOpacity:0}),t._bindLayer(this),this._mask=t,!this.getMap()||this.getMap().isZooming())return this;var e=this._getRenderer();return e&&e.setToRedraw&&this._getRenderer().setToRedraw(),this},e.prototype.removeMask=function(){if(delete this._mask,!this.getMap()||this.getMap().isZooming())return this;var t=this._getRenderer();return t&&t.setToRedraw&&this._getRenderer().setToRedraw(),this},e.prototype.onLoad=function(){return!0},e.prototype.isLoaded=function(){return!!this._loaded},e.prototype._bindMap=function(t,e){t&&(this.map=t,this.setZIndex(e),this._switchEvents("on",this),this.onAdd&&this.onAdd(),this.fire("add"))},e.prototype._initRenderer=function(){var t=this.options.renderer;if(this.constructor.getRendererClass){var e=this.constructor.getRendererClass(t);if(!e)throw new Error("Invalid renderer for Layer("+this.getId()+"):"+t);this._renderer=new e(this),this._renderer.layer=this,this._renderer.setZIndex(this.getZIndex()),this._switchEvents("on",this._renderer)}},e.prototype._doRemove=function(){this._loaded=!1,this.onRemove&&this.onRemove(),this._switchEvents("off",this),this._renderer&&(this._switchEvents("off",this._renderer),this._renderer.remove(),delete this._renderer),delete this._mask,delete this.map},e.prototype._switchEvents=function(t,e){e&&e.getEvents&&this.getMap()[t](e.getEvents(),e)},e.prototype._getRenderer=function(){return this._renderer},e.prototype._getLayerList=function(){return this.map?this.map._layers:[]},e}(Ii(Ei(sn(Ri))));fn.mergeOptions(dn);var gn=fn.prototype.fire;fn.prototype.fire=function(t,e){return"layerload"===t&&(this._loaded=!0),this.map&&(e||(e={}),e.type=t,e.target=this,this.map._onLayerEvent(e)),gn.apply(this,arguments)};var yn=function(){function t(e,i,n,r){ve(this,t),Array.isArray(e)?(this.scale={x:e[0],y:e[1]},this.origin={x:e[2],y:e[3]}):(this.scale={x:e,y:i},this.origin={x:n,y:r})}return t.getDefault=function(t){return"baidu"===t.code.toLowerCase()?"baidu":t.code.toLowerCase()==="EPSG:4326".toLowerCase()?"tms-global-geodetic":"identity"===t.code.toLowerCase()?[1,-1,0,0]:"web-mercator"},t}();n(yn,{"web-mercator":new yn([1,-1,-20037508.34,20037508.34]),"tms-global-mercator":new yn([1,1,-20037508.34,-20037508.34]),"tms-global-geodetic":new yn([1,1,-180,-90]),baidu:new yn([1,1,0,0])});var _n=function(){function t(e,i,n){ve(this,t),this.tileSize=n,this.fullExtent=i,this.prepareTileInfo(e,i)}return t.prototype.prepareTileInfo=function(t,e){if(h(t)?t=yn[t.toLowerCase()]:Array.isArray(t)&&(t=new yn(t)),!t)throw new Error("Invalid TileSystem");this.tileSystem=t;var i=e.right>e.left?1:-1,n=e.top>e.bottom?-1:1,r=t.origin.x,o=t.origin.y;this.transformation=new Ni([i,n,r,o])},t.prototype.getTileIndex=function(t,e){var i=this.tileSystem,n=this.tileSize,r=Math.floor(1e-7+t.x/(n.width*e)),o=-Math.floor(1e-7+t.y/(n.height*e));return{x:i.scale.x*r,y:i.scale.y*o}},t.prototype.getCenterTile=function(t,e){var i=this.tileSystem,n=this.tileSize,r=this.transformation.transform(t,1),o=this.getTileIndex(r,e),s=o.x*n.width,a=o.y*n.height,h=r.x/e-i.scale.x*s,l=r.y/e+i.scale.y*a;return i.scale.x<0&&(o.x-=1),i.scale.y>0&&(o.y-=1),{x:(o=this.getNeighorTileIndex(o.x,o.y,0,0,!0)).x,y:o.y,offset:new ze(h,l)}},t.prototype.getNeighorTileIndex=function(t,e,i,n,r,o){var s=this.tileSystem,a=t+s.scale.x*i,h=e-s.scale.y*n,l=a,p=h;if(o){var u=this._getTileFullIndex(r);a<u.xmin?(a=u.xmax-(u.xmin-a)%(u.xmax-u.xmin))===u.xmax&&(a=u.xmin):a>=u.xmax&&(a=u.xmin+(a-u.xmin)%(u.xmax-u.xmin)),h>=u.ymax?h=u.ymin+(h-u.ymin)%(u.ymax-u.ymin):h<u.ymin&&(h=u.ymax-(u.ymin-h)%(u.ymax-u.ymin))===u.ymax&&(h=u.ymin)}return{x:a,y:h,idx:l,idy:p}},t.prototype._getTileFullIndex=function(t){var e=this.fullExtent,i=this.transformation,n=this.getTileIndex(i.transform(new Xe(e.left,e.top),1),t),r=this.getTileIndex(i.transform(new Xe(e.right,e.bottom),1),t);return new Ke(n,r)},t.prototype.getTileProjectedSw=function(t,e,i){var n=this.tileSystem,r=this.tileSize,o=n.origin.y+n.scale.y*(e+(1===n.scale.y?0:1))*(i*r.height);return[n.scale.x*(t+(1===n.scale.x?0:1))*i*r.width+n.origin.x,o]},t.prototype.getTilePrjExtent=function(t,e,i){var n=this.tileSystem,r=this.tileSize,o=new Xe(this.getTileProjectedSw(t,e,i)),s=n.scale.x,a=n.scale.y,h=o.x+s*(i*r.width),l=o.y-a*(i*r.height);return new Ke(o,new Xe(h,l))},t}(),mn={errorTileUrl:null,urlTemplate:null,subdomains:null,repeatWorld:!0,renderOnMoving:!1,renderOnRotating:!1,updateInterval:ki.mobile?-1:200,cssFilter:null,crossOrigin:null,tileSize:[256,256],tileSystem:null,debug:!1,cacheTiles:!0,keepBuffer:null,container:"back",baseLayerRenderer:be?"canvas":"dom"},vn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.fromJSON=function(t){return t&&"TileLayer"===t.type?new e(t.id,t.options):null},e.prototype.getTileSize=function(){return new je(this.options.tileSize)},e.prototype.getTiles=function(){return this._getTiles()},e.prototype.clear=function(){return this._renderer&&this._renderer.clear(),this.fire("clear"),this},e.prototype.toJSON=function(){return{type:this.getJSONType(),id:this.getId(),options:this.config()}},e.prototype._getTiles=function(){var t=this.getMap();if(!t)return null;if(!this.isVisible())return null;var e=this._getTileConfig();if(!e)return null;var i=this.getTileSize(),n=i.width,r=i.height,o=t.getZoom();s(o)||(o=t.isZooming()?o>t._frameZoom?Math.floor(o):Math.ceil(o):Math.round(o));var a=t._getResolution(o),h=t._get2DExtent(o),l=new ze(t.width/2,t.height/2),p=t._containerPointToPoint(l,o);if(0===h.getWidth()||0===h.getHeight())return{tiles:[]};for(var u=e.getCenterTile(t._getPrjCenter(),a),c=u.offset,d=t._prjToPoint(t._getPrjCenter(),o)._sub(c.x,c.y),f=t.getViewPoint(),g=t._getResolution()/a,y=l.sub(1!==g?f.multi(g):f)._sub(c.x,c.y)._round(),_=this.getMask()?0:null===this.options.keepBuffer?t.isTransforming()?0:t.getBaseLayer()===this?1:0:this.options.keepBuffer,m=Math.ceil(Math.abs(p.y-h.ymin-c.y)/r)+_,v=Math.ceil(Math.abs(p.x-h.xmin-c.x)/n)+_,x=Math.ceil(Math.abs(h.ymax-p.y+c.y)/r)+_,w=Math.ceil(Math.abs(h.xmax-p.x+c.x)/n)+_,C=[],b=void 0,M=-v;M<w;M++)for(var P=-m;P<x;P++){var S=new ze(d.x+n*M,d.y+r*P),T=new ze(y.x+n*M,y.y+r*P),k=e.getNeighorTileIndex(u.x,u.y,M,P,a,this.options.repeatWorld),O=this.getTileUrl(k.x,k.y,o),E=[k.idy,k.idx,o].join("__"),L={url:O,point:S,viewPoint:T,id:E,z:o,x:k.x,y:k.y};C.push(L),0===M&&0===P&&(b=E)}return C.sort((function(t,e){return e.point.distanceTo(d)-t.point.distanceTo(d)})),{zoom:o,center:b,centerViewPoint:y,tiles:C}},e.prototype._initRenderer=function(){var t=this.options.renderer;if(this.getMap().getBaseLayer()===this&&(t=this.options.baseLayerRenderer,this.getMap()._getRenderer()._containerIsCanvas&&(t="canvas")),this.constructor.getRendererClass){var e=this.constructor.getRendererClass(t);e&&(this._renderer=new e(this),this._renderer.setZIndex(this.getZIndex()),this._switchEvents("on",this._renderer))}},e.prototype._initTileConfig=function(){var t=this.getMap(),e=this.getTileSize();if(this._defaultTileConfig=new _n(yn.getDefault(t.getProjection()),t.getFullExtent(),e),this.options.tileSystem&&(this._tileConfig=new _n(this.options.tileSystem,t.getFullExtent(),e)),t&&t.getBaseLayer()&&t.getBaseLayer()!==this&&t.getBaseLayer()._getTileConfig){var i=t.getBaseLayer()._getTileConfig();this._tileConfig=new _n(i.tileSystem,i.fullExtent,e)}},e.prototype._getTileConfig=function(){return this._defaultTileConfig||this._initTileConfig(),this._tileConfig||this._defaultTileConfig},e.prototype.getTileUrl=function(t,e,i){if(!this.options.urlTemplate)return this.options.errorTileUrl;var n=this.options.urlTemplate,r="";if(this.options.subdomains){var o=this.options.subdomains;if(S(o)){var s,a=(t+e)%o.length;a<0&&(a=0),r=o[a]}}if(l(n))return n(t,e,i,r);var h={x:t,y:e,z:i,s:r};return n.replace(/\{ *([\w_]+) *\}/g,(function(t,e){var i=h[e];if(void 0===i)throw new Error("No value provided for variable "+t);return"function"==typeof i&&(i=i(h)),i}))},e}(fn);vn.registerJSONType("TileLayer"),vn.mergeOptions(mn);var xn={"EPSG:3857":{resolutions:function(){for(var t=[],e=12756274*Math.PI,i=0;i<20;i++)t[i]=e/(256*Math.pow(2,i));return t}(),fullExtent:{top:6378137*Math.PI,left:-6378137*Math.PI,bottom:-6378137*Math.PI,right:6378137*Math.PI}},"EPSG:4326":{fullExtent:{top:90,left:-180,bottom:-90,right:180},resolutions:function(){for(var t=[],e=0;e<20;e++)t[e]=180/(128*Math.pow(2,e));return t}()},BAIDU:{resolutions:function(){for(var t=Math.pow(2,18),e=[],i=0;i<20;i++)e[i]=t,t*=.5;return e[0]=null,e[1]=null,e[2]=null,e}(),fullExtent:{top:33554432,left:-33554432,bottom:-33554432,right:33554432}}},wn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ve(this,t),this.options=e,this._initSpatialRef()}return t.prototype._initSpatialRef=function(){var t=this.options.projection;if(t){if(h(t))for(var e in on)if(p(on,e)){var i=on[e].code;if(i&&i.toLowerCase()===t.toLowerCase()){t=on[e];break}}}else t=rn;if(!t||h(t))throw new Error("must provide a valid projection in map's spatial reference.");(t=n({},Wi,t)).measureLength||n(t,Xi.DEFAULT),this._projection=t;var o=void 0,s=this.options.resolutions;if(!s&&(t.code&&(o=xn[t.code])&&(s=o.resolutions),!s))throw new Error("must provide valid resolutions in map's spatial reference.");this._resolutions=s;var a=this.options.fullExtent;if(!a&&(t.code&&(o=xn[t.code])&&(a=o.fullExtent),!a))throw new Error("must provide a valid fullExtent in map's spatial reference.");r(a.left)?(this._fullExtent=new Ke(a),a.left=a.xmin,a.right=a.xmax,a.top=a.ymax,a.bottom=a.ymin):this._fullExtent=new Ke(new Xe(a.left,a.top),new Xe(a.right,a.bottom)),n(this._fullExtent,a);var l=a.right>=a.left?1:-1,u=a.top>=a.bottom?-1:1;this._transformation=new Ni([l,u,0,0])},t.prototype.getResolutions=function(){return this._resolutions||[]},t.prototype.getResolution=function(t){var e=0|t;e<0?e=0:e>this._resolutions.length-1&&(e=this._resolutions.length-1);var i=this._resolutions[e];return s(t)||e===this._resolutions.length-1?i:i+(this._resolutions[e+1]-i)*(t-e)},t.prototype.getProjection=function(){return this._projection},t.prototype.getFullExtent=function(){return this._fullExtent},t.prototype.getTransformation=function(){return this._transformation},t.prototype.getMinZoom=function(){for(var t=0;t<this._resolutions.length;t++)if(!r(this._resolutions[t]))return t;return 0},t.prototype.getMaxZoom=function(){for(var t=this._resolutions.length-1;t>=0;t--)if(!r(this._resolutions[t]))return t;return this._resolutions.length-1},t}(),Cn={centerCross:!1,clipFullExtent:!1,zoomInCenter:!1,zoomAnimation:!be,zoomAnimationDuration:330,zoomBackground:!1,panAnimation:!be,panAnimationDuration:600,zoomable:!0,enableInfoWindow:!0,hitDetect:!ki.mobile,hitDetectLimit:5,fpsOnInteracting:40,layerCanvasLimitOnInteracting:-1,maxZoom:null,minZoom:null,maxExtent:null,checkSize:!0,renderer:"canvas"},bn=function(t){function e(i,r){if(ve(this,e),!r)throw new Error("Invalid options when creating map.");if(!r.center)throw new Error("Invalid center when creating map.");var o=n({},r),s=o.zoom;delete o.zoom;var a=new Xe(o.center);delete o.center;var l=o.baseLayer;delete o.baseLayer;var p=o.layers;delete o.layers;var u=we(this,t.call(this,o));if(u._loaded=!1,h(i)){if(u._containerDOM=document.getElementById(i),!u._containerDOM)throw new Error("invalid container when creating map: '"+i+"'")}else u._containerDOM=i,be&&(u.CanvasClass=u._containerDOM.constructor);if(!be&&u._containerDOM.childNodes&&u._containerDOM.childNodes.length>0&&"maptalks-wrapper"===u._containerDOM.childNodes[0].className)throw new Error("Container is already loaded with another map instance, use map.remove() to clear it.");return u._panels={},u._baseLayer=null,u._layers=[],u._zoomLevel=s,u._center=a,u.setSpatialReference(o.spatialReference||o.view),l&&u.setBaseLayer(l),p&&u.addLayer(p),u._mapViewPoint=new ze(0,0),u._initRenderer(),u._updateMapSize(u._getContainerDomSize()),u._Load(),u}return xe(e,t),e.addOnLoadHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._onLoadHooks=this.prototype._onLoadHooks||[],this.prototype._onLoadHooks.push(i),this},e.prototype.isLoaded=function(){return!!this._loaded},e.prototype.getSpatialReference=function(){return this._spatialReference},e.prototype.setSpatialReference=function(t){var e=this.options.spatialReference;if(e&&!t)return this;if(t=n({},t),this._center=this.getCenter(),this.options.spatialReference=t,this._spatialReference=new wn(t),this.options.spatialReference&&l(this.options.spatialReference.projection)){var i=this._spatialReference.getProjection();this.options.spatialReference.projection=i.code}return this._resetMapStatus(),this._fireEvent("spatialreferencechange",{old:e,new:n({},this.options.spatialReference)}),this},e.prototype.onConfig=function(t){var e=t.spatialReference||t.view;return r(e)||this.setSpatialReference(e),this},e.prototype.getProjection=function(){return this._spatialReference?this._spatialReference.getProjection():null},e.prototype.getFullExtent=function(){return this._spatialReference?this._spatialReference.getFullExtent():null},e.prototype.setCursor=function(t){return delete this._cursor,this._trySetCursor(t),this._cursor=t,this},e.prototype.resetCursor=function(){return this.setCursor(null)},e.prototype.getCenter=function(){return this._loaded&&this._prjCenter?this.getProjection().unproject(this._prjCenter):this._center},e.prototype.setCenter=function(t){if(!t)return this;if(t=new Xe(t),!this._verifyExtent(t))return this;if(!this._loaded)return this._center=t,this;this.onMoveStart();var e,i=this.getProjection().project(t);return this._setPrjCenter(i),this.onMoveEnd(),this},e.prototype.setCoordinateAtContainerPoint=function(t,e){if(e.x===this.width/2&&e.y===this.height/2)return this;var i=this._containerPointToPoint(e)._sub(this._prjToPoint(this._getPrjCenter())),n=this._pointToPrj(this.coordinateToPoint(t).sub(i));return this._setPrjCenter(n),this},e.prototype.getSize=function(){return r(this.width)||r(this.height)?this._getContainerDomSize():new je(this.width,this.height)},e.prototype.getContainerExtent=function(){return new $e(0,0,this.width,this.height)},e.prototype.getExtent=function(){return this._pointToExtent(this._get2DExtent())},e.prototype.getProjExtent=function(){var t=this._get2DExtent();return new Ke(this._pointToPrj(t.getMin()),this._pointToPrj(t.getMax()))},e.prototype.getMaxExtent=function(){return this.options.maxExtent?new Ke(this.options.maxExtent):null},e.prototype.setMaxExtent=function(t){if(t){var e=new Ke(t);this.options.maxExtent=e;var i=this.getCenter();this._verifyExtent(i)||this.panTo(e.getCenter())}else delete this.options.maxExtent;return this},e.prototype.getZoom=function(){return this._zoomLevel},e.prototype.getZoomForScale=function(t,e){var i=this.getZoom();if(r(e)&&(e=i),1===t&&e===i)return i;for(var n=this._getResolution(e),s=this._getResolutions(),a=this.getMinZoom(),h=this.getMaxZoom(),l=Number.MAX_VALUE,p=-1,u=s.length-1;u>=0;u--){var c=Math.abs(n/s[u]-t);c<l&&(l=c,p=u)}return o(a)&&p<a&&(p=a),o(h)&&p>h&&(p=h),p},e.prototype.getZoomFromRes=function(t){var e=this._getResolutions(),i=this._getResolution(this.getMinZoom()),n=this._getResolution(this.getMaxZoom());if(i<=n){if(t<=i)return this.getMinZoom();if(t>=n)return this.getMaxZoom()}else{if(t>=i)return this.getMinZoom();if(t<=n)return this.getMaxZoom()}for(var r=e.length,o=0;o<r-1;o++)if(e[o]){var s=Math.abs(e[o+1]-e[o]),a=Math.abs(t-e[o]);if(s>=a)return o+a/s}return r-1},e.prototype.setZoom=function(t){var e=this;return y((function(){e._loaded&&e.options.zoomAnimation?e._zoomAnimation(t):e._zoom(t)}),(function(){return!e._zooming})),this},e.prototype.getMaxZoom=function(){return r(this.options.maxZoom)?this.getMaxNativeZoom():this.options.maxZoom},e.prototype.getMaxNativeZoom=function(){var t=this.getSpatialReference();return t?t.getResolutions().length-1:null},e.prototype.setMaxZoom=function(t){var e=this._spatialReference.getMaxZoom();return t>e&&(t=e),t<this._zoomLevel&&this.setZoom(t),this.options.maxZoom=t,this},e.prototype.getMinZoom=function(){return r(this.options.minZoom)?0:this.options.minZoom},e.prototype.setMinZoom=function(t){var e=this._spatialReference.getMinZoom();return t<e&&(t=e),this.options.minZoom=t,this},e.prototype.zoomIn=function(){var t=this;return y((function(){t.setZoom(t.getZoom()+1)}),(function(){return!t._zooming})),this},e.prototype.zoomOut=function(){var t=this;return y((function(){t.setZoom(t.getZoom()-1)}),(function(){return!t._zooming})),this},e.prototype.isZooming=function(){return!!this._zooming},e.prototype.isInteracting=function(){return this.isZooming()||this.isMoving()||this.isDragRotating()},e.prototype.setCenterAndZoom=function(t,e){return this._zoomLevel!==e?(this.setCenter(t),r(e)||this.setZoom(e)):this.setCenter(t),this},e.prototype.getFitZoom=function(t){var e=this;if(!(t&&t instanceof Ke))return this._zoomLevel;if(t.xmin===t.xmax&&t.ymin===t.ymax)return this.getMaxZoom();var i=this.getSize(),n=t.convertTo((function(t){return e.coordinateToContainerPoint(t)})),r=n.getWidth(),o=n.getHeight(),s=i.width/r,a=i.height/o,h=this._getResolutions(),l=h[0]<h[h.length-1]?Math.max(s,a):Math.min(s,a);return this.getZoomForScale(l)},e.prototype.setView=function(t){return t?(t.center&&this.setCenter(t.center),t.zoom&&this.setZoom(t.zoom),t.pitch&&this.setPitch(t.pitch),t.bearing&&this.setBearing(t.bearing),this):this},e.prototype.getResolution=function(t){return this._getResolution(t)},e.prototype.getScale=function(t){var e=r(t)?this.getZoom():t,i=this._getResolution(this.getMaxNativeZoom());return this._getResolution(e)/i},e.prototype.fitExtent=function(t,e){if(!t)return this;t=new Ke(t);var i=this.getFitZoom(t)+(e||0),n=t.getCenter();return this.setCenterAndZoom(n,i)},e.prototype.getBaseLayer=function(){return this._baseLayer},e.prototype.setBaseLayer=function(t){function e(){this._fireEvent("baselayerload"),i&&(i=!1,this._fireEvent("baselayerchangeend"))}var i=!1;return this._baseLayer&&(i=!0,this._fireEvent("baselayerchangestart"),this._baseLayer.remove()),t?(t instanceof vn&&(t.config({renderOnMoving:!0}),t.options.tileSystem||t.config("tileSystem",yn.getDefault(this.getProjection()))),t._bindMap(this,-1),this._baseLayer=t,this._baseLayer.on("layerload",e,this),this._loaded&&this._baseLayer.load(),this._fireEvent("setbaselayer"),this):(delete this._baseLayer,this._fireEvent("baselayerchangeend"),this._fireEvent("setbaselayer"),this)},e.prototype.removeBaseLayer=function(){return this._baseLayer&&(this._baseLayer.remove(),delete this._baseLayer,this._fireEvent("baselayerremove")),this},e.prototype.getLayers=function(t){return this._getLayers((function(e){return!(e===this._baseLayer||e.getId().indexOf("_maptalks__internal_layer_")>=0)&&(!t||t(e))}))},e.prototype.getLayer=function(t){if(!t)return null;var e=this._layerCache?this._layerCache[t]:null;if(e)return e;var i=this.getBaseLayer();return i&&i.getId()===t?i:null},e.prototype.addLayer=function(t){if(!t)return this;if(!Array.isArray(t))return this.addLayer([t]);this._layerCache||(this._layerCache={});for(var e=0,i=t.length;e<i;e++){var n=t[e],o=n.getId();if(r(o))throw new Error("Invalid id for the layer: "+o);if(this._layerCache[o])throw new Error("Duplicate layer id in the map: "+o);this._layerCache[o]=n,n._bindMap(this,this._layers.length),this._layers.push(n),this._loaded&&n.load()}return this._fireEvent("addlayer",{layers:t}),this},e.prototype.removeLayer=function(t){if(!t)return this;if(!Array.isArray(t))return this.removeLayer([t]);for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];if(r instanceof fn||(r=this.getLayer(r)),r){var o=r.getMap();if(o&&o===this){e.push(r),this._removeLayer(r,this._layers),this._loaded&&r._doRemove();var s=r.getId();this._layerCache&&delete this._layerCache[s]}}}return e.length>0&&this.once("frameend",(function(){e.forEach((function(t){t.fire("remove")}))})),this._fireEvent("removelayer",{layers:t}),this},e.prototype.sortLayers=function(t){if(!t||!Array.isArray(t))return this;for(var e=[],i=Number.MAX_VALUE,n=0,r=t.length;n<r;n++){var o=t[n];if(h(t[n])&&(o=this.getLayer(o)),!(o instanceof fn&&o.getMap()&&o.getMap()===this))throw new Error("It must be a layer added to this map to order.");o.getZIndex()<i&&(i=o.getZIndex()),e.push(o)}for(var s=0,a=e.length;s<a;s++)e[s].setZIndex(i+s);return this},e.prototype.toDataURL=function(t){t||(t={});var e=t.mimeType;e||(e="image/png");var i=t.save,n=this._getRenderer();if(n&&n.toDataURL){var r=t.filename;r||(r="export");var o=n.toDataURL(e);if(i&&o){var s=o,a=document.createElement("a");a.download=r,a.href=s,a.dataset.downloadurl=[e,a.download,a.href].join(":"),document.body.appendChild(a),a.click(),document.body.removeChild(a)}return o}return null},e.prototype.coordinateToPoint=function(t,e){var i=this.getProjection().project(t);return this._prjToPoint(i,e)},e.prototype.pointToCoordinate=function(t,e){var i=this._pointToPrj(t,e);return this.getProjection().unproject(i)},e.prototype.coordinateToViewPoint=function(t){return this._prjToViewPoint(this.getProjection().project(t))},e.prototype.viewPointToCoordinate=function(t){return this.getProjection().unproject(this._viewPointToPrj(t))},e.prototype.coordinateToContainerPoint=function(t){var e=this.getProjection().project(t);return this._prjToContainerPoint(e)},e.prototype.containerPointToCoordinate=function(t){var e=this._containerPointToPrj(t);return this.getProjection().unproject(e)},e.prototype.containerPointToViewPoint=function(t){return t.sub(this.getViewPoint())},e.prototype.viewPointToContainerPoint=function(t){return t.add(this.getViewPoint())},e.prototype.containerToExtent=function(t){var e=new $e(this._containerPointToPoint(t.getMin()),this._containerPointToPoint(t.getMax()));return this._pointToExtent(e)},e.prototype.checkSize=function(){var t=i()-this._initTime<1500&&0===this.width||0===this.height,e=this._getContainerDomSize(),n=this.height,r=this.width;if(e.width===r&&e.height===n)return this;var o=this.getCenter();this._updateMapSize(e);var s=new ze((r-e.width)/2,(n-e.height)/2);this._offsetCenterByPixel(s),this._mapViewCoord=this._getPrjCenter();var a=0===e.width||0===e.height||0===r||0===n;return(t||a)&&(this._eventSuppressed=!0,this.setCenter(o),this._eventSuppressed=!1),this._fireEvent("resize"),this},e.prototype.distanceToPixel=function(t,e,i){var n=this.getProjection();if(!n)return null;var r=this.getScale()/this.getScale(i),o=this.getCenter(),s=n.locate(o,t,e),a=this.coordinateToContainerPoint(o),h=this.coordinateToContainerPoint(s);return h._sub(a)._multi(r)._abs(),new je(h.x,h.y)},e.prototype.pixelToDistance=function(t,e){var i=this.getProjection();if(!i)return null;var n=this.getFullExtent(),r=n.top>n.bottom?-1:1,o=new ze(this.width/2+t,this.height/2+r*e),s=this.containerPointToCoordinate(o);return i.measureLength(this.getCenter(),s)},e.prototype.locate=function(t,e,i){return this.getProjection().locate(new Xe(t),e,i)},e.prototype.locateByPoint=function(t,e,i){var n=this.coordinateToContainerPoint(t);return this.containerPointToCoordinate(n._add(e,i))},e.prototype.getMainPanel=function(){return this._getRenderer().getMainPanel()},e.prototype.getPanels=function(){return this._panels},e.prototype.remove=function(){if(this.isRemoved())return this;this._removeDomEvents(),this._clearHandlers(),this.removeBaseLayer();for(var t=this.getLayers(),e=0;e<t.length;e++)t[e].remove();return this._getRenderer()&&this._getRenderer().remove(),this._clearAllListeners(),this._containerDOM.innerHTML&&(this._containerDOM.innerHTML=""),delete this._panels,delete this._containerDOM,this},e.prototype.isRemoved=function(){return!this._containerDOM},e.prototype.isMoving=function(){return!!this._moving},e.prototype.onMoveStart=function(t){this._originCenter=this.getCenter(),this._moving=!0,this._trySetCursor("move"),this._fireEvent("movestart",this._parseEvent(t?t.domEvent:null,"movestart"))},e.prototype.onMoving=function(t){this._fireEvent("moving",this._parseEvent(t?t.domEvent:null,"moving"))},e.prototype.onMoveEnd=function(t){if(this._moving=!1,this._trySetCursor("default"),this._fireEvent("moveend",this._parseEvent(t?t.domEvent:null,"moveend")),!this._verifyExtent(this.getCenter())){var e=this._originCenter;this._verifyExtent(e)||(e=this.getMaxExtent().getCenter()),this.panTo(e)}},e.prototype.onDragRotateStart=function(t){this._dragRotating=!0,this._fireEvent("dragrotatestart",this._parseEvent(t?t.domEvent:null,"dragrotatestart"))},e.prototype.onDragRotating=function(t){this._fireEvent("dragrotating",this._parseEvent(t?t.domEvent:null,"dragrotating"))},e.prototype.onDragRotateEnd=function(t){this._dragRotating=!1,this._fireEvent("dragrotateend",this._parseEvent(t?t.domEvent:null,"dragrotateend"))},e.prototype.isDragRotating=function(){return!!this._dragRotating},e.prototype._trySetCursor=function(t){return this._cursor||this._priorityCursor||(t||(t="default"),this._setCursorToPanel(t)),this},e.prototype._setPriorityCursor=function(t){if(t)this._priorityCursor=t,this._setCursorToPanel(t);else{var e=!1;this._priorityCursor&&(e=!0),delete this._priorityCursor,e&&this.setCursor(this._cursor)}return this},e.prototype._setCursorToPanel=function(t){var e=this.getMainPanel();e&&e.style&&e.style.cursor!==t&&(e.style.cursor=t)},e.prototype._get2DExtent=function(t){var e=this._containerPointToPoint(new ze(0,0),t),i=this._containerPointToPoint(new ze(this.width,0),t),n=this._containerPointToPoint(new ze(this.width,this.height),t),r=this._containerPointToPoint(new ze(0,this.height),t),o=Math.min(e.x,i.x,n.x,r.x),s=Math.max(e.x,i.x,n.x,r.x),a=Math.min(e.y,i.y,n.y,r.y),h=Math.max(e.y,i.y,n.y,r.y);return new $e(o,a,s,h)},e.prototype._pointToExtent=function(t){return new Ke(this.pointToCoordinate(t.getMin()),this.pointToCoordinate(t.getMax()))},e.prototype._removeLayer=function(t,e){if(t&&e){var i=e.indexOf(t);if(i>-1){e.splice(i,1);for(var n=0,r=e.length;n<r;n++)e[n].setZIndex&&e[n].setZIndex(n)}}},e.prototype._sortLayersByZIndex=function(){this._layers&&this._layers.sort((function(t,e){return t.getZIndex()-e.getZIndex()}))},e.prototype._fireEvent=function(t,e){this._eventSuppressed||(this.fire("_"+t,e),this.fire(t,e))},e.prototype._Load=function(){this._resetMapStatus(),this._registerDomEvents(),this.options.pitch&&(this.setPitch(this.options.pitch),delete this.options.pitch),this.options.bearing&&(this.setBearing(this.options.bearing),delete this.options.bearing),this._loadAllLayers(),this._getRenderer().onLoad(),this._loaded=!0,this._callOnLoadHooks(),this._initTime=i()},e.prototype._initRenderer=function(){var t=this.options.renderer,i=e.getRendererClass(t);this._renderer=new i(this),this._renderer.load()},e.prototype._getRenderer=function(){return this._renderer},e.prototype._loadAllLayers=function(){function t(t){t&&t.load()}this._baseLayer&&this._baseLayer.load(),this._eachLayer(t,this.getLayers())},e.prototype._getLayers=function(t){for(var e=this._baseLayer?[this._baseLayer].concat(this._layers):this._layers,i=[],n=0;n<e.length;n++)t&&!t.call(this,e[n])||i.push(e[n]);return i},e.prototype._eachLayer=function(t){if(!(arguments.length<2)){var e=Array.prototype.slice.call(arguments,1);e&&!Array.isArray(e)&&(e=[e]);for(var i=[],n=0,r=e.length;n<r;n++)i=i.concat(e[n]);for(var o=0,s=i.length;o<s;o++)t.call(t,i[o])}},e.prototype._onLayerEvent=function(t){t&&"idchange"===t.type&&(delete this._layerCache[t.old],this._layerCache[t.new]=t.target)},e.prototype._resetMapStatus=function(){var t=this.getMaxZoom(),e=this.getMinZoom(),i=this._spatialReference.getMaxZoom(),n=this._spatialReference.getMinZoom();(r(t)||-1===t||t>i)&&this.setMaxZoom(i),(r(e)||-1===e||e<n)&&this.setMinZoom(n),(t=this.getMaxZoom())<(e=this.getMinZoom())&&this.setMaxZoom(e),(r(this._zoomLevel)||this._zoomLevel>t)&&(this._zoomLevel=t),this._zoomLevel<e&&(this._zoomLevel=e),delete this._prjCenter;var o=this.getProjection();this._prjCenter=o.project(this._center);var s=this._getRenderer();s&&s.resetContainer()},e.prototype._getContainerDomSize=function(){if(!this._containerDOM)return null;var t=this._containerDOM,e=void 0,i=void 0;if(r(t.width)||r(t.height)){if(r(t.clientWidth)||r(t.clientHeight))throw new Error("can not get size of container");e=parseInt(t.clientWidth,0),i=parseInt(t.clientHeight,0)}else e=t.width,i=t.height,ki.retina&&t.layer&&(e/=2,i/=2);return new je(e,i)},e.prototype._updateMapSize=function(t){return this.width=t.width,this.height=t.height,this._getRenderer().updateMapSize(t),this._calcMatrices(),this},e.prototype._getPrjCenter=function(){return this._prjCenter},e.prototype._setPrjCenter=function(t){this._prjCenter=t,this.isInteracting()&&!this.isMoving()&&(this._mapViewCoord=t),this._calcMatrices()},e.prototype._verifyExtent=function(t){if(!t)return!1;var e=this.getMaxExtent();return!e||e.contains(t)},e.prototype._offsetCenterByPixel=function(t){var e=new ze(this.width/2-t.x,this.height/2-t.y),i=this._containerPointToPrj(e);return this._setPrjCenter(i),i},e.prototype.offsetPlatform=function(t){return t?(this._getRenderer().offsetPlatform(t),this._mapViewCoord=this._getPrjCenter(),this._mapViewPoint=this._mapViewPoint.add(t),this):this._mapViewPoint},e.prototype.getViewPoint=function(){var t=this._getViewPointOffset(),e=this.offsetPlatform();return t&&(e=e.add(t)),e},e.prototype._getViewPointOffset=function(){var t=this._getPrjCenter();return this._mapViewCoord&&!this._mapViewCoord.equals(t)?this._prjToContainerPoint(this._mapViewCoord).sub(this._prjToContainerPoint(t)):null},e.prototype._resetMapViewPoint=function(){this._mapViewPoint=new ze(0,0),this._mapViewCoord=this._getPrjCenter()},e.prototype._getResolution=function(t){return r(t)&&(t=this.getZoom()),this._spatialReference.getResolution(t)},e.prototype._getResolutions=function(){return this._spatialReference.getResolutions()},e.prototype._prjToPoint=function(t,e){return e=r(e)?this.getZoom():e,this._spatialReference.getTransformation().transform(t,this._getResolution(e))},e.prototype._pointToPrj=function(t,e){return e=r(e)?this.getZoom():e,this._spatialReference.getTransformation().untransform(t,this._getResolution(e))},e.prototype._pointToPoint=function(t,e){return r(e)?t.copy():t.multi(this._getResolution(e)/this._getResolution())},e.prototype._pointToPointAtZoom=function(t,e){return r(e)?t.copy():t.multi(this._getResolution()/this._getResolution(e))},e.prototype._containerPointToPrj=function(t){return this._pointToPrj(this._containerPointToPoint(t))},e.prototype._viewPointToPrj=function(t){return this._containerPointToPrj(this.viewPointToContainerPoint(t))},e.prototype._prjToContainerPoint=function(t){return this._pointToContainerPoint(this._prjToPoint(t))},e.prototype._prjToViewPoint=function(t){var e=this._prjToContainerPoint(t);return this._containerPointToViewPoint(e)},e.prototype._containerPointToViewPoint=function(t){return t?t._sub(this.getViewPoint()):null},e.prototype._viewPointToPoint=function(t,e){return this._containerPointToPoint(this.viewPointToContainerPoint(t),e)},e.prototype._pointToViewPoint=function(t,e){return this._prjToViewPoint(this._pointToPrj(t,e))},e.prototype._callOnLoadHooks=function(){var t=e.prototype;if(t._onLoadHooks)for(var i=0,n=t._onLoadHooks.length;i<n;i++)t._onLoadHooks[i].call(this)},e}(zi(Ei(sn(Ri))));bn.mergeOptions(Cn);var Mn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHooks=function(){this.target.on("_dblclick",this._onDoubleClick,this)},e.prototype.removeHooks=function(){this.target.off("_dblclick",this._onDoubleClick,this)},e.prototype._onDoubleClick=function(t){var e=this.target;if(e.options.doubleClickZoom){var i=e.getZoom(),n=t.domEvent.shiftKey?Math.ceil(i)-1:Math.floor(i)+1;e._zoomAnimation(n,t.containerPoint)}},e}(Di);bn.mergeOptions({doubleClickZoom:!0}),bn.addOnLoadHook("addHandler","doubleClickZoom",Mn);var Pn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHooks=function(){var t=this.target;if(t){var e=t._panels.mapWrapper||t._containerDOM;this._dragHandler=new Fi(e,{cancelOn:this._cancelOn.bind(this),rightclick:!0}),this._dragHandler.on("mousedown",this._onMouseDown,this).on("dragstart",this._onDragStart,this).on("dragging",this._onDragging,this).on("dragend",this._onDragEnd,this).enable()}},e.prototype.removeHooks=function(){this._dragHandler.off("mousedown",this._onMouseDown,this).off("dragstart",this._onDragStart,this).off("dragging",this._onDragging,this).off("dragend",this._onDragEnd,this).disable(),this._dragHandler.remove(),delete this._dragHandler},e.prototype._cancelOn=function(t){return!!this.target.isZooming()||!!this._ignore(t)},e.prototype._ignore=function(t){return!!t&&(t.domEvent&&(t=t.domEvent),this.target._ignoreEvent(t))},e.prototype._onMouseDown=function(t){delete this.startDragTime,delete this._mode,2===t.domEvent.button||t.domEvent.ctrlKey?(this.target.options.dragRotate||this.target.options.dragPitch)&&(this._mode="rotatePitch"):this.target.options.dragPan&&(this._mode="move"),this.target._getRenderer().stopPanAnimation(),Ct(t.domEvent)},e.prototype._onDragStart=function(t){"move"===this._mode?this._moveStart(t):"rotatePitch"===this._mode&&this._rotateStart(t)},e.prototype._onDragging=function(t){"move"===this._mode?this._moving(t):"rotatePitch"===this._mode&&this._rotating(t)},e.prototype._onDragEnd=function(t){"move"===this._mode?this._moveEnd(t):"rotatePitch"===this._mode&&this._rotateEnd(t)},e.prototype._start=function(t){this.startDragTime=i(),this.preX=t.mousePos.x,this.preY=t.mousePos.y,this.startX=this.preX,this.startY=this.preY},e.prototype._moveStart=function(t){this._start(t),this.target.onMoveStart(t)},e.prototype._moving=function(t){if(this.startDragTime){var e=this.target,i=t.mousePos.x,n=t.mousePos.y,r=i-this.preX,o=n-this.preY;e._offsetCenterByPixel(new ze(r,o)),this.preX=i,this.preY=n,e.onMoving(t)}},e.prototype._moveEnd=function(t){if(this.startDragTime){var e=this.target,n=i()-this.startDragTime,r=t.mousePos.x,o=t.mousePos.y,s=r-this.startX,a=o-this.startY;this._clear(),n<280&&Math.abs(a)+Math.abs(s)>5?(n=5*n*(Math.abs(s)+Math.abs(a))/500,e.panBy(new ze(s,a),{duration:n})):e.onMoveEnd(t)}},e.prototype._rotateStart=function(t){this._start(t),delete this._rotateMode,this.target.onDragRotateStart(t)},e.prototype._rotating=function(t){var e=this.target,i=t.mousePos.x,n=t.mousePos.y,r=e.getPitch(),o=e.getBearing(),s=Math.abs(i-this.preX),a=Math.abs(n-this.preY);this._rotateMode||(s>a?this._rotateMode="rotate":s<a&&(this._rotateMode="pitch")),"pitch"===this._rotateMode&&0===r&&a<10||("rotate"===this._rotateMode&&e.options.dragRotate?e.setBearing(e.getBearing()+1.2*(i>this.preX?1:-1)):"pitch"===this._rotateMode&&e.options.dragPitch&&e.setPitch(e.getPitch()+(n>this.preY?-1:1)),this.preX=i,this.preY=n,e.getBearing()===o&&e.getPitch()===r||e.onDragRotating(t))},e.prototype._rotateEnd=function(t){this._clear(),this.target.onDragRotateEnd(t)},e.prototype._clear=function(){delete this.startLeft,delete this.startTop,delete this.preX,delete this.preY,delete this.startX,delete this.startY},e}(Di);bn.mergeOptions({draggable:!0,dragPan:!0,dragRotate:!0,dragPitch:!0}),bn.addOnLoadHook("addHandler","draggable",Pn);var Sn=[ri,ni,ai,ei,si],Tn=function(t){function e(i){ve(this,e);var n=we(this,t.call(this));return n.geometry=i,n.symbolizers=n._createSymbolizers(),n.height=n._getGeometryHeight(),n}return xe(e,t),e.prototype.getMap=function(){return this.geometry.getMap()},e.prototype.getLayer=function(){return this.geometry.getLayer()},e.prototype._createSymbolizers=function(){var t=this.getSymbol(),e=[],i=Sn,n=t;Array.isArray(t)||(n=[t]);for(var r=n.length-1;r>=0;r--)for(var o=n[r],s=i.length-1;s>=0;s--)if(i[s].test(o,this.geometry)){var a=new i[s](o,this.geometry,this);e.push(a),a instanceof ti&&(this._hasPoint=!0)}if(!e.length&&console){var h=this.geometry.getId();console.warn("invalid symbol for geometry("+(this.geometry?this.geometry.getType()+(h?":"+h:""):"")+") to draw : "+JSON.stringify(t))}return this._debugSymbolizer=new ii(t,this.geometry,this),this._hasShadow=this.geometry.options.shadowBlur>0,e},e.prototype.hasPoint=function(){return!!this._hasPoint},e.prototype.getRenderPoints=function(t){return this._renderPoints||(this._renderPoints={}),t||(t="point"),this._renderPoints[t]||(this._renderPoints[t]=this.geometry._getRenderPoints(t)),this._renderPoints[t]},e.prototype.getPaintParams=function(t,e){var i=this.getMap(),n=i.getZoom(),r=0!==i.getPitch(),s=0!==i.getBearing(),a=this._paintParams;if((!a||void 0!==a._zoom&&a._zoom!==n||this._pitched!==r&&this.geometry._redrawWhenPitch()||this._rotated!==s&&this.geometry._redrawWhenRotate())&&(a=this.geometry._getPaintParams(),this.geometry._simplified&&(a._zoom=n),this._paintParams=a),!a)return null;this._pitched=r,this._rotated=s;var h=i.getMaxNativeZoom(),l=i.getScale(),p=this.getHeight(),u=this.getLayer()._getRenderer()._northWest,c=i._pointToContainerPoint(u),d=this._paintParams,f=[],g=d[0],y=void 0;Array.isArray(g)?y=v(g,(function(n){var r=i._pointToContainerPoint(n,h,p)._sub(c);return(t||e)&&r._add(t,e),r})):g instanceof ze&&(y=i._pointToContainerPoint(g,h,p)._sub(c),(t||e)&&y._add(t,e)),f.push(y);for(var _=1,m=d.length;_<m;_++)o(d[_])||d[_]instanceof je?o(d[_])?f.push(d[_]/l):f.push(d[_].multi(1/l)):f.push(d[_]);return f},e.prototype.getSymbol=function(){return this.geometry._getInternalSymbol()},e.prototype.paint=function(t){if(this.symbolizers){var e=this.getLayer()._getRenderer();if(e&&e.context&&(!t||t.intersects(this.get2DExtent(e.resources)))){var i=[e.context,e.resources];this._prepareShadow(e.context);for(var n=this.symbolizers.length-1;n>=0;n--)this.symbolizers[n].symbolize.apply(this.symbolizers[n],i);this._painted=!0,this._debugSymbolizer.symbolize.apply(this._debugSymbolizer,i)}}},e.prototype.getSprite=function(t,e){if("Point"!==this.geometry.type)return null;if(this._genSprite=!0,!this._sprite&&this.symbolizers.length>0){var i=new $e;this.symbolizers.forEach((function(e){var n=e.getMarkerExtent(t);i._combine(n)}));var n=i.getMin().multi(-1),r=e||(this.getMap()?this.getMap().CanvasClass:null),o=Qe.createCanvas(i.getWidth(),i.getHeight(),r),s=void 0;this._renderPoints&&(s=this._renderPoints);var a=[o.getContext("2d"),t];this._prepareShadow(o.getContext("2d"));for(var h=this.symbolizers.length-1;h>=0;h--){var l=this.symbolizers[h].getDxDy();this._renderPoints={point:[[n.add(l)]]},this.symbolizers[h].symbolize.apply(this.symbolizers[h],a)}s&&(this._renderPoints=s),this._sprite={canvas:o,offset:i.getCenter()}}return this._genSprite=!1,this._sprite},e.prototype.isSpriting=function(){return this._genSprite},e.prototype._prepareShadow=function(t){this._hasShadow?(t.shadowBlur=this.geometry.options.shadowBlur,t.shadowColor=this.geometry.options.shadowColor):t.shadowBlur&&(t.shadowBlur=null,t.shadowColor=null)},e.prototype._eachSymbolizer=function(t,e){if(this.symbolizers){e||(e=this);for(var i=this.symbolizers.length-1;i>=0;i--)t.apply(e,[this.symbolizers[i]])}},e.prototype.get2DExtent=function(t){this._verifyProjection();var e=this.getMap();t=t||this.getLayer()._getRenderer().resources;var i=e.getZoom();if((!this._extent2D||this._extent2D._zoom!==i)&&(delete this._extent2D,delete this._markerExtent,this.symbolizers)){for(var n=this._extent2D=new $e,r=this._markerExtent=new $e,o=this.symbolizers.length-1;o>=0;o--){var s=this.symbolizers[o];n._combine(s.get2DExtent()),s.getMarkerExtent&&r._combine(s.getMarkerExtent(t))}n._zoom=i}return this._extent2D.add(this._markerExtent)},e.prototype.getContainerExtent=function(){var t=this;this._verifyProjection();var e=this.getMap(),i=e.getZoom();this._extent2D&&this._extent2D._zoom===i||this.get2DExtent();var n=this._extent2D.convertTo((function(n){return e._pointToContainerPoint(n,i,t.height)}));return n&&n._add(this._markerExtent),n},e.prototype.setZIndex=function(t){this._eachSymbolizer((function(e){e.setZIndex(t)}))},e.prototype.show=function(){this._painted?(this.removeCache(),this._eachSymbolizer((function(t){t.show()}))):this.getLayer().isCanvasRender()||this.paint()},e.prototype.hide=function(){this._eachSymbolizer((function(t){t.hide()}))},e.prototype.repaint=function(){this.removeCache()},e.prototype.refreshSymbol=function(){this.removeCache(),this._removeSymbolizers(),this.symbolizers=this._createSymbolizers()},e.prototype.remove=function(){this.removeCache(),this._removeSymbolizers()},e.prototype._removeSymbolizers=function(){this._eachSymbolizer((function(t){delete t.painter,t.remove()})),delete this.symbolizers},e.prototype.removeCache=function(){delete this._renderPoints,delete this._paintParams,delete this._sprite,delete this._extent2D,delete this._markerExtent},e.prototype.getHeight=function(){if(this._getHeightProperty()!==this._propHeight&&(this.height=this._getGeometryHeight()),!this.height)return 0;var t=this.getMap().getScale();return this.height/t},e.prototype._getGeometryHeight=function(){var t=this.getMap();if(!t)return 0;var e=this._getHeightProperty();if(this._propHeight=e,!e)return 0;var i=this.geometry,n=t.getMaxNativeZoom(),r=i.getCenter(),o=t.locate(r,e,0),s=t.coordinateToPoint(r,n),a=t.coordinateToPoint(o,n);return Math.abs(a.x-s.x)*C(e)},e.prototype._getHeightProperty=function(){var t=this.geometry,e=t.getLayer().options,i=t.getProperties();return e.enableHeight&&i?i[e.heightProperty]:0},e.prototype._verifyProjection=function(){var t=this.geometry._getProjection();this._projCode&&this._projCode!==t.code&&this.removeCache(),this._projCode=t.code},e}(Ri),kn=function(t){function e(i){ve(this,e);var n=we(this,t.call(this));return n.geometry=i,n}return xe(e,t),e.prototype._eachPainter=function(t){for(var e=this.geometry.getGeometries(),i=void 0,n=0,r=e.length;n<r&&(!(i=e[n]._getPainter())||!i||!1!==t.call(this,i));n++);},e.prototype.paint=function(t){this.geometry&&this._eachPainter((function(e){e.paint(t)}))},e.prototype.get2DExtent=function(t){var e=new $e;return this._eachPainter((function(i){e=e.combine(i.get2DExtent(t))})),e},e.prototype.getContainerExtent=function(){var t=new $e;return this._eachPainter((function(e){t=t.combine(e.getContainerExtent())})),t},e.prototype.remove=function(){var t=arguments;this._eachPainter((function(e){e.remove.apply(e,t)}))},e.prototype.setZIndex=function(){var t=arguments;this._eachPainter((function(e){e.setZIndex.apply(e,t)}))},e.prototype.show=function(){var t=arguments;this._eachPainter((function(e){e.show.apply(e,t)}))},e.prototype.hide=function(){var t=arguments;this._eachPainter((function(e){e.hide.apply(e,t)}))},e.prototype.repaint=function(){var t=arguments;this._eachPainter((function(e){e.repaint.apply(e,t)}))},e.prototype.refreshSymbol=function(){var t=arguments;this._eachPainter((function(e){e.refreshSymbol.apply(e,t)}))},e.prototype.hasPoint=function(){var t=!1;return this._eachPainter((function(e){return!e.hasPoint()||(t=!0,!1)})),t},e}(Ri),On={id:null,visible:!0,editable:!0,cursor:null,shadowBlur:0,shadowColor:"black",measure:"EPSG:4326"},En=function(t){function e(i){ve(this,e);var o=n({},i),s=o.symbol,a=o.properties,h=o.id;delete o.symbol,delete o.id,delete o.properties;var l=we(this,t.call(this,o));return s&&l.setSymbol(s),a&&l.setProperties(a),r(h)||l.setId(h),l}return xe(e,t),e.prototype.getFirstCoordinate=function(){if("GeometryCollection"===this.type){var t=this.getGeometries();return t.length?t[0].getFirstCoordinate():null}var e=this.getCoordinates();if(!Array.isArray(e))return e;do{e=e[0]}while(Array.isArray(e)&&e.length>0);return e},e.prototype.getLastCoordinate=function(){if("GeometryCollection"===this.type){var t=this.getGeometries();return t.length?t[t.length-1].getLastCoordinate():null}var e=this.getCoordinates();if(!Array.isArray(e))return e;do{e=e[e.length-1]}while(Array.isArray(e)&&e.length>0);return e},e.prototype.addTo=function(t,e){return t.addGeometry(this,e),this},e.prototype.getLayer=function(){return this._layer?this._layer:null},e.prototype.getMap=function(){return this._layer?this._layer.getMap():null},e.prototype.getId=function(){return this._id},e.prototype.setId=function(t){var e=this.getId();return this._id=t,this._fireEvent("idchange",{old:e,new:t}),this},e.prototype.getProperties=function(){return this.properties?this.properties:this._getParent()?this._getParent().getProperties():null},e.prototype.setProperties=function(t){var e=this.properties;return this.properties=a(t)?n({},t):t,this._fireEvent("propertieschange",{old:e,new:t}),this},e.prototype.getType=function(){return this.type},e.prototype.getSymbol=function(){var t=this._symbol;return t?Array.isArray(t)?st(t):n({},t):null},e.prototype.setSymbol=function(t){return this._symbol=this._prepareSymbol(t),this.onSymbolChanged(),this},e.prototype.updateSymbol=function(t){if(!t)return this;var e=this._getSymbol();return e=st(e||this._getInternalSymbol(),t),this.setSymbol(e)},e.prototype.getCenter=function(){return this._computeCenter(this._getMeasurer())},e.prototype.getExtent=function(){var t=this._getPrjExtent();if(t){var e=this._getProjection();return new Ke(e.unproject(new Xe(t.xmin,t.ymin)),e.unproject(new Xe(t.xmax,t.ymax)))}return this._computeExtent(this._getMeasurer())},e.prototype.getSize=function(){return this.getMap()?this._getPainter().getContainerExtent().getSize():null},e.prototype.containsPoint=function(t,e){if(!this.getMap())throw new Error('The geometry is required to be added on a map to perform "containsPoint".');return t instanceof Xe&&(t=this.getMap().coordinateToContainerPoint(t)),this._containsPoint(this.getMap()._containerPointToPoint(new ze(t)),e)},e.prototype.show=function(){if(this.options.visible=!0,this.getMap()){var t=this._getPainter();t&&t.show(),this._fireEvent("show")}return this},e.prototype.hide=function(){if(this.options.visible=!1,this.getMap()){this.onHide();var t=this._getPainter();t&&t.hide(),this._fireEvent("hide")}return this},e.prototype.isVisible=function(){if(!this.options.visible)return!1;var t=this._getInternalSymbol();if(!t)return!0;if(Array.isArray(t)){if(!t.length)return!0;for(var e=0,i=t.length;e<i;e++)if(r(t[e].opacity)||t[e].opacity>0)return!0;return!1}return r(t.opacity)||o(t.opacity)&&t.opacity>0},e.prototype.getZIndex=function(){return this.options.zIndex||0},e.prototype.setZIndex=function(t){var e=this.options.zIndex;return this.options.zIndex=t,this._fireEvent("zindexchange",{old:e,new:t}),this},e.prototype.setZIndexSilently=function(t){return this.options.zIndex=t,this},e.prototype.bringToFront=function(){var t=this.getLayer();if(!t||!t.getLastGeometry)return this;var e=t.getLastGeometry().getZIndex();return this.setZIndex(e+1),this},e.prototype.bringToBack=function(){var t=this.getLayer();if(!t||!t.getFirstGeometry)return this;var e=t.getFirstGeometry().getZIndex();return this.setZIndex(e-1),this},e.prototype.translate=function(t,e){if(r(t))return this;var i=new Xe(t,e);if(0===i.x&&0===i.y)return this;var n=this.getCoordinates();if(n)if(Array.isArray(n)){var o=v(n,(function(t){return t.add(i)}));this.setCoordinates(o)}else this.setCoordinates(n.add(i));return this},e.prototype.flash=function(t,e,i,n){function r(){if(0===e)return o.show(),void(i&&(n?i.call(n):i()));e%2==0?o.hide():o.show(),e--,o._flashTimeout=setTimeout(r,t)}t||(t=100),e||(e=4);var o=this;return e*=2,this._flashTimeout&&clearTimeout(this._flashTimeout),this._flashTimeout=setTimeout(r,t),this},e.prototype.copy=function(){var t=this.toJSON(),i=e.fromJSON(t);return i.options.visible=!0,i},e.prototype.remove=function(){return this.getLayer()?(this._fireEvent("removestart"),this._unbind(),this._fireEvent("removeend"),this._fireEvent("remove"),this):this},e.prototype.toGeoJSONGeometry=function(){return this._exportGeoJSONGeometry()},e.prototype.toGeoJSON=function(t){t||(t={});var e={type:"Feature",geometry:null};if(r(t.geometry)||t.geometry){var i=this._exportGeoJSONGeometry();e.geometry=i}var n=this.getId();r(n)||(e.id=n);var o=void 0;return(r(t.properties)||t.properties)&&(o=this._exportProperties()),e.properties=o,e},e.prototype.toJSON=function(t){t||(t={});var e=this._toJSON(t);return n(e,this._exportGraphicOptions(t)),e},e.prototype.getLength=function(){return this._computeGeodesicLength(this._getMeasurer())},e.prototype.getArea=function(){return this._computeGeodesicArea(this._getMeasurer())},e.prototype._getConnectPoints=function(){return[this.getCenter()]},e.prototype._initOptions=function(t){var e=n({},t),i=e.symbol,o=e.properties,s=e.id;delete e.symbol,delete e.id,delete e.properties,this.setOptions(e),i&&this.setSymbol(i),o&&this.setProperties(o),r(s)||this.setId(s)},e.prototype._bindLayer=function(t){if(this.getLayer())throw new Error("Geometry cannot be added to two or more layers at the same time.");this._layer=t,this._clearCache(),this._clearProjection()},e.prototype._prepareSymbol=function(t){if(Array.isArray(t)){for(var e=[],i=0;i<t.length;i++)e.push(Jt(this._checkAndCopySymbol(t[i])));return e}return t?Jt(t=this._checkAndCopySymbol(t)):null},e.prototype._checkAndCopySymbol=function(t){var e={},i=Ae.numericalProperties;for(var n in t)i[n]&&h(t[n])?e[n]=+t[n]:e[n]=t[n];return e},e.prototype._getSymbol=function(){return this._symbol},e.prototype._setExternSymbol=function(t){return this._externSymbol=this._prepareSymbol(t),this.onSymbolChanged(),this},e.prototype._getInternalSymbol=function(){return this._symbol?this._symbol:this._externSymbol?this._externSymbol:this.options.symbol?this.options.symbol:null},e.prototype._getPrjExtent=function(){var t=this._getProjection();if(this._verifyProjection(),!this._extent&&t){var e=this._computeExtent(t);if(e){var i=!!Xi.isSphere(t)&&this.options.antiMeridian;if(i&&"default"!==i){var n=this.getFirstCoordinate();if("continuous"===i&&e.xmax-e.xmin>180&&(n.x>0?e.xmin+=360:e.xmax-=360),e.xmax<e.xmin){var r=e.xmax;e.xmax=e.xmin,e.xmin=r}}this._extent=new Ke(t.project(new Xe(e.xmin,e.ymin)),t.project(new Xe(e.xmax,e.ymax)))}}return this._extent},e.prototype._unbind=function(){var t=this.getLayer();t&&(this._animPlayer&&this._animPlayer.finish(),this._unbindMenu(),this._unbindInfoWindow(),this.isEditing()&&this.endEdit(),this._removePainter(),this.onRemove&&this.onRemove(),t.onRemoveGeometry&&t.onRemoveGeometry(this),delete this._layer,delete this._internalId,delete this._extent)},e.prototype._getInternalId=function(){return this._internalId},e.prototype._setInternalId=function(t){this._internalId=t},e.prototype._getMeasurer=function(){return this._getProjection()?this._getProjection():Xi.getInstance(this.options.measure)},e.prototype._getProjection=function(){var t=this.getMap();return t?t.getProjection():null},e.prototype._verifyProjection=function(){var t=this._getProjection();!this._projCode||t&&this._projCode===t.code||this._clearProjection(),this._projCode=t?t.code:null},e.prototype._getExternalResources=function(){return Vt(this._getInternalSymbol())},e.prototype._getPainter=function(){return!this._painter&&this.getMap()&&(-1!==ye.indexOf(this.type)?this._painter=new kn(this):this._painter=new Tn(this)),this._painter},e.prototype._removePainter=function(){this._painter&&this._painter.remove(),delete this._painter},e.prototype._paint=function(t){this._painter&&this._painter.paint(t)},e.prototype._clearCache=function(){delete this._extent},e.prototype._clearProjection=function(){delete this._extent},e.prototype._repaint=function(){this._painter&&this._painter.repaint()},e.prototype.onHide=function(){this.closeMenu(),this.closeInfoWindow()},e.prototype.onShapeChanged=function(){this._clearCache(),this._repaint(),this._fireEvent("shapechange")},e.prototype.onPositionChanged=function(){this._clearCache(),this._repaint(),this._fireEvent("positionchange")},e.prototype.onSymbolChanged=function(){this._painter&&this._painter.refreshSymbol(),this._fireEvent("symbolchange")},e.prototype.onConfig=function(t){var e=!1;for(var i in t)if(t.hasOwnProperty(i)){var n=i.slice(0,5);if("arrow"===n||"shado"===n){e=!0;break}}e&&this._repaint()},e.prototype._setParent=function(t){t&&(this._parent=t)},e.prototype._getParent=function(){return this._parent},e.prototype._fireEvent=function(t,e){this.getLayer()&&this.getLayer()._onGeometryEvent&&(e||(e={}),e.type=t,e.target=this,this.getLayer()._onGeometryEvent(e)),this.fire(t,e)},e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t)}},e.prototype._exportGraphicOptions=function(t){var e={};return(r(t.options)||t.options)&&(e.options=this.config()),(r(t.symbol)||t.symbol)&&(e.symbol=this.getSymbol()),(r(t.infoWindow)||t.infoWindow)&&this._infoWinOptions&&(e.infoWindow=this._infoWinOptions),e},e.prototype._exportGeoJSONGeometry=function(){var t=this.getCoordinates(),e=Xe.toNumberArrays(t);return{type:this.getType(),coordinates:e}},e.prototype._exportProperties=function(){var t=null,e=this.getProperties();return r(e)||(t=a(e)?n({},e):e),t},e}(Ii(Ei(zi(Ri))));En.mergeOptions(On);var Ln="mousedown mouseup mousemove click dblclick contextmenu touchstart touchmove touchend",Dn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHooks=function(){var t=this.target,e=t._panels.allLayers||t._containerDOM;Ue(e,Ln,this._identifyGeometryEvents,this)},e.prototype.removeHooks=function(){var t=this.target,e=t._panels.allLayers||t._containerDOM;qe(e,Ln,this._identifyGeometryEvents,this)},e.prototype._identifyGeometryEvents=function(t,e){function n(e){var i=!0;if("mousemove"===a){var n={};if(S(e))for(var o=e.length-1;o>=0;o--)e[o]instanceof En&&(n[e[o]._getInternalId()]=e[o],e[o]._onEvent(t),i=e[o]._onMouseOver(t));r._setPriorityCursor(d);var h=this._prevMouseOverTargets;if(this._prevMouseOverTargets=e,S(h))for(var l=h.length-1;l>=0;l--){var p=h[l];if(p instanceof En){var u=h[l]._getInternalId();if(e&&e.length>0){var c=!0;n[u]&&(c=!1),c&&p._onMouseOut(t)}else p._onMouseOut(t)}}}else{if(!e||!e.length)return;for(var f=e.length-1;f>=0;f--)if(e[f]instanceof En){i=e[f]._onEvent(t),s&&e[f]._onEvent(t,s);break}}!1===i&&bt(t)}var r=this.target;if(!r.isInteracting()&&!r._ignoreEvent(t)){var o=r._getLayers((function(t){return!(!t.identify||!t.options.geometryEvents)}));if(o.length){var s=null,a=e||t.type;if("mousedown"===a||"touchstart"===a&&1===t.touches.length)this._mouseDownTime=i();else if(("click"===a||"touchend"===a)&&this._mouseDownTime){var h=this._mouseDownTime,l;if(delete this._mouseDownTime,i()-h>300){if("click"===a)return}else"touchend"===a&&(s="click")}var p=t.touches&&t.touches.length>0?t.touches[0]:t.changedTouches&&t.changedTouches.length>0?t.changedTouches[0]:t;if(p){var u=Tt(p,r._containerDOM),c=r.containerPointToCoordinate(u);"touchstart"===a&&Ct(t);var d=null,f={includeInternals:!0,filter:function(e){if(!(e instanceof En))return!1;var i=e._getEventTypeToFire(t);if("mousemove"===a){if(!d&&e.options.cursor&&(d=e.options.cursor),!e.listens("mousemove")&&!e.listens("mouseover"))return!1}else if(!e.listens(i)&&!e.listens(s))return!1;return!0},count:1,coordinate:c,onlyVisible:r.options.onlyVisibleGeometryEvents,layers:o},g=n.bind(this);this._queryIdentifyTimeout&&Pe(this._queryIdentifyTimeout),"mousemove"===a||"touchmove"===a?this._queryIdentifyTimeout=Me((function(){r.isInteracting()||r.identify(f,g)})):r.identify(f,g)}}}},e}(Di);bn.mergeOptions({geometryEvents:!0,onlyVisibleGeometryEvents:!0}),bn.addOnLoadHook("addHandler","geometryEvents",Dn);var Rn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHooks=function(){vt(this.target._containerDOM,"mousewheel",this._onWheelScroll,this)},e.prototype.removeHooks=function(){xt(this.target._containerDOM,"mousewheel",this._onWheelScroll)},e.prototype._onWheelScroll=function(t){var e=this.target,i=e._containerDOM;if(Ct(t),bt(t),e.isZooming())return!1;var n=(t.wheelDelta?t.wheelDelta:t.detail)>0?1:-1;n*=this._getSteps(n),t.detail&&(n*=-1);var r=Tt(t,i);return this._scrollZoomFrame&&Pe(this._scrollZoomFrame),this._scrollZoomFrame=Me((function(){e._zoomAnimation(Math.ceil(e.getZoom()+n),r)})),!1},e.prototype._getSteps=function(t){var e=Date.now();return(!this._steps||e-this._time>500||t!==this._lastLevel)&&(this._steps=1),this._lastLevel=t,this._time=e,this._steps>3&&(this._steps=3),this._steps++},e}(Di);bn.mergeOptions({scrollWheelZoom:!0}),bn.addOnLoadHook("addHandler","scrollWheelZoom",Rn);var An=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addHooks=function(){vt(this.target._containerDOM,"touchstart",this._onTouchStart,this)},e.prototype.removeHooks=function(){xt(this.target._containerDOM,"touchstart",this._onTouchStart)},e.prototype._onTouchStart=function(t){var e=this.target;if(t.touches&&2===t.touches.length&&!e.isZooming()){var i=e._containerDOM,n=Tt(t.touches[0],i),r=Tt(t.touches[1],i);this._startDist=n.distanceTo(r),this._startZoom=e.getZoom();var o=e.getSize();this._Origin=new ze(o.width/2,o.height/2),vt(document,"touchmove",this._onTouchMove,this),vt(document,"touchend",this._onTouchEnd,this),Ct(t),e.onZoomStart(null,this._Origin),e._fireEvent("touchzoomstart",{from:this._startZoom})}},e.prototype._onTouchMove=function(t){var e=this.target;if(t.touches&&2===t.touches.length&&e.isZooming()){var i=e._containerDOM,n=Tt(t.touches[0],i),r=Tt(t.touches[1],i),o=n.distanceTo(r)/this._startDist;this._scale=o;var s=e._getResolution(this._startZoom)/o,a=e.getZoomFromRes(s);e.onZooming(a,this._Origin),e._fireEvent("touchzooming")}},e.prototype._onTouchEnd=function(){var t=this.target;if(t._zooming){t._zooming=!1,qe(document,"touchmove",this._onTouchMove,this),qe(document,"touchend",this._onTouchEnd,this);var e=this._scale,i=t.getZoomForScale(e);-1===i&&(i=t.getZoom()),i!==t.getZoom()?t._zoomAnimation(i,this._Origin,this._scale):t.onZoomEnd(i,this._Origin),t._fireEvent("touchzoomend")}else t._zooming=!1},e}(Di);bn.mergeOptions({touchZoom:!0}),bn.addOnLoadHook("addHandler","touchZoom",An);var In="mousedown mouseup mouseover mouseout mousemove click dblclick contextmenu keypress touchstart touchmove touchend ";bn.include({_registerDomEvents:function(){vt(this._panels.mapWrapper||this._containerDOM,In,this._handleDOMEvent,this)},_removeDomEvents:function(){xt(this._panels.mapWrapper||this._containerDOM,In,this._handleDOMEvent)},_handleDOMEvent:function(t){var e=t.type;if(!this._ignoreEvent(t)){"contextmenu"===e&&Ct(t);var n=null;if("mousedown"===e||"touchstart"===e&&1===t.touches.length)this._mouseDownTime=i();else if(("click"===e||"touchend"===e||"contextmenu"===e)&&this._mouseDownTime){var r=this._mouseDownTime,o;if(delete this._mouseDownTime,i()-r>300){if("click"===e||"contextmenu"===e)return}else"touchend"===e&&(n="click")}"click"===e&&2===t.button&&(e="contextmenu"),this._fireDOMEvent(this,t,e),n&&this._fireDOMEvent(this,t,n)}},_ignoreEvent:function(t){if(!t||!this._panels.control)return!1;var e=t.srcElement||t.target;if(e)for(;e&&e!==this._containerDOM;){if(e.className&&e.className.indexOf&&(e.className.indexOf("maptalks-control")>=0||e.className.indexOf("maptalks-ui")>=0))return!0;e=e.parentNode}return!1},_parseEvent:function(t,e){if(!t)return null;var i={domEvent:t};if("keypress"!==e){var n=t.touches&&t.touches.length>0?t.touches[0]:t.changedTouches&&t.changedTouches.length>0?t.changedTouches[0]:t;if(n){var r=Tt(n,this._containerDOM);i.coordinate=this.containerPointToCoordinate(r),i.containerPoint=r,i.viewPoint=this.containerPointToViewPoint(r),i.point2d=this._containerPointToPoint(r)}}return i},_fireDOMEvent:function(t,e,i){if(!this.isRemoved()){var n=this._parseEvent(e,i);this._fireEvent(i,n)}}}),bn.include({requestFullScreen:function(){return this._fireEvent("fullscreenstart"),this._requestFullScreen(this._containerDOM),this._fireEvent("fullscreenend"),this},cancelFullScreen:function(){return this._cancelFullScreen(this._containerDOM),this._fireEvent("cancelfullscreen"),this},_requestFullScreen:function(t){if(t.requestFullScreen)t.requestFullScreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else if(t.webkitRequestFullScreen)t.webkitRequestFullScreen();else if(t.msRequestFullScreen)t.msRequestFullScreen();else{var e="fullscreen=1,status=no,resizable=yes,top=0,left=0,scrollbars=no,titlebar=no,menubar=no,location=no,toolbar=no,z-look=yes,width="+(screen.availWidth-8)+",height="+(screen.availHeight-45),i;null!==window.open(location.href,"_blank",e)&&(window.opener=null,window.close())}},_cancelFullScreen:function(){if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitCancelFullScreen)document.webkitCancelFullScreen();else{var t;null!==window.open(location.href,"_blank","fullscreen=no,status=yes,resizable=yes,scrollbars=no,titlebar=no,menubar=yes,location=yes,toolbar=yes,z-look=yes")&&(window.opener=null,window.close())}}}),bn.include({panTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t?(t=new Xe(t),this._panAnimation(t,e.duration)):this},panBy:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._panBy(t,e)},_panBy:function(t,e,i){if(!t)return this;if(t=new ze(t).multi(-1),this.onMoveStart(),e?l(e)&&(i=e,e={}):e={},void 0===e.animation||e.animation){var n=this.locateByPoint(this.getCenter(),t.x,t.y);this._panAnimation(n,e.duration,i)}else this._offsetCenterByPixel(t),this.onMoving(),i&&i(),this.onMoveEnd();return this},_panAnimation:function(t,e,i){this._getRenderer().panAnimation(t,e,i)}});var zn=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.getCoordinates=function(){return this._coordinates},e.prototype.setCoordinates=function(t){var e=t instanceof Xe?t:new Xe(t);if(e.equals(this._coordinates))return this;if(this._coordinates=e,!this.getMap())return this.onPositionChanged(),this;var i=this._getProjection();return this._setPrjCoordinates(i.project(this._coordinates)),this},e.prototype._getCenter2DPoint=function(t){var e=this.getMap();if(!e)return null;var i=r(t)?e.getZoom():e.getMaxNativeZoom(),n=this._getPrjCoordinates();return n?e._prjToPoint(n,i):null},e.prototype._getPrjCoordinates=function(){var t=this._getProjection();return t?(this._verifyProjection(),this._pcenter||this._coordinates&&(this._pcenter=t.project(this._coordinates)),this._pcenter):null},e.prototype._setPrjCoordinates=function(t){this._pcenter=t,this.onPositionChanged()},e.prototype._updateCache=function(){this._clearCache();var t=this._getProjection();this._pcenter&&t&&(this._coordinates=t.unproject(this._pcenter))},e.prototype._clearProjection=function(){this._pcenter=null,t.prototype._clearProjection.call(this)},e.prototype._computeCenter=function(){return this._coordinates?this._coordinates.copy():null},e}(t)},jn={symbol:{markerType:"path",markerPath:[{path:"M8 23l0 0 0 0 0 0 0 0 0 0c-4,-5 -8,-10 -8,-14 0,-5 4,-9 8,-9l0 0 0 0c4,0 8,4 8,9 0,4 -4,9 -8,14z M3,9 a5,5 0,1,0,0,-0.9Z",fill:"#DE3333"}],markerPathWidth:16,markerPathHeight:23,markerWidth:24,markerHeight:34}},Zn=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r.type="Point",i&&r.setCoordinates(i),r}return xe(e,t),e.prototype._isVectorMarker=function(){var t=this._getInternalSymbol();return!Array.isArray(t)&&ei.test(t)},e.prototype._canEdit=function(){var t=this._getInternalSymbol();return!Array.isArray(t)&&(ei.test(t)||ai.test(t)||ni.test(t))},e.prototype._containsPoint=function(t){return this._getPainter().getContainerExtent().contains(this.getMap()._pointToContainerPoint(t))},e.prototype._computeExtent=function(){var t=this.getCenter();return t?new Ke(t,t):null},e.prototype._computeGeodesicLength=function(){return 0},e.prototype._computeGeodesicArea=function(){return 0},e.prototype._getSprite=function(t,e){return this._getPainter()?this._getPainter().getSprite(t,e):new Tn(this).getSprite(t,e)},e}(zn(En));Zn.mergeOptions(jn),Zn.registerJSONType("Marker");var Hn={in:function(t){return Math.pow(t,2)},out:function(t){return 1-Hn.in(1-t)},inAndOut:function(t){return 3*t*t-2*t*t*t},linear:function(t){return t},upAndDown:function(t){return t<.5?Hn.inAndOut(2*t):1-Hn.inAndOut(2*(t-.5))}},Fn=function t(e,i){ve(this,t),this.state=e,this.styles=i},Gn=function t(e,i,n){ve(this,t),this._animation=e,this._options=i,this._onFrame=n,this.playState="idle",this.ready=!0,this.finished=!1},Nn={speed:{slow:2e3,normal:1e3,fast:500},_resolveStyles:function(t){if(!t)return null;var e={},i={},n={};for(var r in t)if(t.hasOwnProperty(r)){var s=t[r],a=void 0;(a=function(t){return!Array.isArray(t)&&t.constructor===Object||!(!Array.isArray(t)||t[0].constructor!==Object)}(s)?function(t){if(!Array.isArray(t))return Nn._resolveStyles(t);for(var e=[],i=[],n=[],r=0;r<t.length;r++){var o=Nn._resolveStyles(t[r]);o&&(e.push(o[0]),i.push(o[1]),n.push(o[2]))}return e.length?[e,i,n]:null}(s):function(t){var e=t,i=void 0;Array.isArray(t)||(o(t)?e=[0,t]:t instanceof ze||t instanceof Xe?e=[new(i=t.constructor)(0,0),t]:e=[t,t]);var n=e[0],r=e[1];return o(n)&&o(r)?n===r?null:[n,r-n,r]:Array.isArray(n)||n instanceof Xe||n instanceof ze?(Array.isArray(n)?(n=new Xe(n),r=new Xe(r)):(n=new(i=n.constructor)(n),r=new i(r)),n.equals(r)?null:[n,r.sub(n),r]):[n,0,r]}(s))&&(i[r]=a[0],e[r]=a[1],n[r]=a[2])}return[i,e,n]},framing:function(t,e){e||(e={});var i=e.easing?Hn[e.easing]:Hn.linear;i||(i=Hn.linear);var n=void 0,r=void 0,s=void 0;(t=Nn._resolveStyles(t))&&(r=t[0],n=t[1],s=t[2]);var a=function t(e,i,n){if(!i||!n)return null;var r={};for(var a in n)if(n.hasOwnProperty(a)){if(i[a]===s[a]){r[a]=i[a];continue}var h=i[a],l=n[a];if(o(l))r[a]=h+e*l;else if(Array.isArray(l)){for(var p=[],u=0;u<l.length;u++)p.push(t(e,h[u],l[u]));r[a]=p}else{var c;l.constructor===Object?r[a]=t(e,h,l):(h instanceof ze||h instanceof Xe)&&(r[a]=h.add(l.multi(e)))}}return r};return function(t,e){var o=void 0,h=void 0;if(t<0)o={playState:"idle",delta:0},h=r;else if(t<e){var l=i(t/e);o={playState:"running",delta:l},h=a(l,r,n)}else o={playState:"finished",delta:1},h=s;return o.startStyles=r,o.destStyles=s,o.progress=t,o.remainingMs=e-t,new Fn(o,h)}},_requestAnimFrame:function(t){this._frameQueue||(this._frameQueue=[]),this._frameQueue.push(t),this._a()},_a:function(){this._animationFrameId||(this._animationFrameId=Me(Nn._frameFn))},_run:function(){if(this._frameQueue.length){var t=this._frameQueue;this._frameQueue=[];for(var e=0,i=t.length;e<i;e++)t[e]();this._frameQueue.length?this._animationFrameId=Me(Nn._frameFn):delete this._animationFrameId}},animate:function(t,e,i){e||(e={});var n=Nn.framing(t,e);return new Gn(n,e,i)}};Nn._frameFn=Nn._run.bind(Nn),n(Gn.prototype,{_prepare:function(){var t=this._options,e=t.speed||t.duration;h(e)&&((e=Nn.speed[e])||(e=+e)),e||(e=Nn.speed.normal),this.duration=e,this._framer=t.framer||Nn._requestAnimFrame.bind(Nn)},play:function(){if("idle"!==this.playState&&"paused"!==this.playState)return this;"idle"===this.playState&&(this.currentTime=0,this._prepare());var t=Date.now();if(!this.startTime){var e=this._options;this.startTime=e.startTime?e.startTime:t}return this._playStartTime=Math.max(t,this.startTime),"paused"===this.playState&&(this._playStartTime-=this.currentTime),this.playState="running",this._run(),this},pause:function(){return this.playState="paused",this},cancel:function(){return this.playState="idle",this.finished=!1,this},finish:function(){return this.playState="finished",this.finished=!0,this},reverse:function(){},_run:function(){var t=this,e=this._onFrame,i=Date.now(),n=i-this._playStartTime;if(this._options.repeat&&n>=this.duration&&(this._playStartTime=i,n=0),"finished"!==this.playState&&"paused"!==this.playState&&"idle"!==this.playState){var r=this._animation(n,this.duration);this.playState=r.state.playState,"idle"===this.playState?this.startTime>i&&setTimeout(this._run.bind(this),this.startTime-i):"running"===this.playState?this._framer((function(){"running"===t.playState?(t.currentTime=n,e&&e(r),t._run()):t._run()})):"finished"===this.playState&&(this.finished=!0,e&&e(r))}else if(e){"finished"===this.playState?n=this.duration:"idle"===this.playState&&(n=0);var o=this._animation(n,this.duration);o.state.playState=this.playState,e(o)}}});var Wn=Object.freeze({Animation:Nn,Easing:Hn,Player:Gn,Frame:Fn}),Bn=Qt((function(t){!function(){function e(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n}function i(t,e,i){var n=e.x,r=e.y,o=i.x-n,s=i.y-r;if(0!==o||0!==s){var a=((t.x-n)*o+(t.y-r)*s)/(o*o+s*s);a>1?(n=i.x,r=i.y):a>0&&(n+=o*a,r+=s*a)}return(o=t.x-n)*o+(s=t.y-r)*s}function n(t,i){for(var n,r=t[0],o=[r],s=1,a=t.length;s<a;s++)e(n=t[s],r)>i&&(o.push(n),r=n);return r!==n&&o.push(n),o}function r(t,e){var n,r,o,s,a=t.length,h,l=new("undefined"!=typeof Uint8Array?Uint8Array:Array)(a),p=0,u=a-1,c=[],d=[];for(l[p]=l[u]=1;u;){for(r=0,n=p+1;n<u;n++)(o=i(t[n],t[p],t[u]))>r&&(s=n,r=o);r>e&&(l[s]=1,c.push(p,s,s,u)),u=c.pop(),p=c.pop()}for(n=0;n<a;n++)l[n]&&d.push(t[n]);return d}function o(t,e,i){var o=void 0!==e?e*e:1;return r(t=i?t:n(t,o),o)}t.exports=o}()})),Vn={antiMeridian:"continuous",symbol:{lineColor:"#000",lineWidth:2,lineOpacity:1,polygonFill:"#fff",polygonOpacity:1,opacity:1}},Jn=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._getPath2DPoints=function(t,e,i){var n=[];if(!S(t))return n;var o=this.getMap(),s=o.getFullExtent(),a=this._getProjection(),h=!!Xi.isSphere(a)&&this.options.antiMeridian,l=o.options.clipFullExtent,p=!e&&this.getLayer()&&this.getLayer().options.enableSimplify,u=2*o._getResolution(),c=Array.isArray(t[0]);if(delete this._simplified,p&&!c){var d=t.length;t=Bn(t,u,!1),this._simplified=t.length<d}r(i)&&(i=o.getZoom());for(var f=void 0,g=void 0,y=void 0,_=void 0,m=void 0,v=void 0,x=[],w=[],C=x,b=0,M=t.length;b<M;b++)f=t[b],c?C.push(this._getPath2DPoints(f,e,i)):r(f)||l&&!s.contains(f)||(b>0&&("continuous"===h||"split"===h)&&(y=a.unproject(f),"split"!==h&&g||(g=a.unproject(t[b-1])),g&&y&&(_=y.x-g.x,m=y.y-g.y,Math.abs(_)>180&&("continuous"===h?(g=y=this._anti(y,_),f=a.project(y)):"split"===h&&(_>0?(v=g.y+m*(g.x- -180)/(360-_)*(g.y>y.y?-1:1),(C=C===x?w:x).push(o.coordinateToPoint(new Xe(180,v),i))):(v=g.y+m*(180-g.x)/(360+_)*(g.y>y.y?1:-1),C.push(o.coordinateToPoint(new Xe(180,v),i)),(C=C===x?w:x).push(o.coordinateToPoint(new Xe(-180,v),i))))))),C.push(o._prjToPoint(f,i)));return w.length>0?[x,w]:C},e.prototype._anti=function(t,e){return e>0?t.sub(360,0):t.add(360,0)},e.prototype._setPrjCoordinates=function(t){this._prjCoords=t,this.onShapeChanged()},e.prototype._getPrjCoordinates=function(){return this._getProjection()?(this._verifyProjection(),this._prjCoords||(this._prjCoords=this._projectCoords(this._coordinates)),this._prjCoords):null},e.prototype._updateCache=function(){this._clearCache(),this._getProjection()&&this._prjCoords&&(this._coordinates=this._unprojectCoords(this._getPrjCoordinates()))},e.prototype._clearProjection=function(){this._prjCoords=null,t.prototype._clearProjection.call(this)},e.prototype._projectCoords=function(t){var e=this._getProjection();return e?e.projectCoords(t):[]},e.prototype._unprojectCoords=function(t){var e=this._getProjection();return e?e.unprojectCoords(t):[]},e.prototype._computeCenter=function(){var t=this._coordinates;if(!S(t))return null;for(var e=0,i=0,n=0,r=t.length,s=0;s<r;s++)t[s]&&o(t[s].x)&&o(t[s].y)&&(e+=t[s].x,i+=t[s].y,n++);return new Xe(e/n,i/n)},e.prototype._computeExtent=function(){var t=this._coordinates;if(!S(t))return null;var e=[t];return this.hasHoles&&this.hasHoles()&&e.push.apply(e,this.getHoles()),this._computeCoordsExtent(e)},e.prototype._computeCoordsExtent=function(t){for(var e=this._getProjection(),i=this.options.antiMeridian&&Xi.isSphere(e),n=null,r=void 0,o=void 0,s=void 0,a=void 0,h=0,l=t.length;h<l;h++)for(var p=0,u=t[h].length;p<u;p++)o=t[h][p],p>0&&i&&(a||(a=t[h][p-1]),s=o.x-a.x,Math.abs(s)>180&&(a=o=this._anti(o,s))),n=(r=new Ke(o,o)).combine(n);return n},e.prototype._get2DLength=function(){for(var t=this._getPath2DPoints(this._getPrjCoordinates(),!0),e=0,i=1,n=t.length;i<n;i++)e+=t[i].distanceTo(t[i-1]);return e},e.prototype._hitTestTolerance=function(){var t=this._getInternalSymbol(),e=void 0;if(Array.isArray(t)){e=0;for(var i=0;i<t.length;i++)o(t[i].lineWidth)&&t[i].lineWidth>e&&(e=t[i].lineWidth)}else e=t.lineWidth;return e?e/2:1.5},e}(En);Jn.mergeOptions(Vn);var Un={arrowStyle:null,arrowPlacement:"vertex-last"},qn=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r.type="LineString",i&&r.setCoordinates(i),r}return xe(e,t),e.prototype.setCoordinates=function(t){return t?(this._coordinates=Xe.toCoordinates(t),this.getMap()?this._setPrjCoordinates(this._projectCoords(this._coordinates)):this.onShapeChanged(),this):(this._coordinates=null,this._setPrjCoordinates(null),this)},e.prototype.getCoordinates=function(){return this._coordinates||[]},e.prototype.animateShow=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1];l(e)&&(i=e={});var n=this.getCoordinates(),r=e.duration||1e3,o=this.getLength(),s=e.easing||"out";this.setCoordinates([]);var a=Nn.animate({t:r},{duration:r,easing:s},(function(e){if(!t.getMap())return a.finish(),t.setCoordinates(n),void(i&&i(e));t._drawAnimFrame(e.styles.t,r,o,n),i&&i(e)}));return a.play(),a},e.prototype._drawAnimFrame=function(t,e,i,n){if(0!==t){var r=this.getMap(),o=t/e*i;this._animIdx||(this._animIdx=0,this._animLenSoFar=0,this.show());var s=0,a=void 0,h=void 0;for(a=this._animIdx,h=n.length;a<h-1&&(s=r.computeLength(n[a],n[a+1]),!(this._animLenSoFar+s>o));a++)this._animLenSoFar+=s;if(this._animIdx=a,this._animIdx>=h-1)this.setCoordinates(n);else{var l=this._animIdx,p=n[l],u=n[l+1],c,d=(o-this._animLenSoFar)/s,f=p.x+(u.x-p.x)*d,g=p.y+(u.y-p.y)*d,y=new Xe(f,g),_=n.slice(0,this._animIdx+1);_.push(y),this.setCoordinates(_)}}else this.setCoordinates([])},e.prototype._computeGeodesicLength=function(t){return t.measureLength(this.getCoordinates())},e.prototype._computeGeodesicArea=function(){return 0},e.prototype._containsPoint=function(t,e){function i(e){for(var i=void 0,r=void 0,o=0,s=e.length;o<s-1;o++)if(i=e[o],r=e[o+1],Xt(t,i,r)<=n)return!0;return!1}var n=r(e)?this._hitTestTolerance():e;n<2&&(n=2);var o=this._getArrowStyle(),s=this._getInternalSymbol().lineWidth,a=this.getMap(),h=this._getPrjExtent(),l=new Xe(h.xmin,h.ymax),p=new Xe(h.xmax,h.ymin),u=a._prjToPoint(l),c=a._prjToPoint(p),d=new $e(u.x-n,u.y-n,c.x+n,c.y+n);if(o&&d._expand(Math.max(o[0]*s,o[1]*s)),!d.contains(t))return!1;var f=void 0;if(this._getArrowStyle()){f=this._getPath2DPoints(this._getPrjCoordinates(),!0);for(var g=this._getArrows(f,s,(e||2)+s/2),y=g.length-1;y>=0;y--)if(Kt(t,g[y]))return!0}if((f=f||this._getPath2DPoints(this._getPrjCoordinates())).length>0&&Array.isArray(f[0])){for(var _=0,m=f.length;_<m;_++)if(i(f[_]))return!0;return!1}return i(f)},e}(Jn);qn.mergeOptions(Un),qn.registerJSONType("LineString");var Yn=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r.type="Polygon",i&&r.setCoordinates(i),r}return xe(e,t),e.prototype.setCoordinates=function(t){if(!t)return this._coordinates=null,this._holes=null,this._projectRings(),this;var e=Xe.toCoordinates(t),i=e.length;if(Array.isArray(e[0])){if(this._coordinates=this._trimRing(e[0]),i>1){for(var n=[],r=1;r<i;r++)e[r]&&n.push(this._trimRing(e[r]));this._holes=n}}else this._coordinates=this._trimRing(e);return this._projectRings(),this},e.prototype.getCoordinates=function(){if(!this._coordinates)return[];for(var t=this.getHoles(),e=[this._copyAndCloseRing(this._coordinates)],i=0,n=t.length;i<n;i++)e.push(this._copyAndCloseRing(t[i]));return e},e.prototype.getShell=function(){return this._coordinates||[]},e.prototype.getHoles=function(){return this._holes||[]},e.prototype.hasHoles=function(){return this.getHoles().length>0},e.prototype._projectRings=function(){this.getMap()?(this._prjCoords=this._projectCoords(this._coordinates),this._prjHoles=this._projectCoords(this._holes),this.onShapeChanged()):this.onShapeChanged()},e.prototype._cleanRing=function(t){for(var e=t.length-1;e>=0;e--)t[e]||t.splice(e,1)},e.prototype._checkRing=function(t){if(this._cleanRing(t),!t||!S(t))return!1;var e=t[t.length-1],i=!0;return t[0].x===e.x&&t[0].y===e.y||(i=!1),i},e.prototype._trimRing=function(t){var e=this._checkRing(t);return S(t)&&e&&t.splice(t.length-1,1),t},e.prototype._copyAndCloseRing=function(t){t=t.slice(0);var e=this._checkRing(t);return S(t)&&!e?(t.push(t[0].copy()),t):t},e.prototype._getPrjShell=function(){return"Polygon"===this.getJSONType()?this._getPrjCoordinates():this._getProjection()?(this._verifyProjection(),this._prjShell||(this._prjShell=this._projectCoords(this.getShell())),this._prjShell):null},e.prototype._getPrjHoles=function(){return this._getProjection()?(this._verifyProjection(),this._prjHoles||(this._prjHoles=this._projectCoords(this.getHoles())),this._prjHoles):null},e.prototype._computeGeodesicLength=function(t){var e=this.getCoordinates();if(!S(e))return 0;for(var i=0,n=0,r=e.length;n<r;n++)i+=t.measureLength(e[n]);return i},e.prototype._computeGeodesicArea=function(t){var e=this.getCoordinates();if(!S(e))return 0;for(var i=t.measureArea(e[0]),n=1,r=e.length;n<r;n++)i-=t.measureArea(e[n]);return i},e.prototype._containsPoint=function(t,e){function i(e){var i=Kt(t,e);if(i)return i;var r=void 0,o=void 0,s=void 0,a=void 0,h=e.length;for(r=0,o=h-1;r<h;o=r++)if(s=e[r],a=e[o],Xt(t,s,a)<=n)return!0;return!1}var n=r(e)?this._hitTestTolerance():e;if(!this._getPainter().get2DExtent().expand(n).contains(t))return!1;var o=this.getMap().getProjection(),s=this.getShell().map((function(t){return o.project(t)})),a=this._getPath2DPoints(s);if(Array.isArray(a[0])){for(var h=0;h<a.length;h++)if(i(a[h]))return!0;return!1}return i(a)},e.prototype._updateCache=function(){t.prototype._updateCache.call(this),this._prjHoles&&(this._holes=this._unprojectCoords(this._getPrjHoles()))},e.prototype._clearCache=function(){return delete this._prjShell,t.prototype._clearCache.call(this)},e.prototype._clearProjection=function(){this._prjHoles&&(this._prjHoles=null),this._prjShell&&(this._prjShell=null),t.prototype._clearProjection.call(this)},e}(Jn);Yn.registerJSONType("Polygon");var Qn=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r.type="GeometryCollection",r.setGeometries(i),r}return xe(e,t),e.prototype.setGeometries=function(t){for(var e=this._checkGeometries(t||[]),i=this._getSymbol(),n=this.config(),r=e.length-1;r>=0;r--)e[r]._initOptions(n),e[r]._setParent(this),e[r]._setEventParent(this),i&&e[r].setSymbol(i);return this._geometries=e,this.getLayer()&&(this._bindGeometriesToLayer(),this.onShapeChanged()),this},e.prototype.getGeometries=function(){return this._geometries||[]},e.prototype.forEach=function(t,e){for(var i=this.getGeometries(),n=0,r=i.length;n<r;n++)i[n]&&(e?t.call(e,i[n],n):t(i[n],n));return this},e.prototype.filter=function(t,i){if(!t)return new e;var n=[],r=l(t),o=r?t:D(t);return this.forEach((function(t){var e=r?t:G(t);(i?o.call(i,e):o(e))&&n.push(t)}),this),new e(n)},e.prototype.translate=function(t){if(!t)return this;if(this.isEmpty())return this;var e=arguments;return this.forEach((function(t){t&&t.translate&&t.translate.apply(t,e)})),this},e.prototype.isEmpty=function(){return!S(this.getGeometries())},e.prototype.remove=function(){return this.forEach((function(t){t._unbind()})),En.prototype.remove.apply(this,arguments)},e.prototype.show=function(){return this.options.visible=!0,this.forEach((function(t){t.show()})),this},e.prototype.hide=function(){return this.options.visible=!1,this.forEach((function(t){t.hide()})),this},e.prototype.onConfig=function(t){this.forEach((function(e){e.config(t)}))},e.prototype.getSymbol=function(){var e=t.prototype.getSymbol.call(this);if(!e){var i=[],n=!1;this.forEach((function(t){t.getSymbol()&&!n&&(n=!0),i.push(t.getSymbol())})),n&&(e={children:i})}return e},e.prototype.setSymbol=function(t){if(t&&t.children)this._symbol=null,this.forEach((function(e,i){e.setSymbol(t.children[i])}));else{var e=this._prepareSymbol(t);this._symbol=e,this.forEach((function(t){t.setSymbol(e)}))}return this.onSymbolChanged(),this},e.prototype._setExternSymbol=function(t){return t=this._prepareSymbol(t),this._externSymbol=t,this.forEach((function(e){e._setExternSymbol(t)})),this.onSymbolChanged(),this},e.prototype._bindLayer=function(){t.prototype._bindLayer.apply(this,arguments),this._bindGeometriesToLayer()},e.prototype._bindGeometriesToLayer=function(){var t=this.getLayer();this.forEach((function(e){e._bindLayer(t)}))},e.prototype._checkGeometries=function(t){if(t&&!Array.isArray(t)){if(t instanceof En)return[t];throw new Error("The geometry added to collection is invalid.")}for(var e=0,i=t.length;e<i;e++)if(!this._checkGeo(t[e]))throw new Error("The geometry added to collection is invalid. Index: "+e);return t},e.prototype._checkGeo=function(t){return t instanceof En},e.prototype._updateCache=function(){this._clearCache(),this.isEmpty()||this.forEach((function(t){t&&t._updateCache&&t._updateCache()}))},e.prototype._removePainter=function(){this._painter&&this._painter.remove(),delete this._painter,this.forEach((function(t){t._removePainter()}))},e.prototype._computeCenter=function(t){if(!t||this.isEmpty())return null;for(var e=0,i=0,n=0,r=this.getGeometries(),o=0,s=r.length;o<s;o++)if(r[o]){var a=r[o]._computeCenter(t);a&&(e+=a.x,i+=a.y,n++)}return 0===n?null:new Xe(e/n,i/n)},e.prototype._containsPoint=function(t,e){if(this.isEmpty())return!1;for(var i=this.getGeometries(),n=0,r=i.length;n<r;n++)if(i[n]._containsPoint(t,e))return!0;return!1},e.prototype._computeExtent=function(t){if(this.isEmpty())return null;for(var e=this.getGeometries(),i=null,n=0,r=e.length;n<r;n++)if(e[n]){var o=e[n]._computeExtent(t);o&&(i=o.combine(i))}return i},e.prototype._computeGeodesicLength=function(t){if(!t||this.isEmpty())return 0;for(var e=this.getGeometries(),i=0,n=0,r=e.length;n<r;n++)e[n]&&(i+=e[n]._computeGeodesicLength(t));return i},e.prototype._computeGeodesicArea=function(t){if(!t||this.isEmpty())return 0;for(var e=this.getGeometries(),i=0,n=0,r=e.length;n<r;n++)e[n]&&(i+=e[n]._computeGeodesicArea(t));return i},e.prototype._exportGeoJSONGeometry=function(){var t=[];if(!this.isEmpty())for(var e=this.getGeometries(),i=0,n=e.length;i<n;i++)e[i]&&t.push(e[i]._exportGeoJSONGeometry());return{type:"GeometryCollection",geometries:t}},e.prototype._clearProjection=function(){if(!this.isEmpty())for(var t=this.getGeometries(),e=0,i=t.length;e<i;e++)t[e]&&t[e]._clearProjection()},e.prototype._getConnectPoints=function(){var t=this.getExtent();return[new Xe(t.xmin,t.ymax),new Xe(t.xmax,t.ymin),new Xe(t.xmin,t.ymin),new Xe(t.xmax,t.ymax)]},e.prototype._getExternalResources=function(){if(this.isEmpty())return[];for(var t=this.getGeometries(),e=[],i={},n=void 0,r=void 0,o=void 0,s=0,a=t.length;s<a;s++)if(t[s])for(var h=0,l=(r=Vt(n=t[s]._getInternalSymbol())).length;h<l;h++)i[o=r[h].join()]||(e.push(r[h]),i[o]=1);return e},e.prototype.startEdit=function(t){var e=this;if(this.isEmpty())return this;t||(t={}),t.symbol&&(this._originalSymbol=this.getSymbol(),this.setSymbol(t.symbol)),this._draggbleBeforeEdit=this.options.draggable,this.config("draggable",!1);for(var i=this.getGeometries(),n=0,r=i.length;n<r;n++)i[n].startEdit(t);return this._editing=!0,this.hide(),setTimeout((function(){e.fire("editstart")}),1),this},e.prototype.endEdit=function(){if(this.isEmpty())return this;for(var t=this.getGeometries(),e=0,i=t.length;e<i;e++)t[e].endEdit();return this._originalSymbol&&(this.setSymbol(this._originalSymbol),delete this._originalSymbol),this._editing=!1,this.show(),this.config("draggable",this._draggbleBeforeEdit),this.fire("editend"),this},e.prototype.isEditing=function(){return!!this._editing},e}(En);Qn.registerJSONType("GeometryCollection");var Xn=function(t){function e(i,n,r,o){ve(this,e);var s=we(this,t.call(this,null,o));return s.GeometryType=i,s.type=n,s._initData(r),s}return xe(e,t),e.prototype.getCoordinates=function(){for(var t=[],e=this.getGeometries(),i=0,n=e.length;i<n;i++)t.push(e[i].getCoordinates());return t},e.prototype.setCoordinates=function(t){for(var e=[],i=0,n=(t=t||[]).length;i<n;i++){var r=new this.GeometryType(t[i],this.config());e.push(r)}return this.setGeometries(e),this},e.prototype._initData=function(t){(t=t||[]).length&&(t[0]instanceof this.GeometryType?this.setGeometries(t):this.setCoordinates(t))},e.prototype._checkGeo=function(t){return t instanceof this.GeometryType},e.prototype._exportGeoJSONGeometry=function(){var t=this.getCoordinates(),e=Xe.toNumberArrays(t);return{type:this.getType(),coordinates:e}},e}(Qn),Kn=function(t){function e(i,n){return ve(this,e),we(this,t.call(this,Zn,"MultiPoint",i,n))}return xe(e,t),e}(Xn);Kn.registerJSONType("MultiPoint");var $n=function(t){function e(i,n){return ve(this,e),we(this,t.call(this,qn,"MultiLineString",i,n))}return xe(e,t),e}(Xn);$n.registerJSONType("MultiLineString");var tr=function(t){function e(i,n){return ve(this,e),we(this,t.call(this,Yn,"MultiPolygon",i,n))}return xe(e,t),e}(Xn);tr.registerJSONType("MultiPolygon");var er={Marker:Zn,LineString:qn,Polygon:Yn,MultiPoint:Kn,MultiLineString:$n,MultiPolygon:tr},ir={toGeometry:function(t){if(h(t)&&(t=g(t)),Array.isArray(t)){for(var e=[],i=0,n=t.length;i<n;i++){var r=this._convert(t[i]);Array.isArray(r)?_(e,r):e.push(r)}return e}return this._convert(t)},_convert:function(t){if(!t||r(t.type))return null;var e=t.type;if("Feature"===e){var i=t.geometry,n=this._convert(i);return n?(n.setId(t.id),n.setProperties(t.properties),n):null}if("FeatureCollection"===e){var o=t.features;return o?this.toGeometry(o):null}if(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"].indexOf(e)>=0)return new er["Point"===e?"Marker":e](t.coordinates);if("GeometryCollection"===e){var s=t.geometries;if(!S(s))return new Qn;for(var a=[],h=s.length,l=0;l<h;l++)a.push(this._convert(s[l]));return new Qn(a)}return null}};En.fromJSON=function(t){if(Array.isArray(t)){for(var e=[],i=0,n=t.length;i<n;i++){var o=En.fromJSON(t[i]);Array.isArray(t)?e=e.concat(o):e.push(o)}return e}if(t&&!t.feature)return ir.toGeometry(t);var s=void 0;return t.subType?(s=En.getClass(t.subType).fromJSON(t),r(t.feature.id)||s.setId(t.feature.id)):(s=ir.toGeometry(t.feature),t.options&&s.config(t.options)),t.symbol&&s.setSymbol(t.symbol),t.infoWindow&&s.setInfoWindow(t.infoWindow),s},fn.fromJSON=function(t){if(!t)return null;var e=t.type,i=fn.getClass(e);if(!i||!i.fromJSON)throw new Error("unsupported layer type:"+e);return i.fromJSON(t)},bn.include({JSON_VERSION:"1.0",toJSON:function(t){t||(t={});var e={version:this.JSON_VERSION,extent:this.getExtent().toJSON()};e.options=this.config(),e.options.center=this.getCenter(),e.options.zoom=this.getZoom();var i=this.getBaseLayer();(r(t.baseLayer)||t.baseLayer)&&i&&(e.baseLayer=i.toJSON(t.baseLayer));var o={};t.clipExtent&&(!0===t.clipExtent?o.clipExtent=this.getExtent():o.clipExtent=t.clipExtent);var s=[];if(r(t.layers)||t.layers&&!Array.isArray(t.layers)){for(var h=this.getLayers(),l=0,p=h.length;l<p;l++)if(h[l].toJSON){var u=n({},a(t.layers)?t.layers:{},o);s.push(h[l].toJSON(u))}e.layers=s}else if(S(t.layers)){for(var c=t.layers,d=0;d<c.length;d++){var f=c[d],g=this.getLayer(f.id);if(g.toJSON){var y=n({},f.options,o);s.push(g.toJSON(y))}}e.layers=s}else e.layers=[];return e}}),bn.fromJSON=function(t,e,i){if(!t||!e)return null;i||(i={});var n=new bn(t,e.options);if(r(i.baseLayer)||i.baseLayer){var o=fn.fromJSON(e.baseLayer);o&&n.setBaseLayer(o)}if(r(i.layers)||i.layers){for(var s=[],a=e.layers,h=0;h<a.length;h++){var l=fn.fromJSON(a[h]);s.push(l)}n.addLayer(s)}return n},bn.include({computeLength:function(t,e){if(!this.getProjection())return null;var i=new Xe(t),n=new Xe(e);return i.equals(n)?0:this.getProjection().measureLength(i,n)},computeGeometryLength:function(t){return t._computeGeodesicLength(this.getProjection())},computeGeometryArea:function(t){return t._computeGeodesicArea(this.getProjection())},identify:function(t,e){if(!t)return this;var i=t.layers;if(!S(i))return this;for(var r=[],o=0,s=i.length;o<s;o++)h(i[o])?r.push(this.getLayer(i[o])):r.push(i[o]);for(var a=new Xe(t.coordinate),l=n({},t),p=[],u=r.length-1;u>=0&&!(t.count&&p.length>=t.count);u--){var c=r[u];if(c&&c.getMap()&&(t.includeInvisible||c.isVisible())&&(t.includeInternals||!(c.getId().indexOf("_maptalks__internal_layer_")>=0))){var d=c.identify(a,l);d&&(Array.isArray(d)?_(p,d):p.push(d))}}return e.call(this,p),this}}),bn.include({_zoom:function(t,e){this.options.zoomable&&!this.isZooming()&&(e=this._checkZoomOrigin(e),t=this._checkZoom(t),this.onZoomStart(t,e),this._frameZoom=this.getZoom(),this.onZoomEnd(t,e))},_zoomAnimation:function(t,e,i){this.options.zoomable&&!this.isZooming()&&(t=this._checkZoom(t),this.getZoom()!==t&&(e=this._checkZoomOrigin(e),this.onZoomStart(t,e),this._startZoomAnimation(t,e,i)))},_checkZoomOrigin:function(t){return(!t||this.options.zoomInCenter||this.getPitch()&&this.getBaseLayer()instanceof vn)&&(t=new ze(this.width/2,this.height/2)),t},_startZoomAnimation:function(t,e,i){var n=this;r(i)&&(i=1);var o=this._getResolution(this._startZoomVal)/this._getResolution(t),s=this.options.zoomAnimationDuration*Math.abs(o-i)/Math.abs(o-1);this._frameZoom=this._startZoomVal;var a=this._getRenderer(),h=function(t){a.callInNextFrame(t)},l=Nn.animate({zoom:[this._startZoomVal,t]},{easing:"out",duration:s,framer:h},(function(t){n.isRemoved()?l.finish():"finished"===t.state.playState?n.onZoomEnd(t.styles.zoom,e):n.onZooming(t.styles.zoom,e,i)})).play()},onZoomStart:function(t,e){this._zooming=!0,this._enablePanAnimation=!1,this._startZoomVal=this.getZoom(),this._startZoomCoord=this.containerPointToCoordinate(e),this._fireEvent("zoomstart",{from:this._startZoomVal,to:t})},onZooming:function(t,e,i){if(this._frameZoom!==t){r(i)&&(i=1),this._zoomTo(t,e);var n=this.getResolution(t),o,s=this.getResolution(this._startZoomVal)/n/i,a=this.getViewPoint(),h={view:[s,0,0,s,(e.x-a.x)*(1-s),(e.y-a.y)*(1-s)]};ki.retina&&(e=e.multi(2)),h.container=[s,0,0,s,e.x*(1-s),e.y*(1-s)],this._fireEvent("zooming",{from:this._startZoomVal,to:t,origin:e,matrix:h}),this._frameZoom=t}},onZoomEnd:function(t,e){var i=this._startZoomVal;this._zoomTo(t,e),this._zooming=!1,this._getRenderer().onZoomEnd(),this._fireEvent("zoomend",{from:i,to:t})},_zoomTo:function(t,e){this._zoomLevel=t,this._calcMatrices(),e&&this.setCoordinateAtContainerPoint(this._startZoomCoord,e)},_checkZoom:function(t){var e=this.getMaxZoom(),i=this.getMinZoom();return t<i&&(t=i),t>e&&(t=e),t}});var nr="undefined"!=typeof Float32Array?Float32Array:Array,rr=Math.PI/180;bn.include({getFov:function(){return this._fov||(this._fov=.6435011087932844),this._fov/rr},setFov:function(t){if(this.isZooming())return this;if(t=Math.max(.01,Math.min(60,t)),this._fov===t)return this;var e=this.getFov();return this._fov=t*rr,this._calcMatrices(),this._renderLayers(),this._fireEvent("fovchange",{from:e,to:this.getFov()}),this},getBearing:function(){return this._angle?-this._angle/rr:0},setBearing:function(t){if(ki.ie9)throw new Error("map can't rotate in IE9.");if(this.isZooming())return this;var e=-M(t,-180,180)*rr;if(this._angle===e)return this;var i=this.getBearing();return this._angle=e,this._calcMatrices(),this._renderLayers(),this._fireEvent("rotate",{from:i,to:e}),this},getPitch:function(){return this._pitch?this._pitch/Math.PI*180:0},setPitch:function(t){if(ki.ie9)throw new Error("map can't tilt in IE9.");if(this.isZooming())return this;var e=P(t,0,60)*rr;if(this._pitch===e)return this;var i=this.getPitch();return this._pitch=e,this._calcMatrices(),this._renderLayers(),this._fireEvent("pitch",{from:i,to:e}),this},isTransforming:function(){return!(!this._pitch&&!this._angle)},_pointToContainerPoint:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t=this._pointToPoint(t,e),this.isTransforming()||i){var n=[t.x,t.y,i,1];return $t(n,n,this.pixelMatrix),new ze(n[0]/n[3],n[1]/n[3])}var r=this._prjToPoint(this._getPrjCenter());return t._sub(r)._add(this.width/2,this.height/2)},_containerPointToPoint:function(t,e){if(this.isTransforming()){var i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];$t(i,i,this.pixelMatrixInverse),$t(n,n,this.pixelMatrixInverse);var r=i[3],o=n[3],s,a,h=i[1]/r,l=n[1]/o,p=i[2]/r,u=n[2]/o,c=p===u?0:(0-p)/(u-p),d=new ze(b(i[0]/r,n[0]/o,c),b(h,l,c));return void 0===e||this.getZoom()===e?d:this._pointToPointAtZoom(d,e)}var f=this._prjToPoint(this._getPrjCenter(),e),g=void 0!==e?this._getResolution()/this._getResolution(e):1,y=g*(t.x-this.width/2),_=g*(t.y-this.height/2);return f._add(y,_)},_calcMatrices:function(){if(this.height&&"undefined"!=typeof Float64Array){this._fov||(this._fov=.6435011087932844),this._pitch||(this._pitch=0),this._angle||(this._angle=0);var t=this._prjToPoint(this._prjCenter),e=t.x,i=t.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var n=this._fov/2,r=Math.PI/2+this._pitch,o=Math.sin(n)*this.cameraToCenterDistance/Math.sin(Math.PI-r-n),s,a=1.01*(Math.cos(Math.PI/2-this._pitch)*o+this.cameraToCenterDistance),h=new Float64Array(16);te(h,this._fov,this.width/this.height,1,a),ie(h,h,[1,-1,1]),ee(h,h,[0,0,-this.cameraToCenterDistance]),ne(h,h,this._pitch),re(h,h,this._angle);var l=oe(new Float64Array(16),h);if(ee(h,h,[-e,-i,0]),this.projMatrix=h,ie(h=se(),h,[this.width/2,-this.height/2,1]),ee(h,h,[1,-1,0]),this.pixelMatrix=ae(new Float64Array(16),h,this.projMatrix),!(h=he(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=h,!this._pitch&&!this._angle)return void this._clearMatrices();ie(h=se(),h,[this.width/2,-this.height/2,1]),this.domCssMatrix=ae(h,h,l)}},_clearMatrices:function(){delete this.domCssMatrix},_renderLayers:function(){this.isInteracting()||this._getLayers().forEach((function(t){if(t){var e=t._getRenderer();e&&e.setToRedraw&&e.setToRedraw()}}))}});var or=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.addTo=function(t){if(!t)return this;this._map=t;var e="_tool"+this.name;return t[e]&&t[e].disable(),this.onAdd&&this.onAdd(),this.enable(),t[e]=this,this._fireEvent("add"),this},e.prototype.getMap=function(){return this._map},e.prototype.enable=function(){return!this._map||this._enabled?this:(this._enabled=!0,this._switchEvents("off"),this._registerEvents(),this.onEnable&&this.onEnable(),this._fireEvent("enable"),this)},e.prototype.disable=function(){return this._enabled&&this._map?(this._enabled=!1,this._switchEvents("off"),this.onDisable&&this.onDisable(),this._fireEvent("disable"),this):this},e.prototype.isEnabled=function(){return!!this._enabled},e.prototype._registerEvents=function(){this._switchEvents("on")},e.prototype._switchEvents=function(t){var e=this.getEvents();e&&this._map[t](e,this)},e.prototype._fireEvent=function(t,e){e||(e={}),this.fire(t,e)},e}(Ei(Ri)),sr={numberOfShellPoints:60},ar=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,null,r));return i&&o.setCoordinates(i),o._radius=n,o}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.coordinates,t.radius,t.options);return n.setProperties(i.properties),n},e.prototype.getRadius=function(){return this._radius},e.prototype.setRadius=function(t){return this._radius=t,this.onShapeChanged(),this},e.prototype.getShell=function(){for(var t=this._getMeasurer(),e=this.getCoordinates(),i=this.options.numberOfShellPoints,n=this.getRadius(),r=[],o=void 0,s=void 0,a=void 0,h=0;h<i;h++){o=360*h/i*Math.PI/180,s=n*Math.cos(o),a=n*Math.sin(o);var l=t.locate(e,s,a);r.push(l)}return r},e.prototype.getHoles=function(){return[]},e.prototype._containsPoint=function(e,i){var n=this.getMap(),o=n.pointToCoordinate(e);if(n.computeLength(this.getCenter(),o)<=this.getRadius())return!0;if(n.getPitch())return t.prototype._containsPoint.call(this,e,i);var s=this._getCenter2DPoint(),a=this.getSize(),h=r(i)?this._hitTestTolerance():i;return s.distanceTo(e)<=a.width/2+h},e.prototype._computeExtent=function(t){if(!t||!this._coordinates||r(this._radius))return null;var e=this._radius,i=t.locate(this._coordinates,e,e),n=t.locate(this._coordinates,-e,-e);return new Ke(i,n)},e.prototype._computeGeodesicLength=function(){return r(this._radius)?0:2*Math.PI*this._radius},e.prototype._computeGeodesicArea=function(){return r(this._radius)?0:Math.PI*Math.pow(this._radius,2)},e.prototype._exportGeoJSONGeometry=function(){return{type:"Polygon",coordinates:Xe.toNumberArrays([this.getShell()])}},e.prototype._toJSON=function(t){var e=this.getCenter(),i=n({},t);i.geometry=!1;var r=this.toGeoJSON(i);return r.geometry={type:"Polygon"},{feature:r,subType:"Circle",coordinates:[e.x,e.y],radius:this.getRadius()}},e}(zn(Yn));ar.mergeOptions(sr),ar.registerJSONType("Circle");var hr={numberOfShellPoints:60},lr=function(t){function e(i,n,r,o){ve(this,e);var s=we(this,t.call(this,null,o));return i&&s.setCoordinates(i),s.width=n,s.height=r,s}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.coordinates,t.width,t.height,t.options);return n.setProperties(i.properties),n},e.prototype.getWidth=function(){return this.width},e.prototype.setWidth=function(t){return this.width=t,this.onShapeChanged(),this},e.prototype.getHeight=function(){return this.height},e.prototype.setHeight=function(t){return this.height=t,this.onShapeChanged(),this},e.prototype.getShell=function(){for(var t=this._getMeasurer(),e=this.getCoordinates(),i=this.options.numberOfShellPoints,n=this.getWidth(),r=this.getHeight(),o=[],s=Math.pow(n/2,2)*Math.pow(r/2,2),a=Math.pow(n/2,2),h=Math.pow(r/2,2),l=void 0,p=void 0,u=void 0,c=void 0,d=0;d<i;d++){p=(l=360*d/i)*Math.PI/180,u=Math.sqrt(s/(a*Math.pow(Math.tan(p),2)+h)),c=Math.sqrt(s/(h*Math.pow(1/Math.tan(p),2)+a)),l>90&&l<270&&(u*=-1),l>180&&l<360&&(c*=-1);var f=t.locate(e,u,c);o.push(f)}return o},e.prototype.getHoles=function(){return[]},e.prototype._containsPoint=function(e,i){var n=this.getMap();if(n.isTransforming())return t.prototype._containsPoint.call(this,e,i);var o=r(i)?this._hitTestTolerance():i,s=n.distanceToPixel(this.width/2,0),a=n.distanceToPixel(0,this.height/2),h=s.width,l=a.height,p=Math.sqrt(Math.abs(h*h-l*l)),u=h>=l,c=this._getCenter2DPoint(),d=void 0,f=void 0,g=void 0;return u?(d=new ze(c.x-p,c.y),f=new ze(c.x+p,c.y),g=2*h):(d=new ze(c.x,c.y-p),f=new ze(c.x,c.y+p),g=2*l),(e=new ze(e.x,e.y)).distanceTo(d)+e.distanceTo(f)<=g+2*o},e.prototype._computeExtent=function(t){if(!t||!this._coordinates||r(this.width)||r(this.height))return null;var e=this.getWidth(),i=this.getHeight(),n=t.locate(this._coordinates,e/2,i/2),o=t.locate(this._coordinates,-e/2,-i/2);return new Ke(n,o)},e.prototype._computeGeodesicLength=function(){if(r(this.width)||r(this.height))return 0;var t=this.width>this.height?this.width:this.height;return 2*Math.PI*t/2-4*Math.abs(this.width-this.height)},e.prototype._computeGeodesicArea=function(){return r(this.width)||r(this.height)?0:Math.PI*this.width*this.height/4},e.prototype._exportGeoJSONGeometry=function(){return{type:"Polygon",coordinates:Xe.toNumberArrays([this.getShell()])}},e.prototype._toJSON=function(t){var e=n({},t),i=this.getCenter();e.geometry=!1;var r=this.toGeoJSON(e);return r.geometry={type:"Polygon"},{feature:r,subType:"Ellipse",coordinates:[i.x,i.y],width:this.getWidth(),height:this.getHeight()}},e}(zn(Yn));lr.mergeOptions(hr),lr.registerJSONType("Ellipse");var pr=function(t){function e(i,n,r,o){ve(this,e);var s=we(this,t.call(this,null,o));return i&&s.setCoordinates(i),s._width=n,s._height=r,s}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.coordinates,t.width,t.height,t.options);return n.setProperties(i.properties),n},e.prototype.getCoordinates=function(){return this._coordinates},e.prototype.setCoordinates=function(t){if(this._coordinates=t instanceof Xe?t:new Xe(t),!this._coordinates||!this.getMap())return this.onPositionChanged(),this;var e=this._getProjection();return this._setPrjCoordinates(e.project(this._coordinates)),this},e.prototype.getWidth=function(){return this._width},e.prototype.setWidth=function(t){return this._width=t,this.onShapeChanged(),this},e.prototype.getHeight=function(){return this._height},e.prototype.setHeight=function(t){return this._height=t,this.onShapeChanged(),this},e.prototype.getShell=function(){var t=this._getMeasurer(),e=this._coordinates,i=this.getMap(),n=-1;if(i){var r=i.getFullExtent();r.bottom>r.top&&(n=1)}var o=[];return o.push(e),o.push(t.locate(e,this._width,0)),o.push(t.locate(e,this._width,n*this._height)),o.push(t.locate(e,0,n*this._height)),o.push(e),o},e.prototype.getHoles=function(){return[]},e.prototype._getPrjCoordinates=function(){var t=this._getProjection();return t?(this._verifyProjection(),this._pnw||this._coordinates&&(this._pnw=t.project(this._coordinates)),this._pnw):null},e.prototype._setPrjCoordinates=function(t){this._pnw=t,this.onPositionChanged()},e.prototype._updateCache=function(){this._clearCache();var t=this._getProjection();this._pnw&&t&&(this._coordinates=t.unproject(this._pnw))},e.prototype._clearProjection=function(){this._pnw=null,t.prototype._clearProjection.call(this)},e.prototype._computeCenter=function(t){return t.locate(this._coordinates,this._width/2,-this._height/2)},e.prototype._containsPoint=function(e,i){var n=this.getMap();if(n.isTransforming())return t.prototype._containsPoint.call(this,e,i);var o=r(i)?this._hitTestTolerance():i,s=n.coordinateToPoint(this._coordinates),a=n.distanceToPixel(this._width,this._height);return new $e(s.x-o,s.y-o,s.x+a.width+o,s.y+a.height+o).contains(e)},e.prototype._computeExtent=function(t){if(!t||!this._coordinates||r(this._width)||r(this._height))return null;var e=this.getWidth(),i=this.getHeight(),n=t.locate(this._coordinates,e,-i);return new Ke(n,this._coordinates)},e.prototype._computeGeodesicLength=function(){return r(this._width)||r(this._height)?0:2*(this._width+this._height)},e.prototype._computeGeodesicArea=function(){return r(this._width)||r(this._height)?0:this._width*this._height},e.prototype._exportGeoJSONGeometry=function(){return{type:"Polygon",coordinates:Xe.toNumberArrays([this.getShell()])}},e.prototype._toJSON=function(t){var e=n({},t),i=this.getCoordinates();e.geometry=!1;var r=this.toGeoJSON(e);return r.geometry={type:"Polygon"},{feature:r,subType:"Rectangle",coordinates:[i.x,i.y],width:this.getWidth(),height:this.getHeight()}},e}(Yn);pr.registerJSONType("Rectangle");var ur=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._arc=function(t,e,i){for(var n=this.options.arcDegree*Math.PI/180,r=1,o=e.length;r<o;r++)Qe._arcBetween(t,e[r-1],e[r],n),Qe._stroke(t,i)},e.prototype._quadraticCurve=function(t,e){e.length<=2?Qe._path(t,e):Qe.quadraticCurve(t,e)},e.prototype._bezierCurve=function(t,e){if(e.length<=3)Qe._path(t,e);else{var i=void 0,n=void 0;for(i=1,n=e.length;i+2<n;i+=3)t.bezierCurveTo(e[i].x,e[i].y,e[i+1].x,e[i+1].y,e[i+2].x,e[i+2].y);if(i<n)for(;i<n;i++)t.lineTo(e[i].x,e[i].y)}},e}(qn),cr={arcDegree:90},dr=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t),subType:"ArcCurve"}},e.prototype._paintOn=function(t,e,i){t.beginPath(),this._arc(t,e,i),Qe._stroke(t,i),this._paintArrow(t,e,i)},e.fromJSON=function(t){var i=t.feature,n=new e(i.geometry.coordinates,t.options);return n.setProperties(i.properties),n},e}(ur);dr.registerJSONType("ArcCurve"),dr.mergeOptions(cr);var fr=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(i.geometry.coordinates,t.options);return n.setProperties(i.properties),n},e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t),subType:"CubicBezierCurve"}},e.prototype._paintOn=function(t,e,i){t.beginPath(),t.moveTo(e[0].x,e[0].y),this._bezierCurve(t,e,i),Qe._stroke(t,i),this._paintArrow(t,e,i)},e}(ur);fr.registerJSONType("CubicBezierCurve");var gr=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(i.geometry.coordinates,t.options);return n.setProperties(i.properties),n},e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t),subType:"QuadBezierCurve"}},e.prototype._paintOn=function(t,e,i){t.beginPath(),t.moveTo(e[0].x,e[0].y),this._quadraticCurve(t,e,i),Qe._stroke(t,i),this._paintArrow(t,e,i)},e.prototype._getArrowPlacement=function(){var t=this.options.arrowPlacement;return"point"===t&&(t="vertex-last"),t},e}(ur);gr.registerJSONType("QuadBezierCurve");var yr={numberOfShellPoints:60},_r=function(t){function e(i,n,r,o,s){ve(this,e);var a=we(this,t.call(this,null,s));return i&&a.setCoordinates(i),a._radius=n,a.startAngle=r,a.endAngle=o,a}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.coordinates,t.radius,t.startAngle,t.endAngle,t.options);return n.setProperties(i.properties),n},e.prototype.getRadius=function(){return this._radius},e.prototype.setRadius=function(t){return this._radius=t,this.onShapeChanged(),this},e.prototype.getStartAngle=function(){return this.startAngle},e.prototype.setStartAngle=function(t){return this.startAngle=t,this.onShapeChanged(),this},e.prototype.getEndAngle=function(){return this.endAngle},e.prototype.setEndAngle=function(t){return this.endAngle=t,this.onShapeChanged(),this},e.prototype.getShell=function(){for(var t=this._getMeasurer(),e=this.getCoordinates(),i=this.options.numberOfShellPoints-2,n=this.getRadius(),r=[e.copy()],o=this.getStartAngle(),s=this.getEndAngle()-o,a=void 0,h=void 0,l=void 0,p=0;p<i;p++){a=(s*p/(i-1)+o)*Math.PI/180,h=n*Math.cos(a),l=n*Math.sin(a);var u=t.locate(e,h,l);r.push(u)}return r.push(e.copy()),r},e.prototype.getHoles=function(){return[]},e.prototype._containsPoint=function(e,i){if(this.getMap().isTransforming())return t.prototype._containsPoint.call(this,e,i);var n=this._getCenter2DPoint(),o=r(i)?this._hitTestTolerance():i,s=this.getSize(),a=n,h=e,l=h.x-a.x,p=a.y-h.y,u=Math.atan2(p,l),c=u<0?360*(u+2*Math.PI)/(2*Math.PI):360*u/(2*Math.PI),d=this.startAngle%360,f=this.endAngle%360,g=!1;return g=d>f?!(c>f&&c<d):c>=d&&c<=f,h.distanceTo(a)<=s.width/2+o&&g},e.prototype._computeExtent=function(t){if(!t||!this._coordinates||r(this._radius))return null;var e=this._radius,i=t.locate(this._coordinates,e,e),n=t.locate(this._coordinates,-e,-e);return new Ke(i,n)},e.prototype._computeGeodesicLength=function(){return r(this._radius)?0:2*Math.PI*this._radius*Math.abs(this.startAngle-this.endAngle)/360+2*this._radius},e.prototype._computeGeodesicArea=function(){return r(this._radius)?0:Math.PI*Math.pow(this._radius,2)*Math.abs(this.startAngle-this.endAngle)/360},e.prototype._exportGeoJSONGeometry=function(){return{type:"Polygon",coordinates:Xe.toNumberArrays([this.getShell()])}},e.prototype._toJSON=function(t){var e=n({},t),i=this.getCenter();e.geometry=!1;var r=this.toGeoJSON(e);return r.geometry={type:"Polygon"},{feature:r,subType:"Sector",coordinates:[i.x,i.y],radius:this.getRadius(),startAngle:this.getStartAngle(),endAngle:this.getEndAngle()}},e}(zn(Yn));_r.mergeOptions(yr),_r.registerJSONType("Sector");var mr={textFaceName:"monospace",textSize:12,textLineSpacing:8,textHorizontalAlignment:"middle",textVerticalAlignment:"middle"},vr={markerType:"square",markerLineColor:"#000",markerLineWidth:2,markerLineOpacity:1,markerFill:"#fff",markerOpacity:1},xr={box:!0},wr=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,n,r));return o._content=ht(i),o._refresh(),o}return xe(e,t),e.prototype.getContent=function(){return this._content},e.prototype.setContent=function(t){var e=this._content;return this._content=ht(t),this._refresh(),this._fireEvent("contentchange",{old:e,new:t}),this},e.prototype.getSymbol=function(){return this._textSymbolChanged?En.prototype.getSymbol.call(this):null},e.prototype.setSymbol=function(t){t&&t!==this.options.symbol?this._textSymbolChanged=!0:(this._textSymbolChanged=!1,t={});var e=this._prepareSymbol(t),i=this._getDefaultTextSymbol();return n(i,e),this._symbol=i,this._refresh(),this},e.prototype.onConfig=function(e){var i=!1;for(var n in e)if(e.hasOwnProperty(n)&&"box"===n.slice(0,3)){i=!0;break}return i&&this._refresh(),t.prototype.onConfig.call(this,e)},e.prototype._getBoxSize=function(t){t.markerType||(t.markerType="square");var e=gt(this._content,t).size,i=void 0,n=void 0;if(this.options.boxAutoSize){var r=this.options.boxPadding;i=e.width+2*r.width,n=e.height+2*r.height}return this.options.boxMinWidth&&(!i||i<this.options.boxMinWidth)&&(i=this.options.boxMinWidth),this.options.boxMinHeight&&(!n||n<this.options.boxMinHeight)&&(n=this.options.boxMinHeight),[i&&n?new je(i,n):null,e]},e.prototype._getInternalSymbol=function(){return this._symbol},e.prototype._getDefaultTextSymbol=function(){var t={};return n(t,mr),this.options.box&&n(t,vr),t},e.prototype.onShapeChanged=function(){this._refresh(),t.prototype.onShapeChanged.call(this)},e}(Zn);wr.mergeOptions(xr);var Cr={boxAutoSize:!1,boxMinWidth:0,boxMinHeight:0,boxPadding:{width:12,height:8}},br=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.content,i.geometry.coordinates,t.options);return n.setProperties(i.properties),n.setId(i.id),n},e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t),subType:"TextBox",content:this._content}},e.prototype._refresh=function(){var t=this.getSymbol()||this._getDefaultTextSymbol();t.textName=this._content;var e=this._getBoxSize(t),i=e[1],n=e[0];if(n||t.markerWidth||t.markerHeight)n&&(t.markerWidth=n.width,t.markerHeight=n.height);else{var r=this.options.boxPadding,o=i.width+2*r.width,s=i.height+2*r.height;n=new je(o,s),t.markerWidth=n.width,t.markerHeight=n.height}var a=t.textHorizontalAlignment;a&&(t.textDx=t.markerDx||0,"left"===a?t.textDx-=t.markerWidth/2:"right"===a&&(t.textDx+=t.markerWidth/2));var h=t.textVerticalAlignment;h&&(t.textDy=t.markerDy||0,"top"===h?t.textDy-=t.markerHeight/2:"bottom"===h&&(t.textDy+=t.markerHeight/2)),this._symbol=t,this.onSymbolChanged()},e.prototype._getInternalSymbol=function(){var t=n({},this._symbol);return"left"===t.textHorizontalAlignment?t.textHorizontalAlignment="right":"right"===t.textHorizontalAlignment&&(t.textHorizontalAlignment="left"),"top"===t.textVerticalAlignment?t.textVerticalAlignment="bottom":"bottom"===t.textVerticalAlignment&&(t.textVerticalAlignment="top"),t},e}(wr);br.mergeOptions(Cr),br.registerJSONType("TextBox");var Mr={boxAutoSize:!0,boxMinWidth:0,boxMinHeight:0,boxPadding:{width:12,height:8},boxTextAlign:"middle"},Pr=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.fromJSON=function(t){var i=t.feature,n=new e(t.content,i.geometry.coordinates,t.options);return n.setProperties(i.properties),n.setId(i.id),n},e.prototype._toJSON=function(t){return{feature:this.toGeoJSON(t),subType:"Label",content:this._content}},e.prototype._refresh=function(){var t=this.getSymbol()||this._getDefaultTextSymbol();if(t.textName=this._content,this.options.box){var e=this._getBoxSize(t),i=e[1],n=this.options.boxPadding,r=e[0];if(r||t.markerWidth||t.markerHeight)r&&(t.markerWidth=r.width,t.markerHeight=r.height);else{var o=i.width+2*n.width,s=i.height+2*n.height;r=new je(o,s),t.markerWidth=r.width,t.markerHeight=r.height}var a=this.options.boxTextAlign;if(a){var h=t.textDx||0,l=t.textDy||0,p=dt(i,t.textHorizontalAlignment,t.textVerticalAlignment)._add(h,l);t.markerDx=p.x,t.markerDy=p.y+i.height/2,"left"===a?t.markerDx+=t.markerWidth/2-n.width:"right"===a?t.markerDx-=t.markerWidth/2-i.width-n.width:t.markerDx+=i.width/2}}this._symbol=t,this.onSymbolChanged()},e}(wr);Pr.mergeOptions(Mr),Pr.registerJSONType("Label");var Sr=function(t){return function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e._hasConnectors=function(t){return!r(t.__connectors)&&t.__connectors.length>0},e._getConnectors=function(t){return t.__connectors},e.prototype.getConnectSource=function(){return this._connSource},e.prototype.setConnectSource=function(t){var e=this._connTarget;return this.onRemove(),this._connSource=t,this._connTarget=e,this._updateCoordinates(),this._registEvents(),this},e.prototype.getConnectTarget=function(){return this._connTarget},e.prototype.setConnectTarget=function(t){var e=this._connSource;return this.onRemove(),this._connSource=e,this._connTarget=t,this._updateCoordinates(),this._registEvents(),this},e.prototype._updateCoordinates=function(){var t=this.getMap();if(!t&&this._connSource&&(t=this._connSource.getMap()),!t&&this._connTarget&&(t=this._connTarget.getMap()),t&&this._connSource&&this._connTarget){for(var e=this._connSource._getConnectPoints(),i=this._connTarget._getConnectPoints(),n=0,r=this.getCoordinates(),o=void 0,s=void 0,a=0,h=e.length;a<h;a++)for(var l=e[a],p=0,u=i.length;p<u;p++){var c=i[p],d=t.computeLength(l,c);0===a&&0===p?(o=l,s=c,n=d):d<n&&(o=l,s=c)}S(r)&&r[0].equals(o)&&r[1].equals(s)||this.setCoordinates([o,s])}},e.prototype.onAdd=function(){this._updateCoordinates()},e.prototype.onRemove=function(){this._connSource&&(this._connSource.__connectors&&m(this,this._connSource.__connectors),this._connSource.off("dragging positionchange",this._updateCoordinates,this).off("remove",this.onRemove,this),this._connSource.off("dragstart mousedown mouseover",this._showConnect,this),this._connSource.off("dragend mouseup mouseout",this.hide,this),this._connSource.off("show",this._showConnect,this).off("hide",this.hide,this),delete this._connSource),this._connTarget&&(m(this,this._connTarget.__connectors),this._connTarget.off("dragging positionchange",this._updateCoordinates,this).off("remove",this.onRemove,this),this._connTarget.off("show",this._showConnect,this).off("hide",this.hide,this),delete this._connTarget)},e.prototype._showConnect=function(){this._connSource&&this._connTarget&&this._connSource.isVisible()&&this._connTarget.isVisible()&&(this._updateCoordinates(),this.show())},e.prototype._registEvents=function(){if(this._connSource&&this._connTarget){this._connSource.__connectors||(this._connSource.__connectors=[]),this._connTarget.__connectors||(this._connTarget.__connectors=[]),this._connSource.__connectors.push(this),this._connTarget.__connectors.push(this),this._connSource.on("dragging positionchange",this._updateCoordinates,this).on("remove",this.remove,this),this._connTarget.on("dragging positionchange",this._updateCoordinates,this).on("remove",this.remove,this),this._connSource.on("show",this._showConnect,this).on("hide",this.hide,this),this._connTarget.on("show",this._showConnect,this).on("hide",this.hide,this);var t=this.options.showOn;this.hide(),"moving"===t?(this._connSource.on("dragstart",this._showConnect,this).on("dragend",this.hide,this),this._connTarget.on("dragstart",this._showConnect,this).on("dragend",this.hide,this)):"click"===t?(this._connSource.on("mousedown",this._showConnect,this).on("mouseup",this.hide,this),this._connTarget.on("mousedown",this._showConnect,this).on("mouseup",this.hide,this)):"mouseover"===t?(this._connSource.on("mouseover",this._showConnect,this).on("mouseout",this.hide,this),this._connTarget.on("mouseover",this._showConnect,this).on("mouseout",this.hide,this)):this._showConnect()}},e}(t)},Tr={showOn:"always"},kr=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,null,r));return 1===arguments.length&&(r=i,i=null,n=null),o._connSource=i,o._connTarget=n,o._registEvents(),o}return xe(e,t),e}(Sr(qn));kr.mergeOptions(Tr),kr.registerJSONType("ConnectorLine");var Or=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,null,r));return 1===arguments.length&&(r=i,i=null,n=null),o._connSource=i,o._connTarget=n,o._registEvents(),o}return xe(e,t),e}(Sr(dr));Or.mergeOptions(Tr),Or.registerJSONType("ArcConnectorLine");var Er=function(t){function e(i,n,r){ve(this,e),n&&!(n instanceof En)&&!Array.isArray(n)&&_e.indexOf(n.type)<0&&(r=n,n=null);var o=we(this,t.call(this,i,r));return o._initCache(),n&&o.addGeometry(n),o}return xe(e,t),e.prototype.getGeometryById=function(t){return r(t)||""===t?null:this._geoMap[t]?this._geoMap[t]:null},e.prototype.getGeometries=function(t,e){if(!t)return this._geoList.slice(0);for(var i=[],n=void 0,r=0,o=this._geoList.length;r<o;r++)n=this._geoList[r],(e?t.call(e,n):t(n))&&i.push(n);return i},e.prototype.getFirstGeometry=function(){return this._geoList.length?this._geoList[0]:null},e.prototype.getLastGeometry=function(){var t=this._geoList.length;return 0===t?null:this._geoList[t-1]},e.prototype.getCount=function(){return this._geoList.length},e.prototype.getExtent=function(){if(0===this.getCount())return null;var t=new Ke;return this.forEach((function(e){t._combine(e.getExtent())})),t},e.prototype.forEach=function(t,e){for(var i=this._geoList.slice(0),n=0,r=i.length;n<r;n++)e?t.call(e,i[n],n):t(i[n],n);return this},e.prototype.filter=function(){return Qn.prototype.filter.apply(this,arguments)},e.prototype.isEmpty=function(){return!this._geoList.length},e.prototype.addGeometry=function(t,e){var i=this;if(!t)return this;if("FeatureCollection"===t.type)return this.addGeometry(ir.toGeometry(t),e);if(!Array.isArray(t)){var n=arguments.length,o=arguments[n-1];return t=Array.prototype.slice.call(arguments,0,n-1),e=o,a(o)&&(t.push(o),e=!1),this.addGeometry(t,e)}if(0===t.length)return this;this._initCache();var s=void 0;!0===e&&(s=new Ke);for(var h=0,l=t.length;h<l;h++)!function(e,n){var r=t[e];if(!r)throw new Error("Invalid geometry to add to layer("+i.getId()+") at index:"+e);r instanceof En||(r=En.fromJSON(r),Array.isArray(r)&&r.forEach((function(t){return i._add(t,s,e)}))),Array.isArray(r)||i._add(r,s,e)}(h);this._sortGeometries();var p=this.getMap();if(p&&(this._getRenderer().onGeometryAdd(t),!0===e&&!r(s.xmin))){var u=p.getFitZoom(s);p.setCenterAndZoom(s.getCenter(),u)}return this.fire("addgeo",{geometries:t}),this},e.prototype._add=function(t,e,i){var n=t.getId();if(!r(n)){if(!r(this._geoMap[n]))throw new Error("Duplicate geometry id in layer("+this.getId()+"):"+n+", at index:"+i);this._geoMap[n]=t}var o=f();t._setInternalId(o),this._geoList.push(t),this.onAddGeometry&&this.onAddGeometry(t),t._bindLayer(this),t.onAdd&&t.onAdd(),e&&e._combine(t.getExtent()),t._fireEvent("add",{layer:this})},e.prototype.removeGeometry=function(t){if(!Array.isArray(t))return this.removeGeometry([t]);for(var e=t.length-1;e>=0;e--)t[e]instanceof En||(t[e]=this.getGeometryById(t[e])),t[e]&&this===t[e].getLayer()&&t[e].remove();return this.fire("removegeo",{geometries:t}),this},e.prototype.clear=function(){this._clearing=!0,this.forEach((function(t){t.remove()})),this._geoMap={};var t=this._geoList;return this._geoList=[],this._getRenderer()&&this._getRenderer().onGeometryRemove(t),this._clearing=!1,this.fire("clear"),this},e.prototype.onRemoveGeometry=function(t){if(t&&!this._clearing&&this===t.getLayer()&&!r(t._getInternalId())){var e=t.getId();r(e)||delete this._geoMap[e];var i=this._findInList(t);i>=0&&this._geoList.splice(i,1),this._getRenderer()&&this._getRenderer().onGeometryRemove([t])}},e.prototype.hide=function(){for(var t=0,e=this._geoList.length;t<e;t++)this._geoList[t].onHide();return fn.prototype.hide.call(this)},e.prototype.identify=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._hitGeos(this._geoList,t,e)},e.prototype._hitGeos=function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.filter,r=[],o=this.getMap(),s=o.coordinateToPoint(e),a=o._pointToContainerPoint(s),h=t.length-1;h>=0;h--){var l=t[h];if(l&&l.isVisible()&&l._getPainter()){if(!(l instanceof qn&&l._getArrowStyle())){var p=l._getPainter().getContainerExtent();if(!p||!p.contains(a))continue}if(l._containsPoint(s)&&(!n||n(l))&&(r.push(l),i.count&&r.length>=i.count))break}}return r},e.prototype._initCache=function(){this._geoList||(this._geoList=[],this._geoMap={})},e.prototype._sortGeometries=function(){var t=this;this._geoList.sort((function(e,i){return t._compare(e,i)}))},e.prototype._compare=function(t,e){return t.getZIndex()===e.getZIndex()?t._getInternalId()-e._getInternalId():t.getZIndex()-e.getZIndex()},e.prototype._findInList=function(t){var e=this._geoList.length;if(0===e)return-1;for(var i=0,n=e-1,r=void 0;i<=n;){if(r=Math.floor((i+n)/2),this._geoList[r]===t)return r;this._compare(this._geoList[r],t)>0?n=r-1:i=r+1}return-1},e.prototype._onGeometryEvent=function(t){if(t&&t.target){var e=t.type;"idchange"===e?this._onGeometryIdChange(t):"zindexchange"===e?this._onGeometryZIndexChange(t):"positionchange"===e?this._onGeometryPositionChange(t):"shapechange"===e?this._onGeometryShapeChange(t):"symbolchange"===e?this._onGeometrySymbolChange(t):"show"===e?this._onGeometryShow(t):"hide"===e?this._onGeometryHide(t):"propertieschange"===e&&this._onGeometryPropertiesChange(t)}},e.prototype._onGeometryIdChange=function(t){if(t.new!==t.old||!this._geoMap[t.old]||this._geoMap[t.old]!==t.target){if(!r(t.new)){if(this._geoMap[t.new])throw new Error("Duplicate geometry id in layer("+this.getId()+"):"+t.new);this._geoMap[t.new]=t.target}r(t.old)||t.new===t.old||delete this._geoMap[t.old]}},e.prototype._onGeometryZIndexChange=function(t){t.old!==t.new&&(this._sortGeometries(),this._getRenderer()&&this._getRenderer().onGeometryZIndexChange(t))},e.prototype._onGeometryPositionChange=function(t){this._getRenderer()&&this._getRenderer().onGeometryPositionChange(t)},e.prototype._onGeometryShapeChange=function(t){this._getRenderer()&&this._getRenderer().onGeometryShapeChange(t)},e.prototype._onGeometrySymbolChange=function(t){this._getRenderer()&&this._getRenderer().onGeometrySymbolChange(t)},e.prototype._onGeometryShow=function(t){this._getRenderer()&&this._getRenderer().onGeometryShow(t)},e.prototype._onGeometryHide=function(t){this._getRenderer()&&this._getRenderer().onGeometryHide(t)},e.prototype._onGeometryPropertiesChange=function(t){this._getRenderer()&&this._getRenderer().onGeometryPropertiesChange(t)},e}(fn),Lr={debug:!1,enableSimplify:!0,geometryEvents:!0,defaultIconSize:[20,20],cacheVectorOnCanvas:!0,cacheSvgOnCanvas:!1,enableHeight:!1,heightProperty:"height"},Dr=function(t){function e(i,n,r){ve(this,e);var o=we(this,t.call(this,i,n,r)),s=o.options.style;return delete o.options.style,s&&o.setStyle(s),o}return xe(e,t),e.prototype.getStyle=function(){return this._style?this._style:null},e.prototype.setStyle=function(t){return this._style=t,this._cookedStyles=N(t),this.forEach((function(t){this._styleGeometry(t)}),this),this.fire("setstyle",{style:t}),this},e.prototype.removeStyle=function(){return this._style?(delete this._style,delete this._cookedStyles,this.forEach((function(t){t._setExternSymbol(null)}),this),this.fire("removestyle"),this):this},e.prototype.onAddGeometry=function(t){this.getStyle()&&this._styleGeometry(t)},e.prototype._styleGeometry=function(t){if(!this._cookedStyles)return!1;for(var e=G(t),i=0,n=this._cookedStyles.length;i<n;i++)if(!0===this._cookedStyles[i].filter(e))return t._setExternSymbol(this._cookedStyles[i].symbol),!0;return!1},e.prototype.identify=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this._getRenderer();return i.onlyVisible&&n?n.identify(e,i):t.prototype.identify.call(this,e,i)},e.prototype.toJSON=function(t){t||(t={});var e={type:this.getJSONType(),id:this.getId(),options:this.config()};if((r(t.style)||t.style)&&this.getStyle()&&(e.style=this.getStyle()),r(t.geometries)||t.geometries){var i=void 0;t.clipExtent&&(i=new Ke(t.clipExtent));for(var o=[],s=this.getGeometries(),a=void 0,h=void 0,l=0,p=s.length;l<p;l++)!(a=s[l].getExtent())||i&&!i.intersects(a)||((h=s[l].toJSON(t.geometries)).symbol&&this.getStyle()&&(h.symbol=s[l]._symbolBeforeStyle?n({},s[l]._symbolBeforeStyle):null),o.push(h));e.geometries=o}return e},e.fromJSON=function(t){if(!t||"VectorLayer"!==t.type)return null;for(var i=new e(t.id,t.options),n=t.geometries,r=[],o=0;o<n.length;o++){var s=En.fromJSON(n[o]);s&&r.push(s)}return i.addGeometry(r),t.style&&i.setStyle(t.style),i},e}(Er);Dr.mergeOptions(Lr),Dr.registerJSONType("VectorLayer");var Rr={symbol:{lineColor:"#000",lineWidth:2,lineOpacity:1,polygonFill:"#fff",polygonOpacity:.3},doubleClickZoom:!1,mode:null,once:!1},Ar={},Ir=function(t){function e(i){ve(this,e);var n=we(this,t.call(this,i));return n._checkMode(),n}return xe(e,t),e.registerMode=function(t,e){Ar[t.toLowerCase()]=e},e.getRegisterMode=function(t){return Ar[t.toLowerCase()]},e.prototype.getMode=function(){return this.options.mode?this.options.mode.toLowerCase():null},e.prototype.setMode=function(t){return this._geometry&&(this._geometry.remove(),delete this._geometry),this._clearStage(),this._switchEvents("off"),this.options.mode=t,this._checkMode(),this.isEnabled()&&this._switchEvents("on"),this},e.prototype.getSymbol=function(){var t=this.options.symbol;return st(t||this.options.symbol)},e.prototype.setSymbol=function(t){return t?(this.options.symbol=t,this._geometry&&this._geometry.setSymbol(t),this):this},e.prototype.onAdd=function(){this._checkMode()},e.prototype.onEnable=function(){var t=this.getMap();return this._mapDoubleClickZoom=t.options.doubleClickZoom,t.config({doubleClickZoom:this.options.doubleClickZoom}),"drag"===this._getRegisterMode().action&&(this._mapDraggable=t.options.draggable,t.config({draggable:!1})),this._drawToolLayer=this._getDrawLayer(),this._clearStage(),this._loadResources(),this},e.prototype._checkMode=function(){this._getRegisterMode()},e.prototype.onDisable=function(){var t=this.getMap();return t.config({doubleClickZoom:this._mapDoubleClickZoom}),r(this._mapDraggable)||t.config("draggable",this._mapDraggable),delete this._mapDraggable,delete this._mapDoubleClickZoom,this._endDraw(),t.removeLayer(this._getDrawLayer()),this},e.prototype._loadResources=function(){var t,e=Vt(this.getSymbol());e.length>0&&this._drawToolLayer._getRenderer().loadResources(e)},e.prototype._getProjection=function(){return this._map.getProjection()},e.prototype._getRegisterMode=function(){var t=this.getMode(),i=e.getRegisterMode(t);if(!i)throw new Error(t+" is not a valid mode of DrawTool.");return i},e.prototype.getEvents=function(){var t=this._getRegisterMode().action;return"clickDblclick"===t?{click:this._clickForPath,mousemove:this._mousemoveForPath,dblclick:this._dblclickForPath}:"click"===t?{click:this._clickForPoint}:"drag"===t?{mousedown:this._mousedownToDraw}:null},e.prototype._addGeometryToStage=function(t){this._getDrawLayer().addGeometry(t)},e.prototype._clickForPoint=function(t){var e=this._getRegisterMode();this._geometry=e.create(t.coordinate),this.options.symbol&&this.options.hasOwnProperty("symbol")&&this._geometry.setSymbol(this.options.symbol),this._endDraw()},e.prototype._clickForPath=function(t){var e=this._getRegisterMode(),i=t.coordinate,n=this.getSymbol();this._geometry?(this._clickCoords.push(i),e.update(this._clickCoords,this._geometry),this._fireEvent("drawvertex",t)):(this._clickCoords=[i],this._geometry=e.create(this._clickCoords),n&&this._geometry.setSymbol(n),this._addGeometryToStage(this._geometry),this._fireEvent("drawstart",t))},e.prototype._mousemoveForPath=function(t){var e=this.getMap();if(this._geometry&&e&&!e.isInteracting()){var i=this._getMouseContainerPoint(t);if(this._isValidContainerPoint(i)){var n=t.coordinate,r=this._getRegisterMode(),o=this._clickCoords;o&&o.length>0&&n.equals(o[o.length-1])||(r.update(o.concat([n]),this._geometry),this._fireEvent("mousemove",t))}}},e.prototype._dblclickForPath=function(t){if(this._geometry){var e=this._getMouseContainerPoint(t);if(this._isValidContainerPoint(e)){var i=this._getRegisterMode(),n=t.coordinate,r=this._clickCoords;if(r.push(n),!(r.length<2)){for(var o=[],s=1,a=r.length;s<a;s++)r[s].x===r[s-1].x&&r[s].y===r[s-1].y&&o.push(s);for(var h=o.length-1;h>=0;h--)r.splice(o[h],1);r.length<2||this._geometry&&this._geometry instanceof Yn&&r.length<3||(i.update(r,this._geometry),this._endDraw(t))}}}},e.prototype._mousedownToDraw=function(t){function e(t){var e=r.getSymbol(),i=r._geometry;i?n.update(t,i):((i=n.create(t)).setSymbol(e),r._addGeometryToStage(i),r._geometry=i)}function i(i){if(!this._geometry)return!1;var n=this._getMouseContainerPoint(i);return!!this._isValidContainerPoint(n)&&(e(i.coordinate),this._fireEvent("mousemove",t),!1)}var n=this._getRegisterMode(),r=this,o=this._getMouseContainerPoint(t);if(!this._isValidContainerPoint(o))return!1;var s=t.coordinate,a=function n(r){if(!this._geometry)return!1;var o=this._getMouseContainerPoint(r);return this._isValidContainerPoint(o)&&e(r.coordinate),this._map.off("mousemove",i,this),this._map.off("mouseup",n,this),this._endDraw(t),!1};return this._fireEvent("drawstart",t),e(s),this._map.on("mousemove",i,this),this._map.on("mouseup",a,this),!1},e.prototype._endDraw=function(t){if(this._geometry&&!this._ending){this._ending=!0;var e=this._geometry;this._clearStage(),t||(t={}),this._geometry=e,this._fireEvent("drawend",t),delete this._geometry,this.options.once&&this.disable(),delete this._ending}},e.prototype._clearStage=function(){this._getDrawLayer().clear(),delete this._geometry,delete this._clickCoords},e.prototype._getMouseContainerPoint=function(t){return"drag"===this._getRegisterMode().action&&bt(t.domEvent),t.containerPoint},e.prototype._isValidContainerPoint=function(t){var e=this._map.getSize(),i=e.width,n=e.height;return!(t.x<0||t.y<0||t.x>i||t.y>n)},e.prototype._getDrawLayer=function(){var t="_maptalks__internal_layer_drawtool",e=this._map.getLayer(t);return e||(e=new Dr(t,{enableSimplify:!1}),this._map.addLayer(e)),e},e.prototype._fireEvent=function(t,e){e||(e={}),this._geometry&&(e.geometry=this._getRegisterMode().generate(this._geometry).copy()),or.prototype._fireEvent.call(this,t,e)},e}(or);Ir.mergeOptions(Rr),Ir.registerMode("circle",{action:"drag",create:function(t){return new ar(t,0)},update:function(t,e){var i=e.getMap(),n=e.getCenter(),r=i.computeLength(n,t);e.setRadius(r)},generate:function(t){return t}}),Ir.registerMode("ellipse",{action:"drag",create:function(t){return new lr(t,0,0)},update:function(t,e){var i=e.getMap(),n=e.getCenter(),r=i.computeLength(n,new Xe({x:t.x,y:n.y})),o=i.computeLength(n,new Xe({x:n.x,y:t.y}));e.setWidth(2*r),e.setHeight(2*o)},generate:function(t){return t}}),Ir.registerMode("rectangle",{action:"drag",create:function(t){var e=new pr(t,0,0);return e._firstClick=t,e},update:function(t,e){var i=e._firstClick,n=e.getMap(),r=n.computeLength(i,new Xe(t.x,i.y)),o=n.computeLength(i,new Xe(i.x,t.y)),s=n.coordinateToContainerPoint(i),a=n.coordinateToContainerPoint(t),h=Math.min(s.x,a.x),l=Math.min(s.y,a.y);e.setCoordinates(n.containerPointToCoordinate(new ze(h,l))),e.setWidth(r),e.setHeight(o)},generate:function(t){return t}}),Ir.registerMode("point",{action:"click",create:function(t){return new Zn(t)},generate:function(t){return t}}),Ir.registerMode("polygon",{action:"clickDblclick",create:function(t){return new qn(t)},update:function(t,e){var i=e.getSymbol();if(e.setCoordinates(t),t.length>=3){var n=e.getLayer();if(n){var r=n.getGeometryById("polygon");if(!r){if(r=new Yn([t],{id:"polygon"}),i){var o=st(i,{lineOpacity:0});r.setSymbol(o)}r.addTo(n)}r.setCoordinates(t)}}},generate:function(t){return new Yn(t.getCoordinates(),{symbol:t.getSymbol()})}}),Ir.registerMode("linestring",{action:"clickDblclick",create:function(t){return new qn(t)},update:function(t,e){e.setCoordinates(t)},generate:function(t){return t}}),Ir.registerMode("arccurve",{action:"clickDblclick",create:function(t){return new dr(t)},update:function(t,e){e.setCoordinates(t)},generate:function(t){return t}}),Ir.registerMode("quadbeziercurve",{action:"clickDblclick",create:function(t){return new gr(t)},update:function(t,e){e.setCoordinates(t)},generate:function(t){return t}}),Ir.registerMode("cubicbeziercurve",{action:"clickDblclick",create:function(t){return new fr(t)},update:function(t,e){e.setCoordinates(t)},generate:function(t){return t}});var zr={mode:"LineString",language:"zh-CN",metric:!0,imperial:!1,symbol:{lineColor:"#000",lineWidth:3,lineOpacity:1},vertexSymbol:{markerType:"ellipse",markerFill:"#fff",markerLineColor:"#000",markerLineWidth:3,markerWidth:11,markerHeight:11},labelOptions:{symbol:{textWrapCharacter:"\n",textFaceName:"monospace",textLineSpacing:1,textHorizontalAlignment:"right",markerLineColor:"#b4b3b3",textDx:15},boxPadding:{width:6,height:4}},clearButtonSymbol:[{markerType:"square",markerFill:"#fff",markerLineColor:"#b4b3b3",markerLineWidth:2,markerWidth:15,markerHeight:15,markerDx:20},{markerType:"x",markerWidth:10,markerHeight:10,markerDx:20}]},jr=function(t){function e(i){ve(this,e);var n=we(this,t.call(this,i));return n.on("enable",n._afterEnable,n).on("disable",n._afterDisable,n),n._measureLayers=[],n}return xe(e,t),e.prototype.clear=function(){if(S(this._measureLayers))for(var t=0;t<this._measureLayers.length;t++)this._measureLayers[t].remove();return delete this._lastMeasure,delete this._lastVertex,this._measureLayers=[],this},e.prototype.getMeasureLayers=function(){return this._measureLayers},e.prototype.getLastMeasure=function(){return this._lastMeasure?this._lastMeasure:0},e.prototype._measure=function(t){var e=this.getMap(),i=void 0;t instanceof En?i=e.computeGeometryLength(t):Array.isArray(t)&&(i=e.getProjection().measureLength(t)),this._lastMeasure=i;var n=void 0;n="zh-CN"===this.options.language?[" 米"," 公里"," 英尺"," 英里"]:[" m"," km"," feet"," mile"];var r="";return this.options.metric&&(r+=i<1e3?i.toFixed(0)+n[0]:(i/1e3).toFixed(2)+n[1]),this.options.imperial&&(i*=3.2808399,r.length>0&&(r+="\n"),r+=i<5280?i.toFixed(0)+n[2]:(i/5280).toFixed(2)+n[3]),r},e.prototype._registerMeasureEvents=function(){this.on("drawstart",this._msOnDrawStart,this).on("drawvertex",this._msOnDrawVertex,this).on("mousemove",this._msOnMouseMove,this).on("drawend",this._msOnDrawEnd,this)},e.prototype._afterEnable=function(){this._registerMeasureEvents()},e.prototype._afterDisable=function(){this.off("drawstart",this._msOnDrawStart,this).off("drawvertex",this._msOnDrawVertex,this).off("mousemove",this._msOnMouseMove,this).off("drawend",this._msOnDrawEnd,this)},e.prototype._msOnDrawStart=function(t){var e=this.getMap(),i=f(),n="distancetool_"+i,r="distancetool_markers_"+i;e.getLayer(n)?(this._measureLineLayer=e.getLayer(n),this._measureMarkerLayer=e.getLayer(r)):(this._measureLineLayer=new Dr(n,{drawImmediate:!0}).addTo(e),this._measureMarkerLayer=new Dr(r,{drawImmediate:!0}).addTo(e)),this._measureLayers.push(this._measureLineLayer),this._measureLayers.push(this._measureMarkerLayer),new Zn(t.coordinate,{symbol:this.options.vertexSymbol}).addTo(this._measureMarkerLayer);var o="zh-CN"===this.options.language?"起点":"start",s=new Pr(o,t.coordinate,this.options.labelOptions);this._measureMarkerLayer.addGeometry(s)},e.prototype._msOnMouseMove=function(t){var e=this._measure(this._msGetCoordsToMeasure(t));if(!this._tailMarker){var i=st(this.options.vertexSymbol);i.markerWidth/=2,i.markerHeight/=2,this._tailMarker=new Zn(t.coordinate,{symbol:i}).addTo(this._measureMarkerLayer),this._tailLabel=new Pr(e,t.coordinate,this.options.labelOptions).addTo(this._measureMarkerLayer)}this._tailMarker.setCoordinates(t.coordinate),this._tailLabel.setContent(e),this._tailLabel.setCoordinates(t.coordinate)},e.prototype._msGetCoordsToMeasure=function(t){return t.geometry.getCoordinates().concat([t.coordinate])},e.prototype._msOnDrawVertex=function(t){var e=t.geometry;new Zn(t.coordinate,{symbol:this.options.vertexSymbol}).addTo(this._measureMarkerLayer);var i=this._measure(e),n=new Pr(i,t.coordinate,this.options.labelOptions);this._measureMarkerLayer.addGeometry(n),this._lastVertex=n},e.prototype._msOnDrawEnd=function(t){this._clearTailMarker();var e=this._lastVertex.getSize();e||(e=new je(10,10)),this._addClearMarker(this._lastVertex.getCoordinates(),e.width);var i=t.geometry.copy();i.addTo(this._measureLineLayer),this._lastMeasure=i.getLength()},e.prototype._addClearMarker=function(t,e){var i=this.options.clearButtonSymbol,n={markerDx:(i.markerDx||0)+e,textDx:(i.textDx||0)+e};Array.isArray(i)&&(n=i.map((function(t){return t?{markerDx:(t.markerDx||0)+e,textDx:(t.textDx||0)+e}:null}))),i=st(i,n);var r=new Zn(t,{symbol:i}),o=this._measureLineLayer,s=this._measureMarkerLayer;r.on("click",(function(){return o.remove(),s.remove(),!1}),this),r.addTo(this._measureMarkerLayer)},e.prototype._clearTailMarker=function(){this._tailMarker&&(this._tailMarker.remove(),delete this._tailMarker),this._tailLabel&&(this._tailLabel.remove(),delete this._tailLabel)},e}(Ir);jr.mergeOptions(zr);var Zr={mode:"Polygon",symbol:{lineColor:"#000000",lineWidth:2,lineOpacity:1,lineDasharray:"",polygonFill:"#ffffff",polygonOpacity:.5}},Hr=function(t){function e(i){ve(this,e);var n=we(this,t.call(this,i));return n.on("enable",n._afterEnable,n).on("disable",n._afterDisable,n),n._measureLayers=[],n}return xe(e,t),e.prototype._measure=function(t){var e=this.getMap(),i=void 0;t instanceof En?i=e.computeGeometryArea(t):Array.isArray(t)&&(i=e.getProjection().measureArea(t)),this._lastMeasure=i;var n=void 0;n="zh-CN"===this.options.language?[" 平方米"," 平方公里"," 平方英尺"," 平方英里"]:[" sq.m"," sq.km"," sq.ft"," sq.mi"];var r="";return this.options.metric&&(r+=i<1e6?i.toFixed(0)+n[0]:(i/1e6).toFixed(2)+n[1]),this.options.imperial&&(i*=3.2808399,r.length>0&&(r+="\n"),r+=i<27878400?i.toFixed(0)+n[2]:(i/27878400).toFixed(2)+n[3]),r},e.prototype._msGetCoordsToMeasure=function(t){return t.geometry.getShell().concat([t.coordinate])},e.prototype._msOnDrawVertex=function(t){var e=new Zn(t.coordinate,{symbol:this.options.vertexSymbol}).addTo(this._measureMarkerLayer);this._measure(t.geometry),this._lastVertex=e},e.prototype._msOnDrawEnd=function(t){this._clearTailMarker();var e=this._measure(t.geometry),i,n=new Pr(e,t.coordinate,this.options.labelOptions).addTo(this._measureMarkerLayer).getSize();n||(n=new je(10,10)),this._addClearMarker(t.coordinate,n.width);var r=t.geometry.copy();r.addTo(this._measureLineLayer),this._lastMeasure=r.getArea()},e}(jr);Hr.mergeOptions(Zr),wn.loadArcgis=function(t,e,i){if(h(t)&&"{"!==t.substring(0,1))Oi.getJSON(t,(function(t,n){if(t)i?e.call(i,t):e(t);else{var r=le(n);i?e.call(i,null,r):e(null,r)}}));else{h(t)&&(t=g(t));var n=le(t);i?e.call(i,null,n):e(null,n)}return this};var Fr={eventsToStop:"mousedown dblclick",dx:0,dy:0,autoPan:!1,autoPanDuration:600,single:!0,animation:"scale",animationOnHide:!0,animationDuration:500},Gr=function(t){function e(i){return ve(this,e),we(this,t.call(this,i))}return xe(e,t),e.prototype.addTo=function(t){return this._owner=t,this.fire("add"),this},e.prototype.getMap=function(){return this._owner?this._owner.getBaseLayer?this._owner:this._owner.getMap():null},e.prototype.show=function(t){var e=this.getMap();if(!e)return this;t=t||this._coordinate||this._owner.getCenter();var i=this.isVisible();this.fire("showstart");var n=this._getUIContainer();this.__uiDOM||this._switchEvents("on"),this._coordinate=t,this._removePrevDOM();var r=this.__uiDOM=this.buildOn(e);if(!r)return this.fire("showend"),this;this._measureSize(r),this._singleton()&&(e[this._uiDomKey()]=r),this._setPosition(),r.style[Ve]=null,n.appendChild(r);var o=this._getAnimation();if(i&&(o.ok=!1),o.ok&&(o.fade&&(r.style.opacity=0),o.scale)){if(this.getTransformOrigin){var s=this.getTransformOrigin();r.style[Be]=s.x+"px "+s.y+"px"}r.style[We]=pe(this._pos)+" scale(0)"}r.style.display="",this.options.eventsToStop&&Ue(r,this.options.eventsToStop,bt),this.options.autoPan&&this._autoPan();var a=o.transition;return o.ok&&a&&(r.offsetHeight,a&&(r.style[Ve]=a),o.fade&&(r.style.opacity=1),o.scale&&(r.style[We]=pe(this._pos)+" scale(1)")),this.fire("showend"),this},e.prototype.hide=function(){if(!this.getDOM()||!this.getMap())return this;var t=this._getAnimation(),e=this.getDOM();return this.options.animationOnHide||(t.ok=!1),t.ok?(e.offsetHeight,e.style[Ve]=t.transition,setTimeout((function(){e.style.display="none"}),this.options.animationDuration)):e.style.display="none",t.fade&&(e.style.opacity=0),t.scale&&(e.style[We]=pe(this._pos)+" scale(0)"),this.fire("hide"),this},e.prototype.isVisible=function(){return this.getMap()&&this.getDOM()&&"none"!==this.getDOM().style.display},e.prototype.remove=function(){return this._owner?(this.hide(),this._switchEvents("off"),this.onRemove&&this.onRemove(),!this._singleton()&&this.__uiDOM&&this._removePrevDOM(),delete this._owner,this.fire("remove"),this):this},e.prototype.getSize=function(){return this._size?this._size.copy():null},e.prototype.getOwner=function(){return this._owner},e.prototype.getDOM=function(){return this.__uiDOM},e.prototype.getPosition=function(){if(!this.getMap())return null;var t=this._getViewPoint()._round();if(this.getOffset){var e=this.getOffset()._round();e&&t._add(e)}return t},e.prototype._getAnimation=function(){for(var t={fade:!1,scale:!1},e=this.options.animation?this.options.animation.split(","):[],i=0;i<e.length;i++){var n=at(e[i]);"fade"===n?t.fade=!0:"scale"===n&&(t.scale=!0)}var r=null;return t.fade&&(r="opacity "+this.options.animationDuration+"ms"),t.scale&&(r=r?r+",":"",r+=We+" "+this.options.animationDuration+"ms"),t.transition=r,t.ok=null!==r,t},e.prototype._getViewPoint=function(){return this.getMap().coordinateToViewPoint(this._coordinate)._add(this.options.dx,this.options.dy)},e.prototype._autoPan=function(){var t=this.getMap(),e=this.getDOM();if(!t.isMoving()){var i=this._pos,n=t.getSize(),r=n.width,o=n.height,s=t.viewPointToContainerPoint(i),a=parseInt(e.clientWidth),h=parseInt(e.clientHeight),l=0,p=0;s.x<0?l=-(s.x-a/2):s.x+a-35>r&&(l=r-(s.x+3*a/2)),s.y<0?p=50-s.y:s.y>o&&(p=o-s.y-h-30),0===p&&0===l||t.panBy(new ze(l,p),{duration:this.options.autoPanDuration})}},e.prototype._measureSize=function(t){var e=this._getUIContainer();return t.style.position="absolute",t.style.left="-99999px",t.style.top="-99999px",t.style.display="",e.appendChild(t),this._size=new je(t.clientWidth,t.clientHeight),t.style.display="none",t.style.left="0px",t.style.top="0px",this._size},e.prototype._removePrevDOM=function(){this.onDomRemove&&this.onDomRemove();var t=this.options.eventsToStop;if(this._singleton()){var e=this.getMap(),i=this._uiDomKey();e[i]&&(t&&qe(e[i],t,bt),mt(e[i]),delete e[i]),delete this.__uiDOM}else this.__uiDOM&&(t&&qe(this.__uiDOM,t,bt),mt(this.__uiDOM),delete this.__uiDOM)},e.prototype._uiDomKey=function(){return"__ui_"+this._getClassName()},e.prototype._singleton=function(){return this.options.single},e.prototype._getUIContainer=function(){return this.getMap()._panels.ui},e.prototype._getClassName=function(){return"UIComponent"},e.prototype._switchEvents=function(t){var e=this._getDefaultEvents();if(this.getEvents&&n(e,this.getEvents()),e){var i=this.getMap();if(i)for(var r in e)e.hasOwnProperty(r)&&i[t](r,e[r],this)}var o=this._getOwnerEvents();if(this._owner&&o)for(var s in o)o.hasOwnProperty(s)&&this._owner[t](s,o[s],this)},e.prototype._getDefaultEvents=function(){return{"zooming rotate pitch":this.onEvent,zoomend:this.onZoomEnd,moving:this.onMoving}},e.prototype._getOwnerEvents=function(){return this._owner&&this._owner instanceof En?{positionchange:this.onGeometryPositionChange}:null},e.prototype.onGeometryPositionChange=function(t){this._owner&&this.isVisible()&&this.show(t.target.getCenter())},e.prototype.onMoving=function(){this.isVisible()&&this.getMap().isTransforming()&&this._updatePosition()},e.prototype.onEvent=function(){this.isVisible()&&this._updatePosition()},e.prototype.onZoomEnd=function(){this.isVisible()&&this._setPosition()},e.prototype._updatePosition=function(){this.getMap()._getRenderer().callInNextFrame(this._setPosition.bind(this))},e.prototype._setPosition=function(){var t=this.getDOM(),e=this.getPosition();this._pos=e,t.style[Ve]=null,t.style[We]=pe(e)},e}(Ei(Ri));Gr.mergeOptions(Fr);var Nr={draggable:!1,single:!1,content:null},Wr="mousedown mouseup mouseenter mouseover mouseout mousemove click dblclick contextmenu keypress touchstart touchmove touchend",Br=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r._markerCoord=new Xe(i),r}return xe(e,t),e.prototype._getClassName=function(){return"UIMarker"},e.prototype.setCoordinates=function(t){return this._markerCoord=t,this.fire("positionchange"),this.isVisible()&&this.show(),this},e.prototype.getCoordinates=function(){return this._markerCoord},e.prototype.setContent=function(t){var e=this.options.content;return this.options.content=t,this.fire("contentchange",{old:e,new:t}),this.isVisible()&&this.show(),this},e.prototype.getContent=function(){return this.options.content},e.prototype.show=function(){return t.prototype.show.call(this,this._markerCoord)},e.prototype.buildOn=function(){var t=void 0;return h(this.options.content)?(t=yt("div")).innerHTML=this.options.content:t=this.options.content,this._registerDOMEvents(t),t},e.prototype.getOffset=function(){var t=this.getSize();return new ze(-t.width/2,-t.height/2)},e.prototype.getTransformOrigin=function(){var t=this.getSize();return new ze(t.width/2,t.height/2)},e.prototype.onDomRemove=function(){var t=this.getDOM();this._removeDOMEvents(t)},e.prototype.isDragging=function(){return!!this.draggable&&this.draggable.isDragging()},e.prototype._registerDOMEvents=function(t){Ue(t,Wr,this._onDomEvents,this)},e.prototype._onDomEvents=function(t){var e=this.getMap()._parseEvent(t,t.type);this.fire(t.type,e)},e.prototype._removeDOMEvents=function(t){qe(t,Wr,this._onDomEvents,this)},e}(zi(Gr));Br.mergeOptions(Nr);var Vr=ki.touch?"touchstart mousedown":"mousedown",Jr=function(t){function e(i){return ve(this,e),we(this,t.call(this,i))}return xe(e,t),e.prototype.addHooks=function(){this.target.on(Vr,this._startDrag,this)},e.prototype.removeHooks=function(){this.target.off(Vr,this._startDrag,this)},e.prototype._startDrag=function(t){var e=t.domEvent;e.touches&&e.touches.length>1||this.isDragging()||(this.target.on("click",this._endDrag,this),this._lastCoord=t.coordinate,this._lastPoint=t.containerPoint,this._prepareDragHandler(),this._dragHandler.onMouseDown(t.domEvent),this.target.fire("dragstart",t))},e.prototype._prepareDragHandler=function(){this._dragHandler=new Fi(this.target.getDOM(),{cancelOn:this._cancelOn.bind(this)}),this._dragHandler.on("mousedown",this._onMouseDown,this),this._dragHandler.on("dragging",this._dragging,this),this._dragHandler.on("mouseup",this._endDrag,this),this._dragHandler.enable()},e.prototype._cancelOn=function(t){var e,i=(t.srcElement||t.target).tagName.toLowerCase();return"button"===i||"input"===i||"select"===i||"option"===i||"textarea"===i},e.prototype._onMouseDown=function(t){bt(t.domEvent)},e.prototype._dragging=function(t){var e=this.target,i,n=e.getMap()._parseEvent(t.domEvent),r=n.domEvent;if(!(r.touches&&r.touches.length>1)){if(!this._isDragging)return void(this._isDragging=!0);var o=n.coordinate,s=n.containerPoint;this._lastCoord||(this._lastCoord=o),this._lastPoint||(this._lastPoint=s);var a=o.sub(this._lastCoord),h=s.sub(this._lastPoint);this._lastCoord=o,this._lastPoint=s,this.target.setCoordinates(this.target.getCoordinates().add(a)),n.coordOffset=a,n.pointOffset=h,e.fire("dragging",n)}},e.prototype._endDrag=function(t){var e=this.target,i=e.getMap();if(this._dragHandler&&(e.off("click",this._endDrag,this),this._dragHandler.disable(),delete this._dragHandler),delete this._lastCoord,delete this._lastPoint,this._isDragging=!1,i){var n=i._parseEvent(t.domEvent);e.fire("dragend",n)}},e.prototype.isDragging=function(){return!!this._isDragging},e}(Di);Br.addInitHook("addHandler","draggable",Jr);var Ur={autoPan:!0,width:300,minHeight:120,custom:!1,title:null,content:null},qr=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._getClassName=function(){return"InfoWindow"},e.prototype.addTo=function(e){return e instanceof En&&(e.getInfoWindow()&&e.getInfoWindow()!==this&&e.removeInfoWindow(),e._infoWindow=this),t.prototype.addTo.call(this,e)},e.prototype.setContent=function(t){var e=this.options.content;return this.options.content=t,this.fire("contentchange",{old:e,new:t}),this.isVisible()&&this.show(this._coordinate),this},e.prototype.getContent=function(){return this.options.content},e.prototype.setTitle=function(t){var e=t;return this.options.title=t,this.fire("contentchange",{old:e,new:t}),this.isVisible()&&this.show(this._coordinate),this},e.prototype.getTitle=function(){return this.options.title},e.prototype.buildOn=function(){if(this.options.custom){if(h(this.options.content)){var t=yt("div");return t.innerHTML=this.options.content,t}return this.options.content}var e=yt("div");e.className="maptalks-msgBox",e.style.width=this._getWindowWidth()+"px";var i='<em class="maptalks-ico"></em>';this.options.title&&(i+="<h2>"+this.options.title+"</h2>");var n="\"this.parentNode.style.display='none';return false;\"";return i+='<a href="javascript:void(0);" onclick='+n+" ontouchend="+n+' class="maptalks-close"></a><div class="maptalks-msgContent">'+this.options.content+"</div>",e.innerHTML=i,e},e.prototype.getTransformOrigin=function(){var t=this.getSize(),e=new ze(t.width/2,t.height);return this.options.custom||e._add(4,12),e},e.prototype.getOffset=function(){var t=this.getSize(),e=new ze(-t.width/2,-t.height);if(this.options.custom||e._sub(4,12),this.getOwner()instanceof Zn){var i=this.getOwner().getSize();i&&e._add(0,-i.height)}return e},e.prototype.show=function(e){return this.getMap()&&this.getMap().options.enableInfoWindow?t.prototype.show.call(this,e):this},e.prototype._getWindowWidth=function(){var t=this.options.width;return t||(t=300),t},e}(Gr);qr.mergeOptions(Ur);var Yr={width:0,height:0,animation:"fade",cssName:null},Qr=function(t){function e(i){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ve(this,e);var r=we(this,t.call(this,n));return n.cssName&&r.setStyle(n.cssName),h(i)&&(r._content=i),r}return xe(e,t),e.prototype._getClassName=function(){return"ToolTip"},e.prototype.addTo=function(e){if(e instanceof En)return e.on("mouseover",this.onMouseOver,this),e.on("mouseout",this.onMouseOut,this),t.prototype.addTo.call(this,e);throw new Error("Invalid geometry the tooltip is added to.")},e.prototype.setStyle=function(t){this._cssName=t},e.prototype.getStyle=function(){return this._cssName},e.prototype.getContent=function(){return this._content},e.prototype.buildOn=function(){var t=yt("div");Yr.height&&(t.style.height=Yr.height+"px"),Yr.width&&(t.style.width=Yr.width+"px");var e=this._cssName?this._cssName:"maptalks-tooltip";return!this._cssName&&Yr.height&&(t.style.lineHeight=Yr.height+"px"),t.innerHTML='<div class="'+e+'">'+this._content+"</div>",t},e.prototype.onMouseOver=function(t){if(!this.isVisible()){var e=this.getMap();this.show(e.locateByPoint(t.coordinate,-5,25))}},e.prototype.onMouseOut=function(){this.isVisible()&&this._removePrevDOM()},e.prototype.onRemove=function(){this._owner&&(this._owner.off("mouseover",this.onMouseOver,this),this._owner.off("mouseout",this.onMouseOut,this))},e}(Gr);Qr.mergeOptions(Yr);var Xr={animation:null,animationDelay:10,animationOnHide:!1,eventsToStop:"mousewheel mousedown dblclick click",autoPan:!1,width:160,maxHeight:0,custom:!1,items:[]},Kr=function(t){function e(i){return ve(this,e),we(this,t.call(this,i))}return xe(e,t),e.prototype._getClassName=function(){return"Menu"},e.prototype.addTo=function(t){return t._menu&&t._menu!==this&&t.removeMenu(),t._menu=this,Gr.prototype.addTo.apply(this,arguments)},e.prototype.setItems=function(t){return this.options.items=t,this},e.prototype.getItems=function(){return this.options.items||[]},e.prototype.buildOn=function(){if(this.options.custom){if(h(this.options.items)){var t=yt("div");return t.innerHTML=this.options.items,t}return this.options.items}var e=yt("div");Lt(e,"maptalks-menu"),e.style.width=this._getMenuWidth()+"px";var i=this._createMenuItemDom();return e.appendChild(i),Ue(e,"contextmenu",Ct),e},e.prototype.getOffset=function(){if(!this.getMap())return null;var t=this.getMap().getSize(),e=this.getMap().viewPointToContainerPoint(this._getViewPoint()),i=this.getSize(),n=0,r=0;return e.x+i.width>t.width&&(n=-i.width),e.y+i.height>t.height&&(r=-i.height),new ze(n,r)},e.prototype.getTransformOrigin=function(){return this.getOffset()._multi(-1)},e.prototype.getEvents=function(){return{"_zoomstart _zoomend _movestart _dblclick _click":this.hide}},e.prototype._createMenuItemDom=function(){var t=this,e=this.getMap(),i=yt("ul");Lt(i,"maptalks-menu-items");for(var n=this.getItems(),r=void 0,o=void 0,s=0,a=n.length;s<a;s++){if("-"===(r=n[s])||"_"===r)Lt(o=yt("li"),"maptalks-menu-splitter");else{o=yt("li");var h=r.item;l(h)&&(h=h({owner:this._owner,index:s})),o.innerHTML=h,o._callback=r.click,Ue(o,"click",function(i){return function(n){var r=e._parseEvent(n,"click");r.target=t,r.owner=t._owner,r.index=i,!1!==this._callback(r)&&t.hide()}}(s))}i.appendChild(o)}var p=this.options.maxHeight||0;return p>0&&Ot(i,"max-height: "+p+"px; overflow-y: auto;"),i},e.prototype._getMenuWidth=function(){return this.options.width||160},e}(Gr);Kr.mergeOptions(Xr);var $r={setMenu:function(t){return this._menuOptions=t,this._menu?this._menu.setOptions(t):this.on("contextmenu",this._defaultOpenMenu,this),this},openMenu:function(t){var e=this instanceof bn?this:this.getMap();return t||(t=this.getCenter()),this._menu?this._menu.show(t):this._menuOptions&&e&&(this._bindMenu(this._menuOptions),this._menu.show(t)),this},setMenuItems:function(t){return this._menuOptions||(this._menuOptions={}),Array.isArray(t)&&(this._menuOptions.custom=!1),this._menuOptions.items=t,this.setMenu(this._menuOptions),this},getMenuItems:function(){return this._menu?this._menu.getItems():this._menuOptions&&this._menuOptions.items||[]},closeMenu:function(){return this._menu&&this._menu.hide(),this},removeMenu:function(){return this.off("contextmenu",this._defaultOpenMenu,this),this._unbindMenu(),delete this._menuOptions,this},_bindMenu:function(t){return this._menu=new Kr(t),this._menu.addTo(this),this},_unbindMenu:function(){return this._menu&&(this.closeMenu(),this._menu.remove(),delete this._menu),this},_defaultOpenMenu:function(t){return this.listens("contextmenu")>1||(this.openMenu(t.coordinate),!1)}};bn.include($r),En.include($r);var to=Object.freeze({UIComponent:Gr,UIMarker:Br,InfoWindow:qr,ToolTip:Qr,Menuable:$r,Menu:Kr}),eo=function(t){function e(i){return ve(this,e),i&&i.position&&!h(i.position)&&(i.position=n({},i.position)),we(this,t.call(this,i))}return xe(e,t),e.prototype.addTo=function(t){if(this.remove(),!t.options.control)return this;this._map=t;var e=t._panels.control;return this.__ctrlContainer=yt("div"),Ot(this.__ctrlContainer,"position:absolute"),this.update(),e.appendChild(this.__ctrlContainer),this.onAdd&&this.onAdd(),this.fire("add",{dom:e}),this},e.prototype.update=function(){return this.__ctrlContainer.innerHTML="",this._controlDom=this.buildOn(this.getMap()),this._controlDom&&(this._updatePosition(),this.__ctrlContainer.appendChild(this._controlDom)),this},e.prototype.getMap=function(){return this._map},e.prototype.getPosition=function(){return n({},this._parse(this.options.position))},e.prototype.setPosition=function(t){return h(t)?this.options.position=t:this.options.position=n({},t),this._updatePosition(),this},e.prototype.getContainerPoint=function(){var t=this.getPosition(),e=this.getMap().getSize(),i=void 0,n=void 0;return r(t.top)?r(t.bottom)||(i=e.height-t.bottom):i=t.top,r(t.left)?r(t.right)||(n=e.width-t.right):n=t.left,new ze(i,n)},e.prototype.getContainer=function(){return this.__ctrlContainer},e.prototype.getDOM=function(){return this._controlDom},e.prototype.show=function(){return this.__ctrlContainer.style.display="",this},e.prototype.hide=function(){return this.__ctrlContainer.style.display="none",this},e.prototype.isVisible=function(){return this.__ctrlContainer&&""===this.__ctrlContainer.style.display},e.prototype.remove=function(){return this._map?(mt(this.__ctrlContainer),this.onRemove&&this.onRemove(),delete this._map,delete this.__ctrlContainer,delete this._controlDom,this.fire("remove"),this):this},e.prototype._parse=function(t){var i=t;return h(t)&&(i=e.positions[i]),i},e.prototype._updatePosition=function(){var t=this.getPosition();for(var e in t||(t={top:20,left:20}),t)t.hasOwnProperty(e)&&(t[e]=parseInt(t[e]),this.__ctrlContainer.style[e]=t[e]+"px");this.fire("positionchange",{position:n({},t)})},e}(Ei(Ri));eo.positions={"top-left":{top:20,left:20},"top-right":{top:40,right:60},"bottom-left":{bottom:20,left:60},"bottom-right":{bottom:20,right:60}},bn.mergeOptions({control:!0}),bn.include({addControl:function(t){return this._containerDOM.getContext?this:(t.addTo(this),this)},removeControl:function(t){return t&&t.getMap()===this?(t.remove(),this):this}});var io={position:"bottom-left",content:"<p>carte 3D </p>"},no=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(){return this._attributionContainer=yt("div"),this._update(),this._attributionContainer},e.prototype.setContent=function(t){return this.options.content=t,this._update(),this},e.prototype._update=function(){if(this.getMap()){var t=this.options.content;h(t)&&"<"!==t.charAt(0)&&(this._attributionContainer.className="maptalks-attribution",t='<span style="padding:0px 4px">'+t+"</span>"),this._attributionContainer.innerHTML=t}},e}(eo);no.mergeOptions(io),bn.mergeOptions({attribution:!1}),bn.addOnLoadHook((function(){var t=this.options.attribution||this.options.attributionControl;t&&(this.attributionControl=new no(t),this.addControl(this.attributionControl))}));var ro={level:4,position:"bottom-right",size:{width:300,height:200},symbol:{lineWidth:3,lineColor:"#1bbc9b",polygonFill:"#1bbc9b",polygonOpacity:.4}},oo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(){var t=yt("div");return t.style.cssText="background:#fff;border:1px solid #b4b3b3;width:"+this.options.size.width+"px;height:"+this.options.size.height+"px;",t},e.prototype.onAdd=function(){this._createOverview()},e.prototype._createOverview=function(t){var e=this.getMap(),i=t||this.getDOM(),r=e.getExtent(),o=e.config();n(o,{center:e.getCenter(),zoom:this._getOverviewZoom(),zoomAnimationDuration:150,scrollWheelZoom:!1,checkSize:!1,doubleClickZoom:!1,touchZoom:!1,control:!1,draggable:!1}),this._overview=new bn(i,o),this._updateBaseLayer(),this._perspective=new Yn(r.toArray(),{draggable:!0,cursor:"move",symbol:this.options.symbol}).on("dragstart",this._onDragStart,this).on("dragend",this._onDragEnd,this),e.on("resize moveend zoomend",this._update,this).on("setbaselayer",this._updateBaseLayer,this),new Dr("v",[this._perspective]).addTo(this._overview),this.fire("load")},e.prototype.onRemove=function(){this.getMap().off("load",this._initOverview,this).off("resize moveend zoomend",this._update,this).off("setbaselayer",this._updateBaseLayer,this)},e.prototype._getOverviewZoom=function(){var t=this.getMap(),e=t.getZoom(),i=t.getMinZoom(),n=this.options.level;if(n>0){for(var r=n;r>0;r--)if(e-r>=i)return e-r}else for(var o=n;o<0;o++)if(e-o>=i)return e-o;return e},e.prototype._onDragStart=function(){this._origDraggable=this.getMap().options.draggable,this.getMap().config("draggable",!1)},e.prototype._onDragEnd=function(){var t=this._perspective.getCenter();this._overview.setCenter(t),this.getMap().panTo(t),this.getMap().config("draggable",this._origDraggable)},e.prototype._update=function(){this._perspective.setCoordinates(this.getMap().getExtent().toArray()),this._overview.setCenterAndZoom(this.getMap().getCenter(),this._getOverviewZoom())},e.prototype._updateBaseLayer=function(){var t=this.getMap();t.getBaseLayer()?this._overview.setBaseLayer(fn.fromJSON(t.getBaseLayer().toJSON())):this._overview.setBaseLayer(null)},e}(eo);oo.mergeOptions(ro),bn.mergeOptions({overviewControl:!1}),bn.addOnLoadHook((function(){this.options.overviewControl&&(this.overviewControl=new oo(this.options.overviewControl),this.addControl(this.overviewControl))}));var so={position:"top-right",draggable:!0,custom:!1,content:"",closeButton:!0},ao=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(){var t=void 0;if(this.options.custom)h(this.options.content)?(t=yt("div")).innerHTML=this.options.content:t=this.options.content;else{if(t=yt("div","maptalks-panel"),this.options.closeButton){var e=yt("a","maptalks-close");e.href="javascript:;",e.onclick=function(){t.style.display="none"},t.appendChild(e)}var i=yt("div","maptalks-panel-content");i.innerHTML=this.options.content,t.appendChild(i)}return this.draggable=new Fi(t,{cancelOn:this._cancelOn.bind(this)}),this.draggable.on("dragstart",this._onDragStart,this).on("dragging",this._onDragging,this).on("dragend",this._onDragEnd,this),this.options.draggable&&this.draggable.enable(),t},e.prototype.update=function(){return this.draggable&&(this.draggable.disable(),delete this.draggable),eo.prototype.update.call(this)},e.prototype.setContent=function(t){var e=this.options.content;return this.options.content=t,this.fire("contentchange",{old:e,new:t}),this.isVisible()&&this.update(),this},e.prototype.getContent=function(){return this.options.content},e.prototype._cancelOn=function(t){var e,i=(t.srcElement||t.target).tagName.toLowerCase();return"button"===i||"input"===i||"select"===i||"option"===i||"textarea"===i},e.prototype._onDragStart=function(t){this._startPos=t.mousePos,this._startPosition=n({},this.getPosition())},e.prototype._onDragging=function(t){var e,i=t.mousePos.sub(this._startPos),n=this._startPosition,o=this.getPosition();r(o.top)||(o.top=+n.top+i.y),r(o.bottom)||(o.bottom=+n.bottom-i.y),r(o.left)||(o.left=+n.left+i.x),r(o.right)||(o.right=+n.right-i.x),this.setPosition(o)},e.prototype._onDragEnd=function(){delete this._startPos,delete this._startPosition},e.prototype._getConnectPoints=function(){var t=this._map,e=this.getContainerPoint(),i=this.getDOM(),n=i.clientWidth,r=i.clientHeight;return[t.containerPointToCoordinate(e.add(new ze(Math.round(n/2),0))),t.containerPointToCoordinate(e.add(new ze(n,Math.round(r/2)))),t.containerPointToCoordinate(e.add(new ze(Math.round(n/2),r))),t.containerPointToCoordinate(e.add(new ze(0,Math.round(r/2))))]},e}(eo);ao.mergeOptions(so);var ho={position:"bottom-left",maxWidth:100,metric:!0,imperial:!1},lo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(t){return this._map=t,this._scaleContainer=yt("div"),this._addScales(),t.on("zoomend",this._update,this),this._map._loaded&&this._update(),this._scaleContainer},e.prototype.onRemove=function(){this.getMap().off("zoomend",this._update,this)},e.prototype._addScales=function(){var t="border: 2px solid #000000;border-top: none;line-height: 1.1;padding: 2px 5px 1px;color: #000000;font-size: 11px;text-align:center;white-space: nowrap;overflow: hidden;-moz-box-sizing: content-box;box-sizing: content-box;background: #fff; background: rgba(255, 255, 255, 0);";this.options.metric&&(this._mScale=_t("div",t,this._scaleContainer)),this.options.imperial&&(this._iScale=_t("div",t,this._scaleContainer))},e.prototype._update=function(){var t,e=this._map.pixelToDistance(this.options.maxWidth,0);this._updateScales(e)},e.prototype._updateScales=function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},e.prototype._updateMetric=function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},e.prototype._updateImperial=function(t){var e=3.2808399*t,i=void 0,n=void 0,r=void 0;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mile",n/i)):(r=this._getRoundNum(e),this._updateScale(this._iScale,r+" feet",r/e))},e.prototype._updateScale=function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},e.prototype._getRoundNum=function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)},e}(eo);lo.mergeOptions(ho),bn.mergeOptions({scaleControl:!1}),bn.addOnLoadHook((function(){this.options.scaleControl&&(this.scaleControl=new lo(this.options.scaleControl),this.addControl(this.scaleControl))}));var po={height:28,vertical:!1,position:"top-right",reverseMenu:!1,items:{}},uo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(t){this._map=t;var e=yt("div"),i=yt("ul","maptalks-toolbar-hx");e.appendChild(i),this.options.vertical?Lt(e,"maptalks-toolbar-vertical"):Lt(e,"maptalks-toolbar-horizonal");var n=this,r=this.options.items;if(S(r))for(var o=0,s=r.length;o<s;o++){var a=r[o],h=yt("li");if(28!==this.options.height&&(h.style.lineHeight=this.options.height+"px"),h.style.height=this.options.height+"px",h.style.cursor="pointer",Ht(a.item)){h.style.textAlign="center";var l=Ft("div",a.item);h.innerHTML='<div style="margin-top:'+(this.options.height-l.height)/2+'px;">'+a.item+"</div>"}else h.innerHTML=a.item;if(a.click&&Ue(h,"click",function(t,e,i,r){var o=n._getItems()[e];return function(n){return bt(n),t({target:o,index:e,childIndex:i,dom:r})}}(a.click,o,null,h)),S(a.children)){var p=this._createDropMenu(o);h.appendChild(p),h._menu=p,Ue(h,"mouseover",(function(){this._menu.style.display=""})),Ue(h,"mouseout",(function(){this._menu.style.display="none"}))}i.appendChild(h)}return e},e.prototype._createDropMenu=function(t){var e=this,i=yt("div","maptalks-dropMenu");i.appendChild(yt("em","maptalks-ico"));for(var n=yt("ul"),r=this._getItems()[t].children,o=0,s=0,a=r.length;s<a;s++){var h=pt(r[s].item,"12px");h.width>o&&(o=h.width)}for(var l=0,p=r.length;l<p;l++){var u=r[l],c=yt("li");c.innerHTML='<a href="javascript:;">'+u.item+"</a>",c.style.cursor="pointer",c.style.width=o+24+"px",Ue(c.childNodes[0],"click",function(t,i,n){var r=e._getItems()[i].children[n];return function(e){return bt(e),t({target:r,index:i,childIndex:n})}}(u.click,t,l)),n.appendChild(c)}if(this.options.vertical){var d=o<95?95:o;this.options.reverseMenu?i.style.right=-(d+20)+"px":i.style.left=-(d+20)+"px"}else this.options.reverseMenu?i.style.bottom="28px":i.style.top="28px";return i.appendChild(n),i.style.display="none",i},e.prototype._getItems=function(){return this.options.items||[]},e}(eo);uo.mergeOptions(po);var co={position:"top-left",slider:!0,zoomLevel:!0},fo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.buildOn=function(t){this._map=t;var e=this.options,i=yt("div","maptalks-zoom");if(e.zoomLevel){var n=yt("span","maptalks-zoom-zoomlevel");i.appendChild(n),this._levelDOM=n}var r=yt("div","maptalks-zoom-slider"),o=yt("a","maptalks-zoom-zoomin");if(o.href="javascript:;",o.innerHTML="+",r.appendChild(o),this._zoomInButton=o,e.slider){var s=yt("div","maptalks-zoom-slider-box"),a=yt("div","maptalks-zoom-slider-ruler"),h=yt("span","maptalks-zoom-slider-reading"),l=yt("span","maptalks-zoom-slider-dot");a.appendChild(h),a.appendChild(l),s.appendChild(a),r.appendChild(s),this._sliderBox=s,this._sliderRuler=a,this._sliderReading=h,this._sliderDot=l}var p=yt("a","maptalks-zoom-zoomout");return p.href="javascript:;",p.innerHTML="-",r.appendChild(p),this._zoomOutButton=p,i.appendChild(r),t.on("_zoomend _zoomstart _spatialreferencechange",this._update,this),this._update(),this._registerDomEvents(),i},e.prototype._update=function(){var t=this.getMap();if(this._sliderBox){var e=10*(t.getMaxZoom()-t.getMinZoom());this._sliderBox.style.height=e+6+"px",this._sliderRuler.style.height=e+"px";var i=10*(t.getZoom()-t.getMinZoom());this._sliderReading.style.height=i+"px",this._sliderDot.style.bottom=i+"px"}if(this._levelDOM){var n=t.getZoom();s(n)||(n=n.toFixed(1)),this._levelDOM.innerHTML=n}},e.prototype._registerDomEvents=function(){this._zoomInButton&&Ue(this._zoomInButton,"click",this._onZoomInClick,this),this._zoomOutButton&&Ue(this._zoomOutButton,"click",this._onZoomOutClick,this)},e.prototype._onZoomInClick=function(t){Ct(t),this.getMap().zoomIn()},e.prototype._onZoomOutClick=function(t){Ct(t),this.getMap().zoomOut()},e.prototype.onRemove=function(){this._zoomInButton&&qe(this._zoomInButton,"click",this._onZoomInClick,this),this._zoomOutButton&&qe(this._zoomOutButton,"click",this._onZoomOutClick,this)},e}(eo);fo.mergeOptions(co),bn.mergeOptions({zoomControl:!1}),bn.addOnLoadHook((function(){this.options.zoomControl&&(this.zoomControl=new fo(this.options.zoomControl),this.addControl(this.zoomControl))}));var go=Object.freeze({Control:eo,Attribution:no,Overview:oo,Panel:ao,Scale:lo,Toolbar:uo,Zoom:fo}),yo={crs:null,uppercase:!1,detectRetina:!1},_o={service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},mo=function(t){function e(i,r){ve(this,e);var o=we(this,t.call(this,i)),s=n({},_o);for(var a in r)a in o.options||(s[a]=r[a]);o.setOptions(r);var h=r.detectRetina&&ki.retina?2:1,l=o.getTileSize();return s.width=l.width*h,s.height=l.height*h,o.wmsParams=s,o._wmsVersion=parseFloat(s.version),o}return xe(e,t),e.prototype.onAdd=function(){this.wmsParams.crs=this.options.crs||this.getMap().getProjection().code},e.prototype.getTileUrl=function(e,i,n){var r,o=this.getMap()._getResolution(n),s,a=this._getTileConfig().getTilePrjExtent(e,i,o),h=a.getMax(),l=a.getMin(),p=(this._wmsVersion>=1.3&&"EPSG:4326"===this.wmsParams.crs?[l.y,l.x,h.y,h.x]:[l.x,l.y,h.x,h.y]).join(","),u=t.prototype.getTileUrl.call(this,e,i,n);return u+ue(this.wmsParams,u,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+p},e.prototype.toJSON=function(){return{type:"WMSTileLayer",id:this.getId(),options:this.config()}},e.fromJSON=function(t){return t&&"WMSTileLayer"===t.type?new e(t.id,t.options):null},e}(vn);mo.registerJSONType("WMSTileLayer"),mo.mergeOptions(yo);var vo={renderer:"canvas",baseLayerRenderer:"canvas"},xo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.drawTile=function(){},e.prototype.toJSON=function(){return{type:"CanvasTileLayer",id:this.getId(),options:this.config()}},e.fromJSON=function(t){return t&&"CanvasTileLayer"===t.type?new e(t.id,t.options):null},e}(vn);xo.registerJSONType("CanvasTileLayer"),xo.mergeOptions(vo);var wo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.getPrepareParams=function(){return[]},e.prototype.getDrawParams=function(){return[]},e.prototype.onCanvasCreate=function(){this.canvas&&this.layer.options.doubleBuffer&&(this.buffer=Qe.createCanvas(this.canvas.width,this.canvas.height,this.getMap().CanvasClass))},e.prototype.needToRedraw=function(){return!(this.getMap().isInteracting()&&!this.layer.drawOnInteracting)&&t.prototype.needToRedraw.call(this)},e.prototype.draw=function(){this.prepareCanvas(),this.prepareDrawContext(),this._drawLayer()},e.prototype.drawOnInteracting=function(){this._drawLayerOnInteracting()},e.prototype.getCanvasImage=function(){var e=t.prototype.getCanvasImage.call(this);if(e&&e.image&&this.layer.options.doubleBuffer){var i=e.image;this.buffer.width===i.width&&this.buffer.height===i.height||(this.buffer.width=i.width,this.buffer.height=i.height);var n=this.buffer.getContext("2d"),r=this.layer.doubleBuffer(n,this.context);(void 0===r||r)&&(Qe.image(n,i,0,0),e.image=this.buffer)}return e},e.prototype.isAnimating=function(){return this.layer.options.animation},e.prototype.remove=function(){return delete this._drawContext,t.prototype.remove.call(this)},e.prototype.onZoomStart=function(e){this.layer.onZoomStart(e),t.prototype.onZoomStart.call(this,e)},e.prototype.onZoomEnd=function(e){this.layer.onZoomEnd(e),t.prototype.onZoomEnd.call(this,e)},e.prototype.onMoveStart=function(e){this.layer.onMoveStart(e),t.prototype.onMoveStart.call(this,e)},e.prototype.onMoveEnd=function(e){this.layer.onMoveEnd(e),t.prototype.onMoveEnd.call(this,e)},e.prototype.onResize=function(e){this.layer.onResize(e),t.prototype.onResize.call(this,e)},e.prototype.prepareDrawContext=function(){if(!this._predrawed){var t=ce(this.getPrepareParams());this._drawContext=this.layer.prepareToDraw.apply(this.layer,[this.context].concat(t)),this._drawContext||(this._drawContext=[]),Array.isArray(this._drawContext)||(this._drawContext=[this._drawContext]),this._predrawed=!0}},e.prototype._prepareDrawParams=function(){if(!this.getMap())return null;var t=this.getViewExtent();if(t.maskExtent&&!t.extent.intersects(t.maskExtent))return this.completeRender(),null;var e=[this.context,t],i=ce(this.getDrawParams());return e.push.apply(e,i),e.push.apply(e,this._drawContext),e},e.prototype._drawLayer=function(){var t=this._prepareDrawParams();t&&(this.layer.draw.apply(this.layer,t),this.completeRender())},e.prototype._drawLayerOnInteracting=function(){if(this.layer.drawOnInteracting){var t=this._prepareDrawParams();t&&(this.layer.drawOnInteracting.apply(this.layer,t),this.completeRender())}},e}(un),Co={doubleBuffer:!1,animation:!1},bo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.isCanvasRender=function(){return!0},e.prototype.prepareToDraw=function(){},e.prototype.draw=function(){},e.prototype.redraw=function(){return this._getRenderer()&&this._getRenderer().setToRedraw(),this},e.prototype.play=function(){return this.config("animation",!0),this},e.prototype.pause=function(){return this.config("animation",!1),this},e.prototype.isPlaying=function(){return this.options.animation},e.prototype.clearCanvas=function(){return this._getRenderer()&&this._getRenderer().clearCanvas(),this},e.prototype.requestMapToRender=function(){return this._getRenderer()&&this._getRenderer().requestMapToRender(),this},e.prototype.completeRender=function(){return this._getRenderer()&&this._getRenderer().completeRender(),this},e.prototype.onCanvasCreate=function(){return this},e.prototype.onZoomStart=function(){},e.prototype.onZoomEnd=function(){},e.prototype.onMoveStart=function(){},e.prototype.onMoveEnd=function(){},e.prototype.onResize=function(){},e.prototype.doubleBuffer=function(t){return t.clearRect(0,0,t.canvas.width,t.canvas.height),this},e}(fn);bo.mergeOptions(Co),bo.registerRenderer("canvas",wo);var Mo={animation:!0},Po=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.getParticles=function(){},e.prototype.draw=function(t,e){var n=this.getParticles(i());if(n){var r=this.getMap(),o=e.extent;e.maskExtent&&(o=e.extent.intersection(e.maskExtent)),o=o.convertTo((function(t){return r._pointToContainerPoint(t)}));for(var s=0,a=n.length;s<a;s++){var h=n[s].point;o.contains(h)&&(t.fillStyle!==n[s].color&&(t.fillStyle=n[s].color||this.options.lineColor||"#fff"),t.fillRect(h.x-n[s].r/2,h.y-n[s].r/2,n[s].r,n[s].r))}this._fillCanvas(t)}},e.prototype._fillCanvas=function(t){var e=t.globalCompositeOperation;t.globalCompositeOperation="destination-out";var i=this.options.trail||30;t.fillStyle="rgba(0, 0, 0, "+1/i+")",t.fillRect(0,0,t.canvas.width,t.canvas.height),t.globalCompositeOperation=e},e}(bo);Po.mergeOptions(Mo),Po.registerRenderer("canvas",function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.draw=function(){this.canvas&&this.layer.options.animation&&!this._shouldClear||(this.prepareCanvas(),this._shouldClear=!1),this.prepareDrawContext(),this._drawLayer()},e.prototype.drawOnInteracting=function(){this.draw(),this._shouldClear=!1},e.prototype.skipDrawOnInteracting=function(){this._shouldClear=!0},e}(wo));var So={fixAspectRatio:!1,symbol:null,centerHandleSymbol:de("ellipse",1),vertexHandleSymbol:de("square",1),newVertexHandleSymbol:de("square",.4)},To=function(t){function e(i,n){ve(this,e);var r=we(this,t.call(this,n));return r._geometry=i,r._geometry?r:we(r)}return xe(e,t),e.prototype.getMap=function(){return this._geometry.getMap()},e.prototype.prepare=function(){this.getMap()&&(this.options.symbol&&(this._originalSymbol=this._geometry.getSymbol(),this._geometry.setSymbol(this.options.symbol)),this._prepareEditStageLayer())},e.prototype._prepareEditStageLayer=function(){var t=this.getMap(),e=f();this._editStageLayer=t.getLayer("_maptalks__internal_layer__edit_stage_"+e),this._editStageLayer||(this._editStageLayer=new Dr("_maptalks__internal_layer__edit_stage_"+e),t.addLayer(this._editStageLayer))},e.prototype.start=function(){if(this._geometry&&this._geometry.getMap()&&!this._geometry.editing){this.editing=!0;var t=this._geometry;this._geometryDraggble=t.options.draggable,t.config("draggable",!1),this.prepare();var e=t.copy();e.setSymbol(t._getInternalSymbol()),e.copyEventListeners(t),t._getParent()&&e.copyEventListeners(t._getParent()),e.setId(null).config({draggable:!1}),this._shadow=e,this._switchGeometryEvents("on"),t.hide(),(t instanceof Zn||t instanceof ar||t instanceof pr||t instanceof lr)&&this._createOrRefreshOutline(),this._editStageLayer.bringToFront().addGeometry(e),t instanceof Zn?(e.config("draggable",!0),e.on("dragend",this._onShadowDragEnd,this)):this._createCenterHandle(),t instanceof Zn?this.createMarkerEditor():t instanceof ar?this.createCircleEditor():t instanceof pr?this.createEllipseOrRectEditor():t instanceof lr?this.createEllipseOrRectEditor():t instanceof _r||(t instanceof Yn||t instanceof qn)&&this.createPolygonEditor()}},e.prototype.stop=function(){if(this._switchGeometryEvents("off"),this.getMap()){if(this._shadow&&(this._update(),this._shadow._clearAllListeners(),this._shadow.remove(),delete this._shadow),this._geometry.config("draggable",this._geometryDraggble),delete this._geometryDraggble,this._geometry.show(),this._editStageLayer.remove(),S(this._eventListeners)){for(var t=this._eventListeners.length-1;t>=0;t--){var e=this._eventListeners[t];e[0].off(e[1],e[2],this)}this._eventListeners=[]}this._refreshHooks=[],this.options.symbol&&(this._geometry.setSymbol(this._originalSymbol),delete this._originalSymbol),this.editing=!1}},e.prototype.isEditing=function(){return!r(this.editing)&&this.editing},e.prototype._getGeometryEvents=function(){return{symbolchange:this._onGeometrySymbolChange}},e.prototype._switchGeometryEvents=function(t){if(this._geometry){var e=this._getGeometryEvents();for(var i in e)this._geometry[t](i,e[i],this)}},e.prototype._onGeometrySymbolChange=function(t){this._shadow&&this._shadow.setSymbol(t.target._getInternalSymbol())},e.prototype._onShadowDragEnd=function(){this._update(),this._refresh()},e.prototype._update=function(){this._geometry.setCoordinates(this._shadow.getCoordinates()),this._geometry.getRadius&&this._geometry.setRadius(this._shadow.getRadius()),this._geometry.getWidth&&this._geometry.setWidth(this._shadow.getWidth()),this._geometry.getHeight&&this._geometry.setHeight(this._shadow.getHeight()),this._geometry.getStartAngle&&this._geometry.setStartAngle(this._shadow.getStartAngle()),this._geometry.getEndAngle&&this._geometry.setEndAngle(this._shadow.getEndAngle())},e.prototype._updateAndFireEvent=function(t){this._shadow&&(this._update(),this._geometry.fire(t))},e.prototype._createOrRefreshOutline=function(){var t=this._geometry,e=this.getMap(),i=this._editOutline,n=t._getPainter().get2DExtent(),r=n.getSize(),o=e.pointToCoordinate(n.getMin()),s=e.pixelToDistance(r.width,0),a=e.pixelToDistance(0,r.height);return i?(i.setCoordinates(o),i.setWidth(s),i.setHeight(a)):(i=new pr(o,s,a,{symbol:{lineWidth:1,lineColor:"6b707b"}}),this._editStageLayer.addGeometry(i),this._editOutline=i,this._addRefreshHook(this._createOrRefreshOutline)),i},e.prototype._createCenterHandle=function(){var t=this,e=this._shadow.getCenter(),i=this.options.centerHandleSymbol,n=void 0,r=this.createHandle(e,{symbol:i,cursor:"move",onDown:function(){var e=ot((n=t._shadow.copy())._getInternalSymbol(),.5);n.setSymbol(e).addTo(t._editStageLayer)},onMove:function(e,i){var r=i.coordOffset;n&&(n.translate(r),t._geometry.translate(r))},onUp:function(){n&&(t._shadow.setCoordinates(t._geometry.getCoordinates()),n.remove(),t._refresh())}});this._addRefreshHook((function(){var e=t._shadow.getCenter();r.setCoordinates(e)}))},e.prototype._createHandleInstance=function(t,e){var i=e.symbol;return new Zn(t,{draggable:!0,dragShadow:!1,dragOnAxis:e.axis,cursor:e.cursor,symbol:i})},e.prototype.createHandle=function(t,e){function i(t){e.onDown&&e.onDown.call(a,t.viewPoint,t)}function n(t){a._hideContext();var i=o._prjToViewPoint(s._getPrjCoordinates());e.onMove&&e.onMove.call(a,i,t)}function r(t){e.onUp&&e.onUp.call(a,t)}e||(e={});var o=this.getMap(),s=this._createHandleInstance(t,e),a=this;return s.on("dragstart",i,this),s.on("dragging",n,this),s.on("dragend",r,this),e.onRefresh&&(s["maptalks--editor-refresh-fn"]=e.onRefresh),this._editStageLayer.addGeometry(s),s},e.prototype._createResizeHandles=function(t,e){function i(t){return[t.getMin(),new ze((t.xmax+t.xmin)/2,t.ymin),new ze(t.xmax,t.ymin),new ze(t.xmin,(t.ymax+t.ymin)/2),new ze(t.xmax,(t.ymax+t.ymin)/2),new ze(t.xmin,t.ymax),new ze((t.xmax+t.xmin)/2,t.ymax),t.getMax()]}var n=this,r=["nw-resize","n-resize","ne-resize","w-resize","e-resize","sw-resize","s-resize","se-resize"],o=[null,"y",null,"x","x",null,"y",null],s=this._geometry;t||(t=[]);var a=[],h={},l=this.getMap(),p=this.options.vertexHandleSymbol,u=function(){for(var u,c=i(s._getPainter().get2DExtent()),d=0;d<c.length;d++)!function(i){if(Array.isArray(t)&&t.some((function(t){return t===i})))return"continue";var u=c[i],d=l.pointToCoordinate(u);if(a.length<c.length-t.length){var f=n.createHandle(d,{symbol:p,cursor:r[i],axis:o[i],onMove:function(t){return function(i){e(i,t),s.fire("resizing")}}(i),onUp:function(){n._refresh()}});f.setId(i),h[i]=a.length,a.push(f)}else a[h[i]].setCoordinates(d)}(d)};return u(),this._addRefreshHook(u),a},e.prototype.createMarkerEditor=function(){function t(){if(Array.isArray(c))for(var t=c.length-1;t>=0;t--)c[t].hide();this._editOutline&&this._editOutline.hide()}function e(){if(this._refresh(),Array.isArray(c))for(var t=c.length-1;t>=0;t--)c[t].show();this._editOutline&&this._editOutline.show()}var i=this._shadow,n=this._geometry,r=this.getMap();if(i._canEdit()){var s=i._getInternalSymbol(),a=new ze(0,0);o(s.markerDx)&&(a.x=s.markerDx),o(s.markerDy)&&(a.y=s.markerDy);var h=null;ei.test(s)?"pin"!==s.markerType&&"pie"!==s.markerType&&"bar"!==s.markerType||(h=[5,6,7]):(ni.test(s)||ai.test(s))&&(h=[5,6,7]);var l=[2,1,2,0,0,2,1,2],p=void 0;if(this.options.fixAspectRatio){var u=i.getSize();p=u.width/u.height}var c=this._createResizeHandles(null,(function(t,e){if(h&&h.indexOf(e)>=0){var o=r.viewPointToCoordinate(t.sub(a)),s=i.getCoordinates();o.x=s.x,i.setCoordinates(o),n.setCoordinates(o);var u=c[c.length-1-e];t=r.coordinateToViewPoint(u.getCoordinates())}var d=r._pointToViewPoint(i._getCenter2DPoint()).add(a),f=i._getInternalSymbol(),g=t.sub(d);h&&t.y>d.y&&(g.y=0);var y=h?1:2,_=2*Math.abs(g.x),m=Math.abs(g.y)*y;p&&(m=(_=Math.max(_,m*p))/p);var v=l[e];i instanceof wr?((p||0===v||2===v)&&(n.config("boxMinWidth",_),i.config("boxMinWidth",_)),(p||1===v||2===v)&&(n.config("boxMinHeight",m),i.config("boxMinHeight",m))):((p||0===v||2===v)&&(f.markerWidth=_),(p||1===v||2===v)&&(f.markerHeight=m),i.setSymbol(f),n.setSymbol(f))}));this._addListener([r,"zoomstart",t]),this._addListener([r,"zoomend",e])}else console&&console.warn("A marker can't be resized with symbol:",i.getSymbol())},e.prototype.createCircleEditor=function(){var t=this._shadow,e=this._geometry,i=this.getMap();this._createResizeHandles(null,(function(n){var r=i._pointToViewPoint(t._getCenter2DPoint()),o=n.sub(r),s=Math.abs(o.x),a=Math.abs(o.y),h=void 0;h=s>a?i.pixelToDistance(s,0):i.pixelToDistance(0,a),t.setRadius(h),e.setRadius(h)}))},e.prototype.createEllipseOrRectEditor=function(){var t=[2,1,2,0,0,2,1,2],e=this._shadow,i=this._geometry,n=this.getMap(),r=this._geometry instanceof pr,o=void 0;this.options.fixAspectRatio&&(o=i.getWidth()/i.getHeight());var s=this._createResizeHandles(null,(function(a,h){var l=r?1:2,p=void 0,u=void 0,c=void 0,d=a,f=t[h];if(r){var g=s[7-h],y=n.coordinateToViewPoint(g.getCoordinates()),_=(p=d.sub(y)).abs();u=n.pixelToDistance(_.x,0),c=n.pixelToDistance(0,_.y);var m=i.getSize();0===f?(o&&(_.y=_.x/o,m.height=Math.abs(_.y),c=u/o),d.y=y.y-m.height/2):1===f?(o&&(_.x=_.y*o,m.width=Math.abs(_.x),u=c*o),d.x=y.x-m.width/2):o&&(u>c*o?(c=u/o,d.y=y.y+_.x*C(p.y)/o):(u=c*o,d.x=y.x+_.y*C(p.x)*o));var v=n.viewPointToCoordinate(new ze(Math.min(d.x,y.x),Math.min(d.y,y.y)));e.setCoordinates(v),i.setCoordinates(v)}else p=n.coordinateToViewPoint(i.getCenter()).sub(d)._abs(),u=n.pixelToDistance(p.x,0),c=n.pixelToDistance(0,p.y),o&&(c=(u=Math.max(u,c*o))/o);(o||0===f||2===f)&&(e.setWidth(u*l),i.setWidth(u*l)),(o||1===f||2===f)&&(e.setHeight(c*l),i.setHeight(c*l))}))},e.prototype.createPolygonEditor=function(){function t(){if(h instanceof Yn){var t=h.getCoordinates()[0];return t.slice(0,t.length-1)}return h.getCoordinates()}function e(){return h._getPrjCoordinates()}function i(){for(var t=f.length-1;t>=0;t--)f[t][d]=t;for(var e=g.length-1;e>=0;e--)g[e][d]=e}function n(t){var n,r=t.target[d],o=e();if(!(o.length<=u)){o.splice(r,1),h._setPrjCoordinates(o),h._updateCache(),f.splice(r,1)[0].remove(),r<g.length&&g.splice(r,1)[0].remove();var a=void 0;a=0===r?g.length-1:r-1,g.splice(a,1)[0].remove(),g.splice(a,0,s.call(l,a)),i()}}function r(t,i){var n=e(),r=a._viewPointToPrj(t),o=n[i];o.x=r.x,o.y=r.y,h._updateCache(),h.onShapeChanged();var s=void 0;s=0===i?g.length-1:i-1,g[i]&&g[i][c](),g[s]&&g[s][c](),l._updateAndFireEvent("shapechange")}function o(e){var i=t()[e],o=l.createHandle(i,{symbol:l.options.vertexHandleSymbol,cursor:"pointer",axis:null,onMove:function(t){r(t,o[d])},onRefresh:function(){i=t()[o[d]],o.setCoordinates(i)},onUp:function(){l._refresh()}});return o[d]=e,o.on("contextmenu",n),o}function s(n){var a=t(),u=void 0;u=n+1>=a.length?a[0]:a[n+1];var c=a[n].add(u).multi(.5),y=l.createHandle(c,{symbol:l.options.newVertexHandleSymbol,cursor:"pointer",axis:null,onDown:function(){var t=e(),i=y[d],n=p.project(y.getCoordinates());t.splice(i+1,0,n),h._setPrjCoordinates(t),h._updateCache();var r=y.getSymbol();delete r.opacity,y.setSymbol(r),g.splice(i,0,s.call(l,i),s.call(l,i+1)),l._updateAndFireEvent("shapechange")},onMove:function(t){r(t,y[d]+1)},onUp:function(){var t=y[d];m(y,g),y.remove(),f.splice(t+1,0,o.call(l,t+1)),i(),l._refresh()},onRefresh:function(){a=t();var e=y[d],i=void 0;i=e===a.length-1?0:e+1;var n=a[e].add(a[i]).multi(.5);y.setCoordinates(n)}});return y[d]=n,y}for(var a=this.getMap(),h=this._shadow,l=this,p=a.getProjection(),u=h instanceof Yn?3:2,c="maptalks--editor-refresh-fn",d="maptalks--editor-vertex-index",f=[],g=[],y=t(),_=0,v=y.length;_<v;_++)f.push(o.call(this,_)),_<v-1&&g.push(s.call(this,_));h instanceof Yn&&g.push(s.call(this,y.length-1)),this._addRefreshHook((function(){for(var t=g.length-1;t>=0;t--)g[t][c]();for(var e=f.length-1;e>=0;e--)f[e][c]()}))},e.prototype._refresh=function(){if(this._refreshHooks)for(var t=this._refreshHooks.length-1;t>=0;t--)this._refreshHooks[t].call(this)},e.prototype._hideContext=function(){this._geometry&&(this._geometry.closeMenu(),this._geometry.closeInfoWindow())},e.prototype._addListener=function(t){this._eventListeners||(this._eventListeners=[]),this._eventListeners.push(t),t[0].on(t[1],t[2],this)},e.prototype._addRefreshHook=function(t){t&&(this._refreshHooks||(this._refreshHooks=[]),this._refreshHooks.push(t))},e}(Ei(Ri));To.mergeOptions(So);var ko={startEditText:function(){return this.getMap()?(this.hide(),this.endEditText(),this._prepareEditor(),this._fireEvent("edittextstart"),this):this},endEditText:function(){if(this._textEditor){var t=this._textEditor.innerHTML;t=t.replace(/<p>/gi,"").replace(/<\/p>/gi,"<br/>"),this._textEditor.innerHTML=t;var e=this._textEditor.innerText.replace(/[\r\n]+$/gi,"");this.setContent(e),qe(this._textEditor,"mousedown dblclick",bt),this.getMap().off("mousedown",this.endEditText,this),this._editUIMarker.remove(),delete this._editUIMarker,this._textEditor.onkeyup=null,delete this._textEditor,this.show(),this._fireEvent("edittextend")}return this},isEditingText:function(){return!!this._textEditor},getTextEditor:function(){return this._editUIMarker},_prepareEditor:function(){var t=this.getMap(),e=this._createEditor();this._textEditor=e,t.on("mousedown",this.endEditText,this);var i=this._getEditorOffset();this._editUIMarker=new Br(this.getCoordinates(),{content:e,dx:i.dx,dy:i.dy}).addTo(t).show(),this._setCursorToLast(this._textEditor)},_getEditorOffset:function(){var t=this._getInternalSymbol()||{},e=0,i=0,n;return"middle"===t.textHorizontalAlignment?(e=t.textDx-2||0,i=t.textDy-2||0):(e=t.markerDx-2||0,i=t.markerDy-2||0),{dx:e,dy:i}},_createEditor:function(){var t=this.getContent(),e=this.getSize(),i=this._getInternalSymbol()||{},n=t&&t.length>0&&Math.max(e.width,this.options.boxMinWidth)||100,r=i.textFill||"#000000",o=i.textSize||12,s=Math.max(e.height,this.options.boxMinHeight)||1.5*o,a=i.markerLineColor||"#000",h=i.markerFill||"#3398CC",l=i.textLineSpacing||0,p=yt("div");return p.contentEditable=!0,p.style.cssText="background:"+h+"; border: 1px solid "+a+";\n            color:"+r+";font-size:"+o+"px;width:"+(n-2)+"px;height:"+(s-2)+"px;margin: auto;\n            line-height:"+(o+l)+"px;outline: 0; padding:0; margin:0;word-wrap: break-word;\n            overflow: hidden;-webkit-user-modify: read-write-plaintext-only;",p.innerText=t,Ue(p,"mousedown dblclick",bt),p.onkeyup=function(t){var e=p.style.height||0;13===t.keyCode&&(p.style.height=parseInt(e)+o/2+"px")},p},_setCursorToLast:function(t){var e=void 0;window.getSelection?(t.focus(),(e=window.getSelection()).selectAllChildren(t),e.collapseToEnd()):document.selection&&((e=document.selection.createRange()).moveToElementText(t),e.collapse(!1),e.select())}};br.include(ko),Pr.include(ko),En.include({animate:function(t,e,i){var n=this;this._animPlayer&&this._animPlayer.finish(),l(e)&&(i=e,e=null);var r=this.getMap(),o=this._getProjection(),s=this.getSymbol()||{},a=this._prepareAnimationStyles(t),h=void 0,p=void 0;if(e&&(p=e.focus),delete this._animationStarted,r){var u=r._getRenderer(),c=function(t){u.callInNextFrame(t)};e.framer=c}var d=Nn.animate(a,e,(function(t){if(r&&r.isRemoved())d.finish();else{r&&!n._animationStarted&&p&&r.onMoveStart();var e=t.styles;for(var a in e)if("symbol"!==a&&"translate"!==a&&e.hasOwnProperty(a)){var l="set"+a[0].toUpperCase()+a.slice(1);n[l](e[a])}var u=e.translate;if(u){var c=u;h&&(c=u.sub(h)),h=u,n.translate(c)}var f=e.symbol;if(f&&n.setSymbol(st(s,f)),r&&p){var g=o.project(n.getCenter());r._setPrjCenter(g),"running"!==d.playState?r.onMoveEnd():r.onMoving()}n._fireAnimateEvent(d.playState),i&&i(t)}}));return this._animPlayer=d,this._animPlayer.play()},_prepareAnimationStyles:function(t){var e=this._getInternalSymbol(),i={};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if("translate"!==n&&"symbol"!==n){var o,s=this["get"+n[0].toUpperCase()+n.substring(1)]();i[n]=[s,r]}else if("symbol"===n){var a=void 0;if(Array.isArray(t.symbol)){if(!Array.isArray(e))throw new Error("geometry'symbol isn't a composite symbol, while the symbol in styles is.");a=[];for(var h=t.symbol,l=0;l<h.length;l++)if(h[l]){var p={};for(var u in h[l])h[l].hasOwnProperty(u)&&(p[u]=[e[l][u],h[l][u]]);a.push(p)}else a.push(null)}else{if(Array.isArray(e))throw new Error("geometry'symbol is a composite symbol, while the symbol in styles isn't.");for(var c in a={},r)r.hasOwnProperty(c)&&(a[c]=[e[c],r[c]])}i.symbol=a}else"translate"===n&&(i.translate=new Xe(r))}return i},_fireAnimateEvent:function(t){"finished"===t?(delete this._animationStarted,this._fireEvent("animateend")):"running"===t&&(this._animationStarted?this._fireEvent("animating"):(this._fireEvent("animatestart"),this._animationStarted=!0))}});var Oo=ki.touch?"touchstart mousedown":"mousedown",Eo=function(t){function e(i){return ve(this,e),we(this,t.call(this,i))}return xe(e,t),e.prototype.addHooks=function(){this.target.on(Oo,this._startDrag,this)},e.prototype.removeHooks=function(){this.target.off(Oo,this._startDrag,this)},e.prototype._startDrag=function(t){if(this.target.getMap()&&!this.target._getParent()&&!this.isDragging()){var e=t.domEvent;e.touches&&e.touches.length>1||(this.target.on("click",this._endDrag,this),this._lastCoord=t.coordinate,this._lastPoint=t.containerPoint,this._prepareMap(),this._prepareDragHandler(),this._dragHandler.onMouseDown(t.domEvent),this._moved=!1,this.target._fireEvent("dragstart",t))}},e.prototype._prepareMap=function(){var t=this.target.getMap();this._mapDraggable=t.options.draggable,this._mapHitDetect=t.options.hitDetect,t._trySetCursor("move"),t.config({hitDetect:!1,draggable:!1})},e.prototype._restoreMap=function(){var t=this.target.getMap();t._trySetCursor("default"),r(this._mapDraggable)&&(this._mapDraggable=!0),t.config({hitDetect:this._mapHitDetect,draggable:this._mapDraggable}),delete this._mapDraggable,delete this._mapHitDetect},e.prototype._prepareDragHandler=function(){var t=this.target.getMap();this._dragHandler=new Fi(t._panels.mapWrapper||t._containerDOM),this._dragHandler.on("dragging",this._dragging,this),this._dragHandler.on("mouseup",this._endDrag,this),this._dragHandler.enable()},e.prototype._prepareShadow=function(){var t=this.target;this._prepareDragStageLayer(),this._shadow&&this._shadow.remove(),this._shadow=t.copy(),this._shadow.setSymbol(t._getInternalSymbol());var e=this._shadow;if(t.options.dragShadow){var i=ot(e._getInternalSymbol(),.5);e.setSymbol(i)}e.setId(null),this._prepareShadowConnectors()},e.prototype._prepareShadowConnectors=function(){var t=this.target,e=this._shadow,i=this._dragStageLayer._getRenderer().resources,n=[];if(kr._hasConnectors(t))for(var r=kr._getConnectors(t),o=0,s=r.length;o<s;o++){var a=r[o],h=a.config(),l=a._getInternalSymbol();h.symbol=ot(l,.5);var p=void 0;p=a.getConnectSource()===t?new a.constructor(e,a.getConnectTarget(),h):new a.constructor(a.getConnectSource(),e,h),n.push(p),a.getLayer()&&a.getLayer()._getRenderer()&&i.merge(a.getLayer()._getRenderer().resources)}this._shadowConnectors=n,n.push(e),this._dragStageLayer.bringToFront().addGeometry(n)},e.prototype._onTargetUpdated=function(){this._shadow&&this._shadow.setSymbol(this.target._getSymbol())},e.prototype._prepareDragStageLayer=function(){var t=this.target.getMap(),e=this.target.getLayer();this._dragStageLayer=t.getLayer("_maptalks__internal_layer__drag_stage"),this._dragStageLayer||(this._dragStageLayer=new Dr("_maptalks__internal_layer__drag_stage",{drawImmediate:!0}),t.addLayer(this._dragStageLayer));var i=new cn;i.merge(e._getRenderer().resources),this._dragStageLayer._getRenderer().resources=i},e.prototype._dragging=function(t){var e=this.target,i,n=e.getMap()._parseEvent(t.domEvent),r=n.domEvent;if(!(r.touches&&r.touches.length>1)){if(!this._moved)return this._moved=!0,e.on("symbolchange",this._onTargetUpdated,this),this._isDragging=!0,this._prepareShadow(),e.options.dragShadow||e.hide(),void this._shadow._fireEvent("dragstart",n);if(this._shadow){var o=this._shadow.options.dragOnAxis,s=n.coordinate,a=n.containerPoint;this._lastCoord||(this._lastCoord=s),this._lastPoint||(this._lastPoint=a);var h=s.sub(this._lastCoord),l=a.sub(this._lastPoint);"x"===o?(h.y=0,l.y=0):"y"===o&&(h.x=0,l.x=0),this._lastCoord=s,this._lastPoint=a,this._shadow.translate(h),e.options.dragShadow||e.translate(h),n.coordOffset=h,n.pointOffset=l,this._shadow._fireEvent("dragging",n),e._fireEvent("dragging",n)}}},e.prototype._endDrag=function(t){var e=this.target,i=e.getMap();if(this._dragHandler&&(e.off("click",this._endDrag,this),this._dragHandler.disable(),delete this._dragHandler),i){var n=i._parseEvent(t.domEvent);e.off("symbolchange",this._onTargetUpdated,this),this._updateTargetAndRemoveShadow(n),delete this._lastCoord,delete this._lastPoint,this._restoreMap(),this._isDragging=!1,e._fireEvent("dragend",n)}},e.prototype.isDragging=function(){return!!this._isDragging},e.prototype._updateTargetAndRemoveShadow=function(t){var e=this.target,i=e.getLayer(),n=e.getMap();if(!e.options.dragShadow){var r=i.options.drawImmediate;i.config("drawImmediate",!0),e.show(),i.config("drawImmediate",r)}var o=this._shadow;if(o){if(e.options.dragShadow){var s=i.options.drawImmediate;i.config("drawImmediate",!0),e.setCoordinates(o.getCoordinates()),i.config("drawImmediate",s)}o._fireEvent("dragend",t),o.remove(),delete this._shadow}this._shadowConnectors&&(n.getLayer("_maptalks__internal_layer__drag_stage").removeGeometry(this._shadowConnectors),delete this._shadowConnectors),this._dragStageLayer&&this._dragStageLayer.remove()},e}(Di);En.mergeOptions({draggable:!1,dragShadow:!0,dragOnAxis:null}),En.addInitHook("addHandler","draggable",Eo),En.include({isDragging:function(){return this._getParent()?this._getParent().isDragging():!!this.draggable&&this.draggable.isDragging()}}),En.include({startEdit:function(t){return this.getMap()&&this.options.editable?(this.endEdit(),this._editor=new To(this,t),this._editor.start(),this.fire("editstart"),this):this},endEdit:function(){return this._editor&&(this._editor.stop(),delete this._editor,this.fire("editend")),this},isEditing:function(){return!!this._editor&&this._editor.isEditing()}}),En.include({_onEvent:function(t,e){if(this.getMap()){var i=e||this._getEventTypeToFire(t);"contextmenu"===i&&this.listens("contextmenu")&&(bt(t),Ct(t));var n=this._getEventParams(t);this._fireEvent(i,n)}},_getEventTypeToFire:function(t){var e=t.type;return"click"!==e&&"mousedown"!==e||2===t.button&&(e="contextmenu"),e},_getEventParams:function(t){var e=this.getMap(),i={domEvent:t},n=t.touches?t.touches[0]:t;if(n){var r=Tt(n,e._containerDOM);i.coordinate=e.containerPointToCoordinate(r),i.containerPoint=r,i.viewPoint=e.containerPointToViewPoint(r),i.pont2d=e._containerPointToPoint(r)}return i},_onMouseOver:function(t){if(this.getMap()){var e=t,i=this._getEventParams(e);this._fireEvent("mouseover",i)}},_onMouseOut:function(t){if(this.getMap()){var e=t,i=this._getEventParams(e);this._fireEvent("mouseout",i)}}}),En.include({setInfoWindow:function(t){return this.removeInfoWindow(),t instanceof qr?(this._infoWindow=t,this._infoWinOptions=n({},this._infoWindow.options),this._infoWindow.addTo(this),this):(this._infoWinOptions=n({},t),this._infoWindow?this._infoWindow.setOptions(t):this.getMap()&&this._bindInfoWindow(this._infoWinOptions),this)},getInfoWindow:function(){return this._infoWindow?this._infoWindow:null},openInfoWindow:function(t){return this.getMap()?(t||(t=this.getCenter()),this._infoWindow?this._infoWindow.show(t):this._infoWinOptions&&this.getMap()&&(this._bindInfoWindow(this._infoWinOptions),this._infoWindow.show(t)),this):this},closeInfoWindow:function(){return this._infoWindow&&this._infoWindow.hide(),this},removeInfoWindow:function(){return this._unbindInfoWindow(),delete this._infoWinOptions,delete this._infoWindow,this},_bindInfoWindow:function(t){return this._infoWindow=new qr(t),this._infoWindow.addTo(this),this},_unbindInfoWindow:function(){return this._infoWindow&&(this.closeInfoWindow(),this._infoWindow.remove(),delete this._infoWindow),this}});var Lo="position:absolute;",Do=function(t){function e(i){ve(this,e);var n=we(this,t.call(this));return n.layer=i,n._tiles={},n._fadeAnimated=!0,n}return xe(e,t),e.prototype.getMap=function(){return this.layer?this.layer.getMap():null},e.prototype.show=function(){this._container&&(this.render(),this._show())},e.prototype.hide=function(){this._container&&(this._hide(),this.clear())},e.prototype.remove=function(){delete this._tiles,delete this.layer,this._clearCameraCache(),this._removeLayerContainer()},e.prototype.clear=function(){this._removeAllTiles(),this._clearLayerContainer()},e.prototype.setZIndex=function(t){this._zIndex=t,this._container&&(this._container.style.zIndex=t)},e.prototype.prepareRender=function(){},e.prototype.render=function(){this._renderTiles()},e.prototype.drawOnInteracting=function(){var t=this.getMap();t&&(t.isZooming()?this._drawOnZooming():t.isDragRotating()?this._drawOnDragRotating():t.isMoving()&&this._drawOnMoving())},e.prototype._drawOnZooming=function(){if(this._zoomParam){var t=this.getMap(),e=this._zoomParam,i=this._tileZoom;if(this._levelContainers&&this._levelContainers[i])if(t.domCssMatrix)this._prepareTileContainer();else{var n=e.matrix.view;jt(this._levelContainers[i],n)}delete this._zoomParam}},e.prototype._drawOnMoving=function(){var t=this.getMap();t&&(t.getPitch()||this.layer.options.renderOnMoving)&&this.render()},e.prototype._drawOnDragRotating=function(){this.getMap().domCssMatrix?this._prepareTileContainer():this._renderTiles()},e.prototype._renderTiles=function(){this._container||this._createLayerContainer();var t=this.layer._getTiles();if(t){var e=this._getTileQueue(t);if(this._tileZoom=t.zoom,this._prepareTileContainer(),e.length>0){for(var i=this._getTileContainer(t.zoom),n=document.createDocumentFragment(),r=0,o=e.length;r<o;r++)n.appendChild(this._loadTile(e[r]));i.tile.appendChild(n)}this._updateTileSize(),0===e.length&&this.layer.fire("layerload")}},e.prototype._getTileQueue=function(t){var e=this.getMap(),i=t.tiles,n=[],r=e.domCssMatrix,o=this._camOffset;if(this._camOffset&&(r||this._camOffset.isZero())||(this._camOffset=new ze(0,0)),this._preCenterId&&r){for(var s=this._tiles[this._preCenterId].viewPoint,a=void 0,h=i.length-1;h>=0;h--)if(i[h].id===this._preCenterId){a=i[h].viewPoint;break}if(a){var l=a.sub(s);this._camOffset._add(l)}}if(this._tiles){var p=!r&&o&&!o.isZero();for(var u in this._tiles){var c=this._tiles[u];if(this._tiles[u].current=!1,p){var d=c.pos;d._add(o),this._posTileImage(c.el,d),c.viewPoint=d}}}for(var f=i.length-1;f>=0;f--){var g=this._tiles[i[f].id];if(g){if(g.current=!0,r&&(g.viewPoint=i[f].viewPoint),this._reposTiles){var y=i[f].viewPoint;g.viewPoint=y,this._posTileImage(g.el,y)}}else i[f].current=!0,r&&this._camOffset&&i[f].viewPoint._sub(this._camOffset),n.push(i[f])}return this._reposTiles=!1,this._preCenterId=t.center,n},e.prototype._prepareTileContainer=function(){var t=this.getMap(),e=t.domCssMatrix,i=this._getTileContainer(this._tileZoom),n=t.getSize(),r=t._getResolution(this._tileZoom)/t._getResolution();if(this._container.style.display="none",i.style.left&&(i.style.left=null,i.style.top=null),e){parseInt(i.style.width)===n.width&&parseInt(i.style.height)===n.height||(i.style.width=n.width+"px",i.style.height=n.height+"px");var o=void 0;if(1!==r){var s=se();if(t.isZooming()&&this._zoomParam){var a=this._zoomParam.origin,h=t.getPitch();ee(s,s,[(a.x-n.width/2)*(1-r),(a.y-n.height/2)*(1-r)*(h?Math.cos(h*Math.PI/180):1),0])}ae(s,s,e),ie(s,s,[r,r,1]),o=u(s)}else o=u(e);var l=t.getViewPoint().round();t.isZooming()||(i.tile.style[We]="translate3d("+(this._camOffset.x+l.x/r)+"px, "+(this._camOffset.y+l.y/r)+"px, 0px)"),i.style[We]="translate3d("+-l.x+"px, "+-l.y+"px, 0px) matrix3D("+o+")"}else if(this._resetDomCssMatrix(),1!==r){var p=[r,0,0,r,n.width/2*(1-r),n.height/2*(1-r)];jt(i.tile,p)}else Zt(i.tile);this._container.style.display=""},e.prototype._resetDomCssMatrix=function(){var t=this._getTileContainer(this._tileZoom);Zt(t),(t.style.width||t.style.height)&&(t.style.width=null,t.style.height=null)},e.prototype._getTileSize=function(){var t=this.layer.getTileSize(),e=[t.width,t.height],i=this.getMap();return ki.webkit&&(i.isTransforming()||i.isZooming()||i.getZoom()!==this._tileZoom)&&(e[0]++,e[1]++),e},e.prototype._updateTileSize=function(){if(this._tiles){var t=this.getMap().isZooming(),e=this._getTileSize();for(var i in this._tiles)if(this._tiles[i].current){if(e[0]===this._tiles[i].size[0])break;this._tiles[i].size=e;var n=this._tiles[i].el;n&&(n.width=e[0],n.height=e[1]),t&&(n.style[Ve]=null)}}},e.prototype._loadTile=function(t){return this._tiles[t.id]=t,this._createTile(t,this._tileReady.bind(this))},e.prototype._createTile=function(t,e){var i=this._getTileSize(),n=i[0],r=i[1],o=yt("img");return t.el=o,t.size=i,t.pos=t.viewPoint,Ue(o,"load",this._tileOnLoad.bind(this,e,t)),Ue(o,"error",this._tileOnError.bind(this,e,t)),this.layer.options.crossOrigin&&(o.crossOrigin=this.layer.options.crossOrigin),o.style.position="absolute",this._posTileImage(o,t.viewPoint),o.alt="",o.width=n,o.height=r,At(o,0),this.layer.options.cssFilter&&(o.style[Je]=this.layer.options.cssFilter),o.src=t.url,o},e.prototype._tileReady=function(t,e){if(this.layer){t&&this.layer.fire("tileerror",{error:t,tile:e}),e.loaded=Date.now();var i=this.getMap();if(this._fadeAnimated?(At(e.el,0),Pe(this._fadeFrame),this._fadeFrame=Me(this._updateOpacity.bind(this))):(At(e.el,1),e.active=!0),this.layer.fire("tileload",{tile:e}),this._noTilesToLoad()){this.layer.fire("layerload"),this._pruneTimeout&&clearTimeout(this._pruneTimeout);var n=i?i.options.zoomAnimationDuration:250,r=!i||this.layer!==i.getBaseLayer()||!i.options.zoomBackground;this._pruneTimeout=setTimeout(this._pruneTiles.bind(this,r),n+100)}}},e.prototype._tileOnLoad=function(t,e){ki.ielt9?setTimeout(t.bind(this,null,e),0):t.call(this,null,e)},e.prototype._tileOnError=function(t,e){if(this.layer){var i=this.layer.options.errorTileUrl;i?e.el.src=i:e.el.style.display="none",t.call(this,"error",e)}},e.prototype._noTilesToLoad=function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0},e.prototype._updateOpacity=function(){if(this.getMap()){var t=+new Date,e=!1;for(var i in this._tiles){var n=this._tiles[i];if(n.current&&n.loaded){var r=Math.min(1,(t-n.loaded)/200);At(n.el,r),r<1?e=!0:n.active=!0}}e&&(Pe(this._fadeFrame),this._fadeFrame=Me(this._updateOpacity.bind(this)))}},e.prototype._pruneTiles=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.getMap();if(e&&!e.isMoving()){this._abortLoading();var i=this._tileZoom;if(!this.layer.isVisible())return void this._removeAllTiles();for(var n in this._tiles)this._tiles[n].z!==i||this._tiles[n].current||this._removeTile(n);if(t){for(var r in this._tiles)this._tiles[r].z!==i&&this._removeTile(r);for(var o in this._levelContainers)+o!==i&&(mt(this._levelContainers[o]),this._removeTilesAtZoom(o),delete this._levelContainers[o])}}},e.prototype._removeTile=function(t){var e=this._tiles[t];e&&(mt(e.el),delete this._tiles[t],this.layer.fire("tileunload",{tile:e}))},e.prototype._removeTilesAtZoom=function(t){for(var e in this._tiles)+this._tiles[e].z==+t&&this._removeTile(e)},e.prototype._removeAllTiles=function(){for(var t in this._tiles)this._removeTile(t)},e.prototype._getTileContainer=function(t){if(this._levelContainers||(this._levelContainers={}),!this._levelContainers[t]){var e=this._levelContainers[t]=yt("div","maptalks-tilelayer-level");e.style.cssText=Lo;var i=yt("div");i.style.cssText=Lo+";will-change:transform",e.appendChild(i),e.tile=i,this._container.appendChild(e)}return this._levelContainers[t]},e.prototype._createLayerContainer=function(){var t=this._container=yt("div","maptalks-tilelayer");t.style.cssText=Lo,this._zIndex&&(t.style.zIndex=this._zIndex),("front"===this.layer.options.container?this.getMap()._panels.frontLayer:this.getMap()._panels.backLayer).appendChild(t)},e.prototype._clearLayerContainer=function(){this._container&&(this._container.innerHTML=""),delete this._levelContainers},e.prototype._removeLayerContainer=function(){this._container&&mt(this._container),delete this._container,delete this._levelContainers},e.prototype.getEvents=function(){return{_zoomstart:this.onZoomStart,"_touchzoomstart _dragrotatestart":this._pruneTiles,_zooming:this.onZooming,_zoomend:this.onZoomEnd,_dragrotateend:this.render}},e.prototype._canTransform=function(){return ki.any3d||ki.ie9},e.prototype._show=function(){this._container.style.display=""},e.prototype._hide=function(){this._container.style.display="none"},e.prototype._posTileImage=function(t,e){t.style.left=e.x+"px",t.style.top=e.y+"px"},e.prototype.onZoomStart=function(){this._fadeAnimated=!1,this._mapOffset=this.getMap().offsetPlatform().round(),this._canTransform()||this._hide(),this._pruneTiles(),this._updateTileSize()},e.prototype.onZooming=function(t){this._zoomParam=t},e.prototype.onZoomEnd=function(t){if(delete this._zoomParam,this._pruneTimeout&&clearTimeout(this._pruneTimeout),this._clearCameraCache(),this._reposTiles=t.to===this._tileZoom,this._levelContainers){var e=this._levelContainers[this._tileZoom];this._canTransform()?e&&this._mapOffset&&(e.style.left=this._mapOffset.x+"px",e.style.top=this._mapOffset.y+"px"):(e&&(e.style.display="none"),this._show())}this._fadeAnimated=!ki.mobile&&!0},e.prototype._clearCameraCache=function(){delete this._preCenterId,delete this._camOffset},e.prototype._abortLoading=function(){var t=function(){return!1};for(var e in this._tiles)if(this._tiles[e].z!==this._tileZoom||!this._tiles[e].current){var i=this._tiles[e].el;i.onload=t,i.onerror=t,i.loaded||(i.src=Le,mt(i))}},e}(Ri);vn.registerRenderer("dom",Do);var Ro=function(){function t(e){ve(this,t),this._queue=[],this._cache={},e||(e=128),this.capacity=e}return t.prototype.add=function(t,e){this._cache[t]=e,this._queue.push(t),this._expireCache()},t.prototype.get=function(t){return this._cache[t]},t.prototype.remove=function(t){delete this._cache[t]},t.prototype._expireCache=function(){var t=this;this._expTimeout&&clearTimeout(this._expTimeout),this._expTimeout=setTimeout((function(){var e=t._queue.length;if(e>t.capacity)for(var i=t._queue.splice(0,e-t.capacity),n=i.length-1;n>=0;n--)delete t._cache[i[n]]}),1e3)},t}(),Ao=function(t){function e(i){ve(this,e);var n=we(this,t.call(this,i));return n.propertyOfPointOnTile="--maptalks-tile-point",n.propertyOfTileId="--maptalks-tile-id",n.propertyOfTileZoom="--maptalks-tile-zoom",n._mapRender=i.getMap()._getRenderer(),!be&&n.layer.options.cacheTiles&&(n._tileCache=new Ro),n._tileQueue={},n}return xe(e,t),e.prototype.draw=function(){var t=this.getMap();if(t.getPitch())return console&&console.warn("TileLayer with canvas renderer can't be pitched, use dom renderer ('renderer' : 'dom') instead."),void this.clear();var e=this.layer,i=e._getTiles();if(i){var n=this.prepareCanvas();if(!n||n.intersects(this._extent2D)){this._tileRended||(this._tileRended={});var r=this._tileRended,o=i.tiles,s=this._tileCache,a=e.getTileSize(),h=t.getZoom();this._tileZoom=i.zoom,this._tileRended={},this.canvas||this.createCanvas(),this.context.setTransform(1,0,0,1,0,0),this._totalTileToLoad=this._tileToLoadCounter=0;for(var l=o.length-1;l>=0;l--){var p=o[l],u=o[l].id;if(h===this._tileZoom){var c=new $e(p.point,p.point.add(a.toPoint()));if(!this._extent2D.intersects(c)||n&&!n.intersects(c))continue}var d=r[u]||(s?s.get(u):null);this._totalTileToLoad++,d?(this._drawTile(p.point,d),this._tileRended[u]=d):(this._tileToLoadCounter++,this._tileQueue[u+"@"+p.point.toString()]=p)}0===this._tileToLoadCounter?this.completeRender():this.getMap().isInteracting()||this._scheduleLoadTileQueue()}else this.completeRender()}else this.completeRender()},e.prototype.drawOnInteracting=function(){this.draw()},e.prototype.needToRedraw=function(){var e=this.getMap();return!!e.isDragRotating()||!e.isZooming()&&t.prototype.needToRedraw.call(this)},e.prototype.hitDetect=function(){return!1},e.prototype._scheduleLoadTileQueue=function(){this._loadTileQueue()},e.prototype._loadTileQueue=function(){function t(){if(!be){if(!i._tileRended)return;i._tileCache&&i._tileCache.add(this[i.propertyOfTileId],this),i._tileRended[this[i.propertyOfTileId]]=this}i._drawTileAndRequest(this)}function e(){i._clearTileRectAndRequest(this)}var i=this;for(var n in this._tileQueue)if(this._tileQueue.hasOwnProperty(n)){var r=n.split("@")[0],o=this._tileQueue[n];delete this._tileQueue[n],this._tileCache&&this._tileCache[r]?this._drawTileAndRequest(this._tileCache[r]):this._loadTile(r,o,t,e)}},e.prototype._loadTile=function(t,e,i,n){var r=this.layer.options.crossOrigin,o=this.layer.getTileSize(),s=new Image;s.width=o.width,s.height=o.height,s[this.propertyOfTileId]=t,s[this.propertyOfPointOnTile]=e.point,s[this.propertyOfTileZoom]=e.z,s.onload=i,s.onabort=n,s.onerror=n,r&&(s.crossOrigin=r),d(s,[e.url])},e.prototype._drawTile=function(t,e){if(t&&this.getMap()){var i=this.getMap(),n=i.getZoom(),r=this.layer.getTileSize(),o=this.context,s=i._pointToContainerPoint(t,this._tileZoom)._round(),a=i.getBearing(),h=a||n!==this._tileZoom,l=s.x,p=s.y;if(h){if(o.save(),o.translate(l,p),a&&o.rotate(-a*Math.PI/180),n!==this._tileZoom){var u=i._getResolution(this._tileZoom)/i._getResolution();o.scale(u,u)}l=p=0}if(Qe.image(o,e,l,p,r.width,r.height),this.layer.options.debug){var c=new ze(l,p),d=this.layer.options.debugOutline,f=e[this.propertyOfTileId].split("__");o.save(),o.strokeStyle=d,o.fillStyle=d,o.strokeWidth=10,o.font="15px monospace",Qe.rectangle(o,c,r,1,0),Qe.fillText(o,"x:"+f[1]+", y:"+f[0]+", z:"+f[2],c.add(10,20),d),Qe.drawCross(o,c.add(r.width/2,r.height/2),2,d),o.restore()}h&&o.restore(),e=null}},e.prototype._drawTileAndRequest=function(t){if(this.getMap()&&this._tileZoom===t[this.propertyOfTileZoom]){this._tileToLoadCounter--;var e=t[this.propertyOfPointOnTile];this._drawTile(e,t),be||this.setCanvasUpdated(),0===this._tileToLoadCounter&&this._onTileLoadComplete()}},e.prototype._onTileLoadComplete=function(){this.completeRender()},e.prototype._clearTileRectAndRequest=function(t){this.getMap()&&this.getMap().getZoom()===t[this.propertyOfTileZoom]&&(be||this.setCanvasUpdated(),0==--this._tileToLoadCounter&&this._onTileLoadComplete())},e.prototype.onRemove=function(){delete this._mapRender,delete this._tileCache,delete this._tileRended,delete this._tileQueue,delete this._tileZoom},e}(un);vn.registerRenderer("canvas",Ao);var Io=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype._loadTile=function(t,e,i,n){var r=this.layer.getTileSize(),o=this.canvas.constructor,s=this.getMap(),a=ki.retina?2:1,h=Qe.createCanvas(r.width*a,r.height*a,o);h.layer=this.layer,h[this.propertyOfTileId]=t,h[this.propertyOfPointOnTile]=e.point,h[this.propertyOfTileZoom]=e.z;var l=new Ke(s.pointToCoordinate(e.point),s.pointToCoordinate(e.point.add(r.toPoint())));this.layer.drawTile(h,{url:e.url,point:e.point,center:s.pointToCoordinate(e.point.add(r.width/2,r.height/2)),extent:l,z:e.z,x:e.x,y:e.y},(function(t){t?n.call(h):i.call(h)}))},e}(Ao);xo.registerRenderer("canvas",Io);var zo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.checkResources=function(){var t=this._geosToCheck;if(this._resourceChecked||t||(t=this.layer._geoList),!S(t))return[];for(var e=[],i={},n=t.length-1;n>=0;n--){var r,o=t[n]._getExternalResources();if(o.length)if(this.resources)for(var s=0;s<o.length;s++){var a=o[s][0];this.resources.isResourceLoaded(o[s])||i[a]||(e.push(o[s]),i[a]=1)}else e.push.apply(e,o)}return this._resourceChecked=!0,delete this._geosToCheck,e},e.prototype._addGeoToCheckRes=function(t){t&&(Array.isArray(t)||(t=[t]),this._geosToCheck||(this._geosToCheck=[]),_(this._geosToCheck,t))},e.prototype.onGeometryAdd=function(t){this._addGeoToCheckRes(t),fe(this)},e.prototype.onGeometryRemove=function(){fe(this)},e.prototype.onGeometrySymbolChange=function(t){this._addGeoToCheckRes(t.target),fe(this)},e.prototype.onGeometryShapeChange=function(){fe(this)},e.prototype.onGeometryPositionChange=function(){fe(this)},e.prototype.onGeometryZIndexChange=function(){fe(this)},e.prototype.onGeometryShow=function(){fe(this)},e.prototype.onGeometryHide=function(){fe(this)},e.prototype.onGeometryPropertiesChange=function(){fe(this)},e}(un),jo=function(t){function e(){return ve(this,e),we(this,t.apply(this,arguments))}return xe(e,t),e.prototype.checkResources=function(){var e=this,i=t.prototype.checkResources.apply(this,arguments),n=this.layer.getStyle();return n&&(Array.isArray(n)||(n=[n]),n.forEach((function(t){for(var n=Vt(t.symbol,!0),r=0,o=n.length;r<o;r++)e.resources.isResourceLoaded(n[r])||i.push(n[r])}))),i},e.prototype.needToRedraw=function(){var e=this.getMap();return!(!e.isInteracting()||!this.layer.options.enableHeight)||!(e.isZooming()&&!e.getPitch()&&!this._hasPoint&&this.layer.constructor===Dr)&&t.prototype.needToRedraw.call(this)},e.prototype.draw=function(){if(this.getMap()){if(!this.layer.isVisible()||this.layer.isEmpty())return this.clearCanvas(),void this.completeRender();this.prepareCanvas(),this.drawGeos(),this.completeRender()}},e.prototype.isBlank=function(){return!!this.context&&!this.context.canvas._drawn},e.prototype.drawOnInteracting=function(){if(this._geosToDraw){this._getDisplayExtent();for(var t=0,e=this._geosToDraw.length;t<e;t++)this._geosToDraw[t]._paint(this._displayExtent)}},e.prototype.show=function(){this.layer.forEach((function(t){t._repaint()})),t.prototype.show.apply(this,arguments)},e.prototype.forEachGeo=function(t,e){this.layer.forEach(t,e)},e.prototype.drawGeos=function(){this._getDisplayExtent(),this.prepareToDraw(),this.forEachGeo(this.checkGeo,this);for(var t=0,e=this._geosToDraw.length;t<e;t++)this._geosToDraw[t]._paint(this._displayExtent)},e.prototype.prepareToDraw=function(){this._hasPoint=!1,this._geosToDraw=[]},e.prototype.checkGeo=function(t){if(t&&t.isVisible()&&t.getMap()&&t.getLayer()&&t.getLayer().isCanvasRender()){var e=t._getPainter(),i=e.get2DExtent(this.resources);i&&i.intersects(this._displayExtent)&&(e.hasPoint()&&(this._hasPoint=!0),this._geosToDraw.push(t))}},e.prototype.onZoomEnd=function(){delete this._extent2D,t.prototype.onZoomEnd.apply(this,arguments)},e.prototype.onRemove=function(){this.forEachGeo((function(t){t.onHide()})),delete this._geosToDraw},e.prototype.onGeometryPropertiesChange=function(e){e&&this.layer._styleGeometry(e.target),t.prototype.onGeometryPropertiesChange.call(this,e)},e.prototype._getDisplayExtent=function(){var t=this._extent2D;if(this._maskExtent){if(!this._maskExtent.intersects(t))return void this.completeRender();t=t.intersection(this._maskExtent)}this._displayExtent=t},e.prototype.identify=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this._geosToDraw;return i?this.layer._hitGeos(i,t,e):[]},e}(zo);Dr.registerRenderer("canvas",jo);var Zo=function(t){function e(i){ve(this,e);var n=we(this,t.call(this));return n.map=i,n._handlerQueue={},n}return xe(e,t),e.prototype.callInNextFrame=function(t){this._handlerQueue.push(t)},e.prototype.executeFrameCallbacks=function(){var t=this._handlerQueue;this._handlerQueue=[];for(var e=0,i=t.length;e<i;e++)t[e]()},e.prototype.panAnimation=function(t,e,i){if(!this._panPlayer||"running"!==this._panPlayer.playState){var n=this.map,r=n._getPrjCenter().copy(),o=n.getProjection().project(t),s=o.sub(r);if(n.options.panAnimation){var a=void 0;a=e||n.options.panAnimationDuration;var h=n._getRenderer(),l=function(t){h.callInNextFrame(t)},p=this._panPlayer=Nn.animate({distance:s},{easing:"out",duration:a,framer:l},(function(t){if(n.isRemoved())p.finish();else if("running"!==p.playState||!n.isZooming()&&!n.isDragRotating())if("running"===p.playState&&t.styles.distance){var e=t.styles.distance;n._setPrjCenter(r.add(e)),n.onMoving()}else"finished"===p.playState&&(p._interupted||n._setPrjCenter(o),i&&i(),n.onMoveEnd());else p.finish()}));p.play(),n.isMoving()||n.onMoveStart()}else n.onMoveEnd()}},e.prototype.stopPanAnimation=function(){this._panPlayer&&(this._panPlayer._interupted=!0,this._panPlayer.finish()),delete this._panPlayer},e.prototype.offsetPlatform=function(t){if(!this.map._panels.front)return this;if(0===t.x&&0===t.y)return this;var e=this.map.offsetPlatform().add(t)._round(),i=this.map._panels;return i.backLayer.firstChild&&Pt(i.back,e),(i.frontLayer.firstChild||i.ui.firstChild)&&Pt(this.map._panels.front,e),this},e.prototype.resetContainer=function(){if(this.map&&(this.map._resetMapViewPoint(),this.map._panels.front)){var t=new ze(0,0);Pt(this.map._panels.back,t),Pt(this.map._panels.front,t)}},e.prototype.onZoomEnd=function(){this.resetContainer()},e.prototype.onLoad=function(){this._frameLoop()},e}(Ri),Ho=function(t){function e(i){ve(this,e);var n=we(this,t.call(this,i));return n._containerIsCanvas=!!i._containerDOM.getContext,n._registerEvents(),n._loopTime=0,n}return xe(e,t),e.prototype.load=function(){this.initContainer()},e.prototype.renderFrame=function(){if(!this.map)return!1;this.map._fireEvent("framestart"),this.updateMapDOM();var t=this._getAllLayerToRender();return this.drawLayers(t),this.drawLayerCanvas(t),this.map._fireEvent("frameend"),this._state=this._getMapState(),delete this._spatialRefChanged,this._fireLayerLoadEvents(),this.executeFrameCallbacks(),this._needRedraw=!1,!0},e.prototype.updateMapDOM=function(){var t=this.map;if(!t.isInteracting()||t.isMoving()){var e=t._getViewPointOffset();e&&t.offsetPlatform(e)}},e.prototype.drawLayers=function(t){for(var e=this.map,i=e.isInteracting(),n=[],r=[],o=e.options.fpsOnInteracting||0,s=0===o?0:1e3/o,a=this.map.options.layerCanvasLimitOnInteracting,h=t.length,l=0,p=h-1;p>=0;p--){var u=t[p];if(u.isVisible()){var c=u.isCanvasRender();c&&n.push(u.getId());var d=u._getRenderer();if(d){var f=this._checkLayerRedraw(u);if(c&&d.isCanvasUpdated()&&(f||r.push(u.getId()),this.setToRedraw()),delete d.__shouldZoomTransform,f){if(i&&c){if(a>0&&h-1-p>a){u._getRenderer().clearCanvas();continue}l+=this._drawCanvasLayerOnInteracting(u,l,s)}else i&&d.drawOnInteracting?(d.prepareRender&&d.prepareRender(),d.drawOnInteracting(this._eventParam)):d.render();c&&(r.push(u.getId()),this.setToRedraw())}else c&&i&&(e.isZooming()&&!e.getPitch()?(d.prepareRender(),d.__shouldZoomTransform=!0):(e.getPitch()||e.isDragRotating())&&d.clearCanvas())}}}var g=this._canvasIds||[],y=this._updatedIds||[];this._canvasIds=n,this._updatedIds=r,this._needToRedraw()||g.join("---")===n.join("---")&&y.join("---")===r.join("---")||this.setToRedraw()},e.prototype._checkLayerRedraw=function(t){if(this.isSpatialReferenceChanged())return!0;var e=this.map,i=t._getRenderer();return t.isCanvasRender()?i.isAnimating&&i.isAnimating()||i.needToRedraw():!(!i.needToRedraw||!i.needToRedraw())||e.isInteracting()||this.isStateChanged()},e.prototype._drawCanvasLayerOnInteracting=function(t,e,i){var n=this.map,r=t._getRenderer(),o=r.getDrawTime(),s=0===i||i>0&&e+o<=i;return r.drawOnInteracting&&(s||n.isZooming()&&t.options.forceRenderOnZooming||n.isMoving()&&t.options.forceRenderOnMoving||n.isDragRotating()&&t.options.forceRenderOnDragRotating)?(r.prepareRender(),r.prepareCanvas(),r.drawOnInteracting(this._eventParam),o):(n.isZooming()&&!n.getPitch()?(r.prepareRender(),r.__shouldZoomTransform=!0):(n.getPitch()||n.isDragRotating())&&r.clearCanvas(),r.drawOnInteracting&&!s&&r.skipDrawOnInteracting(this._eventParam),0)},e.prototype._fireLayerLoadEvents=function(){if(this._updatedIds&&this._updatedIds.length>0){var t=this.map;this._updatedIds.reverse().forEach((function(e){var i=t.getLayer(e);if(i){var n=i._getRenderer();n&&n.isRenderComplete()&&i.fire("layerload")}}))}},e.prototype._needToRedraw=function(){return this._needRedraw},e.prototype.setToRedraw=function(){this._needRedraw=!0},e.prototype.drawLayerCanvas=function(t){if(this.map&&(this._needToRedraw()||this.isStateChanged())){this.canvas||this.createCanvas(),this.map._fireEvent("renderstart",{context:this.context}),this._updateCanvasSize()||this.clearCanvas();for(var e=this.map.isInteracting(),i=this.map.options.layerCanvasLimitOnInteracting,n=t.length,r=[],o=0;o<n;o++)if(t[o].isVisible()&&t[o].isCanvasRender()){var s=t[o]._getRenderer();if(!(!s||e&&s.__isEmpty)){var a=this._getLayerImage(t[o]);a&&a.image&&r.push([t[o],a])}}n=r.length;for(var h,l=e&&i>=0&&n>i?n-i:0;l<n;l++)this._drawLayerCanvasImage.apply(this,r[l]);this._drawCenterCross(),this.map._fireEvent("renderend",{context:this.context})}},e.prototype.updateMapSize=function(t){if(t&&!this._containerIsCanvas){var e=t.width+"px",i=t.height+"px",n=this.map._panels;n.mapWrapper.style.width=e,n.mapWrapper.style.height=i,this._updateCanvasSize()}},e.prototype.getMainPanel=function(){return this.map?this._containerIsCanvas?this.map._containerDOM:this.map._panels?this.map._panels.mapWrapper:null:null},e.prototype.toDataURL=function(t){return this.canvas?this.canvas.toDataURL(t):null},e.prototype.remove=function(){this._resizeInterval&&clearInterval(this._resizeInterval),delete this.context,delete this.canvas,delete this.map,delete this._spatialRefChanged,this._cancelFrameLoop()},e.prototype.hitDetect=function(t){var e=this.map;if(e&&e.options.hitDetect&&!e.isInteracting()){for(var i=e._getLayers(),n="default",r=e.options.hitDetectLimit||0,o=0,s=i.length-1;s>=0;s--){var a=i[s];if(!a.isEmpty||!a.isEmpty()){var h=a._getRenderer();if(h&&h.hitDetect&&(!h.isBlank||!h.isBlank())){if("default"!==a.options.cursor&&h.hitDetect(t)){n=a.options.cursor||"pointer";break}if(o++,r>0&&o>r)break}}}e._trySetCursor(n)}},e.prototype._getLayerImage=function(t){return t&&t._getRenderer()&&t._getRenderer().getCanvasImage?t._getRenderer().getCanvasImage():null},e.prototype.initContainer=function(){function t(t,i,n,r){var o=yt("div",i);return n&&(o.style.cssText=n),e[t]=o,r||Mt(o),o}var e=this.map._panels,i=this.map._containerDOM;if(!this._containerIsCanvas){i.innerHTML="";var n="position:absolute;top:0px;left:0px;",r=t("mapWrapper","maptalks-wrapper","position:absolute;overflow:hidden;",!0),o=t("allLayers","maptalks-all-layers",n+"padding:0px;margin:0px;z-index:0",!0),s=t("backStatic","maptalks-back-static",n+"z-index:0;",!0),a=t("back","maptalks-back",n+"will-change:transform;z-index:1;"),h=t("backLayer","maptalks-back-layer",n),l=t("canvasContainer","maptalks-canvas-layer",n+"border:none;z-index:2;"),p=t("frontStatic","maptalks-front-static",n+"z-index:3;",!0),u=t("front","maptalks-front",n+"z-index:4;",!0),c=t("frontLayer","maptalks-front-layer",n+"z-index:0;"),d=t("ui","maptalks-ui",n+"border:none;z-index:1;",!0),f=t("control","maptalks-control","z-index:1",!0);i.appendChild(r),o.appendChild(s),a.appendChild(h),o.appendChild(a),o.appendChild(l),u.appendChild(c),o.appendChild(p),o.appendChild(u),u.appendChild(d),r.appendChild(o),r.appendChild(f),this.createCanvas(),this.resetContainer();var g=this.map._getContainerDomSize();this.updateMapSize(g)}},e.prototype.isStateChanged=function(){var t=this._state,e=this._getMapState();return!t||!ge(t,e)},e.prototype.isSpatialReferenceChanged=function(){return this._spatialRefChanged},e.prototype._getMapState=function(){var t=this.map,e=t._getPrjCenter();return{x:e.x,y:e.y,zoom:t.getZoom(),pitch:t.getPitch(),bearing:t.getBearing(),width:t.width,height:t.height}},e.prototype._frameLoop=function(){var t=this;this.map?(this.renderFrame(),this._animationFrame=Me((function(){t._frameLoop()}))):this._cancelFrameLoop()},e.prototype._cancelFrameLoop=function(){this._animationFrame&&Pe(this._animationFrame)},e.prototype._drawLayerCanvasImage=function(t,e){var i=this.context,n=e.point.multi(ki.retina?2:1),r=e.image;if(!(n.x+r.width<=0||n.y+r.height<=0)){var s=t.options.opacity;if(o(s)||(s=1),!(s<=0)){var a=e.opacity;if(o(a)||(a=1),!(a<=0)){var h=i.globalAlpha;s<1&&(i.globalAlpha*=s),a<1&&(i.globalAlpha*=a),t.options.cssFilter&&(i.filter=t.options.cssFilter);var l=this._zoomMatrix,p=!!t._getRenderer().__shouldZoomTransform;l&&p&&(i.save(),i.setTransform.apply(i,l)),i.drawImage(r,n.x,n.y),l&&p&&i.restore(),"none"!==i.filter&&(i.filter="none"),i.globalAlpha=h}}}},e.prototype._drawCenterCross=function(){var t=this.map.options.centerCross;if(t){var e=this.context,i=new ze(this.canvas.width/2,this.canvas.height/2);l(t)?t(e,i):Qe.drawCross(this.context,i,2,"#f00")}},e.prototype._getAllLayerToRender=function(){return this.map._getLayers()},e.prototype.clearCanvas=function(){this.canvas&&Qe.clearRect(this.context,0,0,this.canvas.width,this.canvas.height)},e.prototype._updateCanvasSize=function(){if(!this.canvas||this._containerIsCanvas)return!1;var t,e=this.map.getSize(),i=this.canvas,n=ki.retina?2:1;return(e.width*n!==i.width||e.height*n!==i.height)&&(i.height=n*e.height,i.width=n*e.width,i.style&&(i.style.width=e.width+"px",i.style.height=e.height+"px"),!0)},e.prototype.createCanvas=function(){this._containerIsCanvas?this.canvas=this.map._containerDOM:(this.canvas=yt("canvas"),this._updateCanvasSize(),this.map._panels.canvasContainer.appendChild(this.canvas)),this.context=this.canvas.getContext("2d")},e.prototype._checkSize=function(){this.map&&!this.map.isInteracting()&&(St(this.map._containerDOM),this.map.checkSize())},e.prototype._setCheckSizeInterval=function(t){var e=this;clearInterval(this._resizeInterval),this._checkSizeInterval=t,this._resizeInterval=setInterval((function(){!e.map||e.map.isRemoved()?clearInterval(e._resizeInterval):e._checkSize()}),this._checkSizeInterval)},e.prototype._registerEvents=function(){var t=this,e=this.map;e.options.checkSize&&!be&&"undefined"!=typeof window&&this._setCheckSizeInterval(1e3),ki.mobile||e.on("_mousemove",this._onMapMouseMove,this),e.on("_dragrotatestart _dragrotating _dragrotateend _movestart _moving _moveend _zoomstart",(function(e){t._eventParam=e})),e.on("_zooming",(function(i){e.getPitch()||(t._zoomMatrix=i.matrix.container),t._eventParam=i})),e.on("_zoomend",(function(e){t._eventParam=e,delete t._zoomMatrix})),e.on("_spatialreferencechange",(function(){t._spatialRefChanged=!0}))},e.prototype._onMapMouseMove=function(t){var e=this,i=this.map;!i.isInteracting()&&i.options.hitDetect&&(this._hitDetectFrame&&Pe(this._hitDetectFrame),this._hitDetectFrame=Me((function(){e.hitDetect(t.containerPoint)})))},e.prototype._getCanvasLayers=function(){return this.map._getLayers((function(t){return t.isCanvasRender()}))},e}(Zo);bn.registerRenderer("canvas",Ho);var Fo=Object.freeze({ResourceCache:cn,CanvasRenderer:un,MapRenderer:Zo,MapCanvasRenderer:Ho,Renderable:sn,TileLayerDomRenderer:Do,TileLayerCanvasRenderer:Ao,CanvasTileLayerRenderer:Io,OverlayLayerCanvasRenderer:zo,VectorLayerCanvasRenderer:jo,CanvasLayerRenderer:wo}),Go={_getRenderPoints:function(){return[[this._getCenter2DPoint(this.getMap().getMaxNativeZoom())],null]}};Zn.include(Go),lr.include(Go),ar.include(Go),_r.include(Go),pr.include({_getRenderPoints:function(t){var e=this.getMap();if("vertex"===t){for(var i=this._trimRing(this.getShell()),n=[],r=0,o=i.length;r<o;r++)n.push(e.coordinateToPoint(i[r],e.getMaxNativeZoom()));return[n,null]}return[[e.coordinateToPoint(this.getCenter(),e.getMaxNativeZoom())],null]}});var No={_getRenderPoints:function(t){var e=this.getMap(),i=e.getMaxNativeZoom(),n=void 0,r=null;if("vertex"===t)(n=this._getPath2DPoints(this._getPrjCoordinates(),!1,i))&&n.length>0&&Array.isArray(n[0])&&(n=n[0].concat(n[1]));else if("line"===t){n=[],r=[];var o=this._getPath2DPoints(this._getPrjCoordinates(),!1,i),s;if(o.length>0&&Array.isArray(o[0]))for(var a=void 0,h=1,l=o.length;h<l;h++){a=o[h],this instanceof Yn&&a.length>0&&!a[0].equals(a[a.length-1])&&a.push(a[0]);for(var p=1,u=a.length;p<u;p++)n.push(a[p].add(a[p-1])._multi(.5)),r.push([a[p-1],a[p]])}else{this instanceof Yn&&o.length>0&&!o[0].equals(o[o.length-1])&&o.push(o[0]);for(var c=1,d=o.length;c<d;c++)n.push(o[c].add(o[c-1])._multi(.5)),r.push([o[c-1],o[c]])}}else if("vertex-first"===t){var f=this._getPrjCoordinates()[0];n=[e._prjToPoint(f,i)]}else if("vertex-last"===t){var g=this._getPrjCoordinates()[this._getPrjCoordinates().length-1];n=[e._prjToPoint(g,i)]}else{var y=this._getProjection().project(this.getCenter());n=[e._prjToPoint(y,i)]}return[n,r]}};qn.include(No),Yn.include(No),En.include({_redrawWhenPitch:function(){return!1},_redrawWhenRotate:function(){return!1}});var Wo={_redrawWhenPitch:function(){return!0},_redrawWhenRotate:function(){return this instanceof lr||this instanceof _r},_paintAsPolygon:function(){var t=this.getMap();return t.getPitch()||this instanceof lr&&t.getBearing()},_getPaintParams:function(){var t=this.getMap();if(this._paintAsPolygon())return Yn.prototype._getPaintParams.call(this,!0);var e=this._getPrjCoordinates(),i=t._prjToPoint(e,t.getMaxNativeZoom()),n=this._getRenderSize();return[i,n.width,n.height]},_paintOn:function(){return this._paintAsPolygon()?Qe.polygon.apply(Qe,arguments):Qe.ellipse.apply(Qe,arguments)},_getRenderSize:function(){var t=this.getMap(),e=t.getScale(),i=this.getCenter(),n=this.getRadius(),r=t.locate(i,n,0),o=t.coordinateToContainerPoint(i).distanceTo(t.coordinateToContainerPoint(r));return new je(o*=e,o)}};lr.include(Wo,{_getRenderSize:function(){var t=this.getWidth(),e=this.getHeight(),i=this.getMap();return i.distanceToPixel(t/2,e/2,i.getMaxNativeZoom())}}),ar.include(Wo),pr.include({_getPaintParams:function(){var t,e=this.getMap().getMaxNativeZoom(),i=this._getPrjShell();return[this._getPath2DPoints(i,!1,e)]},_paintOn:Qe.polygon}),_r.include(Wo,{_redrawWhenPitch:function(){return!0},_getPaintParams:function(){var t=this.getMap();return t.getPitch()?Yn.prototype._getPaintParams.call(this,!0):[t._prjToPoint(this._getPrjCoordinates(),t.getMaxNativeZoom()),this._getRenderSize().width,[this.getStartAngle(),this.getEndAngle()]]},_paintOn:function(){if(this.getMap().getPitch())return Qe.polygon.apply(Qe,arguments);var t=this.getMap().getBearing(),e=arguments;return t&&(e[3]=e[3].slice(0),e[3][0]+=t,e[3][1]+=t),Qe.sector.apply(Qe,e)}}),qn.include({arrowStyles:{classic:[3,4]},_getArrowPoints:function(t,e,i,n,r){r||(r=0);var o=i*n[0],s=i*n[1]+r,a=o/2+r,h=e.sub(t)._unit(),l=e.sub(h.multi(s));h._perp();var p=l.add(h.multi(a));return h._multi(-1),[p,e,l.add(h.multi(a)),p]},_getPaintParams:function(){var t=this._getPrjCoordinates();return[this._getPath2DPoints(t,!1,this.getMap().getMaxNativeZoom())]},_paintOn:function(t,e,i,n,r){Qe.path(t,e,i,null,r),this._paintArrow(t,e,i)},_getArrowPlacement:function(){return this.options.arrowPlacement},_getArrowStyle:function(){var t=this.options.arrowStyle;return t?Array.isArray(t)?t:this.arrowStyles[t]:null},_getArrows:function(t,e,i){var n=this._getArrowStyle();if(!n||t.length<2)return[];for(var r,o=t.length>0&&Array.isArray(t[0])?t:[t],s=this._getArrowPlacement(),a=[],h=o.length-1;h>=0;h--)if("vertex-first"!==s&&"vertex-firstlast"!==s||a.push(this._getArrowPoints(o[h][1],o[h][0],e,n,i)),"vertex-last"===s||"vertex-firstlast"===s)a.push(this._getArrowPoints(o[h][o[h].length-2],o[h][o[h].length-1],e,n,i));else if("point"===s)for(var l=0,p=o[h].length-1;l<p;l++)a.push(this._getArrowPoints(o[h][l],o[h][l+1],e,n,i));return a},_paintArrow:function(t,e,i){var n=this._getInternalSymbol().lineWidth;(!n||n<3)&&(n=3);var r=this._getArrows(e,n);if(r.length){t.setLineDash&&t.setLineDash([]);for(var o=r.length-1;o>=0;o--)t.fillStyle=t.strokeStyle,Qe.polygon(t,r[o],i,i)}}}),Yn.include({_getPaintParams:function(t){var e=this.getMap().getMaxNativeZoom(),i=this._getPrjShell(),n=this._getPath2DPoints(i,t,e),r=n.length>0&&Array.isArray(n[0]);r&&(n=[[n[0]],[n[1]]]);var o=this._getPrjHoles(),s=[];if(o&&o.length>0)for(var a=0;a<o.length;a++){var h=this._getPath2DPoints(o[a],t,e);Array.isArray(h)&&r?Array.isArray(h[0])?(n[0].push(h[0]),n[1].push(h[1])):n[0].push(h):s.push(h)}return r||_(n=[n],s),[n]},_paintOn:Qe.polygon}),t.Util=li,t.DomUtil=Ye,t.StringUtil=Fe,t.MapboxUtil=Re,t.ui=to,t.control=go,t.renderer=Fo,t.symbolizer=hi,t.animation=Wn,t.Browser=ki,t.Ajax=Oi,t.Canvas=Qe,t.Class=Ri,t.Eventable=Ei,t.JSONAble=Ii,t.Handlerable=zi,t.Handler=Di,t.DragHandler=Fi,t.MapTool=or,t.DrawTool=Ir,t.AreaTool=Hr,t.DistanceTool=jr,t.SpatialReference=wn,t.INTERNAL_LAYER_PREFIX="_maptalks__internal_layer_",t.GEOMETRY_COLLECTION_TYPES=ye,t.GEOJSON_TYPES=_e,t.projection=on,t.measurer=Ki,t.Coordinate=Xe,t.CRS=Gi,t.Extent=Ke,t.Point=ze,t.PointExtent=$e,t.Size=je,t.Transformation=Ni,t.Map=bn,t.Layer=fn,t.TileLayer=vn,t.WMSTileLayer=mo,t.CanvasTileLayer=xo,t.OverlayLayer=Er,t.VectorLayer=Dr,t.CanvasLayer=bo,t.ParticleLayer=Po,t.TileSystem=yn,t.TileConfig=_n,t.ArcCurve=dr,t.Circle=ar,t.ConnectorLine=kr,t.ArcConnectorLine=Or,t.CubicBezierCurve=fr,t.Curve=ur,t.Ellipse=lr,t.GeoJSON=ir,t.Geometry=En,t.GeometryCollection=Qn,t.Label=Pr,t.LineString=qn,t.Marker=Zn,t.MultiLineString=$n,t.MultiPoint=Kn,t.MultiPolygon=tr,t.Polygon=Yn,t.QuadBezierCurve=gr,t.Rectangle=pr,t.Sector=_r,t.TextBox=br,t.TextMarker=wr,Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks v0.27.0")}));