@oiz/stzh-components 2.5.0-alpha → 2.5.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-0c3558c0.js → app-globals-adfd466f.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-badge_3.cjs.entry.js +1 -1
- package/dist/cjs/stzh-chip_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-dropdown.cjs.entry.js +19 -1
- package/dist/cjs/stzh-olmap.cjs.entry.js +442 -1
- package/dist/collection/components/stzh-button/stzh-button.css +1 -0
- package/dist/collection/components/stzh-chip/stzh-chip.css +13 -8
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +15 -2
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +94 -8
- package/dist/collection/components/stzh-olmap/stzh-olmap.css +7 -2
- package/dist/collection/components/stzh-olmap/stzh-olmap.js +34 -0
- package/dist/components/index.js +1 -1
- package/dist/components/stzh-button2.js +1 -1
- package/dist/components/stzh-chip2.js +1 -1
- package/dist/components/stzh-dropdown2.js +24 -2
- package/dist/components/stzh-olmap.js +444 -2
- package/dist/esm/{app-globals-a58b5d2d.js → app-globals-9f43baf6.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-badge_3.entry.js +1 -1
- package/dist/esm/stzh-chip_2.entry.js +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-dropdown.entry.js +19 -1
- package/dist/esm/stzh-olmap.entry.js +442 -1
- package/dist/esm-es5/{app-globals-a58b5d2d.js → app-globals-9f43baf6.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
- package/dist/esm-es5/stzh-chip_2.entry.js +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +6 -6
- package/dist/esm-es5/stzh-olmap.entry.js +2 -2
- package/dist/stzh-components/p-08e324a9.entry.js +9 -0
- package/dist/stzh-components/p-22d01c71.entry.js +1 -0
- package/dist/stzh-components/{p-72f050c1.system.js → p-3cec74af.system.js} +1 -1
- package/dist/stzh-components/p-4b2a4289.entry.js +1 -0
- package/dist/stzh-components/{p-a8205b50.system.entry.js → p-833c666f.system.entry.js} +1 -1
- package/dist/stzh-components/p-8e48e5b2.system.js +1 -0
- package/dist/stzh-components/p-a3d67aca.entry.js +7 -0
- package/dist/stzh-components/p-a493c52e.system.entry.js +1 -0
- package/dist/stzh-components/p-b706c115.system.entry.js +1 -0
- package/dist/stzh-components/{p-73ce3c9b.system.entry.js → p-bd2b4c37.system.entry.js} +7 -7
- package/dist/stzh-components/{p-8276a3a5.js → p-d8468b5f.js} +1 -1
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components.d.ts +36 -8
- package/dist/vscode-data.json +20 -0
- package/package.json +1 -1
- package/dist/stzh-components/p-06e2b01d.system.entry.js +0 -1
- package/dist/stzh-components/p-077a1368.entry.js +0 -1
- package/dist/stzh-components/p-0b5226e2.entry.js +0 -7
- package/dist/stzh-components/p-406c9413.entry.js +0 -9
- package/dist/stzh-components/p-ac6df3e4.system.entry.js +0 -1
- package/dist/stzh-components/p-cfe82456.entry.js +0 -1
- package/dist/stzh-components/p-dde56464.system.js +0 -1
|
@@ -4,4 +4,4 @@ var __awaiter=this&&this.__awaiter||function(t,e,i,r){function n(t){return t ins
|
|
|
4
4
|
* Latitude/longitude spherical geodesy formulae taken from
|
|
5
5
|
* http://www.movable-type.co.uk/scripts/latlong.html
|
|
6
6
|
* Licensed under CC-BY-3.0.
|
|
7
|
-
*/var ua=function(t){this.radius=t};ua.prototype.geodesicArea=function(t){return ua.getArea_(t,this.radius)};ua.prototype.haversineDistance=function(t,e){return ua.getDistance_(t,e,this.radius)};ua.prototype.offset=function(t,e,i){var r=ha.toRadians(t[1]);var n=ha.toRadians(t[0]);var a=e/this.radius;var s=Math.asin(Math.sin(r)*Math.cos(a)+Math.cos(r)*Math.sin(a)*Math.cos(i));var o=n+Math.atan2(Math.sin(i)*Math.sin(a)*Math.cos(r),Math.cos(a)-Math.sin(r)*Math.sin(s));return[ha.toDegrees(o),ha.toDegrees(s)]};ua.DEFAULT_RADIUS=6371008.8;ua.getLength=function(t,e){var i=e||{};var r=i.radius||ua.DEFAULT_RADIUS;var n=i.projection||"EPSG:3857";t=t.clone().transform(n,"EPSG:4326");var a=t.getType();var s=0;var o,h,l,u,f,c;switch(a){case la.POINT:case la.MULTI_POINT:{break}case la.LINE_STRING:case la.LINEAR_RING:{o=t.getCoordinates();s=ua.getLength_(o,r);break}case la.MULTI_LINE_STRING:case la.POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){s+=ua.getLength_(o[l],r)}break}case la.MULTI_POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){h=o[l];for(f=0,c=h.length;f<c;++f){s+=ua.getLength_(h[f],r)}}break}case la.GEOMETRY_COLLECTION:{var d=t.getGeometries();for(l=0,u=d.length;l<u;++l){s+=ua.getLength(d[l],e)}break}default:{throw new Error("Unsupported geometry type: "+a)}}return s};ua.getLength_=function(t,e){var i=0;for(var r=0,n=t.length;r<n-1;++r){i+=ua.getDistance_(t[r],t[r+1],e)}return i};ua.getDistance_=function(t,e,i){var r=ha.toRadians(t[1]);var n=ha.toRadians(e[1]);var a=(n-r)/2;var s=ha.toRadians(e[0]-t[0])/2;var o=Math.sin(a)*Math.sin(a)+Math.sin(s)*Math.sin(s)*Math.cos(r)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))};ua.getArea=function(t,e){var i=e||{};var r=i.radius||ua.DEFAULT_RADIUS;var n=i.projection||"EPSG:3857";t=t.clone().transform(n,"EPSG:4326");var a=t.getType();var s=0;var o,h,l,u,f,c;switch(a){case la.POINT:case la.MULTI_POINT:case la.LINE_STRING:case la.MULTI_LINE_STRING:case la.LINEAR_RING:{break}case la.POLYGON:{o=t.getCoordinates();s=Math.abs(ua.getArea_(o[0],r));for(l=1,u=o.length;l<u;++l){s-=Math.abs(ua.getArea_(o[l],r))}break}case la.MULTI_POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){h=o[l];s+=Math.abs(ua.getArea_(h[0],r));for(f=1,c=h.length;f<c;++f){s-=Math.abs(ua.getArea_(h[f],r))}}break}case la.GEOMETRY_COLLECTION:{var d=t.getGeometries();for(l=0,u=d.length;l<u;++l){s+=ua.getArea(d[l],e)}break}default:{throw new Error("Unsupported geometry type: "+a)}}return s};ua.getArea_=function(t,e){var i=0,r=t.length;var n=t[r-1][0];var a=t[r-1][1];for(var s=0;s<r;s++){var o=t[s][0],h=t[s][1];i+=ha.toRadians(o-n)*(2+Math.sin(ha.toRadians(a))+Math.sin(ha.toRadians(h)));n=o;a=h}return i*e*e/2};var fa={};fa.binarySearch=function(t,e,i){var r,n;var a=i||fa.numberSafeCompareFunction;var s=0;var o=t.length;var h=false;while(s<o){r=s+(o-s>>1);n=+a(t[r],e);if(n<0){s=r+1}else{o=r;h=!n}}return h?s:~s};fa.numberSafeCompareFunction=function(t,e){return t>e?1:t<e?-1:0};fa.includes=function(t,e){return t.indexOf(e)>=0};fa.linearFindNearest=function(t,e,i){var r=t.length;if(t[0]<=e){return 0}else if(e<=t[r-1]){return r-1}else{var n;if(i>0){for(n=1;n<r;++n){if(t[n]<e){return n-1}}}else if(i<0){for(n=1;n<r;++n){if(t[n]<=e){return n}}}else{for(n=1;n<r;++n){if(t[n]==e){return n}else if(t[n]<e){if(t[n-1]-e<e-t[n]){return n-1}else{return n}}}}return r-1}};fa.reverseSubArray=function(t,e,i){while(e<i){var r=t[e];t[e]=t[i];t[i]=r;++e;--i}};fa.extend=function(t,e){var i;var r=Array.isArray(e)?e:[e];var n=r.length;for(i=0;i<n;i++){t[t.length]=r[i]}};fa.remove=function(t,e){var i=t.indexOf(e);var r=i>-1;if(r){t.splice(i,1)}return r};fa.find=function(t,e){var i=t.length>>>0;var r;for(var n=0;n<i;n++){r=t[n];if(e(r,n,t)){return r}}return null};fa.equals=function(t,e){var i=t.length;if(i!==e.length){return false}for(var r=0;r<i;r++){if(t[r]!==e[r]){return false}}return true};fa.stableSort=function(t,e){var i=t.length;var r=Array(t.length);var n;for(n=0;n<i;n++){r[n]={index:n,value:t[n]}}r.sort((function(t,i){return e(t.value,i.value)||t.index-i.index}));for(n=0;n<t.length;n++){t[n]=r[n].value}};fa.findIndex=function(t,e){var i;var r=!t.every((function(r,n){i=n;return!e(r,n,t)}));return r?i:-1};fa.isSorted=function(t,e,i){var r=e||fa.numberSafeCompareFunction;return t.every((function(e,n){if(n===0){return true}var a=r(t[n-1],e);return!(a>0||i&&a===0)}))};var ca={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var da={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};var pa={};pa.boundingExtent=function(t){var e=pa.createEmpty();for(var i=0,r=t.length;i<r;++i){pa.extendCoordinate(e,t[i])}return e};pa.boundingExtentXYs_=function(t,e,i){var r=Math.min.apply(null,t);var n=Math.min.apply(null,e);var a=Math.max.apply(null,t);var s=Math.max.apply(null,e);return pa.createOrUpdate(r,n,a,s,i)};pa.buffer=function(t,e,i){if(i){i[0]=t[0]-e;i[1]=t[1]-e;i[2]=t[2]+e;i[3]=t[3]+e;return i}else{return[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}};pa.clone=function(t,e){if(e){e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];return e}else{return t.slice()}};pa.closestSquaredDistanceXY=function(t,e,i){var r,n;if(e<t[0]){r=t[0]-e}else if(t[2]<e){r=e-t[2]}else{r=0}if(i<t[1]){n=t[1]-i}else if(t[3]<i){n=i-t[3]}else{n=0}return r*r+n*n};pa.containsCoordinate=function(t,e){return pa.containsXY(t,e[0],e[1])};pa.containsExtent=function(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]};pa.containsXY=function(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]};pa.coordinateRelationship=function(t,e){var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=e[0];var o=e[1];var h=da.UNKNOWN;if(s<i){h=h|da.LEFT}else if(s>n){h=h|da.RIGHT}if(o<r){h=h|da.BELOW}else if(o>a){h=h|da.ABOVE}if(h===da.UNKNOWN){h=da.INTERSECTING}return h};pa.createEmpty=function(){return[Infinity,Infinity,-Infinity,-Infinity]};pa.createOrUpdate=function(t,e,i,r,n){if(n){n[0]=t;n[1]=e;n[2]=i;n[3]=r;return n}else{return[t,e,i,r]}};pa.createOrUpdateEmpty=function(t){return pa.createOrUpdate(Infinity,Infinity,-Infinity,-Infinity,t)};pa.createOrUpdateFromCoordinate=function(t,e){var i=t[0];var r=t[1];return pa.createOrUpdate(i,r,i,r,e)};pa.createOrUpdateFromCoordinates=function(t,e){var i=pa.createOrUpdateEmpty(e);return pa.extendCoordinates(i,t)};pa.createOrUpdateFromFlatCoordinates=function(t,e,i,r,n){var a=pa.createOrUpdateEmpty(n);return pa.extendFlatCoordinates(a,t,e,i,r)};pa.createOrUpdateFromRings=function(t,e){var i=pa.createOrUpdateEmpty(e);return pa.extendRings(i,t)};pa.equals=function(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]};pa.extend=function(t,e){if(e[0]<t[0]){t[0]=e[0]}if(e[2]>t[2]){t[2]=e[2]}if(e[1]<t[1]){t[1]=e[1]}if(e[3]>t[3]){t[3]=e[3]}return t};pa.extendCoordinate=function(t,e){if(e[0]<t[0]){t[0]=e[0]}if(e[0]>t[2]){t[2]=e[0]}if(e[1]<t[1]){t[1]=e[1]}if(e[1]>t[3]){t[3]=e[1]}};pa.extendCoordinates=function(t,e){var i,r;for(i=0,r=e.length;i<r;++i){pa.extendCoordinate(t,e[i])}return t};pa.extendFlatCoordinates=function(t,e,i,r,n){for(;i<r;i+=n){pa.extendXY(t,e[i],e[i+1])}return t};pa.extendRings=function(t,e){var i,r;for(i=0,r=e.length;i<r;++i){pa.extendCoordinates(t,e[i])}return t};pa.extendXY=function(t,e,i){t[0]=Math.min(t[0],e);t[1]=Math.min(t[1],i);t[2]=Math.max(t[2],e);t[3]=Math.max(t[3],i)};pa.forEachCorner=function(t,e,i){var r;r=e.call(i,pa.getBottomLeft(t));if(r){return r}r=e.call(i,pa.getBottomRight(t));if(r){return r}r=e.call(i,pa.getTopRight(t));if(r){return r}r=e.call(i,pa.getTopLeft(t));if(r){return r}return false};pa.getArea=function(t){var e=0;if(!pa.isEmpty(t)){e=pa.getWidth(t)*pa.getHeight(t)}return e};pa.getBottomLeft=function(t){return[t[0],t[1]]};pa.getBottomRight=function(t){return[t[2],t[1]]};pa.getCenter=function(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]};pa.getCorner=function(t,e){var i;if(e===ca.BOTTOM_LEFT){i=pa.getBottomLeft(t)}else if(e===ca.BOTTOM_RIGHT){i=pa.getBottomRight(t)}else if(e===ca.TOP_LEFT){i=pa.getTopLeft(t)}else if(e===ca.TOP_RIGHT){i=pa.getTopRight(t)}else{oa.assert(false,13)}return i};pa.getEnlargedArea=function(t,e){var i=Math.min(t[0],e[0]);var r=Math.min(t[1],e[1]);var n=Math.max(t[2],e[2]);var a=Math.max(t[3],e[3]);return(n-i)*(a-r)};pa.getForViewAndSize=function(t,e,i,r,n){var a=e*r[0]/2;var s=e*r[1]/2;var o=Math.cos(i);var h=Math.sin(i);var l=a*o;var u=a*h;var f=s*o;var c=s*h;var d=t[0];var p=t[1];var v=d-l+c;var _=d-l-c;var g=d+l-c;var m=d+l+c;var y=p-u-f;var E=p-u+f;var x=p+u+f;var T=p+u-f;return pa.createOrUpdate(Math.min(v,_,g,m),Math.min(y,E,x,T),Math.max(v,_,g,m),Math.max(y,E,x,T),n)};pa.getHeight=function(t){return t[3]-t[1]};pa.getIntersectionArea=function(t,e){var i=pa.getIntersection(t,e);return pa.getArea(i)};pa.getIntersection=function(t,e,i){var r=i?i:pa.createEmpty();if(pa.intersects(t,e)){if(t[0]>e[0]){r[0]=t[0]}else{r[0]=e[0]}if(t[1]>e[1]){r[1]=t[1]}else{r[1]=e[1]}if(t[2]<e[2]){r[2]=t[2]}else{r[2]=e[2]}if(t[3]<e[3]){r[3]=t[3]}else{r[3]=e[3]}}return r};pa.getMargin=function(t){return pa.getWidth(t)+pa.getHeight(t)};pa.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]};pa.getTopLeft=function(t){return[t[0],t[3]]};pa.getTopRight=function(t){return[t[2],t[3]]};pa.getWidth=function(t){return t[2]-t[0]};pa.intersects=function(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]};pa.isEmpty=function(t){return t[2]<t[0]||t[3]<t[1]};pa.returnOrUpdate=function(t,e){if(e){e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];return e}else{return t}};pa.scaleFromCenter=function(t,e){var i=(t[2]-t[0])/2*(e-1);var r=(t[3]-t[1])/2*(e-1);t[0]-=i;t[2]+=i;t[1]-=r;t[3]+=r};pa.intersectsSegment=function(t,e,i){var r=false;var n=pa.coordinateRelationship(t,e);var a=pa.coordinateRelationship(t,i);if(n===da.INTERSECTING||a===da.INTERSECTING){r=true}else{var s=t[0];var o=t[1];var h=t[2];var l=t[3];var u=e[0];var f=e[1];var c=i[0];var d=i[1];var p=(d-f)/(c-u);var v,_;if(!!(a&da.ABOVE)&&!(n&da.ABOVE)){v=c-(d-l)/p;r=v>=s&&v<=h}if(!r&&!!(a&da.RIGHT)&&!(n&da.RIGHT)){_=d-(c-h)*p;r=_>=o&&_<=l}if(!r&&!!(a&da.BELOW)&&!(n&da.BELOW)){v=c-(d-o)/p;r=v>=s&&v<=h}if(!r&&!!(a&da.LEFT)&&!(n&da.LEFT)){_=d-(c-s)*p;r=_>=o&&_<=l}}return r};pa.applyTransform=function(t,e,i){var r=[t[0],t[1],t[0],t[3],t[2],t[1],t[2],t[3]];e(r,r,2);var n=[r[0],r[2],r[4],r[6]];var a=[r[1],r[3],r[5],r[7]];return pa.boundingExtentXYs_(n,a,i)};var va={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};var _a={};_a.TRUE=function(){return true};_a.FALSE=function(){return false};var ga={};ga.transform2D=function(t,e,i,r,n,a){var s=a?a:[];var o=0;var h;for(h=e;h<i;h+=r){var l=t[h];var u=t[h+1];s[o++]=n[0]*l+n[2]*u+n[4];s[o++]=n[1]*l+n[3]*u+n[5]}if(a&&s.length!=o){s.length=o}return s};ga.rotate=function(t,e,i,r,n,a,s){var o=s?s:[];var h=Math.cos(n);var l=Math.sin(n);var u=a[0];var f=a[1];var c=0;for(var d=e;d<i;d+=r){var p=t[d]-u;var v=t[d+1]-f;o[c++]=u+p*h-v*l;o[c++]=f+p*l+v*h;for(var _=d+2;_<d+r;++_){o[c++]=t[_]}}if(s&&o.length!=c){o.length=c}return o};ga.scale=function(t,e,i,r,n,a,s,o){var h=o?o:[];var l=s[0];var u=s[1];var f=0;for(var c=e;c<i;c+=r){var d=t[c]-l;var p=t[c+1]-u;h[f++]=l+n*d;h[f++]=u+a*p;for(var v=c+2;v<c+r;++v){h[f++]=t[v]}}if(o&&h.length!=f){h.length=f}return h};ga.translate=function(t,e,i,r,n,a,s){var o=s?s:[];var h=0;var l,u;for(l=e;l<i;l+=r){o[h++]=t[l]+n;o[h++]=t[l+1]+a;for(u=l+2;u<l+r;++u){o[h++]=t[u]}}if(s&&o.length!=h){o.length=h}return o};var ma={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"};ma.METERS_PER_UNIT={};ma.METERS_PER_UNIT[ma.DEGREES]=2*Math.PI*6370997/360;ma.METERS_PER_UNIT[ma.FEET]=.3048;ma.METERS_PER_UNIT[ma.METERS]=1;ma.METERS_PER_UNIT[ma.USFEET]=1200/3937;var ya={};ya.cache_=null;ya.set=function(t){ya.cache_=t};ya.get=function(){return ya.cache_||window["proj4"]};var Ea=function(t){this.code_=t.code;this.units_=t.units;this.extent_=t.extent!==undefined?t.extent:null;this.worldExtent_=t.worldExtent!==undefined?t.worldExtent:null;this.axisOrientation_=t.axisOrientation!==undefined?t.axisOrientation:"enu";this.global_=t.global!==undefined?t.global:false;this.canWrapX_=!!(this.global_&&this.extent_);this.getPointResolutionFunc_=t.getPointResolution;this.defaultTileGrid_=null;this.metersPerUnit_=t.metersPerUnit;var e=t.code;if(qn.ENABLE_PROJ4JS){var i=ya.get();if(typeof i=="function"){var r=i.defs(e);if(r!==undefined){if(r.axis!==undefined&&t.axisOrientation===undefined){this.axisOrientation_=r.axis}if(t.metersPerUnit===undefined){this.metersPerUnit_=r.to_meter}if(t.units===undefined){this.units_=r.units}}}}};Ea.prototype.canWrapX=function(){return this.canWrapX_};Ea.prototype.getCode=function(){return this.code_};Ea.prototype.getExtent=function(){return this.extent_};Ea.prototype.getUnits=function(){return this.units_};Ea.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||ma.METERS_PER_UNIT[this.units_]};Ea.prototype.getWorldExtent=function(){return this.worldExtent_};Ea.prototype.getAxisOrientation=function(){return this.axisOrientation_};Ea.prototype.isGlobal=function(){return this.global_};Ea.prototype.setGlobal=function(t){this.global_=t;this.canWrapX_=!!(t&&this.extent_)};Ea.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_};Ea.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t};Ea.prototype.setExtent=function(t){this.extent_=t;this.canWrapX_=!!(this.global_&&t)};Ea.prototype.setWorldExtent=function(t){this.worldExtent_=t};Ea.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t};Ea.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_};var xa={};xa.Projection_=function(t){Ea.call(this,{code:t,units:ma.METERS,extent:xa.EXTENT,global:true,worldExtent:xa.WORLD_EXTENT,getPointResolution:function(t,e){return t/ha.cosh(e[1]/xa.RADIUS)}})};qn.inherits(xa.Projection_,Ea);xa.RADIUS=6378137;xa.HALF_SIZE=Math.PI*xa.RADIUS;xa.EXTENT=[-xa.HALF_SIZE,-xa.HALF_SIZE,xa.HALF_SIZE,xa.HALF_SIZE];xa.WORLD_EXTENT=[-180,-85,180,85];xa.PROJECTIONS=[new xa.Projection_("EPSG:3857"),new xa.Projection_("EPSG:102100"),new xa.Projection_("EPSG:102113"),new xa.Projection_("EPSG:900913"),new xa.Projection_("urn:ogc:def:crs:EPSG:6.18:3:3857"),new xa.Projection_("urn:ogc:def:crs:EPSG::3857"),new xa.Projection_("http://www.opengis.net/gml/srs/epsg.xml#3857")];xa.fromEPSG4326=function(t,e,i){var r=t.length,n=i>1?i:2,a=e;if(a===undefined){if(n>2){a=t.slice()}else{a=new Array(r)}}var s=xa.HALF_SIZE;for(var o=0;o<r;o+=n){a[o]=s*t[o]/180;var h=xa.RADIUS*Math.log(Math.tan(Math.PI*(t[o+1]+90)/360));if(h>s){h=s}else if(h<-s){h=-s}a[o+1]=h}return a};xa.toEPSG4326=function(t,e,i){var r=t.length,n=i>1?i:2,a=e;if(a===undefined){if(n>2){a=t.slice()}else{a=new Array(r)}}for(var s=0;s<r;s+=n){a[s]=180*t[s]/xa.HALF_SIZE;a[s+1]=360*Math.atan(Math.exp(t[s+1]/xa.RADIUS))/Math.PI-90}return a};var Ta={};Ta.Projection_=function(t,e){Ea.call(this,{code:t,units:ma.DEGREES,extent:Ta.EXTENT,axisOrientation:e,global:true,metersPerUnit:Ta.METERS_PER_UNIT,worldExtent:Ta.EXTENT})};qn.inherits(Ta.Projection_,Ea);Ta.RADIUS=6378137;Ta.EXTENT=[-180,-90,180,90];Ta.METERS_PER_UNIT=Math.PI*Ta.RADIUS/180;Ta.PROJECTIONS=[new Ta.Projection_("CRS:84"),new Ta.Projection_("EPSG:4326","neu"),new Ta.Projection_("urn:ogc:def:crs:EPSG::4326","neu"),new Ta.Projection_("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new Ta.Projection_("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ta.Projection_("urn:ogc:def:crs:OGC:2:84"),new Ta.Projection_("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ta.Projection_("urn:x-ogc:def:crs:EPSG:4326","neu")];var Ca={};Ca.cache_={};Ca.clear=function(){Ca.cache_={}};Ca.get=function(t){var e=Ca.cache_;return e[t]||null};Ca.add=function(t,e){var i=Ca.cache_;i[t]=e};var Ra={};Ra.cache_={};Ra.clear=function(){Ra.cache_={}};Ra.add=function(t,e,i){var r=t.getCode();var n=e.getCode();var a=Ra.cache_;if(!(r in a)){a[r]={}}a[r][n]=i};Ra.remove=function(t,e){var i=t.getCode();var r=e.getCode();var n=Ra.cache_;var a=n[i][r];delete n[i][r];if(Qn.isEmpty(n[i])){delete n[i]}return a};Ra.get=function(t,e){var i;var r=Ra.cache_;if(t in r&&e in r[t]){i=r[t][e]}return i};var Ma={};Ma.METERS_PER_UNIT=ma.METERS_PER_UNIT;Ma.SPHERE_=new ua(ua.DEFAULT_RADIUS);if(qn.ENABLE_PROJ4JS){Ma.setProj4=function(t){ya.set(t)}}Ma.getPointResolution=function(t,e,i,r){t=Ma.get(t);var n;var a=t.getPointResolutionFunc();if(a){n=a(e,i)}else{var s=t.getUnits();if(s==ma.DEGREES&&!r||r==ma.DEGREES){n=e}else{var o=Ma.getTransformFromProjections(t,Ma.get("EPSG:4326"));var h=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];h=o(h,h,2);var l=Ma.SPHERE_.haversineDistance(h.slice(0,2),h.slice(2,4));var u=Ma.SPHERE_.haversineDistance(h.slice(4,6),h.slice(6,8));n=(l+u)/2;var f=r?ma.METERS_PER_UNIT[r]:t.getMetersPerUnit();if(f!==undefined){n/=f}}}return n};Ma.addEquivalentProjections=function(t){Ma.addProjections(t);t.forEach((function(e){t.forEach((function(t){if(e!==t){Ra.add(e,t,Ma.cloneTransform)}}))}))};Ma.addEquivalentTransforms=function(t,e,i,r){t.forEach((function(t){e.forEach((function(e){Ra.add(t,e,i);Ra.add(e,t,r)}))}))};Ma.addProjection=function(t){Ca.add(t.getCode(),t);Ra.add(t,t,Ma.cloneTransform)};Ma.addProjections=function(t){t.forEach(Ma.addProjection)};Ma.clearAllProjections=function(){Ca.clear();Ra.clear()};Ma.createProjection=function(t,e){if(!t){return Ma.get(e)}else if(typeof t==="string"){return Ma.get(t)}else{return t}};Ma.addCoordinateTransforms=function(t,e,i,r){var n=Ma.get(t);var a=Ma.get(e);Ra.add(n,a,Ma.createTransformFromCoordinateTransform(i));Ra.add(a,n,Ma.createTransformFromCoordinateTransform(r))};Ma.createTransformFromCoordinateTransform=function(t){return function(e,i,r){var n=e.length;var a=r!==undefined?r:2;var s=i!==undefined?i:new Array(n);var o,h,l;for(h=0;h<n;h+=a){o=t([e[h],e[h+1]]);s[h]=o[0];s[h+1]=o[1];for(l=a-1;l>=2;--l){s[h+l]=e[h+l]}}return s}};Ma.fromLonLat=function(t,e){return Ma.transform(t,"EPSG:4326",e!==undefined?e:"EPSG:3857")};Ma.toLonLat=function(t,e){var i=Ma.transform(t,e!==undefined?e:"EPSG:3857","EPSG:4326");var r=i[0];if(r<-180||r>180){i[0]=ha.modulo(r+180,360)-180}return i};Ma.get=function(t){var e=null;if(t instanceof Ea){e=t}else if(typeof t==="string"){var i=t;e=Ca.get(i);if(qn.ENABLE_PROJ4JS&&!e){var r=ya.get();if(typeof r=="function"&&r.defs(i)!==undefined){e=new Ea({code:i});Ma.addProjection(e)}}}return e};Ma.equivalent=function(t,e){if(t===e){return true}var i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode()){return i}else{var r=Ma.getTransformFromProjections(t,e);return r===Ma.cloneTransform&&i}};Ma.getTransform=function(t,e){var i=Ma.get(t);var r=Ma.get(e);return Ma.getTransformFromProjections(i,r)};Ma.getTransformFromProjections=function(t,e){var i=t.getCode();var r=e.getCode();var n=Ra.get(i,r);if(qn.ENABLE_PROJ4JS&&!n){var a=ya.get();if(typeof a=="function"){var s=a.defs(i);var o=a.defs(r);if(s!==undefined&&o!==undefined){if(s===o){Ma.addEquivalentProjections([e,t])}else{var h=a(r,i);Ma.addCoordinateTransforms(e,t,h.forward,h.inverse)}n=Ra.get(i,r)}}}if(!n){n=Ma.identityTransform}return n};Ma.identityTransform=function(t,e,i){if(e!==undefined&&t!==e){for(var r=0,n=t.length;r<n;++r){e[r]=t[r]}t=e}return t};Ma.cloneTransform=function(t,e,i){var r;if(e!==undefined){for(var n=0,a=t.length;n<a;++n){e[n]=t[n]}r=e}else{r=t.slice()}return r};Ma.transform=function(t,e,i){var r=Ma.getTransform(e,i);return r(t,undefined,t.length)};Ma.transformExtent=function(t,e,i){var r=Ma.getTransform(e,i);return pa.applyTransform(t,r)};Ma.transformWithProjections=function(t,e,i){var r=Ma.getTransformFromProjections(e,i);return r(t)};Ma.addCommon=function(){Ma.addEquivalentProjections(xa.PROJECTIONS);Ma.addEquivalentProjections(Ta.PROJECTIONS);Ma.addEquivalentTransforms(Ta.PROJECTIONS,xa.PROJECTIONS,xa.fromEPSG4326,xa.toEPSG4326)};Ma.addCommon();var Sa={};Sa.tmp_=new Array(6);Sa.create=function(){return[1,0,0,1,0,0]};Sa.reset=function(t){return Sa.set(t,1,0,0,1,0,0)};Sa.multiply=function(t,e){var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=t[4];var o=t[5];var h=e[0];var l=e[1];var u=e[2];var f=e[3];var c=e[4];var d=e[5];t[0]=i*h+n*l;t[1]=r*h+a*l;t[2]=i*u+n*f;t[3]=r*u+a*f;t[4]=i*c+n*d+s;t[5]=r*c+a*d+o;return t};Sa.set=function(t,e,i,r,n,a,s){t[0]=e;t[1]=i;t[2]=r;t[3]=n;t[4]=a;t[5]=s;return t};Sa.setFromArray=function(t,e){t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=e[3];t[4]=e[4];t[5]=e[5];return t};Sa.apply=function(t,e){var i=e[0],r=e[1];e[0]=t[0]*i+t[2]*r+t[4];e[1]=t[1]*i+t[3]*r+t[5];return e};Sa.rotate=function(t,e){var i=Math.cos(e);var r=Math.sin(e);return Sa.multiply(t,Sa.set(Sa.tmp_,i,r,-r,i,0,0))};Sa.scale=function(t,e,i){return Sa.multiply(t,Sa.set(Sa.tmp_,e,0,0,i,0,0))};Sa.translate=function(t,e,i){return Sa.multiply(t,Sa.set(Sa.tmp_,1,0,0,1,e,i))};Sa.compose=function(t,e,i,r,n,a,s,o){var h=Math.sin(a);var l=Math.cos(a);t[0]=r*l;t[1]=n*h;t[2]=-r*h;t[3]=n*l;t[4]=s*r*l-o*r*h+e;t[5]=s*n*h+o*n*l+i;return t};Sa.invert=function(t){var e=Sa.determinant(t);oa.assert(e!==0,32);var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=t[4];var o=t[5];t[0]=a/e;t[1]=-r/e;t[2]=-n/e;t[3]=i/e;t[4]=(n*o-a*s)/e;t[5]=-(i*o-r*s)/e;return t};Sa.determinant=function(t){return t[0]*t[3]-t[1]*t[2]};var Ia=function(){aa.call(this);this.extent_=pa.createEmpty();this.extentRevision_=-1;this.simplifiedGeometryCache={};this.simplifiedGeometryMaxMinSquaredTolerance=0;this.simplifiedGeometryRevision=0;this.tmpTransform_=Sa.create()};qn.inherits(Ia,aa);Ia.prototype.clone=function(){};Ia.prototype.closestPointXY=function(t,e,i,r){};Ia.prototype.getClosestPoint=function(t,e){var i=e?e:[NaN,NaN];this.closestPointXY(t[0],t[1],i,Infinity);return i};Ia.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])};Ia.prototype.computeExtent=function(t){};Ia.prototype.containsXY=_a.FALSE;Ia.prototype.getExtent=function(t){if(this.extentRevision_!=this.getRevision()){this.extent_=this.computeExtent(this.extent_);this.extentRevision_=this.getRevision()}return pa.returnOrUpdate(this.extent_,t)};Ia.prototype.rotate=function(t,e){};Ia.prototype.scale=function(t,e,i){};Ia.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)};Ia.prototype.getSimplifiedGeometry=function(t){};Ia.prototype.getType=function(){};Ia.prototype.applyTransform=function(t){};Ia.prototype.intersectsExtent=function(t){};Ia.prototype.translate=function(t,e){};Ia.prototype.transform=function(t,e){var i=this.tmpTransform_;t=Ma.get(t);var r=t.getUnits()==ma.TILE_PIXELS?function(r,n,a){var s=t.getExtent();var o=t.getWorldExtent();var h=pa.getHeight(o)/pa.getHeight(s);Sa.compose(i,o[0],o[3],h,-h,0,0,0);ga.transform2D(r,0,r.length,a,i,n);return Ma.getTransform(t,e)(r,n,a)}:Ma.getTransform(t,e);this.applyTransform(r);return this};var La=function(){Ia.call(this);this.layout=va.XY;this.stride=2;this.flatCoordinates=null};qn.inherits(La,Ia);La.getLayoutForStride_=function(t){var e;if(t==2){e=va.XY}else if(t==3){e=va.XYZ}else if(t==4){e=va.XYZM}return e};La.getStrideForLayout=function(t){var e;if(t==va.XY){e=2}else if(t==va.XYZ||t==va.XYM){e=3}else if(t==va.XYZM){e=4}return e};La.prototype.containsXY=_a.FALSE;La.prototype.computeExtent=function(t){return pa.createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)};La.prototype.getCoordinates=function(){};La.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)};La.prototype.getFlatCoordinates=function(){return this.flatCoordinates};La.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)};La.prototype.getLayout=function(){return this.layout};La.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()){Qn.clear(this.simplifiedGeometryCache);this.simplifiedGeometryMaxMinSquaredTolerance=0;this.simplifiedGeometryRevision=this.getRevision()}if(t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance){return this}var e=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(e)){return this.simplifiedGeometryCache[e]}else{var i=this.getSimplifiedGeometryInternal(t);var r=i.getFlatCoordinates();if(r.length<this.flatCoordinates.length){this.simplifiedGeometryCache[e]=i;return i}else{this.simplifiedGeometryMaxMinSquaredTolerance=t;return this}}};La.prototype.getSimplifiedGeometryInternal=function(t){return this};La.prototype.getStride=function(){return this.stride};La.prototype.setFlatCoordinatesInternal=function(t,e){this.stride=La.getStrideForLayout(t);this.layout=t;this.flatCoordinates=e};La.prototype.setCoordinates=function(t,e){};La.prototype.setLayout=function(t,e,i){var r;if(t){r=La.getStrideForLayout(t)}else{var n;for(n=0;n<i;++n){if(e.length===0){this.layout=va.XY;this.stride=2;return}else{e=e[0]}}r=e.length;t=La.getLayoutForStride_(r)}this.layout=t;this.stride=r};La.prototype.applyTransform=function(t){if(this.flatCoordinates){t(this.flatCoordinates,this.flatCoordinates,this.stride);this.changed()}};La.prototype.rotate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();ga.rotate(i,0,i.length,r,t,e,i);this.changed()}};La.prototype.scale=function(t,e,i){var r=e;if(r===undefined){r=t}var n=i;if(!n){n=pa.getCenter(this.getExtent())}var a=this.getFlatCoordinates();if(a){var s=this.getStride();ga.scale(a,0,a.length,s,t,r,n,a);this.changed()}};La.prototype.translate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();ga.translate(i,0,i.length,r,t,e,i);this.changed()}};La.transform2D=function(t,e,i){var r=t.getFlatCoordinates();if(!r){return null}else{var n=t.getStride();return ga.transform2D(r,0,r.length,n,e,i)}};var Aa={};Aa.linearRing=function(t,e,i,r){var n=0;var a=t[i-r];var s=t[i-r+1];for(;e<i;e+=r){var o=t[e];var h=t[e+1];n+=s*o-a*h;a=o;s=h}return n/2};Aa.linearRings=function(t,e,i,r){var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n+=Aa.linearRing(t,e,o,r);e=o}return n};Aa.linearRingss=function(t,e,i,r){var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n+=Aa.linearRings(t,e,o,r);e=o[o.length-1]}return n};var wa={};wa.point=function(t,e,i,r,n,a,s){var o=t[e];var h=t[e+1];var l=t[i]-o;var u=t[i+1]-h;var f,c;if(l===0&&u===0){c=e}else{var d=((n-o)*l+(a-h)*u)/(l*l+u*u);if(d>1){c=i}else if(d>0){for(f=0;f<r;++f){s[f]=ha.lerp(t[e+f],t[i+f],d)}s.length=r;return}else{c=e}}for(f=0;f<r;++f){s[f]=t[c+f]}s.length=r};wa.getMaxSquaredDelta=function(t,e,i,r,n){var a=t[e];var s=t[e+1];for(e+=r;e<i;e+=r){var o=t[e];var h=t[e+1];var l=ha.squaredDistance(a,s,o,h);if(l>n){n=l}a=o;s=h}return n};wa.getsMaxSquaredDelta=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n=wa.getMaxSquaredDelta(t,e,o,r,n);e=o}return n};wa.getssMaxSquaredDelta=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n=wa.getsMaxSquaredDelta(t,e,o,r,n);e=o[o.length-1]}return n};wa.getClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){if(e==i){return l}var f,c;if(n===0){c=ha.squaredDistance(s,o,t[e],t[e+1]);if(c<l){for(f=0;f<r;++f){h[f]=t[e+f]}h.length=r;return c}else{return l}}var d=u?u:[NaN,NaN];var p=e+r;while(p<i){wa.point(t,p-r,p,r,s,o,d);c=ha.squaredDistance(s,o,d[0],d[1]);if(c<l){l=c;for(f=0;f<r;++f){h[f]=d[f]}h.length=r;p+=r}else{p+=r*Math.max((Math.sqrt(c)-Math.sqrt(l))/n|0,1)}}if(a){wa.point(t,i-r,e,r,s,o,d);c=ha.squaredDistance(s,o,d[0],d[1]);if(c<l){l=c;for(f=0;f<r;++f){h[f]=d[f]}h.length=r}}return l};wa.getsClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){var f=u?u:[NaN,NaN];var c,d;for(c=0,d=i.length;c<d;++c){var p=i[c];l=wa.getClosestPoint(t,e,p,r,n,a,s,o,h,l,f);e=p}return l};wa.getssClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){var f=u?u:[NaN,NaN];var c,d;for(c=0,d=i.length;c<d;++c){var p=i[c];l=wa.getsClosestPoint(t,e,p,r,n,a,s,o,h,l,f);e=p[p.length-1]}return l};var Oa={};Oa.coordinate=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){t[e++]=i[n]}return e};Oa.coordinates=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){var s=i[n];var o;for(o=0;o<r;++o){t[e++]=s[o]}}return e};Oa.coordinatess=function(t,e,i,r,n){var a=n?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=Oa.coordinates(t,e,i[o],r);a[s++]=l;e=l}a.length=s;return a};Oa.coordinatesss=function(t,e,i,r,n){var a=n?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=Oa.coordinatess(t,e,i[o],r,a[s]);a[s++]=l;e=l[l.length-1]}a.length=s;return a};var ba={};ba.coordinates=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o;for(o=e;o<i;o+=r){a[s++]=t.slice(o,o+r)}a.length=s;return a};ba.coordinatess=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=i[o];a[s++]=ba.coordinates(t,e,l,r,a[s]);e=l}a.length=s;return a};ba.coordinatesss=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=i[o];a[s++]=ba.coordinatess(t,e,l,r,a[s]);e=l[l.length-1]}a.length=s;return a};var Pa={};Pa.lineString=function(t,e,i,r,n,a,s){var o=s!==undefined?s:[];if(!a){i=Pa.radialDistance(t,e,i,r,n,o,0);t=o;e=0;r=2}o.length=Pa.douglasPeucker(t,e,i,r,n,o,0);return o};Pa.douglasPeucker=function(t,e,i,r,n,a,s){var o=(i-e)/r;if(o<3){for(;e<i;e+=r){a[s++]=t[e];a[s++]=t[e+1]}return s}var h=new Array(o);h[0]=1;h[o-1]=1;var l=[e,i-r];var u=0;var f;while(l.length>0){var c=l.pop();var d=l.pop();var p=0;var v=t[d];var _=t[d+1];var g=t[c];var m=t[c+1];for(f=d+r;f<c;f+=r){var y=t[f];var E=t[f+1];var x=ha.squaredSegmentDistance(y,E,v,_,g,m);if(x>p){u=f;p=x}}if(p>n){h[(u-e)/r]=1;if(d+r<u){l.push(d,u)}if(u+r<c){l.push(u,c)}}}for(f=0;f<o;++f){if(h[f]){a[s++]=t[e+f*r];a[s++]=t[e+f*r+1]}}return s};Pa.douglasPeuckers=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];s=Pa.douglasPeucker(t,e,u,r,n,a,s);o.push(s);e=u}return s};Pa.douglasPeuckerss=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];var f=[];s=Pa.douglasPeuckers(t,e,u,r,n,a,s,f);o.push(f);e=u[u.length-1]}return s};Pa.radialDistance=function(t,e,i,r,n,a,s){if(i<=e+r){for(;e<i;e+=r){a[s++]=t[e];a[s++]=t[e+1]}return s}var o=t[e];var h=t[e+1];a[s++]=o;a[s++]=h;var l=o;var u=h;for(e+=r;e<i;e+=r){l=t[e];u=t[e+1];if(ha.squaredDistance(o,h,l,u)>n){a[s++]=l;a[s++]=u;o=l;h=u}}if(l!=o||u!=h){a[s++]=l;a[s++]=u}return s};Pa.snap=function(t,e){return e*Math.round(t/e)};Pa.quantize=function(t,e,i,r,n,a,s){if(e==i){return s}var o=Pa.snap(t[e],n);var h=Pa.snap(t[e+1],n);e+=r;a[s++]=o;a[s++]=h;var l,u;do{l=Pa.snap(t[e],n);u=Pa.snap(t[e+1],n);e+=r;if(e==i){a[s++]=l;a[s++]=u;return s}}while(l==o&&u==h);while(e<i){var f,c;f=Pa.snap(t[e],n);c=Pa.snap(t[e+1],n);e+=r;if(f==l&&c==u){continue}var d=l-o;var p=u-h;var v=f-o;var _=c-h;if(d*_==p*v&&(d<0&&v<d||d==v||d>0&&v>d)&&(p<0&&_<p||p==_||p>0&&_>p)){l=f;u=c;continue}a[s++]=l;a[s++]=u;o=l;h=u;l=f;u=c}a[s++]=l;a[s++]=u;return s};Pa.quantizes=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];s=Pa.quantize(t,e,u,r,n,a,s);o.push(s);e=u}return s};Pa.quantizess=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];var f=[];s=Pa.quantizes(t,e,u,r,n,a,s,f);o.push(f);e=u[u.length-1]}return s};var Da=function(t,e){La.call(this);this.maxDelta_=-1;this.maxDeltaRevision_=-1;this.setCoordinates(t,e)};qn.inherits(Da,La);Da.prototype.clone=function(){var t=new Da(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice());return t};Da.prototype.closestPointXY=function(t,e,i,r){if(r<pa.closestSquaredDistanceXY(this.getExtent(),t,e)){return r}if(this.maxDeltaRevision_!=this.getRevision()){this.maxDelta_=Math.sqrt(wa.getMaxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0));this.maxDeltaRevision_=this.getRevision()}return wa.getClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,true,t,e,i,r)};Da.prototype.getArea=function(){return Aa.linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Da.prototype.getCoordinates=function(){return ba.coordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Da.prototype.getSimplifiedGeometryInternal=function(t){var e=[];e.length=Pa.douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0);var i=new Da(null);i.setFlatCoordinates(va.XY,e);return i};Da.prototype.getType=function(){return la.LINEAR_RING};Da.prototype.intersectsExtent=function(t){};Da.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null)}else{this.setLayout(e,t,1);if(!this.flatCoordinates){this.flatCoordinates=[]}this.flatCoordinates.length=Oa.coordinates(this.flatCoordinates,0,t,this.stride);this.changed()}};Da.prototype.setFlatCoordinates=function(t,e){this.setFlatCoordinatesInternal(t,e);this.changed()};var Fa=function(t,e){La.call(this);this.setCoordinates(t,e)};qn.inherits(Fa,La);Fa.prototype.clone=function(){var t=new Fa(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice());return t};Fa.prototype.closestPointXY=function(t,e,i,r){var n=this.flatCoordinates;var a=ha.squaredDistance(t,e,n[0],n[1]);if(a<r){var s=this.stride;var o;for(o=0;o<s;++o){i[o]=n[o]}i.length=s;return a}else{return r}};Fa.prototype.getCoordinates=function(){return!this.flatCoordinates?[]:this.flatCoordinates.slice()};Fa.prototype.computeExtent=function(t){return pa.createOrUpdateFromCoordinate(this.flatCoordinates,t)};Fa.prototype.getType=function(){return la.POINT};Fa.prototype.intersectsExtent=function(t){return pa.containsXY(t,this.flatCoordinates[0],this.flatCoordinates[1])};Fa.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null)}else{this.setLayout(e,t,0);if(!this.flatCoordinates){this.flatCoordinates=[]}this.flatCoordinates.length=Oa.coordinate(this.flatCoordinates,0,t,this.stride);this.changed()}};Fa.prototype.setFlatCoordinates=function(t,e){this.setFlatCoordinatesInternal(t,e);this.changed()};var Na={};Na.linearRingContainsExtent=function(t,e,i,r,n){var a=pa.forEachCorner(n,(function(n){return!Na.linearRingContainsXY(t,e,i,r,n[0],n[1])}));return!a};Na.linearRingContainsXY=function(t,e,i,r,n,a){var s=0;var o=t[i-r];var h=t[i-r+1];for(;e<i;e+=r){var l=t[e];var u=t[e+1];if(h<=a){if(u>a&&(l-o)*(a-h)-(n-o)*(u-h)>0){s++}}else if(u<=a&&(l-o)*(a-h)-(n-o)*(u-h)<0){s--}o=l;h=u}return s!==0};Na.linearRingsContainsXY=function(t,e,i,r,n,a){if(i.length===0){return false}if(!Na.linearRingContainsXY(t,e,i[0],r,n,a)){return false}var s,o;for(s=1,o=i.length;s<o;++s){if(Na.linearRingContainsXY(t,i[s-1],i[s],r,n,a)){return false}}return true};Na.linearRingssContainsXY=function(t,e,i,r,n,a){if(i.length===0){return false}var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];if(Na.linearRingsContainsXY(t,e,h,r,n,a)){return true}e=h[h.length-1]}return false};var Ga={};Ga.linearRings=function(t,e,i,r,n,a,s){var o,h,l,u,f,c,d;var p=n[a+1];var v=[];for(var _=0,g=i.length;_<g;++_){var m=i[_];u=t[m-r];c=t[m-r+1];for(o=e;o<m;o+=r){f=t[o];d=t[o+1];if(p<=c&&d<=p||c<=p&&p<=d){l=(p-c)/(d-c)*(f-u)+u;v.push(l)}u=f;c=d}}var y=NaN;var E=-Infinity;v.sort(fa.numberSafeCompareFunction);u=v[0];for(o=1,h=v.length;o<h;++o){f=v[o];var x=Math.abs(f-u);if(x>E){l=(u+f)/2;if(Na.linearRingsContainsXY(t,e,i,r,l,p)){y=l;E=x}}u=f}if(isNaN(y)){y=n[a]}if(s){s.push(y,p,E);return s}else{return[y,p,E]}};Ga.linearRingss=function(t,e,i,r,n){var a=[];var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];a=Ga.linearRings(t,e,h,r,n,2*s,a);e=h[h.length-1]}return a};var ka={};ka.forEach=function(t,e,i,r,n,a){var s=[t[e],t[e+1]];var o=[];var h;for(;e+r<i;e+=r){o[0]=t[e+r];o[1]=t[e+r+1];h=n.call(a,s,o);if(h){return h}s[0]=o[0];s[1]=o[1]}return false};var Ua={};Ua.lineString=function(t,e,i,r,n){var a=pa.extendFlatCoordinates(pa.createEmpty(),t,e,i,r);if(!pa.intersects(n,a)){return false}if(pa.containsExtent(n,a)){return true}if(a[0]>=n[0]&&a[2]<=n[2]){return true}if(a[1]>=n[1]&&a[3]<=n[3]){return true}return ka.forEach(t,e,i,r,(function(t,e){return pa.intersectsSegment(n,t,e)}))};Ua.lineStrings=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){if(Ua.lineString(t,e,i[a],r,n)){return true}e=i[a]}return false};Ua.linearRing=function(t,e,i,r,n){if(Ua.lineString(t,e,i,r,n)){return true}if(Na.linearRingContainsXY(t,e,i,r,n[0],n[1])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[0],n[3])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[2],n[1])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[2],n[3])){return true}return false};Ua.linearRings=function(t,e,i,r,n){if(!Ua.linearRing(t,e,i[0],r,n)){return false}if(i.length===1){return true}var a,s;for(a=1,s=i.length;a<s;++a){if(Na.linearRingContainsExtent(t,i[a-1],i[a],r,n)){return false}}return true};Ua.linearRingss=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];if(Ua.linearRings(t,e,o,r,n)){return true}e=o[o.length-1]}return false};var za={};za.coordinates=function(t,e,i,r){while(e<i-r){var n;for(n=0;n<r;++n){var a=t[e+n];t[e+n]=t[i-r+n];t[i-r+n]=a}e+=r;i-=r}};var Ba={};Ba.linearRingIsClockwise=function(t,e,i,r){var n=0;var a=t[i-r];var s=t[i-r+1];for(;e<i;e+=r){var o=t[e];var h=t[e+1];n+=(o-a)*(h+s);a=o;s=h}return n>0};Ba.linearRingsAreOriented=function(t,e,i,r,n){var a=n!==undefined?n:false;var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];var l=Ba.linearRingIsClockwise(t,e,h,r);if(s===0){if(a&&l||!a&&!l){return false}}else{if(a&&!l||!a&&l){return false}}e=h}return true};Ba.linearRingssAreOriented=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){if(!Ba.linearRingsAreOriented(t,e,i[a],r,n)){return false}}return true};Ba.orientLinearRings=function(t,e,i,r,n){var a=n!==undefined?n:false;var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];var l=Ba.linearRingIsClockwise(t,e,h,r);var u=s===0?a&&l||!a&&!l:a&&!l||!a&&l;if(u){za.coordinates(t,e,h,r)}e=h}return e};Ba.orientLinearRingss=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){e=Ba.orientLinearRings(t,e,i[a],r,n)}return e};var Wa=function(t,e){La.call(this);this.ends_=[];this.flatInteriorPointRevision_=-1;this.flatInteriorPoint_=null;this.maxDelta_=-1;this.maxDeltaRevision_=-1;this.orientedRevision_=-1;this.orientedFlatCoordinates_=null;this.setCoordinates(t,e)};qn.inherits(Wa,La);Wa.prototype.appendLinearRing=function(t){if(!this.flatCoordinates){this.flatCoordinates=t.getFlatCoordinates().slice()}else{fa.extend(this.flatCoordinates,t.getFlatCoordinates())}this.ends_.push(this.flatCoordinates.length);this.changed()};Wa.prototype.clone=function(){var t=new Wa(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice(),this.ends_.slice());return t};Wa.prototype.closestPointXY=function(t,e,i,r){if(r<pa.closestSquaredDistanceXY(this.getExtent(),t,e)){return r}if(this.maxDeltaRevision_!=this.getRevision()){this.maxDelta_=Math.sqrt(wa.getsMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0));this.maxDeltaRevision_=this.getRevision()}return wa.getsClosestPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,true,t,e,i,r)};Wa.prototype.containsXY=function(t,e){return Na.linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)};Wa.prototype.getArea=function(){return Aa.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)};Wa.prototype.getCoordinates=function(t){var e;if(t!==undefined){e=this.getOrientedFlatCoordinates().slice();Ba.orientLinearRings(e,0,this.ends_,this.stride,t)}else{e=this.flatCoordinates}return ba.coordinatess(e,0,this.ends_,this.stride)};Wa.prototype.getEnds=function(){return this.ends_};Wa.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=pa.getCenter(this.getExtent());this.flatInteriorPoint_=Ga.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0);this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_};Wa.prototype.getInteriorPoint=function(){return new Fa(this.getFlatInteriorPoint(),va.XYM)};Wa.prototype.getLinearRingCount=function(){return this.ends_.length};Wa.prototype.getLinearRing=function(t){if(t<0||this.ends_.length<=t){return null}var e=new Da(null);e.setFlatCoordinates(this.layout,this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]));return e};Wa.prototype.getLinearRings=function(){var t=this.layout;var e=this.flatCoordinates;var i=this.ends_;var r=[];var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];var h=new Da(null);h.setFlatCoordinates(t,e.slice(n,o));r.push(h);n=o}return r};Wa.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;if(Ba.linearRingsAreOriented(t,0,this.ends_,this.stride)){this.orientedFlatCoordinates_=t}else{this.orientedFlatCoordinates_=t.slice();this.orientedFlatCoordinates_.length=Ba.orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)}this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_};Wa.prototype.getSimplifiedGeometryInternal=function(t){var e=[];var i=[];e.length=Pa.quantizes(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i);var r=new Wa(null);r.setFlatCoordinates(va.XY,e,i);return r};Wa.prototype.getType=function(){return la.POLYGON};Wa.prototype.intersectsExtent=function(t){return Ua.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)};Wa.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null,this.ends_)}else{this.setLayout(e,t,2);if(!this.flatCoordinates){this.flatCoordinates=[]}var i=Oa.coordinatess(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1];this.changed()}};Wa.prototype.setFlatCoordinates=function(t,e,i){this.setFlatCoordinatesInternal(t,e);this.ends_=i;this.changed()};Wa.circular=function(t,e,i,r){var n=r?r:32;var a=[];var s;for(s=0;s<n;++s){fa.extend(a,t.offset(e,i,2*Math.PI*s/n))}a.push(a[0],a[1]);var o=new Wa(null);o.setFlatCoordinates(va.XY,a,[a.length]);return o};Wa.fromExtent=function(t){var e=t[0];var i=t[1];var r=t[2];var n=t[3];var a=[e,i,e,n,r,n,r,i,e,i];var s=new Wa(null);s.setFlatCoordinates(va.XY,a,[a.length]);return s};Wa.fromCircle=function(t,e,i){var r=e?e:32;var n=t.getStride();var a=t.getLayout();var s=new Wa(null,a);var o=n*(r+1);var h=new Array(o);for(var l=0;l<o;l++){h[l]=0}var u=[h.length];s.setFlatCoordinates(a,h,u);Wa.makeRegular(s,t.getCenter(),t.getRadius(),i);return s};Wa.makeRegular=function(t,e,i,r){var n=t.getFlatCoordinates();var a=t.getLayout();var s=t.getStride();var o=t.getEnds();var h=n.length/s-1;var l=r?r:0;var u,f;for(var c=0;c<=h;++c){f=c*s;u=l+ha.modulo(c,h)*2*Math.PI/h;n[f]=e[0]+i*Math.cos(u);n[f+1]=e[1]+i*Math.sin(u)}t.setFlatCoordinates(a,n,o)};var Xa={};Xa.ONE=1;Xa.SRC_ALPHA=770;Xa.COLOR_ATTACHMENT0=36064;Xa.COLOR_BUFFER_BIT=16384;Xa.TRIANGLES=4;Xa.TRIANGLE_STRIP=5;Xa.ONE_MINUS_SRC_ALPHA=771;Xa.ARRAY_BUFFER=34962;Xa.ELEMENT_ARRAY_BUFFER=34963;Xa.STREAM_DRAW=35040;Xa.STATIC_DRAW=35044;Xa.DYNAMIC_DRAW=35048;Xa.CULL_FACE=2884;Xa.BLEND=3042;Xa.STENCIL_TEST=2960;Xa.DEPTH_TEST=2929;Xa.SCISSOR_TEST=3089;Xa.UNSIGNED_BYTE=5121;Xa.UNSIGNED_SHORT=5123;Xa.UNSIGNED_INT=5125;Xa.FLOAT=5126;Xa.RGBA=6408;Xa.FRAGMENT_SHADER=35632;Xa.VERTEX_SHADER=35633;Xa.LINK_STATUS=35714;Xa.LINEAR=9729;Xa.TEXTURE_MAG_FILTER=10240;Xa.TEXTURE_MIN_FILTER=10241;Xa.TEXTURE_WRAP_S=10242;Xa.TEXTURE_WRAP_T=10243;Xa.TEXTURE_2D=3553;Xa.TEXTURE0=33984;Xa.CLAMP_TO_EDGE=33071;Xa.COMPILE_STATUS=35713;Xa.FRAMEBUFFER=36160;Xa.CONTEXT_IDS_=["experimental-webgl","webgl","webkit-3d","moz-webgl"];Xa.getContext=function(t,e){var i,r,n=Xa.CONTEXT_IDS_.length;for(r=0;r<n;++r){try{i=t.getContext(Xa.CONTEXT_IDS_[r],e);if(i){return i}}catch(a){}}return null};var Va={};var Ya=typeof navigator!=="undefined"?navigator.userAgent.toLowerCase():"";Va.FIREFOX=Ya.indexOf("firefox")!==-1;Va.SAFARI=Ya.indexOf("safari")!==-1&&Ya.indexOf("chrom")==-1;Va.WEBKIT=Ya.indexOf("webkit")!==-1&&Ya.indexOf("edge")==-1;Va.MAC=Ya.indexOf("macintosh")!==-1;Va.DEVICE_PIXEL_RATIO=window.devicePixelRatio||1;Va.CANVAS_LINE_DASH=false;Va.CANVAS=qn.ENABLE_CANVAS&&function(){if(!("HTMLCanvasElement"in window)){return false}try{var t=document.createElement("CANVAS").getContext("2d");if(!t){return false}else{if(t.setLineDash!==undefined){Va.CANVAS_LINE_DASH=true}return true}}catch(e){return false}}();Va.DEVICE_ORIENTATION="DeviceOrientationEvent"in window;Va.GEOLOCATION="geolocation"in navigator;Va.TOUCH=qn.ASSUME_TOUCH||"ontouchstart"in window;Va.POINTER="PointerEvent"in window;Va.MSPOINTER=!!navigator.msPointerEnabled;(function(){if(qn.ENABLE_WEBGL){var t=false;var e;var i=[];if("WebGLRenderingContext"in window){try{var r=document.createElement("CANVAS");var n=Xa.getContext(r,{failIfMajorPerformanceCaveat:true});if(n){t=true;e=n.getParameter(n.MAX_TEXTURE_SIZE);i=n.getSupportedExtensions()}}catch(a){}}Va.WEBGL=t;qn.WEBGL_EXTENSIONS=i;qn.WEBGL_MAX_TEXTURE_SIZE=e}})();var ja=function(t){aa.call(this);var e=t||{};this.position_=null;this.transform_=Ma.identityTransform;this.sphere_=new ua(Ta.RADIUS);this.watchId_=undefined;$n.listen(this,aa.getChangeEventType(Zn.PROJECTION),this.handleProjectionChanged_,this);$n.listen(this,aa.getChangeEventType(Zn.TRACKING),this.handleTrackingChanged_,this);if(e.projection!==undefined){this.setProjection(e.projection)}if(e.trackingOptions!==undefined){this.setTrackingOptions(e.trackingOptions)}this.setTracking(e.tracking!==undefined?e.tracking:false)};qn.inherits(ja,aa);ja.prototype.disposeInternal=function(){this.setTracking(false);aa.prototype.disposeInternal.call(this)};ja.prototype.handleProjectionChanged_=function(){var t=this.getProjection();if(t){this.transform_=Ma.getTransformFromProjections(Ma.get("EPSG:4326"),t);if(this.position_){this.set(Zn.POSITION,this.transform_(this.position_))}}};ja.prototype.handleTrackingChanged_=function(){if(Va.GEOLOCATION){var t=this.getTracking();if(t&&this.watchId_===undefined){this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions())}else if(!t&&this.watchId_!==undefined){navigator.geolocation.clearWatch(this.watchId_);this.watchId_=undefined}}};ja.prototype.positionChange_=function(t){var e=t.coords;this.set(Zn.ACCURACY,e.accuracy);this.set(Zn.ALTITUDE,e.altitude===null?undefined:e.altitude);this.set(Zn.ALTITUDE_ACCURACY,e.altitudeAccuracy===null?undefined:e.altitudeAccuracy);this.set(Zn.HEADING,e.heading===null?undefined:ha.toRadians(e.heading));if(!this.position_){this.position_=[e.longitude,e.latitude]}else{this.position_[0]=e.longitude;this.position_[1]=e.latitude}var i=this.transform_(this.position_);this.set(Zn.POSITION,i);this.set(Zn.SPEED,e.speed===null?undefined:e.speed);var r=Wa.circular(this.sphere_,this.position_,e.accuracy);r.applyTransform(this.transform_);this.set(Zn.ACCURACY_GEOMETRY,r);this.changed()};ja.prototype.positionError_=function(t){t.type=ra.ERROR;this.setTracking(false);this.dispatchEvent(t)};ja.prototype.getAccuracy=function(){return this.get(Zn.ACCURACY)};ja.prototype.getAccuracyGeometry=function(){return this.get(Zn.ACCURACY_GEOMETRY)||null};ja.prototype.getAltitude=function(){return this.get(Zn.ALTITUDE)};ja.prototype.getAltitudeAccuracy=function(){return this.get(Zn.ALTITUDE_ACCURACY)};ja.prototype.getHeading=function(){return this.get(Zn.HEADING)};ja.prototype.getPosition=function(){return this.get(Zn.POSITION)};ja.prototype.getProjection=function(){return this.get(Zn.PROJECTION)};ja.prototype.getSpeed=function(){return this.get(Zn.SPEED)};ja.prototype.getTracking=function(){return this.get(Zn.TRACKING)};ja.prototype.getTrackingOptions=function(){return this.get(Zn.TRACKING_OPTIONS)};ja.prototype.setProjection=function(t){this.set(Zn.PROJECTION,Ma.get(t))};ja.prototype.setTracking=function(t){this.set(Zn.TRACKING,t)};ja.prototype.setTrackingOptions=function(t){this.set(Zn.TRACKING_OPTIONS,t)};var Ha={ADD:"add",REMOVE:"remove"};var Ka=function(t,e){aa.call(this);var i=e||{};this.unique_=!!i.unique;this.array_=t?t:[];if(this.unique_){for(var r=0,n=this.array_.length;r<n;++r){this.assertUnique_(this.array_[r],r)}}this.updateLength_()};qn.inherits(Ka,aa);Ka.prototype.clear=function(){while(this.getLength()>0){this.pop()}};Ka.prototype.extend=function(t){var e,i;for(e=0,i=t.length;e<i;++e){this.push(t[e])}return this};Ka.prototype.forEach=function(t,e){var i=e?t.bind(e):t;var r=this.array_;for(var n=0,a=r.length;n<a;++n){i(r[n],n,r)}};Ka.prototype.getArray=function(){return this.array_};Ka.prototype.item=function(t){return this.array_[t]};Ka.prototype.getLength=function(){return this.get(Ka.Property_.LENGTH)};Ka.prototype.insertAt=function(t,e){if(this.unique_){this.assertUnique_(e)}this.array_.splice(t,0,e);this.updateLength_();this.dispatchEvent(new Ka.Event(Ha.ADD,e))};Ka.prototype.pop=function(){return this.removeAt(this.getLength()-1)};Ka.prototype.push=function(t){if(this.unique_){this.assertUnique_(t)}var e=this.getLength();this.insertAt(e,t);return this.getLength()};Ka.prototype.remove=function(t){var e=this.array_;var i,r;for(i=0,r=e.length;i<r;++i){if(e[i]===t){return this.removeAt(i)}}return undefined};Ka.prototype.removeAt=function(t){var e=this.array_[t];this.array_.splice(t,1);this.updateLength_();this.dispatchEvent(new Ka.Event(Ha.REMOVE,e));return e};Ka.prototype.setAt=function(t,e){var i=this.getLength();if(t<i){if(this.unique_){this.assertUnique_(e,t)}var r=this.array_[t];this.array_[t]=e;this.dispatchEvent(new Ka.Event(Ha.REMOVE,r));this.dispatchEvent(new Ka.Event(Ha.ADD,e))}else{var n;for(n=i;n<t;++n){this.insertAt(n,undefined)}this.insertAt(t,e)}};Ka.prototype.updateLength_=function(){this.set(Ka.Property_.LENGTH,this.array_.length)};Ka.prototype.assertUnique_=function(t,e){for(var i=0,r=this.array_.length;i<r;++i){if(this.array_[i]===t&&i!==e){throw new sa(58)}}};Ka.Property_={LENGTH:"length"};Ka.Event=function(t,e){ea.call(this,t);this.element=e};qn.inherits(Ka.Event,ea);var qa=function(t,e,i){ea.call(this,t);this.map=e;this.frameState=i!==undefined?i:null};qn.inherits(qa,ea);var Za=function(t,e,i,r,n){qa.call(this,t,e,n);this.originalEvent=i;this.pixel=e.getEventPixel(i);this.coordinate=e.getCoordinateFromPixel(this.pixel);this.dragging=r!==undefined?r:false};qn.inherits(Za,qa);Za.prototype.preventDefault=function(){qa.prototype.preventDefault.call(this);this.originalEvent.preventDefault()};Za.prototype.stopPropagation=function(){qa.prototype.stopPropagation.call(this);this.originalEvent.stopPropagation()};var Ja={SINGLECLICK:"singleclick",CLICK:ra.CLICK,DBLCLICK:ra.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Qa=function(t,e,i,r,n){Za.call(this,t,e,i.originalEvent,r,n);this.pointerEvent=i};qn.inherits(Qa,Za);var $a={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var ts=function(t,e){this.dispatcher=t;this.mapping_=e};ts.prototype.getEvents=function(){return Object.keys(this.mapping_)};ts.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var es=function(t){var e={mousedown:this.mousedown,mousemove:this.mousemove,mouseup:this.mouseup,mouseover:this.mouseover,mouseout:this.mouseout};ts.call(this,t,e);this.pointerMap=t.pointerMap;this.lastTouches=[]};qn.inherits(es,ts);es.POINTER_ID=1;es.POINTER_TYPE="mouse";es.DEDUP_DIST=25;es.prototype.isEventSimulatedFromTouch_=function(t){var e=this.lastTouches;var i=t.clientX,r=t.clientY;for(var n=0,a=e.length,s;n<a&&(s=e[n]);n++){var o=Math.abs(i-s[0]),h=Math.abs(r-s[1]);if(o<=es.DEDUP_DIST&&h<=es.DEDUP_DIST){return true}}return false};es.prepareEvent=function(t,e){var i=e.cloneEvent(t,t);var r=i.preventDefault;i.preventDefault=function(){t.preventDefault();r()};i.pointerId=es.POINTER_ID;i.isPrimary=true;i.pointerType=es.POINTER_TYPE;return i};es.prototype.mousedown=function(t){if(!this.isEventSimulatedFromTouch_(t)){if(es.POINTER_ID.toString()in this.pointerMap){this.cancel(t)}var e=es.prepareEvent(t,this.dispatcher);this.pointerMap[es.POINTER_ID.toString()]=t;this.dispatcher.down(e,t)}};es.prototype.mousemove=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.move(e,t)}};es.prototype.mouseup=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=this.pointerMap[es.POINTER_ID.toString()];if(e&&e.button===t.button){var i=es.prepareEvent(t,this.dispatcher);this.dispatcher.up(i,t);this.cleanupMouse()}}};es.prototype.mouseover=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.enterOver(e,t)}};es.prototype.mouseout=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.leaveOut(e,t)}};es.prototype.cancel=function(t){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.cancel(e,t);this.cleanupMouse()};es.prototype.cleanupMouse=function(){delete this.pointerMap[es.POINTER_ID.toString()]};var is=function(t){var e={MSPointerDown:this.msPointerDown,MSPointerMove:this.msPointerMove,MSPointerUp:this.msPointerUp,MSPointerOut:this.msPointerOut,MSPointerOver:this.msPointerOver,MSPointerCancel:this.msPointerCancel,MSGotPointerCapture:this.msGotPointerCapture,MSLostPointerCapture:this.msLostPointerCapture};ts.call(this,t,e);this.pointerMap=t.pointerMap;this.POINTER_TYPES=["","unavailable","touch","pen","mouse"]};qn.inherits(is,ts);is.prototype.prepareEvent_=function(t){var e=t;if(typeof t.pointerType==="number"){e=this.dispatcher.cloneEvent(t,t);e.pointerType=this.POINTER_TYPES[t.pointerType]}return e};is.prototype.cleanup=function(t){delete this.pointerMap[t.toString()]};is.prototype.msPointerDown=function(t){this.pointerMap[t.pointerId.toString()]=t;var e=this.prepareEvent_(t);this.dispatcher.down(e,t)};is.prototype.msPointerMove=function(t){var e=this.prepareEvent_(t);this.dispatcher.move(e,t)};is.prototype.msPointerUp=function(t){var e=this.prepareEvent_(t);this.dispatcher.up(e,t);this.cleanup(t.pointerId)};is.prototype.msPointerOut=function(t){var e=this.prepareEvent_(t);this.dispatcher.leaveOut(e,t)};is.prototype.msPointerOver=function(t){var e=this.prepareEvent_(t);this.dispatcher.enterOver(e,t)};is.prototype.msPointerCancel=function(t){var e=this.prepareEvent_(t);this.dispatcher.cancel(e,t);this.cleanup(t.pointerId)};is.prototype.msLostPointerCapture=function(t){var e=this.dispatcher.makeEvent("lostpointercapture",t,t);this.dispatcher.dispatchEvent(e)};is.prototype.msGotPointerCapture=function(t){var e=this.dispatcher.makeEvent("gotpointercapture",t,t);this.dispatcher.dispatchEvent(e)};var rs=function(t){var e={pointerdown:this.pointerDown,pointermove:this.pointerMove,pointerup:this.pointerUp,pointerout:this.pointerOut,pointerover:this.pointerOver,pointercancel:this.pointerCancel,gotpointercapture:this.gotPointerCapture,lostpointercapture:this.lostPointerCapture};ts.call(this,t,e)};qn.inherits(rs,ts);rs.prototype.pointerDown=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerMove=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerUp=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerOut=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerOver=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerCancel=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.lostPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.gotPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};var ns=function(t,e,i){ea.call(this,t);this.originalEvent=e;var r=i?i:{};this.buttons=this.getButtons_(r);this.pressure=this.getPressure_(r,this.buttons);this.bubbles="bubbles"in r?r["bubbles"]:false;this.cancelable="cancelable"in r?r["cancelable"]:false;this.view="view"in r?r["view"]:null;this.detail="detail"in r?r["detail"]:null;this.screenX="screenX"in r?r["screenX"]:0;this.screenY="screenY"in r?r["screenY"]:0;this.clientX="clientX"in r?r["clientX"]:0;this.clientY="clientY"in r?r["clientY"]:0;this.ctrlKey="ctrlKey"in r?r["ctrlKey"]:false;this.altKey="altKey"in r?r["altKey"]:false;this.shiftKey="shiftKey"in r?r["shiftKey"]:false;this.metaKey="metaKey"in r?r["metaKey"]:false;this.button="button"in r?r["button"]:0;this.relatedTarget="relatedTarget"in r?r["relatedTarget"]:null;this.pointerId="pointerId"in r?r["pointerId"]:0;this.width="width"in r?r["width"]:0;this.height="height"in r?r["height"]:0;this.tiltX="tiltX"in r?r["tiltX"]:0;this.tiltY="tiltY"in r?r["tiltY"]:0;this.pointerType="pointerType"in r?r["pointerType"]:"";this.hwTimestamp="hwTimestamp"in r?r["hwTimestamp"]:0;this.isPrimary="isPrimary"in r?r["isPrimary"]:false;if(e.preventDefault){this.preventDefault=function(){e.preventDefault()}}};qn.inherits(ns,ea);ns.prototype.getButtons_=function(t){var e;if(t.buttons||ns.HAS_BUTTONS){e=t.buttons}else{switch(t.which){case 1:e=1;break;case 2:e=4;break;case 3:e=2;break;default:e=0}}return e};ns.prototype.getPressure_=function(t,e){var i=0;if(t.pressure){i=t.pressure}else{i=e?.5:0}return i};ns.HAS_BUTTONS=false;(function(){try{var t=new MouseEvent("click",{buttons:1});ns.HAS_BUTTONS=t.buttons===1}catch(e){}})();var as=function(t,e){var i={touchstart:this.touchstart,touchmove:this.touchmove,touchend:this.touchend,touchcancel:this.touchcancel};ts.call(this,t,i);this.pointerMap=t.pointerMap;this.mouseSource=e;this.firstTouchId_=undefined;this.clickCount_=0;this.resetId_=undefined};qn.inherits(as,ts);as.DEDUP_TIMEOUT=2500;as.CLICK_COUNT_TIMEOUT=200;as.POINTER_TYPE="touch";as.prototype.isPrimaryTouch_=function(t){return this.firstTouchId_===t.identifier};as.prototype.setPrimaryTouch_=function(t){var e=Object.keys(this.pointerMap).length;if(e===0||e===1&&es.POINTER_ID.toString()in this.pointerMap){this.firstTouchId_=t.identifier;this.cancelResetClickCount_()}};as.prototype.removePrimaryPointer_=function(t){if(t.isPrimary){this.firstTouchId_=undefined;this.resetClickCount_()}};as.prototype.resetClickCount_=function(){this.resetId_=setTimeout(this.resetClickCountHandler_.bind(this),as.CLICK_COUNT_TIMEOUT)};as.prototype.resetClickCountHandler_=function(){this.clickCount_=0;this.resetId_=undefined};as.prototype.cancelResetClickCount_=function(){if(this.resetId_!==undefined){clearTimeout(this.resetId_)}};as.prototype.touchToPointer_=function(t,e){var i=this.dispatcher.cloneEvent(t,e);i.pointerId=e.identifier+2;i.bubbles=true;i.cancelable=true;i.detail=this.clickCount_;i.button=0;i.buttons=1;i.width=e.webkitRadiusX||e.radiusX||0;i.height=e.webkitRadiusY||e.radiusY||0;i.pressure=e.webkitForce||e.force||.5;i.isPrimary=this.isPrimaryTouch_(e);i.pointerType=as.POINTER_TYPE;i.clientX=e.clientX;i.clientY=e.clientY;i.screenX=e.screenX;i.screenY=e.screenY;return i};as.prototype.processTouches_=function(t,e){var i=Array.prototype.slice.call(t.changedTouches);var r=i.length;function n(){t.preventDefault()}var a,s;for(a=0;a<r;++a){s=this.touchToPointer_(t,i[a]);s.preventDefault=n;e.call(this,t,s)}};as.prototype.findTouch_=function(t,e){var i=t.length;var r;for(var n=0;n<i;n++){r=t[n];if(r.identifier===e){return true}}return false};as.prototype.vacuumTouches_=function(t){var e=t.touches;var i=Object.keys(this.pointerMap);var r=i.length;if(r>=e.length){var n=[];var a,s,o;for(a=0;a<r;++a){s=i[a];o=this.pointerMap[s];if(s!=es.POINTER_ID&&!this.findTouch_(e,s-2)){n.push(o.out)}}for(a=0;a<n.length;++a){this.cancelOut_(t,n[a])}}};as.prototype.touchstart=function(t){this.vacuumTouches_(t);this.setPrimaryTouch_(t.changedTouches[0]);this.dedupSynthMouse_(t);this.clickCount_++;this.processTouches_(t,this.overDown_)};as.prototype.overDown_=function(t,e){this.pointerMap[e.pointerId]={target:e.target,out:e,outTarget:e.target};this.dispatcher.over(e,t);this.dispatcher.enter(e,t);this.dispatcher.down(e,t)};as.prototype.touchmove=function(t){t.preventDefault();this.processTouches_(t,this.moveOverOut_)};as.prototype.moveOverOut_=function(t,e){var i=e;var r=this.pointerMap[i.pointerId];if(!r){return}var n=r.out;var a=r.outTarget;this.dispatcher.move(i,t);if(n&&a!==i.target){n.relatedTarget=i.target;i.relatedTarget=a;n.target=a;if(i.target){this.dispatcher.leaveOut(n,t);this.dispatcher.enterOver(i,t)}else{i.target=a;i.relatedTarget=null;this.cancelOut_(t,i)}}r.out=i;r.outTarget=i.target};as.prototype.touchend=function(t){this.dedupSynthMouse_(t);this.processTouches_(t,this.upOut_)};as.prototype.upOut_=function(t,e){this.dispatcher.up(e,t);this.dispatcher.out(e,t);this.dispatcher.leave(e,t);this.cleanUpPointer_(e)};as.prototype.touchcancel=function(t){this.processTouches_(t,this.cancelOut_)};as.prototype.cancelOut_=function(t,e){this.dispatcher.cancel(e,t);this.dispatcher.out(e,t);this.dispatcher.leave(e,t);this.cleanUpPointer_(e)};as.prototype.cleanUpPointer_=function(t){delete this.pointerMap[t.pointerId];this.removePrimaryPointer_(t)};as.prototype.dedupSynthMouse_=function(t){var e=this.mouseSource.lastTouches;var i=t.changedTouches[0];if(this.isPrimaryTouch_(i)){var r=[i.clientX,i.clientY];e.push(r);setTimeout((function(){fa.remove(e,r)}),as.DEDUP_TIMEOUT)}};var ss=function(t){ia.call(this);this.element_=t;this.pointerMap={};this.eventMap_={};this.eventSourceList_=[];this.registerSources()};qn.inherits(ss,ia);ss.prototype.registerSources=function(){if(Va.POINTER){this.registerSource("native",new rs(this))}else if(Va.MSPOINTER){this.registerSource("ms",new is(this))}else{var t=new es(this);this.registerSource("mouse",t);if(Va.TOUCH){this.registerSource("touch",new as(this,t))}}this.register_()};ss.prototype.registerSource=function(t,e){var i=e;var r=i.getEvents();if(r){r.forEach((function(t){var e=i.getHandlerForEvent(t);if(e){this.eventMap_[t]=e.bind(i)}}),this);this.eventSourceList_.push(i)}};ss.prototype.register_=function(){var t=this.eventSourceList_.length;var e;for(var i=0;i<t;i++){e=this.eventSourceList_[i];this.addEvents_(e.getEvents())}};ss.prototype.unregister_=function(){var t=this.eventSourceList_.length;var e;for(var i=0;i<t;i++){e=this.eventSourceList_[i];this.removeEvents_(e.getEvents())}};ss.prototype.eventHandler_=function(t){var e=t.type;var i=this.eventMap_[e];if(i){i(t)}};ss.prototype.addEvents_=function(t){t.forEach((function(t){$n.listen(this.element_,t,this.eventHandler_,this)}),this)};ss.prototype.removeEvents_=function(t){t.forEach((function(t){$n.unlisten(this.element_,t,this.eventHandler_,this)}),this)};ss.prototype.cloneEvent=function(t,e){var i={},r;for(var n=0,a=ss.CLONE_PROPS.length;n<a;n++){r=ss.CLONE_PROPS[n][0];i[r]=t[r]||e[r]||ss.CLONE_PROPS[n][1]}return i};ss.prototype.down=function(t,e){this.fireEvent($a.POINTERDOWN,t,e)};ss.prototype.move=function(t,e){this.fireEvent($a.POINTERMOVE,t,e)};ss.prototype.up=function(t,e){this.fireEvent($a.POINTERUP,t,e)};ss.prototype.enter=function(t,e){t.bubbles=false;this.fireEvent($a.POINTERENTER,t,e)};ss.prototype.leave=function(t,e){t.bubbles=false;this.fireEvent($a.POINTERLEAVE,t,e)};ss.prototype.over=function(t,e){t.bubbles=true;this.fireEvent($a.POINTEROVER,t,e)};ss.prototype.out=function(t,e){t.bubbles=true;this.fireEvent($a.POINTEROUT,t,e)};ss.prototype.cancel=function(t,e){this.fireEvent($a.POINTERCANCEL,t,e)};ss.prototype.leaveOut=function(t,e){this.out(t,e);if(!this.contains_(t.target,t.relatedTarget)){this.leave(t,e)}};ss.prototype.enterOver=function(t,e){this.over(t,e);if(!this.contains_(t.target,t.relatedTarget)){this.enter(t,e)}};ss.prototype.contains_=function(t,e){if(!t||!e){return false}return t.contains(e)};ss.prototype.makeEvent=function(t,e,i){return new ns(t,i,e)};ss.prototype.fireEvent=function(t,e,i){var r=this.makeEvent(t,e,i);this.dispatchEvent(r)};ss.prototype.fireNativeEvent=function(t){var e=this.makeEvent(t.type,t,t);this.dispatchEvent(e)};ss.prototype.wrapMouseEvent=function(t,e){var i=this.makeEvent(t,es.prepareEvent(e,this),e);return i};ss.prototype.disposeInternal=function(){this.unregister_();ia.prototype.disposeInternal.call(this)};ss.CLONE_PROPS=[["bubbles",false],["cancelable",false],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",false],["altKey",false],["shiftKey",false],["metaKey",false],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",false],["type",""],["target",null],["currentTarget",null],["which",0]];var os=function(t,e){ia.call(this);this.map_=t;this.clickTimeoutId_=0;this.dragging_=false;this.dragListenerKeys_=[];this.moveTolerance_=e?e*Va.DEVICE_PIXEL_RATIO:Va.DEVICE_PIXEL_RATIO;this.down_=null;var i=this.map_.getViewport();this.activePointers_=0;this.trackedTouches_={};this.pointerEventHandler_=new ss(i);this.documentPointerEventHandler_=null;this.pointerdownListenerKey_=$n.listen(this.pointerEventHandler_,$a.POINTERDOWN,this.handlePointerDown_,this);this.relayedListenerKey_=$n.listen(this.pointerEventHandler_,$a.POINTERMOVE,this.relayEvent_,this)};qn.inherits(os,ia);os.prototype.emulateClick_=function(t){var e=new Qa(Ja.CLICK,this.map_,t);this.dispatchEvent(e);if(this.clickTimeoutId_!==0){clearTimeout(this.clickTimeoutId_);this.clickTimeoutId_=0;e=new Qa(Ja.DBLCLICK,this.map_,t);this.dispatchEvent(e)}else{this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=0;var e=new Qa(Ja.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)}};os.prototype.updateActivePointers_=function(t){var e=t;if(e.type==Ja.POINTERUP||e.type==Ja.POINTERCANCEL){delete this.trackedTouches_[e.pointerId]}else if(e.type==Ja.POINTERDOWN){this.trackedTouches_[e.pointerId]=true}this.activePointers_=Object.keys(this.trackedTouches_).length};os.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new Qa(Ja.POINTERUP,this.map_,t);this.dispatchEvent(e);if(!e.propagationStopped&&!this.dragging_&&this.isMouseActionButton_(t)){this.emulateClick_(this.down_)}if(this.activePointers_===0){this.dragListenerKeys_.forEach($n.unlistenByKey);this.dragListenerKeys_.length=0;this.dragging_=false;this.down_=null;this.documentPointerEventHandler_.dispose();this.documentPointerEventHandler_=null}};os.prototype.isMouseActionButton_=function(t){return t.button===0};os.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new Qa(Ja.POINTERDOWN,this.map_,t);this.dispatchEvent(e);this.down_=t;if(this.dragListenerKeys_.length===0){this.documentPointerEventHandler_=new ss(document);this.dragListenerKeys_.push($n.listen(this.documentPointerEventHandler_,Ja.POINTERMOVE,this.handlePointerMove_,this),$n.listen(this.documentPointerEventHandler_,Ja.POINTERUP,this.handlePointerUp_,this),$n.listen(this.pointerEventHandler_,Ja.POINTERCANCEL,this.handlePointerUp_,this))}};os.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=true;var e=new Qa(Ja.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}t.preventDefault()};os.prototype.relayEvent_=function(t){var e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Qa(t.type,this.map_,t,e))};os.prototype.isMoving_=function(t){return Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_};os.prototype.disposeInternal=function(){if(this.relayedListenerKey_){$n.unlistenByKey(this.relayedListenerKey_);this.relayedListenerKey_=null}if(this.pointerdownListenerKey_){$n.unlistenByKey(this.pointerdownListenerKey_);this.pointerdownListenerKey_=null}this.dragListenerKeys_.forEach($n.unlistenByKey);this.dragListenerKeys_.length=0;if(this.documentPointerEventHandler_){this.documentPointerEventHandler_.dispose();this.documentPointerEventHandler_=null}if(this.pointerEventHandler_){this.pointerEventHandler_.dispose();this.pointerEventHandler_=null}ia.prototype.disposeInternal.call(this)};var hs={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend"};var ls={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var us={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4,ABORT:5};var fs=function(t,e){this.priorityFunction_=t;this.keyFunction_=e;this.elements_=[];this.priorities_=[];this.queuedElements_={}};fs.DROP=Infinity;fs.prototype.clear=function(){this.elements_.length=0;this.priorities_.length=0;Qn.clear(this.queuedElements_)};fs.prototype.dequeue=function(){var t=this.elements_;var e=this.priorities_;var i=t[0];if(t.length==1){t.length=0;e.length=0}else{t[0]=t.pop();e[0]=e.pop();this.siftUp_(0)}var r=this.keyFunction_(i);delete this.queuedElements_[r];return i};fs.prototype.enqueue=function(t){oa.assert(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);if(e!=fs.DROP){this.elements_.push(t);this.priorities_.push(e);this.queuedElements_[this.keyFunction_(t)]=true;this.siftDown_(0,this.elements_.length-1);return true}return false};fs.prototype.getCount=function(){return this.elements_.length};fs.prototype.getLeftChildIndex_=function(t){return t*2+1};fs.prototype.getRightChildIndex_=function(t){return t*2+2};fs.prototype.getParentIndex_=function(t){return t-1>>1};fs.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--){this.siftUp_(t)}};fs.prototype.isEmpty=function(){return this.elements_.length===0};fs.prototype.isKeyQueued=function(t){return t in this.queuedElements_};fs.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))};fs.prototype.siftUp_=function(t){var e=this.elements_;var i=this.priorities_;var r=e.length;var n=e[t];var a=i[t];var s=t;while(t<r>>1){var o=this.getLeftChildIndex_(t);var h=this.getRightChildIndex_(t);var l=h<r&&i[h]<i[o]?h:o;e[t]=e[l];i[t]=i[l];t=l}e[t]=n;i[t]=a;this.siftDown_(s,t)};fs.prototype.siftDown_=function(t,e){var i=this.elements_;var r=this.priorities_;var n=i[e];var a=r[e];while(e>t){var s=this.getParentIndex_(e);if(r[s]>a){i[e]=i[s];r[e]=r[s];e=s}else{break}}i[e]=n;r[e]=a};fs.prototype.reprioritize=function(){var t=this.priorityFunction_;var e=this.elements_;var i=this.priorities_;var r=0;var n=e.length;var a,s,o;for(s=0;s<n;++s){a=e[s];o=t(a);if(o==fs.DROP){delete this.queuedElements_[this.keyFunction_(a)]}else{i[r]=o;e[r++]=a}}e.length=r;i.length=r;this.heapify_()};var cs=function(t,e){fs.call(this,(function(e){return t.apply(null,e)}),(function(t){return t[0].getKey()}));this.tileChangeCallback_=e;this.tilesLoading_=0;this.tilesLoadingKeys_={}};qn.inherits(cs,fs);cs.prototype.enqueue=function(t){var e=fs.prototype.enqueue.call(this,t);if(e){var i=t[0];$n.listen(i,ra.CHANGE,this.handleTileChange,this)}return e};cs.prototype.getTilesLoading=function(){return this.tilesLoading_};cs.prototype.handleTileChange=function(t){var e=t.target;var i=e.getState();if(i===us.LOADED||i===us.ERROR||i===us.EMPTY||i===us.ABORT){$n.unlisten(e,ra.CHANGE,this.handleTileChange,this);var r=e.getKey();if(r in this.tilesLoadingKeys_){delete this.tilesLoadingKeys_[r];--this.tilesLoading_}this.tileChangeCallback_()}};cs.prototype.loadMoreTiles=function(t,e){var i=0;var r=false;var n,a,s;while(this.tilesLoading_<t&&i<e&&this.getCount()>0){a=this.dequeue()[0];s=a.getKey();n=a.getState();if(n===us.ABORT){r=true}else if(n===us.IDLE&&!(s in this.tilesLoadingKeys_)){this.tilesLoadingKeys_[s]=true;++this.tilesLoading_;++i;a.load()}}if(i===0&&r){this.tileChangeCallback_()}};var ds={};ds.createExtent=function(t){return function(e){if(e){return[ha.clamp(e[0],t[0],t[2]),ha.clamp(e[1],t[1],t[3])]}else{return undefined}}};ds.none=function(t){return t};var ps={};ps.createSnapToResolutions=function(t){return function(e,i,r){if(e!==undefined){var n=fa.linearFindNearest(t,e,r);n=ha.clamp(n+i,0,t.length-1);var a=Math.floor(n);if(n!=a&&a<t.length-1){var s=t[a]/t[a+1];return t[a]/Math.pow(s,n-a)}else{return t[a]}}else{return undefined}}};ps.createSnapToPower=function(t,e,i){return function(r,n,a){if(r!==undefined){var s=-a/2+.5;var o=Math.floor(Math.log(e/r)/Math.log(t)+s);var h=Math.max(o+n,0);if(i!==undefined){h=Math.min(h,i)}return e/Math.pow(t,h)}else{return undefined}}};var vs={};vs.disable=function(t,e){if(t!==undefined){return 0}else{return undefined}};vs.none=function(t,e){if(t!==undefined){return t+e}else{return undefined}};vs.createSnapToN=function(t){var e=2*Math.PI/t;return function(t,i){if(t!==undefined){t=Math.floor((t+i)/e+.5)*e;return t}else{return undefined}}};vs.createSnapToZero=function(t){var e=t||ha.toRadians(5);return function(t,i){if(t!==undefined){if(Math.abs(t+i)<=e){return 0}else{return t+i}}else{return undefined}}};var _s={ANIMATING:0,INTERACTING:1};var gs={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};var ms={};ms.padNumber=function(t,e,i){var r=i!==undefined?t.toFixed(i):""+t;var n=r.indexOf(".");n=n===-1?r.length:n;return n>e?r:new Array(1+e-n).join("0")+r};ms.compareVersions=function(t,e){var i=(""+t).split(".");var r=(""+e).split(".");for(var n=0;n<Math.max(i.length,r.length);n++){var a=parseInt(i[n]||"0",10);var s=parseInt(r[n]||"0",10);if(a>s){return 1}if(s>a){return-1}}return 0};var ys={};ys.add=function(t,e){t[0]+=e[0];t[1]+=e[1];return t};ys.closestOnCircle=function(t,e){var i=e.getRadius();var r=e.getCenter();var n=r[0];var a=r[1];var s=t[0];var o=t[1];var h=s-n;var l=o-a;if(h===0&&l===0){h=1}var u=Math.sqrt(h*h+l*l);var f,c;f=n+i*h/u;c=a+i*l/u;return[f,c]};ys.closestOnSegment=function(t,e){var i=t[0];var r=t[1];var n=e[0];var a=e[1];var s=n[0];var o=n[1];var h=a[0];var l=a[1];var u=h-s;var f=l-o;var c=u===0&&f===0?0:(u*(i-s)+f*(r-o))/(u*u+f*f||0);var d,p;if(c<=0){d=s;p=o}else if(c>=1){d=h;p=l}else{d=s+c*u;p=o+c*f}return[d,p]};ys.createStringXY=function(t){return function(e){return ys.toStringXY(e,t)}};ys.degreesToStringHDMS=function(t,e,i){var r=ha.modulo(e+180,360)-180;var n=Math.abs(3600*r);var a=i||0;var s=Math.pow(10,a);var o=Math.floor(n/3600);var h=Math.floor((n-o*3600)/60);var l=n-o*3600-h*60;l=Math.ceil(l*s)/s;if(l>=60){l=0;h+=1}if(h>=60){h=0;o+=1}return o+"° "+ms.padNumber(h,2)+"′ "+ms.padNumber(l,2,a)+"″"+(r==0?"":" "+t.charAt(r<0?1:0))};ys.format=function(t,e,i){if(t){return e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i))}else{return""}};ys.equals=function(t,e){var i=true;for(var r=t.length-1;r>=0;--r){if(t[r]!=e[r]){i=false;break}}return i};ys.rotate=function(t,e){var i=Math.cos(e);var r=Math.sin(e);var n=t[0]*i-t[1]*r;var a=t[1]*i+t[0]*r;t[0]=n;t[1]=a;return t};ys.scale=function(t,e){t[0]*=e;t[1]*=e;return t};ys.sub=function(t,e){t[0]-=e[0];t[1]-=e[1];return t};ys.squaredDistance=function(t,e){var i=t[0]-e[0];var r=t[1]-e[1];return i*i+r*r};ys.distance=function(t,e){return Math.sqrt(ys.squaredDistance(t,e))};ys.squaredDistanceToSegment=function(t,e){return ys.squaredDistance(t,ys.closestOnSegment(t,e))};ys.toStringHDMS=function(t,e){if(t){return ys.degreesToStringHDMS("NS",t[1],e)+" "+ys.degreesToStringHDMS("EW",t[0],e)}else{return""}};ys.toStringXY=function(t,e){return ys.format(t,"{x}, {y}",e)};var Es={};Es.easeIn=function(t){return Math.pow(t,3)};Es.easeOut=function(t){return 1-Es.easeIn(1-t)};Es.inAndOut=function(t){return 3*t*t-2*t*t*t};Es.linear=function(t){return t};Es.upAndDown=function(t){if(t<.5){return Es.inAndOut(2*t)}else{return 1-Es.inAndOut(2*(t-.5))}};var xs=function(t){aa.call(this);var e=Qn.assign({},t);this.hints_=[0,0];this.animations_=[];this.updateAnimations_=this.updateAnimations_.bind(this);this.projection_=Ma.createProjection(e.projection,"EPSG:3857");this.applyOptions_(e)};qn.inherits(xs,aa);xs.prototype.applyOptions_=function(t){var e={};e[gs.CENTER]=t.center!==undefined?t.center:null;var i=xs.createResolutionConstraint_(t);this.maxResolution_=i.maxResolution;this.minResolution_=i.minResolution;this.zoomFactor_=i.zoomFactor;this.resolutions_=t.resolutions;this.minZoom_=i.minZoom;var r=xs.createCenterConstraint_(t);var n=i.constraint;var a=xs.createRotationConstraint_(t);this.constraints_={center:r,resolution:n,rotation:a};if(t.resolution!==undefined){e[gs.RESOLUTION]=t.resolution}else if(t.zoom!==undefined){e[gs.RESOLUTION]=this.constrainResolution(this.maxResolution_,t.zoom-this.minZoom_);if(this.resolutions_){e[gs.RESOLUTION]=ha.clamp(Number(this.getResolution()||e[gs.RESOLUTION]),this.minResolution_,this.maxResolution_)}}e[gs.ROTATION]=t.rotation!==undefined?t.rotation:0;this.setProperties(e);this.options_=t};xs.prototype.getUpdatedOptions_=function(t){var e=Qn.assign({},this.options_);if(e.resolution!==undefined){e.resolution=this.getResolution()}else{e.zoom=this.getZoom()}e.center=this.getCenter();e.rotation=this.getRotation();return Qn.assign({},e,t)};xs.prototype.animate=function(t){var e=arguments.length;var i;if(e>1&&typeof arguments[e-1]==="function"){i=arguments[e-1];--e}if(!this.isDef()){var r=arguments[e-1];if(r.center){this.setCenter(r.center)}if(r.zoom!==undefined){this.setZoom(r.zoom)}if(r.rotation!==undefined){this.setRotation(r.rotation)}if(i){i(true)}return}var n=Date.now();var a=this.getCenter().slice();var s=this.getResolution();var o=this.getRotation();var h=[];for(var l=0;l<e;++l){var u=arguments[l];var f={start:n,complete:false,anchor:u.anchor,duration:u.duration!==undefined?u.duration:1e3,easing:u.easing||Es.inAndOut};if(u.center){f.sourceCenter=a;f.targetCenter=u.center;a=f.targetCenter}if(u.zoom!==undefined){f.sourceResolution=s;f.targetResolution=this.constrainResolution(this.maxResolution_,u.zoom-this.minZoom_,0);s=f.targetResolution}else if(u.resolution){f.sourceResolution=s;f.targetResolution=u.resolution;s=f.targetResolution}if(u.rotation!==undefined){f.sourceRotation=o;var c=ha.modulo(u.rotation-o+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=o+c;o=f.targetRotation}f.callback=i;if(xs.isNoopAnimation(f)){f.complete=true}else{n+=f.duration}h.push(f)}this.animations_.push(h);this.setHint(_s.ANIMATING,1);this.updateAnimations_()};xs.prototype.getAnimating=function(){return this.hints_[_s.ANIMATING]>0};xs.prototype.getInteracting=function(){return this.hints_[_s.INTERACTING]>0};xs.prototype.cancelAnimations=function(){this.setHint(_s.ANIMATING,-this.hints_[_s.ANIMATING]);for(var t=0,e=this.animations_.length;t<e;++t){var i=this.animations_[t];if(i[0].callback){i[0].callback(false)}}this.animations_.length=0};xs.prototype.updateAnimations_=function(){if(this.updateAnimationKey_!==undefined){cancelAnimationFrame(this.updateAnimationKey_);this.updateAnimationKey_=undefined}if(!this.getAnimating()){return}var t=Date.now();var e=false;for(var i=this.animations_.length-1;i>=0;--i){var r=this.animations_[i];var n=true;for(var a=0,s=r.length;a<s;++a){var o=r[a];if(o.complete){continue}var h=t-o.start;var l=o.duration>0?h/o.duration:1;if(l>=1){o.complete=true;l=1}else{n=false}var u=o.easing(l);if(o.sourceCenter){var f=o.sourceCenter[0];var c=o.sourceCenter[1];var d=o.targetCenter[0];var p=o.targetCenter[1];var v=f+u*(d-f);var _=c+u*(p-c);this.set(gs.CENTER,[v,_])}if(o.sourceResolution&&o.targetResolution){var g=u===1?o.targetResolution:o.sourceResolution+u*(o.targetResolution-o.sourceResolution);if(o.anchor){this.set(gs.CENTER,this.calculateCenterZoom(g,o.anchor))}this.set(gs.RESOLUTION,g)}if(o.sourceRotation!==undefined&&o.targetRotation!==undefined){var m=u===1?ha.modulo(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+u*(o.targetRotation-o.sourceRotation);if(o.anchor){this.set(gs.CENTER,this.calculateCenterRotate(m,o.anchor))}this.set(gs.ROTATION,m)}e=true;if(!o.complete){break}}if(n){this.animations_[i]=null;this.setHint(_s.ANIMATING,-1);var y=r[0].callback;if(y){y(true)}}}this.animations_=this.animations_.filter(Boolean);if(e&&this.updateAnimationKey_===undefined){this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_)}};xs.prototype.calculateCenterRotate=function(t,e){var i;var r=this.getCenter();if(r!==undefined){i=[r[0]-e[0],r[1]-e[1]];ys.rotate(i,t-this.getRotation());ys.add(i,e)}return i};xs.prototype.calculateCenterZoom=function(t,e){var i;var r=this.getCenter();var n=this.getResolution();if(r!==undefined&&n!==undefined){var a=e[0]-t*(e[0]-r[0])/n;var s=e[1]-t*(e[1]-r[1])/n;i=[a,s]}return i};xs.prototype.getSizeFromViewport_=function(){var t=[100,100];var e='.ol-viewport[data-view="'+qn.getUid(this)+'"]';var i=document.querySelector(e);if(i){var r=getComputedStyle(i);t[0]=parseInt(r.width,10);t[1]=parseInt(r.height,10)}return t};xs.prototype.constrainCenter=function(t){return this.constraints_.center(t)};xs.prototype.constrainResolution=function(t,e,i){var r=e||0;var n=i||0;return this.constraints_.resolution(t,r,n)};xs.prototype.constrainRotation=function(t,e){var i=e||0;return this.constraints_.rotation(t,i)};xs.prototype.getCenter=function(){return this.get(gs.CENTER)};xs.prototype.getConstraints=function(){return this.constraints_};xs.prototype.getHints=function(t){if(t!==undefined){t[0]=this.hints_[0];t[1]=this.hints_[1];return t}else{return this.hints_.slice()}};xs.prototype.calculateExtent=function(t){var e=t||this.getSizeFromViewport_();var i=this.getCenter();oa.assert(i,1);var r=this.getResolution();oa.assert(r!==undefined,2);var n=this.getRotation();oa.assert(n!==undefined,3);return pa.getForViewAndSize(i,r,n,e)};xs.prototype.getMaxResolution=function(){return this.maxResolution_};xs.prototype.getMinResolution=function(){return this.minResolution_};xs.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)};xs.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))};xs.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)};xs.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))};xs.prototype.getProjection=function(){return this.projection_};xs.prototype.getResolution=function(){return this.get(gs.RESOLUTION)};xs.prototype.getResolutions=function(){return this.resolutions_};xs.prototype.getResolutionForExtent=function(t,e){var i=e||this.getSizeFromViewport_();var r=pa.getWidth(t)/i[0];var n=pa.getHeight(t)/i[1];return Math.max(r,n)};xs.prototype.getResolutionForValueFunction=function(t){var e=t||2;var i=this.maxResolution_;var r=this.minResolution_;var n=Math.log(i/r)/Math.log(e);return function(t){var r=i/Math.pow(e,t*n);return r}};xs.prototype.getRotation=function(){return this.get(gs.ROTATION)};xs.prototype.getValueForResolutionFunction=function(t){var e=t||2;var i=this.maxResolution_;var r=this.minResolution_;var n=Math.log(i/r)/Math.log(e);return function(t){var r=Math.log(i/t)/Math.log(e)/n;return r}};xs.prototype.getState=function(){var t=this.getCenter();var e=this.getProjection();var i=this.getResolution();var r=this.getRotation();return{center:t.slice(),projection:e!==undefined?e:null,resolution:i,rotation:r,zoom:this.getZoom()}};xs.prototype.getZoom=function(){var t;var e=this.getResolution();if(e!==undefined){t=this.getZoomForResolution(e)}return t};xs.prototype.getZoomForResolution=function(t){var e=this.minZoom_||0;var i,r;if(this.resolutions_){var n=fa.linearFindNearest(this.resolutions_,t,1);e=n;i=this.resolutions_[n];if(n==this.resolutions_.length-1){r=2}else{r=i/this.resolutions_[n+1]}}else{i=this.maxResolution_;r=this.zoomFactor_}return e+Math.log(i/t)/Math.log(r)};xs.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)};xs.prototype.fit=function(t,e){var i=e||{};var r=i.size;if(!r){r=this.getSizeFromViewport_()}var n;if(!(t instanceof La)){oa.assert(Array.isArray(t),24);oa.assert(!pa.isEmpty(t),25);n=Wa.fromExtent(t)}else if(t.getType()===la.CIRCLE){t=t.getExtent();n=Wa.fromExtent(t);n.rotate(this.getRotation(),pa.getCenter(t))}else{n=t}var a=i.padding!==undefined?i.padding:[0,0,0,0];var s=i.constrainResolution!==undefined?i.constrainResolution:true;var o=i.nearest!==undefined?i.nearest:false;var h;if(i.minResolution!==undefined){h=i.minResolution}else if(i.maxZoom!==undefined){h=this.constrainResolution(this.maxResolution_,i.maxZoom-this.minZoom_,0)}else{h=0}var l=n.getFlatCoordinates();var u=this.getRotation();var f=Math.cos(-u);var c=Math.sin(-u);var d=+Infinity;var p=+Infinity;var v=-Infinity;var _=-Infinity;var g=n.getStride();for(var m=0,y=l.length;m<y;m+=g){var E=l[m]*f-l[m+1]*c;var x=l[m]*c+l[m+1]*f;d=Math.min(d,E);p=Math.min(p,x);v=Math.max(v,E);_=Math.max(_,x)}var T=this.getResolutionForExtent([d,p,v,_],[r[0]-a[1]-a[3],r[1]-a[0]-a[2]]);T=isNaN(T)?h:Math.max(T,h);if(s){var C=this.constrainResolution(T,0,0);if(!o&&C<T){C=this.constrainResolution(C,-1,0)}T=C}c=-c;var R=(d+v)/2;var M=(p+_)/2;R+=(a[1]-a[3])/2*T;M+=(a[0]-a[2])/2*T;var S=R*f-M*c;var I=M*f+R*c;var L=[S,I];var A=i.callback?i.callback:qn.nullFunction;if(i.duration!==undefined){this.animate({resolution:T,center:L,duration:i.duration,easing:i.easing},A)}else{this.setResolution(T);this.setCenter(L);setTimeout(A.bind(undefined,true),0)}};xs.prototype.centerOn=function(t,e,i){var r=this.getRotation();var n=Math.cos(-r);var a=Math.sin(-r);var s=t[0]*n-t[1]*a;var o=t[1]*n+t[0]*a;var h=this.getResolution();s+=(e[0]/2-i[0])*h;o+=(i[1]-e[1]/2)*h;a=-a;var l=s*n-o*a;var u=o*n+s*a;this.setCenter([l,u])};xs.prototype.isDef=function(){return!!this.getCenter()&&this.getResolution()!==undefined};xs.prototype.rotate=function(t,e){if(e!==undefined){var i=this.calculateCenterRotate(t,e);this.setCenter(i)}this.setRotation(t)};xs.prototype.setCenter=function(t){this.set(gs.CENTER,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setHint=function(t,e){this.hints_[t]+=e;this.changed();return this.hints_[t]};xs.prototype.setResolution=function(t){this.set(gs.RESOLUTION,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setRotation=function(t){this.set(gs.ROTATION,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))};xs.createCenterConstraint_=function(t){if(t.extent!==undefined){return ds.createExtent(t.extent)}else{return ds.none}};xs.createResolutionConstraint_=function(t){var e;var i;var r;var n=28;var a=2;var s=t.minZoom!==undefined?t.minZoom:qn.DEFAULT_MIN_ZOOM;var o=t.maxZoom!==undefined?t.maxZoom:n;var h=t.zoomFactor!==undefined?t.zoomFactor:a;if(t.resolutions!==undefined){var l=t.resolutions;i=l[s];r=l[o]!==undefined?l[o]:l[l.length-1];e=ps.createSnapToResolutions(l)}else{var u=Ma.createProjection(t.projection,"EPSG:3857");var f=u.getExtent();var c=!f?360*Ma.METERS_PER_UNIT[ma.DEGREES]/u.getMetersPerUnit():Math.max(pa.getWidth(f),pa.getHeight(f));var d=c/qn.DEFAULT_TILE_SIZE/Math.pow(a,qn.DEFAULT_MIN_ZOOM);var p=d/Math.pow(a,n-qn.DEFAULT_MIN_ZOOM);i=t.maxResolution;if(i!==undefined){s=0}else{i=d/Math.pow(h,s)}r=t.minResolution;if(r===undefined){if(t.maxZoom!==undefined){if(t.maxResolution!==undefined){r=i/Math.pow(h,o)}else{r=d/Math.pow(h,o)}}else{r=p}}o=s+Math.floor(Math.log(i/r)/Math.log(h));r=i/Math.pow(h,o-s);e=ps.createSnapToPower(h,i,o-s)}return{constraint:e,maxResolution:i,minResolution:r,minZoom:s,zoomFactor:h}};xs.createRotationConstraint_=function(t){var e=t.enableRotation!==undefined?t.enableRotation:true;if(e){var i=t.constrainRotation;if(i===undefined||i===true){return vs.createSnapToZero()}else if(i===false){return vs.none}else if(typeof i==="number"){return vs.createSnapToN(i)}else{return vs.none}}else{return vs.disable}};xs.isNoopAnimation=function(t){if(t.sourceCenter&&t.targetCenter){if(!ys.equals(t.sourceCenter,t.targetCenter)){return false}}if(t.sourceResolution!==t.targetResolution){return false}if(t.sourceRotation!==t.targetRotation){return false}return true};var Ts={};Ts.createCanvasContext2D=function(t,e){var i=document.createElement("CANVAS");if(t){i.width=t}if(e){i.height=e}return i.getContext("2d")};Ts.outerWidth=function(t){var e=t.offsetWidth;var i=getComputedStyle(t);e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10);return e};Ts.outerHeight=function(t){var e=t.offsetHeight;var i=getComputedStyle(t);e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10);return e};Ts.replaceNode=function(t,e){var i=e.parentNode;if(i){i.replaceChild(t,e)}};Ts.removeNode=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null};Ts.removeChildren=function(t){while(t.lastChild){t.removeChild(t.lastChild)}};var Cs={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",SOURCE:"source"};var Rs=function(t){aa.call(this);var e=Qn.assign({},t);e[Cs.OPACITY]=t.opacity!==undefined?t.opacity:1;e[Cs.VISIBLE]=t.visible!==undefined?t.visible:true;e[Cs.Z_INDEX]=t.zIndex!==undefined?t.zIndex:0;e[Cs.MAX_RESOLUTION]=t.maxResolution!==undefined?t.maxResolution:Infinity;e[Cs.MIN_RESOLUTION]=t.minResolution!==undefined?t.minResolution:0;this.setProperties(e);this.state_={layer:this,managed:true}};qn.inherits(Rs,aa);Rs.prototype.getType=function(){return this.type};Rs.prototype.getLayerState=function(){this.state_.opacity=ha.clamp(this.getOpacity(),0,1);this.state_.sourceState=this.getSourceState();this.state_.visible=this.getVisible();this.state_.extent=this.getExtent();this.state_.zIndex=this.getZIndex();this.state_.maxResolution=this.getMaxResolution();this.state_.minResolution=Math.max(this.getMinResolution(),0);return this.state_};Rs.prototype.getLayersArray=function(t){};Rs.prototype.getLayerStatesArray=function(t){};Rs.prototype.getExtent=function(){return this.get(Cs.EXTENT)};Rs.prototype.getMaxResolution=function(){return this.get(Cs.MAX_RESOLUTION)};Rs.prototype.getMinResolution=function(){return this.get(Cs.MIN_RESOLUTION)};Rs.prototype.getOpacity=function(){return this.get(Cs.OPACITY)};Rs.prototype.getSourceState=function(){};Rs.prototype.getVisible=function(){return this.get(Cs.VISIBLE)};Rs.prototype.getZIndex=function(){return this.get(Cs.Z_INDEX)};Rs.prototype.setExtent=function(t){this.set(Cs.EXTENT,t)};Rs.prototype.setMaxResolution=function(t){this.set(Cs.MAX_RESOLUTION,t)};Rs.prototype.setMinResolution=function(t){this.set(Cs.MIN_RESOLUTION,t)};Rs.prototype.setOpacity=function(t){this.set(Cs.OPACITY,t)};Rs.prototype.setVisible=function(t){this.set(Cs.VISIBLE,t)};Rs.prototype.setZIndex=function(t){this.set(Cs.Z_INDEX,t)};var Ms={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var Ss=function(t){var e=t||{};var i=Qn.assign({},e);delete i.layers;var r=e.layers;Rs.call(this,i);this.layersListenerKeys_=[];this.listenerKeys_={};$n.listen(this,aa.getChangeEventType(Ss.Property_.LAYERS),this.handleLayersChanged_,this);if(r){if(Array.isArray(r)){r=new Ka(r.slice(),{unique:true})}else{oa.assert(r instanceof Ka,43);r=r}}else{r=new Ka(undefined,{unique:true})}this.setLayers(r)};qn.inherits(Ss,Rs);Ss.prototype.handleLayerChange_=function(){this.changed()};Ss.prototype.handleLayersChanged_=function(t){this.layersListenerKeys_.forEach($n.unlistenByKey);this.layersListenerKeys_.length=0;var e=this.getLayers();this.layersListenerKeys_.push($n.listen(e,Ha.ADD,this.handleLayersAdd_,this),$n.listen(e,Ha.REMOVE,this.handleLayersRemove_,this));for(var i in this.listenerKeys_){this.listenerKeys_[i].forEach($n.unlistenByKey)}Qn.clear(this.listenerKeys_);var r=e.getArray();var n,a,s;for(n=0,a=r.length;n<a;n++){s=r[n];this.listenerKeys_[qn.getUid(s).toString()]=[$n.listen(s,Jn.PROPERTYCHANGE,this.handleLayerChange_,this),$n.listen(s,ra.CHANGE,this.handleLayerChange_,this)]}this.changed()};Ss.prototype.handleLayersAdd_=function(t){var e=t.element;var i=qn.getUid(e).toString();this.listenerKeys_[i]=[$n.listen(e,Jn.PROPERTYCHANGE,this.handleLayerChange_,this),$n.listen(e,ra.CHANGE,this.handleLayerChange_,this)];this.changed()};Ss.prototype.handleLayersRemove_=function(t){var e=t.element;var i=qn.getUid(e).toString();this.listenerKeys_[i].forEach($n.unlistenByKey);delete this.listenerKeys_[i];this.changed()};Ss.prototype.getLayers=function(){return this.get(Ss.Property_.LAYERS)};Ss.prototype.setLayers=function(t){this.set(Ss.Property_.LAYERS,t)};Ss.prototype.getLayersArray=function(t){var e=t!==undefined?t:[];this.getLayers().forEach((function(t){t.getLayersArray(e)}));return e};Ss.prototype.getLayerStatesArray=function(t){var e=t!==undefined?t:[];var i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));var r=this.getLayerState();var n,a,s;for(n=i,a=e.length;n<a;n++){s=e[n];s.opacity*=r.opacity;s.visible=s.visible&&r.visible;s.maxResolution=Math.min(s.maxResolution,r.maxResolution);s.minResolution=Math.max(s.minResolution,r.minResolution);if(r.extent!==undefined){if(s.extent!==undefined){s.extent=pa.getIntersection(s.extent,r.extent)}else{s.extent=r.extent}}}return e};Ss.prototype.getSourceState=function(){return Ms.READY};Ss.Property_={LAYERS:"layers"};var Is={MAP_RENDERER:"MAP_RENDERER",LAYER_RENDERER:"LAYER_RENDERER"};var Ls={};Ls.mapRendererPlugins_=[];Ls.getMapRendererPlugins=function(){return Ls.mapRendererPlugins_};Ls.layerRendererPlugins_=[];Ls.getLayerRendererPlugins=function(){return Ls.layerRendererPlugins_};Ls.register=function(t,e){var i;switch(t){case Is.MAP_RENDERER:{i=Ls.mapRendererPlugins_;i.push(e);break}case Is.LAYER_RENDERER:{i=Ls.layerRendererPlugins_;i.push(e);break}default:{throw new Error("Unsupported plugin type: "+t)}}};Ls.registerMultiple=function(t,e){for(var i=0,r=e.length;i<r;++i){Ls.register(t,e[i])}};var As={CANVAS:"canvas",WEBGL:"webgl"};var ws={};ws.buffer=function(t,e,i){if(i===undefined){i=[0,0]}i[0]=t[0]+2*e;i[1]=t[1]+2*e;return i};ws.hasArea=function(t){return t[0]>0&&t[1]>0};ws.scale=function(t,e,i){if(i===undefined){i=[0,0]}i[0]=t[0]*e+.5|0;i[1]=t[1]*e+.5|0;return i};ws.toSize=function(t,e){if(Array.isArray(t)){return t}else{if(e===undefined){e=[t,t]}else{e[0]=e[1]=t}return e}};var Os=function(t){aa.call(this);var e=Os.createOptionsInternal(t);this.loadTilesWhileAnimating_=t.loadTilesWhileAnimating!==undefined?t.loadTilesWhileAnimating:false;this.loadTilesWhileInteracting_=t.loadTilesWhileInteracting!==undefined?t.loadTilesWhileInteracting:false;this.pixelRatio_=t.pixelRatio!==undefined?t.pixelRatio:Va.DEVICE_PIXEL_RATIO;this.logos_=e.logos;this.animationDelay_=function(){this.animationDelayKey_=undefined;this.renderFrame_.call(this,Date.now())}.bind(this);this.coordinateToPixelTransform_=Sa.create();this.pixelToCoordinateTransform_=Sa.create();this.frameIndex_=0;this.frameState_=null;this.previousExtent_=null;this.viewPropertyListenerKey_=null;this.viewChangeListenerKey_=null;this.layerGroupPropertyListenerKeys_=null;this.viewport_=document.createElement("DIV");this.viewport_.className="ol-viewport"+(Va.TOUCH?" ol-touch":"");this.viewport_.style.position="relative";this.viewport_.style.overflow="hidden";this.viewport_.style.width="100%";this.viewport_.style.height="100%";this.viewport_.style.msTouchAction="none";this.viewport_.style.touchAction="none";this.overlayContainer_=document.createElement("DIV");this.overlayContainer_.className="ol-overlaycontainer";this.viewport_.appendChild(this.overlayContainer_);this.overlayContainerStopEvent_=document.createElement("DIV");this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent";var i=[ra.CLICK,ra.DBLCLICK,ra.MOUSEDOWN,ra.TOUCHSTART,ra.MSPOINTERDOWN,Ja.POINTERDOWN,ra.MOUSEWHEEL,ra.WHEEL];for(var r=0,n=i.length;r<n;++r){$n.listen(this.overlayContainerStopEvent_,i[r],ea.stopPropagation)}this.viewport_.appendChild(this.overlayContainerStopEvent_);this.mapBrowserEventHandler_=new os(this,t.moveTolerance);for(var a in Ja){$n.listen(this.mapBrowserEventHandler_,Ja[a],this.handleMapBrowserEvent,this)}this.keyboardEventTarget_=e.keyboardEventTarget;this.keyHandlerKeys_=null;$n.listen(this.viewport_,ra.WHEEL,this.handleBrowserEvent,this);$n.listen(this.viewport_,ra.MOUSEWHEEL,this.handleBrowserEvent,this);this.controls=e.controls||new Ka;this.interactions=e.interactions||new Ka;this.overlays_=e.overlays;this.overlayIdIndex_={};this.renderer_=e.mapRendererPlugin["create"](this.viewport_,this);this.focus_=null;this.postRenderFunctions_=[];this.tileQueue_=new cs(this.getTilePriority.bind(this),this.handleTileChange_.bind(this));this.skippedFeatureUids_={};$n.listen(this,aa.getChangeEventType(ls.LAYERGROUP),this.handleLayerGroupChanged_,this);$n.listen(this,aa.getChangeEventType(ls.VIEW),this.handleViewChanged_,this);$n.listen(this,aa.getChangeEventType(ls.SIZE),this.handleSizeChanged_,this);$n.listen(this,aa.getChangeEventType(ls.TARGET),this.handleTargetChanged_,this);this.setProperties(e.values);this.controls.forEach((function(t){t.setMap(this)}),this);$n.listen(this.controls,Ha.ADD,(function(t){t.element.setMap(this)}),this);$n.listen(this.controls,Ha.REMOVE,(function(t){t.element.setMap(null)}),this);this.interactions.forEach((function(t){t.setMap(this)}),this);$n.listen(this.interactions,Ha.ADD,(function(t){t.element.setMap(this)}),this);$n.listen(this.interactions,Ha.REMOVE,(function(t){t.element.setMap(null)}),this);this.overlays_.forEach(this.addOverlayInternal_,this);$n.listen(this.overlays_,Ha.ADD,(function(t){this.addOverlayInternal_(t.element)}),this);$n.listen(this.overlays_,Ha.REMOVE,(function(t){var e=t.element;var i=e.getId();if(i!==undefined){delete this.overlayIdIndex_[i.toString()]}t.element.setMap(null)}),this)};qn.inherits(Os,aa);Os.prototype.addControl=function(t){this.getControls().push(t)};Os.prototype.addInteraction=function(t){this.getInteractions().push(t)};Os.prototype.addLayer=function(t){var e=this.getLayerGroup().getLayers();e.push(t)};Os.prototype.addOverlay=function(t){this.getOverlays().push(t)};Os.prototype.addOverlayInternal_=function(t){var e=t.getId();if(e!==undefined){this.overlayIdIndex_[e.toString()]=t}t.setMap(this)};Os.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose();$n.unlisten(this.viewport_,ra.WHEEL,this.handleBrowserEvent,this);$n.unlisten(this.viewport_,ra.MOUSEWHEEL,this.handleBrowserEvent,this);if(this.handleResize_!==undefined){window.removeEventListener(ra.RESIZE,this.handleResize_,false);this.handleResize_=undefined}if(this.animationDelayKey_){cancelAnimationFrame(this.animationDelayKey_);this.animationDelayKey_=undefined}this.setTarget(null);aa.prototype.disposeInternal.call(this)};Os.prototype.forEachFeatureAtPixel=function(t,e,i){if(!this.frameState_){return}var r=this.getCoordinateFromPixel(t);i=i!==undefined?i:{};var n=i.hitTolerance!==undefined?i.hitTolerance*this.frameState_.pixelRatio:0;var a=i.layerFilter!==undefined?i.layerFilter:_a.TRUE;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,n,e,null,a,null)};Os.prototype.getFeaturesAtPixel=function(t,e){var i=null;this.forEachFeatureAtPixel(t,(function(t){if(!i){i=[]}i.push(t)}),e);return i};Os.prototype.forEachLayerAtPixel=function(t,e,i,r,n){if(!this.frameState_){return}var a=i!==undefined?i:null;var s=r!==undefined?r:_a.TRUE;var o=n!==undefined?n:null;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,e,a,s,o)};Os.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_){return false}var i=this.getCoordinateFromPixel(t);e=e!==undefined?e:{};var r=e.layerFilter!==undefined?e.layerFilter:_a.TRUE;var n=e.hitTolerance!==undefined?e.hitTolerance*this.frameState_.pixelRatio:0;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,n,r,null)};Os.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))};Os.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect();var i=t.changedTouches?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]};Os.prototype.getTarget=function(){return this.get(ls.TARGET)};Os.prototype.getTargetElement=function(){var t=this.getTarget();if(t!==undefined){return typeof t==="string"?document.getElementById(t):t}else{return null}};Os.prototype.getCoordinateFromPixel=function(t){var e=this.frameState_;if(!e){return null}else{return Sa.apply(e.pixelToCoordinateTransform,t.slice())}};Os.prototype.getControls=function(){return this.controls};Os.prototype.getOverlays=function(){return this.overlays_};Os.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return e!==undefined?e:null};Os.prototype.getInteractions=function(){return this.interactions};Os.prototype.getLayerGroup=function(){return this.get(ls.LAYERGROUP)};Os.prototype.getLayers=function(){var t=this.getLayerGroup().getLayers();return t};Os.prototype.getPixelFromCoordinate=function(t){var e=this.frameState_;if(!e){return null}else{return Sa.apply(e.coordinateToPixelTransform,t.slice(0,2))}};Os.prototype.getRenderer=function(){return this.renderer_};Os.prototype.getSize=function(){return this.get(ls.SIZE)};Os.prototype.getView=function(){return this.get(ls.VIEW)};Os.prototype.getViewport=function(){return this.viewport_};Os.prototype.getOverlayContainer=function(){return this.overlayContainer_};Os.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_};Os.prototype.getTilePriority=function(t,e,i,r){var n=this.frameState_;if(!n||!(e in n.wantedTiles)){return fs.DROP}if(!n.wantedTiles[e][t.getKey()]){return fs.DROP}var a=i[0]-n.focus[0];var s=i[1]-n.focus[1];return 65536*Math.log(r)+Math.sqrt(a*a+s*s)/r};Os.prototype.handleBrowserEvent=function(t,e){var i=e||t.type;var r=new Za(i,this,t);this.handleMapBrowserEvent(r)};Os.prototype.handleMapBrowserEvent=function(t){if(!this.frameState_){return}this.focus_=t.coordinate;t.frameState=this.frameState_;var e=this.getInteractions().getArray();var i;if(this.dispatchEvent(t)!==false){for(i=e.length-1;i>=0;i--){var r=e[i];if(!r.getActive()){continue}var n=r.handleEvent(t);if(!n){break}}}};Os.prototype.handlePostRender=function(){var t=this.frameState_;var e=this.tileQueue_;if(!e.isEmpty()){var i=16;var r=i;if(t){var n=t.viewHints;if(n[_s.ANIMATING]){i=this.loadTilesWhileAnimating_?8:0;r=2}if(n[_s.INTERACTING]){i=this.loadTilesWhileInteracting_?8:0;r=2}}if(e.getTilesLoading()<i){e.reprioritize();e.loadMoreTiles(i,r)}}var a=this.postRenderFunctions_;var s,o;for(s=0,o=a.length;s<o;++s){a[s](this,t)}a.length=0};Os.prototype.handleSizeChanged_=function(){this.render()};Os.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()){t=this.getTargetElement()}if(this.keyHandlerKeys_){for(var e=0,i=this.keyHandlerKeys_.length;e<i;++e){$n.unlistenByKey(this.keyHandlerKeys_[e])}this.keyHandlerKeys_=null}if(!t){this.renderer_.removeLayerRenderers();Ts.removeNode(this.viewport_);if(this.handleResize_!==undefined){window.removeEventListener(ra.RESIZE,this.handleResize_,false);this.handleResize_=undefined}}else{t.appendChild(this.viewport_);var r=!this.keyboardEventTarget_?t:this.keyboardEventTarget_;this.keyHandlerKeys_=[$n.listen(r,ra.KEYDOWN,this.handleBrowserEvent,this),$n.listen(r,ra.KEYPRESS,this.handleBrowserEvent,this)];if(!this.handleResize_){this.handleResize_=this.updateSize.bind(this);window.addEventListener(ra.RESIZE,this.handleResize_,false)}}this.updateSize()};Os.prototype.handleTileChange_=function(){this.render()};Os.prototype.handleViewPropertyChanged_=function(){this.render()};Os.prototype.handleViewChanged_=function(){if(this.viewPropertyListenerKey_){$n.unlistenByKey(this.viewPropertyListenerKey_);this.viewPropertyListenerKey_=null}if(this.viewChangeListenerKey_){$n.unlistenByKey(this.viewChangeListenerKey_);this.viewChangeListenerKey_=null}var t=this.getView();if(t){this.viewport_.setAttribute("data-view",qn.getUid(t));this.viewPropertyListenerKey_=$n.listen(t,Jn.PROPERTYCHANGE,this.handleViewPropertyChanged_,this);this.viewChangeListenerKey_=$n.listen(t,ra.CHANGE,this.handleViewPropertyChanged_,this)}this.render()};Os.prototype.handleLayerGroupChanged_=function(){if(this.layerGroupPropertyListenerKeys_){this.layerGroupPropertyListenerKeys_.forEach($n.unlistenByKey);this.layerGroupPropertyListenerKeys_=null}var t=this.getLayerGroup();if(t){this.layerGroupPropertyListenerKeys_=[$n.listen(t,Jn.PROPERTYCHANGE,this.render,this),$n.listen(t,ra.CHANGE,this.render,this)]}this.render()};Os.prototype.isRendered=function(){return!!this.frameState_};Os.prototype.renderSync=function(){if(this.animationDelayKey_){cancelAnimationFrame(this.animationDelayKey_)}this.animationDelay_()};Os.prototype.render=function(){if(this.animationDelayKey_===undefined){this.animationDelayKey_=requestAnimationFrame(this.animationDelay_)}};Os.prototype.removeControl=function(t){return this.getControls().remove(t)};Os.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)};Os.prototype.removeLayer=function(t){var e=this.getLayerGroup().getLayers();return e.remove(t)};Os.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)};Os.prototype.renderFrame_=function(t){var e,i,r;var n=this.getSize();var a=this.getView();var s=pa.createEmpty();var o=this.frameState_;var h=null;if(n!==undefined&&ws.hasArea(n)&&a&&a.isDef()){var l=a.getHints(this.frameState_?this.frameState_.viewHints:undefined);var u=this.getLayerGroup().getLayerStatesArray();var f={};for(e=0,i=u.length;e<i;++e){f[qn.getUid(u[e].layer)]=u[e]}r=a.getState();var c=r.center;var d=r.resolution/this.pixelRatio_;c[0]=Math.round(c[0]/d)*d;c[1]=Math.round(c[1]/d)*d;h={animate:false,coordinateToPixelTransform:this.coordinateToPixelTransform_,extent:s,focus:!this.focus_?c:this.focus_,index:this.frameIndex_++,layerStates:f,layerStatesArray:u,logos:Qn.assign({},this.logos_),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:n,skippedFeatureUids:this.skippedFeatureUids_,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:l,wantedTiles:{}}}if(h){h.extent=pa.getForViewAndSize(r.center,r.resolution,r.rotation,h.size,s)}this.frameState_=h;this.renderer_.renderFrame(h);if(h){if(h.animate){this.render()}Array.prototype.push.apply(this.postRenderFunctions_,h.postRenderFunctions);if(o){var p=!this.previousExtent_||!pa.isEmpty(this.previousExtent_)&&!pa.equals(h.extent,this.previousExtent_);if(p){this.dispatchEvent(new qa(hs.MOVESTART,this,o));this.previousExtent_=pa.createOrUpdateEmpty(this.previousExtent_)}}var v=this.previousExtent_&&!h.viewHints[_s.ANIMATING]&&!h.viewHints[_s.INTERACTING]&&!pa.equals(h.extent,this.previousExtent_);if(v){this.dispatchEvent(new qa(hs.MOVEEND,this,h));pa.clone(h.extent,this.previousExtent_)}}this.dispatchEvent(new qa(hs.POSTRENDER,this,h));setTimeout(this.handlePostRender.bind(this),0)};Os.prototype.setLayerGroup=function(t){this.set(ls.LAYERGROUP,t)};Os.prototype.setSize=function(t){this.set(ls.SIZE,t)};Os.prototype.setTarget=function(t){this.set(ls.TARGET,t)};Os.prototype.setView=function(t){this.set(ls.VIEW,t)};Os.prototype.skipFeature=function(t){var e=qn.getUid(t).toString();this.skippedFeatureUids_[e]=true;this.render()};Os.prototype.updateSize=function(){var t=this.getTargetElement();if(!t){this.setSize(undefined)}else{var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e["borderLeftWidth"])-parseFloat(e["paddingLeft"])-parseFloat(e["paddingRight"])-parseFloat(e["borderRightWidth"]),t.offsetHeight-parseFloat(e["borderTopWidth"])-parseFloat(e["paddingTop"])-parseFloat(e["paddingBottom"])-parseFloat(e["borderBottomWidth"])])}};Os.prototype.unskipFeature=function(t){var e=qn.getUid(t).toString();delete this.skippedFeatureUids_[e];this.render()};Os.DEFAULT_RENDERER_TYPES=[As.CANVAS,As.WEBGL];Os.LOGO_URL="data:image/png;base64,"+"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBI"+"WXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAA"+"AhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszW"+"WMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvY"+"asvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvX"+"H1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1Vk"+"bMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW"+"2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLP"+"VcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqT"+"acrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaar"+"ldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+Hi"+"zeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDn"+"BAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSF"+"hYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJ"+"REFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxC"+"Brb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe"+"0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8"+"a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7a"+"hgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCn"+"B3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDg"+"q82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC";Os.createOptionsInternal=function(t){var e=null;if(t.keyboardEventTarget!==undefined){e=typeof t.keyboardEventTarget==="string"?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget}var i={};var r={};if(t.logo===undefined||typeof t.logo==="boolean"&&t.logo){r[Os.LOGO_URL]="https://openlayers.org/"}else{var n=t.logo;if(typeof n==="string"){r[n]=""}else if(n instanceof HTMLElement){r[qn.getUid(n).toString()]=n}else if(n){oa.assert(typeof n.href=="string",44);oa.assert(typeof n.src=="string",45);r[n.src]=n.href}}var a=t.layers instanceof Ss?t.layers:new Ss({layers:t.layers});i[ls.LAYERGROUP]=a;i[ls.TARGET]=t.target;i[ls.VIEW]=t.view!==undefined?t.view:new xs;var s;if(t.renderer!==undefined){if(Array.isArray(t.renderer)){s=t.renderer}else if(typeof t.renderer==="string"){s=[t.renderer]}else{oa.assert(false,46)}if(s.indexOf("dom")>=0){s=s.concat(Os.DEFAULT_RENDERER_TYPES)}}else{s=Os.DEFAULT_RENDERER_TYPES}var o;var h=Ls.getMapRendererPlugins();t:for(var l=0,u=s.length;l<u;++l){var f=s[l];for(var c=0,d=h.length;c<d;++c){var p=h[c];if(p["handles"](f)){o=p;break t}}}if(!o){throw new Error("Unable to create a map renderer for types: "+s.join(", "))}var v;if(t.controls!==undefined){if(Array.isArray(t.controls)){v=new Ka(t.controls.slice())}else{oa.assert(t.controls instanceof Ka,47);v=t.controls}}var _;if(t.interactions!==undefined){if(Array.isArray(t.interactions)){_=new Ka(t.interactions.slice())}else{oa.assert(t.interactions instanceof Ka,48);_=t.interactions}}var g;if(t.overlays!==undefined){if(Array.isArray(t.overlays)){g=new Ka(t.overlays.slice())}else{oa.assert(t.overlays instanceof Ka,49);g=t.overlays}}else{g=new Ka}return{controls:v,interactions:_,keyboardEventTarget:e,logos:r,overlays:g,mapRendererPlugin:o,values:i}};var bs=function(t){aa.call(this);this.element=t.element?t.element:null;this.target_=null;this.map_=null;this.listenerKeys=[];this.render=t.render?t.render:qn.nullFunction;if(t.target){this.setTarget(t.target)}};qn.inherits(bs,aa);bs.prototype.disposeInternal=function(){Ts.removeNode(this.element);aa.prototype.disposeInternal.call(this)};bs.prototype.getMap=function(){return this.map_};bs.prototype.setMap=function(t){if(this.map_){Ts.removeNode(this.element)}for(var e=0,i=this.listenerKeys.length;e<i;++e){$n.unlistenByKey(this.listenerKeys[e])}this.listenerKeys.length=0;this.map_=t;if(this.map_){var r=this.target_?this.target_:t.getOverlayContainerStopEvent();r.appendChild(this.element);if(this.render!==qn.nullFunction){this.listenerKeys.push($n.listen(t,hs.POSTRENDER,this.render,this))}t.render()}};bs.prototype.setTarget=function(t){this.target_=typeof t==="string"?document.getElementById(t):t};var Ps={};Ps.CLASS_HIDDEN="ol-hidden";Ps.CLASS_SELECTABLE="ol-selectable";Ps.CLASS_UNSELECTABLE="ol-unselectable";Ps.CLASS_UNSUPPORTED="ol-unsupported";Ps.CLASS_CONTROL="ol-control";Ps.getFontFamilies=function(){var t;var e={};return function(i){if(!t){t=document.createElement("div").style}if(!(i in e)){t.font=i;var r=t.fontFamily;t.font="";if(!r){return null}e[i]=r.split(/,\s?/)}return e[i]}}();var Ds={POSTCOMPOSE:"postcompose",PRECOMPOSE:"precompose",RENDER:"render"};var Fs=function(t){var e=Qn.assign({},t);delete e.source;Rs.call(this,e);this.mapPrecomposeKey_=null;this.mapRenderKey_=null;this.sourceChangeKey_=null;if(t.map){this.setMap(t.map)}$n.listen(this,aa.getChangeEventType(Cs.SOURCE),this.handleSourcePropertyChange_,this);var i=t.source?t.source:null;this.setSource(i)};qn.inherits(Fs,Rs);Fs.visibleAtResolution=function(t,e){return t.visible&&e>=t.minResolution&&e<t.maxResolution};Fs.prototype.getLayersArray=function(t){var e=t?t:[];e.push(this);return e};Fs.prototype.getLayerStatesArray=function(t){var e=t?t:[];e.push(this.getLayerState());return e};Fs.prototype.getSource=function(){var t=this.get(Cs.SOURCE);return t||null};Fs.prototype.getSourceState=function(){var t=this.getSource();return!t?Ms.UNDEFINED:t.getState()};Fs.prototype.handleSourceChange_=function(){this.changed()};Fs.prototype.handleSourcePropertyChange_=function(){if(this.sourceChangeKey_){$n.unlistenByKey(this.sourceChangeKey_);this.sourceChangeKey_=null}var t=this.getSource();if(t){this.sourceChangeKey_=$n.listen(t,ra.CHANGE,this.handleSourceChange_,this)}this.changed()};Fs.prototype.setMap=function(t){if(this.mapPrecomposeKey_){$n.unlistenByKey(this.mapPrecomposeKey_);this.mapPrecomposeKey_=null}if(!t){this.changed()}if(this.mapRenderKey_){$n.unlistenByKey(this.mapRenderKey_);this.mapRenderKey_=null}if(t){this.mapPrecomposeKey_=$n.listen(t,Ds.PRECOMPOSE,(function(t){var e=this.getLayerState();e.managed=false;e.zIndex=Infinity;t.frameState.layerStatesArray.push(e);t.frameState.layerStates[qn.getUid(this)]=e}),this);this.mapRenderKey_=$n.listen(this,ra.CHANGE,t.render,t);this.changed()}};Fs.prototype.setSource=function(t){this.set(Cs.SOURCE,t)};var Ns=function(t){var e=t?t:{};this.ulElement_=document.createElement("UL");this.logoLi_=document.createElement("LI");this.ulElement_.appendChild(this.logoLi_);this.logoLi_.style.display="none";this.collapsed_=e.collapsed!==undefined?e.collapsed:true;this.collapsible_=e.collapsible!==undefined?e.collapsible:true;if(!this.collapsible_){this.collapsed_=false}var i=e.className!==undefined?e.className:"ol-attribution";var r=e.tipLabel!==undefined?e.tipLabel:"Attributions";var n=e.collapseLabel!==undefined?e.collapseLabel:"»";if(typeof n==="string"){this.collapseLabel_=document.createElement("span");this.collapseLabel_.textContent=n}else{this.collapseLabel_=n}var a=e.label!==undefined?e.label:"i";if(typeof a==="string"){this.label_=document.createElement("span");this.label_.textContent=a}else{this.label_=a}var s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;var o=document.createElement("button");o.setAttribute("type","button");o.title=r;o.appendChild(s);$n.listen(o,ra.CLICK,this.handleClick_,this);var h=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" ol-collapsed":"")+(this.collapsible_?"":" ol-uncollapsible");var l=document.createElement("div");l.className=h;l.appendChild(this.ulElement_);l.appendChild(o);var u=e.render?e.render:Ns.render;bs.call(this,{element:l,render:u,target:e.target});this.renderedAttributions_=[];this.renderedVisible_=true;this.logoElements_={}};qn.inherits(Ns,bs);Ns.prototype.getSourceAttributions_=function(t){var e={};var i=[];var r=t.layerStatesArray;var n=t.viewState.resolution;for(var a=0,s=r.length;a<s;++a){var o=r[a];if(!Fs.visibleAtResolution(o,n)){continue}var h=o.layer.getSource();if(!h){continue}var l=h.getAttributions2();if(!l){continue}var u=l(t);if(!u){continue}if(Array.isArray(u)){for(var f=0,c=u.length;f<c;++f){if(!(u[f]in e)){i.push(u[f]);e[u[f]]=true}}}else{if(!(u in e)){i.push(u);e[u]=true}}}return i};Ns.render=function(t){this.updateElement_(t.frameState)};Ns.prototype.updateElement_=function(t){if(!t){if(this.renderedVisible_){this.element.style.display="none";this.renderedVisible_=false}return}var e=this.getSourceAttributions_(t);if(fa.equals(e,this.renderedAttributions_)){return}while(this.ulElement_.lastChild!==this.logoLi_){this.ulElement_.removeChild(this.ulElement_.lastChild)}for(var i=0,r=e.length;i<r;++i){var n=document.createElement("LI");n.innerHTML=e[i];this.ulElement_.appendChild(n)}if(e.length===0&&this.renderedAttributions_.length>0){this.element.classList.add("ol-logo-only")}else if(this.renderedAttributions_.length===0&&e.length>0){this.element.classList.remove("ol-logo-only")}var a=e.length>0||!Qn.isEmpty(t.logos);if(this.renderedVisible_!=a){this.element.style.display=a?"":"none";this.renderedVisible_=a}this.renderedAttributions_=e;this.insertLogos_(t)};Ns.prototype.insertLogos_=function(t){var e;var i=t.logos;var r=this.logoElements_;for(e in r){if(!(e in i)){Ts.removeNode(r[e]);delete r[e]}}var n,a,s;for(s in i){var o=i[s];if(o instanceof HTMLElement){this.logoLi_.appendChild(o);r[s]=o}if(!(s in r)){n=new Image;n.src=s;if(o===""){a=n}else{a=document.createElement("a");a.href=o;a.appendChild(n)}this.logoLi_.appendChild(a);r[s]=a}}this.logoLi_.style.display=!Qn.isEmpty(i)?"":"none"};Ns.prototype.handleClick_=function(t){t.preventDefault();this.handleToggle_()};Ns.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed");if(this.collapsed_){Ts.replaceNode(this.collapseLabel_,this.label_)}else{Ts.replaceNode(this.label_,this.collapseLabel_)}this.collapsed_=!this.collapsed_};Ns.prototype.getCollapsible=function(){return this.collapsible_};Ns.prototype.setCollapsible=function(t){if(this.collapsible_===t){return}this.collapsible_=t;this.element.classList.toggle("ol-uncollapsible");if(!t&&this.collapsed_){this.handleToggle_()}};Ns.prototype.setCollapsed=function(t){if(!this.collapsible_||this.collapsed_===t){return}this.handleToggle_()};Ns.prototype.getCollapsed=function(){return this.collapsed_};var Gs=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-rotate";var r=e.label!==undefined?e.label:"⇧";this.label_=null;if(typeof r==="string"){this.label_=document.createElement("span");this.label_.className="ol-compass";this.label_.textContent=r}else{this.label_=r;this.label_.classList.add("ol-compass")}var n=e.tipLabel?e.tipLabel:"Reset rotation";var a=document.createElement("button");a.className=i+"-reset";a.setAttribute("type","button");a.title=n;a.appendChild(this.label_);$n.listen(a,ra.CLICK,Gs.prototype.handleClick_,this);var s=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL;var o=document.createElement("div");o.className=s;o.appendChild(a);var h=e.render?e.render:Gs.render;this.callResetNorth_=e.resetNorth?e.resetNorth:undefined;bs.call(this,{element:o,render:h,target:e.target});this.duration_=e.duration!==undefined?e.duration:250;this.autoHide_=e.autoHide!==undefined?e.autoHide:true;this.rotation_=undefined;if(this.autoHide_){this.element.classList.add(Ps.CLASS_HIDDEN)}};qn.inherits(Gs,bs);Gs.prototype.handleClick_=function(t){t.preventDefault();if(this.callResetNorth_!==undefined){this.callResetNorth_()}else{this.resetNorth_()}};Gs.prototype.resetNorth_=function(){var t=this.getMap();var e=t.getView();if(!e){return}if(e.getRotation()!==undefined){if(this.duration_>0){e.animate({rotation:0,duration:this.duration_,easing:Es.easeOut})}else{e.setRotation(0)}}};Gs.render=function(t){var e=t.frameState;if(!e){return}var i=e.viewState.rotation;if(i!=this.rotation_){var r="rotate("+i+"rad)";if(this.autoHide_){var n=this.element.classList.contains(Ps.CLASS_HIDDEN);if(!n&&i===0){this.element.classList.add(Ps.CLASS_HIDDEN)}else if(n&&i!==0){this.element.classList.remove(Ps.CLASS_HIDDEN)}}this.label_.style.msTransform=r;this.label_.style.webkitTransform=r;this.label_.style.transform=r}this.rotation_=i};var ks=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-zoom";var r=e.delta!==undefined?e.delta:1;var n=e.zoomInLabel!==undefined?e.zoomInLabel:"+";var a=e.zoomOutLabel!==undefined?e.zoomOutLabel:"−";var s=e.zoomInTipLabel!==undefined?e.zoomInTipLabel:"Zoom in";var o=e.zoomOutTipLabel!==undefined?e.zoomOutTipLabel:"Zoom out";var h=document.createElement("button");h.className=i+"-in";h.setAttribute("type","button");h.title=s;h.appendChild(typeof n==="string"?document.createTextNode(n):n);$n.listen(h,ra.CLICK,ks.prototype.handleClick_.bind(this,r));var l=document.createElement("button");l.className=i+"-out";l.setAttribute("type","button");l.title=o;l.appendChild(typeof a==="string"?document.createTextNode(a):a);$n.listen(l,ra.CLICK,ks.prototype.handleClick_.bind(this,-r));var u=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL;var f=document.createElement("div");f.className=u;f.appendChild(h);f.appendChild(l);bs.call(this,{element:f,target:e.target});this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(ks,bs);ks.prototype.handleClick_=function(t,e){e.preventDefault();this.zoomByDelta_(t)};ks.prototype.zoomByDelta_=function(t){var e=this.getMap();var i=e.getView();if(!i){return}var r=i.getResolution();if(r){var n=i.constrainResolution(r,t);if(this.duration_>0){if(i.getAnimating()){i.cancelAnimations()}i.animate({resolution:n,duration:this.duration_,easing:Es.easeOut})}else{i.setResolution(n)}}};var Us={};Us.defaults=function(t){var e=t?t:{};var i=new Ka;var r=e.zoom!==undefined?e.zoom:true;if(r){i.push(new ks(e.zoomOptions))}var n=e.rotate!==undefined?e.rotate:true;if(n){i.push(new Gs(e.rotateOptions))}var a=e.attribution!==undefined?e.attribution:true;if(a){i.push(new Ns(e.attributionOptions))}return i};var zs=function(t,e,i){this.decay_=t;this.minVelocity_=e;this.delay_=i;this.points_=[];this.angle_=0;this.initialVelocity_=0};zs.prototype.begin=function(){this.points_.length=0;this.angle_=0;this.initialVelocity_=0};zs.prototype.update=function(t,e){this.points_.push(t,e,Date.now())};zs.prototype.end=function(){if(this.points_.length<6){return false}var t=Date.now()-this.delay_;var e=this.points_.length-3;if(this.points_[e+2]<t){return false}var i=e-3;while(i>0&&this.points_[i+2]>t){i-=3}var r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60){return false}var n=this.points_[e]-this.points_[i];var a=this.points_[e+1]-this.points_[i+1];this.angle_=Math.atan2(a,n);this.initialVelocity_=Math.sqrt(n*n+a*a)/r;return this.initialVelocity_>this.minVelocity_};zs.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_};zs.prototype.getAngle=function(){return this.angle_};var Bs={ACTIVE:"active"};var Ws=function(t){aa.call(this);this.map_=null;this.setActive(true);this.handleEvent=t.handleEvent};qn.inherits(Ws,aa);Ws.prototype.getActive=function(){return this.get(Bs.ACTIVE)};Ws.prototype.getMap=function(){return this.map_};Ws.prototype.setActive=function(t){this.set(Bs.ACTIVE,t)};Ws.prototype.setMap=function(t){this.map_=t};Ws.pan=function(t,e,i){var r=t.getCenter();if(r){var n=t.constrainCenter([r[0]+e[0],r[1]+e[1]]);if(i){t.animate({duration:i,easing:Es.linear,center:n})}else{t.setCenter(n)}}};Ws.rotate=function(t,e,i,r){e=t.constrainRotation(e,0);Ws.rotateWithoutConstraints(t,e,i,r)};Ws.rotateWithoutConstraints=function(t,e,i,r){if(e!==undefined){var n=t.getRotation();var a=t.getCenter();if(n!==undefined&&a&&r>0){t.animate({rotation:e,anchor:i,duration:r,easing:Es.easeOut})}else{t.rotate(e,i)}}};Ws.zoom=function(t,e,i,r,n){e=t.constrainResolution(e,0,n);Ws.zoomWithoutConstraints(t,e,i,r)};Ws.zoomByDelta=function(t,e,i,r){var n=t.getResolution();var a=t.constrainResolution(n,e,0);if(a!==undefined){var s=t.getResolutions();a=ha.clamp(a,t.getMinResolution()||s[s.length-1],t.getMaxResolution()||s[0])}if(i&&a!==undefined&&a!==n){var o=t.getCenter();var h=t.calculateCenterZoom(a,i);h=t.constrainCenter(h);i=[(a*o[0]-n*h[0])/(a-n),(a*o[1]-n*h[1])/(a-n)]}Ws.zoomWithoutConstraints(t,a,i,r)};Ws.zoomWithoutConstraints=function(t,e,i,r){if(e){var n=t.getResolution();var a=t.getCenter();if(n!==undefined&&a&&e!==n&&r){t.animate({resolution:e,anchor:i,duration:r,easing:Es.easeOut})}else{if(i){var s=t.calculateCenterZoom(e,i);t.setCenter(s)}t.setResolution(e)}}};var Xs=function(t){var e=t?t:{};this.delta_=e.delta?e.delta:1;Ws.call(this,{handleEvent:Xs.handleEvent});this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(Xs,Ws);Xs.handleEvent=function(t){var e=false;var i=t.originalEvent;if(t.type==Ja.DBLCLICK){var r=t.map;var n=t.coordinate;var a=i.shiftKey?-this.delta_:this.delta_;var s=r.getView();Ws.zoomByDelta(s,a,n,this.duration_);t.preventDefault();e=true}return!e};var Vs={};Vs.altKeyOnly=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};Vs.altShiftKeysOnly=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey};Vs.always=_a.TRUE;Vs.click=function(t){return t.type==Ja.CLICK};Vs.mouseActionButton=function(t){var e=t.originalEvent;return e.button==0&&!(Va.WEBKIT&&Va.MAC&&e.ctrlKey)};Vs.never=_a.FALSE;Vs.pointerMove=function(t){return t.type=="pointermove"};Vs.singleClick=function(t){return t.type==Ja.SINGLECLICK};Vs.doubleClick=function(t){return t.type==Ja.DBLCLICK};Vs.noModifierKeys=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};Vs.platformModifierKeyOnly=function(t){var e=t.originalEvent;return!e.altKey&&(Va.MAC?e.metaKey:e.ctrlKey)&&!e.shiftKey};Vs.shiftKeyOnly=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey};Vs.targetNotEditable=function(t){var e=t.originalEvent.target;var i=e.tagName;return i!=="INPUT"&&i!=="SELECT"&&i!=="TEXTAREA"};Vs.mouseOnly=function(t){oa.assert(t.pointerEvent,56);return t.pointerEvent.pointerType=="mouse"};Vs.primaryAction=function(t){var e=t.pointerEvent;return e.isPrimary&&e.button===0};var Ys=function(t){var e=t?t:{};var i=e.handleEvent?e.handleEvent:Ys.handleEvent;Ws.call(this,{handleEvent:i});this.handleDownEvent_=e.handleDownEvent?e.handleDownEvent:Ys.handleDownEvent;this.handleDragEvent_=e.handleDragEvent?e.handleDragEvent:Ys.handleDragEvent;this.handleMoveEvent_=e.handleMoveEvent?e.handleMoveEvent:Ys.handleMoveEvent;this.handleUpEvent_=e.handleUpEvent?e.handleUpEvent:Ys.handleUpEvent;this.handlingDownUpSequence=false;this.trackedPointers_={};this.targetPointers=[]};qn.inherits(Ys,Ws);Ys.centroid=function(t){var e=t.length;var i=0;var r=0;for(var n=0;n<e;n++){i+=t[n].clientX;r+=t[n].clientY}return[i/e,r/e]};Ys.prototype.isPointerDraggingEvent_=function(t){var e=t.type;return e===Ja.POINTERDOWN||e===Ja.POINTERDRAG||e===Ja.POINTERUP};Ys.prototype.updateTrackedPointers_=function(t){if(this.isPointerDraggingEvent_(t)){var e=t.pointerEvent;var i=e.pointerId.toString();if(t.type==Ja.POINTERUP){delete this.trackedPointers_[i]}else if(t.type==Ja.POINTERDOWN){this.trackedPointers_[i]=e}else if(i in this.trackedPointers_){this.trackedPointers_[i]=e}this.targetPointers=Qn.getValues(this.trackedPointers_)}};Ys.handleDragEvent=qn.nullFunction;Ys.handleUpEvent=_a.FALSE;Ys.handleDownEvent=_a.FALSE;Ys.handleMoveEvent=qn.nullFunction;Ys.handleEvent=function(t){if(!(t instanceof Qa)){return true}var e=false;this.updateTrackedPointers_(t);if(this.handlingDownUpSequence){if(t.type==Ja.POINTERDRAG){this.handleDragEvent_(t)}else if(t.type==Ja.POINTERUP){var i=this.handleUpEvent_(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else{if(t.type==Ja.POINTERDOWN){var r=this.handleDownEvent_(t);this.handlingDownUpSequence=r;e=this.shouldStopEvent(r)}else if(t.type==Ja.POINTERMOVE){this.handleMoveEvent_(t)}}return!e};Ys.prototype.shouldStopEvent=function(t){return t};var js=function(t){Ys.call(this,{handleDownEvent:js.handleDownEvent_,handleDragEvent:js.handleDragEvent_,handleUpEvent:js.handleUpEvent_});var e=t?t:{};this.kinetic_=e.kinetic;this.lastCentroid=null;this.condition_=e.condition?e.condition:Vs.noModifierKeys;this.noKinetic_=false};qn.inherits(js,Ys);js.handleDragEvent_=function(t){var e=this.targetPointers;var i=Ys.centroid(e);if(e.length==this.lastPointersCount_){if(this.kinetic_){this.kinetic_.update(i[0],i[1])}if(this.lastCentroid){var r=this.lastCentroid[0]-i[0];var n=i[1]-this.lastCentroid[1];var a=t.map;var s=a.getView();var o=s.getState();var h=[r,n];ys.scale(h,o.resolution);ys.rotate(h,o.rotation);ys.add(h,o.center);h=s.constrainCenter(h);s.setCenter(h)}}else if(this.kinetic_){this.kinetic_.begin()}this.lastCentroid=i;this.lastPointersCount_=e.length};js.handleUpEvent_=function(t){var e=t.map;var i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var r=this.kinetic_.getDistance();var n=this.kinetic_.getAngle();var a=i.getCenter();var s=e.getPixelFromCoordinate(a);var o=e.getCoordinateFromPixel([s[0]-r*Math.cos(n),s[1]-r*Math.sin(n)]);i.animate({center:i.constrainCenter(o),duration:500,easing:Es.easeOut})}i.setHint(_s.INTERACTING,-1);return false}else{if(this.kinetic_){this.kinetic_.begin()}this.lastCentroid=null;return true}};js.handleDownEvent_=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var e=t.map;var i=e.getView();this.lastCentroid=null;if(!this.handlingDownUpSequence){i.setHint(_s.INTERACTING,1)}if(i.getAnimating()){i.setCenter(t.frameState.viewState.center)}if(this.kinetic_){this.kinetic_.begin()}this.noKinetic_=this.targetPointers.length>1;return true}else{return false}};js.prototype.shouldStopEvent=_a.FALSE;var Hs=function(t){var e=t?t:{};Ys.call(this,{handleDownEvent:Hs.handleDownEvent_,handleDragEvent:Hs.handleDragEvent_,handleUpEvent:Hs.handleUpEvent_});this.condition_=e.condition?e.condition:Vs.altShiftKeysOnly;this.lastAngle_=undefined;this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(Hs,Ys);Hs.handleDragEvent_=function(t){if(!Vs.mouseOnly(t)){return}var e=t.map;var i=e.getView();if(i.getConstraints().rotation===vs.disable){return}var r=e.getSize();var n=t.pixel;var a=Math.atan2(r[1]/2-n[1],n[0]-r[0]/2);if(this.lastAngle_!==undefined){var s=a-this.lastAngle_;var o=i.getRotation();Ws.rotateWithoutConstraints(i,o-s)}this.lastAngle_=a};Hs.handleUpEvent_=function(t){if(!Vs.mouseOnly(t)){return true}var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);var r=i.getRotation();Ws.rotate(i,r,undefined,this.duration_);return false};Hs.handleDownEvent_=function(t){if(!Vs.mouseOnly(t)){return false}if(Vs.mouseActionButton(t)&&this.condition_(t)){var e=t.map;e.getView().setHint(_s.INTERACTING,1);this.lastAngle_=undefined;return true}else{return false}};Hs.prototype.shouldStopEvent=_a.FALSE;var Ks=function(t){this.geometry_=null;this.element_=document.createElement("div");this.element_.style.position="absolute";this.element_.className="ol-box "+t;this.map_=null;this.startPixel_=null;this.endPixel_=null};qn.inherits(Ks,ta);Ks.prototype.disposeInternal=function(){this.setMap(null)};Ks.prototype.render_=function(){var t=this.startPixel_;var e=this.endPixel_;var i="px";var r=this.element_.style;r.left=Math.min(t[0],e[0])+i;r.top=Math.min(t[1],e[1])+i;r.width=Math.abs(e[0]-t[0])+i;r.height=Math.abs(e[1]-t[1])+i};Ks.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left=e.top=e.width=e.height="inherit"}this.map_=t;if(this.map_){this.map_.getOverlayContainer().appendChild(this.element_)}};Ks.prototype.setPixels=function(t,e){this.startPixel_=t;this.endPixel_=e;this.createOrUpdateGeometry();this.render_()};Ks.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_;var e=this.endPixel_;var i=[t,[t[0],e[1]],e,[e[0],t[1]]];var r=i.map(this.map_.getCoordinateFromPixel,this.map_);r[4]=r[0].slice();if(!this.geometry_){this.geometry_=new Wa([r])}else{this.geometry_.setCoordinates([r])}};Ks.prototype.getGeometry=function(){return this.geometry_};var qs=function(t){Ys.call(this,{handleDownEvent:qs.handleDownEvent_,handleDragEvent:qs.handleDragEvent_,handleUpEvent:qs.handleUpEvent_});var e=t?t:{};this.box_=new Ks(e.className||"ol-dragbox");this.minArea_=e.minArea!==undefined?e.minArea:64;this.startPixel_=null;this.condition_=e.condition?e.condition:Vs.always;this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:qs.defaultBoxEndCondition};qn.inherits(qs,Ys);qs.defaultBoxEndCondition=function(t,e,i){var r=i[0]-e[0];var n=i[1]-e[1];return r*r+n*n>=this.minArea_};qs.handleDragEvent_=function(t){if(!Vs.mouseOnly(t)){return}this.box_.setPixels(this.startPixel_,t.pixel);this.dispatchEvent(new qs.Event(qs.EventType_.BOXDRAG,t.coordinate,t))};qs.prototype.getGeometry=function(){return this.box_.getGeometry()};qs.prototype.onBoxEnd=qn.nullFunction;qs.handleUpEvent_=function(t){if(!Vs.mouseOnly(t)){return true}this.box_.setMap(null);if(this.boxEndCondition_(t,this.startPixel_,t.pixel)){this.onBoxEnd(t);this.dispatchEvent(new qs.Event(qs.EventType_.BOXEND,t.coordinate,t))}return false};qs.handleDownEvent_=function(t){if(!Vs.mouseOnly(t)){return false}if(Vs.mouseActionButton(t)&&this.condition_(t)){this.startPixel_=t.pixel;this.box_.setMap(t.map);this.box_.setPixels(this.startPixel_,this.startPixel_);this.dispatchEvent(new qs.Event(qs.EventType_.BOXSTART,t.coordinate,t));return true}else{return false}};qs.EventType_={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend"};qs.Event=function(t,e,i){ea.call(this,t);this.coordinate=e;this.mapBrowserEvent=i};qn.inherits(qs.Event,ea);var Zs=function(t){var e=t?t:{};var i=e.condition?e.condition:Vs.shiftKeyOnly;this.duration_=e.duration!==undefined?e.duration:200;this.out_=e.out!==undefined?e.out:false;qs.call(this,{condition:i,className:e.className||"ol-dragzoom"})};qn.inherits(Zs,qs);Zs.prototype.onBoxEnd=function(){var t=this.getMap();var e=t.getView();var i=t.getSize();var r=this.getGeometry().getExtent();if(this.out_){var n=e.calculateExtent(i);var a=pa.createOrUpdateFromCoordinates([t.getPixelFromCoordinate(pa.getBottomLeft(r)),t.getPixelFromCoordinate(pa.getTopRight(r))]);var s=e.getResolutionForExtent(a,i);pa.scaleFromCenter(n,1/s);r=n}var o=e.constrainResolution(e.getResolutionForExtent(r,i));var h=pa.getCenter(r);h=e.constrainCenter(h);e.animate({resolution:o,center:h,duration:this.duration_,easing:Es.easeOut})};var Js={LEFT:37,UP:38,RIGHT:39,DOWN:40};var Qs=function(t){Ws.call(this,{handleEvent:Qs.handleEvent});var e=t||{};this.defaultCondition_=function(t){return Vs.noModifierKeys(t)&&Vs.targetNotEditable(t)};this.condition_=e.condition!==undefined?e.condition:this.defaultCondition_;this.duration_=e.duration!==undefined?e.duration:100;this.pixelDelta_=e.pixelDelta!==undefined?e.pixelDelta:128};qn.inherits(Qs,Ws);Qs.handleEvent=function(t){var e=false;if(t.type==ra.KEYDOWN){var i=t.originalEvent;var r=i.keyCode;if(this.condition_(t)&&(r==Js.DOWN||r==Js.LEFT||r==Js.RIGHT||r==Js.UP)){var n=t.map;var a=n.getView();var s=a.getResolution()*this.pixelDelta_;var o=0,h=0;if(r==Js.DOWN){h=-s}else if(r==Js.LEFT){o=-s}else if(r==Js.RIGHT){o=s}else{h=s}var l=[o,h];ys.rotate(l,a.getRotation());Ws.pan(a,l,this.duration_);t.preventDefault();e=true}}return!e};var $s=function(t){Ws.call(this,{handleEvent:$s.handleEvent});var e=t?t:{};this.condition_=e.condition?e.condition:Vs.targetNotEditable;this.delta_=e.delta?e.delta:1;this.duration_=e.duration!==undefined?e.duration:100};qn.inherits($s,Ws);$s.handleEvent=function(t){var e=false;if(t.type==ra.KEYDOWN||t.type==ra.KEYPRESS){var i=t.originalEvent;var r=i.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var n=t.map;var a=r=="+".charCodeAt(0)?this.delta_:-this.delta_;var s=n.getView();Ws.zoomByDelta(s,a,undefined,this.duration_);t.preventDefault();e=true}}return!e};var to=function(t){Ws.call(this,{handleEvent:to.handleEvent});var e=t||{};this.delta_=0;this.duration_=e.duration!==undefined?e.duration:250;this.timeout_=e.timeout!==undefined?e.timeout:80;this.useAnchor_=e.useAnchor!==undefined?e.useAnchor:true;this.constrainResolution_=e.constrainResolution||false;this.lastAnchor_=null;this.startTime_=undefined;this.timeoutId_=undefined;this.mode_=undefined;this.trackpadEventGap_=400;this.trackpadTimeoutId_=undefined;this.trackpadDeltaPerZoom_=300;this.trackpadZoomBuffer_=1.5};qn.inherits(to,Ws);to.handleEvent=function(t){var e=t.type;if(e!==ra.WHEEL&&e!==ra.MOUSEWHEEL){return true}t.preventDefault();var i=t.map;var r=t.originalEvent;if(this.useAnchor_){this.lastAnchor_=t.coordinate}var n;if(t.type==ra.WHEEL){n=r.deltaY;if(Va.FIREFOX&&r.deltaMode===WheelEvent.DOM_DELTA_PIXEL){n/=Va.DEVICE_PIXEL_RATIO}if(r.deltaMode===WheelEvent.DOM_DELTA_LINE){n*=40}}else if(t.type==ra.MOUSEWHEEL){n=-r.wheelDeltaY;if(Va.SAFARI){n/=3}}if(n===0){return false}var a=Date.now();if(this.startTime_===undefined){this.startTime_=a}if(!this.mode_||a-this.startTime_>this.trackpadEventGap_){this.mode_=Math.abs(n)<4?to.Mode_.TRACKPAD:to.Mode_.WHEEL}if(this.mode_===to.Mode_.TRACKPAD){var s=i.getView();if(this.trackpadTimeoutId_){clearTimeout(this.trackpadTimeoutId_)}else{s.setHint(_s.INTERACTING,1)}this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var o=s.getResolution()*Math.pow(2,n/this.trackpadDeltaPerZoom_);var h=s.getMinResolution();var l=s.getMaxResolution();var u=0;if(o<h){o=Math.max(o,h/this.trackpadZoomBuffer_);u=1}else if(o>l){o=Math.min(o,l*this.trackpadZoomBuffer_);u=-1}if(this.lastAnchor_){var f=s.calculateCenterZoom(o,this.lastAnchor_);s.setCenter(s.constrainCenter(f))}s.setResolution(o);if(u===0&&this.constrainResolution_){s.animate({resolution:s.constrainResolution(o,n>0?-1:1),easing:Es.easeOut,anchor:this.lastAnchor_,duration:this.duration_})}if(u>0){s.animate({resolution:h,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500})}else if(u<0){s.animate({resolution:l,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500})}this.startTime_=a;return false}this.delta_+=n;var c=Math.max(this.timeout_-(a-this.startTime_),0);clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),c);return false};to.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=undefined;var t=this.getMap().getView();t.setHint(_s.INTERACTING,-1)};to.prototype.handleWheelZoom_=function(t){var e=t.getView();if(e.getAnimating()){e.cancelAnimations()}var i=qn.MOUSEWHEELZOOM_MAXDELTA;var r=ha.clamp(this.delta_,-i,i);Ws.zoomByDelta(e,-r,this.lastAnchor_,this.duration_);this.mode_=undefined;this.delta_=0;this.lastAnchor_=null;this.startTime_=undefined;this.timeoutId_=undefined};to.prototype.setMouseAnchor=function(t){this.useAnchor_=t;if(!t){this.lastAnchor_=null}};to.Mode_={TRACKPAD:"trackpad",WHEEL:"wheel"};var eo=function(t){Ys.call(this,{handleDownEvent:eo.handleDownEvent_,handleDragEvent:eo.handleDragEvent_,handleUpEvent:eo.handleUpEvent_});var e=t||{};this.anchor_=null;this.lastAngle_=undefined;this.rotating_=false;this.rotationDelta_=0;this.threshold_=e.threshold!==undefined?e.threshold:.3;this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(eo,Ys);eo.handleDragEvent_=function(t){var e=0;var i=this.targetPointers[0];var r=this.targetPointers[1];var n=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==undefined){var a=n-this.lastAngle_;this.rotationDelta_+=a;if(!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_){this.rotating_=true}e=a}this.lastAngle_=n;var s=t.map;var o=s.getView();if(o.getConstraints().rotation===vs.disable){return}var h=s.getViewport().getBoundingClientRect();var l=Ys.centroid(this.targetPointers);l[0]-=h.left;l[1]-=h.top;this.anchor_=s.getCoordinateFromPixel(l);if(this.rotating_){var u=o.getRotation();s.render();Ws.rotateWithoutConstraints(o,u+e,this.anchor_)}};eo.handleUpEvent_=function(t){if(this.targetPointers.length<2){var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);if(this.rotating_){var r=i.getRotation();Ws.rotate(i,r,this.anchor_,this.duration_)}return false}else{return true}};eo.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var e=t.map;this.anchor_=null;this.lastAngle_=undefined;this.rotating_=false;this.rotationDelta_=0;if(!this.handlingDownUpSequence){e.getView().setHint(_s.INTERACTING,1)}return true}else{return false}};eo.prototype.shouldStopEvent=_a.FALSE;var io=function(t){Ys.call(this,{handleDownEvent:io.handleDownEvent_,handleDragEvent:io.handleDragEvent_,handleUpEvent:io.handleUpEvent_});var e=t?t:{};this.constrainResolution_=e.constrainResolution||false;this.anchor_=null;this.duration_=e.duration!==undefined?e.duration:400;this.lastDistance_=undefined;this.lastScaleDelta_=1};qn.inherits(io,Ys);io.handleDragEvent_=function(t){var e=1;var i=this.targetPointers[0];var r=this.targetPointers[1];var n=i.clientX-r.clientX;var a=i.clientY-r.clientY;var s=Math.sqrt(n*n+a*a);if(this.lastDistance_!==undefined){e=this.lastDistance_/s}this.lastDistance_=s;var o=t.map;var h=o.getView();var l=h.getResolution();var u=h.getMaxResolution();var f=h.getMinResolution();var c=l*e;if(c>u){e=u/l;c=u}else if(c<f){e=f/l;c=f}if(e!=1){this.lastScaleDelta_=e}var d=o.getViewport().getBoundingClientRect();var p=Ys.centroid(this.targetPointers);p[0]-=d.left;p[1]-=d.top;this.anchor_=o.getCoordinateFromPixel(p);o.render();Ws.zoomWithoutConstraints(h,c,this.anchor_)};io.handleUpEvent_=function(t){if(this.targetPointers.length<2){var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);var r=i.getResolution();if(this.constrainResolution_||r<i.getMinResolution()||r>i.getMaxResolution()){var n=this.lastScaleDelta_-1;Ws.zoom(i,r,this.anchor_,this.duration_,n)}return false}else{return true}};io.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var e=t.map;this.anchor_=null;this.lastDistance_=undefined;this.lastScaleDelta_=1;if(!this.handlingDownUpSequence){e.getView().setHint(_s.INTERACTING,1)}return true}else{return false}};io.prototype.shouldStopEvent=_a.FALSE;var ro={};ro.defaults=function(t){var e=t?t:{};var i=new Ka;var r=new zs(-.005,.05,100);var n=e.altShiftDragRotate!==undefined?e.altShiftDragRotate:true;if(n){i.push(new Hs)}var a=e.doubleClickZoom!==undefined?e.doubleClickZoom:true;if(a){i.push(new Xs({delta:e.zoomDelta,duration:e.zoomDuration}))}var s=e.dragPan!==undefined?e.dragPan:true;if(s){i.push(new js({kinetic:r}))}var o=e.pinchRotate!==undefined?e.pinchRotate:true;if(o){i.push(new eo)}var h=e.pinchZoom!==undefined?e.pinchZoom:true;if(h){i.push(new io({constrainResolution:e.constrainResolution,duration:e.zoomDuration}))}var l=e.keyboard!==undefined?e.keyboard:true;if(l){i.push(new Qs);i.push(new $s({delta:e.zoomDelta,duration:e.zoomDuration}))}var u=e.mouseWheelZoom!==undefined?e.mouseWheelZoom:true;if(u){i.push(new to({constrainResolution:e.constrainResolution,duration:e.zoomDuration}))}var f=e.shiftDragZoom!==undefined?e.shiftDragZoom:true;if(f){i.push(new Zs({duration:e.zoomDuration}))}return i};var no=function(t,e,i,r){ia.call(this);this.extent=t;this.pixelRatio_=i;this.resolution=e;this.state=r};qn.inherits(no,ia);no.prototype.changed=function(){this.dispatchEvent(ra.CHANGE)};no.prototype.getExtent=function(){return this.extent};no.prototype.getImage=function(){};no.prototype.getPixelRatio=function(){return this.pixelRatio_};no.prototype.getResolution=function(){return this.resolution};no.prototype.getState=function(){return this.state};no.prototype.load=function(){};var ao={IDLE:0,LOADING:1,LOADED:2,ERROR:3};var so=function(t,e,i,r,n){this.loader_=n!==undefined?n:null;var a=n!==undefined?ao.IDLE:ao.LOADED;no.call(this,t,e,i,a);this.canvas_=r;this.error_=null};qn.inherits(so,no);so.prototype.getError=function(){return this.error_};so.prototype.handleLoad_=function(t){if(t){this.error_=t;this.state=ao.ERROR}else{this.state=ao.LOADED}this.changed()};so.prototype.load=function(){if(this.state==ao.IDLE){this.state=ao.LOADING;this.changed();this.loader_(this.handleLoad_.bind(this))}};so.prototype.getImage=function(){return this.canvas_};var oo={IMAGE:"IMAGE",TILE:"TILE",VECTOR_TILE:"VECTOR_TILE",VECTOR:"VECTOR"};var ho={IMAGE:"image",VECTOR:"vector"};var lo=function(t,e,i,r,n){ea.call(this,t);this.vectorContext=e;this.frameState=i;this.context=r;this.glContext=n};qn.inherits(lo,ea);var uo=function(t){ia.call(this);this.highWaterMark=t!==undefined?t:2048;this.count_=0;this.entries_={};this.oldest_=null;this.newest_=null};qn.inherits(uo,ia);uo.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark};uo.prototype.clear=function(){this.count_=0;this.entries_={};this.oldest_=null;this.newest_=null;this.dispatchEvent(ra.CLEAR)};uo.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)};uo.prototype.forEach=function(t,e){var i=this.oldest_;while(i){t.call(e,i.value_,i.key_,this);i=i.newer}};uo.prototype.get=function(t){var e=this.entries_[t];oa.assert(e!==undefined,15);if(e===this.newest_){return e.value_}else if(e===this.oldest_){this.oldest_=this.oldest_.newer;this.oldest_.older=null}else{e.newer.older=e.older;e.older.newer=e.newer}e.newer=null;e.older=this.newest_;this.newest_.newer=e;this.newest_=e;return e.value_};uo.prototype.remove=function(t){var e=this.entries_[t];oa.assert(e!==undefined,15);if(e===this.newest_){this.newest_=e.older;if(this.newest_){this.newest_.newer=null}}else if(e===this.oldest_){this.oldest_=e.newer;if(this.oldest_){this.oldest_.older=null}}else{e.newer.older=e.older;e.older.newer=e.newer}delete this.entries_[t];--this.count_;return e.value_};uo.prototype.getCount=function(){return this.count_};uo.prototype.getKeys=function(){var t=new Array(this.count_);var e=0;var i;for(i=this.newest_;i;i=i.older){t[e++]=i.key_}return t};uo.prototype.getValues=function(){var t=new Array(this.count_);var e=0;var i;for(i=this.newest_;i;i=i.older){t[e++]=i.value_}return t};uo.prototype.peekLast=function(){return this.oldest_.value_};uo.prototype.peekLastKey=function(){return this.oldest_.key_};uo.prototype.peekFirstKey=function(){return this.newest_.key_};uo.prototype.pop=function(){var t=this.oldest_;delete this.entries_[t.key_];if(t.newer){t.newer.older=null}this.oldest_=t.newer;if(!this.oldest_){this.newest_=null}--this.count_;return t.value_};uo.prototype.replace=function(t,e){this.get(t);this.entries_[t].value_=e};uo.prototype.set=function(t,e){oa.assert(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};if(!this.newest_){this.oldest_=i}else{this.newest_.newer=i}this.newest_=i;this.entries_[t]=i;++this.count_};uo.prototype.prune=function(){while(this.canExpireCache()){this.pop()}};var fo={};fo.defaultFont="10px sans-serif";fo.defaultFillStyle=[0,0,0,1];fo.defaultLineCap="round";fo.defaultLineDash=[];fo.defaultLineDashOffset=0;fo.defaultLineJoin="round";fo.defaultMiterLimit=10;fo.defaultStrokeStyle=[0,0,0,1];fo.defaultTextAlign="center";fo.defaultTextBaseline="middle";fo.defaultPadding=[0,0,0,0];fo.defaultLineWidth=1;fo.labelCache=new uo;fo.checkedFonts_={};fo.measureContext_=null;fo.textHeights_={};fo.checkFont=function(){var t=60;var e=fo.checkedFonts_;var i=fo.labelCache;var r="32px monospace";var n="wmytzilWMYTZIL@#/&?$%10";var a,s;function o(t){var e=fo.getMeasureContext();e.font=r;s=e.measureText(n).width;var i=true;if(t!="monospace"){e.font="32px "+t+",monospace";var a=e.measureText(n).width;i=a!=s}return i}function h(){var r=true;for(var n in e){if(e[n]<t){if(o(n)){e[n]=t;Qn.clear(fo.textHeights_);fo.measureContext_=null;i.clear()}else{++e[n];r=false}}}if(r){window.clearInterval(a);a=undefined}}return function(i){var r=Ps.getFontFamilies(i);if(!r){return}for(var n=0,s=r.length;n<s;++n){var l=r[n];if(!(l in e)){e[l]=t;if(!o(l)){e[l]=0;if(a===undefined){a=window.setInterval(h,32)}}}}}}();fo.getMeasureContext=function(){var t=fo.measureContext_;if(!t){t=fo.measureContext_=Ts.createCanvasContext2D(1,1)}return t};fo.measureTextHeight=function(){var t;var e=fo.textHeights_;return function(i){var r=e[i];if(r==undefined){if(!t){t=document.createElement("span");t.textContent="M";t.style.margin=t.style.padding="0 !important";t.style.position="absolute !important";t.style.left="-99999px !important"}t.style.font=i;document.body.appendChild(t);r=e[i]=t.offsetHeight;document.body.removeChild(t)}return r}}();fo.measureTextWidth=function(t,e){var i=fo.getMeasureContext();if(t!=i.font){i.font=t}return i.measureText(e).width};fo.rotateAtOffset=function(t,e,i,r){if(e!==0){t.translate(i,r);t.rotate(e);t.translate(-i,-r)}};fo.resetTransform_=Sa.create();fo.drawImage=function(t,e,i,r,n,a,s,o,h,l,u){var f;if(i!=1){f=t.globalAlpha;t.globalAlpha=f*i}if(e){t.setTransform.apply(t,e)}t.drawImage(r,n,a,s,o,h,l,s*u,o*u);if(f){t.globalAlpha=f}if(e){t.setTransform.apply(t,fo.resetTransform_)}};var co={};co.HEX_COLOR_RE_=/^#(?:[0-9a-f]{3,4}){1,2}$/i;co.NAMED_COLOR_RE_=/^([a-z]*)$/i;co.asArray=function(t){if(Array.isArray(t)){return t}else{return co.fromString(t)}};co.asString=function(t){if(typeof t==="string"){return t}else{return co.toString(t)}};co.fromNamed=function(t){var e=document.createElement("div");e.style.color=t;document.body.appendChild(e);var i=getComputedStyle(e).color;document.body.removeChild(e);return i};co.fromString=function(){var t=1024;var e={};var i=0;return function(r){var n;if(e.hasOwnProperty(r)){n=e[r]}else{if(i>=t){var a=0;var s;for(s in e){if((a++&3)===0){delete e[s];--i}}}n=co.fromStringInternal_(r);e[r]=n;++i}return n}}();co.fromStringInternal_=function(t){var e,i,r,n,a,s;if(co.NAMED_COLOR_RE_.exec(t)){t=co.fromNamed(t)}if(co.HEX_COLOR_RE_.exec(t)){var o=t.length-1;var h;if(o<=4){h=1}else{h=2}var l=o===4||o===8;e=parseInt(t.substr(1+0*h,h),16);i=parseInt(t.substr(1+1*h,h),16);r=parseInt(t.substr(1+2*h,h),16);if(l){n=parseInt(t.substr(1+3*h,h),16)}else{n=255}if(h==1){e=(e<<4)+e;i=(i<<4)+i;r=(r<<4)+r;if(l){n=(n<<4)+n}}a=[e,i,r,n/255]}else if(t.indexOf("rgba(")==0){s=t.slice(5,-1).split(",").map(Number);a=co.normalize(s)}else if(t.indexOf("rgb(")==0){s=t.slice(4,-1).split(",").map(Number);s.push(1);a=co.normalize(s)}else{oa.assert(false,14)}return a};co.normalize=function(t,e){var i=e||[];i[0]=ha.clamp(t[0]+.5|0,0,255);i[1]=ha.clamp(t[1]+.5|0,0,255);i[2]=ha.clamp(t[2]+.5|0,0,255);i[3]=ha.clamp(t[3],0,1);return i};co.toString=function(t){var e=t[0];if(e!=(e|0)){e=e+.5|0}var i=t[1];if(i!=(i|0)){i=i+.5|0}var r=t[2];if(r!=(r|0)){r=r+.5|0}var n=t[3]===undefined?1:t[3];return"rgba("+e+","+i+","+r+","+n+")"};var po={};po.asColorLike=function(t){if(po.isColorLike(t)){return t}else{return co.asString(t)}};po.isColorLike=function(t){return typeof t==="string"||t instanceof CanvasPattern||t instanceof CanvasGradient};var vo=function(){};vo.prototype.drawCustom=function(t,e,i){};vo.prototype.drawGeometry=function(t){};vo.prototype.setStyle=function(t){};vo.prototype.drawCircle=function(t,e){};vo.prototype.drawFeature=function(t,e){};vo.prototype.drawGeometryCollection=function(t,e){};vo.prototype.drawLineString=function(t,e){};vo.prototype.drawMultiLineString=function(t,e){};vo.prototype.drawMultiPoint=function(t,e){};vo.prototype.drawMultiPolygon=function(t,e){};vo.prototype.drawPoint=function(t,e){};vo.prototype.drawPolygon=function(t,e){};vo.prototype.drawText=function(t,e){};vo.prototype.setFillStrokeStyle=function(t,e){};vo.prototype.setImageStyle=function(t,e){};vo.prototype.setTextStyle=function(t,e){};var _o=function(t,e,i,r,n){vo.call(this);this.context_=t;this.pixelRatio_=e;this.extent_=i;this.transform_=r;this.viewRotation_=n;this.contextFillState_=null;this.contextStrokeState_=null;this.contextTextState_=null;this.fillState_=null;this.strokeState_=null;this.image_=null;this.imageAnchorX_=0;this.imageAnchorY_=0;this.imageHeight_=0;this.imageOpacity_=0;this.imageOriginX_=0;this.imageOriginY_=0;this.imageRotateWithView_=false;this.imageRotation_=0;this.imageScale_=0;this.imageSnapToPixel_=false;this.imageWidth_=0;this.text_="";this.textOffsetX_=0;this.textOffsetY_=0;this.textRotateWithView_=false;this.textRotation_=0;this.textScale_=0;this.textFillState_=null;this.textStrokeState_=null;this.textState_=null;this.pixelCoordinates_=[];this.tmpLocalTransform_=Sa.create()};qn.inherits(_o,vo);_o.prototype.drawImages_=function(t,e,i,r){if(!this.image_){return}var n=ga.transform2D(t,e,i,2,this.transform_,this.pixelCoordinates_);var a=this.context_;var s=this.tmpLocalTransform_;var o=a.globalAlpha;if(this.imageOpacity_!=1){a.globalAlpha=o*this.imageOpacity_}var h=this.imageRotation_;if(this.imageRotateWithView_){h+=this.viewRotation_}var l,u;for(l=0,u=n.length;l<u;l+=2){var f=n[l]-this.imageAnchorX_;var c=n[l+1]-this.imageAnchorY_;if(this.imageSnapToPixel_){f=Math.round(f);c=Math.round(c)}if(h!==0||this.imageScale_!=1){var d=f+this.imageAnchorX_;var p=c+this.imageAnchorY_;Sa.compose(s,d,p,this.imageScale_,this.imageScale_,h,-d,-p);a.setTransform.apply(a,s)}a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,c,this.imageWidth_,this.imageHeight_)}if(h!==0||this.imageScale_!=1){a.setTransform(1,0,0,1,0,0)}if(this.imageOpacity_!=1){a.globalAlpha=o}};_o.prototype.drawText_=function(t,e,i,r){if(!this.textState_||this.text_===""){return}if(this.textFillState_){this.setContextFillState_(this.textFillState_)}if(this.textStrokeState_){this.setContextStrokeState_(this.textStrokeState_)}this.setContextTextState_(this.textState_);var n=ga.transform2D(t,e,i,r,this.transform_,this.pixelCoordinates_);var a=this.context_;var s=this.textRotation_;if(this.textRotateWithView_){s+=this.viewRotation_}for(;e<i;e+=r){var o=n[e]+this.textOffsetX_;var h=n[e+1]+this.textOffsetY_;if(s!==0||this.textScale_!=1){var l=Sa.compose(this.tmpLocalTransform_,o,h,this.textScale_,this.textScale_,s,-o,-h);a.setTransform.apply(a,l)}if(this.textStrokeState_){a.strokeText(this.text_,o,h)}if(this.textFillState_){a.fillText(this.text_,o,h)}}if(s!==0||this.textScale_!=1){a.setTransform(1,0,0,1,0,0)}};_o.prototype.moveToLineTo_=function(t,e,i,r,n){var a=this.context_;var s=ga.transform2D(t,e,i,r,this.transform_,this.pixelCoordinates_);a.moveTo(s[0],s[1]);var o=s.length;if(n){o-=2}for(var h=2;h<o;h+=2){a.lineTo(s[h],s[h+1])}if(n){a.closePath()}return i};_o.prototype.drawRings_=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){e=this.moveToLineTo_(t,e,i[n],r,true)}return e};_o.prototype.drawCircle=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.fillState_||this.strokeState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=La.transform2D(t,this.transform_,this.pixelCoordinates_);var i=e[2]-e[0];var r=e[3]-e[1];var n=Math.sqrt(i*i+r*r);var a=this.context_;a.beginPath();a.arc(e[0],e[1],n,0,2*Math.PI);if(this.fillState_){a.fill()}if(this.strokeState_){a.stroke()}}if(this.text_!==""){this.drawText_(t.getCenter(),0,2,2)}};_o.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke());this.setImageStyle(t.getImage());this.setTextStyle(t.getText())};_o.prototype.drawGeometry=function(t){var e=t.getType();switch(e){case la.POINT:this.drawPoint(t);break;case la.LINE_STRING:this.drawLineString(t);break;case la.POLYGON:this.drawPolygon(t);break;case la.MULTI_POINT:this.drawMultiPoint(t);break;case la.MULTI_LINE_STRING:this.drawMultiLineString(t);break;case la.MULTI_POLYGON:this.drawMultiPolygon(t);break;case la.GEOMETRY_COLLECTION:this.drawGeometryCollection(t);break;case la.CIRCLE:this.drawCircle(t);break}};_o.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);if(!i||!pa.intersects(this.extent_,i.getExtent())){return}this.setStyle(e);this.drawGeometry(i)};_o.prototype.drawGeometryCollection=function(t){var e=t.getGeometriesArray();var i,r;for(i=0,r=e.length;i<r;++i){this.drawGeometry(e[i])}};_o.prototype.drawPoint=function(t){var e=t.getFlatCoordinates();var i=t.getStride();if(this.image_){this.drawImages_(e,0,e.length,i)}if(this.text_!==""){this.drawText_(e,0,e.length,i)}};_o.prototype.drawMultiPoint=function(t){var e=t.getFlatCoordinates();var i=t.getStride();if(this.image_){this.drawImages_(e,0,e.length,i)}if(this.text_!==""){this.drawText_(e,0,e.length,i)}};_o.prototype.drawLineString=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var e=this.context_;var i=t.getFlatCoordinates();e.beginPath();this.moveToLineTo_(i,0,i.length,t.getStride(),false);e.stroke()}if(this.text_!==""){var r=t.getFlatMidpoint();this.drawText_(r,0,2,2)}};_o.prototype.drawMultiLineString=function(t){var e=t.getExtent();if(!pa.intersects(this.extent_,e)){return}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_;var r=t.getFlatCoordinates();var n=0;var a=t.getEnds();var s=t.getStride();i.beginPath();var o,h;for(o=0,h=a.length;o<h;++o){n=this.moveToLineTo_(r,n,a[o],s,false)}i.stroke()}if(this.text_!==""){var l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}};_o.prototype.drawPolygon=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_||this.fillState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=this.context_;e.beginPath();this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride());if(this.fillState_){e.fill()}if(this.strokeState_){e.stroke()}}if(this.text_!==""){var i=t.getFlatInteriorPoint();this.drawText_(i,0,2,2)}};_o.prototype.drawMultiPolygon=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_||this.fillState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=this.context_;var i=t.getOrientedFlatCoordinates();var r=0;var n=t.getEndss();var a=t.getStride();var s,o;e.beginPath();for(s=0,o=n.length;s<o;++s){var h=n[s];r=this.drawRings_(i,r,h,a)}if(this.fillState_){e.fill()}if(this.strokeState_){e.stroke()}}if(this.text_!==""){var l=t.getFlatInteriorPoints();this.drawText_(l,0,l.length,2)}};_o.prototype.setContextFillState_=function(t){var e=this.context_;var i=this.contextFillState_;if(!i){e.fillStyle=t.fillStyle;this.contextFillState_={fillStyle:t.fillStyle}}else{if(i.fillStyle!=t.fillStyle){i.fillStyle=e.fillStyle=t.fillStyle}}};_o.prototype.setContextStrokeState_=function(t){var e=this.context_;var i=this.contextStrokeState_;if(!i){e.lineCap=t.lineCap;if(Va.CANVAS_LINE_DASH){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.lineJoin=t.lineJoin;e.lineWidth=t.lineWidth;e.miterLimit=t.miterLimit;e.strokeStyle=t.strokeStyle;this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle}}else{if(i.lineCap!=t.lineCap){i.lineCap=e.lineCap=t.lineCap}if(Va.CANVAS_LINE_DASH){if(!fa.equals(i.lineDash,t.lineDash)){e.setLineDash(i.lineDash=t.lineDash)}if(i.lineDashOffset!=t.lineDashOffset){i.lineDashOffset=e.lineDashOffset=t.lineDashOffset}}if(i.lineJoin!=t.lineJoin){i.lineJoin=e.lineJoin=t.lineJoin}if(i.lineWidth!=t.lineWidth){i.lineWidth=e.lineWidth=t.lineWidth}if(i.miterLimit!=t.miterLimit){i.miterLimit=e.miterLimit=t.miterLimit}if(i.strokeStyle!=t.strokeStyle){i.strokeStyle=e.strokeStyle=t.strokeStyle}}};_o.prototype.setContextTextState_=function(t){var e=this.context_;var i=this.contextTextState_;var r=t.textAlign?t.textAlign:fo.defaultTextAlign;if(!i){e.font=t.font;e.textAlign=r;e.textBaseline=t.textBaseline;this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline}}else{if(i.font!=t.font){i.font=e.font=t.font}if(i.textAlign!=r){i.textAlign=r}if(i.textBaseline!=t.textBaseline){i.textBaseline=e.textBaseline=t.textBaseline}}};_o.prototype.setFillStrokeStyle=function(t,e){if(!t){this.fillState_=null}else{var i=t.getColor();this.fillState_={fillStyle:po.asColorLike(i?i:fo.defaultFillStyle)}}if(!e){this.strokeState_=null}else{var r=e.getColor();var n=e.getLineCap();var a=e.getLineDash();var s=e.getLineDashOffset();var o=e.getLineJoin();var h=e.getWidth();var l=e.getMiterLimit();this.strokeState_={lineCap:n!==undefined?n:fo.defaultLineCap,lineDash:a?a:fo.defaultLineDash,lineDashOffset:s?s:fo.defaultLineDashOffset,lineJoin:o!==undefined?o:fo.defaultLineJoin,lineWidth:this.pixelRatio_*(h!==undefined?h:fo.defaultLineWidth),miterLimit:l!==undefined?l:fo.defaultMiterLimit,strokeStyle:po.asColorLike(r?r:fo.defaultStrokeStyle)}}};_o.prototype.setImageStyle=function(t){if(!t){this.image_=null}else{var e=t.getAnchor();var i=t.getImage(1);var r=t.getOrigin();var n=t.getSize();this.imageAnchorX_=e[0];this.imageAnchorY_=e[1];this.imageHeight_=n[1];this.image_=i;this.imageOpacity_=t.getOpacity();this.imageOriginX_=r[0];this.imageOriginY_=r[1];this.imageRotateWithView_=t.getRotateWithView();this.imageRotation_=t.getRotation();this.imageScale_=t.getScale()*this.pixelRatio_;this.imageSnapToPixel_=t.getSnapToPixel();this.imageWidth_=n[0]}};_o.prototype.setTextStyle=function(t){if(!t){this.text_=""}else{var e=t.getFill();if(!e){this.textFillState_=null}else{var i=e.getColor();this.textFillState_={fillStyle:po.asColorLike(i?i:fo.defaultFillStyle)}}var r=t.getStroke();if(!r){this.textStrokeState_=null}else{var n=r.getColor();var a=r.getLineCap();var s=r.getLineDash();var o=r.getLineDashOffset();var h=r.getLineJoin();var l=r.getWidth();var u=r.getMiterLimit();this.textStrokeState_={lineCap:a!==undefined?a:fo.defaultLineCap,lineDash:s?s:fo.defaultLineDash,lineDashOffset:o?o:fo.defaultLineDashOffset,lineJoin:h!==undefined?h:fo.defaultLineJoin,lineWidth:l!==undefined?l:fo.defaultLineWidth,miterLimit:u!==undefined?u:fo.defaultMiterLimit,strokeStyle:po.asColorLike(n?n:fo.defaultStrokeStyle)}}var f=t.getFont();var c=t.getOffsetX();var d=t.getOffsetY();var p=t.getRotateWithView();var v=t.getRotation();var _=t.getScale();var g=t.getText();var m=t.getTextAlign();var y=t.getTextBaseline();this.textState_={font:f!==undefined?f:fo.defaultFont,textAlign:m!==undefined?m:fo.defaultTextAlign,textBaseline:y!==undefined?y:fo.defaultTextBaseline};this.text_=g!==undefined?g:"";this.textOffsetX_=c!==undefined?this.pixelRatio_*c:0;this.textOffsetY_=d!==undefined?this.pixelRatio_*d:0;this.textRotateWithView_=p!==undefined?p:false;this.textRotation_=v!==undefined?v:0;this.textScale_=this.pixelRatio_*(_!==undefined?_:1)}};var go=function(t){na.call(this);this.layer_=t};qn.inherits(go,na);go.prototype.forEachFeatureAtCoordinate=qn.nullFunction;go.prototype.hasFeatureAtCoordinate=_a.FALSE;go.prototype.createLoadedTileFinder=function(t,e,i){return function(r,n){function a(t){if(!i[r]){i[r]={}}i[r][t.tileCoord.toString()]=t}return t.forEachLoadedTile(e,r,n,a)}};go.prototype.getLayer=function(){return this.layer_};go.prototype.handleImageChange_=function(t){var e=t.target;if(e.getState()===ao.LOADED){this.renderIfReadyAndVisible()}};go.prototype.loadImage=function(t){var e=t.getState();if(e!=ao.LOADED&&e!=ao.ERROR){$n.listen(t,ra.CHANGE,this.handleImageChange_,this)}if(e==ao.IDLE){t.load();e=t.getState()}return e==ao.LOADED};go.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();if(t.getVisible()&&t.getSourceState()==Ms.READY){this.changed()}};go.prototype.scheduleExpireCache=function(t,e){if(e.canExpireCache()){var i=function(t,e,i){var r=qn.getUid(t).toString();if(r in i.usedTiles){t.expireCache(i.viewState.projection,i.usedTiles[r])}}.bind(null,e);t.postRenderFunctions.push(i)}};go.prototype.updateLogos=function(t,e){var i=e.getLogo();if(i!==undefined){if(typeof i==="string"){t.logos[i]=""}else if(i){oa.assert(typeof i.href=="string",44);oa.assert(typeof i.src=="string",45);t.logos[i.src]=i.href}}};go.prototype.updateUsedTiles=function(t,e,i,r){var n=qn.getUid(e).toString();var a=i.toString();if(n in t){if(a in t[n]){t[n][a].extend(r)}else{t[n][a]=r}}else{t[n]={};t[n][a]=r}};go.prototype.manageTilePyramid=function(t,e,i,r,n,a,s,o,h,l){var u=qn.getUid(e).toString();if(!(u in t.wantedTiles)){t.wantedTiles[u]={}}var f=t.wantedTiles[u];var c=t.tileQueue;var d=i.getMinZoom();var p,v,_,g,m,y;for(y=d;y<=s;++y){v=i.getTileRangeForExtentAndZ(a,y,v);_=i.getResolution(y);for(g=v.minX;g<=v.maxX;++g){for(m=v.minY;m<=v.maxY;++m){if(s-y<=o){p=e.getTile(y,g,m,r,n);if(p.getState()==us.IDLE){f[p.getKey()]=true;if(!c.isKeyQueued(p.getKey())){c.enqueue([p,u,i.getTileCoordCenter(p.tileCoord),_])}}if(h!==undefined){h.call(l,p)}}else{e.useTile(y,g,m,n)}}}}};var mo=function(t){go.call(this,t);this.transform_=Sa.create()};qn.inherits(mo,go);mo.prototype.clip=function(t,e,i){var r=e.pixelRatio;var n=e.size[0]*r;var a=e.size[1]*r;var s=e.viewState.rotation;var o=pa.getTopLeft(i);var h=pa.getTopRight(i);var l=pa.getBottomRight(i);var u=pa.getBottomLeft(i);Sa.apply(e.coordinateToPixelTransform,o);Sa.apply(e.coordinateToPixelTransform,h);Sa.apply(e.coordinateToPixelTransform,l);Sa.apply(e.coordinateToPixelTransform,u);t.save();fo.rotateAtOffset(t,-s,n/2,a/2);t.beginPath();t.moveTo(o[0]*r,o[1]*r);t.lineTo(h[0]*r,h[1]*r);t.lineTo(l[0]*r,l[1]*r);t.lineTo(u[0]*r,u[1]*r);t.clip();fo.rotateAtOffset(t,s,n/2,a/2)};mo.prototype.dispatchComposeEvent_=function(t,e,i,r){var n=this.getLayer();if(n.hasListener(t)){var a=i.size[0]*i.pixelRatio;var s=i.size[1]*i.pixelRatio;var o=i.viewState.rotation;fo.rotateAtOffset(e,-o,a/2,s/2);var h=r!==undefined?r:this.getTransform(i,0);var l=new _o(e,i.pixelRatio,i.extent,h,i.viewState.rotation);var u=new lo(t,l,i,e,null);n.dispatchEvent(u);fo.rotateAtOffset(e,o,a/2,s/2)}};mo.prototype.forEachLayerAtCoordinate=function(t,e,i,r){var n=this.forEachFeatureAtCoordinate(t,e,0,_a.TRUE,this);if(n){return i.call(r,this.getLayer(),null)}else{return undefined}};mo.prototype.postCompose=function(t,e,i,r){this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t,e,r)};mo.prototype.preCompose=function(t,e,i){this.dispatchComposeEvent_(Ds.PRECOMPOSE,t,e,i)};mo.prototype.dispatchRenderEvent=function(t,e,i){this.dispatchComposeEvent_(Ds.RENDER,t,e,i)};mo.prototype.getTransform=function(t,e){var i=t.viewState;var r=t.pixelRatio;var n=r*t.size[0]/2;var a=r*t.size[1]/2;var s=r/i.resolution;var o=-s;var h=-i.rotation;var l=-i.center[0]+e;var u=-i.center[1];return Sa.compose(this.transform_,n,a,s,o,h,l,u)};mo.prototype.composeFrame=function(t,e,i){};mo.prototype.prepareFrame=function(t,e){};var yo=function(t){mo.call(this,t);this.coordinateToCanvasPixelTransform=Sa.create();this.hitCanvasContext_=null};qn.inherits(yo,mo);yo.prototype.composeFrame=function(t,e,i){this.preCompose(i,t);var r=this.getImage();if(r){var n=e.extent;var a=n!==undefined&&!pa.containsExtent(n,t.extent)&&pa.intersects(n,t.extent);if(a){this.clip(i,t,n)}var s=this.getImageTransform();var o=i.globalAlpha;i.globalAlpha=e.opacity;var h=s[4];var l=s[5];var u=r.width*s[0];var f=r.height*s[3];i.drawImage(r,0,0,+r.width,+r.height,Math.round(h),Math.round(l),Math.round(u),Math.round(f));i.globalAlpha=o;if(a){i.restore()}}this.postCompose(i,t,e)};yo.prototype.getImage=function(){};yo.prototype.getImageTransform=function(){};yo.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=this.getLayer();var s=a.getSource();var o=e.viewState.resolution;var h=e.viewState.rotation;var l=e.skippedFeatureUids;return s.forEachFeatureAtCoordinate(t,o,h,i,l,(function(t){return r.call(n,t,a)}))};yo.prototype.forEachLayerAtCoordinate=function(t,e,i,r){if(!this.getImage()){return undefined}if(this.getLayer().getSource().forEachFeatureAtCoordinate!==qn.nullFunction){return mo.prototype.forEachLayerAtCoordinate.apply(this,arguments)}else{var n=Sa.apply(this.coordinateToCanvasPixelTransform,t.slice());ys.scale(n,e.viewState.resolution/this.renderedResolution);if(!this.hitCanvasContext_){this.hitCanvasContext_=Ts.createCanvasContext2D(1,1)}this.hitCanvasContext_.clearRect(0,0,1,1);this.hitCanvasContext_.drawImage(this.getImage(),n[0],n[1],1,1,0,0,1,1);var a=this.hitCanvasContext_.getImageData(0,0,1,1).data;if(a[3]>0){return i.call(r,this.getLayer(),a)}else{return undefined}}};var Eo=function(t){yo.call(this,t);this.image_=null;this.imageTransform_=Sa.create();this.skippedFeatures_=[];this.vectorRenderer_=null};qn.inherits(Eo,yo);Eo["handles"]=function(t,e){return t===As.CANVAS&&(e.getType()===oo.IMAGE||e.getType()===oo.VECTOR&&e.getRenderMode()===ho.IMAGE)};Eo["create"]=function(t,e){var i=new Eo(e);if(e.getType()===oo.VECTOR){var r=Ls.getLayerRendererPlugins();for(var n=0,a=r.length;n<a;++n){var s=r[n];if(s!==Eo&&s["handles"](As.CANVAS,e)){i.setVectorRenderer(s["create"](t,e))}}}return i};Eo.prototype.getImage=function(){return!this.image_?null:this.image_.getImage()};Eo.prototype.getImageTransform=function(){return this.imageTransform_};Eo.prototype.prepareFrame=function(t,e){var i=t.pixelRatio;var r=t.size;var n=t.viewState;var a=n.center;var s=n.resolution;var o;var h=this.getLayer();var l=h.getSource();var u=t.viewHints;var f=t.extent;if(e.extent!==undefined){f=pa.getIntersection(f,e.extent)}if(!u[_s.ANIMATING]&&!u[_s.INTERACTING]&&!pa.isEmpty(f)){var c=n.projection;if(!qn.ENABLE_RASTER_REPROJECTION){var d=l.getProjection();if(d){c=d}}var p=this.vectorRenderer_;if(p){var v=p.context;var _=Qn.assign({},t,{size:[pa.getWidth(f)/s,pa.getHeight(f)/s],viewState:Qn.assign({},t.viewState,{rotation:0})});var g=Object.keys(_.skippedFeatureUids).sort();if(p.prepareFrame(_,e)&&(p.replayGroupChanged||!fa.equals(g,this.skippedFeatures_))){v.canvas.width=_.size[0]*i;v.canvas.height=_.size[1]*i;p.composeFrame(_,e,v);this.image_=new so(f,s,i,v.canvas);this.skippedFeatures_=g}}else{o=l.getImage(f,s,i,c);if(o){var m=this.loadImage(o);if(m){this.image_=o}}}}if(this.image_){o=this.image_;var y=o.getExtent();var E=o.getResolution();var x=o.getPixelRatio();var T=i*E/(s*x);var C=Sa.compose(this.imageTransform_,i*r[0]/2,i*r[1]/2,T,T,0,x*(y[0]-a[0])/E,x*(a[1]-y[3])/E);Sa.compose(this.coordinateToCanvasPixelTransform,i*r[0]/2-C[4],i*r[1]/2-C[5],i/s,-i/s,0,-a[0],-a[1]);this.updateLogos(t,l);this.renderedResolution=E*i/x}return!!this.image_};Eo.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.vectorRenderer_){return this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,r,n)}else{return yo.prototype.forEachFeatureAtCoordinate.call(this,t,e,i,r,n)}};Eo.prototype.setVectorRenderer=function(t){this.vectorRenderer_=t};var xo=function(){this.cache_={};this.cacheSize_=0;this.maxCacheSize_=32};xo.getKey=function(t,e,i){var r=i?co.asString(i):"null";return e+":"+t+":"+r};xo.prototype.clear=function(){this.cache_={};this.cacheSize_=0};xo.prototype.expire=function(){if(this.cacheSize_>this.maxCacheSize_){var t=0;var e,i;for(e in this.cache_){i=this.cache_[e];if((t++&3)===0&&!i.hasListener()){delete this.cache_[e];--this.cacheSize_}}}};xo.prototype.get=function(t,e,i){var r=xo.getKey(t,e,i);return r in this.cache_?this.cache_[r]:null};xo.prototype.set=function(t,e,i,r){var n=xo.getKey(t,e,i);this.cache_[n]=r;++this.cacheSize_};xo.prototype.setSize=function(t){this.maxCacheSize_=t;this.expire()};var To={};To.iconImageCache=new xo;var Co=function(t,e){ta.call(this);this.map_=e;this.layerRenderers_={};this.layerRendererListeners_={}};qn.inherits(Co,ta);Co.prototype.calculateMatrices2D=function(t){var e=t.viewState;var i=t.coordinateToPixelTransform;var r=t.pixelToCoordinateTransform;Sa.compose(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]);Sa.invert(Sa.setFromArray(r,i))};Co.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_){this.removeLayerRendererByKey_(t).dispose()}};Co.expireIconCache_=function(t,e){var i=To.iconImageCache;i.expire()};Co.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){var o;var h=e.viewState;var l=h.resolution;function u(t,i){var a=qn.getUid(t).toString();var s=e.layerStates[qn.getUid(i)].managed;if(!(a in e.skippedFeatureUids&&!s)){return r.call(n,t,s?i:null)}}var f=h.projection;var c=t;if(f.canWrapX()){var d=f.getExtent();var p=pa.getWidth(d);var v=t[0];if(v<d[0]||v>d[2]){var _=Math.ceil((d[0]-v)/p);c=[v+p*_,t[1]]}}var g=e.layerStatesArray;var m=g.length;var y;for(y=m-1;y>=0;--y){var E=g[y];var x=E.layer;if(Fs.visibleAtResolution(E,l)&&a.call(s,x)){var T=this.getLayerRenderer(x);if(x.getSource()){o=T.forEachFeatureAtCoordinate(x.getSource().getWrapX()?c:t,e,i,u,n)}if(o){return o}}}return undefined};Co.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){};Co.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var a=this.forEachFeatureAtCoordinate(t,e,i,_a.TRUE,this,r,n);return a!==undefined};Co.prototype.getLayerRenderer=function(t){var e=qn.getUid(t).toString();if(e in this.layerRenderers_){return this.layerRenderers_[e]}else{var i=Ls.getLayerRendererPlugins();var r;var n=this.getType();for(var a=0,s=i.length;a<s;++a){var o=i[a];if(o["handles"](n,t)){r=o["create"](this,t);break}}if(r){this.layerRenderers_[e]=r;this.layerRendererListeners_[e]=$n.listen(r,ra.CHANGE,this.handleLayerRendererChange_,this)}else{throw new Error("Unable to create renderer for layer: "+t.getType())}return r}};Co.prototype.getLayerRendererByKey=function(t){return this.layerRenderers_[t]};Co.prototype.getLayerRenderers=function(){return this.layerRenderers_};Co.prototype.getMap=function(){return this.map_};Co.prototype.getType=function(){};Co.prototype.handleLayerRendererChange_=function(){this.map_.render()};Co.prototype.removeLayerRendererByKey_=function(t){var e=this.layerRenderers_[t];delete this.layerRenderers_[t];$n.unlistenByKey(this.layerRendererListeners_[t]);delete this.layerRendererListeners_[t];return e};Co.prototype.renderFrame=qn.nullFunction;Co.prototype.removeUnusedLayerRenderers_=function(t,e){var i;for(i in this.layerRenderers_){if(!e||!(i in e.layerStates)){this.removeLayerRendererByKey_(i).dispose()}}};Co.prototype.scheduleExpireIconCache=function(t){t.postRenderFunctions.push(Co.expireIconCache_)};Co.prototype.scheduleRemoveUnusedLayerRenderers=function(t){var e;for(e in this.layerRenderers_){if(!(e in t.layerStates)){t.postRenderFunctions.push(this.removeUnusedLayerRenderers_.bind(this));return}}};Co.sortByZIndex=function(t,e){return t.zIndex-e.zIndex};var Ro=function(t,e){Co.call(this,t,e);this.context_=Ts.createCanvasContext2D();this.canvas_=this.context_.canvas;this.canvas_.style.width="100%";this.canvas_.style.height="100%";this.canvas_.style.display="block";this.canvas_.className=Ps.CLASS_UNSELECTABLE;t.insertBefore(this.canvas_,t.childNodes[0]||null);this.renderedVisible_=true;this.transform_=Sa.create()};qn.inherits(Ro,Co);Ro["handles"]=function(t){return t===As.CANVAS};Ro["create"]=function(t,e){return new Ro(t,e)};Ro.prototype.dispatchComposeEvent_=function(t,e){var i=this.getMap();var r=this.context_;if(i.hasListener(t)){var n=e.extent;var a=e.pixelRatio;var s=e.viewState;var o=s.rotation;var h=this.getTransform(e);var l=new _o(r,a,n,h,o);var u=new lo(t,l,e,r,null);i.dispatchEvent(u)}};Ro.prototype.getTransform=function(t){var e=t.viewState;var i=this.canvas_.width/2;var r=this.canvas_.height/2;var n=t.pixelRatio/e.resolution;var a=-n;var s=-e.rotation;var o=-e.center[0];var h=-e.center[1];return Sa.compose(this.transform_,i,r,n,a,s,o,h)};Ro.prototype.getType=function(){return As.CANVAS};Ro.prototype.renderFrame=function(t){if(!t){if(this.renderedVisible_){this.canvas_.style.display="none";this.renderedVisible_=false}return}var e=this.context_;var i=t.pixelRatio;var r=Math.round(t.size[0]*i);var n=Math.round(t.size[1]*i);if(this.canvas_.width!=r||this.canvas_.height!=n){this.canvas_.width=r;this.canvas_.height=n}else{e.clearRect(0,0,r,n)}var a=t.viewState.rotation;this.calculateMatrices2D(t);this.dispatchComposeEvent_(Ds.PRECOMPOSE,t);var s=t.layerStatesArray;fa.stableSort(s,Co.sortByZIndex);if(a){e.save();fo.rotateAtOffset(e,a,r/2,n/2)}var o=t.viewState.resolution;var h,l,u,f,c;for(h=0,l=s.length;h<l;++h){c=s[h];u=c.layer;f=this.getLayerRenderer(u);if(!Fs.visibleAtResolution(c,o)||c.sourceState!=Ms.READY){continue}if(f.prepareFrame(t,c)){f.composeFrame(t,c,e)}}if(a){e.restore()}this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t);if(!this.renderedVisible_){this.canvas_.style.display="";this.renderedVisible_=true}this.scheduleRemoveUnusedLayerRenderers(t);this.scheduleExpireIconCache(t)};Ro.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){var s;var o=e.viewState;var h=o.resolution;var l=e.layerStatesArray;var u=l.length;var f=Sa.apply(e.pixelToCoordinateTransform,t.slice());var c;for(c=u-1;c>=0;--c){var d=l[c];var p=d.layer;if(Fs.visibleAtResolution(d,h)&&n.call(a,p)){var v=this.getLayerRenderer(p);s=v.forEachLayerAtCoordinate(f,e,i,r);if(s){return s}}}return undefined};var Mo=function(t,e,i,r){this.minX=t;this.maxX=e;this.minY=i;this.maxY=r};Mo.createOrUpdate=function(t,e,i,r,n){if(n!==undefined){n.minX=t;n.maxX=e;n.minY=i;n.maxY=r;return n}else{return new Mo(t,e,i,r)}};Mo.prototype.contains=function(t){return this.containsXY(t[1],t[2])};Mo.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY};Mo.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY};Mo.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY};Mo.prototype.extend=function(t){if(t.minX<this.minX){this.minX=t.minX}if(t.maxX>this.maxX){this.maxX=t.maxX}if(t.minY<this.minY){this.minY=t.minY}if(t.maxY>this.maxY){this.maxY=t.maxY}};Mo.prototype.getHeight=function(){return this.maxY-this.minY+1};Mo.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]};Mo.prototype.getWidth=function(){return this.maxX-this.minX+1};Mo.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var So=function(t){yo.call(this,t);this.context=this.context===null?null:Ts.createCanvasContext2D();this.renderedExtent_=null;this.renderedTiles=[];this.tmpExtent=pa.createEmpty();this.tmpTileRange_=new Mo(0,0,0,0);this.imageTransform_=Sa.create();this.zDirection=0};qn.inherits(So,yo);So["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.TILE};So["create"]=function(t,e){return new So(e)};So.prototype.isDrawableTile_=function(t){var e=t.getState();var i=this.getLayer().getUseInterimTilesOnError();return e==us.LOADED||e==us.EMPTY||e==us.ERROR&&!i};So.prototype.prepareFrame=function(t,e){var i=t.pixelRatio;var r=t.size;var n=t.viewState;var a=n.projection;var s=n.resolution;var o=n.center;var h=this.getLayer();var l=h.getSource();var u=l.getRevision();var f=l.getTileGridForProjection(a);var c=f.getZForResolution(s,this.zDirection);var d=f.getResolution(c);var p=Math.round(s/d)||1;var v=t.extent;if(e.extent!==undefined){v=pa.getIntersection(v,e.extent)}if(pa.isEmpty(v)){return false}var _=f.getTileRangeForExtentAndZ(v,c);var g=f.getTileRangeExtent(c,_);var m=l.getTilePixelRatio(i);var y={};y[c]={};var E=this.createLoadedTileFinder(l,a,y);var x=this.tmpExtent;var T=this.tmpTileRange_;var C=false;var R,M,S;for(M=_.minX;M<=_.maxX;++M){for(S=_.minY;S<=_.maxY;++S){R=l.getTile(c,M,S,i,a);if(R.getState()==us.ERROR){if(!h.getUseInterimTilesOnError()){R.setState(us.LOADED)}else if(h.getPreload()>0){C=true}}if(!this.isDrawableTile_(R)){R=R.getInterimTile()}if(this.isDrawableTile_(R)){var I=qn.getUid(this);if(R.getState()==us.LOADED){y[c][R.tileCoord.toString()]=R;var L=R.inTransition(I);if(!C&&(L||this.renderedTiles.indexOf(R)===-1)){C=true}}if(R.getAlpha(I,t.time)===1){continue}}var A=f.getTileCoordChildTileRange(R.tileCoord,T,x);var w=false;if(A){w=E(c+1,A)}if(!w){f.forEachTileCoordParentTileRange(R.tileCoord,E,null,T,x)}}}var O=d*i/m*p;var b=t.viewHints;var P=b[_s.ANIMATING]||b[_s.INTERACTING];if(!(this.renderedResolution&&Date.now()-t.time>16&&P)&&(C||!(this.renderedExtent_&&pa.containsExtent(this.renderedExtent_,v))||this.renderedRevision!=u||p!=this.oversampling_||!P&&O!=this.renderedResolution)){var D=this.context;if(D){var F=l.getTilePixelSize(c,i,a);var N=Math.round(_.getWidth()*F[0]/p);var G=Math.round(_.getHeight()*F[1]/p);var k=D.canvas;if(k.width!=N||k.height!=G){this.oversampling_=p;k.width=N;k.height=G}else{if(this.renderedExtent_&&!pa.equals(g,this.renderedExtent_)){D.clearRect(0,0,N,G)}p=this.oversampling_}}this.renderedTiles.length=0;var U=Object.keys(y).map(Number);U.sort((function(t,e){if(t===c){return 1}else if(e===c){return-1}else{return t>e?1:t<e?-1:0}}));var z,B,W,X,V,Y;var j,H,K,q,Z;for(V=0,Y=U.length;V<Y;++V){X=U[V];W=l.getTilePixelSize(X,i,a);z=f.getResolution(X);B=z/d;H=m*l.getGutter(a);K=y[X];for(var J in K){R=K[J];j=f.getTileCoordExtent(R.getTileCoord(),x);M=(j[0]-g[0])/d*m/p;S=(g[3]-j[3])/d*m/p;q=W[0]*B/p;Z=W[1]*B/p;this.drawTileImage(R,t,e,M,S,q,Z,H,c===X);this.renderedTiles.push(R)}}this.renderedRevision=u;this.renderedResolution=d*i/m*p;this.renderedExtent_=g}var Q=this.renderedResolution/s;var $=Sa.compose(this.imageTransform_,i*r[0]/2,i*r[1]/2,Q,Q,0,(this.renderedExtent_[0]-o[0])/this.renderedResolution*i,(o[1]-this.renderedExtent_[3])/this.renderedResolution*i);Sa.compose(this.coordinateToCanvasPixelTransform,i*r[0]/2-$[4],i*r[1]/2-$[5],i/s,-i/s,0,-o[0],-o[1]);this.updateUsedTiles(t.usedTiles,l,c,_);this.manageTilePyramid(t,l,f,i,a,v,c,h.getPreload());this.scheduleExpireCache(t,l);this.updateLogos(t,l);return this.renderedTiles.length>0};So.prototype.drawTileImage=function(t,e,i,r,n,a,s,o,h){var l=t.getImage(this.getLayer());if(!l){return}var u=qn.getUid(this);var f=h?t.getAlpha(u,e.time):1;if(f===1&&!this.getLayer().getSource().getOpaque(e.viewState.projection)){this.context.clearRect(r,n,a,s)}var c=f!==this.context.globalAlpha;if(c){this.context.save();this.context.globalAlpha=f}this.context.drawImage(l,o,o,l.width-2*o,l.height-2*o,r,n,a,s);if(c){this.context.restore()}if(f!==1){e.animate=true}else if(h){t.endTransition(u)}};So.prototype.getImage=function(){var t=this.context;return t?t.canvas:null};So.prototype.getImageTransform=function(){return this.imageTransform_};var Io=o((function(t,e){(function(e,i){t.exports=i()})(h,(function(){function t(t,i,n,a,s){e(t,i,n||0,a||t.length-1,s||r)}function e(t,r,n,a,s){while(a>n){if(a-n>600){var o=a-n+1;var h=r-n+1;var l=Math.log(o);var u=.5*Math.exp(2*l/3);var f=.5*Math.sqrt(l*u*(o-u)/o)*(h-o/2<0?-1:1);var c=Math.max(n,Math.floor(r-h*u/o+f));var d=Math.min(a,Math.floor(r+(o-h)*u/o+f));e(t,r,c,d,s)}var p=t[r];var v=n;var _=a;i(t,n,r);if(s(t[a],p)>0)i(t,n,a);while(v<_){i(t,v,_);v++;_--;while(s(t[v],p)<0)v++;while(s(t[_],p)>0)_--}if(s(t[n],p)===0)i(t,n,_);else{_++;i(t,_,a)}if(_<=r)n=_+1;if(r<=_)a=_-1}}function i(t,e,i){var r=t[e];t[e]=t[i];t[i]=r}function r(t,e){return t<e?-1:t>e?1:0}return t}))}));var Lo=Ao;function Ao(t,e){if(!(this instanceof Ao))return new Ao(t,e);this._maxEntries=Math.max(4,t||9);this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4));if(e){this._initFormat(e)}this.clear()}Ao.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!Bo(t,e))return i;var n=[],a,s,o,h;while(e){for(a=0,s=e.children.length;a<s;a++){o=e.children[a];h=e.leaf?r(o):o;if(Bo(t,h)){if(e.leaf)i.push(o);else if(zo(t,h))this._all(o,i);else n.push(o)}}e=n.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!Bo(t,e))return false;var r=[],n,a,s,o;while(e){for(n=0,a=e.children.length;n<a;n++){s=e.children[n];o=e.leaf?i(s):s;if(Bo(t,o)){if(e.leaf||zo(t,o))return true;r.push(s)}}e=r.pop()}return false},load:function(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(var e=0,i=t.length;e<i;e++){this.insert(t[e])}return this}var r=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length){this.data=r}else if(this.data.height===r.height){this._splitRoot(this.data,r)}else{if(this.data.height<r.height){var n=this.data;this.data=r;r=n}this._insert(r,this.data.height-r.height-1,true)}return this},insert:function(t){if(t)this._insert(t,this.data.height-1);return this},clear:function(){this.data=Wo([]);return this},remove:function(t,e){if(!t)return this;var i=this.data,r=this.toBBox(t),n=[],a=[],s,o,h,l;while(i||n.length){if(!i){i=n.pop();o=n[n.length-1];s=a.pop();l=true}if(i.leaf){h=wo(t,i.children,e);if(h!==-1){i.children.splice(h,1);n.push(i);this._condense(n);return this}}if(!l&&!i.leaf&&zo(i,r)){n.push(i);a.push(s);s=0;o=i;i=i.children[0]}else if(o){s++;i=o.children[s];l=false}else i=null}return this},toBBox:function(t){return t},compareMinX:Do,compareMinY:Fo,toJSON:function(){return this.data},fromJSON:function(t){this.data=t;return this},_all:function(t,e){var i=[];while(t){if(t.leaf)e.push.apply(e,t.children);else i.push.apply(i,t.children);t=i.pop()}return e},_build:function(t,e,i,r){var n=i-e+1,a=this._maxEntries,s;if(n<=a){s=Wo(t.slice(e,i+1));Oo(s,this.toBBox);return s}if(!r){r=Math.ceil(Math.log(n)/Math.log(a));a=Math.ceil(n/Math.pow(a,r-1))}s=Wo([]);s.leaf=false;s.height=r;var o=Math.ceil(n/a),h=o*Math.ceil(Math.sqrt(a)),l,u,f,c;Xo(t,e,i,h,this.compareMinX);for(l=e;l<=i;l+=h){f=Math.min(l+h-1,i);Xo(t,l,f,o,this.compareMinY);for(u=l;u<=f;u+=o){c=Math.min(u+o-1,f);s.children.push(this._build(t,u,c,r-1))}}Oo(s,this.toBBox);return s},_chooseSubtree:function(t,e,i,r){var n,a,s,o,h,l,u,f;while(true){r.push(e);if(e.leaf||r.length-1===i)break;u=f=Infinity;for(n=0,a=e.children.length;n<a;n++){s=e.children[n];h=No(s);l=ko(t,s)-h;if(l<f){f=l;u=h<u?h:u;o=s}else if(l===f){if(h<u){u=h;o=s}}}e=o||e.children[0]}return e},_insert:function(t,e,i){var r=this.toBBox,n=i?t:r(t),a=[];var s=this._chooseSubtree(n,this.data,e,a);s.children.push(t);Po(s,n);while(e>=0){if(a[e].children.length>this._maxEntries){this._split(a,e);e--}else break}this._adjustParentBBoxes(n,a,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r);var s=Wo(i.children.splice(a,i.children.length-a));s.height=i.height;s.leaf=i.leaf;Oo(i,this.toBBox);Oo(s,this.toBBox);if(e)t[e-1].children.push(s);else this._splitRoot(i,s)},_splitRoot:function(t,e){this.data=Wo([t,e]);this.data.height=t.height+1;this.data.leaf=false;Oo(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,a,s,o,h,l,u;h=l=Infinity;for(r=e;r<=i-e;r++){n=bo(t,0,r,this.toBBox);a=bo(t,r,i,this.toBBox);s=Uo(n,a);o=No(n)+No(a);if(s<h){h=s;u=r;l=o<l?o:l}else if(s===h){if(o<l){l=o;u=r}}}return u},_chooseSplitAxis:function(t,e,i){var r=t.leaf?this.compareMinX:Do,n=t.leaf?this.compareMinY:Fo,a=this._allDistMargin(t,e,i,r),s=this._allDistMargin(t,e,i,n);if(a<s)t.children.sort(r)},_allDistMargin:function(t,e,i,r){t.children.sort(r);var n=this.toBBox,a=bo(t,0,e,n),s=bo(t,i-e,i,n),o=Go(a)+Go(s),h,l;for(h=e;h<i-e;h++){l=t.children[h];Po(a,t.leaf?n(l):l);o+=Go(a)}for(h=i-e-1;h>=e;h--){l=t.children[h];Po(s,t.leaf?n(l):l);o+=Go(s)}return o},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--){Po(e[r],t)}},_condense:function(t){for(var e=t.length-1,i;e>=0;e--){if(t[e].children.length===0){if(e>0){i=t[e-1].children;i.splice(i.indexOf(t[e]),1)}else this.clear()}else Oo(t[e],this.toBBox)}},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0]));this.compareMinY=new Function("a","b",e.join(t[1]));this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};function wo(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r<e.length;r++){if(i(t,e[r]))return r}return-1}function Oo(t,e){bo(t,0,t.children.length,e,t)}function bo(t,e,i,r,n){if(!n)n=Wo(null);n.minX=Infinity;n.minY=Infinity;n.maxX=-Infinity;n.maxY=-Infinity;for(var a=e,s;a<i;a++){s=t.children[a];Po(n,t.leaf?r(s):s)}return n}function Po(t,e){t.minX=Math.min(t.minX,e.minX);t.minY=Math.min(t.minY,e.minY);t.maxX=Math.max(t.maxX,e.maxX);t.maxY=Math.max(t.maxY,e.maxY);return t}function Do(t,e){return t.minX-e.minX}function Fo(t,e){return t.minY-e.minY}function No(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Go(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ko(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function Uo(t,e){var i=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),a=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,a-r)}function zo(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Bo(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Wo(t){return{children:t,height:1,leaf:true,minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}}function Xo(t,e,i,r,n){var a=[e,i],s;while(a.length){i=a.pop();e=a.pop();if(i-e<=r)continue;s=e+Math.ceil((i-e)/r/2)*r;Io(t,s,e,i,n);a.push(e,s,s,i)}}var Vo=function(){};Vo.prototype.getReplay=function(t,e){};Vo.prototype.isEmpty=function(){};var Yo={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};var jo={};jo.lineString=function(t,e,i,r){var n=t[e];var a=t[e+1];var s=0;var o;for(o=e+r;o<i;o+=r){var h=t[o];var l=t[o+1];s+=Math.sqrt((h-n)*(h-n)+(l-a)*(l-a));n=h;a=l}return s};jo.linearRing=function(t,e,i,r){var n=jo.lineString(t,e,i,r);var a=t[i-r]-t[e];var s=t[i-r+1]-t[e+1];n+=Math.sqrt(a*a+s*s);return n};var Ho={};Ho.lineString=function(t,e,i,r,n,a,s,o){var h=[];var l=t[e]>t[i-r];var u=n.length;var f=t[e];var c=t[e+1];e+=r;var d=t[e];var p=t[e+1];var v=0;var _=Math.sqrt(Math.pow(d-f,2)+Math.pow(p-c,2));var g="";var m=0;var y,E,x;for(var T=0;T<u;++T){E=l?u-T-1:T;var C=n.charAt(E);g=l?C+g:g+C;var R=a(g)-m;m+=R;var M=s+R/2;while(e<i-r&&v+_<M){f=d;c=p;e+=r;d=t[e];p=t[e+1];v+=_;_=Math.sqrt(Math.pow(d-f,2)+Math.pow(p-c,2))}var S=M-v;var I=Math.atan2(p-c,d-f);if(l){I+=I>0?-Math.PI:Math.PI}if(x!==undefined){var L=I-x;L+=L>Math.PI?-2*Math.PI:L<-Math.PI?2*Math.PI:0;if(Math.abs(L)>o){return null}}var A=S/_;var w=ha.lerp(f,d,A);var O=ha.lerp(c,p,A);if(x==I){if(l){y[0]=w;y[1]=O;y[2]=R/2}y[4]=g}else{g=C;m=R;y=[w,O,R/2,I,g];if(l){h.unshift(y)}else{h.push(y)}x=I}s+=R}return h};var Ko={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12};var qo={};qo.ORDER=[Yo.POLYGON,Yo.CIRCLE,Yo.LINE_STRING,Yo.IMAGE,Yo.TEXT,Yo.DEFAULT];qo.TEXT_ALIGN={};qo.TEXT_ALIGN["left"]=0;qo.TEXT_ALIGN["end"]=0;qo.TEXT_ALIGN["center"]=.5;qo.TEXT_ALIGN["right"]=1;qo.TEXT_ALIGN["start"]=1;qo.TEXT_ALIGN["top"]=0;qo.TEXT_ALIGN["middle"]=.5;qo.TEXT_ALIGN["hanging"]=.2;qo.TEXT_ALIGN["alphabetic"]=.8;qo.TEXT_ALIGN["ideographic"]=.8;qo.TEXT_ALIGN["bottom"]=1;var Zo=function(t,e,i,r,n,a){vo.call(this);this.declutterTree=a;this.tmpExtent_=pa.createEmpty();this.tolerance=t;this.maxExtent=e;this.overlaps=n;this.pixelRatio=r;this.maxLineWidth=0;this.resolution=i;this.beginGeometryInstruction1_=null;this.beginGeometryInstruction2_=null;this.bufferedMaxExtent_=null;this.instructions=[];this.coordinates=[];this.coordinateCache_={};this.renderedTransform_=Sa.create();this.hitDetectionInstructions=[];this.pixelCoordinates_=null;this.state={};this.viewRotation_=0;this.tmpLocalTransform_=Sa.create();this.resetTransform_=Sa.create()};qn.inherits(Zo,vo);Zo.prototype.replayTextBackground_=function(t,e,i,r,n,a,s){t.beginPath();t.moveTo.apply(t,e);t.lineTo.apply(t,i);t.lineTo.apply(t,r);t.lineTo.apply(t,n);t.lineTo.apply(t,e);if(a){this.fillOrigin_=a[2];this.fill_(t)}if(s){this.setStrokeStyle_(t,s);t.stroke()}};Zo.prototype.replayImage_=function(t,e,i,r,n,a,s,o,h,l,u,f,c,d,p,v,_,g){var m=_||g;var y=this.tmpLocalTransform_;n*=c;a*=c;e-=n;i-=a;if(d){e=Math.round(e);i=Math.round(i)}var E=p+l>r.width?r.width-l:p;var x=o+u>r.height?r.height-u:o;var T=this.tmpExtent_;var C=v[3]+E*c+v[1];var R=v[0]+x*c+v[2];var M=e-v[3];var S=i-v[0];var I;var L;var A;var w;if(m||f!==0){I=[M,S];L=[M+C,S];A=[M+C,S+R];w=[M,S+R]}var O=null;if(f!==0){var b=e+n;var P=i+a;O=Sa.compose(y,b,P,1,1,f,-b,-P);pa.createOrUpdateEmpty(T);pa.extendCoordinate(T,Sa.apply(y,I));pa.extendCoordinate(T,Sa.apply(y,L));pa.extendCoordinate(T,Sa.apply(y,A));pa.extendCoordinate(T,Sa.apply(y,w))}else{pa.createOrUpdate(M,S,M+C,S+R,T)}var D=t.canvas;var F=T[0]<=D.width&&T[2]>=0&&T[1]<=D.height&&T[3]>=0;if(s){if(!F&&s[4]==1){return}pa.extend(s,T);var N=F?[t,O?O.slice(0):null,h,r,l,u,E,x,e,i,c]:null;if(N&&m){N.push(_,g,I,L,A,w)}s.push(N)}else if(F){if(m){this.replayTextBackground_(t,I,L,A,w,_,g)}fo.drawImage(t,O,h,r,l,u,E,x,e,i,c)}};Zo.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return e==1?t:t.map((function(t){return t*e}))};Zo.prototype.appendFlatCoordinates=function(t,e,i,r,n,a){var s=this.coordinates.length;var o=this.getBufferedMaxExtent();if(a){e+=r}var h=[t[e],t[e+1]];var l=[NaN,NaN];var u=true;var f,c,d;for(f=e+r;f<i;f+=r){l[0]=t[f];l[1]=t[f+1];d=pa.coordinateRelationship(o,l);if(d!==c){if(u){this.coordinates[s++]=h[0];this.coordinates[s++]=h[1]}this.coordinates[s++]=l[0];this.coordinates[s++]=l[1];u=false}else if(d===da.INTERSECTING){this.coordinates[s++]=l[0];this.coordinates[s++]=l[1];u=false}else{u=true}h[0]=l[0];h[1]=l[1];c=d}if(n&&u||f===e+r){this.coordinates[s++]=h[0];this.coordinates[s++]=h[1]}return s};Zo.prototype.drawCustomCoordinates_=function(t,e,i,r,n){for(var a=0,s=i.length;a<s;++a){var o=i[a];var h=this.appendFlatCoordinates(t,e,o,r,false,false);n.push(h);e=o}return e};Zo.prototype.drawCustom=function(t,e,i){this.beginGeometry(t,e);var r=t.getType();var n=t.getStride();var a=this.coordinates.length;var s,o,h,l;var u;if(r==la.MULTI_POLYGON){t=t;s=t.getOrientedFlatCoordinates();l=[];var f=t.getEndss();u=0;for(var c=0,d=f.length;c<d;++c){var p=[];u=this.drawCustomCoordinates_(s,u,f[c],n,p);l.push(p)}this.instructions.push([Ko.CUSTOM,a,l,t,i,ba.coordinatesss])}else if(r==la.POLYGON||r==la.MULTI_LINE_STRING){h=[];s=r==la.POLYGON?t.getOrientedFlatCoordinates():t.getFlatCoordinates();u=this.drawCustomCoordinates_(s,0,t.getEnds(),n,h);this.instructions.push([Ko.CUSTOM,a,h,t,i,ba.coordinatess])}else if(r==la.LINE_STRING||r==la.MULTI_POINT){s=t.getFlatCoordinates();o=this.appendFlatCoordinates(s,0,s.length,n,false,false);this.instructions.push([Ko.CUSTOM,a,o,t,i,ba.coordinates])}else if(r==la.POINT){s=t.getFlatCoordinates();this.coordinates.push(s[0],s[1]);o=this.coordinates.length;this.instructions.push([Ko.CUSTOM,a,o,t,i])}this.endGeometry(t,e)};Zo.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Ko.BEGIN_GEOMETRY,e,0];this.instructions.push(this.beginGeometryInstruction1_);this.beginGeometryInstruction2_=[Ko.BEGIN_GEOMETRY,e,0];this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)};Zo.prototype.fill_=function(t){if(this.fillOrigin_){var e=Sa.apply(this.renderedTransform_,this.fillOrigin_.slice());t.translate(e[0],e[1]);t.rotate(this.viewRotation_)}t.fill();if(this.fillOrigin_){t.setTransform.apply(t,fo.resetTransform_)}};Zo.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1];t.lineWidth=e[2];t.lineCap=e[3];t.lineJoin=e[4];t.miterLimit=e[5];if(Va.CANVAS_LINE_DASH){t.lineDashOffset=e[7];t.setLineDash(e[6])}};Zo.prototype.renderDeclutter_=function(t,e){if(t&&t.length>5){var i=t[4];if(i==1||i==t.length-5){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(!this.declutterTree.collides(r)){this.declutterTree.insert(r);var n=fo.drawImage;for(var a=5,s=t.length;a<s;++a){var o=t[a];if(o){if(o.length>11){this.replayTextBackground_(o[0],o[13],o[14],o[15],o[16],o[11],o[12])}n.apply(undefined,o)}}}t.length=5;pa.createOrUpdateEmpty(t)}}};Zo.prototype.replay_=function(t,e,i,r,n,a){var s;if(this.pixelCoordinates_&&fa.equals(e,this.renderedTransform_)){s=this.pixelCoordinates_}else{if(!this.pixelCoordinates_){this.pixelCoordinates_=[]}s=ga.transform2D(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_);Sa.setFromArray(this.renderedTransform_,e)}var o=!Qn.isEmpty(i);var h=0;var l=r.length;var u=0;var f;var c,d,p,v,_,g,m,y;var E=0;var x=0;var T=null;var C=null;var R=this.coordinateCache_;var M=this.viewRotation_;var S={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M};var I=this.instructions!=r||this.overlaps?0:200;while(h<l){var L=r[h];var A=L[0];var w,O,b;switch(A){case Ko.BEGIN_GEOMETRY:w=L[1];if(o&&i[qn.getUid(w).toString()]||!w.getGeometry()){h=L[2]}else if(a!==undefined&&!pa.intersects(a,w.getGeometry().getExtent())){h=L[2]+1}else{++h}break;case Ko.BEGIN_PATH:if(E>I){this.fill_(t);E=0}if(x>I){t.stroke();x=0}if(!E&&!x){t.beginPath();p=v=NaN}++h;break;case Ko.CIRCLE:u=L[1];var P=s[u];var D=s[u+1];var F=s[u+2];var N=s[u+3];var G=F-P;var k=N-D;var U=Math.sqrt(G*G+k*k);t.moveTo(P+U,D);t.arc(P,D,U,0,2*Math.PI,true);++h;break;case Ko.CLOSE_PATH:t.closePath();++h;break;case Ko.CUSTOM:u=L[1];f=L[2];var z=L[3];var B=L[4];var W=L.length==6?L[5]:undefined;S.geometry=z;S.feature=w;if(!(h in R)){R[h]=[]}var X=R[h];if(W){W(s,u,f,2,X)}else{X[0]=s[u];X[1]=s[u+1];X.length=2}B(X,S);++h;break;case Ko.DRAW_IMAGE:u=L[1];f=L[2];y=L[3];c=L[4];d=L[5];m=n?null:L[6];var V=L[7];var Y=L[8];var j=L[9];var H=L[10];var K=L[11];var q=L[12];var Z=L[13];var J=L[14];var Q=L[15];var $,tt,et;if(L.length>16){$=L[16];tt=L[17];et=L[18]}else{$=fo.defaultPadding;tt=et=false}if(K){q+=M}for(;u<f;u+=2){this.replayImage_(t,s[u],s[u+1],y,c,d,m,V,Y,j,H,q,Z,J,Q,$,tt?T:null,et?C:null)}this.renderDeclutter_(m,w);++h;break;case Ko.DRAW_CHARS:var it=L[1];var rt=L[2];var nt=L[3];m=n?null:L[4];var at=L[5];var st=L[6];var ot=L[7];var ht=L[8];var lt=L[9];var ut=L[10];var ft=L[11];var ct=L[12];var dt=L[13];var pt=L[14];var vt=jo.lineString(s,it,rt,2);var _t=ht(ct);if(at||_t<=vt){var gt=this.textStates[dt].textAlign;var mt=(vt-_t)*qo.TEXT_ALIGN[gt];var yt=Ho.lineString(s,it,rt,2,ct,ht,mt,ot);if(yt){var Et,xt,Tt,Ct,Rt;if(ut){for(Et=0,xt=yt.length;Et<xt;++Et){Rt=yt[Et];Tt=Rt[4];Ct=this.getImage(Tt,dt,"",ut);c=Rt[2]+ft;d=nt*Ct.height+(.5-nt)*2*ft-lt;this.replayImage_(t,Rt[0],Rt[1],Ct,c,d,m,Ct.height,1,0,0,Rt[3],pt,false,Ct.width,fo.defaultPadding,null,null)}}if(st){for(Et=0,xt=yt.length;Et<xt;++Et){Rt=yt[Et];Tt=Rt[4];Ct=this.getImage(Tt,dt,st,"");c=Rt[2];d=nt*Ct.height-lt;this.replayImage_(t,Rt[0],Rt[1],Ct,c,d,m,Ct.height,1,0,0,Rt[3],pt,false,Ct.width,fo.defaultPadding,null,null)}}}}this.renderDeclutter_(m,w);++h;break;case Ko.END_GEOMETRY:if(n!==undefined){w=L[1];var Mt=n(w);if(Mt){return Mt}}++h;break;case Ko.FILL:if(I){E++}else{this.fill_(t)}++h;break;case Ko.MOVE_TO_LINE_TO:u=L[1];f=L[2];O=s[u];b=s[u+1];_=O+.5|0;g=b+.5|0;if(_!==p||g!==v){t.moveTo(O,b);p=_;v=g}for(u+=2;u<f;u+=2){O=s[u];b=s[u+1];_=O+.5|0;g=b+.5|0;if(u==f-2||_!==p||g!==v){t.lineTo(O,b);p=_;v=g}}++h;break;case Ko.SET_FILL_STYLE:T=L;this.fillOrigin_=L[2];if(E){this.fill_(t);E=0;if(x){t.stroke();x=0}}t.fillStyle=L[1];++h;break;case Ko.SET_STROKE_STYLE:C=L;if(x){t.stroke();x=0}this.setStrokeStyle_(t,L);++h;break;case Ko.STROKE:if(I){x++}else{t.stroke()}++h;break;default:++h;break}}if(E){this.fill_(t)}if(x){t.stroke()}return undefined};Zo.prototype.replay=function(t,e,i,r){this.viewRotation_=i;this.replay_(t,e,r,this.instructions,undefined,undefined)};Zo.prototype.replayHitDetection=function(t,e,i,r,n,a){this.viewRotation_=i;return this.replay_(t,e,r,this.hitDetectionInstructions,n,a)};Zo.prototype.reverseHitDetectionInstructions=function(){var t=this.hitDetectionInstructions;t.reverse();var e;var i=t.length;var r;var n;var a=-1;for(e=0;e<i;++e){r=t[e];n=r[0];if(n==Ko.END_GEOMETRY){a=e}else if(n==Ko.BEGIN_GEOMETRY){r[2]=e;fa.reverseSubArray(this.hitDetectionInstructions,a,e);a=-1}}};Zo.prototype.setFillStrokeStyle=function(t,e){var i=this.state;if(t){var r=t.getColor();i.fillStyle=po.asColorLike(r?r:fo.defaultFillStyle)}else{i.fillStyle=undefined}if(e){var n=e.getColor();i.strokeStyle=po.asColorLike(n?n:fo.defaultStrokeStyle);var a=e.getLineCap();i.lineCap=a!==undefined?a:fo.defaultLineCap;var s=e.getLineDash();i.lineDash=s?s.slice():fo.defaultLineDash;var o=e.getLineDashOffset();i.lineDashOffset=o?o:fo.defaultLineDashOffset;var h=e.getLineJoin();i.lineJoin=h!==undefined?h:fo.defaultLineJoin;var l=e.getWidth();i.lineWidth=l!==undefined?l:fo.defaultLineWidth;var u=e.getMiterLimit();i.miterLimit=u!==undefined?u:fo.defaultMiterLimit;if(i.lineWidth>this.maxLineWidth){this.maxLineWidth=i.lineWidth;this.bufferedMaxExtent_=null}}else{i.strokeStyle=undefined;i.lineCap=undefined;i.lineDash=null;i.lineDashOffset=undefined;i.lineJoin=undefined;i.lineWidth=undefined;i.miterLimit=undefined}};Zo.prototype.applyFill=function(t,e){var i=t.fillStyle;var r=[Ko.SET_FILL_STYLE,i];if(typeof i!=="string"){var n=e.getExtent();r.push([n[0],n[3]])}this.instructions.push(r)};Zo.prototype.applyStroke=function(t){this.instructions.push([Ko.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio])};Zo.prototype.updateFillStyle=function(t,e,i){var r=t.fillStyle;if(typeof r!=="string"||t.currentFillStyle!=r){e.call(this,t,i);t.currentFillStyle=r}};Zo.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle;var r=t.lineCap;var n=t.lineDash;var a=t.lineDashOffset;var s=t.lineJoin;var o=t.lineWidth;var h=t.miterLimit;if(t.currentStrokeStyle!=i||t.currentLineCap!=r||n!=t.currentLineDash&&!fa.equals(t.currentLineDash,n)||t.currentLineDashOffset!=a||t.currentLineJoin!=s||t.currentLineWidth!=o||t.currentMiterLimit!=h){e.call(this,t);t.currentStrokeStyle=i;t.currentLineCap=r;t.currentLineDash=n;t.currentLineDashOffset=a;t.currentLineJoin=s;t.currentLineWidth=o;t.currentMiterLimit=h}};Zo.prototype.endGeometry=function(t,e){this.beginGeometryInstruction1_[2]=this.instructions.length;this.beginGeometryInstruction1_=null;this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length;this.beginGeometryInstruction2_=null;var i=[Ko.END_GEOMETRY,e];this.instructions.push(i);this.hitDetectionInstructions.push(i)};Zo.prototype.finish=qn.nullFunction;Zo.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_){this.bufferedMaxExtent_=pa.clone(this.maxExtent);if(this.maxLineWidth>0){var t=this.resolution*(this.maxLineWidth+1)/2;pa.buffer(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}}return this.bufferedMaxExtent_};var Jo=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a);this.declutterGroup_=null;this.hitDetectionImage_=null;this.image_=null;this.anchorX_=undefined;this.anchorY_=undefined;this.height_=undefined;this.opacity_=undefined;this.originX_=undefined;this.originY_=undefined;this.rotateWithView_=undefined;this.rotation_=undefined;this.scale_=undefined;this.snapToPixel_=undefined;this.width_=undefined};qn.inherits(Jo,Zo);Jo.prototype.drawCoordinates_=function(t,e,i,r){return this.appendFlatCoordinates(t,e,i,r,false,false)};Jo.prototype.drawPoint=function(t,e){if(!this.image_){return}this.beginGeometry(t,e);var i=t.getFlatCoordinates();var r=t.getStride();var n=this.coordinates.length;var a=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([Ko.DRAW_IMAGE,n,a,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,n,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]);this.endGeometry(t,e)};Jo.prototype.drawMultiPoint=function(t,e){if(!this.image_){return}this.beginGeometry(t,e);var i=t.getFlatCoordinates();var r=t.getStride();var n=this.coordinates.length;var a=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([Ko.DRAW_IMAGE,n,a,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,n,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]);this.endGeometry(t,e)};Jo.prototype.finish=function(){this.reverseHitDetectionInstructions();this.anchorX_=undefined;this.anchorY_=undefined;this.hitDetectionImage_=null;this.image_=null;this.height_=undefined;this.scale_=undefined;this.opacity_=undefined;this.originX_=undefined;this.originY_=undefined;this.rotateWithView_=undefined;this.rotation_=undefined;this.snapToPixel_=undefined;this.width_=undefined};Jo.prototype.setImageStyle=function(t,e){var i=t.getAnchor();var r=t.getSize();var n=t.getHitDetectionImage(1);var a=t.getImage(1);var s=t.getOrigin();this.anchorX_=i[0];this.anchorY_=i[1];this.declutterGroup_=e;this.hitDetectionImage_=n;this.image_=a;this.height_=r[1];this.opacity_=t.getOpacity();this.originX_=s[0];this.originY_=s[1];this.rotateWithView_=t.getRotateWithView();this.rotation_=t.getRotation();this.scale_=t.getScale();this.snapToPixel_=t.getSnapToPixel();this.width_=r[0]};var Qo=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a)};qn.inherits(Qo,Zo);Qo.prototype.drawFlatCoordinates_=function(t,e,i,r){var n=this.coordinates.length;var a=this.appendFlatCoordinates(t,e,i,r,false,false);var s=[Ko.MOVE_TO_LINE_TO,n,a];this.instructions.push(s);this.hitDetectionInstructions.push(s);return i};Qo.prototype.drawLineString=function(t,e){var i=this.state;var r=i.strokeStyle;var n=i.lineWidth;if(r===undefined||n===undefined){return}this.updateStrokeStyle(i,this.applyStroke);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],[Ko.BEGIN_PATH]);var a=t.getFlatCoordinates();var s=t.getStride();this.drawFlatCoordinates_(a,0,a.length,s);this.hitDetectionInstructions.push([Ko.STROKE]);this.endGeometry(t,e)};Qo.prototype.drawMultiLineString=function(t,e){var i=this.state;var r=i.strokeStyle;var n=i.lineWidth;if(r===undefined||n===undefined){return}this.updateStrokeStyle(i,this.applyStroke);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],[Ko.BEGIN_PATH]);var a=t.getEnds();var s=t.getFlatCoordinates();var o=t.getStride();var h=0;var l,u;for(l=0,u=a.length;l<u;++l){h=this.drawFlatCoordinates_(s,h,a[l],o)}this.hitDetectionInstructions.push([Ko.STROKE]);this.endGeometry(t,e)};Qo.prototype.finish=function(){var t=this.state;if(t.lastStroke!=undefined&&t.lastStroke!=this.coordinates.length){this.instructions.push([Ko.STROKE])}this.reverseHitDetectionInstructions();this.state=null};Qo.prototype.applyStroke=function(t){if(t.lastStroke!=undefined&&t.lastStroke!=this.coordinates.length){this.instructions.push([Ko.STROKE]);t.lastStroke=this.coordinates.length}t.lastStroke=0;Zo.prototype.applyStroke.call(this,t);this.instructions.push([Ko.BEGIN_PATH])};var $o=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a)};qn.inherits($o,Zo);$o.prototype.drawFlatCoordinatess_=function(t,e,i,r){var n=this.state;var a=n.fillStyle!==undefined;var s=n.strokeStyle!=undefined;var o=i.length;var h=[Ko.BEGIN_PATH];this.instructions.push(h);this.hitDetectionInstructions.push(h);for(var l=0;l<o;++l){var u=i[l];var f=this.coordinates.length;var c=this.appendFlatCoordinates(t,e,u,r,true,!s);var d=[Ko.MOVE_TO_LINE_TO,f,c];this.instructions.push(d);this.hitDetectionInstructions.push(d);if(s){var p=[Ko.CLOSE_PATH];this.instructions.push(p);this.hitDetectionInstructions.push(p)}e=u}var v=[Ko.FILL];this.hitDetectionInstructions.push(v);if(a){this.instructions.push(v)}if(s){var _=[Ko.STROKE];this.instructions.push(_);this.hitDetectionInstructions.push(_)}return e};$o.prototype.drawCircle=function(t,e){var i=this.state;var r=i.fillStyle;var n=i.strokeStyle;if(r===undefined&&n===undefined){return}this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var a=t.getFlatCoordinates();var s=t.getStride();var o=this.coordinates.length;this.appendFlatCoordinates(a,0,a.length,s,false,false);var h=[Ko.BEGIN_PATH];var l=[Ko.CIRCLE,o];this.instructions.push(h,l);this.hitDetectionInstructions.push(h,l);var u=[Ko.FILL];this.hitDetectionInstructions.push(u);if(i.fillStyle!==undefined){this.instructions.push(u)}if(i.strokeStyle!==undefined){var f=[Ko.STROKE];this.instructions.push(f);this.hitDetectionInstructions.push(f)}this.endGeometry(t,e)};$o.prototype.drawPolygon=function(t,e){var i=this.state;this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var r=t.getEnds();var n=t.getOrientedFlatCoordinates();var a=t.getStride();this.drawFlatCoordinatess_(n,0,r,a);this.endGeometry(t,e)};$o.prototype.drawMultiPolygon=function(t,e){var i=this.state;var r=i.fillStyle;var n=i.strokeStyle;if(r===undefined&&n===undefined){return}this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var a=t.getEndss();var s=t.getOrientedFlatCoordinates();var o=t.getStride();var h=0;var l,u;for(l=0,u=a.length;l<u;++l){h=this.drawFlatCoordinatess_(s,h,a[l],o)}this.endGeometry(t,e)};$o.prototype.finish=function(){this.reverseHitDetectionInstructions();this.state=null;var t=this.tolerance;if(t!==0){var e=this.coordinates;var i,r;for(i=0,r=e.length;i<r;++i){e[i]=Pa.snap(e[i],t)}}};$o.prototype.setFillStrokeStyles_=function(t){var e=this.state;var i=e.fillStyle;if(i!==undefined){this.updateFillStyle(e,this.applyFill,t)}if(e.strokeStyle!==undefined){this.updateStrokeStyle(e,this.applyStroke)}};var th={};th.lineString=function(t,e,i,r,n){var a=i;var s=i;var o=0;var h=0;var l=i;var u,f,c,d,p,v,_,g,m,y;for(f=i;f<r;f+=n){var E=e[f];var x=e[f+1];if(p!==undefined){m=E-p;y=x-v;d=Math.sqrt(m*m+y*y);if(_!==undefined){h+=c;u=Math.acos((_*m+g*y)/(c*d));if(u>t){if(h>o){o=h;a=l;s=f}h=0;l=f-n}}c=d;_=m;g=y}p=E;v=x}h+=d;return h>o?[l,f]:[a,s]};var eh={POINT:"point",LINE:"line"};var ih=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a);this.labels_=null;this.text_="";this.textOffsetX_=0;this.textOffsetY_=0;this.textRotateWithView_=undefined;this.textRotation_=0;this.textFillState_=null;this.fillStates={};this.textStrokeState_=null;this.strokeStates={};this.textState_={};this.textStates={};this.textKey_="";this.fillKey_="";this.strokeKey_="";this.widths_={};var s=fo.labelCache;s.prune()};qn.inherits(ih,Zo);ih.measureTextWidths=function(t,e,i){var r=e.length;var n=0;var a,s;for(s=0;s<r;++s){a=fo.measureTextWidth(t,e[s]);n=Math.max(n,a);i.push(a)}return n};ih.prototype.drawText=function(t,e){var i=this.textFillState_;var r=this.textStrokeState_;var n=this.textState_;if(this.text_===""||!n||!i&&!r){return}var a=this.coordinates.length;var s=t.getType();var o=null;var h=2;var l=2;var u,f;if(n.placement===eh.LINE){if(!pa.intersects(this.getBufferedMaxExtent(),t.getExtent())){return}var c;o=t.getFlatCoordinates();l=t.getStride();if(s==la.LINE_STRING){c=[o.length]}else if(s==la.MULTI_LINE_STRING){c=t.getEnds()}else if(s==la.POLYGON){c=t.getEnds().slice(0,1)}else if(s==la.MULTI_POLYGON){var d=t.getEndss();c=[];for(u=0,f=d.length;u<f;++u){c.push(d[u][0])}}this.beginGeometry(t,e);var p=n.textAlign;var v=0;var _;for(var g=0,m=c.length;g<m;++g){if(p==undefined){var y=th.lineString(n.maxAngle,o,v,c[g],l);v=y[0];_=y[1]}else{_=c[g]}for(u=v;u<_;u+=l){this.coordinates.push(o[u],o[u+1])}h=this.coordinates.length;v=c[g];this.drawChars_(a,h,this.declutterGroup_);a=h}this.endGeometry(t,e)}else{var E=this.getImage(this.text_,this.textKey_,this.fillKey_,this.strokeKey_);var x=E.width/this.pixelRatio;switch(s){case la.POINT:case la.MULTI_POINT:o=t.getFlatCoordinates();h=o.length;break;case la.LINE_STRING:o=t.getFlatMidpoint();break;case la.CIRCLE:o=t.getCenter();break;case la.MULTI_LINE_STRING:o=t.getFlatMidpoints();h=o.length;break;case la.POLYGON:o=t.getFlatInteriorPoint();if(!n.overflow&&o[2]/this.resolution<x){return}l=3;break;case la.MULTI_POLYGON:var T=t.getFlatInteriorPoints();o=[];for(u=0,f=T.length;u<f;u+=3){if(n.overflow||T[u+2]/this.resolution>=x){o.push(T[u],T[u+1])}}h=o.length;if(h==0){return}break}h=this.appendFlatCoordinates(o,0,h,l,false,false);this.beginGeometry(t,e);if(n.backgroundFill||n.backgroundStroke){this.setFillStrokeStyle(n.backgroundFill,n.backgroundStroke);this.updateFillStyle(this.state,this.applyFill,t);this.updateStrokeStyle(this.state,this.applyStroke)}this.drawTextImage_(E,a,h);this.endGeometry(t,e)}};ih.prototype.getImage=function(t,e,i,r){var n;var a=r+e+t+i+this.pixelRatio;var s=fo.labelCache;if(!s.containsKey(a)){var o=r?this.strokeStates[r]||this.textStrokeState_:null;var h=i?this.fillStates[i]||this.textFillState_:null;var l=this.textStates[e]||this.textState_;var u=this.pixelRatio;var f=l.scale*u;var c=qo.TEXT_ALIGN[l.textAlign||fo.defaultTextAlign];var d=r&&o.lineWidth?o.lineWidth:0;var p=t.split("\n");var v=p.length;var _=[];var g=ih.measureTextWidths(l.font,p,_);var m=fo.measureTextHeight(l.font);var y=m*v;var E=g+d;var x=Ts.createCanvasContext2D(Math.ceil(E*f),Math.ceil((y+d)*f));n=x.canvas;s.set(a,n);if(f!=1){x.scale(f,f)}x.font=l.font;if(r){x.strokeStyle=o.strokeStyle;x.lineWidth=d*(Va.SAFARI?f:1);x.lineCap=o.lineCap;x.lineJoin=o.lineJoin;x.miterLimit=o.miterLimit;if(Va.CANVAS_LINE_DASH&&o.lineDash.length){x.setLineDash(o.lineDash);x.lineDashOffset=o.lineDashOffset}}if(i){x.fillStyle=h.fillStyle}x.textBaseline="middle";x.textAlign="center";var T=.5-c;var C=c*n.width/f+T*d;var R;if(r){for(R=0;R<v;++R){x.strokeText(p[R],C+T*_[R],.5*(d+m)+R*m)}}if(i){for(R=0;R<v;++R){x.fillText(p[R],C+T*_[R],.5*(d+m)+R*m)}}}return s.get(a)};ih.prototype.drawTextImage_=function(t,e,i){var r=this.textState_;var n=this.textStrokeState_;var a=this.pixelRatio;var s=qo.TEXT_ALIGN[r.textAlign||fo.defaultTextAlign];var o=qo.TEXT_ALIGN[r.textBaseline];var h=n&&n.lineWidth?n.lineWidth:0;var l=s*t.width/a+2*(.5-s)*h;var u=o*t.height/a+2*(.5-o)*h;this.instructions.push([Ko.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*a,(u-this.textOffsetY_)*a,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1,true,t.width,r.padding==fo.defaultPadding?fo.defaultPadding:r.padding.map((function(t){return t*a})),!!r.backgroundFill,!!r.backgroundStroke]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*a,(u-this.textOffsetY_)*a,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1/a,true,t.width,r.padding,!!r.backgroundFill,!!r.backgroundStroke])};ih.prototype.drawChars_=function(t,e,i){var r=this.textStrokeState_;var n=this.textState_;var a=this.textFillState_;var s=this.strokeKey_;if(r){if(!(s in this.strokeStates)){this.strokeStates[s]={strokeStyle:r.strokeStyle,lineCap:r.lineCap,lineDashOffset:r.lineDashOffset,lineWidth:r.lineWidth,lineJoin:r.lineJoin,miterLimit:r.miterLimit,lineDash:r.lineDash}}}var o=this.textKey_;if(!(this.textKey_ in this.textStates)){this.textStates[this.textKey_]={font:n.font,textAlign:n.textAlign||fo.defaultTextAlign,scale:n.scale}}var h=this.fillKey_;if(a){if(!(h in this.fillStates)){this.fillStates[h]={fillStyle:a.fillStyle}}}var l=this.pixelRatio;var u=qo.TEXT_ALIGN[n.textBaseline];var f=this.textOffsetY_*l;var c=this.text_;var d=n.font;var p=n.scale;var v=r?r.lineWidth*p/2:0;var _=this.widths_[d];if(!_){this.widths_[d]=_={}}this.instructions.push([Ko.DRAW_CHARS,t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=_[t];if(!e){e=_[t]=fo.measureTextWidth(d,t)}return e*p*l},f,s,v*l,c,o,1]);this.hitDetectionInstructions.push([Ko.DRAW_CHARS,t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=_[t];if(!e){e=_[t]=fo.measureTextWidth(d,t)}return e*p},f,s,v,c,o,1/l])};ih.prototype.setTextStyle=function(t,e){var i,r,n;if(!t){this.text_=""}else{this.declutterGroup_=e;var a=t.getFill();if(!a){r=this.textFillState_=null}else{r=this.textFillState_;if(!r){r=this.textFillState_={}}r.fillStyle=po.asColorLike(a.getColor()||fo.defaultFillStyle)}var s=t.getStroke();if(!s){n=this.textStrokeState_=null}else{n=this.textStrokeState_;if(!n){n=this.textStrokeState_={}}var o=s.getLineDash();var h=s.getLineDashOffset();var l=s.getWidth();var u=s.getMiterLimit();n.lineCap=s.getLineCap()||fo.defaultLineCap;n.lineDash=o?o.slice():fo.defaultLineDash;n.lineDashOffset=h===undefined?fo.defaultLineDashOffset:h;n.lineJoin=s.getLineJoin()||fo.defaultLineJoin;n.lineWidth=l===undefined?fo.defaultLineWidth:l;n.miterLimit=u===undefined?fo.defaultMiterLimit:u;n.strokeStyle=po.asColorLike(s.getColor()||fo.defaultStrokeStyle)}i=this.textState_;var f=t.getFont()||fo.defaultFont;fo.checkFont(f);var c=t.getScale();i.overflow=t.getOverflow();i.font=f;i.maxAngle=t.getMaxAngle();i.placement=t.getPlacement();i.textAlign=t.getTextAlign();i.textBaseline=t.getTextBaseline()||fo.defaultTextBaseline;i.backgroundFill=t.getBackgroundFill();i.backgroundStroke=t.getBackgroundStroke();i.padding=t.getPadding()||fo.defaultPadding;i.scale=c===undefined?1:c;var d=t.getOffsetX();var p=t.getOffsetY();var v=t.getRotateWithView();var _=t.getRotation();this.text_=t.getText()||"";this.textOffsetX_=d===undefined?0:d;this.textOffsetY_=p===undefined?0:p;this.textRotateWithView_=v===undefined?false:v;this.textRotation_=_===undefined?0:_;this.strokeKey_=n?(typeof n.strokeStyle=="string"?n.strokeStyle:qn.getUid(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"";this.textKey_=i.font+i.scale+(i.textAlign||"?");this.fillKey_=r?typeof r.fillStyle=="string"?r.fillStyle:"|"+qn.getUid(r.fillStyle):""}};var rh=function(t,e,i,r,n,a,s){Vo.call(this);this.declutterTree_=a;this.declutterGroup_=null;this.tolerance_=t;this.maxExtent_=e;this.overlaps_=n;this.pixelRatio_=r;this.resolution_=i;this.renderBuffer_=s;this.replaysByZIndex_={};this.hitDetectionContext_=Ts.createCanvasContext2D(1,1);this.hitDetectionTransform_=Sa.create()};qn.inherits(rh,Vo);rh.circleArrayCache_={0:[[true]]};rh.fillCircleArrayRowToMiddle_=function(t,e,i){var r;var n=Math.floor(t.length/2);if(e>=n){for(r=n;r<e;r++){t[r][i]=true}}else if(e<n){for(r=e+1;r<n;r++){t[r][i]=true}}};rh.getCircleArray_=function(t){if(rh.circleArrayCache_[t]!==undefined){return rh.circleArrayCache_[t]}var e=t*2+1;var i=new Array(e);for(var r=0;r<e;r++){i[r]=new Array(e)}var n=t;var a=0;var s=0;while(n>=a){rh.fillCircleArrayRowToMiddle_(i,t+n,t+a);rh.fillCircleArrayRowToMiddle_(i,t+a,t+n);rh.fillCircleArrayRowToMiddle_(i,t-a,t+n);rh.fillCircleArrayRowToMiddle_(i,t-n,t+a);rh.fillCircleArrayRowToMiddle_(i,t-n,t-a);rh.fillCircleArrayRowToMiddle_(i,t-a,t-n);rh.fillCircleArrayRowToMiddle_(i,t+a,t-n);rh.fillCircleArrayRowToMiddle_(i,t+n,t-a);a++;s+=1+2*a;if(2*(s-n)+1>0){n-=1;s+=1-2*n}}rh.circleArrayCache_[t]=i;return i};rh.replayDeclutter=function(t,e,i){var r=Object.keys(t).map(Number).sort(fa.numberSafeCompareFunction);var n={};for(var a=0,s=r.length;a<s;++a){var o=t[r[a].toString()];for(var h=0,l=o.length;h<l;){var u=o[h++];var f=o[h++];u.replay(e,f,i,n)}}};rh.prototype.addDeclutter=function(t){var e=null;if(this.declutterTree_){if(t){e=this.declutterGroup_;e[4]++}else{e=this.declutterGroup_=pa.createEmpty();e.push(1)}}return e};rh.prototype.clip=function(t,e){var i=this.getClipCoords(e);t.beginPath();t.moveTo(i[0],i[1]);t.lineTo(i[2],i[3]);t.lineTo(i[4],i[5]);t.lineTo(i[6],i[7]);t.clip()};rh.prototype.hasReplays=function(t){for(var e in this.replaysByZIndex_){var i=this.replaysByZIndex_[e];for(var r=0,n=t.length;r<n;++r){if(t[r]in i){return true}}}return false};rh.prototype.finish=function(){var t;for(t in this.replaysByZIndex_){var e=this.replaysByZIndex_[t];var i;for(i in e){e[i].finish()}}};rh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){r=Math.round(r);var o=r*2+1;var h=Sa.compose(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]);var l=this.hitDetectionContext_;if(l.canvas.width!==o||l.canvas.height!==o){l.canvas.width=o;l.canvas.height=o}else{l.clearRect(0,0,o,o)}var u;if(this.renderBuffer_!==undefined){u=pa.createEmpty();pa.extendCoordinate(u,t);pa.buffer(u,e*(this.renderBuffer_+r),u)}var f=rh.getCircleArray_(r);var c;if(this.declutterTree_){c=this.declutterTree_.all().map((function(t){return t.value}))}var d;function p(t){var e=l.getImageData(0,0,o,o).data;for(var i=0;i<o;i++){for(var r=0;r<o;r++){if(f[i][r]){if(e[(r*o+i)*4+3]>0){var n;if(!(c&&(d==Yo.IMAGE||d==Yo.TEXT))||c.indexOf(t)!==-1){n=a(t)}if(n){return n}else{l.clearRect(0,0,o,o);return undefined}}}}}}var v=Object.keys(this.replaysByZIndex_).map(Number);v.sort(fa.numberSafeCompareFunction);var _,g,m,y,E;for(_=v.length-1;_>=0;--_){var x=v[_].toString();m=this.replaysByZIndex_[x];for(g=qo.ORDER.length-1;g>=0;--g){d=qo.ORDER[g];y=m[d];if(y!==undefined){if(s&&(d==Yo.IMAGE||d==Yo.TEXT)){var T=s[x];if(!T){s[x]=[y,h.slice(0)]}else{T.push(y,h.slice(0))}}else{E=y.replayHitDetection(l,h,i,n,p,u);if(E){return E}}}}}return undefined};rh.prototype.getClipCoords=function(t){var e=this.maxExtent_;var i=e[0];var r=e[1];var n=e[2];var a=e[3];var s=[i,r,i,a,n,a,n,r];ga.transform2D(s,0,8,2,t,s);return s};rh.prototype.getReplay=function(t,e){var i=t!==undefined?t.toString():"0";var r=this.replaysByZIndex_[i];if(r===undefined){r={};this.replaysByZIndex_[i]=r}var n=r[e];if(n===undefined){var a=rh.BATCH_CONSTRUCTORS_[e];n=new a(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_,this.overlaps_,this.declutterTree_);r[e]=n}return n};rh.prototype.getReplays=function(){return this.replaysByZIndex_};rh.prototype.isEmpty=function(){return Qn.isEmpty(this.replaysByZIndex_)};rh.prototype.replay=function(t,e,i,r,n,a){var s=Object.keys(this.replaysByZIndex_).map(Number);s.sort(fa.numberSafeCompareFunction);t.save();this.clip(t,e);var o=n?n:qo.ORDER;var h,l,u,f,c,d;for(h=0,l=s.length;h<l;++h){var p=s[h].toString();c=this.replaysByZIndex_[p];for(u=0,f=o.length;u<f;++u){var v=o[u];d=c[v];if(d!==undefined){if(a&&(v==Yo.IMAGE||v==Yo.TEXT)){var _=a[p];if(!_){a[p]=[d,e.slice(0)]}else{_.push(d,e.slice(0))}}else{d.replay(t,e,i,r)}}}}t.restore()};rh.BATCH_CONSTRUCTORS_={Circle:$o,Default:Zo,Image:Jo,LineString:Qo,Polygon:$o,Text:ih};var nh={};nh.defaultOrder=function(t,e){return qn.getUid(t)-qn.getUid(e)};nh.getSquaredTolerance=function(t,e){var i=nh.getTolerance(t,e);return i*i};nh.getTolerance=function(t,e){return qn.SIMPLIFY_TOLERANCE*t/e};nh.renderCircleGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(n||a){var s=t.getReplay(i.getZIndex(),Yo.CIRCLE);s.setFillStrokeStyle(n,a);s.drawCircle(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.renderFeature=function(t,e,i,r,n,a){var s=false;var o,h;o=i.getImage();if(o){h=o.getImageState();if(h==ao.LOADED||h==ao.ERROR){o.unlistenImageChange(n,a)}else{if(h==ao.IDLE){o.load()}h=o.getImageState();o.listenImageChange(n,a);s=true}}nh.renderFeature_(t,e,i,r);return s};nh.renderFeature_=function(t,e,i,r){var n=i.getGeometryFunction()(e);if(!n){return}var a=n.getSimplifiedGeometry(r);var s=i.getRenderer();if(s){nh.renderGeometry_(t,a,i,e)}else{var o=nh.GEOMETRY_RENDERERS_[a.getType()];o(t,a,i,e)}};nh.renderGeometry_=function(t,e,i,r){if(e.getType()==la.GEOMETRY_COLLECTION){var n=e.getGeometries();for(var a=0,s=n.length;a<s;++a){nh.renderGeometry_(t,n[a],i,r)}return}var o=t.getReplay(i.getZIndex(),Yo.DEFAULT);o.drawCustom(e,r,i.getRenderer())};nh.renderGeometryCollectionGeometry_=function(t,e,i,r){var n=e.getGeometriesArray();var a,s;for(a=0,s=n.length;a<s;++a){var o=nh.GEOMETRY_RENDERERS_[n[a].getType()];o(t,n[a],i,r)}};nh.renderLineStringGeometry_=function(t,e,i,r){var n=i.getStroke();if(n){var a=t.getReplay(i.getZIndex(),Yo.LINE_STRING);a.setFillStrokeStyle(null,n);a.drawLineString(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(false));o.drawText(e,r)}};nh.renderMultiLineStringGeometry_=function(t,e,i,r){var n=i.getStroke();if(n){var a=t.getReplay(i.getZIndex(),Yo.LINE_STRING);a.setFillStrokeStyle(null,n);a.drawMultiLineString(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(false));o.drawText(e,r)}};nh.renderMultiPolygonGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(a||n){var s=t.getReplay(i.getZIndex(),Yo.POLYGON);s.setFillStrokeStyle(n,a);s.drawMultiPolygon(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.renderPointGeometry_=function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=ao.LOADED){return}var a=t.getReplay(i.getZIndex(),Yo.IMAGE);a.setImageStyle(n,t.addDeclutter(false));a.drawPoint(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(!!n));o.drawText(e,r)}};nh.renderMultiPointGeometry_=function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=ao.LOADED){return}var a=t.getReplay(i.getZIndex(),Yo.IMAGE);a.setImageStyle(n,t.addDeclutter(false));a.drawMultiPoint(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(!!n));o.drawText(e,r)}};nh.renderPolygonGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(n||a){var s=t.getReplay(i.getZIndex(),Yo.POLYGON);s.setFillStrokeStyle(n,a);s.drawPolygon(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.GEOMETRY_RENDERERS_={Point:nh.renderPointGeometry_,LineString:nh.renderLineStringGeometry_,Polygon:nh.renderPolygonGeometry_,MultiPoint:nh.renderMultiPointGeometry_,MultiLineString:nh.renderMultiLineStringGeometry_,MultiPolygon:nh.renderMultiPolygonGeometry_,GeometryCollection:nh.renderGeometryCollectionGeometry_,Circle:nh.renderCircleGeometry_};var ah=function(t){mo.call(this,t);this.declutterTree_=t.getDeclutter()?Lo(9):null;this.dirty_=false;this.renderedRevision_=-1;this.renderedResolution_=NaN;this.renderedExtent_=pa.createEmpty();this.renderedRenderOrder_=null;this.replayGroup_=null;this.replayGroupChanged=true;this.context=Ts.createCanvasContext2D();$n.listen(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this)};qn.inherits(ah,mo);ah["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.VECTOR};ah["create"]=function(t,e){return new ah(e)};ah.prototype.disposeInternal=function(){$n.unlisten(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this);mo.prototype.disposeInternal.call(this)};ah.prototype.composeFrame=function(t,e,i){var r=t.extent;var n=t.pixelRatio;var a=e.managed?t.skippedFeatureUids:{};var s=t.viewState;var o=s.projection;var h=s.rotation;var l=o.getExtent();var u=this.getLayer().getSource();var f=this.getTransform(t,0);this.preCompose(i,t,f);var c=e.extent;var d=c!==undefined;if(d){this.clip(i,t,c)}var p=this.replayGroup_;if(p&&!p.isEmpty()){if(this.declutterTree_){this.declutterTree_.clear()}var v=this.getLayer();var _=0;var g=0;var m;var y=e.opacity!==1;var E=v.hasListener(Ds.RENDER);if(y||E){var x=i.canvas.width;var T=i.canvas.height;if(h){var C=Math.round(Math.sqrt(x*x+T*T));_=(C-x)/2;g=(C-T)/2;x=T=C}this.context.canvas.width=x;this.context.canvas.height=T;m=this.context}else{m=i}var R=m.globalAlpha;if(!y){m.globalAlpha=e.opacity}if(m!=i){m.translate(_,g)}var M=t.size[0]*n;var S=t.size[1]*n;fo.rotateAtOffset(m,-h,M/2,S/2);p.replay(m,f,h,a);if(u.getWrapX()&&o.canWrapX()&&!pa.containsExtent(l,r)){var I=r[0];var L=pa.getWidth(l);var A=0;var w;while(I<l[0]){--A;w=L*A;f=this.getTransform(t,w);p.replay(m,f,h,a);I+=L}A=0;I=r[2];while(I>l[2]){++A;w=L*A;f=this.getTransform(t,w);p.replay(m,f,h,a);I-=L}f=this.getTransform(t,0)}fo.rotateAtOffset(m,h,M/2,S/2);if(m!=i){if(E){this.dispatchRenderEvent(m,t,f)}if(y){var O=i.globalAlpha;i.globalAlpha=e.opacity;i.drawImage(m.canvas,-_,-g);i.globalAlpha=O}else{i.drawImage(m.canvas,-_,-g)}m.translate(-_,-g)}if(!y){m.globalAlpha=R}}if(d){i.restore()}this.postCompose(i,t,e,f)};ah.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(!this.replayGroup_){return undefined}else{var a=e.viewState.resolution;var s=e.viewState.rotation;var o=this.getLayer();var h={};var l=this.replayGroup_.forEachFeatureAtCoordinate(t,a,s,i,{},(function(t){var e=qn.getUid(t).toString();if(!(e in h)){h[e]=true;return r.call(n,t,o)}}),null);return l}};ah.prototype.handleFontsChanged_=function(t){var e=this.getLayer();if(e.getVisible()&&this.replayGroup_){e.changed()}};ah.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};ah.prototype.prepareFrame=function(t,e){var i=this.getLayer();var r=i.getSource();this.updateLogos(t,r);var n=t.viewHints[_s.ANIMATING];var a=t.viewHints[_s.INTERACTING];var s=i.getUpdateWhileAnimating();var o=i.getUpdateWhileInteracting();if(!this.dirty_&&(!s&&n)||!o&&a){return true}var h=t.extent;var l=t.viewState;var u=l.projection;var f=l.resolution;var c=t.pixelRatio;var d=i.getRevision();var p=i.getRenderBuffer();var v=i.getRenderOrder();if(v===undefined){v=nh.defaultOrder}var _=pa.buffer(h,p*f);var g=l.projection.getExtent();if(r.getWrapX()&&l.projection.canWrapX()&&!pa.containsExtent(g,t.extent)){var m=pa.getWidth(g);var y=Math.max(pa.getWidth(_)/2,m);_[0]=g[0]-y;_[2]=g[2]+y}if(!this.dirty_&&this.renderedResolution_==f&&this.renderedRevision_==d&&this.renderedRenderOrder_==v&&pa.containsExtent(this.renderedExtent_,_)){this.replayGroupChanged=false;return true}this.replayGroup_=null;this.dirty_=false;var E=new rh(nh.getTolerance(f,c),_,f,c,r.getOverlaps(),this.declutterTree_,i.getRenderBuffer());r.loadFeatures(_,f,u);var x=function(t){var e;var r=t.getStyleFunction();if(r){e=r.call(t,f)}else{r=i.getStyleFunction();if(r){e=r(t,f)}}if(e){var n=this.renderFeature(t,f,c,e,E);this.dirty_=this.dirty_||n}}.bind(this);if(v){var T=[];r.forEachFeatureInExtent(_,(function(t){T.push(t)}),this);T.sort(v);for(var C=0,R=T.length;C<R;++C){x(T[C])}}else{r.forEachFeatureInExtent(_,x,this)}E.finish();this.renderedResolution_=f;this.renderedRevision_=d;this.renderedRenderOrder_=v;this.renderedExtent_=_;this.replayGroup_=E;this.replayGroupChanged=true;return true};ah.prototype.renderFeature=function(t,e,i,r,n){if(!r){return false}var a=false;if(Array.isArray(r)){for(var s=0,o=r.length;s<o;++s){a=nh.renderFeature(n,t,r[s],nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}}else{a=nh.renderFeature(n,t,r,nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)}return a};var sh={IMAGE:"image",HYBRID:"hybrid",VECTOR:"vector"};var oh=function(t){this.context=null;So.call(this,t);this.declutterTree_=t.getDeclutter()?Lo(9):null;this.dirty_=false;this.tmpTransform_=Sa.create();this.zDirection=t.getRenderMode()==sh.VECTOR?1:0;$n.listen(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this)};qn.inherits(oh,So);oh["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.VECTOR_TILE};oh["create"]=function(t,e){return new oh(e)};oh.IMAGE_REPLAYS={image:[Yo.POLYGON,Yo.CIRCLE,Yo.LINE_STRING,Yo.IMAGE,Yo.TEXT],hybrid:[Yo.POLYGON,Yo.LINE_STRING]};oh.VECTOR_REPLAYS={image:[Yo.DEFAULT],hybrid:[Yo.IMAGE,Yo.TEXT,Yo.DEFAULT],vector:qo.ORDER};oh.prototype.disposeInternal=function(){$n.unlisten(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this);So.prototype.disposeInternal.call(this)};oh.prototype.prepareFrame=function(t,e){var i=this.getLayer();var r=i.getRevision();if(this.renderedLayerRevision_!=r){this.renderedTiles.length=0;var n=i.getRenderMode();if(!this.context&&n!=sh.VECTOR){this.context=Ts.createCanvasContext2D()}if(this.context&&n==sh.VECTOR){this.context=null}}this.renderedLayerRevision_=r;return So.prototype.prepareFrame.apply(this,arguments)};oh.prototype.createReplayGroup_=function(t,e){var i=this.getLayer();var r=e.pixelRatio;var n=e.viewState.projection;var a=i.getRevision();var s=i.getRenderOrder()||null;var o=t.getReplayState(i);if(!o.dirty&&o.renderedRevision==a&&o.renderedRenderOrder==s){return}var h=i.getSource();var l=h.getTileGrid();var u=h.getTileGridForProjection(n);var f=u.getResolution(t.tileCoord[0]);var c=u.getTileCoordExtent(t.wrappedTileCoord);for(var d=0,p=t.tileKeys.length;d<p;++d){var v=t.getTile(t.tileKeys[d]);if(v.getState()==us.ERROR){continue}var _=v.tileCoord;var g=l.getTileCoordExtent(_);var m=pa.getIntersection(c,g);var y=pa.equals(g,m)?null:pa.buffer(m,i.getRenderBuffer()*f);var E=v.getProjection();var x=false;if(!Ma.equivalent(n,E)){x=true;v.setProjection(n)}o.dirty=false;var T=new rh(0,m,f,r,h.getOverlaps(),this.declutterTree_,i.getRenderBuffer());var C=nh.getSquaredTolerance(f,r);var R=function(t){var e;var r=t.getStyleFunction();if(r){e=r.call(t,f)}else{r=i.getStyleFunction();if(r){e=r(t,f)}}if(e){var n=this.renderFeature(t,C,e,T);this.dirty_=this.dirty_||n;o.dirty=o.dirty||n}};var M=v.getFeatures();if(s&&s!==o.renderedRenderOrder){M.sort(s)}var S;for(var I=0,L=M.length;I<L;++I){S=M[I];if(x){if(E.getUnits()==ma.TILE_PIXELS){E.setWorldExtent(g);E.setExtent(v.getExtent())}S.getGeometry().transform(E,n)}if(!y||pa.intersects(y,S.getGeometry().getExtent())){R.call(this,S)}}T.finish();for(var A in T.getReplays()){}v.setReplayGroup(i,t.tileCoord.toString(),T)}o.renderedRevision=a;o.renderedRenderOrder=s};oh.prototype.drawTileImage=function(t,e,i,r,n,a,s,o,h){var l=t;this.createReplayGroup_(l,e);if(this.context){this.renderTileImage_(l,e,i);So.prototype.drawTileImage.apply(this,arguments)}};oh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=e.viewState.resolution;var s=e.viewState.rotation;i=i==undefined?0:i;var o=this.getLayer();var h={};var l=this.renderedTiles;var u=o.getSource();var f=u.getTileGridForProjection(e.viewState.projection);var c,d;var p,v,_;var g,m,y;for(p=0,v=l.length;p<v;++p){g=l[p];m=g.wrappedTileCoord;y=f.getTileCoordExtent(m,this.tmpExtent);c=pa.buffer(y,i*a,c);if(!pa.containsCoordinate(c,t)){continue}for(var E=0,x=g.tileKeys.length;E<x;++E){var T=g.getTile(g.tileKeys[E]);if(T.getState()==us.ERROR){continue}_=T.getReplayGroup(o,g.tileCoord.toString());d=d||_.forEachFeatureAtCoordinate(t,a,s,i,{},(function(t){var e=qn.getUid(t).toString();if(!(e in h)){h[e]=true;return r.call(n,t,o)}}),null)}}return d};oh.prototype.getReplayTransform_=function(t,e){var i=this.getLayer();var r=i.getSource();var n=r.getTileGrid();var a=t.tileCoord;var s=n.getResolution(a[0]);var o=e.viewState;var h=e.pixelRatio;var l=o.resolution/h;var u=n.getTileCoordExtent(a,this.tmpExtent);var f=o.center;var c=pa.getTopLeft(u);var d=e.size;var p=Math.round(h*d[0]/2);var v=Math.round(h*d[1]/2);return Sa.compose(this.tmpTransform_,p,v,s/l,s/l,o.rotation,(c[0]-f[0])/s,(f[1]-c[1])/s)};oh.prototype.handleFontsChanged_=function(t){var e=this.getLayer();if(e.getVisible()&&this.renderedLayerRevision_!==undefined){e.changed()}};oh.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};oh.prototype.postCompose=function(t,e,i){var r=this.getLayer();var n=r.getDeclutter()?{}:null;var a=r.getSource();var s=r.getRenderMode();var o=oh.VECTOR_REPLAYS[s];var h=e.pixelRatio;var l=e.viewState.rotation;var u=e.size;var f,c;if(l){f=Math.round(h*u[0]/2);c=Math.round(h*u[1]/2);fo.rotateAtOffset(t,-l,f,c)}if(n){this.declutterTree_.clear()}var d=this.renderedTiles;var p=a.getTileGridForProjection(e.viewState.projection);var v=[];var _=[];for(var g=d.length-1;g>=0;--g){var m=d[g];if(m.getState()==us.ABORT){continue}var y=m.tileCoord;var E=p.getTileCoordExtent(y)[0]-p.getTileCoordExtent(m.wrappedTileCoord)[0];var x=undefined;for(var T=0,C=m.tileKeys.length;T<C;++T){var R=m.getTile(m.tileKeys[T]);if(R.getState()==us.ERROR){continue}var M=R.getReplayGroup(r,y.toString());if(s!=sh.VECTOR&&!M.hasReplays(o)){continue}if(!x){x=this.getTransform(e,E)}var S=R.tileCoord[0];var I=M.getClipCoords(x);t.save();t.globalAlpha=i.opacity;for(var L=0,A=v.length;L<A;++L){var w=v[L];if(S<_[L]){t.beginPath();t.moveTo(I[0],I[1]);t.lineTo(I[2],I[3]);t.lineTo(I[4],I[5]);t.lineTo(I[6],I[7]);t.moveTo(w[6],w[7]);t.lineTo(w[4],w[5]);t.lineTo(w[2],w[3]);t.lineTo(w[0],w[1]);t.clip()}}M.replay(t,x,l,{},o,n);t.restore();v.push(I);_.push(S)}}if(n){rh.replayDeclutter(n,t,l)}if(l){fo.rotateAtOffset(t,l,f,c)}So.prototype.postCompose.apply(this,arguments)};oh.prototype.renderFeature=function(t,e,i,r){if(!i){return false}var n=false;if(Array.isArray(i)){for(var a=0,s=i.length;a<s;++a){n=nh.renderFeature(r,t,i[a],e,this.handleStyleImageChange_,this)||n}}else{n=nh.renderFeature(r,t,i,e,this.handleStyleImageChange_,this)}return n};oh.prototype.renderTileImage_=function(t,e,i){var r=this.getLayer();var n=t.getReplayState(r);var a=r.getRevision();var s=oh.IMAGE_REPLAYS[r.getRenderMode()];if(s&&n.renderedTileRevision!==a){n.renderedTileRevision=a;var o=t.wrappedTileCoord;var h=o[0];var l=e.pixelRatio;var u=r.getSource();var f=u.getTileGridForProjection(e.viewState.projection);var c=f.getResolution(h);var d=t.getContext(r);var p=u.getTilePixelSize(h,l,e.viewState.projection);d.canvas.width=p[0];d.canvas.height=p[1];var v=f.getTileCoordExtent(o);for(var _=0,g=t.tileKeys.length;_<g;++_){var m=t.getTile(t.tileKeys[_]);if(m.getState()==us.ERROR){continue}var y=l/c;var E=Sa.reset(this.tmpTransform_);Sa.scale(E,y,-y);Sa.translate(E,-v[0],-v[3]);var x=m.getReplayGroup(r,t.tileCoord.toString());x.replay(d,E,0,{},s)}}};var hh=function(t){this.source_=t};hh.prototype.getType=function(){};hh.prototype.getSource=function(){return this.source_};hh.prototype.isAnimated=_a.FALSE;var lh=function(t){hh.call(this,t)};qn.inherits(lh,hh);lh.prototype.getType=function(){return Xa.FRAGMENT_SHADER};var uh=function(t){hh.call(this,t)};qn.inherits(uh,hh);uh.prototype.getType=function(){return Xa.VERTEX_SHADER};var fh={};fh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_fillColor;\nuniform vec4 u_strokeColor;\nuniform vec2 u_size;\n\nvoid main(void) {\n vec2 windowCenter = vec2((v_center.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_center.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n vec2 windowOffset = vec2((v_offset.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_offset.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n float radius = length(windowCenter - windowOffset);\n float dist = length(windowCenter - gl_FragCoord.xy);\n if (dist > radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n":"precision mediump float;varying vec2 a;varying vec2 b;varying float c;varying float d;uniform float m;uniform vec4 n;uniform vec4 o;uniform vec2 p;void main(void){vec2 windowCenter=vec2((a.x+1.0)/2.0*p.x*d,(a.y+1.0)/2.0*p.y*d);vec2 windowOffset=vec2((b.x+1.0)/2.0*p.x*d,(b.y+1.0)/2.0*p.y*d);float radius=length(windowCenter-windowOffset);float dist=length(windowCenter-gl_FragCoord.xy);if(dist>radius+c){if(o.a==0.0){gl_FragColor=n;}else{gl_FragColor=o;}gl_FragColor.a=gl_FragColor.a-(dist-(radius+c));}else if(n.a==0.0){gl_FragColor=o;if(dist<radius-c){gl_FragColor.a=gl_FragColor.a-(radius-c-dist);}} else{gl_FragColor=n;float strokeDist=radius-c;float antialias=2.0*d;if(dist>strokeDist){gl_FragColor=o;}else if(dist>=strokeDist-antialias){float step=smoothstep(strokeDist-antialias,strokeDist,dist);gl_FragColor=mix(n,o,step);}} gl_FragColor.a=gl_FragColor.a*m;if(gl_FragColor.a<=0.0){discard;}}");fh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n":"varying vec2 a;varying vec2 b;varying float c;varying float d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;void main(void){mat4 offsetMatrix=i*j;a=vec4(h*vec4(e,0.0,1.0)).xy;d=l;float lineWidth=k*l;c=lineWidth/2.0;if(lineWidth==0.0){lineWidth=2.0*l;}vec2 offset;float radius=g+3.0*l;//Until we get gl_VertexID in WebGL,we store an instruction.if(f==0.0){//Offsetting the edges of the triangle by lineWidth/2 is necessary,however//we should also leave some space for the antialiasing,thus we offset by lineWidth.offset=vec2(-1.0,1.0);}else if(f==1.0){offset=vec2(-1.0,-1.0);}else if(f==2.0){offset=vec2(1.0,-1.0);}else{offset=vec2(1.0,1.0);}gl_Position=h*vec4(e+offset*radius,0.0,1.0)+offsetMatrix*vec4(offset*lineWidth,0.0,0.0);b=vec4(h*vec4(e.x+g,e.y,0.0,1.0)).xy;if(distance(a,b)>20000.0){gl_Position=vec4(a,0.0,1.0);}}");var ch=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_lineWidth=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_lineWidth":"k");this.u_pixelRatio=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_pixelRatio":"l");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"m");this.u_fillColor=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_fillColor":"n");this.u_strokeColor=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_strokeColor":"o");this.u_size=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_size":"p");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"e");this.a_instruction=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_instruction":"f");this.a_radius=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_radius":"g")};var dh={};dh.create=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]};dh.fromTransform=function(t,e){t[0]=e[0];t[1]=e[1];t[4]=e[2];t[5]=e[3];t[12]=e[4];t[13]=e[5];return t};var ph=function(t,e){vo.call(this);this.tolerance=t;this.maxExtent=e;this.origin=pa.getCenter(e);this.projectionMatrix_=Sa.create();this.offsetRotateMatrix_=Sa.create();this.offsetScaleMatrix_=Sa.create();this.tmpMat4_=dh.create();this.indices=[];this.indicesBuffer=null;this.startIndices=[];this.startIndicesFeature=[];this.vertices=[];this.verticesBuffer=null;this.lineStringReplay=undefined};qn.inherits(ph,vo);ph.prototype.getDeleteResourcesFunction=function(t){};ph.prototype.finish=function(t){};ph.prototype.setUpProgram=function(t,e,i,r){};ph.prototype.shutDownProgram=function(t,e){};ph.prototype.drawReplay=function(t,e,i,r){};ph.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){};ph.prototype.drawHitDetectionReplay=function(t,e,i,r,n,a){if(!n){return this.drawHitDetectionReplayAll(t,e,i,r)}else{return this.drawHitDetectionReplayOneByOne(t,e,i,r,a)}};ph.prototype.drawHitDetectionReplayAll=function(t,e,i,r){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawReplay(t,e,i,true);var n=r(null);if(n){return n}else{return undefined}};ph.prototype.replay=function(t,e,i,r,n,a,s,o,h,l,u){var f=t.getGL();var c,d,p,v,_,g,m,y;if(this.lineStringReplay){c=f.isEnabled(f.STENCIL_TEST);d=f.getParameter(f.STENCIL_FUNC);p=f.getParameter(f.STENCIL_VALUE_MASK);v=f.getParameter(f.STENCIL_REF);_=f.getParameter(f.STENCIL_WRITEMASK);g=f.getParameter(f.STENCIL_FAIL);m=f.getParameter(f.STENCIL_PASS_DEPTH_PASS);y=f.getParameter(f.STENCIL_PASS_DEPTH_FAIL);f.enable(f.STENCIL_TEST);f.clear(f.STENCIL_BUFFER_BIT);f.stencilMask(255);f.stencilFunc(f.ALWAYS,1,255);f.stencilOp(f.KEEP,f.KEEP,f.REPLACE);this.lineStringReplay.replay(t,e,i,r,n,a,s,o,h,l,u);f.stencilMask(0);f.stencilFunc(f.NOTEQUAL,1,255)}t.bindBuffer(Xa.ARRAY_BUFFER,this.verticesBuffer);t.bindBuffer(Xa.ELEMENT_ARRAY_BUFFER,this.indicesBuffer);var E=this.setUpProgram(f,t,n,a);var x=Sa.reset(this.projectionMatrix_);Sa.scale(x,2/(i*n[0]),2/(i*n[1]));Sa.rotate(x,-r);Sa.translate(x,-(e[0]-this.origin[0]),-(e[1]-this.origin[1]));var T=Sa.reset(this.offsetScaleMatrix_);Sa.scale(T,2/n[0],2/n[1]);var C=Sa.reset(this.offsetRotateMatrix_);if(r!==0){Sa.rotate(C,-r)}f.uniformMatrix4fv(E.u_projectionMatrix,false,dh.fromTransform(this.tmpMat4_,x));f.uniformMatrix4fv(E.u_offsetScaleMatrix,false,dh.fromTransform(this.tmpMat4_,T));f.uniformMatrix4fv(E.u_offsetRotateMatrix,false,dh.fromTransform(this.tmpMat4_,C));f.uniform1f(E.u_opacity,s);var R;if(h===undefined){this.drawReplay(f,t,o,false)}else{R=this.drawHitDetectionReplay(f,t,o,h,l,u)}this.shutDownProgram(f,E);if(this.lineStringReplay){if(!c){f.disable(f.STENCIL_TEST)}f.clear(f.STENCIL_BUFFER_BIT);f.stencilFunc(d,v,p);f.stencilMask(_);f.stencilOp(g,y,m)}return R};ph.prototype.drawElements=function(t,e,i,r){var n=e.hasOESElementIndexUint?Xa.UNSIGNED_INT:Xa.UNSIGNED_SHORT;var a=e.hasOESElementIndexUint?4:2;var s=r-i;var o=i*a;t.drawElements(Xa.TRIANGLES,s,n,o)};var vh={};vh.defaultFont="10px sans-serif";vh.defaultFillStyle=[0,0,0,1];vh.defaultLineCap="round";vh.defaultLineDash=[];vh.defaultLineDashOffset=0;vh.defaultLineJoin="round";vh.defaultMiterLimit=10;vh.defaultStrokeStyle=[0,0,0,1];vh.defaultTextAlign=.5;vh.defaultTextBaseline=.5;vh.defaultLineWidth=1;vh.triangleIsCounterClockwise=function(t,e,i,r,n,a){var s=(i-t)*(a-e)-(n-t)*(r-e);return s<=vh.EPSILON&&s>=-vh.EPSILON?undefined:s>0};vh.EPSILON=Number.EPSILON||2220446049250313e-31;var _h=function(t,e){this.arr_=t!==undefined?t:[];this.usage_=e!==undefined?e:_h.Usage_.STATIC_DRAW};_h.prototype.getArray=function(){return this.arr_};_h.prototype.getUsage=function(){return this.usage_};_h.Usage_={STATIC_DRAW:Xa.STATIC_DRAW,STREAM_DRAW:Xa.STREAM_DRAW,DYNAMIC_DRAW:Xa.DYNAMIC_DRAW};var gh=function(t,e){ph.call(this,t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.radius_=0;this.state_={fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:undefined,lineWidth:undefined,changed:false}};qn.inherits(gh,ph);gh.prototype.drawCoordinates_=function(t,e,i,r){var n=this.vertices.length;var a=this.indices.length;var s=n/4;var o,h;for(o=e,h=i;o<h;o+=r){this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=0;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=1;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=2;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=3;this.vertices[n++]=this.radius_;this.indices[a++]=s;this.indices[a++]=s+1;this.indices[a++]=s+2;this.indices[a++]=s+2;this.indices[a++]=s+3;this.indices[a++]=s;s+=4}};gh.prototype.drawCircle=function(t,e){var i=t.getRadius();var r=t.getStride();if(i){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.radius_=i;var n=t.getFlatCoordinates();n=ga.translate(n,0,2,r,-this.origin[0],-this.origin[1]);this.drawCoordinates_(n,0,2,r)}else{if(this.state_.changed){this.styles_.pop();if(this.styles_.length){var a=this.styles_[this.styles_.length-1];this.state_.fillColor=a[0];this.state_.strokeColor=a[1];this.state_.lineWidth=a[2];this.state_.changed=false}}}};gh.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};gh.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;return function(){t.deleteBuffer(e);t.deleteBuffer(i)}};gh.prototype.setUpProgram=function(t,e,i,r){var n,a;n=fh.fragment;a=fh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new ch(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,16,0);t.enableVertexAttribArray(o.a_instruction);t.vertexAttribPointer(o.a_instruction,1,Xa.FLOAT,false,16,8);t.enableVertexAttribArray(o.a_radius);t.vertexAttribPointer(o.a_radius,1,Xa.FLOAT,false,16,12);t.uniform2fv(o.u_size,i);t.uniform1f(o.u_pixelRatio,r);return o};gh.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_instruction);t.disableVertexAttribArray(e.a_radius)};gh.prototype.drawReplay=function(t,e,i,r){if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var n,a,s,o;s=this.startIndices[this.startIndices.length-1];for(n=this.styleIndices_.length-1;n>=0;--n){a=this.styleIndices_[n];o=this.styles_[n];this.setFillStyle_(t,o[0]);this.setStrokeStyle_(t,o[1],o[2]);this.drawElements(t,e,a,s);s=a}}};gh.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setFillStyle_(t,h[0]);this.setStrokeStyle_(t,h[1],h[2]);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};gh.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setFillStyle_(t,s[0]);this.setStrokeStyle_(t,s[1],s[2]);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a)}n=a=o}};gh.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_fillColor,e)};gh.prototype.setStrokeStyle_=function(t,e,i){t.uniform4fv(this.defaultLocations_.u_strokeColor,e);t.uniform1f(this.defaultLocations_.u_lineWidth,i)};gh.prototype.setFillStrokeStyle=function(t,e){var i,r;if(e){var n=e.getLineDash();this.state_.lineDash=n?n:vh.defaultLineDash;var a=e.getLineDashOffset();this.state_.lineDashOffset=a?a:vh.defaultLineDashOffset;i=e.getColor();if(!(i instanceof CanvasGradient)&&!(i instanceof CanvasPattern)){i=co.asArray(i).map((function(t,e){return e!=3?t/255:t}))||vh.defaultStrokeStyle}else{i=vh.defaultStrokeStyle}r=e.getWidth();r=r!==undefined?r:vh.defaultLineWidth}else{i=[0,0,0,0];r=0}var s=t?t.getColor():[0,0,0,0];if(!(s instanceof CanvasGradient)&&!(s instanceof CanvasPattern)){s=co.asArray(s).map((function(t,e){return e!=3?t/255:t}))||vh.defaultFillStyle}else{s=vh.defaultFillStyle}if(!this.state_.strokeColor||!fa.equals(this.state_.strokeColor,i)||!this.state_.fillColor||!fa.equals(this.state_.fillColor,s)||this.state_.lineWidth!==r){this.state_.changed=true;this.state_.fillColor=s;this.state_.strokeColor=i;this.state_.lineWidth=r;this.styles_.push([s,i,r])}};var mh={};mh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");mh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n":"varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.0,0.0);gl_Position=h*vec4(c,0.0,1.0)+offsets;a=d;b=f;}");var yh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"k");this.u_image=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_image":"l");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"c");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"d");this.a_offsets=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_offsets":"e");this.a_opacity=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_opacity":"f");this.a_rotateWithView=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_rotateWithView":"g")};var Eh={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var xh=function(t,e){this.canvas_=t;this.gl_=e;this.bufferCache_={};this.shaderCache_={};this.programCache_={};this.currentProgram_=null;this.hitDetectionFramebuffer_=null;this.hitDetectionTexture_=null;this.hitDetectionRenderbuffer_=null;this.hasOESElementIndexUint=fa.includes(qn.WEBGL_EXTENSIONS,"OES_element_index_uint");if(this.hasOESElementIndexUint){e.getExtension("OES_element_index_uint")}$n.listen(this.canvas_,Eh.LOST,this.handleWebGLContextLost,this);$n.listen(this.canvas_,Eh.RESTORED,this.handleWebGLContextRestored,this)};qn.inherits(xh,ta);xh.prototype.bindBuffer=function(t,e){var i=this.getGL();var r=e.getArray();var n=String(qn.getUid(e));if(n in this.bufferCache_){var a=this.bufferCache_[n];i.bindBuffer(t,a.buffer)}else{var s=i.createBuffer();i.bindBuffer(t,s);var o;if(t==Xa.ARRAY_BUFFER){o=new Float32Array(r)}else if(t==Xa.ELEMENT_ARRAY_BUFFER){o=this.hasOESElementIndexUint?new Uint32Array(r):new Uint16Array(r)}i.bufferData(t,o,e.getUsage());this.bufferCache_[n]={buf:e,buffer:s}}};xh.prototype.deleteBuffer=function(t){var e=this.getGL();var i=String(qn.getUid(t));var r=this.bufferCache_[i];if(!e.isContextLost()){e.deleteBuffer(r.buffer)}delete this.bufferCache_[i]};xh.prototype.disposeInternal=function(){$n.unlistenAll(this.canvas_);var t=this.getGL();if(!t.isContextLost()){var e;for(e in this.bufferCache_){t.deleteBuffer(this.bufferCache_[e].buffer)}for(e in this.programCache_){t.deleteProgram(this.programCache_[e])}for(e in this.shaderCache_){t.deleteShader(this.shaderCache_[e])}t.deleteFramebuffer(this.hitDetectionFramebuffer_);t.deleteRenderbuffer(this.hitDetectionRenderbuffer_);t.deleteTexture(this.hitDetectionTexture_)}};xh.prototype.getCanvas=function(){return this.canvas_};xh.prototype.getGL=function(){return this.gl_};xh.prototype.getHitDetectionFramebuffer=function(){if(!this.hitDetectionFramebuffer_){this.initHitDetectionFramebuffer_()}return this.hitDetectionFramebuffer_};xh.prototype.getShader=function(t){var e=String(qn.getUid(t));if(e in this.shaderCache_){return this.shaderCache_[e]}else{var i=this.getGL();var r=i.createShader(t.getType());i.shaderSource(r,t.getSource());i.compileShader(r);this.shaderCache_[e]=r;return r}};xh.prototype.getProgram=function(t,e){var i=qn.getUid(t)+"/"+qn.getUid(e);if(i in this.programCache_){return this.programCache_[i]}else{var r=this.getGL();var n=r.createProgram();r.attachShader(n,this.getShader(t));r.attachShader(n,this.getShader(e));r.linkProgram(n);this.programCache_[i]=n;return n}};xh.prototype.handleWebGLContextLost=function(){Qn.clear(this.bufferCache_);Qn.clear(this.shaderCache_);Qn.clear(this.programCache_);this.currentProgram_=null;this.hitDetectionFramebuffer_=null;this.hitDetectionTexture_=null;this.hitDetectionRenderbuffer_=null};xh.prototype.handleWebGLContextRestored=function(){};xh.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_;var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var i=xh.createEmptyTexture(t,1,1);var r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r);t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,r);t.bindTexture(t.TEXTURE_2D,null);t.bindRenderbuffer(t.RENDERBUFFER,null);t.bindFramebuffer(t.FRAMEBUFFER,null);this.hitDetectionFramebuffer_=e;this.hitDetectionTexture_=i;this.hitDetectionRenderbuffer_=r};xh.prototype.useProgram=function(t){if(t==this.currentProgram_){return false}else{var e=this.getGL();e.useProgram(t);this.currentProgram_=t;return true}};xh.createTexture_=function(t,e,i){var r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR);if(e!==undefined){t.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_S,e)}if(i!==undefined){t.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_T,i)}return r};xh.createEmptyTexture=function(t,e,i,r,n){var a=xh.createTexture_(t,r,n);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null);return a};xh.createTexture=function(t,e,i,r){var n=xh.createTexture_(t,i,r);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);return n};var Th=function(t,e){ph.call(this,t,e);this.anchorX=undefined;this.anchorY=undefined;this.groupIndices=[];this.hitDetectionGroupIndices=[];this.height=undefined;this.imageHeight=undefined;this.imageWidth=undefined;this.defaultLocations=null;this.opacity=undefined;this.originX=undefined;this.originY=undefined;this.rotateWithView=undefined;this.rotation=undefined;this.scale=undefined;this.width=undefined};qn.inherits(Th,ph);Th.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;var r=this.getTextures(true);var n=t.getGL();return function(){if(!n.isContextLost()){var a,s;for(a=0,s=r.length;a<s;++a){n.deleteTexture(r[a])}}t.deleteBuffer(e);t.deleteBuffer(i)}};Th.prototype.drawCoordinates=function(t,e,i,r){var n=this.anchorX;var a=this.anchorY;var s=this.height;var o=this.imageHeight;var h=this.imageWidth;var l=this.opacity;var u=this.originX;var f=this.originY;var c=this.rotateWithView?1:0;var d=-this.rotation;var p=this.scale;var v=this.width;var _=Math.cos(d);var g=Math.sin(d);var m=this.indices.length;var y=this.vertices.length;var E,x,T,C,R,M;for(E=e;E<i;E+=r){R=t[E]-this.origin[0];M=t[E+1]-this.origin[1];x=y/8;T=-p*n;C=-p*(s-a);this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=u/h;this.vertices[y++]=(f+s)/o;this.vertices[y++]=l;this.vertices[y++]=c;T=p*(v-n);C=-p*(s-a);this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=(u+v)/h;this.vertices[y++]=(f+s)/o;this.vertices[y++]=l;this.vertices[y++]=c;T=p*(v-n);C=p*a;this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=(u+v)/h;this.vertices[y++]=f/o;this.vertices[y++]=l;this.vertices[y++]=c;T=-p*n;C=p*a;this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=u/h;this.vertices[y++]=f/o;this.vertices[y++]=l;this.vertices[y++]=c;this.indices[m++]=x;this.indices[m++]=x+1;this.indices[m++]=x+2;this.indices[m++]=x;this.indices[m++]=x+2;this.indices[m++]=x+3}return y};Th.prototype.createTextures=function(t,e,i,r){var n,a,s,o;var h=e.length;for(o=0;o<h;++o){a=e[o];s=qn.getUid(a).toString();if(s in i){n=i[s]}else{n=xh.createTexture(r,a,Xa.CLAMP_TO_EDGE,Xa.CLAMP_TO_EDGE);i[s]=n}t[o]=n}};Th.prototype.setUpProgram=function(t,e,i,r){var n=mh.fragment;var a=mh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations){o=new yh(t,s);this.defaultLocations=o}else{o=this.defaultLocations}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,32,0);t.enableVertexAttribArray(o.a_offsets);t.vertexAttribPointer(o.a_offsets,2,Xa.FLOAT,false,32,8);t.enableVertexAttribArray(o.a_texCoord);t.vertexAttribPointer(o.a_texCoord,2,Xa.FLOAT,false,32,16);t.enableVertexAttribArray(o.a_opacity);t.vertexAttribPointer(o.a_opacity,1,Xa.FLOAT,false,32,24);t.enableVertexAttribArray(o.a_rotateWithView);t.vertexAttribPointer(o.a_rotateWithView,1,Xa.FLOAT,false,32,28);return o};Th.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_offsets);t.disableVertexAttribArray(e.a_texCoord);t.disableVertexAttribArray(e.a_opacity);t.disableVertexAttribArray(e.a_rotateWithView)};Th.prototype.drawReplay=function(t,e,i,r){var n=r?this.getHitDetectionTextures():this.getTextures();var a=r?this.hitDetectionGroupIndices:this.groupIndices;if(!Qn.isEmpty(i)){this.drawReplaySkipping(t,e,i,n,a)}else{var s,o,h;for(s=0,o=n.length,h=0;s<o;++s){t.bindTexture(Xa.TEXTURE_2D,n[s]);var l=a[s];this.drawElements(t,e,h,l);h=l}}};Th.prototype.drawReplaySkipping=function(t,e,i,r,n){var a=0;var s,o;for(s=0,o=r.length;s<o;++s){t.bindTexture(Xa.TEXTURE_2D,r[s]);var h=s>0?n[s-1]:0;var l=n[s];var u=h;var f=h;while(a<this.startIndices.length&&this.startIndices[a]<=l){var c=this.startIndicesFeature[a];var d=qn.getUid(c).toString();if(i[d]!==undefined){if(u!==f){this.drawElements(t,e,u,f)}u=a===this.startIndices.length-1?l:this.startIndices[a+1];f=u}else{f=a===this.startIndices.length-1?l:this.startIndices[a+1]}a++}if(u!==f){this.drawElements(t,e,u,f)}}};Th.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u;var f=this.startIndices.length-1;var c=this.getHitDetectionTextures();for(a=c.length-1;a>=0;--a){t.bindTexture(Xa.TEXTURE_2D,c[a]);s=a>0?this.hitDetectionGroupIndices[a-1]:0;h=this.hitDetectionGroupIndices[a];while(f>=0&&this.startIndices[f]>=s){o=this.startIndices[f];l=this.startIndicesFeature[f];u=qn.getUid(l).toString();if(i[u]===undefined&&l.getGeometry()&&(n===undefined||pa.intersects(n,l.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,o,h);var d=r(l);if(d){return d}}h=o;f--}}return undefined};Th.prototype.finish=function(t){this.anchorX=undefined;this.anchorY=undefined;this.height=undefined;this.imageHeight=undefined;this.imageWidth=undefined;this.indices=null;this.opacity=undefined;this.originX=undefined;this.originY=undefined;this.rotateWithView=undefined;this.rotation=undefined;this.scale=undefined;this.vertices=null;this.width=undefined};Th.prototype.getTextures=function(t){};Th.prototype.getHitDetectionTextures=function(){};var Ch=function(t,e){Th.call(this,t,e);this.images_=[];this.hitDetectionImages_=[];this.textures_=[];this.hitDetectionTextures_=[]};qn.inherits(Ch,Th);Ch.prototype.drawMultiPoint=function(t,e){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var i=t.getFlatCoordinates();var r=t.getStride();this.drawCoordinates(i,0,i.length,r)};Ch.prototype.drawPoint=function(t,e){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var i=t.getFlatCoordinates();var r=t.getStride();this.drawCoordinates(i,0,i.length,r)};Ch.prototype.finish=function(t){var e=t.getGL();this.groupIndices.push(this.indices.length);this.hitDetectionGroupIndices.push(this.indices.length);this.verticesBuffer=new _h(this.vertices);var i=this.indices;this.indicesBuffer=new _h(i);var r={};this.createTextures(this.textures_,this.images_,r,e);this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,r,e);this.images_=null;this.hitDetectionImages_=null;Th.prototype.finish.call(this,t)};Ch.prototype.setImageStyle=function(t){var e=t.getAnchor();var i=t.getImage(1);var r=t.getImageSize();var n=t.getHitDetectionImage(1);var a=t.getOpacity();var s=t.getOrigin();var o=t.getRotateWithView();var h=t.getRotation();var l=t.getSize();var u=t.getScale();var f;if(this.images_.length===0){this.images_.push(i)}else{f=this.images_[this.images_.length-1];if(qn.getUid(f)!=qn.getUid(i)){this.groupIndices.push(this.indices.length);this.images_.push(i)}}if(this.hitDetectionImages_.length===0){this.hitDetectionImages_.push(n)}else{f=this.hitDetectionImages_[this.hitDetectionImages_.length-1];if(qn.getUid(f)!=qn.getUid(n)){this.hitDetectionGroupIndices.push(this.indices.length);this.hitDetectionImages_.push(n)}}this.anchorX=e[0];this.anchorY=e[1];this.height=l[1];this.imageHeight=r[1];this.imageWidth=r[0];this.opacity=a;this.originX=s[0];this.originY=s[1];this.rotation=h;this.rotateWithView=o;this.scale=u;this.width=l[0]};Ch.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_};Ch.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_};var Rh={};Rh.lineStringIsClosed=function(t,e,i,r){var n=i-r;if(t[e]===t[n]&&t[e+1]===t[n+1]&&(i-e)/r>3){return!!Aa.linearRing(t,e,i,r)}return false};var Mh={};Mh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying float a;varying vec2 aVertex;varying float c;uniform float m;uniform vec4 n;uniform vec2 o;uniform float p;void main(void){if(a>0.0){vec2 windowCoords=vec2((aVertex.x+1.0)/2.0*o.x*p,(aVertex.y+1.0)/2.0*o.y*p);if(length(windowCoords-gl_FragCoord.xy)>c*p){discard;}} gl_FragColor=n;float alpha=n.a*m;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");Mh.vertex=new uh(qn.DEBUG_WEBGL?"varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n":"varying float a;varying vec2 aVertex;varying float c;attribute vec2 d;attribute vec2 e;attribute vec2 f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;bool nearlyEquals(in float value,in float ref){float epsilon=0.000000000001;return value>=ref-epsilon&&value<=ref+epsilon;}void alongNormal(out vec2 offset,in vec2 nextP,in float turnDir,in float direction){vec2 dirVect=nextP-e;vec2 normal=normalize(vec2(-turnDir*dirVect.y,turnDir*dirVect.x));offset=k/2.0*normal*direction;}void miterUp(out vec2 offset,out float round,in bool isRound,in float direction){float halfWidth=k/2.0;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=f-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;round=0.0;if(isRound){round=1.0;}else if(miterLength>l+k){offset=halfWidth*tmpNormal*direction;}} bool miterDown(out vec2 offset,in vec4 projPos,in mat4 offsetMatrix,in float direction){bool degenerate=false;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=d-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));vec2 longOffset,shortOffset,longVertex;vec4 shortProjVertex;float halfWidth=k/2.0;if(length(f-e)>length(d-e)){longOffset=tmpNormal*direction*halfWidth;shortOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=f;shortProjVertex=h*vec4(d,0.0,1.0);}else{shortOffset=tmpNormal*direction*halfWidth;longOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=d;shortProjVertex=h*vec4(f,0.0,1.0);}vec4 p1=h*vec4(longVertex,0.0,1.0)+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p2=projPos+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p3=shortProjVertex+offsetMatrix*vec4(-shortOffset,0.0,0.0);vec4 p4=shortProjVertex+offsetMatrix*vec4(shortOffset,0.0,0.0);float denom=(p4.y-p3.y)*(p2.x-p1.x)-(p4.x-p3.x)*(p2.y-p1.y);float firstU=((p4.x-p3.x)*(p1.y-p3.y)-(p4.y-p3.y)*(p1.x-p3.x))/denom;float secondU=((p2.x-p1.x)*(p1.y-p3.y)-(p2.y-p1.y)*(p1.x-p3.x))/denom;float epsilon=0.000000000001;if(firstU>epsilon&&firstU<1.0-epsilon&&secondU>epsilon&&secondU<1.0-epsilon){shortProjVertex.x=p1.x+firstU*(p2.x-p1.x);shortProjVertex.y=p1.y+firstU*(p2.y-p1.y);offset=shortProjVertex.xy;degenerate=true;}else{float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;}return degenerate;}void squareCap(out vec2 offset,out float round,in bool isRound,in vec2 nextP,in float turnDir,in float direction){round=0.0;vec2 dirVect=e-nextP;vec2 firstNormal=normalize(dirVect);vec2 secondNormal=vec2(turnDir*firstNormal.y*direction,-turnDir*firstNormal.x*direction);vec2 hypotenuse=normalize(firstNormal-secondNormal);vec2 normal=vec2(turnDir*hypotenuse.y*direction,-turnDir*hypotenuse.x*direction);float length=sqrt(c*c*2.0);offset=normal*length;if(isRound){round=1.0;}} void main(void){bool degenerate=false;float direction=float(sign(g));mat4 offsetMatrix=i*j;vec2 offset;vec4 projPos=h*vec4(e,0.0,1.0);bool round=nearlyEquals(mod(g,2.0),0.0);a=0.0;c=k/2.0;aVertex=projPos.xy;if(nearlyEquals(mod(g,3.0),0.0)||nearlyEquals(mod(g,17.0),0.0)){alongNormal(offset,f,1.0,direction);}else if(nearlyEquals(mod(g,5.0),0.0)||nearlyEquals(mod(g,13.0),0.0)){alongNormal(offset,d,-1.0,direction);}else if(nearlyEquals(mod(g,23.0),0.0)){miterUp(offset,a,round,direction);}else if(nearlyEquals(mod(g,19.0),0.0)){degenerate=miterDown(offset,projPos,offsetMatrix,direction);}else if(nearlyEquals(mod(g,7.0),0.0)){squareCap(offset,a,round,f,1.0,direction);}else if(nearlyEquals(mod(g,11.0),0.0)){squareCap(offset,a,round,d,-1.0,direction);}if(!degenerate){vec4 offsets=offsetMatrix*vec4(offset,0.0,0.0);gl_Position=projPos+offsets;}else{gl_Position=vec4(offset,0.0,1.0);}}");var Sh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_lineWidth=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_lineWidth":"k");this.u_miterLimit=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_miterLimit":"l");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"m");this.u_color=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_color":"n");this.u_size=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_size":"o");this.u_pixelRatio=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_pixelRatio":"p");this.a_lastPos=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_lastPos":"d");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"e");this.a_nextPos=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_nextPos":"f");this.a_direction=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_direction":"g")};var Ih=function(t,e){ph.call(this,t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:undefined,miterLimit:undefined,changed:false}};qn.inherits(Ih,ph);Ih.prototype.drawCoordinates_=function(t,e,i,r){var n,a;var s=this.vertices.length;var o=this.indices.length;var h=this.state_.lineJoin==="bevel"?0:this.state_.lineJoin==="miter"?1:2;var l=this.state_.lineCap==="butt"?0:this.state_.lineCap==="square"?1:2;var u=Rh.lineStringIsClosed(t,e,i,r);var f,c,d;var p=o;var v=1;var _,g,m;for(n=e,a=i;n<a;n+=r){d=s/7;_=g;g=m||[t[n],t[n+1]];if(n===e){m=[t[n+r],t[n+r+1]];if(i-e===r*2&&fa.equals(g,m)){break}if(u){_=[t[i-r*2],t[i-r*2+1]];f=m}else{if(l){s=this.addVertices_([0,0],g,m,v*Ih.Instruction_.BEGIN_LINE_CAP*l,s);s=this.addVertices_([0,0],g,m,-v*Ih.Instruction_.BEGIN_LINE_CAP*l,s);this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=d+1;this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d+2}s=this.addVertices_([0,0],g,m,v*Ih.Instruction_.BEGIN_LINE*(l||1),s);s=this.addVertices_([0,0],g,m,-v*Ih.Instruction_.BEGIN_LINE*(l||1),s);p=s/7-1;continue}}else if(n===i-r){if(u){m=f;break}else{_=_||[0,0];s=this.addVertices_(_,g,[0,0],v*Ih.Instruction_.END_LINE*(l||1),s);s=this.addVertices_(_,g,[0,0],-v*Ih.Instruction_.END_LINE*(l||1),s);this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=p;this.indices[o++]=d+1;this.indices[o++]=d;if(l){s=this.addVertices_(_,g,[0,0],v*Ih.Instruction_.END_LINE_CAP*l,s);s=this.addVertices_(_,g,[0,0],-v*Ih.Instruction_.END_LINE_CAP*l,s);this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=d+1;this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d+2}break}}else{m=[t[n+r],t[n+r+1]]}c=vh.triangleIsCounterClockwise(_[0],_[1],g[0],g[1],m[0],m[1])?-1:1;s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_FIRST*(h||1),s);s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_SECOND*(h||1),s);s=this.addVertices_(_,g,m,-c*Ih.Instruction_.MITER_BOTTOM*(h||1),s);if(n>e){this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=v*c>0?p:p-1}this.indices[o++]=d;this.indices[o++]=d+2;this.indices[o++]=d+1;p=d+2;v=c;if(h){s=this.addVertices_(_,g,m,c*Ih.Instruction_.MITER_TOP*h,s);this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d}}if(u){d=d||s/7;c=Ba.linearRingIsClockwise([_[0],_[1],g[0],g[1],m[0],m[1]],0,6,2)?1:-1;s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_FIRST*(h||1),s);s=this.addVertices_(_,g,m,-c*Ih.Instruction_.MITER_BOTTOM*(h||1),s);this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=d+1;this.indices[o++]=d;this.indices[o++]=v*c>0?p:p-1}};Ih.prototype.addVertices_=function(t,e,i,r,n){this.vertices[n++]=t[0];this.vertices[n++]=t[1];this.vertices[n++]=e[0];this.vertices[n++]=e[1];this.vertices[n++]=i[0];this.vertices[n++]=i[1];this.vertices[n++]=r;return n};Ih.prototype.isValid_=function(t,e,i,r){var n=i-e;if(n<r*2){return false}else if(n===r*2){var a=[t[e],t[e+1]];var s=[t[e+r],t[e+r+1]];return!fa.equals(a,s)}return true};Ih.prototype.drawLineString=function(t,e){var i=t.getFlatCoordinates();var r=t.getStride();if(this.isValid_(i,0,i.length,r)){i=ga.translate(i,0,i.length,r,-this.origin[0],-this.origin[1]);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);this.drawCoordinates_(i,0,i.length,r)}};Ih.prototype.drawMultiLineString=function(t,e){var i=this.indices.length;var r=t.getEnds();r.unshift(0);var n=t.getFlatCoordinates();var a=t.getStride();var s,o;if(r.length>1){for(s=1,o=r.length;s<o;++s){if(this.isValid_(n,r[s-1],r[s],a)){var h=ga.translate(n,r[s-1],r[s],a,-this.origin[0],-this.origin[1]);this.drawCoordinates_(h,0,h.length,a)}}}if(this.indices.length>i){this.startIndices.push(i);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(i);this.state_.changed=false}}};Ih.prototype.drawPolygonCoordinates=function(t,e,i){if(!Rh.lineStringIsClosed(t,0,t.length,i)){t.push(t[0]);t.push(t[1])}this.drawCoordinates_(t,0,t.length,i);if(e.length){var r,n;for(r=0,n=e.length;r<n;++r){if(!Rh.lineStringIsClosed(e[r],0,e[r].length,i)){e[r].push(e[r][0]);e[r].push(e[r][1])}this.drawCoordinates_(e[r],0,e[r].length,i)}}};Ih.prototype.setPolygonStyle=function(t,e){var i=e===undefined?this.indices.length:e;this.startIndices.push(i);this.startIndicesFeature.push(t);if(this.state_.changed){this.styleIndices_.push(i);this.state_.changed=false}};Ih.prototype.getCurrentIndex=function(){return this.indices.length};Ih.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};Ih.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;return function(){t.deleteBuffer(e);t.deleteBuffer(i)}};Ih.prototype.setUpProgram=function(t,e,i,r){var n,a;n=Mh.fragment;a=Mh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new Sh(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_lastPos);t.vertexAttribPointer(o.a_lastPos,2,Xa.FLOAT,false,28,0);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,28,8);t.enableVertexAttribArray(o.a_nextPos);t.vertexAttribPointer(o.a_nextPos,2,Xa.FLOAT,false,28,16);t.enableVertexAttribArray(o.a_direction);t.vertexAttribPointer(o.a_direction,1,Xa.FLOAT,false,28,24);t.uniform2fv(o.u_size,i);t.uniform1f(o.u_pixelRatio,r);return o};Ih.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_lastPos);t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_nextPos);t.disableVertexAttribArray(e.a_direction)};Ih.prototype.drawReplay=function(t,e,i,r){var n=t.getParameter(t.DEPTH_FUNC);var a=t.getParameter(t.DEPTH_WRITEMASK);if(!r){t.enable(t.DEPTH_TEST);t.depthMask(true);t.depthFunc(t.NOTEQUAL)}if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var s,o,h,l;h=this.startIndices[this.startIndices.length-1];for(s=this.styleIndices_.length-1;s>=0;--s){o=this.styleIndices_[s];l=this.styles_[s];this.setStrokeStyle_(t,l[0],l[1],l[2]);this.drawElements(t,e,o,h);t.clear(t.DEPTH_BUFFER_BIT);h=o}}if(!r){t.disable(t.DEPTH_TEST);t.clear(t.DEPTH_BUFFER_BIT);t.depthMask(a);t.depthFunc(n)}};Ih.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setStrokeStyle_(t,s[0],s[1],s[2]);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}n=a=o}};Ih.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setStrokeStyle_(t,h[0],h[1],h[2]);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};Ih.prototype.setStrokeStyle_=function(t,e,i,r){t.uniform4fv(this.defaultLocations_.u_color,e);t.uniform1f(this.defaultLocations_.u_lineWidth,i);t.uniform1f(this.defaultLocations_.u_miterLimit,r)};Ih.prototype.setFillStrokeStyle=function(t,e){var i=e.getLineCap();this.state_.lineCap=i!==undefined?i:vh.defaultLineCap;var r=e.getLineDash();this.state_.lineDash=r?r:vh.defaultLineDash;var n=e.getLineDashOffset();this.state_.lineDashOffset=n?n:vh.defaultLineDashOffset;var a=e.getLineJoin();this.state_.lineJoin=a!==undefined?a:vh.defaultLineJoin;var s=e.getColor();if(!(s instanceof CanvasGradient)&&!(s instanceof CanvasPattern)){s=co.asArray(s).map((function(t,e){return e!=3?t/255:t}))||vh.defaultStrokeStyle}else{s=vh.defaultStrokeStyle}var o=e.getWidth();o=o!==undefined?o:vh.defaultLineWidth;var h=e.getMiterLimit();h=h!==undefined?h:vh.defaultMiterLimit;if(!this.state_.strokeColor||!fa.equals(this.state_.strokeColor,s)||this.state_.lineWidth!==o||this.state_.miterLimit!==h){this.state_.changed=true;this.state_.strokeColor=s;this.state_.lineWidth=o;this.state_.miterLimit=h;this.styles_.push([s,o,h])}};Ih.Instruction_={ROUND:2,BEGIN_LINE:3,END_LINE:5,BEGIN_LINE_CAP:7,END_LINE_CAP:11,BEVEL_FIRST:13,BEVEL_SECOND:17,MITER_BOTTOM:19,MITER_TOP:23};var Lh={};Lh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;uniform vec4 e;uniform float f;void main(void){gl_FragColor=e;float alpha=e.a*f;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");Lh.vertex=new uh(qn.DEBUG_WEBGL?"\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n":"attribute vec2 a;uniform mat4 b;uniform mat4 c;uniform mat4 d;void main(void){gl_Position=b*vec4(a,0.0,1.0);}");var Ah=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"b");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"c");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"d");this.u_color=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_color":"e");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"f");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"a")};var wh=function(t){var e=t||{};this.color_=e.color!==undefined?e.color:null;this.lineCap_=e.lineCap;this.lineDash_=e.lineDash!==undefined?e.lineDash:null;this.lineDashOffset_=e.lineDashOffset;this.lineJoin_=e.lineJoin;this.miterLimit_=e.miterLimit;this.width_=e.width;this.checksum_=undefined};wh.prototype.clone=function(){var t=this.getColor();return new wh({color:t&&t.slice?t.slice():t||undefined,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():undefined,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})};wh.prototype.getColor=function(){return this.color_};wh.prototype.getLineCap=function(){return this.lineCap_};wh.prototype.getLineDash=function(){return this.lineDash_};wh.prototype.getLineDashOffset=function(){return this.lineDashOffset_};wh.prototype.getLineJoin=function(){return this.lineJoin_};wh.prototype.getMiterLimit=function(){return this.miterLimit_};wh.prototype.getWidth=function(){return this.width_};wh.prototype.setColor=function(t){this.color_=t;this.checksum_=undefined};wh.prototype.setLineCap=function(t){this.lineCap_=t;this.checksum_=undefined};wh.prototype.setLineDash=function(t){this.lineDash_=t;this.checksum_=undefined};wh.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t;this.checksum_=undefined};wh.prototype.setLineJoin=function(t){this.lineJoin_=t;this.checksum_=undefined};wh.prototype.setMiterLimit=function(t){this.miterLimit_=t;this.checksum_=undefined};wh.prototype.setWidth=function(t){this.width_=t;this.checksum_=undefined};wh.prototype.getChecksum=function(){if(this.checksum_===undefined){this.checksum_="s";if(this.color_){if(typeof this.color_==="string"){this.checksum_+=this.color_}else{this.checksum_+=qn.getUid(this.color_).toString()}}else{this.checksum_+="-"}this.checksum_+=","+(this.lineCap_!==undefined?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(this.lineDashOffset_!==undefined?this.lineDashOffset_:"-")+","+(this.lineJoin_!==undefined?this.lineJoin_:"-")+","+(this.miterLimit_!==undefined?this.miterLimit_.toString():"-")+","+(this.width_!==undefined?this.width_.toString():"-")}return this.checksum_};var Oh=function(t){this.first_=undefined;this.last_=undefined;this.head_=undefined;this.circular_=t===undefined?true:t;this.length_=0};Oh.prototype.insertItem=function(t){var e={prev:undefined,next:undefined,data:t};var i=this.head_;if(!i){this.first_=e;this.last_=e;if(this.circular_){e.next=e;e.prev=e}}else{var r=i.next;e.prev=i;e.next=r;i.next=e;if(r){r.prev=e}if(i===this.last_){this.last_=e}}this.head_=e;this.length_++};Oh.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next;var i=t.prev;if(e){e.prev=i}if(i){i.next=e}this.head_=e||i;if(this.first_===this.last_){this.head_=undefined;this.first_=undefined;this.last_=undefined}else if(this.first_===t){this.first_=this.head_}else if(this.last_===t){this.last_=i?this.head_.prev:this.head_}this.length_--}};Oh.prototype.firstItem=function(){this.head_=this.first_;if(this.head_){return this.head_.data}return undefined};Oh.prototype.lastItem=function(){this.head_=this.last_;if(this.head_){return this.head_.data}return undefined};Oh.prototype.nextItem=function(){if(this.head_&&this.head_.next){this.head_=this.head_.next;return this.head_.data}return undefined};Oh.prototype.getNextItem=function(){if(this.head_&&this.head_.next){return this.head_.next.data}return undefined};Oh.prototype.prevItem=function(){if(this.head_&&this.head_.prev){this.head_=this.head_.prev;return this.head_.data}return undefined};Oh.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev){return this.head_.prev.data}return undefined};Oh.prototype.getCurrItem=function(){if(this.head_){return this.head_.data}return undefined};Oh.prototype.setFirstItem=function(){if(this.circular_&&this.head_){this.first_=this.head_;this.last_=this.head_.prev}};Oh.prototype.concat=function(t){if(t.head_){if(this.head_){var e=this.head_.next;this.head_.next=t.first_;t.first_.prev=this.head_;e.prev=t.last_;t.last_.next=e;this.length_+=t.length_}else{this.head_=t.head_;this.first_=t.first_;this.last_=t.last_;this.length_=t.length_}t.head_=undefined;t.first_=undefined;t.last_=undefined;t.length_=0}};Oh.prototype.getLength=function(){return this.length_};var bh=function(t){this.rbush_=Lo(t);this.items_={}};bh.prototype.insert=function(t,e){var i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i);this.items_[qn.getUid(e)]=i};bh.prototype.load=function(t,e){var i=new Array(e.length);for(var r=0,n=e.length;r<n;r++){var a=t[r];var s=e[r];var o={minX:a[0],minY:a[1],maxX:a[2],maxY:a[3],value:s};i[r]=o;this.items_[qn.getUid(s)]=o}this.rbush_.load(i)};bh.prototype.remove=function(t){var e=qn.getUid(t);var i=this.items_[e];delete this.items_[e];return this.rbush_.remove(i)!==null};bh.prototype.update=function(t,e){var i=this.items_[qn.getUid(e)];var r=[i.minX,i.minY,i.maxX,i.maxY];if(!pa.equals(r,t)){this.remove(e);this.insert(t,e)}};bh.prototype.getAll=function(){var t=this.rbush_.all();return t.map((function(t){return t.value}))};bh.prototype.getInExtent=function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};var i=this.rbush_.search(e);return i.map((function(t){return t.value}))};bh.prototype.forEach=function(t,e){return this.forEach_(this.getAll(),t,e)};bh.prototype.forEachInExtent=function(t,e,i){return this.forEach_(this.getInExtent(t),e,i)};bh.prototype.forEach_=function(t,e,i){var r;for(var n=0,a=t.length;n<a;n++){r=e.call(i,t[n]);if(r){return r}}return r};bh.prototype.isEmpty=function(){return Qn.isEmpty(this.items_)};bh.prototype.clear=function(){this.rbush_.clear();this.items_={}};bh.prototype.getExtent=function(t){var e=this.rbush_.data;return pa.createOrUpdate(e.minX,e.minY,e.maxX,e.maxY,t)};bh.prototype.concat=function(t){this.rbush_.load(t.rbush_.all());for(var e in t.items_){this.items_[e|0]=t.items_[e|0]}};var Ph=function(t,e){ph.call(this,t,e);this.lineStringReplay=new Ih(t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.state_={fillColor:null,changed:false}};qn.inherits(Ph,ph);Ph.prototype.drawCoordinates_=function(t,e,i){var r=new Oh;var n=new bh;this.processFlatCoordinates_(t,i,r,n,true);var a=this.getMaxCoords_(r);if(e.length){var s,o;var h=[];for(s=0,o=e.length;s<o;++s){var l={list:new Oh,maxCoords:undefined,rtree:new bh};h.push(l);this.processFlatCoordinates_(e[s],i,l.list,l.rtree,false);this.classifyPoints_(l.list,l.rtree,true);l.maxCoords=this.getMaxCoords_(l.list)}h.sort((function(t,e){return e.maxCoords[0]===t.maxCoords[0]?t.maxCoords[1]-e.maxCoords[1]:e.maxCoords[0]-t.maxCoords[0]}));for(s=0;s<h.length;++s){var u=h[s].list;var f=u.firstItem();var c=f;var d;do{if(this.getIntersections_(c,n).length){d=true;break}c=u.nextItem()}while(f!==c);if(!d){if(this.bridgeHole_(u,h[s].maxCoords[0],r,a[0],n)){n.concat(h[s].rtree);this.classifyPoints_(r,n,false)}}}}else{this.classifyPoints_(r,n,false)}this.triangulate_(r,n)};Ph.prototype.processFlatCoordinates_=function(t,e,i,r,n){var a=Ba.linearRingIsClockwise(t,0,t.length,e);var s,o;var h=this.vertices.length/2;var l;var u;var f;var c=[];var d=[];if(n===a){l=this.createPoint_(t[0],t[1],h++);u=l;for(s=e,o=t.length;s<o;s+=e){f=this.createPoint_(t[s],t[s+1],h++);d.push(this.insertItem_(u,f,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)]);u=f}d.push(this.insertItem_(f,l,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)])}else{var p=t.length-e;l=this.createPoint_(t[p],t[p+1],h++);u=l;for(s=p-e,o=0;s>=o;s-=e){f=this.createPoint_(t[s],t[s+1],h++);d.push(this.insertItem_(u,f,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)]);u=f}d.push(this.insertItem_(f,l,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)])}r.load(c,d)};Ph.prototype.getMaxCoords_=function(t){var e=t.firstItem();var i=e;var r=[i.p0.x,i.p0.y];do{i=t.nextItem();if(i.p0.x>r[0]){r=[i.p0.x,i.p0.y]}}while(i!==e);return r};Ph.prototype.classifyPoints_=function(t,e,i){var r=t.firstItem();var n=r;var a=t.nextItem();var s=false;do{var o=i?vh.triangleIsCounterClockwise(a.p1.x,a.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):vh.triangleIsCounterClockwise(n.p0.x,n.p0.y,n.p1.x,n.p1.y,a.p1.x,a.p1.y);if(o===undefined){this.removeItem_(n,a,t,e);s=true;if(a===r){r=t.getNextItem()}a=n;t.prevItem()}else if(n.p1.reflex!==o){n.p1.reflex=o;s=true}n=a;a=t.nextItem()}while(n!==r);return s};Ph.prototype.bridgeHole_=function(t,e,i,r,n){var a=t.firstItem();while(a.p1.x!==e){a=t.nextItem()}var s=a.p1;var o={x:r,y:s.y,i:-1};var h=Infinity;var l,u,f;var c;var d=this.getIntersections_({p0:s,p1:o},n,true);for(l=0,u=d.length;l<u;++l){var p=d[l];var v=this.calculateIntersection_(s,o,p.p0,p.p1,true);var _=Math.abs(s.x-v[0]);if(_<h&&vh.triangleIsCounterClockwise(s.x,s.y,p.p0.x,p.p0.y,p.p1.x,p.p1.y)!==undefined){h=_;c={x:v[0],y:v[1],i:-1};a=p}}if(h===Infinity){return false}f=a.p1;if(h>0){var g=this.getPointsInTriangle_(s,c,a.p1,n);if(g.length){var m=Infinity;for(l=0,u=g.length;l<u;++l){var y=g[l];var E=Math.atan2(s.y-y.y,o.x-y.x);if(E<m||E===m&&y.x<f.x){m=E;f=y}}}}a=i.firstItem();while(a.p1.x!==f.x||a.p1.y!==f.y){a=i.nextItem()}var x={x:s.x,y:s.y,i:s.i,reflex:undefined};var T={x:a.p1.x,y:a.p1.y,i:a.p1.i,reflex:undefined};t.getNextItem().p0=x;this.insertItem_(s,a.p1,t,n);this.insertItem_(T,x,t,n);a.p1=T;t.setFirstItem();i.concat(t);return true};Ph.prototype.triangulate_=function(t,e){var i=false;var r=this.isSimple_(t,e);while(t.getLength()>3){if(r){if(!this.clipEars_(t,e,r,i)){if(!this.classifyPoints_(t,e,i)){if(!this.resolveSelfIntersections_(t,e,true)){break}}}}else{if(!this.clipEars_(t,e,r,i)){if(!this.classifyPoints_(t,e,i)){if(!this.resolveSelfIntersections_(t,e)){r=this.isSimple_(t,e);if(!r){this.splitPolygon_(t,e);break}else{i=!this.isClockwise_(t);this.classifyPoints_(t,e,i)}}}}}}if(t.getLength()===3){var n=this.indices.length;this.indices[n++]=t.getPrevItem().p0.i;this.indices[n++]=t.getCurrItem().p0.i;this.indices[n++]=t.getNextItem().p0.i}};Ph.prototype.clipEars_=function(t,e,i,r){var n=this.indices.length;var a=t.firstItem();var s=t.getPrevItem();var o=a;var h=t.nextItem();var l=t.getNextItem();var u,f,c;var d=false;do{u=o.p0;f=o.p1;c=h.p1;if(f.reflex===false){var p;if(i){p=this.getPointsInTriangle_(u,f,c,e,true).length===0}else{p=r?this.diagonalIsInside_(l.p1,c,f,u,s.p0):this.diagonalIsInside_(s.p0,u,f,c,l.p1)}if((i||this.getIntersections_({p0:u,p1:c},e).length===0)&&p){if(i||u.reflex===false||c.reflex===false||Ba.linearRingIsClockwise([s.p0.x,s.p0.y,u.x,u.y,f.x,f.y,c.x,c.y,l.p1.x,l.p1.y],0,10,2)===!r){this.indices[n++]=u.i;this.indices[n++]=f.i;this.indices[n++]=c.i;this.removeItem_(o,h,t,e);if(h===a){a=l}d=true}}}s=t.getPrevItem();o=t.getCurrItem();h=t.nextItem();l=t.getNextItem()}while(o!==a&&t.getLength()>3);return d};Ph.prototype.resolveSelfIntersections_=function(t,e,i){var r=t.firstItem();t.nextItem();var n=r;var a=t.nextItem();var s=false;do{var o=this.calculateIntersection_(n.p0,n.p1,a.p0,a.p1,i);if(o){var h=false;var l=this.vertices.length;var u=this.indices.length;var f=l/2;var c=t.prevItem();t.removeItem();e.remove(c);h=c===r;var d;if(i){if(o[0]===n.p0.x&&o[1]===n.p0.y){t.prevItem();d=n.p0;a.p0=d;e.remove(n);h=h||n===r}else{d=a.p1;n.p1=d;e.remove(a);h=h||a===r}t.removeItem()}else{d=this.createPoint_(o[0],o[1],f);n.p1=d;a.p0=d;e.update([Math.min(n.p0.x,n.p1.x),Math.min(n.p0.y,n.p1.y),Math.max(n.p0.x,n.p1.x),Math.max(n.p0.y,n.p1.y)],n);e.update([Math.min(a.p0.x,a.p1.x),Math.min(a.p0.y,a.p1.y),Math.max(a.p0.x,a.p1.x),Math.max(a.p0.y,a.p1.y)],a)}this.indices[u++]=c.p0.i;this.indices[u++]=c.p1.i;this.indices[u++]=d.i;s=true;if(h){break}}n=t.getPrevItem();a=t.nextItem()}while(n!==r);return s};Ph.prototype.isSimple_=function(t,e){var i=t.firstItem();var r=i;do{if(this.getIntersections_(r,e).length){return false}r=t.nextItem()}while(r!==i);return true};Ph.prototype.isClockwise_=function(t){var e=t.getLength()*2;var i=new Array(e);var r=t.firstItem();var n=r;var a=0;do{i[a++]=n.p0.x;i[a++]=n.p0.y;n=t.nextItem()}while(n!==r);return Ba.linearRingIsClockwise(i,0,e,2)};Ph.prototype.splitPolygon_=function(t,e){var i=t.firstItem();var r=i;do{var n=this.getIntersections_(r,e);if(n.length){var a=n[0];var s=this.vertices.length/2;var o=this.calculateIntersection_(r.p0,r.p1,a.p0,a.p1);var h=this.createPoint_(o[0],o[1],s);var l=new Oh;var u=new bh;this.insertItem_(h,r.p1,l,u);r.p1=h;e.update([Math.min(r.p0.x,h.x),Math.min(r.p0.y,h.y),Math.max(r.p0.x,h.x),Math.max(r.p0.y,h.y)],r);var f=t.nextItem();while(f!==a){this.insertItem_(f.p0,f.p1,l,u);e.remove(f);t.removeItem();f=t.getCurrItem()}this.insertItem_(a.p0,h,l,u);a.p0=h;e.update([Math.min(a.p1.x,h.x),Math.min(a.p1.y,h.y),Math.max(a.p1.x,h.x),Math.max(a.p1.y,h.y)],a);this.classifyPoints_(t,e,false);this.triangulate_(t,e);this.classifyPoints_(l,u,false);this.triangulate_(l,u);break}r=t.nextItem()}while(r!==i)};Ph.prototype.createPoint_=function(t,e,i){var r=this.vertices.length;this.vertices[r++]=t;this.vertices[r++]=e;var n={x:t,y:e,i:i,reflex:undefined};return n};Ph.prototype.insertItem_=function(t,e,i,r){var n={p0:t,p1:e};i.insertItem(n);if(r){r.insert([Math.min(t.x,e.x),Math.min(t.y,e.y),Math.max(t.x,e.x),Math.max(t.y,e.y)],n)}return n};Ph.prototype.removeItem_=function(t,e,i,r){if(i.getCurrItem()===e){i.removeItem();t.p1=e.p1;r.remove(e);r.update([Math.min(t.p0.x,t.p1.x),Math.min(t.p0.y,t.p1.y),Math.max(t.p0.x,t.p1.x),Math.max(t.p0.y,t.p1.y)],t)}};Ph.prototype.getPointsInTriangle_=function(t,e,i,r,n){var a,s,o,h;var l=[];var u=r.getInExtent([Math.min(t.x,e.x,i.x),Math.min(t.y,e.y,i.y),Math.max(t.x,e.x,i.x),Math.max(t.y,e.y,i.y)]);for(a=0,s=u.length;a<s;++a){for(o in u[a]){h=u[a][o];if(typeof h==="object"&&(!n||h.reflex)){if((h.x!==t.x||h.y!==t.y)&&(h.x!==e.x||h.y!==e.y)&&(h.x!==i.x||h.y!==i.y)&&l.indexOf(h)===-1&&Na.linearRingContainsXY([t.x,t.y,e.x,e.y,i.x,i.y],0,6,2,h.x,h.y)){l.push(h)}}}}return l};Ph.prototype.getIntersections_=function(t,e,i){var r=t.p0;var n=t.p1;var a=e.getInExtent([Math.min(r.x,n.x),Math.min(r.y,n.y),Math.max(r.x,n.x),Math.max(r.y,n.y)]);var s=[];var o,h;for(o=0,h=a.length;o<h;++o){var l=a[o];if(t!==l&&(i||l.p0!==n||l.p1!==r)&&this.calculateIntersection_(r,n,l.p0,l.p1,i)){s.push(l)}}return s};Ph.prototype.calculateIntersection_=function(t,e,i,r,n){var a=(r.y-i.y)*(e.x-t.x)-(r.x-i.x)*(e.y-t.y);if(a!==0){var s=((r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x))/a;var o=((e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x))/a;if(!n&&s>vh.EPSILON&&s<1-vh.EPSILON&&o>vh.EPSILON&&o<1-vh.EPSILON||n&&s>=0&&s<=1&&o>=0&&o<=1){return[t.x+s*(e.x-t.x),t.y+s*(e.y-t.y)]}}return undefined};Ph.prototype.diagonalIsInside_=function(t,e,i,r,n){if(e.reflex===undefined||r.reflex===undefined){return false}var a=(i.x-r.x)*(e.y-r.y)>(i.y-r.y)*(e.x-r.x);var s=(n.x-r.x)*(e.y-r.y)<(n.y-r.y)*(e.x-r.x);var o=(t.x-e.x)*(r.y-e.y)>(t.y-e.y)*(r.x-e.x);var h=(i.x-e.x)*(r.y-e.y)<(i.y-e.y)*(r.x-e.x);var l=r.reflex?s||a:s&&a;var u=e.reflex?h||o:h&&o;return l&&u};Ph.prototype.drawMultiPolygon=function(t,e){var i=t.getEndss();var r=t.getStride();var n=this.indices.length;var a=this.lineStringReplay.getCurrentIndex();var s=t.getFlatCoordinates();var o,h,l,u;var f=0;for(o=0,h=i.length;o<h;++o){var c=i[o];if(c.length>0){var d=ga.translate(s,f,c[0],r,-this.origin[0],-this.origin[1]);if(d.length){var p=[];var v;for(l=1,u=c.length;l<u;++l){if(c[l]!==c[l-1]){v=ga.translate(s,c[l-1],c[l],r,-this.origin[0],-this.origin[1]);p.push(v)}}this.lineStringReplay.drawPolygonCoordinates(d,p,r);this.drawCoordinates_(d,p,r)}}f=c[c.length-1]}if(this.indices.length>n){this.startIndices.push(n);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(n);this.state_.changed=false}}if(this.lineStringReplay.getCurrentIndex()>a){this.lineStringReplay.setPolygonStyle(e,a)}};Ph.prototype.drawPolygon=function(t,e){var i=t.getEnds();var r=t.getStride();if(i.length>0){var n=t.getFlatCoordinates().map(Number);var a=ga.translate(n,0,i[0],r,-this.origin[0],-this.origin[1]);if(a.length){var s=[];var o,h,l;for(o=1,h=i.length;o<h;++o){if(i[o]!==i[o-1]){l=ga.translate(n,i[o-1],i[o],r,-this.origin[0],-this.origin[1]);s.push(l)}}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.lineStringReplay.setPolygonStyle(e);this.lineStringReplay.drawPolygonCoordinates(a,s,r);this.drawCoordinates_(a,s,r)}}};Ph.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);this.lineStringReplay.finish(t);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};Ph.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;var r=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(e);t.deleteBuffer(i);r()}};Ph.prototype.setUpProgram=function(t,e,i,r){var n,a;n=Lh.fragment;a=Lh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new Ah(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,8,0);return o};Ph.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position)};Ph.prototype.drawReplay=function(t,e,i,r){var n=t.getParameter(t.DEPTH_FUNC);var a=t.getParameter(t.DEPTH_WRITEMASK);if(!r){t.enable(t.DEPTH_TEST);t.depthMask(true);t.depthFunc(t.NOTEQUAL)}if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var s,o,h,l;h=this.startIndices[this.startIndices.length-1];for(s=this.styleIndices_.length-1;s>=0;--s){o=this.styleIndices_[s];l=this.styles_[s];this.setFillStyle_(t,l);this.drawElements(t,e,o,h);h=o}}if(!r){t.disable(t.DEPTH_TEST);t.clear(t.DEPTH_BUFFER_BIT);t.depthMask(a);t.depthFunc(n)}};Ph.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setFillStyle_(t,h);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};Ph.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setFillStyle_(t,s);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}n=a=o}};Ph.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_color,e)};Ph.prototype.setFillStrokeStyle=function(t,e){var i=t?t.getColor():[0,0,0,0];if(!(i instanceof CanvasGradient)&&!(i instanceof CanvasPattern)){i=co.asArray(i).map((function(t,e){return e!=3?t/255:t}))||vh.defaultFillStyle}else{i=vh.defaultFillStyle}if(!this.state_.fillColor||!fa.equals(i,this.state_.fillColor)){this.state_.fillColor=i;this.state_.changed=true;this.styles_.push(i)}if(e){this.lineStringReplay.setFillStrokeStyle(null,e)}else{var r=new wh({color:[0,0,0,0],lineWidth:0});this.lineStringReplay.setFillStrokeStyle(null,r)}};var Dh=function(t,e){this.space_=e;this.emptyBlocks_=[{x:0,y:0,width:t,height:t}];this.entries_={};this.context_=Ts.createCanvasContext2D(t,t);this.canvas_=this.context_.canvas};Dh.prototype.get=function(t){return this.entries_[t]||null};Dh.prototype.add=function(t,e,i,r,n){var a,s,o;for(s=0,o=this.emptyBlocks_.length;s<o;++s){a=this.emptyBlocks_[s];if(a.width>=e+this.space_&&a.height>=i+this.space_){var h={offsetX:a.x+this.space_,offsetY:a.y+this.space_,image:this.canvas_};this.entries_[t]=h;r.call(n,this.context_,a.x+this.space_,a.y+this.space_);this.split_(s,a,e+this.space_,i+this.space_);return h}}return null};Dh.prototype.split_=function(t,e,i,r){var n=e.width-i;var a=e.height-r;var s;var o;if(n>a){s={x:e.x+i,y:e.y,width:e.width-i,height:e.height};o={x:e.x,y:e.y+r,width:i,height:e.height-r};this.updateBlocks_(t,s,o)}else{s={x:e.x+i,y:e.y,width:e.width-i,height:r};o={x:e.x,y:e.y+r,width:e.width,height:e.height-r};this.updateBlocks_(t,s,o)}};Dh.prototype.updateBlocks_=function(t,e,i){var r=[t,1];if(e.width>0&&e.height>0){r.push(e)}if(i.width>0&&i.height>0){r.push(i)}this.emptyBlocks_.splice.apply(this.emptyBlocks_,r)};var Fh=function(t){var e=t||{};this.currentSize_=e.initialSize!==undefined?e.initialSize:qn.INITIAL_ATLAS_SIZE;this.maxSize_=e.maxSize!==undefined?e.maxSize:qn.MAX_ATLAS_SIZE!=-1?qn.MAX_ATLAS_SIZE:qn.WEBGL_MAX_TEXTURE_SIZE!==undefined?qn.WEBGL_MAX_TEXTURE_SIZE:2048;this.space_=e.space!==undefined?e.space:1;this.atlases_=[new Dh(this.currentSize_,this.space_)];this.currentHitSize_=this.currentSize_;this.hitAtlases_=[new Dh(this.currentHitSize_,this.space_)]};Fh.prototype.getInfo=function(t){var e=this.getInfo_(this.atlases_,t);if(!e){return null}var i=this.getInfo_(this.hitAtlases_,t);return this.mergeInfos_(e,i)};Fh.prototype.getInfo_=function(t,e){var i,r,n,a;for(n=0,a=t.length;n<a;++n){i=t[n];r=i.get(e);if(r){return r}}return null};Fh.prototype.mergeInfos_=function(t,e){return{offsetX:t.offsetX,offsetY:t.offsetY,image:t.image,hitImage:e.image}};Fh.prototype.add=function(t,e,i,r,n,a){if(e+this.space_>this.maxSize_||i+this.space_>this.maxSize_){return null}var s=this.add_(false,t,e,i,r,a);if(!s){return null}var o=n!==undefined?n:qn.nullFunction;var h=this.add_(true,t,e,i,o,a);return this.mergeInfos_(s,h)};Fh.prototype.add_=function(t,e,i,r,n,a){var s=t?this.hitAtlases_:this.atlases_;var o,h,l,u;for(l=0,u=s.length;l<u;++l){o=s[l];h=o.add(e,i,r,n,a);if(h){return h}else if(!h&&l===u-1){var f;if(t){f=Math.min(this.currentHitSize_*2,this.maxSize_);this.currentHitSize_=f}else{f=Math.min(this.currentSize_*2,this.maxSize_);this.currentSize_=f}o=new Dh(f,this.space_);s.push(o);++u}}return null};var Nh=function(t,e){Th.call(this,t,e);this.images_=[];this.textures_=[];this.measureCanvas_=Ts.createCanvasContext2D(0,0).canvas;this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:0,miterLimit:undefined,fillColor:null,font:undefined,scale:undefined};this.text_="";this.textAlign_=undefined;this.textBaseline_=undefined;this.offsetX_=undefined;this.offsetY_=undefined;this.atlases_={};this.currAtlas_=undefined;this.scale=1;this.opacity=1};qn.inherits(Nh,Th);Nh.prototype.drawText=function(t,e){if(this.text_){var i=null;var r=0;var n=2;var a=2;switch(t.getType()){case la.POINT:case la.MULTI_POINT:i=t.getFlatCoordinates();n=i.length;a=t.getStride();break;case la.CIRCLE:i=t.getCenter();break;case la.LINE_STRING:i=t.getFlatMidpoint();break;case la.MULTI_LINE_STRING:i=t.getFlatMidpoints();n=i.length;break;case la.POLYGON:i=t.getFlatInteriorPoint();break;case la.MULTI_POLYGON:i=t.getFlatInteriorPoints();n=i.length;break}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var s=this.currAtlas_;var o=this.text_.split("\n");var h=this.getTextSize_(o);var l,u,f,c,d,p,v,_;var g=Math.round(h[0]*this.textAlign_-this.offsetX_);var m=Math.round(h[1]*this.textBaseline_-this.offsetY_);var y=this.state_.lineWidth/2*this.state_.scale;for(l=0,u=o.length;l<u;++l){d=0;p=s.height*l;v=o[l].split("");for(f=0,c=v.length;f<c;++f){_=s.atlas.getInfo(v[f]);if(_){var E=_.image;this.anchorX=g-d;this.anchorY=m-p;this.originX=f===0?_.offsetX-y:_.offsetX;this.originY=_.offsetY;this.height=s.height;this.width=f===0||f===v.length-1?s.width[v[f]]+y:s.width[v[f]];this.imageHeight=E.height;this.imageWidth=E.width;var x;if(this.images_.length===0){this.images_.push(E)}else{x=this.images_[this.images_.length-1];if(qn.getUid(x)!=qn.getUid(E)){this.groupIndices.push(this.indices.length);this.images_.push(E)}}this.drawText_(i,r,n,a)}d+=this.width}}}};Nh.prototype.getTextSize_=function(t){var e=this;var i=this.currAtlas_;var r=t.length*i.height;var n=t.map((function(t){var r=0;var n,a;for(n=0,a=t.length;n<a;++n){var s=t[n];if(!i.width[s]){e.addCharToAtlas_(s)}r+=i.width[s]?i.width[s]:0}return r})).reduce((function(t,e){return Math.max(t,e)}));return[n,r]};Nh.prototype.drawText_=function(t,e,i,r){var n,a;for(n=e,a=i;n<a;n+=r){this.drawCoordinates(t,e,i,r)}};Nh.prototype.addCharToAtlas_=function(t){if(t.length===1){var e=this.currAtlas_;var i=this.state_;var r=this.measureCanvas_.getContext("2d");r.font=i.font;var n=Math.ceil(r.measureText(t).width*i.scale);var a=e.atlas.add(t,n,e.height,(function(e,r,n){e.font=i.font;e.fillStyle=i.fillColor;e.strokeStyle=i.strokeColor;e.lineWidth=i.lineWidth;e.lineCap=i.lineCap;e.lineJoin=i.lineJoin;e.miterLimit=i.miterLimit;e.textAlign="left";e.textBaseline="top";if(Va.CANVAS_LINE_DASH&&i.lineDash){e.setLineDash(i.lineDash);e.lineDashOffset=i.lineDashOffset}if(i.scale!==1){e.setTransform(i.scale,0,0,i.scale,0,0)}if(i.strokeColor){e.strokeText(t,r,n)}if(i.fillColor){e.fillText(t,r,n)}}));if(a){e.width[t]=n}}};Nh.prototype.finish=function(t){var e=t.getGL();this.groupIndices.push(this.indices.length);this.hitDetectionGroupIndices=this.groupIndices;this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);var i={};this.createTextures(this.textures_,this.images_,i,e);this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:0,miterLimit:undefined,fillColor:null,font:undefined,scale:undefined};this.text_="";this.textAlign_=undefined;this.textBaseline_=undefined;this.offsetX_=undefined;this.offsetY_=undefined;this.images_=null;this.atlases_={};this.currAtlas_=undefined;Th.prototype.finish.call(this,t)};Nh.prototype.setTextStyle=function(t){var e=this.state_;var i=t.getFill();var r=t.getStroke();if(!t||!t.getText()||!i&&!r){this.text_=""}else{if(!i){e.fillColor=null}else{var n=i.getColor();e.fillColor=po.asColorLike(n?n:vh.defaultFillStyle)}if(!r){e.strokeColor=null;e.lineWidth=0}else{var a=r.getColor();e.strokeColor=po.asColorLike(a?a:vh.defaultStrokeStyle);e.lineWidth=r.getWidth()||vh.defaultLineWidth;e.lineCap=r.getLineCap()||vh.defaultLineCap;e.lineDashOffset=r.getLineDashOffset()||vh.defaultLineDashOffset;e.lineJoin=r.getLineJoin()||vh.defaultLineJoin;e.miterLimit=r.getMiterLimit()||vh.defaultMiterLimit;var s=r.getLineDash();e.lineDash=s?s.slice():vh.defaultLineDash}e.font=t.getFont()||vh.defaultFont;e.scale=t.getScale()||1;this.text_=t.getText();var o=qo.TEXT_ALIGN[t.getTextAlign()];var h=qo.TEXT_ALIGN[t.getTextBaseline()];this.textAlign_=o===undefined?vh.defaultTextAlign:o;this.textBaseline_=h===undefined?vh.defaultTextBaseline:h;this.offsetX_=t.getOffsetX()||0;this.offsetY_=t.getOffsetY()||0;this.rotateWithView=!!t.getRotateWithView();this.rotation=t.getRotation()||0;this.currAtlas_=this.getAtlas_(e)}};Nh.prototype.getAtlas_=function(t){var e=[];var i;for(i in t){if(t[i]||t[i]===0){if(Array.isArray(t[i])){e=e.concat(t[i])}else{e.push(t[i])}}}var r=this.calculateHash_(e);if(!this.atlases_[r]){var n=this.measureCanvas_.getContext("2d");n.font=t.font;var a=Math.ceil((n.measureText("M").width*1.5+t.lineWidth/2)*t.scale);this.atlases_[r]={atlas:new Fh({space:t.lineWidth+1}),width:{},height:a}}return this.atlases_[r]};Nh.prototype.calculateHash_=function(t){var e,i;var r="";for(e=0,i=t.length;e<i;++e){r+=t[e]}return r};Nh.prototype.getTextures=function(t){return this.textures_};Nh.prototype.getHitDetectionTextures=function(){return this.textures_};var Gh=function(t,e,i){Vo.call(this);this.maxExtent_=e;this.tolerance_=t;this.renderBuffer_=i;this.replaysByZIndex_={}};qn.inherits(Gh,Vo);Gh.prototype.addDeclutter=function(t,e){};Gh.prototype.getDeleteResourcesFunction=function(t){var e=[];var i;for(i in this.replaysByZIndex_){var r=this.replaysByZIndex_[i];var n;for(n in r){e.push(r[n].getDeleteResourcesFunction(t))}}return function(){var t=e.length;var i;for(var r=0;r<t;r++){i=e[r].apply(this,arguments)}return i}};Gh.prototype.finish=function(t){var e;for(e in this.replaysByZIndex_){var i=this.replaysByZIndex_[e];var r;for(r in i){i[r].finish(t)}}};Gh.prototype.getReplay=function(t,e){var i=t!==undefined?t.toString():"0";var r=this.replaysByZIndex_[i];if(r===undefined){r={};this.replaysByZIndex_[i]=r}var n=r[e];if(n===undefined){var a=Gh.BATCH_CONSTRUCTORS_[e];n=new a(this.tolerance_,this.maxExtent_);r[e]=n}return n};Gh.prototype.isEmpty=function(){return Qn.isEmpty(this.replaysByZIndex_)};Gh.prototype.replay=function(t,e,i,r,n,a,s,o){var h=Object.keys(this.replaysByZIndex_).map(Number);h.sort(fa.numberSafeCompareFunction);var l,u,f,c,d,p;for(l=0,u=h.length;l<u;++l){d=this.replaysByZIndex_[h[l].toString()];for(f=0,c=qo.ORDER.length;f<c;++f){p=d[qo.ORDER[f]];if(p!==undefined){p.replay(t,e,i,r,n,a,s,o,undefined,false)}}}};Gh.prototype.replayHitDetection_=function(t,e,i,r,n,a,s,o,h,l,u){var f=Object.keys(this.replaysByZIndex_).map(Number);f.sort((function(t,e){return e-t}));var c,d,p,v,_,g;for(c=0,d=f.length;c<d;++c){v=this.replaysByZIndex_[f[c].toString()];for(p=qo.ORDER.length-1;p>=0;--p){_=v[qo.ORDER[p]];if(_!==undefined){g=_.replay(t,e,i,r,n,a,s,o,h,l,u);if(g){return g}}}}return undefined};Gh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s,o,h,l){var u=e.getGL();u.bindFramebuffer(u.FRAMEBUFFER,e.getHitDetectionFramebuffer());var f;if(this.renderBuffer_!==undefined){f=pa.buffer(pa.createOrUpdateFromCoordinate(t),r*this.renderBuffer_)}return this.replayHitDetection_(e,t,r,n,Gh.HIT_DETECTION_SIZE_,s,o,h,(function(t){var e=new Uint8Array(4);u.readPixels(0,0,1,1,u.RGBA,u.UNSIGNED_BYTE,e);if(e[3]>0){var i=l(t);if(i){return i}}}),true,f)};Gh.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n,a,s,o,h){var l=e.getGL();l.bindFramebuffer(l.FRAMEBUFFER,e.getHitDetectionFramebuffer());var u=this.replayHitDetection_(e,t,r,n,Gh.HIT_DETECTION_SIZE_,s,o,h,(function(t){var e=new Uint8Array(4);l.readPixels(0,0,1,1,l.RGBA,l.UNSIGNED_BYTE,e);return e[3]>0}),false);return u!==undefined};Gh.HIT_DETECTION_SIZE_=[1,1];Gh.BATCH_CONSTRUCTORS_={Circle:gh,Image:Ch,LineString:Ih,Polygon:Ph,Text:Nh};var kh=function(t,e,i,r,n,a,s){vo.call(this);this.context_=t;this.center_=e;this.extent_=a;this.pixelRatio_=s;this.size_=n;this.rotation_=r;this.resolution_=i;this.imageStyle_=null;this.fillStyle_=null;this.strokeStyle_=null;this.textStyle_=null};qn.inherits(kh,vo);kh.prototype.drawText_=function(t,e){var i=this.context_;var r=t.getReplay(0,Yo.TEXT);r.setTextStyle(this.textStyle_);r.drawText(e,null);r.finish(i);var n=1;var a={};var s;var o=false;r.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,n,a,s,o);r.getDeleteResourcesFunction(i)()};kh.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke());this.setImageStyle(t.getImage());this.setTextStyle(t.getText())};kh.prototype.drawGeometry=function(t){var e=t.getType();switch(e){case la.POINT:this.drawPoint(t,null);break;case la.LINE_STRING:this.drawLineString(t,null);break;case la.POLYGON:this.drawPolygon(t,null);break;case la.MULTI_POINT:this.drawMultiPoint(t,null);break;case la.MULTI_LINE_STRING:this.drawMultiLineString(t,null);break;case la.MULTI_POLYGON:this.drawMultiPolygon(t,null);break;case la.GEOMETRY_COLLECTION:this.drawGeometryCollection(t,null);break;case la.CIRCLE:this.drawCircle(t,null);break}};kh.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);if(!i||!pa.intersects(this.extent_,i.getExtent())){return}this.setStyle(e);this.drawGeometry(i)};kh.prototype.drawGeometryCollection=function(t,e){var i=t.getGeometriesArray();var r,n;for(r=0,n=i.length;r<n;++r){this.drawGeometry(i[r])}};kh.prototype.drawPoint=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.IMAGE);n.setImageStyle(this.imageStyle_);n.drawPoint(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiPoint=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.IMAGE);n.setImageStyle(this.imageStyle_);n.drawMultiPoint(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawLineString=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_);n.drawLineString(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiLineString=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_);n.drawMultiLineString(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawPolygon=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawPolygon(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiPolygon=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawMultiPolygon(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawCircle=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.CIRCLE);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawCircle(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.setImageStyle=function(t){this.imageStyle_=t};kh.prototype.setFillStrokeStyle=function(t,e){this.fillStyle_=t;this.strokeStyle_=e};kh.prototype.setTextStyle=function(t){this.textStyle_=t};var Uh={};Uh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_texture, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n gl_FragColor.a = texColor.a * u_opacity;\n}\n":"precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}");Uh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\n\nuniform mat4 u_texCoordMatrix;\nuniform mat4 u_projectionMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.);\n v_texCoord = (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}");var zh=function(t,e){this.u_texCoordMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texCoordMatrix":"d");this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"e");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"f");this.u_texture=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texture":"g");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"b");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"c")};var Bh=function(t,e){go.call(this,e);this.mapRenderer=t;this.arrayBuffer_=new _h([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);this.texture=null;this.framebuffer=null;this.framebufferDimension=undefined;this.texCoordMatrix=Sa.create();this.projectionMatrix=Sa.create();this.tmpMat4_=dh.create();this.defaultLocations_=null};qn.inherits(Bh,go);Bh.prototype.bindFramebuffer=function(t,e){var i=this.mapRenderer.getGL();if(this.framebufferDimension===undefined||this.framebufferDimension!=e){var r=function(t,e,i){if(!t.isContextLost()){t.deleteFramebuffer(e);t.deleteTexture(i)}}.bind(null,i,this.framebuffer,this.texture);t.postRenderFunctions.push(r);var n=xh.createEmptyTexture(i,e,e);var a=i.createFramebuffer();i.bindFramebuffer(Xa.FRAMEBUFFER,a);i.framebufferTexture2D(Xa.FRAMEBUFFER,Xa.COLOR_ATTACHMENT0,Xa.TEXTURE_2D,n,0);this.texture=n;this.framebuffer=a;this.framebufferDimension=e}else{i.bindFramebuffer(Xa.FRAMEBUFFER,this.framebuffer)}};Bh.prototype.composeFrame=function(t,e,i){this.dispatchComposeEvent_(Ds.PRECOMPOSE,i,t);i.bindBuffer(Xa.ARRAY_BUFFER,this.arrayBuffer_);var r=i.getGL();var n=Uh.fragment;var a=Uh.vertex;var s=i.getProgram(n,a);var o;if(!this.defaultLocations_){o=new zh(r,s);this.defaultLocations_=o}else{o=this.defaultLocations_}if(i.useProgram(s)){r.enableVertexAttribArray(o.a_position);r.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,16,0);r.enableVertexAttribArray(o.a_texCoord);r.vertexAttribPointer(o.a_texCoord,2,Xa.FLOAT,false,16,8);r.uniform1i(o.u_texture,0)}r.uniformMatrix4fv(o.u_texCoordMatrix,false,dh.fromTransform(this.tmpMat4_,this.getTexCoordMatrix()));r.uniformMatrix4fv(o.u_projectionMatrix,false,dh.fromTransform(this.tmpMat4_,this.getProjectionMatrix()));r.uniform1f(o.u_opacity,e.opacity);r.bindTexture(Xa.TEXTURE_2D,this.getTexture());r.drawArrays(Xa.TRIANGLE_STRIP,0,4);this.dispatchComposeEvent_(Ds.POSTCOMPOSE,i,t)};Bh.prototype.dispatchComposeEvent_=function(t,e,i){var r=this.getLayer();if(r.hasListener(t)){var n=i.viewState;var a=n.resolution;var s=i.pixelRatio;var o=i.extent;var h=n.center;var l=n.rotation;var u=i.size;var f=new kh(e,h,a,l,u,o,s);var c=new lo(t,f,i,null,e);r.dispatchEvent(c)}};Bh.prototype.getTexCoordMatrix=function(){return this.texCoordMatrix};Bh.prototype.getTexture=function(){return this.texture};Bh.prototype.getProjectionMatrix=function(){return this.projectionMatrix};Bh.prototype.handleWebGLContextLost=function(){this.texture=null;this.framebuffer=null;this.framebufferDimension=undefined};Bh.prototype.prepareFrame=function(t,e,i){};Bh.prototype.forEachLayerAtPixel=function(t,e,i,r){};var Wh=function(t,e){Bh.call(this,t,e);this.image_=null;this.hitCanvasContext_=null;this.hitTransformationMatrix_=null};qn.inherits(Wh,Bh);Wh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.IMAGE};Wh["create"]=function(t,e){return new Wh(t,e)};Wh.prototype.createTexture_=function(t){var e=t.getImage();var i=this.mapRenderer.getGL();return xh.createTexture(i,e,Xa.CLAMP_TO_EDGE,Xa.CLAMP_TO_EDGE)};Wh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=this.getLayer();var s=a.getSource();var o=e.viewState.resolution;var h=e.viewState.rotation;var l=e.skippedFeatureUids;return s.forEachFeatureAtCoordinate(t,o,h,i,l,(function(t){return r.call(n,t,a)}))};Wh.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer.getGL();var n=t.pixelRatio;var a=t.viewState;var s=a.center;var o=a.resolution;var h=a.rotation;var l=this.image_;var u=this.texture;var f=this.getLayer();var c=f.getSource();var d=t.viewHints;var p=t.extent;if(e.extent!==undefined){p=pa.getIntersection(p,e.extent)}if(!d[_s.ANIMATING]&&!d[_s.INTERACTING]&&!pa.isEmpty(p)){var v=a.projection;if(!qn.ENABLE_RASTER_REPROJECTION){var _=c.getProjection();if(_){v=_}}var g=c.getImage(p,o,n,v);if(g){var m=this.loadImage(g);if(m){l=g;u=this.createTexture_(g);if(this.texture){var y=function(t,e){if(!t.isContextLost()){t.deleteTexture(e)}}.bind(null,r,this.texture);t.postRenderFunctions.push(y)}}}}if(l){var E=this.mapRenderer.getContext().getCanvas();this.updateProjectionMatrix_(E.width,E.height,n,s,o,h,l.getExtent());this.hitTransformationMatrix_=null;var x=this.texCoordMatrix;Sa.reset(x);Sa.scale(x,1,-1);Sa.translate(x,0,-1);this.image_=l;this.texture=u;this.updateLogos(t,c)}return!!l};Wh.prototype.updateProjectionMatrix_=function(t,e,i,r,n,a,s){var o=t*n;var h=e*n;var l=this.projectionMatrix;Sa.reset(l);Sa.scale(l,i*2/o,i*2/h);Sa.rotate(l,-a);Sa.translate(l,s[0]-r[0],s[1]-r[1]);Sa.scale(l,(s[2]-s[0])/2,(s[3]-s[1])/2);Sa.translate(l,1,1)};Wh.prototype.hasFeatureAtCoordinate=function(t,e){var i=this.forEachFeatureAtCoordinate(t,e,0,_a.TRUE,this);return i!==undefined};Wh.prototype.forEachLayerAtPixel=function(t,e,i,r){if(!this.image_||!this.image_.getImage()){return undefined}if(this.getLayer().getSource().forEachFeatureAtCoordinate!==qn.nullFunction){var n=Sa.apply(e.pixelToCoordinateTransform,t.slice());var a=this.forEachFeatureAtCoordinate(n,e,0,_a.TRUE,this);if(a){return i.call(r,this.getLayer(),null)}else{return undefined}}else{var s=[this.image_.getImage().width,this.image_.getImage().height];if(!this.hitTransformationMatrix_){this.hitTransformationMatrix_=this.getHitTransformationMatrix_(e.size,s)}var o=Sa.apply(this.hitTransformationMatrix_,t.slice());if(o[0]<0||o[0]>s[0]||o[1]<0||o[1]>s[1]){return undefined}if(!this.hitCanvasContext_){this.hitCanvasContext_=Ts.createCanvasContext2D(1,1)}this.hitCanvasContext_.clearRect(0,0,1,1);this.hitCanvasContext_.drawImage(this.image_.getImage(),o[0],o[1],1,1,0,0,1,1);var h=this.hitCanvasContext_.getImageData(0,0,1,1).data;if(h[3]>0){return i.call(r,this.getLayer(),h)}else{return undefined}}};Wh.prototype.getHitTransformationMatrix_=function(t,e){var i=Sa.create();Sa.translate(i,-1,-1);Sa.scale(i,2/t[0],2/t[1]);Sa.translate(i,0,t[1]);Sa.scale(i,1,-1);var r=Sa.invert(this.projectionMatrix.slice());var n=Sa.create();Sa.translate(n,0,e[1]);Sa.scale(n,1,-1);Sa.scale(n,e[0]/2,e[1]/2);Sa.translate(n,1,1);Sa.multiply(n,r);Sa.multiply(n,i);return n};var Xh=function(t,e){Co.call(this,t,e);this.canvas_=document.createElement("CANVAS");this.canvas_.style.width="100%";this.canvas_.style.height="100%";this.canvas_.style.display="block";this.canvas_.className=Ps.CLASS_UNSELECTABLE;t.insertBefore(this.canvas_,t.childNodes[0]||null);this.clipTileCanvasWidth_=0;this.clipTileCanvasHeight_=0;this.clipTileContext_=Ts.createCanvasContext2D();this.renderedVisible_=true;this.gl_=Xa.getContext(this.canvas_,{antialias:true,depth:true,failIfMajorPerformanceCaveat:true,preserveDrawingBuffer:false,stencil:true});this.context_=new xh(this.canvas_,this.gl_);$n.listen(this.canvas_,Eh.LOST,this.handleWebGLContextLost,this);$n.listen(this.canvas_,Eh.RESTORED,this.handleWebGLContextRestored,this);this.textureCache_=new uo;this.focus_=null;this.tileTextureQueue_=new fs(function(t){var e=t[1];var i=t[2];var r=e[0]-this.focus_[0];var n=e[1]-this.focus_[1];return 65536*Math.log(i)+Math.sqrt(r*r+n*n)/i}.bind(this),(function(t){return t[0].getKey()}));this.loadNextTileTexture_=function(t,e){if(!this.tileTextureQueue_.isEmpty()){this.tileTextureQueue_.reprioritize();var i=this.tileTextureQueue_.dequeue();var r=i[0];var n=i[3];var a=i[4];this.bindTileTexture(r,n,a,Xa.LINEAR,Xa.LINEAR)}return false}.bind(this);this.textureCacheFrameMarkerCount_=0;this.initializeGL_()};qn.inherits(Xh,Co);Xh["handles"]=function(t){return Va.WEBGL&&t===As.WEBGL};Xh["create"]=function(t,e){return new Xh(t,e)};Xh.prototype.bindTileTexture=function(t,e,i,r,n){var a=this.getGL();var s=t.getKey();if(this.textureCache_.containsKey(s)){var o=this.textureCache_.get(s);a.bindTexture(Xa.TEXTURE_2D,o.texture);if(o.magFilter!=r){a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MAG_FILTER,r);o.magFilter=r}if(o.minFilter!=n){a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MIN_FILTER,n);o.minFilter=n}}else{var h=a.createTexture();a.bindTexture(Xa.TEXTURE_2D,h);if(i>0){var l=this.clipTileContext_.canvas;var u=this.clipTileContext_;if(this.clipTileCanvasWidth_!==e[0]||this.clipTileCanvasHeight_!==e[1]){l.width=e[0];l.height=e[1];this.clipTileCanvasWidth_=e[0];this.clipTileCanvasHeight_=e[1]}else{u.clearRect(0,0,e[0],e[1])}u.drawImage(t.getImage(),i,i,e[0],e[1],0,0,e[0],e[1]);a.texImage2D(Xa.TEXTURE_2D,0,Xa.RGBA,Xa.RGBA,Xa.UNSIGNED_BYTE,l)}else{a.texImage2D(Xa.TEXTURE_2D,0,Xa.RGBA,Xa.RGBA,Xa.UNSIGNED_BYTE,t.getImage())}a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MAG_FILTER,r);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MIN_FILTER,n);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_S,Xa.CLAMP_TO_EDGE);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_T,Xa.CLAMP_TO_EDGE);this.textureCache_.set(s,{texture:h,magFilter:r,minFilter:n})}};Xh.prototype.dispatchComposeEvent_=function(t,e){var i=this.getMap();if(i.hasListener(t)){var r=this.context_;var n=e.extent;var a=e.size;var s=e.viewState;var o=e.pixelRatio;var h=s.resolution;var l=s.center;var u=s.rotation;var f=new kh(r,l,h,u,a,n,o);var c=new lo(t,f,e,null,r);i.dispatchEvent(c)}};Xh.prototype.disposeInternal=function(){var t=this.getGL();if(!t.isContextLost()){this.textureCache_.forEach((function(e){if(e){t.deleteTexture(e.texture)}}))}this.context_.dispose();Co.prototype.disposeInternal.call(this)};Xh.prototype.expireCache_=function(t,e){var i=this.getGL();var r;while(this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>qn.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK){r=this.textureCache_.peekLast();if(!r){if(+this.textureCache_.peekLastKey()==e.index){break}else{--this.textureCacheFrameMarkerCount_}}else{i.deleteTexture(r.texture)}this.textureCache_.pop()}};Xh.prototype.getContext=function(){return this.context_};Xh.prototype.getGL=function(){return this.gl_};Xh.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_};Xh.prototype.getType=function(){return As.WEBGL};Xh.prototype.handleWebGLContextLost=function(t){t.preventDefault();this.textureCache_.clear();this.textureCacheFrameMarkerCount_=0;var e=this.getLayerRenderers();for(var i in e){var r=e[i];r.handleWebGLContextLost()}};Xh.prototype.handleWebGLContextRestored=function(){this.initializeGL_();this.getMap().render()};Xh.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture(Xa.TEXTURE0);t.blendFuncSeparate(Xa.SRC_ALPHA,Xa.ONE_MINUS_SRC_ALPHA,Xa.ONE,Xa.ONE_MINUS_SRC_ALPHA);t.disable(Xa.CULL_FACE);t.disable(Xa.DEPTH_TEST);t.disable(Xa.SCISSOR_TEST);t.disable(Xa.STENCIL_TEST)};Xh.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())};Xh.prototype.renderFrame=function(t){var e=this.getContext();var i=this.getGL();if(i.isContextLost()){return false}if(!t){if(this.renderedVisible_){this.canvas_.style.display="none";this.renderedVisible_=false}return false}this.focus_=t.focus;this.textureCache_.set((-t.index).toString(),null);++this.textureCacheFrameMarkerCount_;this.dispatchComposeEvent_(Ds.PRECOMPOSE,t);var r=[];var n=t.layerStatesArray;fa.stableSort(n,Co.sortByZIndex);var a=t.viewState.resolution;var s,o,h,l;for(s=0,o=n.length;s<o;++s){l=n[s];if(Fs.visibleAtResolution(l,a)&&l.sourceState==Ms.READY){h=this.getLayerRenderer(l.layer);if(h.prepareFrame(t,l,e)){r.push(l)}}}var u=t.size[0]*t.pixelRatio;var f=t.size[1]*t.pixelRatio;if(this.canvas_.width!=u||this.canvas_.height!=f){this.canvas_.width=u;this.canvas_.height=f}i.bindFramebuffer(Xa.FRAMEBUFFER,null);i.clearColor(0,0,0,0);i.clear(Xa.COLOR_BUFFER_BIT);i.enable(Xa.BLEND);i.viewport(0,0,this.canvas_.width,this.canvas_.height);for(s=0,o=r.length;s<o;++s){l=r[s];h=this.getLayerRenderer(l.layer);h.composeFrame(t,l,e)}if(!this.renderedVisible_){this.canvas_.style.display="";this.renderedVisible_=true}this.calculateMatrices2D(t);if(this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>qn.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK){t.postRenderFunctions.push(this.expireCache_.bind(this))}if(!this.tileTextureQueue_.isEmpty()){t.postRenderFunctions.push(this.loadNextTileTexture_);t.animate=true}this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t);this.scheduleRemoveUnusedLayerRenderers(t);this.scheduleExpireIconCache(t)};Xh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){var o;if(this.getGL().isContextLost()){return false}var h=e.viewState;var l=e.layerStatesArray;var u=l.length;var f;for(f=u-1;f>=0;--f){var c=l[f];var d=c.layer;if(Fs.visibleAtResolution(c,h.resolution)&&a.call(s,d)){var p=this.getLayerRenderer(d);o=p.forEachFeatureAtCoordinate(t,e,i,r,n);if(o){return o}}}return undefined};Xh.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var a=false;if(this.getGL().isContextLost()){return false}var s=e.viewState;var o=e.layerStatesArray;var h=o.length;var l;for(l=h-1;l>=0;--l){var u=o[l];var f=u.layer;if(Fs.visibleAtResolution(u,s.resolution)&&r.call(n,f)){var c=this.getLayerRenderer(f);a=c.hasFeatureAtCoordinate(t,e);if(a){return true}}}return a};Xh.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){if(this.getGL().isContextLost()){return false}var s=e.viewState;var o;var h=e.layerStatesArray;var l=h.length;var u;for(u=l-1;u>=0;--u){var f=h[u];var c=f.layer;if(Fs.visibleAtResolution(f,s.resolution)&&n.call(r,c)){var d=this.getLayerRenderer(c);o=d.forEachLayerAtPixel(t,e,i,r);if(o){return o}}}return undefined};var Vh={};Vh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n":"precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}");Vh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}");var Yh=function(t,e){this.u_tileOffset=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_tileOffset":"d");this.u_texture=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texture":"e");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"b");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"c")};var jh=function(t,e){Bh.call(this,t,e);this.fragmentShader_=Vh.fragment;this.vertexShader_=Vh.vertex;this.locations_=null;this.renderArrayBuffer_=new _h([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]);this.renderedTileRange_=null;this.renderedFramebufferExtent_=null;this.renderedRevision_=-1;this.tmpSize_=[0,0]};qn.inherits(jh,Bh);jh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.TILE};jh["create"]=function(t,e){return new jh(t,e)};jh.prototype.disposeInternal=function(){var t=this.mapRenderer.getContext();t.deleteBuffer(this.renderArrayBuffer_);Bh.prototype.disposeInternal.call(this)};jh.prototype.createLoadedTileFinder=function(t,e,i){var r=this.mapRenderer;return function(n,a){function s(t){var e=r.isTileTextureLoaded(t);if(e){if(!i[n]){i[n]={}}i[n][t.tileCoord.toString()]=t}return e}return t.forEachLoadedTile(e,n,a,s)}};jh.prototype.handleWebGLContextLost=function(){Bh.prototype.handleWebGLContextLost.call(this);this.locations_=null};jh.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer;var n=i.getGL();var a=t.viewState;var s=a.projection;var o=this.getLayer();var h=o.getSource();var l=h.getTileGridForProjection(s);var u=l.getZForResolution(a.resolution);var f=l.getResolution(u);var c=h.getTilePixelSize(u,t.pixelRatio,s);var d=c[0]/ws.toSize(l.getTileSize(u),this.tmpSize_)[0];var p=f/d;var v=h.getTilePixelRatio(d)*h.getGutter(s);var _=a.center;var g=t.extent;var m=l.getTileRangeForExtentAndZ(g,u);var y;if(this.renderedTileRange_&&this.renderedTileRange_.equals(m)&&this.renderedRevision_==h.getRevision()){y=this.renderedFramebufferExtent_}else{var E=m.getSize();var x=Math.max(E[0]*c[0],E[1]*c[1]);var T=ha.roundUpToPowerOfTwo(x);var C=p*T;var R=l.getOrigin(u);var M=R[0]+m.minX*c[0]*p;var S=R[1]+m.minY*c[1]*p;y=[M,S,M+C,S+C];this.bindFramebuffer(t,T);n.viewport(0,0,T,T);n.clearColor(0,0,0,0);n.clear(Xa.COLOR_BUFFER_BIT);n.disable(Xa.BLEND);var I=i.getProgram(this.fragmentShader_,this.vertexShader_);i.useProgram(I);if(!this.locations_){this.locations_=new Yh(n,I)}i.bindBuffer(Xa.ARRAY_BUFFER,this.renderArrayBuffer_);n.enableVertexAttribArray(this.locations_.a_position);n.vertexAttribPointer(this.locations_.a_position,2,Xa.FLOAT,false,16,0);n.enableVertexAttribArray(this.locations_.a_texCoord);n.vertexAttribPointer(this.locations_.a_texCoord,2,Xa.FLOAT,false,16,8);n.uniform1i(this.locations_.u_texture,0);var L={};L[u]={};var A=this.createLoadedTileFinder(h,s,L);var w=o.getUseInterimTilesOnError();var O=true;var b=pa.createEmpty();var P=new Mo(0,0,0,0);var D,F,N,G,k;var U,z,B;for(U=m.minX;U<=m.maxX;++U){for(z=m.minY;z<=m.maxY;++z){G=h.getTile(u,U,z,d,s);if(e.extent!==undefined){B=l.getTileCoordExtent(G.tileCoord,b);if(!pa.intersects(B,e.extent)){continue}}k=G.getState();F=k==us.LOADED||k==us.EMPTY||k==us.ERROR&&!w;if(!F){G=G.getInterimTile()}k=G.getState();if(k==us.LOADED){if(r.isTileTextureLoaded(G)){L[u][G.tileCoord.toString()]=G;continue}}else if(k==us.EMPTY||k==us.ERROR&&!w){continue}O=false;N=l.forEachTileCoordParentTileRange(G.tileCoord,A,null,P,b);if(!N){D=l.getTileCoordChildTileRange(G.tileCoord,P,b);if(D){A(u+1,D)}}}}var W=Object.keys(L).map(Number);W.sort(fa.numberSafeCompareFunction);var X=new Float32Array(4);var V,Y,j,H;for(V=0,Y=W.length;V<Y;++V){H=L[W[V]];for(j in H){G=H[j];B=l.getTileCoordExtent(G.tileCoord,b);X[0]=2*(B[2]-B[0])/C;X[1]=2*(B[3]-B[1])/C;X[2]=2*(B[0]-y[0])/C-1;X[3]=2*(B[1]-y[1])/C-1;n.uniform4fv(this.locations_.u_tileOffset,X);r.bindTileTexture(G,c,v*d,Xa.LINEAR,Xa.LINEAR);n.drawArrays(Xa.TRIANGLE_STRIP,0,4)}}if(O){this.renderedTileRange_=m;this.renderedFramebufferExtent_=y;this.renderedRevision_=h.getRevision()}else{this.renderedTileRange_=null;this.renderedFramebufferExtent_=null;this.renderedRevision_=-1;t.animate=true}}this.updateUsedTiles(t.usedTiles,h,u,m);var K=r.getTileTextureQueue();this.manageTilePyramid(t,h,l,d,s,g,u,o.getPreload(),(function(t){if(t.getState()==us.LOADED&&!r.isTileTextureLoaded(t)&&!K.isKeyQueued(t.getKey())){K.enqueue([t,l.getTileCoordCenter(t.tileCoord),l.getResolution(t.tileCoord[0]),c,v*d])}}),this);this.scheduleExpireCache(t,h);this.updateLogos(t,h);var q=this.texCoordMatrix;Sa.reset(q);Sa.translate(q,(Math.round(_[0]/f)*f-y[0])/(y[2]-y[0]),(Math.round(_[1]/f)*f-y[1])/(y[3]-y[1]));if(a.rotation!==0){Sa.rotate(q,a.rotation)}Sa.scale(q,t.size[0]*a.resolution/(y[2]-y[0]),t.size[1]*a.resolution/(y[3]-y[1]));Sa.translate(q,-.5,-.5);return true};jh.prototype.forEachLayerAtPixel=function(t,e,i,r){if(!this.framebuffer){return undefined}var n=[t[0]/e.size[0],(e.size[1]-t[1])/e.size[1]];var a=Sa.apply(this.texCoordMatrix,n.slice());var s=[a[0]*this.framebufferDimension,a[1]*this.framebufferDimension];var o=this.mapRenderer.getContext().getGL();o.bindFramebuffer(o.FRAMEBUFFER,this.framebuffer);var h=new Uint8Array(4);o.readPixels(s[0],s[1],1,1,o.RGBA,o.UNSIGNED_BYTE,h);if(h[3]>0){return i.call(r,this.getLayer(),h)}else{return undefined}};var Hh=function(t,e){Bh.call(this,t,e);this.dirty_=false;this.renderedRevision_=-1;this.renderedResolution_=NaN;this.renderedExtent_=pa.createEmpty();this.renderedRenderOrder_=null;this.replayGroup_=null;this.layerState_=null};qn.inherits(Hh,Bh);Hh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.VECTOR};Hh["create"]=function(t,e){return new Hh(t,e)};Hh.prototype.composeFrame=function(t,e,i){this.layerState_=e;var r=t.viewState;var n=this.replayGroup_;var a=t.size;var s=t.pixelRatio;var o=this.mapRenderer.getGL();if(n&&!n.isEmpty()){o.enable(o.SCISSOR_TEST);o.scissor(0,0,a[0]*s,a[1]*s);n.replay(i,r.center,r.resolution,r.rotation,a,s,e.opacity,e.managed?t.skippedFeatureUids:{});o.disable(o.SCISSOR_TEST)}};Hh.prototype.disposeInternal=function(){var t=this.replayGroup_;if(t){var e=this.mapRenderer.getContext();t.getDeleteResourcesFunction(e)();this.replayGroup_=null}Bh.prototype.disposeInternal.call(this)};Hh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(!this.replayGroup_||!this.layerState_){return undefined}else{var a=this.mapRenderer.getContext();var s=e.viewState;var o=this.getLayer();var h=this.layerState_;var l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,a,s.center,s.resolution,s.rotation,e.size,e.pixelRatio,h.opacity,{},(function(t){var e=qn.getUid(t).toString();if(!(e in l)){l[e]=true;return r.call(n,t,o)}}))}};Hh.prototype.hasFeatureAtCoordinate=function(t,e){if(!this.replayGroup_||!this.layerState_){return false}else{var i=this.mapRenderer.getContext();var r=e.viewState;var n=this.layerState_;return this.replayGroup_.hasFeatureAtCoordinate(t,i,r.center,r.resolution,r.rotation,e.size,e.pixelRatio,n.opacity,e.skippedFeatureUids)}};Hh.prototype.forEachLayerAtPixel=function(t,e,i,r){var n=Sa.apply(e.pixelToCoordinateTransform,t.slice());var a=this.hasFeatureAtCoordinate(n,e);if(a){return i.call(r,this.getLayer(),null)}else{return undefined}};Hh.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};Hh.prototype.prepareFrame=function(t,e,i){var r=this.getLayer();var n=r.getSource();this.updateLogos(t,n);var a=t.viewHints[_s.ANIMATING];var s=t.viewHints[_s.INTERACTING];var o=r.getUpdateWhileAnimating();var h=r.getUpdateWhileInteracting();if(!this.dirty_&&(!o&&a)||!h&&s){return true}var l=t.extent;var u=t.viewState;var f=u.projection;var c=u.resolution;var d=t.pixelRatio;var p=r.getRevision();var v=r.getRenderBuffer();var _=r.getRenderOrder();if(_===undefined){_=nh.defaultOrder}var g=pa.buffer(l,v*c);if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==p&&this.renderedRenderOrder_==_&&pa.containsExtent(this.renderedExtent_,g)){return true}if(this.replayGroup_){t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(i))}this.dirty_=false;var m=new Gh(nh.getTolerance(c,d),g,r.getRenderBuffer());n.loadFeatures(g,c,f);var y=function(t){var e;var i=t.getStyleFunction();if(i){e=i.call(t,c)}else{i=r.getStyleFunction();if(i){e=i(t,c)}}if(e){var n=this.renderFeature(t,c,d,e,m);this.dirty_=this.dirty_||n}};if(_){var E=[];n.forEachFeatureInExtent(g,(function(t){E.push(t)}),this);E.sort(_);E.forEach(y,this)}else{n.forEachFeatureInExtent(g,y,this)}m.finish(i);this.renderedResolution_=c;this.renderedRevision_=p;this.renderedRenderOrder_=_;this.renderedExtent_=g;this.replayGroup_=m;return true};Hh.prototype.renderFeature=function(t,e,i,r,n){if(!r){return false}var a=false;if(Array.isArray(r)){for(var s=r.length-1,o=0;s>=o;--s){a=nh.renderFeature(n,t,r[s],nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}}else{a=nh.renderFeature(n,t,r,nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}return a};if(qn.ENABLE_CANVAS){Ls.register(Is.MAP_RENDERER,Ro);Ls.registerMultiple(Is.LAYER_RENDERER,[Eo,So,ah,oh])}if(qn.ENABLE_WEBGL){Ls.register(Is.MAP_RENDERER,Xh);Ls.registerMultiple(Is.LAYER_RENDERER,[Wh,jh,Hh])}var Kh=function(t){t=Qn.assign({},t);if(!t.controls){t.controls=Us.defaults()}if(!t.interactions){t.interactions=ro.defaults()}Os.call(this,t)};qn.inherits(Kh,Os);var qh=function(t){this.opacity_=t.opacity;this.rotateWithView_=t.rotateWithView;this.rotation_=t.rotation;this.scale_=t.scale;this.snapToPixel_=t.snapToPixel};qh.prototype.getOpacity=function(){return this.opacity_};qh.prototype.getRotateWithView=function(){return this.rotateWithView_};qh.prototype.getRotation=function(){return this.rotation_};qh.prototype.getScale=function(){return this.scale_};qh.prototype.getSnapToPixel=function(){return this.snapToPixel_};qh.prototype.getAnchor=function(){};qh.prototype.getImage=function(t){};qh.prototype.getHitDetectionImage=function(t){};qh.prototype.getImageState=function(){};qh.prototype.getImageSize=function(){};qh.prototype.getHitDetectionImageSize=function(){};qh.prototype.getOrigin=function(){};qh.prototype.getSize=function(){};qh.prototype.setOpacity=function(t){this.opacity_=t};qh.prototype.setRotateWithView=function(t){this.rotateWithView_=t};qh.prototype.setRotation=function(t){this.rotation_=t};qh.prototype.setScale=function(t){this.scale_=t};qh.prototype.setSnapToPixel=function(t){this.snapToPixel_=t};qh.prototype.listenImageChange=function(t,e){};qh.prototype.load=function(){};qh.prototype.unlistenImageChange=function(t,e){};var Zh=function(t){this.checksums_=null;this.canvas_=null;this.hitDetectionCanvas_=null;this.fill_=t.fill!==undefined?t.fill:null;this.origin_=[0,0];this.points_=t.points;this.radius_=t.radius!==undefined?t.radius:t.radius1;this.radius2_=t.radius2;this.angle_=t.angle!==undefined?t.angle:0;this.stroke_=t.stroke!==undefined?t.stroke:null;this.anchor_=null;this.size_=null;this.imageSize_=null;this.hitDetectionImageSize_=null;this.atlasManager_=t.atlasManager;this.render_(this.atlasManager_);var e=t.snapToPixel!==undefined?t.snapToPixel:true;var i=t.rotateWithView!==undefined?t.rotateWithView:false;qh.call(this,{opacity:1,rotateWithView:i,rotation:t.rotation!==undefined?t.rotation:0,scale:1,snapToPixel:e})};qn.inherits(Zh,qh);Zh.prototype.clone=function(){var t=new Zh({fill:this.getFill()?this.getFill().clone():undefined,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),snapToPixel:this.getSnapToPixel(),stroke:this.getStroke()?this.getStroke().clone():undefined,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});t.setOpacity(this.getOpacity());t.setScale(this.getScale());return t};Zh.prototype.getAnchor=function(){return this.anchor_};Zh.prototype.getAngle=function(){return this.angle_};Zh.prototype.getFill=function(){return this.fill_};Zh.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_};Zh.prototype.getImage=function(t){return this.canvas_};Zh.prototype.getImageSize=function(){return this.imageSize_};Zh.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_};Zh.prototype.getImageState=function(){return ao.LOADED};Zh.prototype.getOrigin=function(){return this.origin_};Zh.prototype.getPoints=function(){return this.points_};Zh.prototype.getRadius=function(){return this.radius_};Zh.prototype.getRadius2=function(){return this.radius2_};Zh.prototype.getSize=function(){return this.size_};Zh.prototype.getStroke=function(){return this.stroke_};Zh.prototype.listenImageChange=function(t,e){};Zh.prototype.load=function(){};Zh.prototype.unlistenImageChange=function(t,e){};Zh.prototype.render_=function(t){var e;var i="";var r="";var n=0;var a=null;var s=0;var o;var h=0;if(this.stroke_){o=this.stroke_.getColor();if(o===null){o=fo.defaultStrokeStyle}o=po.asColorLike(o);h=this.stroke_.getWidth();if(h===undefined){h=fo.defaultLineWidth}a=this.stroke_.getLineDash();s=this.stroke_.getLineDashOffset();if(!Va.CANVAS_LINE_DASH){a=null;s=0}r=this.stroke_.getLineJoin();if(r===undefined){r=fo.defaultLineJoin}i=this.stroke_.getLineCap();if(i===undefined){i=fo.defaultLineCap}n=this.stroke_.getMiterLimit();if(n===undefined){n=fo.defaultMiterLimit}}var l=2*(this.radius_+h)+1;var u={strokeStyle:o,strokeWidth:h,size:l,lineCap:i,lineDash:a,lineDashOffset:s,lineJoin:r,miterLimit:n};if(t===undefined){var f=Ts.createCanvasContext2D(l,l);this.canvas_=f.canvas;l=this.canvas_.width;e=l;this.draw_(u,f,0,0);this.createHitDetectionCanvas_(u)}else{l=Math.round(l);var c=!this.fill_;var d;if(c){d=this.drawHitDetectionCanvas_.bind(this,u)}var p=this.getChecksum();var v=t.add(p,l,l,this.draw_.bind(this,u),d);this.canvas_=v.image;this.origin_=[v.offsetX,v.offsetY];e=v.image.width;if(c){this.hitDetectionCanvas_=v.hitImage;this.hitDetectionImageSize_=[v.hitImage.width,v.hitImage.height]}else{this.hitDetectionCanvas_=this.canvas_;this.hitDetectionImageSize_=[e,e]}}this.anchor_=[l/2,l/2];this.size_=[l,l];this.imageSize_=[e,e]};Zh.prototype.draw_=function(t,e,i,r){var n,a,s;e.setTransform(1,0,0,1,0,0);e.translate(i,r);e.beginPath();var o=this.points_;if(o===Infinity){e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,true)}else{var h=this.radius2_!==undefined?this.radius2_:this.radius_;if(h!==this.radius_){o=2*o}for(n=0;n<=o;n++){a=n*2*Math.PI/o-Math.PI/2+this.angle_;s=n%2===0?this.radius_:h;e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}}if(this.fill_){var l=this.fill_.getColor();if(l===null){l=fo.defaultFillStyle}e.fillStyle=po.asColorLike(l);e.fill()}if(this.stroke_){e.strokeStyle=t.strokeStyle;e.lineWidth=t.strokeWidth;if(t.lineDash){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.lineCap=t.lineCap;e.lineJoin=t.lineJoin;e.miterLimit=t.miterLimit;e.stroke()}e.closePath()};Zh.prototype.createHitDetectionCanvas_=function(t){this.hitDetectionImageSize_=[t.size,t.size];if(this.fill_){this.hitDetectionCanvas_=this.canvas_;return}var e=Ts.createCanvasContext2D(t.size,t.size);this.hitDetectionCanvas_=e.canvas;this.drawHitDetectionCanvas_(t,e,0,0)};Zh.prototype.drawHitDetectionCanvas_=function(t,e,i,r){e.setTransform(1,0,0,1,0,0);e.translate(i,r);e.beginPath();var n=this.points_;if(n===Infinity){e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,true)}else{var a=this.radius2_!==undefined?this.radius2_:this.radius_;if(a!==this.radius_){n=2*n}var s,o,h;for(s=0;s<=n;s++){h=s*2*Math.PI/n-Math.PI/2+this.angle_;o=s%2===0?this.radius_:a;e.lineTo(t.size/2+o*Math.cos(h),t.size/2+o*Math.sin(h))}}e.fillStyle=fo.defaultFillStyle;e.fill();if(this.stroke_){e.strokeStyle=t.strokeStyle;e.lineWidth=t.strokeWidth;if(t.lineDash){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.stroke()}e.closePath()};Zh.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-";var e=this.fill_?this.fill_.getChecksum():"-";var i=!this.checksums_||(t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.radius2_!=this.checksums_[4]||this.angle_!=this.checksums_[5]||this.points_!=this.checksums_[6]);if(i){var r="r"+t+e+(this.radius_!==undefined?this.radius_.toString():"-")+(this.radius2_!==undefined?this.radius2_.toString():"-")+(this.angle_!==undefined?this.angle_.toString():"-")+(this.points_!==undefined?this.points_.toString():"-");this.checksums_=[r,t,e,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]};var Jh=function(t){var e=t||{};Zh.call(this,{points:Infinity,fill:e.fill,radius:e.radius,snapToPixel:e.snapToPixel,stroke:e.stroke,atlasManager:e.atlasManager})};qn.inherits(Jh,Zh);Jh.prototype.clone=function(){var t=new Jh({fill:this.getFill()?this.getFill().clone():undefined,stroke:this.getStroke()?this.getStroke().clone():undefined,radius:this.getRadius(),snapToPixel:this.getSnapToPixel(),atlasManager:this.atlasManager_});t.setOpacity(this.getOpacity());t.setScale(this.getScale());return t};Jh.prototype.setRadius=function(t){this.radius_=t;this.render_(this.atlasManager_)};var Qh=function(t){var e=t||{};this.color_=e.color!==undefined?e.color:null;this.checksum_=undefined};Qh.prototype.clone=function(){var t=this.getColor();return new Qh({color:t&&t.slice?t.slice():t||undefined})};Qh.prototype.getColor=function(){return this.color_};Qh.prototype.setColor=function(t){this.color_=t;this.checksum_=undefined};Qh.prototype.getChecksum=function(){if(this.checksum_===undefined){if(this.color_ instanceof CanvasPattern||this.color_ instanceof CanvasGradient){this.checksum_=qn.getUid(this.color_).toString()}else{this.checksum_="f"+(this.color_?co.asString(this.color_):"-")}}return this.checksum_};var $h=function(t){var e=t||{};this.geometry_=null;this.geometryFunction_=$h.defaultGeometryFunction;if(e.geometry!==undefined){this.setGeometry(e.geometry)}this.fill_=e.fill!==undefined?e.fill:null;this.image_=e.image!==undefined?e.image:null;this.renderer_=e.renderer!==undefined?e.renderer:null;this.stroke_=e.stroke!==undefined?e.stroke:null;this.text_=e.text!==undefined?e.text:null;this.zIndex_=e.zIndex};$h.prototype.clone=function(){var t=this.getGeometry();if(t&&t.clone){t=t.clone()}return new $h({geometry:t,fill:this.getFill()?this.getFill().clone():undefined,image:this.getImage()?this.getImage().clone():undefined,stroke:this.getStroke()?this.getStroke().clone():undefined,text:this.getText()?this.getText().clone():undefined,zIndex:this.getZIndex()})};$h.prototype.getRenderer=function(){return this.renderer_};$h.prototype.setRenderer=function(t){this.renderer_=t};$h.prototype.getGeometry=function(){return this.geometry_};$h.prototype.getGeometryFunction=function(){return this.geometryFunction_};$h.prototype.getFill=function(){return this.fill_};$h.prototype.setFill=function(t){this.fill_=t};$h.prototype.getImage=function(){return this.image_};$h.prototype.setImage=function(t){this.image_=t};$h.prototype.getStroke=function(){return this.stroke_};$h.prototype.setStroke=function(t){this.stroke_=t};$h.prototype.getText=function(){return this.text_};$h.prototype.setText=function(t){this.text_=t};$h.prototype.getZIndex=function(){return this.zIndex_};$h.prototype.setGeometry=function(t){if(typeof t==="function"){this.geometryFunction_=t}else if(typeof t==="string"){this.geometryFunction_=function(e){return e.get(t)}}else if(!t){this.geometryFunction_=$h.defaultGeometryFunction}else if(t!==undefined){this.geometryFunction_=function(){return t}}this.geometry_=t};$h.prototype.setZIndex=function(t){this.zIndex_=t};$h.createFunction=function(t){var e;if(typeof t==="function"){e=t}else{var i;if(Array.isArray(t)){i=t}else{oa.assert(t instanceof $h,41);i=[t]}e=function(){return i}}return e};$h.default_=null;$h.defaultFunction=function(t,e){if(!$h.default_){var i=new Qh({color:"rgba(255,255,255,0.4)"});var r=new wh({color:"#3399CC",width:1.25});$h.default_=[new $h({image:new Jh({fill:i,stroke:r,radius:5}),fill:i,stroke:r})]}return $h.default_};$h.createDefaultEditing=function(){var t={};var e=[255,255,255,1];var i=[0,153,255,1];var r=3;t[la.POLYGON]=[new $h({fill:new Qh({color:[255,255,255,.5]})})];t[la.MULTI_POLYGON]=t[la.POLYGON];t[la.LINE_STRING]=[new $h({stroke:new wh({color:e,width:r+2})}),new $h({stroke:new wh({color:i,width:r})})];t[la.MULTI_LINE_STRING]=t[la.LINE_STRING];t[la.CIRCLE]=t[la.POLYGON].concat(t[la.LINE_STRING]);t[la.POINT]=[new $h({image:new Jh({radius:r*2,fill:new Qh({color:i}),stroke:new wh({color:e,width:r/2})}),zIndex:Infinity})];t[la.MULTI_POINT]=t[la.POINT];t[la.GEOMETRY_COLLECTION]=t[la.POLYGON].concat(t[la.LINE_STRING],t[la.POINT]);return t};$h.defaultGeometryFunction=function(t){return t.getGeometry()};var tl=function(t){aa.call(this);this.id_=undefined;this.geometryName_="geometry";this.style_=null;this.styleFunction_=undefined;this.geometryChangeKey_=null;$n.listen(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);if(t!==undefined){if(t instanceof Ia||!t){var e=t;this.setGeometry(e)}else{var i=t;this.setProperties(i)}}};qn.inherits(tl,aa);tl.prototype.clone=function(){var t=new tl(this.getProperties());t.setGeometryName(this.getGeometryName());var e=this.getGeometry();if(e){t.setGeometry(e.clone())}var i=this.getStyle();if(i){t.setStyle(i)}return t};tl.prototype.getGeometry=function(){return this.get(this.geometryName_)};tl.prototype.getId=function(){return this.id_};tl.prototype.getGeometryName=function(){return this.geometryName_};tl.prototype.getStyle=function(){return this.style_};tl.prototype.getStyleFunction=function(){return this.styleFunction_};tl.prototype.handleGeometryChange_=function(){this.changed()};tl.prototype.handleGeometryChanged_=function(){if(this.geometryChangeKey_){$n.unlistenByKey(this.geometryChangeKey_);this.geometryChangeKey_=null}var t=this.getGeometry();if(t){this.geometryChangeKey_=$n.listen(t,ra.CHANGE,this.handleGeometryChange_,this)}this.changed()};tl.prototype.setGeometry=function(t){this.set(this.geometryName_,t)};tl.prototype.setStyle=function(t){this.style_=t;this.styleFunction_=!t?undefined:tl.createStyleFunction(t);this.changed()};tl.prototype.setId=function(t){this.id_=t;this.changed()};tl.prototype.setGeometryName=function(t){$n.unlisten(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);this.geometryName_=t;$n.listen(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);this.handleGeometryChanged_()};tl.createStyleFunction=function(t){var e;if(typeof t==="function"){if(t.length==2){e=function(e){return t(this,e)}}else{e=t}}else{var i;if(Array.isArray(t)){i=t}else{oa.assert(t instanceof $h,41);i=[t]}e=function(){return i}}return e};var el={};el.createOrUpdate=function(t,e,i,r){if(r!==undefined){r[0]=t;r[1]=e;r[2]=i;return r}else{return[t,e,i]}};el.getKeyZXY=function(t,e,i){return t+"/"+e+"/"+i};el.getKey=function(t){return el.getKeyZXY(t[0],t[1],t[2])};el.fromKey=function(t){return t.split("/").map(Number)};el.hash=function(t){return(t[1]<<t[0])+t[2]};el.quadKey=function(t){var e=t[0];var i=new Array(e);var r=1<<e-1;var n,a;for(n=0;n<e;++n){a=48;if(t[1]&r){a+=1}if(t[2]&r){a+=2}i[n]=String.fromCharCode(a);r>>=1}return i.join("")};el.withinExtentAndZ=function(t,e){var i=t[0];var r=t[1];var n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom()){return false}var a=e.getExtent();var s;if(!a){s=e.getFullTileRange(i)}else{s=e.getTileRangeForExtentAndZ(a,i)}if(!s){return true}else{return s.containsXY(r,n)}};var il={};il.createFromTemplate=function(t,e){var i=/\{z\}/g;var r=/\{x\}/g;var n=/\{y\}/g;var a=/\{-y\}/g;return function(s,o,h){if(!s){return undefined}else{return t.replace(i,s[0].toString()).replace(r,s[1].toString()).replace(n,(function(){var t=-s[2]-1;return t.toString()})).replace(a,(function(){var t=s[0];var i=e.getFullTileRange(t);oa.assert(i,55);var r=i.getHeight()+s[2];return r.toString()}))}}};il.createFromTemplates=function(t,e){var i=t.length;var r=new Array(i);for(var n=0;n<i;++n){r[n]=il.createFromTemplate(t[n],e)}return il.createFromTileUrlFunctions(r)};il.createFromTileUrlFunctions=function(t){if(t.length===1){return t[0]}return function(e,i,r){if(!e){return undefined}else{var n=el.hash(e);var a=ha.modulo(n,t.length);return t[a](e,i,r)}}};il.nullTileUrlFunction=function(t,e,i){return undefined};il.expandUrl=function(t){var e=[];var i=/\{([a-z])-([a-z])\}/.exec(t);if(i){var r=i[1].charCodeAt(0);var n=i[2].charCodeAt(0);var a;for(a=r;a<=n;++a){e.push(t.replace(i[0],String.fromCharCode(a)))}return e}i=i=/\{(\d+)-(\d+)\}/.exec(t);if(i){var s=parseInt(i[2],10);for(var o=parseInt(i[1],10);o<=s;o++){e.push(t.replace(i[0],o.toString()))}return e}e.push(t);return e};var rl=function(t,e,i){ia.call(this);var r=i?i:{};this.tileCoord=t;this.state=e;this.interimTile=null;this.key="";this.transition_=r.transition===undefined?250:r.transition;this.transitionStarts_={}};qn.inherits(rl,ia);rl.prototype.changed=function(){this.dispatchEvent(ra.CHANGE)};rl.prototype.getKey=function(){return this.key+"/"+this.tileCoord};rl.prototype.getInterimTile=function(){if(!this.interimTile){return this}var t=this.interimTile;do{if(t.getState()==us.LOADED){return t}t=t.interimTile}while(t);return this};rl.prototype.refreshInterimChain=function(){if(!this.interimTile){return}var t=this.interimTile;var e=this;do{if(t.getState()==us.LOADED){t.interimTile=null;break}else if(t.getState()==us.LOADING){e=t}else if(t.getState()==us.IDLE){e.interimTile=t.interimTile}else{e=t}t=e.interimTile}while(t)};rl.prototype.getTileCoord=function(){return this.tileCoord};rl.prototype.getState=function(){return this.state};rl.prototype.setState=function(t){this.state=t;this.changed()};rl.prototype.load=function(){};rl.prototype.getAlpha=function(t,e){if(!this.transition_){return 1}var i=this.transitionStarts_[t];if(!i){i=e;this.transitionStarts_[t]=i}else if(i===-1){return 1}var r=e-i+1e3/60;if(r>=this.transition_){return 1}return Es.easeIn(r/this.transition_)};rl.prototype.inTransition=function(t){if(!this.transition_){return false}return this.transitionStarts_[t]!==-1};rl.prototype.endTransition=function(t){if(this.transition_){this.transitionStarts_[t]=-1}};var nl=function(t,e,i,r,n,a){rl.call(this,t,e,a);this.crossOrigin_=r;this.src_=i;this.image_=new Image;if(r!==null){this.image_.crossOrigin=r}this.imageListenerKeys_=null;this.tileLoadFunction_=n};qn.inherits(nl,rl);nl.prototype.disposeInternal=function(){if(this.state==us.LOADING){this.unlistenImage_();this.image_=nl.getBlankImage()}if(this.interimTile){this.interimTile.dispose()}this.state=us.ABORT;this.changed();rl.prototype.disposeInternal.call(this)};nl.prototype.getImage=function(){return this.image_};nl.prototype.getKey=function(){return this.src_};nl.prototype.handleImageError_=function(){this.state=us.ERROR;this.unlistenImage_();this.image_=nl.getBlankImage();this.changed()};nl.prototype.handleImageLoad_=function(){if(this.image_.naturalWidth&&this.image_.naturalHeight){this.state=us.LOADED}else{this.state=us.EMPTY}this.unlistenImage_();this.changed()};nl.prototype.load=function(){if(this.state==us.ERROR){this.state=us.IDLE;this.image_=new Image;if(this.crossOrigin_!==null){this.image_.crossOrigin=this.crossOrigin_}}if(this.state==us.IDLE){this.state=us.LOADING;this.changed();this.imageListenerKeys_=[$n.listenOnce(this.image_,ra.ERROR,this.handleImageError_,this),$n.listenOnce(this.image_,ra.LOAD,this.handleImageLoad_,this)];this.tileLoadFunction_(this,this.src_)}};nl.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach($n.unlistenByKey);this.imageListenerKeys_=null};nl.getBlankImage=function(){var t=Ts.createCanvasContext2D(1,1);t.fillStyle="rgba(0,0,0,0)";t.fillRect(0,0,1,1);return t.canvas};var al=function(t){uo.call(this,t)};qn.inherits(al,uo);al.prototype.expireCache=function(t){var e,i;while(this.canExpireCache()){e=this.peekLast();i=e.tileCoord[0].toString();if(i in t&&t[i].contains(e.tileCoord)){break}else{this.pop().dispose()}}};al.prototype.pruneExceptNewestZ=function(){if(this.getCount()===0){return}var t=this.peekFirstKey();var e=el.fromKey(t);var i=e[0];this.forEach((function(t){if(t.tileCoord[0]!==i){this.remove(el.getKey(t.tileCoord));t.dispose()}}),this)};var sl={};sl.calculateSourceResolution=function(t,e,i,r){var n=Ma.transform(i,e,t);var a=Ma.getPointResolution(e,r,i);var s=e.getMetersPerUnit();if(s!==undefined){a*=s}var o=t.getMetersPerUnit();if(o!==undefined){a/=o}var h=t.getExtent();if(!h||pa.containsCoordinate(h,n)){var l=Ma.getPointResolution(t,a,n)/a;if(isFinite(l)&&l>0){a/=l}}return a};sl.enlargeClipPoint_=function(t,e,i,r){var n=i-t,a=r-e;var s=Math.sqrt(n*n+a*a);return[Math.round(i+n/s),Math.round(r+a/s)]};sl.render=function(t,e,i,r,n,a,s,o,h,l,u){var f=Ts.createCanvasContext2D(Math.round(i*t),Math.round(i*e));if(h.length===0){return f.canvas}f.scale(i,i);var c=pa.createEmpty();h.forEach((function(t,e,i){pa.extend(c,t.extent)}));var d=pa.getWidth(c);var p=pa.getHeight(c);var v=Ts.createCanvasContext2D(Math.round(i*d/r),Math.round(i*p/r));var _=i/r;h.forEach((function(t,e,i){var r=t.extent[0]-c[0];var n=-(t.extent[3]-c[3]);var a=pa.getWidth(t.extent);var s=pa.getHeight(t.extent);v.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,r*_,n*_,a*_,s*_)}));var g=pa.getTopLeft(s);o.getTriangles().forEach((function(t,e,n){var s=t.source,o=t.target;var h=s[0][0],l=s[0][1],u=s[1][0],d=s[1][1],p=s[2][0],_=s[2][1];var m=(o[0][0]-g[0])/a,y=-(o[0][1]-g[1])/a;var E=(o[1][0]-g[0])/a,x=-(o[1][1]-g[1])/a;var T=(o[2][0]-g[0])/a,C=-(o[2][1]-g[1])/a;var R=h,M=l;h=0;l=0;u-=R;d-=M;p-=R;_-=M;var S=[[u,d,0,0,E-m],[p,_,0,0,T-m],[0,0,u,d,x-y],[0,0,p,_,C-y]];var I=ha.solveLinearSystem(S);if(!I){return}f.save();f.beginPath();var L=(m+E+T)/3,A=(y+x+C)/3;var w=sl.enlargeClipPoint_(L,A,m,y);var O=sl.enlargeClipPoint_(L,A,E,x);var b=sl.enlargeClipPoint_(L,A,T,C);f.moveTo(O[0],O[1]);f.lineTo(w[0],w[1]);f.lineTo(b[0],b[1]);f.clip();f.transform(I[0],I[2],I[1],I[3],m,y);f.translate(c[0]-R,c[3]-M);f.scale(r/i,-r/i);f.drawImage(v.canvas,0,0);f.restore()}));if(u){f.save();f.strokeStyle="black";f.lineWidth=1;o.getTriangles().forEach((function(t,e,i){var r=t.target;var n=(r[0][0]-g[0])/a,s=-(r[0][1]-g[1])/a;var o=(r[1][0]-g[0])/a,h=-(r[1][1]-g[1])/a;var l=(r[2][0]-g[0])/a,u=-(r[2][1]-g[1])/a;f.beginPath();f.moveTo(o,h);f.lineTo(n,s);f.lineTo(l,u);f.closePath();f.stroke()}));f.restore()}return f.canvas};var ol=function(t,e,i,r,n){this.sourceProj_=t;this.targetProj_=e;var a={};var s=Ma.getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];if(!a[e]){a[e]=s(t)}return a[e]};this.maxSourceExtent_=r;this.errorThresholdSquared_=n*n;this.triangles_=[];this.wrapsXInSource_=false;this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&pa.getWidth(r)==pa.getWidth(this.sourceProj_.getExtent());this.sourceWorldWidth_=this.sourceProj_.getExtent()?pa.getWidth(this.sourceProj_.getExtent()):null;this.targetWorldWidth_=this.targetProj_.getExtent()?pa.getWidth(this.targetProj_.getExtent()):null;var o=pa.getTopLeft(i);var h=pa.getTopRight(i);var l=pa.getBottomRight(i);var u=pa.getBottomLeft(i);var f=this.transformInv_(o);var c=this.transformInv_(h);var d=this.transformInv_(l);var p=this.transformInv_(u);this.addQuad_(o,h,l,u,f,c,d,p,qn.RASTER_REPROJECTION_MAX_SUBDIVISION);if(this.wrapsXInSource_){var v=Infinity;this.triangles_.forEach((function(t,e,i){v=Math.min(v,t.source[0][0],t.source[1][0],t.source[2][0])}));this.triangles_.forEach((function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-v>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];if(e[0][0]-v>this.sourceWorldWidth_/2){e[0][0]-=this.sourceWorldWidth_}if(e[1][0]-v>this.sourceWorldWidth_/2){e[1][0]-=this.sourceWorldWidth_}if(e[2][0]-v>this.sourceWorldWidth_/2){e[2][0]-=this.sourceWorldWidth_}var i=Math.min(e[0][0],e[1][0],e[2][0]);var r=Math.max(e[0][0],e[1][0],e[2][0]);if(r-i<this.sourceWorldWidth_/2){t.source=e}}}),this)}a={}};ol.prototype.addTriangle_=function(t,e,i,r,n,a){this.triangles_.push({source:[r,n,a],target:[t,e,i]})};ol.prototype.addQuad_=function(t,e,i,r,n,a,s,o,h){var l=pa.boundingExtent([n,a,s,o]);var u=this.sourceWorldWidth_?pa.getWidth(l)/this.sourceWorldWidth_:null;var f=this.sourceWorldWidth_;var c=this.sourceProj_.canWrapX()&&u>.5&&u<1;var d=false;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){var p=pa.boundingExtent([t,e,i,r]);var v=pa.getWidth(p)/this.targetWorldWidth_;d|=v>qn.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}if(!c&&this.sourceProj_.isGlobal()&&u){d|=u>qn.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}}if(!d&&this.maxSourceExtent_){if(!pa.intersects(l,this.maxSourceExtent_)){return}}if(!d){if(!isFinite(n[0])||!isFinite(n[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])){if(h>0){d=true}else{return}}}if(h>0){if(!d){var _=[(t[0]+i[0])/2,(t[1]+i[1])/2];var g=this.transformInv_(_);var m;if(c){var y=(ha.modulo(n[0],f)+ha.modulo(s[0],f))/2;m=y-ha.modulo(g[0],f)}else{m=(n[0]+s[0])/2-g[0]}var E=(n[1]+s[1])/2-g[1];var x=m*m+E*E;d=x>this.errorThresholdSquared_}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var T=[(e[0]+i[0])/2,(e[1]+i[1])/2];var C=this.transformInv_(T);var R=[(r[0]+t[0])/2,(r[1]+t[1])/2];var M=this.transformInv_(R);this.addQuad_(t,e,T,R,n,a,C,M,h-1);this.addQuad_(R,T,i,r,M,C,s,o,h-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2];var I=this.transformInv_(S);var L=[(i[0]+r[0])/2,(i[1]+r[1])/2];var A=this.transformInv_(L);this.addQuad_(t,S,L,r,n,I,A,o,h-1);this.addQuad_(S,e,i,L,I,a,s,A,h-1)}return}}if(c){if(!this.canWrapXInSource_){return}this.wrapsXInSource_=true}this.addTriangle_(t,i,r,n,s,o);this.addTriangle_(t,e,i,n,a,s)};ol.prototype.calculateSourceExtent=function(){var t=pa.createEmpty();this.triangles_.forEach((function(e,i,r){var n=e.source;pa.extendCoordinate(t,n[0]);pa.extendCoordinate(t,n[1]);pa.extendCoordinate(t,n[2])}));return t};ol.prototype.getTriangles=function(){return this.triangles_};var hl=function(t,e,i,r,n,a,s,o,h,l,u){rl.call(this,n,us.IDLE);this.renderEdges_=u!==undefined?u:false;this.pixelRatio_=s;this.gutter_=o;this.canvas_=null;this.sourceTileGrid_=e;this.targetTileGrid_=r;this.wrappedTileCoord_=a?a:n;this.sourceTiles_=[];this.sourcesListenerKeys_=null;this.sourceZ_=0;var f=r.getTileCoordExtent(this.wrappedTileCoord_);var c=this.targetTileGrid_.getExtent();var d=this.sourceTileGrid_.getExtent();var p=c?pa.getIntersection(f,c):f;if(pa.getArea(p)===0){this.state=us.EMPTY;return}var v=t.getExtent();if(v){if(!d){d=v}else{d=pa.getIntersection(d,v)}}var _=r.getResolution(this.wrappedTileCoord_[0]);var g=pa.getCenter(p);var m=sl.calculateSourceResolution(t,i,g,_);if(!isFinite(m)||m<=0){this.state=us.EMPTY;return}var y=l!==undefined?l:qn.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD;this.triangulation_=new ol(t,i,p,d,m*y);if(this.triangulation_.getTriangles().length===0){this.state=us.EMPTY;return}this.sourceZ_=e.getZForResolution(m);var E=this.triangulation_.calculateSourceExtent();if(d){if(t.canWrapX()){E[1]=ha.clamp(E[1],d[1],d[3]);E[3]=ha.clamp(E[3],d[1],d[3])}else{E=pa.getIntersection(E,d)}}if(!pa.getArea(E)){this.state=us.EMPTY}else{var x=e.getTileRangeForExtentAndZ(E,this.sourceZ_);for(var T=x.minX;T<=x.maxX;T++){for(var C=x.minY;C<=x.maxY;C++){var R=h(this.sourceZ_,T,C,s);if(R){this.sourceTiles_.push(R)}}}if(this.sourceTiles_.length===0){this.state=us.EMPTY}}};qn.inherits(hl,rl);hl.prototype.disposeInternal=function(){if(this.state==us.LOADING){this.unlistenSources_()}rl.prototype.disposeInternal.call(this)};hl.prototype.getImage=function(){return this.canvas_};hl.prototype.reproject_=function(){var t=[];this.sourceTiles_.forEach((function(e,i,r){if(e&&e.getState()==us.LOADED){t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}}),this);this.sourceTiles_.length=0;if(t.length===0){this.state=us.ERROR}else{var e=this.wrappedTileCoord_[0];var i=this.targetTileGrid_.getTileSize(e);var r=typeof i==="number"?i:i[0];var n=typeof i==="number"?i:i[1];var a=this.targetTileGrid_.getResolution(e);var s=this.sourceTileGrid_.getResolution(this.sourceZ_);var o=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sl.render(r,n,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),a,o,this.triangulation_,t,this.gutter_,this.renderEdges_);this.state=us.LOADED}this.changed()};hl.prototype.load=function(){if(this.state==us.IDLE){this.state=us.LOADING;this.changed();var t=0;this.sourcesListenerKeys_=[];this.sourceTiles_.forEach((function(e,i,r){var n=e.getState();if(n==us.IDLE||n==us.LOADING){t++;var a;a=$n.listen(e,ra.CHANGE,(function(i){var r=e.getState();if(r==us.LOADED||r==us.ERROR||r==us.EMPTY){$n.unlistenByKey(a);t--;if(t===0){this.unlistenSources_();this.reproject_()}}}),this);this.sourcesListenerKeys_.push(a)}}),this);this.sourceTiles_.forEach((function(t,e,i){var r=t.getState();if(r==us.IDLE){t.load()}}));if(t===0){setTimeout(this.reproject_.bind(this),0)}}};hl.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach($n.unlistenByKey);this.sourcesListenerKeys_=null};var ll=function(t){this.minZoom=t.minZoom!==undefined?t.minZoom:0;this.resolutions_=t.resolutions;oa.assert(fa.isSorted(this.resolutions_,(function(t,e){return e-t}),true),17);var e;if(!t.origins){for(var i=0,r=this.resolutions_.length-1;i<r;++i){if(!e){e=this.resolutions_[i]/this.resolutions_[i+1]}else{if(this.resolutions_[i]/this.resolutions_[i+1]!==e){e=undefined;break}}}}this.zoomFactor_=e;this.maxZoom=this.resolutions_.length-1;this.origin_=t.origin!==undefined?t.origin:null;this.origins_=null;if(t.origins!==undefined){this.origins_=t.origins;oa.assert(this.origins_.length==this.resolutions_.length,20)}var n=t.extent;if(n!==undefined&&!this.origin_&&!this.origins_){this.origin_=pa.getTopLeft(n)}oa.assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18);this.tileSizes_=null;if(t.tileSizes!==undefined){this.tileSizes_=t.tileSizes;oa.assert(this.tileSizes_.length==this.resolutions_.length,19)}this.tileSize_=t.tileSize!==undefined?t.tileSize:!this.tileSizes_?qn.DEFAULT_TILE_SIZE:null;oa.assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22);this.extent_=n!==undefined?n:null;this.fullTileRanges_=null;this.tmpSize_=[0,0];if(t.sizes!==undefined){this.fullTileRanges_=t.sizes.map((function(t,e){var i=new Mo(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));return i}),this)}else if(n){this.calculateTileRanges_(n)}};ll.tmpTileCoord_=[0,0,0];ll.prototype.forEachTileCoord=function(t,e,i){var r=this.getTileRangeForExtentAndZ(t,e);for(var n=r.minX,a=r.maxX;n<=a;++n){for(var s=r.minY,o=r.maxY;s<=o;++s){i([e,n,s])}}};ll.prototype.forEachTileCoordParentTileRange=function(t,e,i,r,n){var a,s,o;var h=null;var l=t[0]-1;if(this.zoomFactor_===2){s=t[1];o=t[2]}else{h=this.getTileCoordExtent(t,n)}while(l>=this.minZoom){if(this.zoomFactor_===2){s=Math.floor(s/2);o=Math.floor(o/2);a=Mo.createOrUpdate(s,s,o,o,r)}else{a=this.getTileRangeForExtentAndZ(h,l,r)}if(e.call(i,l,a)){return true}--l}return false};ll.prototype.getExtent=function(){return this.extent_};ll.prototype.getMaxZoom=function(){return this.maxZoom};ll.prototype.getMinZoom=function(){return this.minZoom};ll.prototype.getOrigin=function(t){if(this.origin_){return this.origin_}else{return this.origins_[t]}};ll.prototype.getResolution=function(t){return this.resolutions_[t]};ll.prototype.getResolutions=function(){return this.resolutions_};ll.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){var r=t[1]*2;var n=t[2]*2;return Mo.createOrUpdate(r,r+1,n,n+1,e)}var a=this.getTileCoordExtent(t,i);return this.getTileRangeForExtentAndZ(a,t[0]+1,e)}return null};ll.prototype.getTileRangeExtent=function(t,e,i){var r=this.getOrigin(t);var n=this.getResolution(t);var a=ws.toSize(this.getTileSize(t),this.tmpSize_);var s=r[0]+e.minX*a[0]*n;var o=r[0]+(e.maxX+1)*a[0]*n;var h=r[1]+e.minY*a[1]*n;var l=r[1]+(e.maxY+1)*a[1]*n;return pa.createOrUpdate(s,h,o,l,i)};ll.prototype.getTileRangeForExtentAndZ=function(t,e,i){var r=ll.tmpTileCoord_;this.getTileCoordForXYAndZ_(t[0],t[1],e,false,r);var n=r[1];var a=r[2];this.getTileCoordForXYAndZ_(t[2],t[3],e,true,r);return Mo.createOrUpdate(n,r[1],a,r[2],i)};ll.prototype.getTileCoordCenter=function(t){var e=this.getOrigin(t[0]);var i=this.getResolution(t[0]);var r=ws.toSize(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]+(t[2]+.5)*r[1]*i]};ll.prototype.getTileCoordExtent=function(t,e){var i=this.getOrigin(t[0]);var r=this.getResolution(t[0]);var n=ws.toSize(this.getTileSize(t[0]),this.tmpSize_);var a=i[0]+t[1]*n[0]*r;var s=i[1]+t[2]*n[1]*r;var o=a+n[0]*r;var h=s+n[1]*r;return pa.createOrUpdate(a,s,o,h,e)};ll.prototype.getTileCoordForCoordAndResolution=function(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,false,i)};ll.prototype.getTileCoordForXYAndResolution_=function(t,e,i,r,n){var a=this.getZForResolution(i);var s=i/this.getResolution(a);var o=this.getOrigin(a);var h=ws.toSize(this.getTileSize(a),this.tmpSize_);var l=r?.5:0;var u=r?0:.5;var f=Math.floor((t-o[0])/i+l);var c=Math.floor((e-o[1])/i+u);var d=s*f/h[0];var p=s*c/h[1];if(r){d=Math.ceil(d)-1;p=Math.ceil(p)-1}else{d=Math.floor(d);p=Math.floor(p)}return el.createOrUpdate(a,d,p,n)};ll.prototype.getTileCoordForXYAndZ_=function(t,e,i,r,n){var a=this.getOrigin(i);var s=this.getResolution(i);var o=ws.toSize(this.getTileSize(i),this.tmpSize_);var h=r?.5:0;var l=r?0:.5;var u=Math.floor((t-a[0])/s+h);var f=Math.floor((e-a[1])/s+l);var c=u/o[0];var d=f/o[1];if(r){c=Math.ceil(c)-1;d=Math.ceil(d)-1}else{c=Math.floor(c);d=Math.floor(d)}return el.createOrUpdate(i,c,d,n)};ll.prototype.getTileCoordForCoordAndZ=function(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,false,i)};ll.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]};ll.prototype.getTileSize=function(t){if(this.tileSize_){return this.tileSize_}else{return this.tileSizes_[t]}};ll.prototype.getFullTileRange=function(t){if(!this.fullTileRanges_){return null}else{return this.fullTileRanges_[t]}};ll.prototype.getZForResolution=function(t,e){var i=fa.linearFindNearest(this.resolutions_,t,e||0);return ha.clamp(i,this.minZoom,this.maxZoom)};ll.prototype.calculateTileRanges_=function(t){var e=this.resolutions_.length;var i=new Array(e);for(var r=this.minZoom;r<e;++r){i[r]=this.getTileRangeForExtentAndZ(t,r)}this.fullTileRanges_=i};var ul={};ul.getForProjection=function(t){var e=t.getDefaultTileGrid();if(!e){e=ul.createForProjection(t);t.setDefaultTileGrid(e)}return e};ul.wrapX=function(t,e,i){var r=e[0];var n=t.getTileCoordCenter(e);var a=ul.extentFromProjection(i);if(!pa.containsCoordinate(a,n)){var s=pa.getWidth(a);var o=Math.ceil((a[0]-n[0])/s);n[0]+=s*o;return t.getTileCoordForCoordAndZ(n,r)}else{return e}};ul.createForExtent=function(t,e,i,r){var n=r!==undefined?r:ca.TOP_LEFT;var a=ul.resolutionsFromExtent(t,e,i);return new ll({extent:t,origin:pa.getCorner(t,n),resolutions:a,tileSize:i})};ul.createXYZ=function(t){var e={};Qn.assign(e,t!==undefined?t:{});if(e.extent===undefined){e.extent=Ma.get("EPSG:3857").getExtent()}e.resolutions=ul.resolutionsFromExtent(e.extent,e.maxZoom,e.tileSize);delete e.maxZoom;return new ll(e)};ul.resolutionsFromExtent=function(t,e,i){var r=e!==undefined?e:qn.DEFAULT_MAX_ZOOM;var n=pa.getHeight(t);var a=pa.getWidth(t);var s=ws.toSize(i!==undefined?i:qn.DEFAULT_TILE_SIZE);var o=Math.max(a/s[0],n/s[1]);var h=r+1;var l=new Array(h);for(var u=0;u<h;++u){l[u]=o/Math.pow(2,u)}return l};ul.createForProjection=function(t,e,i,r){var n=ul.extentFromProjection(t);return ul.createForExtent(n,e,i,r)};ul.extentFromProjection=function(t){t=Ma.get(t);var e=t.getExtent();if(!e){var i=180*Ma.METERS_PER_UNIT[ma.DEGREES]/t.getMetersPerUnit();e=pa.createOrUpdate(-i,-i,i,i)}return e};var fl=function(t){this.html_=t.html;this.tileRanges_=t.tileRanges?t.tileRanges:null};fl.prototype.getHTML=function(){return this.html_};fl.prototype.intersectsAnyTileRange=function(t,e,i){if(!this.tileRanges_){return true}var r,n,a,s;for(s in t){if(!(s in this.tileRanges_)){continue}a=t[s];var o;for(r=0,n=this.tileRanges_[s].length;r<n;++r){o=this.tileRanges_[s][r];if(o.intersects(a)){return true}var h=e.getTileRangeForExtentAndZ(ul.extentFromProjection(i),parseInt(s,10));var l=h.getWidth();if(a.minX<h.minX||a.maxX>h.maxX){if(o.intersects(new Mo(ha.modulo(a.minX,l),ha.modulo(a.maxX,l),a.minY,a.maxY))){return true}if(a.getWidth()>l&&o.intersects(h)){return true}}}}return false};var cl=function(t){aa.call(this);this.projection_=Ma.get(t.projection);this.attributions_=null;this.attributions2_=this.adaptAttributions_(t.attributions);this.logo_=t.logo;this.state_=t.state!==undefined?t.state:Ms.READY;this.wrapX_=t.wrapX!==undefined?t.wrapX:false};qn.inherits(cl,aa);cl.prototype.adaptAttributions_=function(t){if(!t){return null}if(t instanceof fl){this.attributions_=[t];return function(e){return[t.getHTML()]}}if(Array.isArray(t)){if(t[0]instanceof fl){this.attributions_=t;var e=t.map((function(t){return t.getHTML()}));return function(t){return e}}this.attributions_=t.map((function(t){return new fl({html:t})}));return function(e){return t}}if(typeof t==="function"){return t}this.attributions_=[new fl({html:t})];return function(e){return[t]}};cl.prototype.forEachFeatureAtCoordinate=qn.nullFunction;cl.prototype.getAttributions=function(){return this.attributions_};cl.prototype.getAttributions2=function(){return this.attributions2_};cl.prototype.getLogo=function(){return this.logo_};cl.prototype.getProjection=function(){return this.projection_};cl.prototype.getResolutions=function(){};cl.prototype.getState=function(){return this.state_};cl.prototype.getWrapX=function(){return this.wrapX_};cl.prototype.refresh=function(){this.changed()};cl.prototype.setAttributions=function(t){this.attributions2_=this.adaptAttributions_(t);this.changed()};cl.prototype.setLogo=function(t){this.logo_=t};cl.prototype.setState=function(t){this.state_=t;this.changed()};var dl=function(t){cl.call(this,{attributions:t.attributions,extent:t.extent,logo:t.logo,projection:t.projection,state:t.state,wrapX:t.wrapX});this.opaque_=t.opaque!==undefined?t.opaque:false;this.tilePixelRatio_=t.tilePixelRatio!==undefined?t.tilePixelRatio:1;this.tileGrid=t.tileGrid!==undefined?t.tileGrid:null;this.tileCache=new al(t.cacheSize);this.tmpSize=[0,0];this.key_="";this.tileOptions={transition:t.transition}};qn.inherits(dl,cl);dl.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()};dl.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);if(i){i.expireCache(e)}};dl.prototype.forEachLoadedTile=function(t,e,i,r){var n=this.getTileCacheForProjection(t);if(!n){return false}var a=true;var s,o,h;for(var l=i.minX;l<=i.maxX;++l){for(var u=i.minY;u<=i.maxY;++u){o=el.getKeyZXY(e,l,u);h=false;if(n.containsKey(o)){s=n.get(o);h=s.getState()===us.LOADED;if(h){h=r(s)!==false}}if(!h){a=false}}}return a};dl.prototype.getGutter=function(t){return 0};dl.prototype.getKey=function(){return this.key_};dl.prototype.setKey=function(t){if(this.key_!==t){this.key_=t;this.changed()}};dl.prototype.getOpaque=function(t){return this.opaque_};dl.prototype.getResolutions=function(){return this.tileGrid.getResolutions()};dl.prototype.getTile=function(t,e,i,r,n){};dl.prototype.getTileGrid=function(){return this.tileGrid};dl.prototype.getTileGridForProjection=function(t){if(!this.tileGrid){return ul.getForProjection(t)}else{return this.tileGrid}};dl.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(e&&!Ma.equivalent(e,t)){return null}else{return this.tileCache}};dl.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_};dl.prototype.getTilePixelSize=function(t,e,i){var r=this.getTileGridForProjection(i);var n=this.getTilePixelRatio(e);var a=ws.toSize(r.getTileSize(t),this.tmpSize);if(n==1){return a}else{return ws.scale(a,n,this.tmpSize)}};dl.prototype.getTileCoordForTileUrlFunction=function(t,e){var i=e!==undefined?e:this.getProjection();var r=this.getTileGridForProjection(i);if(this.getWrapX()&&i.isGlobal()){t=ul.wrapX(r,t,i)}return el.withinExtentAndZ(t,r)?t:null};dl.prototype.refresh=function(){this.tileCache.clear();this.changed()};dl.prototype.useTile=qn.nullFunction;dl.Event=function(t,e){ea.call(this,t);this.tile=e};qn.inherits(dl.Event,ea);var pl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var vl=function(t){dl.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition});this.tileLoadFunction=t.tileLoadFunction;this.tileUrlFunction=this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.nullTileUrlFunction;this.urls=null;if(t.urls){this.setUrls(t.urls)}else if(t.url){this.setUrl(t.url)}if(t.tileUrlFunction){this.setTileUrlFunction(t.tileUrlFunction)}this.tileLoadingKeys_={}};qn.inherits(vl,dl);vl.prototype.getTileLoadFunction=function(){return this.tileLoadFunction};vl.prototype.getTileUrlFunction=function(){return this.tileUrlFunction};vl.prototype.getUrls=function(){return this.urls};vl.prototype.handleTileChange=function(t){var e=t.target;var i=qn.getUid(e);var r=e.getState();var n;if(r==us.LOADING){this.tileLoadingKeys_[i]=true;n=pl.TILELOADSTART}else if(i in this.tileLoadingKeys_){delete this.tileLoadingKeys_[i];n=r==us.ERROR?pl.TILELOADERROR:r==us.LOADED||r==us.ABORT?pl.TILELOADEND:undefined}if(n!=undefined){this.dispatchEvent(new dl.Event(n,e))}};vl.prototype.setTileLoadFunction=function(t){this.tileCache.clear();this.tileLoadFunction=t;this.changed()};vl.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t;this.tileCache.pruneExceptNewestZ();if(typeof e!=="undefined"){this.setKey(e)}else{this.changed()}};vl.prototype.setUrl=function(t){var e=this.urls=il.expandUrl(t);this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTemplates(e,this.tileGrid),t)};vl.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTemplates(t,this.tileGrid),e)};vl.prototype.useTile=function(t,e,i){var r=el.getKeyZXY(t,e,i);if(this.tileCache.containsKey(r)){this.tileCache.get(r)}};var _l=function(t){vl.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:_l.defaultTileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition});this.crossOrigin=t.crossOrigin!==undefined?t.crossOrigin:null;this.tileClass=t.tileClass!==undefined?t.tileClass:nl;this.tileCacheForProjection={};this.tileGridForProjection={};this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold;this.renderReprojectionEdges_=false};qn.inherits(_l,vl);_l.prototype.canExpireCache=function(){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.canExpireCache.call(this)}if(this.tileCache.canExpireCache()){return true}else{for(var t in this.tileCacheForProjection){if(this.tileCacheForProjection[t].canExpireCache()){return true}}}return false};_l.prototype.expireCache=function(t,e){if(!qn.ENABLE_RASTER_REPROJECTION){vl.prototype.expireCache.call(this,t,e);return}var i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(var r in this.tileCacheForProjection){var n=this.tileCacheForProjection[r];n.expireCache(n==i?e:{})}};_l.prototype.getGutter=function(t){if(qn.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Ma.equivalent(this.getProjection(),t)){return 0}else{return this.getGutterInternal()}};_l.prototype.getGutterInternal=function(){return 0};_l.prototype.getOpaque=function(t){if(qn.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Ma.equivalent(this.getProjection(),t)){return false}else{return vl.prototype.getOpaque.call(this,t)}};_l.prototype.getTileGridForProjection=function(t){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.getTileGridForProjection.call(this,t)}var e=this.getProjection();if(this.tileGrid&&(!e||Ma.equivalent(e,t))){return this.tileGrid}else{var i=qn.getUid(t).toString();if(!(i in this.tileGridForProjection)){this.tileGridForProjection[i]=ul.getForProjection(t)}return this.tileGridForProjection[i]}};_l.prototype.getTileCacheForProjection=function(t){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.getTileCacheForProjection.call(this,t)}var e=this.getProjection();if(!e||Ma.equivalent(e,t)){return this.tileCache}else{var i=qn.getUid(t).toString();if(!(i in this.tileCacheForProjection)){this.tileCacheForProjection[i]=new al(this.tileCache.highWaterMark)}return this.tileCacheForProjection[i]}};_l.prototype.createTile_=function(t,e,i,r,n,a){var s=[t,e,i];var o=this.getTileCoordForTileUrlFunction(s,n);var h=o?this.tileUrlFunction(o,r,n):undefined;var l=new this.tileClass(s,h!==undefined?us.IDLE:us.EMPTY,h!==undefined?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);l.key=a;$n.listen(l,ra.CHANGE,this.handleTileChange,this);return l};_l.prototype.getTile=function(t,e,i,r,n){var a=this.getProjection();if(!qn.ENABLE_RASTER_REPROJECTION||!a||!n||Ma.equivalent(a,n)){return this.getTileInternal(t,e,i,r,a||n)}else{var s=this.getTileCacheForProjection(n);var o=[t,e,i];var h;var l=el.getKey(o);if(s.containsKey(l)){h=s.get(l)}var u=this.getKey();if(h&&h.key==u){return h}else{var f=this.getTileGridForProjection(a);var c=this.getTileGridForProjection(n);var d=this.getTileCoordForTileUrlFunction(o,n);var p=new hl(a,f,n,c,o,d,this.getTilePixelRatio(r),this.getGutterInternal(),function(t,e,i,r){return this.getTileInternal(t,e,i,r,a)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);p.key=u;if(h){p.interimTile=h;p.refreshInterimChain();s.replace(l,p)}else{s.set(l,p)}return p}}};_l.prototype.getTileInternal=function(t,e,i,r,n){var a=null;var s=el.getKeyZXY(t,e,i);var o=this.getKey();if(!this.tileCache.containsKey(s)){a=this.createTile_(t,e,i,r,n,o);this.tileCache.set(s,a)}else{a=this.tileCache.get(s);if(a.key!=o){var h=a;a=this.createTile_(t,e,i,r,n,o);if(h.getState()==us.IDLE){a.interimTile=h.interimTile}else{a.interimTile=h}a.refreshInterimChain();this.tileCache.replace(s,a)}}return a};_l.prototype.setRenderReprojectionEdges=function(t){if(!qn.ENABLE_RASTER_REPROJECTION||this.renderReprojectionEdges_==t){return}this.renderReprojectionEdges_=t;for(var e in this.tileCacheForProjection){this.tileCacheForProjection[e].clear()}this.changed()};_l.prototype.setTileGridForProjection=function(t,e){if(qn.ENABLE_RASTER_REPROJECTION){var i=Ma.get(t);if(i){var r=qn.getUid(i).toString();if(!(r in this.tileGridForProjection)){this.tileGridForProjection[r]=e}}}};_l.defaultTileLoadFunction=function(t,e){t.getImage().src=e};var gl={KVP:"KVP",REST:"REST"};var ml=function(t){this.matrixIds_=t.matrixIds;ll.call(this,{extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes})};qn.inherits(ml,ll);ml.prototype.getMatrixId=function(t){return this.matrixIds_[t]};ml.prototype.getMatrixIds=function(){return this.matrixIds_};ml.createFromCapabilitiesMatrixSet=function(t,e,i){var r=[];var n=[];var a=[];var s=[];var o=[];var h=i!==undefined?i:[];var l="SupportedCRS";var u="TileMatrix";var f="Identifier";var c="ScaleDenominator";var d="TopLeftCorner";var p="TileWidth";var v="TileHeight";var _=t[l];var g=Ma.get(_.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(_);var m=g.getMetersPerUnit();var y=g.getAxisOrientation().substr(0,2)=="ne";t[u].sort((function(t,e){return e[c]-t[c]}));t[u].forEach((function(t,e,i){var l;if(h.length>0){l=fa.find(h,(function(e,i,r){return t[f]==e[u]}))}else{l=true}if(l){n.push(t[f]);var _=t[c]*28e-5/m;var g=t[p];var E=t[v];if(y){a.push([t[d][1],t[d][0]])}else{a.push(t[d])}r.push(_);s.push(g==E?g:[g,E]);o.push([t["MatrixWidth"],-t["MatrixHeight"]])}}));return new ml({extent:e,origins:a,resolutions:r,matrixIds:n,tileSizes:s,sizes:o})};var yl={};yl.appendParams=function(t,e){var i=[];Object.keys(e).forEach((function(t){if(e[t]!==null&&e[t]!==undefined){i.push(t+"="+encodeURIComponent(e[t]))}}));var r=i.join("&");t=t.replace(/[?&]$/,"");t=t.indexOf("?")===-1?t+"?":t+"&";return t+r};var El=function(t){this.version_=t.version!==undefined?t.version:"1.0.0";this.format_=t.format!==undefined?t.format:"image/jpeg";this.dimensions_=t.dimensions!==undefined?t.dimensions:{};this.layer_=t.layer;this.matrixSet_=t.matrixSet;this.style_=t.style;var e=t.urls;if(e===undefined&&t.url!==undefined){e=il.expandUrl(t.url)}this.requestEncoding_=t.requestEncoding!==undefined?t.requestEncoding:gl.KVP;var i=this.requestEncoding_;var r=t.tileGrid;var n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};if(i==gl.KVP){Qn.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_})}var a=this.dimensions_;this.createFromWMTSTemplate_=function(t){t=i==gl.KVP?yl.appendParams(t,n):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in n?n[e.toLowerCase()]:t}));return function(e,n,s){if(!e){return undefined}else{var o={TileMatrix:r.getMatrixId(e[0]),TileCol:e[1],TileRow:-e[2]-1};Qn.assign(o,a);var h=t;if(i==gl.KVP){h=yl.appendParams(h,o)}else{h=h.replace(/\{(\w+?)\}/g,(function(t,e){return o[e]}))}return h}}};var s=e&&e.length>0?il.createFromTileUrlFunctions(e.map(this.createFromWMTSTemplate_)):il.nullTileUrlFunction;_l.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,logo:t.logo,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:r,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:s,urls:e,wrapX:t.wrapX!==undefined?t.wrapX:false,transition:t.transition});this.setKey(this.getKeyForDimensions_())};qn.inherits(El,_l);El.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTileUrlFunctions(t.map(this.createFromWMTSTemplate_.bind(this))),e)};El.prototype.getDimensions=function(){return this.dimensions_};El.prototype.getFormat=function(){return this.format_};El.prototype.getLayer=function(){return this.layer_};El.prototype.getMatrixSet=function(){return this.matrixSet_};El.prototype.getRequestEncoding=function(){return this.requestEncoding_};El.prototype.getStyle=function(){return this.style_};El.prototype.getVersion=function(){return this.version_};El.prototype.getKeyForDimensions_=function(){var t=0;var e=[];for(var i in this.dimensions_){e[t++]=i+"-"+this.dimensions_[i]}return e.join("/")};El.prototype.updateDimensions=function(t){Qn.assign(this.dimensions_,t);this.setKey(this.getKeyForDimensions_())};El.optionsFromCapabilities=function(t,e){var i=t["Contents"]["Layer"];var r=fa.find(i,(function(t,i,r){return t["Identifier"]==e["layer"]}));if(r===null){return null}var n=t["Contents"]["TileMatrixSet"];var a,s,o;if(r["TileMatrixSetLink"].length>1){if("projection"in e){a=fa.findIndex(r["TileMatrixSetLink"],(function(t,i,r){var a=fa.find(n,(function(e){return e["Identifier"]==t["TileMatrixSet"]}));var s=a["SupportedCRS"];var o=Ma.get(s.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(s);var h=Ma.get(e["projection"]);if(o&&h){return Ma.equivalent(o,h)}else{return s==e["projection"]}}))}else{a=fa.findIndex(r["TileMatrixSetLink"],(function(t,i,r){return t["TileMatrixSet"]==e["matrixSet"]}))}}else{a=0}if(a<0){a=0}s=r["TileMatrixSetLink"][a]["TileMatrixSet"];o=r["TileMatrixSetLink"][a]["TileMatrixSetLimits"];var h=r["Format"][0];if("format"in e){h=e["format"]}a=fa.findIndex(r["Style"],(function(t,i,r){if("style"in e){return t["Title"]==e["style"]}else{return t["isDefault"]}}));if(a<0){a=0}var l=r["Style"][a]["Identifier"];var u={};if("Dimension"in r){r["Dimension"].forEach((function(t,e,i){var r=t["Identifier"];var n=t["Default"];if(n===undefined){n=t["Value"][0]}u[r]=n}))}var f=t["Contents"]["TileMatrixSet"];var c=fa.find(f,(function(t,e,i){return t["Identifier"]==s}));var d;var p=c["SupportedCRS"];if(p){d=Ma.get(p.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(p)}if("projection"in e){var v=Ma.get(e["projection"]);if(v){if(!d||Ma.equivalent(v,d)){d=v}}}var _=r["WGS84BoundingBox"];var g,m;if(_!==undefined){var y=Ma.get("EPSG:4326").getExtent();m=_[0]==y[0]&&_[2]==y[2];g=Ma.transformExtent(_,"EPSG:4326",d);var E=d.getExtent();if(E){if(!pa.containsExtent(E,g)){g=undefined}}}var x=ml.createFromCapabilitiesMatrixSet(c,g,o);var T=[];var C=e["requestEncoding"];C=C!==undefined?C:"";if("OperationsMetadata"in t&&"GetTile"in t["OperationsMetadata"]){var R=t["OperationsMetadata"]["GetTile"]["DCP"]["HTTP"]["Get"];for(var M=0,S=R.length;M<S;++M){if(R[M]["Constraint"]){var I=fa.find(R[M]["Constraint"],(function(t){return t["name"]=="GetEncoding"}));var L=I["AllowedValues"]["Value"];if(C===""){C=L[0]}if(C===gl.KVP){if(fa.includes(L,gl.KVP)){T.push(R[M]["href"])}}else{break}}else if(R[M]["href"]){C=gl.KVP;T.push(R[M]["href"])}}}if(T.length===0){C=gl.REST;r["ResourceURL"].forEach((function(t){if(t["resourceType"]==="tile"){h=t["format"];T.push(t["template"])}}))}return{urls:T,layer:e["layer"],matrixSet:s,format:h,projection:d,requestEncoding:C,tileGrid:x,style:l,dimensions:u,wrapX:m,crossOrigin:e["crossOrigin"]}};var xl={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var Tl={};Tl.DOCUMENT=document.implementation.createDocument("","",null);Tl.createElementNS=function(t,e){return Tl.DOCUMENT.createElementNS(t,e)};Tl.getAllTextContent=function(t,e){return Tl.getAllTextContent_(t,e,[]).join("")};Tl.getAllTextContent_=function(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE){if(e){i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,""))}else{i.push(t.nodeValue)}}else{var r;for(r=t.firstChild;r;r=r.nextSibling){Tl.getAllTextContent_(r,e,i)}}return i};Tl.isDocument=function(t){return t instanceof Document};Tl.isNode=function(t){return t instanceof Node};Tl.getAttributeNS=function(t,e,i){return t.getAttributeNS(e,i)||""};Tl.setAttributeNS=function(t,e,i,r){t.setAttributeNS(e,i,r)};Tl.parse=function(t){return(new DOMParser).parseFromString(t,"application/xml")};Tl.makeArrayExtender=function(t,e){return function(i,r){var n=t.call(e,i,r);if(n!==undefined){var a=r[r.length-1];fa.extend(a,n)}}};Tl.makeArrayPusher=function(t,e){return function(i,r){var n=t.call(e!==undefined?e:this,i,r);if(n!==undefined){var a=r[r.length-1];a.push(n)}}};Tl.makeReplacer=function(t,e){return function(i,r){var n=t.call(e!==undefined?e:this,i,r);if(n!==undefined){r[r.length-1]=n}}};Tl.makeObjectPropertyPusher=function(t,e,i){return function(r,n){var a=t.call(i!==undefined?i:this,r,n);if(a!==undefined){var s=n[n.length-1];var o=e!==undefined?e:r.localName;var h;if(o in s){h=s[o]}else{h=s[o]=[]}h.push(a)}}};Tl.makeObjectPropertySetter=function(t,e,i){return function(r,n){var a=t.call(i!==undefined?i:this,r,n);if(a!==undefined){var s=n[n.length-1];var o=e!==undefined?e:r.localName;s[o]=a}}};Tl.makeChildAppender=function(t,e){return function(i,r,n){t.call(e!==undefined?e:this,i,r,n);var a=n[n.length-1];var s=a.node;s.appendChild(i)}};Tl.makeArraySerializer=function(t,e){var i,r;return function(e,n,a){if(i===undefined){i={};var s={};s[e.localName]=t;i[e.namespaceURI]=s;r=Tl.makeSimpleNodeFactory(e.localName)}Tl.serialize(i,r,n,a)}};Tl.makeSimpleNodeFactory=function(t,e){var i=t;return function(t,r,n){var a=r[r.length-1];var s=a.node;var o=i;if(o===undefined){o=n}var h=e;if(e===undefined){h=s.namespaceURI}return Tl.createElementNS(h,o)}};Tl.OBJECT_PROPERTY_NODE_FACTORY=Tl.makeSimpleNodeFactory();Tl.makeSequence=function(t,e){var i=e.length;var r=new Array(i);for(var n=0;n<i;++n){r[n]=t[e[n]]}return r};Tl.makeStructureNS=function(t,e,i){var r=i!==undefined?i:{};var n,a;for(n=0,a=t.length;n<a;++n){r[t[n]]=e}return r};Tl.parseNode=function(t,e,i,r){var n;for(n=e.firstElementChild;n;n=n.nextElementSibling){var a=t[n.namespaceURI];if(a!==undefined){var s=a[n.localName];if(s!==undefined){s.call(r,n,i)}}}};Tl.pushParseAndPop=function(t,e,i,r,n){r.push(t);Tl.parseNode(e,i,r,n);return r.pop()};Tl.serialize=function(t,e,i,r,n,a){var s=(n!==undefined?n:i).length;var o,h;for(var l=0;l<s;++l){o=i[l];if(o!==undefined){h=e.call(a,o,r,n!==undefined?n[l]:undefined);if(h!==undefined){t[h.namespaceURI][h.localName].call(a,h,o,r)}}}};Tl.pushSerializeAndPop=function(t,e,i,r,n,a,s){n.push(t);Tl.serialize(e,i,r,n,a,s);return n.pop()};var Cl={};Cl.loadFeaturesXhr=function(t,e,i,r){return function(n,a,s){var o=new XMLHttpRequest;o.open("GET",typeof t==="function"?t(n,a,s):t,true);if(e.getType()==xl.ARRAY_BUFFER){o.responseType="arraybuffer"}o.onload=function(t){if(!o.status||o.status>=200&&o.status<300){var n=e.getType();var a;if(n==xl.JSON||n==xl.TEXT){a=o.responseText}else if(n==xl.XML){a=o.responseXML;if(!a){a=Tl.parse(o.responseText)}}else if(n==xl.ARRAY_BUFFER){a=o.response}if(a){i.call(this,e.readFeatures(a,{featureProjection:s}),e.readProjection(a),e.getLastExtent())}else{r.call(this)}}else{r.call(this)}}.bind(this);o.onerror=function(){r.call(this)}.bind(this);o.send()}};Cl.xhr=function(t,e){return Cl.loadFeaturesXhr(t,e,(function(t,e){this.addFeatures(t)}),qn.nullFunction)};var Rl={};Rl.all=function(t,e){return[[-Infinity,-Infinity,Infinity,Infinity]]};Rl.bbox=function(t,e){return[t]};Rl.tile=function(t){return function(e,i){var r=t.getZForResolution(i);var n=t.getTileRangeForExtentAndZ(e,r);var a=[];var s=[r,0,0];for(s[1]=n.minX;s[1]<=n.maxX;++s[1]){for(s[2]=n.minY;s[2]<=n.maxY;++s[2]){a.push(t.getTileCoordExtent(s))}}return a}};var Ml={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"};var Sl=function(t){var e=t||{};cl.call(this,{attributions:e.attributions,logo:e.logo,projection:undefined,state:Ms.READY,wrapX:e.wrapX!==undefined?e.wrapX:true});this.loader_=qn.nullFunction;this.format_=e.format;this.overlaps_=e.overlaps==undefined?true:e.overlaps;this.url_=e.url;if(e.loader!==undefined){this.loader_=e.loader}else if(this.url_!==undefined){oa.assert(this.format_,7);this.loader_=Cl.xhr(this.url_,this.format_)}this.strategy_=e.strategy!==undefined?e.strategy:Rl.all;var i=e.useSpatialIndex!==undefined?e.useSpatialIndex:true;this.featuresRtree_=i?new bh:null;this.loadedExtentsRtree_=new bh;this.nullGeometryFeatures_={};this.idIndex_={};this.undefIdIndex_={};this.featureChangeKeys_={};this.featuresCollection_=null;var r,n;if(e.features instanceof Ka){r=e.features;n=r.getArray()}else if(Array.isArray(e.features)){n=e.features}if(!i&&r===undefined){r=new Ka(n)}if(n!==undefined){this.addFeaturesInternal(n)}if(r!==undefined){this.bindFeaturesCollection_(r)}};qn.inherits(Sl,cl);Sl.prototype.addFeature=function(t){this.addFeatureInternal(t);this.changed()};Sl.prototype.addFeatureInternal=function(t){var e=qn.getUid(t).toString();if(!this.addToIndex_(e,t)){return}this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var r=i.getExtent();if(this.featuresRtree_){this.featuresRtree_.insert(r,t)}}else{this.nullGeometryFeatures_[e]=t}this.dispatchEvent(new Sl.Event(Ml.ADDFEATURE,t))};Sl.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[$n.listen(e,ra.CHANGE,this.handleFeatureChange_,this),$n.listen(e,Jn.PROPERTYCHANGE,this.handleFeatureChange_,this)]};Sl.prototype.addToIndex_=function(t,e){var i=true;var r=e.getId();if(r!==undefined){if(!(r.toString()in this.idIndex_)){this.idIndex_[r.toString()]=e}else{i=false}}else{oa.assert(!(t in this.undefIdIndex_),30);this.undefIdIndex_[t]=e}return i};Sl.prototype.addFeatures=function(t){this.addFeaturesInternal(t);this.changed()};Sl.prototype.addFeaturesInternal=function(t){var e,i,r,n;var a=[];var s=[];var o=[];for(i=0,r=t.length;i<r;i++){n=t[i];e=qn.getUid(n).toString();if(this.addToIndex_(e,n)){s.push(n)}}for(i=0,r=s.length;i<r;i++){n=s[i];e=qn.getUid(n).toString();this.setupChangeEvents_(e,n);var h=n.getGeometry();if(h){var l=h.getExtent();a.push(l);o.push(n)}else{this.nullGeometryFeatures_[e]=n}}if(this.featuresRtree_){this.featuresRtree_.load(a,o)}for(i=0,r=s.length;i<r;i++){this.dispatchEvent(new Sl.Event(Ml.ADDFEATURE,s[i]))}};Sl.prototype.bindFeaturesCollection_=function(t){var e=false;$n.listen(this,Ml.ADDFEATURE,(function(i){if(!e){e=true;t.push(i.feature);e=false}}));$n.listen(this,Ml.REMOVEFEATURE,(function(i){if(!e){e=true;t.remove(i.feature);e=false}}));$n.listen(t,Ha.ADD,(function(t){if(!e){e=true;this.addFeature(t.element);e=false}}),this);$n.listen(t,Ha.REMOVE,(function(t){if(!e){e=true;this.removeFeature(t.element);e=false}}),this);this.featuresCollection_=t};Sl.prototype.clear=function(t){if(t){for(var e in this.featureChangeKeys_){var i=this.featureChangeKeys_[e];i.forEach($n.unlistenByKey)}if(!this.featuresCollection_){this.featureChangeKeys_={};this.idIndex_={};this.undefIdIndex_={}}}else{if(this.featuresRtree_){this.featuresRtree_.forEach(this.removeFeatureInternal,this);for(var r in this.nullGeometryFeatures_){this.removeFeatureInternal(this.nullGeometryFeatures_[r])}}}if(this.featuresCollection_){this.featuresCollection_.clear()}if(this.featuresRtree_){this.featuresRtree_.clear()}this.loadedExtentsRtree_.clear();this.nullGeometryFeatures_={};var n=new Sl.Event(Ml.CLEAR);this.dispatchEvent(n);this.changed()};Sl.prototype.forEachFeature=function(t,e){if(this.featuresRtree_){return this.featuresRtree_.forEach(t,e)}else if(this.featuresCollection_){return this.featuresCollection_.forEach(t,e)}};Sl.prototype.forEachFeatureAtCoordinateDirect=function(t,e,i){var r=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(r,(function(r){var n=r.getGeometry();if(n.intersectsCoordinate(t)){return e.call(i,r)}else{return undefined}}))};Sl.prototype.forEachFeatureInExtent=function(t,e,i){if(this.featuresRtree_){return this.featuresRtree_.forEachInExtent(t,e,i)}else if(this.featuresCollection_){return this.featuresCollection_.forEach(e,i)}};Sl.prototype.forEachFeatureIntersectingExtent=function(t,e,i){return this.forEachFeatureInExtent(t,(function(r){var n=r.getGeometry();if(n.intersectsExtent(t)){var a=e.call(i,r);if(a){return a}}}))};Sl.prototype.getFeaturesCollection=function(){return this.featuresCollection_};Sl.prototype.getFeatures=function(){var t;if(this.featuresCollection_){t=this.featuresCollection_.getArray()}else if(this.featuresRtree_){t=this.featuresRtree_.getAll();if(!Qn.isEmpty(this.nullGeometryFeatures_)){fa.extend(t,Qn.getValues(this.nullGeometryFeatures_))}}return t};Sl.prototype.getFeaturesAtCoordinate=function(t){var e=[];this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)}));return e};Sl.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_.getInExtent(t)};Sl.prototype.getClosestFeatureToCoordinate=function(t,e){var i=t[0];var r=t[1];var n=null;var a=[NaN,NaN];var s=Infinity;var o=[-Infinity,-Infinity,Infinity,Infinity];var h=e?e:_a.TRUE;this.featuresRtree_.forEachInExtent(o,(function(t){if(h(t)){var e=t.getGeometry();var l=s;s=e.closestPointXY(i,r,a,s);if(s<l){n=t;var u=Math.sqrt(s);o[0]=i-u;o[1]=r-u;o[2]=i+u;o[3]=r+u}}}));return n};Sl.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)};Sl.prototype.getFeatureById=function(t){var e=this.idIndex_[t.toString()];return e!==undefined?e:null};Sl.prototype.getFormat=function(){return this.format_};Sl.prototype.getOverlaps=function(){return this.overlaps_};Sl.prototype.getResolutions=function(){};Sl.prototype.getUrl=function(){return this.url_};Sl.prototype.handleFeatureChange_=function(t){var e=t.target;var i=qn.getUid(e).toString();var r=e.getGeometry();if(!r){if(!(i in this.nullGeometryFeatures_)){if(this.featuresRtree_){this.featuresRtree_.remove(e)}this.nullGeometryFeatures_[i]=e}}else{var n=r.getExtent();if(i in this.nullGeometryFeatures_){delete this.nullGeometryFeatures_[i];if(this.featuresRtree_){this.featuresRtree_.insert(n,e)}}else{if(this.featuresRtree_){this.featuresRtree_.update(n,e)}}}var a=e.getId();if(a!==undefined){var s=a.toString();if(i in this.undefIdIndex_){delete this.undefIdIndex_[i];this.idIndex_[s]=e}else{if(this.idIndex_[s]!==e){this.removeFromIdIndex_(e);this.idIndex_[s]=e}}}else{if(!(i in this.undefIdIndex_)){this.removeFromIdIndex_(e);this.undefIdIndex_[i]=e}}this.changed();this.dispatchEvent(new Sl.Event(Ml.CHANGEFEATURE,e))};Sl.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&Qn.isEmpty(this.nullGeometryFeatures_)};Sl.prototype.loadFeatures=function(t,e,i){var r=this.loadedExtentsRtree_;var n=this.strategy_(t,e);var a,s;for(a=0,s=n.length;a<s;++a){var o=n[a];var h=r.forEachInExtent(o,(function(t){return pa.containsExtent(t.extent,o)}));if(!h){this.loader_.call(this,o,e,i);r.insert(o,{extent:o.slice()})}}};Sl.prototype.removeLoadedExtent=function(t){var e=this.loadedExtentsRtree_;var i;e.forEachInExtent(t,(function(e){if(pa.equals(e.extent,t)){i=e;return true}}));if(i){e.remove(i)}};Sl.prototype.removeFeature=function(t){var e=qn.getUid(t).toString();if(e in this.nullGeometryFeatures_){delete this.nullGeometryFeatures_[e]}else{if(this.featuresRtree_){this.featuresRtree_.remove(t)}}this.removeFeatureInternal(t);this.changed()};Sl.prototype.removeFeatureInternal=function(t){var e=qn.getUid(t).toString();this.featureChangeKeys_[e].forEach($n.unlistenByKey);delete this.featureChangeKeys_[e];var i=t.getId();if(i!==undefined){delete this.idIndex_[i.toString()]}else{delete this.undefIdIndex_[e]}this.dispatchEvent(new Sl.Event(Ml.REMOVEFEATURE,t))};Sl.prototype.removeFromIdIndex_=function(t){var e=false;for(var i in this.idIndex_){if(this.idIndex_[i]===t){delete this.idIndex_[i];e=true;break}}return e};Sl.prototype.setLoader=function(t){this.loader_=t};Sl.Event=function(t,e){ea.call(this,t);this.feature=e};qn.inherits(Sl.Event,ea);var Il={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var Ll=function(t){var e=t?t:{};var i=Qn.assign({},e);delete i.preload;delete i.useInterimTilesOnError;Fs.call(this,i);this.setPreload(e.preload!==undefined?e.preload:0);this.setUseInterimTilesOnError(e.useInterimTilesOnError!==undefined?e.useInterimTilesOnError:true);this.type=oo.TILE};qn.inherits(Ll,Fs);Ll.prototype.getPreload=function(){return this.get(Il.PRELOAD)};Ll.prototype.setPreload=function(t){this.set(Il.PRELOAD,t)};Ll.prototype.getUseInterimTilesOnError=function(){return this.get(Il.USE_INTERIM_TILES_ON_ERROR)};Ll.prototype.setUseInterimTilesOnError=function(t){this.set(Il.USE_INTERIM_TILES_ON_ERROR,t)};var Al=function(t){var e=t?t:{};var i=Qn.assign({},e);delete i.style;delete i.renderBuffer;delete i.updateWhileAnimating;delete i.updateWhileInteracting;Fs.call(this,i);this.declutter_=e.declutter!==undefined?e.declutter:false;this.renderBuffer_=e.renderBuffer!==undefined?e.renderBuffer:100;this.style_=null;this.styleFunction_=undefined;this.setStyle(e.style);this.updateWhileAnimating_=e.updateWhileAnimating!==undefined?e.updateWhileAnimating:false;this.updateWhileInteracting_=e.updateWhileInteracting!==undefined?e.updateWhileInteracting:false;this.renderMode_=e.renderMode||ho.VECTOR;this.type=oo.VECTOR};qn.inherits(Al,Fs);Al.prototype.getDeclutter=function(){return this.declutter_};Al.prototype.setDeclutter=function(t){this.declutter_=t};Al.prototype.getRenderBuffer=function(){return this.renderBuffer_};Al.prototype.getRenderOrder=function(){return this.get(Al.Property_.RENDER_ORDER)};Al.prototype.getStyle=function(){return this.style_};Al.prototype.getStyleFunction=function(){return this.styleFunction_};Al.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_};Al.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_};Al.prototype.setRenderOrder=function(t){this.set(Al.Property_.RENDER_ORDER,t)};Al.prototype.setStyle=function(t){this.style_=t!==undefined?t:$h.defaultFunction;this.styleFunction_=t===null?undefined:$h.createFunction(this.style_);this.changed()};Al.prototype.getRenderMode=function(){return this.renderMode_};Al.Property_={RENDER_ORDER:"renderOrder"};var wl={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",US:"us"};var Ol=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-scale-line";this.innerElement_=document.createElement("DIV");this.innerElement_.className=i+"-inner";this.element_=document.createElement("DIV");this.element_.className=i+" "+Ps.CLASS_UNSELECTABLE;this.element_.appendChild(this.innerElement_);this.viewState_=null;this.minWidth_=e.minWidth!==undefined?e.minWidth:64;this.renderedVisible_=false;this.renderedWidth_=undefined;this.renderedHTML_="";var r=e.render?e.render:Ol.render;bs.call(this,{element:this.element_,render:r,target:e.target});$n.listen(this,aa.getChangeEventType(Ol.Property_.UNITS),this.handleUnitsChanged_,this);this.setUnits(e.units||wl.METRIC)};qn.inherits(Ol,bs);Ol.LEADING_DIGITS=[1,2,5];Ol.prototype.getUnits=function(){return this.get(Ol.Property_.UNITS)};Ol.render=function(t){var e=t.frameState;if(!e){this.viewState_=null}else{this.viewState_=e.viewState}this.updateElement_()};Ol.prototype.handleUnitsChanged_=function(){this.updateElement_()};Ol.prototype.setUnits=function(t){this.set(Ol.Property_.UNITS,t)};Ol.prototype.updateElement_=function(){var t=this.viewState_;if(!t){if(this.renderedVisible_){this.element_.style.display="none";this.renderedVisible_=false}return}var e=t.center;var i=t.projection;var r=this.getUnits();var n=r==wl.DEGREES?ma.DEGREES:ma.METERS;var a=Ma.getPointResolution(i,t.resolution,e,n);if(r!=wl.DEGREES){a*=i.getMetersPerUnit()}var s=this.minWidth_*a;var o="";if(r==wl.DEGREES){var h=Ma.METERS_PER_UNIT[ma.DEGREES];if(i.getUnits()==ma.DEGREES){s*=h}else{a/=h}if(s<h/60){o="″";a*=3600}else if(s<h){o="′";a*=60}else{o="°"}}else if(r==wl.IMPERIAL){if(s<.9144){o="in";a/=.0254}else if(s<1609.344){o="ft";a/=.3048}else{o="mi";a/=1609.344}}else if(r==wl.NAUTICAL){a/=1852;o="nm"}else if(r==wl.METRIC){if(s<.001){o="μm";a*=1e6}else if(s<1){o="mm";a*=1e3}else if(s<1e3){o="m"}else{o="km";a/=1e3}}else if(r==wl.US){if(s<.9144){o="in";a*=39.37}else if(s<1609.344){o="ft";a/=.30480061}else{o="mi";a/=1609.3472}}else{oa.assert(false,33)}var l=3*Math.floor(Math.log(this.minWidth_*a)/Math.log(10));var u,f;while(true){u=Ol.LEADING_DIGITS[(l%3+3)%3]*Math.pow(10,Math.floor(l/3));f=Math.round(u/a);if(isNaN(f)){this.element_.style.display="none";this.renderedVisible_=false;return}else if(f>=this.minWidth_){break}++l}var c=u+" "+o;if(this.renderedHTML_!=c){this.innerElement_.innerHTML=c;this.renderedHTML_=c}if(this.renderedWidth_!=f){this.innerElement_.style.width=f+"px";this.renderedWidth_=f}if(!this.renderedVisible_){this.element_.style.display="";this.renderedVisible_=true}};Ol.Property_={UNITS:"units"};var bl={FRACTION:"fraction",PIXELS:"pixels"};var Pl=function(t,e,i,r,n,a){ia.call(this);this.hitDetectionImage_=null;this.image_=!t?new Image:t;if(r!==null){this.image_.crossOrigin=r}this.canvas_=a?document.createElement("CANVAS"):null;this.color_=a;this.imageListenerKeys_=null;this.imageState_=n;this.size_=i;this.src_=e;this.tainting_=false;if(this.imageState_==ao.LOADED){this.determineTainting_()}};qn.inherits(Pl,ia);Pl.get=function(t,e,i,r,n,a){var s=To.iconImageCache;var o=s.get(e,r,a);if(!o){o=new Pl(t,e,i,r,n,a);s.set(e,r,a,o)}return o};Pl.prototype.determineTainting_=function(){var t=Ts.createCanvasContext2D(1,1);try{t.drawImage(this.image_,0,0);t.getImageData(0,0,1,1)}catch(e){this.tainting_=true}};Pl.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(ra.CHANGE)};Pl.prototype.handleImageError_=function(){this.imageState_=ao.ERROR;this.unlistenImage_();this.dispatchChangeEvent_()};Pl.prototype.handleImageLoad_=function(){this.imageState_=ao.LOADED;if(this.size_){this.image_.width=this.size_[0];this.image_.height=this.size_[1]}this.size_=[this.image_.width,this.image_.height];this.unlistenImage_();this.determineTainting_();this.replaceColor_();this.dispatchChangeEvent_()};Pl.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_};Pl.prototype.getImageState=function(){return this.imageState_};Pl.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_){if(this.tainting_){var e=this.size_[0];var i=this.size_[1];var r=Ts.createCanvasContext2D(e,i);r.fillRect(0,0,e,i);this.hitDetectionImage_=r.canvas}else{this.hitDetectionImage_=this.image_}}return this.hitDetectionImage_};Pl.prototype.getSize=function(){return this.size_};Pl.prototype.getSrc=function(){return this.src_};Pl.prototype.load=function(){if(this.imageState_==ao.IDLE){this.imageState_=ao.LOADING;this.imageListenerKeys_=[$n.listenOnce(this.image_,ra.ERROR,this.handleImageError_,this),$n.listenOnce(this.image_,ra.LOAD,this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}};Pl.prototype.replaceColor_=function(){if(this.tainting_||this.color_===null){return}this.canvas_.width=this.image_.width;this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");t.drawImage(this.image_,0,0);var e=t.getImageData(0,0,this.image_.width,this.image_.height);var i=e.data;var r=this.color_[0]/255;var n=this.color_[1]/255;var a=this.color_[2]/255;for(var s=0,o=i.length;s<o;s+=4){i[s]*=r;i[s+1]*=n;i[s+2]*=a}t.putImageData(e,0,0)};Pl.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach($n.unlistenByKey);this.imageListenerKeys_=null};var Dl={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Fl=function(t){var e=t||{};this.anchor_=e.anchor!==undefined?e.anchor:[.5,.5];this.normalizedAnchor_=null;this.anchorOrigin_=e.anchorOrigin!==undefined?e.anchorOrigin:Dl.TOP_LEFT;this.anchorXUnits_=e.anchorXUnits!==undefined?e.anchorXUnits:bl.FRACTION;this.anchorYUnits_=e.anchorYUnits!==undefined?e.anchorYUnits:bl.FRACTION;this.crossOrigin_=e.crossOrigin!==undefined?e.crossOrigin:null;var i=e.img!==undefined?e.img:null;var r=e.imgSize!==undefined?e.imgSize:null;var n=e.src;oa.assert(!(n!==undefined&&i),4);oa.assert(!i||i&&r,5);if((n===undefined||n.length===0)&&i){n=i.src||qn.getUid(i).toString()}oa.assert(n!==undefined&&n.length>0,6);var a=e.src!==undefined?ao.IDLE:ao.LOADED;this.color_=e.color!==undefined?co.asArray(e.color):null;this.iconImage_=Pl.get(i,n,r,this.crossOrigin_,a,this.color_);this.offset_=e.offset!==undefined?e.offset:[0,0];this.offsetOrigin_=e.offsetOrigin!==undefined?e.offsetOrigin:Dl.TOP_LEFT;this.origin_=null;this.size_=e.size!==undefined?e.size:null;var s=e.opacity!==undefined?e.opacity:1;var o=e.rotateWithView!==undefined?e.rotateWithView:false;var h=e.rotation!==undefined?e.rotation:0;var l=e.scale!==undefined?e.scale:1;var u=e.snapToPixel!==undefined?e.snapToPixel:true;qh.call(this,{opacity:s,rotation:h,scale:l,snapToPixel:u,rotateWithView:o})};qn.inherits(Fl,qh);Fl.prototype.clone=function(){return new Fl({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||undefined,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:this.size_!==null?this.size_.slice():undefined,opacity:this.getOpacity(),scale:this.getScale(),snapToPixel:this.getSnapToPixel(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})};Fl.prototype.getAnchor=function(){if(this.normalizedAnchor_){return this.normalizedAnchor_}var t=this.anchor_;var e=this.getSize();if(this.anchorXUnits_==bl.FRACTION||this.anchorYUnits_==bl.FRACTION){if(!e){return null}t=this.anchor_.slice();if(this.anchorXUnits_==bl.FRACTION){t[0]*=e[0]}if(this.anchorYUnits_==bl.FRACTION){t[1]*=e[1]}}if(this.anchorOrigin_!=Dl.TOP_LEFT){if(!e){return null}if(t===this.anchor_){t=this.anchor_.slice()}if(this.anchorOrigin_==Dl.TOP_RIGHT||this.anchorOrigin_==Dl.BOTTOM_RIGHT){t[0]=-t[0]+e[0]}if(this.anchorOrigin_==Dl.BOTTOM_LEFT||this.anchorOrigin_==Dl.BOTTOM_RIGHT){t[1]=-t[1]+e[1]}}this.normalizedAnchor_=t;return this.normalizedAnchor_};Fl.prototype.getColor=function(){return this.color_};Fl.prototype.getImage=function(t){return this.iconImage_.getImage(t)};Fl.prototype.getImageSize=function(){return this.iconImage_.getSize()};Fl.prototype.getHitDetectionImageSize=function(){return this.getImageSize()};Fl.prototype.getImageState=function(){return this.iconImage_.getImageState()};Fl.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)};Fl.prototype.getOrigin=function(){if(this.origin_){return this.origin_}var t=this.offset_;if(this.offsetOrigin_!=Dl.TOP_LEFT){var e=this.getSize();var i=this.iconImage_.getSize();if(!e||!i){return null}t=t.slice();if(this.offsetOrigin_==Dl.TOP_RIGHT||this.offsetOrigin_==Dl.BOTTOM_RIGHT){t[0]=i[0]-e[0]-t[0]}if(this.offsetOrigin_==Dl.BOTTOM_LEFT||this.offsetOrigin_==Dl.BOTTOM_RIGHT){t[1]=i[1]-e[1]-t[1]}}this.origin_=t;return this.origin_};Fl.prototype.getSrc=function(){return this.iconImage_.getSrc()};Fl.prototype.getSize=function(){return!this.size_?this.iconImage_.getSize():this.size_};Fl.prototype.listenImageChange=function(t,e){return $n.listen(this.iconImage_,ra.CHANGE,t,e)};Fl.prototype.load=function(){this.iconImage_.load()};Fl.prototype.unlistenImageChange=function(t,e){$n.unlisten(this.iconImage_,ra.CHANGE,t,e)};var Nl='<svg width="16" height="24" viewBox="0 0 16 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.0011 22.5728L13.2809 12.0132H2.72134L8.0011 22.5728Z" fill="#DEDEDE" stroke="#BFBFBF" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" fill="#D0021B"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" stroke="#D0021B" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" stroke="black" stroke-opacity="0.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n';var Gl=':host{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}:host[hidden]{display:none}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}stzh-olmap{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block;position:relative;width:100%;height:18.75rem}stzh-olmap[hidden]{display:none}stzh-olmap *,stzh-olmap *::before,stzh-olmap *::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}@media screen and (min-width: 800px){stzh-olmap{height:25rem}}.stzh-olmap{}.stzh-olmap__map{position:absolute;width:100%;height:100%;top:0;left:0}.stzh-olmap__map--print{margin-top:var(--stzh-space-xxlarge);max-width:100%;height:auto}.stzh-olmap__print-image{display:block;max-width:100%}.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom-in,.stzh-olmap .ol-zoom-out,.stzh-olmap .ol-rotate-reset{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-deca-font-size);line-height:var(--stzh-font-deca-text-line-height);letter-spacing:var(--stzh-font-deca-text-letter-spacing);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;border-radius:0;color:var(--stzh-color-primary, var(--stzh-color-zueriblue));-webkit-transition:all var(--stzh-base-transition-animation-speed) ease;transition:all var(--stzh-base-transition-animation-speed) ease;background-color:var(--stzh-color-white);width:var(--stzh-form-input-small-height);height:var(--stzh-form-input-small-height);cursor:pointer}.stzh-olmap .ol-print stzh-icon,.stzh-olmap .ol-location stzh-icon,.stzh-olmap .ol-zoom-in stzh-icon,.stzh-olmap .ol-zoom-out stzh-icon,.stzh-olmap .ol-rotate-reset stzh-icon{--size:var(--stzh-icon-size-small)}.stzh-olmap .ol-print:hover,.stzh-olmap .ol-location:hover,.stzh-olmap .ol-zoom-in:hover,.stzh-olmap .ol-zoom-out:hover,.stzh-olmap .ol-rotate-reset:hover{color:var(--stzh-color-white);background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom,.stzh-olmap .ol-rotate-reset{position:absolute;right:var(--stzh-space-xsmall);bottom:var(--stzh-space-xsmall);-webkit-box-shadow:var(--stzh-box-shadow-popover);box-shadow:var(--stzh-box-shadow-popover);border-radius:var(--stzh-form-input-border-radius)}@media screen and (min-width: 800px){.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom,.stzh-olmap .ol-rotate-reset{right:var(--stzh-space-large);bottom:var(--stzh-space-large)}}.stzh-olmap .ol-layer{left:var(--stzh-space-xsmall);right:auto;padding:var(--stzh-space-xxxsmall);border:none;cursor:pointer}@media screen and (min-width: 800px){.stzh-olmap .ol-layer{left:var(--stzh-space-large)}}.stzh-olmap .ol-layer__thumbnail{width:4.75rem;height:4.75rem;display:block}.stzh-olmap .ol-layer__text{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);position:absolute;bottom:0;left:0;right:0;text-align:left;background-color:var(--stzh-color-white);color:var(--stzh-color-primary, var(--stzh-color-zueriblue));padding-left:calc(var(--stzh-space-xxxsmall) + 0.0625rem);padding-right:calc(var(--stzh-space-xxxsmall) + 0.0625rem)}.stzh-olmap .ol-layer:hover .ol-layer__text{color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-location{margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}.stzh-olmap .ol-location.active{background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));color:var(--stzh-color-white)}.stzh-olmap .ol-zoom{margin-bottom:calc(var(--stzh-form-input-small-height) + var(--stzh-space-xsmall));background-color:var(--stzh-color-grey13)}.stzh-olmap .ol-zoom-in{margin-bottom:0.0625rem}.stzh-olmap .ol-rotate-reset{width:var(--stzh-space-xxlarge);height:var(--stzh-space-xxlarge);border-radius:50%;-webkit-box-shadow:none;box-shadow:none;border:0.0625rem solid var(--stzh-color-grey13);margin-right:calc((var(--stzh-form-input-small-height) - var(--stzh-space-xxlarge)) / 2);margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}.stzh-olmap .ol-rotate-reset span{border:0;clip:rect(0 0 0 0);-webkit-clip-path:inset(100%);clip-path:inset(100%);width:0.0625rem;height:0.0625rem;overflow:hidden;padding:0;position:absolute}.stzh-olmap .ol-rotate-reset svg{width:0.99rem;height:1.32188rem}.stzh-olmap .ol-hidden .ol-rotate-reset{opacity:0}.stzh-olmap .ol-compass{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.stzh-olmap .ol-scale-line{position:absolute;bottom:var(--stzh-space-xsmall);margin-left:calc(4.75rem + var(--stzh-space-xxxsmall) + var(--stzh-space-xsmall));left:var(--stzh-space-xsmall)}@media screen and (min-width: 800px){.stzh-olmap .ol-scale-line{bottom:var(--stzh-space-large);left:var(--stzh-space-large)}}.stzh-olmap .ol-scale-line-inner{font-size:var(--stzh-font-nano-font-size);line-height:var(--stzh-font-nano-text-line-height);position:relative;color:var(--stzh-color-black);text-align:center;-webkit-filter:drop-shadow(-0.0625rem 0px 0px white) drop-shadow(0.0625rem 0px 0px white) drop-shadow(0px -0.0625rem 0px white) drop-shadow(0px 0.0625rem 0px white);filter:drop-shadow(-0.0625rem 0px 0px white) drop-shadow(0.0625rem 0px 0px white) drop-shadow(0px -0.0625rem 0px white) drop-shadow(0px 0.0625rem 0px white)}.stzh-olmap .ol-scale-line-inner::after{content:"";position:absolute;bottom:0;left:0;width:100%;height:0.28125rem;border:0.0625rem solid var(--stzh-color-black);border-top:0}.stzh-olmap .ol-attribution{display:none}.stzh-olmap--has-no-layer-control .ol-scale-line{margin-left:0}.stzh-olmap--has-no-print-control .ol-zoom{margin-bottom:0}.stzh-olmap--has-no-print-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 2 + var(--stzh-space-xsmall))}.stzh-olmap--has-location-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 4 + var(--stzh-space-xsmall) * 3)}.stzh-olmap--has-location-control.stzh-olmap--has-no-print-control .ol-location{margin-bottom:calc(var(--stzh-form-input-small-height) * 2 + var(--stzh-space-xsmall))}.stzh-olmap--has-location-control.stzh-olmap--has-no-print-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}';window.proj4=Kt;window.proj4.defs("EPSG:2056","+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs");var kl={anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:.5,src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker.png")};var Ul=Object.assign(Object.assign({},kl),{src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker-active.png")});var zl=Object.assign(Object.assign({},kl),{anchor:[.5,.5],src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker-position.png")});var Bl=t("stzh_olmap",function(){function t(t){var r=this;e(this,t);this.stzhInitialized=i(this,"stzhInitialized",7);this.stzhPostRender=i(this,"stzhPostRender",7);this.stzhMoveStart=i(this,"stzhMoveStart",7);this.stzhMoveEnd=i(this,"stzhMoveEnd",7);this.geoPositionChanged=false;this.handlePostRender=function(){r.stzhPostRender.emit({component:"stzh-olmap"})};this.handleMoveStart=function(){r.stzhMoveStart.emit({component:"stzh-olmap"})};this.handleMoveEnd=function(){r.stzhMoveEnd.emit({component:"stzh-olmap"})};this.handleInsideModalOpen=function(){if(r.map){requestAnimationFrame((function(){r.map.updateSize()}))}};this.handlePrintButtonClick=function(){if(!r.printIframe){r.printIframe=document.createElement("iframe");Object.assign(r.printIframe.style,{height:"0px",width:"0px",position:"absolute",border:"none"});r.element.append(r.printIframe)}r.printIframe.innerHTML="";var t=r.printIframe.contentWindow;var e=r.constructor.style.replace('@charset "UTF-8";',"");var i=Array.from(document.querySelectorAll("link")).map((function(t){return t.outerHTML}));var n;r.map.once("postcompose",(function(t){var e=t.context.canvas;n=e.toDataURL("image/png")}));r.map.renderSync();t.document.body.innerHTML="\n ".concat(i.join(""),'\n\n <style type="text/css">\n ').concat(e,'\n </style>\n\n <div class="stzh-olmap__map stzh-olmap__map--print">\n <img class="stzh-olmap__print-image" src="').concat(n,'">\n ').concat(r.element.querySelector(".ol-scale-line.ol-unselectable").outerHTML,"\n </div>\n ");setTimeout((function(){try{t.document.execCommand("print",false,null)}catch(e){t.print()}}),1e3)};this.localization=undefined;this.hostname="www.ogc.stadt-zuerich.ch";this.scaleControl=true;this.layerControl=true;this.printControl=true;this.locationControl=false;this.layer="streets";this.zoom=7;this.zoomLocation=7;this.center=[2683311,1247082];this.centerMarker=true;this.resolutions=[67.73333333333,33.8666666667,16.9333333333,8.4666666667,4.2333333333,2.1166666667,1.0583333333,.5291666667,.2645833333,.1322916667,.0661458333];this.layers={streets:{thumbnailUrl:"".concat(window.stzhComponents.pathMedia,"/olmap/thumb-streets.jpg"),options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"basiskarte_zuerich_gebaeudeschraegansicht",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}},satellite:{thumbnailUrl:"".concat(window.stzhComponents.pathMedia,"/olmap/thumb-satellite.jpg"),options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"orthofoto",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}}}}t.prototype.zoomWatcher=function(t){if(this.map){this.map.getView().setZoom(t)}};t.prototype.scaleControlWatcher=function(t){if(!this.map){return}if(t){this.scaleControlOl=new Ol({units:"metric"});this.map.addControl(this.scaleControlOl)}else{if(this.scaleControl){this.map.removeControl(this.scaleControlOl)}this.scaleControlOl=null}};t.prototype.printControlWatcher=function(t){if(!this.map){return}if(t){this.printControlElement=document.createElement("button");this.printControlElement.className="ol-print";this.printControlElement.ariaLabel=this.localization.printLabel;this.printControlElement.addEventListener("click",this.handlePrintButtonClick);this.printControlElement.innerHTML='<stzh-icon name="print" class="ol-print__icon"></stzh-icon>';this.printControlOl=new bs({element:this.printControlElement});this.map.addControl(this.printControlOl)}else{if(this.printControlOl){this.map.removeControl(this.printControlOl)}this.printControlOl=null;this.printControlElement=null}};t.prototype.layerControlWatcher=function(t){var e=this;if(!this.map||this.layersArray.length===1){return}if(t){this.layerControlElement=document.createElement("button");this.layerControlElement.className="ol-layer";this.layerControlElement.addEventListener("click",(function(){e.layer=e.layer==="streets"?"satellite":"streets"}));this.layerControlImageElement=document.createElement("img");this.layerControlImageElement.className="ol-layer__thumbnail";this.layerControlImageElement.setAttribute("role","presentation");this.layerControlImageElement.setAttribute("alt","");this.layerControlTextElement=document.createElement("span");this.layerControlTextElement.className="ol-layer__text";this.layerControlElement.appendChild(this.layerControlImageElement);this.layerControlElement.appendChild(this.layerControlTextElement);this.layerControlOl=new bs({element:this.layerControlElement});this.map.addControl(this.layerControlOl)}else{if(this.layerControlOl){this.map.removeControl(this.layerControlOl)}this.layerControlOl=null;this.layerControlElement=null;this.layerControlImageElement=null;this.layerControlTextElement=null}};t.prototype.locationControlWatcher=function(t){var e=this;if(!this.map){return}if(t){this.locationControlElement=document.createElement("button");this.locationControlElement.className="ol-location";this.locationControlElement.innerHTML='<stzh-icon name="target-bullet" class="ol-location__icon"></stzh-icon>';this.locationControlElement.addEventListener("click",(function(){var t=e.geolocation.getTracking();if(t){e.disableLocationTracking()}else{e.enableLocationTracking()}}));this.locationControlOl=new bs({element:this.locationControlElement});this.geolocation=new ja({projection:this.map.getView().getProjection()});this.positionMarkerOl=new tl;this.positionMarkerOl.setId("position");var i=new $h({image:new Fl(zl)});this.positionMarkerOl.setStyle(i);this.positionLayer.getSource().addFeature(this.positionMarkerOl);this.geolocation.on("change:position",(function(){var t=e.geolocation.getPosition();e.positionMarkerOl.setGeometry(new Fa(t));if(!e.geoPositionChanged&&pa.containsExtent(e.layers[e.layer].options.extent,e.positionMarkerOl.getGeometry().getExtent())){e.geoPositionChanged=true;e.map.getView().setCenter(t);if(e.zoomLocation){e.map.getView().setZoom(e.zoomLocation)}}}));this.geolocation.on("change:tracking",(function(){var t=e.geolocation.getTracking();e.positionMarkerOl.setGeometry(null);e.setLocationControlState(t)}));this.geolocation.on("error",(function(){e.setLocationControlState(false)}));this.map.addControl(this.locationControlOl)}else{this.disableLocationTracking();if(this.locationControlOl){this.map.removeControl(this.locationControlOl)}if(this.positionMarkerOl){this.positionLayer.getSource().removeFeature(this.positionMarkerOl)}this.locationControlOl=null;this.locationControlElement=null;this.geolocation=null;this.positionMarkerOl=null}};t.prototype.layerWatcher=function(t){var e=this;if(!this.map){return}Object.entries(this.rasterLayers).forEach((function(i){var r=i[0],n=i[1];if(r===t){n.setVisible(true);e.map.getView().set("projection",e.projections[t]);var a=e.layersArray.find((function(t){var i=t[0];return i!==e.layer}));if(a){if(e.layerControlImageElement){e.layerControlImageElement.src=a[1].thumbnailUrl}if(e.layerControlTextElement){var s="";if(r==="streets"){s=e.localization.streetsLayerTitle}else if(r==="satellite"){s=e.localization.satelliteLayerTitle}e.layerControlTextElement.textContent=a[1].title||s}}}else{n.setVisible(false)}}))};t.prototype.centerWatcher=function(t){this.map.getView().setCenter(t);if(this.centerMarkerOl){this.centerMarkerOl.setGeometry(new Fa(t))}};t.prototype.centerMarkerWatcher=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:if(!t)return[3,2];e=this;return[4,this.addIconMarker(this.center)];case 1:e.centerMarkerOl=i.sent();return[3,3];case 2:if(this.centerMarkerOl){this.removeIconMarker(this.centerMarkerOl)}i.label=3;case 3:return[2]}}))}))};t.prototype.getMap=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.map]}))}))};t.prototype.addIconMarker=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(r){e=new tl({geometry:new Fa(t)});i=new $h({image:new Fl(kl)});e.setStyle(i);this.iconLayer.getSource().addFeature(e);return[2,e]}))}))};t.prototype.removeIconMarker=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.iconLayer.getSource().removeFeature(t)]}))}))};t.prototype.setIconMarkerActive=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.setStyle(new $h({image:new Fl(Ul)}));return[2]}))}))};t.prototype.setIconMarkerInactive=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.setStyle(new $h({image:new Fl(kl)}));return[2]}))}))};t.prototype.enableLocationTracking=function(t){if(t===void 0){t=true}return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setLocationControlState(true);if(t){this.geoPositionChanged=false}if(this.geolocation){this.geolocation.setTracking(true)}return[2]}))}))};t.prototype.disableLocationTracking=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.setLocationControlState(false);if(this.geolocation){this.geolocation.setTracking(false)}return[2]}))}))};t.prototype.handleLoad=function(){var t=this;if(this.map){requestAnimationFrame((function(){t.map.updateSize()}))}};t.prototype.setLocationControlState=function(t){if(this.positionLayer){this.positionLayer.setVisible(t)}if(this.locationControlElement){this.locationControlElement.classList.toggle("active",t)}};t.prototype.createMap=function(){var t=document.createElement("stzh-icon");t.ariaLabel=this.localization.zoomInLabel;t.name="plus";var e=document.createElement("stzh-icon");e.ariaLabel=this.localization.zoomOutLabel;e.name="minus";var i=document.createElement("div");i.innerHTML=Nl;var r=document.createElement("span");r.innerText=this.localization.rotateLabel;i.appendChild(r);var n=new Kh({controls:Us.defaults({zoomOptions:{zoomInLabel:t,zoomOutLabel:e,zoomInTipLabel:"",zoomOutTipLabel:""},rotateOptions:{label:i,tipLabel:""}}),interactions:ro.defaults({mouseWheelZoom:false}),loadTilesWhileAnimating:true,loadTilesWhileInteracting:true,target:this.mapElement,logo:false});return n};t.prototype.createRasterLayer=function(t,e){return new Ll({title:"wmts",type:"base",extent:e.extent,source:this.createLayerSource(t,e)})};t.prototype.createLayerSource=function(t,e){if(!this.projections){this.projections={}}this.projections[t]=new Ea({code:"EPSG:2056",extent:e.extent});return this.creatRasterSource(t,e)};t.prototype.creatRasterSource=function(t,e){var i=e.url,r=e.layer,n=e.matrixSet,a=e.origin;var s=[];for(var o=0;o<this.resolutions.length;o++){s.push(o)}var h=new ml({origin:a,resolutions:this.resolutions,matrixIds:s,tileSize:[512,512]});return new El({url:i,tileGrid:h,style:"default",projection:this.projections[t],crossOrigin:"anonymous",layer:r,matrixSet:n,requestEncoding:"REST"})};t.prototype.createIconLayer=function(){return new Al({source:new Sl({})})};t.prototype.initMap=function(){var t=this;this.map=this.createMap();this.map.on("postrender",this.handlePostRender);this.map.on("movestart",this.handleMoveStart);this.map.on("moveend",this.handleMoveEnd);this.layersArray=Object.entries(this.layers);if(this.layersArray.length>2){throw new Error("There are only two different layers allowed.")}this.rasterLayers={};this.layersArray.forEach((function(e){var i=e[0],r=e[1];r.options.url=r.options.url.replace(/{hostname}/gi,t.hostname);t.rasterLayers[i]=t.createRasterLayer(i,r.options);t.map.addLayer(t.rasterLayers[i])}));this.positionLayer=this.createIconLayer();this.positionLayer.setVisible(false);this.map.addLayer(this.positionLayer);this.iconLayer=this.createIconLayer();this.map.addLayer(this.iconLayer);var e=new xs({center:this.center,projection:this.projections[this.layer],zoom:this.zoom,resolutions:this.resolutions});this.map.setView(e);this.scaleControlWatcher(this.scaleControl);this.printControlWatcher(this.printControl);this.locationControlWatcher(this.locationControl);this.layerControlWatcher(this.layerControl);this.layerWatcher(this.layer);this.centerWatcher(this.center);this.centerMarkerWatcher(this.centerMarker);requestAnimationFrame((function(){t.map.updateSize();t.stzhInitialized.emit({component:"stzh-olmap"})}))};t.prototype.componentShouldUpdate=function(t,e,i){return["hostname","localization","layers","resolutions"].includes(i)};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:if(!!this.localization)return[3,2];t=this;return[4,s(this.element,"olmap")];case 1:t.localization=e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.componentWillUpdate=function(){if(this.map){this.map.setTarget(null);this.map=null}};t.prototype.componentDidRender=function(){if(this.map){return}this.initMap()};t.prototype.connectedCallback=function(){var t=this.element.closest("stzh-dialog");if(t){t.addEventListener("stzhOpen",this.handleInsideModalOpen)}};t.prototype.disconnectedCallback=function(){if(this.map){this.map.setTarget(null);this.map=null}var t=this.element.closest("stzh-dialog");if(t){t.removeEventListener("stzhOpen",this.handleInsideModalOpen)}};t.prototype.render=function(){var t=this;var e={"stzh-olmap":true,"stzh-olmap--has-no-layer-control":!this.layerControl,"stzh-olmap--has-no-print-control":!this.printControl,"stzh-olmap--has-location-control":this.locationControl};return r(n,null,r("div",{class:e},r("div",{ref:function(e){return t.mapElement=e},class:"stzh-olmap__map"})))};Object.defineProperty(t.prototype,"element",{get:function(){return a(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{zoom:["zoomWatcher"],scaleControl:["scaleControlWatcher"],printControl:["printControlWatcher"],layerControl:["layerControlWatcher"],locationControl:["locationControlWatcher"],layer:["layerWatcher"],center:["centerWatcher"],centerMarker:["centerMarkerWatcher"]}},enumerable:false,configurable:true});return t}());Bl.style=Gl}}}));
|
|
7
|
+
*/var ua=function(t){this.radius=t};ua.prototype.geodesicArea=function(t){return ua.getArea_(t,this.radius)};ua.prototype.haversineDistance=function(t,e){return ua.getDistance_(t,e,this.radius)};ua.prototype.offset=function(t,e,i){var r=ha.toRadians(t[1]);var n=ha.toRadians(t[0]);var a=e/this.radius;var s=Math.asin(Math.sin(r)*Math.cos(a)+Math.cos(r)*Math.sin(a)*Math.cos(i));var o=n+Math.atan2(Math.sin(i)*Math.sin(a)*Math.cos(r),Math.cos(a)-Math.sin(r)*Math.sin(s));return[ha.toDegrees(o),ha.toDegrees(s)]};ua.DEFAULT_RADIUS=6371008.8;ua.getLength=function(t,e){var i=e||{};var r=i.radius||ua.DEFAULT_RADIUS;var n=i.projection||"EPSG:3857";t=t.clone().transform(n,"EPSG:4326");var a=t.getType();var s=0;var o,h,l,u,f,c;switch(a){case la.POINT:case la.MULTI_POINT:{break}case la.LINE_STRING:case la.LINEAR_RING:{o=t.getCoordinates();s=ua.getLength_(o,r);break}case la.MULTI_LINE_STRING:case la.POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){s+=ua.getLength_(o[l],r)}break}case la.MULTI_POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){h=o[l];for(f=0,c=h.length;f<c;++f){s+=ua.getLength_(h[f],r)}}break}case la.GEOMETRY_COLLECTION:{var d=t.getGeometries();for(l=0,u=d.length;l<u;++l){s+=ua.getLength(d[l],e)}break}default:{throw new Error("Unsupported geometry type: "+a)}}return s};ua.getLength_=function(t,e){var i=0;for(var r=0,n=t.length;r<n-1;++r){i+=ua.getDistance_(t[r],t[r+1],e)}return i};ua.getDistance_=function(t,e,i){var r=ha.toRadians(t[1]);var n=ha.toRadians(e[1]);var a=(n-r)/2;var s=ha.toRadians(e[0]-t[0])/2;var o=Math.sin(a)*Math.sin(a)+Math.sin(s)*Math.sin(s)*Math.cos(r)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))};ua.getArea=function(t,e){var i=e||{};var r=i.radius||ua.DEFAULT_RADIUS;var n=i.projection||"EPSG:3857";t=t.clone().transform(n,"EPSG:4326");var a=t.getType();var s=0;var o,h,l,u,f,c;switch(a){case la.POINT:case la.MULTI_POINT:case la.LINE_STRING:case la.MULTI_LINE_STRING:case la.LINEAR_RING:{break}case la.POLYGON:{o=t.getCoordinates();s=Math.abs(ua.getArea_(o[0],r));for(l=1,u=o.length;l<u;++l){s-=Math.abs(ua.getArea_(o[l],r))}break}case la.MULTI_POLYGON:{o=t.getCoordinates();for(l=0,u=o.length;l<u;++l){h=o[l];s+=Math.abs(ua.getArea_(h[0],r));for(f=1,c=h.length;f<c;++f){s-=Math.abs(ua.getArea_(h[f],r))}}break}case la.GEOMETRY_COLLECTION:{var d=t.getGeometries();for(l=0,u=d.length;l<u;++l){s+=ua.getArea(d[l],e)}break}default:{throw new Error("Unsupported geometry type: "+a)}}return s};ua.getArea_=function(t,e){var i=0,r=t.length;var n=t[r-1][0];var a=t[r-1][1];for(var s=0;s<r;s++){var o=t[s][0],h=t[s][1];i+=ha.toRadians(o-n)*(2+Math.sin(ha.toRadians(a))+Math.sin(ha.toRadians(h)));n=o;a=h}return i*e*e/2};var fa={};fa.binarySearch=function(t,e,i){var r,n;var a=i||fa.numberSafeCompareFunction;var s=0;var o=t.length;var h=false;while(s<o){r=s+(o-s>>1);n=+a(t[r],e);if(n<0){s=r+1}else{o=r;h=!n}}return h?s:~s};fa.numberSafeCompareFunction=function(t,e){return t>e?1:t<e?-1:0};fa.includes=function(t,e){return t.indexOf(e)>=0};fa.linearFindNearest=function(t,e,i){var r=t.length;if(t[0]<=e){return 0}else if(e<=t[r-1]){return r-1}else{var n;if(i>0){for(n=1;n<r;++n){if(t[n]<e){return n-1}}}else if(i<0){for(n=1;n<r;++n){if(t[n]<=e){return n}}}else{for(n=1;n<r;++n){if(t[n]==e){return n}else if(t[n]<e){if(t[n-1]-e<e-t[n]){return n-1}else{return n}}}}return r-1}};fa.reverseSubArray=function(t,e,i){while(e<i){var r=t[e];t[e]=t[i];t[i]=r;++e;--i}};fa.extend=function(t,e){var i;var r=Array.isArray(e)?e:[e];var n=r.length;for(i=0;i<n;i++){t[t.length]=r[i]}};fa.remove=function(t,e){var i=t.indexOf(e);var r=i>-1;if(r){t.splice(i,1)}return r};fa.find=function(t,e){var i=t.length>>>0;var r;for(var n=0;n<i;n++){r=t[n];if(e(r,n,t)){return r}}return null};fa.equals=function(t,e){var i=t.length;if(i!==e.length){return false}for(var r=0;r<i;r++){if(t[r]!==e[r]){return false}}return true};fa.stableSort=function(t,e){var i=t.length;var r=Array(t.length);var n;for(n=0;n<i;n++){r[n]={index:n,value:t[n]}}r.sort((function(t,i){return e(t.value,i.value)||t.index-i.index}));for(n=0;n<t.length;n++){t[n]=r[n].value}};fa.findIndex=function(t,e){var i;var r=!t.every((function(r,n){i=n;return!e(r,n,t)}));return r?i:-1};fa.isSorted=function(t,e,i){var r=e||fa.numberSafeCompareFunction;return t.every((function(e,n){if(n===0){return true}var a=r(t[n-1],e);return!(a>0||i&&a===0)}))};var ca={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var da={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};var pa={};pa.boundingExtent=function(t){var e=pa.createEmpty();for(var i=0,r=t.length;i<r;++i){pa.extendCoordinate(e,t[i])}return e};pa.boundingExtentXYs_=function(t,e,i){var r=Math.min.apply(null,t);var n=Math.min.apply(null,e);var a=Math.max.apply(null,t);var s=Math.max.apply(null,e);return pa.createOrUpdate(r,n,a,s,i)};pa.buffer=function(t,e,i){if(i){i[0]=t[0]-e;i[1]=t[1]-e;i[2]=t[2]+e;i[3]=t[3]+e;return i}else{return[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}};pa.clone=function(t,e){if(e){e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];return e}else{return t.slice()}};pa.closestSquaredDistanceXY=function(t,e,i){var r,n;if(e<t[0]){r=t[0]-e}else if(t[2]<e){r=e-t[2]}else{r=0}if(i<t[1]){n=t[1]-i}else if(t[3]<i){n=i-t[3]}else{n=0}return r*r+n*n};pa.containsCoordinate=function(t,e){return pa.containsXY(t,e[0],e[1])};pa.containsExtent=function(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]};pa.containsXY=function(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]};pa.coordinateRelationship=function(t,e){var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=e[0];var o=e[1];var h=da.UNKNOWN;if(s<i){h=h|da.LEFT}else if(s>n){h=h|da.RIGHT}if(o<r){h=h|da.BELOW}else if(o>a){h=h|da.ABOVE}if(h===da.UNKNOWN){h=da.INTERSECTING}return h};pa.createEmpty=function(){return[Infinity,Infinity,-Infinity,-Infinity]};pa.createOrUpdate=function(t,e,i,r,n){if(n){n[0]=t;n[1]=e;n[2]=i;n[3]=r;return n}else{return[t,e,i,r]}};pa.createOrUpdateEmpty=function(t){return pa.createOrUpdate(Infinity,Infinity,-Infinity,-Infinity,t)};pa.createOrUpdateFromCoordinate=function(t,e){var i=t[0];var r=t[1];return pa.createOrUpdate(i,r,i,r,e)};pa.createOrUpdateFromCoordinates=function(t,e){var i=pa.createOrUpdateEmpty(e);return pa.extendCoordinates(i,t)};pa.createOrUpdateFromFlatCoordinates=function(t,e,i,r,n){var a=pa.createOrUpdateEmpty(n);return pa.extendFlatCoordinates(a,t,e,i,r)};pa.createOrUpdateFromRings=function(t,e){var i=pa.createOrUpdateEmpty(e);return pa.extendRings(i,t)};pa.equals=function(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]};pa.extend=function(t,e){if(e[0]<t[0]){t[0]=e[0]}if(e[2]>t[2]){t[2]=e[2]}if(e[1]<t[1]){t[1]=e[1]}if(e[3]>t[3]){t[3]=e[3]}return t};pa.extendCoordinate=function(t,e){if(e[0]<t[0]){t[0]=e[0]}if(e[0]>t[2]){t[2]=e[0]}if(e[1]<t[1]){t[1]=e[1]}if(e[1]>t[3]){t[3]=e[1]}};pa.extendCoordinates=function(t,e){var i,r;for(i=0,r=e.length;i<r;++i){pa.extendCoordinate(t,e[i])}return t};pa.extendFlatCoordinates=function(t,e,i,r,n){for(;i<r;i+=n){pa.extendXY(t,e[i],e[i+1])}return t};pa.extendRings=function(t,e){var i,r;for(i=0,r=e.length;i<r;++i){pa.extendCoordinates(t,e[i])}return t};pa.extendXY=function(t,e,i){t[0]=Math.min(t[0],e);t[1]=Math.min(t[1],i);t[2]=Math.max(t[2],e);t[3]=Math.max(t[3],i)};pa.forEachCorner=function(t,e,i){var r;r=e.call(i,pa.getBottomLeft(t));if(r){return r}r=e.call(i,pa.getBottomRight(t));if(r){return r}r=e.call(i,pa.getTopRight(t));if(r){return r}r=e.call(i,pa.getTopLeft(t));if(r){return r}return false};pa.getArea=function(t){var e=0;if(!pa.isEmpty(t)){e=pa.getWidth(t)*pa.getHeight(t)}return e};pa.getBottomLeft=function(t){return[t[0],t[1]]};pa.getBottomRight=function(t){return[t[2],t[1]]};pa.getCenter=function(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]};pa.getCorner=function(t,e){var i;if(e===ca.BOTTOM_LEFT){i=pa.getBottomLeft(t)}else if(e===ca.BOTTOM_RIGHT){i=pa.getBottomRight(t)}else if(e===ca.TOP_LEFT){i=pa.getTopLeft(t)}else if(e===ca.TOP_RIGHT){i=pa.getTopRight(t)}else{oa.assert(false,13)}return i};pa.getEnlargedArea=function(t,e){var i=Math.min(t[0],e[0]);var r=Math.min(t[1],e[1]);var n=Math.max(t[2],e[2]);var a=Math.max(t[3],e[3]);return(n-i)*(a-r)};pa.getForViewAndSize=function(t,e,i,r,n){var a=e*r[0]/2;var s=e*r[1]/2;var o=Math.cos(i);var h=Math.sin(i);var l=a*o;var u=a*h;var f=s*o;var c=s*h;var d=t[0];var p=t[1];var v=d-l+c;var _=d-l-c;var g=d+l-c;var m=d+l+c;var y=p-u-f;var E=p-u+f;var x=p+u+f;var T=p+u-f;return pa.createOrUpdate(Math.min(v,_,g,m),Math.min(y,E,x,T),Math.max(v,_,g,m),Math.max(y,E,x,T),n)};pa.getHeight=function(t){return t[3]-t[1]};pa.getIntersectionArea=function(t,e){var i=pa.getIntersection(t,e);return pa.getArea(i)};pa.getIntersection=function(t,e,i){var r=i?i:pa.createEmpty();if(pa.intersects(t,e)){if(t[0]>e[0]){r[0]=t[0]}else{r[0]=e[0]}if(t[1]>e[1]){r[1]=t[1]}else{r[1]=e[1]}if(t[2]<e[2]){r[2]=t[2]}else{r[2]=e[2]}if(t[3]<e[3]){r[3]=t[3]}else{r[3]=e[3]}}return r};pa.getMargin=function(t){return pa.getWidth(t)+pa.getHeight(t)};pa.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]};pa.getTopLeft=function(t){return[t[0],t[3]]};pa.getTopRight=function(t){return[t[2],t[3]]};pa.getWidth=function(t){return t[2]-t[0]};pa.intersects=function(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]};pa.isEmpty=function(t){return t[2]<t[0]||t[3]<t[1]};pa.returnOrUpdate=function(t,e){if(e){e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];return e}else{return t}};pa.scaleFromCenter=function(t,e){var i=(t[2]-t[0])/2*(e-1);var r=(t[3]-t[1])/2*(e-1);t[0]-=i;t[2]+=i;t[1]-=r;t[3]+=r};pa.intersectsSegment=function(t,e,i){var r=false;var n=pa.coordinateRelationship(t,e);var a=pa.coordinateRelationship(t,i);if(n===da.INTERSECTING||a===da.INTERSECTING){r=true}else{var s=t[0];var o=t[1];var h=t[2];var l=t[3];var u=e[0];var f=e[1];var c=i[0];var d=i[1];var p=(d-f)/(c-u);var v,_;if(!!(a&da.ABOVE)&&!(n&da.ABOVE)){v=c-(d-l)/p;r=v>=s&&v<=h}if(!r&&!!(a&da.RIGHT)&&!(n&da.RIGHT)){_=d-(c-h)*p;r=_>=o&&_<=l}if(!r&&!!(a&da.BELOW)&&!(n&da.BELOW)){v=c-(d-o)/p;r=v>=s&&v<=h}if(!r&&!!(a&da.LEFT)&&!(n&da.LEFT)){_=d-(c-s)*p;r=_>=o&&_<=l}}return r};pa.applyTransform=function(t,e,i){var r=[t[0],t[1],t[0],t[3],t[2],t[1],t[2],t[3]];e(r,r,2);var n=[r[0],r[2],r[4],r[6]];var a=[r[1],r[3],r[5],r[7]];return pa.boundingExtentXYs_(n,a,i)};var va={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};var _a={};_a.TRUE=function(){return true};_a.FALSE=function(){return false};var ga={};ga.transform2D=function(t,e,i,r,n,a){var s=a?a:[];var o=0;var h;for(h=e;h<i;h+=r){var l=t[h];var u=t[h+1];s[o++]=n[0]*l+n[2]*u+n[4];s[o++]=n[1]*l+n[3]*u+n[5]}if(a&&s.length!=o){s.length=o}return s};ga.rotate=function(t,e,i,r,n,a,s){var o=s?s:[];var h=Math.cos(n);var l=Math.sin(n);var u=a[0];var f=a[1];var c=0;for(var d=e;d<i;d+=r){var p=t[d]-u;var v=t[d+1]-f;o[c++]=u+p*h-v*l;o[c++]=f+p*l+v*h;for(var _=d+2;_<d+r;++_){o[c++]=t[_]}}if(s&&o.length!=c){o.length=c}return o};ga.scale=function(t,e,i,r,n,a,s,o){var h=o?o:[];var l=s[0];var u=s[1];var f=0;for(var c=e;c<i;c+=r){var d=t[c]-l;var p=t[c+1]-u;h[f++]=l+n*d;h[f++]=u+a*p;for(var v=c+2;v<c+r;++v){h[f++]=t[v]}}if(o&&h.length!=f){h.length=f}return h};ga.translate=function(t,e,i,r,n,a,s){var o=s?s:[];var h=0;var l,u;for(l=e;l<i;l+=r){o[h++]=t[l]+n;o[h++]=t[l+1]+a;for(u=l+2;u<l+r;++u){o[h++]=t[u]}}if(s&&o.length!=h){o.length=h}return o};var ma={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"};ma.METERS_PER_UNIT={};ma.METERS_PER_UNIT[ma.DEGREES]=2*Math.PI*6370997/360;ma.METERS_PER_UNIT[ma.FEET]=.3048;ma.METERS_PER_UNIT[ma.METERS]=1;ma.METERS_PER_UNIT[ma.USFEET]=1200/3937;var ya={};ya.cache_=null;ya.set=function(t){ya.cache_=t};ya.get=function(){return ya.cache_||window["proj4"]};var Ea=function(t){this.code_=t.code;this.units_=t.units;this.extent_=t.extent!==undefined?t.extent:null;this.worldExtent_=t.worldExtent!==undefined?t.worldExtent:null;this.axisOrientation_=t.axisOrientation!==undefined?t.axisOrientation:"enu";this.global_=t.global!==undefined?t.global:false;this.canWrapX_=!!(this.global_&&this.extent_);this.getPointResolutionFunc_=t.getPointResolution;this.defaultTileGrid_=null;this.metersPerUnit_=t.metersPerUnit;var e=t.code;if(qn.ENABLE_PROJ4JS){var i=ya.get();if(typeof i=="function"){var r=i.defs(e);if(r!==undefined){if(r.axis!==undefined&&t.axisOrientation===undefined){this.axisOrientation_=r.axis}if(t.metersPerUnit===undefined){this.metersPerUnit_=r.to_meter}if(t.units===undefined){this.units_=r.units}}}}};Ea.prototype.canWrapX=function(){return this.canWrapX_};Ea.prototype.getCode=function(){return this.code_};Ea.prototype.getExtent=function(){return this.extent_};Ea.prototype.getUnits=function(){return this.units_};Ea.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||ma.METERS_PER_UNIT[this.units_]};Ea.prototype.getWorldExtent=function(){return this.worldExtent_};Ea.prototype.getAxisOrientation=function(){return this.axisOrientation_};Ea.prototype.isGlobal=function(){return this.global_};Ea.prototype.setGlobal=function(t){this.global_=t;this.canWrapX_=!!(t&&this.extent_)};Ea.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_};Ea.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t};Ea.prototype.setExtent=function(t){this.extent_=t;this.canWrapX_=!!(this.global_&&t)};Ea.prototype.setWorldExtent=function(t){this.worldExtent_=t};Ea.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t};Ea.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_};var xa={};xa.Projection_=function(t){Ea.call(this,{code:t,units:ma.METERS,extent:xa.EXTENT,global:true,worldExtent:xa.WORLD_EXTENT,getPointResolution:function(t,e){return t/ha.cosh(e[1]/xa.RADIUS)}})};qn.inherits(xa.Projection_,Ea);xa.RADIUS=6378137;xa.HALF_SIZE=Math.PI*xa.RADIUS;xa.EXTENT=[-xa.HALF_SIZE,-xa.HALF_SIZE,xa.HALF_SIZE,xa.HALF_SIZE];xa.WORLD_EXTENT=[-180,-85,180,85];xa.PROJECTIONS=[new xa.Projection_("EPSG:3857"),new xa.Projection_("EPSG:102100"),new xa.Projection_("EPSG:102113"),new xa.Projection_("EPSG:900913"),new xa.Projection_("urn:ogc:def:crs:EPSG:6.18:3:3857"),new xa.Projection_("urn:ogc:def:crs:EPSG::3857"),new xa.Projection_("http://www.opengis.net/gml/srs/epsg.xml#3857")];xa.fromEPSG4326=function(t,e,i){var r=t.length,n=i>1?i:2,a=e;if(a===undefined){if(n>2){a=t.slice()}else{a=new Array(r)}}var s=xa.HALF_SIZE;for(var o=0;o<r;o+=n){a[o]=s*t[o]/180;var h=xa.RADIUS*Math.log(Math.tan(Math.PI*(t[o+1]+90)/360));if(h>s){h=s}else if(h<-s){h=-s}a[o+1]=h}return a};xa.toEPSG4326=function(t,e,i){var r=t.length,n=i>1?i:2,a=e;if(a===undefined){if(n>2){a=t.slice()}else{a=new Array(r)}}for(var s=0;s<r;s+=n){a[s]=180*t[s]/xa.HALF_SIZE;a[s+1]=360*Math.atan(Math.exp(t[s+1]/xa.RADIUS))/Math.PI-90}return a};var Ta={};Ta.Projection_=function(t,e){Ea.call(this,{code:t,units:ma.DEGREES,extent:Ta.EXTENT,axisOrientation:e,global:true,metersPerUnit:Ta.METERS_PER_UNIT,worldExtent:Ta.EXTENT})};qn.inherits(Ta.Projection_,Ea);Ta.RADIUS=6378137;Ta.EXTENT=[-180,-90,180,90];Ta.METERS_PER_UNIT=Math.PI*Ta.RADIUS/180;Ta.PROJECTIONS=[new Ta.Projection_("CRS:84"),new Ta.Projection_("EPSG:4326","neu"),new Ta.Projection_("urn:ogc:def:crs:EPSG::4326","neu"),new Ta.Projection_("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new Ta.Projection_("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ta.Projection_("urn:ogc:def:crs:OGC:2:84"),new Ta.Projection_("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ta.Projection_("urn:x-ogc:def:crs:EPSG:4326","neu")];var Ca={};Ca.cache_={};Ca.clear=function(){Ca.cache_={}};Ca.get=function(t){var e=Ca.cache_;return e[t]||null};Ca.add=function(t,e){var i=Ca.cache_;i[t]=e};var Ra={};Ra.cache_={};Ra.clear=function(){Ra.cache_={}};Ra.add=function(t,e,i){var r=t.getCode();var n=e.getCode();var a=Ra.cache_;if(!(r in a)){a[r]={}}a[r][n]=i};Ra.remove=function(t,e){var i=t.getCode();var r=e.getCode();var n=Ra.cache_;var a=n[i][r];delete n[i][r];if(Qn.isEmpty(n[i])){delete n[i]}return a};Ra.get=function(t,e){var i;var r=Ra.cache_;if(t in r&&e in r[t]){i=r[t][e]}return i};var Ma={};Ma.METERS_PER_UNIT=ma.METERS_PER_UNIT;Ma.SPHERE_=new ua(ua.DEFAULT_RADIUS);if(qn.ENABLE_PROJ4JS){Ma.setProj4=function(t){ya.set(t)}}Ma.getPointResolution=function(t,e,i,r){t=Ma.get(t);var n;var a=t.getPointResolutionFunc();if(a){n=a(e,i)}else{var s=t.getUnits();if(s==ma.DEGREES&&!r||r==ma.DEGREES){n=e}else{var o=Ma.getTransformFromProjections(t,Ma.get("EPSG:4326"));var h=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];h=o(h,h,2);var l=Ma.SPHERE_.haversineDistance(h.slice(0,2),h.slice(2,4));var u=Ma.SPHERE_.haversineDistance(h.slice(4,6),h.slice(6,8));n=(l+u)/2;var f=r?ma.METERS_PER_UNIT[r]:t.getMetersPerUnit();if(f!==undefined){n/=f}}}return n};Ma.addEquivalentProjections=function(t){Ma.addProjections(t);t.forEach((function(e){t.forEach((function(t){if(e!==t){Ra.add(e,t,Ma.cloneTransform)}}))}))};Ma.addEquivalentTransforms=function(t,e,i,r){t.forEach((function(t){e.forEach((function(e){Ra.add(t,e,i);Ra.add(e,t,r)}))}))};Ma.addProjection=function(t){Ca.add(t.getCode(),t);Ra.add(t,t,Ma.cloneTransform)};Ma.addProjections=function(t){t.forEach(Ma.addProjection)};Ma.clearAllProjections=function(){Ca.clear();Ra.clear()};Ma.createProjection=function(t,e){if(!t){return Ma.get(e)}else if(typeof t==="string"){return Ma.get(t)}else{return t}};Ma.addCoordinateTransforms=function(t,e,i,r){var n=Ma.get(t);var a=Ma.get(e);Ra.add(n,a,Ma.createTransformFromCoordinateTransform(i));Ra.add(a,n,Ma.createTransformFromCoordinateTransform(r))};Ma.createTransformFromCoordinateTransform=function(t){return function(e,i,r){var n=e.length;var a=r!==undefined?r:2;var s=i!==undefined?i:new Array(n);var o,h,l;for(h=0;h<n;h+=a){o=t([e[h],e[h+1]]);s[h]=o[0];s[h+1]=o[1];for(l=a-1;l>=2;--l){s[h+l]=e[h+l]}}return s}};Ma.fromLonLat=function(t,e){return Ma.transform(t,"EPSG:4326",e!==undefined?e:"EPSG:3857")};Ma.toLonLat=function(t,e){var i=Ma.transform(t,e!==undefined?e:"EPSG:3857","EPSG:4326");var r=i[0];if(r<-180||r>180){i[0]=ha.modulo(r+180,360)-180}return i};Ma.get=function(t){var e=null;if(t instanceof Ea){e=t}else if(typeof t==="string"){var i=t;e=Ca.get(i);if(qn.ENABLE_PROJ4JS&&!e){var r=ya.get();if(typeof r=="function"&&r.defs(i)!==undefined){e=new Ea({code:i});Ma.addProjection(e)}}}return e};Ma.equivalent=function(t,e){if(t===e){return true}var i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode()){return i}else{var r=Ma.getTransformFromProjections(t,e);return r===Ma.cloneTransform&&i}};Ma.getTransform=function(t,e){var i=Ma.get(t);var r=Ma.get(e);return Ma.getTransformFromProjections(i,r)};Ma.getTransformFromProjections=function(t,e){var i=t.getCode();var r=e.getCode();var n=Ra.get(i,r);if(qn.ENABLE_PROJ4JS&&!n){var a=ya.get();if(typeof a=="function"){var s=a.defs(i);var o=a.defs(r);if(s!==undefined&&o!==undefined){if(s===o){Ma.addEquivalentProjections([e,t])}else{var h=a(r,i);Ma.addCoordinateTransforms(e,t,h.forward,h.inverse)}n=Ra.get(i,r)}}}if(!n){n=Ma.identityTransform}return n};Ma.identityTransform=function(t,e,i){if(e!==undefined&&t!==e){for(var r=0,n=t.length;r<n;++r){e[r]=t[r]}t=e}return t};Ma.cloneTransform=function(t,e,i){var r;if(e!==undefined){for(var n=0,a=t.length;n<a;++n){e[n]=t[n]}r=e}else{r=t.slice()}return r};Ma.transform=function(t,e,i){var r=Ma.getTransform(e,i);return r(t,undefined,t.length)};Ma.transformExtent=function(t,e,i){var r=Ma.getTransform(e,i);return pa.applyTransform(t,r)};Ma.transformWithProjections=function(t,e,i){var r=Ma.getTransformFromProjections(e,i);return r(t)};Ma.addCommon=function(){Ma.addEquivalentProjections(xa.PROJECTIONS);Ma.addEquivalentProjections(Ta.PROJECTIONS);Ma.addEquivalentTransforms(Ta.PROJECTIONS,xa.PROJECTIONS,xa.fromEPSG4326,xa.toEPSG4326)};Ma.addCommon();var Sa={};Sa.tmp_=new Array(6);Sa.create=function(){return[1,0,0,1,0,0]};Sa.reset=function(t){return Sa.set(t,1,0,0,1,0,0)};Sa.multiply=function(t,e){var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=t[4];var o=t[5];var h=e[0];var l=e[1];var u=e[2];var f=e[3];var c=e[4];var d=e[5];t[0]=i*h+n*l;t[1]=r*h+a*l;t[2]=i*u+n*f;t[3]=r*u+a*f;t[4]=i*c+n*d+s;t[5]=r*c+a*d+o;return t};Sa.set=function(t,e,i,r,n,a,s){t[0]=e;t[1]=i;t[2]=r;t[3]=n;t[4]=a;t[5]=s;return t};Sa.setFromArray=function(t,e){t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=e[3];t[4]=e[4];t[5]=e[5];return t};Sa.apply=function(t,e){var i=e[0],r=e[1];e[0]=t[0]*i+t[2]*r+t[4];e[1]=t[1]*i+t[3]*r+t[5];return e};Sa.rotate=function(t,e){var i=Math.cos(e);var r=Math.sin(e);return Sa.multiply(t,Sa.set(Sa.tmp_,i,r,-r,i,0,0))};Sa.scale=function(t,e,i){return Sa.multiply(t,Sa.set(Sa.tmp_,e,0,0,i,0,0))};Sa.translate=function(t,e,i){return Sa.multiply(t,Sa.set(Sa.tmp_,1,0,0,1,e,i))};Sa.compose=function(t,e,i,r,n,a,s,o){var h=Math.sin(a);var l=Math.cos(a);t[0]=r*l;t[1]=n*h;t[2]=-r*h;t[3]=n*l;t[4]=s*r*l-o*r*h+e;t[5]=s*n*h+o*n*l+i;return t};Sa.invert=function(t){var e=Sa.determinant(t);oa.assert(e!==0,32);var i=t[0];var r=t[1];var n=t[2];var a=t[3];var s=t[4];var o=t[5];t[0]=a/e;t[1]=-r/e;t[2]=-n/e;t[3]=i/e;t[4]=(n*o-a*s)/e;t[5]=-(i*o-r*s)/e;return t};Sa.determinant=function(t){return t[0]*t[3]-t[1]*t[2]};var Ia=function(){aa.call(this);this.extent_=pa.createEmpty();this.extentRevision_=-1;this.simplifiedGeometryCache={};this.simplifiedGeometryMaxMinSquaredTolerance=0;this.simplifiedGeometryRevision=0;this.tmpTransform_=Sa.create()};qn.inherits(Ia,aa);Ia.prototype.clone=function(){};Ia.prototype.closestPointXY=function(t,e,i,r){};Ia.prototype.getClosestPoint=function(t,e){var i=e?e:[NaN,NaN];this.closestPointXY(t[0],t[1],i,Infinity);return i};Ia.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])};Ia.prototype.computeExtent=function(t){};Ia.prototype.containsXY=_a.FALSE;Ia.prototype.getExtent=function(t){if(this.extentRevision_!=this.getRevision()){this.extent_=this.computeExtent(this.extent_);this.extentRevision_=this.getRevision()}return pa.returnOrUpdate(this.extent_,t)};Ia.prototype.rotate=function(t,e){};Ia.prototype.scale=function(t,e,i){};Ia.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)};Ia.prototype.getSimplifiedGeometry=function(t){};Ia.prototype.getType=function(){};Ia.prototype.applyTransform=function(t){};Ia.prototype.intersectsExtent=function(t){};Ia.prototype.translate=function(t,e){};Ia.prototype.transform=function(t,e){var i=this.tmpTransform_;t=Ma.get(t);var r=t.getUnits()==ma.TILE_PIXELS?function(r,n,a){var s=t.getExtent();var o=t.getWorldExtent();var h=pa.getHeight(o)/pa.getHeight(s);Sa.compose(i,o[0],o[3],h,-h,0,0,0);ga.transform2D(r,0,r.length,a,i,n);return Ma.getTransform(t,e)(r,n,a)}:Ma.getTransform(t,e);this.applyTransform(r);return this};var La=function(){Ia.call(this);this.layout=va.XY;this.stride=2;this.flatCoordinates=null};qn.inherits(La,Ia);La.getLayoutForStride_=function(t){var e;if(t==2){e=va.XY}else if(t==3){e=va.XYZ}else if(t==4){e=va.XYZM}return e};La.getStrideForLayout=function(t){var e;if(t==va.XY){e=2}else if(t==va.XYZ||t==va.XYM){e=3}else if(t==va.XYZM){e=4}return e};La.prototype.containsXY=_a.FALSE;La.prototype.computeExtent=function(t){return pa.createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)};La.prototype.getCoordinates=function(){};La.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)};La.prototype.getFlatCoordinates=function(){return this.flatCoordinates};La.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)};La.prototype.getLayout=function(){return this.layout};La.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()){Qn.clear(this.simplifiedGeometryCache);this.simplifiedGeometryMaxMinSquaredTolerance=0;this.simplifiedGeometryRevision=this.getRevision()}if(t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance){return this}var e=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(e)){return this.simplifiedGeometryCache[e]}else{var i=this.getSimplifiedGeometryInternal(t);var r=i.getFlatCoordinates();if(r.length<this.flatCoordinates.length){this.simplifiedGeometryCache[e]=i;return i}else{this.simplifiedGeometryMaxMinSquaredTolerance=t;return this}}};La.prototype.getSimplifiedGeometryInternal=function(t){return this};La.prototype.getStride=function(){return this.stride};La.prototype.setFlatCoordinatesInternal=function(t,e){this.stride=La.getStrideForLayout(t);this.layout=t;this.flatCoordinates=e};La.prototype.setCoordinates=function(t,e){};La.prototype.setLayout=function(t,e,i){var r;if(t){r=La.getStrideForLayout(t)}else{var n;for(n=0;n<i;++n){if(e.length===0){this.layout=va.XY;this.stride=2;return}else{e=e[0]}}r=e.length;t=La.getLayoutForStride_(r)}this.layout=t;this.stride=r};La.prototype.applyTransform=function(t){if(this.flatCoordinates){t(this.flatCoordinates,this.flatCoordinates,this.stride);this.changed()}};La.prototype.rotate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();ga.rotate(i,0,i.length,r,t,e,i);this.changed()}};La.prototype.scale=function(t,e,i){var r=e;if(r===undefined){r=t}var n=i;if(!n){n=pa.getCenter(this.getExtent())}var a=this.getFlatCoordinates();if(a){var s=this.getStride();ga.scale(a,0,a.length,s,t,r,n,a);this.changed()}};La.prototype.translate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();ga.translate(i,0,i.length,r,t,e,i);this.changed()}};La.transform2D=function(t,e,i){var r=t.getFlatCoordinates();if(!r){return null}else{var n=t.getStride();return ga.transform2D(r,0,r.length,n,e,i)}};var Aa={};Aa.linearRing=function(t,e,i,r){var n=0;var a=t[i-r];var s=t[i-r+1];for(;e<i;e+=r){var o=t[e];var h=t[e+1];n+=s*o-a*h;a=o;s=h}return n/2};Aa.linearRings=function(t,e,i,r){var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n+=Aa.linearRing(t,e,o,r);e=o}return n};Aa.linearRingss=function(t,e,i,r){var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n+=Aa.linearRings(t,e,o,r);e=o[o.length-1]}return n};var wa={};wa.point=function(t,e,i,r,n,a,s){var o=t[e];var h=t[e+1];var l=t[i]-o;var u=t[i+1]-h;var f,c;if(l===0&&u===0){c=e}else{var d=((n-o)*l+(a-h)*u)/(l*l+u*u);if(d>1){c=i}else if(d>0){for(f=0;f<r;++f){s[f]=ha.lerp(t[e+f],t[i+f],d)}s.length=r;return}else{c=e}}for(f=0;f<r;++f){s[f]=t[c+f]}s.length=r};wa.getMaxSquaredDelta=function(t,e,i,r,n){var a=t[e];var s=t[e+1];for(e+=r;e<i;e+=r){var o=t[e];var h=t[e+1];var l=ha.squaredDistance(a,s,o,h);if(l>n){n=l}a=o;s=h}return n};wa.getsMaxSquaredDelta=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n=wa.getMaxSquaredDelta(t,e,o,r,n);e=o}return n};wa.getssMaxSquaredDelta=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];n=wa.getsMaxSquaredDelta(t,e,o,r,n);e=o[o.length-1]}return n};wa.getClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){if(e==i){return l}var f,c;if(n===0){c=ha.squaredDistance(s,o,t[e],t[e+1]);if(c<l){for(f=0;f<r;++f){h[f]=t[e+f]}h.length=r;return c}else{return l}}var d=u?u:[NaN,NaN];var p=e+r;while(p<i){wa.point(t,p-r,p,r,s,o,d);c=ha.squaredDistance(s,o,d[0],d[1]);if(c<l){l=c;for(f=0;f<r;++f){h[f]=d[f]}h.length=r;p+=r}else{p+=r*Math.max((Math.sqrt(c)-Math.sqrt(l))/n|0,1)}}if(a){wa.point(t,i-r,e,r,s,o,d);c=ha.squaredDistance(s,o,d[0],d[1]);if(c<l){l=c;for(f=0;f<r;++f){h[f]=d[f]}h.length=r}}return l};wa.getsClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){var f=u?u:[NaN,NaN];var c,d;for(c=0,d=i.length;c<d;++c){var p=i[c];l=wa.getClosestPoint(t,e,p,r,n,a,s,o,h,l,f);e=p}return l};wa.getssClosestPoint=function(t,e,i,r,n,a,s,o,h,l,u){var f=u?u:[NaN,NaN];var c,d;for(c=0,d=i.length;c<d;++c){var p=i[c];l=wa.getsClosestPoint(t,e,p,r,n,a,s,o,h,l,f);e=p[p.length-1]}return l};var Oa={};Oa.coordinate=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){t[e++]=i[n]}return e};Oa.coordinates=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){var s=i[n];var o;for(o=0;o<r;++o){t[e++]=s[o]}}return e};Oa.coordinatess=function(t,e,i,r,n){var a=n?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=Oa.coordinates(t,e,i[o],r);a[s++]=l;e=l}a.length=s;return a};Oa.coordinatesss=function(t,e,i,r,n){var a=n?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=Oa.coordinatess(t,e,i[o],r,a[s]);a[s++]=l;e=l[l.length-1]}a.length=s;return a};var ba={};ba.coordinates=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o;for(o=e;o<i;o+=r){a[s++]=t.slice(o,o+r)}a.length=s;return a};ba.coordinatess=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=i[o];a[s++]=ba.coordinates(t,e,l,r,a[s]);e=l}a.length=s;return a};ba.coordinatesss=function(t,e,i,r,n){var a=n!==undefined?n:[];var s=0;var o,h;for(o=0,h=i.length;o<h;++o){var l=i[o];a[s++]=ba.coordinatess(t,e,l,r,a[s]);e=l[l.length-1]}a.length=s;return a};var Pa={};Pa.lineString=function(t,e,i,r,n,a,s){var o=s!==undefined?s:[];if(!a){i=Pa.radialDistance(t,e,i,r,n,o,0);t=o;e=0;r=2}o.length=Pa.douglasPeucker(t,e,i,r,n,o,0);return o};Pa.douglasPeucker=function(t,e,i,r,n,a,s){var o=(i-e)/r;if(o<3){for(;e<i;e+=r){a[s++]=t[e];a[s++]=t[e+1]}return s}var h=new Array(o);h[0]=1;h[o-1]=1;var l=[e,i-r];var u=0;var f;while(l.length>0){var c=l.pop();var d=l.pop();var p=0;var v=t[d];var _=t[d+1];var g=t[c];var m=t[c+1];for(f=d+r;f<c;f+=r){var y=t[f];var E=t[f+1];var x=ha.squaredSegmentDistance(y,E,v,_,g,m);if(x>p){u=f;p=x}}if(p>n){h[(u-e)/r]=1;if(d+r<u){l.push(d,u)}if(u+r<c){l.push(u,c)}}}for(f=0;f<o;++f){if(h[f]){a[s++]=t[e+f*r];a[s++]=t[e+f*r+1]}}return s};Pa.douglasPeuckers=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];s=Pa.douglasPeucker(t,e,u,r,n,a,s);o.push(s);e=u}return s};Pa.douglasPeuckerss=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];var f=[];s=Pa.douglasPeuckers(t,e,u,r,n,a,s,f);o.push(f);e=u[u.length-1]}return s};Pa.radialDistance=function(t,e,i,r,n,a,s){if(i<=e+r){for(;e<i;e+=r){a[s++]=t[e];a[s++]=t[e+1]}return s}var o=t[e];var h=t[e+1];a[s++]=o;a[s++]=h;var l=o;var u=h;for(e+=r;e<i;e+=r){l=t[e];u=t[e+1];if(ha.squaredDistance(o,h,l,u)>n){a[s++]=l;a[s++]=u;o=l;h=u}}if(l!=o||u!=h){a[s++]=l;a[s++]=u}return s};Pa.snap=function(t,e){return e*Math.round(t/e)};Pa.quantize=function(t,e,i,r,n,a,s){if(e==i){return s}var o=Pa.snap(t[e],n);var h=Pa.snap(t[e+1],n);e+=r;a[s++]=o;a[s++]=h;var l,u;do{l=Pa.snap(t[e],n);u=Pa.snap(t[e+1],n);e+=r;if(e==i){a[s++]=l;a[s++]=u;return s}}while(l==o&&u==h);while(e<i){var f,c;f=Pa.snap(t[e],n);c=Pa.snap(t[e+1],n);e+=r;if(f==l&&c==u){continue}var d=l-o;var p=u-h;var v=f-o;var _=c-h;if(d*_==p*v&&(d<0&&v<d||d==v||d>0&&v>d)&&(p<0&&_<p||p==_||p>0&&_>p)){l=f;u=c;continue}a[s++]=l;a[s++]=u;o=l;h=u;l=f;u=c}a[s++]=l;a[s++]=u;return s};Pa.quantizes=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];s=Pa.quantize(t,e,u,r,n,a,s);o.push(s);e=u}return s};Pa.quantizess=function(t,e,i,r,n,a,s,o){var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];var f=[];s=Pa.quantizes(t,e,u,r,n,a,s,f);o.push(f);e=u[u.length-1]}return s};var Da=function(t,e){La.call(this);this.maxDelta_=-1;this.maxDeltaRevision_=-1;this.setCoordinates(t,e)};qn.inherits(Da,La);Da.prototype.clone=function(){var t=new Da(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice());return t};Da.prototype.closestPointXY=function(t,e,i,r){if(r<pa.closestSquaredDistanceXY(this.getExtent(),t,e)){return r}if(this.maxDeltaRevision_!=this.getRevision()){this.maxDelta_=Math.sqrt(wa.getMaxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0));this.maxDeltaRevision_=this.getRevision()}return wa.getClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,true,t,e,i,r)};Da.prototype.getArea=function(){return Aa.linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Da.prototype.getCoordinates=function(){return ba.coordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Da.prototype.getSimplifiedGeometryInternal=function(t){var e=[];e.length=Pa.douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0);var i=new Da(null);i.setFlatCoordinates(va.XY,e);return i};Da.prototype.getType=function(){return la.LINEAR_RING};Da.prototype.intersectsExtent=function(t){};Da.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null)}else{this.setLayout(e,t,1);if(!this.flatCoordinates){this.flatCoordinates=[]}this.flatCoordinates.length=Oa.coordinates(this.flatCoordinates,0,t,this.stride);this.changed()}};Da.prototype.setFlatCoordinates=function(t,e){this.setFlatCoordinatesInternal(t,e);this.changed()};var Fa=function(t,e){La.call(this);this.setCoordinates(t,e)};qn.inherits(Fa,La);Fa.prototype.clone=function(){var t=new Fa(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice());return t};Fa.prototype.closestPointXY=function(t,e,i,r){var n=this.flatCoordinates;var a=ha.squaredDistance(t,e,n[0],n[1]);if(a<r){var s=this.stride;var o;for(o=0;o<s;++o){i[o]=n[o]}i.length=s;return a}else{return r}};Fa.prototype.getCoordinates=function(){return!this.flatCoordinates?[]:this.flatCoordinates.slice()};Fa.prototype.computeExtent=function(t){return pa.createOrUpdateFromCoordinate(this.flatCoordinates,t)};Fa.prototype.getType=function(){return la.POINT};Fa.prototype.intersectsExtent=function(t){return pa.containsXY(t,this.flatCoordinates[0],this.flatCoordinates[1])};Fa.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null)}else{this.setLayout(e,t,0);if(!this.flatCoordinates){this.flatCoordinates=[]}this.flatCoordinates.length=Oa.coordinate(this.flatCoordinates,0,t,this.stride);this.changed()}};Fa.prototype.setFlatCoordinates=function(t,e){this.setFlatCoordinatesInternal(t,e);this.changed()};var Na={};Na.linearRingContainsExtent=function(t,e,i,r,n){var a=pa.forEachCorner(n,(function(n){return!Na.linearRingContainsXY(t,e,i,r,n[0],n[1])}));return!a};Na.linearRingContainsXY=function(t,e,i,r,n,a){var s=0;var o=t[i-r];var h=t[i-r+1];for(;e<i;e+=r){var l=t[e];var u=t[e+1];if(h<=a){if(u>a&&(l-o)*(a-h)-(n-o)*(u-h)>0){s++}}else if(u<=a&&(l-o)*(a-h)-(n-o)*(u-h)<0){s--}o=l;h=u}return s!==0};Na.linearRingsContainsXY=function(t,e,i,r,n,a){if(i.length===0){return false}if(!Na.linearRingContainsXY(t,e,i[0],r,n,a)){return false}var s,o;for(s=1,o=i.length;s<o;++s){if(Na.linearRingContainsXY(t,i[s-1],i[s],r,n,a)){return false}}return true};Na.linearRingssContainsXY=function(t,e,i,r,n,a){if(i.length===0){return false}var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];if(Na.linearRingsContainsXY(t,e,h,r,n,a)){return true}e=h[h.length-1]}return false};var Ga={};Ga.linearRings=function(t,e,i,r,n,a,s){var o,h,l,u,f,c,d;var p=n[a+1];var v=[];for(var _=0,g=i.length;_<g;++_){var m=i[_];u=t[m-r];c=t[m-r+1];for(o=e;o<m;o+=r){f=t[o];d=t[o+1];if(p<=c&&d<=p||c<=p&&p<=d){l=(p-c)/(d-c)*(f-u)+u;v.push(l)}u=f;c=d}}var y=NaN;var E=-Infinity;v.sort(fa.numberSafeCompareFunction);u=v[0];for(o=1,h=v.length;o<h;++o){f=v[o];var x=Math.abs(f-u);if(x>E){l=(u+f)/2;if(Na.linearRingsContainsXY(t,e,i,r,l,p)){y=l;E=x}}u=f}if(isNaN(y)){y=n[a]}if(s){s.push(y,p,E);return s}else{return[y,p,E]}};Ga.linearRingss=function(t,e,i,r,n){var a=[];var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];a=Ga.linearRings(t,e,h,r,n,2*s,a);e=h[h.length-1]}return a};var ka={};ka.forEach=function(t,e,i,r,n,a){var s=[t[e],t[e+1]];var o=[];var h;for(;e+r<i;e+=r){o[0]=t[e+r];o[1]=t[e+r+1];h=n.call(a,s,o);if(h){return h}s[0]=o[0];s[1]=o[1]}return false};var Ua={};Ua.lineString=function(t,e,i,r,n){var a=pa.extendFlatCoordinates(pa.createEmpty(),t,e,i,r);if(!pa.intersects(n,a)){return false}if(pa.containsExtent(n,a)){return true}if(a[0]>=n[0]&&a[2]<=n[2]){return true}if(a[1]>=n[1]&&a[3]<=n[3]){return true}return ka.forEach(t,e,i,r,(function(t,e){return pa.intersectsSegment(n,t,e)}))};Ua.lineStrings=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){if(Ua.lineString(t,e,i[a],r,n)){return true}e=i[a]}return false};Ua.linearRing=function(t,e,i,r,n){if(Ua.lineString(t,e,i,r,n)){return true}if(Na.linearRingContainsXY(t,e,i,r,n[0],n[1])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[0],n[3])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[2],n[1])){return true}if(Na.linearRingContainsXY(t,e,i,r,n[2],n[3])){return true}return false};Ua.linearRings=function(t,e,i,r,n){if(!Ua.linearRing(t,e,i[0],r,n)){return false}if(i.length===1){return true}var a,s;for(a=1,s=i.length;a<s;++a){if(Na.linearRingContainsExtent(t,i[a-1],i[a],r,n)){return false}}return true};Ua.linearRingss=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];if(Ua.linearRings(t,e,o,r,n)){return true}e=o[o.length-1]}return false};var za={};za.coordinates=function(t,e,i,r){while(e<i-r){var n;for(n=0;n<r;++n){var a=t[e+n];t[e+n]=t[i-r+n];t[i-r+n]=a}e+=r;i-=r}};var Ba={};Ba.linearRingIsClockwise=function(t,e,i,r){var n=0;var a=t[i-r];var s=t[i-r+1];for(;e<i;e+=r){var o=t[e];var h=t[e+1];n+=(o-a)*(h+s);a=o;s=h}return n>0};Ba.linearRingsAreOriented=function(t,e,i,r,n){var a=n!==undefined?n:false;var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];var l=Ba.linearRingIsClockwise(t,e,h,r);if(s===0){if(a&&l||!a&&!l){return false}}else{if(a&&!l||!a&&l){return false}}e=h}return true};Ba.linearRingssAreOriented=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){if(!Ba.linearRingsAreOriented(t,e,i[a],r,n)){return false}}return true};Ba.orientLinearRings=function(t,e,i,r,n){var a=n!==undefined?n:false;var s,o;for(s=0,o=i.length;s<o;++s){var h=i[s];var l=Ba.linearRingIsClockwise(t,e,h,r);var u=s===0?a&&l||!a&&!l:a&&!l||!a&&l;if(u){za.coordinates(t,e,h,r)}e=h}return e};Ba.orientLinearRingss=function(t,e,i,r,n){var a,s;for(a=0,s=i.length;a<s;++a){e=Ba.orientLinearRings(t,e,i[a],r,n)}return e};var Wa=function(t,e){La.call(this);this.ends_=[];this.flatInteriorPointRevision_=-1;this.flatInteriorPoint_=null;this.maxDelta_=-1;this.maxDeltaRevision_=-1;this.orientedRevision_=-1;this.orientedFlatCoordinates_=null;this.setCoordinates(t,e)};qn.inherits(Wa,La);Wa.prototype.appendLinearRing=function(t){if(!this.flatCoordinates){this.flatCoordinates=t.getFlatCoordinates().slice()}else{fa.extend(this.flatCoordinates,t.getFlatCoordinates())}this.ends_.push(this.flatCoordinates.length);this.changed()};Wa.prototype.clone=function(){var t=new Wa(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice(),this.ends_.slice());return t};Wa.prototype.closestPointXY=function(t,e,i,r){if(r<pa.closestSquaredDistanceXY(this.getExtent(),t,e)){return r}if(this.maxDeltaRevision_!=this.getRevision()){this.maxDelta_=Math.sqrt(wa.getsMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0));this.maxDeltaRevision_=this.getRevision()}return wa.getsClosestPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,true,t,e,i,r)};Wa.prototype.containsXY=function(t,e){return Na.linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)};Wa.prototype.getArea=function(){return Aa.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)};Wa.prototype.getCoordinates=function(t){var e;if(t!==undefined){e=this.getOrientedFlatCoordinates().slice();Ba.orientLinearRings(e,0,this.ends_,this.stride,t)}else{e=this.flatCoordinates}return ba.coordinatess(e,0,this.ends_,this.stride)};Wa.prototype.getEnds=function(){return this.ends_};Wa.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=pa.getCenter(this.getExtent());this.flatInteriorPoint_=Ga.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0);this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_};Wa.prototype.getInteriorPoint=function(){return new Fa(this.getFlatInteriorPoint(),va.XYM)};Wa.prototype.getLinearRingCount=function(){return this.ends_.length};Wa.prototype.getLinearRing=function(t){if(t<0||this.ends_.length<=t){return null}var e=new Da(null);e.setFlatCoordinates(this.layout,this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]));return e};Wa.prototype.getLinearRings=function(){var t=this.layout;var e=this.flatCoordinates;var i=this.ends_;var r=[];var n=0;var a,s;for(a=0,s=i.length;a<s;++a){var o=i[a];var h=new Da(null);h.setFlatCoordinates(t,e.slice(n,o));r.push(h);n=o}return r};Wa.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;if(Ba.linearRingsAreOriented(t,0,this.ends_,this.stride)){this.orientedFlatCoordinates_=t}else{this.orientedFlatCoordinates_=t.slice();this.orientedFlatCoordinates_.length=Ba.orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)}this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_};Wa.prototype.getSimplifiedGeometryInternal=function(t){var e=[];var i=[];e.length=Pa.quantizes(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i);var r=new Wa(null);r.setFlatCoordinates(va.XY,e,i);return r};Wa.prototype.getType=function(){return la.POLYGON};Wa.prototype.intersectsExtent=function(t){return Ua.linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)};Wa.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null,this.ends_)}else{this.setLayout(e,t,2);if(!this.flatCoordinates){this.flatCoordinates=[]}var i=Oa.coordinatess(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1];this.changed()}};Wa.prototype.setFlatCoordinates=function(t,e,i){this.setFlatCoordinatesInternal(t,e);this.ends_=i;this.changed()};Wa.circular=function(t,e,i,r){var n=r?r:32;var a=[];var s;for(s=0;s<n;++s){fa.extend(a,t.offset(e,i,2*Math.PI*s/n))}a.push(a[0],a[1]);var o=new Wa(null);o.setFlatCoordinates(va.XY,a,[a.length]);return o};Wa.fromExtent=function(t){var e=t[0];var i=t[1];var r=t[2];var n=t[3];var a=[e,i,e,n,r,n,r,i,e,i];var s=new Wa(null);s.setFlatCoordinates(va.XY,a,[a.length]);return s};Wa.fromCircle=function(t,e,i){var r=e?e:32;var n=t.getStride();var a=t.getLayout();var s=new Wa(null,a);var o=n*(r+1);var h=new Array(o);for(var l=0;l<o;l++){h[l]=0}var u=[h.length];s.setFlatCoordinates(a,h,u);Wa.makeRegular(s,t.getCenter(),t.getRadius(),i);return s};Wa.makeRegular=function(t,e,i,r){var n=t.getFlatCoordinates();var a=t.getLayout();var s=t.getStride();var o=t.getEnds();var h=n.length/s-1;var l=r?r:0;var u,f;for(var c=0;c<=h;++c){f=c*s;u=l+ha.modulo(c,h)*2*Math.PI/h;n[f]=e[0]+i*Math.cos(u);n[f+1]=e[1]+i*Math.sin(u)}t.setFlatCoordinates(a,n,o)};var Xa={};Xa.ONE=1;Xa.SRC_ALPHA=770;Xa.COLOR_ATTACHMENT0=36064;Xa.COLOR_BUFFER_BIT=16384;Xa.TRIANGLES=4;Xa.TRIANGLE_STRIP=5;Xa.ONE_MINUS_SRC_ALPHA=771;Xa.ARRAY_BUFFER=34962;Xa.ELEMENT_ARRAY_BUFFER=34963;Xa.STREAM_DRAW=35040;Xa.STATIC_DRAW=35044;Xa.DYNAMIC_DRAW=35048;Xa.CULL_FACE=2884;Xa.BLEND=3042;Xa.STENCIL_TEST=2960;Xa.DEPTH_TEST=2929;Xa.SCISSOR_TEST=3089;Xa.UNSIGNED_BYTE=5121;Xa.UNSIGNED_SHORT=5123;Xa.UNSIGNED_INT=5125;Xa.FLOAT=5126;Xa.RGBA=6408;Xa.FRAGMENT_SHADER=35632;Xa.VERTEX_SHADER=35633;Xa.LINK_STATUS=35714;Xa.LINEAR=9729;Xa.TEXTURE_MAG_FILTER=10240;Xa.TEXTURE_MIN_FILTER=10241;Xa.TEXTURE_WRAP_S=10242;Xa.TEXTURE_WRAP_T=10243;Xa.TEXTURE_2D=3553;Xa.TEXTURE0=33984;Xa.CLAMP_TO_EDGE=33071;Xa.COMPILE_STATUS=35713;Xa.FRAMEBUFFER=36160;Xa.CONTEXT_IDS_=["experimental-webgl","webgl","webkit-3d","moz-webgl"];Xa.getContext=function(t,e){var i,r,n=Xa.CONTEXT_IDS_.length;for(r=0;r<n;++r){try{i=t.getContext(Xa.CONTEXT_IDS_[r],e);if(i){return i}}catch(a){}}return null};var Va={};var Ya=typeof navigator!=="undefined"?navigator.userAgent.toLowerCase():"";Va.FIREFOX=Ya.indexOf("firefox")!==-1;Va.SAFARI=Ya.indexOf("safari")!==-1&&Ya.indexOf("chrom")==-1;Va.WEBKIT=Ya.indexOf("webkit")!==-1&&Ya.indexOf("edge")==-1;Va.MAC=Ya.indexOf("macintosh")!==-1;Va.DEVICE_PIXEL_RATIO=window.devicePixelRatio||1;Va.CANVAS_LINE_DASH=false;Va.CANVAS=qn.ENABLE_CANVAS&&function(){if(!("HTMLCanvasElement"in window)){return false}try{var t=document.createElement("CANVAS").getContext("2d");if(!t){return false}else{if(t.setLineDash!==undefined){Va.CANVAS_LINE_DASH=true}return true}}catch(e){return false}}();Va.DEVICE_ORIENTATION="DeviceOrientationEvent"in window;Va.GEOLOCATION="geolocation"in navigator;Va.TOUCH=qn.ASSUME_TOUCH||"ontouchstart"in window;Va.POINTER="PointerEvent"in window;Va.MSPOINTER=!!navigator.msPointerEnabled;(function(){if(qn.ENABLE_WEBGL){var t=false;var e;var i=[];if("WebGLRenderingContext"in window){try{var r=document.createElement("CANVAS");var n=Xa.getContext(r,{failIfMajorPerformanceCaveat:true});if(n){t=true;e=n.getParameter(n.MAX_TEXTURE_SIZE);i=n.getSupportedExtensions()}}catch(a){}}Va.WEBGL=t;qn.WEBGL_EXTENSIONS=i;qn.WEBGL_MAX_TEXTURE_SIZE=e}})();var ja=function(t){aa.call(this);var e=t||{};this.position_=null;this.transform_=Ma.identityTransform;this.sphere_=new ua(Ta.RADIUS);this.watchId_=undefined;$n.listen(this,aa.getChangeEventType(Zn.PROJECTION),this.handleProjectionChanged_,this);$n.listen(this,aa.getChangeEventType(Zn.TRACKING),this.handleTrackingChanged_,this);if(e.projection!==undefined){this.setProjection(e.projection)}if(e.trackingOptions!==undefined){this.setTrackingOptions(e.trackingOptions)}this.setTracking(e.tracking!==undefined?e.tracking:false)};qn.inherits(ja,aa);ja.prototype.disposeInternal=function(){this.setTracking(false);aa.prototype.disposeInternal.call(this)};ja.prototype.handleProjectionChanged_=function(){var t=this.getProjection();if(t){this.transform_=Ma.getTransformFromProjections(Ma.get("EPSG:4326"),t);if(this.position_){this.set(Zn.POSITION,this.transform_(this.position_))}}};ja.prototype.handleTrackingChanged_=function(){if(Va.GEOLOCATION){var t=this.getTracking();if(t&&this.watchId_===undefined){this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions())}else if(!t&&this.watchId_!==undefined){navigator.geolocation.clearWatch(this.watchId_);this.watchId_=undefined}}};ja.prototype.positionChange_=function(t){var e=t.coords;this.set(Zn.ACCURACY,e.accuracy);this.set(Zn.ALTITUDE,e.altitude===null?undefined:e.altitude);this.set(Zn.ALTITUDE_ACCURACY,e.altitudeAccuracy===null?undefined:e.altitudeAccuracy);this.set(Zn.HEADING,e.heading===null?undefined:ha.toRadians(e.heading));if(!this.position_){this.position_=[e.longitude,e.latitude]}else{this.position_[0]=e.longitude;this.position_[1]=e.latitude}var i=this.transform_(this.position_);this.set(Zn.POSITION,i);this.set(Zn.SPEED,e.speed===null?undefined:e.speed);var r=Wa.circular(this.sphere_,this.position_,e.accuracy);r.applyTransform(this.transform_);this.set(Zn.ACCURACY_GEOMETRY,r);this.changed()};ja.prototype.positionError_=function(t){t.type=ra.ERROR;this.setTracking(false);this.dispatchEvent(t)};ja.prototype.getAccuracy=function(){return this.get(Zn.ACCURACY)};ja.prototype.getAccuracyGeometry=function(){return this.get(Zn.ACCURACY_GEOMETRY)||null};ja.prototype.getAltitude=function(){return this.get(Zn.ALTITUDE)};ja.prototype.getAltitudeAccuracy=function(){return this.get(Zn.ALTITUDE_ACCURACY)};ja.prototype.getHeading=function(){return this.get(Zn.HEADING)};ja.prototype.getPosition=function(){return this.get(Zn.POSITION)};ja.prototype.getProjection=function(){return this.get(Zn.PROJECTION)};ja.prototype.getSpeed=function(){return this.get(Zn.SPEED)};ja.prototype.getTracking=function(){return this.get(Zn.TRACKING)};ja.prototype.getTrackingOptions=function(){return this.get(Zn.TRACKING_OPTIONS)};ja.prototype.setProjection=function(t){this.set(Zn.PROJECTION,Ma.get(t))};ja.prototype.setTracking=function(t){this.set(Zn.TRACKING,t)};ja.prototype.setTrackingOptions=function(t){this.set(Zn.TRACKING_OPTIONS,t)};var Ha={ADD:"add",REMOVE:"remove"};var Ka=function(t,e){aa.call(this);var i=e||{};this.unique_=!!i.unique;this.array_=t?t:[];if(this.unique_){for(var r=0,n=this.array_.length;r<n;++r){this.assertUnique_(this.array_[r],r)}}this.updateLength_()};qn.inherits(Ka,aa);Ka.prototype.clear=function(){while(this.getLength()>0){this.pop()}};Ka.prototype.extend=function(t){var e,i;for(e=0,i=t.length;e<i;++e){this.push(t[e])}return this};Ka.prototype.forEach=function(t,e){var i=e?t.bind(e):t;var r=this.array_;for(var n=0,a=r.length;n<a;++n){i(r[n],n,r)}};Ka.prototype.getArray=function(){return this.array_};Ka.prototype.item=function(t){return this.array_[t]};Ka.prototype.getLength=function(){return this.get(Ka.Property_.LENGTH)};Ka.prototype.insertAt=function(t,e){if(this.unique_){this.assertUnique_(e)}this.array_.splice(t,0,e);this.updateLength_();this.dispatchEvent(new Ka.Event(Ha.ADD,e))};Ka.prototype.pop=function(){return this.removeAt(this.getLength()-1)};Ka.prototype.push=function(t){if(this.unique_){this.assertUnique_(t)}var e=this.getLength();this.insertAt(e,t);return this.getLength()};Ka.prototype.remove=function(t){var e=this.array_;var i,r;for(i=0,r=e.length;i<r;++i){if(e[i]===t){return this.removeAt(i)}}return undefined};Ka.prototype.removeAt=function(t){var e=this.array_[t];this.array_.splice(t,1);this.updateLength_();this.dispatchEvent(new Ka.Event(Ha.REMOVE,e));return e};Ka.prototype.setAt=function(t,e){var i=this.getLength();if(t<i){if(this.unique_){this.assertUnique_(e,t)}var r=this.array_[t];this.array_[t]=e;this.dispatchEvent(new Ka.Event(Ha.REMOVE,r));this.dispatchEvent(new Ka.Event(Ha.ADD,e))}else{var n;for(n=i;n<t;++n){this.insertAt(n,undefined)}this.insertAt(t,e)}};Ka.prototype.updateLength_=function(){this.set(Ka.Property_.LENGTH,this.array_.length)};Ka.prototype.assertUnique_=function(t,e){for(var i=0,r=this.array_.length;i<r;++i){if(this.array_[i]===t&&i!==e){throw new sa(58)}}};Ka.Property_={LENGTH:"length"};Ka.Event=function(t,e){ea.call(this,t);this.element=e};qn.inherits(Ka.Event,ea);var qa=function(t,e,i){ea.call(this,t);this.map=e;this.frameState=i!==undefined?i:null};qn.inherits(qa,ea);var Za=function(t,e,i,r,n){qa.call(this,t,e,n);this.originalEvent=i;this.pixel=e.getEventPixel(i);this.coordinate=e.getCoordinateFromPixel(this.pixel);this.dragging=r!==undefined?r:false};qn.inherits(Za,qa);Za.prototype.preventDefault=function(){qa.prototype.preventDefault.call(this);this.originalEvent.preventDefault()};Za.prototype.stopPropagation=function(){qa.prototype.stopPropagation.call(this);this.originalEvent.stopPropagation()};var Ja={SINGLECLICK:"singleclick",CLICK:ra.CLICK,DBLCLICK:ra.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Qa=function(t,e,i,r,n){Za.call(this,t,e,i.originalEvent,r,n);this.pointerEvent=i};qn.inherits(Qa,Za);var $a={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var ts=function(t,e){this.dispatcher=t;this.mapping_=e};ts.prototype.getEvents=function(){return Object.keys(this.mapping_)};ts.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var es=function(t){var e={mousedown:this.mousedown,mousemove:this.mousemove,mouseup:this.mouseup,mouseover:this.mouseover,mouseout:this.mouseout};ts.call(this,t,e);this.pointerMap=t.pointerMap;this.lastTouches=[]};qn.inherits(es,ts);es.POINTER_ID=1;es.POINTER_TYPE="mouse";es.DEDUP_DIST=25;es.prototype.isEventSimulatedFromTouch_=function(t){var e=this.lastTouches;var i=t.clientX,r=t.clientY;for(var n=0,a=e.length,s;n<a&&(s=e[n]);n++){var o=Math.abs(i-s[0]),h=Math.abs(r-s[1]);if(o<=es.DEDUP_DIST&&h<=es.DEDUP_DIST){return true}}return false};es.prepareEvent=function(t,e){var i=e.cloneEvent(t,t);var r=i.preventDefault;i.preventDefault=function(){t.preventDefault();r()};i.pointerId=es.POINTER_ID;i.isPrimary=true;i.pointerType=es.POINTER_TYPE;return i};es.prototype.mousedown=function(t){if(!this.isEventSimulatedFromTouch_(t)){if(es.POINTER_ID.toString()in this.pointerMap){this.cancel(t)}var e=es.prepareEvent(t,this.dispatcher);this.pointerMap[es.POINTER_ID.toString()]=t;this.dispatcher.down(e,t)}};es.prototype.mousemove=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.move(e,t)}};es.prototype.mouseup=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=this.pointerMap[es.POINTER_ID.toString()];if(e&&e.button===t.button){var i=es.prepareEvent(t,this.dispatcher);this.dispatcher.up(i,t);this.cleanupMouse()}}};es.prototype.mouseover=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.enterOver(e,t)}};es.prototype.mouseout=function(t){if(!this.isEventSimulatedFromTouch_(t)){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.leaveOut(e,t)}};es.prototype.cancel=function(t){var e=es.prepareEvent(t,this.dispatcher);this.dispatcher.cancel(e,t);this.cleanupMouse()};es.prototype.cleanupMouse=function(){delete this.pointerMap[es.POINTER_ID.toString()]};var is=function(t){var e={MSPointerDown:this.msPointerDown,MSPointerMove:this.msPointerMove,MSPointerUp:this.msPointerUp,MSPointerOut:this.msPointerOut,MSPointerOver:this.msPointerOver,MSPointerCancel:this.msPointerCancel,MSGotPointerCapture:this.msGotPointerCapture,MSLostPointerCapture:this.msLostPointerCapture};ts.call(this,t,e);this.pointerMap=t.pointerMap;this.POINTER_TYPES=["","unavailable","touch","pen","mouse"]};qn.inherits(is,ts);is.prototype.prepareEvent_=function(t){var e=t;if(typeof t.pointerType==="number"){e=this.dispatcher.cloneEvent(t,t);e.pointerType=this.POINTER_TYPES[t.pointerType]}return e};is.prototype.cleanup=function(t){delete this.pointerMap[t.toString()]};is.prototype.msPointerDown=function(t){this.pointerMap[t.pointerId.toString()]=t;var e=this.prepareEvent_(t);this.dispatcher.down(e,t)};is.prototype.msPointerMove=function(t){var e=this.prepareEvent_(t);this.dispatcher.move(e,t)};is.prototype.msPointerUp=function(t){var e=this.prepareEvent_(t);this.dispatcher.up(e,t);this.cleanup(t.pointerId)};is.prototype.msPointerOut=function(t){var e=this.prepareEvent_(t);this.dispatcher.leaveOut(e,t)};is.prototype.msPointerOver=function(t){var e=this.prepareEvent_(t);this.dispatcher.enterOver(e,t)};is.prototype.msPointerCancel=function(t){var e=this.prepareEvent_(t);this.dispatcher.cancel(e,t);this.cleanup(t.pointerId)};is.prototype.msLostPointerCapture=function(t){var e=this.dispatcher.makeEvent("lostpointercapture",t,t);this.dispatcher.dispatchEvent(e)};is.prototype.msGotPointerCapture=function(t){var e=this.dispatcher.makeEvent("gotpointercapture",t,t);this.dispatcher.dispatchEvent(e)};var rs=function(t){var e={pointerdown:this.pointerDown,pointermove:this.pointerMove,pointerup:this.pointerUp,pointerout:this.pointerOut,pointerover:this.pointerOver,pointercancel:this.pointerCancel,gotpointercapture:this.gotPointerCapture,lostpointercapture:this.lostPointerCapture};ts.call(this,t,e)};qn.inherits(rs,ts);rs.prototype.pointerDown=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerMove=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerUp=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerOut=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerOver=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.pointerCancel=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.lostPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};rs.prototype.gotPointerCapture=function(t){this.dispatcher.fireNativeEvent(t)};var ns=function(t,e,i){ea.call(this,t);this.originalEvent=e;var r=i?i:{};this.buttons=this.getButtons_(r);this.pressure=this.getPressure_(r,this.buttons);this.bubbles="bubbles"in r?r["bubbles"]:false;this.cancelable="cancelable"in r?r["cancelable"]:false;this.view="view"in r?r["view"]:null;this.detail="detail"in r?r["detail"]:null;this.screenX="screenX"in r?r["screenX"]:0;this.screenY="screenY"in r?r["screenY"]:0;this.clientX="clientX"in r?r["clientX"]:0;this.clientY="clientY"in r?r["clientY"]:0;this.ctrlKey="ctrlKey"in r?r["ctrlKey"]:false;this.altKey="altKey"in r?r["altKey"]:false;this.shiftKey="shiftKey"in r?r["shiftKey"]:false;this.metaKey="metaKey"in r?r["metaKey"]:false;this.button="button"in r?r["button"]:0;this.relatedTarget="relatedTarget"in r?r["relatedTarget"]:null;this.pointerId="pointerId"in r?r["pointerId"]:0;this.width="width"in r?r["width"]:0;this.height="height"in r?r["height"]:0;this.tiltX="tiltX"in r?r["tiltX"]:0;this.tiltY="tiltY"in r?r["tiltY"]:0;this.pointerType="pointerType"in r?r["pointerType"]:"";this.hwTimestamp="hwTimestamp"in r?r["hwTimestamp"]:0;this.isPrimary="isPrimary"in r?r["isPrimary"]:false;if(e.preventDefault){this.preventDefault=function(){e.preventDefault()}}};qn.inherits(ns,ea);ns.prototype.getButtons_=function(t){var e;if(t.buttons||ns.HAS_BUTTONS){e=t.buttons}else{switch(t.which){case 1:e=1;break;case 2:e=4;break;case 3:e=2;break;default:e=0}}return e};ns.prototype.getPressure_=function(t,e){var i=0;if(t.pressure){i=t.pressure}else{i=e?.5:0}return i};ns.HAS_BUTTONS=false;(function(){try{var t=new MouseEvent("click",{buttons:1});ns.HAS_BUTTONS=t.buttons===1}catch(e){}})();var as=function(t,e){var i={touchstart:this.touchstart,touchmove:this.touchmove,touchend:this.touchend,touchcancel:this.touchcancel};ts.call(this,t,i);this.pointerMap=t.pointerMap;this.mouseSource=e;this.firstTouchId_=undefined;this.clickCount_=0;this.resetId_=undefined};qn.inherits(as,ts);as.DEDUP_TIMEOUT=2500;as.CLICK_COUNT_TIMEOUT=200;as.POINTER_TYPE="touch";as.prototype.isPrimaryTouch_=function(t){return this.firstTouchId_===t.identifier};as.prototype.setPrimaryTouch_=function(t){var e=Object.keys(this.pointerMap).length;if(e===0||e===1&&es.POINTER_ID.toString()in this.pointerMap){this.firstTouchId_=t.identifier;this.cancelResetClickCount_()}};as.prototype.removePrimaryPointer_=function(t){if(t.isPrimary){this.firstTouchId_=undefined;this.resetClickCount_()}};as.prototype.resetClickCount_=function(){this.resetId_=setTimeout(this.resetClickCountHandler_.bind(this),as.CLICK_COUNT_TIMEOUT)};as.prototype.resetClickCountHandler_=function(){this.clickCount_=0;this.resetId_=undefined};as.prototype.cancelResetClickCount_=function(){if(this.resetId_!==undefined){clearTimeout(this.resetId_)}};as.prototype.touchToPointer_=function(t,e){var i=this.dispatcher.cloneEvent(t,e);i.pointerId=e.identifier+2;i.bubbles=true;i.cancelable=true;i.detail=this.clickCount_;i.button=0;i.buttons=1;i.width=e.webkitRadiusX||e.radiusX||0;i.height=e.webkitRadiusY||e.radiusY||0;i.pressure=e.webkitForce||e.force||.5;i.isPrimary=this.isPrimaryTouch_(e);i.pointerType=as.POINTER_TYPE;i.clientX=e.clientX;i.clientY=e.clientY;i.screenX=e.screenX;i.screenY=e.screenY;return i};as.prototype.processTouches_=function(t,e){var i=Array.prototype.slice.call(t.changedTouches);var r=i.length;function n(){t.preventDefault()}var a,s;for(a=0;a<r;++a){s=this.touchToPointer_(t,i[a]);s.preventDefault=n;e.call(this,t,s)}};as.prototype.findTouch_=function(t,e){var i=t.length;var r;for(var n=0;n<i;n++){r=t[n];if(r.identifier===e){return true}}return false};as.prototype.vacuumTouches_=function(t){var e=t.touches;var i=Object.keys(this.pointerMap);var r=i.length;if(r>=e.length){var n=[];var a,s,o;for(a=0;a<r;++a){s=i[a];o=this.pointerMap[s];if(s!=es.POINTER_ID&&!this.findTouch_(e,s-2)){n.push(o.out)}}for(a=0;a<n.length;++a){this.cancelOut_(t,n[a])}}};as.prototype.touchstart=function(t){this.vacuumTouches_(t);this.setPrimaryTouch_(t.changedTouches[0]);this.dedupSynthMouse_(t);this.clickCount_++;this.processTouches_(t,this.overDown_)};as.prototype.overDown_=function(t,e){this.pointerMap[e.pointerId]={target:e.target,out:e,outTarget:e.target};this.dispatcher.over(e,t);this.dispatcher.enter(e,t);this.dispatcher.down(e,t)};as.prototype.touchmove=function(t){t.preventDefault();this.processTouches_(t,this.moveOverOut_)};as.prototype.moveOverOut_=function(t,e){var i=e;var r=this.pointerMap[i.pointerId];if(!r){return}var n=r.out;var a=r.outTarget;this.dispatcher.move(i,t);if(n&&a!==i.target){n.relatedTarget=i.target;i.relatedTarget=a;n.target=a;if(i.target){this.dispatcher.leaveOut(n,t);this.dispatcher.enterOver(i,t)}else{i.target=a;i.relatedTarget=null;this.cancelOut_(t,i)}}r.out=i;r.outTarget=i.target};as.prototype.touchend=function(t){this.dedupSynthMouse_(t);this.processTouches_(t,this.upOut_)};as.prototype.upOut_=function(t,e){this.dispatcher.up(e,t);this.dispatcher.out(e,t);this.dispatcher.leave(e,t);this.cleanUpPointer_(e)};as.prototype.touchcancel=function(t){this.processTouches_(t,this.cancelOut_)};as.prototype.cancelOut_=function(t,e){this.dispatcher.cancel(e,t);this.dispatcher.out(e,t);this.dispatcher.leave(e,t);this.cleanUpPointer_(e)};as.prototype.cleanUpPointer_=function(t){delete this.pointerMap[t.pointerId];this.removePrimaryPointer_(t)};as.prototype.dedupSynthMouse_=function(t){var e=this.mouseSource.lastTouches;var i=t.changedTouches[0];if(this.isPrimaryTouch_(i)){var r=[i.clientX,i.clientY];e.push(r);setTimeout((function(){fa.remove(e,r)}),as.DEDUP_TIMEOUT)}};var ss=function(t){ia.call(this);this.element_=t;this.pointerMap={};this.eventMap_={};this.eventSourceList_=[];this.registerSources()};qn.inherits(ss,ia);ss.prototype.registerSources=function(){if(Va.POINTER){this.registerSource("native",new rs(this))}else if(Va.MSPOINTER){this.registerSource("ms",new is(this))}else{var t=new es(this);this.registerSource("mouse",t);if(Va.TOUCH){this.registerSource("touch",new as(this,t))}}this.register_()};ss.prototype.registerSource=function(t,e){var i=e;var r=i.getEvents();if(r){r.forEach((function(t){var e=i.getHandlerForEvent(t);if(e){this.eventMap_[t]=e.bind(i)}}),this);this.eventSourceList_.push(i)}};ss.prototype.register_=function(){var t=this.eventSourceList_.length;var e;for(var i=0;i<t;i++){e=this.eventSourceList_[i];this.addEvents_(e.getEvents())}};ss.prototype.unregister_=function(){var t=this.eventSourceList_.length;var e;for(var i=0;i<t;i++){e=this.eventSourceList_[i];this.removeEvents_(e.getEvents())}};ss.prototype.eventHandler_=function(t){var e=t.type;var i=this.eventMap_[e];if(i){i(t)}};ss.prototype.addEvents_=function(t){t.forEach((function(t){$n.listen(this.element_,t,this.eventHandler_,this)}),this)};ss.prototype.removeEvents_=function(t){t.forEach((function(t){$n.unlisten(this.element_,t,this.eventHandler_,this)}),this)};ss.prototype.cloneEvent=function(t,e){var i={},r;for(var n=0,a=ss.CLONE_PROPS.length;n<a;n++){r=ss.CLONE_PROPS[n][0];i[r]=t[r]||e[r]||ss.CLONE_PROPS[n][1]}return i};ss.prototype.down=function(t,e){this.fireEvent($a.POINTERDOWN,t,e)};ss.prototype.move=function(t,e){this.fireEvent($a.POINTERMOVE,t,e)};ss.prototype.up=function(t,e){this.fireEvent($a.POINTERUP,t,e)};ss.prototype.enter=function(t,e){t.bubbles=false;this.fireEvent($a.POINTERENTER,t,e)};ss.prototype.leave=function(t,e){t.bubbles=false;this.fireEvent($a.POINTERLEAVE,t,e)};ss.prototype.over=function(t,e){t.bubbles=true;this.fireEvent($a.POINTEROVER,t,e)};ss.prototype.out=function(t,e){t.bubbles=true;this.fireEvent($a.POINTEROUT,t,e)};ss.prototype.cancel=function(t,e){this.fireEvent($a.POINTERCANCEL,t,e)};ss.prototype.leaveOut=function(t,e){this.out(t,e);if(!this.contains_(t.target,t.relatedTarget)){this.leave(t,e)}};ss.prototype.enterOver=function(t,e){this.over(t,e);if(!this.contains_(t.target,t.relatedTarget)){this.enter(t,e)}};ss.prototype.contains_=function(t,e){if(!t||!e){return false}return t.contains(e)};ss.prototype.makeEvent=function(t,e,i){return new ns(t,i,e)};ss.prototype.fireEvent=function(t,e,i){var r=this.makeEvent(t,e,i);this.dispatchEvent(r)};ss.prototype.fireNativeEvent=function(t){var e=this.makeEvent(t.type,t,t);this.dispatchEvent(e)};ss.prototype.wrapMouseEvent=function(t,e){var i=this.makeEvent(t,es.prepareEvent(e,this),e);return i};ss.prototype.disposeInternal=function(){this.unregister_();ia.prototype.disposeInternal.call(this)};ss.CLONE_PROPS=[["bubbles",false],["cancelable",false],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",false],["altKey",false],["shiftKey",false],["metaKey",false],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",false],["type",""],["target",null],["currentTarget",null],["which",0]];var os=function(t,e){ia.call(this);this.map_=t;this.clickTimeoutId_=0;this.dragging_=false;this.dragListenerKeys_=[];this.moveTolerance_=e?e*Va.DEVICE_PIXEL_RATIO:Va.DEVICE_PIXEL_RATIO;this.down_=null;var i=this.map_.getViewport();this.activePointers_=0;this.trackedTouches_={};this.pointerEventHandler_=new ss(i);this.documentPointerEventHandler_=null;this.pointerdownListenerKey_=$n.listen(this.pointerEventHandler_,$a.POINTERDOWN,this.handlePointerDown_,this);this.relayedListenerKey_=$n.listen(this.pointerEventHandler_,$a.POINTERMOVE,this.relayEvent_,this)};qn.inherits(os,ia);os.prototype.emulateClick_=function(t){var e=new Qa(Ja.CLICK,this.map_,t);this.dispatchEvent(e);if(this.clickTimeoutId_!==0){clearTimeout(this.clickTimeoutId_);this.clickTimeoutId_=0;e=new Qa(Ja.DBLCLICK,this.map_,t);this.dispatchEvent(e)}else{this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=0;var e=new Qa(Ja.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)}};os.prototype.updateActivePointers_=function(t){var e=t;if(e.type==Ja.POINTERUP||e.type==Ja.POINTERCANCEL){delete this.trackedTouches_[e.pointerId]}else if(e.type==Ja.POINTERDOWN){this.trackedTouches_[e.pointerId]=true}this.activePointers_=Object.keys(this.trackedTouches_).length};os.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new Qa(Ja.POINTERUP,this.map_,t);this.dispatchEvent(e);if(!e.propagationStopped&&!this.dragging_&&this.isMouseActionButton_(t)){this.emulateClick_(this.down_)}if(this.activePointers_===0){this.dragListenerKeys_.forEach($n.unlistenByKey);this.dragListenerKeys_.length=0;this.dragging_=false;this.down_=null;this.documentPointerEventHandler_.dispose();this.documentPointerEventHandler_=null}};os.prototype.isMouseActionButton_=function(t){return t.button===0};os.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new Qa(Ja.POINTERDOWN,this.map_,t);this.dispatchEvent(e);this.down_=t;if(this.dragListenerKeys_.length===0){this.documentPointerEventHandler_=new ss(document);this.dragListenerKeys_.push($n.listen(this.documentPointerEventHandler_,Ja.POINTERMOVE,this.handlePointerMove_,this),$n.listen(this.documentPointerEventHandler_,Ja.POINTERUP,this.handlePointerUp_,this),$n.listen(this.pointerEventHandler_,Ja.POINTERCANCEL,this.handlePointerUp_,this))}};os.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=true;var e=new Qa(Ja.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}t.preventDefault()};os.prototype.relayEvent_=function(t){var e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Qa(t.type,this.map_,t,e))};os.prototype.isMoving_=function(t){return Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_};os.prototype.disposeInternal=function(){if(this.relayedListenerKey_){$n.unlistenByKey(this.relayedListenerKey_);this.relayedListenerKey_=null}if(this.pointerdownListenerKey_){$n.unlistenByKey(this.pointerdownListenerKey_);this.pointerdownListenerKey_=null}this.dragListenerKeys_.forEach($n.unlistenByKey);this.dragListenerKeys_.length=0;if(this.documentPointerEventHandler_){this.documentPointerEventHandler_.dispose();this.documentPointerEventHandler_=null}if(this.pointerEventHandler_){this.pointerEventHandler_.dispose();this.pointerEventHandler_=null}ia.prototype.disposeInternal.call(this)};var hs={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend"};var ls={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var us={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4,ABORT:5};var fs=function(t,e){this.priorityFunction_=t;this.keyFunction_=e;this.elements_=[];this.priorities_=[];this.queuedElements_={}};fs.DROP=Infinity;fs.prototype.clear=function(){this.elements_.length=0;this.priorities_.length=0;Qn.clear(this.queuedElements_)};fs.prototype.dequeue=function(){var t=this.elements_;var e=this.priorities_;var i=t[0];if(t.length==1){t.length=0;e.length=0}else{t[0]=t.pop();e[0]=e.pop();this.siftUp_(0)}var r=this.keyFunction_(i);delete this.queuedElements_[r];return i};fs.prototype.enqueue=function(t){oa.assert(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);if(e!=fs.DROP){this.elements_.push(t);this.priorities_.push(e);this.queuedElements_[this.keyFunction_(t)]=true;this.siftDown_(0,this.elements_.length-1);return true}return false};fs.prototype.getCount=function(){return this.elements_.length};fs.prototype.getLeftChildIndex_=function(t){return t*2+1};fs.prototype.getRightChildIndex_=function(t){return t*2+2};fs.prototype.getParentIndex_=function(t){return t-1>>1};fs.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--){this.siftUp_(t)}};fs.prototype.isEmpty=function(){return this.elements_.length===0};fs.prototype.isKeyQueued=function(t){return t in this.queuedElements_};fs.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))};fs.prototype.siftUp_=function(t){var e=this.elements_;var i=this.priorities_;var r=e.length;var n=e[t];var a=i[t];var s=t;while(t<r>>1){var o=this.getLeftChildIndex_(t);var h=this.getRightChildIndex_(t);var l=h<r&&i[h]<i[o]?h:o;e[t]=e[l];i[t]=i[l];t=l}e[t]=n;i[t]=a;this.siftDown_(s,t)};fs.prototype.siftDown_=function(t,e){var i=this.elements_;var r=this.priorities_;var n=i[e];var a=r[e];while(e>t){var s=this.getParentIndex_(e);if(r[s]>a){i[e]=i[s];r[e]=r[s];e=s}else{break}}i[e]=n;r[e]=a};fs.prototype.reprioritize=function(){var t=this.priorityFunction_;var e=this.elements_;var i=this.priorities_;var r=0;var n=e.length;var a,s,o;for(s=0;s<n;++s){a=e[s];o=t(a);if(o==fs.DROP){delete this.queuedElements_[this.keyFunction_(a)]}else{i[r]=o;e[r++]=a}}e.length=r;i.length=r;this.heapify_()};var cs=function(t,e){fs.call(this,(function(e){return t.apply(null,e)}),(function(t){return t[0].getKey()}));this.tileChangeCallback_=e;this.tilesLoading_=0;this.tilesLoadingKeys_={}};qn.inherits(cs,fs);cs.prototype.enqueue=function(t){var e=fs.prototype.enqueue.call(this,t);if(e){var i=t[0];$n.listen(i,ra.CHANGE,this.handleTileChange,this)}return e};cs.prototype.getTilesLoading=function(){return this.tilesLoading_};cs.prototype.handleTileChange=function(t){var e=t.target;var i=e.getState();if(i===us.LOADED||i===us.ERROR||i===us.EMPTY||i===us.ABORT){$n.unlisten(e,ra.CHANGE,this.handleTileChange,this);var r=e.getKey();if(r in this.tilesLoadingKeys_){delete this.tilesLoadingKeys_[r];--this.tilesLoading_}this.tileChangeCallback_()}};cs.prototype.loadMoreTiles=function(t,e){var i=0;var r=false;var n,a,s;while(this.tilesLoading_<t&&i<e&&this.getCount()>0){a=this.dequeue()[0];s=a.getKey();n=a.getState();if(n===us.ABORT){r=true}else if(n===us.IDLE&&!(s in this.tilesLoadingKeys_)){this.tilesLoadingKeys_[s]=true;++this.tilesLoading_;++i;a.load()}}if(i===0&&r){this.tileChangeCallback_()}};var ds={};ds.createExtent=function(t){return function(e){if(e){return[ha.clamp(e[0],t[0],t[2]),ha.clamp(e[1],t[1],t[3])]}else{return undefined}}};ds.none=function(t){return t};var ps={};ps.createSnapToResolutions=function(t){return function(e,i,r){if(e!==undefined){var n=fa.linearFindNearest(t,e,r);n=ha.clamp(n+i,0,t.length-1);var a=Math.floor(n);if(n!=a&&a<t.length-1){var s=t[a]/t[a+1];return t[a]/Math.pow(s,n-a)}else{return t[a]}}else{return undefined}}};ps.createSnapToPower=function(t,e,i){return function(r,n,a){if(r!==undefined){var s=-a/2+.5;var o=Math.floor(Math.log(e/r)/Math.log(t)+s);var h=Math.max(o+n,0);if(i!==undefined){h=Math.min(h,i)}return e/Math.pow(t,h)}else{return undefined}}};var vs={};vs.disable=function(t,e){if(t!==undefined){return 0}else{return undefined}};vs.none=function(t,e){if(t!==undefined){return t+e}else{return undefined}};vs.createSnapToN=function(t){var e=2*Math.PI/t;return function(t,i){if(t!==undefined){t=Math.floor((t+i)/e+.5)*e;return t}else{return undefined}}};vs.createSnapToZero=function(t){var e=t||ha.toRadians(5);return function(t,i){if(t!==undefined){if(Math.abs(t+i)<=e){return 0}else{return t+i}}else{return undefined}}};var _s={ANIMATING:0,INTERACTING:1};var gs={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};var ms={};ms.padNumber=function(t,e,i){var r=i!==undefined?t.toFixed(i):""+t;var n=r.indexOf(".");n=n===-1?r.length:n;return n>e?r:new Array(1+e-n).join("0")+r};ms.compareVersions=function(t,e){var i=(""+t).split(".");var r=(""+e).split(".");for(var n=0;n<Math.max(i.length,r.length);n++){var a=parseInt(i[n]||"0",10);var s=parseInt(r[n]||"0",10);if(a>s){return 1}if(s>a){return-1}}return 0};var ys={};ys.add=function(t,e){t[0]+=e[0];t[1]+=e[1];return t};ys.closestOnCircle=function(t,e){var i=e.getRadius();var r=e.getCenter();var n=r[0];var a=r[1];var s=t[0];var o=t[1];var h=s-n;var l=o-a;if(h===0&&l===0){h=1}var u=Math.sqrt(h*h+l*l);var f,c;f=n+i*h/u;c=a+i*l/u;return[f,c]};ys.closestOnSegment=function(t,e){var i=t[0];var r=t[1];var n=e[0];var a=e[1];var s=n[0];var o=n[1];var h=a[0];var l=a[1];var u=h-s;var f=l-o;var c=u===0&&f===0?0:(u*(i-s)+f*(r-o))/(u*u+f*f||0);var d,p;if(c<=0){d=s;p=o}else if(c>=1){d=h;p=l}else{d=s+c*u;p=o+c*f}return[d,p]};ys.createStringXY=function(t){return function(e){return ys.toStringXY(e,t)}};ys.degreesToStringHDMS=function(t,e,i){var r=ha.modulo(e+180,360)-180;var n=Math.abs(3600*r);var a=i||0;var s=Math.pow(10,a);var o=Math.floor(n/3600);var h=Math.floor((n-o*3600)/60);var l=n-o*3600-h*60;l=Math.ceil(l*s)/s;if(l>=60){l=0;h+=1}if(h>=60){h=0;o+=1}return o+"° "+ms.padNumber(h,2)+"′ "+ms.padNumber(l,2,a)+"″"+(r==0?"":" "+t.charAt(r<0?1:0))};ys.format=function(t,e,i){if(t){return e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i))}else{return""}};ys.equals=function(t,e){var i=true;for(var r=t.length-1;r>=0;--r){if(t[r]!=e[r]){i=false;break}}return i};ys.rotate=function(t,e){var i=Math.cos(e);var r=Math.sin(e);var n=t[0]*i-t[1]*r;var a=t[1]*i+t[0]*r;t[0]=n;t[1]=a;return t};ys.scale=function(t,e){t[0]*=e;t[1]*=e;return t};ys.sub=function(t,e){t[0]-=e[0];t[1]-=e[1];return t};ys.squaredDistance=function(t,e){var i=t[0]-e[0];var r=t[1]-e[1];return i*i+r*r};ys.distance=function(t,e){return Math.sqrt(ys.squaredDistance(t,e))};ys.squaredDistanceToSegment=function(t,e){return ys.squaredDistance(t,ys.closestOnSegment(t,e))};ys.toStringHDMS=function(t,e){if(t){return ys.degreesToStringHDMS("NS",t[1],e)+" "+ys.degreesToStringHDMS("EW",t[0],e)}else{return""}};ys.toStringXY=function(t,e){return ys.format(t,"{x}, {y}",e)};var Es={};Es.easeIn=function(t){return Math.pow(t,3)};Es.easeOut=function(t){return 1-Es.easeIn(1-t)};Es.inAndOut=function(t){return 3*t*t-2*t*t*t};Es.linear=function(t){return t};Es.upAndDown=function(t){if(t<.5){return Es.inAndOut(2*t)}else{return 1-Es.inAndOut(2*(t-.5))}};var xs=function(t){aa.call(this);var e=Qn.assign({},t);this.hints_=[0,0];this.animations_=[];this.updateAnimations_=this.updateAnimations_.bind(this);this.projection_=Ma.createProjection(e.projection,"EPSG:3857");this.applyOptions_(e)};qn.inherits(xs,aa);xs.prototype.applyOptions_=function(t){var e={};e[gs.CENTER]=t.center!==undefined?t.center:null;var i=xs.createResolutionConstraint_(t);this.maxResolution_=i.maxResolution;this.minResolution_=i.minResolution;this.zoomFactor_=i.zoomFactor;this.resolutions_=t.resolutions;this.minZoom_=i.minZoom;var r=xs.createCenterConstraint_(t);var n=i.constraint;var a=xs.createRotationConstraint_(t);this.constraints_={center:r,resolution:n,rotation:a};if(t.resolution!==undefined){e[gs.RESOLUTION]=t.resolution}else if(t.zoom!==undefined){e[gs.RESOLUTION]=this.constrainResolution(this.maxResolution_,t.zoom-this.minZoom_);if(this.resolutions_){e[gs.RESOLUTION]=ha.clamp(Number(this.getResolution()||e[gs.RESOLUTION]),this.minResolution_,this.maxResolution_)}}e[gs.ROTATION]=t.rotation!==undefined?t.rotation:0;this.setProperties(e);this.options_=t};xs.prototype.getUpdatedOptions_=function(t){var e=Qn.assign({},this.options_);if(e.resolution!==undefined){e.resolution=this.getResolution()}else{e.zoom=this.getZoom()}e.center=this.getCenter();e.rotation=this.getRotation();return Qn.assign({},e,t)};xs.prototype.animate=function(t){var e=arguments.length;var i;if(e>1&&typeof arguments[e-1]==="function"){i=arguments[e-1];--e}if(!this.isDef()){var r=arguments[e-1];if(r.center){this.setCenter(r.center)}if(r.zoom!==undefined){this.setZoom(r.zoom)}if(r.rotation!==undefined){this.setRotation(r.rotation)}if(i){i(true)}return}var n=Date.now();var a=this.getCenter().slice();var s=this.getResolution();var o=this.getRotation();var h=[];for(var l=0;l<e;++l){var u=arguments[l];var f={start:n,complete:false,anchor:u.anchor,duration:u.duration!==undefined?u.duration:1e3,easing:u.easing||Es.inAndOut};if(u.center){f.sourceCenter=a;f.targetCenter=u.center;a=f.targetCenter}if(u.zoom!==undefined){f.sourceResolution=s;f.targetResolution=this.constrainResolution(this.maxResolution_,u.zoom-this.minZoom_,0);s=f.targetResolution}else if(u.resolution){f.sourceResolution=s;f.targetResolution=u.resolution;s=f.targetResolution}if(u.rotation!==undefined){f.sourceRotation=o;var c=ha.modulo(u.rotation-o+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=o+c;o=f.targetRotation}f.callback=i;if(xs.isNoopAnimation(f)){f.complete=true}else{n+=f.duration}h.push(f)}this.animations_.push(h);this.setHint(_s.ANIMATING,1);this.updateAnimations_()};xs.prototype.getAnimating=function(){return this.hints_[_s.ANIMATING]>0};xs.prototype.getInteracting=function(){return this.hints_[_s.INTERACTING]>0};xs.prototype.cancelAnimations=function(){this.setHint(_s.ANIMATING,-this.hints_[_s.ANIMATING]);for(var t=0,e=this.animations_.length;t<e;++t){var i=this.animations_[t];if(i[0].callback){i[0].callback(false)}}this.animations_.length=0};xs.prototype.updateAnimations_=function(){if(this.updateAnimationKey_!==undefined){cancelAnimationFrame(this.updateAnimationKey_);this.updateAnimationKey_=undefined}if(!this.getAnimating()){return}var t=Date.now();var e=false;for(var i=this.animations_.length-1;i>=0;--i){var r=this.animations_[i];var n=true;for(var a=0,s=r.length;a<s;++a){var o=r[a];if(o.complete){continue}var h=t-o.start;var l=o.duration>0?h/o.duration:1;if(l>=1){o.complete=true;l=1}else{n=false}var u=o.easing(l);if(o.sourceCenter){var f=o.sourceCenter[0];var c=o.sourceCenter[1];var d=o.targetCenter[0];var p=o.targetCenter[1];var v=f+u*(d-f);var _=c+u*(p-c);this.set(gs.CENTER,[v,_])}if(o.sourceResolution&&o.targetResolution){var g=u===1?o.targetResolution:o.sourceResolution+u*(o.targetResolution-o.sourceResolution);if(o.anchor){this.set(gs.CENTER,this.calculateCenterZoom(g,o.anchor))}this.set(gs.RESOLUTION,g)}if(o.sourceRotation!==undefined&&o.targetRotation!==undefined){var m=u===1?ha.modulo(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+u*(o.targetRotation-o.sourceRotation);if(o.anchor){this.set(gs.CENTER,this.calculateCenterRotate(m,o.anchor))}this.set(gs.ROTATION,m)}e=true;if(!o.complete){break}}if(n){this.animations_[i]=null;this.setHint(_s.ANIMATING,-1);var y=r[0].callback;if(y){y(true)}}}this.animations_=this.animations_.filter(Boolean);if(e&&this.updateAnimationKey_===undefined){this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_)}};xs.prototype.calculateCenterRotate=function(t,e){var i;var r=this.getCenter();if(r!==undefined){i=[r[0]-e[0],r[1]-e[1]];ys.rotate(i,t-this.getRotation());ys.add(i,e)}return i};xs.prototype.calculateCenterZoom=function(t,e){var i;var r=this.getCenter();var n=this.getResolution();if(r!==undefined&&n!==undefined){var a=e[0]-t*(e[0]-r[0])/n;var s=e[1]-t*(e[1]-r[1])/n;i=[a,s]}return i};xs.prototype.getSizeFromViewport_=function(){var t=[100,100];var e='.ol-viewport[data-view="'+qn.getUid(this)+'"]';var i=document.querySelector(e);if(i){var r=getComputedStyle(i);t[0]=parseInt(r.width,10);t[1]=parseInt(r.height,10)}return t};xs.prototype.constrainCenter=function(t){return this.constraints_.center(t)};xs.prototype.constrainResolution=function(t,e,i){var r=e||0;var n=i||0;return this.constraints_.resolution(t,r,n)};xs.prototype.constrainRotation=function(t,e){var i=e||0;return this.constraints_.rotation(t,i)};xs.prototype.getCenter=function(){return this.get(gs.CENTER)};xs.prototype.getConstraints=function(){return this.constraints_};xs.prototype.getHints=function(t){if(t!==undefined){t[0]=this.hints_[0];t[1]=this.hints_[1];return t}else{return this.hints_.slice()}};xs.prototype.calculateExtent=function(t){var e=t||this.getSizeFromViewport_();var i=this.getCenter();oa.assert(i,1);var r=this.getResolution();oa.assert(r!==undefined,2);var n=this.getRotation();oa.assert(n!==undefined,3);return pa.getForViewAndSize(i,r,n,e)};xs.prototype.getMaxResolution=function(){return this.maxResolution_};xs.prototype.getMinResolution=function(){return this.minResolution_};xs.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)};xs.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))};xs.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)};xs.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))};xs.prototype.getProjection=function(){return this.projection_};xs.prototype.getResolution=function(){return this.get(gs.RESOLUTION)};xs.prototype.getResolutions=function(){return this.resolutions_};xs.prototype.getResolutionForExtent=function(t,e){var i=e||this.getSizeFromViewport_();var r=pa.getWidth(t)/i[0];var n=pa.getHeight(t)/i[1];return Math.max(r,n)};xs.prototype.getResolutionForValueFunction=function(t){var e=t||2;var i=this.maxResolution_;var r=this.minResolution_;var n=Math.log(i/r)/Math.log(e);return function(t){var r=i/Math.pow(e,t*n);return r}};xs.prototype.getRotation=function(){return this.get(gs.ROTATION)};xs.prototype.getValueForResolutionFunction=function(t){var e=t||2;var i=this.maxResolution_;var r=this.minResolution_;var n=Math.log(i/r)/Math.log(e);return function(t){var r=Math.log(i/t)/Math.log(e)/n;return r}};xs.prototype.getState=function(){var t=this.getCenter();var e=this.getProjection();var i=this.getResolution();var r=this.getRotation();return{center:t.slice(),projection:e!==undefined?e:null,resolution:i,rotation:r,zoom:this.getZoom()}};xs.prototype.getZoom=function(){var t;var e=this.getResolution();if(e!==undefined){t=this.getZoomForResolution(e)}return t};xs.prototype.getZoomForResolution=function(t){var e=this.minZoom_||0;var i,r;if(this.resolutions_){var n=fa.linearFindNearest(this.resolutions_,t,1);e=n;i=this.resolutions_[n];if(n==this.resolutions_.length-1){r=2}else{r=i/this.resolutions_[n+1]}}else{i=this.maxResolution_;r=this.zoomFactor_}return e+Math.log(i/t)/Math.log(r)};xs.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)};xs.prototype.fit=function(t,e){var i=e||{};var r=i.size;if(!r){r=this.getSizeFromViewport_()}var n;if(!(t instanceof La)){oa.assert(Array.isArray(t),24);oa.assert(!pa.isEmpty(t),25);n=Wa.fromExtent(t)}else if(t.getType()===la.CIRCLE){t=t.getExtent();n=Wa.fromExtent(t);n.rotate(this.getRotation(),pa.getCenter(t))}else{n=t}var a=i.padding!==undefined?i.padding:[0,0,0,0];var s=i.constrainResolution!==undefined?i.constrainResolution:true;var o=i.nearest!==undefined?i.nearest:false;var h;if(i.minResolution!==undefined){h=i.minResolution}else if(i.maxZoom!==undefined){h=this.constrainResolution(this.maxResolution_,i.maxZoom-this.minZoom_,0)}else{h=0}var l=n.getFlatCoordinates();var u=this.getRotation();var f=Math.cos(-u);var c=Math.sin(-u);var d=+Infinity;var p=+Infinity;var v=-Infinity;var _=-Infinity;var g=n.getStride();for(var m=0,y=l.length;m<y;m+=g){var E=l[m]*f-l[m+1]*c;var x=l[m]*c+l[m+1]*f;d=Math.min(d,E);p=Math.min(p,x);v=Math.max(v,E);_=Math.max(_,x)}var T=this.getResolutionForExtent([d,p,v,_],[r[0]-a[1]-a[3],r[1]-a[0]-a[2]]);T=isNaN(T)?h:Math.max(T,h);if(s){var C=this.constrainResolution(T,0,0);if(!o&&C<T){C=this.constrainResolution(C,-1,0)}T=C}c=-c;var R=(d+v)/2;var M=(p+_)/2;R+=(a[1]-a[3])/2*T;M+=(a[0]-a[2])/2*T;var S=R*f-M*c;var I=M*f+R*c;var L=[S,I];var A=i.callback?i.callback:qn.nullFunction;if(i.duration!==undefined){this.animate({resolution:T,center:L,duration:i.duration,easing:i.easing},A)}else{this.setResolution(T);this.setCenter(L);setTimeout(A.bind(undefined,true),0)}};xs.prototype.centerOn=function(t,e,i){var r=this.getRotation();var n=Math.cos(-r);var a=Math.sin(-r);var s=t[0]*n-t[1]*a;var o=t[1]*n+t[0]*a;var h=this.getResolution();s+=(e[0]/2-i[0])*h;o+=(i[1]-e[1]/2)*h;a=-a;var l=s*n-o*a;var u=o*n+s*a;this.setCenter([l,u])};xs.prototype.isDef=function(){return!!this.getCenter()&&this.getResolution()!==undefined};xs.prototype.rotate=function(t,e){if(e!==undefined){var i=this.calculateCenterRotate(t,e);this.setCenter(i)}this.setRotation(t)};xs.prototype.setCenter=function(t){this.set(gs.CENTER,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setHint=function(t,e){this.hints_[t]+=e;this.changed();return this.hints_[t]};xs.prototype.setResolution=function(t){this.set(gs.RESOLUTION,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setRotation=function(t){this.set(gs.ROTATION,t);if(this.getAnimating()){this.cancelAnimations()}};xs.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))};xs.createCenterConstraint_=function(t){if(t.extent!==undefined){return ds.createExtent(t.extent)}else{return ds.none}};xs.createResolutionConstraint_=function(t){var e;var i;var r;var n=28;var a=2;var s=t.minZoom!==undefined?t.minZoom:qn.DEFAULT_MIN_ZOOM;var o=t.maxZoom!==undefined?t.maxZoom:n;var h=t.zoomFactor!==undefined?t.zoomFactor:a;if(t.resolutions!==undefined){var l=t.resolutions;i=l[s];r=l[o]!==undefined?l[o]:l[l.length-1];e=ps.createSnapToResolutions(l)}else{var u=Ma.createProjection(t.projection,"EPSG:3857");var f=u.getExtent();var c=!f?360*Ma.METERS_PER_UNIT[ma.DEGREES]/u.getMetersPerUnit():Math.max(pa.getWidth(f),pa.getHeight(f));var d=c/qn.DEFAULT_TILE_SIZE/Math.pow(a,qn.DEFAULT_MIN_ZOOM);var p=d/Math.pow(a,n-qn.DEFAULT_MIN_ZOOM);i=t.maxResolution;if(i!==undefined){s=0}else{i=d/Math.pow(h,s)}r=t.minResolution;if(r===undefined){if(t.maxZoom!==undefined){if(t.maxResolution!==undefined){r=i/Math.pow(h,o)}else{r=d/Math.pow(h,o)}}else{r=p}}o=s+Math.floor(Math.log(i/r)/Math.log(h));r=i/Math.pow(h,o-s);e=ps.createSnapToPower(h,i,o-s)}return{constraint:e,maxResolution:i,minResolution:r,minZoom:s,zoomFactor:h}};xs.createRotationConstraint_=function(t){var e=t.enableRotation!==undefined?t.enableRotation:true;if(e){var i=t.constrainRotation;if(i===undefined||i===true){return vs.createSnapToZero()}else if(i===false){return vs.none}else if(typeof i==="number"){return vs.createSnapToN(i)}else{return vs.none}}else{return vs.disable}};xs.isNoopAnimation=function(t){if(t.sourceCenter&&t.targetCenter){if(!ys.equals(t.sourceCenter,t.targetCenter)){return false}}if(t.sourceResolution!==t.targetResolution){return false}if(t.sourceRotation!==t.targetRotation){return false}return true};var Ts={};Ts.createCanvasContext2D=function(t,e){var i=document.createElement("CANVAS");if(t){i.width=t}if(e){i.height=e}return i.getContext("2d")};Ts.outerWidth=function(t){var e=t.offsetWidth;var i=getComputedStyle(t);e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10);return e};Ts.outerHeight=function(t){var e=t.offsetHeight;var i=getComputedStyle(t);e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10);return e};Ts.replaceNode=function(t,e){var i=e.parentNode;if(i){i.replaceChild(t,e)}};Ts.removeNode=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null};Ts.removeChildren=function(t){while(t.lastChild){t.removeChild(t.lastChild)}};var Cs={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",SOURCE:"source"};var Rs=function(t){aa.call(this);var e=Qn.assign({},t);e[Cs.OPACITY]=t.opacity!==undefined?t.opacity:1;e[Cs.VISIBLE]=t.visible!==undefined?t.visible:true;e[Cs.Z_INDEX]=t.zIndex!==undefined?t.zIndex:0;e[Cs.MAX_RESOLUTION]=t.maxResolution!==undefined?t.maxResolution:Infinity;e[Cs.MIN_RESOLUTION]=t.minResolution!==undefined?t.minResolution:0;this.setProperties(e);this.state_={layer:this,managed:true}};qn.inherits(Rs,aa);Rs.prototype.getType=function(){return this.type};Rs.prototype.getLayerState=function(){this.state_.opacity=ha.clamp(this.getOpacity(),0,1);this.state_.sourceState=this.getSourceState();this.state_.visible=this.getVisible();this.state_.extent=this.getExtent();this.state_.zIndex=this.getZIndex();this.state_.maxResolution=this.getMaxResolution();this.state_.minResolution=Math.max(this.getMinResolution(),0);return this.state_};Rs.prototype.getLayersArray=function(t){};Rs.prototype.getLayerStatesArray=function(t){};Rs.prototype.getExtent=function(){return this.get(Cs.EXTENT)};Rs.prototype.getMaxResolution=function(){return this.get(Cs.MAX_RESOLUTION)};Rs.prototype.getMinResolution=function(){return this.get(Cs.MIN_RESOLUTION)};Rs.prototype.getOpacity=function(){return this.get(Cs.OPACITY)};Rs.prototype.getSourceState=function(){};Rs.prototype.getVisible=function(){return this.get(Cs.VISIBLE)};Rs.prototype.getZIndex=function(){return this.get(Cs.Z_INDEX)};Rs.prototype.setExtent=function(t){this.set(Cs.EXTENT,t)};Rs.prototype.setMaxResolution=function(t){this.set(Cs.MAX_RESOLUTION,t)};Rs.prototype.setMinResolution=function(t){this.set(Cs.MIN_RESOLUTION,t)};Rs.prototype.setOpacity=function(t){this.set(Cs.OPACITY,t)};Rs.prototype.setVisible=function(t){this.set(Cs.VISIBLE,t)};Rs.prototype.setZIndex=function(t){this.set(Cs.Z_INDEX,t)};var Ms={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var Ss=function(t){var e=t||{};var i=Qn.assign({},e);delete i.layers;var r=e.layers;Rs.call(this,i);this.layersListenerKeys_=[];this.listenerKeys_={};$n.listen(this,aa.getChangeEventType(Ss.Property_.LAYERS),this.handleLayersChanged_,this);if(r){if(Array.isArray(r)){r=new Ka(r.slice(),{unique:true})}else{oa.assert(r instanceof Ka,43);r=r}}else{r=new Ka(undefined,{unique:true})}this.setLayers(r)};qn.inherits(Ss,Rs);Ss.prototype.handleLayerChange_=function(){this.changed()};Ss.prototype.handleLayersChanged_=function(t){this.layersListenerKeys_.forEach($n.unlistenByKey);this.layersListenerKeys_.length=0;var e=this.getLayers();this.layersListenerKeys_.push($n.listen(e,Ha.ADD,this.handleLayersAdd_,this),$n.listen(e,Ha.REMOVE,this.handleLayersRemove_,this));for(var i in this.listenerKeys_){this.listenerKeys_[i].forEach($n.unlistenByKey)}Qn.clear(this.listenerKeys_);var r=e.getArray();var n,a,s;for(n=0,a=r.length;n<a;n++){s=r[n];this.listenerKeys_[qn.getUid(s).toString()]=[$n.listen(s,Jn.PROPERTYCHANGE,this.handleLayerChange_,this),$n.listen(s,ra.CHANGE,this.handleLayerChange_,this)]}this.changed()};Ss.prototype.handleLayersAdd_=function(t){var e=t.element;var i=qn.getUid(e).toString();this.listenerKeys_[i]=[$n.listen(e,Jn.PROPERTYCHANGE,this.handleLayerChange_,this),$n.listen(e,ra.CHANGE,this.handleLayerChange_,this)];this.changed()};Ss.prototype.handleLayersRemove_=function(t){var e=t.element;var i=qn.getUid(e).toString();this.listenerKeys_[i].forEach($n.unlistenByKey);delete this.listenerKeys_[i];this.changed()};Ss.prototype.getLayers=function(){return this.get(Ss.Property_.LAYERS)};Ss.prototype.setLayers=function(t){this.set(Ss.Property_.LAYERS,t)};Ss.prototype.getLayersArray=function(t){var e=t!==undefined?t:[];this.getLayers().forEach((function(t){t.getLayersArray(e)}));return e};Ss.prototype.getLayerStatesArray=function(t){var e=t!==undefined?t:[];var i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));var r=this.getLayerState();var n,a,s;for(n=i,a=e.length;n<a;n++){s=e[n];s.opacity*=r.opacity;s.visible=s.visible&&r.visible;s.maxResolution=Math.min(s.maxResolution,r.maxResolution);s.minResolution=Math.max(s.minResolution,r.minResolution);if(r.extent!==undefined){if(s.extent!==undefined){s.extent=pa.getIntersection(s.extent,r.extent)}else{s.extent=r.extent}}}return e};Ss.prototype.getSourceState=function(){return Ms.READY};Ss.Property_={LAYERS:"layers"};var Is={MAP_RENDERER:"MAP_RENDERER",LAYER_RENDERER:"LAYER_RENDERER"};var Ls={};Ls.mapRendererPlugins_=[];Ls.getMapRendererPlugins=function(){return Ls.mapRendererPlugins_};Ls.layerRendererPlugins_=[];Ls.getLayerRendererPlugins=function(){return Ls.layerRendererPlugins_};Ls.register=function(t,e){var i;switch(t){case Is.MAP_RENDERER:{i=Ls.mapRendererPlugins_;i.push(e);break}case Is.LAYER_RENDERER:{i=Ls.layerRendererPlugins_;i.push(e);break}default:{throw new Error("Unsupported plugin type: "+t)}}};Ls.registerMultiple=function(t,e){for(var i=0,r=e.length;i<r;++i){Ls.register(t,e[i])}};var As={CANVAS:"canvas",WEBGL:"webgl"};var ws={};ws.buffer=function(t,e,i){if(i===undefined){i=[0,0]}i[0]=t[0]+2*e;i[1]=t[1]+2*e;return i};ws.hasArea=function(t){return t[0]>0&&t[1]>0};ws.scale=function(t,e,i){if(i===undefined){i=[0,0]}i[0]=t[0]*e+.5|0;i[1]=t[1]*e+.5|0;return i};ws.toSize=function(t,e){if(Array.isArray(t)){return t}else{if(e===undefined){e=[t,t]}else{e[0]=e[1]=t}return e}};var Os=function(t){aa.call(this);var e=Os.createOptionsInternal(t);this.loadTilesWhileAnimating_=t.loadTilesWhileAnimating!==undefined?t.loadTilesWhileAnimating:false;this.loadTilesWhileInteracting_=t.loadTilesWhileInteracting!==undefined?t.loadTilesWhileInteracting:false;this.pixelRatio_=t.pixelRatio!==undefined?t.pixelRatio:Va.DEVICE_PIXEL_RATIO;this.logos_=e.logos;this.animationDelay_=function(){this.animationDelayKey_=undefined;this.renderFrame_.call(this,Date.now())}.bind(this);this.coordinateToPixelTransform_=Sa.create();this.pixelToCoordinateTransform_=Sa.create();this.frameIndex_=0;this.frameState_=null;this.previousExtent_=null;this.viewPropertyListenerKey_=null;this.viewChangeListenerKey_=null;this.layerGroupPropertyListenerKeys_=null;this.viewport_=document.createElement("DIV");this.viewport_.className="ol-viewport"+(Va.TOUCH?" ol-touch":"");this.viewport_.style.position="relative";this.viewport_.style.overflow="hidden";this.viewport_.style.width="100%";this.viewport_.style.height="100%";this.viewport_.style.msTouchAction="none";this.viewport_.style.touchAction="none";this.overlayContainer_=document.createElement("DIV");this.overlayContainer_.className="ol-overlaycontainer";this.viewport_.appendChild(this.overlayContainer_);this.overlayContainerStopEvent_=document.createElement("DIV");this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent";var i=[ra.CLICK,ra.DBLCLICK,ra.MOUSEDOWN,ra.TOUCHSTART,ra.MSPOINTERDOWN,Ja.POINTERDOWN,ra.MOUSEWHEEL,ra.WHEEL];for(var r=0,n=i.length;r<n;++r){$n.listen(this.overlayContainerStopEvent_,i[r],ea.stopPropagation)}this.viewport_.appendChild(this.overlayContainerStopEvent_);this.mapBrowserEventHandler_=new os(this,t.moveTolerance);for(var a in Ja){$n.listen(this.mapBrowserEventHandler_,Ja[a],this.handleMapBrowserEvent,this)}this.keyboardEventTarget_=e.keyboardEventTarget;this.keyHandlerKeys_=null;$n.listen(this.viewport_,ra.WHEEL,this.handleBrowserEvent,this);$n.listen(this.viewport_,ra.MOUSEWHEEL,this.handleBrowserEvent,this);this.controls=e.controls||new Ka;this.interactions=e.interactions||new Ka;this.overlays_=e.overlays;this.overlayIdIndex_={};this.renderer_=e.mapRendererPlugin["create"](this.viewport_,this);this.focus_=null;this.postRenderFunctions_=[];this.tileQueue_=new cs(this.getTilePriority.bind(this),this.handleTileChange_.bind(this));this.skippedFeatureUids_={};$n.listen(this,aa.getChangeEventType(ls.LAYERGROUP),this.handleLayerGroupChanged_,this);$n.listen(this,aa.getChangeEventType(ls.VIEW),this.handleViewChanged_,this);$n.listen(this,aa.getChangeEventType(ls.SIZE),this.handleSizeChanged_,this);$n.listen(this,aa.getChangeEventType(ls.TARGET),this.handleTargetChanged_,this);this.setProperties(e.values);this.controls.forEach((function(t){t.setMap(this)}),this);$n.listen(this.controls,Ha.ADD,(function(t){t.element.setMap(this)}),this);$n.listen(this.controls,Ha.REMOVE,(function(t){t.element.setMap(null)}),this);this.interactions.forEach((function(t){t.setMap(this)}),this);$n.listen(this.interactions,Ha.ADD,(function(t){t.element.setMap(this)}),this);$n.listen(this.interactions,Ha.REMOVE,(function(t){t.element.setMap(null)}),this);this.overlays_.forEach(this.addOverlayInternal_,this);$n.listen(this.overlays_,Ha.ADD,(function(t){this.addOverlayInternal_(t.element)}),this);$n.listen(this.overlays_,Ha.REMOVE,(function(t){var e=t.element;var i=e.getId();if(i!==undefined){delete this.overlayIdIndex_[i.toString()]}t.element.setMap(null)}),this)};qn.inherits(Os,aa);Os.prototype.addControl=function(t){this.getControls().push(t)};Os.prototype.addInteraction=function(t){this.getInteractions().push(t)};Os.prototype.addLayer=function(t){var e=this.getLayerGroup().getLayers();e.push(t)};Os.prototype.addOverlay=function(t){this.getOverlays().push(t)};Os.prototype.addOverlayInternal_=function(t){var e=t.getId();if(e!==undefined){this.overlayIdIndex_[e.toString()]=t}t.setMap(this)};Os.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose();$n.unlisten(this.viewport_,ra.WHEEL,this.handleBrowserEvent,this);$n.unlisten(this.viewport_,ra.MOUSEWHEEL,this.handleBrowserEvent,this);if(this.handleResize_!==undefined){window.removeEventListener(ra.RESIZE,this.handleResize_,false);this.handleResize_=undefined}if(this.animationDelayKey_){cancelAnimationFrame(this.animationDelayKey_);this.animationDelayKey_=undefined}this.setTarget(null);aa.prototype.disposeInternal.call(this)};Os.prototype.forEachFeatureAtPixel=function(t,e,i){if(!this.frameState_){return}var r=this.getCoordinateFromPixel(t);i=i!==undefined?i:{};var n=i.hitTolerance!==undefined?i.hitTolerance*this.frameState_.pixelRatio:0;var a=i.layerFilter!==undefined?i.layerFilter:_a.TRUE;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,n,e,null,a,null)};Os.prototype.getFeaturesAtPixel=function(t,e){var i=null;this.forEachFeatureAtPixel(t,(function(t){if(!i){i=[]}i.push(t)}),e);return i};Os.prototype.forEachLayerAtPixel=function(t,e,i,r,n){if(!this.frameState_){return}var a=i!==undefined?i:null;var s=r!==undefined?r:_a.TRUE;var o=n!==undefined?n:null;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,e,a,s,o)};Os.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_){return false}var i=this.getCoordinateFromPixel(t);e=e!==undefined?e:{};var r=e.layerFilter!==undefined?e.layerFilter:_a.TRUE;var n=e.hitTolerance!==undefined?e.hitTolerance*this.frameState_.pixelRatio:0;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,n,r,null)};Os.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))};Os.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect();var i=t.changedTouches?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]};Os.prototype.getTarget=function(){return this.get(ls.TARGET)};Os.prototype.getTargetElement=function(){var t=this.getTarget();if(t!==undefined){return typeof t==="string"?document.getElementById(t):t}else{return null}};Os.prototype.getCoordinateFromPixel=function(t){var e=this.frameState_;if(!e){return null}else{return Sa.apply(e.pixelToCoordinateTransform,t.slice())}};Os.prototype.getControls=function(){return this.controls};Os.prototype.getOverlays=function(){return this.overlays_};Os.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return e!==undefined?e:null};Os.prototype.getInteractions=function(){return this.interactions};Os.prototype.getLayerGroup=function(){return this.get(ls.LAYERGROUP)};Os.prototype.getLayers=function(){var t=this.getLayerGroup().getLayers();return t};Os.prototype.getPixelFromCoordinate=function(t){var e=this.frameState_;if(!e){return null}else{return Sa.apply(e.coordinateToPixelTransform,t.slice(0,2))}};Os.prototype.getRenderer=function(){return this.renderer_};Os.prototype.getSize=function(){return this.get(ls.SIZE)};Os.prototype.getView=function(){return this.get(ls.VIEW)};Os.prototype.getViewport=function(){return this.viewport_};Os.prototype.getOverlayContainer=function(){return this.overlayContainer_};Os.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_};Os.prototype.getTilePriority=function(t,e,i,r){var n=this.frameState_;if(!n||!(e in n.wantedTiles)){return fs.DROP}if(!n.wantedTiles[e][t.getKey()]){return fs.DROP}var a=i[0]-n.focus[0];var s=i[1]-n.focus[1];return 65536*Math.log(r)+Math.sqrt(a*a+s*s)/r};Os.prototype.handleBrowserEvent=function(t,e){var i=e||t.type;var r=new Za(i,this,t);this.handleMapBrowserEvent(r)};Os.prototype.handleMapBrowserEvent=function(t){if(!this.frameState_){return}this.focus_=t.coordinate;t.frameState=this.frameState_;var e=this.getInteractions().getArray();var i;if(this.dispatchEvent(t)!==false){for(i=e.length-1;i>=0;i--){var r=e[i];if(!r.getActive()){continue}var n=r.handleEvent(t);if(!n){break}}}};Os.prototype.handlePostRender=function(){var t=this.frameState_;var e=this.tileQueue_;if(!e.isEmpty()){var i=16;var r=i;if(t){var n=t.viewHints;if(n[_s.ANIMATING]){i=this.loadTilesWhileAnimating_?8:0;r=2}if(n[_s.INTERACTING]){i=this.loadTilesWhileInteracting_?8:0;r=2}}if(e.getTilesLoading()<i){e.reprioritize();e.loadMoreTiles(i,r)}}var a=this.postRenderFunctions_;var s,o;for(s=0,o=a.length;s<o;++s){a[s](this,t)}a.length=0};Os.prototype.handleSizeChanged_=function(){this.render()};Os.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()){t=this.getTargetElement()}if(this.keyHandlerKeys_){for(var e=0,i=this.keyHandlerKeys_.length;e<i;++e){$n.unlistenByKey(this.keyHandlerKeys_[e])}this.keyHandlerKeys_=null}if(!t){this.renderer_.removeLayerRenderers();Ts.removeNode(this.viewport_);if(this.handleResize_!==undefined){window.removeEventListener(ra.RESIZE,this.handleResize_,false);this.handleResize_=undefined}}else{t.appendChild(this.viewport_);var r=!this.keyboardEventTarget_?t:this.keyboardEventTarget_;this.keyHandlerKeys_=[$n.listen(r,ra.KEYDOWN,this.handleBrowserEvent,this),$n.listen(r,ra.KEYPRESS,this.handleBrowserEvent,this)];if(!this.handleResize_){this.handleResize_=this.updateSize.bind(this);window.addEventListener(ra.RESIZE,this.handleResize_,false)}}this.updateSize()};Os.prototype.handleTileChange_=function(){this.render()};Os.prototype.handleViewPropertyChanged_=function(){this.render()};Os.prototype.handleViewChanged_=function(){if(this.viewPropertyListenerKey_){$n.unlistenByKey(this.viewPropertyListenerKey_);this.viewPropertyListenerKey_=null}if(this.viewChangeListenerKey_){$n.unlistenByKey(this.viewChangeListenerKey_);this.viewChangeListenerKey_=null}var t=this.getView();if(t){this.viewport_.setAttribute("data-view",qn.getUid(t));this.viewPropertyListenerKey_=$n.listen(t,Jn.PROPERTYCHANGE,this.handleViewPropertyChanged_,this);this.viewChangeListenerKey_=$n.listen(t,ra.CHANGE,this.handleViewPropertyChanged_,this)}this.render()};Os.prototype.handleLayerGroupChanged_=function(){if(this.layerGroupPropertyListenerKeys_){this.layerGroupPropertyListenerKeys_.forEach($n.unlistenByKey);this.layerGroupPropertyListenerKeys_=null}var t=this.getLayerGroup();if(t){this.layerGroupPropertyListenerKeys_=[$n.listen(t,Jn.PROPERTYCHANGE,this.render,this),$n.listen(t,ra.CHANGE,this.render,this)]}this.render()};Os.prototype.isRendered=function(){return!!this.frameState_};Os.prototype.renderSync=function(){if(this.animationDelayKey_){cancelAnimationFrame(this.animationDelayKey_)}this.animationDelay_()};Os.prototype.render=function(){if(this.animationDelayKey_===undefined){this.animationDelayKey_=requestAnimationFrame(this.animationDelay_)}};Os.prototype.removeControl=function(t){return this.getControls().remove(t)};Os.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)};Os.prototype.removeLayer=function(t){var e=this.getLayerGroup().getLayers();return e.remove(t)};Os.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)};Os.prototype.renderFrame_=function(t){var e,i,r;var n=this.getSize();var a=this.getView();var s=pa.createEmpty();var o=this.frameState_;var h=null;if(n!==undefined&&ws.hasArea(n)&&a&&a.isDef()){var l=a.getHints(this.frameState_?this.frameState_.viewHints:undefined);var u=this.getLayerGroup().getLayerStatesArray();var f={};for(e=0,i=u.length;e<i;++e){f[qn.getUid(u[e].layer)]=u[e]}r=a.getState();var c=r.center;var d=r.resolution/this.pixelRatio_;c[0]=Math.round(c[0]/d)*d;c[1]=Math.round(c[1]/d)*d;h={animate:false,coordinateToPixelTransform:this.coordinateToPixelTransform_,extent:s,focus:!this.focus_?c:this.focus_,index:this.frameIndex_++,layerStates:f,layerStatesArray:u,logos:Qn.assign({},this.logos_),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:n,skippedFeatureUids:this.skippedFeatureUids_,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:l,wantedTiles:{}}}if(h){h.extent=pa.getForViewAndSize(r.center,r.resolution,r.rotation,h.size,s)}this.frameState_=h;this.renderer_.renderFrame(h);if(h){if(h.animate){this.render()}Array.prototype.push.apply(this.postRenderFunctions_,h.postRenderFunctions);if(o){var p=!this.previousExtent_||!pa.isEmpty(this.previousExtent_)&&!pa.equals(h.extent,this.previousExtent_);if(p){this.dispatchEvent(new qa(hs.MOVESTART,this,o));this.previousExtent_=pa.createOrUpdateEmpty(this.previousExtent_)}}var v=this.previousExtent_&&!h.viewHints[_s.ANIMATING]&&!h.viewHints[_s.INTERACTING]&&!pa.equals(h.extent,this.previousExtent_);if(v){this.dispatchEvent(new qa(hs.MOVEEND,this,h));pa.clone(h.extent,this.previousExtent_)}}this.dispatchEvent(new qa(hs.POSTRENDER,this,h));setTimeout(this.handlePostRender.bind(this),0)};Os.prototype.setLayerGroup=function(t){this.set(ls.LAYERGROUP,t)};Os.prototype.setSize=function(t){this.set(ls.SIZE,t)};Os.prototype.setTarget=function(t){this.set(ls.TARGET,t)};Os.prototype.setView=function(t){this.set(ls.VIEW,t)};Os.prototype.skipFeature=function(t){var e=qn.getUid(t).toString();this.skippedFeatureUids_[e]=true;this.render()};Os.prototype.updateSize=function(){var t=this.getTargetElement();if(!t){this.setSize(undefined)}else{var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e["borderLeftWidth"])-parseFloat(e["paddingLeft"])-parseFloat(e["paddingRight"])-parseFloat(e["borderRightWidth"]),t.offsetHeight-parseFloat(e["borderTopWidth"])-parseFloat(e["paddingTop"])-parseFloat(e["paddingBottom"])-parseFloat(e["borderBottomWidth"])])}};Os.prototype.unskipFeature=function(t){var e=qn.getUid(t).toString();delete this.skippedFeatureUids_[e];this.render()};Os.DEFAULT_RENDERER_TYPES=[As.CANVAS,As.WEBGL];Os.LOGO_URL="data:image/png;base64,"+"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBI"+"WXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAA"+"AhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszW"+"WMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvY"+"asvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvX"+"H1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1Vk"+"bMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW"+"2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLP"+"VcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqT"+"acrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaar"+"ldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+Hi"+"zeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDn"+"BAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSF"+"hYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJ"+"REFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxC"+"Brb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe"+"0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8"+"a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7a"+"hgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCn"+"B3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDg"+"q82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC";Os.createOptionsInternal=function(t){var e=null;if(t.keyboardEventTarget!==undefined){e=typeof t.keyboardEventTarget==="string"?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget}var i={};var r={};if(t.logo===undefined||typeof t.logo==="boolean"&&t.logo){r[Os.LOGO_URL]="https://openlayers.org/"}else{var n=t.logo;if(typeof n==="string"){r[n]=""}else if(n instanceof HTMLElement){r[qn.getUid(n).toString()]=n}else if(n){oa.assert(typeof n.href=="string",44);oa.assert(typeof n.src=="string",45);r[n.src]=n.href}}var a=t.layers instanceof Ss?t.layers:new Ss({layers:t.layers});i[ls.LAYERGROUP]=a;i[ls.TARGET]=t.target;i[ls.VIEW]=t.view!==undefined?t.view:new xs;var s;if(t.renderer!==undefined){if(Array.isArray(t.renderer)){s=t.renderer}else if(typeof t.renderer==="string"){s=[t.renderer]}else{oa.assert(false,46)}if(s.indexOf("dom")>=0){s=s.concat(Os.DEFAULT_RENDERER_TYPES)}}else{s=Os.DEFAULT_RENDERER_TYPES}var o;var h=Ls.getMapRendererPlugins();t:for(var l=0,u=s.length;l<u;++l){var f=s[l];for(var c=0,d=h.length;c<d;++c){var p=h[c];if(p["handles"](f)){o=p;break t}}}if(!o){throw new Error("Unable to create a map renderer for types: "+s.join(", "))}var v;if(t.controls!==undefined){if(Array.isArray(t.controls)){v=new Ka(t.controls.slice())}else{oa.assert(t.controls instanceof Ka,47);v=t.controls}}var _;if(t.interactions!==undefined){if(Array.isArray(t.interactions)){_=new Ka(t.interactions.slice())}else{oa.assert(t.interactions instanceof Ka,48);_=t.interactions}}var g;if(t.overlays!==undefined){if(Array.isArray(t.overlays)){g=new Ka(t.overlays.slice())}else{oa.assert(t.overlays instanceof Ka,49);g=t.overlays}}else{g=new Ka}return{controls:v,interactions:_,keyboardEventTarget:e,logos:r,overlays:g,mapRendererPlugin:o,values:i}};var bs=function(t){aa.call(this);this.element=t.element?t.element:null;this.target_=null;this.map_=null;this.listenerKeys=[];this.render=t.render?t.render:qn.nullFunction;if(t.target){this.setTarget(t.target)}};qn.inherits(bs,aa);bs.prototype.disposeInternal=function(){Ts.removeNode(this.element);aa.prototype.disposeInternal.call(this)};bs.prototype.getMap=function(){return this.map_};bs.prototype.setMap=function(t){if(this.map_){Ts.removeNode(this.element)}for(var e=0,i=this.listenerKeys.length;e<i;++e){$n.unlistenByKey(this.listenerKeys[e])}this.listenerKeys.length=0;this.map_=t;if(this.map_){var r=this.target_?this.target_:t.getOverlayContainerStopEvent();r.appendChild(this.element);if(this.render!==qn.nullFunction){this.listenerKeys.push($n.listen(t,hs.POSTRENDER,this.render,this))}t.render()}};bs.prototype.setTarget=function(t){this.target_=typeof t==="string"?document.getElementById(t):t};var Ps={};Ps.CLASS_HIDDEN="ol-hidden";Ps.CLASS_SELECTABLE="ol-selectable";Ps.CLASS_UNSELECTABLE="ol-unselectable";Ps.CLASS_UNSUPPORTED="ol-unsupported";Ps.CLASS_CONTROL="ol-control";Ps.getFontFamilies=function(){var t;var e={};return function(i){if(!t){t=document.createElement("div").style}if(!(i in e)){t.font=i;var r=t.fontFamily;t.font="";if(!r){return null}e[i]=r.split(/,\s?/)}return e[i]}}();var Ds={POSTCOMPOSE:"postcompose",PRECOMPOSE:"precompose",RENDER:"render"};var Fs=function(t){var e=Qn.assign({},t);delete e.source;Rs.call(this,e);this.mapPrecomposeKey_=null;this.mapRenderKey_=null;this.sourceChangeKey_=null;if(t.map){this.setMap(t.map)}$n.listen(this,aa.getChangeEventType(Cs.SOURCE),this.handleSourcePropertyChange_,this);var i=t.source?t.source:null;this.setSource(i)};qn.inherits(Fs,Rs);Fs.visibleAtResolution=function(t,e){return t.visible&&e>=t.minResolution&&e<t.maxResolution};Fs.prototype.getLayersArray=function(t){var e=t?t:[];e.push(this);return e};Fs.prototype.getLayerStatesArray=function(t){var e=t?t:[];e.push(this.getLayerState());return e};Fs.prototype.getSource=function(){var t=this.get(Cs.SOURCE);return t||null};Fs.prototype.getSourceState=function(){var t=this.getSource();return!t?Ms.UNDEFINED:t.getState()};Fs.prototype.handleSourceChange_=function(){this.changed()};Fs.prototype.handleSourcePropertyChange_=function(){if(this.sourceChangeKey_){$n.unlistenByKey(this.sourceChangeKey_);this.sourceChangeKey_=null}var t=this.getSource();if(t){this.sourceChangeKey_=$n.listen(t,ra.CHANGE,this.handleSourceChange_,this)}this.changed()};Fs.prototype.setMap=function(t){if(this.mapPrecomposeKey_){$n.unlistenByKey(this.mapPrecomposeKey_);this.mapPrecomposeKey_=null}if(!t){this.changed()}if(this.mapRenderKey_){$n.unlistenByKey(this.mapRenderKey_);this.mapRenderKey_=null}if(t){this.mapPrecomposeKey_=$n.listen(t,Ds.PRECOMPOSE,(function(t){var e=this.getLayerState();e.managed=false;e.zIndex=Infinity;t.frameState.layerStatesArray.push(e);t.frameState.layerStates[qn.getUid(this)]=e}),this);this.mapRenderKey_=$n.listen(this,ra.CHANGE,t.render,t);this.changed()}};Fs.prototype.setSource=function(t){this.set(Cs.SOURCE,t)};var Ns=function(t){var e=t?t:{};this.ulElement_=document.createElement("UL");this.logoLi_=document.createElement("LI");this.ulElement_.appendChild(this.logoLi_);this.logoLi_.style.display="none";this.collapsed_=e.collapsed!==undefined?e.collapsed:true;this.collapsible_=e.collapsible!==undefined?e.collapsible:true;if(!this.collapsible_){this.collapsed_=false}var i=e.className!==undefined?e.className:"ol-attribution";var r=e.tipLabel!==undefined?e.tipLabel:"Attributions";var n=e.collapseLabel!==undefined?e.collapseLabel:"»";if(typeof n==="string"){this.collapseLabel_=document.createElement("span");this.collapseLabel_.textContent=n}else{this.collapseLabel_=n}var a=e.label!==undefined?e.label:"i";if(typeof a==="string"){this.label_=document.createElement("span");this.label_.textContent=a}else{this.label_=a}var s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;var o=document.createElement("button");o.setAttribute("type","button");o.title=r;o.appendChild(s);$n.listen(o,ra.CLICK,this.handleClick_,this);var h=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" ol-collapsed":"")+(this.collapsible_?"":" ol-uncollapsible");var l=document.createElement("div");l.className=h;l.appendChild(this.ulElement_);l.appendChild(o);var u=e.render?e.render:Ns.render;bs.call(this,{element:l,render:u,target:e.target});this.renderedAttributions_=[];this.renderedVisible_=true;this.logoElements_={}};qn.inherits(Ns,bs);Ns.prototype.getSourceAttributions_=function(t){var e={};var i=[];var r=t.layerStatesArray;var n=t.viewState.resolution;for(var a=0,s=r.length;a<s;++a){var o=r[a];if(!Fs.visibleAtResolution(o,n)){continue}var h=o.layer.getSource();if(!h){continue}var l=h.getAttributions2();if(!l){continue}var u=l(t);if(!u){continue}if(Array.isArray(u)){for(var f=0,c=u.length;f<c;++f){if(!(u[f]in e)){i.push(u[f]);e[u[f]]=true}}}else{if(!(u in e)){i.push(u);e[u]=true}}}return i};Ns.render=function(t){this.updateElement_(t.frameState)};Ns.prototype.updateElement_=function(t){if(!t){if(this.renderedVisible_){this.element.style.display="none";this.renderedVisible_=false}return}var e=this.getSourceAttributions_(t);if(fa.equals(e,this.renderedAttributions_)){return}while(this.ulElement_.lastChild!==this.logoLi_){this.ulElement_.removeChild(this.ulElement_.lastChild)}for(var i=0,r=e.length;i<r;++i){var n=document.createElement("LI");n.innerHTML=e[i];this.ulElement_.appendChild(n)}if(e.length===0&&this.renderedAttributions_.length>0){this.element.classList.add("ol-logo-only")}else if(this.renderedAttributions_.length===0&&e.length>0){this.element.classList.remove("ol-logo-only")}var a=e.length>0||!Qn.isEmpty(t.logos);if(this.renderedVisible_!=a){this.element.style.display=a?"":"none";this.renderedVisible_=a}this.renderedAttributions_=e;this.insertLogos_(t)};Ns.prototype.insertLogos_=function(t){var e;var i=t.logos;var r=this.logoElements_;for(e in r){if(!(e in i)){Ts.removeNode(r[e]);delete r[e]}}var n,a,s;for(s in i){var o=i[s];if(o instanceof HTMLElement){this.logoLi_.appendChild(o);r[s]=o}if(!(s in r)){n=new Image;n.src=s;if(o===""){a=n}else{a=document.createElement("a");a.href=o;a.appendChild(n)}this.logoLi_.appendChild(a);r[s]=a}}this.logoLi_.style.display=!Qn.isEmpty(i)?"":"none"};Ns.prototype.handleClick_=function(t){t.preventDefault();this.handleToggle_()};Ns.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed");if(this.collapsed_){Ts.replaceNode(this.collapseLabel_,this.label_)}else{Ts.replaceNode(this.label_,this.collapseLabel_)}this.collapsed_=!this.collapsed_};Ns.prototype.getCollapsible=function(){return this.collapsible_};Ns.prototype.setCollapsible=function(t){if(this.collapsible_===t){return}this.collapsible_=t;this.element.classList.toggle("ol-uncollapsible");if(!t&&this.collapsed_){this.handleToggle_()}};Ns.prototype.setCollapsed=function(t){if(!this.collapsible_||this.collapsed_===t){return}this.handleToggle_()};Ns.prototype.getCollapsed=function(){return this.collapsed_};var Gs=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-rotate";var r=e.label!==undefined?e.label:"⇧";this.label_=null;if(typeof r==="string"){this.label_=document.createElement("span");this.label_.className="ol-compass";this.label_.textContent=r}else{this.label_=r;this.label_.classList.add("ol-compass")}var n=e.tipLabel?e.tipLabel:"Reset rotation";var a=document.createElement("button");a.className=i+"-reset";a.setAttribute("type","button");a.title=n;a.appendChild(this.label_);$n.listen(a,ra.CLICK,Gs.prototype.handleClick_,this);var s=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL;var o=document.createElement("div");o.className=s;o.appendChild(a);var h=e.render?e.render:Gs.render;this.callResetNorth_=e.resetNorth?e.resetNorth:undefined;bs.call(this,{element:o,render:h,target:e.target});this.duration_=e.duration!==undefined?e.duration:250;this.autoHide_=e.autoHide!==undefined?e.autoHide:true;this.rotation_=undefined;if(this.autoHide_){this.element.classList.add(Ps.CLASS_HIDDEN)}};qn.inherits(Gs,bs);Gs.prototype.handleClick_=function(t){t.preventDefault();if(this.callResetNorth_!==undefined){this.callResetNorth_()}else{this.resetNorth_()}};Gs.prototype.resetNorth_=function(){var t=this.getMap();var e=t.getView();if(!e){return}if(e.getRotation()!==undefined){if(this.duration_>0){e.animate({rotation:0,duration:this.duration_,easing:Es.easeOut})}else{e.setRotation(0)}}};Gs.render=function(t){var e=t.frameState;if(!e){return}var i=e.viewState.rotation;if(i!=this.rotation_){var r="rotate("+i+"rad)";if(this.autoHide_){var n=this.element.classList.contains(Ps.CLASS_HIDDEN);if(!n&&i===0){this.element.classList.add(Ps.CLASS_HIDDEN)}else if(n&&i!==0){this.element.classList.remove(Ps.CLASS_HIDDEN)}}this.label_.style.msTransform=r;this.label_.style.webkitTransform=r;this.label_.style.transform=r}this.rotation_=i};var ks=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-zoom";var r=e.delta!==undefined?e.delta:1;var n=e.zoomInLabel!==undefined?e.zoomInLabel:"+";var a=e.zoomOutLabel!==undefined?e.zoomOutLabel:"−";var s=e.zoomInTipLabel!==undefined?e.zoomInTipLabel:"Zoom in";var o=e.zoomOutTipLabel!==undefined?e.zoomOutTipLabel:"Zoom out";var h=document.createElement("button");h.className=i+"-in";h.setAttribute("type","button");h.title=s;h.appendChild(typeof n==="string"?document.createTextNode(n):n);$n.listen(h,ra.CLICK,ks.prototype.handleClick_.bind(this,r));var l=document.createElement("button");l.className=i+"-out";l.setAttribute("type","button");l.title=o;l.appendChild(typeof a==="string"?document.createTextNode(a):a);$n.listen(l,ra.CLICK,ks.prototype.handleClick_.bind(this,-r));var u=i+" "+Ps.CLASS_UNSELECTABLE+" "+Ps.CLASS_CONTROL;var f=document.createElement("div");f.className=u;f.appendChild(h);f.appendChild(l);bs.call(this,{element:f,target:e.target});this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(ks,bs);ks.prototype.handleClick_=function(t,e){e.preventDefault();this.zoomByDelta_(t)};ks.prototype.zoomByDelta_=function(t){var e=this.getMap();var i=e.getView();if(!i){return}var r=i.getResolution();if(r){var n=i.constrainResolution(r,t);if(this.duration_>0){if(i.getAnimating()){i.cancelAnimations()}i.animate({resolution:n,duration:this.duration_,easing:Es.easeOut})}else{i.setResolution(n)}}};var Us={};Us.defaults=function(t){var e=t?t:{};var i=new Ka;var r=e.zoom!==undefined?e.zoom:true;if(r){i.push(new ks(e.zoomOptions))}var n=e.rotate!==undefined?e.rotate:true;if(n){i.push(new Gs(e.rotateOptions))}var a=e.attribution!==undefined?e.attribution:true;if(a){i.push(new Ns(e.attributionOptions))}return i};var zs=function(t,e,i){this.decay_=t;this.minVelocity_=e;this.delay_=i;this.points_=[];this.angle_=0;this.initialVelocity_=0};zs.prototype.begin=function(){this.points_.length=0;this.angle_=0;this.initialVelocity_=0};zs.prototype.update=function(t,e){this.points_.push(t,e,Date.now())};zs.prototype.end=function(){if(this.points_.length<6){return false}var t=Date.now()-this.delay_;var e=this.points_.length-3;if(this.points_[e+2]<t){return false}var i=e-3;while(i>0&&this.points_[i+2]>t){i-=3}var r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60){return false}var n=this.points_[e]-this.points_[i];var a=this.points_[e+1]-this.points_[i+1];this.angle_=Math.atan2(a,n);this.initialVelocity_=Math.sqrt(n*n+a*a)/r;return this.initialVelocity_>this.minVelocity_};zs.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_};zs.prototype.getAngle=function(){return this.angle_};var Bs={ACTIVE:"active"};var Ws=function(t){aa.call(this);this.map_=null;this.setActive(true);this.handleEvent=t.handleEvent};qn.inherits(Ws,aa);Ws.prototype.getActive=function(){return this.get(Bs.ACTIVE)};Ws.prototype.getMap=function(){return this.map_};Ws.prototype.setActive=function(t){this.set(Bs.ACTIVE,t)};Ws.prototype.setMap=function(t){this.map_=t};Ws.pan=function(t,e,i){var r=t.getCenter();if(r){var n=t.constrainCenter([r[0]+e[0],r[1]+e[1]]);if(i){t.animate({duration:i,easing:Es.linear,center:n})}else{t.setCenter(n)}}};Ws.rotate=function(t,e,i,r){e=t.constrainRotation(e,0);Ws.rotateWithoutConstraints(t,e,i,r)};Ws.rotateWithoutConstraints=function(t,e,i,r){if(e!==undefined){var n=t.getRotation();var a=t.getCenter();if(n!==undefined&&a&&r>0){t.animate({rotation:e,anchor:i,duration:r,easing:Es.easeOut})}else{t.rotate(e,i)}}};Ws.zoom=function(t,e,i,r,n){e=t.constrainResolution(e,0,n);Ws.zoomWithoutConstraints(t,e,i,r)};Ws.zoomByDelta=function(t,e,i,r){var n=t.getResolution();var a=t.constrainResolution(n,e,0);if(a!==undefined){var s=t.getResolutions();a=ha.clamp(a,t.getMinResolution()||s[s.length-1],t.getMaxResolution()||s[0])}if(i&&a!==undefined&&a!==n){var o=t.getCenter();var h=t.calculateCenterZoom(a,i);h=t.constrainCenter(h);i=[(a*o[0]-n*h[0])/(a-n),(a*o[1]-n*h[1])/(a-n)]}Ws.zoomWithoutConstraints(t,a,i,r)};Ws.zoomWithoutConstraints=function(t,e,i,r){if(e){var n=t.getResolution();var a=t.getCenter();if(n!==undefined&&a&&e!==n&&r){t.animate({resolution:e,anchor:i,duration:r,easing:Es.easeOut})}else{if(i){var s=t.calculateCenterZoom(e,i);t.setCenter(s)}t.setResolution(e)}}};var Xs=function(t){var e=t?t:{};this.delta_=e.delta?e.delta:1;Ws.call(this,{handleEvent:Xs.handleEvent});this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(Xs,Ws);Xs.handleEvent=function(t){var e=false;var i=t.originalEvent;if(t.type==Ja.DBLCLICK){var r=t.map;var n=t.coordinate;var a=i.shiftKey?-this.delta_:this.delta_;var s=r.getView();Ws.zoomByDelta(s,a,n,this.duration_);t.preventDefault();e=true}return!e};var Vs={};Vs.altKeyOnly=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};Vs.altShiftKeysOnly=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey};Vs.always=_a.TRUE;Vs.click=function(t){return t.type==Ja.CLICK};Vs.mouseActionButton=function(t){var e=t.originalEvent;return e.button==0&&!(Va.WEBKIT&&Va.MAC&&e.ctrlKey)};Vs.never=_a.FALSE;Vs.pointerMove=function(t){return t.type=="pointermove"};Vs.singleClick=function(t){return t.type==Ja.SINGLECLICK};Vs.doubleClick=function(t){return t.type==Ja.DBLCLICK};Vs.noModifierKeys=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};Vs.platformModifierKeyOnly=function(t){var e=t.originalEvent;return!e.altKey&&(Va.MAC?e.metaKey:e.ctrlKey)&&!e.shiftKey};Vs.shiftKeyOnly=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey};Vs.targetNotEditable=function(t){var e=t.originalEvent.target;var i=e.tagName;return i!=="INPUT"&&i!=="SELECT"&&i!=="TEXTAREA"};Vs.mouseOnly=function(t){oa.assert(t.pointerEvent,56);return t.pointerEvent.pointerType=="mouse"};Vs.primaryAction=function(t){var e=t.pointerEvent;return e.isPrimary&&e.button===0};var Ys=function(t){var e=t?t:{};var i=e.handleEvent?e.handleEvent:Ys.handleEvent;Ws.call(this,{handleEvent:i});this.handleDownEvent_=e.handleDownEvent?e.handleDownEvent:Ys.handleDownEvent;this.handleDragEvent_=e.handleDragEvent?e.handleDragEvent:Ys.handleDragEvent;this.handleMoveEvent_=e.handleMoveEvent?e.handleMoveEvent:Ys.handleMoveEvent;this.handleUpEvent_=e.handleUpEvent?e.handleUpEvent:Ys.handleUpEvent;this.handlingDownUpSequence=false;this.trackedPointers_={};this.targetPointers=[]};qn.inherits(Ys,Ws);Ys.centroid=function(t){var e=t.length;var i=0;var r=0;for(var n=0;n<e;n++){i+=t[n].clientX;r+=t[n].clientY}return[i/e,r/e]};Ys.prototype.isPointerDraggingEvent_=function(t){var e=t.type;return e===Ja.POINTERDOWN||e===Ja.POINTERDRAG||e===Ja.POINTERUP};Ys.prototype.updateTrackedPointers_=function(t){if(this.isPointerDraggingEvent_(t)){var e=t.pointerEvent;var i=e.pointerId.toString();if(t.type==Ja.POINTERUP){delete this.trackedPointers_[i]}else if(t.type==Ja.POINTERDOWN){this.trackedPointers_[i]=e}else if(i in this.trackedPointers_){this.trackedPointers_[i]=e}this.targetPointers=Qn.getValues(this.trackedPointers_)}};Ys.handleDragEvent=qn.nullFunction;Ys.handleUpEvent=_a.FALSE;Ys.handleDownEvent=_a.FALSE;Ys.handleMoveEvent=qn.nullFunction;Ys.handleEvent=function(t){if(!(t instanceof Qa)){return true}var e=false;this.updateTrackedPointers_(t);if(this.handlingDownUpSequence){if(t.type==Ja.POINTERDRAG){this.handleDragEvent_(t)}else if(t.type==Ja.POINTERUP){var i=this.handleUpEvent_(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else{if(t.type==Ja.POINTERDOWN){var r=this.handleDownEvent_(t);this.handlingDownUpSequence=r;e=this.shouldStopEvent(r)}else if(t.type==Ja.POINTERMOVE){this.handleMoveEvent_(t)}}return!e};Ys.prototype.shouldStopEvent=function(t){return t};var js=function(t){Ys.call(this,{handleDownEvent:js.handleDownEvent_,handleDragEvent:js.handleDragEvent_,handleUpEvent:js.handleUpEvent_});var e=t?t:{};this.kinetic_=e.kinetic;this.lastCentroid=null;this.condition_=e.condition?e.condition:Vs.noModifierKeys;this.noKinetic_=false};qn.inherits(js,Ys);js.handleDragEvent_=function(t){var e=this.targetPointers;var i=Ys.centroid(e);if(e.length==this.lastPointersCount_){if(this.kinetic_){this.kinetic_.update(i[0],i[1])}if(this.lastCentroid){var r=this.lastCentroid[0]-i[0];var n=i[1]-this.lastCentroid[1];var a=t.map;var s=a.getView();var o=s.getState();var h=[r,n];ys.scale(h,o.resolution);ys.rotate(h,o.rotation);ys.add(h,o.center);h=s.constrainCenter(h);s.setCenter(h)}}else if(this.kinetic_){this.kinetic_.begin()}this.lastCentroid=i;this.lastPointersCount_=e.length};js.handleUpEvent_=function(t){var e=t.map;var i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var r=this.kinetic_.getDistance();var n=this.kinetic_.getAngle();var a=i.getCenter();var s=e.getPixelFromCoordinate(a);var o=e.getCoordinateFromPixel([s[0]-r*Math.cos(n),s[1]-r*Math.sin(n)]);i.animate({center:i.constrainCenter(o),duration:500,easing:Es.easeOut})}i.setHint(_s.INTERACTING,-1);return false}else{if(this.kinetic_){this.kinetic_.begin()}this.lastCentroid=null;return true}};js.handleDownEvent_=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var e=t.map;var i=e.getView();this.lastCentroid=null;if(!this.handlingDownUpSequence){i.setHint(_s.INTERACTING,1)}if(i.getAnimating()){i.setCenter(t.frameState.viewState.center)}if(this.kinetic_){this.kinetic_.begin()}this.noKinetic_=this.targetPointers.length>1;return true}else{return false}};js.prototype.shouldStopEvent=_a.FALSE;var Hs=function(t){var e=t?t:{};Ys.call(this,{handleDownEvent:Hs.handleDownEvent_,handleDragEvent:Hs.handleDragEvent_,handleUpEvent:Hs.handleUpEvent_});this.condition_=e.condition?e.condition:Vs.altShiftKeysOnly;this.lastAngle_=undefined;this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(Hs,Ys);Hs.handleDragEvent_=function(t){if(!Vs.mouseOnly(t)){return}var e=t.map;var i=e.getView();if(i.getConstraints().rotation===vs.disable){return}var r=e.getSize();var n=t.pixel;var a=Math.atan2(r[1]/2-n[1],n[0]-r[0]/2);if(this.lastAngle_!==undefined){var s=a-this.lastAngle_;var o=i.getRotation();Ws.rotateWithoutConstraints(i,o-s)}this.lastAngle_=a};Hs.handleUpEvent_=function(t){if(!Vs.mouseOnly(t)){return true}var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);var r=i.getRotation();Ws.rotate(i,r,undefined,this.duration_);return false};Hs.handleDownEvent_=function(t){if(!Vs.mouseOnly(t)){return false}if(Vs.mouseActionButton(t)&&this.condition_(t)){var e=t.map;e.getView().setHint(_s.INTERACTING,1);this.lastAngle_=undefined;return true}else{return false}};Hs.prototype.shouldStopEvent=_a.FALSE;var Ks=function(t){this.geometry_=null;this.element_=document.createElement("div");this.element_.style.position="absolute";this.element_.className="ol-box "+t;this.map_=null;this.startPixel_=null;this.endPixel_=null};qn.inherits(Ks,ta);Ks.prototype.disposeInternal=function(){this.setMap(null)};Ks.prototype.render_=function(){var t=this.startPixel_;var e=this.endPixel_;var i="px";var r=this.element_.style;r.left=Math.min(t[0],e[0])+i;r.top=Math.min(t[1],e[1])+i;r.width=Math.abs(e[0]-t[0])+i;r.height=Math.abs(e[1]-t[1])+i};Ks.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left=e.top=e.width=e.height="inherit"}this.map_=t;if(this.map_){this.map_.getOverlayContainer().appendChild(this.element_)}};Ks.prototype.setPixels=function(t,e){this.startPixel_=t;this.endPixel_=e;this.createOrUpdateGeometry();this.render_()};Ks.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_;var e=this.endPixel_;var i=[t,[t[0],e[1]],e,[e[0],t[1]]];var r=i.map(this.map_.getCoordinateFromPixel,this.map_);r[4]=r[0].slice();if(!this.geometry_){this.geometry_=new Wa([r])}else{this.geometry_.setCoordinates([r])}};Ks.prototype.getGeometry=function(){return this.geometry_};var qs=function(t){Ys.call(this,{handleDownEvent:qs.handleDownEvent_,handleDragEvent:qs.handleDragEvent_,handleUpEvent:qs.handleUpEvent_});var e=t?t:{};this.box_=new Ks(e.className||"ol-dragbox");this.minArea_=e.minArea!==undefined?e.minArea:64;this.startPixel_=null;this.condition_=e.condition?e.condition:Vs.always;this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:qs.defaultBoxEndCondition};qn.inherits(qs,Ys);qs.defaultBoxEndCondition=function(t,e,i){var r=i[0]-e[0];var n=i[1]-e[1];return r*r+n*n>=this.minArea_};qs.handleDragEvent_=function(t){if(!Vs.mouseOnly(t)){return}this.box_.setPixels(this.startPixel_,t.pixel);this.dispatchEvent(new qs.Event(qs.EventType_.BOXDRAG,t.coordinate,t))};qs.prototype.getGeometry=function(){return this.box_.getGeometry()};qs.prototype.onBoxEnd=qn.nullFunction;qs.handleUpEvent_=function(t){if(!Vs.mouseOnly(t)){return true}this.box_.setMap(null);if(this.boxEndCondition_(t,this.startPixel_,t.pixel)){this.onBoxEnd(t);this.dispatchEvent(new qs.Event(qs.EventType_.BOXEND,t.coordinate,t))}return false};qs.handleDownEvent_=function(t){if(!Vs.mouseOnly(t)){return false}if(Vs.mouseActionButton(t)&&this.condition_(t)){this.startPixel_=t.pixel;this.box_.setMap(t.map);this.box_.setPixels(this.startPixel_,this.startPixel_);this.dispatchEvent(new qs.Event(qs.EventType_.BOXSTART,t.coordinate,t));return true}else{return false}};qs.EventType_={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend"};qs.Event=function(t,e,i){ea.call(this,t);this.coordinate=e;this.mapBrowserEvent=i};qn.inherits(qs.Event,ea);var Zs=function(t){var e=t?t:{};var i=e.condition?e.condition:Vs.shiftKeyOnly;this.duration_=e.duration!==undefined?e.duration:200;this.out_=e.out!==undefined?e.out:false;qs.call(this,{condition:i,className:e.className||"ol-dragzoom"})};qn.inherits(Zs,qs);Zs.prototype.onBoxEnd=function(){var t=this.getMap();var e=t.getView();var i=t.getSize();var r=this.getGeometry().getExtent();if(this.out_){var n=e.calculateExtent(i);var a=pa.createOrUpdateFromCoordinates([t.getPixelFromCoordinate(pa.getBottomLeft(r)),t.getPixelFromCoordinate(pa.getTopRight(r))]);var s=e.getResolutionForExtent(a,i);pa.scaleFromCenter(n,1/s);r=n}var o=e.constrainResolution(e.getResolutionForExtent(r,i));var h=pa.getCenter(r);h=e.constrainCenter(h);e.animate({resolution:o,center:h,duration:this.duration_,easing:Es.easeOut})};var Js={LEFT:37,UP:38,RIGHT:39,DOWN:40};var Qs=function(t){Ws.call(this,{handleEvent:Qs.handleEvent});var e=t||{};this.defaultCondition_=function(t){return Vs.noModifierKeys(t)&&Vs.targetNotEditable(t)};this.condition_=e.condition!==undefined?e.condition:this.defaultCondition_;this.duration_=e.duration!==undefined?e.duration:100;this.pixelDelta_=e.pixelDelta!==undefined?e.pixelDelta:128};qn.inherits(Qs,Ws);Qs.handleEvent=function(t){var e=false;if(t.type==ra.KEYDOWN){var i=t.originalEvent;var r=i.keyCode;if(this.condition_(t)&&(r==Js.DOWN||r==Js.LEFT||r==Js.RIGHT||r==Js.UP)){var n=t.map;var a=n.getView();var s=a.getResolution()*this.pixelDelta_;var o=0,h=0;if(r==Js.DOWN){h=-s}else if(r==Js.LEFT){o=-s}else if(r==Js.RIGHT){o=s}else{h=s}var l=[o,h];ys.rotate(l,a.getRotation());Ws.pan(a,l,this.duration_);t.preventDefault();e=true}}return!e};var $s=function(t){Ws.call(this,{handleEvent:$s.handleEvent});var e=t?t:{};this.condition_=e.condition?e.condition:Vs.targetNotEditable;this.delta_=e.delta?e.delta:1;this.duration_=e.duration!==undefined?e.duration:100};qn.inherits($s,Ws);$s.handleEvent=function(t){var e=false;if(t.type==ra.KEYDOWN||t.type==ra.KEYPRESS){var i=t.originalEvent;var r=i.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var n=t.map;var a=r=="+".charCodeAt(0)?this.delta_:-this.delta_;var s=n.getView();Ws.zoomByDelta(s,a,undefined,this.duration_);t.preventDefault();e=true}}return!e};var to=function(t){Ws.call(this,{handleEvent:to.handleEvent});var e=t||{};this.delta_=0;this.duration_=e.duration!==undefined?e.duration:250;this.timeout_=e.timeout!==undefined?e.timeout:80;this.useAnchor_=e.useAnchor!==undefined?e.useAnchor:true;this.constrainResolution_=e.constrainResolution||false;this.lastAnchor_=null;this.startTime_=undefined;this.timeoutId_=undefined;this.mode_=undefined;this.trackpadEventGap_=400;this.trackpadTimeoutId_=undefined;this.trackpadDeltaPerZoom_=300;this.trackpadZoomBuffer_=1.5};qn.inherits(to,Ws);to.handleEvent=function(t){var e=t.type;if(e!==ra.WHEEL&&e!==ra.MOUSEWHEEL){return true}t.preventDefault();var i=t.map;var r=t.originalEvent;if(this.useAnchor_){this.lastAnchor_=t.coordinate}var n;if(t.type==ra.WHEEL){n=r.deltaY;if(Va.FIREFOX&&r.deltaMode===WheelEvent.DOM_DELTA_PIXEL){n/=Va.DEVICE_PIXEL_RATIO}if(r.deltaMode===WheelEvent.DOM_DELTA_LINE){n*=40}}else if(t.type==ra.MOUSEWHEEL){n=-r.wheelDeltaY;if(Va.SAFARI){n/=3}}if(n===0){return false}var a=Date.now();if(this.startTime_===undefined){this.startTime_=a}if(!this.mode_||a-this.startTime_>this.trackpadEventGap_){this.mode_=Math.abs(n)<4?to.Mode_.TRACKPAD:to.Mode_.WHEEL}if(this.mode_===to.Mode_.TRACKPAD){var s=i.getView();if(this.trackpadTimeoutId_){clearTimeout(this.trackpadTimeoutId_)}else{s.setHint(_s.INTERACTING,1)}this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var o=s.getResolution()*Math.pow(2,n/this.trackpadDeltaPerZoom_);var h=s.getMinResolution();var l=s.getMaxResolution();var u=0;if(o<h){o=Math.max(o,h/this.trackpadZoomBuffer_);u=1}else if(o>l){o=Math.min(o,l*this.trackpadZoomBuffer_);u=-1}if(this.lastAnchor_){var f=s.calculateCenterZoom(o,this.lastAnchor_);s.setCenter(s.constrainCenter(f))}s.setResolution(o);if(u===0&&this.constrainResolution_){s.animate({resolution:s.constrainResolution(o,n>0?-1:1),easing:Es.easeOut,anchor:this.lastAnchor_,duration:this.duration_})}if(u>0){s.animate({resolution:h,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500})}else if(u<0){s.animate({resolution:l,easing:Es.easeOut,anchor:this.lastAnchor_,duration:500})}this.startTime_=a;return false}this.delta_+=n;var c=Math.max(this.timeout_-(a-this.startTime_),0);clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),c);return false};to.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=undefined;var t=this.getMap().getView();t.setHint(_s.INTERACTING,-1)};to.prototype.handleWheelZoom_=function(t){var e=t.getView();if(e.getAnimating()){e.cancelAnimations()}var i=qn.MOUSEWHEELZOOM_MAXDELTA;var r=ha.clamp(this.delta_,-i,i);Ws.zoomByDelta(e,-r,this.lastAnchor_,this.duration_);this.mode_=undefined;this.delta_=0;this.lastAnchor_=null;this.startTime_=undefined;this.timeoutId_=undefined};to.prototype.setMouseAnchor=function(t){this.useAnchor_=t;if(!t){this.lastAnchor_=null}};to.Mode_={TRACKPAD:"trackpad",WHEEL:"wheel"};var eo=function(t){Ys.call(this,{handleDownEvent:eo.handleDownEvent_,handleDragEvent:eo.handleDragEvent_,handleUpEvent:eo.handleUpEvent_});var e=t||{};this.anchor_=null;this.lastAngle_=undefined;this.rotating_=false;this.rotationDelta_=0;this.threshold_=e.threshold!==undefined?e.threshold:.3;this.duration_=e.duration!==undefined?e.duration:250};qn.inherits(eo,Ys);eo.handleDragEvent_=function(t){var e=0;var i=this.targetPointers[0];var r=this.targetPointers[1];var n=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==undefined){var a=n-this.lastAngle_;this.rotationDelta_+=a;if(!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_){this.rotating_=true}e=a}this.lastAngle_=n;var s=t.map;var o=s.getView();if(o.getConstraints().rotation===vs.disable){return}var h=s.getViewport().getBoundingClientRect();var l=Ys.centroid(this.targetPointers);l[0]-=h.left;l[1]-=h.top;this.anchor_=s.getCoordinateFromPixel(l);if(this.rotating_){var u=o.getRotation();s.render();Ws.rotateWithoutConstraints(o,u+e,this.anchor_)}};eo.handleUpEvent_=function(t){if(this.targetPointers.length<2){var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);if(this.rotating_){var r=i.getRotation();Ws.rotate(i,r,this.anchor_,this.duration_)}return false}else{return true}};eo.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var e=t.map;this.anchor_=null;this.lastAngle_=undefined;this.rotating_=false;this.rotationDelta_=0;if(!this.handlingDownUpSequence){e.getView().setHint(_s.INTERACTING,1)}return true}else{return false}};eo.prototype.shouldStopEvent=_a.FALSE;var io=function(t){Ys.call(this,{handleDownEvent:io.handleDownEvent_,handleDragEvent:io.handleDragEvent_,handleUpEvent:io.handleUpEvent_});var e=t?t:{};this.constrainResolution_=e.constrainResolution||false;this.anchor_=null;this.duration_=e.duration!==undefined?e.duration:400;this.lastDistance_=undefined;this.lastScaleDelta_=1};qn.inherits(io,Ys);io.handleDragEvent_=function(t){var e=1;var i=this.targetPointers[0];var r=this.targetPointers[1];var n=i.clientX-r.clientX;var a=i.clientY-r.clientY;var s=Math.sqrt(n*n+a*a);if(this.lastDistance_!==undefined){e=this.lastDistance_/s}this.lastDistance_=s;var o=t.map;var h=o.getView();var l=h.getResolution();var u=h.getMaxResolution();var f=h.getMinResolution();var c=l*e;if(c>u){e=u/l;c=u}else if(c<f){e=f/l;c=f}if(e!=1){this.lastScaleDelta_=e}var d=o.getViewport().getBoundingClientRect();var p=Ys.centroid(this.targetPointers);p[0]-=d.left;p[1]-=d.top;this.anchor_=o.getCoordinateFromPixel(p);o.render();Ws.zoomWithoutConstraints(h,c,this.anchor_)};io.handleUpEvent_=function(t){if(this.targetPointers.length<2){var e=t.map;var i=e.getView();i.setHint(_s.INTERACTING,-1);var r=i.getResolution();if(this.constrainResolution_||r<i.getMinResolution()||r>i.getMaxResolution()){var n=this.lastScaleDelta_-1;Ws.zoom(i,r,this.anchor_,this.duration_,n)}return false}else{return true}};io.handleDownEvent_=function(t){if(this.targetPointers.length>=2){var e=t.map;this.anchor_=null;this.lastDistance_=undefined;this.lastScaleDelta_=1;if(!this.handlingDownUpSequence){e.getView().setHint(_s.INTERACTING,1)}return true}else{return false}};io.prototype.shouldStopEvent=_a.FALSE;var ro={};ro.defaults=function(t){var e=t?t:{};var i=new Ka;var r=new zs(-.005,.05,100);var n=e.altShiftDragRotate!==undefined?e.altShiftDragRotate:true;if(n){i.push(new Hs)}var a=e.doubleClickZoom!==undefined?e.doubleClickZoom:true;if(a){i.push(new Xs({delta:e.zoomDelta,duration:e.zoomDuration}))}var s=e.dragPan!==undefined?e.dragPan:true;if(s){i.push(new js({kinetic:r}))}var o=e.pinchRotate!==undefined?e.pinchRotate:true;if(o){i.push(new eo)}var h=e.pinchZoom!==undefined?e.pinchZoom:true;if(h){i.push(new io({constrainResolution:e.constrainResolution,duration:e.zoomDuration}))}var l=e.keyboard!==undefined?e.keyboard:true;if(l){i.push(new Qs);i.push(new $s({delta:e.zoomDelta,duration:e.zoomDuration}))}var u=e.mouseWheelZoom!==undefined?e.mouseWheelZoom:true;if(u){i.push(new to({constrainResolution:e.constrainResolution,duration:e.zoomDuration}))}var f=e.shiftDragZoom!==undefined?e.shiftDragZoom:true;if(f){i.push(new Zs({duration:e.zoomDuration}))}return i};var no=function(t,e,i,r){ia.call(this);this.extent=t;this.pixelRatio_=i;this.resolution=e;this.state=r};qn.inherits(no,ia);no.prototype.changed=function(){this.dispatchEvent(ra.CHANGE)};no.prototype.getExtent=function(){return this.extent};no.prototype.getImage=function(){};no.prototype.getPixelRatio=function(){return this.pixelRatio_};no.prototype.getResolution=function(){return this.resolution};no.prototype.getState=function(){return this.state};no.prototype.load=function(){};var ao={IDLE:0,LOADING:1,LOADED:2,ERROR:3};var so=function(t,e,i,r,n){this.loader_=n!==undefined?n:null;var a=n!==undefined?ao.IDLE:ao.LOADED;no.call(this,t,e,i,a);this.canvas_=r;this.error_=null};qn.inherits(so,no);so.prototype.getError=function(){return this.error_};so.prototype.handleLoad_=function(t){if(t){this.error_=t;this.state=ao.ERROR}else{this.state=ao.LOADED}this.changed()};so.prototype.load=function(){if(this.state==ao.IDLE){this.state=ao.LOADING;this.changed();this.loader_(this.handleLoad_.bind(this))}};so.prototype.getImage=function(){return this.canvas_};var oo={IMAGE:"IMAGE",TILE:"TILE",VECTOR_TILE:"VECTOR_TILE",VECTOR:"VECTOR"};var ho={IMAGE:"image",VECTOR:"vector"};var lo=function(t,e,i,r,n){ea.call(this,t);this.vectorContext=e;this.frameState=i;this.context=r;this.glContext=n};qn.inherits(lo,ea);var uo=function(t){ia.call(this);this.highWaterMark=t!==undefined?t:2048;this.count_=0;this.entries_={};this.oldest_=null;this.newest_=null};qn.inherits(uo,ia);uo.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark};uo.prototype.clear=function(){this.count_=0;this.entries_={};this.oldest_=null;this.newest_=null;this.dispatchEvent(ra.CLEAR)};uo.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)};uo.prototype.forEach=function(t,e){var i=this.oldest_;while(i){t.call(e,i.value_,i.key_,this);i=i.newer}};uo.prototype.get=function(t){var e=this.entries_[t];oa.assert(e!==undefined,15);if(e===this.newest_){return e.value_}else if(e===this.oldest_){this.oldest_=this.oldest_.newer;this.oldest_.older=null}else{e.newer.older=e.older;e.older.newer=e.newer}e.newer=null;e.older=this.newest_;this.newest_.newer=e;this.newest_=e;return e.value_};uo.prototype.remove=function(t){var e=this.entries_[t];oa.assert(e!==undefined,15);if(e===this.newest_){this.newest_=e.older;if(this.newest_){this.newest_.newer=null}}else if(e===this.oldest_){this.oldest_=e.newer;if(this.oldest_){this.oldest_.older=null}}else{e.newer.older=e.older;e.older.newer=e.newer}delete this.entries_[t];--this.count_;return e.value_};uo.prototype.getCount=function(){return this.count_};uo.prototype.getKeys=function(){var t=new Array(this.count_);var e=0;var i;for(i=this.newest_;i;i=i.older){t[e++]=i.key_}return t};uo.prototype.getValues=function(){var t=new Array(this.count_);var e=0;var i;for(i=this.newest_;i;i=i.older){t[e++]=i.value_}return t};uo.prototype.peekLast=function(){return this.oldest_.value_};uo.prototype.peekLastKey=function(){return this.oldest_.key_};uo.prototype.peekFirstKey=function(){return this.newest_.key_};uo.prototype.pop=function(){var t=this.oldest_;delete this.entries_[t.key_];if(t.newer){t.newer.older=null}this.oldest_=t.newer;if(!this.oldest_){this.newest_=null}--this.count_;return t.value_};uo.prototype.replace=function(t,e){this.get(t);this.entries_[t].value_=e};uo.prototype.set=function(t,e){oa.assert(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};if(!this.newest_){this.oldest_=i}else{this.newest_.newer=i}this.newest_=i;this.entries_[t]=i;++this.count_};uo.prototype.prune=function(){while(this.canExpireCache()){this.pop()}};var fo={};fo.defaultFont="10px sans-serif";fo.defaultFillStyle=[0,0,0,1];fo.defaultLineCap="round";fo.defaultLineDash=[];fo.defaultLineDashOffset=0;fo.defaultLineJoin="round";fo.defaultMiterLimit=10;fo.defaultStrokeStyle=[0,0,0,1];fo.defaultTextAlign="center";fo.defaultTextBaseline="middle";fo.defaultPadding=[0,0,0,0];fo.defaultLineWidth=1;fo.labelCache=new uo;fo.checkedFonts_={};fo.measureContext_=null;fo.textHeights_={};fo.checkFont=function(){var t=60;var e=fo.checkedFonts_;var i=fo.labelCache;var r="32px monospace";var n="wmytzilWMYTZIL@#/&?$%10";var a,s;function o(t){var e=fo.getMeasureContext();e.font=r;s=e.measureText(n).width;var i=true;if(t!="monospace"){e.font="32px "+t+",monospace";var a=e.measureText(n).width;i=a!=s}return i}function h(){var r=true;for(var n in e){if(e[n]<t){if(o(n)){e[n]=t;Qn.clear(fo.textHeights_);fo.measureContext_=null;i.clear()}else{++e[n];r=false}}}if(r){window.clearInterval(a);a=undefined}}return function(i){var r=Ps.getFontFamilies(i);if(!r){return}for(var n=0,s=r.length;n<s;++n){var l=r[n];if(!(l in e)){e[l]=t;if(!o(l)){e[l]=0;if(a===undefined){a=window.setInterval(h,32)}}}}}}();fo.getMeasureContext=function(){var t=fo.measureContext_;if(!t){t=fo.measureContext_=Ts.createCanvasContext2D(1,1)}return t};fo.measureTextHeight=function(){var t;var e=fo.textHeights_;return function(i){var r=e[i];if(r==undefined){if(!t){t=document.createElement("span");t.textContent="M";t.style.margin=t.style.padding="0 !important";t.style.position="absolute !important";t.style.left="-99999px !important"}t.style.font=i;document.body.appendChild(t);r=e[i]=t.offsetHeight;document.body.removeChild(t)}return r}}();fo.measureTextWidth=function(t,e){var i=fo.getMeasureContext();if(t!=i.font){i.font=t}return i.measureText(e).width};fo.rotateAtOffset=function(t,e,i,r){if(e!==0){t.translate(i,r);t.rotate(e);t.translate(-i,-r)}};fo.resetTransform_=Sa.create();fo.drawImage=function(t,e,i,r,n,a,s,o,h,l,u){var f;if(i!=1){f=t.globalAlpha;t.globalAlpha=f*i}if(e){t.setTransform.apply(t,e)}t.drawImage(r,n,a,s,o,h,l,s*u,o*u);if(f){t.globalAlpha=f}if(e){t.setTransform.apply(t,fo.resetTransform_)}};var co={};co.HEX_COLOR_RE_=/^#(?:[0-9a-f]{3,4}){1,2}$/i;co.NAMED_COLOR_RE_=/^([a-z]*)$/i;co.asArray=function(t){if(Array.isArray(t)){return t}else{return co.fromString(t)}};co.asString=function(t){if(typeof t==="string"){return t}else{return co.toString(t)}};co.fromNamed=function(t){var e=document.createElement("div");e.style.color=t;document.body.appendChild(e);var i=getComputedStyle(e).color;document.body.removeChild(e);return i};co.fromString=function(){var t=1024;var e={};var i=0;return function(r){var n;if(e.hasOwnProperty(r)){n=e[r]}else{if(i>=t){var a=0;var s;for(s in e){if((a++&3)===0){delete e[s];--i}}}n=co.fromStringInternal_(r);e[r]=n;++i}return n}}();co.fromStringInternal_=function(t){var e,i,r,n,a,s;if(co.NAMED_COLOR_RE_.exec(t)){t=co.fromNamed(t)}if(co.HEX_COLOR_RE_.exec(t)){var o=t.length-1;var h;if(o<=4){h=1}else{h=2}var l=o===4||o===8;e=parseInt(t.substr(1+0*h,h),16);i=parseInt(t.substr(1+1*h,h),16);r=parseInt(t.substr(1+2*h,h),16);if(l){n=parseInt(t.substr(1+3*h,h),16)}else{n=255}if(h==1){e=(e<<4)+e;i=(i<<4)+i;r=(r<<4)+r;if(l){n=(n<<4)+n}}a=[e,i,r,n/255]}else if(t.indexOf("rgba(")==0){s=t.slice(5,-1).split(",").map(Number);a=co.normalize(s)}else if(t.indexOf("rgb(")==0){s=t.slice(4,-1).split(",").map(Number);s.push(1);a=co.normalize(s)}else{oa.assert(false,14)}return a};co.normalize=function(t,e){var i=e||[];i[0]=ha.clamp(t[0]+.5|0,0,255);i[1]=ha.clamp(t[1]+.5|0,0,255);i[2]=ha.clamp(t[2]+.5|0,0,255);i[3]=ha.clamp(t[3],0,1);return i};co.toString=function(t){var e=t[0];if(e!=(e|0)){e=e+.5|0}var i=t[1];if(i!=(i|0)){i=i+.5|0}var r=t[2];if(r!=(r|0)){r=r+.5|0}var n=t[3]===undefined?1:t[3];return"rgba("+e+","+i+","+r+","+n+")"};var po={};po.asColorLike=function(t){if(po.isColorLike(t)){return t}else{return co.asString(t)}};po.isColorLike=function(t){return typeof t==="string"||t instanceof CanvasPattern||t instanceof CanvasGradient};var vo=function(){};vo.prototype.drawCustom=function(t,e,i){};vo.prototype.drawGeometry=function(t){};vo.prototype.setStyle=function(t){};vo.prototype.drawCircle=function(t,e){};vo.prototype.drawFeature=function(t,e){};vo.prototype.drawGeometryCollection=function(t,e){};vo.prototype.drawLineString=function(t,e){};vo.prototype.drawMultiLineString=function(t,e){};vo.prototype.drawMultiPoint=function(t,e){};vo.prototype.drawMultiPolygon=function(t,e){};vo.prototype.drawPoint=function(t,e){};vo.prototype.drawPolygon=function(t,e){};vo.prototype.drawText=function(t,e){};vo.prototype.setFillStrokeStyle=function(t,e){};vo.prototype.setImageStyle=function(t,e){};vo.prototype.setTextStyle=function(t,e){};var _o=function(t,e,i,r,n){vo.call(this);this.context_=t;this.pixelRatio_=e;this.extent_=i;this.transform_=r;this.viewRotation_=n;this.contextFillState_=null;this.contextStrokeState_=null;this.contextTextState_=null;this.fillState_=null;this.strokeState_=null;this.image_=null;this.imageAnchorX_=0;this.imageAnchorY_=0;this.imageHeight_=0;this.imageOpacity_=0;this.imageOriginX_=0;this.imageOriginY_=0;this.imageRotateWithView_=false;this.imageRotation_=0;this.imageScale_=0;this.imageSnapToPixel_=false;this.imageWidth_=0;this.text_="";this.textOffsetX_=0;this.textOffsetY_=0;this.textRotateWithView_=false;this.textRotation_=0;this.textScale_=0;this.textFillState_=null;this.textStrokeState_=null;this.textState_=null;this.pixelCoordinates_=[];this.tmpLocalTransform_=Sa.create()};qn.inherits(_o,vo);_o.prototype.drawImages_=function(t,e,i,r){if(!this.image_){return}var n=ga.transform2D(t,e,i,2,this.transform_,this.pixelCoordinates_);var a=this.context_;var s=this.tmpLocalTransform_;var o=a.globalAlpha;if(this.imageOpacity_!=1){a.globalAlpha=o*this.imageOpacity_}var h=this.imageRotation_;if(this.imageRotateWithView_){h+=this.viewRotation_}var l,u;for(l=0,u=n.length;l<u;l+=2){var f=n[l]-this.imageAnchorX_;var c=n[l+1]-this.imageAnchorY_;if(this.imageSnapToPixel_){f=Math.round(f);c=Math.round(c)}if(h!==0||this.imageScale_!=1){var d=f+this.imageAnchorX_;var p=c+this.imageAnchorY_;Sa.compose(s,d,p,this.imageScale_,this.imageScale_,h,-d,-p);a.setTransform.apply(a,s)}a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,c,this.imageWidth_,this.imageHeight_)}if(h!==0||this.imageScale_!=1){a.setTransform(1,0,0,1,0,0)}if(this.imageOpacity_!=1){a.globalAlpha=o}};_o.prototype.drawText_=function(t,e,i,r){if(!this.textState_||this.text_===""){return}if(this.textFillState_){this.setContextFillState_(this.textFillState_)}if(this.textStrokeState_){this.setContextStrokeState_(this.textStrokeState_)}this.setContextTextState_(this.textState_);var n=ga.transform2D(t,e,i,r,this.transform_,this.pixelCoordinates_);var a=this.context_;var s=this.textRotation_;if(this.textRotateWithView_){s+=this.viewRotation_}for(;e<i;e+=r){var o=n[e]+this.textOffsetX_;var h=n[e+1]+this.textOffsetY_;if(s!==0||this.textScale_!=1){var l=Sa.compose(this.tmpLocalTransform_,o,h,this.textScale_,this.textScale_,s,-o,-h);a.setTransform.apply(a,l)}if(this.textStrokeState_){a.strokeText(this.text_,o,h)}if(this.textFillState_){a.fillText(this.text_,o,h)}}if(s!==0||this.textScale_!=1){a.setTransform(1,0,0,1,0,0)}};_o.prototype.moveToLineTo_=function(t,e,i,r,n){var a=this.context_;var s=ga.transform2D(t,e,i,r,this.transform_,this.pixelCoordinates_);a.moveTo(s[0],s[1]);var o=s.length;if(n){o-=2}for(var h=2;h<o;h+=2){a.lineTo(s[h],s[h+1])}if(n){a.closePath()}return i};_o.prototype.drawRings_=function(t,e,i,r){var n,a;for(n=0,a=i.length;n<a;++n){e=this.moveToLineTo_(t,e,i[n],r,true)}return e};_o.prototype.drawCircle=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.fillState_||this.strokeState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=La.transform2D(t,this.transform_,this.pixelCoordinates_);var i=e[2]-e[0];var r=e[3]-e[1];var n=Math.sqrt(i*i+r*r);var a=this.context_;a.beginPath();a.arc(e[0],e[1],n,0,2*Math.PI);if(this.fillState_){a.fill()}if(this.strokeState_){a.stroke()}}if(this.text_!==""){this.drawText_(t.getCenter(),0,2,2)}};_o.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke());this.setImageStyle(t.getImage());this.setTextStyle(t.getText())};_o.prototype.drawGeometry=function(t){var e=t.getType();switch(e){case la.POINT:this.drawPoint(t);break;case la.LINE_STRING:this.drawLineString(t);break;case la.POLYGON:this.drawPolygon(t);break;case la.MULTI_POINT:this.drawMultiPoint(t);break;case la.MULTI_LINE_STRING:this.drawMultiLineString(t);break;case la.MULTI_POLYGON:this.drawMultiPolygon(t);break;case la.GEOMETRY_COLLECTION:this.drawGeometryCollection(t);break;case la.CIRCLE:this.drawCircle(t);break}};_o.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);if(!i||!pa.intersects(this.extent_,i.getExtent())){return}this.setStyle(e);this.drawGeometry(i)};_o.prototype.drawGeometryCollection=function(t){var e=t.getGeometriesArray();var i,r;for(i=0,r=e.length;i<r;++i){this.drawGeometry(e[i])}};_o.prototype.drawPoint=function(t){var e=t.getFlatCoordinates();var i=t.getStride();if(this.image_){this.drawImages_(e,0,e.length,i)}if(this.text_!==""){this.drawText_(e,0,e.length,i)}};_o.prototype.drawMultiPoint=function(t){var e=t.getFlatCoordinates();var i=t.getStride();if(this.image_){this.drawImages_(e,0,e.length,i)}if(this.text_!==""){this.drawText_(e,0,e.length,i)}};_o.prototype.drawLineString=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var e=this.context_;var i=t.getFlatCoordinates();e.beginPath();this.moveToLineTo_(i,0,i.length,t.getStride(),false);e.stroke()}if(this.text_!==""){var r=t.getFlatMidpoint();this.drawText_(r,0,2,2)}};_o.prototype.drawMultiLineString=function(t){var e=t.getExtent();if(!pa.intersects(this.extent_,e)){return}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_;var r=t.getFlatCoordinates();var n=0;var a=t.getEnds();var s=t.getStride();i.beginPath();var o,h;for(o=0,h=a.length;o<h;++o){n=this.moveToLineTo_(r,n,a[o],s,false)}i.stroke()}if(this.text_!==""){var l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}};_o.prototype.drawPolygon=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_||this.fillState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=this.context_;e.beginPath();this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride());if(this.fillState_){e.fill()}if(this.strokeState_){e.stroke()}}if(this.text_!==""){var i=t.getFlatInteriorPoint();this.drawText_(i,0,2,2)}};_o.prototype.drawMultiPolygon=function(t){if(!pa.intersects(this.extent_,t.getExtent())){return}if(this.strokeState_||this.fillState_){if(this.fillState_){this.setContextFillState_(this.fillState_)}if(this.strokeState_){this.setContextStrokeState_(this.strokeState_)}var e=this.context_;var i=t.getOrientedFlatCoordinates();var r=0;var n=t.getEndss();var a=t.getStride();var s,o;e.beginPath();for(s=0,o=n.length;s<o;++s){var h=n[s];r=this.drawRings_(i,r,h,a)}if(this.fillState_){e.fill()}if(this.strokeState_){e.stroke()}}if(this.text_!==""){var l=t.getFlatInteriorPoints();this.drawText_(l,0,l.length,2)}};_o.prototype.setContextFillState_=function(t){var e=this.context_;var i=this.contextFillState_;if(!i){e.fillStyle=t.fillStyle;this.contextFillState_={fillStyle:t.fillStyle}}else{if(i.fillStyle!=t.fillStyle){i.fillStyle=e.fillStyle=t.fillStyle}}};_o.prototype.setContextStrokeState_=function(t){var e=this.context_;var i=this.contextStrokeState_;if(!i){e.lineCap=t.lineCap;if(Va.CANVAS_LINE_DASH){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.lineJoin=t.lineJoin;e.lineWidth=t.lineWidth;e.miterLimit=t.miterLimit;e.strokeStyle=t.strokeStyle;this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle}}else{if(i.lineCap!=t.lineCap){i.lineCap=e.lineCap=t.lineCap}if(Va.CANVAS_LINE_DASH){if(!fa.equals(i.lineDash,t.lineDash)){e.setLineDash(i.lineDash=t.lineDash)}if(i.lineDashOffset!=t.lineDashOffset){i.lineDashOffset=e.lineDashOffset=t.lineDashOffset}}if(i.lineJoin!=t.lineJoin){i.lineJoin=e.lineJoin=t.lineJoin}if(i.lineWidth!=t.lineWidth){i.lineWidth=e.lineWidth=t.lineWidth}if(i.miterLimit!=t.miterLimit){i.miterLimit=e.miterLimit=t.miterLimit}if(i.strokeStyle!=t.strokeStyle){i.strokeStyle=e.strokeStyle=t.strokeStyle}}};_o.prototype.setContextTextState_=function(t){var e=this.context_;var i=this.contextTextState_;var r=t.textAlign?t.textAlign:fo.defaultTextAlign;if(!i){e.font=t.font;e.textAlign=r;e.textBaseline=t.textBaseline;this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline}}else{if(i.font!=t.font){i.font=e.font=t.font}if(i.textAlign!=r){i.textAlign=r}if(i.textBaseline!=t.textBaseline){i.textBaseline=e.textBaseline=t.textBaseline}}};_o.prototype.setFillStrokeStyle=function(t,e){if(!t){this.fillState_=null}else{var i=t.getColor();this.fillState_={fillStyle:po.asColorLike(i?i:fo.defaultFillStyle)}}if(!e){this.strokeState_=null}else{var r=e.getColor();var n=e.getLineCap();var a=e.getLineDash();var s=e.getLineDashOffset();var o=e.getLineJoin();var h=e.getWidth();var l=e.getMiterLimit();this.strokeState_={lineCap:n!==undefined?n:fo.defaultLineCap,lineDash:a?a:fo.defaultLineDash,lineDashOffset:s?s:fo.defaultLineDashOffset,lineJoin:o!==undefined?o:fo.defaultLineJoin,lineWidth:this.pixelRatio_*(h!==undefined?h:fo.defaultLineWidth),miterLimit:l!==undefined?l:fo.defaultMiterLimit,strokeStyle:po.asColorLike(r?r:fo.defaultStrokeStyle)}}};_o.prototype.setImageStyle=function(t){if(!t){this.image_=null}else{var e=t.getAnchor();var i=t.getImage(1);var r=t.getOrigin();var n=t.getSize();this.imageAnchorX_=e[0];this.imageAnchorY_=e[1];this.imageHeight_=n[1];this.image_=i;this.imageOpacity_=t.getOpacity();this.imageOriginX_=r[0];this.imageOriginY_=r[1];this.imageRotateWithView_=t.getRotateWithView();this.imageRotation_=t.getRotation();this.imageScale_=t.getScale()*this.pixelRatio_;this.imageSnapToPixel_=t.getSnapToPixel();this.imageWidth_=n[0]}};_o.prototype.setTextStyle=function(t){if(!t){this.text_=""}else{var e=t.getFill();if(!e){this.textFillState_=null}else{var i=e.getColor();this.textFillState_={fillStyle:po.asColorLike(i?i:fo.defaultFillStyle)}}var r=t.getStroke();if(!r){this.textStrokeState_=null}else{var n=r.getColor();var a=r.getLineCap();var s=r.getLineDash();var o=r.getLineDashOffset();var h=r.getLineJoin();var l=r.getWidth();var u=r.getMiterLimit();this.textStrokeState_={lineCap:a!==undefined?a:fo.defaultLineCap,lineDash:s?s:fo.defaultLineDash,lineDashOffset:o?o:fo.defaultLineDashOffset,lineJoin:h!==undefined?h:fo.defaultLineJoin,lineWidth:l!==undefined?l:fo.defaultLineWidth,miterLimit:u!==undefined?u:fo.defaultMiterLimit,strokeStyle:po.asColorLike(n?n:fo.defaultStrokeStyle)}}var f=t.getFont();var c=t.getOffsetX();var d=t.getOffsetY();var p=t.getRotateWithView();var v=t.getRotation();var _=t.getScale();var g=t.getText();var m=t.getTextAlign();var y=t.getTextBaseline();this.textState_={font:f!==undefined?f:fo.defaultFont,textAlign:m!==undefined?m:fo.defaultTextAlign,textBaseline:y!==undefined?y:fo.defaultTextBaseline};this.text_=g!==undefined?g:"";this.textOffsetX_=c!==undefined?this.pixelRatio_*c:0;this.textOffsetY_=d!==undefined?this.pixelRatio_*d:0;this.textRotateWithView_=p!==undefined?p:false;this.textRotation_=v!==undefined?v:0;this.textScale_=this.pixelRatio_*(_!==undefined?_:1)}};var go=function(t){na.call(this);this.layer_=t};qn.inherits(go,na);go.prototype.forEachFeatureAtCoordinate=qn.nullFunction;go.prototype.hasFeatureAtCoordinate=_a.FALSE;go.prototype.createLoadedTileFinder=function(t,e,i){return function(r,n){function a(t){if(!i[r]){i[r]={}}i[r][t.tileCoord.toString()]=t}return t.forEachLoadedTile(e,r,n,a)}};go.prototype.getLayer=function(){return this.layer_};go.prototype.handleImageChange_=function(t){var e=t.target;if(e.getState()===ao.LOADED){this.renderIfReadyAndVisible()}};go.prototype.loadImage=function(t){var e=t.getState();if(e!=ao.LOADED&&e!=ao.ERROR){$n.listen(t,ra.CHANGE,this.handleImageChange_,this)}if(e==ao.IDLE){t.load();e=t.getState()}return e==ao.LOADED};go.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();if(t.getVisible()&&t.getSourceState()==Ms.READY){this.changed()}};go.prototype.scheduleExpireCache=function(t,e){if(e.canExpireCache()){var i=function(t,e,i){var r=qn.getUid(t).toString();if(r in i.usedTiles){t.expireCache(i.viewState.projection,i.usedTiles[r])}}.bind(null,e);t.postRenderFunctions.push(i)}};go.prototype.updateLogos=function(t,e){var i=e.getLogo();if(i!==undefined){if(typeof i==="string"){t.logos[i]=""}else if(i){oa.assert(typeof i.href=="string",44);oa.assert(typeof i.src=="string",45);t.logos[i.src]=i.href}}};go.prototype.updateUsedTiles=function(t,e,i,r){var n=qn.getUid(e).toString();var a=i.toString();if(n in t){if(a in t[n]){t[n][a].extend(r)}else{t[n][a]=r}}else{t[n]={};t[n][a]=r}};go.prototype.manageTilePyramid=function(t,e,i,r,n,a,s,o,h,l){var u=qn.getUid(e).toString();if(!(u in t.wantedTiles)){t.wantedTiles[u]={}}var f=t.wantedTiles[u];var c=t.tileQueue;var d=i.getMinZoom();var p,v,_,g,m,y;for(y=d;y<=s;++y){v=i.getTileRangeForExtentAndZ(a,y,v);_=i.getResolution(y);for(g=v.minX;g<=v.maxX;++g){for(m=v.minY;m<=v.maxY;++m){if(s-y<=o){p=e.getTile(y,g,m,r,n);if(p.getState()==us.IDLE){f[p.getKey()]=true;if(!c.isKeyQueued(p.getKey())){c.enqueue([p,u,i.getTileCoordCenter(p.tileCoord),_])}}if(h!==undefined){h.call(l,p)}}else{e.useTile(y,g,m,n)}}}}};var mo=function(t){go.call(this,t);this.transform_=Sa.create()};qn.inherits(mo,go);mo.prototype.clip=function(t,e,i){var r=e.pixelRatio;var n=e.size[0]*r;var a=e.size[1]*r;var s=e.viewState.rotation;var o=pa.getTopLeft(i);var h=pa.getTopRight(i);var l=pa.getBottomRight(i);var u=pa.getBottomLeft(i);Sa.apply(e.coordinateToPixelTransform,o);Sa.apply(e.coordinateToPixelTransform,h);Sa.apply(e.coordinateToPixelTransform,l);Sa.apply(e.coordinateToPixelTransform,u);t.save();fo.rotateAtOffset(t,-s,n/2,a/2);t.beginPath();t.moveTo(o[0]*r,o[1]*r);t.lineTo(h[0]*r,h[1]*r);t.lineTo(l[0]*r,l[1]*r);t.lineTo(u[0]*r,u[1]*r);t.clip();fo.rotateAtOffset(t,s,n/2,a/2)};mo.prototype.dispatchComposeEvent_=function(t,e,i,r){var n=this.getLayer();if(n.hasListener(t)){var a=i.size[0]*i.pixelRatio;var s=i.size[1]*i.pixelRatio;var o=i.viewState.rotation;fo.rotateAtOffset(e,-o,a/2,s/2);var h=r!==undefined?r:this.getTransform(i,0);var l=new _o(e,i.pixelRatio,i.extent,h,i.viewState.rotation);var u=new lo(t,l,i,e,null);n.dispatchEvent(u);fo.rotateAtOffset(e,o,a/2,s/2)}};mo.prototype.forEachLayerAtCoordinate=function(t,e,i,r){var n=this.forEachFeatureAtCoordinate(t,e,0,_a.TRUE,this);if(n){return i.call(r,this.getLayer(),null)}else{return undefined}};mo.prototype.postCompose=function(t,e,i,r){this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t,e,r)};mo.prototype.preCompose=function(t,e,i){this.dispatchComposeEvent_(Ds.PRECOMPOSE,t,e,i)};mo.prototype.dispatchRenderEvent=function(t,e,i){this.dispatchComposeEvent_(Ds.RENDER,t,e,i)};mo.prototype.getTransform=function(t,e){var i=t.viewState;var r=t.pixelRatio;var n=r*t.size[0]/2;var a=r*t.size[1]/2;var s=r/i.resolution;var o=-s;var h=-i.rotation;var l=-i.center[0]+e;var u=-i.center[1];return Sa.compose(this.transform_,n,a,s,o,h,l,u)};mo.prototype.composeFrame=function(t,e,i){};mo.prototype.prepareFrame=function(t,e){};var yo=function(t){mo.call(this,t);this.coordinateToCanvasPixelTransform=Sa.create();this.hitCanvasContext_=null};qn.inherits(yo,mo);yo.prototype.composeFrame=function(t,e,i){this.preCompose(i,t);var r=this.getImage();if(r){var n=e.extent;var a=n!==undefined&&!pa.containsExtent(n,t.extent)&&pa.intersects(n,t.extent);if(a){this.clip(i,t,n)}var s=this.getImageTransform();var o=i.globalAlpha;i.globalAlpha=e.opacity;var h=s[4];var l=s[5];var u=r.width*s[0];var f=r.height*s[3];i.drawImage(r,0,0,+r.width,+r.height,Math.round(h),Math.round(l),Math.round(u),Math.round(f));i.globalAlpha=o;if(a){i.restore()}}this.postCompose(i,t,e)};yo.prototype.getImage=function(){};yo.prototype.getImageTransform=function(){};yo.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=this.getLayer();var s=a.getSource();var o=e.viewState.resolution;var h=e.viewState.rotation;var l=e.skippedFeatureUids;return s.forEachFeatureAtCoordinate(t,o,h,i,l,(function(t){return r.call(n,t,a)}))};yo.prototype.forEachLayerAtCoordinate=function(t,e,i,r){if(!this.getImage()){return undefined}if(this.getLayer().getSource().forEachFeatureAtCoordinate!==qn.nullFunction){return mo.prototype.forEachLayerAtCoordinate.apply(this,arguments)}else{var n=Sa.apply(this.coordinateToCanvasPixelTransform,t.slice());ys.scale(n,e.viewState.resolution/this.renderedResolution);if(!this.hitCanvasContext_){this.hitCanvasContext_=Ts.createCanvasContext2D(1,1)}this.hitCanvasContext_.clearRect(0,0,1,1);this.hitCanvasContext_.drawImage(this.getImage(),n[0],n[1],1,1,0,0,1,1);var a=this.hitCanvasContext_.getImageData(0,0,1,1).data;if(a[3]>0){return i.call(r,this.getLayer(),a)}else{return undefined}}};var Eo=function(t){yo.call(this,t);this.image_=null;this.imageTransform_=Sa.create();this.skippedFeatures_=[];this.vectorRenderer_=null};qn.inherits(Eo,yo);Eo["handles"]=function(t,e){return t===As.CANVAS&&(e.getType()===oo.IMAGE||e.getType()===oo.VECTOR&&e.getRenderMode()===ho.IMAGE)};Eo["create"]=function(t,e){var i=new Eo(e);if(e.getType()===oo.VECTOR){var r=Ls.getLayerRendererPlugins();for(var n=0,a=r.length;n<a;++n){var s=r[n];if(s!==Eo&&s["handles"](As.CANVAS,e)){i.setVectorRenderer(s["create"](t,e))}}}return i};Eo.prototype.getImage=function(){return!this.image_?null:this.image_.getImage()};Eo.prototype.getImageTransform=function(){return this.imageTransform_};Eo.prototype.prepareFrame=function(t,e){var i=t.pixelRatio;var r=t.size;var n=t.viewState;var a=n.center;var s=n.resolution;var o;var h=this.getLayer();var l=h.getSource();var u=t.viewHints;var f=t.extent;if(e.extent!==undefined){f=pa.getIntersection(f,e.extent)}if(!u[_s.ANIMATING]&&!u[_s.INTERACTING]&&!pa.isEmpty(f)){var c=n.projection;if(!qn.ENABLE_RASTER_REPROJECTION){var d=l.getProjection();if(d){c=d}}var p=this.vectorRenderer_;if(p){var v=p.context;var _=Qn.assign({},t,{size:[pa.getWidth(f)/s,pa.getHeight(f)/s],viewState:Qn.assign({},t.viewState,{rotation:0})});var g=Object.keys(_.skippedFeatureUids).sort();if(p.prepareFrame(_,e)&&(p.replayGroupChanged||!fa.equals(g,this.skippedFeatures_))){v.canvas.width=_.size[0]*i;v.canvas.height=_.size[1]*i;p.composeFrame(_,e,v);this.image_=new so(f,s,i,v.canvas);this.skippedFeatures_=g}}else{o=l.getImage(f,s,i,c);if(o){var m=this.loadImage(o);if(m){this.image_=o}}}}if(this.image_){o=this.image_;var y=o.getExtent();var E=o.getResolution();var x=o.getPixelRatio();var T=i*E/(s*x);var C=Sa.compose(this.imageTransform_,i*r[0]/2,i*r[1]/2,T,T,0,x*(y[0]-a[0])/E,x*(a[1]-y[3])/E);Sa.compose(this.coordinateToCanvasPixelTransform,i*r[0]/2-C[4],i*r[1]/2-C[5],i/s,-i/s,0,-a[0],-a[1]);this.updateLogos(t,l);this.renderedResolution=E*i/x}return!!this.image_};Eo.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.vectorRenderer_){return this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,r,n)}else{return yo.prototype.forEachFeatureAtCoordinate.call(this,t,e,i,r,n)}};Eo.prototype.setVectorRenderer=function(t){this.vectorRenderer_=t};var xo=function(){this.cache_={};this.cacheSize_=0;this.maxCacheSize_=32};xo.getKey=function(t,e,i){var r=i?co.asString(i):"null";return e+":"+t+":"+r};xo.prototype.clear=function(){this.cache_={};this.cacheSize_=0};xo.prototype.expire=function(){if(this.cacheSize_>this.maxCacheSize_){var t=0;var e,i;for(e in this.cache_){i=this.cache_[e];if((t++&3)===0&&!i.hasListener()){delete this.cache_[e];--this.cacheSize_}}}};xo.prototype.get=function(t,e,i){var r=xo.getKey(t,e,i);return r in this.cache_?this.cache_[r]:null};xo.prototype.set=function(t,e,i,r){var n=xo.getKey(t,e,i);this.cache_[n]=r;++this.cacheSize_};xo.prototype.setSize=function(t){this.maxCacheSize_=t;this.expire()};var To={};To.iconImageCache=new xo;var Co=function(t,e){ta.call(this);this.map_=e;this.layerRenderers_={};this.layerRendererListeners_={}};qn.inherits(Co,ta);Co.prototype.calculateMatrices2D=function(t){var e=t.viewState;var i=t.coordinateToPixelTransform;var r=t.pixelToCoordinateTransform;Sa.compose(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]);Sa.invert(Sa.setFromArray(r,i))};Co.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_){this.removeLayerRendererByKey_(t).dispose()}};Co.expireIconCache_=function(t,e){var i=To.iconImageCache;i.expire()};Co.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){var o;var h=e.viewState;var l=h.resolution;function u(t,i){var a=qn.getUid(t).toString();var s=e.layerStates[qn.getUid(i)].managed;if(!(a in e.skippedFeatureUids&&!s)){return r.call(n,t,s?i:null)}}var f=h.projection;var c=t;if(f.canWrapX()){var d=f.getExtent();var p=pa.getWidth(d);var v=t[0];if(v<d[0]||v>d[2]){var _=Math.ceil((d[0]-v)/p);c=[v+p*_,t[1]]}}var g=e.layerStatesArray;var m=g.length;var y;for(y=m-1;y>=0;--y){var E=g[y];var x=E.layer;if(Fs.visibleAtResolution(E,l)&&a.call(s,x)){var T=this.getLayerRenderer(x);if(x.getSource()){o=T.forEachFeatureAtCoordinate(x.getSource().getWrapX()?c:t,e,i,u,n)}if(o){return o}}}return undefined};Co.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){};Co.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var a=this.forEachFeatureAtCoordinate(t,e,i,_a.TRUE,this,r,n);return a!==undefined};Co.prototype.getLayerRenderer=function(t){var e=qn.getUid(t).toString();if(e in this.layerRenderers_){return this.layerRenderers_[e]}else{var i=Ls.getLayerRendererPlugins();var r;var n=this.getType();for(var a=0,s=i.length;a<s;++a){var o=i[a];if(o["handles"](n,t)){r=o["create"](this,t);break}}if(r){this.layerRenderers_[e]=r;this.layerRendererListeners_[e]=$n.listen(r,ra.CHANGE,this.handleLayerRendererChange_,this)}else{throw new Error("Unable to create renderer for layer: "+t.getType())}return r}};Co.prototype.getLayerRendererByKey=function(t){return this.layerRenderers_[t]};Co.prototype.getLayerRenderers=function(){return this.layerRenderers_};Co.prototype.getMap=function(){return this.map_};Co.prototype.getType=function(){};Co.prototype.handleLayerRendererChange_=function(){this.map_.render()};Co.prototype.removeLayerRendererByKey_=function(t){var e=this.layerRenderers_[t];delete this.layerRenderers_[t];$n.unlistenByKey(this.layerRendererListeners_[t]);delete this.layerRendererListeners_[t];return e};Co.prototype.renderFrame=qn.nullFunction;Co.prototype.removeUnusedLayerRenderers_=function(t,e){var i;for(i in this.layerRenderers_){if(!e||!(i in e.layerStates)){this.removeLayerRendererByKey_(i).dispose()}}};Co.prototype.scheduleExpireIconCache=function(t){t.postRenderFunctions.push(Co.expireIconCache_)};Co.prototype.scheduleRemoveUnusedLayerRenderers=function(t){var e;for(e in this.layerRenderers_){if(!(e in t.layerStates)){t.postRenderFunctions.push(this.removeUnusedLayerRenderers_.bind(this));return}}};Co.sortByZIndex=function(t,e){return t.zIndex-e.zIndex};var Ro=function(t,e){Co.call(this,t,e);this.context_=Ts.createCanvasContext2D();this.canvas_=this.context_.canvas;this.canvas_.style.width="100%";this.canvas_.style.height="100%";this.canvas_.style.display="block";this.canvas_.className=Ps.CLASS_UNSELECTABLE;t.insertBefore(this.canvas_,t.childNodes[0]||null);this.renderedVisible_=true;this.transform_=Sa.create()};qn.inherits(Ro,Co);Ro["handles"]=function(t){return t===As.CANVAS};Ro["create"]=function(t,e){return new Ro(t,e)};Ro.prototype.dispatchComposeEvent_=function(t,e){var i=this.getMap();var r=this.context_;if(i.hasListener(t)){var n=e.extent;var a=e.pixelRatio;var s=e.viewState;var o=s.rotation;var h=this.getTransform(e);var l=new _o(r,a,n,h,o);var u=new lo(t,l,e,r,null);i.dispatchEvent(u)}};Ro.prototype.getTransform=function(t){var e=t.viewState;var i=this.canvas_.width/2;var r=this.canvas_.height/2;var n=t.pixelRatio/e.resolution;var a=-n;var s=-e.rotation;var o=-e.center[0];var h=-e.center[1];return Sa.compose(this.transform_,i,r,n,a,s,o,h)};Ro.prototype.getType=function(){return As.CANVAS};Ro.prototype.renderFrame=function(t){if(!t){if(this.renderedVisible_){this.canvas_.style.display="none";this.renderedVisible_=false}return}var e=this.context_;var i=t.pixelRatio;var r=Math.round(t.size[0]*i);var n=Math.round(t.size[1]*i);if(this.canvas_.width!=r||this.canvas_.height!=n){this.canvas_.width=r;this.canvas_.height=n}else{e.clearRect(0,0,r,n)}var a=t.viewState.rotation;this.calculateMatrices2D(t);this.dispatchComposeEvent_(Ds.PRECOMPOSE,t);var s=t.layerStatesArray;fa.stableSort(s,Co.sortByZIndex);if(a){e.save();fo.rotateAtOffset(e,a,r/2,n/2)}var o=t.viewState.resolution;var h,l,u,f,c;for(h=0,l=s.length;h<l;++h){c=s[h];u=c.layer;f=this.getLayerRenderer(u);if(!Fs.visibleAtResolution(c,o)||c.sourceState!=Ms.READY){continue}if(f.prepareFrame(t,c)){f.composeFrame(t,c,e)}}if(a){e.restore()}this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t);if(!this.renderedVisible_){this.canvas_.style.display="";this.renderedVisible_=true}this.scheduleRemoveUnusedLayerRenderers(t);this.scheduleExpireIconCache(t)};Ro.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){var s;var o=e.viewState;var h=o.resolution;var l=e.layerStatesArray;var u=l.length;var f=Sa.apply(e.pixelToCoordinateTransform,t.slice());var c;for(c=u-1;c>=0;--c){var d=l[c];var p=d.layer;if(Fs.visibleAtResolution(d,h)&&n.call(a,p)){var v=this.getLayerRenderer(p);s=v.forEachLayerAtCoordinate(f,e,i,r);if(s){return s}}}return undefined};var Mo=function(t,e,i,r){this.minX=t;this.maxX=e;this.minY=i;this.maxY=r};Mo.createOrUpdate=function(t,e,i,r,n){if(n!==undefined){n.minX=t;n.maxX=e;n.minY=i;n.maxY=r;return n}else{return new Mo(t,e,i,r)}};Mo.prototype.contains=function(t){return this.containsXY(t[1],t[2])};Mo.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY};Mo.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY};Mo.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY};Mo.prototype.extend=function(t){if(t.minX<this.minX){this.minX=t.minX}if(t.maxX>this.maxX){this.maxX=t.maxX}if(t.minY<this.minY){this.minY=t.minY}if(t.maxY>this.maxY){this.maxY=t.maxY}};Mo.prototype.getHeight=function(){return this.maxY-this.minY+1};Mo.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]};Mo.prototype.getWidth=function(){return this.maxX-this.minX+1};Mo.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var So=function(t){yo.call(this,t);this.context=this.context===null?null:Ts.createCanvasContext2D();this.renderedExtent_=null;this.renderedTiles=[];this.tmpExtent=pa.createEmpty();this.tmpTileRange_=new Mo(0,0,0,0);this.imageTransform_=Sa.create();this.zDirection=0};qn.inherits(So,yo);So["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.TILE};So["create"]=function(t,e){return new So(e)};So.prototype.isDrawableTile_=function(t){var e=t.getState();var i=this.getLayer().getUseInterimTilesOnError();return e==us.LOADED||e==us.EMPTY||e==us.ERROR&&!i};So.prototype.prepareFrame=function(t,e){var i=t.pixelRatio;var r=t.size;var n=t.viewState;var a=n.projection;var s=n.resolution;var o=n.center;var h=this.getLayer();var l=h.getSource();var u=l.getRevision();var f=l.getTileGridForProjection(a);var c=f.getZForResolution(s,this.zDirection);var d=f.getResolution(c);var p=Math.round(s/d)||1;var v=t.extent;if(e.extent!==undefined){v=pa.getIntersection(v,e.extent)}if(pa.isEmpty(v)){return false}var _=f.getTileRangeForExtentAndZ(v,c);var g=f.getTileRangeExtent(c,_);var m=l.getTilePixelRatio(i);var y={};y[c]={};var E=this.createLoadedTileFinder(l,a,y);var x=this.tmpExtent;var T=this.tmpTileRange_;var C=false;var R,M,S;for(M=_.minX;M<=_.maxX;++M){for(S=_.minY;S<=_.maxY;++S){R=l.getTile(c,M,S,i,a);if(R.getState()==us.ERROR){if(!h.getUseInterimTilesOnError()){R.setState(us.LOADED)}else if(h.getPreload()>0){C=true}}if(!this.isDrawableTile_(R)){R=R.getInterimTile()}if(this.isDrawableTile_(R)){var I=qn.getUid(this);if(R.getState()==us.LOADED){y[c][R.tileCoord.toString()]=R;var L=R.inTransition(I);if(!C&&(L||this.renderedTiles.indexOf(R)===-1)){C=true}}if(R.getAlpha(I,t.time)===1){continue}}var A=f.getTileCoordChildTileRange(R.tileCoord,T,x);var w=false;if(A){w=E(c+1,A)}if(!w){f.forEachTileCoordParentTileRange(R.tileCoord,E,null,T,x)}}}var O=d*i/m*p;var b=t.viewHints;var P=b[_s.ANIMATING]||b[_s.INTERACTING];if(!(this.renderedResolution&&Date.now()-t.time>16&&P)&&(C||!(this.renderedExtent_&&pa.containsExtent(this.renderedExtent_,v))||this.renderedRevision!=u||p!=this.oversampling_||!P&&O!=this.renderedResolution)){var D=this.context;if(D){var F=l.getTilePixelSize(c,i,a);var N=Math.round(_.getWidth()*F[0]/p);var G=Math.round(_.getHeight()*F[1]/p);var k=D.canvas;if(k.width!=N||k.height!=G){this.oversampling_=p;k.width=N;k.height=G}else{if(this.renderedExtent_&&!pa.equals(g,this.renderedExtent_)){D.clearRect(0,0,N,G)}p=this.oversampling_}}this.renderedTiles.length=0;var U=Object.keys(y).map(Number);U.sort((function(t,e){if(t===c){return 1}else if(e===c){return-1}else{return t>e?1:t<e?-1:0}}));var z,B,W,X,V,Y;var j,H,K,q,Z;for(V=0,Y=U.length;V<Y;++V){X=U[V];W=l.getTilePixelSize(X,i,a);z=f.getResolution(X);B=z/d;H=m*l.getGutter(a);K=y[X];for(var J in K){R=K[J];j=f.getTileCoordExtent(R.getTileCoord(),x);M=(j[0]-g[0])/d*m/p;S=(g[3]-j[3])/d*m/p;q=W[0]*B/p;Z=W[1]*B/p;this.drawTileImage(R,t,e,M,S,q,Z,H,c===X);this.renderedTiles.push(R)}}this.renderedRevision=u;this.renderedResolution=d*i/m*p;this.renderedExtent_=g}var Q=this.renderedResolution/s;var $=Sa.compose(this.imageTransform_,i*r[0]/2,i*r[1]/2,Q,Q,0,(this.renderedExtent_[0]-o[0])/this.renderedResolution*i,(o[1]-this.renderedExtent_[3])/this.renderedResolution*i);Sa.compose(this.coordinateToCanvasPixelTransform,i*r[0]/2-$[4],i*r[1]/2-$[5],i/s,-i/s,0,-o[0],-o[1]);this.updateUsedTiles(t.usedTiles,l,c,_);this.manageTilePyramid(t,l,f,i,a,v,c,h.getPreload());this.scheduleExpireCache(t,l);this.updateLogos(t,l);return this.renderedTiles.length>0};So.prototype.drawTileImage=function(t,e,i,r,n,a,s,o,h){var l=t.getImage(this.getLayer());if(!l){return}var u=qn.getUid(this);var f=h?t.getAlpha(u,e.time):1;if(f===1&&!this.getLayer().getSource().getOpaque(e.viewState.projection)){this.context.clearRect(r,n,a,s)}var c=f!==this.context.globalAlpha;if(c){this.context.save();this.context.globalAlpha=f}this.context.drawImage(l,o,o,l.width-2*o,l.height-2*o,r,n,a,s);if(c){this.context.restore()}if(f!==1){e.animate=true}else if(h){t.endTransition(u)}};So.prototype.getImage=function(){var t=this.context;return t?t.canvas:null};So.prototype.getImageTransform=function(){return this.imageTransform_};var Io=o((function(t,e){(function(e,i){t.exports=i()})(h,(function(){function t(t,i,n,a,s){e(t,i,n||0,a||t.length-1,s||r)}function e(t,r,n,a,s){while(a>n){if(a-n>600){var o=a-n+1;var h=r-n+1;var l=Math.log(o);var u=.5*Math.exp(2*l/3);var f=.5*Math.sqrt(l*u*(o-u)/o)*(h-o/2<0?-1:1);var c=Math.max(n,Math.floor(r-h*u/o+f));var d=Math.min(a,Math.floor(r+(o-h)*u/o+f));e(t,r,c,d,s)}var p=t[r];var v=n;var _=a;i(t,n,r);if(s(t[a],p)>0)i(t,n,a);while(v<_){i(t,v,_);v++;_--;while(s(t[v],p)<0)v++;while(s(t[_],p)>0)_--}if(s(t[n],p)===0)i(t,n,_);else{_++;i(t,_,a)}if(_<=r)n=_+1;if(r<=_)a=_-1}}function i(t,e,i){var r=t[e];t[e]=t[i];t[i]=r}function r(t,e){return t<e?-1:t>e?1:0}return t}))}));var Lo=Ao;function Ao(t,e){if(!(this instanceof Ao))return new Ao(t,e);this._maxEntries=Math.max(4,t||9);this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4));if(e){this._initFormat(e)}this.clear()}Ao.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!Bo(t,e))return i;var n=[],a,s,o,h;while(e){for(a=0,s=e.children.length;a<s;a++){o=e.children[a];h=e.leaf?r(o):o;if(Bo(t,h)){if(e.leaf)i.push(o);else if(zo(t,h))this._all(o,i);else n.push(o)}}e=n.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!Bo(t,e))return false;var r=[],n,a,s,o;while(e){for(n=0,a=e.children.length;n<a;n++){s=e.children[n];o=e.leaf?i(s):s;if(Bo(t,o)){if(e.leaf||zo(t,o))return true;r.push(s)}}e=r.pop()}return false},load:function(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(var e=0,i=t.length;e<i;e++){this.insert(t[e])}return this}var r=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length){this.data=r}else if(this.data.height===r.height){this._splitRoot(this.data,r)}else{if(this.data.height<r.height){var n=this.data;this.data=r;r=n}this._insert(r,this.data.height-r.height-1,true)}return this},insert:function(t){if(t)this._insert(t,this.data.height-1);return this},clear:function(){this.data=Wo([]);return this},remove:function(t,e){if(!t)return this;var i=this.data,r=this.toBBox(t),n=[],a=[],s,o,h,l;while(i||n.length){if(!i){i=n.pop();o=n[n.length-1];s=a.pop();l=true}if(i.leaf){h=wo(t,i.children,e);if(h!==-1){i.children.splice(h,1);n.push(i);this._condense(n);return this}}if(!l&&!i.leaf&&zo(i,r)){n.push(i);a.push(s);s=0;o=i;i=i.children[0]}else if(o){s++;i=o.children[s];l=false}else i=null}return this},toBBox:function(t){return t},compareMinX:Do,compareMinY:Fo,toJSON:function(){return this.data},fromJSON:function(t){this.data=t;return this},_all:function(t,e){var i=[];while(t){if(t.leaf)e.push.apply(e,t.children);else i.push.apply(i,t.children);t=i.pop()}return e},_build:function(t,e,i,r){var n=i-e+1,a=this._maxEntries,s;if(n<=a){s=Wo(t.slice(e,i+1));Oo(s,this.toBBox);return s}if(!r){r=Math.ceil(Math.log(n)/Math.log(a));a=Math.ceil(n/Math.pow(a,r-1))}s=Wo([]);s.leaf=false;s.height=r;var o=Math.ceil(n/a),h=o*Math.ceil(Math.sqrt(a)),l,u,f,c;Xo(t,e,i,h,this.compareMinX);for(l=e;l<=i;l+=h){f=Math.min(l+h-1,i);Xo(t,l,f,o,this.compareMinY);for(u=l;u<=f;u+=o){c=Math.min(u+o-1,f);s.children.push(this._build(t,u,c,r-1))}}Oo(s,this.toBBox);return s},_chooseSubtree:function(t,e,i,r){var n,a,s,o,h,l,u,f;while(true){r.push(e);if(e.leaf||r.length-1===i)break;u=f=Infinity;for(n=0,a=e.children.length;n<a;n++){s=e.children[n];h=No(s);l=ko(t,s)-h;if(l<f){f=l;u=h<u?h:u;o=s}else if(l===f){if(h<u){u=h;o=s}}}e=o||e.children[0]}return e},_insert:function(t,e,i){var r=this.toBBox,n=i?t:r(t),a=[];var s=this._chooseSubtree(n,this.data,e,a);s.children.push(t);Po(s,n);while(e>=0){if(a[e].children.length>this._maxEntries){this._split(a,e);e--}else break}this._adjustParentBBoxes(n,a,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var a=this._chooseSplitIndex(i,n,r);var s=Wo(i.children.splice(a,i.children.length-a));s.height=i.height;s.leaf=i.leaf;Oo(i,this.toBBox);Oo(s,this.toBBox);if(e)t[e-1].children.push(s);else this._splitRoot(i,s)},_splitRoot:function(t,e){this.data=Wo([t,e]);this.data.height=t.height+1;this.data.leaf=false;Oo(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,a,s,o,h,l,u;h=l=Infinity;for(r=e;r<=i-e;r++){n=bo(t,0,r,this.toBBox);a=bo(t,r,i,this.toBBox);s=Uo(n,a);o=No(n)+No(a);if(s<h){h=s;u=r;l=o<l?o:l}else if(s===h){if(o<l){l=o;u=r}}}return u},_chooseSplitAxis:function(t,e,i){var r=t.leaf?this.compareMinX:Do,n=t.leaf?this.compareMinY:Fo,a=this._allDistMargin(t,e,i,r),s=this._allDistMargin(t,e,i,n);if(a<s)t.children.sort(r)},_allDistMargin:function(t,e,i,r){t.children.sort(r);var n=this.toBBox,a=bo(t,0,e,n),s=bo(t,i-e,i,n),o=Go(a)+Go(s),h,l;for(h=e;h<i-e;h++){l=t.children[h];Po(a,t.leaf?n(l):l);o+=Go(a)}for(h=i-e-1;h>=e;h--){l=t.children[h];Po(s,t.leaf?n(l):l);o+=Go(s)}return o},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--){Po(e[r],t)}},_condense:function(t){for(var e=t.length-1,i;e>=0;e--){if(t[e].children.length===0){if(e>0){i=t[e-1].children;i.splice(i.indexOf(t[e]),1)}else this.clear()}else Oo(t[e],this.toBBox)}},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0]));this.compareMinY=new Function("a","b",e.join(t[1]));this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};function wo(t,e,i){if(!i)return e.indexOf(t);for(var r=0;r<e.length;r++){if(i(t,e[r]))return r}return-1}function Oo(t,e){bo(t,0,t.children.length,e,t)}function bo(t,e,i,r,n){if(!n)n=Wo(null);n.minX=Infinity;n.minY=Infinity;n.maxX=-Infinity;n.maxY=-Infinity;for(var a=e,s;a<i;a++){s=t.children[a];Po(n,t.leaf?r(s):s)}return n}function Po(t,e){t.minX=Math.min(t.minX,e.minX);t.minY=Math.min(t.minY,e.minY);t.maxX=Math.max(t.maxX,e.maxX);t.maxY=Math.max(t.maxY,e.maxY);return t}function Do(t,e){return t.minX-e.minX}function Fo(t,e){return t.minY-e.minY}function No(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Go(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ko(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function Uo(t,e){var i=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),a=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,a-r)}function zo(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Bo(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Wo(t){return{children:t,height:1,leaf:true,minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity}}function Xo(t,e,i,r,n){var a=[e,i],s;while(a.length){i=a.pop();e=a.pop();if(i-e<=r)continue;s=e+Math.ceil((i-e)/r/2)*r;Io(t,s,e,i,n);a.push(e,s,s,i)}}var Vo=function(){};Vo.prototype.getReplay=function(t,e){};Vo.prototype.isEmpty=function(){};var Yo={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};var jo={};jo.lineString=function(t,e,i,r){var n=t[e];var a=t[e+1];var s=0;var o;for(o=e+r;o<i;o+=r){var h=t[o];var l=t[o+1];s+=Math.sqrt((h-n)*(h-n)+(l-a)*(l-a));n=h;a=l}return s};jo.linearRing=function(t,e,i,r){var n=jo.lineString(t,e,i,r);var a=t[i-r]-t[e];var s=t[i-r+1]-t[e+1];n+=Math.sqrt(a*a+s*s);return n};var Ho={};Ho.lineString=function(t,e,i,r,n,a,s,o){var h=[];var l=t[e]>t[i-r];var u=n.length;var f=t[e];var c=t[e+1];e+=r;var d=t[e];var p=t[e+1];var v=0;var _=Math.sqrt(Math.pow(d-f,2)+Math.pow(p-c,2));var g="";var m=0;var y,E,x;for(var T=0;T<u;++T){E=l?u-T-1:T;var C=n.charAt(E);g=l?C+g:g+C;var R=a(g)-m;m+=R;var M=s+R/2;while(e<i-r&&v+_<M){f=d;c=p;e+=r;d=t[e];p=t[e+1];v+=_;_=Math.sqrt(Math.pow(d-f,2)+Math.pow(p-c,2))}var S=M-v;var I=Math.atan2(p-c,d-f);if(l){I+=I>0?-Math.PI:Math.PI}if(x!==undefined){var L=I-x;L+=L>Math.PI?-2*Math.PI:L<-Math.PI?2*Math.PI:0;if(Math.abs(L)>o){return null}}var A=S/_;var w=ha.lerp(f,d,A);var O=ha.lerp(c,p,A);if(x==I){if(l){y[0]=w;y[1]=O;y[2]=R/2}y[4]=g}else{g=C;m=R;y=[w,O,R/2,I,g];if(l){h.unshift(y)}else{h.push(y)}x=I}s+=R}return h};var Ko={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12};var qo={};qo.ORDER=[Yo.POLYGON,Yo.CIRCLE,Yo.LINE_STRING,Yo.IMAGE,Yo.TEXT,Yo.DEFAULT];qo.TEXT_ALIGN={};qo.TEXT_ALIGN["left"]=0;qo.TEXT_ALIGN["end"]=0;qo.TEXT_ALIGN["center"]=.5;qo.TEXT_ALIGN["right"]=1;qo.TEXT_ALIGN["start"]=1;qo.TEXT_ALIGN["top"]=0;qo.TEXT_ALIGN["middle"]=.5;qo.TEXT_ALIGN["hanging"]=.2;qo.TEXT_ALIGN["alphabetic"]=.8;qo.TEXT_ALIGN["ideographic"]=.8;qo.TEXT_ALIGN["bottom"]=1;var Zo=function(t,e,i,r,n,a){vo.call(this);this.declutterTree=a;this.tmpExtent_=pa.createEmpty();this.tolerance=t;this.maxExtent=e;this.overlaps=n;this.pixelRatio=r;this.maxLineWidth=0;this.resolution=i;this.beginGeometryInstruction1_=null;this.beginGeometryInstruction2_=null;this.bufferedMaxExtent_=null;this.instructions=[];this.coordinates=[];this.coordinateCache_={};this.renderedTransform_=Sa.create();this.hitDetectionInstructions=[];this.pixelCoordinates_=null;this.state={};this.viewRotation_=0;this.tmpLocalTransform_=Sa.create();this.resetTransform_=Sa.create()};qn.inherits(Zo,vo);Zo.prototype.replayTextBackground_=function(t,e,i,r,n,a,s){t.beginPath();t.moveTo.apply(t,e);t.lineTo.apply(t,i);t.lineTo.apply(t,r);t.lineTo.apply(t,n);t.lineTo.apply(t,e);if(a){this.fillOrigin_=a[2];this.fill_(t)}if(s){this.setStrokeStyle_(t,s);t.stroke()}};Zo.prototype.replayImage_=function(t,e,i,r,n,a,s,o,h,l,u,f,c,d,p,v,_,g){var m=_||g;var y=this.tmpLocalTransform_;n*=c;a*=c;e-=n;i-=a;if(d){e=Math.round(e);i=Math.round(i)}var E=p+l>r.width?r.width-l:p;var x=o+u>r.height?r.height-u:o;var T=this.tmpExtent_;var C=v[3]+E*c+v[1];var R=v[0]+x*c+v[2];var M=e-v[3];var S=i-v[0];var I;var L;var A;var w;if(m||f!==0){I=[M,S];L=[M+C,S];A=[M+C,S+R];w=[M,S+R]}var O=null;if(f!==0){var b=e+n;var P=i+a;O=Sa.compose(y,b,P,1,1,f,-b,-P);pa.createOrUpdateEmpty(T);pa.extendCoordinate(T,Sa.apply(y,I));pa.extendCoordinate(T,Sa.apply(y,L));pa.extendCoordinate(T,Sa.apply(y,A));pa.extendCoordinate(T,Sa.apply(y,w))}else{pa.createOrUpdate(M,S,M+C,S+R,T)}var D=t.canvas;var F=T[0]<=D.width&&T[2]>=0&&T[1]<=D.height&&T[3]>=0;if(s){if(!F&&s[4]==1){return}pa.extend(s,T);var N=F?[t,O?O.slice(0):null,h,r,l,u,E,x,e,i,c]:null;if(N&&m){N.push(_,g,I,L,A,w)}s.push(N)}else if(F){if(m){this.replayTextBackground_(t,I,L,A,w,_,g)}fo.drawImage(t,O,h,r,l,u,E,x,e,i,c)}};Zo.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return e==1?t:t.map((function(t){return t*e}))};Zo.prototype.appendFlatCoordinates=function(t,e,i,r,n,a){var s=this.coordinates.length;var o=this.getBufferedMaxExtent();if(a){e+=r}var h=[t[e],t[e+1]];var l=[NaN,NaN];var u=true;var f,c,d;for(f=e+r;f<i;f+=r){l[0]=t[f];l[1]=t[f+1];d=pa.coordinateRelationship(o,l);if(d!==c){if(u){this.coordinates[s++]=h[0];this.coordinates[s++]=h[1]}this.coordinates[s++]=l[0];this.coordinates[s++]=l[1];u=false}else if(d===da.INTERSECTING){this.coordinates[s++]=l[0];this.coordinates[s++]=l[1];u=false}else{u=true}h[0]=l[0];h[1]=l[1];c=d}if(n&&u||f===e+r){this.coordinates[s++]=h[0];this.coordinates[s++]=h[1]}return s};Zo.prototype.drawCustomCoordinates_=function(t,e,i,r,n){for(var a=0,s=i.length;a<s;++a){var o=i[a];var h=this.appendFlatCoordinates(t,e,o,r,false,false);n.push(h);e=o}return e};Zo.prototype.drawCustom=function(t,e,i){this.beginGeometry(t,e);var r=t.getType();var n=t.getStride();var a=this.coordinates.length;var s,o,h,l;var u;if(r==la.MULTI_POLYGON){t=t;s=t.getOrientedFlatCoordinates();l=[];var f=t.getEndss();u=0;for(var c=0,d=f.length;c<d;++c){var p=[];u=this.drawCustomCoordinates_(s,u,f[c],n,p);l.push(p)}this.instructions.push([Ko.CUSTOM,a,l,t,i,ba.coordinatesss])}else if(r==la.POLYGON||r==la.MULTI_LINE_STRING){h=[];s=r==la.POLYGON?t.getOrientedFlatCoordinates():t.getFlatCoordinates();u=this.drawCustomCoordinates_(s,0,t.getEnds(),n,h);this.instructions.push([Ko.CUSTOM,a,h,t,i,ba.coordinatess])}else if(r==la.LINE_STRING||r==la.MULTI_POINT){s=t.getFlatCoordinates();o=this.appendFlatCoordinates(s,0,s.length,n,false,false);this.instructions.push([Ko.CUSTOM,a,o,t,i,ba.coordinates])}else if(r==la.POINT){s=t.getFlatCoordinates();this.coordinates.push(s[0],s[1]);o=this.coordinates.length;this.instructions.push([Ko.CUSTOM,a,o,t,i])}this.endGeometry(t,e)};Zo.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Ko.BEGIN_GEOMETRY,e,0];this.instructions.push(this.beginGeometryInstruction1_);this.beginGeometryInstruction2_=[Ko.BEGIN_GEOMETRY,e,0];this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)};Zo.prototype.fill_=function(t){if(this.fillOrigin_){var e=Sa.apply(this.renderedTransform_,this.fillOrigin_.slice());t.translate(e[0],e[1]);t.rotate(this.viewRotation_)}t.fill();if(this.fillOrigin_){t.setTransform.apply(t,fo.resetTransform_)}};Zo.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1];t.lineWidth=e[2];t.lineCap=e[3];t.lineJoin=e[4];t.miterLimit=e[5];if(Va.CANVAS_LINE_DASH){t.lineDashOffset=e[7];t.setLineDash(e[6])}};Zo.prototype.renderDeclutter_=function(t,e){if(t&&t.length>5){var i=t[4];if(i==1||i==t.length-5){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(!this.declutterTree.collides(r)){this.declutterTree.insert(r);var n=fo.drawImage;for(var a=5,s=t.length;a<s;++a){var o=t[a];if(o){if(o.length>11){this.replayTextBackground_(o[0],o[13],o[14],o[15],o[16],o[11],o[12])}n.apply(undefined,o)}}}t.length=5;pa.createOrUpdateEmpty(t)}}};Zo.prototype.replay_=function(t,e,i,r,n,a){var s;if(this.pixelCoordinates_&&fa.equals(e,this.renderedTransform_)){s=this.pixelCoordinates_}else{if(!this.pixelCoordinates_){this.pixelCoordinates_=[]}s=ga.transform2D(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_);Sa.setFromArray(this.renderedTransform_,e)}var o=!Qn.isEmpty(i);var h=0;var l=r.length;var u=0;var f;var c,d,p,v,_,g,m,y;var E=0;var x=0;var T=null;var C=null;var R=this.coordinateCache_;var M=this.viewRotation_;var S={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M};var I=this.instructions!=r||this.overlaps?0:200;while(h<l){var L=r[h];var A=L[0];var w,O,b;switch(A){case Ko.BEGIN_GEOMETRY:w=L[1];if(o&&i[qn.getUid(w).toString()]||!w.getGeometry()){h=L[2]}else if(a!==undefined&&!pa.intersects(a,w.getGeometry().getExtent())){h=L[2]+1}else{++h}break;case Ko.BEGIN_PATH:if(E>I){this.fill_(t);E=0}if(x>I){t.stroke();x=0}if(!E&&!x){t.beginPath();p=v=NaN}++h;break;case Ko.CIRCLE:u=L[1];var P=s[u];var D=s[u+1];var F=s[u+2];var N=s[u+3];var G=F-P;var k=N-D;var U=Math.sqrt(G*G+k*k);t.moveTo(P+U,D);t.arc(P,D,U,0,2*Math.PI,true);++h;break;case Ko.CLOSE_PATH:t.closePath();++h;break;case Ko.CUSTOM:u=L[1];f=L[2];var z=L[3];var B=L[4];var W=L.length==6?L[5]:undefined;S.geometry=z;S.feature=w;if(!(h in R)){R[h]=[]}var X=R[h];if(W){W(s,u,f,2,X)}else{X[0]=s[u];X[1]=s[u+1];X.length=2}B(X,S);++h;break;case Ko.DRAW_IMAGE:u=L[1];f=L[2];y=L[3];c=L[4];d=L[5];m=n?null:L[6];var V=L[7];var Y=L[8];var j=L[9];var H=L[10];var K=L[11];var q=L[12];var Z=L[13];var J=L[14];var Q=L[15];var $,tt,et;if(L.length>16){$=L[16];tt=L[17];et=L[18]}else{$=fo.defaultPadding;tt=et=false}if(K){q+=M}for(;u<f;u+=2){this.replayImage_(t,s[u],s[u+1],y,c,d,m,V,Y,j,H,q,Z,J,Q,$,tt?T:null,et?C:null)}this.renderDeclutter_(m,w);++h;break;case Ko.DRAW_CHARS:var it=L[1];var rt=L[2];var nt=L[3];m=n?null:L[4];var at=L[5];var st=L[6];var ot=L[7];var ht=L[8];var lt=L[9];var ut=L[10];var ft=L[11];var ct=L[12];var dt=L[13];var pt=L[14];var vt=jo.lineString(s,it,rt,2);var _t=ht(ct);if(at||_t<=vt){var gt=this.textStates[dt].textAlign;var mt=(vt-_t)*qo.TEXT_ALIGN[gt];var yt=Ho.lineString(s,it,rt,2,ct,ht,mt,ot);if(yt){var Et,xt,Tt,Ct,Rt;if(ut){for(Et=0,xt=yt.length;Et<xt;++Et){Rt=yt[Et];Tt=Rt[4];Ct=this.getImage(Tt,dt,"",ut);c=Rt[2]+ft;d=nt*Ct.height+(.5-nt)*2*ft-lt;this.replayImage_(t,Rt[0],Rt[1],Ct,c,d,m,Ct.height,1,0,0,Rt[3],pt,false,Ct.width,fo.defaultPadding,null,null)}}if(st){for(Et=0,xt=yt.length;Et<xt;++Et){Rt=yt[Et];Tt=Rt[4];Ct=this.getImage(Tt,dt,st,"");c=Rt[2];d=nt*Ct.height-lt;this.replayImage_(t,Rt[0],Rt[1],Ct,c,d,m,Ct.height,1,0,0,Rt[3],pt,false,Ct.width,fo.defaultPadding,null,null)}}}}this.renderDeclutter_(m,w);++h;break;case Ko.END_GEOMETRY:if(n!==undefined){w=L[1];var Mt=n(w);if(Mt){return Mt}}++h;break;case Ko.FILL:if(I){E++}else{this.fill_(t)}++h;break;case Ko.MOVE_TO_LINE_TO:u=L[1];f=L[2];O=s[u];b=s[u+1];_=O+.5|0;g=b+.5|0;if(_!==p||g!==v){t.moveTo(O,b);p=_;v=g}for(u+=2;u<f;u+=2){O=s[u];b=s[u+1];_=O+.5|0;g=b+.5|0;if(u==f-2||_!==p||g!==v){t.lineTo(O,b);p=_;v=g}}++h;break;case Ko.SET_FILL_STYLE:T=L;this.fillOrigin_=L[2];if(E){this.fill_(t);E=0;if(x){t.stroke();x=0}}t.fillStyle=L[1];++h;break;case Ko.SET_STROKE_STYLE:C=L;if(x){t.stroke();x=0}this.setStrokeStyle_(t,L);++h;break;case Ko.STROKE:if(I){x++}else{t.stroke()}++h;break;default:++h;break}}if(E){this.fill_(t)}if(x){t.stroke()}return undefined};Zo.prototype.replay=function(t,e,i,r){this.viewRotation_=i;this.replay_(t,e,r,this.instructions,undefined,undefined)};Zo.prototype.replayHitDetection=function(t,e,i,r,n,a){this.viewRotation_=i;return this.replay_(t,e,r,this.hitDetectionInstructions,n,a)};Zo.prototype.reverseHitDetectionInstructions=function(){var t=this.hitDetectionInstructions;t.reverse();var e;var i=t.length;var r;var n;var a=-1;for(e=0;e<i;++e){r=t[e];n=r[0];if(n==Ko.END_GEOMETRY){a=e}else if(n==Ko.BEGIN_GEOMETRY){r[2]=e;fa.reverseSubArray(this.hitDetectionInstructions,a,e);a=-1}}};Zo.prototype.setFillStrokeStyle=function(t,e){var i=this.state;if(t){var r=t.getColor();i.fillStyle=po.asColorLike(r?r:fo.defaultFillStyle)}else{i.fillStyle=undefined}if(e){var n=e.getColor();i.strokeStyle=po.asColorLike(n?n:fo.defaultStrokeStyle);var a=e.getLineCap();i.lineCap=a!==undefined?a:fo.defaultLineCap;var s=e.getLineDash();i.lineDash=s?s.slice():fo.defaultLineDash;var o=e.getLineDashOffset();i.lineDashOffset=o?o:fo.defaultLineDashOffset;var h=e.getLineJoin();i.lineJoin=h!==undefined?h:fo.defaultLineJoin;var l=e.getWidth();i.lineWidth=l!==undefined?l:fo.defaultLineWidth;var u=e.getMiterLimit();i.miterLimit=u!==undefined?u:fo.defaultMiterLimit;if(i.lineWidth>this.maxLineWidth){this.maxLineWidth=i.lineWidth;this.bufferedMaxExtent_=null}}else{i.strokeStyle=undefined;i.lineCap=undefined;i.lineDash=null;i.lineDashOffset=undefined;i.lineJoin=undefined;i.lineWidth=undefined;i.miterLimit=undefined}};Zo.prototype.applyFill=function(t,e){var i=t.fillStyle;var r=[Ko.SET_FILL_STYLE,i];if(typeof i!=="string"){var n=e.getExtent();r.push([n[0],n[3]])}this.instructions.push(r)};Zo.prototype.applyStroke=function(t){this.instructions.push([Ko.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio])};Zo.prototype.updateFillStyle=function(t,e,i){var r=t.fillStyle;if(typeof r!=="string"||t.currentFillStyle!=r){e.call(this,t,i);t.currentFillStyle=r}};Zo.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle;var r=t.lineCap;var n=t.lineDash;var a=t.lineDashOffset;var s=t.lineJoin;var o=t.lineWidth;var h=t.miterLimit;if(t.currentStrokeStyle!=i||t.currentLineCap!=r||n!=t.currentLineDash&&!fa.equals(t.currentLineDash,n)||t.currentLineDashOffset!=a||t.currentLineJoin!=s||t.currentLineWidth!=o||t.currentMiterLimit!=h){e.call(this,t);t.currentStrokeStyle=i;t.currentLineCap=r;t.currentLineDash=n;t.currentLineDashOffset=a;t.currentLineJoin=s;t.currentLineWidth=o;t.currentMiterLimit=h}};Zo.prototype.endGeometry=function(t,e){this.beginGeometryInstruction1_[2]=this.instructions.length;this.beginGeometryInstruction1_=null;this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length;this.beginGeometryInstruction2_=null;var i=[Ko.END_GEOMETRY,e];this.instructions.push(i);this.hitDetectionInstructions.push(i)};Zo.prototype.finish=qn.nullFunction;Zo.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_){this.bufferedMaxExtent_=pa.clone(this.maxExtent);if(this.maxLineWidth>0){var t=this.resolution*(this.maxLineWidth+1)/2;pa.buffer(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}}return this.bufferedMaxExtent_};var Jo=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a);this.declutterGroup_=null;this.hitDetectionImage_=null;this.image_=null;this.anchorX_=undefined;this.anchorY_=undefined;this.height_=undefined;this.opacity_=undefined;this.originX_=undefined;this.originY_=undefined;this.rotateWithView_=undefined;this.rotation_=undefined;this.scale_=undefined;this.snapToPixel_=undefined;this.width_=undefined};qn.inherits(Jo,Zo);Jo.prototype.drawCoordinates_=function(t,e,i,r){return this.appendFlatCoordinates(t,e,i,r,false,false)};Jo.prototype.drawPoint=function(t,e){if(!this.image_){return}this.beginGeometry(t,e);var i=t.getFlatCoordinates();var r=t.getStride();var n=this.coordinates.length;var a=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([Ko.DRAW_IMAGE,n,a,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,n,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]);this.endGeometry(t,e)};Jo.prototype.drawMultiPoint=function(t,e){if(!this.image_){return}this.beginGeometry(t,e);var i=t.getFlatCoordinates();var r=t.getStride();var n=this.coordinates.length;var a=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([Ko.DRAW_IMAGE,n,a,this.image_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.snapToPixel_,this.width_]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,n,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.snapToPixel_,this.width_]);this.endGeometry(t,e)};Jo.prototype.finish=function(){this.reverseHitDetectionInstructions();this.anchorX_=undefined;this.anchorY_=undefined;this.hitDetectionImage_=null;this.image_=null;this.height_=undefined;this.scale_=undefined;this.opacity_=undefined;this.originX_=undefined;this.originY_=undefined;this.rotateWithView_=undefined;this.rotation_=undefined;this.snapToPixel_=undefined;this.width_=undefined};Jo.prototype.setImageStyle=function(t,e){var i=t.getAnchor();var r=t.getSize();var n=t.getHitDetectionImage(1);var a=t.getImage(1);var s=t.getOrigin();this.anchorX_=i[0];this.anchorY_=i[1];this.declutterGroup_=e;this.hitDetectionImage_=n;this.image_=a;this.height_=r[1];this.opacity_=t.getOpacity();this.originX_=s[0];this.originY_=s[1];this.rotateWithView_=t.getRotateWithView();this.rotation_=t.getRotation();this.scale_=t.getScale();this.snapToPixel_=t.getSnapToPixel();this.width_=r[0]};var Qo=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a)};qn.inherits(Qo,Zo);Qo.prototype.drawFlatCoordinates_=function(t,e,i,r){var n=this.coordinates.length;var a=this.appendFlatCoordinates(t,e,i,r,false,false);var s=[Ko.MOVE_TO_LINE_TO,n,a];this.instructions.push(s);this.hitDetectionInstructions.push(s);return i};Qo.prototype.drawLineString=function(t,e){var i=this.state;var r=i.strokeStyle;var n=i.lineWidth;if(r===undefined||n===undefined){return}this.updateStrokeStyle(i,this.applyStroke);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],[Ko.BEGIN_PATH]);var a=t.getFlatCoordinates();var s=t.getStride();this.drawFlatCoordinates_(a,0,a.length,s);this.hitDetectionInstructions.push([Ko.STROKE]);this.endGeometry(t,e)};Qo.prototype.drawMultiLineString=function(t,e){var i=this.state;var r=i.strokeStyle;var n=i.lineWidth;if(r===undefined||n===undefined){return}this.updateStrokeStyle(i,this.applyStroke);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],[Ko.BEGIN_PATH]);var a=t.getEnds();var s=t.getFlatCoordinates();var o=t.getStride();var h=0;var l,u;for(l=0,u=a.length;l<u;++l){h=this.drawFlatCoordinates_(s,h,a[l],o)}this.hitDetectionInstructions.push([Ko.STROKE]);this.endGeometry(t,e)};Qo.prototype.finish=function(){var t=this.state;if(t.lastStroke!=undefined&&t.lastStroke!=this.coordinates.length){this.instructions.push([Ko.STROKE])}this.reverseHitDetectionInstructions();this.state=null};Qo.prototype.applyStroke=function(t){if(t.lastStroke!=undefined&&t.lastStroke!=this.coordinates.length){this.instructions.push([Ko.STROKE]);t.lastStroke=this.coordinates.length}t.lastStroke=0;Zo.prototype.applyStroke.call(this,t);this.instructions.push([Ko.BEGIN_PATH])};var $o=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a)};qn.inherits($o,Zo);$o.prototype.drawFlatCoordinatess_=function(t,e,i,r){var n=this.state;var a=n.fillStyle!==undefined;var s=n.strokeStyle!=undefined;var o=i.length;var h=[Ko.BEGIN_PATH];this.instructions.push(h);this.hitDetectionInstructions.push(h);for(var l=0;l<o;++l){var u=i[l];var f=this.coordinates.length;var c=this.appendFlatCoordinates(t,e,u,r,true,!s);var d=[Ko.MOVE_TO_LINE_TO,f,c];this.instructions.push(d);this.hitDetectionInstructions.push(d);if(s){var p=[Ko.CLOSE_PATH];this.instructions.push(p);this.hitDetectionInstructions.push(p)}e=u}var v=[Ko.FILL];this.hitDetectionInstructions.push(v);if(a){this.instructions.push(v)}if(s){var _=[Ko.STROKE];this.instructions.push(_);this.hitDetectionInstructions.push(_)}return e};$o.prototype.drawCircle=function(t,e){var i=this.state;var r=i.fillStyle;var n=i.strokeStyle;if(r===undefined&&n===undefined){return}this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var a=t.getFlatCoordinates();var s=t.getStride();var o=this.coordinates.length;this.appendFlatCoordinates(a,0,a.length,s,false,false);var h=[Ko.BEGIN_PATH];var l=[Ko.CIRCLE,o];this.instructions.push(h,l);this.hitDetectionInstructions.push(h,l);var u=[Ko.FILL];this.hitDetectionInstructions.push(u);if(i.fillStyle!==undefined){this.instructions.push(u)}if(i.strokeStyle!==undefined){var f=[Ko.STROKE];this.instructions.push(f);this.hitDetectionInstructions.push(f)}this.endGeometry(t,e)};$o.prototype.drawPolygon=function(t,e){var i=this.state;this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var r=t.getEnds();var n=t.getOrientedFlatCoordinates();var a=t.getStride();this.drawFlatCoordinatess_(n,0,r,a);this.endGeometry(t,e)};$o.prototype.drawMultiPolygon=function(t,e){var i=this.state;var r=i.fillStyle;var n=i.strokeStyle;if(r===undefined&&n===undefined){return}this.setFillStrokeStyles_(t);this.beginGeometry(t,e);this.hitDetectionInstructions.push([Ko.SET_FILL_STYLE,co.asString(fo.defaultFillStyle)]);if(i.strokeStyle!==undefined){this.hitDetectionInstructions.push([Ko.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset])}var a=t.getEndss();var s=t.getOrientedFlatCoordinates();var o=t.getStride();var h=0;var l,u;for(l=0,u=a.length;l<u;++l){h=this.drawFlatCoordinatess_(s,h,a[l],o)}this.endGeometry(t,e)};$o.prototype.finish=function(){this.reverseHitDetectionInstructions();this.state=null;var t=this.tolerance;if(t!==0){var e=this.coordinates;var i,r;for(i=0,r=e.length;i<r;++i){e[i]=Pa.snap(e[i],t)}}};$o.prototype.setFillStrokeStyles_=function(t){var e=this.state;var i=e.fillStyle;if(i!==undefined){this.updateFillStyle(e,this.applyFill,t)}if(e.strokeStyle!==undefined){this.updateStrokeStyle(e,this.applyStroke)}};var th={};th.lineString=function(t,e,i,r,n){var a=i;var s=i;var o=0;var h=0;var l=i;var u,f,c,d,p,v,_,g,m,y;for(f=i;f<r;f+=n){var E=e[f];var x=e[f+1];if(p!==undefined){m=E-p;y=x-v;d=Math.sqrt(m*m+y*y);if(_!==undefined){h+=c;u=Math.acos((_*m+g*y)/(c*d));if(u>t){if(h>o){o=h;a=l;s=f}h=0;l=f-n}}c=d;_=m;g=y}p=E;v=x}h+=d;return h>o?[l,f]:[a,s]};var eh={POINT:"point",LINE:"line"};var ih=function(t,e,i,r,n,a){Zo.call(this,t,e,i,r,n,a);this.labels_=null;this.text_="";this.textOffsetX_=0;this.textOffsetY_=0;this.textRotateWithView_=undefined;this.textRotation_=0;this.textFillState_=null;this.fillStates={};this.textStrokeState_=null;this.strokeStates={};this.textState_={};this.textStates={};this.textKey_="";this.fillKey_="";this.strokeKey_="";this.widths_={};var s=fo.labelCache;s.prune()};qn.inherits(ih,Zo);ih.measureTextWidths=function(t,e,i){var r=e.length;var n=0;var a,s;for(s=0;s<r;++s){a=fo.measureTextWidth(t,e[s]);n=Math.max(n,a);i.push(a)}return n};ih.prototype.drawText=function(t,e){var i=this.textFillState_;var r=this.textStrokeState_;var n=this.textState_;if(this.text_===""||!n||!i&&!r){return}var a=this.coordinates.length;var s=t.getType();var o=null;var h=2;var l=2;var u,f;if(n.placement===eh.LINE){if(!pa.intersects(this.getBufferedMaxExtent(),t.getExtent())){return}var c;o=t.getFlatCoordinates();l=t.getStride();if(s==la.LINE_STRING){c=[o.length]}else if(s==la.MULTI_LINE_STRING){c=t.getEnds()}else if(s==la.POLYGON){c=t.getEnds().slice(0,1)}else if(s==la.MULTI_POLYGON){var d=t.getEndss();c=[];for(u=0,f=d.length;u<f;++u){c.push(d[u][0])}}this.beginGeometry(t,e);var p=n.textAlign;var v=0;var _;for(var g=0,m=c.length;g<m;++g){if(p==undefined){var y=th.lineString(n.maxAngle,o,v,c[g],l);v=y[0];_=y[1]}else{_=c[g]}for(u=v;u<_;u+=l){this.coordinates.push(o[u],o[u+1])}h=this.coordinates.length;v=c[g];this.drawChars_(a,h,this.declutterGroup_);a=h}this.endGeometry(t,e)}else{var E=this.getImage(this.text_,this.textKey_,this.fillKey_,this.strokeKey_);var x=E.width/this.pixelRatio;switch(s){case la.POINT:case la.MULTI_POINT:o=t.getFlatCoordinates();h=o.length;break;case la.LINE_STRING:o=t.getFlatMidpoint();break;case la.CIRCLE:o=t.getCenter();break;case la.MULTI_LINE_STRING:o=t.getFlatMidpoints();h=o.length;break;case la.POLYGON:o=t.getFlatInteriorPoint();if(!n.overflow&&o[2]/this.resolution<x){return}l=3;break;case la.MULTI_POLYGON:var T=t.getFlatInteriorPoints();o=[];for(u=0,f=T.length;u<f;u+=3){if(n.overflow||T[u+2]/this.resolution>=x){o.push(T[u],T[u+1])}}h=o.length;if(h==0){return}break}h=this.appendFlatCoordinates(o,0,h,l,false,false);this.beginGeometry(t,e);if(n.backgroundFill||n.backgroundStroke){this.setFillStrokeStyle(n.backgroundFill,n.backgroundStroke);this.updateFillStyle(this.state,this.applyFill,t);this.updateStrokeStyle(this.state,this.applyStroke)}this.drawTextImage_(E,a,h);this.endGeometry(t,e)}};ih.prototype.getImage=function(t,e,i,r){var n;var a=r+e+t+i+this.pixelRatio;var s=fo.labelCache;if(!s.containsKey(a)){var o=r?this.strokeStates[r]||this.textStrokeState_:null;var h=i?this.fillStates[i]||this.textFillState_:null;var l=this.textStates[e]||this.textState_;var u=this.pixelRatio;var f=l.scale*u;var c=qo.TEXT_ALIGN[l.textAlign||fo.defaultTextAlign];var d=r&&o.lineWidth?o.lineWidth:0;var p=t.split("\n");var v=p.length;var _=[];var g=ih.measureTextWidths(l.font,p,_);var m=fo.measureTextHeight(l.font);var y=m*v;var E=g+d;var x=Ts.createCanvasContext2D(Math.ceil(E*f),Math.ceil((y+d)*f));n=x.canvas;s.set(a,n);if(f!=1){x.scale(f,f)}x.font=l.font;if(r){x.strokeStyle=o.strokeStyle;x.lineWidth=d*(Va.SAFARI?f:1);x.lineCap=o.lineCap;x.lineJoin=o.lineJoin;x.miterLimit=o.miterLimit;if(Va.CANVAS_LINE_DASH&&o.lineDash.length){x.setLineDash(o.lineDash);x.lineDashOffset=o.lineDashOffset}}if(i){x.fillStyle=h.fillStyle}x.textBaseline="middle";x.textAlign="center";var T=.5-c;var C=c*n.width/f+T*d;var R;if(r){for(R=0;R<v;++R){x.strokeText(p[R],C+T*_[R],.5*(d+m)+R*m)}}if(i){for(R=0;R<v;++R){x.fillText(p[R],C+T*_[R],.5*(d+m)+R*m)}}}return s.get(a)};ih.prototype.drawTextImage_=function(t,e,i){var r=this.textState_;var n=this.textStrokeState_;var a=this.pixelRatio;var s=qo.TEXT_ALIGN[r.textAlign||fo.defaultTextAlign];var o=qo.TEXT_ALIGN[r.textBaseline];var h=n&&n.lineWidth?n.lineWidth:0;var l=s*t.width/a+2*(.5-s)*h;var u=o*t.height/a+2*(.5-o)*h;this.instructions.push([Ko.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*a,(u-this.textOffsetY_)*a,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1,true,t.width,r.padding==fo.defaultPadding?fo.defaultPadding:r.padding.map((function(t){return t*a})),!!r.backgroundFill,!!r.backgroundStroke]);this.hitDetectionInstructions.push([Ko.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*a,(u-this.textOffsetY_)*a,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1/a,true,t.width,r.padding,!!r.backgroundFill,!!r.backgroundStroke])};ih.prototype.drawChars_=function(t,e,i){var r=this.textStrokeState_;var n=this.textState_;var a=this.textFillState_;var s=this.strokeKey_;if(r){if(!(s in this.strokeStates)){this.strokeStates[s]={strokeStyle:r.strokeStyle,lineCap:r.lineCap,lineDashOffset:r.lineDashOffset,lineWidth:r.lineWidth,lineJoin:r.lineJoin,miterLimit:r.miterLimit,lineDash:r.lineDash}}}var o=this.textKey_;if(!(this.textKey_ in this.textStates)){this.textStates[this.textKey_]={font:n.font,textAlign:n.textAlign||fo.defaultTextAlign,scale:n.scale}}var h=this.fillKey_;if(a){if(!(h in this.fillStates)){this.fillStates[h]={fillStyle:a.fillStyle}}}var l=this.pixelRatio;var u=qo.TEXT_ALIGN[n.textBaseline];var f=this.textOffsetY_*l;var c=this.text_;var d=n.font;var p=n.scale;var v=r?r.lineWidth*p/2:0;var _=this.widths_[d];if(!_){this.widths_[d]=_={}}this.instructions.push([Ko.DRAW_CHARS,t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=_[t];if(!e){e=_[t]=fo.measureTextWidth(d,t)}return e*p*l},f,s,v*l,c,o,1]);this.hitDetectionInstructions.push([Ko.DRAW_CHARS,t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=_[t];if(!e){e=_[t]=fo.measureTextWidth(d,t)}return e*p},f,s,v,c,o,1/l])};ih.prototype.setTextStyle=function(t,e){var i,r,n;if(!t){this.text_=""}else{this.declutterGroup_=e;var a=t.getFill();if(!a){r=this.textFillState_=null}else{r=this.textFillState_;if(!r){r=this.textFillState_={}}r.fillStyle=po.asColorLike(a.getColor()||fo.defaultFillStyle)}var s=t.getStroke();if(!s){n=this.textStrokeState_=null}else{n=this.textStrokeState_;if(!n){n=this.textStrokeState_={}}var o=s.getLineDash();var h=s.getLineDashOffset();var l=s.getWidth();var u=s.getMiterLimit();n.lineCap=s.getLineCap()||fo.defaultLineCap;n.lineDash=o?o.slice():fo.defaultLineDash;n.lineDashOffset=h===undefined?fo.defaultLineDashOffset:h;n.lineJoin=s.getLineJoin()||fo.defaultLineJoin;n.lineWidth=l===undefined?fo.defaultLineWidth:l;n.miterLimit=u===undefined?fo.defaultMiterLimit:u;n.strokeStyle=po.asColorLike(s.getColor()||fo.defaultStrokeStyle)}i=this.textState_;var f=t.getFont()||fo.defaultFont;fo.checkFont(f);var c=t.getScale();i.overflow=t.getOverflow();i.font=f;i.maxAngle=t.getMaxAngle();i.placement=t.getPlacement();i.textAlign=t.getTextAlign();i.textBaseline=t.getTextBaseline()||fo.defaultTextBaseline;i.backgroundFill=t.getBackgroundFill();i.backgroundStroke=t.getBackgroundStroke();i.padding=t.getPadding()||fo.defaultPadding;i.scale=c===undefined?1:c;var d=t.getOffsetX();var p=t.getOffsetY();var v=t.getRotateWithView();var _=t.getRotation();this.text_=t.getText()||"";this.textOffsetX_=d===undefined?0:d;this.textOffsetY_=p===undefined?0:p;this.textRotateWithView_=v===undefined?false:v;this.textRotation_=_===undefined?0:_;this.strokeKey_=n?(typeof n.strokeStyle=="string"?n.strokeStyle:qn.getUid(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"";this.textKey_=i.font+i.scale+(i.textAlign||"?");this.fillKey_=r?typeof r.fillStyle=="string"?r.fillStyle:"|"+qn.getUid(r.fillStyle):""}};var rh=function(t,e,i,r,n,a,s){Vo.call(this);this.declutterTree_=a;this.declutterGroup_=null;this.tolerance_=t;this.maxExtent_=e;this.overlaps_=n;this.pixelRatio_=r;this.resolution_=i;this.renderBuffer_=s;this.replaysByZIndex_={};this.hitDetectionContext_=Ts.createCanvasContext2D(1,1);this.hitDetectionTransform_=Sa.create()};qn.inherits(rh,Vo);rh.circleArrayCache_={0:[[true]]};rh.fillCircleArrayRowToMiddle_=function(t,e,i){var r;var n=Math.floor(t.length/2);if(e>=n){for(r=n;r<e;r++){t[r][i]=true}}else if(e<n){for(r=e+1;r<n;r++){t[r][i]=true}}};rh.getCircleArray_=function(t){if(rh.circleArrayCache_[t]!==undefined){return rh.circleArrayCache_[t]}var e=t*2+1;var i=new Array(e);for(var r=0;r<e;r++){i[r]=new Array(e)}var n=t;var a=0;var s=0;while(n>=a){rh.fillCircleArrayRowToMiddle_(i,t+n,t+a);rh.fillCircleArrayRowToMiddle_(i,t+a,t+n);rh.fillCircleArrayRowToMiddle_(i,t-a,t+n);rh.fillCircleArrayRowToMiddle_(i,t-n,t+a);rh.fillCircleArrayRowToMiddle_(i,t-n,t-a);rh.fillCircleArrayRowToMiddle_(i,t-a,t-n);rh.fillCircleArrayRowToMiddle_(i,t+a,t-n);rh.fillCircleArrayRowToMiddle_(i,t+n,t-a);a++;s+=1+2*a;if(2*(s-n)+1>0){n-=1;s+=1-2*n}}rh.circleArrayCache_[t]=i;return i};rh.replayDeclutter=function(t,e,i){var r=Object.keys(t).map(Number).sort(fa.numberSafeCompareFunction);var n={};for(var a=0,s=r.length;a<s;++a){var o=t[r[a].toString()];for(var h=0,l=o.length;h<l;){var u=o[h++];var f=o[h++];u.replay(e,f,i,n)}}};rh.prototype.addDeclutter=function(t){var e=null;if(this.declutterTree_){if(t){e=this.declutterGroup_;e[4]++}else{e=this.declutterGroup_=pa.createEmpty();e.push(1)}}return e};rh.prototype.clip=function(t,e){var i=this.getClipCoords(e);t.beginPath();t.moveTo(i[0],i[1]);t.lineTo(i[2],i[3]);t.lineTo(i[4],i[5]);t.lineTo(i[6],i[7]);t.clip()};rh.prototype.hasReplays=function(t){for(var e in this.replaysByZIndex_){var i=this.replaysByZIndex_[e];for(var r=0,n=t.length;r<n;++r){if(t[r]in i){return true}}}return false};rh.prototype.finish=function(){var t;for(t in this.replaysByZIndex_){var e=this.replaysByZIndex_[t];var i;for(i in e){e[i].finish()}}};rh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){r=Math.round(r);var o=r*2+1;var h=Sa.compose(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]);var l=this.hitDetectionContext_;if(l.canvas.width!==o||l.canvas.height!==o){l.canvas.width=o;l.canvas.height=o}else{l.clearRect(0,0,o,o)}var u;if(this.renderBuffer_!==undefined){u=pa.createEmpty();pa.extendCoordinate(u,t);pa.buffer(u,e*(this.renderBuffer_+r),u)}var f=rh.getCircleArray_(r);var c;if(this.declutterTree_){c=this.declutterTree_.all().map((function(t){return t.value}))}var d;function p(t){var e=l.getImageData(0,0,o,o).data;for(var i=0;i<o;i++){for(var r=0;r<o;r++){if(f[i][r]){if(e[(r*o+i)*4+3]>0){var n;if(!(c&&(d==Yo.IMAGE||d==Yo.TEXT))||c.indexOf(t)!==-1){n=a(t)}if(n){return n}else{l.clearRect(0,0,o,o);return undefined}}}}}}var v=Object.keys(this.replaysByZIndex_).map(Number);v.sort(fa.numberSafeCompareFunction);var _,g,m,y,E;for(_=v.length-1;_>=0;--_){var x=v[_].toString();m=this.replaysByZIndex_[x];for(g=qo.ORDER.length-1;g>=0;--g){d=qo.ORDER[g];y=m[d];if(y!==undefined){if(s&&(d==Yo.IMAGE||d==Yo.TEXT)){var T=s[x];if(!T){s[x]=[y,h.slice(0)]}else{T.push(y,h.slice(0))}}else{E=y.replayHitDetection(l,h,i,n,p,u);if(E){return E}}}}}return undefined};rh.prototype.getClipCoords=function(t){var e=this.maxExtent_;var i=e[0];var r=e[1];var n=e[2];var a=e[3];var s=[i,r,i,a,n,a,n,r];ga.transform2D(s,0,8,2,t,s);return s};rh.prototype.getReplay=function(t,e){var i=t!==undefined?t.toString():"0";var r=this.replaysByZIndex_[i];if(r===undefined){r={};this.replaysByZIndex_[i]=r}var n=r[e];if(n===undefined){var a=rh.BATCH_CONSTRUCTORS_[e];n=new a(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_,this.overlaps_,this.declutterTree_);r[e]=n}return n};rh.prototype.getReplays=function(){return this.replaysByZIndex_};rh.prototype.isEmpty=function(){return Qn.isEmpty(this.replaysByZIndex_)};rh.prototype.replay=function(t,e,i,r,n,a){var s=Object.keys(this.replaysByZIndex_).map(Number);s.sort(fa.numberSafeCompareFunction);t.save();this.clip(t,e);var o=n?n:qo.ORDER;var h,l,u,f,c,d;for(h=0,l=s.length;h<l;++h){var p=s[h].toString();c=this.replaysByZIndex_[p];for(u=0,f=o.length;u<f;++u){var v=o[u];d=c[v];if(d!==undefined){if(a&&(v==Yo.IMAGE||v==Yo.TEXT)){var _=a[p];if(!_){a[p]=[d,e.slice(0)]}else{_.push(d,e.slice(0))}}else{d.replay(t,e,i,r)}}}}t.restore()};rh.BATCH_CONSTRUCTORS_={Circle:$o,Default:Zo,Image:Jo,LineString:Qo,Polygon:$o,Text:ih};var nh={};nh.defaultOrder=function(t,e){return qn.getUid(t)-qn.getUid(e)};nh.getSquaredTolerance=function(t,e){var i=nh.getTolerance(t,e);return i*i};nh.getTolerance=function(t,e){return qn.SIMPLIFY_TOLERANCE*t/e};nh.renderCircleGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(n||a){var s=t.getReplay(i.getZIndex(),Yo.CIRCLE);s.setFillStrokeStyle(n,a);s.drawCircle(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.renderFeature=function(t,e,i,r,n,a){var s=false;var o,h;o=i.getImage();if(o){h=o.getImageState();if(h==ao.LOADED||h==ao.ERROR){o.unlistenImageChange(n,a)}else{if(h==ao.IDLE){o.load()}h=o.getImageState();o.listenImageChange(n,a);s=true}}nh.renderFeature_(t,e,i,r);return s};nh.renderFeature_=function(t,e,i,r){var n=i.getGeometryFunction()(e);if(!n){return}var a=n.getSimplifiedGeometry(r);var s=i.getRenderer();if(s){nh.renderGeometry_(t,a,i,e)}else{var o=nh.GEOMETRY_RENDERERS_[a.getType()];o(t,a,i,e)}};nh.renderGeometry_=function(t,e,i,r){if(e.getType()==la.GEOMETRY_COLLECTION){var n=e.getGeometries();for(var a=0,s=n.length;a<s;++a){nh.renderGeometry_(t,n[a],i,r)}return}var o=t.getReplay(i.getZIndex(),Yo.DEFAULT);o.drawCustom(e,r,i.getRenderer())};nh.renderGeometryCollectionGeometry_=function(t,e,i,r){var n=e.getGeometriesArray();var a,s;for(a=0,s=n.length;a<s;++a){var o=nh.GEOMETRY_RENDERERS_[n[a].getType()];o(t,n[a],i,r)}};nh.renderLineStringGeometry_=function(t,e,i,r){var n=i.getStroke();if(n){var a=t.getReplay(i.getZIndex(),Yo.LINE_STRING);a.setFillStrokeStyle(null,n);a.drawLineString(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(false));o.drawText(e,r)}};nh.renderMultiLineStringGeometry_=function(t,e,i,r){var n=i.getStroke();if(n){var a=t.getReplay(i.getZIndex(),Yo.LINE_STRING);a.setFillStrokeStyle(null,n);a.drawMultiLineString(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(false));o.drawText(e,r)}};nh.renderMultiPolygonGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(a||n){var s=t.getReplay(i.getZIndex(),Yo.POLYGON);s.setFillStrokeStyle(n,a);s.drawMultiPolygon(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.renderPointGeometry_=function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=ao.LOADED){return}var a=t.getReplay(i.getZIndex(),Yo.IMAGE);a.setImageStyle(n,t.addDeclutter(false));a.drawPoint(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(!!n));o.drawText(e,r)}};nh.renderMultiPointGeometry_=function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=ao.LOADED){return}var a=t.getReplay(i.getZIndex(),Yo.IMAGE);a.setImageStyle(n,t.addDeclutter(false));a.drawMultiPoint(e,r)}var s=i.getText();if(s){var o=t.getReplay(i.getZIndex(),Yo.TEXT);o.setTextStyle(s,t.addDeclutter(!!n));o.drawText(e,r)}};nh.renderPolygonGeometry_=function(t,e,i,r){var n=i.getFill();var a=i.getStroke();if(n||a){var s=t.getReplay(i.getZIndex(),Yo.POLYGON);s.setFillStrokeStyle(n,a);s.drawPolygon(e,r)}var o=i.getText();if(o){var h=t.getReplay(i.getZIndex(),Yo.TEXT);h.setTextStyle(o,t.addDeclutter(false));h.drawText(e,r)}};nh.GEOMETRY_RENDERERS_={Point:nh.renderPointGeometry_,LineString:nh.renderLineStringGeometry_,Polygon:nh.renderPolygonGeometry_,MultiPoint:nh.renderMultiPointGeometry_,MultiLineString:nh.renderMultiLineStringGeometry_,MultiPolygon:nh.renderMultiPolygonGeometry_,GeometryCollection:nh.renderGeometryCollectionGeometry_,Circle:nh.renderCircleGeometry_};var ah=function(t){mo.call(this,t);this.declutterTree_=t.getDeclutter()?Lo(9):null;this.dirty_=false;this.renderedRevision_=-1;this.renderedResolution_=NaN;this.renderedExtent_=pa.createEmpty();this.renderedRenderOrder_=null;this.replayGroup_=null;this.replayGroupChanged=true;this.context=Ts.createCanvasContext2D();$n.listen(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this)};qn.inherits(ah,mo);ah["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.VECTOR};ah["create"]=function(t,e){return new ah(e)};ah.prototype.disposeInternal=function(){$n.unlisten(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this);mo.prototype.disposeInternal.call(this)};ah.prototype.composeFrame=function(t,e,i){var r=t.extent;var n=t.pixelRatio;var a=e.managed?t.skippedFeatureUids:{};var s=t.viewState;var o=s.projection;var h=s.rotation;var l=o.getExtent();var u=this.getLayer().getSource();var f=this.getTransform(t,0);this.preCompose(i,t,f);var c=e.extent;var d=c!==undefined;if(d){this.clip(i,t,c)}var p=this.replayGroup_;if(p&&!p.isEmpty()){if(this.declutterTree_){this.declutterTree_.clear()}var v=this.getLayer();var _=0;var g=0;var m;var y=e.opacity!==1;var E=v.hasListener(Ds.RENDER);if(y||E){var x=i.canvas.width;var T=i.canvas.height;if(h){var C=Math.round(Math.sqrt(x*x+T*T));_=(C-x)/2;g=(C-T)/2;x=T=C}this.context.canvas.width=x;this.context.canvas.height=T;m=this.context}else{m=i}var R=m.globalAlpha;if(!y){m.globalAlpha=e.opacity}if(m!=i){m.translate(_,g)}var M=t.size[0]*n;var S=t.size[1]*n;fo.rotateAtOffset(m,-h,M/2,S/2);p.replay(m,f,h,a);if(u.getWrapX()&&o.canWrapX()&&!pa.containsExtent(l,r)){var I=r[0];var L=pa.getWidth(l);var A=0;var w;while(I<l[0]){--A;w=L*A;f=this.getTransform(t,w);p.replay(m,f,h,a);I+=L}A=0;I=r[2];while(I>l[2]){++A;w=L*A;f=this.getTransform(t,w);p.replay(m,f,h,a);I-=L}f=this.getTransform(t,0)}fo.rotateAtOffset(m,h,M/2,S/2);if(m!=i){if(E){this.dispatchRenderEvent(m,t,f)}if(y){var O=i.globalAlpha;i.globalAlpha=e.opacity;i.drawImage(m.canvas,-_,-g);i.globalAlpha=O}else{i.drawImage(m.canvas,-_,-g)}m.translate(-_,-g)}if(!y){m.globalAlpha=R}}if(d){i.restore()}this.postCompose(i,t,e,f)};ah.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(!this.replayGroup_){return undefined}else{var a=e.viewState.resolution;var s=e.viewState.rotation;var o=this.getLayer();var h={};var l=this.replayGroup_.forEachFeatureAtCoordinate(t,a,s,i,{},(function(t){var e=qn.getUid(t).toString();if(!(e in h)){h[e]=true;return r.call(n,t,o)}}),null);return l}};ah.prototype.handleFontsChanged_=function(t){var e=this.getLayer();if(e.getVisible()&&this.replayGroup_){e.changed()}};ah.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};ah.prototype.prepareFrame=function(t,e){var i=this.getLayer();var r=i.getSource();this.updateLogos(t,r);var n=t.viewHints[_s.ANIMATING];var a=t.viewHints[_s.INTERACTING];var s=i.getUpdateWhileAnimating();var o=i.getUpdateWhileInteracting();if(!this.dirty_&&(!s&&n)||!o&&a){return true}var h=t.extent;var l=t.viewState;var u=l.projection;var f=l.resolution;var c=t.pixelRatio;var d=i.getRevision();var p=i.getRenderBuffer();var v=i.getRenderOrder();if(v===undefined){v=nh.defaultOrder}var _=pa.buffer(h,p*f);var g=l.projection.getExtent();if(r.getWrapX()&&l.projection.canWrapX()&&!pa.containsExtent(g,t.extent)){var m=pa.getWidth(g);var y=Math.max(pa.getWidth(_)/2,m);_[0]=g[0]-y;_[2]=g[2]+y}if(!this.dirty_&&this.renderedResolution_==f&&this.renderedRevision_==d&&this.renderedRenderOrder_==v&&pa.containsExtent(this.renderedExtent_,_)){this.replayGroupChanged=false;return true}this.replayGroup_=null;this.dirty_=false;var E=new rh(nh.getTolerance(f,c),_,f,c,r.getOverlaps(),this.declutterTree_,i.getRenderBuffer());r.loadFeatures(_,f,u);var x=function(t){var e;var r=t.getStyleFunction();if(r){e=r.call(t,f)}else{r=i.getStyleFunction();if(r){e=r(t,f)}}if(e){var n=this.renderFeature(t,f,c,e,E);this.dirty_=this.dirty_||n}}.bind(this);if(v){var T=[];r.forEachFeatureInExtent(_,(function(t){T.push(t)}),this);T.sort(v);for(var C=0,R=T.length;C<R;++C){x(T[C])}}else{r.forEachFeatureInExtent(_,x,this)}E.finish();this.renderedResolution_=f;this.renderedRevision_=d;this.renderedRenderOrder_=v;this.renderedExtent_=_;this.replayGroup_=E;this.replayGroupChanged=true;return true};ah.prototype.renderFeature=function(t,e,i,r,n){if(!r){return false}var a=false;if(Array.isArray(r)){for(var s=0,o=r.length;s<o;++s){a=nh.renderFeature(n,t,r[s],nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}}else{a=nh.renderFeature(n,t,r,nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)}return a};var sh={IMAGE:"image",HYBRID:"hybrid",VECTOR:"vector"};var oh=function(t){this.context=null;So.call(this,t);this.declutterTree_=t.getDeclutter()?Lo(9):null;this.dirty_=false;this.tmpTransform_=Sa.create();this.zDirection=t.getRenderMode()==sh.VECTOR?1:0;$n.listen(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this)};qn.inherits(oh,So);oh["handles"]=function(t,e){return t===As.CANVAS&&e.getType()===oo.VECTOR_TILE};oh["create"]=function(t,e){return new oh(e)};oh.IMAGE_REPLAYS={image:[Yo.POLYGON,Yo.CIRCLE,Yo.LINE_STRING,Yo.IMAGE,Yo.TEXT],hybrid:[Yo.POLYGON,Yo.LINE_STRING]};oh.VECTOR_REPLAYS={image:[Yo.DEFAULT],hybrid:[Yo.IMAGE,Yo.TEXT,Yo.DEFAULT],vector:qo.ORDER};oh.prototype.disposeInternal=function(){$n.unlisten(fo.labelCache,ra.CLEAR,this.handleFontsChanged_,this);So.prototype.disposeInternal.call(this)};oh.prototype.prepareFrame=function(t,e){var i=this.getLayer();var r=i.getRevision();if(this.renderedLayerRevision_!=r){this.renderedTiles.length=0;var n=i.getRenderMode();if(!this.context&&n!=sh.VECTOR){this.context=Ts.createCanvasContext2D()}if(this.context&&n==sh.VECTOR){this.context=null}}this.renderedLayerRevision_=r;return So.prototype.prepareFrame.apply(this,arguments)};oh.prototype.createReplayGroup_=function(t,e){var i=this.getLayer();var r=e.pixelRatio;var n=e.viewState.projection;var a=i.getRevision();var s=i.getRenderOrder()||null;var o=t.getReplayState(i);if(!o.dirty&&o.renderedRevision==a&&o.renderedRenderOrder==s){return}var h=i.getSource();var l=h.getTileGrid();var u=h.getTileGridForProjection(n);var f=u.getResolution(t.tileCoord[0]);var c=u.getTileCoordExtent(t.wrappedTileCoord);for(var d=0,p=t.tileKeys.length;d<p;++d){var v=t.getTile(t.tileKeys[d]);if(v.getState()==us.ERROR){continue}var _=v.tileCoord;var g=l.getTileCoordExtent(_);var m=pa.getIntersection(c,g);var y=pa.equals(g,m)?null:pa.buffer(m,i.getRenderBuffer()*f);var E=v.getProjection();var x=false;if(!Ma.equivalent(n,E)){x=true;v.setProjection(n)}o.dirty=false;var T=new rh(0,m,f,r,h.getOverlaps(),this.declutterTree_,i.getRenderBuffer());var C=nh.getSquaredTolerance(f,r);var R=function(t){var e;var r=t.getStyleFunction();if(r){e=r.call(t,f)}else{r=i.getStyleFunction();if(r){e=r(t,f)}}if(e){var n=this.renderFeature(t,C,e,T);this.dirty_=this.dirty_||n;o.dirty=o.dirty||n}};var M=v.getFeatures();if(s&&s!==o.renderedRenderOrder){M.sort(s)}var S;for(var I=0,L=M.length;I<L;++I){S=M[I];if(x){if(E.getUnits()==ma.TILE_PIXELS){E.setWorldExtent(g);E.setExtent(v.getExtent())}S.getGeometry().transform(E,n)}if(!y||pa.intersects(y,S.getGeometry().getExtent())){R.call(this,S)}}T.finish();for(var A in T.getReplays()){}v.setReplayGroup(i,t.tileCoord.toString(),T)}o.renderedRevision=a;o.renderedRenderOrder=s};oh.prototype.drawTileImage=function(t,e,i,r,n,a,s,o,h){var l=t;this.createReplayGroup_(l,e);if(this.context){this.renderTileImage_(l,e,i);So.prototype.drawTileImage.apply(this,arguments)}};oh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=e.viewState.resolution;var s=e.viewState.rotation;i=i==undefined?0:i;var o=this.getLayer();var h={};var l=this.renderedTiles;var u=o.getSource();var f=u.getTileGridForProjection(e.viewState.projection);var c,d;var p,v,_;var g,m,y;for(p=0,v=l.length;p<v;++p){g=l[p];m=g.wrappedTileCoord;y=f.getTileCoordExtent(m,this.tmpExtent);c=pa.buffer(y,i*a,c);if(!pa.containsCoordinate(c,t)){continue}for(var E=0,x=g.tileKeys.length;E<x;++E){var T=g.getTile(g.tileKeys[E]);if(T.getState()==us.ERROR){continue}_=T.getReplayGroup(o,g.tileCoord.toString());d=d||_.forEachFeatureAtCoordinate(t,a,s,i,{},(function(t){var e=qn.getUid(t).toString();if(!(e in h)){h[e]=true;return r.call(n,t,o)}}),null)}}return d};oh.prototype.getReplayTransform_=function(t,e){var i=this.getLayer();var r=i.getSource();var n=r.getTileGrid();var a=t.tileCoord;var s=n.getResolution(a[0]);var o=e.viewState;var h=e.pixelRatio;var l=o.resolution/h;var u=n.getTileCoordExtent(a,this.tmpExtent);var f=o.center;var c=pa.getTopLeft(u);var d=e.size;var p=Math.round(h*d[0]/2);var v=Math.round(h*d[1]/2);return Sa.compose(this.tmpTransform_,p,v,s/l,s/l,o.rotation,(c[0]-f[0])/s,(f[1]-c[1])/s)};oh.prototype.handleFontsChanged_=function(t){var e=this.getLayer();if(e.getVisible()&&this.renderedLayerRevision_!==undefined){e.changed()}};oh.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};oh.prototype.postCompose=function(t,e,i){var r=this.getLayer();var n=r.getDeclutter()?{}:null;var a=r.getSource();var s=r.getRenderMode();var o=oh.VECTOR_REPLAYS[s];var h=e.pixelRatio;var l=e.viewState.rotation;var u=e.size;var f,c;if(l){f=Math.round(h*u[0]/2);c=Math.round(h*u[1]/2);fo.rotateAtOffset(t,-l,f,c)}if(n){this.declutterTree_.clear()}var d=this.renderedTiles;var p=a.getTileGridForProjection(e.viewState.projection);var v=[];var _=[];for(var g=d.length-1;g>=0;--g){var m=d[g];if(m.getState()==us.ABORT){continue}var y=m.tileCoord;var E=p.getTileCoordExtent(y)[0]-p.getTileCoordExtent(m.wrappedTileCoord)[0];var x=undefined;for(var T=0,C=m.tileKeys.length;T<C;++T){var R=m.getTile(m.tileKeys[T]);if(R.getState()==us.ERROR){continue}var M=R.getReplayGroup(r,y.toString());if(s!=sh.VECTOR&&!M.hasReplays(o)){continue}if(!x){x=this.getTransform(e,E)}var S=R.tileCoord[0];var I=M.getClipCoords(x);t.save();t.globalAlpha=i.opacity;for(var L=0,A=v.length;L<A;++L){var w=v[L];if(S<_[L]){t.beginPath();t.moveTo(I[0],I[1]);t.lineTo(I[2],I[3]);t.lineTo(I[4],I[5]);t.lineTo(I[6],I[7]);t.moveTo(w[6],w[7]);t.lineTo(w[4],w[5]);t.lineTo(w[2],w[3]);t.lineTo(w[0],w[1]);t.clip()}}M.replay(t,x,l,{},o,n);t.restore();v.push(I);_.push(S)}}if(n){rh.replayDeclutter(n,t,l)}if(l){fo.rotateAtOffset(t,l,f,c)}So.prototype.postCompose.apply(this,arguments)};oh.prototype.renderFeature=function(t,e,i,r){if(!i){return false}var n=false;if(Array.isArray(i)){for(var a=0,s=i.length;a<s;++a){n=nh.renderFeature(r,t,i[a],e,this.handleStyleImageChange_,this)||n}}else{n=nh.renderFeature(r,t,i,e,this.handleStyleImageChange_,this)}return n};oh.prototype.renderTileImage_=function(t,e,i){var r=this.getLayer();var n=t.getReplayState(r);var a=r.getRevision();var s=oh.IMAGE_REPLAYS[r.getRenderMode()];if(s&&n.renderedTileRevision!==a){n.renderedTileRevision=a;var o=t.wrappedTileCoord;var h=o[0];var l=e.pixelRatio;var u=r.getSource();var f=u.getTileGridForProjection(e.viewState.projection);var c=f.getResolution(h);var d=t.getContext(r);var p=u.getTilePixelSize(h,l,e.viewState.projection);d.canvas.width=p[0];d.canvas.height=p[1];var v=f.getTileCoordExtent(o);for(var _=0,g=t.tileKeys.length;_<g;++_){var m=t.getTile(t.tileKeys[_]);if(m.getState()==us.ERROR){continue}var y=l/c;var E=Sa.reset(this.tmpTransform_);Sa.scale(E,y,-y);Sa.translate(E,-v[0],-v[3]);var x=m.getReplayGroup(r,t.tileCoord.toString());x.replay(d,E,0,{},s)}}};var hh=function(t){this.source_=t};hh.prototype.getType=function(){};hh.prototype.getSource=function(){return this.source_};hh.prototype.isAnimated=_a.FALSE;var lh=function(t){hh.call(this,t)};qn.inherits(lh,hh);lh.prototype.getType=function(){return Xa.FRAGMENT_SHADER};var uh=function(t){hh.call(this,t)};qn.inherits(uh,hh);uh.prototype.getType=function(){return Xa.VERTEX_SHADER};var fh={};fh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_fillColor;\nuniform vec4 u_strokeColor;\nuniform vec2 u_size;\n\nvoid main(void) {\n vec2 windowCenter = vec2((v_center.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_center.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n vec2 windowOffset = vec2((v_offset.x + 1.0) / 2.0 * u_size.x * v_pixelRatio,\n (v_offset.y + 1.0) / 2.0 * u_size.y * v_pixelRatio);\n float radius = length(windowCenter - windowOffset);\n float dist = length(windowCenter - gl_FragCoord.xy);\n if (dist > radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n":"precision mediump float;varying vec2 a;varying vec2 b;varying float c;varying float d;uniform float m;uniform vec4 n;uniform vec4 o;uniform vec2 p;void main(void){vec2 windowCenter=vec2((a.x+1.0)/2.0*p.x*d,(a.y+1.0)/2.0*p.y*d);vec2 windowOffset=vec2((b.x+1.0)/2.0*p.x*d,(b.y+1.0)/2.0*p.y*d);float radius=length(windowCenter-windowOffset);float dist=length(windowCenter-gl_FragCoord.xy);if(dist>radius+c){if(o.a==0.0){gl_FragColor=n;}else{gl_FragColor=o;}gl_FragColor.a=gl_FragColor.a-(dist-(radius+c));}else if(n.a==0.0){gl_FragColor=o;if(dist<radius-c){gl_FragColor.a=gl_FragColor.a-(radius-c-dist);}} else{gl_FragColor=n;float strokeDist=radius-c;float antialias=2.0*d;if(dist>strokeDist){gl_FragColor=o;}else if(dist>=strokeDist-antialias){float step=smoothstep(strokeDist-antialias,strokeDist,dist);gl_FragColor=mix(n,o,step);}} gl_FragColor.a=gl_FragColor.a*m;if(gl_FragColor.a<=0.0){discard;}}");fh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n":"varying vec2 a;varying vec2 b;varying float c;varying float d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;void main(void){mat4 offsetMatrix=i*j;a=vec4(h*vec4(e,0.0,1.0)).xy;d=l;float lineWidth=k*l;c=lineWidth/2.0;if(lineWidth==0.0){lineWidth=2.0*l;}vec2 offset;float radius=g+3.0*l;//Until we get gl_VertexID in WebGL,we store an instruction.if(f==0.0){//Offsetting the edges of the triangle by lineWidth/2 is necessary,however//we should also leave some space for the antialiasing,thus we offset by lineWidth.offset=vec2(-1.0,1.0);}else if(f==1.0){offset=vec2(-1.0,-1.0);}else if(f==2.0){offset=vec2(1.0,-1.0);}else{offset=vec2(1.0,1.0);}gl_Position=h*vec4(e+offset*radius,0.0,1.0)+offsetMatrix*vec4(offset*lineWidth,0.0,0.0);b=vec4(h*vec4(e.x+g,e.y,0.0,1.0)).xy;if(distance(a,b)>20000.0){gl_Position=vec4(a,0.0,1.0);}}");var ch=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_lineWidth=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_lineWidth":"k");this.u_pixelRatio=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_pixelRatio":"l");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"m");this.u_fillColor=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_fillColor":"n");this.u_strokeColor=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_strokeColor":"o");this.u_size=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_size":"p");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"e");this.a_instruction=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_instruction":"f");this.a_radius=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_radius":"g")};var dh={};dh.create=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]};dh.fromTransform=function(t,e){t[0]=e[0];t[1]=e[1];t[4]=e[2];t[5]=e[3];t[12]=e[4];t[13]=e[5];return t};var ph=function(t,e){vo.call(this);this.tolerance=t;this.maxExtent=e;this.origin=pa.getCenter(e);this.projectionMatrix_=Sa.create();this.offsetRotateMatrix_=Sa.create();this.offsetScaleMatrix_=Sa.create();this.tmpMat4_=dh.create();this.indices=[];this.indicesBuffer=null;this.startIndices=[];this.startIndicesFeature=[];this.vertices=[];this.verticesBuffer=null;this.lineStringReplay=undefined};qn.inherits(ph,vo);ph.prototype.getDeleteResourcesFunction=function(t){};ph.prototype.finish=function(t){};ph.prototype.setUpProgram=function(t,e,i,r){};ph.prototype.shutDownProgram=function(t,e){};ph.prototype.drawReplay=function(t,e,i,r){};ph.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){};ph.prototype.drawHitDetectionReplay=function(t,e,i,r,n,a){if(!n){return this.drawHitDetectionReplayAll(t,e,i,r)}else{return this.drawHitDetectionReplayOneByOne(t,e,i,r,a)}};ph.prototype.drawHitDetectionReplayAll=function(t,e,i,r){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawReplay(t,e,i,true);var n=r(null);if(n){return n}else{return undefined}};ph.prototype.replay=function(t,e,i,r,n,a,s,o,h,l,u){var f=t.getGL();var c,d,p,v,_,g,m,y;if(this.lineStringReplay){c=f.isEnabled(f.STENCIL_TEST);d=f.getParameter(f.STENCIL_FUNC);p=f.getParameter(f.STENCIL_VALUE_MASK);v=f.getParameter(f.STENCIL_REF);_=f.getParameter(f.STENCIL_WRITEMASK);g=f.getParameter(f.STENCIL_FAIL);m=f.getParameter(f.STENCIL_PASS_DEPTH_PASS);y=f.getParameter(f.STENCIL_PASS_DEPTH_FAIL);f.enable(f.STENCIL_TEST);f.clear(f.STENCIL_BUFFER_BIT);f.stencilMask(255);f.stencilFunc(f.ALWAYS,1,255);f.stencilOp(f.KEEP,f.KEEP,f.REPLACE);this.lineStringReplay.replay(t,e,i,r,n,a,s,o,h,l,u);f.stencilMask(0);f.stencilFunc(f.NOTEQUAL,1,255)}t.bindBuffer(Xa.ARRAY_BUFFER,this.verticesBuffer);t.bindBuffer(Xa.ELEMENT_ARRAY_BUFFER,this.indicesBuffer);var E=this.setUpProgram(f,t,n,a);var x=Sa.reset(this.projectionMatrix_);Sa.scale(x,2/(i*n[0]),2/(i*n[1]));Sa.rotate(x,-r);Sa.translate(x,-(e[0]-this.origin[0]),-(e[1]-this.origin[1]));var T=Sa.reset(this.offsetScaleMatrix_);Sa.scale(T,2/n[0],2/n[1]);var C=Sa.reset(this.offsetRotateMatrix_);if(r!==0){Sa.rotate(C,-r)}f.uniformMatrix4fv(E.u_projectionMatrix,false,dh.fromTransform(this.tmpMat4_,x));f.uniformMatrix4fv(E.u_offsetScaleMatrix,false,dh.fromTransform(this.tmpMat4_,T));f.uniformMatrix4fv(E.u_offsetRotateMatrix,false,dh.fromTransform(this.tmpMat4_,C));f.uniform1f(E.u_opacity,s);var R;if(h===undefined){this.drawReplay(f,t,o,false)}else{R=this.drawHitDetectionReplay(f,t,o,h,l,u)}this.shutDownProgram(f,E);if(this.lineStringReplay){if(!c){f.disable(f.STENCIL_TEST)}f.clear(f.STENCIL_BUFFER_BIT);f.stencilFunc(d,v,p);f.stencilMask(_);f.stencilOp(g,y,m)}return R};ph.prototype.drawElements=function(t,e,i,r){var n=e.hasOESElementIndexUint?Xa.UNSIGNED_INT:Xa.UNSIGNED_SHORT;var a=e.hasOESElementIndexUint?4:2;var s=r-i;var o=i*a;t.drawElements(Xa.TRIANGLES,s,n,o)};var vh={};vh.defaultFont="10px sans-serif";vh.defaultFillStyle=[0,0,0,1];vh.defaultLineCap="round";vh.defaultLineDash=[];vh.defaultLineDashOffset=0;vh.defaultLineJoin="round";vh.defaultMiterLimit=10;vh.defaultStrokeStyle=[0,0,0,1];vh.defaultTextAlign=.5;vh.defaultTextBaseline=.5;vh.defaultLineWidth=1;vh.triangleIsCounterClockwise=function(t,e,i,r,n,a){var s=(i-t)*(a-e)-(n-t)*(r-e);return s<=vh.EPSILON&&s>=-vh.EPSILON?undefined:s>0};vh.EPSILON=Number.EPSILON||2220446049250313e-31;var _h=function(t,e){this.arr_=t!==undefined?t:[];this.usage_=e!==undefined?e:_h.Usage_.STATIC_DRAW};_h.prototype.getArray=function(){return this.arr_};_h.prototype.getUsage=function(){return this.usage_};_h.Usage_={STATIC_DRAW:Xa.STATIC_DRAW,STREAM_DRAW:Xa.STREAM_DRAW,DYNAMIC_DRAW:Xa.DYNAMIC_DRAW};var gh=function(t,e){ph.call(this,t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.radius_=0;this.state_={fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:undefined,lineWidth:undefined,changed:false}};qn.inherits(gh,ph);gh.prototype.drawCoordinates_=function(t,e,i,r){var n=this.vertices.length;var a=this.indices.length;var s=n/4;var o,h;for(o=e,h=i;o<h;o+=r){this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=0;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=1;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=2;this.vertices[n++]=this.radius_;this.vertices[n++]=t[o];this.vertices[n++]=t[o+1];this.vertices[n++]=3;this.vertices[n++]=this.radius_;this.indices[a++]=s;this.indices[a++]=s+1;this.indices[a++]=s+2;this.indices[a++]=s+2;this.indices[a++]=s+3;this.indices[a++]=s;s+=4}};gh.prototype.drawCircle=function(t,e){var i=t.getRadius();var r=t.getStride();if(i){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.radius_=i;var n=t.getFlatCoordinates();n=ga.translate(n,0,2,r,-this.origin[0],-this.origin[1]);this.drawCoordinates_(n,0,2,r)}else{if(this.state_.changed){this.styles_.pop();if(this.styles_.length){var a=this.styles_[this.styles_.length-1];this.state_.fillColor=a[0];this.state_.strokeColor=a[1];this.state_.lineWidth=a[2];this.state_.changed=false}}}};gh.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};gh.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;return function(){t.deleteBuffer(e);t.deleteBuffer(i)}};gh.prototype.setUpProgram=function(t,e,i,r){var n,a;n=fh.fragment;a=fh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new ch(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,16,0);t.enableVertexAttribArray(o.a_instruction);t.vertexAttribPointer(o.a_instruction,1,Xa.FLOAT,false,16,8);t.enableVertexAttribArray(o.a_radius);t.vertexAttribPointer(o.a_radius,1,Xa.FLOAT,false,16,12);t.uniform2fv(o.u_size,i);t.uniform1f(o.u_pixelRatio,r);return o};gh.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_instruction);t.disableVertexAttribArray(e.a_radius)};gh.prototype.drawReplay=function(t,e,i,r){if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var n,a,s,o;s=this.startIndices[this.startIndices.length-1];for(n=this.styleIndices_.length-1;n>=0;--n){a=this.styleIndices_[n];o=this.styles_[n];this.setFillStyle_(t,o[0]);this.setStrokeStyle_(t,o[1],o[2]);this.drawElements(t,e,a,s);s=a}}};gh.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setFillStyle_(t,h[0]);this.setStrokeStyle_(t,h[1],h[2]);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};gh.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setFillStyle_(t,s[0]);this.setStrokeStyle_(t,s[1],s[2]);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a)}n=a=o}};gh.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_fillColor,e)};gh.prototype.setStrokeStyle_=function(t,e,i){t.uniform4fv(this.defaultLocations_.u_strokeColor,e);t.uniform1f(this.defaultLocations_.u_lineWidth,i)};gh.prototype.setFillStrokeStyle=function(t,e){var i,r;if(e){var n=e.getLineDash();this.state_.lineDash=n?n:vh.defaultLineDash;var a=e.getLineDashOffset();this.state_.lineDashOffset=a?a:vh.defaultLineDashOffset;i=e.getColor();if(!(i instanceof CanvasGradient)&&!(i instanceof CanvasPattern)){i=co.asArray(i).map((function(t,e){return e!=3?t/255:t}))||vh.defaultStrokeStyle}else{i=vh.defaultStrokeStyle}r=e.getWidth();r=r!==undefined?r:vh.defaultLineWidth}else{i=[0,0,0,0];r=0}var s=t?t.getColor():[0,0,0,0];if(!(s instanceof CanvasGradient)&&!(s instanceof CanvasPattern)){s=co.asArray(s).map((function(t,e){return e!=3?t/255:t}))||vh.defaultFillStyle}else{s=vh.defaultFillStyle}if(!this.state_.strokeColor||!fa.equals(this.state_.strokeColor,i)||!this.state_.fillColor||!fa.equals(this.state_.fillColor,s)||this.state_.lineWidth!==r){this.state_.changed=true;this.state_.fillColor=s;this.state_.strokeColor=i;this.state_.lineWidth=r;this.styles_.push([s,i,r])}};var mh={};mh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");mh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n":"varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.0,0.0);gl_Position=h*vec4(c,0.0,1.0)+offsets;a=d;b=f;}");var yh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"k");this.u_image=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_image":"l");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"c");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"d");this.a_offsets=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_offsets":"e");this.a_opacity=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_opacity":"f");this.a_rotateWithView=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_rotateWithView":"g")};var Eh={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};var xh=function(t,e){this.canvas_=t;this.gl_=e;this.bufferCache_={};this.shaderCache_={};this.programCache_={};this.currentProgram_=null;this.hitDetectionFramebuffer_=null;this.hitDetectionTexture_=null;this.hitDetectionRenderbuffer_=null;this.hasOESElementIndexUint=fa.includes(qn.WEBGL_EXTENSIONS,"OES_element_index_uint");if(this.hasOESElementIndexUint){e.getExtension("OES_element_index_uint")}$n.listen(this.canvas_,Eh.LOST,this.handleWebGLContextLost,this);$n.listen(this.canvas_,Eh.RESTORED,this.handleWebGLContextRestored,this)};qn.inherits(xh,ta);xh.prototype.bindBuffer=function(t,e){var i=this.getGL();var r=e.getArray();var n=String(qn.getUid(e));if(n in this.bufferCache_){var a=this.bufferCache_[n];i.bindBuffer(t,a.buffer)}else{var s=i.createBuffer();i.bindBuffer(t,s);var o;if(t==Xa.ARRAY_BUFFER){o=new Float32Array(r)}else if(t==Xa.ELEMENT_ARRAY_BUFFER){o=this.hasOESElementIndexUint?new Uint32Array(r):new Uint16Array(r)}i.bufferData(t,o,e.getUsage());this.bufferCache_[n]={buf:e,buffer:s}}};xh.prototype.deleteBuffer=function(t){var e=this.getGL();var i=String(qn.getUid(t));var r=this.bufferCache_[i];if(!e.isContextLost()){e.deleteBuffer(r.buffer)}delete this.bufferCache_[i]};xh.prototype.disposeInternal=function(){$n.unlistenAll(this.canvas_);var t=this.getGL();if(!t.isContextLost()){var e;for(e in this.bufferCache_){t.deleteBuffer(this.bufferCache_[e].buffer)}for(e in this.programCache_){t.deleteProgram(this.programCache_[e])}for(e in this.shaderCache_){t.deleteShader(this.shaderCache_[e])}t.deleteFramebuffer(this.hitDetectionFramebuffer_);t.deleteRenderbuffer(this.hitDetectionRenderbuffer_);t.deleteTexture(this.hitDetectionTexture_)}};xh.prototype.getCanvas=function(){return this.canvas_};xh.prototype.getGL=function(){return this.gl_};xh.prototype.getHitDetectionFramebuffer=function(){if(!this.hitDetectionFramebuffer_){this.initHitDetectionFramebuffer_()}return this.hitDetectionFramebuffer_};xh.prototype.getShader=function(t){var e=String(qn.getUid(t));if(e in this.shaderCache_){return this.shaderCache_[e]}else{var i=this.getGL();var r=i.createShader(t.getType());i.shaderSource(r,t.getSource());i.compileShader(r);this.shaderCache_[e]=r;return r}};xh.prototype.getProgram=function(t,e){var i=qn.getUid(t)+"/"+qn.getUid(e);if(i in this.programCache_){return this.programCache_[i]}else{var r=this.getGL();var n=r.createProgram();r.attachShader(n,this.getShader(t));r.attachShader(n,this.getShader(e));r.linkProgram(n);this.programCache_[i]=n;return n}};xh.prototype.handleWebGLContextLost=function(){Qn.clear(this.bufferCache_);Qn.clear(this.shaderCache_);Qn.clear(this.programCache_);this.currentProgram_=null;this.hitDetectionFramebuffer_=null;this.hitDetectionTexture_=null;this.hitDetectionRenderbuffer_=null};xh.prototype.handleWebGLContextRestored=function(){};xh.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_;var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var i=xh.createEmptyTexture(t,1,1);var r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r);t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,r);t.bindTexture(t.TEXTURE_2D,null);t.bindRenderbuffer(t.RENDERBUFFER,null);t.bindFramebuffer(t.FRAMEBUFFER,null);this.hitDetectionFramebuffer_=e;this.hitDetectionTexture_=i;this.hitDetectionRenderbuffer_=r};xh.prototype.useProgram=function(t){if(t==this.currentProgram_){return false}else{var e=this.getGL();e.useProgram(t);this.currentProgram_=t;return true}};xh.createTexture_=function(t,e,i){var r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR);if(e!==undefined){t.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_S,e)}if(i!==undefined){t.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_T,i)}return r};xh.createEmptyTexture=function(t,e,i,r,n){var a=xh.createTexture_(t,r,n);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null);return a};xh.createTexture=function(t,e,i,r){var n=xh.createTexture_(t,i,r);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);return n};var Th=function(t,e){ph.call(this,t,e);this.anchorX=undefined;this.anchorY=undefined;this.groupIndices=[];this.hitDetectionGroupIndices=[];this.height=undefined;this.imageHeight=undefined;this.imageWidth=undefined;this.defaultLocations=null;this.opacity=undefined;this.originX=undefined;this.originY=undefined;this.rotateWithView=undefined;this.rotation=undefined;this.scale=undefined;this.width=undefined};qn.inherits(Th,ph);Th.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;var r=this.getTextures(true);var n=t.getGL();return function(){if(!n.isContextLost()){var a,s;for(a=0,s=r.length;a<s;++a){n.deleteTexture(r[a])}}t.deleteBuffer(e);t.deleteBuffer(i)}};Th.prototype.drawCoordinates=function(t,e,i,r){var n=this.anchorX;var a=this.anchorY;var s=this.height;var o=this.imageHeight;var h=this.imageWidth;var l=this.opacity;var u=this.originX;var f=this.originY;var c=this.rotateWithView?1:0;var d=-this.rotation;var p=this.scale;var v=this.width;var _=Math.cos(d);var g=Math.sin(d);var m=this.indices.length;var y=this.vertices.length;var E,x,T,C,R,M;for(E=e;E<i;E+=r){R=t[E]-this.origin[0];M=t[E+1]-this.origin[1];x=y/8;T=-p*n;C=-p*(s-a);this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=u/h;this.vertices[y++]=(f+s)/o;this.vertices[y++]=l;this.vertices[y++]=c;T=p*(v-n);C=-p*(s-a);this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=(u+v)/h;this.vertices[y++]=(f+s)/o;this.vertices[y++]=l;this.vertices[y++]=c;T=p*(v-n);C=p*a;this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=(u+v)/h;this.vertices[y++]=f/o;this.vertices[y++]=l;this.vertices[y++]=c;T=-p*n;C=p*a;this.vertices[y++]=R;this.vertices[y++]=M;this.vertices[y++]=T*_-C*g;this.vertices[y++]=T*g+C*_;this.vertices[y++]=u/h;this.vertices[y++]=f/o;this.vertices[y++]=l;this.vertices[y++]=c;this.indices[m++]=x;this.indices[m++]=x+1;this.indices[m++]=x+2;this.indices[m++]=x;this.indices[m++]=x+2;this.indices[m++]=x+3}return y};Th.prototype.createTextures=function(t,e,i,r){var n,a,s,o;var h=e.length;for(o=0;o<h;++o){a=e[o];s=qn.getUid(a).toString();if(s in i){n=i[s]}else{n=xh.createTexture(r,a,Xa.CLAMP_TO_EDGE,Xa.CLAMP_TO_EDGE);i[s]=n}t[o]=n}};Th.prototype.setUpProgram=function(t,e,i,r){var n=mh.fragment;var a=mh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations){o=new yh(t,s);this.defaultLocations=o}else{o=this.defaultLocations}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,32,0);t.enableVertexAttribArray(o.a_offsets);t.vertexAttribPointer(o.a_offsets,2,Xa.FLOAT,false,32,8);t.enableVertexAttribArray(o.a_texCoord);t.vertexAttribPointer(o.a_texCoord,2,Xa.FLOAT,false,32,16);t.enableVertexAttribArray(o.a_opacity);t.vertexAttribPointer(o.a_opacity,1,Xa.FLOAT,false,32,24);t.enableVertexAttribArray(o.a_rotateWithView);t.vertexAttribPointer(o.a_rotateWithView,1,Xa.FLOAT,false,32,28);return o};Th.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_offsets);t.disableVertexAttribArray(e.a_texCoord);t.disableVertexAttribArray(e.a_opacity);t.disableVertexAttribArray(e.a_rotateWithView)};Th.prototype.drawReplay=function(t,e,i,r){var n=r?this.getHitDetectionTextures():this.getTextures();var a=r?this.hitDetectionGroupIndices:this.groupIndices;if(!Qn.isEmpty(i)){this.drawReplaySkipping(t,e,i,n,a)}else{var s,o,h;for(s=0,o=n.length,h=0;s<o;++s){t.bindTexture(Xa.TEXTURE_2D,n[s]);var l=a[s];this.drawElements(t,e,h,l);h=l}}};Th.prototype.drawReplaySkipping=function(t,e,i,r,n){var a=0;var s,o;for(s=0,o=r.length;s<o;++s){t.bindTexture(Xa.TEXTURE_2D,r[s]);var h=s>0?n[s-1]:0;var l=n[s];var u=h;var f=h;while(a<this.startIndices.length&&this.startIndices[a]<=l){var c=this.startIndicesFeature[a];var d=qn.getUid(c).toString();if(i[d]!==undefined){if(u!==f){this.drawElements(t,e,u,f)}u=a===this.startIndices.length-1?l:this.startIndices[a+1];f=u}else{f=a===this.startIndices.length-1?l:this.startIndices[a+1]}a++}if(u!==f){this.drawElements(t,e,u,f)}}};Th.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u;var f=this.startIndices.length-1;var c=this.getHitDetectionTextures();for(a=c.length-1;a>=0;--a){t.bindTexture(Xa.TEXTURE_2D,c[a]);s=a>0?this.hitDetectionGroupIndices[a-1]:0;h=this.hitDetectionGroupIndices[a];while(f>=0&&this.startIndices[f]>=s){o=this.startIndices[f];l=this.startIndicesFeature[f];u=qn.getUid(l).toString();if(i[u]===undefined&&l.getGeometry()&&(n===undefined||pa.intersects(n,l.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,o,h);var d=r(l);if(d){return d}}h=o;f--}}return undefined};Th.prototype.finish=function(t){this.anchorX=undefined;this.anchorY=undefined;this.height=undefined;this.imageHeight=undefined;this.imageWidth=undefined;this.indices=null;this.opacity=undefined;this.originX=undefined;this.originY=undefined;this.rotateWithView=undefined;this.rotation=undefined;this.scale=undefined;this.vertices=null;this.width=undefined};Th.prototype.getTextures=function(t){};Th.prototype.getHitDetectionTextures=function(){};var Ch=function(t,e){Th.call(this,t,e);this.images_=[];this.hitDetectionImages_=[];this.textures_=[];this.hitDetectionTextures_=[]};qn.inherits(Ch,Th);Ch.prototype.drawMultiPoint=function(t,e){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var i=t.getFlatCoordinates();var r=t.getStride();this.drawCoordinates(i,0,i.length,r)};Ch.prototype.drawPoint=function(t,e){this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var i=t.getFlatCoordinates();var r=t.getStride();this.drawCoordinates(i,0,i.length,r)};Ch.prototype.finish=function(t){var e=t.getGL();this.groupIndices.push(this.indices.length);this.hitDetectionGroupIndices.push(this.indices.length);this.verticesBuffer=new _h(this.vertices);var i=this.indices;this.indicesBuffer=new _h(i);var r={};this.createTextures(this.textures_,this.images_,r,e);this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,r,e);this.images_=null;this.hitDetectionImages_=null;Th.prototype.finish.call(this,t)};Ch.prototype.setImageStyle=function(t){var e=t.getAnchor();var i=t.getImage(1);var r=t.getImageSize();var n=t.getHitDetectionImage(1);var a=t.getOpacity();var s=t.getOrigin();var o=t.getRotateWithView();var h=t.getRotation();var l=t.getSize();var u=t.getScale();var f;if(this.images_.length===0){this.images_.push(i)}else{f=this.images_[this.images_.length-1];if(qn.getUid(f)!=qn.getUid(i)){this.groupIndices.push(this.indices.length);this.images_.push(i)}}if(this.hitDetectionImages_.length===0){this.hitDetectionImages_.push(n)}else{f=this.hitDetectionImages_[this.hitDetectionImages_.length-1];if(qn.getUid(f)!=qn.getUid(n)){this.hitDetectionGroupIndices.push(this.indices.length);this.hitDetectionImages_.push(n)}}this.anchorX=e[0];this.anchorY=e[1];this.height=l[1];this.imageHeight=r[1];this.imageWidth=r[0];this.opacity=a;this.originX=s[0];this.originY=s[1];this.rotation=h;this.rotateWithView=o;this.scale=u;this.width=l[0]};Ch.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_};Ch.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_};var Rh={};Rh.lineStringIsClosed=function(t,e,i,r){var n=i-r;if(t[e]===t[n]&&t[e+1]===t[n+1]&&(i-e)/r>3){return!!Aa.linearRing(t,e,i,r)}return false};var Mh={};Mh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;varying float a;varying vec2 aVertex;varying float c;uniform float m;uniform vec4 n;uniform vec2 o;uniform float p;void main(void){if(a>0.0){vec2 windowCoords=vec2((aVertex.x+1.0)/2.0*o.x*p,(aVertex.y+1.0)/2.0*o.y*p);if(length(windowCoords-gl_FragCoord.xy)>c*p){discard;}} gl_FragColor=n;float alpha=n.a*m;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");Mh.vertex=new uh(qn.DEBUG_WEBGL?"varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n":"varying float a;varying vec2 aVertex;varying float c;attribute vec2 d;attribute vec2 e;attribute vec2 f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;uniform float k;uniform float l;bool nearlyEquals(in float value,in float ref){float epsilon=0.000000000001;return value>=ref-epsilon&&value<=ref+epsilon;}void alongNormal(out vec2 offset,in vec2 nextP,in float turnDir,in float direction){vec2 dirVect=nextP-e;vec2 normal=normalize(vec2(-turnDir*dirVect.y,turnDir*dirVect.x));offset=k/2.0*normal*direction;}void miterUp(out vec2 offset,out float round,in bool isRound,in float direction){float halfWidth=k/2.0;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=f-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;round=0.0;if(isRound){round=1.0;}else if(miterLength>l+k){offset=halfWidth*tmpNormal*direction;}} bool miterDown(out vec2 offset,in vec4 projPos,in mat4 offsetMatrix,in float direction){bool degenerate=false;vec2 tangent=normalize(normalize(f-e)+normalize(e-d));vec2 normal=vec2(-tangent.y,tangent.x);vec2 dirVect=d-e;vec2 tmpNormal=normalize(vec2(-dirVect.y,dirVect.x));vec2 longOffset,shortOffset,longVertex;vec4 shortProjVertex;float halfWidth=k/2.0;if(length(f-e)>length(d-e)){longOffset=tmpNormal*direction*halfWidth;shortOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=f;shortProjVertex=h*vec4(d,0.0,1.0);}else{shortOffset=tmpNormal*direction*halfWidth;longOffset=normalize(vec2(dirVect.y,-dirVect.x))*direction*halfWidth;longVertex=d;shortProjVertex=h*vec4(f,0.0,1.0);}vec4 p1=h*vec4(longVertex,0.0,1.0)+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p2=projPos+offsetMatrix*vec4(longOffset,0.0,0.0);vec4 p3=shortProjVertex+offsetMatrix*vec4(-shortOffset,0.0,0.0);vec4 p4=shortProjVertex+offsetMatrix*vec4(shortOffset,0.0,0.0);float denom=(p4.y-p3.y)*(p2.x-p1.x)-(p4.x-p3.x)*(p2.y-p1.y);float firstU=((p4.x-p3.x)*(p1.y-p3.y)-(p4.y-p3.y)*(p1.x-p3.x))/denom;float secondU=((p2.x-p1.x)*(p1.y-p3.y)-(p2.y-p1.y)*(p1.x-p3.x))/denom;float epsilon=0.000000000001;if(firstU>epsilon&&firstU<1.0-epsilon&&secondU>epsilon&&secondU<1.0-epsilon){shortProjVertex.x=p1.x+firstU*(p2.x-p1.x);shortProjVertex.y=p1.y+firstU*(p2.y-p1.y);offset=shortProjVertex.xy;degenerate=true;}else{float miterLength=abs(halfWidth/dot(normal,tmpNormal));offset=normal*direction*miterLength;}return degenerate;}void squareCap(out vec2 offset,out float round,in bool isRound,in vec2 nextP,in float turnDir,in float direction){round=0.0;vec2 dirVect=e-nextP;vec2 firstNormal=normalize(dirVect);vec2 secondNormal=vec2(turnDir*firstNormal.y*direction,-turnDir*firstNormal.x*direction);vec2 hypotenuse=normalize(firstNormal-secondNormal);vec2 normal=vec2(turnDir*hypotenuse.y*direction,-turnDir*hypotenuse.x*direction);float length=sqrt(c*c*2.0);offset=normal*length;if(isRound){round=1.0;}} void main(void){bool degenerate=false;float direction=float(sign(g));mat4 offsetMatrix=i*j;vec2 offset;vec4 projPos=h*vec4(e,0.0,1.0);bool round=nearlyEquals(mod(g,2.0),0.0);a=0.0;c=k/2.0;aVertex=projPos.xy;if(nearlyEquals(mod(g,3.0),0.0)||nearlyEquals(mod(g,17.0),0.0)){alongNormal(offset,f,1.0,direction);}else if(nearlyEquals(mod(g,5.0),0.0)||nearlyEquals(mod(g,13.0),0.0)){alongNormal(offset,d,-1.0,direction);}else if(nearlyEquals(mod(g,23.0),0.0)){miterUp(offset,a,round,direction);}else if(nearlyEquals(mod(g,19.0),0.0)){degenerate=miterDown(offset,projPos,offsetMatrix,direction);}else if(nearlyEquals(mod(g,7.0),0.0)){squareCap(offset,a,round,f,1.0,direction);}else if(nearlyEquals(mod(g,11.0),0.0)){squareCap(offset,a,round,d,-1.0,direction);}if(!degenerate){vec4 offsets=offsetMatrix*vec4(offset,0.0,0.0);gl_Position=projPos+offsets;}else{gl_Position=vec4(offset,0.0,1.0);}}");var Sh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"h");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"i");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"j");this.u_lineWidth=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_lineWidth":"k");this.u_miterLimit=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_miterLimit":"l");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"m");this.u_color=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_color":"n");this.u_size=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_size":"o");this.u_pixelRatio=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_pixelRatio":"p");this.a_lastPos=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_lastPos":"d");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"e");this.a_nextPos=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_nextPos":"f");this.a_direction=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_direction":"g")};var Ih=function(t,e){ph.call(this,t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:undefined,miterLimit:undefined,changed:false}};qn.inherits(Ih,ph);Ih.prototype.drawCoordinates_=function(t,e,i,r){var n,a;var s=this.vertices.length;var o=this.indices.length;var h=this.state_.lineJoin==="bevel"?0:this.state_.lineJoin==="miter"?1:2;var l=this.state_.lineCap==="butt"?0:this.state_.lineCap==="square"?1:2;var u=Rh.lineStringIsClosed(t,e,i,r);var f,c,d;var p=o;var v=1;var _,g,m;for(n=e,a=i;n<a;n+=r){d=s/7;_=g;g=m||[t[n],t[n+1]];if(n===e){m=[t[n+r],t[n+r+1]];if(i-e===r*2&&fa.equals(g,m)){break}if(u){_=[t[i-r*2],t[i-r*2+1]];f=m}else{if(l){s=this.addVertices_([0,0],g,m,v*Ih.Instruction_.BEGIN_LINE_CAP*l,s);s=this.addVertices_([0,0],g,m,-v*Ih.Instruction_.BEGIN_LINE_CAP*l,s);this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=d+1;this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d+2}s=this.addVertices_([0,0],g,m,v*Ih.Instruction_.BEGIN_LINE*(l||1),s);s=this.addVertices_([0,0],g,m,-v*Ih.Instruction_.BEGIN_LINE*(l||1),s);p=s/7-1;continue}}else if(n===i-r){if(u){m=f;break}else{_=_||[0,0];s=this.addVertices_(_,g,[0,0],v*Ih.Instruction_.END_LINE*(l||1),s);s=this.addVertices_(_,g,[0,0],-v*Ih.Instruction_.END_LINE*(l||1),s);this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=p;this.indices[o++]=d+1;this.indices[o++]=d;if(l){s=this.addVertices_(_,g,[0,0],v*Ih.Instruction_.END_LINE_CAP*l,s);s=this.addVertices_(_,g,[0,0],-v*Ih.Instruction_.END_LINE_CAP*l,s);this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=d+1;this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d+2}break}}else{m=[t[n+r],t[n+r+1]]}c=vh.triangleIsCounterClockwise(_[0],_[1],g[0],g[1],m[0],m[1])?-1:1;s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_FIRST*(h||1),s);s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_SECOND*(h||1),s);s=this.addVertices_(_,g,m,-c*Ih.Instruction_.MITER_BOTTOM*(h||1),s);if(n>e){this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=d+2;this.indices[o++]=d;this.indices[o++]=v*c>0?p:p-1}this.indices[o++]=d;this.indices[o++]=d+2;this.indices[o++]=d+1;p=d+2;v=c;if(h){s=this.addVertices_(_,g,m,c*Ih.Instruction_.MITER_TOP*h,s);this.indices[o++]=d+1;this.indices[o++]=d+3;this.indices[o++]=d}}if(u){d=d||s/7;c=Ba.linearRingIsClockwise([_[0],_[1],g[0],g[1],m[0],m[1]],0,6,2)?1:-1;s=this.addVertices_(_,g,m,c*Ih.Instruction_.BEVEL_FIRST*(h||1),s);s=this.addVertices_(_,g,m,-c*Ih.Instruction_.MITER_BOTTOM*(h||1),s);this.indices[o++]=d;this.indices[o++]=p-1;this.indices[o++]=p;this.indices[o++]=d+1;this.indices[o++]=d;this.indices[o++]=v*c>0?p:p-1}};Ih.prototype.addVertices_=function(t,e,i,r,n){this.vertices[n++]=t[0];this.vertices[n++]=t[1];this.vertices[n++]=e[0];this.vertices[n++]=e[1];this.vertices[n++]=i[0];this.vertices[n++]=i[1];this.vertices[n++]=r;return n};Ih.prototype.isValid_=function(t,e,i,r){var n=i-e;if(n<r*2){return false}else if(n===r*2){var a=[t[e],t[e+1]];var s=[t[e+r],t[e+r+1]];return!fa.equals(a,s)}return true};Ih.prototype.drawLineString=function(t,e){var i=t.getFlatCoordinates();var r=t.getStride();if(this.isValid_(i,0,i.length,r)){i=ga.translate(i,0,i.length,r,-this.origin[0],-this.origin[1]);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);this.drawCoordinates_(i,0,i.length,r)}};Ih.prototype.drawMultiLineString=function(t,e){var i=this.indices.length;var r=t.getEnds();r.unshift(0);var n=t.getFlatCoordinates();var a=t.getStride();var s,o;if(r.length>1){for(s=1,o=r.length;s<o;++s){if(this.isValid_(n,r[s-1],r[s],a)){var h=ga.translate(n,r[s-1],r[s],a,-this.origin[0],-this.origin[1]);this.drawCoordinates_(h,0,h.length,a)}}}if(this.indices.length>i){this.startIndices.push(i);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(i);this.state_.changed=false}}};Ih.prototype.drawPolygonCoordinates=function(t,e,i){if(!Rh.lineStringIsClosed(t,0,t.length,i)){t.push(t[0]);t.push(t[1])}this.drawCoordinates_(t,0,t.length,i);if(e.length){var r,n;for(r=0,n=e.length;r<n;++r){if(!Rh.lineStringIsClosed(e[r],0,e[r].length,i)){e[r].push(e[r][0]);e[r].push(e[r][1])}this.drawCoordinates_(e[r],0,e[r].length,i)}}};Ih.prototype.setPolygonStyle=function(t,e){var i=e===undefined?this.indices.length:e;this.startIndices.push(i);this.startIndicesFeature.push(t);if(this.state_.changed){this.styleIndices_.push(i);this.state_.changed=false}};Ih.prototype.getCurrentIndex=function(){return this.indices.length};Ih.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};Ih.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;return function(){t.deleteBuffer(e);t.deleteBuffer(i)}};Ih.prototype.setUpProgram=function(t,e,i,r){var n,a;n=Mh.fragment;a=Mh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new Sh(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_lastPos);t.vertexAttribPointer(o.a_lastPos,2,Xa.FLOAT,false,28,0);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,28,8);t.enableVertexAttribArray(o.a_nextPos);t.vertexAttribPointer(o.a_nextPos,2,Xa.FLOAT,false,28,16);t.enableVertexAttribArray(o.a_direction);t.vertexAttribPointer(o.a_direction,1,Xa.FLOAT,false,28,24);t.uniform2fv(o.u_size,i);t.uniform1f(o.u_pixelRatio,r);return o};Ih.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_lastPos);t.disableVertexAttribArray(e.a_position);t.disableVertexAttribArray(e.a_nextPos);t.disableVertexAttribArray(e.a_direction)};Ih.prototype.drawReplay=function(t,e,i,r){var n=t.getParameter(t.DEPTH_FUNC);var a=t.getParameter(t.DEPTH_WRITEMASK);if(!r){t.enable(t.DEPTH_TEST);t.depthMask(true);t.depthFunc(t.NOTEQUAL)}if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var s,o,h,l;h=this.startIndices[this.startIndices.length-1];for(s=this.styleIndices_.length-1;s>=0;--s){o=this.styleIndices_[s];l=this.styles_[s];this.setStrokeStyle_(t,l[0],l[1],l[2]);this.drawElements(t,e,o,h);t.clear(t.DEPTH_BUFFER_BIT);h=o}}if(!r){t.disable(t.DEPTH_TEST);t.clear(t.DEPTH_BUFFER_BIT);t.depthMask(a);t.depthFunc(n)}};Ih.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setStrokeStyle_(t,s[0],s[1],s[2]);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}n=a=o}};Ih.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setStrokeStyle_(t,h[0],h[1],h[2]);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};Ih.prototype.setStrokeStyle_=function(t,e,i,r){t.uniform4fv(this.defaultLocations_.u_color,e);t.uniform1f(this.defaultLocations_.u_lineWidth,i);t.uniform1f(this.defaultLocations_.u_miterLimit,r)};Ih.prototype.setFillStrokeStyle=function(t,e){var i=e.getLineCap();this.state_.lineCap=i!==undefined?i:vh.defaultLineCap;var r=e.getLineDash();this.state_.lineDash=r?r:vh.defaultLineDash;var n=e.getLineDashOffset();this.state_.lineDashOffset=n?n:vh.defaultLineDashOffset;var a=e.getLineJoin();this.state_.lineJoin=a!==undefined?a:vh.defaultLineJoin;var s=e.getColor();if(!(s instanceof CanvasGradient)&&!(s instanceof CanvasPattern)){s=co.asArray(s).map((function(t,e){return e!=3?t/255:t}))||vh.defaultStrokeStyle}else{s=vh.defaultStrokeStyle}var o=e.getWidth();o=o!==undefined?o:vh.defaultLineWidth;var h=e.getMiterLimit();h=h!==undefined?h:vh.defaultMiterLimit;if(!this.state_.strokeColor||!fa.equals(this.state_.strokeColor,s)||this.state_.lineWidth!==o||this.state_.miterLimit!==h){this.state_.changed=true;this.state_.strokeColor=s;this.state_.lineWidth=o;this.state_.miterLimit=h;this.styles_.push([s,o,h])}};Ih.Instruction_={ROUND:2,BEGIN_LINE:3,END_LINE:5,BEGIN_LINE_CAP:7,END_LINE_CAP:11,BEVEL_FIRST:13,BEVEL_SECOND:17,MITER_BOTTOM:19,MITER_TOP:23};var Lh={};Lh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n":"precision mediump float;uniform vec4 e;uniform float f;void main(void){gl_FragColor=e;float alpha=e.a*f;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}");Lh.vertex=new uh(qn.DEBUG_WEBGL?"\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n":"attribute vec2 a;uniform mat4 b;uniform mat4 c;uniform mat4 d;void main(void){gl_Position=b*vec4(a,0.0,1.0);}");var Ah=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"b");this.u_offsetScaleMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetScaleMatrix":"c");this.u_offsetRotateMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_offsetRotateMatrix":"d");this.u_color=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_color":"e");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"f");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"a")};var wh=function(t){var e=t||{};this.color_=e.color!==undefined?e.color:null;this.lineCap_=e.lineCap;this.lineDash_=e.lineDash!==undefined?e.lineDash:null;this.lineDashOffset_=e.lineDashOffset;this.lineJoin_=e.lineJoin;this.miterLimit_=e.miterLimit;this.width_=e.width;this.checksum_=undefined};wh.prototype.clone=function(){var t=this.getColor();return new wh({color:t&&t.slice?t.slice():t||undefined,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():undefined,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})};wh.prototype.getColor=function(){return this.color_};wh.prototype.getLineCap=function(){return this.lineCap_};wh.prototype.getLineDash=function(){return this.lineDash_};wh.prototype.getLineDashOffset=function(){return this.lineDashOffset_};wh.prototype.getLineJoin=function(){return this.lineJoin_};wh.prototype.getMiterLimit=function(){return this.miterLimit_};wh.prototype.getWidth=function(){return this.width_};wh.prototype.setColor=function(t){this.color_=t;this.checksum_=undefined};wh.prototype.setLineCap=function(t){this.lineCap_=t;this.checksum_=undefined};wh.prototype.setLineDash=function(t){this.lineDash_=t;this.checksum_=undefined};wh.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t;this.checksum_=undefined};wh.prototype.setLineJoin=function(t){this.lineJoin_=t;this.checksum_=undefined};wh.prototype.setMiterLimit=function(t){this.miterLimit_=t;this.checksum_=undefined};wh.prototype.setWidth=function(t){this.width_=t;this.checksum_=undefined};wh.prototype.getChecksum=function(){if(this.checksum_===undefined){this.checksum_="s";if(this.color_){if(typeof this.color_==="string"){this.checksum_+=this.color_}else{this.checksum_+=qn.getUid(this.color_).toString()}}else{this.checksum_+="-"}this.checksum_+=","+(this.lineCap_!==undefined?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(this.lineDashOffset_!==undefined?this.lineDashOffset_:"-")+","+(this.lineJoin_!==undefined?this.lineJoin_:"-")+","+(this.miterLimit_!==undefined?this.miterLimit_.toString():"-")+","+(this.width_!==undefined?this.width_.toString():"-")}return this.checksum_};var Oh=function(t){this.first_=undefined;this.last_=undefined;this.head_=undefined;this.circular_=t===undefined?true:t;this.length_=0};Oh.prototype.insertItem=function(t){var e={prev:undefined,next:undefined,data:t};var i=this.head_;if(!i){this.first_=e;this.last_=e;if(this.circular_){e.next=e;e.prev=e}}else{var r=i.next;e.prev=i;e.next=r;i.next=e;if(r){r.prev=e}if(i===this.last_){this.last_=e}}this.head_=e;this.length_++};Oh.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next;var i=t.prev;if(e){e.prev=i}if(i){i.next=e}this.head_=e||i;if(this.first_===this.last_){this.head_=undefined;this.first_=undefined;this.last_=undefined}else if(this.first_===t){this.first_=this.head_}else if(this.last_===t){this.last_=i?this.head_.prev:this.head_}this.length_--}};Oh.prototype.firstItem=function(){this.head_=this.first_;if(this.head_){return this.head_.data}return undefined};Oh.prototype.lastItem=function(){this.head_=this.last_;if(this.head_){return this.head_.data}return undefined};Oh.prototype.nextItem=function(){if(this.head_&&this.head_.next){this.head_=this.head_.next;return this.head_.data}return undefined};Oh.prototype.getNextItem=function(){if(this.head_&&this.head_.next){return this.head_.next.data}return undefined};Oh.prototype.prevItem=function(){if(this.head_&&this.head_.prev){this.head_=this.head_.prev;return this.head_.data}return undefined};Oh.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev){return this.head_.prev.data}return undefined};Oh.prototype.getCurrItem=function(){if(this.head_){return this.head_.data}return undefined};Oh.prototype.setFirstItem=function(){if(this.circular_&&this.head_){this.first_=this.head_;this.last_=this.head_.prev}};Oh.prototype.concat=function(t){if(t.head_){if(this.head_){var e=this.head_.next;this.head_.next=t.first_;t.first_.prev=this.head_;e.prev=t.last_;t.last_.next=e;this.length_+=t.length_}else{this.head_=t.head_;this.first_=t.first_;this.last_=t.last_;this.length_=t.length_}t.head_=undefined;t.first_=undefined;t.last_=undefined;t.length_=0}};Oh.prototype.getLength=function(){return this.length_};var bh=function(t){this.rbush_=Lo(t);this.items_={}};bh.prototype.insert=function(t,e){var i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i);this.items_[qn.getUid(e)]=i};bh.prototype.load=function(t,e){var i=new Array(e.length);for(var r=0,n=e.length;r<n;r++){var a=t[r];var s=e[r];var o={minX:a[0],minY:a[1],maxX:a[2],maxY:a[3],value:s};i[r]=o;this.items_[qn.getUid(s)]=o}this.rbush_.load(i)};bh.prototype.remove=function(t){var e=qn.getUid(t);var i=this.items_[e];delete this.items_[e];return this.rbush_.remove(i)!==null};bh.prototype.update=function(t,e){var i=this.items_[qn.getUid(e)];var r=[i.minX,i.minY,i.maxX,i.maxY];if(!pa.equals(r,t)){this.remove(e);this.insert(t,e)}};bh.prototype.getAll=function(){var t=this.rbush_.all();return t.map((function(t){return t.value}))};bh.prototype.getInExtent=function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};var i=this.rbush_.search(e);return i.map((function(t){return t.value}))};bh.prototype.forEach=function(t,e){return this.forEach_(this.getAll(),t,e)};bh.prototype.forEachInExtent=function(t,e,i){return this.forEach_(this.getInExtent(t),e,i)};bh.prototype.forEach_=function(t,e,i){var r;for(var n=0,a=t.length;n<a;n++){r=e.call(i,t[n]);if(r){return r}}return r};bh.prototype.isEmpty=function(){return Qn.isEmpty(this.items_)};bh.prototype.clear=function(){this.rbush_.clear();this.items_={}};bh.prototype.getExtent=function(t){var e=this.rbush_.data;return pa.createOrUpdate(e.minX,e.minY,e.maxX,e.maxY,t)};bh.prototype.concat=function(t){this.rbush_.load(t.rbush_.all());for(var e in t.items_){this.items_[e|0]=t.items_[e|0]}};var Ph=function(t,e){ph.call(this,t,e);this.lineStringReplay=new Ih(t,e);this.defaultLocations_=null;this.styles_=[];this.styleIndices_=[];this.state_={fillColor:null,changed:false}};qn.inherits(Ph,ph);Ph.prototype.drawCoordinates_=function(t,e,i){var r=new Oh;var n=new bh;this.processFlatCoordinates_(t,i,r,n,true);var a=this.getMaxCoords_(r);if(e.length){var s,o;var h=[];for(s=0,o=e.length;s<o;++s){var l={list:new Oh,maxCoords:undefined,rtree:new bh};h.push(l);this.processFlatCoordinates_(e[s],i,l.list,l.rtree,false);this.classifyPoints_(l.list,l.rtree,true);l.maxCoords=this.getMaxCoords_(l.list)}h.sort((function(t,e){return e.maxCoords[0]===t.maxCoords[0]?t.maxCoords[1]-e.maxCoords[1]:e.maxCoords[0]-t.maxCoords[0]}));for(s=0;s<h.length;++s){var u=h[s].list;var f=u.firstItem();var c=f;var d;do{if(this.getIntersections_(c,n).length){d=true;break}c=u.nextItem()}while(f!==c);if(!d){if(this.bridgeHole_(u,h[s].maxCoords[0],r,a[0],n)){n.concat(h[s].rtree);this.classifyPoints_(r,n,false)}}}}else{this.classifyPoints_(r,n,false)}this.triangulate_(r,n)};Ph.prototype.processFlatCoordinates_=function(t,e,i,r,n){var a=Ba.linearRingIsClockwise(t,0,t.length,e);var s,o;var h=this.vertices.length/2;var l;var u;var f;var c=[];var d=[];if(n===a){l=this.createPoint_(t[0],t[1],h++);u=l;for(s=e,o=t.length;s<o;s+=e){f=this.createPoint_(t[s],t[s+1],h++);d.push(this.insertItem_(u,f,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)]);u=f}d.push(this.insertItem_(f,l,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)])}else{var p=t.length-e;l=this.createPoint_(t[p],t[p+1],h++);u=l;for(s=p-e,o=0;s>=o;s-=e){f=this.createPoint_(t[s],t[s+1],h++);d.push(this.insertItem_(u,f,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)]);u=f}d.push(this.insertItem_(f,l,i));c.push([Math.min(u.x,f.x),Math.min(u.y,f.y),Math.max(u.x,f.x),Math.max(u.y,f.y)])}r.load(c,d)};Ph.prototype.getMaxCoords_=function(t){var e=t.firstItem();var i=e;var r=[i.p0.x,i.p0.y];do{i=t.nextItem();if(i.p0.x>r[0]){r=[i.p0.x,i.p0.y]}}while(i!==e);return r};Ph.prototype.classifyPoints_=function(t,e,i){var r=t.firstItem();var n=r;var a=t.nextItem();var s=false;do{var o=i?vh.triangleIsCounterClockwise(a.p1.x,a.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):vh.triangleIsCounterClockwise(n.p0.x,n.p0.y,n.p1.x,n.p1.y,a.p1.x,a.p1.y);if(o===undefined){this.removeItem_(n,a,t,e);s=true;if(a===r){r=t.getNextItem()}a=n;t.prevItem()}else if(n.p1.reflex!==o){n.p1.reflex=o;s=true}n=a;a=t.nextItem()}while(n!==r);return s};Ph.prototype.bridgeHole_=function(t,e,i,r,n){var a=t.firstItem();while(a.p1.x!==e){a=t.nextItem()}var s=a.p1;var o={x:r,y:s.y,i:-1};var h=Infinity;var l,u,f;var c;var d=this.getIntersections_({p0:s,p1:o},n,true);for(l=0,u=d.length;l<u;++l){var p=d[l];var v=this.calculateIntersection_(s,o,p.p0,p.p1,true);var _=Math.abs(s.x-v[0]);if(_<h&&vh.triangleIsCounterClockwise(s.x,s.y,p.p0.x,p.p0.y,p.p1.x,p.p1.y)!==undefined){h=_;c={x:v[0],y:v[1],i:-1};a=p}}if(h===Infinity){return false}f=a.p1;if(h>0){var g=this.getPointsInTriangle_(s,c,a.p1,n);if(g.length){var m=Infinity;for(l=0,u=g.length;l<u;++l){var y=g[l];var E=Math.atan2(s.y-y.y,o.x-y.x);if(E<m||E===m&&y.x<f.x){m=E;f=y}}}}a=i.firstItem();while(a.p1.x!==f.x||a.p1.y!==f.y){a=i.nextItem()}var x={x:s.x,y:s.y,i:s.i,reflex:undefined};var T={x:a.p1.x,y:a.p1.y,i:a.p1.i,reflex:undefined};t.getNextItem().p0=x;this.insertItem_(s,a.p1,t,n);this.insertItem_(T,x,t,n);a.p1=T;t.setFirstItem();i.concat(t);return true};Ph.prototype.triangulate_=function(t,e){var i=false;var r=this.isSimple_(t,e);while(t.getLength()>3){if(r){if(!this.clipEars_(t,e,r,i)){if(!this.classifyPoints_(t,e,i)){if(!this.resolveSelfIntersections_(t,e,true)){break}}}}else{if(!this.clipEars_(t,e,r,i)){if(!this.classifyPoints_(t,e,i)){if(!this.resolveSelfIntersections_(t,e)){r=this.isSimple_(t,e);if(!r){this.splitPolygon_(t,e);break}else{i=!this.isClockwise_(t);this.classifyPoints_(t,e,i)}}}}}}if(t.getLength()===3){var n=this.indices.length;this.indices[n++]=t.getPrevItem().p0.i;this.indices[n++]=t.getCurrItem().p0.i;this.indices[n++]=t.getNextItem().p0.i}};Ph.prototype.clipEars_=function(t,e,i,r){var n=this.indices.length;var a=t.firstItem();var s=t.getPrevItem();var o=a;var h=t.nextItem();var l=t.getNextItem();var u,f,c;var d=false;do{u=o.p0;f=o.p1;c=h.p1;if(f.reflex===false){var p;if(i){p=this.getPointsInTriangle_(u,f,c,e,true).length===0}else{p=r?this.diagonalIsInside_(l.p1,c,f,u,s.p0):this.diagonalIsInside_(s.p0,u,f,c,l.p1)}if((i||this.getIntersections_({p0:u,p1:c},e).length===0)&&p){if(i||u.reflex===false||c.reflex===false||Ba.linearRingIsClockwise([s.p0.x,s.p0.y,u.x,u.y,f.x,f.y,c.x,c.y,l.p1.x,l.p1.y],0,10,2)===!r){this.indices[n++]=u.i;this.indices[n++]=f.i;this.indices[n++]=c.i;this.removeItem_(o,h,t,e);if(h===a){a=l}d=true}}}s=t.getPrevItem();o=t.getCurrItem();h=t.nextItem();l=t.getNextItem()}while(o!==a&&t.getLength()>3);return d};Ph.prototype.resolveSelfIntersections_=function(t,e,i){var r=t.firstItem();t.nextItem();var n=r;var a=t.nextItem();var s=false;do{var o=this.calculateIntersection_(n.p0,n.p1,a.p0,a.p1,i);if(o){var h=false;var l=this.vertices.length;var u=this.indices.length;var f=l/2;var c=t.prevItem();t.removeItem();e.remove(c);h=c===r;var d;if(i){if(o[0]===n.p0.x&&o[1]===n.p0.y){t.prevItem();d=n.p0;a.p0=d;e.remove(n);h=h||n===r}else{d=a.p1;n.p1=d;e.remove(a);h=h||a===r}t.removeItem()}else{d=this.createPoint_(o[0],o[1],f);n.p1=d;a.p0=d;e.update([Math.min(n.p0.x,n.p1.x),Math.min(n.p0.y,n.p1.y),Math.max(n.p0.x,n.p1.x),Math.max(n.p0.y,n.p1.y)],n);e.update([Math.min(a.p0.x,a.p1.x),Math.min(a.p0.y,a.p1.y),Math.max(a.p0.x,a.p1.x),Math.max(a.p0.y,a.p1.y)],a)}this.indices[u++]=c.p0.i;this.indices[u++]=c.p1.i;this.indices[u++]=d.i;s=true;if(h){break}}n=t.getPrevItem();a=t.nextItem()}while(n!==r);return s};Ph.prototype.isSimple_=function(t,e){var i=t.firstItem();var r=i;do{if(this.getIntersections_(r,e).length){return false}r=t.nextItem()}while(r!==i);return true};Ph.prototype.isClockwise_=function(t){var e=t.getLength()*2;var i=new Array(e);var r=t.firstItem();var n=r;var a=0;do{i[a++]=n.p0.x;i[a++]=n.p0.y;n=t.nextItem()}while(n!==r);return Ba.linearRingIsClockwise(i,0,e,2)};Ph.prototype.splitPolygon_=function(t,e){var i=t.firstItem();var r=i;do{var n=this.getIntersections_(r,e);if(n.length){var a=n[0];var s=this.vertices.length/2;var o=this.calculateIntersection_(r.p0,r.p1,a.p0,a.p1);var h=this.createPoint_(o[0],o[1],s);var l=new Oh;var u=new bh;this.insertItem_(h,r.p1,l,u);r.p1=h;e.update([Math.min(r.p0.x,h.x),Math.min(r.p0.y,h.y),Math.max(r.p0.x,h.x),Math.max(r.p0.y,h.y)],r);var f=t.nextItem();while(f!==a){this.insertItem_(f.p0,f.p1,l,u);e.remove(f);t.removeItem();f=t.getCurrItem()}this.insertItem_(a.p0,h,l,u);a.p0=h;e.update([Math.min(a.p1.x,h.x),Math.min(a.p1.y,h.y),Math.max(a.p1.x,h.x),Math.max(a.p1.y,h.y)],a);this.classifyPoints_(t,e,false);this.triangulate_(t,e);this.classifyPoints_(l,u,false);this.triangulate_(l,u);break}r=t.nextItem()}while(r!==i)};Ph.prototype.createPoint_=function(t,e,i){var r=this.vertices.length;this.vertices[r++]=t;this.vertices[r++]=e;var n={x:t,y:e,i:i,reflex:undefined};return n};Ph.prototype.insertItem_=function(t,e,i,r){var n={p0:t,p1:e};i.insertItem(n);if(r){r.insert([Math.min(t.x,e.x),Math.min(t.y,e.y),Math.max(t.x,e.x),Math.max(t.y,e.y)],n)}return n};Ph.prototype.removeItem_=function(t,e,i,r){if(i.getCurrItem()===e){i.removeItem();t.p1=e.p1;r.remove(e);r.update([Math.min(t.p0.x,t.p1.x),Math.min(t.p0.y,t.p1.y),Math.max(t.p0.x,t.p1.x),Math.max(t.p0.y,t.p1.y)],t)}};Ph.prototype.getPointsInTriangle_=function(t,e,i,r,n){var a,s,o,h;var l=[];var u=r.getInExtent([Math.min(t.x,e.x,i.x),Math.min(t.y,e.y,i.y),Math.max(t.x,e.x,i.x),Math.max(t.y,e.y,i.y)]);for(a=0,s=u.length;a<s;++a){for(o in u[a]){h=u[a][o];if(typeof h==="object"&&(!n||h.reflex)){if((h.x!==t.x||h.y!==t.y)&&(h.x!==e.x||h.y!==e.y)&&(h.x!==i.x||h.y!==i.y)&&l.indexOf(h)===-1&&Na.linearRingContainsXY([t.x,t.y,e.x,e.y,i.x,i.y],0,6,2,h.x,h.y)){l.push(h)}}}}return l};Ph.prototype.getIntersections_=function(t,e,i){var r=t.p0;var n=t.p1;var a=e.getInExtent([Math.min(r.x,n.x),Math.min(r.y,n.y),Math.max(r.x,n.x),Math.max(r.y,n.y)]);var s=[];var o,h;for(o=0,h=a.length;o<h;++o){var l=a[o];if(t!==l&&(i||l.p0!==n||l.p1!==r)&&this.calculateIntersection_(r,n,l.p0,l.p1,i)){s.push(l)}}return s};Ph.prototype.calculateIntersection_=function(t,e,i,r,n){var a=(r.y-i.y)*(e.x-t.x)-(r.x-i.x)*(e.y-t.y);if(a!==0){var s=((r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x))/a;var o=((e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x))/a;if(!n&&s>vh.EPSILON&&s<1-vh.EPSILON&&o>vh.EPSILON&&o<1-vh.EPSILON||n&&s>=0&&s<=1&&o>=0&&o<=1){return[t.x+s*(e.x-t.x),t.y+s*(e.y-t.y)]}}return undefined};Ph.prototype.diagonalIsInside_=function(t,e,i,r,n){if(e.reflex===undefined||r.reflex===undefined){return false}var a=(i.x-r.x)*(e.y-r.y)>(i.y-r.y)*(e.x-r.x);var s=(n.x-r.x)*(e.y-r.y)<(n.y-r.y)*(e.x-r.x);var o=(t.x-e.x)*(r.y-e.y)>(t.y-e.y)*(r.x-e.x);var h=(i.x-e.x)*(r.y-e.y)<(i.y-e.y)*(r.x-e.x);var l=r.reflex?s||a:s&&a;var u=e.reflex?h||o:h&&o;return l&&u};Ph.prototype.drawMultiPolygon=function(t,e){var i=t.getEndss();var r=t.getStride();var n=this.indices.length;var a=this.lineStringReplay.getCurrentIndex();var s=t.getFlatCoordinates();var o,h,l,u;var f=0;for(o=0,h=i.length;o<h;++o){var c=i[o];if(c.length>0){var d=ga.translate(s,f,c[0],r,-this.origin[0],-this.origin[1]);if(d.length){var p=[];var v;for(l=1,u=c.length;l<u;++l){if(c[l]!==c[l-1]){v=ga.translate(s,c[l-1],c[l],r,-this.origin[0],-this.origin[1]);p.push(v)}}this.lineStringReplay.drawPolygonCoordinates(d,p,r);this.drawCoordinates_(d,p,r)}}f=c[c.length-1]}if(this.indices.length>n){this.startIndices.push(n);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(n);this.state_.changed=false}}if(this.lineStringReplay.getCurrentIndex()>a){this.lineStringReplay.setPolygonStyle(e,a)}};Ph.prototype.drawPolygon=function(t,e){var i=t.getEnds();var r=t.getStride();if(i.length>0){var n=t.getFlatCoordinates().map(Number);var a=ga.translate(n,0,i[0],r,-this.origin[0],-this.origin[1]);if(a.length){var s=[];var o,h,l;for(o=1,h=i.length;o<h;++o){if(i[o]!==i[o-1]){l=ga.translate(n,i[o-1],i[o],r,-this.origin[0],-this.origin[1]);s.push(l)}}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);if(this.state_.changed){this.styleIndices_.push(this.indices.length);this.state_.changed=false}this.lineStringReplay.setPolygonStyle(e);this.lineStringReplay.drawPolygonCoordinates(a,s,r);this.drawCoordinates_(a,s,r)}}};Ph.prototype.finish=function(t){this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);this.startIndices.push(this.indices.length);this.lineStringReplay.finish(t);if(this.styleIndices_.length===0&&this.styles_.length>0){this.styles_=[]}this.vertices=null;this.indices=null};Ph.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer;var i=this.indicesBuffer;var r=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(e);t.deleteBuffer(i);r()}};Ph.prototype.setUpProgram=function(t,e,i,r){var n,a;n=Lh.fragment;a=Lh.vertex;var s=e.getProgram(n,a);var o;if(!this.defaultLocations_){o=new Ah(t,s);this.defaultLocations_=o}else{o=this.defaultLocations_}e.useProgram(s);t.enableVertexAttribArray(o.a_position);t.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,8,0);return o};Ph.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position)};Ph.prototype.drawReplay=function(t,e,i,r){var n=t.getParameter(t.DEPTH_FUNC);var a=t.getParameter(t.DEPTH_WRITEMASK);if(!r){t.enable(t.DEPTH_TEST);t.depthMask(true);t.depthFunc(t.NOTEQUAL)}if(!Qn.isEmpty(i)){this.drawReplaySkipping_(t,e,i)}else{var s,o,h,l;h=this.startIndices[this.startIndices.length-1];for(s=this.styleIndices_.length-1;s>=0;--s){o=this.styleIndices_[s];l=this.styles_[s];this.setFillStyle_(t,l);this.drawElements(t,e,o,h);h=o}}if(!r){t.disable(t.DEPTH_TEST);t.clear(t.DEPTH_BUFFER_BIT);t.depthMask(a);t.depthFunc(n)}};Ph.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var a,s,o,h,l,u,f,c;c=this.startIndices.length-2;o=this.startIndices[c+1];for(a=this.styleIndices_.length-1;a>=0;--a){h=this.styles_[a];this.setFillStyle_(t,h);l=this.styleIndices_[a];while(c>=0&&this.startIndices[c]>=l){s=this.startIndices[c];u=this.startIndicesFeature[c];f=qn.getUid(u).toString();if(i[f]===undefined&&u.getGeometry()&&(n===undefined||pa.intersects(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);this.drawElements(t,e,s,o);var d=r(u);if(d){return d}}c--;o=s}}return undefined};Ph.prototype.drawReplaySkipping_=function(t,e,i){var r,n,a,s,o,h,l,u,f;u=this.startIndices.length-2;a=n=this.startIndices[u+1];for(r=this.styleIndices_.length-1;r>=0;--r){s=this.styles_[r];this.setFillStyle_(t,s);o=this.styleIndices_[r];while(u>=0&&this.startIndices[u]>=o){f=this.startIndices[u];h=this.startIndicesFeature[u];l=qn.getUid(h).toString();if(i[l]){if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}a=f}u--;n=f}if(n!==a){this.drawElements(t,e,n,a);t.clear(t.DEPTH_BUFFER_BIT)}n=a=o}};Ph.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_color,e)};Ph.prototype.setFillStrokeStyle=function(t,e){var i=t?t.getColor():[0,0,0,0];if(!(i instanceof CanvasGradient)&&!(i instanceof CanvasPattern)){i=co.asArray(i).map((function(t,e){return e!=3?t/255:t}))||vh.defaultFillStyle}else{i=vh.defaultFillStyle}if(!this.state_.fillColor||!fa.equals(i,this.state_.fillColor)){this.state_.fillColor=i;this.state_.changed=true;this.styles_.push(i)}if(e){this.lineStringReplay.setFillStrokeStyle(null,e)}else{var r=new wh({color:[0,0,0,0],lineWidth:0});this.lineStringReplay.setFillStrokeStyle(null,r)}};var Dh=function(t,e){this.space_=e;this.emptyBlocks_=[{x:0,y:0,width:t,height:t}];this.entries_={};this.context_=Ts.createCanvasContext2D(t,t);this.canvas_=this.context_.canvas};Dh.prototype.get=function(t){return this.entries_[t]||null};Dh.prototype.add=function(t,e,i,r,n){var a,s,o;for(s=0,o=this.emptyBlocks_.length;s<o;++s){a=this.emptyBlocks_[s];if(a.width>=e+this.space_&&a.height>=i+this.space_){var h={offsetX:a.x+this.space_,offsetY:a.y+this.space_,image:this.canvas_};this.entries_[t]=h;r.call(n,this.context_,a.x+this.space_,a.y+this.space_);this.split_(s,a,e+this.space_,i+this.space_);return h}}return null};Dh.prototype.split_=function(t,e,i,r){var n=e.width-i;var a=e.height-r;var s;var o;if(n>a){s={x:e.x+i,y:e.y,width:e.width-i,height:e.height};o={x:e.x,y:e.y+r,width:i,height:e.height-r};this.updateBlocks_(t,s,o)}else{s={x:e.x+i,y:e.y,width:e.width-i,height:r};o={x:e.x,y:e.y+r,width:e.width,height:e.height-r};this.updateBlocks_(t,s,o)}};Dh.prototype.updateBlocks_=function(t,e,i){var r=[t,1];if(e.width>0&&e.height>0){r.push(e)}if(i.width>0&&i.height>0){r.push(i)}this.emptyBlocks_.splice.apply(this.emptyBlocks_,r)};var Fh=function(t){var e=t||{};this.currentSize_=e.initialSize!==undefined?e.initialSize:qn.INITIAL_ATLAS_SIZE;this.maxSize_=e.maxSize!==undefined?e.maxSize:qn.MAX_ATLAS_SIZE!=-1?qn.MAX_ATLAS_SIZE:qn.WEBGL_MAX_TEXTURE_SIZE!==undefined?qn.WEBGL_MAX_TEXTURE_SIZE:2048;this.space_=e.space!==undefined?e.space:1;this.atlases_=[new Dh(this.currentSize_,this.space_)];this.currentHitSize_=this.currentSize_;this.hitAtlases_=[new Dh(this.currentHitSize_,this.space_)]};Fh.prototype.getInfo=function(t){var e=this.getInfo_(this.atlases_,t);if(!e){return null}var i=this.getInfo_(this.hitAtlases_,t);return this.mergeInfos_(e,i)};Fh.prototype.getInfo_=function(t,e){var i,r,n,a;for(n=0,a=t.length;n<a;++n){i=t[n];r=i.get(e);if(r){return r}}return null};Fh.prototype.mergeInfos_=function(t,e){return{offsetX:t.offsetX,offsetY:t.offsetY,image:t.image,hitImage:e.image}};Fh.prototype.add=function(t,e,i,r,n,a){if(e+this.space_>this.maxSize_||i+this.space_>this.maxSize_){return null}var s=this.add_(false,t,e,i,r,a);if(!s){return null}var o=n!==undefined?n:qn.nullFunction;var h=this.add_(true,t,e,i,o,a);return this.mergeInfos_(s,h)};Fh.prototype.add_=function(t,e,i,r,n,a){var s=t?this.hitAtlases_:this.atlases_;var o,h,l,u;for(l=0,u=s.length;l<u;++l){o=s[l];h=o.add(e,i,r,n,a);if(h){return h}else if(!h&&l===u-1){var f;if(t){f=Math.min(this.currentHitSize_*2,this.maxSize_);this.currentHitSize_=f}else{f=Math.min(this.currentSize_*2,this.maxSize_);this.currentSize_=f}o=new Dh(f,this.space_);s.push(o);++u}}return null};var Nh=function(t,e){Th.call(this,t,e);this.images_=[];this.textures_=[];this.measureCanvas_=Ts.createCanvasContext2D(0,0).canvas;this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:0,miterLimit:undefined,fillColor:null,font:undefined,scale:undefined};this.text_="";this.textAlign_=undefined;this.textBaseline_=undefined;this.offsetX_=undefined;this.offsetY_=undefined;this.atlases_={};this.currAtlas_=undefined;this.scale=1;this.opacity=1};qn.inherits(Nh,Th);Nh.prototype.drawText=function(t,e){if(this.text_){var i=null;var r=0;var n=2;var a=2;switch(t.getType()){case la.POINT:case la.MULTI_POINT:i=t.getFlatCoordinates();n=i.length;a=t.getStride();break;case la.CIRCLE:i=t.getCenter();break;case la.LINE_STRING:i=t.getFlatMidpoint();break;case la.MULTI_LINE_STRING:i=t.getFlatMidpoints();n=i.length;break;case la.POLYGON:i=t.getFlatInteriorPoint();break;case la.MULTI_POLYGON:i=t.getFlatInteriorPoints();n=i.length;break}this.startIndices.push(this.indices.length);this.startIndicesFeature.push(e);var s=this.currAtlas_;var o=this.text_.split("\n");var h=this.getTextSize_(o);var l,u,f,c,d,p,v,_;var g=Math.round(h[0]*this.textAlign_-this.offsetX_);var m=Math.round(h[1]*this.textBaseline_-this.offsetY_);var y=this.state_.lineWidth/2*this.state_.scale;for(l=0,u=o.length;l<u;++l){d=0;p=s.height*l;v=o[l].split("");for(f=0,c=v.length;f<c;++f){_=s.atlas.getInfo(v[f]);if(_){var E=_.image;this.anchorX=g-d;this.anchorY=m-p;this.originX=f===0?_.offsetX-y:_.offsetX;this.originY=_.offsetY;this.height=s.height;this.width=f===0||f===v.length-1?s.width[v[f]]+y:s.width[v[f]];this.imageHeight=E.height;this.imageWidth=E.width;var x;if(this.images_.length===0){this.images_.push(E)}else{x=this.images_[this.images_.length-1];if(qn.getUid(x)!=qn.getUid(E)){this.groupIndices.push(this.indices.length);this.images_.push(E)}}this.drawText_(i,r,n,a)}d+=this.width}}}};Nh.prototype.getTextSize_=function(t){var e=this;var i=this.currAtlas_;var r=t.length*i.height;var n=t.map((function(t){var r=0;var n,a;for(n=0,a=t.length;n<a;++n){var s=t[n];if(!i.width[s]){e.addCharToAtlas_(s)}r+=i.width[s]?i.width[s]:0}return r})).reduce((function(t,e){return Math.max(t,e)}));return[n,r]};Nh.prototype.drawText_=function(t,e,i,r){var n,a;for(n=e,a=i;n<a;n+=r){this.drawCoordinates(t,e,i,r)}};Nh.prototype.addCharToAtlas_=function(t){if(t.length===1){var e=this.currAtlas_;var i=this.state_;var r=this.measureCanvas_.getContext("2d");r.font=i.font;var n=Math.ceil(r.measureText(t).width*i.scale);var a=e.atlas.add(t,n,e.height,(function(e,r,n){e.font=i.font;e.fillStyle=i.fillColor;e.strokeStyle=i.strokeColor;e.lineWidth=i.lineWidth;e.lineCap=i.lineCap;e.lineJoin=i.lineJoin;e.miterLimit=i.miterLimit;e.textAlign="left";e.textBaseline="top";if(Va.CANVAS_LINE_DASH&&i.lineDash){e.setLineDash(i.lineDash);e.lineDashOffset=i.lineDashOffset}if(i.scale!==1){e.setTransform(i.scale,0,0,i.scale,0,0)}if(i.strokeColor){e.strokeText(t,r,n)}if(i.fillColor){e.fillText(t,r,n)}}));if(a){e.width[t]=n}}};Nh.prototype.finish=function(t){var e=t.getGL();this.groupIndices.push(this.indices.length);this.hitDetectionGroupIndices=this.groupIndices;this.verticesBuffer=new _h(this.vertices);this.indicesBuffer=new _h(this.indices);var i={};this.createTextures(this.textures_,this.images_,i,e);this.state_={strokeColor:null,lineCap:undefined,lineDash:null,lineDashOffset:undefined,lineJoin:undefined,lineWidth:0,miterLimit:undefined,fillColor:null,font:undefined,scale:undefined};this.text_="";this.textAlign_=undefined;this.textBaseline_=undefined;this.offsetX_=undefined;this.offsetY_=undefined;this.images_=null;this.atlases_={};this.currAtlas_=undefined;Th.prototype.finish.call(this,t)};Nh.prototype.setTextStyle=function(t){var e=this.state_;var i=t.getFill();var r=t.getStroke();if(!t||!t.getText()||!i&&!r){this.text_=""}else{if(!i){e.fillColor=null}else{var n=i.getColor();e.fillColor=po.asColorLike(n?n:vh.defaultFillStyle)}if(!r){e.strokeColor=null;e.lineWidth=0}else{var a=r.getColor();e.strokeColor=po.asColorLike(a?a:vh.defaultStrokeStyle);e.lineWidth=r.getWidth()||vh.defaultLineWidth;e.lineCap=r.getLineCap()||vh.defaultLineCap;e.lineDashOffset=r.getLineDashOffset()||vh.defaultLineDashOffset;e.lineJoin=r.getLineJoin()||vh.defaultLineJoin;e.miterLimit=r.getMiterLimit()||vh.defaultMiterLimit;var s=r.getLineDash();e.lineDash=s?s.slice():vh.defaultLineDash}e.font=t.getFont()||vh.defaultFont;e.scale=t.getScale()||1;this.text_=t.getText();var o=qo.TEXT_ALIGN[t.getTextAlign()];var h=qo.TEXT_ALIGN[t.getTextBaseline()];this.textAlign_=o===undefined?vh.defaultTextAlign:o;this.textBaseline_=h===undefined?vh.defaultTextBaseline:h;this.offsetX_=t.getOffsetX()||0;this.offsetY_=t.getOffsetY()||0;this.rotateWithView=!!t.getRotateWithView();this.rotation=t.getRotation()||0;this.currAtlas_=this.getAtlas_(e)}};Nh.prototype.getAtlas_=function(t){var e=[];var i;for(i in t){if(t[i]||t[i]===0){if(Array.isArray(t[i])){e=e.concat(t[i])}else{e.push(t[i])}}}var r=this.calculateHash_(e);if(!this.atlases_[r]){var n=this.measureCanvas_.getContext("2d");n.font=t.font;var a=Math.ceil((n.measureText("M").width*1.5+t.lineWidth/2)*t.scale);this.atlases_[r]={atlas:new Fh({space:t.lineWidth+1}),width:{},height:a}}return this.atlases_[r]};Nh.prototype.calculateHash_=function(t){var e,i;var r="";for(e=0,i=t.length;e<i;++e){r+=t[e]}return r};Nh.prototype.getTextures=function(t){return this.textures_};Nh.prototype.getHitDetectionTextures=function(){return this.textures_};var Gh=function(t,e,i){Vo.call(this);this.maxExtent_=e;this.tolerance_=t;this.renderBuffer_=i;this.replaysByZIndex_={}};qn.inherits(Gh,Vo);Gh.prototype.addDeclutter=function(t,e){};Gh.prototype.getDeleteResourcesFunction=function(t){var e=[];var i;for(i in this.replaysByZIndex_){var r=this.replaysByZIndex_[i];var n;for(n in r){e.push(r[n].getDeleteResourcesFunction(t))}}return function(){var t=e.length;var i;for(var r=0;r<t;r++){i=e[r].apply(this,arguments)}return i}};Gh.prototype.finish=function(t){var e;for(e in this.replaysByZIndex_){var i=this.replaysByZIndex_[e];var r;for(r in i){i[r].finish(t)}}};Gh.prototype.getReplay=function(t,e){var i=t!==undefined?t.toString():"0";var r=this.replaysByZIndex_[i];if(r===undefined){r={};this.replaysByZIndex_[i]=r}var n=r[e];if(n===undefined){var a=Gh.BATCH_CONSTRUCTORS_[e];n=new a(this.tolerance_,this.maxExtent_);r[e]=n}return n};Gh.prototype.isEmpty=function(){return Qn.isEmpty(this.replaysByZIndex_)};Gh.prototype.replay=function(t,e,i,r,n,a,s,o){var h=Object.keys(this.replaysByZIndex_).map(Number);h.sort(fa.numberSafeCompareFunction);var l,u,f,c,d,p;for(l=0,u=h.length;l<u;++l){d=this.replaysByZIndex_[h[l].toString()];for(f=0,c=qo.ORDER.length;f<c;++f){p=d[qo.ORDER[f]];if(p!==undefined){p.replay(t,e,i,r,n,a,s,o,undefined,false)}}}};Gh.prototype.replayHitDetection_=function(t,e,i,r,n,a,s,o,h,l,u){var f=Object.keys(this.replaysByZIndex_).map(Number);f.sort((function(t,e){return e-t}));var c,d,p,v,_,g;for(c=0,d=f.length;c<d;++c){v=this.replaysByZIndex_[f[c].toString()];for(p=qo.ORDER.length-1;p>=0;--p){_=v[qo.ORDER[p]];if(_!==undefined){g=_.replay(t,e,i,r,n,a,s,o,h,l,u);if(g){return g}}}}return undefined};Gh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s,o,h,l){var u=e.getGL();u.bindFramebuffer(u.FRAMEBUFFER,e.getHitDetectionFramebuffer());var f;if(this.renderBuffer_!==undefined){f=pa.buffer(pa.createOrUpdateFromCoordinate(t),r*this.renderBuffer_)}return this.replayHitDetection_(e,t,r,n,Gh.HIT_DETECTION_SIZE_,s,o,h,(function(t){var e=new Uint8Array(4);u.readPixels(0,0,1,1,u.RGBA,u.UNSIGNED_BYTE,e);if(e[3]>0){var i=l(t);if(i){return i}}}),true,f)};Gh.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n,a,s,o,h){var l=e.getGL();l.bindFramebuffer(l.FRAMEBUFFER,e.getHitDetectionFramebuffer());var u=this.replayHitDetection_(e,t,r,n,Gh.HIT_DETECTION_SIZE_,s,o,h,(function(t){var e=new Uint8Array(4);l.readPixels(0,0,1,1,l.RGBA,l.UNSIGNED_BYTE,e);return e[3]>0}),false);return u!==undefined};Gh.HIT_DETECTION_SIZE_=[1,1];Gh.BATCH_CONSTRUCTORS_={Circle:gh,Image:Ch,LineString:Ih,Polygon:Ph,Text:Nh};var kh=function(t,e,i,r,n,a,s){vo.call(this);this.context_=t;this.center_=e;this.extent_=a;this.pixelRatio_=s;this.size_=n;this.rotation_=r;this.resolution_=i;this.imageStyle_=null;this.fillStyle_=null;this.strokeStyle_=null;this.textStyle_=null};qn.inherits(kh,vo);kh.prototype.drawText_=function(t,e){var i=this.context_;var r=t.getReplay(0,Yo.TEXT);r.setTextStyle(this.textStyle_);r.drawText(e,null);r.finish(i);var n=1;var a={};var s;var o=false;r.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,n,a,s,o);r.getDeleteResourcesFunction(i)()};kh.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke());this.setImageStyle(t.getImage());this.setTextStyle(t.getText())};kh.prototype.drawGeometry=function(t){var e=t.getType();switch(e){case la.POINT:this.drawPoint(t,null);break;case la.LINE_STRING:this.drawLineString(t,null);break;case la.POLYGON:this.drawPolygon(t,null);break;case la.MULTI_POINT:this.drawMultiPoint(t,null);break;case la.MULTI_LINE_STRING:this.drawMultiLineString(t,null);break;case la.MULTI_POLYGON:this.drawMultiPolygon(t,null);break;case la.GEOMETRY_COLLECTION:this.drawGeometryCollection(t,null);break;case la.CIRCLE:this.drawCircle(t,null);break}};kh.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);if(!i||!pa.intersects(this.extent_,i.getExtent())){return}this.setStyle(e);this.drawGeometry(i)};kh.prototype.drawGeometryCollection=function(t,e){var i=t.getGeometriesArray();var r,n;for(r=0,n=i.length;r<n;++r){this.drawGeometry(i[r])}};kh.prototype.drawPoint=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.IMAGE);n.setImageStyle(this.imageStyle_);n.drawPoint(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiPoint=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.IMAGE);n.setImageStyle(this.imageStyle_);n.drawMultiPoint(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawLineString=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_);n.drawLineString(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiLineString=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_);n.drawMultiLineString(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawPolygon=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawPolygon(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawMultiPolygon=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawMultiPolygon(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.drawCircle=function(t,e){var i=this.context_;var r=new Gh(1,this.extent_);var n=r.getReplay(0,Yo.CIRCLE);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_);n.drawCircle(t,e);n.finish(i);var a=1;var s={};var o;var h=false;n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,a,s,o,h);n.getDeleteResourcesFunction(i)();if(this.textStyle_){this.drawText_(r,t)}};kh.prototype.setImageStyle=function(t){this.imageStyle_=t};kh.prototype.setFillStrokeStyle=function(t,e){this.fillStyle_=t;this.strokeStyle_=e};kh.prototype.setTextStyle=function(t){this.textStyle_=t};var Uh={};Uh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_texture, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n gl_FragColor.a = texColor.a * u_opacity;\n}\n":"precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}");Uh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\n\nuniform mat4 u_texCoordMatrix;\nuniform mat4 u_projectionMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.);\n v_texCoord = (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}");var zh=function(t,e){this.u_texCoordMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texCoordMatrix":"d");this.u_projectionMatrix=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_projectionMatrix":"e");this.u_opacity=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_opacity":"f");this.u_texture=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texture":"g");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"b");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"c")};var Bh=function(t,e){go.call(this,e);this.mapRenderer=t;this.arrayBuffer_=new _h([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);this.texture=null;this.framebuffer=null;this.framebufferDimension=undefined;this.texCoordMatrix=Sa.create();this.projectionMatrix=Sa.create();this.tmpMat4_=dh.create();this.defaultLocations_=null};qn.inherits(Bh,go);Bh.prototype.bindFramebuffer=function(t,e){var i=this.mapRenderer.getGL();if(this.framebufferDimension===undefined||this.framebufferDimension!=e){var r=function(t,e,i){if(!t.isContextLost()){t.deleteFramebuffer(e);t.deleteTexture(i)}}.bind(null,i,this.framebuffer,this.texture);t.postRenderFunctions.push(r);var n=xh.createEmptyTexture(i,e,e);var a=i.createFramebuffer();i.bindFramebuffer(Xa.FRAMEBUFFER,a);i.framebufferTexture2D(Xa.FRAMEBUFFER,Xa.COLOR_ATTACHMENT0,Xa.TEXTURE_2D,n,0);this.texture=n;this.framebuffer=a;this.framebufferDimension=e}else{i.bindFramebuffer(Xa.FRAMEBUFFER,this.framebuffer)}};Bh.prototype.composeFrame=function(t,e,i){this.dispatchComposeEvent_(Ds.PRECOMPOSE,i,t);i.bindBuffer(Xa.ARRAY_BUFFER,this.arrayBuffer_);var r=i.getGL();var n=Uh.fragment;var a=Uh.vertex;var s=i.getProgram(n,a);var o;if(!this.defaultLocations_){o=new zh(r,s);this.defaultLocations_=o}else{o=this.defaultLocations_}if(i.useProgram(s)){r.enableVertexAttribArray(o.a_position);r.vertexAttribPointer(o.a_position,2,Xa.FLOAT,false,16,0);r.enableVertexAttribArray(o.a_texCoord);r.vertexAttribPointer(o.a_texCoord,2,Xa.FLOAT,false,16,8);r.uniform1i(o.u_texture,0)}r.uniformMatrix4fv(o.u_texCoordMatrix,false,dh.fromTransform(this.tmpMat4_,this.getTexCoordMatrix()));r.uniformMatrix4fv(o.u_projectionMatrix,false,dh.fromTransform(this.tmpMat4_,this.getProjectionMatrix()));r.uniform1f(o.u_opacity,e.opacity);r.bindTexture(Xa.TEXTURE_2D,this.getTexture());r.drawArrays(Xa.TRIANGLE_STRIP,0,4);this.dispatchComposeEvent_(Ds.POSTCOMPOSE,i,t)};Bh.prototype.dispatchComposeEvent_=function(t,e,i){var r=this.getLayer();if(r.hasListener(t)){var n=i.viewState;var a=n.resolution;var s=i.pixelRatio;var o=i.extent;var h=n.center;var l=n.rotation;var u=i.size;var f=new kh(e,h,a,l,u,o,s);var c=new lo(t,f,i,null,e);r.dispatchEvent(c)}};Bh.prototype.getTexCoordMatrix=function(){return this.texCoordMatrix};Bh.prototype.getTexture=function(){return this.texture};Bh.prototype.getProjectionMatrix=function(){return this.projectionMatrix};Bh.prototype.handleWebGLContextLost=function(){this.texture=null;this.framebuffer=null;this.framebufferDimension=undefined};Bh.prototype.prepareFrame=function(t,e,i){};Bh.prototype.forEachLayerAtPixel=function(t,e,i,r){};var Wh=function(t,e){Bh.call(this,t,e);this.image_=null;this.hitCanvasContext_=null;this.hitTransformationMatrix_=null};qn.inherits(Wh,Bh);Wh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.IMAGE};Wh["create"]=function(t,e){return new Wh(t,e)};Wh.prototype.createTexture_=function(t){var e=t.getImage();var i=this.mapRenderer.getGL();return xh.createTexture(i,e,Xa.CLAMP_TO_EDGE,Xa.CLAMP_TO_EDGE)};Wh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var a=this.getLayer();var s=a.getSource();var o=e.viewState.resolution;var h=e.viewState.rotation;var l=e.skippedFeatureUids;return s.forEachFeatureAtCoordinate(t,o,h,i,l,(function(t){return r.call(n,t,a)}))};Wh.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer.getGL();var n=t.pixelRatio;var a=t.viewState;var s=a.center;var o=a.resolution;var h=a.rotation;var l=this.image_;var u=this.texture;var f=this.getLayer();var c=f.getSource();var d=t.viewHints;var p=t.extent;if(e.extent!==undefined){p=pa.getIntersection(p,e.extent)}if(!d[_s.ANIMATING]&&!d[_s.INTERACTING]&&!pa.isEmpty(p)){var v=a.projection;if(!qn.ENABLE_RASTER_REPROJECTION){var _=c.getProjection();if(_){v=_}}var g=c.getImage(p,o,n,v);if(g){var m=this.loadImage(g);if(m){l=g;u=this.createTexture_(g);if(this.texture){var y=function(t,e){if(!t.isContextLost()){t.deleteTexture(e)}}.bind(null,r,this.texture);t.postRenderFunctions.push(y)}}}}if(l){var E=this.mapRenderer.getContext().getCanvas();this.updateProjectionMatrix_(E.width,E.height,n,s,o,h,l.getExtent());this.hitTransformationMatrix_=null;var x=this.texCoordMatrix;Sa.reset(x);Sa.scale(x,1,-1);Sa.translate(x,0,-1);this.image_=l;this.texture=u;this.updateLogos(t,c)}return!!l};Wh.prototype.updateProjectionMatrix_=function(t,e,i,r,n,a,s){var o=t*n;var h=e*n;var l=this.projectionMatrix;Sa.reset(l);Sa.scale(l,i*2/o,i*2/h);Sa.rotate(l,-a);Sa.translate(l,s[0]-r[0],s[1]-r[1]);Sa.scale(l,(s[2]-s[0])/2,(s[3]-s[1])/2);Sa.translate(l,1,1)};Wh.prototype.hasFeatureAtCoordinate=function(t,e){var i=this.forEachFeatureAtCoordinate(t,e,0,_a.TRUE,this);return i!==undefined};Wh.prototype.forEachLayerAtPixel=function(t,e,i,r){if(!this.image_||!this.image_.getImage()){return undefined}if(this.getLayer().getSource().forEachFeatureAtCoordinate!==qn.nullFunction){var n=Sa.apply(e.pixelToCoordinateTransform,t.slice());var a=this.forEachFeatureAtCoordinate(n,e,0,_a.TRUE,this);if(a){return i.call(r,this.getLayer(),null)}else{return undefined}}else{var s=[this.image_.getImage().width,this.image_.getImage().height];if(!this.hitTransformationMatrix_){this.hitTransformationMatrix_=this.getHitTransformationMatrix_(e.size,s)}var o=Sa.apply(this.hitTransformationMatrix_,t.slice());if(o[0]<0||o[0]>s[0]||o[1]<0||o[1]>s[1]){return undefined}if(!this.hitCanvasContext_){this.hitCanvasContext_=Ts.createCanvasContext2D(1,1)}this.hitCanvasContext_.clearRect(0,0,1,1);this.hitCanvasContext_.drawImage(this.image_.getImage(),o[0],o[1],1,1,0,0,1,1);var h=this.hitCanvasContext_.getImageData(0,0,1,1).data;if(h[3]>0){return i.call(r,this.getLayer(),h)}else{return undefined}}};Wh.prototype.getHitTransformationMatrix_=function(t,e){var i=Sa.create();Sa.translate(i,-1,-1);Sa.scale(i,2/t[0],2/t[1]);Sa.translate(i,0,t[1]);Sa.scale(i,1,-1);var r=Sa.invert(this.projectionMatrix.slice());var n=Sa.create();Sa.translate(n,0,e[1]);Sa.scale(n,1,-1);Sa.scale(n,e[0]/2,e[1]/2);Sa.translate(n,1,1);Sa.multiply(n,r);Sa.multiply(n,i);return n};var Xh=function(t,e){Co.call(this,t,e);this.canvas_=document.createElement("CANVAS");this.canvas_.style.width="100%";this.canvas_.style.height="100%";this.canvas_.style.display="block";this.canvas_.className=Ps.CLASS_UNSELECTABLE;t.insertBefore(this.canvas_,t.childNodes[0]||null);this.clipTileCanvasWidth_=0;this.clipTileCanvasHeight_=0;this.clipTileContext_=Ts.createCanvasContext2D();this.renderedVisible_=true;this.gl_=Xa.getContext(this.canvas_,{antialias:true,depth:true,failIfMajorPerformanceCaveat:true,preserveDrawingBuffer:false,stencil:true});this.context_=new xh(this.canvas_,this.gl_);$n.listen(this.canvas_,Eh.LOST,this.handleWebGLContextLost,this);$n.listen(this.canvas_,Eh.RESTORED,this.handleWebGLContextRestored,this);this.textureCache_=new uo;this.focus_=null;this.tileTextureQueue_=new fs(function(t){var e=t[1];var i=t[2];var r=e[0]-this.focus_[0];var n=e[1]-this.focus_[1];return 65536*Math.log(i)+Math.sqrt(r*r+n*n)/i}.bind(this),(function(t){return t[0].getKey()}));this.loadNextTileTexture_=function(t,e){if(!this.tileTextureQueue_.isEmpty()){this.tileTextureQueue_.reprioritize();var i=this.tileTextureQueue_.dequeue();var r=i[0];var n=i[3];var a=i[4];this.bindTileTexture(r,n,a,Xa.LINEAR,Xa.LINEAR)}return false}.bind(this);this.textureCacheFrameMarkerCount_=0;this.initializeGL_()};qn.inherits(Xh,Co);Xh["handles"]=function(t){return Va.WEBGL&&t===As.WEBGL};Xh["create"]=function(t,e){return new Xh(t,e)};Xh.prototype.bindTileTexture=function(t,e,i,r,n){var a=this.getGL();var s=t.getKey();if(this.textureCache_.containsKey(s)){var o=this.textureCache_.get(s);a.bindTexture(Xa.TEXTURE_2D,o.texture);if(o.magFilter!=r){a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MAG_FILTER,r);o.magFilter=r}if(o.minFilter!=n){a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MIN_FILTER,n);o.minFilter=n}}else{var h=a.createTexture();a.bindTexture(Xa.TEXTURE_2D,h);if(i>0){var l=this.clipTileContext_.canvas;var u=this.clipTileContext_;if(this.clipTileCanvasWidth_!==e[0]||this.clipTileCanvasHeight_!==e[1]){l.width=e[0];l.height=e[1];this.clipTileCanvasWidth_=e[0];this.clipTileCanvasHeight_=e[1]}else{u.clearRect(0,0,e[0],e[1])}u.drawImage(t.getImage(),i,i,e[0],e[1],0,0,e[0],e[1]);a.texImage2D(Xa.TEXTURE_2D,0,Xa.RGBA,Xa.RGBA,Xa.UNSIGNED_BYTE,l)}else{a.texImage2D(Xa.TEXTURE_2D,0,Xa.RGBA,Xa.RGBA,Xa.UNSIGNED_BYTE,t.getImage())}a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MAG_FILTER,r);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_MIN_FILTER,n);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_S,Xa.CLAMP_TO_EDGE);a.texParameteri(Xa.TEXTURE_2D,Xa.TEXTURE_WRAP_T,Xa.CLAMP_TO_EDGE);this.textureCache_.set(s,{texture:h,magFilter:r,minFilter:n})}};Xh.prototype.dispatchComposeEvent_=function(t,e){var i=this.getMap();if(i.hasListener(t)){var r=this.context_;var n=e.extent;var a=e.size;var s=e.viewState;var o=e.pixelRatio;var h=s.resolution;var l=s.center;var u=s.rotation;var f=new kh(r,l,h,u,a,n,o);var c=new lo(t,f,e,null,r);i.dispatchEvent(c)}};Xh.prototype.disposeInternal=function(){var t=this.getGL();if(!t.isContextLost()){this.textureCache_.forEach((function(e){if(e){t.deleteTexture(e.texture)}}))}this.context_.dispose();Co.prototype.disposeInternal.call(this)};Xh.prototype.expireCache_=function(t,e){var i=this.getGL();var r;while(this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>qn.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK){r=this.textureCache_.peekLast();if(!r){if(+this.textureCache_.peekLastKey()==e.index){break}else{--this.textureCacheFrameMarkerCount_}}else{i.deleteTexture(r.texture)}this.textureCache_.pop()}};Xh.prototype.getContext=function(){return this.context_};Xh.prototype.getGL=function(){return this.gl_};Xh.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_};Xh.prototype.getType=function(){return As.WEBGL};Xh.prototype.handleWebGLContextLost=function(t){t.preventDefault();this.textureCache_.clear();this.textureCacheFrameMarkerCount_=0;var e=this.getLayerRenderers();for(var i in e){var r=e[i];r.handleWebGLContextLost()}};Xh.prototype.handleWebGLContextRestored=function(){this.initializeGL_();this.getMap().render()};Xh.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture(Xa.TEXTURE0);t.blendFuncSeparate(Xa.SRC_ALPHA,Xa.ONE_MINUS_SRC_ALPHA,Xa.ONE,Xa.ONE_MINUS_SRC_ALPHA);t.disable(Xa.CULL_FACE);t.disable(Xa.DEPTH_TEST);t.disable(Xa.SCISSOR_TEST);t.disable(Xa.STENCIL_TEST)};Xh.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())};Xh.prototype.renderFrame=function(t){var e=this.getContext();var i=this.getGL();if(i.isContextLost()){return false}if(!t){if(this.renderedVisible_){this.canvas_.style.display="none";this.renderedVisible_=false}return false}this.focus_=t.focus;this.textureCache_.set((-t.index).toString(),null);++this.textureCacheFrameMarkerCount_;this.dispatchComposeEvent_(Ds.PRECOMPOSE,t);var r=[];var n=t.layerStatesArray;fa.stableSort(n,Co.sortByZIndex);var a=t.viewState.resolution;var s,o,h,l;for(s=0,o=n.length;s<o;++s){l=n[s];if(Fs.visibleAtResolution(l,a)&&l.sourceState==Ms.READY){h=this.getLayerRenderer(l.layer);if(h.prepareFrame(t,l,e)){r.push(l)}}}var u=t.size[0]*t.pixelRatio;var f=t.size[1]*t.pixelRatio;if(this.canvas_.width!=u||this.canvas_.height!=f){this.canvas_.width=u;this.canvas_.height=f}i.bindFramebuffer(Xa.FRAMEBUFFER,null);i.clearColor(0,0,0,0);i.clear(Xa.COLOR_BUFFER_BIT);i.enable(Xa.BLEND);i.viewport(0,0,this.canvas_.width,this.canvas_.height);for(s=0,o=r.length;s<o;++s){l=r[s];h=this.getLayerRenderer(l.layer);h.composeFrame(t,l,e)}if(!this.renderedVisible_){this.canvas_.style.display="";this.renderedVisible_=true}this.calculateMatrices2D(t);if(this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>qn.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK){t.postRenderFunctions.push(this.expireCache_.bind(this))}if(!this.tileTextureQueue_.isEmpty()){t.postRenderFunctions.push(this.loadNextTileTexture_);t.animate=true}this.dispatchComposeEvent_(Ds.POSTCOMPOSE,t);this.scheduleRemoveUnusedLayerRenderers(t);this.scheduleExpireIconCache(t)};Xh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,a,s){var o;if(this.getGL().isContextLost()){return false}var h=e.viewState;var l=e.layerStatesArray;var u=l.length;var f;for(f=u-1;f>=0;--f){var c=l[f];var d=c.layer;if(Fs.visibleAtResolution(c,h.resolution)&&a.call(s,d)){var p=this.getLayerRenderer(d);o=p.forEachFeatureAtCoordinate(t,e,i,r,n);if(o){return o}}}return undefined};Xh.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var a=false;if(this.getGL().isContextLost()){return false}var s=e.viewState;var o=e.layerStatesArray;var h=o.length;var l;for(l=h-1;l>=0;--l){var u=o[l];var f=u.layer;if(Fs.visibleAtResolution(u,s.resolution)&&r.call(n,f)){var c=this.getLayerRenderer(f);a=c.hasFeatureAtCoordinate(t,e);if(a){return true}}}return a};Xh.prototype.forEachLayerAtPixel=function(t,e,i,r,n,a){if(this.getGL().isContextLost()){return false}var s=e.viewState;var o;var h=e.layerStatesArray;var l=h.length;var u;for(u=l-1;u>=0;--u){var f=h[u];var c=f.layer;if(Fs.visibleAtResolution(f,s.resolution)&&n.call(r,c)){var d=this.getLayerRenderer(c);o=d.forEachLayerAtPixel(t,e,i,r);if(o){return o}}}return undefined};var Vh={};Vh.fragment=new lh(qn.DEBUG_WEBGL?"precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n}\n":"precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}");Vh.vertex=new uh(qn.DEBUG_WEBGL?"varying vec2 v_texCoord;\n\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 u_tileOffset;\n\nvoid main(void) {\n gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n v_texCoord = a_texCoord;\n}\n\n\n":"varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}");var Yh=function(t,e){this.u_tileOffset=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_tileOffset":"d");this.u_texture=t.getUniformLocation(e,qn.DEBUG_WEBGL?"u_texture":"e");this.a_position=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_position":"b");this.a_texCoord=t.getAttribLocation(e,qn.DEBUG_WEBGL?"a_texCoord":"c")};var jh=function(t,e){Bh.call(this,t,e);this.fragmentShader_=Vh.fragment;this.vertexShader_=Vh.vertex;this.locations_=null;this.renderArrayBuffer_=new _h([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]);this.renderedTileRange_=null;this.renderedFramebufferExtent_=null;this.renderedRevision_=-1;this.tmpSize_=[0,0]};qn.inherits(jh,Bh);jh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.TILE};jh["create"]=function(t,e){return new jh(t,e)};jh.prototype.disposeInternal=function(){var t=this.mapRenderer.getContext();t.deleteBuffer(this.renderArrayBuffer_);Bh.prototype.disposeInternal.call(this)};jh.prototype.createLoadedTileFinder=function(t,e,i){var r=this.mapRenderer;return function(n,a){function s(t){var e=r.isTileTextureLoaded(t);if(e){if(!i[n]){i[n]={}}i[n][t.tileCoord.toString()]=t}return e}return t.forEachLoadedTile(e,n,a,s)}};jh.prototype.handleWebGLContextLost=function(){Bh.prototype.handleWebGLContextLost.call(this);this.locations_=null};jh.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer;var n=i.getGL();var a=t.viewState;var s=a.projection;var o=this.getLayer();var h=o.getSource();var l=h.getTileGridForProjection(s);var u=l.getZForResolution(a.resolution);var f=l.getResolution(u);var c=h.getTilePixelSize(u,t.pixelRatio,s);var d=c[0]/ws.toSize(l.getTileSize(u),this.tmpSize_)[0];var p=f/d;var v=h.getTilePixelRatio(d)*h.getGutter(s);var _=a.center;var g=t.extent;var m=l.getTileRangeForExtentAndZ(g,u);var y;if(this.renderedTileRange_&&this.renderedTileRange_.equals(m)&&this.renderedRevision_==h.getRevision()){y=this.renderedFramebufferExtent_}else{var E=m.getSize();var x=Math.max(E[0]*c[0],E[1]*c[1]);var T=ha.roundUpToPowerOfTwo(x);var C=p*T;var R=l.getOrigin(u);var M=R[0]+m.minX*c[0]*p;var S=R[1]+m.minY*c[1]*p;y=[M,S,M+C,S+C];this.bindFramebuffer(t,T);n.viewport(0,0,T,T);n.clearColor(0,0,0,0);n.clear(Xa.COLOR_BUFFER_BIT);n.disable(Xa.BLEND);var I=i.getProgram(this.fragmentShader_,this.vertexShader_);i.useProgram(I);if(!this.locations_){this.locations_=new Yh(n,I)}i.bindBuffer(Xa.ARRAY_BUFFER,this.renderArrayBuffer_);n.enableVertexAttribArray(this.locations_.a_position);n.vertexAttribPointer(this.locations_.a_position,2,Xa.FLOAT,false,16,0);n.enableVertexAttribArray(this.locations_.a_texCoord);n.vertexAttribPointer(this.locations_.a_texCoord,2,Xa.FLOAT,false,16,8);n.uniform1i(this.locations_.u_texture,0);var L={};L[u]={};var A=this.createLoadedTileFinder(h,s,L);var w=o.getUseInterimTilesOnError();var O=true;var b=pa.createEmpty();var P=new Mo(0,0,0,0);var D,F,N,G,k;var U,z,B;for(U=m.minX;U<=m.maxX;++U){for(z=m.minY;z<=m.maxY;++z){G=h.getTile(u,U,z,d,s);if(e.extent!==undefined){B=l.getTileCoordExtent(G.tileCoord,b);if(!pa.intersects(B,e.extent)){continue}}k=G.getState();F=k==us.LOADED||k==us.EMPTY||k==us.ERROR&&!w;if(!F){G=G.getInterimTile()}k=G.getState();if(k==us.LOADED){if(r.isTileTextureLoaded(G)){L[u][G.tileCoord.toString()]=G;continue}}else if(k==us.EMPTY||k==us.ERROR&&!w){continue}O=false;N=l.forEachTileCoordParentTileRange(G.tileCoord,A,null,P,b);if(!N){D=l.getTileCoordChildTileRange(G.tileCoord,P,b);if(D){A(u+1,D)}}}}var W=Object.keys(L).map(Number);W.sort(fa.numberSafeCompareFunction);var X=new Float32Array(4);var V,Y,j,H;for(V=0,Y=W.length;V<Y;++V){H=L[W[V]];for(j in H){G=H[j];B=l.getTileCoordExtent(G.tileCoord,b);X[0]=2*(B[2]-B[0])/C;X[1]=2*(B[3]-B[1])/C;X[2]=2*(B[0]-y[0])/C-1;X[3]=2*(B[1]-y[1])/C-1;n.uniform4fv(this.locations_.u_tileOffset,X);r.bindTileTexture(G,c,v*d,Xa.LINEAR,Xa.LINEAR);n.drawArrays(Xa.TRIANGLE_STRIP,0,4)}}if(O){this.renderedTileRange_=m;this.renderedFramebufferExtent_=y;this.renderedRevision_=h.getRevision()}else{this.renderedTileRange_=null;this.renderedFramebufferExtent_=null;this.renderedRevision_=-1;t.animate=true}}this.updateUsedTiles(t.usedTiles,h,u,m);var K=r.getTileTextureQueue();this.manageTilePyramid(t,h,l,d,s,g,u,o.getPreload(),(function(t){if(t.getState()==us.LOADED&&!r.isTileTextureLoaded(t)&&!K.isKeyQueued(t.getKey())){K.enqueue([t,l.getTileCoordCenter(t.tileCoord),l.getResolution(t.tileCoord[0]),c,v*d])}}),this);this.scheduleExpireCache(t,h);this.updateLogos(t,h);var q=this.texCoordMatrix;Sa.reset(q);Sa.translate(q,(Math.round(_[0]/f)*f-y[0])/(y[2]-y[0]),(Math.round(_[1]/f)*f-y[1])/(y[3]-y[1]));if(a.rotation!==0){Sa.rotate(q,a.rotation)}Sa.scale(q,t.size[0]*a.resolution/(y[2]-y[0]),t.size[1]*a.resolution/(y[3]-y[1]));Sa.translate(q,-.5,-.5);return true};jh.prototype.forEachLayerAtPixel=function(t,e,i,r){if(!this.framebuffer){return undefined}var n=[t[0]/e.size[0],(e.size[1]-t[1])/e.size[1]];var a=Sa.apply(this.texCoordMatrix,n.slice());var s=[a[0]*this.framebufferDimension,a[1]*this.framebufferDimension];var o=this.mapRenderer.getContext().getGL();o.bindFramebuffer(o.FRAMEBUFFER,this.framebuffer);var h=new Uint8Array(4);o.readPixels(s[0],s[1],1,1,o.RGBA,o.UNSIGNED_BYTE,h);if(h[3]>0){return i.call(r,this.getLayer(),h)}else{return undefined}};var Hh=function(t,e){Bh.call(this,t,e);this.dirty_=false;this.renderedRevision_=-1;this.renderedResolution_=NaN;this.renderedExtent_=pa.createEmpty();this.renderedRenderOrder_=null;this.replayGroup_=null;this.layerState_=null};qn.inherits(Hh,Bh);Hh["handles"]=function(t,e){return t===As.WEBGL&&e.getType()===oo.VECTOR};Hh["create"]=function(t,e){return new Hh(t,e)};Hh.prototype.composeFrame=function(t,e,i){this.layerState_=e;var r=t.viewState;var n=this.replayGroup_;var a=t.size;var s=t.pixelRatio;var o=this.mapRenderer.getGL();if(n&&!n.isEmpty()){o.enable(o.SCISSOR_TEST);o.scissor(0,0,a[0]*s,a[1]*s);n.replay(i,r.center,r.resolution,r.rotation,a,s,e.opacity,e.managed?t.skippedFeatureUids:{});o.disable(o.SCISSOR_TEST)}};Hh.prototype.disposeInternal=function(){var t=this.replayGroup_;if(t){var e=this.mapRenderer.getContext();t.getDeleteResourcesFunction(e)();this.replayGroup_=null}Bh.prototype.disposeInternal.call(this)};Hh.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(!this.replayGroup_||!this.layerState_){return undefined}else{var a=this.mapRenderer.getContext();var s=e.viewState;var o=this.getLayer();var h=this.layerState_;var l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,a,s.center,s.resolution,s.rotation,e.size,e.pixelRatio,h.opacity,{},(function(t){var e=qn.getUid(t).toString();if(!(e in l)){l[e]=true;return r.call(n,t,o)}}))}};Hh.prototype.hasFeatureAtCoordinate=function(t,e){if(!this.replayGroup_||!this.layerState_){return false}else{var i=this.mapRenderer.getContext();var r=e.viewState;var n=this.layerState_;return this.replayGroup_.hasFeatureAtCoordinate(t,i,r.center,r.resolution,r.rotation,e.size,e.pixelRatio,n.opacity,e.skippedFeatureUids)}};Hh.prototype.forEachLayerAtPixel=function(t,e,i,r){var n=Sa.apply(e.pixelToCoordinateTransform,t.slice());var a=this.hasFeatureAtCoordinate(n,e);if(a){return i.call(r,this.getLayer(),null)}else{return undefined}};Hh.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()};Hh.prototype.prepareFrame=function(t,e,i){var r=this.getLayer();var n=r.getSource();this.updateLogos(t,n);var a=t.viewHints[_s.ANIMATING];var s=t.viewHints[_s.INTERACTING];var o=r.getUpdateWhileAnimating();var h=r.getUpdateWhileInteracting();if(!this.dirty_&&(!o&&a)||!h&&s){return true}var l=t.extent;var u=t.viewState;var f=u.projection;var c=u.resolution;var d=t.pixelRatio;var p=r.getRevision();var v=r.getRenderBuffer();var _=r.getRenderOrder();if(_===undefined){_=nh.defaultOrder}var g=pa.buffer(l,v*c);if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==p&&this.renderedRenderOrder_==_&&pa.containsExtent(this.renderedExtent_,g)){return true}if(this.replayGroup_){t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(i))}this.dirty_=false;var m=new Gh(nh.getTolerance(c,d),g,r.getRenderBuffer());n.loadFeatures(g,c,f);var y=function(t){var e;var i=t.getStyleFunction();if(i){e=i.call(t,c)}else{i=r.getStyleFunction();if(i){e=i(t,c)}}if(e){var n=this.renderFeature(t,c,d,e,m);this.dirty_=this.dirty_||n}};if(_){var E=[];n.forEachFeatureInExtent(g,(function(t){E.push(t)}),this);E.sort(_);E.forEach(y,this)}else{n.forEachFeatureInExtent(g,y,this)}m.finish(i);this.renderedResolution_=c;this.renderedRevision_=p;this.renderedRenderOrder_=_;this.renderedExtent_=g;this.replayGroup_=m;return true};Hh.prototype.renderFeature=function(t,e,i,r,n){if(!r){return false}var a=false;if(Array.isArray(r)){for(var s=r.length-1,o=0;s>=o;--s){a=nh.renderFeature(n,t,r[s],nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}}else{a=nh.renderFeature(n,t,r,nh.getSquaredTolerance(e,i),this.handleStyleImageChange_,this)||a}return a};if(qn.ENABLE_CANVAS){Ls.register(Is.MAP_RENDERER,Ro);Ls.registerMultiple(Is.LAYER_RENDERER,[Eo,So,ah,oh])}if(qn.ENABLE_WEBGL){Ls.register(Is.MAP_RENDERER,Xh);Ls.registerMultiple(Is.LAYER_RENDERER,[Wh,jh,Hh])}var Kh=function(t){t=Qn.assign({},t);if(!t.controls){t.controls=Us.defaults()}if(!t.interactions){t.interactions=ro.defaults()}Os.call(this,t)};qn.inherits(Kh,Os);var qh=function(t){this.opacity_=t.opacity;this.rotateWithView_=t.rotateWithView;this.rotation_=t.rotation;this.scale_=t.scale;this.snapToPixel_=t.snapToPixel};qh.prototype.getOpacity=function(){return this.opacity_};qh.prototype.getRotateWithView=function(){return this.rotateWithView_};qh.prototype.getRotation=function(){return this.rotation_};qh.prototype.getScale=function(){return this.scale_};qh.prototype.getSnapToPixel=function(){return this.snapToPixel_};qh.prototype.getAnchor=function(){};qh.prototype.getImage=function(t){};qh.prototype.getHitDetectionImage=function(t){};qh.prototype.getImageState=function(){};qh.prototype.getImageSize=function(){};qh.prototype.getHitDetectionImageSize=function(){};qh.prototype.getOrigin=function(){};qh.prototype.getSize=function(){};qh.prototype.setOpacity=function(t){this.opacity_=t};qh.prototype.setRotateWithView=function(t){this.rotateWithView_=t};qh.prototype.setRotation=function(t){this.rotation_=t};qh.prototype.setScale=function(t){this.scale_=t};qh.prototype.setSnapToPixel=function(t){this.snapToPixel_=t};qh.prototype.listenImageChange=function(t,e){};qh.prototype.load=function(){};qh.prototype.unlistenImageChange=function(t,e){};var Zh=function(t){this.checksums_=null;this.canvas_=null;this.hitDetectionCanvas_=null;this.fill_=t.fill!==undefined?t.fill:null;this.origin_=[0,0];this.points_=t.points;this.radius_=t.radius!==undefined?t.radius:t.radius1;this.radius2_=t.radius2;this.angle_=t.angle!==undefined?t.angle:0;this.stroke_=t.stroke!==undefined?t.stroke:null;this.anchor_=null;this.size_=null;this.imageSize_=null;this.hitDetectionImageSize_=null;this.atlasManager_=t.atlasManager;this.render_(this.atlasManager_);var e=t.snapToPixel!==undefined?t.snapToPixel:true;var i=t.rotateWithView!==undefined?t.rotateWithView:false;qh.call(this,{opacity:1,rotateWithView:i,rotation:t.rotation!==undefined?t.rotation:0,scale:1,snapToPixel:e})};qn.inherits(Zh,qh);Zh.prototype.clone=function(){var t=new Zh({fill:this.getFill()?this.getFill().clone():undefined,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),snapToPixel:this.getSnapToPixel(),stroke:this.getStroke()?this.getStroke().clone():undefined,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});t.setOpacity(this.getOpacity());t.setScale(this.getScale());return t};Zh.prototype.getAnchor=function(){return this.anchor_};Zh.prototype.getAngle=function(){return this.angle_};Zh.prototype.getFill=function(){return this.fill_};Zh.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_};Zh.prototype.getImage=function(t){return this.canvas_};Zh.prototype.getImageSize=function(){return this.imageSize_};Zh.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_};Zh.prototype.getImageState=function(){return ao.LOADED};Zh.prototype.getOrigin=function(){return this.origin_};Zh.prototype.getPoints=function(){return this.points_};Zh.prototype.getRadius=function(){return this.radius_};Zh.prototype.getRadius2=function(){return this.radius2_};Zh.prototype.getSize=function(){return this.size_};Zh.prototype.getStroke=function(){return this.stroke_};Zh.prototype.listenImageChange=function(t,e){};Zh.prototype.load=function(){};Zh.prototype.unlistenImageChange=function(t,e){};Zh.prototype.render_=function(t){var e;var i="";var r="";var n=0;var a=null;var s=0;var o;var h=0;if(this.stroke_){o=this.stroke_.getColor();if(o===null){o=fo.defaultStrokeStyle}o=po.asColorLike(o);h=this.stroke_.getWidth();if(h===undefined){h=fo.defaultLineWidth}a=this.stroke_.getLineDash();s=this.stroke_.getLineDashOffset();if(!Va.CANVAS_LINE_DASH){a=null;s=0}r=this.stroke_.getLineJoin();if(r===undefined){r=fo.defaultLineJoin}i=this.stroke_.getLineCap();if(i===undefined){i=fo.defaultLineCap}n=this.stroke_.getMiterLimit();if(n===undefined){n=fo.defaultMiterLimit}}var l=2*(this.radius_+h)+1;var u={strokeStyle:o,strokeWidth:h,size:l,lineCap:i,lineDash:a,lineDashOffset:s,lineJoin:r,miterLimit:n};if(t===undefined){var f=Ts.createCanvasContext2D(l,l);this.canvas_=f.canvas;l=this.canvas_.width;e=l;this.draw_(u,f,0,0);this.createHitDetectionCanvas_(u)}else{l=Math.round(l);var c=!this.fill_;var d;if(c){d=this.drawHitDetectionCanvas_.bind(this,u)}var p=this.getChecksum();var v=t.add(p,l,l,this.draw_.bind(this,u),d);this.canvas_=v.image;this.origin_=[v.offsetX,v.offsetY];e=v.image.width;if(c){this.hitDetectionCanvas_=v.hitImage;this.hitDetectionImageSize_=[v.hitImage.width,v.hitImage.height]}else{this.hitDetectionCanvas_=this.canvas_;this.hitDetectionImageSize_=[e,e]}}this.anchor_=[l/2,l/2];this.size_=[l,l];this.imageSize_=[e,e]};Zh.prototype.draw_=function(t,e,i,r){var n,a,s;e.setTransform(1,0,0,1,0,0);e.translate(i,r);e.beginPath();var o=this.points_;if(o===Infinity){e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,true)}else{var h=this.radius2_!==undefined?this.radius2_:this.radius_;if(h!==this.radius_){o=2*o}for(n=0;n<=o;n++){a=n*2*Math.PI/o-Math.PI/2+this.angle_;s=n%2===0?this.radius_:h;e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}}if(this.fill_){var l=this.fill_.getColor();if(l===null){l=fo.defaultFillStyle}e.fillStyle=po.asColorLike(l);e.fill()}if(this.stroke_){e.strokeStyle=t.strokeStyle;e.lineWidth=t.strokeWidth;if(t.lineDash){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.lineCap=t.lineCap;e.lineJoin=t.lineJoin;e.miterLimit=t.miterLimit;e.stroke()}e.closePath()};Zh.prototype.createHitDetectionCanvas_=function(t){this.hitDetectionImageSize_=[t.size,t.size];if(this.fill_){this.hitDetectionCanvas_=this.canvas_;return}var e=Ts.createCanvasContext2D(t.size,t.size);this.hitDetectionCanvas_=e.canvas;this.drawHitDetectionCanvas_(t,e,0,0)};Zh.prototype.drawHitDetectionCanvas_=function(t,e,i,r){e.setTransform(1,0,0,1,0,0);e.translate(i,r);e.beginPath();var n=this.points_;if(n===Infinity){e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,true)}else{var a=this.radius2_!==undefined?this.radius2_:this.radius_;if(a!==this.radius_){n=2*n}var s,o,h;for(s=0;s<=n;s++){h=s*2*Math.PI/n-Math.PI/2+this.angle_;o=s%2===0?this.radius_:a;e.lineTo(t.size/2+o*Math.cos(h),t.size/2+o*Math.sin(h))}}e.fillStyle=fo.defaultFillStyle;e.fill();if(this.stroke_){e.strokeStyle=t.strokeStyle;e.lineWidth=t.strokeWidth;if(t.lineDash){e.setLineDash(t.lineDash);e.lineDashOffset=t.lineDashOffset}e.stroke()}e.closePath()};Zh.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-";var e=this.fill_?this.fill_.getChecksum():"-";var i=!this.checksums_||(t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.radius2_!=this.checksums_[4]||this.angle_!=this.checksums_[5]||this.points_!=this.checksums_[6]);if(i){var r="r"+t+e+(this.radius_!==undefined?this.radius_.toString():"-")+(this.radius2_!==undefined?this.radius2_.toString():"-")+(this.angle_!==undefined?this.angle_.toString():"-")+(this.points_!==undefined?this.points_.toString():"-");this.checksums_=[r,t,e,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]};var Jh=function(t){var e=t||{};Zh.call(this,{points:Infinity,fill:e.fill,radius:e.radius,snapToPixel:e.snapToPixel,stroke:e.stroke,atlasManager:e.atlasManager})};qn.inherits(Jh,Zh);Jh.prototype.clone=function(){var t=new Jh({fill:this.getFill()?this.getFill().clone():undefined,stroke:this.getStroke()?this.getStroke().clone():undefined,radius:this.getRadius(),snapToPixel:this.getSnapToPixel(),atlasManager:this.atlasManager_});t.setOpacity(this.getOpacity());t.setScale(this.getScale());return t};Jh.prototype.setRadius=function(t){this.radius_=t;this.render_(this.atlasManager_)};var Qh=function(t){var e=t||{};this.color_=e.color!==undefined?e.color:null;this.checksum_=undefined};Qh.prototype.clone=function(){var t=this.getColor();return new Qh({color:t&&t.slice?t.slice():t||undefined})};Qh.prototype.getColor=function(){return this.color_};Qh.prototype.setColor=function(t){this.color_=t;this.checksum_=undefined};Qh.prototype.getChecksum=function(){if(this.checksum_===undefined){if(this.color_ instanceof CanvasPattern||this.color_ instanceof CanvasGradient){this.checksum_=qn.getUid(this.color_).toString()}else{this.checksum_="f"+(this.color_?co.asString(this.color_):"-")}}return this.checksum_};var $h=function(t){var e=t||{};this.geometry_=null;this.geometryFunction_=$h.defaultGeometryFunction;if(e.geometry!==undefined){this.setGeometry(e.geometry)}this.fill_=e.fill!==undefined?e.fill:null;this.image_=e.image!==undefined?e.image:null;this.renderer_=e.renderer!==undefined?e.renderer:null;this.stroke_=e.stroke!==undefined?e.stroke:null;this.text_=e.text!==undefined?e.text:null;this.zIndex_=e.zIndex};$h.prototype.clone=function(){var t=this.getGeometry();if(t&&t.clone){t=t.clone()}return new $h({geometry:t,fill:this.getFill()?this.getFill().clone():undefined,image:this.getImage()?this.getImage().clone():undefined,stroke:this.getStroke()?this.getStroke().clone():undefined,text:this.getText()?this.getText().clone():undefined,zIndex:this.getZIndex()})};$h.prototype.getRenderer=function(){return this.renderer_};$h.prototype.setRenderer=function(t){this.renderer_=t};$h.prototype.getGeometry=function(){return this.geometry_};$h.prototype.getGeometryFunction=function(){return this.geometryFunction_};$h.prototype.getFill=function(){return this.fill_};$h.prototype.setFill=function(t){this.fill_=t};$h.prototype.getImage=function(){return this.image_};$h.prototype.setImage=function(t){this.image_=t};$h.prototype.getStroke=function(){return this.stroke_};$h.prototype.setStroke=function(t){this.stroke_=t};$h.prototype.getText=function(){return this.text_};$h.prototype.setText=function(t){this.text_=t};$h.prototype.getZIndex=function(){return this.zIndex_};$h.prototype.setGeometry=function(t){if(typeof t==="function"){this.geometryFunction_=t}else if(typeof t==="string"){this.geometryFunction_=function(e){return e.get(t)}}else if(!t){this.geometryFunction_=$h.defaultGeometryFunction}else if(t!==undefined){this.geometryFunction_=function(){return t}}this.geometry_=t};$h.prototype.setZIndex=function(t){this.zIndex_=t};$h.createFunction=function(t){var e;if(typeof t==="function"){e=t}else{var i;if(Array.isArray(t)){i=t}else{oa.assert(t instanceof $h,41);i=[t]}e=function(){return i}}return e};$h.default_=null;$h.defaultFunction=function(t,e){if(!$h.default_){var i=new Qh({color:"rgba(255,255,255,0.4)"});var r=new wh({color:"#3399CC",width:1.25});$h.default_=[new $h({image:new Jh({fill:i,stroke:r,radius:5}),fill:i,stroke:r})]}return $h.default_};$h.createDefaultEditing=function(){var t={};var e=[255,255,255,1];var i=[0,153,255,1];var r=3;t[la.POLYGON]=[new $h({fill:new Qh({color:[255,255,255,.5]})})];t[la.MULTI_POLYGON]=t[la.POLYGON];t[la.LINE_STRING]=[new $h({stroke:new wh({color:e,width:r+2})}),new $h({stroke:new wh({color:i,width:r})})];t[la.MULTI_LINE_STRING]=t[la.LINE_STRING];t[la.CIRCLE]=t[la.POLYGON].concat(t[la.LINE_STRING]);t[la.POINT]=[new $h({image:new Jh({radius:r*2,fill:new Qh({color:i}),stroke:new wh({color:e,width:r/2})}),zIndex:Infinity})];t[la.MULTI_POINT]=t[la.POINT];t[la.GEOMETRY_COLLECTION]=t[la.POLYGON].concat(t[la.LINE_STRING],t[la.POINT]);return t};$h.defaultGeometryFunction=function(t){return t.getGeometry()};var tl=function(t){aa.call(this);this.id_=undefined;this.geometryName_="geometry";this.style_=null;this.styleFunction_=undefined;this.geometryChangeKey_=null;$n.listen(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);if(t!==undefined){if(t instanceof Ia||!t){var e=t;this.setGeometry(e)}else{var i=t;this.setProperties(i)}}};qn.inherits(tl,aa);tl.prototype.clone=function(){var t=new tl(this.getProperties());t.setGeometryName(this.getGeometryName());var e=this.getGeometry();if(e){t.setGeometry(e.clone())}var i=this.getStyle();if(i){t.setStyle(i)}return t};tl.prototype.getGeometry=function(){return this.get(this.geometryName_)};tl.prototype.getId=function(){return this.id_};tl.prototype.getGeometryName=function(){return this.geometryName_};tl.prototype.getStyle=function(){return this.style_};tl.prototype.getStyleFunction=function(){return this.styleFunction_};tl.prototype.handleGeometryChange_=function(){this.changed()};tl.prototype.handleGeometryChanged_=function(){if(this.geometryChangeKey_){$n.unlistenByKey(this.geometryChangeKey_);this.geometryChangeKey_=null}var t=this.getGeometry();if(t){this.geometryChangeKey_=$n.listen(t,ra.CHANGE,this.handleGeometryChange_,this)}this.changed()};tl.prototype.setGeometry=function(t){this.set(this.geometryName_,t)};tl.prototype.setStyle=function(t){this.style_=t;this.styleFunction_=!t?undefined:tl.createStyleFunction(t);this.changed()};tl.prototype.setId=function(t){this.id_=t;this.changed()};tl.prototype.setGeometryName=function(t){$n.unlisten(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);this.geometryName_=t;$n.listen(this,aa.getChangeEventType(this.geometryName_),this.handleGeometryChanged_,this);this.handleGeometryChanged_()};tl.createStyleFunction=function(t){var e;if(typeof t==="function"){if(t.length==2){e=function(e){return t(this,e)}}else{e=t}}else{var i;if(Array.isArray(t)){i=t}else{oa.assert(t instanceof $h,41);i=[t]}e=function(){return i}}return e};var el={};el.createOrUpdate=function(t,e,i,r){if(r!==undefined){r[0]=t;r[1]=e;r[2]=i;return r}else{return[t,e,i]}};el.getKeyZXY=function(t,e,i){return t+"/"+e+"/"+i};el.getKey=function(t){return el.getKeyZXY(t[0],t[1],t[2])};el.fromKey=function(t){return t.split("/").map(Number)};el.hash=function(t){return(t[1]<<t[0])+t[2]};el.quadKey=function(t){var e=t[0];var i=new Array(e);var r=1<<e-1;var n,a;for(n=0;n<e;++n){a=48;if(t[1]&r){a+=1}if(t[2]&r){a+=2}i[n]=String.fromCharCode(a);r>>=1}return i.join("")};el.withinExtentAndZ=function(t,e){var i=t[0];var r=t[1];var n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom()){return false}var a=e.getExtent();var s;if(!a){s=e.getFullTileRange(i)}else{s=e.getTileRangeForExtentAndZ(a,i)}if(!s){return true}else{return s.containsXY(r,n)}};var il={};il.createFromTemplate=function(t,e){var i=/\{z\}/g;var r=/\{x\}/g;var n=/\{y\}/g;var a=/\{-y\}/g;return function(s,o,h){if(!s){return undefined}else{return t.replace(i,s[0].toString()).replace(r,s[1].toString()).replace(n,(function(){var t=-s[2]-1;return t.toString()})).replace(a,(function(){var t=s[0];var i=e.getFullTileRange(t);oa.assert(i,55);var r=i.getHeight()+s[2];return r.toString()}))}}};il.createFromTemplates=function(t,e){var i=t.length;var r=new Array(i);for(var n=0;n<i;++n){r[n]=il.createFromTemplate(t[n],e)}return il.createFromTileUrlFunctions(r)};il.createFromTileUrlFunctions=function(t){if(t.length===1){return t[0]}return function(e,i,r){if(!e){return undefined}else{var n=el.hash(e);var a=ha.modulo(n,t.length);return t[a](e,i,r)}}};il.nullTileUrlFunction=function(t,e,i){return undefined};il.expandUrl=function(t){var e=[];var i=/\{([a-z])-([a-z])\}/.exec(t);if(i){var r=i[1].charCodeAt(0);var n=i[2].charCodeAt(0);var a;for(a=r;a<=n;++a){e.push(t.replace(i[0],String.fromCharCode(a)))}return e}i=i=/\{(\d+)-(\d+)\}/.exec(t);if(i){var s=parseInt(i[2],10);for(var o=parseInt(i[1],10);o<=s;o++){e.push(t.replace(i[0],o.toString()))}return e}e.push(t);return e};var rl=function(t,e,i){ia.call(this);var r=i?i:{};this.tileCoord=t;this.state=e;this.interimTile=null;this.key="";this.transition_=r.transition===undefined?250:r.transition;this.transitionStarts_={}};qn.inherits(rl,ia);rl.prototype.changed=function(){this.dispatchEvent(ra.CHANGE)};rl.prototype.getKey=function(){return this.key+"/"+this.tileCoord};rl.prototype.getInterimTile=function(){if(!this.interimTile){return this}var t=this.interimTile;do{if(t.getState()==us.LOADED){return t}t=t.interimTile}while(t);return this};rl.prototype.refreshInterimChain=function(){if(!this.interimTile){return}var t=this.interimTile;var e=this;do{if(t.getState()==us.LOADED){t.interimTile=null;break}else if(t.getState()==us.LOADING){e=t}else if(t.getState()==us.IDLE){e.interimTile=t.interimTile}else{e=t}t=e.interimTile}while(t)};rl.prototype.getTileCoord=function(){return this.tileCoord};rl.prototype.getState=function(){return this.state};rl.prototype.setState=function(t){this.state=t;this.changed()};rl.prototype.load=function(){};rl.prototype.getAlpha=function(t,e){if(!this.transition_){return 1}var i=this.transitionStarts_[t];if(!i){i=e;this.transitionStarts_[t]=i}else if(i===-1){return 1}var r=e-i+1e3/60;if(r>=this.transition_){return 1}return Es.easeIn(r/this.transition_)};rl.prototype.inTransition=function(t){if(!this.transition_){return false}return this.transitionStarts_[t]!==-1};rl.prototype.endTransition=function(t){if(this.transition_){this.transitionStarts_[t]=-1}};var nl=function(t,e,i,r,n,a){rl.call(this,t,e,a);this.crossOrigin_=r;this.src_=i;this.image_=new Image;if(r!==null){this.image_.crossOrigin=r}this.imageListenerKeys_=null;this.tileLoadFunction_=n};qn.inherits(nl,rl);nl.prototype.disposeInternal=function(){if(this.state==us.LOADING){this.unlistenImage_();this.image_=nl.getBlankImage()}if(this.interimTile){this.interimTile.dispose()}this.state=us.ABORT;this.changed();rl.prototype.disposeInternal.call(this)};nl.prototype.getImage=function(){return this.image_};nl.prototype.getKey=function(){return this.src_};nl.prototype.handleImageError_=function(){this.state=us.ERROR;this.unlistenImage_();this.image_=nl.getBlankImage();this.changed()};nl.prototype.handleImageLoad_=function(){if(this.image_.naturalWidth&&this.image_.naturalHeight){this.state=us.LOADED}else{this.state=us.EMPTY}this.unlistenImage_();this.changed()};nl.prototype.load=function(){if(this.state==us.ERROR){this.state=us.IDLE;this.image_=new Image;if(this.crossOrigin_!==null){this.image_.crossOrigin=this.crossOrigin_}}if(this.state==us.IDLE){this.state=us.LOADING;this.changed();this.imageListenerKeys_=[$n.listenOnce(this.image_,ra.ERROR,this.handleImageError_,this),$n.listenOnce(this.image_,ra.LOAD,this.handleImageLoad_,this)];this.tileLoadFunction_(this,this.src_)}};nl.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach($n.unlistenByKey);this.imageListenerKeys_=null};nl.getBlankImage=function(){var t=Ts.createCanvasContext2D(1,1);t.fillStyle="rgba(0,0,0,0)";t.fillRect(0,0,1,1);return t.canvas};var al=function(t){uo.call(this,t)};qn.inherits(al,uo);al.prototype.expireCache=function(t){var e,i;while(this.canExpireCache()){e=this.peekLast();i=e.tileCoord[0].toString();if(i in t&&t[i].contains(e.tileCoord)){break}else{this.pop().dispose()}}};al.prototype.pruneExceptNewestZ=function(){if(this.getCount()===0){return}var t=this.peekFirstKey();var e=el.fromKey(t);var i=e[0];this.forEach((function(t){if(t.tileCoord[0]!==i){this.remove(el.getKey(t.tileCoord));t.dispose()}}),this)};var sl={};sl.calculateSourceResolution=function(t,e,i,r){var n=Ma.transform(i,e,t);var a=Ma.getPointResolution(e,r,i);var s=e.getMetersPerUnit();if(s!==undefined){a*=s}var o=t.getMetersPerUnit();if(o!==undefined){a/=o}var h=t.getExtent();if(!h||pa.containsCoordinate(h,n)){var l=Ma.getPointResolution(t,a,n)/a;if(isFinite(l)&&l>0){a/=l}}return a};sl.enlargeClipPoint_=function(t,e,i,r){var n=i-t,a=r-e;var s=Math.sqrt(n*n+a*a);return[Math.round(i+n/s),Math.round(r+a/s)]};sl.render=function(t,e,i,r,n,a,s,o,h,l,u){var f=Ts.createCanvasContext2D(Math.round(i*t),Math.round(i*e));if(h.length===0){return f.canvas}f.scale(i,i);var c=pa.createEmpty();h.forEach((function(t,e,i){pa.extend(c,t.extent)}));var d=pa.getWidth(c);var p=pa.getHeight(c);var v=Ts.createCanvasContext2D(Math.round(i*d/r),Math.round(i*p/r));var _=i/r;h.forEach((function(t,e,i){var r=t.extent[0]-c[0];var n=-(t.extent[3]-c[3]);var a=pa.getWidth(t.extent);var s=pa.getHeight(t.extent);v.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,r*_,n*_,a*_,s*_)}));var g=pa.getTopLeft(s);o.getTriangles().forEach((function(t,e,n){var s=t.source,o=t.target;var h=s[0][0],l=s[0][1],u=s[1][0],d=s[1][1],p=s[2][0],_=s[2][1];var m=(o[0][0]-g[0])/a,y=-(o[0][1]-g[1])/a;var E=(o[1][0]-g[0])/a,x=-(o[1][1]-g[1])/a;var T=(o[2][0]-g[0])/a,C=-(o[2][1]-g[1])/a;var R=h,M=l;h=0;l=0;u-=R;d-=M;p-=R;_-=M;var S=[[u,d,0,0,E-m],[p,_,0,0,T-m],[0,0,u,d,x-y],[0,0,p,_,C-y]];var I=ha.solveLinearSystem(S);if(!I){return}f.save();f.beginPath();var L=(m+E+T)/3,A=(y+x+C)/3;var w=sl.enlargeClipPoint_(L,A,m,y);var O=sl.enlargeClipPoint_(L,A,E,x);var b=sl.enlargeClipPoint_(L,A,T,C);f.moveTo(O[0],O[1]);f.lineTo(w[0],w[1]);f.lineTo(b[0],b[1]);f.clip();f.transform(I[0],I[2],I[1],I[3],m,y);f.translate(c[0]-R,c[3]-M);f.scale(r/i,-r/i);f.drawImage(v.canvas,0,0);f.restore()}));if(u){f.save();f.strokeStyle="black";f.lineWidth=1;o.getTriangles().forEach((function(t,e,i){var r=t.target;var n=(r[0][0]-g[0])/a,s=-(r[0][1]-g[1])/a;var o=(r[1][0]-g[0])/a,h=-(r[1][1]-g[1])/a;var l=(r[2][0]-g[0])/a,u=-(r[2][1]-g[1])/a;f.beginPath();f.moveTo(o,h);f.lineTo(n,s);f.lineTo(l,u);f.closePath();f.stroke()}));f.restore()}return f.canvas};var ol=function(t,e,i,r,n){this.sourceProj_=t;this.targetProj_=e;var a={};var s=Ma.getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];if(!a[e]){a[e]=s(t)}return a[e]};this.maxSourceExtent_=r;this.errorThresholdSquared_=n*n;this.triangles_=[];this.wrapsXInSource_=false;this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&pa.getWidth(r)==pa.getWidth(this.sourceProj_.getExtent());this.sourceWorldWidth_=this.sourceProj_.getExtent()?pa.getWidth(this.sourceProj_.getExtent()):null;this.targetWorldWidth_=this.targetProj_.getExtent()?pa.getWidth(this.targetProj_.getExtent()):null;var o=pa.getTopLeft(i);var h=pa.getTopRight(i);var l=pa.getBottomRight(i);var u=pa.getBottomLeft(i);var f=this.transformInv_(o);var c=this.transformInv_(h);var d=this.transformInv_(l);var p=this.transformInv_(u);this.addQuad_(o,h,l,u,f,c,d,p,qn.RASTER_REPROJECTION_MAX_SUBDIVISION);if(this.wrapsXInSource_){var v=Infinity;this.triangles_.forEach((function(t,e,i){v=Math.min(v,t.source[0][0],t.source[1][0],t.source[2][0])}));this.triangles_.forEach((function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-v>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];if(e[0][0]-v>this.sourceWorldWidth_/2){e[0][0]-=this.sourceWorldWidth_}if(e[1][0]-v>this.sourceWorldWidth_/2){e[1][0]-=this.sourceWorldWidth_}if(e[2][0]-v>this.sourceWorldWidth_/2){e[2][0]-=this.sourceWorldWidth_}var i=Math.min(e[0][0],e[1][0],e[2][0]);var r=Math.max(e[0][0],e[1][0],e[2][0]);if(r-i<this.sourceWorldWidth_/2){t.source=e}}}),this)}a={}};ol.prototype.addTriangle_=function(t,e,i,r,n,a){this.triangles_.push({source:[r,n,a],target:[t,e,i]})};ol.prototype.addQuad_=function(t,e,i,r,n,a,s,o,h){var l=pa.boundingExtent([n,a,s,o]);var u=this.sourceWorldWidth_?pa.getWidth(l)/this.sourceWorldWidth_:null;var f=this.sourceWorldWidth_;var c=this.sourceProj_.canWrapX()&&u>.5&&u<1;var d=false;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){var p=pa.boundingExtent([t,e,i,r]);var v=pa.getWidth(p)/this.targetWorldWidth_;d|=v>qn.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}if(!c&&this.sourceProj_.isGlobal()&&u){d|=u>qn.RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH}}if(!d&&this.maxSourceExtent_){if(!pa.intersects(l,this.maxSourceExtent_)){return}}if(!d){if(!isFinite(n[0])||!isFinite(n[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])){if(h>0){d=true}else{return}}}if(h>0){if(!d){var _=[(t[0]+i[0])/2,(t[1]+i[1])/2];var g=this.transformInv_(_);var m;if(c){var y=(ha.modulo(n[0],f)+ha.modulo(s[0],f))/2;m=y-ha.modulo(g[0],f)}else{m=(n[0]+s[0])/2-g[0]}var E=(n[1]+s[1])/2-g[1];var x=m*m+E*E;d=x>this.errorThresholdSquared_}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var T=[(e[0]+i[0])/2,(e[1]+i[1])/2];var C=this.transformInv_(T);var R=[(r[0]+t[0])/2,(r[1]+t[1])/2];var M=this.transformInv_(R);this.addQuad_(t,e,T,R,n,a,C,M,h-1);this.addQuad_(R,T,i,r,M,C,s,o,h-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2];var I=this.transformInv_(S);var L=[(i[0]+r[0])/2,(i[1]+r[1])/2];var A=this.transformInv_(L);this.addQuad_(t,S,L,r,n,I,A,o,h-1);this.addQuad_(S,e,i,L,I,a,s,A,h-1)}return}}if(c){if(!this.canWrapXInSource_){return}this.wrapsXInSource_=true}this.addTriangle_(t,i,r,n,s,o);this.addTriangle_(t,e,i,n,a,s)};ol.prototype.calculateSourceExtent=function(){var t=pa.createEmpty();this.triangles_.forEach((function(e,i,r){var n=e.source;pa.extendCoordinate(t,n[0]);pa.extendCoordinate(t,n[1]);pa.extendCoordinate(t,n[2])}));return t};ol.prototype.getTriangles=function(){return this.triangles_};var hl=function(t,e,i,r,n,a,s,o,h,l,u){rl.call(this,n,us.IDLE);this.renderEdges_=u!==undefined?u:false;this.pixelRatio_=s;this.gutter_=o;this.canvas_=null;this.sourceTileGrid_=e;this.targetTileGrid_=r;this.wrappedTileCoord_=a?a:n;this.sourceTiles_=[];this.sourcesListenerKeys_=null;this.sourceZ_=0;var f=r.getTileCoordExtent(this.wrappedTileCoord_);var c=this.targetTileGrid_.getExtent();var d=this.sourceTileGrid_.getExtent();var p=c?pa.getIntersection(f,c):f;if(pa.getArea(p)===0){this.state=us.EMPTY;return}var v=t.getExtent();if(v){if(!d){d=v}else{d=pa.getIntersection(d,v)}}var _=r.getResolution(this.wrappedTileCoord_[0]);var g=pa.getCenter(p);var m=sl.calculateSourceResolution(t,i,g,_);if(!isFinite(m)||m<=0){this.state=us.EMPTY;return}var y=l!==undefined?l:qn.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD;this.triangulation_=new ol(t,i,p,d,m*y);if(this.triangulation_.getTriangles().length===0){this.state=us.EMPTY;return}this.sourceZ_=e.getZForResolution(m);var E=this.triangulation_.calculateSourceExtent();if(d){if(t.canWrapX()){E[1]=ha.clamp(E[1],d[1],d[3]);E[3]=ha.clamp(E[3],d[1],d[3])}else{E=pa.getIntersection(E,d)}}if(!pa.getArea(E)){this.state=us.EMPTY}else{var x=e.getTileRangeForExtentAndZ(E,this.sourceZ_);for(var T=x.minX;T<=x.maxX;T++){for(var C=x.minY;C<=x.maxY;C++){var R=h(this.sourceZ_,T,C,s);if(R){this.sourceTiles_.push(R)}}}if(this.sourceTiles_.length===0){this.state=us.EMPTY}}};qn.inherits(hl,rl);hl.prototype.disposeInternal=function(){if(this.state==us.LOADING){this.unlistenSources_()}rl.prototype.disposeInternal.call(this)};hl.prototype.getImage=function(){return this.canvas_};hl.prototype.reproject_=function(){var t=[];this.sourceTiles_.forEach((function(e,i,r){if(e&&e.getState()==us.LOADED){t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}}),this);this.sourceTiles_.length=0;if(t.length===0){this.state=us.ERROR}else{var e=this.wrappedTileCoord_[0];var i=this.targetTileGrid_.getTileSize(e);var r=typeof i==="number"?i:i[0];var n=typeof i==="number"?i:i[1];var a=this.targetTileGrid_.getResolution(e);var s=this.sourceTileGrid_.getResolution(this.sourceZ_);var o=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sl.render(r,n,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),a,o,this.triangulation_,t,this.gutter_,this.renderEdges_);this.state=us.LOADED}this.changed()};hl.prototype.load=function(){if(this.state==us.IDLE){this.state=us.LOADING;this.changed();var t=0;this.sourcesListenerKeys_=[];this.sourceTiles_.forEach((function(e,i,r){var n=e.getState();if(n==us.IDLE||n==us.LOADING){t++;var a;a=$n.listen(e,ra.CHANGE,(function(i){var r=e.getState();if(r==us.LOADED||r==us.ERROR||r==us.EMPTY){$n.unlistenByKey(a);t--;if(t===0){this.unlistenSources_();this.reproject_()}}}),this);this.sourcesListenerKeys_.push(a)}}),this);this.sourceTiles_.forEach((function(t,e,i){var r=t.getState();if(r==us.IDLE){t.load()}}));if(t===0){setTimeout(this.reproject_.bind(this),0)}}};hl.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach($n.unlistenByKey);this.sourcesListenerKeys_=null};var ll=function(t){this.minZoom=t.minZoom!==undefined?t.minZoom:0;this.resolutions_=t.resolutions;oa.assert(fa.isSorted(this.resolutions_,(function(t,e){return e-t}),true),17);var e;if(!t.origins){for(var i=0,r=this.resolutions_.length-1;i<r;++i){if(!e){e=this.resolutions_[i]/this.resolutions_[i+1]}else{if(this.resolutions_[i]/this.resolutions_[i+1]!==e){e=undefined;break}}}}this.zoomFactor_=e;this.maxZoom=this.resolutions_.length-1;this.origin_=t.origin!==undefined?t.origin:null;this.origins_=null;if(t.origins!==undefined){this.origins_=t.origins;oa.assert(this.origins_.length==this.resolutions_.length,20)}var n=t.extent;if(n!==undefined&&!this.origin_&&!this.origins_){this.origin_=pa.getTopLeft(n)}oa.assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18);this.tileSizes_=null;if(t.tileSizes!==undefined){this.tileSizes_=t.tileSizes;oa.assert(this.tileSizes_.length==this.resolutions_.length,19)}this.tileSize_=t.tileSize!==undefined?t.tileSize:!this.tileSizes_?qn.DEFAULT_TILE_SIZE:null;oa.assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22);this.extent_=n!==undefined?n:null;this.fullTileRanges_=null;this.tmpSize_=[0,0];if(t.sizes!==undefined){this.fullTileRanges_=t.sizes.map((function(t,e){var i=new Mo(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));return i}),this)}else if(n){this.calculateTileRanges_(n)}};ll.tmpTileCoord_=[0,0,0];ll.prototype.forEachTileCoord=function(t,e,i){var r=this.getTileRangeForExtentAndZ(t,e);for(var n=r.minX,a=r.maxX;n<=a;++n){for(var s=r.minY,o=r.maxY;s<=o;++s){i([e,n,s])}}};ll.prototype.forEachTileCoordParentTileRange=function(t,e,i,r,n){var a,s,o;var h=null;var l=t[0]-1;if(this.zoomFactor_===2){s=t[1];o=t[2]}else{h=this.getTileCoordExtent(t,n)}while(l>=this.minZoom){if(this.zoomFactor_===2){s=Math.floor(s/2);o=Math.floor(o/2);a=Mo.createOrUpdate(s,s,o,o,r)}else{a=this.getTileRangeForExtentAndZ(h,l,r)}if(e.call(i,l,a)){return true}--l}return false};ll.prototype.getExtent=function(){return this.extent_};ll.prototype.getMaxZoom=function(){return this.maxZoom};ll.prototype.getMinZoom=function(){return this.minZoom};ll.prototype.getOrigin=function(t){if(this.origin_){return this.origin_}else{return this.origins_[t]}};ll.prototype.getResolution=function(t){return this.resolutions_[t]};ll.prototype.getResolutions=function(){return this.resolutions_};ll.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){var r=t[1]*2;var n=t[2]*2;return Mo.createOrUpdate(r,r+1,n,n+1,e)}var a=this.getTileCoordExtent(t,i);return this.getTileRangeForExtentAndZ(a,t[0]+1,e)}return null};ll.prototype.getTileRangeExtent=function(t,e,i){var r=this.getOrigin(t);var n=this.getResolution(t);var a=ws.toSize(this.getTileSize(t),this.tmpSize_);var s=r[0]+e.minX*a[0]*n;var o=r[0]+(e.maxX+1)*a[0]*n;var h=r[1]+e.minY*a[1]*n;var l=r[1]+(e.maxY+1)*a[1]*n;return pa.createOrUpdate(s,h,o,l,i)};ll.prototype.getTileRangeForExtentAndZ=function(t,e,i){var r=ll.tmpTileCoord_;this.getTileCoordForXYAndZ_(t[0],t[1],e,false,r);var n=r[1];var a=r[2];this.getTileCoordForXYAndZ_(t[2],t[3],e,true,r);return Mo.createOrUpdate(n,r[1],a,r[2],i)};ll.prototype.getTileCoordCenter=function(t){var e=this.getOrigin(t[0]);var i=this.getResolution(t[0]);var r=ws.toSize(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]+(t[2]+.5)*r[1]*i]};ll.prototype.getTileCoordExtent=function(t,e){var i=this.getOrigin(t[0]);var r=this.getResolution(t[0]);var n=ws.toSize(this.getTileSize(t[0]),this.tmpSize_);var a=i[0]+t[1]*n[0]*r;var s=i[1]+t[2]*n[1]*r;var o=a+n[0]*r;var h=s+n[1]*r;return pa.createOrUpdate(a,s,o,h,e)};ll.prototype.getTileCoordForCoordAndResolution=function(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,false,i)};ll.prototype.getTileCoordForXYAndResolution_=function(t,e,i,r,n){var a=this.getZForResolution(i);var s=i/this.getResolution(a);var o=this.getOrigin(a);var h=ws.toSize(this.getTileSize(a),this.tmpSize_);var l=r?.5:0;var u=r?0:.5;var f=Math.floor((t-o[0])/i+l);var c=Math.floor((e-o[1])/i+u);var d=s*f/h[0];var p=s*c/h[1];if(r){d=Math.ceil(d)-1;p=Math.ceil(p)-1}else{d=Math.floor(d);p=Math.floor(p)}return el.createOrUpdate(a,d,p,n)};ll.prototype.getTileCoordForXYAndZ_=function(t,e,i,r,n){var a=this.getOrigin(i);var s=this.getResolution(i);var o=ws.toSize(this.getTileSize(i),this.tmpSize_);var h=r?.5:0;var l=r?0:.5;var u=Math.floor((t-a[0])/s+h);var f=Math.floor((e-a[1])/s+l);var c=u/o[0];var d=f/o[1];if(r){c=Math.ceil(c)-1;d=Math.ceil(d)-1}else{c=Math.floor(c);d=Math.floor(d)}return el.createOrUpdate(i,c,d,n)};ll.prototype.getTileCoordForCoordAndZ=function(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,false,i)};ll.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]};ll.prototype.getTileSize=function(t){if(this.tileSize_){return this.tileSize_}else{return this.tileSizes_[t]}};ll.prototype.getFullTileRange=function(t){if(!this.fullTileRanges_){return null}else{return this.fullTileRanges_[t]}};ll.prototype.getZForResolution=function(t,e){var i=fa.linearFindNearest(this.resolutions_,t,e||0);return ha.clamp(i,this.minZoom,this.maxZoom)};ll.prototype.calculateTileRanges_=function(t){var e=this.resolutions_.length;var i=new Array(e);for(var r=this.minZoom;r<e;++r){i[r]=this.getTileRangeForExtentAndZ(t,r)}this.fullTileRanges_=i};var ul={};ul.getForProjection=function(t){var e=t.getDefaultTileGrid();if(!e){e=ul.createForProjection(t);t.setDefaultTileGrid(e)}return e};ul.wrapX=function(t,e,i){var r=e[0];var n=t.getTileCoordCenter(e);var a=ul.extentFromProjection(i);if(!pa.containsCoordinate(a,n)){var s=pa.getWidth(a);var o=Math.ceil((a[0]-n[0])/s);n[0]+=s*o;return t.getTileCoordForCoordAndZ(n,r)}else{return e}};ul.createForExtent=function(t,e,i,r){var n=r!==undefined?r:ca.TOP_LEFT;var a=ul.resolutionsFromExtent(t,e,i);return new ll({extent:t,origin:pa.getCorner(t,n),resolutions:a,tileSize:i})};ul.createXYZ=function(t){var e={};Qn.assign(e,t!==undefined?t:{});if(e.extent===undefined){e.extent=Ma.get("EPSG:3857").getExtent()}e.resolutions=ul.resolutionsFromExtent(e.extent,e.maxZoom,e.tileSize);delete e.maxZoom;return new ll(e)};ul.resolutionsFromExtent=function(t,e,i){var r=e!==undefined?e:qn.DEFAULT_MAX_ZOOM;var n=pa.getHeight(t);var a=pa.getWidth(t);var s=ws.toSize(i!==undefined?i:qn.DEFAULT_TILE_SIZE);var o=Math.max(a/s[0],n/s[1]);var h=r+1;var l=new Array(h);for(var u=0;u<h;++u){l[u]=o/Math.pow(2,u)}return l};ul.createForProjection=function(t,e,i,r){var n=ul.extentFromProjection(t);return ul.createForExtent(n,e,i,r)};ul.extentFromProjection=function(t){t=Ma.get(t);var e=t.getExtent();if(!e){var i=180*Ma.METERS_PER_UNIT[ma.DEGREES]/t.getMetersPerUnit();e=pa.createOrUpdate(-i,-i,i,i)}return e};var fl=function(t){this.html_=t.html;this.tileRanges_=t.tileRanges?t.tileRanges:null};fl.prototype.getHTML=function(){return this.html_};fl.prototype.intersectsAnyTileRange=function(t,e,i){if(!this.tileRanges_){return true}var r,n,a,s;for(s in t){if(!(s in this.tileRanges_)){continue}a=t[s];var o;for(r=0,n=this.tileRanges_[s].length;r<n;++r){o=this.tileRanges_[s][r];if(o.intersects(a)){return true}var h=e.getTileRangeForExtentAndZ(ul.extentFromProjection(i),parseInt(s,10));var l=h.getWidth();if(a.minX<h.minX||a.maxX>h.maxX){if(o.intersects(new Mo(ha.modulo(a.minX,l),ha.modulo(a.maxX,l),a.minY,a.maxY))){return true}if(a.getWidth()>l&&o.intersects(h)){return true}}}}return false};var cl=function(t){aa.call(this);this.projection_=Ma.get(t.projection);this.attributions_=null;this.attributions2_=this.adaptAttributions_(t.attributions);this.logo_=t.logo;this.state_=t.state!==undefined?t.state:Ms.READY;this.wrapX_=t.wrapX!==undefined?t.wrapX:false};qn.inherits(cl,aa);cl.prototype.adaptAttributions_=function(t){if(!t){return null}if(t instanceof fl){this.attributions_=[t];return function(e){return[t.getHTML()]}}if(Array.isArray(t)){if(t[0]instanceof fl){this.attributions_=t;var e=t.map((function(t){return t.getHTML()}));return function(t){return e}}this.attributions_=t.map((function(t){return new fl({html:t})}));return function(e){return t}}if(typeof t==="function"){return t}this.attributions_=[new fl({html:t})];return function(e){return[t]}};cl.prototype.forEachFeatureAtCoordinate=qn.nullFunction;cl.prototype.getAttributions=function(){return this.attributions_};cl.prototype.getAttributions2=function(){return this.attributions2_};cl.prototype.getLogo=function(){return this.logo_};cl.prototype.getProjection=function(){return this.projection_};cl.prototype.getResolutions=function(){};cl.prototype.getState=function(){return this.state_};cl.prototype.getWrapX=function(){return this.wrapX_};cl.prototype.refresh=function(){this.changed()};cl.prototype.setAttributions=function(t){this.attributions2_=this.adaptAttributions_(t);this.changed()};cl.prototype.setLogo=function(t){this.logo_=t};cl.prototype.setState=function(t){this.state_=t;this.changed()};var dl=function(t){cl.call(this,{attributions:t.attributions,extent:t.extent,logo:t.logo,projection:t.projection,state:t.state,wrapX:t.wrapX});this.opaque_=t.opaque!==undefined?t.opaque:false;this.tilePixelRatio_=t.tilePixelRatio!==undefined?t.tilePixelRatio:1;this.tileGrid=t.tileGrid!==undefined?t.tileGrid:null;this.tileCache=new al(t.cacheSize);this.tmpSize=[0,0];this.key_="";this.tileOptions={transition:t.transition}};qn.inherits(dl,cl);dl.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()};dl.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);if(i){i.expireCache(e)}};dl.prototype.forEachLoadedTile=function(t,e,i,r){var n=this.getTileCacheForProjection(t);if(!n){return false}var a=true;var s,o,h;for(var l=i.minX;l<=i.maxX;++l){for(var u=i.minY;u<=i.maxY;++u){o=el.getKeyZXY(e,l,u);h=false;if(n.containsKey(o)){s=n.get(o);h=s.getState()===us.LOADED;if(h){h=r(s)!==false}}if(!h){a=false}}}return a};dl.prototype.getGutter=function(t){return 0};dl.prototype.getKey=function(){return this.key_};dl.prototype.setKey=function(t){if(this.key_!==t){this.key_=t;this.changed()}};dl.prototype.getOpaque=function(t){return this.opaque_};dl.prototype.getResolutions=function(){return this.tileGrid.getResolutions()};dl.prototype.getTile=function(t,e,i,r,n){};dl.prototype.getTileGrid=function(){return this.tileGrid};dl.prototype.getTileGridForProjection=function(t){if(!this.tileGrid){return ul.getForProjection(t)}else{return this.tileGrid}};dl.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(e&&!Ma.equivalent(e,t)){return null}else{return this.tileCache}};dl.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_};dl.prototype.getTilePixelSize=function(t,e,i){var r=this.getTileGridForProjection(i);var n=this.getTilePixelRatio(e);var a=ws.toSize(r.getTileSize(t),this.tmpSize);if(n==1){return a}else{return ws.scale(a,n,this.tmpSize)}};dl.prototype.getTileCoordForTileUrlFunction=function(t,e){var i=e!==undefined?e:this.getProjection();var r=this.getTileGridForProjection(i);if(this.getWrapX()&&i.isGlobal()){t=ul.wrapX(r,t,i)}return el.withinExtentAndZ(t,r)?t:null};dl.prototype.refresh=function(){this.tileCache.clear();this.changed()};dl.prototype.useTile=qn.nullFunction;dl.Event=function(t,e){ea.call(this,t);this.tile=e};qn.inherits(dl.Event,ea);var pl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var vl=function(t){dl.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition});this.tileLoadFunction=t.tileLoadFunction;this.tileUrlFunction=this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.nullTileUrlFunction;this.urls=null;if(t.urls){this.setUrls(t.urls)}else if(t.url){this.setUrl(t.url)}if(t.tileUrlFunction){this.setTileUrlFunction(t.tileUrlFunction)}this.tileLoadingKeys_={}};qn.inherits(vl,dl);vl.prototype.getTileLoadFunction=function(){return this.tileLoadFunction};vl.prototype.getTileUrlFunction=function(){return this.tileUrlFunction};vl.prototype.getUrls=function(){return this.urls};vl.prototype.handleTileChange=function(t){var e=t.target;var i=qn.getUid(e);var r=e.getState();var n;if(r==us.LOADING){this.tileLoadingKeys_[i]=true;n=pl.TILELOADSTART}else if(i in this.tileLoadingKeys_){delete this.tileLoadingKeys_[i];n=r==us.ERROR?pl.TILELOADERROR:r==us.LOADED||r==us.ABORT?pl.TILELOADEND:undefined}if(n!=undefined){this.dispatchEvent(new dl.Event(n,e))}};vl.prototype.setTileLoadFunction=function(t){this.tileCache.clear();this.tileLoadFunction=t;this.changed()};vl.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t;this.tileCache.pruneExceptNewestZ();if(typeof e!=="undefined"){this.setKey(e)}else{this.changed()}};vl.prototype.setUrl=function(t){var e=this.urls=il.expandUrl(t);this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTemplates(e,this.tileGrid),t)};vl.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTemplates(t,this.tileGrid),e)};vl.prototype.useTile=function(t,e,i){var r=el.getKeyZXY(t,e,i);if(this.tileCache.containsKey(r)){this.tileCache.get(r)}};var _l=function(t){vl.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,logo:t.logo,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:_l.defaultTileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition});this.crossOrigin=t.crossOrigin!==undefined?t.crossOrigin:null;this.tileClass=t.tileClass!==undefined?t.tileClass:nl;this.tileCacheForProjection={};this.tileGridForProjection={};this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold;this.renderReprojectionEdges_=false};qn.inherits(_l,vl);_l.prototype.canExpireCache=function(){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.canExpireCache.call(this)}if(this.tileCache.canExpireCache()){return true}else{for(var t in this.tileCacheForProjection){if(this.tileCacheForProjection[t].canExpireCache()){return true}}}return false};_l.prototype.expireCache=function(t,e){if(!qn.ENABLE_RASTER_REPROJECTION){vl.prototype.expireCache.call(this,t,e);return}var i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(var r in this.tileCacheForProjection){var n=this.tileCacheForProjection[r];n.expireCache(n==i?e:{})}};_l.prototype.getGutter=function(t){if(qn.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Ma.equivalent(this.getProjection(),t)){return 0}else{return this.getGutterInternal()}};_l.prototype.getGutterInternal=function(){return 0};_l.prototype.getOpaque=function(t){if(qn.ENABLE_RASTER_REPROJECTION&&this.getProjection()&&t&&!Ma.equivalent(this.getProjection(),t)){return false}else{return vl.prototype.getOpaque.call(this,t)}};_l.prototype.getTileGridForProjection=function(t){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.getTileGridForProjection.call(this,t)}var e=this.getProjection();if(this.tileGrid&&(!e||Ma.equivalent(e,t))){return this.tileGrid}else{var i=qn.getUid(t).toString();if(!(i in this.tileGridForProjection)){this.tileGridForProjection[i]=ul.getForProjection(t)}return this.tileGridForProjection[i]}};_l.prototype.getTileCacheForProjection=function(t){if(!qn.ENABLE_RASTER_REPROJECTION){return vl.prototype.getTileCacheForProjection.call(this,t)}var e=this.getProjection();if(!e||Ma.equivalent(e,t)){return this.tileCache}else{var i=qn.getUid(t).toString();if(!(i in this.tileCacheForProjection)){this.tileCacheForProjection[i]=new al(this.tileCache.highWaterMark)}return this.tileCacheForProjection[i]}};_l.prototype.createTile_=function(t,e,i,r,n,a){var s=[t,e,i];var o=this.getTileCoordForTileUrlFunction(s,n);var h=o?this.tileUrlFunction(o,r,n):undefined;var l=new this.tileClass(s,h!==undefined?us.IDLE:us.EMPTY,h!==undefined?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);l.key=a;$n.listen(l,ra.CHANGE,this.handleTileChange,this);return l};_l.prototype.getTile=function(t,e,i,r,n){var a=this.getProjection();if(!qn.ENABLE_RASTER_REPROJECTION||!a||!n||Ma.equivalent(a,n)){return this.getTileInternal(t,e,i,r,a||n)}else{var s=this.getTileCacheForProjection(n);var o=[t,e,i];var h;var l=el.getKey(o);if(s.containsKey(l)){h=s.get(l)}var u=this.getKey();if(h&&h.key==u){return h}else{var f=this.getTileGridForProjection(a);var c=this.getTileGridForProjection(n);var d=this.getTileCoordForTileUrlFunction(o,n);var p=new hl(a,f,n,c,o,d,this.getTilePixelRatio(r),this.getGutterInternal(),function(t,e,i,r){return this.getTileInternal(t,e,i,r,a)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);p.key=u;if(h){p.interimTile=h;p.refreshInterimChain();s.replace(l,p)}else{s.set(l,p)}return p}}};_l.prototype.getTileInternal=function(t,e,i,r,n){var a=null;var s=el.getKeyZXY(t,e,i);var o=this.getKey();if(!this.tileCache.containsKey(s)){a=this.createTile_(t,e,i,r,n,o);this.tileCache.set(s,a)}else{a=this.tileCache.get(s);if(a.key!=o){var h=a;a=this.createTile_(t,e,i,r,n,o);if(h.getState()==us.IDLE){a.interimTile=h.interimTile}else{a.interimTile=h}a.refreshInterimChain();this.tileCache.replace(s,a)}}return a};_l.prototype.setRenderReprojectionEdges=function(t){if(!qn.ENABLE_RASTER_REPROJECTION||this.renderReprojectionEdges_==t){return}this.renderReprojectionEdges_=t;for(var e in this.tileCacheForProjection){this.tileCacheForProjection[e].clear()}this.changed()};_l.prototype.setTileGridForProjection=function(t,e){if(qn.ENABLE_RASTER_REPROJECTION){var i=Ma.get(t);if(i){var r=qn.getUid(i).toString();if(!(r in this.tileGridForProjection)){this.tileGridForProjection[r]=e}}}};_l.defaultTileLoadFunction=function(t,e){t.getImage().src=e};var gl={KVP:"KVP",REST:"REST"};var ml=function(t){this.matrixIds_=t.matrixIds;ll.call(this,{extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes})};qn.inherits(ml,ll);ml.prototype.getMatrixId=function(t){return this.matrixIds_[t]};ml.prototype.getMatrixIds=function(){return this.matrixIds_};ml.createFromCapabilitiesMatrixSet=function(t,e,i){var r=[];var n=[];var a=[];var s=[];var o=[];var h=i!==undefined?i:[];var l="SupportedCRS";var u="TileMatrix";var f="Identifier";var c="ScaleDenominator";var d="TopLeftCorner";var p="TileWidth";var v="TileHeight";var _=t[l];var g=Ma.get(_.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(_);var m=g.getMetersPerUnit();var y=g.getAxisOrientation().substr(0,2)=="ne";t[u].sort((function(t,e){return e[c]-t[c]}));t[u].forEach((function(t,e,i){var l;if(h.length>0){l=fa.find(h,(function(e,i,r){return t[f]==e[u]}))}else{l=true}if(l){n.push(t[f]);var _=t[c]*28e-5/m;var g=t[p];var E=t[v];if(y){a.push([t[d][1],t[d][0]])}else{a.push(t[d])}r.push(_);s.push(g==E?g:[g,E]);o.push([t["MatrixWidth"],-t["MatrixHeight"]])}}));return new ml({extent:e,origins:a,resolutions:r,matrixIds:n,tileSizes:s,sizes:o})};var yl={};yl.appendParams=function(t,e){var i=[];Object.keys(e).forEach((function(t){if(e[t]!==null&&e[t]!==undefined){i.push(t+"="+encodeURIComponent(e[t]))}}));var r=i.join("&");t=t.replace(/[?&]$/,"");t=t.indexOf("?")===-1?t+"?":t+"&";return t+r};var El=function(t){this.version_=t.version!==undefined?t.version:"1.0.0";this.format_=t.format!==undefined?t.format:"image/jpeg";this.dimensions_=t.dimensions!==undefined?t.dimensions:{};this.layer_=t.layer;this.matrixSet_=t.matrixSet;this.style_=t.style;var e=t.urls;if(e===undefined&&t.url!==undefined){e=il.expandUrl(t.url)}this.requestEncoding_=t.requestEncoding!==undefined?t.requestEncoding:gl.KVP;var i=this.requestEncoding_;var r=t.tileGrid;var n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};if(i==gl.KVP){Qn.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_})}var a=this.dimensions_;this.createFromWMTSTemplate_=function(t){t=i==gl.KVP?yl.appendParams(t,n):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in n?n[e.toLowerCase()]:t}));return function(e,n,s){if(!e){return undefined}else{var o={TileMatrix:r.getMatrixId(e[0]),TileCol:e[1],TileRow:-e[2]-1};Qn.assign(o,a);var h=t;if(i==gl.KVP){h=yl.appendParams(h,o)}else{h=h.replace(/\{(\w+?)\}/g,(function(t,e){return o[e]}))}return h}}};var s=e&&e.length>0?il.createFromTileUrlFunctions(e.map(this.createFromWMTSTemplate_)):il.nullTileUrlFunction;_l.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,logo:t.logo,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:r,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:s,urls:e,wrapX:t.wrapX!==undefined?t.wrapX:false,transition:t.transition});this.setKey(this.getKeyForDimensions_())};qn.inherits(El,_l);El.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):il.createFromTileUrlFunctions(t.map(this.createFromWMTSTemplate_.bind(this))),e)};El.prototype.getDimensions=function(){return this.dimensions_};El.prototype.getFormat=function(){return this.format_};El.prototype.getLayer=function(){return this.layer_};El.prototype.getMatrixSet=function(){return this.matrixSet_};El.prototype.getRequestEncoding=function(){return this.requestEncoding_};El.prototype.getStyle=function(){return this.style_};El.prototype.getVersion=function(){return this.version_};El.prototype.getKeyForDimensions_=function(){var t=0;var e=[];for(var i in this.dimensions_){e[t++]=i+"-"+this.dimensions_[i]}return e.join("/")};El.prototype.updateDimensions=function(t){Qn.assign(this.dimensions_,t);this.setKey(this.getKeyForDimensions_())};El.optionsFromCapabilities=function(t,e){var i=t["Contents"]["Layer"];var r=fa.find(i,(function(t,i,r){return t["Identifier"]==e["layer"]}));if(r===null){return null}var n=t["Contents"]["TileMatrixSet"];var a,s,o;if(r["TileMatrixSetLink"].length>1){if("projection"in e){a=fa.findIndex(r["TileMatrixSetLink"],(function(t,i,r){var a=fa.find(n,(function(e){return e["Identifier"]==t["TileMatrixSet"]}));var s=a["SupportedCRS"];var o=Ma.get(s.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(s);var h=Ma.get(e["projection"]);if(o&&h){return Ma.equivalent(o,h)}else{return s==e["projection"]}}))}else{a=fa.findIndex(r["TileMatrixSetLink"],(function(t,i,r){return t["TileMatrixSet"]==e["matrixSet"]}))}}else{a=0}if(a<0){a=0}s=r["TileMatrixSetLink"][a]["TileMatrixSet"];o=r["TileMatrixSetLink"][a]["TileMatrixSetLimits"];var h=r["Format"][0];if("format"in e){h=e["format"]}a=fa.findIndex(r["Style"],(function(t,i,r){if("style"in e){return t["Title"]==e["style"]}else{return t["isDefault"]}}));if(a<0){a=0}var l=r["Style"][a]["Identifier"];var u={};if("Dimension"in r){r["Dimension"].forEach((function(t,e,i){var r=t["Identifier"];var n=t["Default"];if(n===undefined){n=t["Value"][0]}u[r]=n}))}var f=t["Contents"]["TileMatrixSet"];var c=fa.find(f,(function(t,e,i){return t["Identifier"]==s}));var d;var p=c["SupportedCRS"];if(p){d=Ma.get(p.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ma.get(p)}if("projection"in e){var v=Ma.get(e["projection"]);if(v){if(!d||Ma.equivalent(v,d)){d=v}}}var _=r["WGS84BoundingBox"];var g,m;if(_!==undefined){var y=Ma.get("EPSG:4326").getExtent();m=_[0]==y[0]&&_[2]==y[2];g=Ma.transformExtent(_,"EPSG:4326",d);var E=d.getExtent();if(E){if(!pa.containsExtent(E,g)){g=undefined}}}var x=ml.createFromCapabilitiesMatrixSet(c,g,o);var T=[];var C=e["requestEncoding"];C=C!==undefined?C:"";if("OperationsMetadata"in t&&"GetTile"in t["OperationsMetadata"]){var R=t["OperationsMetadata"]["GetTile"]["DCP"]["HTTP"]["Get"];for(var M=0,S=R.length;M<S;++M){if(R[M]["Constraint"]){var I=fa.find(R[M]["Constraint"],(function(t){return t["name"]=="GetEncoding"}));var L=I["AllowedValues"]["Value"];if(C===""){C=L[0]}if(C===gl.KVP){if(fa.includes(L,gl.KVP)){T.push(R[M]["href"])}}else{break}}else if(R[M]["href"]){C=gl.KVP;T.push(R[M]["href"])}}}if(T.length===0){C=gl.REST;r["ResourceURL"].forEach((function(t){if(t["resourceType"]==="tile"){h=t["format"];T.push(t["template"])}}))}return{urls:T,layer:e["layer"],matrixSet:s,format:h,projection:d,requestEncoding:C,tileGrid:x,style:l,dimensions:u,wrapX:m,crossOrigin:e["crossOrigin"]}};var xl={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var Tl={};Tl.DOCUMENT=document.implementation.createDocument("","",null);Tl.createElementNS=function(t,e){return Tl.DOCUMENT.createElementNS(t,e)};Tl.getAllTextContent=function(t,e){return Tl.getAllTextContent_(t,e,[]).join("")};Tl.getAllTextContent_=function(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE){if(e){i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,""))}else{i.push(t.nodeValue)}}else{var r;for(r=t.firstChild;r;r=r.nextSibling){Tl.getAllTextContent_(r,e,i)}}return i};Tl.isDocument=function(t){return t instanceof Document};Tl.isNode=function(t){return t instanceof Node};Tl.getAttributeNS=function(t,e,i){return t.getAttributeNS(e,i)||""};Tl.setAttributeNS=function(t,e,i,r){t.setAttributeNS(e,i,r)};Tl.parse=function(t){return(new DOMParser).parseFromString(t,"application/xml")};Tl.makeArrayExtender=function(t,e){return function(i,r){var n=t.call(e,i,r);if(n!==undefined){var a=r[r.length-1];fa.extend(a,n)}}};Tl.makeArrayPusher=function(t,e){return function(i,r){var n=t.call(e!==undefined?e:this,i,r);if(n!==undefined){var a=r[r.length-1];a.push(n)}}};Tl.makeReplacer=function(t,e){return function(i,r){var n=t.call(e!==undefined?e:this,i,r);if(n!==undefined){r[r.length-1]=n}}};Tl.makeObjectPropertyPusher=function(t,e,i){return function(r,n){var a=t.call(i!==undefined?i:this,r,n);if(a!==undefined){var s=n[n.length-1];var o=e!==undefined?e:r.localName;var h;if(o in s){h=s[o]}else{h=s[o]=[]}h.push(a)}}};Tl.makeObjectPropertySetter=function(t,e,i){return function(r,n){var a=t.call(i!==undefined?i:this,r,n);if(a!==undefined){var s=n[n.length-1];var o=e!==undefined?e:r.localName;s[o]=a}}};Tl.makeChildAppender=function(t,e){return function(i,r,n){t.call(e!==undefined?e:this,i,r,n);var a=n[n.length-1];var s=a.node;s.appendChild(i)}};Tl.makeArraySerializer=function(t,e){var i,r;return function(e,n,a){if(i===undefined){i={};var s={};s[e.localName]=t;i[e.namespaceURI]=s;r=Tl.makeSimpleNodeFactory(e.localName)}Tl.serialize(i,r,n,a)}};Tl.makeSimpleNodeFactory=function(t,e){var i=t;return function(t,r,n){var a=r[r.length-1];var s=a.node;var o=i;if(o===undefined){o=n}var h=e;if(e===undefined){h=s.namespaceURI}return Tl.createElementNS(h,o)}};Tl.OBJECT_PROPERTY_NODE_FACTORY=Tl.makeSimpleNodeFactory();Tl.makeSequence=function(t,e){var i=e.length;var r=new Array(i);for(var n=0;n<i;++n){r[n]=t[e[n]]}return r};Tl.makeStructureNS=function(t,e,i){var r=i!==undefined?i:{};var n,a;for(n=0,a=t.length;n<a;++n){r[t[n]]=e}return r};Tl.parseNode=function(t,e,i,r){var n;for(n=e.firstElementChild;n;n=n.nextElementSibling){var a=t[n.namespaceURI];if(a!==undefined){var s=a[n.localName];if(s!==undefined){s.call(r,n,i)}}}};Tl.pushParseAndPop=function(t,e,i,r,n){r.push(t);Tl.parseNode(e,i,r,n);return r.pop()};Tl.serialize=function(t,e,i,r,n,a){var s=(n!==undefined?n:i).length;var o,h;for(var l=0;l<s;++l){o=i[l];if(o!==undefined){h=e.call(a,o,r,n!==undefined?n[l]:undefined);if(h!==undefined){t[h.namespaceURI][h.localName].call(a,h,o,r)}}}};Tl.pushSerializeAndPop=function(t,e,i,r,n,a,s){n.push(t);Tl.serialize(e,i,r,n,a,s);return n.pop()};var Cl={};Cl.loadFeaturesXhr=function(t,e,i,r){return function(n,a,s){var o=new XMLHttpRequest;o.open("GET",typeof t==="function"?t(n,a,s):t,true);if(e.getType()==xl.ARRAY_BUFFER){o.responseType="arraybuffer"}o.onload=function(t){if(!o.status||o.status>=200&&o.status<300){var n=e.getType();var a;if(n==xl.JSON||n==xl.TEXT){a=o.responseText}else if(n==xl.XML){a=o.responseXML;if(!a){a=Tl.parse(o.responseText)}}else if(n==xl.ARRAY_BUFFER){a=o.response}if(a){i.call(this,e.readFeatures(a,{featureProjection:s}),e.readProjection(a),e.getLastExtent())}else{r.call(this)}}else{r.call(this)}}.bind(this);o.onerror=function(){r.call(this)}.bind(this);o.send()}};Cl.xhr=function(t,e){return Cl.loadFeaturesXhr(t,e,(function(t,e){this.addFeatures(t)}),qn.nullFunction)};var Rl={};Rl.all=function(t,e){return[[-Infinity,-Infinity,Infinity,Infinity]]};Rl.bbox=function(t,e){return[t]};Rl.tile=function(t){return function(e,i){var r=t.getZForResolution(i);var n=t.getTileRangeForExtentAndZ(e,r);var a=[];var s=[r,0,0];for(s[1]=n.minX;s[1]<=n.maxX;++s[1]){for(s[2]=n.minY;s[2]<=n.maxY;++s[2]){a.push(t.getTileCoordExtent(s))}}return a}};var Ml={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"};var Sl=function(t){var e=t||{};cl.call(this,{attributions:e.attributions,logo:e.logo,projection:undefined,state:Ms.READY,wrapX:e.wrapX!==undefined?e.wrapX:true});this.loader_=qn.nullFunction;this.format_=e.format;this.overlaps_=e.overlaps==undefined?true:e.overlaps;this.url_=e.url;if(e.loader!==undefined){this.loader_=e.loader}else if(this.url_!==undefined){oa.assert(this.format_,7);this.loader_=Cl.xhr(this.url_,this.format_)}this.strategy_=e.strategy!==undefined?e.strategy:Rl.all;var i=e.useSpatialIndex!==undefined?e.useSpatialIndex:true;this.featuresRtree_=i?new bh:null;this.loadedExtentsRtree_=new bh;this.nullGeometryFeatures_={};this.idIndex_={};this.undefIdIndex_={};this.featureChangeKeys_={};this.featuresCollection_=null;var r,n;if(e.features instanceof Ka){r=e.features;n=r.getArray()}else if(Array.isArray(e.features)){n=e.features}if(!i&&r===undefined){r=new Ka(n)}if(n!==undefined){this.addFeaturesInternal(n)}if(r!==undefined){this.bindFeaturesCollection_(r)}};qn.inherits(Sl,cl);Sl.prototype.addFeature=function(t){this.addFeatureInternal(t);this.changed()};Sl.prototype.addFeatureInternal=function(t){var e=qn.getUid(t).toString();if(!this.addToIndex_(e,t)){return}this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var r=i.getExtent();if(this.featuresRtree_){this.featuresRtree_.insert(r,t)}}else{this.nullGeometryFeatures_[e]=t}this.dispatchEvent(new Sl.Event(Ml.ADDFEATURE,t))};Sl.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[$n.listen(e,ra.CHANGE,this.handleFeatureChange_,this),$n.listen(e,Jn.PROPERTYCHANGE,this.handleFeatureChange_,this)]};Sl.prototype.addToIndex_=function(t,e){var i=true;var r=e.getId();if(r!==undefined){if(!(r.toString()in this.idIndex_)){this.idIndex_[r.toString()]=e}else{i=false}}else{oa.assert(!(t in this.undefIdIndex_),30);this.undefIdIndex_[t]=e}return i};Sl.prototype.addFeatures=function(t){this.addFeaturesInternal(t);this.changed()};Sl.prototype.addFeaturesInternal=function(t){var e,i,r,n;var a=[];var s=[];var o=[];for(i=0,r=t.length;i<r;i++){n=t[i];e=qn.getUid(n).toString();if(this.addToIndex_(e,n)){s.push(n)}}for(i=0,r=s.length;i<r;i++){n=s[i];e=qn.getUid(n).toString();this.setupChangeEvents_(e,n);var h=n.getGeometry();if(h){var l=h.getExtent();a.push(l);o.push(n)}else{this.nullGeometryFeatures_[e]=n}}if(this.featuresRtree_){this.featuresRtree_.load(a,o)}for(i=0,r=s.length;i<r;i++){this.dispatchEvent(new Sl.Event(Ml.ADDFEATURE,s[i]))}};Sl.prototype.bindFeaturesCollection_=function(t){var e=false;$n.listen(this,Ml.ADDFEATURE,(function(i){if(!e){e=true;t.push(i.feature);e=false}}));$n.listen(this,Ml.REMOVEFEATURE,(function(i){if(!e){e=true;t.remove(i.feature);e=false}}));$n.listen(t,Ha.ADD,(function(t){if(!e){e=true;this.addFeature(t.element);e=false}}),this);$n.listen(t,Ha.REMOVE,(function(t){if(!e){e=true;this.removeFeature(t.element);e=false}}),this);this.featuresCollection_=t};Sl.prototype.clear=function(t){if(t){for(var e in this.featureChangeKeys_){var i=this.featureChangeKeys_[e];i.forEach($n.unlistenByKey)}if(!this.featuresCollection_){this.featureChangeKeys_={};this.idIndex_={};this.undefIdIndex_={}}}else{if(this.featuresRtree_){this.featuresRtree_.forEach(this.removeFeatureInternal,this);for(var r in this.nullGeometryFeatures_){this.removeFeatureInternal(this.nullGeometryFeatures_[r])}}}if(this.featuresCollection_){this.featuresCollection_.clear()}if(this.featuresRtree_){this.featuresRtree_.clear()}this.loadedExtentsRtree_.clear();this.nullGeometryFeatures_={};var n=new Sl.Event(Ml.CLEAR);this.dispatchEvent(n);this.changed()};Sl.prototype.forEachFeature=function(t,e){if(this.featuresRtree_){return this.featuresRtree_.forEach(t,e)}else if(this.featuresCollection_){return this.featuresCollection_.forEach(t,e)}};Sl.prototype.forEachFeatureAtCoordinateDirect=function(t,e,i){var r=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(r,(function(r){var n=r.getGeometry();if(n.intersectsCoordinate(t)){return e.call(i,r)}else{return undefined}}))};Sl.prototype.forEachFeatureInExtent=function(t,e,i){if(this.featuresRtree_){return this.featuresRtree_.forEachInExtent(t,e,i)}else if(this.featuresCollection_){return this.featuresCollection_.forEach(e,i)}};Sl.prototype.forEachFeatureIntersectingExtent=function(t,e,i){return this.forEachFeatureInExtent(t,(function(r){var n=r.getGeometry();if(n.intersectsExtent(t)){var a=e.call(i,r);if(a){return a}}}))};Sl.prototype.getFeaturesCollection=function(){return this.featuresCollection_};Sl.prototype.getFeatures=function(){var t;if(this.featuresCollection_){t=this.featuresCollection_.getArray()}else if(this.featuresRtree_){t=this.featuresRtree_.getAll();if(!Qn.isEmpty(this.nullGeometryFeatures_)){fa.extend(t,Qn.getValues(this.nullGeometryFeatures_))}}return t};Sl.prototype.getFeaturesAtCoordinate=function(t){var e=[];this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)}));return e};Sl.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_.getInExtent(t)};Sl.prototype.getClosestFeatureToCoordinate=function(t,e){var i=t[0];var r=t[1];var n=null;var a=[NaN,NaN];var s=Infinity;var o=[-Infinity,-Infinity,Infinity,Infinity];var h=e?e:_a.TRUE;this.featuresRtree_.forEachInExtent(o,(function(t){if(h(t)){var e=t.getGeometry();var l=s;s=e.closestPointXY(i,r,a,s);if(s<l){n=t;var u=Math.sqrt(s);o[0]=i-u;o[1]=r-u;o[2]=i+u;o[3]=r+u}}}));return n};Sl.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)};Sl.prototype.getFeatureById=function(t){var e=this.idIndex_[t.toString()];return e!==undefined?e:null};Sl.prototype.getFormat=function(){return this.format_};Sl.prototype.getOverlaps=function(){return this.overlaps_};Sl.prototype.getResolutions=function(){};Sl.prototype.getUrl=function(){return this.url_};Sl.prototype.handleFeatureChange_=function(t){var e=t.target;var i=qn.getUid(e).toString();var r=e.getGeometry();if(!r){if(!(i in this.nullGeometryFeatures_)){if(this.featuresRtree_){this.featuresRtree_.remove(e)}this.nullGeometryFeatures_[i]=e}}else{var n=r.getExtent();if(i in this.nullGeometryFeatures_){delete this.nullGeometryFeatures_[i];if(this.featuresRtree_){this.featuresRtree_.insert(n,e)}}else{if(this.featuresRtree_){this.featuresRtree_.update(n,e)}}}var a=e.getId();if(a!==undefined){var s=a.toString();if(i in this.undefIdIndex_){delete this.undefIdIndex_[i];this.idIndex_[s]=e}else{if(this.idIndex_[s]!==e){this.removeFromIdIndex_(e);this.idIndex_[s]=e}}}else{if(!(i in this.undefIdIndex_)){this.removeFromIdIndex_(e);this.undefIdIndex_[i]=e}}this.changed();this.dispatchEvent(new Sl.Event(Ml.CHANGEFEATURE,e))};Sl.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&Qn.isEmpty(this.nullGeometryFeatures_)};Sl.prototype.loadFeatures=function(t,e,i){var r=this.loadedExtentsRtree_;var n=this.strategy_(t,e);var a,s;for(a=0,s=n.length;a<s;++a){var o=n[a];var h=r.forEachInExtent(o,(function(t){return pa.containsExtent(t.extent,o)}));if(!h){this.loader_.call(this,o,e,i);r.insert(o,{extent:o.slice()})}}};Sl.prototype.removeLoadedExtent=function(t){var e=this.loadedExtentsRtree_;var i;e.forEachInExtent(t,(function(e){if(pa.equals(e.extent,t)){i=e;return true}}));if(i){e.remove(i)}};Sl.prototype.removeFeature=function(t){var e=qn.getUid(t).toString();if(e in this.nullGeometryFeatures_){delete this.nullGeometryFeatures_[e]}else{if(this.featuresRtree_){this.featuresRtree_.remove(t)}}this.removeFeatureInternal(t);this.changed()};Sl.prototype.removeFeatureInternal=function(t){var e=qn.getUid(t).toString();this.featureChangeKeys_[e].forEach($n.unlistenByKey);delete this.featureChangeKeys_[e];var i=t.getId();if(i!==undefined){delete this.idIndex_[i.toString()]}else{delete this.undefIdIndex_[e]}this.dispatchEvent(new Sl.Event(Ml.REMOVEFEATURE,t))};Sl.prototype.removeFromIdIndex_=function(t){var e=false;for(var i in this.idIndex_){if(this.idIndex_[i]===t){delete this.idIndex_[i];e=true;break}}return e};Sl.prototype.setLoader=function(t){this.loader_=t};Sl.Event=function(t,e){ea.call(this,t);this.feature=e};qn.inherits(Sl.Event,ea);var Il={};Il.lineString=function(t,e,i,r,n,a){var s=NaN;var o=NaN;var h=(i-e)/r;if(h===1){s=t[e];o=t[e+1]}else if(h==2){s=(1-n)*t[e]+n*t[e+r];o=(1-n)*t[e+1]+n*t[e+r+1]}else if(h!==0){var l=t[e];var u=t[e+1];var f=0;var c=[0];var d;for(d=e+r;d<i;d+=r){var p=t[d];var v=t[d+1];f+=Math.sqrt((p-l)*(p-l)+(v-u)*(v-u));c.push(f);l=p;u=v}var _=n*f;var g=fa.binarySearch(c,_);if(g<0){var m=(_-c[-g-2])/(c[-g-1]-c[-g-2]);var y=e+(-g-2)*r;s=ha.lerp(t[y],t[y+r],m);o=ha.lerp(t[y+1],t[y+r+1],m)}else{s=t[e+g*r];o=t[e+g*r+1]}}if(a){a[0]=s;a[1]=o;return a}else{return[s,o]}};Il.lineStringCoordinateAtM=function(t,e,i,r,n,a){if(i==e){return null}var s;if(n<t[e+r-1]){if(a){s=t.slice(e,e+r);s[r-1]=n;return s}else{return null}}else if(t[i-1]<n){if(a){s=t.slice(i-r,i);s[r-1]=n;return s}else{return null}}if(n==t[e+r-1]){return t.slice(e,e+r)}var o=e/r;var h=i/r;while(o<h){var l=o+h>>1;if(n<t[(l+1)*r-1]){h=l}else{o=l+1}}var u=t[o*r-1];if(n==u){return t.slice((o-1)*r,(o-1)*r+r)}var f=t[(o+1)*r-1];var c=(n-u)/(f-u);s=[];var d;for(d=0;d<r-1;++d){s.push(ha.lerp(t[(o-1)*r+d],t[o*r+d],c))}s.push(n);return s};Il.lineStringsCoordinateAtM=function(t,e,i,r,n,a,s){if(s){return Il.lineStringCoordinateAtM(t,e,i[i.length-1],r,n,a)}var o;if(n<t[r-1]){if(a){o=t.slice(0,r);o[r-1]=n;return o}else{return null}}if(t[t.length-1]<n){if(a){o=t.slice(t.length-r);o[r-1]=n;return o}else{return null}}var h,l;for(h=0,l=i.length;h<l;++h){var u=i[h];if(e==u){continue}if(n<t[e+r-1]){return null}else if(n<=t[u-1]){return Il.lineStringCoordinateAtM(t,e,u,r,n,false)}e=u}return null};var Ll=function(t,e){La.call(this);this.flatMidpoint_=null;this.flatMidpointRevision_=-1;this.maxDelta_=-1;this.maxDeltaRevision_=-1;this.setCoordinates(t,e)};qn.inherits(Ll,La);Ll.prototype.appendCoordinate=function(t){if(!this.flatCoordinates){this.flatCoordinates=t.slice()}else{fa.extend(this.flatCoordinates,t)}this.changed()};Ll.prototype.clone=function(){var t=new Ll(null);t.setFlatCoordinates(this.layout,this.flatCoordinates.slice());return t};Ll.prototype.closestPointXY=function(t,e,i,r){if(r<pa.closestSquaredDistanceXY(this.getExtent(),t,e)){return r}if(this.maxDeltaRevision_!=this.getRevision()){this.maxDelta_=Math.sqrt(wa.getMaxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0));this.maxDeltaRevision_=this.getRevision()}return wa.getClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,false,t,e,i,r)};Ll.prototype.forEachSegment=function(t,e){return ka.forEach(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e)};Ll.prototype.getCoordinateAtM=function(t,e){if(this.layout!=va.XYM&&this.layout!=va.XYZM){return null}var i=e!==undefined?e:false;return Il.lineStringCoordinateAtM(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i)};Ll.prototype.getCoordinates=function(){return ba.coordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Ll.prototype.getCoordinateAt=function(t,e){return Il.lineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e)};Ll.prototype.getLength=function(){return jo.lineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)};Ll.prototype.getFlatMidpoint=function(){if(this.flatMidpointRevision_!=this.getRevision()){this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_);this.flatMidpointRevision_=this.getRevision()}return this.flatMidpoint_};Ll.prototype.getSimplifiedGeometryInternal=function(t){var e=[];e.length=Pa.douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0);var i=new Ll(null);i.setFlatCoordinates(va.XY,e);return i};Ll.prototype.getType=function(){return la.LINE_STRING};Ll.prototype.intersectsExtent=function(t){return Ua.lineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)};Ll.prototype.setCoordinates=function(t,e){if(!t){this.setFlatCoordinates(va.XY,null)}else{this.setLayout(e,t,1);if(!this.flatCoordinates){this.flatCoordinates=[]}this.flatCoordinates.length=Oa.coordinates(this.flatCoordinates,0,t,this.stride);this.changed()}};Ll.prototype.setFlatCoordinates=function(t,e){this.setFlatCoordinatesInternal(t,e);this.changed()};var Al={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var wl=function(t){var e=t?t:{};var i=Qn.assign({},e);delete i.preload;delete i.useInterimTilesOnError;Fs.call(this,i);this.setPreload(e.preload!==undefined?e.preload:0);this.setUseInterimTilesOnError(e.useInterimTilesOnError!==undefined?e.useInterimTilesOnError:true);this.type=oo.TILE};qn.inherits(wl,Fs);wl.prototype.getPreload=function(){return this.get(Al.PRELOAD)};wl.prototype.setPreload=function(t){this.set(Al.PRELOAD,t)};wl.prototype.getUseInterimTilesOnError=function(){return this.get(Al.USE_INTERIM_TILES_ON_ERROR)};wl.prototype.setUseInterimTilesOnError=function(t){this.set(Al.USE_INTERIM_TILES_ON_ERROR,t)};var Ol=function(t){var e=t?t:{};var i=Qn.assign({},e);delete i.style;delete i.renderBuffer;delete i.updateWhileAnimating;delete i.updateWhileInteracting;Fs.call(this,i);this.declutter_=e.declutter!==undefined?e.declutter:false;this.renderBuffer_=e.renderBuffer!==undefined?e.renderBuffer:100;this.style_=null;this.styleFunction_=undefined;this.setStyle(e.style);this.updateWhileAnimating_=e.updateWhileAnimating!==undefined?e.updateWhileAnimating:false;this.updateWhileInteracting_=e.updateWhileInteracting!==undefined?e.updateWhileInteracting:false;this.renderMode_=e.renderMode||ho.VECTOR;this.type=oo.VECTOR};qn.inherits(Ol,Fs);Ol.prototype.getDeclutter=function(){return this.declutter_};Ol.prototype.setDeclutter=function(t){this.declutter_=t};Ol.prototype.getRenderBuffer=function(){return this.renderBuffer_};Ol.prototype.getRenderOrder=function(){return this.get(Ol.Property_.RENDER_ORDER)};Ol.prototype.getStyle=function(){return this.style_};Ol.prototype.getStyleFunction=function(){return this.styleFunction_};Ol.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_};Ol.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_};Ol.prototype.setRenderOrder=function(t){this.set(Ol.Property_.RENDER_ORDER,t)};Ol.prototype.setStyle=function(t){this.style_=t!==undefined?t:$h.defaultFunction;this.styleFunction_=t===null?undefined:$h.createFunction(this.style_);this.changed()};Ol.prototype.getRenderMode=function(){return this.renderMode_};Ol.Property_={RENDER_ORDER:"renderOrder"};var bl={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",US:"us"};var Pl=function(t){var e=t?t:{};var i=e.className!==undefined?e.className:"ol-scale-line";this.innerElement_=document.createElement("DIV");this.innerElement_.className=i+"-inner";this.element_=document.createElement("DIV");this.element_.className=i+" "+Ps.CLASS_UNSELECTABLE;this.element_.appendChild(this.innerElement_);this.viewState_=null;this.minWidth_=e.minWidth!==undefined?e.minWidth:64;this.renderedVisible_=false;this.renderedWidth_=undefined;this.renderedHTML_="";var r=e.render?e.render:Pl.render;bs.call(this,{element:this.element_,render:r,target:e.target});$n.listen(this,aa.getChangeEventType(Pl.Property_.UNITS),this.handleUnitsChanged_,this);this.setUnits(e.units||bl.METRIC)};qn.inherits(Pl,bs);Pl.LEADING_DIGITS=[1,2,5];Pl.prototype.getUnits=function(){return this.get(Pl.Property_.UNITS)};Pl.render=function(t){var e=t.frameState;if(!e){this.viewState_=null}else{this.viewState_=e.viewState}this.updateElement_()};Pl.prototype.handleUnitsChanged_=function(){this.updateElement_()};Pl.prototype.setUnits=function(t){this.set(Pl.Property_.UNITS,t)};Pl.prototype.updateElement_=function(){var t=this.viewState_;if(!t){if(this.renderedVisible_){this.element_.style.display="none";this.renderedVisible_=false}return}var e=t.center;var i=t.projection;var r=this.getUnits();var n=r==bl.DEGREES?ma.DEGREES:ma.METERS;var a=Ma.getPointResolution(i,t.resolution,e,n);if(r!=bl.DEGREES){a*=i.getMetersPerUnit()}var s=this.minWidth_*a;var o="";if(r==bl.DEGREES){var h=Ma.METERS_PER_UNIT[ma.DEGREES];if(i.getUnits()==ma.DEGREES){s*=h}else{a/=h}if(s<h/60){o="″";a*=3600}else if(s<h){o="′";a*=60}else{o="°"}}else if(r==bl.IMPERIAL){if(s<.9144){o="in";a/=.0254}else if(s<1609.344){o="ft";a/=.3048}else{o="mi";a/=1609.344}}else if(r==bl.NAUTICAL){a/=1852;o="nm"}else if(r==bl.METRIC){if(s<.001){o="μm";a*=1e6}else if(s<1){o="mm";a*=1e3}else if(s<1e3){o="m"}else{o="km";a/=1e3}}else if(r==bl.US){if(s<.9144){o="in";a*=39.37}else if(s<1609.344){o="ft";a/=.30480061}else{o="mi";a/=1609.3472}}else{oa.assert(false,33)}var l=3*Math.floor(Math.log(this.minWidth_*a)/Math.log(10));var u,f;while(true){u=Pl.LEADING_DIGITS[(l%3+3)%3]*Math.pow(10,Math.floor(l/3));f=Math.round(u/a);if(isNaN(f)){this.element_.style.display="none";this.renderedVisible_=false;return}else if(f>=this.minWidth_){break}++l}var c=u+" "+o;if(this.renderedHTML_!=c){this.innerElement_.innerHTML=c;this.renderedHTML_=c}if(this.renderedWidth_!=f){this.innerElement_.style.width=f+"px";this.renderedWidth_=f}if(!this.renderedVisible_){this.element_.style.display="";this.renderedVisible_=true}};Pl.Property_={UNITS:"units"};var Dl={FRACTION:"fraction",PIXELS:"pixels"};var Fl=function(t,e,i,r,n,a){ia.call(this);this.hitDetectionImage_=null;this.image_=!t?new Image:t;if(r!==null){this.image_.crossOrigin=r}this.canvas_=a?document.createElement("CANVAS"):null;this.color_=a;this.imageListenerKeys_=null;this.imageState_=n;this.size_=i;this.src_=e;this.tainting_=false;if(this.imageState_==ao.LOADED){this.determineTainting_()}};qn.inherits(Fl,ia);Fl.get=function(t,e,i,r,n,a){var s=To.iconImageCache;var o=s.get(e,r,a);if(!o){o=new Fl(t,e,i,r,n,a);s.set(e,r,a,o)}return o};Fl.prototype.determineTainting_=function(){var t=Ts.createCanvasContext2D(1,1);try{t.drawImage(this.image_,0,0);t.getImageData(0,0,1,1)}catch(e){this.tainting_=true}};Fl.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(ra.CHANGE)};Fl.prototype.handleImageError_=function(){this.imageState_=ao.ERROR;this.unlistenImage_();this.dispatchChangeEvent_()};Fl.prototype.handleImageLoad_=function(){this.imageState_=ao.LOADED;if(this.size_){this.image_.width=this.size_[0];this.image_.height=this.size_[1]}this.size_=[this.image_.width,this.image_.height];this.unlistenImage_();this.determineTainting_();this.replaceColor_();this.dispatchChangeEvent_()};Fl.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_};Fl.prototype.getImageState=function(){return this.imageState_};Fl.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_){if(this.tainting_){var e=this.size_[0];var i=this.size_[1];var r=Ts.createCanvasContext2D(e,i);r.fillRect(0,0,e,i);this.hitDetectionImage_=r.canvas}else{this.hitDetectionImage_=this.image_}}return this.hitDetectionImage_};Fl.prototype.getSize=function(){return this.size_};Fl.prototype.getSrc=function(){return this.src_};Fl.prototype.load=function(){if(this.imageState_==ao.IDLE){this.imageState_=ao.LOADING;this.imageListenerKeys_=[$n.listenOnce(this.image_,ra.ERROR,this.handleImageError_,this),$n.listenOnce(this.image_,ra.LOAD,this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}};Fl.prototype.replaceColor_=function(){if(this.tainting_||this.color_===null){return}this.canvas_.width=this.image_.width;this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");t.drawImage(this.image_,0,0);var e=t.getImageData(0,0,this.image_.width,this.image_.height);var i=e.data;var r=this.color_[0]/255;var n=this.color_[1]/255;var a=this.color_[2]/255;for(var s=0,o=i.length;s<o;s+=4){i[s]*=r;i[s+1]*=n;i[s+2]*=a}t.putImageData(e,0,0)};Fl.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach($n.unlistenByKey);this.imageListenerKeys_=null};var Nl={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var Gl=function(t){var e=t||{};this.anchor_=e.anchor!==undefined?e.anchor:[.5,.5];this.normalizedAnchor_=null;this.anchorOrigin_=e.anchorOrigin!==undefined?e.anchorOrigin:Nl.TOP_LEFT;this.anchorXUnits_=e.anchorXUnits!==undefined?e.anchorXUnits:Dl.FRACTION;this.anchorYUnits_=e.anchorYUnits!==undefined?e.anchorYUnits:Dl.FRACTION;this.crossOrigin_=e.crossOrigin!==undefined?e.crossOrigin:null;var i=e.img!==undefined?e.img:null;var r=e.imgSize!==undefined?e.imgSize:null;var n=e.src;oa.assert(!(n!==undefined&&i),4);oa.assert(!i||i&&r,5);if((n===undefined||n.length===0)&&i){n=i.src||qn.getUid(i).toString()}oa.assert(n!==undefined&&n.length>0,6);var a=e.src!==undefined?ao.IDLE:ao.LOADED;this.color_=e.color!==undefined?co.asArray(e.color):null;this.iconImage_=Fl.get(i,n,r,this.crossOrigin_,a,this.color_);this.offset_=e.offset!==undefined?e.offset:[0,0];this.offsetOrigin_=e.offsetOrigin!==undefined?e.offsetOrigin:Nl.TOP_LEFT;this.origin_=null;this.size_=e.size!==undefined?e.size:null;var s=e.opacity!==undefined?e.opacity:1;var o=e.rotateWithView!==undefined?e.rotateWithView:false;var h=e.rotation!==undefined?e.rotation:0;var l=e.scale!==undefined?e.scale:1;var u=e.snapToPixel!==undefined?e.snapToPixel:true;qh.call(this,{opacity:s,rotation:h,scale:l,snapToPixel:u,rotateWithView:o})};qn.inherits(Gl,qh);Gl.prototype.clone=function(){return new Gl({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||undefined,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:this.size_!==null?this.size_.slice():undefined,opacity:this.getOpacity(),scale:this.getScale(),snapToPixel:this.getSnapToPixel(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})};Gl.prototype.getAnchor=function(){if(this.normalizedAnchor_){return this.normalizedAnchor_}var t=this.anchor_;var e=this.getSize();if(this.anchorXUnits_==Dl.FRACTION||this.anchorYUnits_==Dl.FRACTION){if(!e){return null}t=this.anchor_.slice();if(this.anchorXUnits_==Dl.FRACTION){t[0]*=e[0]}if(this.anchorYUnits_==Dl.FRACTION){t[1]*=e[1]}}if(this.anchorOrigin_!=Nl.TOP_LEFT){if(!e){return null}if(t===this.anchor_){t=this.anchor_.slice()}if(this.anchorOrigin_==Nl.TOP_RIGHT||this.anchorOrigin_==Nl.BOTTOM_RIGHT){t[0]=-t[0]+e[0]}if(this.anchorOrigin_==Nl.BOTTOM_LEFT||this.anchorOrigin_==Nl.BOTTOM_RIGHT){t[1]=-t[1]+e[1]}}this.normalizedAnchor_=t;return this.normalizedAnchor_};Gl.prototype.getColor=function(){return this.color_};Gl.prototype.getImage=function(t){return this.iconImage_.getImage(t)};Gl.prototype.getImageSize=function(){return this.iconImage_.getSize()};Gl.prototype.getHitDetectionImageSize=function(){return this.getImageSize()};Gl.prototype.getImageState=function(){return this.iconImage_.getImageState()};Gl.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)};Gl.prototype.getOrigin=function(){if(this.origin_){return this.origin_}var t=this.offset_;if(this.offsetOrigin_!=Nl.TOP_LEFT){var e=this.getSize();var i=this.iconImage_.getSize();if(!e||!i){return null}t=t.slice();if(this.offsetOrigin_==Nl.TOP_RIGHT||this.offsetOrigin_==Nl.BOTTOM_RIGHT){t[0]=i[0]-e[0]-t[0]}if(this.offsetOrigin_==Nl.BOTTOM_LEFT||this.offsetOrigin_==Nl.BOTTOM_RIGHT){t[1]=i[1]-e[1]-t[1]}}this.origin_=t;return this.origin_};Gl.prototype.getSrc=function(){return this.iconImage_.getSrc()};Gl.prototype.getSize=function(){return!this.size_?this.iconImage_.getSize():this.size_};Gl.prototype.listenImageChange=function(t,e){return $n.listen(this.iconImage_,ra.CHANGE,t,e)};Gl.prototype.load=function(){this.iconImage_.load()};Gl.prototype.unlistenImageChange=function(t,e){$n.unlisten(this.iconImage_,ra.CHANGE,t,e)};var kl='<svg width="16" height="24" viewBox="0 0 16 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.0011 22.5728L13.2809 12.0132H2.72134L8.0011 22.5728Z" fill="#DEDEDE" stroke="#BFBFBF" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" fill="#D0021B"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" stroke="#D0021B" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M7.99976 1.42721L2.71999 11.9867H13.2795L7.99976 1.42721Z" stroke="black" stroke-opacity="0.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n';var Ul=':host{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}:host[hidden]{display:none}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}stzh-olmap{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block;position:relative;width:100%;height:18.75rem}stzh-olmap[hidden]{display:none}stzh-olmap *,stzh-olmap *::before,stzh-olmap *::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}@media screen and (min-width: 800px){stzh-olmap{height:25rem}}.stzh-olmap{}.stzh-olmap__map{position:absolute;width:100%;height:100%;top:0;left:0}.stzh-olmap__map--print{margin-top:var(--stzh-space-xxlarge);max-width:100%;height:auto}.stzh-olmap__print-image{display:block;max-width:100%}.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom-in,.stzh-olmap .ol-zoom-out,.stzh-olmap .ol-rotate-reset{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-deca-font-size);line-height:var(--stzh-font-deca-text-line-height);letter-spacing:var(--stzh-font-deca-text-letter-spacing);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;border-radius:0;color:var(--stzh-color-primary, var(--stzh-color-zueriblue));-webkit-transition:all var(--stzh-base-transition-animation-speed) ease;transition:all var(--stzh-base-transition-animation-speed) ease;background-color:var(--stzh-color-white);width:var(--stzh-form-input-small-height);height:var(--stzh-form-input-small-height);cursor:pointer}.stzh-olmap .ol-print stzh-icon,.stzh-olmap .ol-location stzh-icon,.stzh-olmap .ol-zoom-in stzh-icon,.stzh-olmap .ol-zoom-out stzh-icon,.stzh-olmap .ol-rotate-reset stzh-icon{--size:var(--stzh-icon-size-small)}.stzh-olmap .ol-print:hover,.stzh-olmap .ol-location:hover,.stzh-olmap .ol-zoom-in:hover,.stzh-olmap .ol-zoom-out:hover,.stzh-olmap .ol-rotate-reset:hover{color:var(--stzh-color-white);background:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));border-color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom,.stzh-olmap .ol-rotate-reset{position:absolute;right:var(--stzh-space-xsmall);bottom:var(--stzh-space-xsmall);-webkit-box-shadow:var(--stzh-box-shadow-popover);box-shadow:var(--stzh-box-shadow-popover);border-radius:var(--stzh-form-input-border-radius)}@media screen and (min-width: 800px){.stzh-olmap .ol-layer,.stzh-olmap .ol-print,.stzh-olmap .ol-location,.stzh-olmap .ol-zoom,.stzh-olmap .ol-rotate-reset{right:var(--stzh-space-large);bottom:var(--stzh-space-large)}}.stzh-olmap .ol-layer{left:var(--stzh-space-xsmall);right:auto;padding:var(--stzh-space-xxxsmall);border:none;cursor:pointer}@media screen and (min-width: 800px){.stzh-olmap .ol-layer{left:var(--stzh-space-large)}}.stzh-olmap .ol-layer__thumbnail{width:4.75rem;height:4.75rem;display:block}.stzh-olmap .ol-layer__text{font-family:var(--stzh-font-family-light);font-weight:var(--stzh-font-weight-light);font-style:normal;font-size:var(--stzh-font-pico-font-size);line-height:var(--stzh-font-pico-text-line-height);position:absolute;bottom:0;left:0;right:0;text-align:left;background-color:var(--stzh-color-white);color:var(--stzh-color-primary, var(--stzh-color-zueriblue));padding-left:calc(var(--stzh-space-xxxsmall) + 0.0625rem);padding-right:calc(var(--stzh-space-xxxsmall) + 0.0625rem)}.stzh-olmap .ol-layer:hover .ol-layer__text{color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark))}.stzh-olmap .ol-location{margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}.stzh-olmap .ol-location:hover{color:var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));background:var(--stzh-color-white);border-color:var(--stzh-color-white)}.stzh-olmap .ol-location.active{background:var(--stzh-color-primary, var(--stzh-color-zueriblue));border-color:var(--stzh-color-primary, var(--stzh-color-zueriblue));color:var(--stzh-color-white)}.stzh-olmap .ol-zoom{margin-bottom:calc(var(--stzh-form-input-small-height) + var(--stzh-space-xsmall));background-color:var(--stzh-color-grey13)}.stzh-olmap .ol-zoom-in{margin-bottom:0.0625rem}.stzh-olmap .ol-rotate-reset{width:var(--stzh-space-xxlarge);height:var(--stzh-space-xxlarge);border-radius:50%;-webkit-box-shadow:none;box-shadow:none;border:0.0625rem solid var(--stzh-color-grey13);margin-right:calc((var(--stzh-form-input-small-height) - var(--stzh-space-xxlarge)) / 2);margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}.stzh-olmap .ol-rotate-reset span{border:0;clip:rect(0 0 0 0);-webkit-clip-path:inset(100%);clip-path:inset(100%);width:0.0625rem;height:0.0625rem;overflow:hidden;padding:0;position:absolute}.stzh-olmap .ol-rotate-reset svg{width:0.99rem;height:1.32188rem}.stzh-olmap .ol-hidden .ol-rotate-reset{opacity:0}.stzh-olmap .ol-compass{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.stzh-olmap .ol-scale-line{position:absolute;bottom:var(--stzh-space-xsmall);margin-left:calc(4.75rem + var(--stzh-space-xxxsmall) + var(--stzh-space-xsmall));left:var(--stzh-space-xsmall)}@media screen and (min-width: 800px){.stzh-olmap .ol-scale-line{bottom:var(--stzh-space-large);left:var(--stzh-space-large)}}.stzh-olmap .ol-scale-line-inner{font-size:var(--stzh-font-nano-font-size);line-height:var(--stzh-font-nano-text-line-height);position:relative;color:var(--stzh-color-black);text-align:center;-webkit-filter:drop-shadow(-0.0625rem 0px 0px white) drop-shadow(0.0625rem 0px 0px white) drop-shadow(0px -0.0625rem 0px white) drop-shadow(0px 0.0625rem 0px white);filter:drop-shadow(-0.0625rem 0px 0px white) drop-shadow(0.0625rem 0px 0px white) drop-shadow(0px -0.0625rem 0px white) drop-shadow(0px 0.0625rem 0px white)}.stzh-olmap .ol-scale-line-inner::after{content:"";position:absolute;bottom:0;left:0;width:100%;height:0.28125rem;border:0.0625rem solid var(--stzh-color-black);border-top:0}.stzh-olmap .ol-attribution{display:none}.stzh-olmap--has-no-layer-control .ol-scale-line{margin-left:0}.stzh-olmap--has-no-print-control .ol-zoom{margin-bottom:0}.stzh-olmap--has-no-print-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 2 + var(--stzh-space-xsmall))}.stzh-olmap--has-location-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 4 + var(--stzh-space-xsmall) * 3)}.stzh-olmap--has-location-control.stzh-olmap--has-no-print-control .ol-location{margin-bottom:calc(var(--stzh-form-input-small-height) * 2 + var(--stzh-space-xsmall))}.stzh-olmap--has-location-control.stzh-olmap--has-no-print-control .ol-rotate-reset{margin-bottom:calc(var(--stzh-form-input-small-height) * 3 + var(--stzh-space-xsmall) * 2)}';window.proj4=Kt;window.proj4.defs("EPSG:2056","+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs");var zl={anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:.5,src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker.png")};var Bl=Object.assign(Object.assign({},zl),{src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker-active.png")});var Wl=Object.assign(Object.assign({},zl),{anchor:[.5,.5],src:"".concat(window.stzhComponents.pathMedia,"/olmap/marker-position.png")});var Xl=t("stzh_olmap",function(){function t(t){var r=this;e(this,t);this.stzhInitialized=i(this,"stzhInitialized",7);this.stzhPostRender=i(this,"stzhPostRender",7);this.stzhMoveStart=i(this,"stzhMoveStart",7);this.stzhMoveEnd=i(this,"stzhMoveEnd",7);this.geoPositionChanged=false;this.handlePostRender=function(){r.stzhPostRender.emit({component:"stzh-olmap"})};this.handleMoveStart=function(){r.stzhMoveStart.emit({component:"stzh-olmap"})};this.handleMoveEnd=function(){r.stzhMoveEnd.emit({component:"stzh-olmap"})};this.handleInsideModalOpen=function(){if(r.map){requestAnimationFrame((function(){r.map.updateSize()}))}};this.handlePrintButtonClick=function(){if(!r.printIframe){r.printIframe=document.createElement("iframe");Object.assign(r.printIframe.style,{height:"0px",width:"0px",position:"absolute",border:"none"});r.element.append(r.printIframe)}r.printIframe.innerHTML="";var t=r.printIframe.contentWindow;var e=r.constructor.style.replace('@charset "UTF-8";',"");var i=Array.from(document.querySelectorAll("link")).map((function(t){return t.outerHTML}));var n;r.map.once("postcompose",(function(t){var e=t.context.canvas;n=e.toDataURL("image/png")}));r.map.renderSync();t.document.body.innerHTML="\n ".concat(i.join(""),'\n\n <style type="text/css">\n ').concat(e,'\n </style>\n\n <div class="stzh-olmap__map stzh-olmap__map--print">\n <img class="stzh-olmap__print-image" src="').concat(n,'">\n ').concat(r.element.querySelector(".ol-scale-line.ol-unselectable").outerHTML,"\n </div>\n ");setTimeout((function(){try{t.document.execCommand("print",false,null)}catch(e){t.print()}}),1e3)};this.localization=undefined;this.hostname="www.ogc.stadt-zuerich.ch";this.scaleControl=true;this.layerControl=true;this.printControl=true;this.locationControl=false;this.layer="streets";this.zoom=7;this.zoomLocation=7;this.center=[2683311,1247082];this.centerMarker=true;this.resolutions=[67.73333333333,33.8666666667,16.9333333333,8.4666666667,4.2333333333,2.1166666667,1.0583333333,.5291666667,.2645833333,.1322916667,.0661458333];this.layers={streets:{thumbnailUrl:"".concat(window.stzhComponents.pathMedia,"/olmap/thumb-streets.jpg"),options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"basiskarte_zuerich_gebaeudeschraegansicht",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}},satellite:{thumbnailUrl:"".concat(window.stzhComponents.pathMedia,"/olmap/thumb-satellite.jpg"),options:{url:"https://{Hostname}/mapproxy/wmts/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",layer:"orthofoto",matrixSet:"ktzh",origin:[2480237,1315832],extent:[2666867,1220962,2719695.5,1285537]}}}}t.prototype.zoomWatcher=function(t){if(this.map){this.map.getView().setZoom(t)}};t.prototype.scaleControlWatcher=function(t){if(!this.map){return}if(t){this.scaleControlOl=new Pl({units:"metric"});this.map.addControl(this.scaleControlOl)}else{if(this.scaleControl){this.map.removeControl(this.scaleControlOl)}this.scaleControlOl=null}};t.prototype.printControlWatcher=function(t){if(!this.map){return}if(t){this.printControlElement=document.createElement("button");this.printControlElement.className="ol-print";this.printControlElement.ariaLabel=this.localization.printLabel;this.printControlElement.addEventListener("click",this.handlePrintButtonClick);this.printControlElement.innerHTML='<stzh-icon name="print" class="ol-print__icon"></stzh-icon>';this.printControlOl=new bs({element:this.printControlElement});this.map.addControl(this.printControlOl)}else{if(this.printControlOl){this.map.removeControl(this.printControlOl)}this.printControlOl=null;this.printControlElement=null}};t.prototype.layerControlWatcher=function(t){var e=this;if(!this.map||this.layersArray.length===1){return}if(t){this.layerControlElement=document.createElement("button");this.layerControlElement.className="ol-layer";this.layerControlElement.addEventListener("click",(function(){e.layer=e.layer==="streets"?"satellite":"streets"}));this.layerControlImageElement=document.createElement("img");this.layerControlImageElement.className="ol-layer__thumbnail";this.layerControlImageElement.setAttribute("role","presentation");this.layerControlImageElement.setAttribute("alt","");this.layerControlTextElement=document.createElement("span");this.layerControlTextElement.className="ol-layer__text";this.layerControlElement.appendChild(this.layerControlImageElement);this.layerControlElement.appendChild(this.layerControlTextElement);this.layerControlOl=new bs({element:this.layerControlElement});this.map.addControl(this.layerControlOl)}else{if(this.layerControlOl){this.map.removeControl(this.layerControlOl)}this.layerControlOl=null;this.layerControlElement=null;this.layerControlImageElement=null;this.layerControlTextElement=null}};t.prototype.locationControlWatcher=function(t){var e=this;if(!this.map){return}if(t){this.locationControlElement=document.createElement("button");this.locationControlElement.className="ol-location";this.locationControlElement.innerHTML='<stzh-icon name="target-bullet" class="ol-location__icon"></stzh-icon>';this.locationControlElement.addEventListener("click",(function(){var t=e.geolocation.getTracking();if(t){e.disableLocationTracking()}else{e.enableLocationTracking()}}));this.locationControlOl=new bs({element:this.locationControlElement});this.geolocation=new ja({projection:this.map.getView().getProjection()});this.positionMarkerOl=new tl;this.positionMarkerOl.setId("position");var i=new $h({image:new Gl(Wl)});this.positionMarkerOl.setStyle(i);this.positionLayer.getSource().addFeature(this.positionMarkerOl);this.geolocation.on("change:position",(function(){var t=e.geolocation.getPosition();e.positionMarkerOl.setGeometry(new Fa(t));if(!e.geoPositionChanged&&pa.containsExtent(e.layers[e.layer].options.extent,e.positionMarkerOl.getGeometry().getExtent())){e.geoPositionChanged=true;e.map.getView().setCenter(t);if(e.zoomLocation){e.map.getView().setZoom(e.zoomLocation)}}}));this.geolocation.on("change:tracking",(function(){var t=e.geolocation.getTracking();e.positionMarkerOl.setGeometry(null);e.setLocationControlState(t)}));this.geolocation.on("error",(function(){e.setLocationControlState(false)}));this.map.addControl(this.locationControlOl)}else{this.disableLocationTracking();if(this.locationControlOl){this.map.removeControl(this.locationControlOl)}if(this.positionMarkerOl){this.positionLayer.getSource().removeFeature(this.positionMarkerOl)}this.locationControlOl=null;this.locationControlElement=null;this.geolocation=null;this.positionMarkerOl=null}};t.prototype.layerWatcher=function(t){var e=this;if(!this.map){return}Object.entries(this.rasterLayers).forEach((function(i){var r=i[0],n=i[1];if(r===t){n.setVisible(true);e.map.getView().set("projection",e.projections[t]);var a=e.layersArray.find((function(t){var i=t[0];return i!==e.layer}));if(a){if(e.layerControlImageElement){e.layerControlImageElement.src=a[1].thumbnailUrl}if(e.layerControlTextElement){var s="";if(r==="streets"){s=e.localization.streetsLayerTitle}else if(r==="satellite"){s=e.localization.satelliteLayerTitle}e.layerControlTextElement.textContent=a[1].title||s}}}else{n.setVisible(false)}}))};t.prototype.centerWatcher=function(t){this.map.getView().setCenter(t);if(this.centerMarkerOl){this.centerMarkerOl.setGeometry(new Fa(t))}};t.prototype.centerMarkerWatcher=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:if(!t)return[3,2];e=this;return[4,this.addIconMarker(this.center)];case 1:e.centerMarkerOl=i.sent();return[3,3];case 2:if(this.centerMarkerOl){this.removeIconMarker(this.centerMarkerOl)}i.label=3;case 3:return[2]}}))}))};t.prototype.getMap=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.map]}))}))};t.prototype.addIconMarker=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(r){e=new tl({geometry:new Fa(t)});i=new $h({image:new Gl(zl)});e.setStyle(i);this.iconLayer.getSource().addFeature(e);return[2,e]}))}))};t.prototype.removeIconMarker=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.iconLayer.getSource().removeFeature(t)]}))}))};t.prototype.setIconMarkerActive=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.setStyle(new $h({image:new Gl(Bl)}));return[2]}))}))};t.prototype.setIconMarkerInactive=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.setStyle(new $h({image:new Gl(zl)}));return[2]}))}))};t.prototype.enableLocationTracking=function(t){if(t===void 0){t=true}return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.setLocationControlState(true);if(t){this.geoPositionChanged=false}if(this.geolocation){this.geolocation.setTracking(true)}return[2]}))}))};t.prototype.disableLocationTracking=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.setLocationControlState(false);if(this.geolocation){this.geolocation.setTracking(false)}return[2]}))}))};t.prototype.getDistance=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,r;return __generator(this,(function(n){i=new Ll([t,e]);r=ua.getLength(i,{projection:this.map.getView().getProjection()});return[2,r]}))}))};t.prototype.handleLoad=function(){var t=this;if(this.map){requestAnimationFrame((function(){t.map.updateSize()}))}};t.prototype.setLocationControlState=function(t){if(this.positionLayer){this.positionLayer.setVisible(t)}if(this.locationControlElement){this.locationControlElement.classList.toggle("active",t)}};t.prototype.createMap=function(){var t=document.createElement("stzh-icon");t.ariaLabel=this.localization.zoomInLabel;t.name="plus";var e=document.createElement("stzh-icon");e.ariaLabel=this.localization.zoomOutLabel;e.name="minus";var i=document.createElement("div");i.innerHTML=kl;var r=document.createElement("span");r.innerText=this.localization.rotateLabel;i.appendChild(r);var n=new Kh({controls:Us.defaults({zoomOptions:{zoomInLabel:t,zoomOutLabel:e,zoomInTipLabel:"",zoomOutTipLabel:""},rotateOptions:{label:i,tipLabel:""}}),interactions:ro.defaults({mouseWheelZoom:false}),loadTilesWhileAnimating:true,loadTilesWhileInteracting:true,target:this.mapElement,logo:false});return n};t.prototype.createRasterLayer=function(t,e){return new wl({title:"wmts",type:"base",extent:e.extent,source:this.createLayerSource(t,e)})};t.prototype.createLayerSource=function(t,e){if(!this.projections){this.projections={}}this.projections[t]=new Ea({code:"EPSG:2056",extent:e.extent});return this.creatRasterSource(t,e)};t.prototype.creatRasterSource=function(t,e){var i=e.url,r=e.layer,n=e.matrixSet,a=e.origin;var s=[];for(var o=0;o<this.resolutions.length;o++){s.push(o)}var h=new ml({origin:a,resolutions:this.resolutions,matrixIds:s,tileSize:[512,512]});return new El({url:i,tileGrid:h,style:"default",projection:this.projections[t],crossOrigin:"anonymous",layer:r,matrixSet:n,requestEncoding:"REST"})};t.prototype.createIconLayer=function(){return new Ol({source:new Sl({})})};t.prototype.initMap=function(){var t=this;this.map=this.createMap();this.map.on("postrender",this.handlePostRender);this.map.on("movestart",this.handleMoveStart);this.map.on("moveend",this.handleMoveEnd);this.layersArray=Object.entries(this.layers);if(this.layersArray.length>2){throw new Error("There are only two different layers allowed.")}this.rasterLayers={};this.layersArray.forEach((function(e){var i=e[0],r=e[1];r.options.url=r.options.url.replace(/{hostname}/gi,t.hostname);t.rasterLayers[i]=t.createRasterLayer(i,r.options);t.map.addLayer(t.rasterLayers[i])}));this.positionLayer=this.createIconLayer();this.positionLayer.setVisible(false);this.map.addLayer(this.positionLayer);this.iconLayer=this.createIconLayer();this.map.addLayer(this.iconLayer);var e=new xs({center:this.center,projection:this.projections[this.layer],zoom:this.zoom,resolutions:this.resolutions});this.map.setView(e);this.scaleControlWatcher(this.scaleControl);this.printControlWatcher(this.printControl);this.locationControlWatcher(this.locationControl);this.layerControlWatcher(this.layerControl);this.layerWatcher(this.layer);this.centerWatcher(this.center);this.centerMarkerWatcher(this.centerMarker);requestAnimationFrame((function(){t.map.updateSize();t.stzhInitialized.emit({component:"stzh-olmap"})}))};t.prototype.componentShouldUpdate=function(t,e,i){return["hostname","localization","layers","resolutions"].includes(i)};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:if(!!this.localization)return[3,2];t=this;return[4,s(this.element,"olmap")];case 1:t.localization=e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.componentWillUpdate=function(){if(this.map){this.map.setTarget(null);this.map=null}};t.prototype.componentDidRender=function(){if(this.map){return}this.initMap()};t.prototype.connectedCallback=function(){var t=this.element.closest("stzh-dialog");if(t){t.addEventListener("stzhOpen",this.handleInsideModalOpen)}};t.prototype.disconnectedCallback=function(){if(this.map){this.map.setTarget(null);this.map=null}var t=this.element.closest("stzh-dialog");if(t){t.removeEventListener("stzhOpen",this.handleInsideModalOpen)}};t.prototype.render=function(){var t=this;var e={"stzh-olmap":true,"stzh-olmap--has-no-layer-control":!this.layerControl,"stzh-olmap--has-no-print-control":!this.printControl,"stzh-olmap--has-location-control":this.locationControl};return r(n,null,r("div",{class:e},r("div",{ref:function(e){return t.mapElement=e},class:"stzh-olmap__map"})))};Object.defineProperty(t.prototype,"element",{get:function(){return a(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{zoom:["zoomWatcher"],scaleControl:["scaleControlWatcher"],printControl:["printControlWatcher"],layerControl:["layerControlWatcher"],locationControl:["locationControlWatcher"],layer:["layerWatcher"],center:["centerWatcher"],centerMarker:["centerMarkerWatcher"]}},enumerable:false,configurable:true});return t}());Xl.style=Ul}}}));
|