Liferay.on("vipnrw-after-maximize-portlet",function(parameter){if(parameter&&parameter.portletId===journal_content_viewer_portlet_id){var position=parameter.position;var title=parameter.title;var icon=parameter.icon;onShowJournalContentViewer(position,title,icon)}});
Liferay.on("vipnrw-refresh-portlet-content",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==journal_content_viewer_portlet_id&&journalContentViewer_position!=null)onShowJournalContentViewer(journalContentViewer_position,journalContentViewer_title,journalContentViewer_icon)});
Liferay.on("restore-portlet-width",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==journal_content_viewer_portlet_id&&journalContentViewer_position!=null)$(".info-slider").css("width","")});
var vipnrwPaginatorMap={};var vipnrwPaginatorIdCounter=0;
function VipnrwPaginator(pageLimit,buttonCount,callback,id){this.currentPage=0;this.limit=pageLimit;this.maxCount=0;this.numberOfButtons=buttonCount;this.callbackFunction=callback;this.basId=id+"_"+vipnrwPaginatorIdCounter;vipnrwPaginatorIdCounter++;this.getHtml=function(){vipnrwPaginatorMap[this.basId]=this;var maxNumberOfPages=1;if(this.maxCount&&this.maxCount>0)maxNumberOfPages=Math.max(Math.ceil(this.maxCount/this.limit),1);else{this.currentPage=0;this.maxCount=0}var html='\x3cdiv id\x3d"paginator-table" class\x3d"vipnrw-paginator-table"\x3e\x3cdiv id\x3d"paginator-table-container" style\x3d"width: 100%"\x3e';
html+=this.createButton("first",'\x3ci class\x3d"fa fa-fast-backward" aria-hidden\x3d"true"\x3e\x3c/i\x3e');html+=this.createButton("previous",'\x3ci class\x3d"fa fa-play fa-rotate-180" aria-hidden\x3d"true"\x3e\x3c/i\x3e');var startNumber=Math.max(0,this.currentPage-Math.floor(this.numberOfButtons/2));startNumber=Math.max(0,Math.min(maxNumberOfPages-this.numberOfButtons,startNumber));for(var i=startNumber;i<maxNumberOfPages&&i<this.numberOfButtons+startNumber;i++)html+=this.createButton(i,i+1);html+=
this.createButton("next",'\x3ci class\x3d"fa fa-play" aria-hidden\x3d"true"\x3e\x3c/i\x3e');html+=this.createButton("last",'\x3ci class\x3d"fa fa-fast-forward" aria-hidden\x3d"true"\x3e\x3c/i\x3e');html+='\x3c/div\x3e\x3cdiv class\x3d"vipnrw-paginator-sum-text"\x3e';html+="Gesamt:"+" "+this.maxCount+"\x3c/td\x3e";html+="\x3c/div\x3e\x3c/div\x3e";var maxNumberOfPages=1;if(this.maxCount>0)maxNumberOfPages=Math.max(Math.ceil(this.maxCount/this.limit),1);if(this.maxCount>0&&this.currentPage>maxNumberOfPages-
1){this.currentPage=maxNumberOfPages-1;this.callbackFunction();return""}return html};this.buttonClick=function(buttonValue){var lastPage=this.currentPage;if("first"==buttonValue)this.currentPage=0;else if("last"==buttonValue){var maxNumberOfPages=1;if(this.maxCount>0)maxNumberOfPages=Math.max(Math.ceil(this.maxCount/this.limit),1);this.currentPage=Math.max(maxNumberOfPages-1,0)}else if("previous"==buttonValue)this.currentPage=Math.max(0,this.currentPage-1);else if("next"==buttonValue){var maxNumberOfPages=
1;if(this.maxCount>0)maxNumberOfPages=Math.max(Math.ceil(this.maxCount/this.limit),1);this.currentPage=Math.min(maxNumberOfPages-1,this.currentPage+1)}else this.currentPage=parseInt(buttonValue);if(this.currentPage!=lastPage)this.callbackFunction()};this.createButton=function(buttonValue,text){var buttonId=this.basId+"_"+buttonValue;var buttonClassName="vipnrw-paginator-button ui-button ui-widget ui-corner-all";if(buttonValue==this.currentPage)buttonClassName+=" ui-state-active";var buttonOnClick=
" onclick\x3d\"vipnrwPaginatorButtonClick('"+this.basId+"', '"+buttonValue+"')\"";var buttonHtml="\x3cbutton "+buttonOnClick+' class\x3d"'+buttonClassName+'" id\x3d"'+this.basId+"_"+buttonValue+'"\x3e'+text+"\x3c/button\x3e";return buttonHtml};this.reset=function(){this.currentPage=0;this.maxCount=0};this.getOffset=function(){return this.currentPage*this.limit}}
function vipnrwPaginatorButtonClick(paginatorId,buttonValue){var paginator=vipnrwPaginatorMap[paginatorId];if(paginator)paginator.buttonClick(buttonValue)};
var lastPublishedExtent=null;var timeoutId=null;var limitValue=10;var pageCount=5;var mapDetailsTrafficObjectpaginator=new VipnrwPaginator(limitValue,pageCount,mapDetailsTrafficObjectAjaxCall,map_details_portlet_id+"paginator");var currentAjaxCallExtent=null;var selectedTab="WARNING";var selectedTabDiv=$("#"+map_details_portlet_id+"warnings");
function retrieveData(){clearErrorMessages();var html="\x3cdiv id\x3d'to-container' display\x3d'none'/\x3e";if(currentAjaxCallExtent!=null)$.ajax({url:map_details_portlet_resource_url,type:"POST",datatype:"json",timeout:2E4,data:{action:"getTrafficObjectsByExtent",trafficCategory:selectedTab,mapExtent:currentAjaxCallExtent,offset:mapDetailsTrafficObjectpaginator.getOffset(),limit:mapDetailsTrafficObjectpaginator.limit,startDate:getTrafficMessageDate(),durationInDays:getTrafficMessageDays()},success:function(data){if(data!=
null){var content=JSON.parse(data);if(content.error!=null)addErrorMessage(content.error);html=toHtml(content,true);if(html){setContent(html);mapDetailsTrafficObjectpaginator.maxCount=content.maxcount}else{setContent("Keine Eintr\u00e4ge gefunden");mapDetailsTrafficObjectpaginator.maxCount=0}}else{addErrorMessage("Fehler beim holen der Daten.");setContent("Keine Eintr\u00e4ge gefunden");mapDetailsTrafficObjectpaginator.maxCount=0}$("#pagination").html(mapDetailsTrafficObjectpaginator.getHtml());updateContentScrollHeight()},
fail:function(jqXHR,textStatus,errorThrown){addErrorMessage("Fehler beim holen der Daten.");setContent("Keine Eintr\u00e4ge gefunden");mapDetailsTrafficObjectpaginator.maxCount=0;$("#pagination").html(mapDetailsTrafficObjectpaginator.getHtml());updateContentScrollHeight();console.error(errorThrown)}})}function toHtml(content,withFlyToButton){return convertTrafficObjectsToHtml(content,withFlyToButton)}
function clearErrorMessages(){$("#"+map_details_portlet_id+"errorMsg").html("");$("#"+map_details_portlet_id+"errorMsg").css("display","none")}function addErrorMessage(message){$("#"+map_details_portlet_id+"errorMsg").append('\x3cdiv class\x3d"portlet-msg-error"\x3e'+message+"\x3c/div\x3e");$("#"+map_details_portlet_id+"errorMsg").css("display","flex")}
function setContent(content){var contentContainer=$('\x3cdiv id\x3d"'+map_details_portlet_id+'contentDiv" class\x3d"map-css map-details-css tabs-content-container"\x3e\x3c/div\x3e');contentContainer.append(content);contentContainer.children().each(function(){$(this).addClass("inside-portlet")});selectedTabDiv.empty().append(contentContainer)}
function updateContentScrollHeight(){var contentDataDiv=$("#"+map_details_portlet_id+"contentDiv");var titleHeader=$("#portlet_de_strassennrw_vipnrw_map_details_portlet_MapDetailsPortlet .portlet-topper").outerHeight(true);var tabsHeight=$("#"+map_details_portlet_id+"detailTabs ul").outerHeight(true);var footerHeight=$("#"+map_details_portlet_id+"detailTabs .vipnrw-paginator-table").outerHeight(true);var portletHeight=$("#p_p_id_de_strassennrw_vipnrw_map_details_portlet_MapDetailsPortlet_").outerHeight(true);
var errorDivHeight=$("#"+map_details_portlet_id+"errorMsg").outerHeight(true);if($("#"+map_details_portlet_id+"errorMsg").css("display")=="none")errorDivHeight=0;var height=portletHeight-(titleHeader+tabsHeight+footerHeight+errorDivHeight+21);contentDataDiv.css("max-height",height+"px");contentDataDiv.css("height",height+"px")}function mapDetailsTrafficObjectAjaxCall(){clearAllmapDetailsTabs();if(timeoutId!=null)clearTimeout(timeoutId);timeoutId=setTimeout(retrieveData(),500)};
Liferay.on("vipnrw-map-extent-changed",function(parameter){var extent=parameter.extent;if(extent!=null){lastPublishedExtent=extent;currentAjaxCallExtent=extent;if($("#info"+map_details_portlet_id).is(":visible"))mapDetailsTrafficObjectAjaxCall()}});Liferay.on("vipnrw-refresh-portlet-content",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==map_details_portlet_id){currentAjaxCallExtent=lastPublishedExtent;mapDetailsTrafficObjectAjaxCall()}});
Liferay.on("vipnrw-before-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==map_details_portlet_id||"_"+portletId+"_"==map_details_portlet_id)){currentAjaxCallExtent=lastPublishedExtent;mapDetailsTrafficObjectAjaxCall()}});Liferay.on("vipnrw-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==map_details_portlet_id||"_"+portletId+"_"==map_details_portlet_id))mapDetailsTrafficObjectAjaxCall()});
Liferay.on("vipnrw-after-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==map_details_portlet_id||"_"+portletId+"_"==map_details_portlet_id))selectedTabDiv.ready(function(){mapDetailsTrafficObjectAjaxCall()})});
Liferay.on("vipnrw-after-portlet-resize",function(parameter){if(parameter!=="undefined"){var portletId=parameter.portletId;if(portletId&&(portletId==map_details_portlet_id||"_"+portletId+"_"==map_details_portlet_id)){if(parameter.smaller)$("."+portletId+"tab-label").hide();if(parameter.bigger)$("."+portletId+"tab-label").show()}}updateMapDetailsPortletWidth()});Liferay.on("vipnrw-window-resize",function(parameter){updateMapDetailsPortletWidth();updateContentScrollHeight()});
Liferay.on("restore-portlet-width",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==map_details_portlet_id||"_"+portletId+"_"==map_details_portlet_id)){$(".info-slider").css("width","");updateMapDetailsPortletWidth()}});
function updateMapDetailsPortletWidth(){var labels=$("#"+map_details_portlet_id+"detailTabs li label");labels.each(function(n){$(this).css("display","inline")});var portletWidth=$("#"+map_details_portlet_id+"detailTabs").width();var tabs=$("#"+map_details_portlet_id+"detailTabs li");var overallWidth=0;tabs.each(function(n){var tabWidth=$(this).outerWidth(true);overallWidth+=tabWidth});if(portletWidth<overallWidth+10){var labels=$("#"+map_details_portlet_id+"detailTabs li label");labels.each(function(n){$(this).css("display",
"none")})}}function mapDetailsWarningsTabClick(){if(selectedTab!="WARNING"){mapDetailsTrafficObjectpaginator.reset();selectedTab="WARNING";selectedTabDiv=$("#"+map_details_portlet_id+"warnings");mapDetailsTrafficObjectAjaxCall()}}function mapDetailsObstructionsTabClick(){if(selectedTab!="CLOSURE"){mapDetailsTrafficObjectpaginator.reset();selectedTab="CLOSURE";selectedTabDiv=$("#"+map_details_portlet_id+"obstructions");mapDetailsTrafficObjectAjaxCall()}}
function mapDetailsRoadworksTabClick(){if(selectedTab!="ROADWORKS"){mapDetailsTrafficObjectpaginator.reset();selectedTab="ROADWORKS";selectedTabDiv=$("#"+map_details_portlet_id+"roadworks");mapDetailsTrafficObjectAjaxCall()}}function mapDetailsWebcamsTabClick(){if(selectedTab!="WEBCAM"){mapDetailsTrafficObjectpaginator.reset();selectedTab="WEBCAM";selectedTabDiv=$("#"+map_details_portlet_id+"webcams");mapDetailsTrafficObjectAjaxCall()}}
function mapDetailsParkingTabClick(){if(selectedTab!="PARKING"){mapDetailsTrafficObjectpaginator.reset();selectedTab="PARKING";selectedTabDiv=$("#"+map_details_portlet_id+"parking");mapDetailsTrafficObjectAjaxCall()}}function clearAllmapDetailsTabs(){$("#"+map_details_portlet_id+"warnings").empty();$("#"+map_details_portlet_id+"obstructions").empty();$("#"+map_details_portlet_id+"roadworks").empty();$("#"+map_details_portlet_id+"webcams").empty();$("#"+map_details_portlet_id+"parking").empty()};
/*

 Latitude/longitude spherical geodesy formulae taken from
 http://www.movable-type.co.uk/scripts/latlong.html
 Licensed under CC-BY-3.0.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(window,function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&
Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};
return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=9)}([function(t,e,i){t.exports=n,t.exports.default=n;var r=i(5);function n(t,e){if(!(this instanceof n))return new n(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function o(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 s(t,e){a(t,0,t.children.length,e,t)}
function a(t,e,i,r,n){n||(n=y(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var o,s=e;s<i;s++)o=t.children[s],h(n,t.leaf?r(o):o);return n}function h(t,e){return 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),t}function l(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function p(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(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 f(t,e){var i=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,o-r)}function _(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function g(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/
0}}function v(t,e,i,n,o){for(var s,a=[e,i];a.length;)(i=a.pop())-(e=a.pop())<=n||(s=e+Math.ceil((i-e)/n/2)*n,r(t,s,e,i,o),a.push(e,s,s,i))}n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!g(t,e))return i;for(var n,o,s,a,h=[];e;){for(n=0,o=e.children.length;n<o;n++)s=e.children[n],g(t,a=e.leaf?r(s):s)&&(e.leaf?i.push(s):_(t,a)?this._all(s,i):h.push(s));e=h.pop()}return i},collides:function(t){var e=this.data,i=this.toBBox;if(!g(t,
e))return!1;for(var r,n,o,s,a=[];e;){for(r=0,n=e.children.length;r<n;r++)if(o=e.children[r],g(t,s=e.leaf?i(o):o)){if(e.leaf||_(t,s))return!0;a.push(o)}e=a.pop()}return!1},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)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,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=y([]),this},remove:function(t,e){if(!t)return this;for(var i,r,n,s,a=this.data,h=this.toBBox(t),l=[],u=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],i=u.pop(),s=!0),a.leaf&&-1!==(n=o(t,a.children,e)))return a.children.splice(n,1),l.push(a),this._condense(l),this;s||a.leaf||!_(a,h)?r?(i++,a=r.children[i],s=!1):
a=null:(l.push(a),u.push(i),i=0,r=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:l,compareMinY:u,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},_build:function(t,e,i,r){var n,o=i-e+1,a=this._maxEntries;if(o<=a)return s(n=y(t.slice(e,i+1)),this.toBBox),n;r||(r=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,r-1))),
(n=y([])).leaf=!1,n.height=r;var h,l,u,p,c=Math.ceil(o/a),d=c*Math.ceil(Math.sqrt(a));for(v(t,e,i,d,this.compareMinX),h=e;h<=i;h+=d)for(v(t,h,u=Math.min(h+d-1,i),c,this.compareMinY),l=h;l<=u;l+=c)p=Math.min(l+c-1,u),n.children.push(this._build(t,l,p,r-1));return s(n,this.toBBox),n},_chooseSubtree:function(t,e,i,r){for(var n,o,s,a,h,l,u,c;r.push(e),!e.leaf&&r.length-1!==i;){for(u=c=1/0,n=0,o=e.children.length;n<o;n++)h=p(s=e.children[n]),(l=d(t,s)-h)<c?(c=l,u=h<u?h:u,a=s):l===c&&h<u&&(u=h,a=s);e=a||
e.children[0]}return e},_insert:function(t,e,i){var r=this.toBBox,n=i?t:r(t),o=[],s=this._chooseSubtree(n,this.data,e,o);for(s.children.push(t),h(s,n);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var o=this._chooseSplitIndex(i,n,r),a=y(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),e?t[e-
1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,o,s,h,l,u,c;for(l=u=1/0,r=e;r<=i-e;r++)s=f(n=a(t,0,r,this.toBBox),o=a(t,r,i,this.toBBox)),h=p(n)+p(o),s<l?(l=s,c=r,u=h<u?h:u):s===l&&h<u&&(u=h,c=r);return c},_chooseSplitAxis:function(t,e,i){var r=t.leaf?this.compareMinX:l,n=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,i,r)<this._allDistMargin(t,
e,i,n)&&t.children.sort(r)},_allDistMargin:function(t,e,i,r){t.children.sort(r);var n,o,s=this.toBBox,l=a(t,0,e,s),u=a(t,i-e,i,s),p=c(l)+c(u);for(n=e;n<i-e;n++)o=t.children[n],h(l,t.leaf?s(o):o),p+=c(l);for(n=i-e-1;n>=e;n--)o=t.children[n],h(u,t.leaf?s(o):o),p+=c(u);return p},_adjustParentBBoxes:function(t,e,i){for(var r=i;r>=0;r--)h(e[r],t)},_condense:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():s(t[i],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(t,e,i){t.exports=n;var r=i(6);function n(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;function o(t){return t.type===
n.Bytes?t.readVarint()+t.pos:t.pos+1}function s(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function a(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function h(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function l(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function u(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function p(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}
function c(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function d(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function f(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function _(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function g(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function y(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function v(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function m(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+
(t[e+3]<<24)}n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=m(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=y(this.buf,this.pos)+
4294967296*y(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=y(this.buf,this.pos)+4294967296*m(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=
r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return s(t,r,e);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return s(t,r,e);throw new Error("Expected varint not more than 10 bytes");}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},
readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,i){var r="",n=e;for(;n<i;){var o,s,a,h=t[n],l=null,u=h>239?4:h>223?3:h>191?2:1;if(n+u>i)break;1===u?h<128&&(l=h):2===u?128==(192&(o=t[n+1]))&&(l=(31&h)<<6|63&o)<=127&&(l=null):3===u?(o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&((l=(15&h)<<12|(63&o)<<6|63&s)<=2047||l>=55296&&l<=57343)&&(l=null)):
4===u&&(o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((l=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=u}return r}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var i=o(this);for(t=t||[];this.pos<
i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){var e=o(this);for(t=
t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){var e=o(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===n.Varint)for(;this.buf[this.pos++]>127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;
else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),v(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),
v(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),v(this.buf,-1&t,this.pos),v(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),v(this.buf,-1&t,this.pos),v(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0));if(t>=1.8446744073709552E19||
t<-1.8446744073709552E19)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=
127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,
e,i){for(var r,n,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&a(e,i,
this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),r.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),r.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},
writeMessage:function(t,e,i){this.writeTag(t,n.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){this.writeMessage(t,h,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,c,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedFixed64:function(t,
e){this.writeMessage(t,_,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,g,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,
e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e,i){var r=i(7);e.Processor=r},,,function(t,e,i){t.exports=
function(){function t(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function e(t,e){return t<e?-1:t>e?1:0}return function(i,r,n,o,s){!function e(i,r,n,o,s){for(;o>n;){if(o-n>600){var a=o-n+1,h=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),p=.5*Math.sqrt(l*u*(a-u)/a)*(h-a/2<0?-1:1),c=Math.max(n,Math.floor(r-h*u/a+p)),d=Math.min(o,Math.floor(r+(a-h)*u/a+p));e(i,r,c,d,s)}var f=i[r],_=n,g=o;for(t(i,n,r),s(i[o],f)>0&&t(i,n,o);_<g;){for(t(i,_,g),_++,g--;s(i[_],f)<0;)_++;for(;s(i[g],f)>0;)g--}0===s(i[n],f)?t(i,n,g):t(i,
++g,o),g<=r&&(n=g+1),r<=g&&(o=g-1)}}(i,r,n||0,o||i.length-1,s||e)}}()},function(t,e){e.read=function(t,e,i,r,n){var o,s,a=8*n-r-1,h=(1<<a)-1,l=h>>1,u=-7,p=i?n-1:0,c=i?-1:1,d=t[e+p];for(p+=c,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+p],p+=c,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+p],p+=c,u-=8);if(0===o)o=1-l;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=l}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,h,l=8*o-n-1,u=(1<<l)-1,p=u>>1,c=23===n?Math.pow(2,
-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+p>=1?c/h:c*Math.pow(2,1-p))*h>=2&&(s++,h/=2),s+p>=u?(a=0,s=u):s+p>=1?(a=(e*h-1)*Math.pow(2,n),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;t[i+d]=255&a,d+=f,a/=256,n-=8);for(s=s<<n|a,l+=n;l>0;t[i+d]=255&s,d+=f,s/=256,l-=8);t[i+d-f]|=128*_}},function(t,e,i){var r=i(8).newImageData;function n(t){var e=
!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,r){return e?new ImageData(t,i,r):{data:t,width:i,height:r}}return function(e){var r,n,o=e.buffers,s=e.meta,a=e.imageOps,h=e.width,l=e.height,u=o.length,p=o[0].byteLength;if(a){var c=new Array(u);for(n=0;n<u;++n)c[n]=i(new Uint8ClampedArray(o[n]),h,l);r=t(c,s).data}else{r=new Uint8ClampedArray(p);var d=new Array(u),f=new Array(u);for(n=0;n<u;++n)d[n]=new Uint8ClampedArray(o[n]),f[n]=[0,0,0,0];for(var _=0;_<p;_+=4){for(var g=0;g<u;++g){var y=
d[g];f[g][0]=y[_],f[g][1]=y[_+1],f[g][2]=y[_+2],f[g][3]=y[_+3]}var v=t(f,s);r[_]=v[0],r[_+1]=v[1],r[_+2]=v[2],r[_+3]=v[3]}}return r.buffer}}function o(t,e){var i=Object.keys(t.lib||{}).map(function(e){return"var "+e+" \x3d "+t.lib[e].toString()+";"}).concat(["var __minion__ \x3d ("+n.toString()+")(",t.operation.toString(),");",'self.addEventListener("message", function(event) {',"  var buffer \x3d __minion__(event.data);","  self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),
r=new Blob(i,{type:"text/javascript"}),o=URL.createObjectURL(r),s=new Worker(o);return s.addEventListener("message",e),s}function s(t){var e;this._imageOps=!!t.imageOps;var i=[];if(e=0===t.threads?0:this._imageOps?1:t.threads||1)for(var r=0;r<e;++r)i[r]=o(t,this._onWorkerMessage.bind(this,r));else i[0]=function(t,e){var i=n(t.operation);return{postMessage:function(t){setTimeout(function(){e({data:{buffer:i(t),meta:t.meta}})},0)}}}(t,this._onWorkerMessage.bind(this,0));this._workers=i,this._queue=
[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}s.prototype.process=function(t,e,i){this._enqueue({inputs:t,meta:e,callback:i}),this._dispatch()},s.prototype.destroy=function(){for(var t in this)this[t]=null;this._destroyed=!0},s.prototype._enqueue=function(t){for(this._queue.push(t);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)},s.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._job=this._queue.shift(),
e=t.inputs[0].width,i=t.inputs[0].height,r=t.inputs.map(function(t){return t.data.buffer}),n=this._workers.length;if(this._running=n,1===n)this._workers[0].postMessage({buffers:r,meta:t.meta,imageOps:this._imageOps,width:e,height:i},r);else for(var o=t.inputs[0].data.length,s=4*Math.ceil(o/4/n),a=0;a<n;++a){for(var h=a*s,l=[],u=0,p=r.length;u<p;++u)l.push(r[a].slice(h,h+s));this._workers[a].postMessage({buffers:l,meta:t.meta,imageOps:this._imageOps,width:e,height:i},l)}}},s.prototype._onWorkerMessage=
function(t,e){this._destroyed||(this._dataLookup[t]=e.data,--this._running,0===this._running&&this._resolveJob())},s.prototype._resolveJob=function(){var t,e,i=this._job,n=this._workers.length;if(1===n)t=new Uint8ClampedArray(this._dataLookup[0].buffer),e=this._dataLookup[0].meta;else{var o=i.inputs[0].data.length;t=new Uint8ClampedArray(o),e=new Array(o);for(var s=4*Math.ceil(o/4/n),a=0;a<n;++a){var h=this._dataLookup[a].buffer,l=a*s;t.set(new Uint8ClampedArray(h),l),e[a]=this._dataLookup[a].meta}}this._job=
null,this._dataLookup={},i.callback(null,r(t,i.inputs[0].width,i.inputs[0].height),e),this._dispatch()},t.exports=s},function(t,e){var i=!0;try{new ImageData(10,10)}catch(t){i=!1}var r=document.createElement("canvas").getContext("2d");e.newImageData=function(t,e,n){if(i)return new ImageData(t,e,n);var o=r.createImageData(e,n);return o.data.set(t),o}},function(t,e,i){function r(){return function(){throw new Error("Unimplemented abstract method.");}()}i.r(e);var n=0;function o(t){return t.ol_uid||(t.ol_uid=
String(++n))}var s="5.3.0",a=function(t){function e(e){var i="Assertion failed. See https://openlayers.org/en/"+("latest"===s?s:"v"+s.split("-")[0])+"/doc/errors/#"+e+" for details.";t.call(this,i),this.code=e,this.name="AssertionError",this.message=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),h={ADD:"add",REMOVE:"remove"},l="propertychange",u="function"==typeof Object.assign?Object.assign:function(t,e){var i=arguments;if(void 0===t||null===
t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),n=1,o=arguments.length;n<o;++n){var s=i[n];if(void 0!==s&&null!==s)for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a])}return r};function p(t){for(var e in t)delete t[e]}function c(t){var e=[];for(var i in t)e.push(t[i]);return e}function d(t){var e;for(e in t)return!1;return!e}function f(t,e,i,r){for(var n,o=0,s=t.length;o<s;++o)if((n=t[o]).listener===e&&n.bindTo===i)return r&&(n.deleteIndex=o),n}function _(t,e){var i=
g(t);return i?i[e]:void 0}function g(t,e){var i=t.ol_lm;return!i&&e&&(i=t.ol_lm={}),i}function y(t,e){var i=_(t,e);if(i){for(var r=0,n=i.length;r<n;++r)t.removeEventListener(e,i[r].boundListener),p(i[r]);i.length=0;var o=g(t);o&&(delete o[e],0===Object.keys(o).length&&function(t){delete t.ol_lm}(t))}}function v(t,e,i,r,n){var o=g(t,!0),s=o[e];s||(s=o[e]=[]);var a=f(s,i,r,!1);return a?n||(a.callOnce=!1):(a={bindTo:r,callOnce:!!n,listener:i,target:t,type:e},t.addEventListener(e,function(t){var e=function(e){var i=
t.listener,r=t.bindTo||t.target;return t.callOnce&&E(t),i.call(r,e)};return t.boundListener=e,e}(a)),s.push(a)),a}function m(t,e,i,r){return v(t,e,i,r,!0)}function x(t,e,i,r){var n=_(t,e);if(n){var o=f(n,i,r,!0);o&&E(o)}}function E(t){if(t&&t.target){t.target.removeEventListener(t.type,t.boundListener);var e=_(t.target,t.type);if(e){var i="deleteIndex"in t?t.deleteIndex:e.indexOf(t);-1!==i&&e.splice(i,1),0===e.length&&y(t.target,t.type)}p(t)}}function S(t){var e=g(t);if(e)for(var i in e)y(t,i)}var T=
function(){this.disposed_=!1};T.prototype.dispose=function(){this.disposed_||(this.disposed_=!0,this.disposeInternal())},T.prototype.disposeInternal=function(){};var C=T;function R(){return!0}function w(){return!1}function I(){}var L=function(t){this.propagationStopped,this.type=t,this.target=null};function O(t){t.stopPropagation()}L.prototype.preventDefault=function(){this.propagationStopped=!0},L.prototype.stopPropagation=function(){this.propagationStopped=!0};var P=L,b=function(t){function e(){t.call(this),
this.pendingRemovals_={},this.dispatching_={},this.listeners_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addEventListener=function(t,e){var i=this.listeners_[t];i||(i=this.listeners_[t]=[]),-1===i.indexOf(e)&&i.push(e)},e.prototype.dispatchEvent=function(t){var e="string"==typeof t?new P(t):t,i=e.type;e.target=this;var r,n=this.listeners_[i];if(n){i in this.dispatching_||(this.dispatching_[i]=0,this.pendingRemovals_[i]=0),++this.dispatching_[i];
for(var o=0,s=n.length;o<s;++o)if(!1===n[o].call(this,e)||e.propagationStopped){r=!1;break}if(--this.dispatching_[i],0===this.dispatching_[i]){var a=this.pendingRemovals_[i];for(delete this.pendingRemovals_[i];a--;)this.removeEventListener(i,I);delete this.dispatching_[i]}return r}},e.prototype.disposeInternal=function(){S(this)},e.prototype.getListeners=function(t){return this.listeners_[t]},e.prototype.hasListener=function(t){return t?t in this.listeners_:Object.keys(this.listeners_).length>0},
e.prototype.removeEventListener=function(t,e){var i=this.listeners_[t];if(i){var r=i.indexOf(e);t in this.pendingRemovals_?(i[r]=I,++this.pendingRemovals_[t]):(i.splice(r,1),0===i.length&&delete this.listeners_[t])}},e}(C),M={CHANGE:"change",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",ERROR:"error",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",MOUSEDOWN:"mousedown",MOUSEMOVE:"mousemove",MOUSEOUT:"mouseout",MOUSEUP:"mouseup",
MOUSEWHEEL:"mousewheel",MSPOINTERDOWN:"MSPointerDown",RESIZE:"resize",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",WHEEL:"wheel"};var F=function(t){function e(){t.call(this),this.revision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.changed=function(){++this.revision_,this.dispatchEvent(M.CHANGE)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var i=
t.length,r=new Array(i),n=0;n<i;++n)r[n]=v(this,t[n],e);return r}return v(this,t,e)},e.prototype.once=function(t,e){if(Array.isArray(t)){for(var i=t.length,r=new Array(i),n=0;n<i;++n)r[n]=m(this,t[n],e);return r}return m(this,t,e)},e.prototype.un=function(t,e){if(Array.isArray(t))for(var i=0,r=t.length;i<r;++i)x(this,t[i],e);else x(this,t,e)},e}(b),A=function(t){function e(e,i,r){t.call(this,e),this.key=i,this.oldValue=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e}(P),N={};function G(t){return N.hasOwnProperty(t)?N[t]:N[t]="change:"+t}var D=function(t){function e(e){t.call(this),o(this),this.values_={},void 0!==e&&this.setProperties(e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){var e;return this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e},e.prototype.getKeys=function(){return Object.keys(this.values_)},e.prototype.getProperties=function(){return u({},this.values_)},e.prototype.notify=
function(t,e){var i;i=G(t),this.dispatchEvent(new A(i,t,e)),i=l,this.dispatchEvent(new A(i,t,e))},e.prototype.set=function(t,e,i){if(i)this.values_[t]=e;else{var r=this.values_[t];this.values_[t]=e,r!==e&&this.notify(t,r)}},e.prototype.setProperties=function(t,e){for(var i in t)this.set(i,t[i],e)},e.prototype.unset=function(t,e){if(t in this.values_){var i=this.values_[t];delete this.values_[t],e||this.notify(t,i)}},e}(F),k="length",j=function(t){function e(e,i){t.call(this,e),this.element=i}return t&&
(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),U=function(t){function e(e,i){t.call(this);var r=i||{};if(this.unique_=!!r.unique,this.array_=e||[],this.unique_)for(var n=0,o=this.array_.length;n<o;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},e.prototype.extend=function(t){for(var e=
0,i=t.length;e<i;++e)this.push(t[e]);return this},e.prototype.forEach=function(t){for(var e=this.array_,i=0,r=e.length;i<r;++i)t(e[i],i,e)},e.prototype.getArray=function(){return this.array_},e.prototype.item=function(t){return this.array_[t]},e.prototype.getLength=function(){return this.get(k)},e.prototype.insertAt=function(t,e){this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new j(h.ADD,e))},e.prototype.pop=function(){return this.removeAt(this.getLength()-
1)},e.prototype.push=function(t){this.unique_&&this.assertUnique_(t);var e=this.getLength();return this.insertAt(e,t),this.getLength()},e.prototype.remove=function(t){for(var e=this.array_,i=0,r=e.length;i<r;++i)if(e[i]===t)return this.removeAt(i)},e.prototype.removeAt=function(t){var e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new j(h.REMOVE,e)),e},e.prototype.setAt=function(t,e){var i=this.getLength();if(t<i){this.unique_&&this.assertUnique_(e,t);var r=
this.array_[t];this.array_[t]=e,this.dispatchEvent(new j(h.REMOVE,r)),this.dispatchEvent(new j(h.ADD,e))}else{for(var n=i;n<t;++n)this.insertAt(n,void 0);this.insertAt(t,e)}},e.prototype.updateLength_=function(){this.set(k,this.array_.length)},e.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 a(58);},e}(D);function Y(t,e){if(!t)throw new a(e);}var B=function(t){function e(e){if(t.call(this),this.id_=void 0,this.geometryName_="geometry",
this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,v(this,G(this.geometryName_),this.handleGeometryChanged_,this),e)if("function"==typeof e.getSimplifiedGeometry){var i=e;this.setGeometry(i)}else{var r=e;this.setProperties(r)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){var t=new e(this.getProperties());t.setGeometryName(this.getGeometryName());var i=this.getGeometry();i&&t.setGeometry(i.clone());
var r=this.getStyle();return r&&t.setStyle(r),t},e.prototype.getGeometry=function(){return this.get(this.geometryName_)},e.prototype.getId=function(){return this.id_},e.prototype.getGeometryName=function(){return this.geometryName_},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.handleGeometryChange_=function(){this.changed()},e.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(E(this.geometryChangeKey_),
this.geometryChangeKey_=null);var t=this.getGeometry();t&&(this.geometryChangeKey_=v(t,M.CHANGE,this.handleGeometryChange_,this)),this.changed()},e.prototype.setGeometry=function(t){this.set(this.geometryName_,t)},e.prototype.setStyle=function(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;var e;if(Array.isArray(t))e=t;else{Y("function"==typeof t.getZIndex,41);var i=t;e=[i]}return function(){return e}}(t):void 0,this.changed()},e.prototype.setId=function(t){this.id_=
t,this.changed()},e.prototype.setGeometryName=function(t){x(this,G(this.geometryName_),this.handleGeometryChanged_,this),this.geometryName_=t,v(this,G(this.geometryName_),this.handleGeometryChanged_,this),this.handleGeometryChanged_()},e}(D);function V(t,e){return t>e?1:t<e?-1:0}function X(t,e){return t.indexOf(e)>=0}function z(t,e,i){var r,n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;if(i>0)for(r=1;r<n;++r){if(t[r]<e)return r-1}else if(i<0)for(r=1;r<n;++r){if(t[r]<=e)return r}else for(r=
1;r<n;++r){if(t[r]==e)return r;if(t[r]<e)return t[r-1]-e<e-t[r]?r-1:r}return n-1}function W(t,e,i){for(;e<i;){var r=t[e];t[e]=t[i],t[i]=r,++e,--i}}function K(t,e){for(var i=Array.isArray(e)?e:[e],r=i.length,n=0;n<r;n++)t[t.length]=i[n]}function H(t,e){for(var i,r=t.length>>>0,n=0;n<r;n++)if(e(i=t[n],n,t))return i;return null}function Z(t,e){var i=t.length;if(i!==e.length)return!1;for(var r=0;r<i;r++)if(t[r]!==e[r])return!1;return!0}function q(t,e){var i,r=t.length,n=Array(t.length);for(i=0;i<r;i++)n[i]=
{index:i,value:t[i]};for(n.sort(function(t,i){return e(t.value,i.value)||t.index-i.index}),i=0;i<t.length;i++)t[i]=n[i].value}function J(t,e){var i;return!t.every(function(r,n){return i=n,!e(r,n,t)})?i:-1}var Q={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"},$={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function tt(t){for(var e=ht(),i=0,r=t.length;i<r;++i)_t(e,t[i]);return e}function et(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=
t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function it(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function rt(t,e,i){var r,n;return(r=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0)*r+(n=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0)*n}function nt(t,e){return st(t,e[0],e[1])}function ot(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function st(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function at(t,e){var i=t[0],r=t[1],n=t[2],o=t[3],s=e[0],a=e[1],h=$.UNKNOWN;return s<i?h|=$.LEFT:
s>n&&(h|=$.RIGHT),a<r?h|=$.BELOW:a>o&&(h|=$.ABOVE),h===$.UNKNOWN&&(h=$.INTERSECTING),h}function ht(){return[1/0,1/0,-1/0,-1/0]}function lt(t,e,i,r,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=r,n):[t,e,i,r]}function ut(t){return lt(1/0,1/0,-1/0,-1/0,t)}function pt(t,e){var i=t[0],r=t[1];return lt(i,r,i,r,e)}function ct(t,e,i,r,n){return yt(ut(n),t,e,i,r)}function dt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ft(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&
(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function _t(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function gt(t,e){for(var i=0,r=e.length;i<r;++i)_t(t,e[i]);return t}function yt(t,e,i,r,n){for(;i<r;i+=n)vt(t,e[i],e[i+1]);return t}function vt(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)}function mt(t,e,i){var r;return(r=e.call(i,Et(t)))?r:(r=e.call(i,St(t)))?r:(r=e.call(i,Lt(t)))?r:(r=e.call(i,It(t)))||
!1}function xt(t){var e=0;return bt(t)||(e=Ot(t)*Rt(t)),e}function Et(t){return[t[0],t[1]]}function St(t){return[t[2],t[1]]}function Tt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Ct(t,e,i,r,n){var o=e*r[0]/2,s=e*r[1]/2,a=Math.cos(i),h=Math.sin(i),l=o*a,u=o*h,p=s*a,c=s*h,d=t[0],f=t[1],_=d-l+c,g=d-l-c,y=d+l-c,v=d+l+c,m=f-u-p,x=f-u+p,E=f+u+p,S=f+u-p;return lt(Math.min(_,g,y,v),Math.min(m,x,E,S),Math.max(_,g,y,v),Math.max(m,x,E,S),n)}function Rt(t){return t[3]-t[1]}function wt(t,e,i){var r=i||[1/
0,1/0,-1/0,-1/0];return Pt(t,e)?(t[0]>e[0]?r[0]=t[0]:r[0]=e[0],t[1]>e[1]?r[1]=t[1]:r[1]=e[1],t[2]<e[2]?r[2]=t[2]:r[2]=e[2],t[3]<e[3]?r[3]=t[3]:r[3]=e[3]):ut(r),r}function It(t){return[t[0],t[3]]}function Lt(t){return[t[2],t[3]]}function Ot(t){return t[2]-t[0]}function Pt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function bt(t){return t[2]<t[0]||t[3]<t[1]}function Mt(t,e){var i=(t[2]-t[0])/2*(e-1),r=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=r,t[3]+=r}function Ft(t,e,i){var r=[t[0],
t[1],t[0],t[3],t[2],t[1],t[2],t[3]];return e(r,r,2),function(t,e,i){return lt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}([r[0],r[2],r[4],r[6]],[r[1],r[3],r[5],r[7]],i)}var At={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"},Nt={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};
function Gt(t,e,i,r,n,o){for(var s=o||[],a=0,h=e;h<i;h+=r){var l=t[h],u=t[h+1];s[a++]=n[0]*l+n[2]*u+n[4],s[a++]=n[1]*l+n[3]*u+n[5]}return o&&s.length!=a&&(s.length=a),s}function Dt(t,e,i,r,n,o,s){for(var a=s||[],h=0,l=e;l<i;l+=r){a[h++]=t[l]+n,a[h++]=t[l+1]+o;for(var u=l+2;u<l+r;++u)a[h++]=t[u]}return s&&a.length!=h&&(a.length=h),a}function kt(t,e,i){return Math.min(Math.max(t,e),i)}var jt="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2};function Ut(t,e,i,r,n,o){var s=n-i,a=
o-r;if(0!==s||0!==a){var h=((t-i)*s+(e-r)*a)/(s*s+a*a);h>1?(i=n,r=o):h>0&&(i+=s*h,r+=a*h)}return Yt(t,e,i,r)}function Yt(t,e,i,r){var n=i-t,o=r-e;return n*n+o*o}function Bt(t){return 180*t/Math.PI}function Vt(t){return t*Math.PI/180}function Xt(t,e){var i=t%e;return i*e<0?i+e:i}function zt(t,e,i){return t+i*(e-t)}var Wt=6371008.8;function Kt(t,e,i){var r=i||Wt,n=Vt(t[1]),o=Vt(e[1]),s=(o-n)/2,a=Vt(e[0]-t[0])/2,h=Math.sin(s)*Math.sin(s)+Math.sin(a)*Math.sin(a)*Math.cos(n)*Math.cos(o);return 2*r*Math.atan2(Math.sqrt(h),
Math.sqrt(1-h))}function Ht(t,e){for(var i=0,r=0,n=t.length;r<n-1;++r)i+=Kt(t[r],t[r+1],e);return i}function Zt(t,e){for(var i=0,r=t.length,n=t[r-1][0],o=t[r-1][1],s=0;s<r;s++){var a=t[s][0],h=t[s][1];i+=Vt(a-n)*(2+Math.sin(Vt(o))+Math.sin(Vt(h))),n=a,o=h}return i*e*e/2}function qt(t,e,i,r){var n=r||Wt,o=Vt(t[1]),s=Vt(t[0]),a=e/n,h=Math.asin(Math.sin(o)*Math.cos(a)+Math.cos(o)*Math.sin(a)*Math.cos(i));return[Bt(s+Math.atan2(Math.sin(i)*Math.sin(a)*Math.cos(o),Math.cos(a)-Math.sin(o)*Math.sin(h))),
Bt(h)]}var Jt={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},Qt={};Qt[Jt.DEGREES]=2*Math.PI*6370997/360,Qt[Jt.FEET]=.3048,Qt[Jt.METERS]=1,Qt[Jt.USFEET]=1200/3937;var $t=Jt,te=function(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=
!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit};te.prototype.canWrapX=function(){return this.canWrapX_},te.prototype.getCode=function(){return this.code_},te.prototype.getExtent=function(){return this.extent_},te.prototype.getUnits=function(){return this.units_},te.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||Qt[this.units_]},te.prototype.getWorldExtent=function(){return this.worldExtent_},
te.prototype.getAxisOrientation=function(){return this.axisOrientation_},te.prototype.isGlobal=function(){return this.global_},te.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},te.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},te.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},te.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},te.prototype.setWorldExtent=function(t){this.worldExtent_=
t},te.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},te.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_};var ee=te,ie=6378137,re=Math.PI*ie,ne=[-re,-re,re,re],oe=[-180,-85,180,85],se=function(t){function e(e){t.call(this,{code:e,units:$t.METERS,extent:ne,global:!0,worldExtent:oe,getPointResolution:function(t,e){return t/jt(e[1]/ie)}})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ee),ae=
[new se("EPSG:3857"),new se("EPSG:102100"),new se("EPSG:102113"),new se("EPSG:900913"),new se("urn:ogc:def:crs:EPSG:6.18:3:3857"),new se("urn:ogc:def:crs:EPSG::3857"),new se("http://www.opengis.net/gml/srs/epsg.xml#3857")];function he(t,e,i){var r=t.length,n=i>1?i:2,o=e;void 0===o&&(o=n>2?t.slice():new Array(r));for(var s=re,a=0;a<r;a+=n){o[a]=s*t[a]/180;var h=ie*Math.log(Math.tan(Math.PI*(t[a+1]+90)/360));h>s?h=s:h<-s&&(h=-s),o[a+1]=h}return o}function le(t,e,i){var r=t.length,n=i>1?i:2,o=e;void 0===
o&&(o=n>2?t.slice():new Array(r));for(var s=0;s<r;s+=n)o[s]=180*t[s]/re,o[s+1]=360*Math.atan(Math.exp(t[s+1]/ie))/Math.PI-90;return o}var ue=[-180,-90,180,90],pe=6378137*Math.PI/180,ce=function(t){function e(e,i){t.call(this,{code:e,units:$t.DEGREES,extent:ue,axisOrientation:i,global:!0,metersPerUnit:pe,worldExtent:ue})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ee),de=[new ce("CRS:84"),new ce("EPSG:4326","neu"),new ce("urn:ogc:def:crs:EPSG::4326",
"neu"),new ce("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new ce("urn:ogc:def:crs:OGC:1.3:CRS84"),new ce("urn:ogc:def:crs:OGC:2:84"),new ce("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ce("urn:x-ogc:def:crs:EPSG:4326","neu")],fe={};var _e={};function ge(t,e,i){var r=t.getCode(),n=e.getCode();r in _e||(_e[r]={}),_e[r][n]=i}function ye(t,e){var i;return t in _e&&e in _e[t]&&(i=_e[t][e]),i}function ve(t,e,i){var r;if(void 0!==e){for(var n=0,o=t.length;n<o;++n)e[n]=t[n];r=e}else r=t.slice();return r}
function me(t,e,i){if(void 0!==e&&t!==e){for(var r=0,n=t.length;r<n;++r)e[r]=t[r];t=e}return t}function xe(t){!function(t,e){fe[t]=e}(t.getCode(),t),ge(t,t,ve)}function Ee(t){return"string"==typeof t?function(t){return fe[t]||null}(t):t||null}function Se(t,e,i,r){var n,o=(t=Ee(t)).getPointResolutionFunc();if(o)n=o(e,i);else if(t.getUnits()==$t.DEGREES&&!r||r==$t.DEGREES)n=e;else{var s=Le(t,Ee("EPSG:4326")),a=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];n=(Kt((a=s(a,a,2)).slice(0,2),a.slice(2,
4))+Kt(a.slice(4,6),a.slice(6,8)))/2;var h=r?Qt[r]:t.getMetersPerUnit();void 0!==h&&(n/=h)}return n}function Te(t){!function(t){t.forEach(xe)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&ge(e,t,ve)})})}function Ce(t,e){return t?"string"==typeof t?Ee(t):t:Ee(e)}function Re(t){return function(e,i,r){for(var n=e.length,o=void 0!==r?r:2,s=void 0!==i?i:new Array(n),a=0;a<n;a+=o){var h=t([e[a],e[a+1]]);s[a]=h[0],s[a+1]=h[1];for(var l=o-1;l>=2;--l)s[a+l]=e[a+l]}return s}}function we(t,e,i,r){var n=
Ee(t),o=Ee(e);ge(n,o,Re(i)),ge(o,n,Re(r))}function Ie(t,e){if(t===e)return!0;var i=t.getUnits()===e.getUnits();return t.getCode()===e.getCode()?i:Le(t,e)===ve&&i}function Le(t,e){var i=ye(t.getCode(),e.getCode());return i||(i=me),i}function Oe(t,e){return Le(Ee(t),Ee(e))}function Pe(t,e,i){return Oe(e,i)(t,void 0,t.length)}function be(t,e,i){return Ft(t,Oe(e,i))}Te(ae),Te(de),function(t,e,i,r){t.forEach(function(t){e.forEach(function(e){ge(t,e,i),ge(e,t,r)})})}(de,ae,he,le);var Me=new Array(6);function Fe(t){return Ne(t,
1,0,0,1,0,0)}function Ae(t,e){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],h=e[0],l=e[1],u=e[2],p=e[3],c=e[4],d=e[5];return t[0]=i*h+n*l,t[1]=r*h+o*l,t[2]=i*u+n*p,t[3]=r*u+o*p,t[4]=i*c+n*d+s,t[5]=r*c+o*d+a,t}function Ne(t,e,i,r,n,o,s){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=o,t[5]=s,t}function Ge(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function De(t,e){var i=e[0],r=e[1];return e[0]=t[0]*i+t[2]*r+t[4],e[1]=t[1]*i+t[3]*r+t[5],e}function ke(t,e){var i=Math.cos(e),r=
Math.sin(e);return Ae(t,Ne(Me,i,r,-r,i,0,0))}function je(t,e,i){return Ae(t,Ne(Me,e,0,0,i,0,0))}function Ue(t,e,i){return Ae(t,Ne(Me,1,0,0,1,e,i))}function Ye(t,e,i,r,n,o,s,a){var h=Math.sin(o),l=Math.cos(o);return t[0]=r*l,t[1]=n*h,t[2]=-r*h,t[3]=n*l,t[4]=s*r*l-a*r*h+e,t[5]=s*n*h+a*n*l+i,t}function Be(t){var e=function(t){return t[0]*t[3]-t[1]*t[2]}(t);Y(0!==e,32);var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5];return t[0]=o/e,t[1]=-r/e,t[2]=-n/e,t[3]=i/e,t[4]=(n*a-o*s)/e,t[5]=-(i*a-r*s)/e,t}var Ve=
[1,0,0,1,0,0],Xe=function(t){function e(){t.call(this),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryCache={},this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return r()},e.prototype.closestPointXY=function(t,e,i,n){return r()},e.prototype.containsXY=function(t,e){return!1},e.prototype.getClosestPoint=function(t,
e){var i=e||[NaN,NaN];return this.closestPointXY(t[0],t[1],i,1/0),i},e.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},e.prototype.computeExtent=function(t){return r()},e.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)},e.prototype.rotate=function(t,e){r()},e.prototype.scale=
function(t,e,i){r()},e.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},e.prototype.getSimplifiedGeometry=function(t){return r()},e.prototype.getType=function(){return r()},e.prototype.applyTransform=function(t){r()},e.prototype.intersectsExtent=function(t){return r()},e.prototype.translate=function(t,e){r()},e.prototype.transform=function(t,e){var i=Ee(t),r=i.getUnits()==$t.TILE_PIXELS?function(t,r,n){var o=i.getExtent(),s=i.getWorldExtent(),a=Rt(s)/Rt(o);return Ye(Ve,s[0],
s[3],a,-a,0,0,0),Gt(t,0,t.length,n,Ve,r),Oe(i,e)(t,r,n)}:Oe(i,e);return this.applyTransform(r),this},e}(D);function ze(t){var e;return t==At.XY?e=2:t==At.XYZ||t==At.XYM?e=3:t==At.XYZM&&(e=4),e}var We=function(t){function e(){t.call(this),this.layout=At.XY,this.stride=2,this.flatCoordinates=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeExtent=function(t){return ct(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,
t)},e.prototype.getCoordinates=function(){return r()},e.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.getFlatCoordinates=function(){return this.flatCoordinates},e.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},e.prototype.getLayout=function(){return this.layout},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()&&(p(this.simplifiedGeometryCache),
this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var e=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(e))return this.simplifiedGeometryCache[e];var i=this.getSimplifiedGeometryInternal(t);return i.getFlatCoordinates().length<this.flatCoordinates.length?(this.simplifiedGeometryCache[e]=i,i):(this.simplifiedGeometryMaxMinSquaredTolerance=
t,this)},e.prototype.getSimplifiedGeometryInternal=function(t){return this},e.prototype.getStride=function(){return this.stride},e.prototype.setFlatCoordinates=function(t,e){this.stride=ze(t),this.layout=t,this.flatCoordinates=e},e.prototype.setCoordinates=function(t,e){r()},e.prototype.setLayout=function(t,e,i){var r;if(t)r=ze(t);else{for(var n=0;n<i;++n){if(0===e.length)return this.layout=At.XY,void(this.stride=2);e=e[0]}t=function(t){var e;2==t?e=At.XY:3==t?e=At.XYZ:4==t&&(e=At.XYZM);return e}(r=
e.length)}this.layout=t,this.stride=r},e.prototype.applyTransform=function(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},e.prototype.rotate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();!function(t,e,i,r,n,o,s){for(var a=s||[],h=Math.cos(n),l=Math.sin(n),u=o[0],p=o[1],c=0,d=e;d<i;d+=r){var f=t[d]-u,_=t[d+1]-p;a[c++]=u+f*h-_*l,a[c++]=p+f*l+_*h;for(var g=d+2;g<d+r;++g)a[c++]=t[g]}s&&a.length!=c&&(a.length=c)}(i,0,i.length,
r,t,e,i),this.changed()}},e.prototype.scale=function(t,e,i){var r=e;void 0===r&&(r=t);var n=i;n||(n=Tt(this.getExtent()));var o=this.getFlatCoordinates();if(o){var s=this.getStride();!function(t,e,i,r,n,o,s,a){for(var h=a||[],l=s[0],u=s[1],p=0,c=e;c<i;c+=r){var d=t[c]-l,f=t[c+1]-u;h[p++]=l+n*d,h[p++]=u+o*f;for(var _=c+2;_<c+r;++_)h[p++]=t[_]}a&&h.length!=p&&(h.length=p)}(o,0,o.length,s,t,r,n,o),this.changed()}},e.prototype.translate=function(t,e){var i=this.getFlatCoordinates();if(i){var r=this.getStride();
Dt(i,0,i.length,r,t,e,i),this.changed()}},e}(Xe);function Ke(t,e,i,r){for(var n=0,o=t[i-r],s=t[i-r+1];e<i;e+=r){var a=t[e],h=t[e+1];n+=s*a-o*h,o=a,s=h}return n/2}function He(t,e,i,r){for(var n=0,o=0,s=i.length;o<s;++o){var a=i[o];n+=Ke(t,e,a,r),e=a}return n}function Ze(t,e,i,r,n,o,s){var a,h=t[e],l=t[e+1],u=t[i]-h,p=t[i+1]-l;if(0===u&&0===p)a=e;else{var c=((n-h)*u+(o-l)*p)/(u*u+p*p);if(c>1)a=i;else{if(c>0){for(var d=0;d<r;++d)s[d]=zt(t[e+d],t[i+d],c);return void(s.length=r)}a=e}}for(var f=0;f<r;++f)s[f]=
t[a+f];s.length=r}function qe(t,e,i,r,n){var o=t[e],s=t[e+1];for(e+=r;e<i;e+=r){var a=t[e],h=t[e+1],l=Yt(o,s,a,h);l>n&&(n=l),o=a,s=h}return n}function Je(t,e,i,r,n){for(var o=0,s=i.length;o<s;++o){var a=i[o];n=qe(t,e,a,r,n),e=a}return n}function Qe(t,e,i,r,n,o,s,a,h,l,u){if(e==i)return l;var p,c;if(0===n){if((c=Yt(s,a,t[e],t[e+1]))<l){for(p=0;p<r;++p)h[p]=t[e+p];return h.length=r,c}return l}for(var d=u||[NaN,NaN],f=e+r;f<i;)if(Ze(t,f-r,f,r,s,a,d),(c=Yt(s,a,d[0],d[1]))<l){for(l=c,p=0;p<r;++p)h[p]=
d[p];h.length=r,f+=r}else f+=r*Math.max((Math.sqrt(c)-Math.sqrt(l))/n|0,1);if(o&&(Ze(t,i-r,e,r,s,a,d),(c=Yt(s,a,d[0],d[1]))<l)){for(l=c,p=0;p<r;++p)h[p]=d[p];h.length=r}return l}function $e(t,e,i,r,n,o,s,a,h,l,u){for(var p=u||[NaN,NaN],c=0,d=i.length;c<d;++c){var f=i[c];l=Qe(t,e,f,r,n,o,s,a,h,l,p),e=f}return l}function ti(t,e,i,r){for(var n=0,o=i.length;n<o;++n)t[e++]=i[n];return e}function ei(t,e,i,r){for(var n=0,o=i.length;n<o;++n)for(var s=i[n],a=0;a<r;++a)t[e++]=s[a];return e}function ii(t,e,
i,r,n){for(var o=n||[],s=0,a=0,h=i.length;a<h;++a){var l=ei(t,e,i[a],r);o[s++]=l,e=l}return o.length=s,o}function ri(t,e,i,r,n){for(var o=void 0!==n?n:[],s=0,a=e;a<i;a+=r)o[s++]=t.slice(a,a+r);return o.length=s,o}function ni(t,e,i,r,n){for(var o=void 0!==n?n:[],s=0,a=0,h=i.length;a<h;++a){var l=i[a];o[s++]=ri(t,e,l,r,o[s]),e=l}return o.length=s,o}function oi(t,e,i,r,n){for(var o=void 0!==n?n:[],s=0,a=0,h=i.length;a<h;++a){var l=i[a];o[s++]=ni(t,e,l,r,o[s]),e=l[l.length-1]}return o.length=s,o}function si(t,
e,i,r,n,o,s){var a=(i-e)/r;if(a<3){for(;e<i;e+=r)o[s++]=t[e],o[s++]=t[e+1];return s}var h=new Array(a);h[0]=1,h[a-1]=1;for(var l=[e,i-r],u=0;l.length>0;){for(var p=l.pop(),c=l.pop(),d=0,f=t[c],_=t[c+1],g=t[p],y=t[p+1],v=c+r;v<p;v+=r){var m=Ut(t[v],t[v+1],f,_,g,y);m>d&&(u=v,d=m)}d>n&&(h[(u-e)/r]=1,c+r<u&&l.push(c,u),u+r<p&&l.push(u,p))}for(var x=0;x<a;++x)h[x]&&(o[s++]=t[e+x*r],o[s++]=t[e+x*r+1]);return s}function ai(t,e,i,r,n,o,s,a){for(var h=0,l=i.length;h<l;++h){var u=i[h];s=si(t,e,u,r,n,o,s),a.push(s),
e=u}return s}function hi(t,e){return e*Math.round(t/e)}function li(t,e,i,r,n,o,s){if(e==i)return s;var a,h,l=hi(t[e],n),u=hi(t[e+1],n);e+=r,o[s++]=l,o[s++]=u;do if(a=hi(t[e],n),h=hi(t[e+1],n),(e+=r)==i)return o[s++]=a,o[s++]=h,s;while(a==l&&h==u);for(;e<i;){var p=hi(t[e],n),c=hi(t[e+1],n);if(e+=r,p!=a||c!=h){var d=a-l,f=h-u,_=p-l,g=c-u;d*g==f*_&&(d<0&&_<d||d==_||d>0&&_>d)&&(f<0&&g<f||f==g||f>0&&g>f)?(a=p,h=c):(o[s++]=a,o[s++]=h,l=a,u=h,a=p,h=c)}}return o[s++]=a,o[s++]=h,s}function ui(t,e,i,r,n,o,
s,a){for(var h=0,l=i.length;h<l;++h){var u=i[h];s=li(t,e,u,r,n,o,s),a.push(s),e=u}return s}var pi=function(t){function e(e,i){t.call(this),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===i||Array.isArray(e[0])?this.setCoordinates(e,i):this.setFlatCoordinates(i,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,i,r){return r<
rt(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,r))},e.prototype.getArea=function(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getCoordinates=function(){return ri(this.flatCoordinates,0,this.flatCoordinates.length,
this.stride)},e.prototype.getSimplifiedGeometryInternal=function(t){var i=[];return i.length=si(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i,0),new e(i,At.XY)},e.prototype.getType=function(){return Nt.LINEAR_RING},e.prototype.intersectsExtent=function(t){return!1},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ei(this.flatCoordinates,0,t,this.stride),this.changed()},e}(We),ci=function(t){function e(e,
i){t.call(this),this.setCoordinates(e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,i,r){var n=this.flatCoordinates,o=Yt(t,e,n[0],n[1]);if(o<r){for(var s=this.stride,a=0;a<s;++a)i[a]=n[a];return i.length=s,o}return r},e.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},e.prototype.computeExtent=
function(t){return pt(this.flatCoordinates,t)},e.prototype.getType=function(){return Nt.POINT},e.prototype.intersectsExtent=function(t){return st(t,this.flatCoordinates[0],this.flatCoordinates[1])},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ti(this.flatCoordinates,0,t,this.stride),this.changed()},e}(We);function di(t,e,i,r,n){return!mt(n,function(n){return!fi(t,e,i,r,n[0],n[1])})}function fi(t,e,i,r,n,
o){for(var s=0,a=t[i-r],h=t[i-r+1];e<i;e+=r){var l=t[e],u=t[e+1];h<=o?u>o&&(l-a)*(o-h)-(n-a)*(u-h)>0&&s++:u<=o&&(l-a)*(o-h)-(n-a)*(u-h)<0&&s--,a=l,h=u}return 0!==s}function _i(t,e,i,r,n,o){if(0===i.length)return!1;if(!fi(t,e,i[0],r,n,o))return!1;for(var s=1,a=i.length;s<a;++s)if(fi(t,i[s-1],i[s],r,n,o))return!1;return!0}function gi(t,e,i,r,n,o,s){for(var a,h,l,u,p,c,d,f=n[o+1],_=[],g=0,y=i.length;g<y;++g){var v=i[g];for(u=t[v-r],c=t[v-r+1],a=e;a<v;a+=r)p=t[a],d=t[a+1],(f<=c&&d<=f||c<=f&&f<=d)&&(l=
(f-c)/(d-c)*(p-u)+u,_.push(l)),u=p,c=d}var m=NaN,x=-1/0;for(_.sort(V),u=_[0],a=1,h=_.length;a<h;++a){p=_[a];var E=Math.abs(p-u);E>x&&_i(t,e,i,r,l=(u+p)/2,f)&&(m=l,x=E),u=p}return isNaN(m)&&(m=n[o]),s?(s.push(m,f,x),s):[m,f,x]}function yi(t,e,i,r,n){for(var o=[],s=0,a=i.length;s<a;++s){var h=i[s];o=gi(t,e,h,r,n,2*s,o),e=h[h.length-1]}return o}function vi(t,e,i,r,n,o){for(var s,a=[t[e],t[e+1]],h=[];e+r<i;e+=r){if(h[0]=t[e+r],h[1]=t[e+r+1],s=n.call(o,a,h))return s;a[0]=h[0],a[1]=h[1]}return!1}function mi(t,
e,i,r,n){var o=yt([1/0,1/0,-1/0,-1/0],t,e,i,r);return!!Pt(n,o)&&(!!ot(n,o)||(o[0]>=n[0]&&o[2]<=n[2]||(o[1]>=n[1]&&o[3]<=n[3]||vi(t,e,i,r,function(t,e){return function(t,e,i){var r=!1,n=at(t,e),o=at(t,i);if(n===$.INTERSECTING||o===$.INTERSECTING)r=!0;else{var s,a,h=t[0],l=t[1],u=t[2],p=t[3],c=e[0],d=e[1],f=i[0],_=i[1],g=(_-d)/(f-c);o&$.ABOVE&&!(n&$.ABOVE)&&(r=(s=f-(_-p)/g)>=h&&s<=u),r||!(o&$.RIGHT)||n&$.RIGHT||(r=(a=_-(f-u)*g)>=l&&a<=p),r||!(o&$.BELOW)||n&$.BELOW||(r=(s=f-(_-l)/g)>=h&&s<=u),r||!(o&
$.LEFT)||n&$.LEFT||(r=(a=_-(f-h)*g)>=l&&a<=p)}return r}(n,t,e)}))))}function xi(t,e,i,r,n){if(!function(t,e,i,r,n){return!!(mi(t,e,i,r,n)||fi(t,e,i,r,n[0],n[1])||fi(t,e,i,r,n[0],n[3])||fi(t,e,i,r,n[2],n[1])||fi(t,e,i,r,n[2],n[3]))}(t,e,i[0],r,n))return!1;if(1===i.length)return!0;for(var o=1,s=i.length;o<s;++o)if(di(t,i[o-1],i[o],r,n)&&!mi(t,i[o-1],i[o],r,n))return!1;return!0}function Ei(t,e,i,r){for(;e<i-r;){for(var n=0;n<r;++n){var o=t[e+n];t[e+n]=t[i-r+n],t[i-r+n]=o}e+=r,i-=r}}function Si(t,e,i,
r){for(var n=0,o=t[i-r],s=t[i-r+1];e<i;e+=r){var a=t[e],h=t[e+1];n+=(a-o)*(h+s),o=a,s=h}return n>0}function Ti(t,e,i,r,n){for(var o=void 0!==n&&n,s=0,a=i.length;s<a;++s){var h=i[s],l=Si(t,e,h,r);if(0===s){if(o&&l||!o&&!l)return!1}else if(o&&!l||!o&&l)return!1;e=h}return!0}function Ci(t,e,i,r,n){for(var o=void 0!==n&&n,s=0,a=i.length;s<a;++s){var h=i[s],l=Si(t,e,h,r);(0===s?o&&l||!o&&!l:o&&!l||!o&&l)&&Ei(t,e,h,r),e=h}return e}function Ri(t,e,i,r,n){for(var o=0,s=i.length;o<s;++o)e=Ci(t,e,i[o],r,n);
return e}var wi=function(t){function e(e,i,r){t.call(this),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==i&&r?(this.setFlatCoordinates(i,e),this.ends_=r):this.setCoordinates(e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.appendLinearRing=function(t){this.flatCoordinates?K(this.flatCoordinates,
t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice())},e.prototype.closestPointXY=function(t,e,i,r){return r<rt(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Je(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$e(this.flatCoordinates,
0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,r))},e.prototype.containsXY=function(t,e){return _i(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)},e.prototype.getArea=function(){return He(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},e.prototype.getCoordinates=function(t){var e;return void 0!==t?Ci(e=this.getOrientedFlatCoordinates().slice(),0,this.ends_,this.stride,t):e=this.flatCoordinates,ni(e,0,this.ends_,this.stride)},e.prototype.getEnds=function(){return this.ends_},
e.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=Tt(this.getExtent());this.flatInteriorPoint_=gi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},e.prototype.getInteriorPoint=function(){return new ci(this.getFlatInteriorPoint(),At.XYM)},e.prototype.getLinearRingCount=function(){return this.ends_.length},e.prototype.getLinearRing=function(t){return t<
0||this.ends_.length<=t?null:new pi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)},e.prototype.getLinearRings=function(){for(var t=this.layout,e=this.flatCoordinates,i=this.ends_,r=[],n=0,o=0,s=i.length;o<s;++o){var a=i[o],h=new pi(e.slice(n,a),t);r.push(h),n=a}return r},e.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;Ti(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=
t.slice(),this.orientedFlatCoordinates_.length=Ci(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},e.prototype.getSimplifiedGeometryInternal=function(t){var i=[],r=[];return i.length=ui(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),i,0,r),new e(i,At.XY,r)},e.prototype.getType=function(){return Nt.POLYGON},e.prototype.intersectsExtent=function(t){return xi(this.getOrientedFlatCoordinates(),0,this.ends_,
this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var i=ii(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()},e}(We),Ii=wi;function Li(t,e,i,r){for(var n=i||32,o=[],s=0;s<n;++s)K(o,qt(t,e,2*Math.PI*s/n,r));return o.push(o[0],o[1]),new wi(o,At.XY,[o.length])}function Oi(t){var e=t[0],i=t[1],r=t[2],n=t[3],o=[e,i,e,n,r,n,r,i,e,i];return new wi(o,At.XY,[o.length])}
function Pi(t,e,i){for(var r=e||32,n=t.getStride(),o=t.getLayout(),s=t.getCenter(),a=n*(r+1),h=new Array(a),l=0;l<a;l+=n){h[l]=0,h[l+1]=0;for(var u=2;u<n;u++)h[l+u]=s[u]}var p=[h.length],c=new wi(h,o,p);return bi(c,s,t.getRadius(),i),c}function bi(t,e,i,r){for(var n=t.getFlatCoordinates(),o=t.getStride(),s=n.length/o-1,a=r||0,h=0;h<=s;++h){var l=h*o,u=a+2*Xt(h,s)*Math.PI/s;n[l]=e[0]+i*Math.cos(u),n[l+1]=e[1]+i*Math.sin(u)}t.changed()}var Mi="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():
"",Fi=-1!==Mi.indexOf("firefox"),Ai=-1!==Mi.indexOf("safari")&&-1==Mi.indexOf("chrom"),Ni=-1!==Mi.indexOf("webkit")&&-1==Mi.indexOf("edge"),Gi=-1!==Mi.indexOf("macintosh"),Di=window.devicePixelRatio||1,ki=function(){var t=!1;try{t=!!document.createElement("canvas").getContext("2d").setLineDash}catch(t){}return t}(),ji="geolocation"in navigator,Ui="ontouchstart"in window,Yi="PointerEvent"in window,Bi=!!navigator.msPointerEnabled,Vi={ACCURACY:"accuracy",ACCURACY_GEOMETRY:"accuracyGeometry",ALTITUDE:"altitude",
ALTITUDE_ACCURACY:"altitudeAccuracy",HEADING:"heading",POSITION:"position",PROJECTION:"projection",SPEED:"speed",TRACKING:"tracking",TRACKING_OPTIONS:"trackingOptions"},Xi=function(t){function e(e){t.call(this,M.ERROR),this.code=e.code,this.message=e.message}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),zi=function(t){function e(e){t.call(this);var i=e||{};this.position_=null,this.transform_=me,this.watchId_=void 0,v(this,G(Vi.PROJECTION),this.handleProjectionChanged_,
this),v(this,G(Vi.TRACKING),this.handleTrackingChanged_,this),void 0!==i.projection&&this.setProjection(i.projection),void 0!==i.trackingOptions&&this.setTrackingOptions(i.trackingOptions),this.setTracking(void 0!==i.tracking&&i.tracking)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.setTracking(!1),t.prototype.disposeInternal.call(this)},e.prototype.handleProjectionChanged_=function(){var t=this.getProjection();
t&&(this.transform_=Le(Ee("EPSG:4326"),t),this.position_&&this.set(Vi.POSITION,this.transform_(this.position_)))},e.prototype.handleTrackingChanged_=function(){if(ji){var t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}},e.prototype.positionChange_=function(t){var e=
t.coords;this.set(Vi.ACCURACY,e.accuracy),this.set(Vi.ALTITUDE,null===e.altitude?void 0:e.altitude),this.set(Vi.ALTITUDE_ACCURACY,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(Vi.HEADING,null===e.heading?void 0:Vt(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];var i=this.transform_(this.position_);this.set(Vi.POSITION,i),this.set(Vi.SPEED,null===e.speed?void 0:e.speed);var r=Li(this.position_,e.accuracy);
r.applyTransform(this.transform_),this.set(Vi.ACCURACY_GEOMETRY,r),this.changed()},e.prototype.positionError_=function(t){this.setTracking(!1),this.dispatchEvent(new Xi(t))},e.prototype.getAccuracy=function(){return this.get(Vi.ACCURACY)},e.prototype.getAccuracyGeometry=function(){return this.get(Vi.ACCURACY_GEOMETRY)||null},e.prototype.getAltitude=function(){return this.get(Vi.ALTITUDE)},e.prototype.getAltitudeAccuracy=function(){return this.get(Vi.ALTITUDE_ACCURACY)},e.prototype.getHeading=function(){return this.get(Vi.HEADING)},
e.prototype.getPosition=function(){return this.get(Vi.POSITION)},e.prototype.getProjection=function(){return this.get(Vi.PROJECTION)},e.prototype.getSpeed=function(){return this.get(Vi.SPEED)},e.prototype.getTracking=function(){return this.get(Vi.TRACKING)},e.prototype.getTrackingOptions=function(){return this.get(Vi.TRACKING_OPTIONS)},e.prototype.setProjection=function(t){this.set(Vi.PROJECTION,Ee(t))},e.prototype.setTracking=function(t){this.set(Vi.TRACKING,t)},e.prototype.setTrackingOptions=function(t){this.set(Vi.TRACKING_OPTIONS,
t)},e}(D);function Wi(t,e,i){var r=void 0!==i?t.toFixed(i):""+t,n=r.indexOf(".");return(n=-1===n?r.length:n)>e?r:(new Array(1+e-n)).join("0")+r}function Ki(t,e){for(var i=(""+t).split("."),r=(""+e).split("."),n=0;n<Math.max(i.length,r.length);n++){var o=parseInt(i[n]||"0",10),s=parseInt(r[n]||"0",10);if(o>s)return 1;if(s>o)return-1}return 0}function Hi(t,e){return t[0]+=e[0],t[1]+=e[1],t}function Zi(t,e){var i,r,n=t[0],o=t[1],s=e[0],a=e[1],h=s[0],l=s[1],u=a[0],p=a[1],c=u-h,d=p-l,f=0===c&&0===d?0:
(c*(n-h)+d*(o-l))/(c*c+d*d||0);return f<=0?(i=h,r=l):f>=1?(i=u,r=p):(i=h+f*c,r=l+f*d),[i,r]}function qi(t,e,i){var r=Xt(e+180,360)-180,n=Math.abs(3600*r),o=i||0,s=Math.pow(10,o),a=Math.floor(n/3600),h=Math.floor((n-3600*a)/60),l=n-3600*a-60*h;return(l=Math.ceil(l*s)/s)>=60&&(l=0,h+=1),h>=60&&(h=0,a+=1),a+"\u00b0 "+Wi(h,2)+"\u2032 "+Wi(l,2,o)+"\u2033"+(0==r?"":" "+t.charAt(r<0?1:0))}function Ji(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Qi(t,e){for(var i=
!0,r=t.length-1;r>=0;--r)if(t[r]!=e[r]){i=!1;break}return i}function $i(t,e){var i=Math.cos(e),r=Math.sin(e),n=t[0]*i-t[1]*r,o=t[1]*i+t[0]*r;return t[0]=n,t[1]=o,t}function tr(t,e){return t[0]*=e,t[1]*=e,t}function er(t,e){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function ir(t,e){return Math.sqrt(er(t,e))}function rr(t,e){return er(t,Zi(t,e))}function nr(t,e){return Ji(t,"{x}, {y}",e)}function or(t,e,i,r,n,o){var s=NaN,a=NaN,h=(i-e)/r;if(1===h)s=t[e],a=t[e+1];else if(2==h)s=(1-n)*t[e]+n*t[e+r],
a=(1-n)*t[e+1]+n*t[e+r+1];else if(0!==h){for(var l=t[e],u=t[e+1],p=0,c=[0],d=e+r;d<i;d+=r){var f=t[d],_=t[d+1];p+=Math.sqrt((f-l)*(f-l)+(_-u)*(_-u)),c.push(p),l=f,u=_}var g=n*p,y=function(t,e,i){for(var r,n,o=i||V,s=0,a=t.length,h=!1;s<a;)(n=+o(t[r=s+(a-s>>1)],e))<0?s=r+1:(a=r,h=!n);return h?s:~s}(c,g);if(y<0){var v=(g-c[-y-2])/(c[-y-1]-c[-y-2]),m=e+(-y-2)*r;s=zt(t[m],t[m+r],v),a=zt(t[m+1],t[m+r+1],v)}else s=t[e+y*r],a=t[e+y*r+1]}return o?(o[0]=s,o[1]=a,o):[s,a]}function sr(t,e,i,r,n,o){if(i==e)return null;
var s;if(n<t[e+r-1])return o?((s=t.slice(e,e+r))[r-1]=n,s):null;if(t[i-1]<n)return o?((s=t.slice(i-r,i))[r-1]=n,s):null;if(n==t[e+r-1])return t.slice(e,e+r);for(var a=e/r,h=i/r;a<h;){var l=a+h>>1;n<t[(l+1)*r-1]?h=l:a=l+1}var u=t[a*r-1];if(n==u)return t.slice((a-1)*r,(a-1)*r+r);var p=(n-u)/(t[(a+1)*r-1]-u);s=[];for(var c=0;c<r-1;++c)s.push(zt(t[(a-1)*r+c],t[a*r+c],p));return s.push(n),s}function ar(t,e,i,r){for(var n=t[e],o=t[e+1],s=0,a=e+r;a<i;a+=r){var h=t[a],l=t[a+1];s+=Math.sqrt((h-n)*(h-n)+(l-
o)*(l-o)),n=h,o=l}return s}var hr=function(t){function e(e,i){t.call(this),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===i||Array.isArray(e[0])?this.setCoordinates(e,i):this.setFlatCoordinates(i,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.appendCoordinate=function(t){this.flatCoordinates?K(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()},e.prototype.clone=
function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,i,r){return r<rt(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,r))},e.prototype.forEachSegment=function(t){return vi(this.flatCoordinates,0,this.flatCoordinates.length,
this.stride,t)},e.prototype.getCoordinateAtM=function(t,e){if(this.layout!=At.XYM&&this.layout!=At.XYZM)return null;var i=void 0!==e&&e;return sr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i)},e.prototype.getCoordinates=function(){return ri(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getCoordinateAt=function(t,e){return or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e)},e.prototype.getLength=function(){return ar(this.flatCoordinates,
0,this.flatCoordinates.length,this.stride)},e.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},e.prototype.getSimplifiedGeometryInternal=function(t){var i=[];return i.length=si(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i,0),new e(i,At.XY)},e.prototype.getType=function(){return Nt.LINE_STRING},e.prototype.intersectsExtent=
function(t){return mi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ei(this.flatCoordinates,0,t,this.stride),this.changed()},e}(We);function lr(t,e,i){for(var r,n,o,s,a,h,l=[],u=t(0),p=t(1),c=e(u),d=e(p),f=[p,u],_=[d,c],g=[1,0],y={},v=1E5;--v>0&&g.length>0;)o=g.pop(),u=f.pop(),c=_.pop(),(h=o.toString())in y||(l.push(c[0],c[1]),y[h]=!0),s=g.pop(),
p=f.pop(),d=_.pop(),Ut((n=e(r=t(a=(o+s)/2)))[0],n[1],c[0],c[1],d[0],d[1])<i?(l.push(d[0],d[1]),y[h=s.toString()]=!0):(g.push(s,a,a,o),_.push(d,n,n,c),f.push(p,r,r,u));return l}var ur={POSTCOMPOSE:"postcompose",PRECOMPOSE:"precompose",RENDER:"render",RENDERCOMPLETE:"rendercomplete"},pr=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,cr=/^([a-z]*)$/i;function dr(t){return"string"==typeof t?t:yr(t)}var fr=function(){var t={},e=0;return function(i){var r;if(t.hasOwnProperty(i))r=t[i];else{if(e>=1024){var n=
0;for(var o in t)0==(3&n++)&&(delete t[o],--e)}r=function(t){var e,i,r,n,o;cr.exec(t)&&(t=function(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}(t));if(pr.exec(t)){var s,a=t.length-1;s=a<=4?1:2;var h=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),i=parseInt(t.substr(1+1*s,s),16),r=parseInt(t.substr(1+2*s,s),16),n=h?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=
(e<<4)+e,i=(i<<4)+i,r=(r<<4)+r,h&&(n=(n<<4)+n)),o=[e,i,r,n/255]}else 0==t.indexOf("rgba(")?gr(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),gr(o)):Y(!1,14);return o}(i),t[i]=r,++e}return r}}();function _r(t){return Array.isArray(t)?t:fr(t)}function gr(t){return t[0]=kt(t[0]+.5|0,0,255),t[1]=kt(t[1]+.5|0,0,255),t[2]=kt(t[2]+.5|0,0,255),t[3]=kt(t[3],0,1),t}function yr(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);
var r=t[2];return r!=(0|r)&&(r=r+.5|0),"rgba("+e+","+i+","+r+","+(void 0===t[3]?1:t[3])+")"}var vr=function(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.checksum_=void 0};vr.prototype.clone=function(){var t=this.getColor();return new vr({color:Array.isArray(t)?t.slice():t||void 0})},vr.prototype.getColor=function(){return this.color_},vr.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},vr.prototype.getChecksum=function(){if(void 0===this.checksum_){var t=this.color_;
t?Array.isArray(t)||"string"==typeof t?this.checksum_="f"+dr(t):this.checksum_=o(this.color_):this.checksum_="f-"}return this.checksum_};var mr=vr,xr=function(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width,this.checksum_=void 0};xr.prototype.clone=function(){var t=this.getColor();return new xr({color:Array.isArray(t)?
t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},xr.prototype.getColor=function(){return this.color_},xr.prototype.getLineCap=function(){return this.lineCap_},xr.prototype.getLineDash=function(){return this.lineDash_},xr.prototype.getLineDashOffset=function(){return this.lineDashOffset_},xr.prototype.getLineJoin=function(){return this.lineJoin_},
xr.prototype.getMiterLimit=function(){return this.miterLimit_},xr.prototype.getWidth=function(){return this.width_},xr.prototype.setColor=function(t){this.color_=t,this.checksum_=void 0},xr.prototype.setLineCap=function(t){this.lineCap_=t,this.checksum_=void 0},xr.prototype.setLineDash=function(t){this.lineDash_=t,this.checksum_=void 0},xr.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t,this.checksum_=void 0},xr.prototype.setLineJoin=function(t){this.lineJoin_=t,this.checksum_=void 0},
xr.prototype.setMiterLimit=function(t){this.miterLimit_=t,this.checksum_=void 0},xr.prototype.setWidth=function(t){this.width_=t,this.checksum_=void 0},xr.prototype.getChecksum=function(){return void 0===this.checksum_&&(this.checksum_="s",this.color_?"string"==typeof this.color_?this.checksum_+=this.color_:this.checksum_+=o(this.color_):this.checksum_+="-",this.checksum_+=","+(void 0!==this.lineCap_?this.lineCap_.toString():"-")+","+(this.lineDash_?this.lineDash_.toString():"-")+","+(void 0!==this.lineDashOffset_?
this.lineDashOffset_:"-")+","+(void 0!==this.lineJoin_?this.lineJoin_:"-")+","+(void 0!==this.miterLimit_?this.miterLimit_.toString():"-")+","+(void 0!==this.width_?this.width_.toString():"-")),this.checksum_};var Er=xr,Sr="point",Tr="line",Cr=function(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new mr({color:"#333"}),
this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Sr,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding};Cr.prototype.clone=function(){return new Cr({font:this.getFont(),
placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?
this.getBackgroundStroke().clone():void 0})},Cr.prototype.getOverflow=function(){return this.overflow_},Cr.prototype.getFont=function(){return this.font_},Cr.prototype.getMaxAngle=function(){return this.maxAngle_},Cr.prototype.getPlacement=function(){return this.placement_},Cr.prototype.getOffsetX=function(){return this.offsetX_},Cr.prototype.getOffsetY=function(){return this.offsetY_},Cr.prototype.getFill=function(){return this.fill_},Cr.prototype.getRotateWithView=function(){return this.rotateWithView_},
Cr.prototype.getRotation=function(){return this.rotation_},Cr.prototype.getScale=function(){return this.scale_},Cr.prototype.getStroke=function(){return this.stroke_},Cr.prototype.getText=function(){return this.text_},Cr.prototype.getTextAlign=function(){return this.textAlign_},Cr.prototype.getTextBaseline=function(){return this.textBaseline_},Cr.prototype.getBackgroundFill=function(){return this.backgroundFill_},Cr.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},Cr.prototype.getPadding=
function(){return this.padding_},Cr.prototype.setOverflow=function(t){this.overflow_=t},Cr.prototype.setFont=function(t){this.font_=t},Cr.prototype.setMaxAngle=function(t){this.maxAngle_=t},Cr.prototype.setOffsetX=function(t){this.offsetX_=t},Cr.prototype.setOffsetY=function(t){this.offsetY_=t},Cr.prototype.setPlacement=function(t){this.placement_=t},Cr.prototype.setFill=function(t){this.fill_=t},Cr.prototype.setRotation=function(t){this.rotation_=t},Cr.prototype.setScale=function(t){this.scale_=
t},Cr.prototype.setStroke=function(t){this.stroke_=t},Cr.prototype.setText=function(t){this.text_=t},Cr.prototype.setTextAlign=function(t){this.textAlign_=t},Cr.prototype.setTextBaseline=function(t){this.textBaseline_=t},Cr.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},Cr.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},Cr.prototype.setPadding=function(t){this.padding_=t};var Rr=Cr,wr=new Er({color:"rgba(0,0,0,0.2)"}),Ir=[90,45,30,20,10,5,2,1,.5,.2,.1,.05,.01,
.005,.002,.001],Lr=function(t){var e=t||{};this.map_=null,this.postcomposeListenerKey_=null,this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxLatP_=1/0,this.maxLonP_=1/0,this.minLatP_=-1/0,this.minLonP_=-1/0,this.targetSize_=void 0!==e.targetSize?e.targetSize:100,this.maxLines_=void 0!==e.maxLines?e.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=void 0!==e.strokeStyle?e.strokeStyle:wr,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=
void 0,this.projectionCenterLonLat_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,1==e.showLabels&&(this.lonLabelFormatter_=void 0==e.lonLabelFormatter?qi.bind(this,"EW"):e.lonLabelFormatter,this.latLabelFormatter_=void 0==e.latLabelFormatter?qi.bind(this,"NS"):e.latLabelFormatter,this.lonLabelPosition_=void 0==e.lonLabelPosition?0:e.lonLabelPosition,this.latLabelPosition_=void 0==e.latLabelPosition?1:e.latLabelPosition,this.lonLabelStyle_=void 0!==e.lonLabelStyle?e.lonLabelStyle:new Rr({font:"12px Calibri,sans-serif",
textBaseline:"bottom",fill:new mr({color:"rgba(0,0,0,1)"}),stroke:new Er({color:"rgba(255,255,255,1)",width:3})}),this.latLabelStyle_=void 0!==e.latLabelStyle?e.latLabelStyle:new Rr({font:"12px Calibri,sans-serif",textAlign:"end",fill:new mr({color:"rgba(0,0,0,1)"}),stroke:new Er({color:"rgba(255,255,255,1)",width:3})}),this.meridiansLabels_=[],this.parallelsLabels_=[]),this.intervals_=void 0!==e.intervals?e.intervals:Ir,this.setMap(void 0!==e.map?e.map:null)};Lr.prototype.addMeridian_=function(t,
e,i,r,n,o){var s=this.getMeridian_(t,e,i,r,o);if(Pt(s.getExtent(),n)){if(this.meridiansLabels_){var a=this.getMeridianPoint_(s,n,o);this.meridiansLabels_[o]={geom:a,text:this.lonLabelFormatter_(t)}}this.meridians_[o++]=s}return o},Lr.prototype.getMeridianPoint_=function(t,e,i){var r,n=t.getFlatCoordinates(),o=Math.max(e[1],n[1]),s=Math.min(e[3],n[n.length-1]),a=kt(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,s),h=[n[0],a];return i in this.meridiansLabels_?(r=this.meridiansLabels_[i].geom).setCoordinates(h):
r=new ci(h),r},Lr.prototype.addParallel_=function(t,e,i,r,n,o){var s=this.getParallel_(t,e,i,r,o);if(Pt(s.getExtent(),n)){if(this.parallelsLabels_){var a=this.getParallelPoint_(s,n,o);this.parallelsLabels_[o]={geom:a,text:this.latLabelFormatter_(t)}}this.parallels_[o++]=s}return o},Lr.prototype.getParallelPoint_=function(t,e,i){var r,n=t.getFlatCoordinates(),o=Math.max(e[0],n[0]),s=Math.min(e[2],n[n.length-2]),a=[kt(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,s),n[1]];return i in this.parallelsLabels_?
(r=this.parallelsLabels_[i].geom).setCoordinates(a):r=new ci(a),r},Lr.prototype.createGraticule_=function(t,e,i,r){var n=this.getInterval_(i);if(-1==n)return this.meridians_.length=this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),void(this.parallelsLabels_&&(this.parallelsLabels_.length=0));var o,s,a,h,l=this.toLonLatTransform_(e),u=l[0],p=l[1],c=this.maxLines_,d=[Math.max(t[0],this.minLonP_),Math.max(t[1],this.minLatP_),Math.min(t[2],this.maxLonP_),Math.min(t[3],this.maxLatP_)],
f=(d=be(d,this.projection_,"EPSG:4326"))[3],_=d[2],g=d[1],y=d[0];for(h=kt(u=Math.floor(u/n)*n,this.minLon_,this.maxLon_),s=this.addMeridian_(h,g,f,r,t,0),o=0;h!=this.minLon_&&o++<c;)h=Math.max(h-n,this.minLon_),s=this.addMeridian_(h,g,f,r,t,s);for(h=kt(u,this.minLon_,this.maxLon_),o=0;h!=this.maxLon_&&o++<c;)h=Math.min(h+n,this.maxLon_),s=this.addMeridian_(h,g,f,r,t,s);for(this.meridians_.length=s,this.meridiansLabels_&&(this.meridiansLabels_.length=s),a=kt(p=Math.floor(p/n)*n,this.minLat_,this.maxLat_),
s=this.addParallel_(a,y,_,r,t,0),o=0;a!=this.minLat_&&o++<c;)a=Math.max(a-n,this.minLat_),s=this.addParallel_(a,y,_,r,t,s);for(a=kt(p,this.minLat_,this.maxLat_),o=0;a!=this.maxLat_&&o++<c;)a=Math.min(a+n,this.maxLat_),s=this.addParallel_(a,y,_,r,t,s);this.parallels_.length=s,this.parallelsLabels_&&(this.parallelsLabels_.length=s)},Lr.prototype.getInterval_=function(t){for(var e=this.projectionCenterLonLat_[0],i=this.projectionCenterLonLat_[1],r=-1,n=Math.pow(this.targetSize_*t,2),o=[],s=[],a=0,h=
this.intervals_.length;a<h;++a){var l=this.intervals_[a]/2;if(o[0]=e-l,o[1]=i-l,s[0]=e+l,s[1]=i+l,this.fromLonLatTransform_(o,o),this.fromLonLatTransform_(s,s),Math.pow(s[0]-o[0],2)+Math.pow(s[1]-o[1],2)<=n)break;r=this.intervals_[a]}return r},Lr.prototype.getMap=function(){return this.map_},Lr.prototype.getMeridian_=function(t,e,i,r,n){var o=function(t,e,i,r,n){return lr(function(r){return[t,e+(i-e)*r]},Oe(Ee("EPSG:4326"),r),n)}(t,e,i,this.projection_,r),s=this.meridians_[n];return s?(s.setFlatCoordinates(At.XY,
o),s.changed()):s=this.meridians_[n]=new hr(o,At.XY),s},Lr.prototype.getMeridians=function(){return this.meridians_},Lr.prototype.getParallel_=function(t,e,i,r,n){var o=function(t,e,i,r,n){return lr(function(r){return[e+(i-e)*r,t]},Oe(Ee("EPSG:4326"),r),n)}(t,e,i,this.projection_,r),s=this.parallels_[n];return s?(s.setFlatCoordinates(At.XY,o),s.changed()):s=new hr(o,At.XY),s},Lr.prototype.getParallels=function(){return this.parallels_},Lr.prototype.handlePostCompose_=function(t){var e,i,r,n,o=t.vectorContext,
s=t.frameState,a=s.extent,h=s.viewState,l=h.center,u=h.projection,p=h.resolution,c=s.pixelRatio,d=p*p/(4*c*c);for((!this.projection_||!Ie(this.projection_,u))&&this.updateProjectionInfo_(u),this.createGraticule_(a,l,p,d),o.setFillStrokeStyle(null,this.strokeStyle_),e=0,i=this.meridians_.length;e<i;++e)r=this.meridians_[e],o.drawGeometry(r);for(e=0,i=this.parallels_.length;e<i;++e)r=this.parallels_[e],o.drawGeometry(r);if(this.meridiansLabels_)for(e=0,i=this.meridiansLabels_.length;e<i;++e)n=this.meridiansLabels_[e],
this.lonLabelStyle_.setText(n.text),o.setTextStyle(this.lonLabelStyle_),o.drawGeometry(n.geom);if(this.parallelsLabels_)for(e=0,i=this.parallelsLabels_.length;e<i;++e)n=this.parallelsLabels_[e],this.latLabelStyle_.setText(n.text),o.setTextStyle(this.latLabelStyle_),o.drawGeometry(n.geom)},Lr.prototype.updateProjectionInfo_=function(t){var e=Ee("EPSG:4326"),i=t.getWorldExtent(),r=be(i,e,t);this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0],this.maxLatP_=r[3],this.maxLonP_=r[2],
this.minLatP_=r[1],this.minLonP_=r[0],this.fromLonLatTransform_=Oe(e,t),this.toLonLatTransform_=Oe(t,e),this.projectionCenterLonLat_=this.toLonLatTransform_(Tt(t.getExtent())),this.projection_=t},Lr.prototype.setMap=function(t){this.map_&&(E(this.postcomposeListenerKey_),this.postcomposeListenerKey_=null,this.map_.render()),t&&(this.postcomposeListenerKey_=v(t,ur.POSTCOMPOSE,this.handlePostCompose_,this),t.render()),this.map_=t};var Or=Lr,Pr=function(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=
i,this.points_=[],this.angle_=0,this.initialVelocity_=0};Pr.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},Pr.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},Pr.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;for(var i=e-3;i>0&&this.points_[i+2]>t;)i-=3;var r=this.points_[e+2]-this.points_[i+2];if(r<1E3/60)return!1;var n=this.points_[e]-this.points_[i],
o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,n),this.initialVelocity_=Math.sqrt(n*n+o*o)/r,this.initialVelocity_>this.minVelocity_},Pr.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},Pr.prototype.getAngle=function(){return this.angle_};var br=Pr,Mr=function(t){function e(e,i,r){t.call(this,e),this.map=i,this.frameState=void 0!==r?r:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e}(P),Fr=function(t){function e(e,i,r,n,o){t.call(this,e,i,o),this.originalEvent=r,this.pixel=i.getEventPixel(r),this.coordinate=i.getCoordinateFromPixel(this.pixel),this.dragging=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},
e}(Mr),Ar={SINGLECLICK:"singleclick",CLICK:M.CLICK,DBLCLICK:M.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Nr=function(t){function e(e,i,r,n,o){t.call(this,e,i,r.originalEvent,n,o),this.pointerEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fr),
Gr={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Dr=function(t,e){this.dispatcher=t,this.mapping_=e};Dr.prototype.getEvents=function(){return Object.keys(this.mapping_)},Dr.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var kr=Dr,jr=1,Ur="mouse";function Yr(t){if(!this.isEventSimulatedFromTouch_(t)){jr.toString()in
this.pointerMap&&this.cancel(t);var e=Wr(t,this.dispatcher);this.pointerMap[jr.toString()]=t,this.dispatcher.down(e,t)}}function Br(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);this.dispatcher.move(e,t)}}function Vr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=this.pointerMap[jr.toString()];if(e&&e.button===t.button){var i=Wr(t,this.dispatcher);this.dispatcher.up(i,t),this.cleanupMouse()}}}function Xr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);
this.dispatcher.enterOver(e,t)}}function zr(t){if(!this.isEventSimulatedFromTouch_(t)){var e=Wr(t,this.dispatcher);this.dispatcher.leaveOut(e,t)}}function Wr(t,e){var i=e.cloneEvent(t,t),r=i.preventDefault;return i.preventDefault=function(){t.preventDefault(),r()},i.pointerId=jr,i.isPrimary=!0,i.pointerType=Ur,i}var Kr=function(t){function e(e){var i={mousedown:Yr,mousemove:Br,mouseup:Vr,mouseover:Xr,mouseout:zr};t.call(this,e,i),this.pointerMap=e.pointerMap,this.lastTouches=[]}return t&&(e.__proto__=
t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isEventSimulatedFromTouch_=function(t){for(var e=this.lastTouches,i=t.clientX,r=t.clientY,n=0,o=e.length,s=void 0;n<o&&(s=e[n]);n++){var a=Math.abs(i-s[0]),h=Math.abs(r-s[1]);if(a<=25&&h<=25)return!0}return!1},e.prototype.cancel=function(t){var e=Wr(t,this.dispatcher);this.dispatcher.cancel(e,t),this.cleanupMouse()},e.prototype.cleanupMouse=function(){delete this.pointerMap[jr.toString()]},e}(kr),Hr=["","unavailable",
"touch","pen","mouse"];function Zr(t){this.pointerMap[t.pointerId.toString()]=t;var e=this.prepareEvent_(t);this.dispatcher.down(e,t)}function qr(t){var e=this.prepareEvent_(t);this.dispatcher.move(e,t)}function Jr(t){var e=this.prepareEvent_(t);this.dispatcher.up(e,t),this.cleanup(t.pointerId)}function Qr(t){var e=this.prepareEvent_(t);this.dispatcher.leaveOut(e,t)}function $r(t){var e=this.prepareEvent_(t);this.dispatcher.enterOver(e,t)}function tn(t){var e=this.prepareEvent_(t);this.dispatcher.cancel(e,
t),this.cleanup(t.pointerId)}function en(t){var e=this.dispatcher.makeEvent("lostpointercapture",t,t);this.dispatcher.dispatchEvent(e)}function rn(t){var e=this.dispatcher.makeEvent("gotpointercapture",t,t);this.dispatcher.dispatchEvent(e)}var nn=function(t){function e(e){var i={MSPointerDown:Zr,MSPointerMove:qr,MSPointerUp:Jr,MSPointerOut:Qr,MSPointerOver:$r,MSPointerCancel:tn,MSGotPointerCapture:rn,MSLostPointerCapture:en};t.call(this,e,i),this.pointerMap=e.pointerMap}return t&&(e.__proto__=t),
e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvent_=function(t){var e=t;return"number"==typeof t.pointerType&&((e=this.dispatcher.cloneEvent(t,t)).pointerType=Hr[t.pointerType]),e},e.prototype.cleanup=function(t){delete this.pointerMap[t.toString()]},e}(kr);function on(t){this.dispatcher.fireNativeEvent(t)}function sn(t){this.dispatcher.fireNativeEvent(t)}function an(t){this.dispatcher.fireNativeEvent(t)}function hn(t){this.dispatcher.fireNativeEvent(t)}function ln(t){this.dispatcher.fireNativeEvent(t)}
function un(t){this.dispatcher.fireNativeEvent(t)}function pn(t){this.dispatcher.fireNativeEvent(t)}function cn(t){this.dispatcher.fireNativeEvent(t)}var dn=function(t){function e(e){var i={pointerdown:on,pointermove:sn,pointerup:an,pointerout:hn,pointerover:ln,pointercancel:un,gotpointercapture:cn,lostpointercapture:pn};t.call(this,e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(kr),fn=!1,_n=function(t){function e(e,i,r){t.call(this,e),this.originalEvent=
i;var n=r||{};this.buttons=function(t){var e;if(t.buttons||fn)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}(n),this.pressure=function(t,e){var i=0;i=t.pressure?t.pressure:e?.5:0;return i}(n,this.buttons),this.bubbles="bubbles"in n&&n.bubbles,this.cancelable="cancelable"in n&&n.cancelable,this.view="view"in n?n.view:null,this.detail="detail"in n?n.detail:null,this.screenX="screenX"in n?n.screenX:0,this.screenY="screenY"in n?n.screenY:0,this.clientX=
"clientX"in n?n.clientX:0,this.clientY="clientY"in n?n.clientY:0,this.ctrlKey="ctrlKey"in n&&n.ctrlKey,this.altKey="altKey"in n&&n.altKey,this.shiftKey="shiftKey"in n&&n.shiftKey,this.metaKey="metaKey"in n&&n.metaKey,this.button="button"in n?n.button:0,this.relatedTarget="relatedTarget"in n?n.relatedTarget:null,this.pointerId="pointerId"in n?n.pointerId:0,this.width="width"in n?n.width:0,this.height="height"in n?n.height:0,this.tiltX="tiltX"in n?n.tiltX:0,this.tiltY="tiltY"in n?n.tiltY:0,this.pointerType=
"pointerType"in n?n.pointerType:"",this.hwTimestamp="hwTimestamp"in n?n.hwTimestamp:0,this.isPrimary="isPrimary"in n&&n.isPrimary,i.preventDefault&&(this.preventDefault=function(){i.preventDefault()})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);!function(){try{var t=new MouseEvent("click",{buttons:1});fn=1===t.buttons}catch(t){}}();var gn=_n;function yn(t){this.vacuumTouches_(t),this.setPrimaryTouch_(t.changedTouches[0]),this.dedupSynthMouse_(t),
this.clickCount_++,this.processTouches_(t,this.overDown_)}function vn(t){this.processTouches_(t,this.moveOverOut_)}function mn(t){this.dedupSynthMouse_(t),this.processTouches_(t,this.upOut_)}function xn(t){this.processTouches_(t,this.cancelOut_)}var En=function(t){function e(e,i){var r={touchstart:yn,touchmove:vn,touchend:mn,touchcancel:xn};t.call(this,e,r),this.pointerMap=e.pointerMap,this.mouseSource=i,this.firstTouchId_=void 0,this.clickCount_=0,this.resetId_,this.dedupTimeout_=2500}return t&&
(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isPrimaryTouch_=function(t){return this.firstTouchId_===t.identifier},e.prototype.setPrimaryTouch_=function(t){var e=Object.keys(this.pointerMap).length;(0===e||1===e&&jr.toString()in this.pointerMap)&&(this.firstTouchId_=t.identifier,this.cancelResetClickCount_())},e.prototype.removePrimaryPointer_=function(t){t.isPrimary&&(this.firstTouchId_=void 0,this.resetClickCount_())},e.prototype.resetClickCount_=
function(){this.resetId_=setTimeout(this.resetClickCountHandler_.bind(this),200)},e.prototype.resetClickCountHandler_=function(){this.clickCount_=0,this.resetId_=void 0},e.prototype.cancelResetClickCount_=function(){void 0!==this.resetId_&&clearTimeout(this.resetId_)},e.prototype.touchToPointer_=function(t,e){var i=this.dispatcher.cloneEvent(t,e);return i.pointerId=e.identifier+2,i.bubbles=!0,i.cancelable=!0,i.detail=this.clickCount_,i.button=0,i.buttons=1,i.width=e.radiusX||0,i.height=e.radiusY||
0,i.pressure=e.force||.5,i.isPrimary=this.isPrimaryTouch_(e),i.pointerType="touch",i.clientX=e.clientX,i.clientY=e.clientY,i.screenX=e.screenX,i.screenY=e.screenY,i},e.prototype.processTouches_=function(t,e){var i=Array.prototype.slice.call(t.changedTouches),r=i.length;function n(){t.preventDefault()}for(var o=0;o<r;++o){var s=this.touchToPointer_(t,i[o]);s.preventDefault=n,e.call(this,t,s)}},e.prototype.findTouch_=function(t,e){for(var i=t.length,r=0;r<i;r++)if(t[r].identifier===e)return!0;return!1},
e.prototype.vacuumTouches_=function(t){var e=t.touches,i=Object.keys(this.pointerMap),r=i.length;if(r>=e.length){for(var n=[],o=0;o<r;++o){var s=Number(i[o]),a=this.pointerMap[s];s==jr||this.findTouch_(e,s-2)||n.push(a.out)}for(var h=0;h<n.length;++h)this.cancelOut_(t,n[h])}},e.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)},e.prototype.moveOverOut_=function(t,
e){var i=e,r=this.pointerMap[i.pointerId];if(r){var n=r.out,o=r.outTarget;this.dispatcher.move(i,t),n&&o!==i.target&&(n.relatedTarget=i.target,i.relatedTarget=o,n.target=o,i.target?(this.dispatcher.leaveOut(n,t),this.dispatcher.enterOver(i,t)):(i.target=o,i.relatedTarget=null,this.cancelOut_(t,i))),r.out=i,r.outTarget=i.target}},e.prototype.upOut_=function(t,e){this.dispatcher.up(e,t),this.dispatcher.out(e,t),this.dispatcher.leave(e,t),this.cleanUpPointer_(e)},e.prototype.cancelOut_=function(t,e){this.dispatcher.cancel(e,
t),this.dispatcher.out(e,t),this.dispatcher.leave(e,t),this.cleanUpPointer_(e)},e.prototype.cleanUpPointer_=function(t){delete this.pointerMap[t.pointerId],this.removePrimaryPointer_(t)},e.prototype.dedupSynthMouse_=function(t){var e=this.mouseSource.lastTouches,i=t.changedTouches[0];if(this.isPrimaryTouch_(i)){var r=[i.clientX,i.clientY];e.push(r),setTimeout(function(){!function(t,e){var i=t.indexOf(e),r=i>-1;r&&t.splice(i,1)}(e,r)},this.dedupTimeout_)}},e}(kr),Sn=[["bubbles",!1],["cancelable",!1],
["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",!1],["altKey",!1],["shiftKey",!1],["metaKey",!1],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",!1],["type",""],["target",null],["currentTarget",null],["which",0]],Tn=function(t){function e(e){t.call(this),this.element_=e,this.pointerMap={},this.eventMap_={},this.eventSourceList_=
[],this.registerSources()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.registerSources=function(){if(Yi)this.registerSource("native",new dn(this));else if(Bi)this.registerSource("ms",new nn(this));else{var t=new Kr(this);this.registerSource("mouse",t),Ui&&this.registerSource("touch",new En(this,t))}this.register_()},e.prototype.registerSource=function(t,e){var i=e,r=i.getEvents();r&&(r.forEach(function(t){var e=i.getHandlerForEvent(t);e&&
(this.eventMap_[t]=e.bind(i))}.bind(this)),this.eventSourceList_.push(i))},e.prototype.register_=function(){for(var t=this.eventSourceList_.length,e=0;e<t;e++){var i=this.eventSourceList_[e];this.addEvents_(i.getEvents())}},e.prototype.unregister_=function(){for(var t=this.eventSourceList_.length,e=0;e<t;e++){var i=this.eventSourceList_[e];this.removeEvents_(i.getEvents())}},e.prototype.eventHandler_=function(t){var e=t.type,i=this.eventMap_[e];i&&i(t)},e.prototype.addEvents_=function(t){t.forEach(function(t){v(this.element_,
t,this.eventHandler_,this)}.bind(this))},e.prototype.removeEvents_=function(t){t.forEach(function(t){x(this.element_,t,this.eventHandler_,this)}.bind(this))},e.prototype.cloneEvent=function(t,e){for(var i={},r=0,n=Sn.length;r<n;r++){var o=Sn[r][0];i[o]=t[o]||e[o]||Sn[r][1]}return i},e.prototype.down=function(t,e){this.fireEvent(Gr.POINTERDOWN,t,e)},e.prototype.move=function(t,e){this.fireEvent(Gr.POINTERMOVE,t,e)},e.prototype.up=function(t,e){this.fireEvent(Gr.POINTERUP,t,e)},e.prototype.enter=function(t,
e){t.bubbles=!1,this.fireEvent(Gr.POINTERENTER,t,e)},e.prototype.leave=function(t,e){t.bubbles=!1,this.fireEvent(Gr.POINTERLEAVE,t,e)},e.prototype.over=function(t,e){t.bubbles=!0,this.fireEvent(Gr.POINTEROVER,t,e)},e.prototype.out=function(t,e){t.bubbles=!0,this.fireEvent(Gr.POINTEROUT,t,e)},e.prototype.cancel=function(t,e){this.fireEvent(Gr.POINTERCANCEL,t,e)},e.prototype.leaveOut=function(t,e){this.out(t,e),this.contains_(t.target,t.relatedTarget)||this.leave(t,e)},e.prototype.enterOver=function(t,
e){this.over(t,e),this.contains_(t.target,t.relatedTarget)||this.enter(t,e)},e.prototype.contains_=function(t,e){return!(!t||!e)&&t.contains(e)},e.prototype.makeEvent=function(t,e,i){return new gn(t,i,e)},e.prototype.fireEvent=function(t,e,i){var r=this.makeEvent(t,e,i);this.dispatchEvent(r)},e.prototype.fireNativeEvent=function(t){var e=this.makeEvent(t.type,t,t);this.dispatchEvent(e)},e.prototype.wrapMouseEvent=function(t,e){return this.makeEvent(t,Wr(e,this),e)},e.prototype.disposeInternal=function(){this.unregister_(),
t.prototype.disposeInternal.call(this)},e}(b),Cn=function(t){function e(e,i){t.call(this),this.map_=e,this.clickTimeoutId_,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=i?i*Di:Di,this.down_=null;var r=this.map_.getViewport();this.activePointers_=0,this.trackedTouches_={},this.pointerEventHandler_=new Tn(r),this.documentPointerEventHandler_=null,this.pointerdownListenerKey_=v(this.pointerEventHandler_,Gr.POINTERDOWN,this.handlePointerDown_,this),this.relayedListenerKey_=v(this.pointerEventHandler_,
Gr.POINTERMOVE,this.relayEvent_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.emulateClick_=function(t){var e=new Nr(Ar.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Nr(Ar.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;var e=new Nr(Ar.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),
250)},e.prototype.updateActivePointers_=function(t){var e=t;e.type==Ar.POINTERUP||e.type==Ar.POINTERCANCEL?delete this.trackedTouches_[e.pointerId]:e.type==Ar.POINTERDOWN&&(this.trackedTouches_[e.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},e.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new Nr(Ar.POINTERUP,this.map_,t);this.dispatchEvent(e),e.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),
0===this.activePointers_&&(this.dragListenerKeys_.forEach(E),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null,this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null)},e.prototype.isMouseActionButton_=function(t){return 0===t.button},e.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new Nr(Ar.POINTERDOWN,this.map_,t);this.dispatchEvent(e),this.down_=t,0===this.dragListenerKeys_.length&&(this.documentPointerEventHandler_=new Tn(document),
this.dragListenerKeys_.push(v(this.documentPointerEventHandler_,Ar.POINTERMOVE,this.handlePointerMove_,this),v(this.documentPointerEventHandler_,Ar.POINTERUP,this.handlePointerUp_,this),v(this.pointerEventHandler_,Ar.POINTERCANCEL,this.handlePointerUp_,this)))},e.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var e=new Nr(Ar.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}t.preventDefault()},e.prototype.relayEvent_=function(t){var e=!(!this.down_||!this.isMoving_(t));
this.dispatchEvent(new Nr(t.type,this.map_,t,e))},e.prototype.isMoving_=function(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(E(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(E(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(E),this.dragListenerKeys_.length=
0,this.documentPointerEventHandler_&&(this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null),this.pointerEventHandler_&&(this.pointerEventHandler_.dispose(),this.pointerEventHandler_=null),t.prototype.disposeInternal.call(this)},e}(b),Rn="postrender",wn="movestart",In="moveend",Ln={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},On={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4,ABORT:5},Pn=function(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=
[],this.priorities_=[],this.queuedElements_={}};Pn.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,p(this.queuedElements_)},Pn.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var r=this.keyFunction_(i);return delete this.queuedElements_[r],i},Pn.prototype.enqueue=function(t){Y(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=
1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},Pn.prototype.getCount=function(){return this.elements_.length},Pn.prototype.getLeftChildIndex_=function(t){return 2*t+1},Pn.prototype.getRightChildIndex_=function(t){return 2*t+2},Pn.prototype.getParentIndex_=function(t){return t-1>>1},Pn.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},Pn.prototype.isEmpty=
function(){return 0===this.elements_.length},Pn.prototype.isKeyQueued=function(t){return t in this.queuedElements_},Pn.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},Pn.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,r=e.length,n=e[t],o=i[t],s=t;t<r>>1;){var a=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=h<r&&i[h]<i[a]?h:a;e[t]=e[l],i[t]=i[l],t=l}e[t]=n,i[t]=o,this.siftDown_(s,t)},Pn.prototype.siftDown_=function(t,e){for(var i=
this.elements_,r=this.priorities_,n=i[e],o=r[e];e>t;){var s=this.getParentIndex_(e);if(!(r[s]>o))break;i[e]=i[s],r[e]=r[s],e=s}i[e]=n,r[e]=o},Pn.prototype.reprioritize=function(){var t,e,i,r=this.priorityFunction_,n=this.elements_,o=this.priorities_,s=0,a=n.length;for(e=0;e<a;++e)(i=r(t=n[e]))==1/0?delete this.queuedElements_[this.keyFunction_(t)]:(o[s]=i,n[s++]=t);n.length=s,o.length=s,this.heapify_()};var bn=Pn,Mn=function(t){function e(e,i){t.call(this,function(t){return e.apply(null,t)},function(t){return t[0].getKey()}),
this.tileChangeCallback_=i,this.tilesLoading_=0,this.tilesLoadingKeys_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.enqueue=function(e){var i=t.prototype.enqueue.call(this,e);i&&v(e[0],M.CHANGE,this.handleTileChange,this);return i},e.prototype.getTilesLoading=function(){return this.tilesLoading_},e.prototype.handleTileChange=function(t){var e=t.target,i=e.getState();if(i===On.LOADED||i===On.ERROR||i===On.EMPTY||i===On.ABORT){x(e,M.CHANGE,
this.handleTileChange,this);var r=e.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}},e.prototype.loadMoreTiles=function(t,e){for(var i,r,n,o=0,s=!1;this.tilesLoading_<t&&o<e&&this.getCount()>0;)n=(r=this.dequeue()[0]).getKey(),(i=r.getState())===On.ABORT?s=!0:i!==On.IDLE||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++o,r.load());0===o&&s&&this.tileChangeCallback_()},e}(bn),Fn=42,An=256;function Nn(t){return t}
function Gn(t,e){return void 0!==t?0:void 0}function Dn(t,e){return void 0!==t?t+e:void 0}var kn=0,jn=1,Un="center",Yn="resolution",Bn="rotation";function Vn(t){return Math.pow(t,3)}function Xn(t){return 1-Vn(1-t)}function zn(t){return 3*t*t-2*t*t*t}function Wn(t){return t}var Kn=0;function Hn(t,e){setTimeout(function(){t(e)},0)}function Zn(t){return!(t.sourceCenter&&t.targetCenter&&!Qi(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}
var qn=function(t){function e(e){t.call(this);var i=u({},e);this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.updateAnimations_=this.updateAnimations_.bind(this),this.projection_=Ce(i.projection,"EPSG:3857"),this.applyOptions_(i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyOptions_=function(t){var e={};e[Un]=void 0!==t.center?t.center:null;var i=function(t){var e,i,r,n=void 0!==t.minZoom?t.minZoom:Kn,o=void 0!==t.maxZoom?
t.maxZoom:28,s=void 0!==t.zoomFactor?t.zoomFactor:2;if(void 0!==t.resolutions){var a=t.resolutions;i=a[n],r=void 0!==a[o]?a[o]:a[a.length-1],e=function(t){return function(e,i,r){if(void 0!==e){var n=z(t,e,r);n=kt(n+i,0,t.length-1);var o=Math.floor(n);if(n!=o&&o<t.length-1){var s=t[o]/t[o+1];return t[o]/Math.pow(s,n-o)}return t[o]}}}(a)}else{var h=Ce(t.projection,"EPSG:3857"),l=h.getExtent(),u=l?Math.max(Ot(l),Rt(l)):360*Qt[$t.DEGREES]/h.getMetersPerUnit(),p=u/An/Math.pow(2,Kn),c=p/Math.pow(2,28-Kn);
void 0!==(i=t.maxResolution)?n=0:i=p/Math.pow(s,n),void 0===(r=t.minResolution)&&(r=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(s,o):p/Math.pow(s,o):c),o=n+Math.floor(Math.log(i/r)/Math.log(s)),r=i/Math.pow(s,o-n),e=function(t,e,i){return function(r,n,o){if(void 0!==r){var s=-o/2+.5,a=Math.floor(Math.log(e/r)/Math.log(t)+s),h=Math.max(a+n,0);return void 0!==i&&(h=Math.min(h,i)),e/Math.pow(t,h)}}}(s,i,o-n)}return{constraint:e,maxResolution:i,minResolution:r,minZoom:n,zoomFactor:s}}(t);this.maxResolution_=
i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.minZoom_=i.minZoom;var r=function(t){return void 0!==t.extent?function(t){return function(e){return e?[kt(e[0],t[0],t[2]),kt(e[1],t[1],t[3])]:void 0}}(t.extent):Nn}(t),n=i.constraint,o=function(t){if(void 0===t.enableRotation||t.enableRotation){var e=t.constrainRotation;return void 0===e||!0===e?function(t){var e=t||Vt(5);return function(t,i){return void 0!==t?Math.abs(t+i)<=e?0:
t+i:void 0}}():!1===e?Dn:"number"==typeof e?function(t){var e=2*Math.PI/t;return function(t,i){return void 0!==t?t=Math.floor((t+i)/e+.5)*e:void 0}}(e):Dn}return Gn}(t);this.constraints_={center:r,resolution:n,rotation:o},void 0!==t.resolution?e[Yn]=t.resolution:void 0!==t.zoom&&(e[Yn]=this.constrainResolution(this.maxResolution_,t.zoom-this.minZoom_),this.resolutions_&&(e[Yn]=kt(Number(this.getResolution()||e[Yn]),this.minResolution_,this.maxResolution_))),e[Bn]=void 0!==t.rotation?t.rotation:0,
this.setProperties(e),this.options_=t},e.prototype.getUpdatedOptions_=function(t){var e=u({},this.options_);return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenter(),e.rotation=this.getRotation(),u({},e,t)},e.prototype.animate=function(t){var e,i=arguments,r=arguments.length;if(r>1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenter(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),
void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&Hn(e,!0))}for(var o=Date.now(),s=this.getCenter().slice(),a=this.getResolution(),h=this.getRotation(),l=[],u=0;u<r;++u){var p=i[u],c={start:o,complete:!1,anchor:p.anchor,duration:void 0!==p.duration?p.duration:1E3,easing:p.easing||zn};if(p.center&&(c.sourceCenter=s,c.targetCenter=p.center,s=c.targetCenter),void 0!==p.zoom?(c.sourceResolution=a,c.targetResolution=this.constrainResolution(this.maxResolution_,p.zoom-this.minZoom_,0),a=c.targetResolution):
p.resolution&&(c.sourceResolution=a,c.targetResolution=p.resolution,a=c.targetResolution),void 0!==p.rotation){c.sourceRotation=h;var d=Xt(p.rotation-h+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=h+d,h=c.targetRotation}c.callback=e,Zn(c)?c.complete=!0:o+=c.duration,l.push(c)}this.animations_.push(l),this.setHint(kn,1),this.updateAnimations_()},e.prototype.getAnimating=function(){return this.hints_[kn]>0},e.prototype.getInteracting=function(){return this.hints_[jn]>0},e.prototype.cancelAnimations=
function(){this.setHint(kn,-this.hints_[kn]);for(var t=0,e=this.animations_.length;t<e;++t){var i=this.animations_[t];i[0].callback&&Hn(i[0].callback,!1)}this.animations_.length=0},e.prototype.updateAnimations_=function(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),this.getAnimating()){for(var t=Date.now(),e=!1,i=this.animations_.length-1;i>=0;--i){for(var r=this.animations_[i],n=!0,o=0,s=r.length;o<s;++o){var a=r[o];if(!a.complete){var h=
t-a.start,l=a.duration>0?h/a.duration:1;l>=1?(a.complete=!0,l=1):n=!1;var u=a.easing(l);if(a.sourceCenter){var p=a.sourceCenter[0],c=a.sourceCenter[1],d=p+u*(a.targetCenter[0]-p),f=c+u*(a.targetCenter[1]-c);this.set(Un,[d,f])}if(a.sourceResolution&&a.targetResolution){var _=1===u?a.targetResolution:a.sourceResolution+u*(a.targetResolution-a.sourceResolution);a.anchor&&this.set(Un,this.calculateCenterZoom(_,a.anchor)),this.set(Yn,_)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var g=1===
u?Xt(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+u*(a.targetRotation-a.sourceRotation);a.anchor&&this.set(Un,this.calculateCenterRotate(g,a.anchor)),this.set(Bn,g)}if(e=!0,!a.complete)break}}if(n){this.animations_[i]=null,this.setHint(kn,-1);var y=r[0].callback;y&&Hn(y,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_))}},e.prototype.calculateCenterRotate=function(t,e){var i,
r=this.getCenter();return void 0!==r&&($i(i=[r[0]-e[0],r[1]-e[1]],t-this.getRotation()),Hi(i,e)),i},e.prototype.calculateCenterZoom=function(t,e){var i,r=this.getCenter(),n=this.getResolution();void 0!==r&&void 0!==n&&(i=[e[0]-t*(e[0]-r[0])/n,e[1]-t*(e[1]-r[1])/n]);return i},e.prototype.getSizeFromViewport_=function(){var t=[100,100],e='.ol-viewport[data-view\x3d"'+o(this)+'"]',i=document.querySelector(e);if(i){var r=getComputedStyle(i);t[0]=parseInt(r.width,10),t[1]=parseInt(r.height,10)}return t},
e.prototype.constrainCenter=function(t){return this.constraints_.center(t)},e.prototype.constrainResolution=function(t,e,i){var r=e||0,n=i||0;return this.constraints_.resolution(t,r,n)},e.prototype.constrainRotation=function(t,e){var i=e||0;return this.constraints_.rotation(t,i)},e.prototype.getCenter=function(){return this.get(Un)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},
e.prototype.calculateExtent=function(t){var e=t||this.getSizeFromViewport_(),i=this.getCenter();Y(i,1);var r=this.getResolution();Y(void 0!==r,2);var n=this.getRotation();return Y(void 0!==n,3),Ct(i,r,n,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},
e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(Yn)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){var i=e||this.getSizeFromViewport_(),r=Ot(t)/i[0],n=Rt(t)/i[1];return Math.max(r,n)},e.prototype.getResolutionForValueFunction=
function(t){var e=t||2,i=this.maxResolution_,r=this.minResolution_,n=Math.log(i/r)/Math.log(e);return function(t){return i/Math.pow(e,t*n)}},e.prototype.getRotation=function(){return this.get(Bn)},e.prototype.getValueForResolutionFunction=function(t){var e=t||2,i=this.maxResolution_,r=this.minResolution_,n=Math.log(i/r)/Math.log(e);return function(t){return Math.log(i/t)/Math.log(e)/n}},e.prototype.getState=function(t){var e=this.getCenter(),i=this.getProjection(),r=this.getResolution(),n=r/t,o=this.getRotation();
return{center:[Math.round(e[0]/n)*n,Math.round(e[1]/n)*n],projection:void 0!==i?i:null,resolution:r,rotation:o,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,r=this.minZoom_||0;if(this.resolutions_){var n=z(this.resolutions_,t,1);r=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;
return r+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){return this.constrainResolution(this.maxResolution_,t-this.minZoom_,0)},e.prototype.fit=function(t,e){var i,r=e||{},n=r.size;n||(n=this.getSizeFromViewport_()),Y(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)?(Y(!bt(t),25),i=Oi(t)):t.getType()===Nt.CIRCLE?(i=Oi(t=t.getExtent())).rotate(this.getRotation(),Tt(t)):i=t;var o,s=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0===r.constrainResolution||
r.constrainResolution,h=void 0!==r.nearest&&r.nearest;o=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.constrainResolution(this.maxResolution_,r.maxZoom-this.minZoom_,0):0;for(var l=i.getFlatCoordinates(),u=this.getRotation(),p=Math.cos(-u),c=Math.sin(-u),d=1/0,f=1/0,_=-1/0,g=-1/0,y=i.getStride(),v=0,m=l.length;v<m;v+=y){var x=l[v]*p-l[v+1]*c,E=l[v]*c+l[v+1]*p;d=Math.min(d,x),f=Math.min(f,E),_=Math.max(_,x),g=Math.max(g,E)}var S=this.getResolutionForExtent([d,f,_,g],[n[0]-s[1]-s[3],
n[1]-s[0]-s[2]]);if(S=isNaN(S)?o:Math.max(S,o),a){var T=this.constrainResolution(S,0,0);!h&&T<S&&(T=this.constrainResolution(T,-1,0)),S=T}c=-c;var C=(d+_)/2,R=(f+g)/2,w=[(C+=(s[1]-s[3])/2*S)*p-(R+=(s[0]-s[2])/2*S)*c,R*p+C*c],L=r.callback?r.callback:I;void 0!==r.duration?this.animate({resolution:S,center:w,duration:r.duration,easing:r.easing},L):(this.setResolution(S),this.setCenter(w),Hn(L,!0))},e.prototype.centerOn=function(t,e,i){var r=this.getRotation(),n=Math.cos(-r),o=Math.sin(-r),s=t[0]*n-t[1]*
o,a=t[1]*n+t[0]*o,h=this.getResolution(),l=(s+=(e[0]/2-i[0])*h)*n-(a+=(i[1]-e[1]/2)*h)*(o=-o),u=a*n+s*o;this.setCenter([l,u])},e.prototype.isDef=function(){return!!this.getCenter()&&void 0!==this.getResolution()},e.prototype.rotate=function(t,e){if(void 0!==e){var i=this.calculateCenterRotate(t,e);this.setCenter(i)}this.setRotation(t)},e.prototype.setCenter=function(t){this.set(Un,t),this.getAnimating()&&this.cancelAnimations()},e.prototype.setHint=function(t,e){return this.hints_[t]+=e,this.changed(),
this.hints_[t]},e.prototype.setResolution=function(t){this.set(Yn,t),this.getAnimating()&&this.cancelAnimations()},e.prototype.setRotation=function(t){this.set(Bn,t),this.getAnimating()&&this.cancelAnimations()},e.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))},e}(D);function Jn(t,e){var i=document.createElement("canvas");return t&&(i.width=t),e&&(i.height=e),i.getContext("2d")}function Qn(t,e){var i=e.parentNode;i&&i.replaceChild(t,e)}function $n(t){return t&&t.parentNode?
t.parentNode.removeChild(t):null}function to(t){for(;t.lastChild;)t.removeChild(t.lastChild)}var eo={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",SOURCE:"source"},io=function(t){function e(e){t.call(this);var i=u({},e);i[eo.OPACITY]=void 0!==e.opacity?e.opacity:1,i[eo.VISIBLE]=void 0===e.visible||e.visible,i[eo.Z_INDEX]=e.zIndex,i[eo.MAX_RESOLUTION]=void 0!==e.maxResolution?e.maxResolution:1/0,i[eo.MIN_RESOLUTION]=
void 0!==e.minResolution?e.minResolution:0,this.setProperties(i),this.state_=null,this.type}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getType=function(){return this.type},e.prototype.getLayerState=function(){var t=this.state_||{layer:this,managed:!0};return t.opacity=kt(this.getOpacity(),0,1),t.sourceState=this.getSourceState(),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=this.getZIndex()||0,t.maxResolution=this.getMaxResolution(),
t.minResolution=Math.max(this.getMinResolution(),0),this.state_=t,t},e.prototype.getLayersArray=function(t){return r()},e.prototype.getLayerStatesArray=function(t){return r()},e.prototype.getExtent=function(){return this.get(eo.EXTENT)},e.prototype.getMaxResolution=function(){return this.get(eo.MAX_RESOLUTION)},e.prototype.getMinResolution=function(){return this.get(eo.MIN_RESOLUTION)},e.prototype.getOpacity=function(){return this.get(eo.OPACITY)},e.prototype.getSourceState=function(){return r()},
e.prototype.getVisible=function(){return this.get(eo.VISIBLE)},e.prototype.getZIndex=function(){return this.get(eo.Z_INDEX)},e.prototype.setExtent=function(t){this.set(eo.EXTENT,t)},e.prototype.setMaxResolution=function(t){this.set(eo.MAX_RESOLUTION,t)},e.prototype.setMinResolution=function(t){this.set(eo.MIN_RESOLUTION,t)},e.prototype.setOpacity=function(t){this.set(eo.OPACITY,t)},e.prototype.setVisible=function(t){this.set(eo.VISIBLE,t)},e.prototype.setZIndex=function(t){this.set(eo.Z_INDEX,t)},
e}(D),ro={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"},no={LAYERS:"layers"},oo=function(t){function e(e){var i=e||{},r=u({},i);delete r.layers;var n=i.layers;t.call(this,r),this.layersListenerKeys_=[],this.listenerKeys_={},v(this,G(no.LAYERS),this.handleLayersChanged_,this),n?Array.isArray(n)?n=new U(n.slice(),{unique:!0}):Y("function"==typeof n.getArray,43):n=new U(void 0,{unique:!0}),this.setLayers(n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(E),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(v(t,h.ADD,this.handleLayersAdd_,this),v(t,h.REMOVE,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(E);p(this.listenerKeys_);for(var i=t.getArray(),r=0,n=i.length;r<n;r++){var s=i[r];this.listenerKeys_[o(s)]=[v(s,l,this.handleLayerChange_,
this),v(s,M.CHANGE,this.handleLayerChange_,this)]}this.changed()},e.prototype.handleLayersAdd_=function(t){var e=t.element;this.listenerKeys_[o(e)]=[v(e,l,this.handleLayerChange_,this),v(e,M.CHANGE,this.handleLayerChange_,this)],this.changed()},e.prototype.handleLayersRemove_=function(t){var e=o(t.element);this.listenerKeys_[e].forEach(E),delete this.listenerKeys_[e],this.changed()},e.prototype.getLayers=function(){return this.get(no.LAYERS)},e.prototype.setLayers=function(t){this.set(no.LAYERS,t)},
e.prototype.getLayersArray=function(t){var e=void 0!==t?t:[];return this.getLayers().forEach(function(t){t.getLayersArray(e)}),e},e.prototype.getLayerStatesArray=function(t){var e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});for(var r=this.getLayerState(),n=i,o=e.length;n<o;n++){var 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),
void 0!==r.extent&&(void 0!==s.extent?s.extent=wt(s.extent,r.extent):s.extent=r.extent)}return e},e.prototype.getSourceState=function(){return ro.READY},e}(io);function so(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i}function ao(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function ho(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:e[0]=e[1]=t,e)}var lo=function(t){function e(e){t.call(this);var i=function(t){var e=null;void 0!==t.keyboardEventTarget&&
(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var i,r,n,o={},s=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new oo({layers:t.layers});o[Ln.LAYERGROUP]=s,o[Ln.TARGET]=t.target,o[Ln.VIEW]=void 0!==t.view?t.view:new qn,void 0!==t.controls&&(Array.isArray(t.controls)?i=new U(t.controls.slice()):(Y("function"==typeof t.controls.getArray,47),i=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new U(t.interactions.slice()):
(Y("function"==typeof t.interactions.getArray,48),r=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?n=new U(t.overlays.slice()):(Y("function"==typeof t.overlays.getArray,49),n=t.overlays):n=new U;return{controls:i,interactions:r,keyboardEventTarget:e,overlays:n,values:o}}(e);this.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,this.loadTilesWhileAnimating_=void 0!==e.loadTilesWhileAnimating&&e.loadTilesWhileAnimating,this.loadTilesWhileInteracting_=void 0!==e.loadTilesWhileInteracting&&
e.loadTilesWhileInteracting,this.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Di,this.animationDelayKey_,this.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_.call(this,Date.now())}.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],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"+(Ui?" 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";for(var r=[M.CLICK,M.DBLCLICK,M.MOUSEDOWN,M.TOUCHSTART,M.MSPOINTERDOWN,Ar.POINTERDOWN,M.MOUSEWHEEL,M.WHEEL],n=0,o=r.length;n<o;++n)v(this.overlayContainerStopEvent_,r[n],O);for(var s in this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=new Cn(this,e.moveTolerance),Ar)v(this.mapBrowserEventHandler_,Ar[s],this.handleMapBrowserEvent,this);this.keyboardEventTarget_=
i.keyboardEventTarget,this.keyHandlerKeys_=null,v(this.viewport_,M.CONTEXTMENU,this.handleBrowserEvent,this),v(this.viewport_,M.WHEEL,this.handleBrowserEvent,this),v(this.viewport_,M.MOUSEWHEEL,this.handleBrowserEvent,this),this.controls=i.controls||new U,this.interactions=i.interactions||new U,this.overlays_=i.overlays,this.overlayIdIndex_={},this.renderer_=this.createRenderer(),this.handleResize_,this.focus_=null,this.postRenderFunctions_=[],this.tileQueue_=new Mn(this.getTilePriority.bind(this),
this.handleTileChange_.bind(this)),this.skippedFeatureUids_={},v(this,G(Ln.LAYERGROUP),this.handleLayerGroupChanged_,this),v(this,G(Ln.VIEW),this.handleViewChanged_,this),v(this,G(Ln.SIZE),this.handleSizeChanged_,this),v(this,G(Ln.TARGET),this.handleTargetChanged_,this),this.setProperties(i.values),this.controls.forEach(function(t){t.setMap(this)}.bind(this)),v(this.controls,h.ADD,function(t){t.element.setMap(this)},this),v(this.controls,h.REMOVE,function(t){t.element.setMap(null)},this),this.interactions.forEach(function(t){t.setMap(this)}.bind(this)),
v(this.interactions,h.ADD,function(t){t.element.setMap(this)},this),v(this.interactions,h.REMOVE,function(t){t.element.setMap(null)},this),this.overlays_.forEach(this.addOverlayInternal_.bind(this)),v(this.overlays_,h.ADD,function(t){this.addOverlayInternal_(t.element)},this),v(this.overlays_,h.REMOVE,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)},this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method");},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},
e.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose(),x(this.viewport_,M.CONTEXTMENU,this.handleBrowserEvent,this),x(this.viewport_,M.WHEEL,this.handleBrowserEvent,this),x(this.viewport_,M.MOUSEWHEEL,this.handleBrowserEvent,this),void 0!==this.handleResize_&&(removeEventListener(M.RESIZE,this.handleResize_,!1),this.handleResize_=void 0),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0),this.setTarget(null),t.prototype.disposeInternal.call(this)},
e.prototype.forEachFeatureAtPixel=function(t,e,i){if(this.frameState_){var r=this.getCoordinateFromPixel(t),n=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,o=void 0!==i.layerFilter?i.layerFilter:R;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,n,e,null,o,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var i=null;return this.forEachFeatureAtPixel(t,function(t){i||(i=[]),i.push(t)},e),i},e.prototype.forEachLayerAtPixel=function(t,e,
i){if(this.frameState_){var r=i||{},n=void 0!==r.hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,o=r.layerFilter||R;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,n,e,null,o,null)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var i=this.getCoordinateFromPixel(t),r=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:R,n=void 0!==e.hitTolerance?e.hitTolerance*this.frameState_.pixelRatio:0;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,
n,r,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),i="changedTouches"in t?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]},e.prototype.getTarget=function(){return this.get(Ln.TARGET)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=
function(t){var e=this.frameState_;return e?De(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(Ln.LAYERGROUP)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},
e.prototype.getPixelFromCoordinate=function(t){var e=this.frameState_;return e?De(e.coordinateToPixelTransform,t.slice(0,2)):null},e.prototype.getRenderer=function(){return this.renderer_},e.prototype.getSize=function(){return this.get(Ln.SIZE)},e.prototype.getView=function(){return this.get(Ln.VIEW)},e.prototype.getViewport=function(){return this.viewport_},e.prototype.getOverlayContainer=function(){return this.overlayContainer_},e.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_},
e.prototype.getTilePriority=function(t,e,i,r){var n=this.frameState_;if(!(n&&e in n.wantedTiles))return 1/0;if(!n.wantedTiles[e][t.getKey()])return 1/0;var o=i[0]-n.focus[0],s=i[1]-n.focus[1];return 65536*Math.log(r)+Math.sqrt(o*o+s*s)/r},e.prototype.handleBrowserEvent=function(t,e){var i=e||t.type,r=new Fr(i,this,t);this.handleMapBrowserEvent(r)},e.prototype.handleMapBrowserEvent=function(t){if(this.frameState_){this.focus_=t.coordinate,t.frameState=this.frameState_;var e=this.getInteractions().getArray();
if(!1!==this.dispatchEvent(t))for(var i=e.length-1;i>=0;i--){var r=e[i];if(r.getActive())if(!r.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,r=i;if(t){var n=t.viewHints;n[kn]&&(i=this.loadTilesWhileAnimating_?8:0,r=2),n[jn]&&(i=this.loadTilesWhileInteracting_?8:0,r=2)}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,r))}!t||!this.hasListener(ur.RENDERCOMPLETE)||t.animate||this.tileQueue_.getTilesLoading()||
function t(e){for(var i=0,r=e.length;i<r;++i){var n=e[i];if("function"==typeof n.getLayers)return t(n.getLayers().getArray());var o=n.getSource();if(o&&o.loading)return!0}return!1}(this.getLayers().getArray())||this.renderer_.dispatchRenderEvent(ur.RENDERCOMPLETE,t);for(var o=this.postRenderFunctions_,s=0,a=o.length;s<a;++s)o[s](this,t);o.length=0},e.prototype.handleSizeChanged_=function(){this.render()},e.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()&&(t=this.getTargetElement()),
this.keyHandlerKeys_){for(var e=0,i=this.keyHandlerKeys_.length;e<i;++e)E(this.keyHandlerKeys_[e]);this.keyHandlerKeys_=null}if(t){t.appendChild(this.viewport_);var r=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.keyHandlerKeys_=[v(r,M.KEYDOWN,this.handleBrowserEvent,this),v(r,M.KEYPRESS,this.handleBrowserEvent,this)],this.handleResize_||(this.handleResize_=this.updateSize.bind(this),addEventListener(M.RESIZE,this.handleResize_,!1))}else this.renderer_.removeLayerRenderers(),$n(this.viewport_),
void 0!==this.handleResize_&&(removeEventListener(M.RESIZE,this.handleResize_,!1),this.handleResize_=void 0);this.updateSize()},e.prototype.handleTileChange_=function(){this.render()},e.prototype.handleViewPropertyChanged_=function(){this.render()},e.prototype.handleViewChanged_=function(){this.viewPropertyListenerKey_&&(E(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(E(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);var t=this.getView();
t&&(this.viewport_.setAttribute("data-view",o(t)),this.viewPropertyListenerKey_=v(t,l,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=v(t,M.CHANGE,this.handleViewPropertyChanged_,this)),this.render()},e.prototype.handleLayerGroupChanged_=function(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(E),this.layerGroupPropertyListenerKeys_=null);var t=this.getLayerGroup();t&&(this.layerGroupPropertyListenerKeys_=[v(t,l,this.render,this),v(t,M.CHANGE,
this.render,this)]),this.render()},e.prototype.isRendered=function(){return!!this.frameState_},e.prototype.renderSync=function(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()},e.prototype.render=function(){void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))},e.prototype.removeControl=function(t){return this.getControls().remove(t)},e.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)},
e.prototype.removeLayer=function(t){return this.getLayerGroup().getLayers().remove(t)},e.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)},e.prototype.renderFrame_=function(t){var e,i=this.getSize(),r=this.getView(),n=[1/0,1/0,-1/0,-1/0],s=this.frameState_,a=null;if(void 0!==i&&function(t){return t[0]>0&&t[1]>0}(i)&&r&&r.isDef()){for(var h=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),l=this.getLayerGroup().getLayerStatesArray(),u={},p=0,c=l.length;p<c;++p)u[o(l[p].layer)]=
l[p];e=r.getState(this.pixelRatio_),a={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,extent:n,focus:this.focus_?this.focus_:e.center,index:this.frameIndex_++,layerStates:u,layerStatesArray:l,pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:i,skippedFeatureUids:this.skippedFeatureUids_,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:e,viewHints:h,wantedTiles:{}}}if(a&&(a.extent=Ct(e.center,e.resolution,
e.rotation,a.size,n)),this.frameState_=a,this.renderer_.renderFrame(a),a){if(a.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,a.postRenderFunctions),s)(!this.previousExtent_||!bt(this.previousExtent_)&&!dt(a.extent,this.previousExtent_))&&(this.dispatchEvent(new Mr(wn,this,s)),this.previousExtent_=ut(this.previousExtent_));this.previousExtent_&&!a.viewHints[kn]&&!a.viewHints[jn]&&!dt(a.extent,this.previousExtent_)&&(this.dispatchEvent(new Mr(In,this,a)),it(a.extent,this.previousExtent_))}this.dispatchEvent(new Mr(Rn,
this,a)),setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(Ln.LAYERGROUP,t)},e.prototype.setSize=function(t){this.set(Ln.SIZE,t)},e.prototype.setTarget=function(t){this.set(Ln.TARGET,t)},e.prototype.setView=function(t){this.set(Ln.VIEW,t)},e.prototype.skipFeature=function(t){this.skippedFeatureUids_[o(t)]=!0,this.render()},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){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)])}else this.setSize(void 0)},e.prototype.unskipFeature=function(t){delete this.skippedFeatureUids_[o(t)],this.render()},e}(D);var uo=function(t){function e(e){t.call(this),this.element=e.element?e.element:null,this.target_=null,this.map_=null,this.listenerKeys=[],this.render=e.render?e.render:
I,e.target&&this.setTarget(e.target)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){$n(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&$n(this.element);for(var e=0,i=this.listenerKeys.length;e<i;++e)E(this.listenerKeys[e]);(this.listenerKeys.length=0,this.map_=t,this.map_)&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),
this.render!==I&&this.listenerKeys.push(v(t,Rn,this.render,this)),t.render())},e.prototype.setTarget=function(t){this.target_="string"==typeof t?document.getElementById(t):t},e}(D),po="ol-hidden",co="ol-selectable",fo="ol-unselectable",_o="ol-unsupported",go="ol-control",yo="ol-collapsed",vo=function(){var t,e={};return function(i){if(t||(t=document.createElement("div").style),!(i in e)){t.font=i;var r=t.fontFamily;if(t.font="",!r)return null;e[i]=r.split(/,\s?/)}return e[i]}}();function mo(t,e){return t.visible&&
e>=t.minResolution&&e<t.maxResolution}var xo=function(t){function e(e){var i=u({},e);delete i.source,t.call(this,i),this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,e.map&&this.setMap(e.map),v(this,G(eo.SOURCE),this.handleSourcePropertyChange_,this);var r=e.source?e.source:null;this.setSource(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=
function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(eo.SOURCE)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():ro.UNDEFINED},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(E(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=v(t,M.CHANGE,this.handleSourceChange_,
this)),this.changed()},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(E(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(E(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=v(t,ur.PRECOMPOSE,function(t){var e=t,i=this.getLayerState();i.managed=!1,void 0===this.getZIndex()&&(i.zIndex=1/0),e.frameState.layerStatesArray.push(i),e.frameState.layerStates[o(this)]=i},this),this.mapRenderKey_=v(this,M.CHANGE,t.render,t),this.changed())},
e.prototype.setSource=function(t){this.set(eo.SOURCE,t)},e}(io);function Eo(t){this.updateElement_(t.frameState)}var So=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),render:i.render||Eo,target:i.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===i.collapsed||i.collapsed,this.overrideCollapsible_=void 0!==i.collapsible,this.collapsible_=void 0===i.collapsible||i.collapsible,this.collapsible_||(this.collapsed_=!1);var r=void 0!==
i.className?i.className:"ol-attribution",n=void 0!==i.tipLabel?i.tipLabel:"Attributions",o=void 0!==i.collapseLabel?i.collapseLabel:"\u00bb";"string"==typeof o?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o):this.collapseLabel_=o;var s=void 0!==i.label?i.label:"i";"string"==typeof s?(this.label_=document.createElement("span"),this.label_.textContent=s):this.label_=s;var a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,h=document.createElement("button");
h.setAttribute("type","button"),h.title=n,h.appendChild(a),v(h,M.CLICK,this.handleClick_,this);var l=r+" "+fo+" "+go+(this.collapsed_&&this.collapsible_?" "+yo:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=l,u.appendChild(this.ulElement_),u.appendChild(h),this.renderedAttributions_=[],this.renderedVisible_=!0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.collectSourceAttributions_=function(t){for(var e={},i=[],
r=t.layerStatesArray,n=t.viewState.resolution,o=0,s=r.length;o<s;++o){var a=r[o];if(mo(a,n)){var h=a.layer.getSource();if(h){var l=h.getAttributions();if(l){var u=l(t);if(u)if(this.overrideCollapsible_||!1!==h.getAttributionsCollapsible()||this.setCollapsible(!1),Array.isArray(u))for(var p=0,c=u.length;p<c;++p)u[p]in e||(i.push(u[p]),e[u[p]]=!0);else u in e||(i.push(u),e[u]=!0)}}}}return i},e.prototype.updateElement_=function(t){if(t){var e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=
i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Z(e,this.renderedAttributions_)){to(this.ulElement_);for(var r=0,n=e.length;r<n;++r){var o=document.createElement("li");o.innerHTML=e[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle(yo),
this.collapsed_?Qn(this.collapseLabel_,this.label_):Qn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},
e}(uo);function To(t){var e=t.frameState;if(e){var i=e.viewState.rotation;if(i!=this.rotation_){var r="rotate("+i+"rad)";if(this.autoHide_){var n=this.element.classList.contains(po);n||0!==i?n&&0!==i&&this.element.classList.remove(po):this.element.classList.add(po)}this.label_.style.msTransform=r,this.label_.style.webkitTransform=r,this.label_.style.transform=r}this.rotation_=i}}var Co=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),render:i.render||To,target:i.target});
var r=void 0!==i.className?i.className:"ol-rotate",n=void 0!==i.label?i.label:"\u21e7";this.label_=null,"string"==typeof n?(this.label_=document.createElement("span"),this.label_.className="ol-compass",this.label_.textContent=n):(this.label_=n,this.label_.classList.add("ol-compass"));var o=i.tipLabel?i.tipLabel:"Reset rotation",s=document.createElement("button");s.className=r+"-reset",s.setAttribute("type","button"),s.title=o,s.appendChild(this.label_),v(s,M.CLICK,this.handleClick_,this);var a=r+
" "+fo+" "+go,h=this.element;h.className=a,h.appendChild(s),this.callResetNorth_=i.resetNorth?i.resetNorth:void 0,this.duration_=void 0!==i.duration?i.duration:250,this.autoHide_=void 0===i.autoHide||i.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(po)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},
e.prototype.resetNorth_=function(){var t=this.getMap().getView();t&&void 0!==t.getRotation()&&(this.duration_>0?t.animate({rotation:0,duration:this.duration_,easing:Xn}):t.setRotation(0))},e}(uo),Ro=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),target:i.target});var r=void 0!==i.className?i.className:"ol-zoom",n=void 0!==i.delta?i.delta:1,o=void 0!==i.zoomInLabel?i.zoomInLabel:"+",s=void 0!==i.zoomOutLabel?i.zoomOutLabel:"\u2212",a=void 0!==i.zoomInTipLabel?
i.zoomInTipLabel:"Zoom in",h=void 0!==i.zoomOutTipLabel?i.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=r+"-in",l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof o?document.createTextNode(o):o),v(l,M.CLICK,this.handleClick_.bind(this,n));var u=document.createElement("button");u.className=r+"-out",u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof s?document.createTextNode(s):s),v(u,M.CLICK,this.handleClick_.bind(this,-n));var p=
r+" "+fo+" "+go,c=this.element;c.className=p,c.appendChild(l),c.appendChild(u),this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var i=e.getResolution();if(i){var r=e.constrainResolution(i,t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:r,
duration:this.duration_,easing:Xn})):e.setResolution(r)}}},e}(uo);function wo(t){var e=t||{},i=new U;return(void 0===e.zoom||e.zoom)&&i.push(new Ro(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&i.push(new Co(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&i.push(new So(e.attributionOptions)),i}var Io={ACTIVE:"active"};function Lo(t,e,i,r){Oo(t,e=t.constrainRotation(e,0),i,r)}function Oo(t,e,i,r){if(void 0!==e){var n=t.getRotation(),o=t.getCenter();void 0!==n&&o&&r>0?t.animate({rotation:e,
anchor:i,duration:r,easing:Xn}):t.rotate(e,i)}}function Po(t,e,i,r,n){Mo(t,e=t.constrainResolution(e,0,n),i,r)}function bo(t,e,i,r){var n=t.getResolution(),o=t.constrainResolution(n,e,0);if(void 0!==o){var s=t.getResolutions();o=kt(o,t.getMinResolution()||s[s.length-1],t.getMaxResolution()||s[0])}if(i&&void 0!==o&&o!==n){var a=t.getCenter(),h=t.calculateCenterZoom(o,i);h=t.constrainCenter(h),i=[(o*a[0]-n*h[0])/(o-n),(o*a[1]-n*h[1])/(o-n)]}Mo(t,o,i,r)}function Mo(t,e,i,r){if(e){var n=t.getResolution(),
o=t.getCenter();if(void 0!==n&&o&&e!==n&&r)t.animate({resolution:e,anchor:i,duration:r,easing:Xn});else{if(i){var s=t.calculateCenterZoom(e,i);t.setCenter(s)}t.setResolution(e)}}}var Fo=function(t){function e(e){t.call(this),e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getActive=function(){return this.get(Io.ACTIVE)},e.prototype.getMap=function(){return this.map_},
e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Io.ACTIVE,t)},e.prototype.setMap=function(t){this.map_=t},e}(D);function Ao(t){var e=!1;if(t.type==Ar.DBLCLICK){var i=t.originalEvent,r=t.map,n=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_;bo(r.getView(),o,n,this.duration_),t.preventDefault(),e=!0}return!e}var No=function(t){function e(e){t.call(this,{handleEvent:Ao});var i=e||{};this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:
250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo),Go=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Do=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},ko=function(t){return t.target.getTargetElement()===document.activeElement},jo=R,Uo=function(t){var e=t.originalEvent;return 0==e.button&&!(Ni&&Gi&&e.ctrlKey)},Yo=w,Bo=function(t){return"pointermove"==t.type},Vo=function(t){return t.type==
Ar.SINGLECLICK},Xo=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},zo=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Wo=function(t){var e=t.originalEvent.target.tagName;return"INPUT"!==e&&"SELECT"!==e&&"TEXTAREA"!==e},Ko=function(t){var e=t.pointerEvent;return Y(void 0!==e,56),"mouse"==e.pointerType},Ho=function(t){var e=t.pointerEvent;return Y(void 0!==e,56),e.isPrimary&&0===e.button};function Zo(t){for(var e=t.length,
i=0,r=0,n=0;n<e;n++)i+=t[n].clientX,r+=t[n].clientY;return[i/e,r/e]}var qo=function(t){function e(e){var i=e||{};t.call(this,i),i.handleDownEvent&&(this.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(this.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(this.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(this.handleUpEvent=i.handleUpEvent),i.stopDown&&(this.stopDown=i.stopDown),this.handlingDownUpSequence=!1,this.trackedPointers_={},this.targetPointers=[]}return t&&(e.__proto__=
t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDownEvent=function(t){return!1},e.prototype.handleDragEvent=function(t){},e.prototype.handleEvent=function(t){if(!t.pointerEvent)return!0;var e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence)if(t.type==Ar.POINTERDRAG)this.handleDragEvent(t);else{if(t.type==Ar.POINTERUP){var i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==Ar.POINTERDOWN){var r=
this.handleDownEvent(t);r&&t.preventDefault(),this.handlingDownUpSequence=r,e=this.stopDown(r)}else t.type==Ar.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Ar.POINTERDOWN||e===Ar.POINTERDRAG||e===Ar.POINTERUP}(t)){var e=t.pointerEvent,i=e.pointerId.toString();t.type==Ar.POINTERUP?
delete this.trackedPointers_[i]:t.type==Ar.POINTERDOWN?this.trackedPointers_[i]=e:i in this.trackedPointers_&&(this.trackedPointers_[i]=e),this.targetPointers=c(this.trackedPointers_)}},e}(Fo),Jo=function(t){function e(e){t.call(this,{stopDown:w});var i=e||{};this.kinetic_=i.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1,this.condition_=i.condition?i.condition:Xo,this.noKinetic_=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.handleDragEvent=function(t){this.panning_||(this.panning_=!0,this.getMap().getView().setHint(jn,1));var e=this.targetPointers,i=Zo(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(i[0],i[1]),this.lastCentroid){var r=this.lastCentroid[0]-i[0],n=i[1]-this.lastCentroid[1],o=t.map.getView(),s=[r,n];tr(s,o.getResolution()),$i(s,o.getRotation()),Hi(s,o.getCenter()),s=o.constrainCenter(s),o.setCenter(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=
i,this.lastPointersCount_=e.length},e.prototype.handleUpEvent=function(t){var e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var r=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),o=i.getCenter(),s=e.getPixelFromCoordinate(o),a=e.getCoordinateFromPixel([s[0]-r*Math.cos(n),s[1]-r*Math.sin(n)]);i.animate({center:i.constrainCenter(a),duration:500,easing:Xn})}return this.panning_&&(this.panning_=!1,i.setHint(jn,-1)),!1}return this.kinetic_&&
this.kinetic_.begin(),this.lastCentroid=null,!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.setCenter(t.frameState.viewState.center),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(qo),Qo=function(t){function e(e){var i=e||{};t.call(this,{stopDown:w}),this.condition_=i.condition?i.condition:Do,this.lastAngle_=void 0,this.duration_=
void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){if(Ko(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==Gn){var r=e.getSize(),n=t.pixel,o=Math.atan2(r[1]/2-n[1],n[0]-r[0]/2);if(void 0!==this.lastAngle_){var s=o-this.lastAngle_;Oo(i,i.getRotation()-s)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){if(!Ko(t))return!0;var e=t.map.getView();return e.setHint(jn,
-1),Lo(e,e.getRotation(),void 0,this.duration_),!1},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!(!Uo(t)||!this.condition_(t))&&(t.map.getView().setHint(jn,1),this.lastAngle_=void 0,!0))},e}(qo),$o=function(t){function e(e){t.call(this),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i=this.element_.style;i.left=Math.min(t[0],e[0])+"px",i.top=Math.min(t[1],e[1])+"px",i.width=Math.abs(e[0]-t[0])+"px",i.height=Math.abs(e[1]-t[1])+"px"},e.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,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixel,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Ii([i])},e.prototype.getGeometry=function(){return this.geometry_},
e}(C),ts="boxstart",es="boxdrag",is="boxend",rs=function(t){function e(e,i,r){t.call(this,e),this.coordinate=i,this.mapBrowserEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),ns=function(t){function e(e){t.call(this);var i=e||{};this.box_=new $o(i.className||"ol-dragbox"),this.minArea_=void 0!==i.minArea?i.minArea:64,this.onBoxEnd_=i.onBoxEnd?i.onBoxEnd:I,this.startPixel_=null,this.condition_=i.condition?i.condition:jo,this.boxEndCondition_=
i.boxEndCondition?i.boxEndCondition:this.defaultBoxEndCondition}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.defaultBoxEndCondition=function(t,e,i){var r=i[0]-e[0],n=i[1]-e[1];return r*r+n*n>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){Ko(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new rs(es,t.coordinate,t)))},e.prototype.handleUpEvent=
function(t){return!Ko(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new rs(is,t.coordinate,t))),!1)},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!(!Uo(t)||!this.condition_(t))&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new rs(ts,t.coordinate,t)),!0))},e}(qo);function os(){var t=this.getMap(),e=t.getView(),i=t.getSize(),r=this.getGeometry().getExtent();
if(this.out_){var n=e.calculateExtent(i),o=function(t,e){return gt(ut(e),t)}([t.getPixelFromCoordinate(Et(r)),t.getPixelFromCoordinate(Lt(r))]);Mt(n,1/e.getResolutionForExtent(o,i)),r=n}var s=e.constrainResolution(e.getResolutionForExtent(r,i)),a=Tt(r);a=e.constrainCenter(a),e.animate({resolution:s,center:a,duration:this.duration_,easing:Xn})}var ss=function(t){function e(e){var i=e||{},r=i.condition?i.condition:zo;t.call(this,{condition:r,className:i.className||"ol-dragzoom",onBoxEnd:os}),this.duration_=
void 0!==i.duration?i.duration:200,this.out_=void 0!==i.out&&i.out}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ns),as={LEFT:37,UP:38,RIGHT:39,DOWN:40};function hs(t){var e=!1;if(t.type==M.KEYDOWN){var i=t.originalEvent.keyCode;if(this.condition_(t)&&(i==as.DOWN||i==as.LEFT||i==as.RIGHT||i==as.UP)){var r=t.map.getView(),n=r.getResolution()*this.pixelDelta_,o=0,s=0;i==as.DOWN?s=-n:i==as.LEFT?o=-n:i==as.RIGHT?o=n:s=n;var a=[o,s];$i(a,r.getRotation()),
function(t,e,i){var r=t.getCenter();if(r){var n=t.constrainCenter([r[0]+e[0],r[1]+e[1]]);i?t.animate({duration:i,easing:Wn,center:n}):t.setCenter(n)}}(r,a,this.duration_),t.preventDefault(),e=!0}}return!e}var ls=function(t){function e(e){t.call(this,{handleEvent:hs});var i=e||{};this.defaultCondition_=function(t){return Xo(t)&&Wo(t)},this.condition_=void 0!==i.condition?i.condition:this.defaultCondition_,this.duration_=void 0!==i.duration?i.duration:100,this.pixelDelta_=void 0!==i.pixelDelta?i.pixelDelta:
128}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo);function us(t){var e=!1;if(t.type==M.KEYDOWN||t.type==M.KEYPRESS){var i=t.originalEvent.charCode;if(this.condition_(t)&&(i=="+".charCodeAt(0)||i=="-".charCodeAt(0))){var r=t.map,n=i=="+".charCodeAt(0)?this.delta_:-this.delta_;bo(r.getView(),n,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var ps=function(t){function e(e){t.call(this,{handleEvent:us});var i=e||{};this.condition_=i.condition?
i.condition:Wo,this.delta_=i.delta?i.delta:1,this.duration_=void 0!==i.duration?i.duration:100}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Fo),cs="trackpad",ds="wheel",fs=function(t){function e(e){var i=e||{};t.call(this,i),this.delta_=0,this.duration_=void 0!==i.duration?i.duration:250,this.timeout_=void 0!==i.timeout?i.timeout:80,this.useAnchor_=void 0===i.useAnchor||i.useAnchor,this.constrainResolution_=i.constrainResolution||!1,this.condition_=
i.condition?i.condition:jo,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.trackpadDeltaPerZoom_=300,this.trackpadZoomBuffer_=1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().setHint(jn,-1)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=
t.type;if(e!==M.WHEEL&&e!==M.MOUSEWHEEL)return!0;t.preventDefault();var i,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==M.WHEEL?(i=n.deltaY,Fi&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(i/=Di),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(i*=40)):t.type==M.MOUSEWHEEL&&(i=-n.wheelDeltaY,Ai&&(i/=3)),0===i)return!1;var o=Date.now();if(void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?cs:
ds),this.mode_===cs){var s=r.getView();this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):s.setHint(jn,1),this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var a=s.getResolution()*Math.pow(2,i/this.trackpadDeltaPerZoom_),h=s.getMinResolution(),l=s.getMaxResolution(),u=0;if(a<h?(a=Math.max(a,h/this.trackpadZoomBuffer_),u=1):a>l&&(a=Math.min(a,l*this.trackpadZoomBuffer_),u=-1),this.lastAnchor_){var p=s.calculateCenterZoom(a,this.lastAnchor_);
s.setCenter(s.constrainCenter(p))}return s.setResolution(a),0===u&&this.constrainResolution_&&s.animate({resolution:s.constrainResolution(a,i>0?-1:1),easing:Xn,anchor:this.lastAnchor_,duration:this.duration_}),u>0?s.animate({resolution:h,easing:Xn,anchor:this.lastAnchor_,duration:500}):u<0&&s.animate({resolution:l,easing:Xn,anchor:this.lastAnchor_,duration:500}),this.startTime_=o,!1}this.delta_+=i;var c=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=
setTimeout(this.handleWheelZoom_.bind(this,r),c),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();bo(e,-kt(this.delta_,-1,1),this.lastAnchor_,this.duration_),this.mode_=void 0,this.delta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Fo),_s=function(t){function e(e){var i=e||{},r=i;r.stopDown||(r.stopDown=w),t.call(this,r),this.anchor_=
null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==i.threshold?i.threshold:.3,this.duration_=void 0!==i.duration?i.duration:250}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],r=this.targetPointers[1],n=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(void 0!==this.lastAngle_){var o=n-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&
Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=n;var s=t.map,a=s.getView();if(a.getConstraints().rotation!==Gn){var h=s.getViewport().getBoundingClientRect(),l=Zo(this.targetPointers);if(l[0]-=h.left,l[1]-=h.top,this.anchor_=s.getCoordinateFromPixel(l),this.rotating_){var u=a.getRotation();s.render(),Oo(a,u+e,this.anchor_)}}},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView();if(e.setHint(jn,-1),this.rotating_)Lo(e,
e.getRotation(),this.anchor_,this.duration_);return!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().setHint(jn,1),!0}return!1},e}(qo),gs=function(t){function e(e){var i=e||{},r=i;r.stopDown||(r.stopDown=w),t.call(this,r),this.constrainResolution_=i.constrainResolution||!1,this.anchor_=null,this.duration_=void 0!==i.duration?
i.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],r=this.targetPointers[1],n=i.clientX-r.clientX,o=i.clientY-r.clientY,s=Math.sqrt(n*n+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/s),this.lastDistance_=s;var a=t.map,h=a.getView(),l=h.getResolution(),u=h.getMaxResolution(),p=h.getMinResolution(),c=l*e;c>u?(e=
u/l,c=u):c<p&&(e=p/l,c=p),1!=e&&(this.lastScaleDelta_=e);var d=a.getViewport().getBoundingClientRect(),f=Zo(this.targetPointers);f[0]-=d.left,f[1]-=d.top,this.anchor_=a.getCoordinateFromPixel(f),a.render(),Mo(h,c,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView();e.setHint(jn,-1);var i=e.getResolution();if(this.constrainResolution_||i<e.getMinResolution()||i>e.getMaxResolution()){var r=this.lastScaleDelta_-1;Po(e,i,this.anchor_,this.duration_,
r)}return!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().setHint(jn,1),!0}return!1},e}(qo);function ys(t){var e=t||{},i=new U,r=new br(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&i.push(new Qo),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&i.push(new No({delta:e.zoomDelta,duration:e.zoomDuration})),
(void 0===e.dragPan||e.dragPan)&&i.push(new Jo({condition:e.onFocusOnly?ko:void 0,kinetic:r})),(void 0===e.pinchRotate||e.pinchRotate)&&i.push(new _s),(void 0===e.pinchZoom||e.pinchZoom)&&i.push(new gs({constrainResolution:e.constrainResolution,duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(i.push(new ls),i.push(new ps({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&i.push(new fs({condition:e.onFocusOnly?ko:void 0,constrainResolution:e.constrainResolution,
duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&i.push(new ss({duration:e.zoomDuration})),i}var vs=.5,ms=function(t){function e(e,i,r,n){t.call(this),this.extent=e,this.pixelRatio_=r,this.resolution=i,this.state=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.changed=function(){this.dispatchEvent(M.CHANGE)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return r()},e.prototype.getPixelRatio=
function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){r()},e}(b),xs={IDLE:0,LOADING:1,LOADED:2,ERROR:3},Es=function(t){function e(e,i,r,n,o){var s=void 0!==o?xs.IDLE:xs.LOADED;t.call(this,e,i,r,s),this.loader_=void 0!==o?o:null,this.canvas_=n,this.error_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getError=function(){return this.error_},
e.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=xs.ERROR):this.state=xs.LOADED,this.changed()},e.prototype.load=function(){this.state==xs.IDLE&&(this.state=xs.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))},e.prototype.getImage=function(){return this.canvas_},e}(ms),Ss={IMAGE:"IMAGE",TILE:"TILE",VECTOR_TILE:"VECTOR_TILE",VECTOR:"VECTOR"},Ts={IMAGE:"image",VECTOR:"vector"},Cs=function(t){function e(e,i,r,n,o){t.call(this,e),this.vectorContext=i,this.frameState=r,
this.context=n,this.glContext=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),Rs=function(t){function e(e){t.call(this),this.highWaterMark=void 0!==e?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},e.prototype.clear=function(){this.count_=0,this.entries_=
{},this.oldest_=null,this.newest_=null,this.dispatchEvent(M.CLEAR)},e.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},e.prototype.forEach=function(t,e){for(var i=this.oldest_;i;)t.call(e,i.value_,i.key_,this),i=i.newer},e.prototype.get=function(t){var e=this.entries_[t];return Y(void 0!==e,15),e===this.newest_?e.value_:(e===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(e.newer.older=e.older,e.older.newer=e.newer),e.newer=null,e.older=this.newest_,
this.newest_.newer=e,this.newest_=e,e.value_)},e.prototype.remove=function(t){var e=this.entries_[t];return Y(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},e.prototype.getCount=function(){return this.count_},e.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=
this.newest_;t;t=t.older)e[i++]=t.key_;return e},e.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},e.prototype.peekLast=function(){return this.oldest_.value_},e.prototype.peekLastKey=function(){return this.oldest_.key_},e.prototype.peekFirstKey=function(){return this.newest_.key_},e.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||
(this.newest_=null),--this.count_,t.value_},e.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},e.prototype.set=function(t,e){Y(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},e.prototype.setSize=function(t){this.highWaterMark=t},e.prototype.prune=function(){for(;this.canExpireCache();)this.pop()},e}(b),ws=[0,0,0,1],Is=[],Ls=[0,0,0,1],Os=[0,0,0,0],
Ps=new Rs,bs={},Ms=null,Fs={},As=function(){var t,e,i=60,r=bs,n="32px ",o=["monospace","serif"],s=o.length,a="wmytzilWMYTZIL@#/\x26?$%10\uf013";function h(t){for(var i=Ns(),r=100;r<=700;r+=300){for(var h=r+" ",l=!0,u=0;u<s;++u){var p=o[u];if(i.font=h+n+p,e=i.measureText(a).width,t!=p){i.font=h+n+t+","+p;var c=i.measureText(a).width;l=l&&c!=e}}if(l)return!0}return!1}function l(){var e=!0;for(var n in r)r[n]<i&&(h(n)?(r[n]=i,p(Fs),Ms=null,Ps.clear()):(++r[n],e=!1));e&&(clearInterval(t),t=void 0)}return function(e){var n=
vo(e);if(n)for(var o=0,s=n.length;o<s;++o){var a=n[o];a in r||(r[a]=i,h(a)||(r[a]=0,void 0===t&&(t=setInterval(l,32))))}}}();function Ns(){return Ms||(Ms=Jn(1,1)),Ms}var Gs=function(){var t,e=Fs;return function(i){var r=e[i];return void 0==r&&(t||((t=document.createElement("span")).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)),
r}}();function Ds(t,e){var i=Ns();return t!=i.font&&(i.font=t),i.measureText(e).width}function ks(t,e,i,r){0!==e&&(t.translate(i,r),t.rotate(e),t.translate(-i,-r))}var js=[1,0,0,1,0,0];function Us(t,e,i,r,n,o,s,a,h,l,u){var p;1!=i&&(p=t.globalAlpha,t.globalAlpha=p*i),e&&t.setTransform.apply(t,e),t.drawImage(r,n,o,s,a,h,l,s*u,a*u),p&&(t.globalAlpha=p),e&&t.setTransform.apply(t,js)}function Ys(t){return Array.isArray(t)?yr(t):t}var Bs=function(){};Bs.prototype.drawCustom=function(t,e,i){},Bs.prototype.drawGeometry=
function(t){},Bs.prototype.setStyle=function(t){},Bs.prototype.drawCircle=function(t,e){},Bs.prototype.drawFeature=function(t,e){},Bs.prototype.drawGeometryCollection=function(t,e){},Bs.prototype.drawLineString=function(t,e){},Bs.prototype.drawMultiLineString=function(t,e){},Bs.prototype.drawMultiPoint=function(t,e){},Bs.prototype.drawMultiPolygon=function(t,e){},Bs.prototype.drawPoint=function(t,e){},Bs.prototype.drawPolygon=function(t,e){},Bs.prototype.drawText=function(t,e){},Bs.prototype.setFillStrokeStyle=
function(t,e){},Bs.prototype.setImageStyle=function(t,e){},Bs.prototype.setTextStyle=function(t,e){};var Vs=Bs,Xs=function(t){function e(e,i,r,n,o){t.call(this),this.context_=e,this.pixelRatio_=i,this.extent_=r,this.transform_=n,this.viewRotation_=o,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_=!1,this.imageRotation_=0,this.imageScale_=0,this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=0,this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawImages_=function(t,e,i,
r){if(this.image_){var n=Gt(t,e,i,2,this.transform_,this.pixelCoordinates_),o=this.context_,s=this.tmpLocalTransform_,a=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=a*this.imageOpacity_);var h=this.imageRotation_;this.imageRotateWithView_&&(h+=this.viewRotation_);for(var l=0,u=n.length;l<u;l+=2){var p=n[l]-this.imageAnchorX_,c=n[l+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_){var d=p+this.imageAnchorX_,f=c+this.imageAnchorY_;Ye(s,d,f,this.imageScale_,this.imageScale_,h,-d,-f),o.setTransform.apply(o,
s)}o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,p,c,this.imageWidth_,this.imageHeight_)}0===h&&1==this.imageScale_||o.setTransform(1,0,0,1,0,0),1!=this.imageOpacity_&&(o.globalAlpha=a)}},e.prototype.drawText_=function(t,e,i,r){if(this.textState_&&""!==this.text_){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);
var n=Gt(t,e,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,s=this.textRotation_;for(this.textRotateWithView_&&(s+=this.viewRotation_);e<i;e+=r){var a=n[e]+this.textOffsetX_,h=n[e+1]+this.textOffsetY_;if(0!==s||1!=this.textScale_){var l=Ye(this.tmpLocalTransform_,a,h,this.textScale_,this.textScale_,s,-a,-h);o.setTransform.apply(o,l)}this.textStrokeState_&&o.strokeText(this.text_,a,h),this.textFillState_&&o.fillText(this.text_,a,h)}0===s&&1==this.textScale_||o.setTransform(1,0,0,1,0,0)}},
e.prototype.moveToLineTo_=function(t,e,i,r,n){var o=this.context_,s=Gt(t,e,i,r,this.transform_,this.pixelCoordinates_);o.moveTo(s[0],s[1]);var a=s.length;n&&(a-=2);for(var h=2;h<a;h+=2)o.lineTo(s[h],s[h+1]);return n&&o.closePath(),i},e.prototype.drawRings_=function(t,e,i,r){for(var n=0,o=i.length;n<o;++n)e=this.moveToLineTo_(t,e,i[n],r,!0);return e},e.prototype.drawCircle=function(t){if(Pt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),
this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var e=function(t,e,i){var r=t.getFlatCoordinates();if(r){var n=t.getStride();return Gt(r,0,r.length,n,e,i)}return null}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],r=e[3]-e[1],n=Math.sqrt(i*i+r*r),o=this.context_;o.beginPath(),o.arc(e[0],e[1],n,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}},e.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),
t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},e.prototype.drawGeometry=function(t){switch(t.getType()){case Nt.POINT:this.drawPoint(t);break;case Nt.LINE_STRING:this.drawLineString(t);break;case Nt.POLYGON:this.drawPolygon(t);break;case Nt.MULTI_POINT:this.drawMultiPoint(t);break;case Nt.MULTI_LINE_STRING:this.drawMultiLineString(t);break;case Nt.MULTI_POLYGON:this.drawMultiPolygon(t);break;case Nt.GEOMETRY_COLLECTION:this.drawGeometryCollection(t);break;case Nt.CIRCLE:this.drawCircle(t)}},
e.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);i&&Pt(this.extent_,i.getExtent())&&(this.setStyle(e),this.drawGeometry(i))},e.prototype.drawGeometryCollection=function(t){for(var e=t.getGeometriesArray(),i=0,r=e.length;i<r;++i)this.drawGeometry(e[i])},e.prototype.drawPoint=function(t){var e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)},e.prototype.drawMultiPoint=function(t){var e=t.getFlatCoordinates(),
i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)},e.prototype.drawLineString=function(t){if(Pt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){var r=t.getFlatMidpoint();this.drawText_(r,0,2,2)}}},e.prototype.drawMultiLineString=function(t){var e=t.getExtent();
if(Pt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var i=this.context_,r=t.getFlatCoordinates(),n=0,o=t.getEnds(),s=t.getStride();i.beginPath();for(var a=0,h=o.length;a<h;++a)n=this.moveToLineTo_(r,n,o[a],s,!1);i.stroke()}if(""!==this.text_){var l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}}},e.prototype.drawPolygon=function(t){if(Pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),
this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){var i=t.getFlatInteriorPoint();this.drawText_(i,0,2,2)}}},e.prototype.drawMultiPolygon=function(t){if(Pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&
this.setContextStrokeState_(this.strokeState_);var e=this.context_,i=t.getOrientedFlatCoordinates(),r=0,n=t.getEndss(),o=t.getStride();e.beginPath();for(var s=0,a=n.length;s<a;++s){var h=n[s];r=this.drawRings_(i,r,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){var l=t.getFlatInteriorPoints();this.drawText_(l,0,l.length,2)}}},e.prototype.setContextFillState_=function(t){var e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=e.fillStyle=
t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})},e.prototype.setContextStrokeState_=function(t){var e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=e.lineCap=t.lineCap),ki&&(Z(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset=t.lineDashOffset)),i.lineJoin!=t.lineJoin&&(i.lineJoin=e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=e.lineWidth=
t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,ki&&(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})},e.prototype.setContextTextState_=function(t){var e=this.context_,i=this.contextTextState_,r=t.textAlign?t.textAlign:"center";i?(i.font!=t.font&&(i.font=e.font=t.font),i.textAlign!=r&&(i.textAlign=e.textAlign=r),i.textBaseline!=t.textBaseline&&(i.textBaseline=e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=r,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:r,textBaseline:t.textBaseline})},e.prototype.setFillStrokeStyle=function(t,e){if(t){var i=
t.getColor();this.fillState_={fillStyle:Ys(i||ws)}}else this.fillState_=null;if(e){var r=e.getColor(),n=e.getLineCap(),o=e.getLineDash(),s=e.getLineDashOffset(),a=e.getLineJoin(),h=e.getWidth(),l=e.getMiterLimit();this.strokeState_={lineCap:void 0!==n?n:"round",lineDash:o||Is,lineDashOffset:s||0,lineJoin:void 0!==a?a:"round",lineWidth:this.pixelRatio_*(void 0!==h?h:1),miterLimit:void 0!==l?l:10,strokeStyle:Ys(r||Ls)}}else this.strokeState_=null},e.prototype.setImageStyle=function(t){if(t){var e=t.getAnchor(),
i=t.getImage(1),r=t.getOrigin(),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.imageWidth_=n[0]}else this.image_=null},e.prototype.setTextStyle=function(t){if(t){var e=t.getFill();if(e){var i=e.getColor();this.textFillState_={fillStyle:Ys(i||
ws)}}else this.textFillState_=null;var r=t.getStroke();if(r){var n=r.getColor(),o=r.getLineCap(),s=r.getLineDash(),a=r.getLineDashOffset(),h=r.getLineJoin(),l=r.getWidth(),u=r.getMiterLimit();this.textStrokeState_={lineCap:void 0!==o?o:"round",lineDash:s||Is,lineDashOffset:a||0,lineJoin:void 0!==h?h:"round",lineWidth:void 0!==l?l:1,miterLimit:void 0!==u?u:10,strokeStyle:Ys(n||Ls)}}else this.textStrokeState_=null;var p=t.getFont(),c=t.getOffsetX(),d=t.getOffsetY(),f=t.getRotateWithView(),_=t.getRotation(),
g=t.getScale(),y=t.getText(),v=t.getTextAlign(),m=t.getTextBaseline();this.textState_={font:void 0!==p?p:"10px sans-serif",textAlign:void 0!==v?v:"center",textBaseline:void 0!==m?m:"middle"},this.text_=void 0!==y?y:"",this.textOffsetX_=void 0!==c?this.pixelRatio_*c:0,this.textOffsetY_=void 0!==d?this.pixelRatio_*d:0,this.textRotateWithView_=void 0!==f&&f,this.textRotation_=void 0!==_?_:0,this.textScale_=this.pixelRatio_*(void 0!==g?g:1)}else this.text_=""},e}(Vs),zs=function(){this.cache_={},this.cacheSize_=
0,this.maxCacheSize_=32};function Ws(t,e,i){return e+":"+t+":"+(i?dr(i):"null")}zs.prototype.clear=function(){this.cache_={},this.cacheSize_=0},zs.prototype.expire=function(){if(this.cacheSize_>this.maxCacheSize_){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},zs.prototype.get=function(t,e,i){var r=Ws(t,e,i);return r in this.cache_?this.cache_[r]:null},zs.prototype.set=function(t,e,i,r){var n=Ws(t,e,i);this.cache_[n]=
r,++this.cacheSize_},zs.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()};var Ks=new zs;function Hs(t,e){Ks.expire()}function Zs(t,e){return t.zIndex-e.zIndex}var qs=function(t){function e(e){t.call(this),this.map_=e,this.layerRenderers_={},this.layerRendererListeners_={},this.layerRendererConstructors_=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.dispatchRenderEvent=function(t,e){r()},e.prototype.registerLayerRenderers=
function(t){this.layerRendererConstructors_.push.apply(this.layerRendererConstructors_,t)},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Ye(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Be(Ge(r,i))},e.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_)this.removeLayerRendererByKey_(t).dispose()},e.prototype.forEachFeatureAtCoordinate=function(t,e,
i,r,n,s,a){var h,l=e.viewState,u=l.resolution;function p(t,i){var s=e.layerStates[o(i)].managed;if(!(o(t)in e.skippedFeatureUids)||s)return r.call(n,t,s?i:null)}var c=l.projection,d=t;if(c.canWrapX()){var f=c.getExtent(),_=Ot(f),g=t[0];if(g<f[0]||g>f[2])d=[g+_*Math.ceil((f[0]-g)/_),t[1]]}var y,v=e.layerStatesArray;for(y=v.length-1;y>=0;--y){var m=v[y],x=m.layer;if(mo(m,u)&&s.call(a,x)){var E=this.getLayerRenderer(x),S=x.getSource();if(S&&(h=E.forEachFeatureAtCoordinate(S.getWrapX()?d:t,e,i,p)),h)return h}}},
e.prototype.forEachLayerAtPixel=function(t,e,i,n,o,s,a){return r()},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,R,this,r,n)},e.prototype.getLayerRenderer=function(t){var e=o(t);if(e in this.layerRenderers_)return this.layerRenderers_[e];for(var i,r=0,n=this.layerRendererConstructors_.length;r<n;++r){var s=this.layerRendererConstructors_[r];if(s.handles(t)){i=s.create(this,t);break}}if(!i)throw new Error("Unable to create renderer for layer: "+
t.getType());return this.layerRenderers_[e]=i,this.layerRendererListeners_[e]=v(i,M.CHANGE,this.handleLayerRendererChange_,this),i},e.prototype.getLayerRendererByKey=function(t){return this.layerRenderers_[t]},e.prototype.getLayerRenderers=function(){return this.layerRenderers_},e.prototype.getMap=function(){return this.map_},e.prototype.handleLayerRendererChange_=function(){this.map_.render()},e.prototype.removeLayerRendererByKey_=function(t){var e=this.layerRenderers_[t];return delete this.layerRenderers_[t],
E(this.layerRendererListeners_[t]),delete this.layerRendererListeners_[t],e},e.prototype.removeUnusedLayerRenderers_=function(t,e){for(var i in this.layerRenderers_)e&&i in e.layerStates||this.removeLayerRendererByKey_(i).dispose()},e.prototype.renderFrame=function(t){r()},e.prototype.scheduleExpireIconCache=function(t){t.postRenderFunctions.push(Hs)},e.prototype.scheduleRemoveUnusedLayerRenderers=function(t){for(var e in this.layerRenderers_)if(!(e in t.layerStates))return void t.postRenderFunctions.push(this.removeUnusedLayerRenderers_.bind(this))},
e}(C),Js=[],Qs=function(t){function e(e){t.call(this,e);var i=e.getViewport();this.context_=Jn(),this.canvas_=this.context_.canvas,this.canvas_.style.width="100%",this.canvas_.style.height="100%",this.canvas_.style.display="block",this.canvas_.className=fo,i.insertBefore(this.canvas_,i.childNodes[0]||null),this.renderedVisible_=!0,this.transform_=[1,0,0,1,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.dispatchRenderEvent=function(t,e){var i=
this.getMap(),r=this.context_;if(i.hasListener(t)){var n=e.extent,o=e.pixelRatio,s=e.viewState.rotation,a=this.getTransform(e),h=new Xs(r,o,n,a,s),l=new Cs(t,h,e,r,null);i.dispatchEvent(l)}},e.prototype.getTransform=function(t){var e=t.viewState,i=this.canvas_.width/2,r=this.canvas_.height/2,n=t.pixelRatio/e.resolution,o=-n,s=-e.rotation,a=-e.center[0],h=-e.center[1];return Ye(this.transform_,i,r,n,o,s,a,h)},e.prototype.renderFrame=function(t){if(t){var e=this.context_,i=t.pixelRatio,r=Math.round(t.size[0]*
i),n=Math.round(t.size[1]*i);this.canvas_.width!=r||this.canvas_.height!=n?(this.canvas_.width=r,this.canvas_.height=n):e.clearRect(0,0,r,n);var o=t.viewState.rotation;this.calculateMatrices2D(t),this.dispatchRenderEvent(ur.PRECOMPOSE,t);var s=t.layerStatesArray;q(s,Zs),o&&(e.save(),ks(e,o,r/2,n/2));var a,h,l=t.viewState.resolution;for(a=0,h=s.length;a<h;++a){var u=s[a],p=u.layer,c=this.getLayerRenderer(p);mo(u,l)&&u.sourceState==ro.READY&&(c.prepareFrame(t,u)&&c.composeFrame(t,u,e))}o&&e.restore(),
this.dispatchRenderEvent(ur.POSTCOMPOSE,t),this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,i,r,n,o,s){var a,h,l=e.viewState.resolution,u=e.layerStatesArray,p=u.length,c=De(e.pixelToCoordinateTransform,t.slice());for(h=p-1;h>=0;--h){var d=u[h],f=d.layer;if(mo(d,
l)&&o.call(s,f))if(a=this.getLayerRenderer(f).forEachLayerAtCoordinate(c,e,i,r,n))return a}},e.prototype.registerLayerRenderers=function(e){t.prototype.registerLayerRenderers.call(this,e);for(var i=0,r=e.length;i<r;++i){var n=e[i];X(Js,n)||Js.push(n)}},e}(qs),$s=function(t){function e(e){t.call(this),this.layer_=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createLoadedTileFinder=function(t,e,i){return function(r,n){return t.forEachLoadedTile(e,
r,n,function(t){i[r]||(i[r]={}),i[r][t.tileCoord.toString()]=t})}},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r){},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleImageChange_=function(t){t.target.getState()===xs.LOADED&&this.renderIfReadyAndVisible()},e.prototype.hasFeatureAtCoordinate=function(t,e){return!1},e.prototype.loadImage=function(t){var e=t.getState();return e!=xs.LOADED&&e!=xs.ERROR&&v(t,M.CHANGE,this.handleImageChange_,this),e==xs.IDLE&&(t.load(),e=t.getState()),
e==xs.LOADED},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==ro.READY&&this.changed()},e.prototype.scheduleExpireCache=function(t,e){if(e.canExpireCache()){var i=function(t,e,i){var r=o(t);r in i.usedTiles&&t.expireCache(i.viewState.projection,i.usedTiles[r])}.bind(null,e);t.postRenderFunctions.push(i)}},e.prototype.updateUsedTiles=function(t,e,i,r){var n=o(e),s=i.toString();n in t?s in t[n]?t[n][s].extend(r):t[n][s]=r:(t[n]={},t[n][s]=r)},
e.prototype.manageTilePyramid=function(t,e,i,r,n,s,a,h,l,u){var p=o(e);p in t.wantedTiles||(t.wantedTiles[p]={});var c,d,f,_,g,y,v=t.wantedTiles[p],m=t.tileQueue;for(y=i.getMinZoom();y<=a;++y)for(d=i.getTileRangeForExtentAndZ(s,y,d),f=i.getResolution(y),_=d.minX;_<=d.maxX;++_)for(g=d.minY;g<=d.maxY;++g)a-y<=h?((c=e.getTile(y,_,g,r,n)).getState()==On.IDLE&&(v[c.getKey()]=!0,m.isKeyQueued(c.getKey())||m.enqueue([c,p,i.getTileCoordCenter(c.tileCoord),f])),void 0!==l&&l.call(u,c)):e.useTile(y,_,g,n)},
e}(F),ta=function(t){function e(e){t.call(this,e),this.renderedResolution,this.transform_=[1,0,0,1,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clip=function(t,e,i){var r=e.pixelRatio,n=e.size[0]*r,o=e.size[1]*r,s=e.viewState.rotation,a=It(i),h=Lt(i),l=St(i),u=Et(i);De(e.coordinateToPixelTransform,a),De(e.coordinateToPixelTransform,h),De(e.coordinateToPixelTransform,l),De(e.coordinateToPixelTransform,u),t.save(),ks(t,-s,n/2,o/2),t.beginPath(),
t.moveTo(a[0]*r,a[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(),ks(t,s,n/2,o/2)},e.prototype.dispatchComposeEvent_=function(t,e,i,r){var n=this.getLayer();if(n.hasListener(t)){var o=i.size[0]*i.pixelRatio,s=i.size[1]*i.pixelRatio,a=i.viewState.rotation;ks(e,-a,o/2,s/2);var h=void 0!==r?r:this.getTransform(i,0),l=new Xs(e,i.pixelRatio,i.extent,h,i.viewState.rotation),u=new Cs(t,l,i,e,null);n.dispatchEvent(u),ks(e,a,o/2,s/2)}},e.prototype.forEachLayerAtCoordinate=
function(t,e,i,r,n){return this.forEachFeatureAtCoordinate(t,e,i,R)?r.call(n,this.getLayer(),null):void 0},e.prototype.postCompose=function(t,e,i,r){this.dispatchComposeEvent_(ur.POSTCOMPOSE,t,e,r)},e.prototype.preCompose=function(t,e,i){this.dispatchComposeEvent_(ur.PRECOMPOSE,t,e,i)},e.prototype.dispatchRenderEvent=function(t,e,i){this.dispatchComposeEvent_(ur.RENDER,t,e,i)},e.prototype.getTransform=function(t,e){var i=t.viewState,r=t.pixelRatio,n=r*t.size[0]/2,o=r*t.size[1]/2,s=r/i.resolution,
a=-s,h=-i.rotation,l=-i.center[0]+e,u=-i.center[1];return Ye(this.transform_,n,o,s,a,h,l,u)},e.prototype.composeFrame=function(t,e,i){r()},e.prototype.prepareFrame=function(t,e){return r()},e}($s),ea=function(t){function e(e){t.call(this,e),this.coordinateToCanvasPixelTransform=[1,0,0,1,0,0],this.hitCanvasContext_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.composeFrame=function(t,e,i){this.preCompose(i,t);var r=this.getImage();if(r){var n=
e.extent,o=void 0!==n&&!ot(n,t.extent)&&Pt(n,t.extent);o&&this.clip(i,t,n);var s=this.getImageTransform(),a=i.globalAlpha;i.globalAlpha=e.opacity;var h=s[4],l=s[5],u=r.width*s[0],p=r.height*s[3];u>=.5&&p>=.5&&i.drawImage(r,0,0,+r.width,+r.height,Math.round(h),Math.round(l),Math.round(u),Math.round(p)),i.globalAlpha=a,o&&i.restore()}this.postCompose(i,t,e)},e.prototype.getImage=function(){return r()},e.prototype.getImageTransform=function(){return r()},e.prototype.forEachLayerAtCoordinate=function(t,
e,i,r,n){if(this.getImage()){var o=De(this.coordinateToCanvasPixelTransform,t.slice());tr(o,e.viewState.resolution/this.renderedResolution),this.hitCanvasContext_||(this.hitCanvasContext_=Jn(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.getImage(),o[0],o[1],1,1,0,0,1,1);var s=this.hitCanvasContext_.getImageData(0,0,1,1).data;return s[3]>0?r.call(n,this.getLayer(),s):void 0}},e}(ta),ia=function(t){function e(i){if(t.call(this,i),this.image_=null,this.imageTransform_=
[1,0,0,1,0,0],this.skippedFeatures_=[],this.vectorRenderer_=null,i.getType()===Ss.VECTOR)for(var r=0,n=Js.length;r<n;++r){var o=Js[r];if(o!==e&&o.handles(i)){this.vectorRenderer_=new o(i);break}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.vectorRenderer_&&this.vectorRenderer_.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},
e.prototype.getImageTransform=function(){return this.imageTransform_},e.prototype.prepareFrame=function(t,e){var i,r=t.pixelRatio,n=t.size,o=t.viewState,s=o.center,a=o.resolution,h=this.getLayer().getSource(),l=t.viewHints,p=this.vectorRenderer_,c=t.extent;if(p||void 0===e.extent||(c=wt(c,e.extent)),!l[kn]&&!l[jn]&&!bt(c)){var d=o.projection,f=this.skippedFeatures_;if(p){var _=p.context,g=u({},t,{size:[Ot(c)/a,Rt(c)/a],viewState:u({},t.viewState,{rotation:0})}),y=Object.keys(g.skippedFeatureUids).sort();
i=new Es(c,a,r,_.canvas,function(t){!p.prepareFrame(g,e)||!p.replayGroupChanged&&Z(f,y)||(_.canvas.width=g.size[0]*r,_.canvas.height=g.size[1]*r,p.compose(_,g,e),f=y,t())})}else i=h.getImage(c,a,r,d);i&&this.loadImage(i)&&(this.image_=i,this.skippedFeatures_=f)}if(this.image_){var v=(i=this.image_).getExtent(),m=i.getResolution(),x=i.getPixelRatio(),E=r*m/(a*x),S=Ye(this.imageTransform_,r*n[0]/2,r*n[1]/2,E,E,0,x*(v[0]-s[0])/m,x*(s[1]-v[3])/m);Ye(this.coordinateToCanvasPixelTransform,r*n[0]/2-S[4],
r*n[1]/2-S[5],r/a,-r/a,0,-s[0],-s[1]),this.renderedResolution=m*r/x}return!!this.image_},e.prototype.forEachFeatureAtCoordinate=function(e,i,r,n){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,i,r,n):t.prototype.forEachFeatureAtCoordinate.call(this,e,i,r,n)},e}(ea);ia.handles=function(t){return t.getType()===Ss.IMAGE||t.getType()===Ss.VECTOR&&t.getRenderMode()===Ts.IMAGE},ia.create=function(t,e){return new ia(e)};var ra=ia,na=function(t,e,i,r){this.minX=t,this.maxX=
e,this.minY=i,this.maxY=r};function oa(t,e,i,r,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=r,n):new na(t,e,i,r)}na.prototype.contains=function(t){return this.containsXY(t[1],t[2])},na.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},na.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},na.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==
t.maxX&&this.maxY==t.maxY},na.prototype.extend=function(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)},na.prototype.getHeight=function(){return this.maxY-this.minY+1},na.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},na.prototype.getWidth=function(){return this.maxX-this.minX+1},na.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=
t.maxY&&this.maxY>=t.minY};var sa=na,aa=function(t){function e(e,i){t.call(this,e),this.context=i?null:Jn(),this.oversampling_,this.renderedExtent_=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new sa(0,0,0,0),this.imageTransform_=[1,0,0,1,0,0],this.zDirection=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isDrawableTile_=function(t){var e=this.getLayer(),i=t.getState(),
r=e.getUseInterimTilesOnError();return i==On.LOADED||i==On.EMPTY||i==On.ERROR&&!r},e.prototype.getTile=function(t,e,i,r,n){var o=this.getLayer(),s=o.getSource().getTile(t,e,i,r,n);return s.getState()==On.ERROR&&(o.getUseInterimTilesOnError()?o.getPreload()>0&&(this.newTiles_=!0):s.setState(On.LOADED)),this.isDrawableTile_(s)||(s=s.getInterimTile()),s},e.prototype.prepareFrame=function(t,e){var i=t.pixelRatio,r=t.size,n=t.viewState,s=n.projection,a=n.resolution,h=n.center,l=this.getLayer(),u=l.getSource(),
p=u.getRevision(),c=u.getTileGridForProjection(s),d=c.getZForResolution(a,this.zDirection),f=c.getResolution(d),_=Math.round(a/f)||1,g=t.extent;if(void 0!==e.extent&&(g=wt(g,e.extent)),bt(g))return!1;var y=c.getTileRangeForExtentAndZ(g,d),v=c.getTileRangeExtent(d,y),m=u.getTilePixelRatio(i),x={};x[d]={};var E,S,T,C=this.createLoadedTileFinder(u,s,x),R=t.viewHints,w=R[kn]||R[jn],I=this.tmpExtent,L=this.tmpTileRange_;for(this.newTiles_=!1,S=y.minX;S<=y.maxX;++S)for(T=y.minY;T<=y.maxY;++T)if(!(Date.now()-
t.time>16&&w)){if(E=this.getTile(d,S,T,i,s),this.isDrawableTile_(E)){var O=o(this);if(E.getState()==On.LOADED){x[d][E.tileCoord.toString()]=E;var P=E.inTransition(O);this.newTiles_||!P&&-1!==this.renderedTiles.indexOf(E)||(this.newTiles_=!0)}if(1===E.getAlpha(O,t.time))continue}var b=c.getTileCoordChildTileRange(E.tileCoord,L,I),M=!1;b&&(M=C(d+1,b)),M||c.forEachTileCoordParentTileRange(E.tileCoord,C,null,L,I)}var F=f*i/m*_;if(!(this.renderedResolution&&Date.now()-t.time>16&&w)&&(this.newTiles_||!this.renderedExtent_||
!ot(this.renderedExtent_,g)||this.renderedRevision!=p||_!=this.oversampling_||!w&&F!=this.renderedResolution)){var A=this.context;if(A){var N=u.getTilePixelSize(d,i,s),G=Math.round(y.getWidth()*N[0]/_),D=Math.round(y.getHeight()*N[1]/_),k=A.canvas;k.width!=G||k.height!=D?(this.oversampling_=_,k.width=G,k.height=D):(this.renderedExtent_&&!dt(v,this.renderedExtent_)&&A.clearRect(0,0,G,D),_=this.oversampling_)}this.renderedTiles.length=0;var j,U,Y,B,V,X,z,W,K,H,Z=Object.keys(x).map(Number);for(Z.sort(function(t,
e){return t===d?1:e===d?-1:t>e?1:t<e?-1:0}),B=0,V=Z.length;B<V;++B)for(var q in Y=Z[B],U=u.getTilePixelSize(Y,i,s),j=c.getResolution(Y)/f,z=m*u.getGutterForProjection(s),W=x[Y])E=W[q],S=((X=c.getTileCoordExtent(E.getTileCoord(),I))[0]-v[0])/f*m/_,T=(v[3]-X[3])/f*m/_,K=U[0]*j/_,H=U[1]*j/_,this.drawTileImage(E,t,e,S,T,K,H,z,d===Y),this.renderedTiles.push(E);this.renderedRevision=p,this.renderedResolution=f*i/m*_,this.renderedExtent_=v}var J=this.renderedResolution/a,Q=Ye(this.imageTransform_,i*r[0]/
2,i*r[1]/2,J,J,0,(this.renderedExtent_[0]-h[0])/this.renderedResolution*i,(h[1]-this.renderedExtent_[3])/this.renderedResolution*i);return Ye(this.coordinateToCanvasPixelTransform,i*r[0]/2-Q[4],i*r[1]/2-Q[5],i/a,-i/a,0,-h[0],-h[1]),this.updateUsedTiles(t.usedTiles,u,d,y),this.manageTilePyramid(t,u,c,i,s,g,d,l.getPreload()),this.scheduleExpireCache(t,u),this.renderedTiles.length>0},e.prototype.drawTileImage=function(t,e,i,r,n,s,a,h,l){var u=this.getTileImage(t);if(u){var p=o(this),c=l?t.getAlpha(p,
e.time):1,d=this.getLayer().getSource();1!==c||d.getOpaque(e.viewState.projection)||this.context.clearRect(r,n,s,a);var f=c!==this.context.globalAlpha;f&&(this.context.save(),this.context.globalAlpha=c),this.context.drawImage(u,h,h,u.width-2*h,u.height-2*h,r,n,s,a),f&&this.context.restore(),1!==c?e.animate=!0:l&&t.endTransition(p)}},e.prototype.getImage=function(){var t=this.context;return t?t.canvas:null},e.prototype.getImageTransform=function(){return this.imageTransform_},e.prototype.getTileImage=
function(t){return t.getImage()},e}(ea);aa.handles=function(t){return t.getType()===Ss.TILE},aa.create=function(t,e){return new aa(e)},aa.prototype.getLayer;var ha=aa,la=i(0),ua=i.n(la),pa=function(){};pa.prototype.getReplay=function(t,e){return r()},pa.prototype.isEmpty=function(){return r()},pa.prototype.addDeclutter=function(t){return r()};var ca=pa,da={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function fa(t,e,i,r,n,o,s,a){for(var h,
l,u,p=[],c=t[e]>t[i-r],d=n.length,f=t[e],_=t[e+1],g=t[e+=r],y=t[e+1],v=0,m=Math.sqrt(Math.pow(g-f,2)+Math.pow(y-_,2)),x="",E=0,S=0;S<d;++S){l=c?d-S-1:S;var T=n.charAt(l),C=o(x=c?T+x:x+T)-E;E+=C;for(var R=s+C/2;e<i-r&&v+m<R;)f=g,_=y,g=t[e+=r],y=t[e+1],v+=m,m=Math.sqrt(Math.pow(g-f,2)+Math.pow(y-_,2));var w=R-v,I=Math.atan2(y-_,g-f);if(c&&(I+=I>0?-Math.PI:Math.PI),void 0!==u){var L=I-u;if(L+=L>Math.PI?-2*Math.PI:L<-Math.PI?2*Math.PI:0,Math.abs(L)>a)return null}var O=w/m,P=zt(f,g,O),b=zt(_,y,O);u==I?
(c&&(h[0]=P,h[1]=b,h[2]=C/2),h[4]=x):(E=C,h=[P,b,C/2,I,x=T],c?p.unshift(h):p.push(h),u=I),s+=C}return p}var _a={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},ga=[_a.FILL],ya=[_a.STROKE],va=[_a.BEGIN_PATH],ma=[_a.CLOSE_PATH],xa=_a,Ea=[da.POLYGON,da.CIRCLE,da.LINE_STRING,da.IMAGE,da.TEXT,da.DEFAULT],Sa={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,
ideographic:.8,bottom:1},Ta=[1/0,1/0,-1/0,-1/0],Ca=[1,0,0,1,0,0],Ra=function(t){function e(e,i,r,n,o,s){t.call(this),this.declutterTree=s,this.tolerance=e,this.maxExtent=i,this.overlaps=o,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=r,this.alignFill_,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=[],this.pixelCoordinates_=
null,this.state={},this.viewRotation_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replayTextBackground_=function(t,e,i,r,n,o,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),o&&(this.alignFill_=o[2],this.fill_(t)),s&&(this.setStrokeStyle_(t,s),t.stroke())},e.prototype.replayImage_=function(t,e,i,r,n,o,s,a,h,l,u,p,c,d,f,_,g,y){var v=g||y;e-=n*=c,i-=o*=c;var m,x,E,S,T=
f+l>r.width?r.width-l:f,C=a+u>r.height?r.height-u:a,R=_[3]+T*c+_[1],w=_[0]+C*c+_[2],I=e-_[3],L=i-_[0];(v||0!==p)&&(m=[I,L],x=[I+R,L],E=[I+R,L+w],S=[I,L+w]);var O=null;if(0!==p){var P=e+n,b=i+o;O=Ye(Ca,P,b,1,1,p,-P,-b),ut(Ta),_t(Ta,De(Ca,m)),_t(Ta,De(Ca,x)),_t(Ta,De(Ca,E)),_t(Ta,De(Ca,S))}else lt(I,L,I+R,L+w,Ta);var M=t.canvas,F=y?y[2]*c/2:0,A=Ta[0]-F<=M.width&&Ta[2]+F>=0&&Ta[1]-F<=M.height&&Ta[3]+F>=0;if(d&&(e=Math.round(e),i=Math.round(i)),s){if(!A&&1==s[4])return;ft(s,Ta);var N=A?[t,O?O.slice(0):
null,h,r,l,u,T,C,e,i,c]:null;N&&v&&N.push(g,y,m,x,E,S),s.push(N)}else A&&(v&&this.replayTextBackground_(t,m,x,E,S,g,y),Us(t,O,h,r,l,u,T,C,e,i,c))},e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})},e.prototype.appendFlatCoordinates=function(t,e,i,r,n,o){var s=this.coordinates.length,a=this.getBufferedMaxExtent();o&&(e+=r);var h,l,u,p=[t[e],t[e+1]],c=[NaN,NaN],d=!0;for(h=e+r;h<i;h+=r)c[0]=t[h],c[1]=t[h+1],(u=at(a,c))!==l?(d&&(this.coordinates[s++]=
p[0],this.coordinates[s++]=p[1]),this.coordinates[s++]=c[0],this.coordinates[s++]=c[1],d=!1):u===$.INTERSECTING?(this.coordinates[s++]=c[0],this.coordinates[s++]=c[1],d=!1):d=!0,p[0]=c[0],p[1]=c[1],l=u;return(n&&d||h===e+r)&&(this.coordinates[s++]=p[0],this.coordinates[s++]=p[1]),s},e.prototype.drawCustomCoordinates_=function(t,e,i,r,n){for(var o=0,s=i.length;o<s;++o){var a=i[o],h=this.appendFlatCoordinates(t,e,a,r,!1,!1);n.push(h),e=a}return e},e.prototype.drawCustom=function(t,e,i){this.beginGeometry(t,
e);var r,n,o,s,a,h=t.getType(),l=t.getStride(),u=this.coordinates.length;if(h==Nt.MULTI_POLYGON){r=(t=t).getOrientedFlatCoordinates(),s=[];var p=t.getEndss();a=0;for(var c=0,d=p.length;c<d;++c){var f=[];a=this.drawCustomCoordinates_(r,a,p[c],l,f),s.push(f)}this.instructions.push([xa.CUSTOM,u,s,t,i,oi])}else h==Nt.POLYGON||h==Nt.MULTI_LINE_STRING?(o=[],r=h==Nt.POLYGON?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),a=this.drawCustomCoordinates_(r,0,t.getEnds(),l,o),this.instructions.push([xa.CUSTOM,
u,o,t,i,ni])):h==Nt.LINE_STRING||h==Nt.MULTI_POINT?(r=t.getFlatCoordinates(),n=this.appendFlatCoordinates(r,0,r.length,l,!1,!1),this.instructions.push([xa.CUSTOM,u,n,t,i,ri])):h==Nt.POINT&&(r=t.getFlatCoordinates(),this.coordinates.push(r[0],r[1]),n=this.coordinates.length,this.instructions.push([xa.CUSTOM,u,n,t,i]));this.endGeometry(t,e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[xa.BEGIN_GEOMETRY,e,0],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=
[xa.BEGIN_GEOMETRY,e,0],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){},e.prototype.fill_=function(t){if(this.alignFill_){var e=De(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.setTransform.apply(t,js)},e.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],ki&&(t.lineDashOffset=e[7],
t.setLineDash(e[6]))},e.prototype.renderDeclutter_=function(t,e){if(t&&t.length>5){var i=t[4];if(1==i||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);for(var n=5,o=t.length;n<o;++n){var s=t[n];s&&(s.length>11&&this.replayTextBackground_(s[0],s[13],s[14],s[15],s[16],s[11],s[12]),Us.apply(void 0,s))}}t.length=5,ut(t)}}},e.prototype.replay_=function(t,e,i,r,n,s,a){var h;this.pixelCoordinates_&&Z(e,this.renderedTransform_)?
h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Gt(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),Ge(this.renderedTransform_,e));for(var l,u,p,c,f,_,g,y,v,m,x,E,S=!d(i),T=0,C=r.length,R=0,w=0,I=0,L=null,O=null,P=this.coordinateCache_,b=this.viewRotation_,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:b},F=this.instructions!=r||this.overlaps?0:200;T<C;){var A=r[T];switch(A[0]){case xa.BEGIN_GEOMETRY:m=A[1],S&&i[o(m)]||
!m.getGeometry()?T=A[2]:void 0===a||Pt(a,m.getGeometry().getExtent())?++T:T=A[2]+1;break;case xa.BEGIN_PATH:w>F&&(this.fill_(t),w=0),I>F&&(t.stroke(),I=0),w||I||(t.beginPath(),c=f=NaN),++T;break;case xa.CIRCLE:var N=h[R=A[1]],G=h[R+1],D=h[R+2]-N,k=h[R+3]-G,j=Math.sqrt(D*D+k*k);t.moveTo(N+j,G),t.arc(N,G,j,0,2*Math.PI,!0),++T;break;case xa.CLOSE_PATH:t.closePath(),++T;break;case xa.CUSTOM:R=A[1],l=A[2];var U=A[3],Y=A[4],B=6==A.length?A[5]:void 0;M.geometry=U,M.feature=m,T in P||(P[T]=[]);var V=P[T];
B?B(h,R,l,2,V):(V[0]=h[R],V[1]=h[R+1],V.length=2),Y(V,M),++T;break;case xa.DRAW_IMAGE:R=A[1],l=A[2],v=A[3],u=A[4],p=A[5],y=s?null:A[6];var X=A[7],z=A[8],W=A[9],K=A[10],H=A[11],q=A[12],J=A[13],Q=A[14],$=void 0,tt=void 0,et=void 0;for(A.length>16?($=A[15],tt=A[16],et=A[17]):($=Os,tt=et=!1),H&&(q+=b);R<l;R+=2)this.replayImage_(t,h[R],h[R+1],v,u,p,y,X,z,W,K,q,J,n,Q,$,tt?L:null,et?O:null);this.renderDeclutter_(y,m),++T;break;case xa.DRAW_CHARS:var it=A[1],rt=A[2],nt=A[3];y=s?null:A[4];var ot=A[5],st=A[6],
at=A[7],ht=A[8],lt=A[9],ut=A[10],pt=A[11],ct=A[12],dt=A[13],ft=A[14],_t=ar(h,it,rt,2),gt=ht(ct);if(ot||gt<=_t){var yt=this,vt=yt.textStates[dt].textAlign,mt=fa(h,it,rt,2,ct,ht,(_t-gt)*Sa[vt],at);if(mt){var xt=void 0,Et=void 0,St=void 0,Tt=void 0,Ct=void 0;if(ut)for(xt=0,Et=mt.length;xt<Et;++xt)St=(Ct=mt[xt])[4],Tt=yt.getImage(St,dt,"",ut),u=Ct[2]+pt,p=nt*Tt.height+2*(.5-nt)*pt-lt,this.replayImage_(t,Ct[0],Ct[1],Tt,u,p,y,Tt.height,1,0,0,Ct[3],ft,!1,Tt.width,Os,null,null);if(st)for(xt=0,Et=mt.length;xt<
Et;++xt)St=(Ct=mt[xt])[4],Tt=yt.getImage(St,dt,st,""),u=Ct[2],p=nt*Tt.height-lt,this.replayImage_(t,Ct[0],Ct[1],Tt,u,p,y,Tt.height,1,0,0,Ct[3],ft,!1,Tt.width,Os,null,null)}}this.renderDeclutter_(y,m),++T;break;case xa.END_GEOMETRY:if(void 0!==s){var Rt=s(m=A[1]);if(Rt)return Rt}++T;break;case xa.FILL:F?w++:this.fill_(t),++T;break;case xa.MOVE_TO_LINE_TO:for(R=A[1],l=A[2],x=h[R],g=(E=h[R+1])+.5|0,(_=x+.5|0)===c&&g===f||(t.moveTo(x,E),c=_,f=g),R+=2;R<l;R+=2)_=(x=h[R])+.5|0,g=(E=h[R+1])+.5|0,R!=l-2&&
_===c&&g===f||(t.lineTo(x,E),c=_,f=g);++T;break;case xa.SET_FILL_STYLE:L=A,this.alignFill_=A[2],w&&(this.fill_(t),w=0,I&&(t.stroke(),I=0)),t.fillStyle=A[1],++T;break;case xa.SET_STROKE_STYLE:O=A,I&&(t.stroke(),I=0),this.setStrokeStyle_(t,A),++T;break;case xa.STROKE:F?I++:t.stroke(),++T;break;default:++T}}w&&this.fill_(t),I&&t.stroke()},e.prototype.replay=function(t,e,i,r,n){this.viewRotation_=i,this.replay_(t,e,r,this.instructions,n,void 0,void 0)},e.prototype.replayHitDetection=function(t,e,i,r,
n,o){return this.viewRotation_=i,this.replay_(t,e,r,this.hitDetectionInstructions,!0,n,o)},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var i,r,n=e.length,o=-1;for(t=0;t<n;++t)(r=(i=e[t])[0])==xa.END_GEOMETRY?o=t:r==xa.BEGIN_GEOMETRY&&(i[2]=t,W(this.hitDetectionInstructions,o,t),o=-1)},e.prototype.setFillStrokeStyle=function(t,e){var i=this.state;if(t){var r=t.getColor();i.fillStyle=Ys(r||ws)}else i.fillStyle=void 0;if(e){var n=e.getColor();
i.strokeStyle=Ys(n||Ls);var o=e.getLineCap();i.lineCap=void 0!==o?o:"round";var s=e.getLineDash();i.lineDash=s?s.slice():Is;var a=e.getLineDashOffset();i.lineDashOffset=a||0;var h=e.getLineJoin();i.lineJoin=void 0!==h?h:"round";var l=e.getWidth();i.lineWidth=void 0!==l?l:1;var u=e.getMiterLimit();i.miterLimit=void 0!==u?u:10,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,
i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t,e){var i=t.fillStyle,r=[xa.SET_FILL_STYLE,i];return"string"!=typeof i&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[xa.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,
e,i){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t,i)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,r=t.lineCap,n=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=r||n!=t.currentLineDash&&!Z(t.currentLineDash,n)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,
t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=n,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=a,t.currentMiterLimit=h)},e.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=[xa.END_GEOMETRY,e];this.instructions.push(i),this.hitDetectionInstructions.push(i)},e.prototype.getBufferedMaxExtent=
function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=it(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;et(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Vs),wa=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s),this.declutterGroup_=null,this.hitDetectionImage_=null,this.image_=null,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,
this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){return this.appendFlatCoordinates(t,e,i,r,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),r=t.getStride(),n=this.coordinates.length,o=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([xa.DRAW_IMAGE,
n,o,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.width_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,n,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(t,e)}},e.prototype.drawMultiPoint=function(t,
e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),r=t.getStride(),n=this.coordinates.length,o=this.drawCoordinates_(i,0,i.length,r);this.instructions.push([xa.DRAW_IMAGE,n,o,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.width_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,n,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroup_,
this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(t,e)}},e.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0},e.prototype.setImageStyle=function(t,
e){var i=t.getAnchor(),r=t.getSize(),n=t.getHitDetectionImage(1),o=t.getImage(1),s=t.getOrigin();this.anchorX_=i[0],this.anchorY_=i[1],this.declutterGroup_=e,this.hitDetectionImage_=n,this.image_=o,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.width_=r[0]},e}(Ra),Ia=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s)}return t&&(e.__proto__=t),e.prototype=
Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawFlatCoordinates_=function(t,e,i,r){var n=this.coordinates.length,o=this.appendFlatCoordinates(t,e,i,r,!1,!1),s=[xa.MOVE_TO_LINE_TO,n,o];return this.instructions.push(s),this.hitDetectionInstructions.push(s),i},e.prototype.drawLineString=function(t,e){var i=this.state,r=i.strokeStyle,n=i.lineWidth;if(void 0!==r&&void 0!==n){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,
i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],va);var o=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(ya),this.endGeometry(t,e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,r=i.strokeStyle,n=i.lineWidth;if(void 0!==r&&void 0!==n){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,
i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],va);for(var o=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),h=0,l=0,u=o.length;l<u;++l)h=this.drawFlatCoordinates_(s,h,o[l],a);this.hitDetectionInstructions.push(ya),this.endGeometry(t,e)}},e.prototype.finish=function(){var t=this.state;void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ya),this.reverseHitDetectionInstructions(),this.state=null},e.prototype.applyStroke=function(e){void 0!=e.lastStroke&&
e.lastStroke!=this.coordinates.length&&(this.instructions.push(ya),e.lastStroke=this.coordinates.length),e.lastStroke=0,t.prototype.applyStroke.call(this,e),this.instructions.push(va)},e}(Ra),La=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawFlatCoordinatess_=function(t,e,i,r){var n=this.state,o=void 0!==n.fillStyle,s=void 0!=n.strokeStyle,a=i.length;this.instructions.push(va),
this.hitDetectionInstructions.push(va);for(var h=0;h<a;++h){var l=i[h],u=this.coordinates.length,p=this.appendFlatCoordinates(t,e,l,r,!0,!s),c=[xa.MOVE_TO_LINE_TO,u,p];this.instructions.push(c),this.hitDetectionInstructions.push(c),s&&(this.instructions.push(ma),this.hitDetectionInstructions.push(ma)),e=l}return o&&(this.instructions.push(ga),this.hitDetectionInstructions.push(ga)),s&&(this.instructions.push(ya),this.hitDetectionInstructions.push(ya)),e},e.prototype.drawCircle=function(t,e){var i=
this.state,r=i.fillStyle,n=i.strokeStyle;if(void 0!==r||void 0!==n){this.setFillStrokeStyles_(t),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([xa.SET_FILL_STYLE,dr(ws)]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);var o=t.getFlatCoordinates(),s=t.getStride(),a=this.coordinates.length;this.appendFlatCoordinates(o,0,o.length,s,!1,!1);var h=
[xa.CIRCLE,a];this.instructions.push(va,h),this.hitDetectionInstructions.push(va,h),this.hitDetectionInstructions.push(ga),void 0!==i.fillStyle&&this.instructions.push(ga),void 0!==i.strokeStyle&&(this.instructions.push(ya),this.hitDetectionInstructions.push(ya)),this.endGeometry(t,e)}},e.prototype.drawPolygon=function(t,e){var i=this.state,r=i.fillStyle,n=i.strokeStyle;if(void 0!==r||void 0!==n){this.setFillStrokeStyles_(t),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([xa.SET_FILL_STYLE,
dr(ws)]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);var o=t.getEnds(),s=t.getOrientedFlatCoordinates(),a=t.getStride();this.drawFlatCoordinatess_(s,0,o,a),this.endGeometry(t,e)}},e.prototype.drawMultiPolygon=function(t,e){var i=this.state,r=i.fillStyle,n=i.strokeStyle;if(void 0!==r||void 0!==n){this.setFillStrokeStyles_(t),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([xa.SET_FILL_STYLE,
dr(ws)]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);for(var o=t.getEndss(),s=t.getOrientedFlatCoordinates(),a=t.getStride(),h=0,l=0,u=o.length;l<u;++l)h=this.drawFlatCoordinatess_(s,h,o[l],a);this.endGeometry(t,e)}},e.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var t=this.tolerance;if(0!==t)for(var e=this.coordinates,i=0,r=e.length;i<
r;++i)e[i]=hi(e[i],t)},e.prototype.setFillStrokeStyles_=function(t){var e=this.state;void 0!==e.fillStyle&&this.updateFillStyle(e,this.createFill,t),void 0!==e.strokeStyle&&this.updateStrokeStyle(e,this.applyStroke)},e}(Ra);function Oa(t,e,i,r,n){var o,s,a,h,l,u,p,c,d,f=i,_=i,g=0,y=0,v=i;for(o=i;o<r;o+=n){var m=e[o],x=e[o+1];void 0!==h&&(c=m-h,d=x-l,a=Math.sqrt(c*c+d*d),void 0!==u&&(y+=s,Math.acos((u*c+p*d)/(s*a))>t&&(y>g&&(g=y,f=v,_=o),y=0,v=o-n)),s=a,u=c,p=d),h=m,l=x}return(y+=a)>g?[v,o]:[f,_]}
var Pa={Circle:La,Default:Ra,Image:wa,LineString:Ia,Polygon:La,Text:function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,n,o,s),this.declutterGroup_,this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,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_={},Ps.prune()}return t&&(e.__proto__=
t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawText=function(t,e){var i=this.textFillState_,r=this.textStrokeState_,n=this.textState_;if(""!==this.text_&&n&&(i||r)){var o,s,a=this.coordinates.length,h=t.getType(),l=null,u=2,p=2;if(n.placement===Tr){if(!Pt(this.getBufferedMaxExtent(),t.getExtent()))return;var c;if(l=t.getFlatCoordinates(),p=t.getStride(),h==Nt.LINE_STRING)c=[l.length];else if(h==Nt.MULTI_LINE_STRING)c=t.getEnds();else if(h==Nt.POLYGON)c=t.getEnds().slice(0,
1);else if(h==Nt.MULTI_POLYGON){var d=t.getEndss();for(c=[],o=0,s=d.length;o<s;++o)c.push(d[o][0])}this.beginGeometry(t,e);for(var f,_=n.textAlign,g=0,y=0,v=c.length;y<v;++y){if(void 0==_){var m=Oa(n.maxAngle,l,g,c[y],p);g=m[0],f=m[1]}else f=c[y];for(o=g;o<f;o+=p)this.coordinates.push(l[o],l[o+1]);u=this.coordinates.length,g=c[y],this.drawChars_(a,u,this.declutterGroup_),a=u}this.endGeometry(t,e)}else{var x=this.getImage(this.text_,this.textKey_,this.fillKey_,this.strokeKey_),E=x.width/this.pixelRatio;
switch(h){case Nt.POINT:case Nt.MULTI_POINT:u=(l=t.getFlatCoordinates()).length;break;case Nt.LINE_STRING:l=t.getFlatMidpoint();break;case Nt.CIRCLE:l=t.getCenter();break;case Nt.MULTI_LINE_STRING:u=(l=t.getFlatMidpoints()).length;break;case Nt.POLYGON:if(l=t.getFlatInteriorPoint(),!n.overflow&&l[2]/this.resolution<E)return;p=3;break;case Nt.MULTI_POLYGON:var S=t.getFlatInteriorPoints();for(l=[],o=0,s=S.length;o<s;o+=3)(n.overflow||S[o+2]/this.resolution>=E)&&l.push(S[o],S[o+1]);if(0==(u=l.length))return}u=
this.appendFlatCoordinates(l,0,u,p,!1,!1),(n.backgroundFill||n.backgroundStroke)&&(this.setFillStrokeStyle(n.backgroundFill,n.backgroundStroke),n.backgroundFill&&(this.updateFillStyle(this.state,this.createFill,t),this.hitDetectionInstructions.push(this.createFill(this.state,t))),n.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e),this.drawTextImage_(x,a,u),this.endGeometry(t,e)}}},e.prototype.getImage=
function(t,e,i,r){var n,o=r+e+t+i+this.pixelRatio;if(!Ps.containsKey(o)){var s=r?this.strokeStates[r]||this.textStrokeState_:null,a=i?this.fillStates[i]||this.textFillState_:null,h=this.textStates[e]||this.textState_,l=this.pixelRatio,u=h.scale*l,p=Sa[h.textAlign||"center"],c=r&&s.lineWidth?s.lineWidth:0,d=t.split("\n"),f=d.length,_=[],g=function(t,e,i){for(var r=e.length,n=0,o=0;o<r;++o){var s=Ds(t,e[o]);n=Math.max(n,s),i.push(s)}return n}(h.font,d,_),y=Gs(h.font),v=y*f,m=g+c,x=Jn(Math.ceil(m*u),
Math.ceil((v+c)*u));n=x.canvas,Ps.set(o,n),1!=u&&x.scale(u,u),x.font=h.font,r&&(x.strokeStyle=s.strokeStyle,x.lineWidth=c,x.lineCap=s.lineCap,x.lineJoin=s.lineJoin,x.miterLimit=s.miterLimit,ki&&s.lineDash.length&&(x.setLineDash(s.lineDash),x.lineDashOffset=s.lineDashOffset)),i&&(x.fillStyle=a.fillStyle),x.textBaseline="middle",x.textAlign="center";var E,S=.5-p,T=p*n.width/u+S*c;if(r)for(E=0;E<f;++E)x.strokeText(d[E],T+S*_[E],.5*(c+y)+E*y);if(i)for(E=0;E<f;++E)x.fillText(d[E],T+S*_[E],.5*(c+y)+E*y)}return Ps.get(o)},
e.prototype.drawTextImage_=function(t,e,i){var r=this.textState_,n=this.textStrokeState_,o=this.pixelRatio,s=Sa[r.textAlign||"center"],a=Sa[r.textBaseline],h=n&&n.lineWidth?n.lineWidth:0,l=s*t.width/o+2*(.5-s)*h,u=a*t.height/o+2*(.5-a)*h;this.instructions.push([xa.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*o,(u-this.textOffsetY_)*o,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1,t.width,r.padding==Os?Os:r.padding.map(function(t){return t*o}),!!r.backgroundFill,!!r.backgroundStroke]),
this.hitDetectionInstructions.push([xa.DRAW_IMAGE,e,i,t,(l-this.textOffsetX_)*o,(u-this.textOffsetY_)*o,this.declutterGroup_,t.height,1,0,0,this.textRotateWithView_,this.textRotation_,1/o,t.width,r.padding,!!r.backgroundFill,!!r.backgroundStroke])},e.prototype.drawChars_=function(t,e,i){var r=this.textStrokeState_,n=this.textState_,o=this.textFillState_,s=this.strokeKey_;r&&(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 a=this.textKey_;this.textKey_ in this.textStates||(this.textStates[this.textKey_]={font:n.font,textAlign:n.textAlign||"center",scale:n.scale});var h=this.fillKey_;o&&(h in this.fillStates||(this.fillStates[h]={fillStyle:o.fillStyle}));var l=this.pixelRatio,u=Sa[n.textBaseline],p=this.textOffsetY_*l,c=this.text_,d=n.font,f=n.scale,_=r?r.lineWidth*f/2:0,g=this.widths_[d];g||(this.widths_[d]=g={}),this.instructions.push([xa.DRAW_CHARS,
t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=g[t];return e||(e=g[t]=Ds(d,t)),e*f*l},p,s,_*l,c,a,1]),this.hitDetectionInstructions.push([xa.DRAW_CHARS,t,e,u,i,n.overflow,h,n.maxAngle,function(t){var e=g[t];return e||(e=g[t]=Ds(d,t)),e*f},p,s,_,c,a,1/l])},e.prototype.setTextStyle=function(t,e){var i,r,n;if(t){this.declutterGroup_=e;var s=t.getFill();s?((r=this.textFillState_)||(r=this.textFillState_={}),r.fillStyle=Ys(s.getColor()||ws)):r=this.textFillState_=null;var a=t.getStroke();if(a){(n=this.textStrokeState_)||
(n=this.textStrokeState_={});var h=a.getLineDash(),l=a.getLineDashOffset(),u=a.getWidth(),p=a.getMiterLimit();n.lineCap=a.getLineCap()||"round",n.lineDash=h?h.slice():Is,n.lineDashOffset=void 0===l?0:l,n.lineJoin=a.getLineJoin()||"round",n.lineWidth=void 0===u?1:u,n.miterLimit=void 0===p?10:p,n.strokeStyle=Ys(a.getColor()||Ls)}else n=this.textStrokeState_=null;i=this.textState_;var c=t.getFont()||"10px sans-serif";As(c);var d=t.getScale();i.overflow=t.getOverflow(),i.font=c,i.maxAngle=t.getMaxAngle(),
i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.textBaseline=t.getTextBaseline()||"middle",i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Os,i.scale=void 0===d?1:d;var f=t.getOffsetX(),_=t.getOffsetY(),g=t.getRotateWithView(),y=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===f?0:f,this.textOffsetY_=void 0===_?0:_,this.textRotateWithView_=void 0!==g&&g,this.textRotation_=void 0===y?0:y,this.strokeKey_=n?
("string"==typeof n.strokeStyle?n.strokeStyle:o(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?"string"==typeof r.fillStyle?r.fillStyle:"|"+o(r.fillStyle):""}else this.text_=""},e}(Ra)},ba=function(t){function e(e,i,r,n,o,s,a){t.call(this),this.declutterTree_=s,this.declutterGroup_=null,this.tolerance_=e,this.maxExtent_=i,this.overlaps_=o,this.pixelRatio_=n,this.resolution_=
r,this.renderBuffer_=a,this.replaysByZIndex_={},this.hitDetectionContext_=Jn(1,1),this.hitDetectionTransform_=[1,0,0,1,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addDeclutter=function(t){var e=null;return this.declutterTree_&&(t?(e=this.declutterGroup_)[4]++:(e=this.declutterGroup_=[1/0,1/0,-1/0,-1/0]).push(1)),e},e.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()},e.prototype.hasReplays=function(t){for(var e in this.replaysByZIndex_)for(var i=this.replaysByZIndex_[e],r=0,n=t.length;r<n;++r)if(t[r]in i)return!0;return!1},e.prototype.finish=function(){for(var t in this.replaysByZIndex_){var e=this.replaysByZIndex_[t];for(var i in e)e[i].finish()}},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,o,s){var a,h=2*(r=Math.round(r))+1,l=Ye(this.hitDetectionTransform_,r+.5,r+.5,1/e,-1/e,-i,-t[0],-t[1]),u=this.hitDetectionContext_;
u.canvas.width!==h||u.canvas.height!==h?(u.canvas.width=h,u.canvas.height=h):u.clearRect(0,0,h,h),void 0!==this.renderBuffer_&&(_t(a=[1/0,1/0,-1/0,-1/0],t),et(a,e*(this.renderBuffer_+r),a));var p,c,d=function(t){if(void 0!==Ma[t])return Ma[t];for(var e=2*t+1,i=new Array(e),r=0;r<e;r++)i[r]=new Array(e);var n=t,o=0,s=0;for(;n>=o;)Fa(i,t+n,t+o),Fa(i,t+o,t+n),Fa(i,t-o,t+n),Fa(i,t-n,t+o),Fa(i,t-n,t-o),Fa(i,t-o,t-n),Fa(i,t+o,t-n),Fa(i,t+n,t-o),2*((s+=1+2*++o)-n)+1>0&&(s+=1-2*(n-=1));return Ma[t]=i,i}(r);
function f(t){for(var e=u.getImageData(0,0,h,h).data,i=0;i<h;i++)for(var r=0;r<h;r++)if(d[i][r]&&e[4*(r*h+i)+3]>0){var n=void 0;return(!p||c!=da.IMAGE&&c!=da.TEXT||-1!==p.indexOf(t))&&(n=o(t)),n||void u.clearRect(0,0,h,h)}}this.declutterTree_&&(p=this.declutterTree_.all().map(function(t){return t.value}));var _,g,y,v,m,x=Object.keys(this.replaysByZIndex_).map(Number);for(x.sort(V),_=x.length-1;_>=0;--_){var E=x[_].toString();for(y=this.replaysByZIndex_[E],g=Ea.length-1;g>=0;--g)if(void 0!==(v=y[c=
Ea[g]]))if(!s||c!=da.IMAGE&&c!=da.TEXT){if(m=v.replayHitDetection(u,l,i,n,f,a))return m}else{var S=s[E];S?S.push(v,l.slice(0)):s[E]=[v,l.slice(0)]}}},e.prototype.getClipCoords=function(t){var e=this.maxExtent_,i=e[0],r=e[1],n=e[2],o=e[3],s=[i,r,i,o,n,o,n,r];return Gt(s,0,8,2,t,s),s},e.prototype.getReplay=function(t,e){var i=void 0!==t?t.toString():"0",r=this.replaysByZIndex_[i];void 0===r&&(r={},this.replaysByZIndex_[i]=r);var n=r[e];void 0===n&&(n=new (0,Pa[e])(this.tolerance_,this.maxExtent_,this.resolution_,
this.pixelRatio_,this.overlaps_,this.declutterTree_),r[e]=n);return n},e.prototype.getReplays=function(){return this.replaysByZIndex_},e.prototype.isEmpty=function(){return d(this.replaysByZIndex_)},e.prototype.replay=function(t,e,i,r,n,o,s){var a=Object.keys(this.replaysByZIndex_).map(Number);a.sort(V),t.save(),this.clip(t,e);var h,l,u,p,c,d,f=o||Ea;for(h=0,l=a.length;h<l;++h){var _=a[h].toString();for(c=this.replaysByZIndex_[_],u=0,p=f.length;u<p;++u){var g=f[u];if(d=c[g],void 0!==d)if(!s||g!=da.IMAGE&&
g!=da.TEXT)d.replay(t,e,i,r,n);else{var y=s[_];y?y.push(d,e.slice(0)):s[_]=[d,e.slice(0)]}}}t.restore()},e}(ca),Ma={0:[[!0]]};function Fa(t,e,i){var r,n=Math.floor(t.length/2);if(e>=n)for(r=n;r<e;r++)t[r][i]=!0;else if(e<n)for(r=e+1;r<n;r++)t[r][i]=!0}var Aa=ba,Na=.5,Ga={Point:function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=xs.LOADED)return;var o=t.getReplay(i.getZIndex(),da.IMAGE);o.setImageStyle(n,t.addDeclutter(!1)),o.drawPoint(e,r)}var s=i.getText();if(s){var a=t.getReplay(i.getZIndex(),
da.TEXT);a.setTextStyle(s,t.addDeclutter(!!n)),a.drawText(e,r)}},LineString:function(t,e,i,r){var n=i.getStroke();if(n){var o=t.getReplay(i.getZIndex(),da.LINE_STRING);o.setFillStrokeStyle(null,n),o.drawLineString(e,r)}var s=i.getText();if(s){var a=t.getReplay(i.getZIndex(),da.TEXT);a.setTextStyle(s,t.addDeclutter(!1)),a.drawText(e,r)}},Polygon:function(t,e,i,r){var n=i.getFill(),o=i.getStroke();if(n||o){var s=t.getReplay(i.getZIndex(),da.POLYGON);s.setFillStrokeStyle(n,o),s.drawPolygon(e,r)}var a=
i.getText();if(a){var h=t.getReplay(i.getZIndex(),da.TEXT);h.setTextStyle(a,t.addDeclutter(!1)),h.drawText(e,r)}},MultiPoint:function(t,e,i,r){var n=i.getImage();if(n){if(n.getImageState()!=xs.LOADED)return;var o=t.getReplay(i.getZIndex(),da.IMAGE);o.setImageStyle(n,t.addDeclutter(!1)),o.drawMultiPoint(e,r)}var s=i.getText();if(s){var a=t.getReplay(i.getZIndex(),da.TEXT);a.setTextStyle(s,t.addDeclutter(!!n)),a.drawText(e,r)}},MultiLineString:function(t,e,i,r){var n=i.getStroke();if(n){var o=t.getReplay(i.getZIndex(),
da.LINE_STRING);o.setFillStrokeStyle(null,n),o.drawMultiLineString(e,r)}var s=i.getText();if(s){var a=t.getReplay(i.getZIndex(),da.TEXT);a.setTextStyle(s,t.addDeclutter(!1)),a.drawText(e,r)}},MultiPolygon:function(t,e,i,r){var n=i.getFill(),o=i.getStroke();if(o||n){var s=t.getReplay(i.getZIndex(),da.POLYGON);s.setFillStrokeStyle(n,o),s.drawMultiPolygon(e,r)}var a=i.getText();if(a){var h=t.getReplay(i.getZIndex(),da.TEXT);h.setTextStyle(a,t.addDeclutter(!1)),h.drawText(e,r)}},GeometryCollection:function(t,
e,i,r){var n,o,s=e.getGeometriesArray();for(n=0,o=s.length;n<o;++n){var a=Ga[s[n].getType()];a(t,s[n],i,r)}},Circle:function(t,e,i,r){var n=i.getFill(),o=i.getStroke();if(n||o){var s=t.getReplay(i.getZIndex(),da.CIRCLE);s.setFillStrokeStyle(n,o),s.drawCircle(e,r)}var a=i.getText();if(a){var h=t.getReplay(i.getZIndex(),da.TEXT);h.setTextStyle(a,t.addDeclutter(!1)),h.drawText(e,r)}}};function Da(t,e){return parseInt(o(t),10)-parseInt(o(e),10)}function ka(t,e){var i=ja(t,e);return i*i}function ja(t,
e){return Na*t/e}function Ua(t,e,i,r,n,o){var s=!1,a=i.getImage();if(a){var h=a.getImageState();h==xs.LOADED||h==xs.ERROR?a.unlistenImageChange(n,o):(h==xs.IDLE&&a.load(),h=a.getImageState(),a.listenImageChange(n,o),s=!0)}return function(t,e,i,r){var n=i.getGeometryFunction()(e);if(!n)return;var o=n.getSimplifiedGeometry(r);if(i.getRenderer())!function t(e,i,r,n){if(i.getType()==Nt.GEOMETRY_COLLECTION){for(var o=i.getGeometries(),s=0,a=o.length;s<a;++s)t(e,o[s],r,n);return}var h=e.getReplay(r.getZIndex(),
da.DEFAULT);h.drawCustom(i,n,r.getRenderer())}(t,o,i,e);else{var s=Ga[o.getType()];s(t,o,i,e)}}(t,e,i,r),s}var Ya=function(t){function e(e){t.call(this,e),this.declutterTree_=e.getDeclutter()?ua()(9,void 0):null,this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.context=Jn(),v(Ps,M.CLEAR,this.handleFontsChanged_,this)}return t&&(e.__proto__=t),e.prototype=
Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){x(Ps,M.CLEAR,this.handleFontsChanged_,this),t.prototype.disposeInternal.call(this)},e.prototype.compose=function(t,e,i){var r=e.extent,n=e.pixelRatio,o=i.managed?e.skippedFeatureUids:{},s=e.viewState,a=s.projection,h=s.rotation,l=a.getExtent(),u=this.getLayer().getSource(),p=this.getTransform(e,0),c=i.extent,d=void 0!==c;d&&this.clip(t,e,c);var f=this.replayGroup_;if(f&&!f.isEmpty()){this.declutterTree_&&
this.declutterTree_.clear();var _,g=this.getLayer(),y=0,v=0,m=1!==i.opacity,x=g.hasListener(ur.RENDER);if(m||x){var E=t.canvas.width,S=t.canvas.height;if(h){var T=Math.round(Math.sqrt(E*E+S*S));y=(T-E)/2,v=(T-S)/2,E=S=T}this.context.canvas.width=E,this.context.canvas.height=S,_=this.context}else _=t;var C=_.globalAlpha;m||(_.globalAlpha=i.opacity),_!=t&&_.translate(y,v);var R=e.viewHints,w=!(R[kn]||R[jn]),I=e.size[0]*n,L=e.size[1]*n;if(ks(_,-h,I/2,L/2),f.replay(_,p,h,o,w),u.getWrapX()&&a.canWrapX()&&
!ot(l,r)){for(var O,P=r[0],b=Ot(l),M=0;P<l[0];)O=b*--M,p=this.getTransform(e,O),f.replay(_,p,h,o,w),P+=b;for(M=0,P=r[2];P>l[2];)O=b*++M,p=this.getTransform(e,O),f.replay(_,p,h,o,w),P-=b}if(ks(_,h,I/2,L/2),x&&this.dispatchRenderEvent(_,e,p),_!=t){if(m){var F=t.globalAlpha;t.globalAlpha=i.opacity,t.drawImage(_.canvas,-y,-v),t.globalAlpha=F}else t.drawImage(_.canvas,-y,-v);_.translate(-y,-v)}m||(_.globalAlpha=C)}d&&t.restore()},e.prototype.composeFrame=function(t,e,i){var r=this.getTransform(t,0);this.preCompose(i,
t,r),this.compose(i,t,e),this.postCompose(i,t,e,r)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.replayGroup_){var s=e.viewState.resolution,a=e.viewState.rotation,h=this.getLayer(),l={};return this.replayGroup_.forEachFeatureAtCoordinate(t,s,a,i,{},function(t){var e=o(t);if(!(e in l))return l[e]=!0,r.call(n,t,h)},null)}},e.prototype.handleFontsChanged_=function(t){var e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},
e.prototype.prepareFrame=function(t,e){var i=this.getLayer(),r=i.getSource(),n=t.viewHints[kn],o=t.viewHints[jn],s=i.getUpdateWhileAnimating(),a=i.getUpdateWhileInteracting();if(!this.dirty_&&!s&&n||!a&&o)return!0;var h=t.extent,l=t.viewState,u=l.projection,p=l.resolution,c=t.pixelRatio,d=i.getRevision(),f=i.getRenderBuffer(),_=i.getRenderOrder();void 0===_&&(_=Da);var g=et(h,f*p),y=l.projection.getExtent();if(r.getWrapX()&&l.projection.canWrapX()&&!ot(y,t.extent)){var v=Ot(y),m=Math.max(Ot(g)/2,
v);g[0]=y[0]-m,g[2]=y[2]+m}if(!this.dirty_&&this.renderedResolution_==p&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&ot(this.renderedExtent_,g))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var x=new Aa(ja(p,c),g,p,c,r.getOverlaps(),this.declutterTree_,i.getRenderBuffer());r.loadFeatures(g,p,u);var E=function(t){var e,r=t.getStyleFunction()||i.getStyleFunction();if(r&&(e=r(t,p)),e){var n=this.renderFeature(t,p,c,e,x);this.dirty_=this.dirty_||n}}.bind(this);
if(_){var S=[];r.forEachFeatureInExtent(g,function(t){S.push(t)}),S.sort(_);for(var T=0,C=S.length;T<C;++T)E(S[T])}else r.forEachFeatureInExtent(g,E);return x.finish(),this.renderedResolution_=p,this.renderedRevision_=d,this.renderedRenderOrder_=_,this.renderedExtent_=g,this.replayGroup_=x,this.replayGroupChanged=!0,!0},e.prototype.renderFeature=function(t,e,i,r,n){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var s=0,a=r.length;s<a;++s)o=Ua(n,t,r[s],ka(e,i),this.handleStyleImageChange_,this)||
o;else o=Ua(n,t,r,ka(e,i),this.handleStyleImageChange_,this);return o},e}(ta);Ya.handles=function(t){return t.getType()===Ss.VECTOR},Ya.create=function(t,e){return new Ya(e)};var Ba=Ya,Va={IMAGE:"image",HYBRID:"hybrid",VECTOR:"vector"},Xa={image:[da.POLYGON,da.CIRCLE,da.LINE_STRING,da.IMAGE,da.TEXT],hybrid:[da.POLYGON,da.LINE_STRING]},za={image:[da.DEFAULT],hybrid:[da.IMAGE,da.TEXT,da.DEFAULT],vector:Ea},Wa=function(t){function e(e){t.call(this,e,!0),this.declutterTree_=e.getDeclutter()?ua()(9,void 0):
null,this.dirty_=!1,this.renderedLayerRevision_,this.tmpTransform_=[1,0,0,1,0,0];var i=e.getRenderMode();this.zDirection=i===Va.VECTOR?1:0,i!==Va.VECTOR&&(this.context=Jn()),v(Ps,M.CLEAR,this.handleFontsChanged_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){x(Ps,M.CLEAR,this.handleFontsChanged_,this),t.prototype.disposeInternal.call(this)},e.prototype.getTile=function(e,i,r,n,o){var s=t.prototype.getTile.call(this,
e,i,r,n,o);return s.getState()===On.LOADED&&(this.createReplayGroup_(s,n,o),this.context&&this.renderTileImage_(s,n,o)),s},e.prototype.getTileImage=function(t){var e=this.getLayer();return t.getImage(e)},e.prototype.prepareFrame=function(e,i){var r=this.getLayer().getRevision();return this.renderedLayerRevision_!=r&&(this.renderedTiles.length=0),this.renderedLayerRevision_=r,t.prototype.prepareFrame.call(this,e,i)},e.prototype.createReplayGroup_=function(t,e,i){var r=this,n=this.getLayer(),o=n.getRevision(),
s=n.getRenderOrder()||null,a=t.getReplayState(n);if(a.dirty||a.renderedRevision!=o||a.renderedRenderOrder!=s){for(var h=n.getSource(),l=h.getTileGrid(),u=h.getTileGridForProjection(i).getResolution(t.tileCoord[0]),p=t.extent,c=function(o,c){var d=t.getTile(t.tileKeys[o]);if(d.getState()==On.LOADED){var f=d.tileCoord,_=l.getTileCoordExtent(f),g=wt(p,_),y=dt(_,g)?null:et(g,n.getRenderBuffer()*u,r.tmpExtent),v=d.getProjection(),m=!1;Ie(i,v)||(m=!0,d.setProjection(i)),a.dirty=!1;var x=new Aa(0,g,u,e,
h.getOverlaps(),r.declutterTree_,n.getRenderBuffer()),E=ka(u,e),S=function(t){var e,i=t.getStyleFunction()||n.getStyleFunction();if(i&&(e=i(t,u)),e){var r=this.renderFeature(t,E,e,x);this.dirty_=this.dirty_||r,a.dirty=a.dirty||r}},T=d.getFeatures();s&&s!==a.renderedRenderOrder&&T.sort(s);for(var C=0,R=T.length;C<R;++C){var w=T[C];m&&(v.getUnits()==$t.TILE_PIXELS&&(v.setWorldExtent(_),v.setExtent(d.getExtent())),w.getGeometry().transform(v,i)),y&&!Pt(y,w.getGeometry().getExtent())||S.call(r,w)}x.finish(),
d.setReplayGroup(n,t.tileCoord.toString(),x)}},d=0,f=t.tileKeys.length;d<f;++d)c(d);a.renderedRevision=o,a.renderedRenderOrder=s}},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){var s=e.viewState.resolution,a=e.viewState.rotation;i=void 0==i?0:i;var h,l,u,p,c=this.getLayer(),d={},f=this.renderedTiles;for(u=0,p=f.length;u<p;++u){var _=f[u];if(nt(h=et(_.extent,i*s,h),t))for(var g=0,y=_.tileKeys.length;g<y;++g){var v=_.getTile(_.tileKeys[g]);if(v.getState()==On.LOADED){var m=v.getReplayGroup(c,
_.tileCoord.toString());l=l||m.forEachFeatureAtCoordinate(t,s,a,i,{},function(t){var e=o(t);if(!(e in d))return d[e]=!0,r.call(n,t,c)},null)}}}return l},e.prototype.getReplayTransform_=function(t,e){var i=this.getLayer().getSource().getTileGrid(),r=t.tileCoord,n=i.getResolution(r[0]),o=e.viewState,s=e.pixelRatio,a=o.resolution/s,h=i.getTileCoordExtent(r,this.tmpExtent),l=o.center,u=It(h),p=e.size,c=Math.round(s*p[0]/2),d=Math.round(s*p[1]/2);return Ye(this.tmpTransform_,c,d,n/a,n/a,o.rotation,(u[0]-
l[0])/n,(l[1]-u[1])/n)},e.prototype.handleFontsChanged_=function(t){var e=this.getLayer();e.getVisible()&&void 0!==this.renderedLayerRevision_&&e.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.postCompose=function(e,i,r){var n=this.getLayer(),o=n.getRenderMode();if(o!=Va.IMAGE){var s,a,h=n.getDeclutter()?{}:null,l=n.getSource(),u=za[o],p=i.pixelRatio,c=i.viewState.rotation,d=i.size;c&&ks(e,-c,s=Math.round(p*d[0]/2),a=Math.round(p*d[1]/2)),h&&
this.declutterTree_.clear();for(var f=i.viewHints,_=!(f[kn]||f[jn]),g=this.renderedTiles,y=l.getTileGridForProjection(i.viewState.projection),v=[],m=[],x=g.length-1;x>=0;--x){var E=g[x];if(E.getState()!=On.ABORT)for(var S=E.tileCoord,T=y.getTileCoordExtent(S,this.tmpExtent)[0]-E.extent[0],C=void 0,R=0,w=E.tileKeys.length;R<w;++R){var I=E.getTile(E.tileKeys[R]);if(I.getState()==On.LOADED){var L=I.getReplayGroup(n,S.toString());if(L&&L.hasReplays(u)){C||(C=this.getTransform(i,T));var O=I.tileCoord[0],
P=L.getClipCoords(C);e.save(),e.globalAlpha=r.opacity;for(var b=0,M=v.length;b<M;++b){var F=v[b];O<m[b]&&(e.beginPath(),e.moveTo(P[0],P[1]),e.lineTo(P[2],P[3]),e.lineTo(P[4],P[5]),e.lineTo(P[6],P[7]),e.moveTo(F[6],F[7]),e.lineTo(F[4],F[5]),e.lineTo(F[2],F[3]),e.lineTo(F[0],F[1]),e.clip())}L.replay(e,C,c,{},_,u,h),e.restore(),v.push(P),m.push(O)}}}}h&&function(t,e,i,r){for(var n=Object.keys(t).map(Number).sort(V),o={},s=0,a=n.length;s<a;++s)for(var h=t[n[s].toString()],l=0,u=h.length;l<u;){var p=h[l++],
c=h[l++];p.replay(e,c,i,o,r)}}(h,e,c,_),c&&ks(e,c,s,a)}t.prototype.postCompose.call(this,e,i,r)},e.prototype.renderFeature=function(t,e,i,r){if(!i)return!1;var n=!1;if(Array.isArray(i))for(var o=0,s=i.length;o<s;++o)n=Ua(r,t,i[o],e,this.handleStyleImageChange_,this)||n;else n=Ua(r,t,i,e,this.handleStyleImageChange_,this);return n},e.prototype.renderTileImage_=function(t,e,i){var r=this.getLayer(),n=t.getReplayState(r),o=r.getRevision(),s=Xa[r.getRenderMode()];if(s&&n.renderedTileRevision!==o){n.renderedTileRevision=
o;var a=t.wrappedTileCoord,h=a[0],l=r.getSource(),u=l.getTileGridForProjection(i),p=u.getResolution(h),c=t.getContext(r),d=l.getTilePixelSize(h,e,i);c.canvas.width=d[0],c.canvas.height=d[1];for(var f=u.getTileCoordExtent(a,this.tmpExtent),_=0,g=t.tileKeys.length;_<g;++_){var y=t.getTile(t.tileKeys[_]);if(y.getState()==On.LOADED){var v=e/p,m=Fe(this.tmpTransform_);je(m,v,-v),Ue(m,-f[0],-f[3]),y.getReplayGroup(r,t.tileCoord.toString()).replay(c,m,0,{},!0,s)}}}},e}(ha);Wa.handles=function(t){return t.getType()===
Ss.VECTOR_TILE},Wa.create=function(t,e){return new Wa(e)};var Ka=Wa,Ha=function(t){function e(e){(e=u({},e)).controls||(e.controls=wo()),e.interactions||(e.interactions=ys()),t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createRenderer=function(){var t=new Qs(this);return t.registerLayerRenderers([ra,ha,Ba,Ka]),t},e}(lo),Za={BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right",CENTER_LEFT:"center-left",
CENTER_CENTER:"center-center",CENTER_RIGHT:"center-right",TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right"},qa={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"},Ja=function(t){function e(e){t.call(this),this.options=e,this.id=e.id,this.insertFirst=void 0===e.insertFirst||e.insertFirst,this.stopEvent=void 0===e.stopEvent||e.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==e.className?e.className:"ol-overlay-container "+
co,this.element.style.position="absolute",this.autoPan=void 0!==e.autoPan&&e.autoPan,this.autoPanAnimation=e.autoPanAnimation||{},this.autoPanMargin=void 0!==e.autoPanMargin?e.autoPanMargin:20,this.rendered={bottom_:"",left_:"",right_:"",top_:"",visible:!0},this.mapPostrenderListenerKey=null,v(this,G(qa.ELEMENT),this.handleElementChanged,this),v(this,G(qa.MAP),this.handleMapChanged,this),v(this,G(qa.OFFSET),this.handleOffsetChanged,this),v(this,G(qa.POSITION),this.handlePositionChanged,this),v(this,
G(qa.POSITIONING),this.handlePositioningChanged,this),void 0!==e.element&&this.setElement(e.element),this.setOffset(void 0!==e.offset?e.offset:[0,0]),this.setPositioning(void 0!==e.positioning?e.positioning:Za.TOP_LEFT),void 0!==e.position&&this.setPosition(e.position)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getElement=function(){return this.get(qa.ELEMENT)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(qa.MAP)},
e.prototype.getOffset=function(){return this.get(qa.OFFSET)},e.prototype.getPosition=function(){return this.get(qa.POSITION)},e.prototype.getPositioning=function(){return this.get(qa.POSITIONING)},e.prototype.handleElementChanged=function(){to(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&($n(this.element),E(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=
v(t,Rn,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element)}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.get(qa.POSITION)&&this.autoPan&&this.panIntoView()},e.prototype.handlePositioningChanged=
function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(qa.ELEMENT,t)},e.prototype.setMap=function(t){this.set(qa.MAP,t)},e.prototype.setOffset=function(t){this.set(qa.OFFSET,t)},e.prototype.setPosition=function(t){this.set(qa.POSITION,t)},e.prototype.panIntoView=function(){var t=this.getMap();if(t&&t.getTargetElement()){var e=this.getRect(t.getTargetElement(),t.getSize()),i=this.getElement(),r=this.getRect(i,[function(t){var e=t.offsetWidth,i=getComputedStyle(t);return e+=
parseInt(i.marginLeft,10)+parseInt(i.marginRight,10)}(i),function(t){var e=t.offsetHeight,i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10)}(i)]),n=this.autoPanMargin;if(!ot(e,r)){var o=r[0]-e[0],s=e[2]-r[2],a=r[1]-e[1],h=e[3]-r[3],l=[0,0];if(o<0?l[0]=o-n:s<0&&(l[0]=Math.abs(s)+n),a<0?l[1]=a-n:h<0&&(l[1]=Math.abs(h)+n),0!==l[0]||0!==l[1]){var u=t.getView().getCenter(),p=t.getPixelFromCoordinate(u),c=[p[0]+l[0],p[1]+l[1]];t.getView().animate({center:t.getCoordinateFromPixel(c),
duration:this.autoPanAnimation.duration,easing:this.autoPanAnimation.easing})}}}},e.prototype.getRect=function(t,e){var i=t.getBoundingClientRect(),r=i.left+window.pageXOffset,n=i.top+window.pageYOffset;return[r,n,r+e[0],n+e[1]]},e.prototype.setPositioning=function(t){this.set(qa.POSITIONING,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();
if(t&&t.isRendered()&&e){var i=t.getPixelFromCoordinate(e),r=t.getSize();this.updateRenderedPosition(i,r)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var i=this.element.style,r=this.getOffset(),n=this.getPositioning();this.setVisible(!0);var o=r[0],s=r[1];if(n==Za.BOTTOM_RIGHT||n==Za.CENTER_RIGHT||n==Za.TOP_RIGHT){""!==this.rendered.left_&&(this.rendered.left_=i.left="");var a=Math.round(e[0]-t[0]-o)+"px";this.rendered.right_!=a&&(this.rendered.right_=i.right=a)}else{""!==
this.rendered.right_&&(this.rendered.right_=i.right=""),n!=Za.BOTTOM_CENTER&&n!=Za.CENTER_CENTER&&n!=Za.TOP_CENTER||(o-=this.element.offsetWidth/2);var h=Math.round(t[0]+o)+"px";this.rendered.left_!=h&&(this.rendered.left_=i.left=h)}if(n==Za.BOTTOM_LEFT||n==Za.BOTTOM_CENTER||n==Za.BOTTOM_RIGHT){""!==this.rendered.top_&&(this.rendered.top_=i.top="");var l=Math.round(e[1]-t[1]-s)+"px";this.rendered.bottom_!=l&&(this.rendered.bottom_=i.bottom=l)}else{""!==this.rendered.bottom_&&(this.rendered.bottom_=
i.bottom=""),n!=Za.CENTER_LEFT&&n!=Za.CENTER_CENTER&&n!=Za.CENTER_RIGHT||(s-=this.element.offsetHeight/2);var u=Math.round(t[1]+s)+"px";this.rendered.top_!=u&&(this.rendered.top_=i.top=u)}},e.prototype.getOptions=function(){return this.options},e}(D),Qa=9729,$a=10242,th=10243,eh=3553,ih=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function rh(t,e){for(var i=ih.length,r=0;r<i;++r)try{var n=t.getContext(ih[r],e);if(n)return n}catch(t){}return null}var nh,oh;if("undefined"!=typeof window&&
"WebGLRenderingContext"in window)try{var sh=rh(document.createElement("canvas"),{failIfMajorPerformanceCaveat:!0});sh&&(!0,nh=sh.getParameter(sh.MAX_TEXTURE_SIZE),oh=sh.getSupportedExtensions())}catch(t){}var ah=function(t){this.source_=t};ah.prototype.isAnimated=function(){return!1},ah.prototype.getType=function(){return r()},ah.prototype.getSource=function(){return this.source_};var hh=ah,lh=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),
e.prototype.constructor=e,e.prototype.getType=function(){return 35632},e}(hh),uh=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getType=function(){return 35633},e}(hh),ph=new lh("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 \x3d 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 \x3d 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 \x3d length(windowCenter - windowOffset);\n  float dist \x3d length(windowCenter - gl_FragCoord.xy);\n  if (dist \x3e radius + v_halfWidth) {\n    if (u_strokeColor.a \x3d\x3d 0.0) {\n      gl_FragColor \x3d u_fillColor;\n    } else {\n      gl_FragColor \x3d u_strokeColor;\n    }\n    gl_FragColor.a \x3d gl_FragColor.a - (dist - (radius + v_halfWidth));\n  } else if (u_fillColor.a \x3d\x3d 0.0) {\n    // Hooray, no fill, just stroke. We can use real antialiasing.\n    gl_FragColor \x3d u_strokeColor;\n    if (dist \x3c radius - v_halfWidth) {\n      gl_FragColor.a \x3d gl_FragColor.a - (radius - v_halfWidth - dist);\n    }\n  } else {\n    gl_FragColor \x3d u_fillColor;\n    float strokeDist \x3d radius - v_halfWidth;\n    float antialias \x3d 2.0 * v_pixelRatio;\n    if (dist \x3e strokeDist) {\n      gl_FragColor \x3d u_strokeColor;\n    } else if (dist \x3e\x3d strokeDist - antialias) {\n      float step \x3d smoothstep(strokeDist - antialias, strokeDist, dist);\n      gl_FragColor \x3d mix(u_fillColor, u_strokeColor, step);\n    }\n  }\n  gl_FragColor.a \x3d gl_FragColor.a * u_opacity;\n  if (gl_FragColor.a \x3c\x3d 0.0) {\n    discard;\n  }\n}\n"),
ch=new uh("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 \x3d u_offsetScaleMatrix * u_offsetRotateMatrix;\n  v_center \x3d vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n  v_pixelRatio \x3d u_pixelRatio;\n  float lineWidth \x3d u_lineWidth * u_pixelRatio;\n  v_halfWidth \x3d lineWidth / 2.0;\n  if (lineWidth \x3d\x3d 0.0) {\n    lineWidth \x3d 2.0 * u_pixelRatio;\n  }\n  vec2 offset;\n  // Radius with anitaliasing (roughly).\n  float radius \x3d a_radius + 3.0 * u_pixelRatio;\n  // Until we get gl_VertexID in WebGL, we store an instruction.\n  if (a_instruction \x3d\x3d 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 \x3d vec2(-1.0, 1.0);\n  } else if (a_instruction \x3d\x3d 1.0) {\n    offset \x3d vec2(-1.0, -1.0);\n  } else if (a_instruction \x3d\x3d 2.0) {\n    offset \x3d vec2(1.0, -1.0);\n  } else {\n    offset \x3d vec2(1.0, 1.0);\n  }\n\n  gl_Position \x3d u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n      offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n  v_offset \x3d 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) \x3e 20000.0) {\n    gl_Position \x3d vec4(v_center, 0.0, 1.0);\n  }\n}\n\n\n"),
dh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_pixelRatio=t.getUniformLocation(e,"u_pixelRatio"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_fillColor=t.getUniformLocation(e,"u_fillColor"),this.u_strokeColor=t.getUniformLocation(e,"u_strokeColor"),
this.u_size=t.getUniformLocation(e,"u_size"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_instruction=t.getAttribLocation(e,"a_instruction"),this.a_radius=t.getAttribLocation(e,"a_radius")};function fh(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}var _h=function(t){function e(e,i){t.call(this),this.tolerance=e,this.maxExtent=i,this.origin=Tt(i),this.projectionMatrix_=[1,0,0,1,0,0],this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,
0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.indices=[],this.indicesBuffer=null,this.startIndices=[],this.startIndicesFeature=[],this.vertices=[],this.verticesBuffer=null,this.lineStringReplay=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDeleteResourcesFunction=function(t){return r()},e.prototype.finish=function(t){r()},e.prototype.setUpProgram=function(t,e,i,n){return r()},e.prototype.shutDownProgram=function(t,e){r()},
e.prototype.drawReplay=function(t,e,i,n){r()},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,n,o){return r()},e.prototype.drawHitDetectionReplay=function(t,e,i,r,n,o){return n?this.drawHitDetectionReplayOneByOne(t,e,i,r,o):this.drawHitDetectionReplayAll(t,e,i,r)},e.prototype.drawHitDetectionReplayAll=function(t,e,i,r){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawReplay(t,e,i,!0);var n=r(null);return n||void 0},e.prototype.replay=function(t,e,i,r,n,o,s,a,h,l,u){var p,c,d,f,_,
g,y,v,m=t.getGL();this.lineStringReplay&&(p=m.isEnabled(m.STENCIL_TEST),c=m.getParameter(m.STENCIL_FUNC),d=m.getParameter(m.STENCIL_VALUE_MASK),f=m.getParameter(m.STENCIL_REF),_=m.getParameter(m.STENCIL_WRITEMASK),g=m.getParameter(m.STENCIL_FAIL),y=m.getParameter(m.STENCIL_PASS_DEPTH_PASS),v=m.getParameter(m.STENCIL_PASS_DEPTH_FAIL),m.enable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilMask(255),m.stencilFunc(m.ALWAYS,1,255),m.stencilOp(m.KEEP,m.KEEP,m.REPLACE),this.lineStringReplay.replay(t,
e,i,r,n,o,s,a,h,l,u),m.stencilMask(0),m.stencilFunc(m.NOTEQUAL,1,255)),t.bindBuffer(34962,this.verticesBuffer),t.bindBuffer(34963,this.indicesBuffer);var x=this.setUpProgram(m,t,n,o),E=Fe(this.projectionMatrix_);je(E,2/(i*n[0]),2/(i*n[1])),ke(E,-r),Ue(E,-(e[0]-this.origin[0]),-(e[1]-this.origin[1]));var S=Fe(this.offsetScaleMatrix_);je(S,2/n[0],2/n[1]);var T,C=Fe(this.offsetRotateMatrix_);return 0!==r&&ke(C,-r),m.uniformMatrix4fv(x.u_projectionMatrix,!1,fh(this.tmpMat4_,E)),m.uniformMatrix4fv(x.u_offsetScaleMatrix,
!1,fh(this.tmpMat4_,S)),m.uniformMatrix4fv(x.u_offsetRotateMatrix,!1,fh(this.tmpMat4_,C)),m.uniform1f(x.u_opacity,s),void 0===h?this.drawReplay(m,t,a,!1):T=this.drawHitDetectionReplay(m,t,a,h,l,u),this.shutDownProgram(m,x),this.lineStringReplay&&(p||m.disable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilFunc(c,f,d),m.stencilMask(_),m.stencilOp(g,v,y)),T},e.prototype.drawElements=function(t,e,i,r){var n=e.hasOESElementIndexUint?5125:5123,o=r-i,s=i*(e.hasOESElementIndexUint?4:2);t.drawElements(4,
o,n,s)},e}(Vs),gh=[0,0,0,1],yh=[],vh=[0,0,0,1],mh=Number.EPSILON||2.220446049250313E-16,xh=function(t,e,i,r,n,o){var s=(i-t)*(o-e)-(n-t)*(r-e);return s<=mh&&s>=-mh?void 0:s>0},Eh=35044,Sh=function(t,e){this.arr_=void 0!==t?t:[],this.usage_=void 0!==e?e:Eh};Sh.prototype.getArray=function(){return this.arr_},Sh.prototype.getUsage=function(){return this.usage_};var Th=Sh,Ch=function(t){function e(e,i){t.call(this,e,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.radius_=0,this.state_=
{fillColor:null,strokeColor:null,lineDash:null,lineDashOffset:void 0,lineWidth:void 0,changed:!1}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){var n,o,s=this.vertices.length,a=this.indices.length,h=s/4;for(n=e,o=i;n<o;n+=r)this.vertices[s++]=t[n],this.vertices[s++]=t[n+1],this.vertices[s++]=0,this.vertices[s++]=this.radius_,this.vertices[s++]=t[n],this.vertices[s++]=t[n+1],this.vertices[s++]=1,this.vertices[s++]=
this.radius_,this.vertices[s++]=t[n],this.vertices[s++]=t[n+1],this.vertices[s++]=2,this.vertices[s++]=this.radius_,this.vertices[s++]=t[n],this.vertices[s++]=t[n+1],this.vertices[s++]=3,this.vertices[s++]=this.radius_,this.indices[a++]=h,this.indices[a++]=h+1,this.indices[a++]=h+2,this.indices[a++]=h+2,this.indices[a++]=h+3,this.indices[a++]=h,h+=4},e.prototype.drawCircle=function(t,e){var i=t.getRadius(),r=t.getStride();if(i){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e),
this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.radius_=i;var n=t.getFlatCoordinates();n=Dt(n,0,2,r,-this.origin[0],-this.origin[1]),this.drawCoordinates_(n,0,2,r)}else if(this.state_.changed&&(this.styles_.pop(),this.styles_.length)){var o=this.styles_[this.styles_.length-1];this.state_.fillColor=o[0],this.state_.strokeColor=o[1],this.state_.lineWidth=o[2],this.state_.changed=!1}},e.prototype.finish=function(t){this.verticesBuffer=new Th(this.vertices),
this.indicesBuffer=new Th(this.indices),this.startIndices.push(this.indices.length),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer;return function(){t.deleteBuffer(e),t.deleteBuffer(i)}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(ph,ch);return this.defaultLocations_?n=this.defaultLocations_:(n=new dh(t,o),this.defaultLocations_=
n),e.useProgram(o),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,16,0),t.enableVertexAttribArray(n.a_instruction),t.vertexAttribPointer(n.a_instruction,1,5126,!1,16,8),t.enableVertexAttribArray(n.a_radius),t.vertexAttribPointer(n.a_radius,1,5126,!1,16,12),t.uniform2fv(n.u_size,i),t.uniform1f(n.u_pixelRatio,r),n},e.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position),t.disableVertexAttribArray(e.a_instruction),t.disableVertexAttribArray(e.a_radius)},
e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a;if(d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setFillStyle_(t,a[0]),this.setStrokeStyle_(t,a[1],a[2]),this.drawElements(t,e,o,s),s=o;else this.drawReplaySkipping_(t,e,i)},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=
this.styles_[s],this.setFillStyle_(t,l[0]),this.setStrokeStyle_(t,l[1],l[2]),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-2,s=n=this.startIndices[l+
1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setFillStyle_(t,a[0]),this.setStrokeStyle_(t,a[1],a[2]),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&this.drawElements(t,e,n,s),s=u),l--,n=u;n!==s&&this.drawElements(t,e,n,s),n=s=h}},e.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_fillColor,e)},e.prototype.setStrokeStyle_=function(t,e,i){t.uniform4fv(this.defaultLocations_.u_strokeColor,
e),t.uniform1f(this.defaultLocations_.u_lineWidth,i)},e.prototype.setFillStrokeStyle=function(t,e){var i,r;if(e){var n=e.getLineDash();this.state_.lineDash=n||yh;var o=e.getLineDashOffset();this.state_.lineDashOffset=o||0,i=(i=e.getColor())instanceof CanvasGradient||i instanceof CanvasPattern?vh:_r(i).map(function(t,e){return 3!=e?t/255:t})||vh,r=void 0!==(r=e.getWidth())?r:1}else i=[0,0,0,0],r=0;var s=t?t.getColor():[0,0,0,0];s=s instanceof CanvasGradient||s instanceof CanvasPattern?gh:_r(s).map(function(t,
e){return 3!=e?t/255:t})||gh,this.state_.strokeColor&&Z(this.state_.strokeColor,i)&&this.state_.fillColor&&Z(this.state_.fillColor,s)&&this.state_.lineWidth===r||(this.state_.changed=!0,this.state_.fillColor=s,this.state_.strokeColor=i,this.state_.lineWidth=r,this.styles_.push([s,i,r]))},e}(_h),Rh=new lh("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 \x3d texture2D(u_image, v_texCoord);\n  gl_FragColor.rgb \x3d texColor.rgb;\n  float alpha \x3d texColor.a * v_opacity * u_opacity;\n  if (alpha \x3d\x3d 0.0) {\n    discard;\n  }\n  gl_FragColor.a \x3d alpha;\n}\n"),
wh=new uh("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 \x3d u_offsetScaleMatrix;\n  if (a_rotateWithView \x3d\x3d 1.0) {\n    offsetMatrix \x3d u_offsetScaleMatrix * u_offsetRotateMatrix;\n  }\n  vec4 offsets \x3d offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n  gl_Position \x3d u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n  v_texCoord \x3d a_texCoord;\n  v_opacity \x3d a_opacity;\n}\n\n\n"),
Ih=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_image=t.getUniformLocation(e,"u_image"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord"),this.a_offsets=t.getAttribLocation(e,"a_offsets"),this.a_opacity=t.getAttribLocation(e,
"a_opacity"),this.a_rotateWithView=t.getAttribLocation(e,"a_rotateWithView")},Lh={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};function Oh(t,e,i){var r=t.createTexture();return 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),void 0!==e&&t.texParameteri(eh,$a,e),void 0!==i&&t.texParameteri(eh,th,i),r}function Ph(t,e,i,r,n){var o=Oh(t,r,n);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,
t.RGBA,t.UNSIGNED_BYTE,null),o}function bh(t,e,i,r){var n=Oh(t,i,r);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),n}var Mh=function(t){function e(e,i){t.call(this),this.canvas_=e,this.gl_=i,this.bufferCache_={},this.shaderCache_={},this.programCache_={},this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null,this.hasOESElementIndexUint=X(oh,"OES_element_index_uint"),this.hasOESElementIndexUint&&i.getExtension("OES_element_index_uint"),
v(this.canvas_,Lh.LOST,this.handleWebGLContextLost,this),v(this.canvas_,Lh.RESTORED,this.handleWebGLContextRestored,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.bindBuffer=function(t,e){var i=this.getGL(),r=e.getArray(),n=o(e);if(n in this.bufferCache_){var s=this.bufferCache_[n];i.bindBuffer(t,s.buffer)}else{var a,h=i.createBuffer();i.bindBuffer(t,h),34962==t?a=new Float32Array(r):34963==t&&(a=this.hasOESElementIndexUint?new Uint32Array(r):
new Uint16Array(r)),i.bufferData(t,a,e.getUsage()),this.bufferCache_[n]={buf:e,buffer:h}}},e.prototype.deleteBuffer=function(t){var e=this.getGL(),i=o(t),r=this.bufferCache_[i];e.isContextLost()||e.deleteBuffer(r.buffer),delete this.bufferCache_[i]},e.prototype.disposeInternal=function(){S(this.canvas_);var t=this.getGL();if(!t.isContextLost()){for(var e in this.bufferCache_)t.deleteBuffer(this.bufferCache_[e].buffer);for(var i in this.programCache_)t.deleteProgram(this.programCache_[i]);for(var r in this.shaderCache_)t.deleteShader(this.shaderCache_[r]);
t.deleteFramebuffer(this.hitDetectionFramebuffer_),t.deleteRenderbuffer(this.hitDetectionRenderbuffer_),t.deleteTexture(this.hitDetectionTexture_)}},e.prototype.getCanvas=function(){return this.canvas_},e.prototype.getGL=function(){return this.gl_},e.prototype.getHitDetectionFramebuffer=function(){return this.hitDetectionFramebuffer_||this.initHitDetectionFramebuffer_(),this.hitDetectionFramebuffer_},e.prototype.getShader=function(t){var e=o(t);if(e in this.shaderCache_)return this.shaderCache_[e];
var i=this.getGL(),r=i.createShader(t.getType());return i.shaderSource(r,t.getSource()),i.compileShader(r),this.shaderCache_[e]=r,r},e.prototype.getProgram=function(t,e){var i=o(t)+"/"+o(e);if(i in this.programCache_)return this.programCache_[i];var r=this.getGL(),n=r.createProgram();return r.attachShader(n,this.getShader(t)),r.attachShader(n,this.getShader(e)),r.linkProgram(n),this.programCache_[i]=n,n},e.prototype.handleWebGLContextLost=function(){p(this.bufferCache_),p(this.shaderCache_),p(this.programCache_),
this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null},e.prototype.handleWebGLContextRestored=function(){},e.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_,e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var i=Ph(t,1,1),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},e.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,!0)},e}(C),Fh=function(t){function e(e,i){t.call(this,e,i),this.anchorX=void 0,this.anchorY=
void 0,this.groupIndices=[],this.hitDetectionGroupIndices=[],this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.defaultLocations=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.width=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer,r=this.getTextures(!0),
n=t.getGL();return function(){var o,s;if(!n.isContextLost())for(o=0,s=r.length;o<s;++o)n.deleteTexture(r[o]);t.deleteBuffer(e),t.deleteBuffer(i)}},e.prototype.drawCoordinates=function(t,e,i,r){var n,o,s,a,h,l,u=this.anchorX,p=this.anchorY,c=this.height,d=this.imageHeight,f=this.imageWidth,_=this.opacity,g=this.originX,y=this.originY,v=this.rotateWithView?1:0,m=-this.rotation,x=this.scale,E=this.width,S=Math.cos(m),T=Math.sin(m),C=this.indices.length,R=this.vertices.length;for(n=e;n<i;n+=r)h=t[n]-
this.origin[0],l=t[n+1]-this.origin[1],o=R/8,s=-x*u,a=-x*(c-p),this.vertices[R++]=h,this.vertices[R++]=l,this.vertices[R++]=s*S-a*T,this.vertices[R++]=s*T+a*S,this.vertices[R++]=g/f,this.vertices[R++]=(y+c)/d,this.vertices[R++]=_,this.vertices[R++]=v,s=x*(E-u),a=-x*(c-p),this.vertices[R++]=h,this.vertices[R++]=l,this.vertices[R++]=s*S-a*T,this.vertices[R++]=s*T+a*S,this.vertices[R++]=(g+E)/f,this.vertices[R++]=(y+c)/d,this.vertices[R++]=_,this.vertices[R++]=v,s=x*(E-u),a=x*p,this.vertices[R++]=h,
this.vertices[R++]=l,this.vertices[R++]=s*S-a*T,this.vertices[R++]=s*T+a*S,this.vertices[R++]=(g+E)/f,this.vertices[R++]=y/d,this.vertices[R++]=_,this.vertices[R++]=v,s=-x*u,a=x*p,this.vertices[R++]=h,this.vertices[R++]=l,this.vertices[R++]=s*S-a*T,this.vertices[R++]=s*T+a*S,this.vertices[R++]=g/f,this.vertices[R++]=y/d,this.vertices[R++]=_,this.vertices[R++]=v,this.indices[C++]=o,this.indices[C++]=o+1,this.indices[C++]=o+2,this.indices[C++]=o,this.indices[C++]=o+2,this.indices[C++]=o+3;return R},
e.prototype.createTextures=function(t,e,i,r){var n,s,a,h,l=e.length;for(h=0;h<l;++h)(a=o(s=e[h]))in i?n=i[a]:(n=bh(r,s,33071,33071),i[a]=n),t[h]=n},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(Rh,wh);return this.defaultLocations?n=this.defaultLocations:(n=new Ih(t,o),this.defaultLocations=n),e.useProgram(o),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,32,0),t.enableVertexAttribArray(n.a_offsets),t.vertexAttribPointer(n.a_offsets,2,5126,!1,
32,8),t.enableVertexAttribArray(n.a_texCoord),t.vertexAttribPointer(n.a_texCoord,2,5126,!1,32,16),t.enableVertexAttribArray(n.a_opacity),t.vertexAttribPointer(n.a_opacity,1,5126,!1,32,24),t.enableVertexAttribArray(n.a_rotateWithView),t.vertexAttribPointer(n.a_rotateWithView,1,5126,!1,32,28),n},e.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)},
e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a=r?this.getHitDetectionTextures():this.getTextures(),h=r?this.hitDetectionGroupIndices:this.groupIndices;if(d(i))for(n=0,o=a.length,s=0;n<o;++n){t.bindTexture(eh,a[n]);var l=h[n];this.drawElements(t,e,s,l),s=l}else this.drawReplaySkipping(t,e,i,a,h)},e.prototype.drawReplaySkipping=function(t,e,i,r,n){var s,a,h=0;for(s=0,a=r.length;s<a;++s){t.bindTexture(eh,r[s]);for(var l=s>0?n[s-1]:0,u=n[s],p=l,c=l;h<this.startIndices.length&&this.startIndices[h]<=
u;)void 0!==i[o(this.startIndicesFeature[h])]?(p!==c&&this.drawElements(t,e,p,c),c=p=h===this.startIndices.length-1?u:this.startIndices[h+1]):c=h===this.startIndices.length-1?u:this.startIndices[h+1],h++;p!==c&&this.drawElements(t,e,p,c)}},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p=this.startIndices.length-1,c=this.getHitDetectionTextures();for(s=c.length-1;s>=0;--s)for(t.bindTexture(eh,c[s]),a=s>0?this.hitDetectionGroupIndices[s-1]:0,l=this.hitDetectionGroupIndices[s];p>=
0&&this.startIndices[p]>=a;){if(h=this.startIndices[p],void 0===i[o(u=this.startIndicesFeature[p])]&&u.getGeometry()&&(void 0===n||Pt(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,h,l);var d=r(u);if(d)return d}l=h,p--}},e.prototype.finish=function(t){this.anchorX=void 0,this.anchorY=void 0,this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.indices=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=
void 0,this.rotation=void 0,this.scale=void 0,this.vertices=null,this.width=void 0},e.prototype.getTextures=function(t){return r()},e.prototype.getHitDetectionTextures=function(){return r()},e}(_h),Ah=function(t){function e(e,i){t.call(this,e,i),this.images_=[],this.hitDetectionImages_=[],this.textures_=[],this.hitDetectionTextures_=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawMultiPoint=function(t,e){this.startIndices.push(this.indices.length),
this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},e.prototype.drawPoint=function(t,e){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},e.prototype.finish=function(e){var i=e.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices.push(this.indices.length),this.verticesBuffer=new Th(this.vertices);
var r=this.indices;this.indicesBuffer=new Th(r);var n={};this.createTextures(this.textures_,this.images_,n,i),this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,n,i),this.images_=null,this.hitDetectionImages_=null,t.prototype.finish.call(this,e)},e.prototype.setImageStyle=function(t){var e=t.getAnchor(),i=t.getImage(1),r=t.getImageSize(),n=t.getHitDetectionImage(1),s=t.getOpacity(),a=t.getOrigin(),h=t.getRotateWithView(),l=t.getRotation(),u=t.getSize(),p=t.getScale();0===this.images_.length?
this.images_.push(i):o(this.images_[this.images_.length-1])!=o(i)&&(this.groupIndices.push(this.indices.length),this.images_.push(i)),0===this.hitDetectionImages_.length?this.hitDetectionImages_.push(n):o(this.hitDetectionImages_[this.hitDetectionImages_.length-1])!=o(n)&&(this.hitDetectionGroupIndices.push(this.indices.length),this.hitDetectionImages_.push(n)),this.anchorX=e[0],this.anchorY=e[1],this.height=u[1],this.imageHeight=r[1],this.imageWidth=r[0],this.opacity=s,this.originX=a[0],this.originY=
a[1],this.rotation=l,this.rotateWithView=h,this.scale=p,this.width=u[0]},e.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_},e.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_},e}(Fh);function Nh(t,e,i,r){var n=i-r;return t[e]===t[n]&&t[e+1]===t[n+1]&&(i-e)/r>3&&!!Ke(t,e,i,r)}var Gh=new lh("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 \x3e 0.0) {\n    vec2 windowCoords \x3d 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) \x3e v_halfWidth * u_pixelRatio) {\n      discard;\n    }\n  }\n  gl_FragColor \x3d u_color;\n  float alpha \x3d u_color.a * u_opacity;\n  if (alpha \x3d\x3d 0.0) {\n    discard;\n  }\n  gl_FragColor.a \x3d alpha;\n}\n"),
Dh=new uh("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 \x3d 0.000000000001;\n  return value \x3e\x3d ref - epsilon \x26\x26 value \x3c\x3d ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n  vec2 dirVect \x3d nextP - a_position;\n  vec2 normal \x3d normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n  offset \x3d 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 \x3d u_lineWidth / 2.0;\n  vec2 tangent \x3d normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n  vec2 normal \x3d vec2(-tangent.y, tangent.x);\n  vec2 dirVect \x3d a_nextPos - a_position;\n  vec2 tmpNormal \x3d normalize(vec2(-dirVect.y, dirVect.x));\n  float miterLength \x3d abs(halfWidth / dot(normal, tmpNormal));\n  offset \x3d normal * direction * miterLength;\n  round \x3d 0.0;\n  if (isRound) {\n    round \x3d 1.0;\n  } else if (miterLength \x3e u_miterLimit + u_lineWidth) {\n    offset \x3d halfWidth * tmpNormal * direction;\n  }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n  bool degenerate \x3d false;\n  vec2 tangent \x3d normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n  vec2 normal \x3d vec2(-tangent.y, tangent.x);\n  vec2 dirVect \x3d a_lastPos - a_position;\n  vec2 tmpNormal \x3d normalize(vec2(-dirVect.y, dirVect.x));\n  vec2 longOffset, shortOffset, longVertex;\n  vec4 shortProjVertex;\n  float halfWidth \x3d u_lineWidth / 2.0;\n  if (length(a_nextPos - a_position) \x3e length(a_lastPos - a_position)) {\n    longOffset \x3d tmpNormal * direction * halfWidth;\n    shortOffset \x3d normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n    longVertex \x3d a_nextPos;\n    shortProjVertex \x3d u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n  } else {\n    shortOffset \x3d tmpNormal * direction * halfWidth;\n    longOffset \x3d normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n    longVertex \x3d a_lastPos;\n    shortProjVertex \x3d 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 \x3d u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n  vec4 p2 \x3d projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n  vec4 p3 \x3d shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n  vec4 p4 \x3d shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n  float denom \x3d (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n  float firstU \x3d ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n  float secondU \x3d ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n  float epsilon \x3d 0.000000000001;\n  if (firstU \x3e epsilon \x26\x26 firstU \x3c 1.0 - epsilon \x26\x26 secondU \x3e epsilon \x26\x26 secondU \x3c 1.0 - epsilon) {\n    shortProjVertex.x \x3d p1.x + firstU * (p2.x - p1.x);\n    shortProjVertex.y \x3d p1.y + firstU * (p2.y - p1.y);\n    offset \x3d shortProjVertex.xy;\n    degenerate \x3d true;\n  } else {\n    float miterLength \x3d abs(halfWidth / dot(normal, tmpNormal));\n    offset \x3d 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 \x3d 0.0;\n  vec2 dirVect \x3d a_position - nextP;\n  vec2 firstNormal \x3d normalize(dirVect);\n  vec2 secondNormal \x3d vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n  vec2 hypotenuse \x3d normalize(firstNormal - secondNormal);\n  vec2 normal \x3d vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n  float length \x3d sqrt(v_halfWidth * v_halfWidth * 2.0);\n  offset \x3d normal * length;\n  if (isRound) {\n    round \x3d 1.0;\n  }\n}\n\nvoid main(void) {\n  bool degenerate \x3d false;\n  float direction \x3d float(sign(a_direction));\n  mat4 offsetMatrix \x3d u_offsetScaleMatrix * u_offsetRotateMatrix;\n  vec2 offset;\n  vec4 projPos \x3d u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n  bool round \x3d nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n  v_round \x3d 0.0;\n  v_halfWidth \x3d u_lineWidth / 2.0;\n  v_roundVertex \x3d 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 \x3d 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 \x3d offsetMatrix * vec4(offset, 0.0, 0.0);\n    gl_Position \x3d projPos + offsets;\n  } else {\n    gl_Position \x3d vec4(offset, 0.0, 1.0);\n  }\n}\n\n\n"),
kh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_miterLimit=t.getUniformLocation(e,"u_miterLimit"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_color=t.getUniformLocation(e,"u_color"),this.u_size=t.getUniformLocation(e,"u_size"),this.u_pixelRatio=
t.getUniformLocation(e,"u_pixelRatio"),this.a_lastPos=t.getAttribLocation(e,"a_lastPos"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_nextPos=t.getAttribLocation(e,"a_nextPos"),this.a_direction=t.getAttribLocation(e,"a_direction")},jh=3,Uh=5,Yh=7,Bh=11,Vh=13,Xh=17,zh=19,Wh=23,Kh=function(t){function e(e,i){t.call(this,e,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,
lineWidth:void 0,miterLimit:void 0,changed:!1}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i,r){var n,o,s,a,h,l,u,p,c=this.vertices.length,d=this.indices.length,f="bevel"===this.state_.lineJoin?0:"miter"===this.state_.lineJoin?1:2,_="butt"===this.state_.lineCap?0:"square"===this.state_.lineCap?1:2,g=Nh(t,e,i,r),y=d,v=1;for(n=e,o=i;n<o;n+=r){if(h=c/7,l=u,u=p||[t[n],t[n+1]],n===e){if(p=[t[n+r],t[n+r+1]],i-e==
2*r&&Z(u,p))break;if(!g){_&&(c=this.addVertices_([0,0],u,p,v*Yh*_,c),c=this.addVertices_([0,0],u,p,-v*Yh*_,c),this.indices[d++]=h+2,this.indices[d++]=h,this.indices[d++]=h+1,this.indices[d++]=h+1,this.indices[d++]=h+3,this.indices[d++]=h+2),c=this.addVertices_([0,0],u,p,v*jh*(_||1),c),y=(c=this.addVertices_([0,0],u,p,-v*jh*(_||1),c))/7-1;continue}l=[t[i-2*r],t[i-2*r+1]],s=p}else{if(n===i-r){if(g){p=s;break}l=l||[0,0],c=this.addVertices_(l,u,[0,0],v*Uh*(_||1),c),c=this.addVertices_(l,u,[0,0],-v*Uh*
(_||1),c),this.indices[d++]=h,this.indices[d++]=y-1,this.indices[d++]=y,this.indices[d++]=y,this.indices[d++]=h+1,this.indices[d++]=h,_&&(c=this.addVertices_(l,u,[0,0],v*Bh*_,c),c=this.addVertices_(l,u,[0,0],-v*Bh*_,c),this.indices[d++]=h+2,this.indices[d++]=h,this.indices[d++]=h+1,this.indices[d++]=h+1,this.indices[d++]=h+3,this.indices[d++]=h+2);break}p=[t[n+r],t[n+r+1]]}a=xh(l[0],l[1],u[0],u[1],p[0],p[1])?-1:1,c=this.addVertices_(l,u,p,a*Vh*(f||1),c),c=this.addVertices_(l,u,p,a*Xh*(f||1),c),c=
this.addVertices_(l,u,p,-a*zh*(f||1),c),n>e&&(this.indices[d++]=h,this.indices[d++]=y-1,this.indices[d++]=y,this.indices[d++]=h+2,this.indices[d++]=h,this.indices[d++]=v*a>0?y:y-1),this.indices[d++]=h,this.indices[d++]=h+2,this.indices[d++]=h+1,y=h+2,v=a,f&&(c=this.addVertices_(l,u,p,a*Wh*f,c),this.indices[d++]=h+1,this.indices[d++]=h+3,this.indices[d++]=h)}g&&(h=h||c/7,a=Si([l[0],l[1],u[0],u[1],p[0],p[1]],0,6,2)?1:-1,c=this.addVertices_(l,u,p,a*Vh*(f||1),c),c=this.addVertices_(l,u,p,-a*zh*(f||1),
c),this.indices[d++]=h,this.indices[d++]=y-1,this.indices[d++]=y,this.indices[d++]=h+1,this.indices[d++]=h,this.indices[d++]=v*a>0?y:y-1)},e.prototype.addVertices_=function(t,e,i,r,n){return 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,n},e.prototype.isValid_=function(t,e,i,r){var n=i-e;return!(n<2*r)&&(n!==2*r||!Z([t[e],t[e+1]],[t[e+r],t[e+r+1]]))},e.prototype.drawLineString=function(t,
e){var i=t.getFlatCoordinates(),r=t.getStride();this.isValid_(i,0,i.length,r)&&(i=Dt(i,0,i.length,r,-this.origin[0],-this.origin[1]),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e),this.drawCoordinates_(i,0,i.length,r))},e.prototype.drawMultiLineString=function(t,e){var i=this.indices.length,r=t.getEnds();r.unshift(0);var n,o,s=t.getFlatCoordinates(),a=t.getStride();if(r.length>
1)for(n=1,o=r.length;n<o;++n)if(this.isValid_(s,r[n-1],r[n],a)){var h=Dt(s,r[n-1],r[n],a,-this.origin[0],-this.origin[1]);this.drawCoordinates_(h,0,h.length,a)}this.indices.length>i&&(this.startIndices.push(i),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(i),this.state_.changed=!1))},e.prototype.drawPolygonCoordinates=function(t,e,i){var r,n;if(Nh(t,0,t.length,i)||(t.push(t[0]),t.push(t[1])),this.drawCoordinates_(t,0,t.length,i),e.length)for(r=0,n=e.length;r<n;++r)Nh(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)},e.prototype.setPolygonStyle=function(t,e){var i=void 0===e?this.indices.length:e;this.startIndices.push(i),this.startIndicesFeature.push(t),this.state_.changed&&(this.styleIndices_.push(i),this.state_.changed=!1)},e.prototype.getCurrentIndex=function(){return this.indices.length},e.prototype.finish=function(t){this.verticesBuffer=new Th(this.vertices),this.indicesBuffer=new Th(this.indices),this.startIndices.push(this.indices.length),
0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer;return function(){t.deleteBuffer(e),t.deleteBuffer(i)}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(Gh,Dh);return this.defaultLocations_?n=this.defaultLocations_:(n=new kh(t,o),this.defaultLocations_=n),e.useProgram(o),t.enableVertexAttribArray(n.a_lastPos),t.vertexAttribPointer(n.a_lastPos,
2,5126,!1,28,0),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,28,8),t.enableVertexAttribArray(n.a_nextPos),t.vertexAttribPointer(n.a_nextPos,2,5126,!1,28,16),t.enableVertexAttribArray(n.a_direction),t.vertexAttribPointer(n.a_direction,1,5126,!1,28,24),t.uniform2fv(n.u_size,i),t.uniform1f(n.u_pixelRatio,r),n},e.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)},e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a,h=t.getParameter(t.DEPTH_FUNC),l=t.getParameter(t.DEPTH_WRITEMASK);if(r||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setStrokeStyle_(t,a[0],a[1],a[2]),this.drawElements(t,e,o,s),t.clear(t.DEPTH_BUFFER_BIT),s=o;else this.drawReplaySkipping_(t,
e,i);r||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(l),t.depthFunc(h))},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-2,s=n=this.startIndices[l+1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setStrokeStyle_(t,a[0],a[1],a[2]),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),s=u),
l--,n=u;n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),n=s=h}},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=this.styles_[s],this.setStrokeStyle_(t,l[0],l[1],l[2]),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|
t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.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)},e.prototype.setFillStrokeStyle=function(t,e){var i=e.getLineCap();this.state_.lineCap=void 0!==i?i:"round";var r=e.getLineDash();this.state_.lineDash=r||yh;var n=e.getLineDashOffset();this.state_.lineDashOffset=n||0;var o=e.getLineJoin();
this.state_.lineJoin=void 0!==o?o:"round";var s=e.getColor();s=s instanceof CanvasGradient||s instanceof CanvasPattern?vh:_r(s).map(function(t,e){return 3!=e?t/255:t})||vh;var a=e.getWidth();a=void 0!==a?a:1;var h=e.getMiterLimit();h=void 0!==h?h:10,this.state_.strokeColor&&Z(this.state_.strokeColor,s)&&this.state_.lineWidth===a&&this.state_.miterLimit===h||(this.state_.changed=!0,this.state_.strokeColor=s,this.state_.lineWidth=a,this.state_.miterLimit=h,this.styles_.push([s,a,h]))},e}(_h),Hh=new lh("precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n  gl_FragColor \x3d u_color;\n  float alpha \x3d u_color.a * u_opacity;\n  if (alpha \x3d\x3d 0.0) {\n    discard;\n  }\n  gl_FragColor.a \x3d alpha;\n}\n"),
Zh=new uh("\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 \x3d u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n"),qh=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_color=t.getUniformLocation(e,
"u_color"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.a_position=t.getAttribLocation(e,"a_position")},Jh=function(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0};Jh.prototype.insertItem=function(t){var e={prev:void 0,next:void 0,data:t},i=this.head_;if(i){var r=i.next;e.prev=i,e.next=r,i.next=e,r&&(r.prev=e),i===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&(e.next=e,e.prev=e);this.head_=e,this.length_++},Jh.prototype.removeItem=
function(){var t=this.head_;if(t){var e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.head_=e||i,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=i?this.head_.prev:this.head_),this.length_--}},Jh.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},Jh.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},Jh.prototype.nextItem=
function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},Jh.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},Jh.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},Jh.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},Jh.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},Jh.prototype.setFirstItem=function(){this.circular_&&
this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},Jh.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_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}},Jh.prototype.getLength=function(){return this.length_};var Qh=Jh,$h=function(t){this.rbush_=ua()(t,void 0),
this.items_={}};$h.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_[o(e)]=i},$h.prototype.load=function(t,e){for(var i=new Array(e.length),r=0,n=e.length;r<n;r++){var s=t[r],a=e[r],h={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:a};i[r]=h,this.items_[o(a)]=h}this.rbush_.load(i)},$h.prototype.remove=function(t){var e=o(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)},$h.prototype.update=function(t,
e){var i=this.items_[o(e)];dt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))},$h.prototype.getAll=function(){return this.rbush_.all().map(function(t){return t.value})},$h.prototype.getInExtent=function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})},$h.prototype.forEach=function(t,e){return this.forEach_(this.getAll(),t,e)},$h.prototype.forEachInExtent=function(t,e,i){return this.forEach_(this.getInExtent(t),e,
i)},$h.prototype.forEach_=function(t,e,i){for(var r,n=0,o=t.length;n<o;n++)if(r=e.call(i,t[n]))return r;return r},$h.prototype.isEmpty=function(){return d(this.items_)},$h.prototype.clear=function(){this.rbush_.clear(),this.items_={}},$h.prototype.getExtent=function(t){var e=this.rbush_.toJSON();return lt(e.minX,e.minY,e.maxX,e.maxY,t)},$h.prototype.concat=function(t){for(var e in this.rbush_.load(t.rbush_.all()),t.items_)this.items_[e]=t.items_[e]};var tl=$h,el=function(t){function e(e,i){t.call(this,
e,i),this.lineStringReplay=new Kh(e,i),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={fillColor:null,changed:!1}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawCoordinates_=function(t,e,i){var r=new Qh,n=new tl;this.processFlatCoordinates_(t,i,r,n,!0);var o=this.getMaxCoords_(r);if(e.length){var s,a,h=[];for(s=0,a=e.length;s<a;++s){var l={list:new Qh,maxCoords:void 0,rtree:new tl};h.push(l),this.processFlatCoordinates_(e[s],
i,l.list,l.rtree,!1),this.classifyPoints_(l.list,l.rtree,!0),l.maxCoords=this.getMaxCoords_(l.list)}for(h.sort(function(t,e){return e.maxCoords[0]===t.maxCoords[0]?t.maxCoords[1]-e.maxCoords[1]:e.maxCoords[0]-t.maxCoords[0]}),s=0;s<h.length;++s){var u=h[s].list,p=u.firstItem(),c=p,d=void 0;do{if(this.getIntersections_(c,n).length){d=!0;break}c=u.nextItem()}while(p!==c);d||this.bridgeHole_(u,h[s].maxCoords[0],r,o[0],n)&&(n.concat(h[s].rtree),this.classifyPoints_(r,n,!1))}}else this.classifyPoints_(r,
n,!1);this.triangulate_(r,n)},e.prototype.processFlatCoordinates_=function(t,e,i,r,n){var o,s,a,h,l,u=Si(t,0,t.length,e),p=this.vertices.length/2,c=[],d=[];if(n===u){for(h=a=this.createPoint_(t[0],t[1],p++),o=e,s=t.length;o<s;o+=e)l=this.createPoint_(t[o],t[o+1],p++),d.push(this.insertItem_(h,l,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)]),h=l;d.push(this.insertItem_(l,a,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)])}else{var f=
t.length-e;for(h=a=this.createPoint_(t[f],t[f+1],p++),o=f-e,s=0;o>=s;o-=e)l=this.createPoint_(t[o],t[o+1],p++),d.push(this.insertItem_(h,l,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)]),h=l;d.push(this.insertItem_(l,a,i)),c.push([Math.min(h.x,l.x),Math.min(h.y,l.y),Math.max(h.x,l.x),Math.max(h.y,l.y)])}r.load(c,d)},e.prototype.getMaxCoords_=function(t){var e=t.firstItem(),i=e,r=[i.p0.x,i.p0.y];do(i=t.nextItem()).p0.x>r[0]&&(r=[i.p0.x,i.p0.y]);while(i!==e);return r},
e.prototype.classifyPoints_=function(t,e,i){var r=t.firstItem(),n=r,o=t.nextItem(),s=!1;do{var a=i?xh(o.p1.x,o.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):xh(n.p0.x,n.p0.y,n.p1.x,n.p1.y,o.p1.x,o.p1.y);void 0===a?(this.removeItem_(n,o,t,e),s=!0,o===r&&(r=t.getNextItem()),o=n,t.prevItem()):n.p1.reflex!==a&&(n.p1.reflex=a,s=!0),n=o,o=t.nextItem()}while(n!==r);return s},e.prototype.bridgeHole_=function(t,e,i,r,n){for(var o=t.firstItem();o.p1.x!==e;)o=t.nextItem();var s,a,h,l,u=o.p1,p={x:r,y:u.y,i:-1},c=1/0,d=this.getIntersections_({p0:u,
p1:p},n,!0);for(s=0,a=d.length;s<a;++s){var f=d[s],_=this.calculateIntersection_(u,p,f.p0,f.p1,!0),g=Math.abs(u.x-_[0]);g<c&&void 0!==xh(u.x,u.y,f.p0.x,f.p0.y,f.p1.x,f.p1.y)&&(c=g,l={x:_[0],y:_[1],i:-1},o=f)}if(c===1/0)return!1;if(h=o.p1,c>0){var y=this.getPointsInTriangle_(u,l,o.p1,n);if(y.length){var v=1/0;for(s=0,a=y.length;s<a;++s){var m=y[s],x=Math.atan2(u.y-m.y,p.x-m.x);(x<v||x===v&&m.x<h.x)&&(v=x,h=m)}}}for(o=i.firstItem();o.p1.x!==h.x||o.p1.y!==h.y;)o=i.nextItem();var E={x:u.x,y:u.y,i:u.i,
reflex:void 0},S={x:o.p1.x,y:o.p1.y,i:o.p1.i,reflex:void 0};return t.getNextItem().p0=E,this.insertItem_(u,o.p1,t,n),this.insertItem_(S,E,t,n),o.p1=S,t.setFirstItem(),i.concat(t),!0},e.prototype.triangulate_=function(t,e){for(var i=!1,r=this.isSimple_(t,e);t.getLength()>3;)if(r){if(!this.clipEars_(t,e,r,i)&&!this.classifyPoints_(t,e,i)&&!this.resolveSelfIntersections_(t,e,!0))break}else if(!this.clipEars_(t,e,r,i)&&!this.classifyPoints_(t,e,i)&&!this.resolveSelfIntersections_(t,e)){if(!(r=this.isSimple_(t,
e))){this.splitPolygon_(t,e);break}i=!this.isClockwise_(t),this.classifyPoints_(t,e,i)}if(3===t.getLength()){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}},e.prototype.clipEars_=function(t,e,i,r){var n,o,s,a=this.indices.length,h=t.firstItem(),l=t.getPrevItem(),u=h,p=t.nextItem(),c=t.getNextItem(),d=!1;do{if(n=u.p0,o=u.p1,s=p.p1,!1===o.reflex){var f=void 0;f=i?0===this.getPointsInTriangle_(n,o,s,e,!0).length:
r?this.diagonalIsInside_(c.p1,s,o,n,l.p0):this.diagonalIsInside_(l.p0,n,o,s,c.p1),(i||0===this.getIntersections_({p0:n,p1:s},e).length)&&f&&(i||!1===n.reflex||!1===s.reflex||Si([l.p0.x,l.p0.y,n.x,n.y,o.x,o.y,s.x,s.y,c.p1.x,c.p1.y],0,10,2)===!r)&&(this.indices[a++]=n.i,this.indices[a++]=o.i,this.indices[a++]=s.i,this.removeItem_(u,p,t,e),p===h&&(h=c),d=!0)}l=t.getPrevItem(),u=t.getCurrItem(),p=t.nextItem(),c=t.getNextItem()}while(u!==h&&t.getLength()>3);return d},e.prototype.resolveSelfIntersections_=
function(t,e,i){var r=t.firstItem();t.nextItem();var n=r,o=t.nextItem(),s=!1;do{var a=this.calculateIntersection_(n.p0,n.p1,o.p0,o.p1,i);if(a){var h=!1,l=this.vertices.length,u=this.indices.length,p=l/2,c=t.prevItem();t.removeItem(),e.remove(c),h=c===r;var d=void 0;if(i?(a[0]===n.p0.x&&a[1]===n.p0.y?(t.prevItem(),d=n.p0,o.p0=d,e.remove(n),h=h||n===r):(d=o.p1,n.p1=d,e.remove(o),h=h||o===r),t.removeItem()):(d=this.createPoint_(a[0],a[1],p),n.p1=d,o.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(o.p0.x,o.p1.x),Math.min(o.p0.y,o.p1.y),Math.max(o.p0.x,o.p1.x),Math.max(o.p0.y,o.p1.y)],o)),this.indices[u++]=c.p0.i,this.indices[u++]=c.p1.i,this.indices[u++]=d.i,s=!0,h)break}n=t.getPrevItem(),o=t.nextItem()}while(n!==r);return s},e.prototype.isSimple_=function(t,e){var i=t.firstItem(),r=i;do{if(this.getIntersections_(r,e).length)return!1;r=t.nextItem()}while(r!==i);return!0},e.prototype.isClockwise_=function(t){var e=
2*t.getLength(),i=new Array(e),r=t.firstItem(),n=r,o=0;do i[o++]=n.p0.x,i[o++]=n.p0.y,n=t.nextItem();while(n!==r);return Si(i,0,e,2)},e.prototype.splitPolygon_=function(t,e){var i=t.firstItem(),r=i;do{var n=this.getIntersections_(r,e);if(n.length){var o=n[0],s=this.vertices.length/2,a=this.calculateIntersection_(r.p0,r.p1,o.p0,o.p1),h=this.createPoint_(a[0],a[1],s),l=new Qh,u=new tl;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);for(var p=t.nextItem();p!==o;)this.insertItem_(p.p0,p.p1,l,u),e.remove(p),t.removeItem(),p=t.getCurrItem();this.insertItem_(o.p0,h,l,u),o.p0=h,e.update([Math.min(o.p1.x,h.x),Math.min(o.p1.y,h.y),Math.max(o.p1.x,h.x),Math.max(o.p1.y,h.y)],o),this.classifyPoints_(t,e,!1),this.triangulate_(t,e),this.classifyPoints_(l,u,!1),this.triangulate_(l,u);break}r=t.nextItem()}while(r!==i)},e.prototype.createPoint_=function(t,e,i){var r=this.vertices.length;return this.vertices[r++]=t,this.vertices[r++]=
e,{x:t,y:e,i:i,reflex:void 0}},e.prototype.insertItem_=function(t,e,i,r){var n={p0:t,p1:e};return i.insertItem(n),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),n},e.prototype.removeItem_=function(t,e,i,r){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))},e.prototype.getPointsInTriangle_=function(t,e,i,r,n){for(var o=[],s=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)]),a=0,h=s.length;a<h;++a)for(var l in s[a]){var u=s[a][l];"object"!=typeof u||n&&!u.reflex||u.x===t.x&&u.y===t.y||u.x===e.x&&u.y===e.y||u.x===i.x&&u.y===i.y||-1!==o.indexOf(u)||!fi([t.x,t.y,e.x,e.y,i.x,i.y],0,6,2,u.x,u.y)||o.push(u)}return o},e.prototype.getIntersections_=function(t,e,i){for(var r=t.p0,n=t.p1,o=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)]),s=[],a=0,h=o.length;a<h;++a){var l=
o[a];t!==l&&(i||l.p0!==n||l.p1!==r)&&this.calculateIntersection_(r,n,l.p0,l.p1,i)&&s.push(l)}return s},e.prototype.calculateIntersection_=function(t,e,i,r,n){var o=(r.y-i.y)*(e.x-t.x)-(r.x-i.x)*(e.y-t.y);if(0!==o){var s=((r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x))/o,a=((e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x))/o;if(!n&&s>mh&&s<1-mh&&a>mh&&a<1-mh||n&&s>=0&&s<=1&&a>=0&&a<=1)return[t.x+s*(e.x-t.x),t.y+s*(e.y-t.y)]}},e.prototype.diagonalIsInside_=function(t,e,i,r,n){if(void 0===e.reflex||void 0===r.reflex)return!1;
var o=(i.x-r.x)*(e.y-r.y)>(i.y-r.y)*(e.x-r.x),s=(n.x-r.x)*(e.y-r.y)<(n.y-r.y)*(e.x-r.x),a=(t.x-e.x)*(r.y-e.y)>(t.y-e.y)*(r.x-e.x),h=(i.x-e.x)*(r.y-e.y)<(i.y-e.y)*(r.x-e.x),l=r.reflex?s||o:s&&o,u=e.reflex?h||a:h&&a;return l&&u},e.prototype.drawMultiPolygon=function(t,e){var i,r,n,o,s=t.getEndss(),a=t.getStride(),h=this.indices.length,l=this.lineStringReplay.getCurrentIndex(),u=t.getFlatCoordinates(),p=0;for(i=0,r=s.length;i<r;++i){var c=s[i];if(c.length>0){var d=Dt(u,p,c[0],a,-this.origin[0],-this.origin[1]);
if(d.length){var f=[],_=void 0;for(n=1,o=c.length;n<o;++n)c[n]!==c[n-1]&&(_=Dt(u,c[n-1],c[n],a,-this.origin[0],-this.origin[1]),f.push(_));this.lineStringReplay.drawPolygonCoordinates(d,f,a),this.drawCoordinates_(d,f,a)}}p=c[c.length-1]}this.indices.length>h&&(this.startIndices.push(h),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(h),this.state_.changed=!1)),this.lineStringReplay.getCurrentIndex()>l&&this.lineStringReplay.setPolygonStyle(e,l)},e.prototype.drawPolygon=
function(t,e){var i=t.getEnds(),r=t.getStride();if(i.length>0){var n=t.getFlatCoordinates().map(Number),o=Dt(n,0,i[0],r,-this.origin[0],-this.origin[1]);if(o.length){var s,a,h,l=[];for(s=1,a=i.length;s<a;++s)i[s]!==i[s-1]&&(h=Dt(n,i[s-1],i[s],r,-this.origin[0],-this.origin[1]),l.push(h));this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(this.indices.length),this.state_.changed=!1),this.lineStringReplay.setPolygonStyle(e),this.lineStringReplay.drawPolygonCoordinates(o,
l,r),this.drawCoordinates_(o,l,r)}}},e.prototype.finish=function(t){this.verticesBuffer=new Th(this.vertices),this.indicesBuffer=new Th(this.indices),this.startIndices.push(this.indices.length),this.lineStringReplay.finish(t),0===this.styleIndices_.length&&this.styles_.length>0&&(this.styles_=[]),this.vertices=null,this.indices=null},e.prototype.getDeleteResourcesFunction=function(t){var e=this.verticesBuffer,i=this.indicesBuffer,r=this.lineStringReplay.getDeleteResourcesFunction(t);return function(){t.deleteBuffer(e),
t.deleteBuffer(i),r()}},e.prototype.setUpProgram=function(t,e,i,r){var n,o=e.getProgram(Hh,Zh);return this.defaultLocations_?n=this.defaultLocations_:(n=new qh(t,o),this.defaultLocations_=n),e.useProgram(o),t.enableVertexAttribArray(n.a_position),t.vertexAttribPointer(n.a_position,2,5126,!1,8,0),n},e.prototype.shutDownProgram=function(t,e){t.disableVertexAttribArray(e.a_position)},e.prototype.drawReplay=function(t,e,i,r){var n,o,s,a,h=t.getParameter(t.DEPTH_FUNC),l=t.getParameter(t.DEPTH_WRITEMASK);
if(r||(t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.NOTEQUAL)),d(i))for(s=this.startIndices[this.startIndices.length-1],n=this.styleIndices_.length-1;n>=0;--n)o=this.styleIndices_[n],a=this.styles_[n],this.setFillStyle_(t,a),this.drawElements(t,e,o,s),s=o;else this.drawReplaySkipping_(t,e,i);r||(t.disable(t.DEPTH_TEST),t.clear(t.DEPTH_BUFFER_BIT),t.depthMask(l),t.depthFunc(h))},e.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var s,a,h,l,u,p,c;for(c=this.startIndices.length-
2,h=this.startIndices[c+1],s=this.styleIndices_.length-1;s>=0;--s)for(l=this.styles_[s],this.setFillStyle_(t,l),u=this.styleIndices_[s];c>=0&&this.startIndices[c]>=u;){if(a=this.startIndices[c],void 0===i[o(p=this.startIndicesFeature[c])]&&p.getGeometry()&&(void 0===n||Pt(n,p.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var d=r(p);if(d)return d}c--,h=a}},e.prototype.drawReplaySkipping_=function(t,e,i){var r,n,s,a,h,l,u;for(l=this.startIndices.length-
2,s=n=this.startIndices[l+1],r=this.styleIndices_.length-1;r>=0;--r){for(a=this.styles_[r],this.setFillStyle_(t,a),h=this.styleIndices_[r];l>=0&&this.startIndices[l]>=h;)u=this.startIndices[l],i[o(this.startIndicesFeature[l])]&&(n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),s=u),l--,n=u;n!==s&&(this.drawElements(t,e,n,s),t.clear(t.DEPTH_BUFFER_BIT)),n=s=h}},e.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_color,e)},e.prototype.setFillStrokeStyle=function(t,
e){var i=t?t.getColor():[0,0,0,0];if(i=i instanceof CanvasGradient||i instanceof CanvasPattern?gh:_r(i).map(function(t,e){return 3!=e?t/255:t})||gh,this.state_.fillColor&&Z(i,this.state_.fillColor)||(this.state_.fillColor=i,this.state_.changed=!0,this.styles_.push(i)),e)this.lineStringReplay.setFillStrokeStyle(null,e);else{var r=new Er({color:[0,0,0,0],width:0});this.lineStringReplay.setFillStrokeStyle(null,r)}},e}(_h),il=function(t,e){this.space_=e,this.emptyBlocks_=[{x:0,y:0,width:t,height:t}],
this.entries_={},this.context_=Jn(t,t),this.canvas_=this.context_.canvas};il.prototype.get=function(t){return this.entries_[t]||null},il.prototype.add=function(t,e,i,r,n){for(var o=0,s=this.emptyBlocks_.length;o<s;++o){var a=this.emptyBlocks_[o];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_};return this.entries_[t]=h,r.call(n,this.context_,a.x+this.space_,a.y+this.space_),this.split_(o,a,e+this.space_,i+this.space_),h}}return null},
il.prototype.split_=function(t,e,i,r){var n,o;e.width-i>e.height-r?(n={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,n,o)):(n={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,n,o))},il.prototype.updateBlocks_=function(t,e,i){var r=[t,1];e.width>0&&e.height>0&&r.push(e),i.width>0&&i.height>0&&r.push(i),this.emptyBlocks_.splice.apply(this.emptyBlocks_,r)};var rl=il,nl=function(t){var e=
t||{};this.currentSize_=void 0!==e.initialSize?e.initialSize:256,this.maxSize_=void 0!==e.maxSize?e.maxSize:void 0!==nh?nh:2048,this.space_=void 0!==e.space?e.space:1,this.atlases_=[new rl(this.currentSize_,this.space_)],this.currentHitSize_=this.currentSize_,this.hitAtlases_=[new rl(this.currentHitSize_,this.space_)]};nl.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)},nl.prototype.getInfo_=
function(t,e){for(var i=0,r=t.length;i<r;++i){var n=t[i].get(e);if(n)return n}return null},nl.prototype.mergeInfos_=function(t,e){return{offsetX:t.offsetX,offsetY:t.offsetY,image:t.image,hitImage:e.image}},nl.prototype.add=function(t,e,i,r,n,o){if(e+this.space_>this.maxSize_||i+this.space_>this.maxSize_)return null;var s=this.add_(!1,t,e,i,r,o);if(!s)return null;var a=void 0!==n?n:I,h=this.add_(!0,t,e,i,a,o);return this.mergeInfos_(s,h)},nl.prototype.add_=function(t,e,i,r,n,o){var s,a,h,l,u=t?this.hitAtlases_:
this.atlases_;for(h=0,l=u.length;h<l;++h){if(a=(s=u[h]).add(e,i,r,n,o))return a;if(!a&&h===l-1){var p=void 0;t?(p=Math.min(2*this.currentHitSize_,this.maxSize_),this.currentHitSize_=p):(p=Math.min(2*this.currentSize_,this.maxSize_),this.currentSize_=p),s=new rl(p,this.space_),u.push(s),++l}}return null};var ol=nl,sl=function(t){function e(e,i){t.call(this,e,i),this.images_=[],this.textures_=[],this.measureCanvas_=Jn(0,0).canvas,this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,
lineJoin:void 0,lineWidth:0,miterLimit:void 0,fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.atlases_={},this.currAtlas_=void 0,this.scale=1,this.opacity=1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawText=function(t,e){if(this.text_){var i=null,r=2,n=2;switch(t.getType()){case Nt.POINT:case Nt.MULTI_POINT:r=(i=t.getFlatCoordinates()).length,
n=t.getStride();break;case Nt.CIRCLE:i=t.getCenter();break;case Nt.LINE_STRING:i=t.getFlatMidpoint();break;case Nt.MULTI_LINE_STRING:r=(i=t.getFlatMidpoints()).length;break;case Nt.POLYGON:i=t.getFlatInteriorPoint();break;case Nt.MULTI_POLYGON:r=(i=t.getFlatInteriorPoints()).length}this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var s,a,h,l,u,p,c,d,f=this.currAtlas_,_=this.text_.split("\n"),g=this.getTextSize_(_),y=Math.round(g[0]*this.textAlign_-this.offsetX_),v=Math.round(g[1]*
this.textBaseline_-this.offsetY_),m=this.state_.lineWidth/2*this.state_.scale;for(s=0,a=_.length;s<a;++s)for(u=0,p=f.height*s,h=0,l=(c=_[s].split("")).length;h<l;++h){if(d=f.atlas.getInfo(c[h])){var x=d.image;if(this.anchorX=y-u,this.anchorY=v-p,this.originX=0===h?d.offsetX-m:d.offsetX,this.originY=d.offsetY,this.height=f.height,this.width=0===h||h===c.length-1?f.width[c[h]]+m:f.width[c[h]],this.imageHeight=x.height,this.imageWidth=x.width,0===this.images_.length)this.images_.push(x);else o(this.images_[this.images_.length-
1])!=o(x)&&(this.groupIndices.push(this.indices.length),this.images_.push(x));this.drawText_(i,0,r,n)}u+=this.width}}},e.prototype.getTextSize_=function(t){var e=this,i=this.currAtlas_,r=t.length*i.height;return[t.map(function(t){for(var r=0,n=0,o=t.length;n<o;++n){var s=t[n];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)}),r]},e.prototype.drawText_=function(t,e,i,r){for(var n=e,o=i;n<o;n+=r)this.drawCoordinates(t,e,i,r)},e.prototype.addCharToAtlas_=
function(t){if(1===t.length){var e=this.currAtlas_,i=this.state_,r=this.measureCanvas_.getContext("2d");r.font=i.font;var n=Math.ceil(r.measureText(t).width*i.scale);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",ki&&i.lineDash&&(e.setLineDash(i.lineDash),e.lineDashOffset=i.lineDashOffset),1!==i.scale&&e.setTransform(i.scale,
0,0,i.scale,0,0),i.strokeColor&&e.strokeText(t,r,n),i.fillColor&&e.fillText(t,r,n)})&&(e.width[t]=n)}},e.prototype.finish=function(e){var i=e.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices=this.groupIndices,this.verticesBuffer=new Th(this.vertices),this.indicesBuffer=new Th(this.indices);this.createTextures(this.textures_,this.images_,{},i),this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:0,miterLimit:void 0,
fillColor:null,font:void 0,scale:void 0},this.text_="",this.textAlign_=void 0,this.textBaseline_=void 0,this.offsetX_=void 0,this.offsetY_=void 0,this.images_=null,this.atlases_={},this.currAtlas_=void 0,t.prototype.finish.call(this,e)},e.prototype.setTextStyle=function(t){var e=this.state_,i=t.getFill(),r=t.getStroke();if(t&&t.getText()&&(i||r)){if(i){var n=i.getColor();e.fillColor=Ys(n||gh)}else e.fillColor=null;if(r){var o=r.getColor();e.strokeColor=Ys(o||vh),e.lineWidth=r.getWidth()||1,e.lineCap=
r.getLineCap()||"round",e.lineDashOffset=r.getLineDashOffset()||0,e.lineJoin=r.getLineJoin()||"round",e.miterLimit=r.getMiterLimit()||10;var s=r.getLineDash();e.lineDash=s?s.slice():yh}else e.strokeColor=null,e.lineWidth=0;e.font=t.getFont()||"10px sans-serif",e.scale=t.getScale()||1,this.text_=t.getText();var a=Sa[t.getTextAlign()],h=Sa[t.getTextBaseline()];this.textAlign_=void 0===a?.5:a,this.textBaseline_=void 0===h?.5: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)}else this.text_=""},e.prototype.getAtlas_=function(t){var e=[];for(var i in t)(t[i]||0===t[i])&&(Array.isArray(t[i])?e=e.concat(t[i]):e.push(t[i]));var r=this.calculateHash_(e);if(!this.atlases_[r]){var n=this.measureCanvas_.getContext("2d");n.font=t.font;var o=Math.ceil((1.5*n.measureText("M").width+t.lineWidth/2)*t.scale);this.atlases_[r]={atlas:new ol({space:t.lineWidth+1}),width:{},height:o}}return this.atlases_[r]},
e.prototype.calculateHash_=function(t){for(var e="",i=0,r=t.length;i<r;++i)e+=t[i];return e},e.prototype.getTextures=function(t){return this.textures_},e.prototype.getHitDetectionTextures=function(){return this.textures_},e}(Fh),al=[1,1],hl={Circle:Ch,Image:Ah,LineString:Kh,Polygon:el,Text:sl},ll=function(t){function e(e,i,r){t.call(this),this.maxExtent_=i,this.tolerance_=e,this.renderBuffer_=r,this.replaysByZIndex_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.addDeclutter=function(t){return[]},e.prototype.getDeleteResourcesFunction=function(t){var e,i=[];for(e in this.replaysByZIndex_){var r=this.replaysByZIndex_[e];for(var n in r)i.push(r[n].getDeleteResourcesFunction(t))}return function(){for(var t,e=arguments,r=i.length,n=0;n<r;n++)t=i[n].apply(this,e);return t}},e.prototype.finish=function(t){var e;for(e in this.replaysByZIndex_){var i=this.replaysByZIndex_[e];for(var r in i)i[r].finish(t)}},e.prototype.getReplay=function(t,e){var i=
void 0!==t?t.toString():"0",r=this.replaysByZIndex_[i];void 0===r&&(r={},this.replaysByZIndex_[i]=r);var n=r[e];void 0===n&&(n=new (0,hl[e])(this.tolerance_,this.maxExtent_),r[e]=n);return n},e.prototype.isEmpty=function(){return d(this.replaysByZIndex_)},e.prototype.replay=function(t,e,i,r,n,o,s,a){var h,l,u,p,c,d,f=Object.keys(this.replaysByZIndex_).map(Number);for(f.sort(V),h=0,l=f.length;h<l;++h)for(c=this.replaysByZIndex_[f[h].toString()],u=0,p=Ea.length;u<p;++u)d=c[Ea[u]],void 0!==d&&d.replay(t,
e,i,r,n,o,s,a,void 0,!1)},e.prototype.replayHitDetection_=function(t,e,i,r,n,o,s,a,h,l,u){var p,c,d,f,_,g,y=Object.keys(this.replaysByZIndex_).map(Number);for(y.sort(function(t,e){return e-t}),p=0,c=y.length;p<c;++p)for(f=this.replaysByZIndex_[y[p].toString()],d=Ea.length-1;d>=0;--d)if(void 0!==(_=f[Ea[d]])&&(g=_.replay(t,e,i,r,n,o,s,a,h,l,u)))return g},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,o,s,a,h,l){var u,p=e.getGL();return p.bindFramebuffer(p.FRAMEBUFFER,e.getHitDetectionFramebuffer()),
void 0!==this.renderBuffer_&&(u=et(pt(t),r*this.renderBuffer_)),this.replayHitDetection_(e,t,r,n,al,s,a,h,function(t){var e=new Uint8Array(4);if(p.readPixels(0,0,1,1,p.RGBA,p.UNSIGNED_BYTE,e),e[3]>0){var i=l(t);if(i)return i}},!0,u)},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n,o,s,a,h){var l=e.getGL();return l.bindFramebuffer(l.FRAMEBUFFER,e.getHitDetectionFramebuffer()),void 0!==this.replayHitDetection_(e,t,r,n,al,s,a,h,function(t){var e=new Uint8Array(4);return l.readPixels(0,0,1,1,l.RGBA,
l.UNSIGNED_BYTE,e),e[3]>0},!1)},e}(ca),ul=function(t){function e(e,i,r,n,o,s,a){t.call(this),this.context_=e,this.center_=i,this.extent_=s,this.pixelRatio_=a,this.size_=o,this.rotation_=n,this.resolution_=r,this.imageStyle_=null,this.fillStyle_=null,this.strokeStyle_=null,this.textStyle_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.drawText_=function(t,e){var i=this.context_,r=t.getReplay(0,da.TEXT);r.setTextStyle(this.textStyle_),
r.drawText(e,null),r.finish(i);r.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),r.getDeleteResourcesFunction(i)()},e.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},e.prototype.drawGeometry=function(t){switch(t.getType()){case Nt.POINT:this.drawPoint(t,null);break;case Nt.LINE_STRING:this.drawLineString(t,null);break;case Nt.POLYGON:this.drawPolygon(t,
null);break;case Nt.MULTI_POINT:this.drawMultiPoint(t,null);break;case Nt.MULTI_LINE_STRING:this.drawMultiLineString(t,null);break;case Nt.MULTI_POLYGON:this.drawMultiPolygon(t,null);break;case Nt.GEOMETRY_COLLECTION:this.drawGeometryCollection(t,null);break;case Nt.CIRCLE:this.drawCircle(t,null)}},e.prototype.drawFeature=function(t,e){var i=e.getGeometryFunction()(t);i&&Pt(this.extent_,i.getExtent())&&(this.setStyle(e),this.drawGeometry(i))},e.prototype.drawGeometryCollection=function(t,e){var i,
r,n=t.getGeometriesArray();for(i=0,r=n.length;i<r;++i)this.drawGeometry(n[i])},e.prototype.drawPoint=function(t,e){var i=this.context_,r=new ll(1,this.extent_),n=r.getReplay(0,da.IMAGE);n.setImageStyle(this.imageStyle_),n.drawPoint(t,e),n.finish(i);n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.drawMultiPoint=function(t,e){var i=this.context_,r=new ll(1,
this.extent_),n=r.getReplay(0,da.IMAGE);n.setImageStyle(this.imageStyle_),n.drawMultiPoint(t,e),n.finish(i);n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.drawLineString=function(t,e){var i=this.context_,r=new ll(1,this.extent_),n=r.getReplay(0,da.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_),n.drawLineString(t,e),n.finish(i);n.replay(this.context_,
this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.drawMultiLineString=function(t,e){var i=this.context_,r=new ll(1,this.extent_),n=r.getReplay(0,da.LINE_STRING);n.setFillStrokeStyle(null,this.strokeStyle_),n.drawMultiLineString(t,e),n.finish(i);n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),
this.textStyle_&&this.drawText_(r,t)},e.prototype.drawPolygon=function(t,e){var i=this.context_,r=new ll(1,this.extent_),n=r.getReplay(0,da.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawPolygon(t,e),n.finish(i);n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.drawMultiPolygon=function(t,e){var i=this.context_,r=new ll(1,this.extent_),
n=r.getReplay(0,da.POLYGON);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawMultiPolygon(t,e),n.finish(i);n.replay(this.context_,this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.drawCircle=function(t,e){var i=this.context_,r=new ll(1,this.extent_),n=r.getReplay(0,da.CIRCLE);n.setFillStrokeStyle(this.fillStyle_,this.strokeStyle_),n.drawCircle(t,e),n.finish(i);n.replay(this.context_,
this.center_,this.resolution_,this.rotation_,this.size_,this.pixelRatio_,1,{},void 0,!1),n.getDeleteResourcesFunction(i)(),this.textStyle_&&this.drawText_(r,t)},e.prototype.setImageStyle=function(t){this.imageStyle_=t},e.prototype.setFillStrokeStyle=function(t,e){this.fillStyle_=t,this.strokeStyle_=e},e.prototype.setTextStyle=function(t){this.textStyle_=t},e}(Vs),pl=new lh("precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform float u_opacity;\nuniform sampler2D u_texture;\n\nvoid main(void) {\n  vec4 texColor \x3d texture2D(u_texture, v_texCoord);\n  gl_FragColor.rgb \x3d texColor.rgb;\n  gl_FragColor.a \x3d texColor.a * u_opacity;\n}\n"),
cl=new uh("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 \x3d u_projectionMatrix * vec4(a_position, 0., 1.);\n  v_texCoord \x3d (u_texCoordMatrix * vec4(a_texCoord, 0., 1.)).st;\n}\n\n\n"),dl=function(t,e){this.u_texCoordMatrix=t.getUniformLocation(e,"u_texCoordMatrix"),this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_opacity=t.getUniformLocation(e,
"u_opacity"),this.u_texture=t.getUniformLocation(e,"u_texture"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord")},fl=function(t){function e(e,i){t.call(this,i),this.mapRenderer=e,this.arrayBuffer_=new Th([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]),this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0,this.texCoordMatrix=[1,0,0,1,0,0],this.projectionMatrix=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.defaultLocations_=
null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.bindFramebuffer=function(t,e){var i=this.mapRenderer.getGL();if(void 0===this.framebufferDimension||this.framebufferDimension!=e){var r=function(t,e,i){t.isContextLost()||(t.deleteFramebuffer(e),t.deleteTexture(i))}.bind(null,i,this.framebuffer,this.texture);t.postRenderFunctions.push(r);var n=Ph(i,e,e),o=i.createFramebuffer();i.bindFramebuffer(36160,o),i.framebufferTexture2D(36160,36064,
eh,n,0),this.texture=n,this.framebuffer=o,this.framebufferDimension=e}else i.bindFramebuffer(36160,this.framebuffer)},e.prototype.composeFrame=function(t,e,i){this.dispatchComposeEvent_(ur.PRECOMPOSE,i,t),i.bindBuffer(34962,this.arrayBuffer_);var r,n=i.getGL(),o=i.getProgram(pl,cl);this.defaultLocations_?r=this.defaultLocations_:(r=new dl(n,o),this.defaultLocations_=r),i.useProgram(o)&&(n.enableVertexAttribArray(r.a_position),n.vertexAttribPointer(r.a_position,2,5126,!1,16,0),n.enableVertexAttribArray(r.a_texCoord),
n.vertexAttribPointer(r.a_texCoord,2,5126,!1,16,8),n.uniform1i(r.u_texture,0)),n.uniformMatrix4fv(r.u_texCoordMatrix,!1,fh(this.tmpMat4_,this.getTexCoordMatrix())),n.uniformMatrix4fv(r.u_projectionMatrix,!1,fh(this.tmpMat4_,this.getProjectionMatrix())),n.uniform1f(r.u_opacity,e.opacity),n.bindTexture(eh,this.getTexture()),n.drawArrays(5,0,4),this.dispatchComposeEvent_(ur.POSTCOMPOSE,i,t)},e.prototype.dispatchComposeEvent_=function(t,e,i){var r=this.getLayer();if(r.hasListener(t)){var n=i.viewState,
o=n.resolution,s=i.pixelRatio,a=i.extent,h=n.center,l=n.rotation,u=i.size,p=new ul(e,h,o,l,u,a,s),c=new Cs(t,p,i,null,e);r.dispatchEvent(c)}},e.prototype.getTexCoordMatrix=function(){return this.texCoordMatrix},e.prototype.getTexture=function(){return this.texture},e.prototype.getProjectionMatrix=function(){return this.projectionMatrix},e.prototype.handleWebGLContextLost=function(){this.texture=null,this.framebuffer=null,this.framebufferDimension=void 0},e.prototype.prepareFrame=function(t,e,i){return r()},
e.prototype.forEachLayerAtPixel=function(t,e,i,n){return r()},e}($s),_l=function(t){function e(e,i){t.call(this,e,i),this.image_=null,this.hitCanvasContext_=null,this.hitTransformationMatrix_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createTexture_=function(t){var e=t.getImage();return bh(this.mapRenderer.getGL(),e,33071,33071)},e.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer.getGL(),n=t.pixelRatio,o=t.viewState,
s=o.center,a=o.resolution,h=o.rotation,l=this.image_,u=this.texture,p=this.getLayer().getSource(),c=t.viewHints,d=t.extent;if(void 0!==e.extent&&(d=wt(d,e.extent)),!c[kn]&&!c[jn]&&!bt(d)){var f=o.projection,_=p.getImage(d,a,n,f);if(_)if(this.loadImage(_)&&(l=_,u=this.createTexture_(_),this.texture)){var g=function(t,e){t.isContextLost()||t.deleteTexture(e)}.bind(null,r,this.texture);t.postRenderFunctions.push(g)}}if(l){var y=this.mapRenderer.getContext().getCanvas();this.updateProjectionMatrix_(y.width,
y.height,n,s,a,h,l.getExtent()),this.hitTransformationMatrix_=null;var v=this.texCoordMatrix;Fe(v),je(v,1,-1),Ue(v,0,-1),this.image_=l,this.texture=u}return!!l},e.prototype.updateProjectionMatrix_=function(t,e,i,r,n,o,s){var a=t*n,h=e*n,l=this.projectionMatrix;Fe(l),je(l,2*i/a,2*i/h),ke(l,-o),Ue(l,s[0]-r[0],s[1]-r[1]),je(l,(s[2]-s[0])/2,(s[3]-s[1])/2),Ue(l,1,1)},e.prototype.forEachLayerAtPixel=function(t,e,i,r){if(this.image_&&this.image_.getImage()){var n=[this.image_.getImage().width,this.image_.getImage().height];
this.hitTransformationMatrix_||(this.hitTransformationMatrix_=this.getHitTransformationMatrix_(e.size,n));var o=De(this.hitTransformationMatrix_,t.slice());if(!(o[0]<0||o[0]>n[0]||o[1]<0||o[1]>n[1])){this.hitCanvasContext_||(this.hitCanvasContext_=Jn(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 s=this.hitCanvasContext_.getImageData(0,0,1,1).data;return s[3]>0?i.call(r,this.getLayer(),s):void 0}}},e.prototype.getHitTransformationMatrix_=
function(t,e){var i=[1,0,0,1,0,0];Ue(i,-1,-1),je(i,2/t[0],2/t[1]),Ue(i,0,t[1]),je(i,1,-1);var r=Be(this.projectionMatrix.slice()),n=[1,0,0,1,0,0];return Ue(n,0,e[1]),je(n,1,-1),je(n,e[0]/2,e[1]/2),Ue(n,1,1),Ae(n,r),Ae(n,i),n},e}(fl);_l.handles=function(t){return t.getType()===Ss.IMAGE},_l.create=function(t,e){return new _l(t,e)};var gl=_l,yl=function(t){function e(e){t.call(this,e);var i=e.getViewport();this.canvas_=document.createElement("canvas"),this.canvas_.style.width="100%",this.canvas_.style.height=
"100%",this.canvas_.style.display="block",this.canvas_.className=fo,i.insertBefore(this.canvas_,i.childNodes[0]||null),this.clipTileCanvasWidth_=0,this.clipTileCanvasHeight_=0,this.clipTileContext_=Jn(),this.renderedVisible_=!0,this.gl_=rh(this.canvas_,{antialias:!0,depth:!0,failIfMajorPerformanceCaveat:!0,preserveDrawingBuffer:!1,stencil:!0}),this.context_=new Mh(this.canvas_,this.gl_),v(this.canvas_,Lh.LOST,this.handleWebGLContextLost,this),v(this.canvas_,Lh.RESTORED,this.handleWebGLContextRestored,
this),this.textureCache_=new Rs,this.focus_=null,this.tileTextureQueue_=new bn(function(t){var e=t[1],i=t[2],r=e[0]-this.focus_[0],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(),r=i[0],n=i[3],o=i[4];this.bindTileTexture(r,n,o,Qa,Qa)}return!1}.bind(this),this.textureCacheFrameMarkerCount_=
0,this.initializeGL_()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.bindTileTexture=function(t,e,i,r,n){var o=this.getGL(),s=t.getKey();if(this.textureCache_.containsKey(s)){var a=this.textureCache_.get(s);o.bindTexture(eh,a.texture),a.magFilter!=r&&(o.texParameteri(eh,10240,r),a.magFilter=r),a.minFilter!=n&&(o.texParameteri(eh,10241,n),a.minFilter=n)}else{var h=o.createTexture(),l=t;if(o.bindTexture(eh,h),i>0){var u=this.clipTileContext_.canvas,
p=this.clipTileContext_;this.clipTileCanvasWidth_!==e[0]||this.clipTileCanvasHeight_!==e[1]?(u.width=e[0],u.height=e[1],this.clipTileCanvasWidth_=e[0],this.clipTileCanvasHeight_=e[1]):p.clearRect(0,0,e[0],e[1]),p.drawImage(l.getImage(),i,i,e[0],e[1],0,0,e[0],e[1]),o.texImage2D(eh,0,6408,6408,5121,u)}else o.texImage2D(eh,0,6408,6408,5121,l.getImage());o.texParameteri(eh,10240,r),o.texParameteri(eh,10241,n),o.texParameteri(eh,$a,33071),o.texParameteri(eh,th,33071),this.textureCache_.set(s,{texture:h,
magFilter:r,minFilter:n})}},e.prototype.dispatchRenderEvent=function(t,e){var i=this.getMap();if(i.hasListener(t)){var r=this.context_,n=e.extent,o=e.size,s=e.viewState,a=e.pixelRatio,h=s.resolution,l=s.center,u=s.rotation,p=new ul(r,l,h,u,o,n,a),c=new Cs(t,p,e,null,r);i.dispatchEvent(c)}},e.prototype.disposeInternal=function(){var e=this.getGL();e.isContextLost()||this.textureCache_.forEach(function(t){t&&e.deleteTexture(t.texture)}),this.context_.dispose(),t.prototype.disposeInternal.call(this)},
e.prototype.expireCache_=function(t,e){for(var i,r=this.getGL();this.textureCache_.getCount()-this.textureCacheFrameMarkerCount_>1024;){if(i=this.textureCache_.peekLast())r.deleteTexture(i.texture);else{if(+this.textureCache_.peekLastKey()==e.index)break;--this.textureCacheFrameMarkerCount_}this.textureCache_.pop()}},e.prototype.getContext=function(){return this.context_},e.prototype.getGL=function(){return this.gl_},e.prototype.getTileTextureQueue=function(){return this.tileTextureQueue_},e.prototype.handleWebGLContextLost=
function(t){t.preventDefault(),this.textureCache_.clear(),this.textureCacheFrameMarkerCount_=0;var e=this.getLayerRenderers();for(var i in e)e[i].handleWebGLContextLost()},e.prototype.handleWebGLContextRestored=function(){this.initializeGL_(),this.getMap().render()},e.prototype.initializeGL_=function(){var t=this.gl_;t.activeTexture(33984),t.blendFuncSeparate(770,771,1,771),t.disable(2884),t.disable(2929),t.disable(3089),t.disable(2960)},e.prototype.isTileTextureLoaded=function(t){return this.textureCache_.containsKey(t.getKey())},
e.prototype.renderFrame=function(t){var e=this.getContext(),i=this.getGL();if(i.isContextLost())return!1;if(!t)return this.renderedVisible_&&(this.canvas_.style.display="none",this.renderedVisible_=!1),!1;this.focus_=t.focus,this.textureCache_.set((-t.index).toString(),null),++this.textureCacheFrameMarkerCount_,this.dispatchRenderEvent(ur.PRECOMPOSE,t);var r=[],n=t.layerStatesArray;q(n,Zs);var o,s,a=t.viewState.resolution;for(o=0,s=n.length;o<s;++o){var h=n[o];if(mo(h,a)&&h.sourceState==ro.READY)this.getLayerRenderer(h.layer).prepareFrame(t,
h,e)&&r.push(h)}var l=t.size[0]*t.pixelRatio,u=t.size[1]*t.pixelRatio;for(this.canvas_.width==l&&this.canvas_.height==u||(this.canvas_.width=l,this.canvas_.height=u),i.bindFramebuffer(36160,null),i.clearColor(0,0,0,0),i.clear(16384),i.enable(3042),i.viewport(0,0,this.canvas_.width,this.canvas_.height),o=0,s=r.length;o<s;++o){var p=r[o];this.getLayerRenderer(p.layer).composeFrame(t,p,e)}this.renderedVisible_||(this.canvas_.style.display="",this.renderedVisible_=!0),this.calculateMatrices2D(t),this.textureCache_.getCount()-
this.textureCacheFrameMarkerCount_>1024&&t.postRenderFunctions.push(this.expireCache_.bind(this)),this.tileTextureQueue_.isEmpty()||(t.postRenderFunctions.push(this.loadNextTileTexture_),t.animate=!0),this.dispatchRenderEvent(ur.POSTCOMPOSE,t),this.scheduleRemoveUnusedLayerRenderers(t),this.scheduleExpireIconCache(t)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n,o,s){var a;if(this.getGL().isContextLost())return!1;var h,l=e.viewState,u=e.layerStatesArray;for(h=u.length-1;h>=0;--h){var p=
u[h],c=p.layer;if(mo(p,l.resolution)&&o.call(s,c))if(a=this.getLayerRenderer(c).forEachFeatureAtCoordinate(t,e,i,r))return a}},e.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){var o=!1;if(this.getGL().isContextLost())return!1;var s,a=e.viewState,h=e.layerStatesArray;for(s=h.length-1;s>=0;--s){var l=h[s],u=l.layer;if(mo(l,a.resolution)&&r.call(n,u))if(o=this.getLayerRenderer(u).hasFeatureAtCoordinate(t,e))return!0}return o},e.prototype.forEachLayerAtPixel=function(t,e,i,r,n,o,s){if(this.getGL().isContextLost())return!1;
var a,h,l=e.viewState,u=e.layerStatesArray;for(h=u.length-1;h>=0;--h){var p=u[h],c=p.layer;if(mo(p,l.resolution)&&o.call(n,c))if(a=this.getLayerRenderer(c).forEachLayerAtPixel(t,e,r,n))return a}},e}(qs),vl=function(t){function e(e,i,r){t.call(this);var n=r||{};this.tileCoord=e,this.state=i,this.interimTile=null,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,
e.prototype.changed=function(){this.dispatchEvent(M.CHANGE)},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==On.LOADED)return t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==On.LOADED){t.interimTile=null;break}t.getState()==On.LOADING?e=t:t.getState()==On.IDLE?e.interimTile=
t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){this.state=t,this.changed()},e.prototype.load=function(){},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var r=e-i+1E3/60;return r>=this.transition_?1:Vn(r/this.transition_)},e.prototype.inTransition=
function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(b);function ml(){var t=Jn(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var xl=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,s),this.crossOrigin_=n,this.src_=r,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.imageListenerKeys_=null,this.tileLoadFunction_=o}return t&&(e.__proto__=t),e.prototype=
Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==On.LOADING&&(this.unlistenImage_(),this.image_=ml()),this.interimTile&&this.interimTile.dispose(),this.state=On.ABORT,this.changed(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){this.state=On.ERROR,this.unlistenImage_(),this.image_=ml(),this.changed()},e.prototype.handleImageLoad_=
function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=On.LOADED:this.state=On.EMPTY,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==On.ERROR&&(this.state=On.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==On.IDLE&&(this.state=On.LOADING,this.changed(),this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)],this.tileLoadFunction_(this,
this.src_))},e.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(E),this.imageListenerKeys_=null},e}(vl);function El(t,e,i,r){return void 0!==r?(r[0]=t,r[1]=e,r[2]=i,r):[t,e,i]}function Sl(t,e,i){return t+"/"+e+"/"+i}function Tl(t){return Sl(t[0],t[1],t[2])}function Cl(t){return(t[1]<<t[0])+t[2]}var Rl=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.expireCache=function(t){for(;this.canExpireCache();){var e=
this.peekLast(),i=e.tileCoord[0].toString();if(i in t&&t[i].contains(e.tileCoord))break;this.pop().dispose()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=function(t){return t.split("/").map(Number)}(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(Tl(e.tileCoord)),e.dispose())},this)}},e}(Rs);function wl(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Il=function(t){function e(e){t.call(this),
this.projection_=Ee(e.projection),this.attributions_=wl(e.attributions),this.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,this.loading=!1,this.state_=void 0!==e.state?e.state:ro.READY,this.wrapX_=void 0!==e.wrapX&&e.wrapX}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},
e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return r()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=wl(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(D),Ll=[0,0,0],Ol=function(t){var e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=
t.resolutions,Y(function(t,e,i){var r=e||V;return t.every(function(e,n){if(0===n)return!0;var o=r(t[n-1],e);return!(o>0||i&&0===o)})}(this.resolutions_,function(t,e){return e-t},!0),17),!t.origins)for(var i=0,r=this.resolutions_.length-1;i<r;++i)if(e){if(this.resolutions_[i]/this.resolutions_[i+1]!==e){e=void 0;break}}else e=this.resolutions_[i]/this.resolutions_[i+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==
t.origins&&(this.origins_=t.origins,Y(this.origins_.length==this.resolutions_.length,20));var n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=It(n)),Y(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,Y(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:An,Y(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),
this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map(function(t,e){return new sa(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1))},this):n&&this.calculateTileRanges_(n)};Ol.prototype.forEachTileCoord=function(t,e,i){for(var r=this.getTileRangeForExtentAndZ(t,e),n=r.minX,o=r.maxX;n<=o;++n)for(var s=r.minY,a=r.maxY;s<=a;++s)i([e,n,s])},Ol.prototype.forEachTileCoordParentTileRange=function(t,e,i,r,n){var o,
s,a,h=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],a=t[2]):h=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(o=2===this.zoomFactor_?oa(s=Math.floor(s/2),s,a=Math.floor(a/2),a,r):this.getTileRangeForExtentAndZ(h,l,r),e.call(i,l,o))return!0;--l}return!1},Ol.prototype.getExtent=function(){return this.extent_},Ol.prototype.getMaxZoom=function(){return this.maxZoom},Ol.prototype.getMinZoom=function(){return this.minZoom},Ol.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},
Ol.prototype.getResolution=function(t){return this.resolutions_[t]},Ol.prototype.getResolutions=function(){return this.resolutions_},Ol.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){var r=2*t[1],n=2*t[2];return oa(r,r+1,n,n+1,e)}var o=this.getTileCoordExtent(t,i);return this.getTileRangeForExtentAndZ(o,t[0]+1,e)}return null},Ol.prototype.getTileRangeExtent=function(t,e,i){var r=this.getOrigin(t),n=this.getResolution(t),o=ho(this.getTileSize(t),
this.tmpSize_),s=r[0]+e.minX*o[0]*n,a=r[0]+(e.maxX+1)*o[0]*n;return lt(s,r[1]+e.minY*o[1]*n,a,r[1]+(e.maxY+1)*o[1]*n,i)},Ol.prototype.getTileRangeForExtentAndZ=function(t,e,i){var r=Ll;this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,r);var n=r[1],o=r[2];return this.getTileCoordForXYAndZ_(t[2],t[3],e,!0,r),oa(n,r[1],o,r[2],i)},Ol.prototype.getTileCoordCenter=function(t){var e=this.getOrigin(t[0]),i=this.getResolution(t[0]),r=ho(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*r[0]*i,e[1]+(t[2]+
.5)*r[1]*i]},Ol.prototype.getTileCoordExtent=function(t,e){var i=this.getOrigin(t[0]),r=this.getResolution(t[0]),n=ho(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*n[0]*r,s=i[1]+t[2]*n[1]*r;return lt(o,s,o+n[0]*r,s+n[1]*r,e)},Ol.prototype.getTileCoordForCoordAndResolution=function(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)},Ol.prototype.getTileCoordForXYAndResolution_=function(t,e,i,r,n){var o=this.getZForResolution(i),s=i/this.getResolution(o),a=this.getOrigin(o),h=
ho(this.getTileSize(o),this.tmpSize_),l=r?.5:0,u=r?0:.5,p=Math.floor((t-a[0])/i+l),c=Math.floor((e-a[1])/i+u),d=s*p/h[0],f=s*c/h[1];return r?(d=Math.ceil(d)-1,f=Math.ceil(f)-1):(d=Math.floor(d),f=Math.floor(f)),El(o,d,f,n)},Ol.prototype.getTileCoordForXYAndZ_=function(t,e,i,r,n){var o=this.getOrigin(i),s=this.getResolution(i),a=ho(this.getTileSize(i),this.tmpSize_),h=r?.5:0,l=r?0:.5,u=Math.floor((t-o[0])/s+h),p=Math.floor((e-o[1])/s+l),c=u/a[0],d=p/a[1];return r?(c=Math.ceil(c)-1,d=Math.ceil(d)-1):
(c=Math.floor(c),d=Math.floor(d)),El(i,c,d,n)},Ol.prototype.getTileCoordForCoordAndZ=function(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)},Ol.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]},Ol.prototype.getTileSize=function(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]},Ol.prototype.getFullTileRange=function(t){return this.fullTileRanges_?this.fullTileRanges_[t]:null},Ol.prototype.getZForResolution=function(t,e){return kt(z(this.resolutions_,
t,e||0),this.minZoom,this.maxZoom)},Ol.prototype.calculateTileRanges_=function(t){for(var e=this.resolutions_.length,i=new Array(e),r=this.minZoom;r<e;++r)i[r]=this.getTileRangeForExtentAndZ(t,r);this.fullTileRanges_=i};var Pl=Ol;function bl(t){var e=t.getDefaultTileGrid();return e||(e=Nl(t),t.setDefaultTileGrid(e)),e}function Ml(t,e,i,r){var n=void 0!==r?r:Q.TOP_LEFT,o=Al(t,e,i);return new Pl({extent:t,origin:function(t,e){var i;return e===Q.BOTTOM_LEFT?i=Et(t):e===Q.BOTTOM_RIGHT?i=St(t):e===Q.TOP_LEFT?
i=It(t):e===Q.TOP_RIGHT?i=Lt(t):Y(!1,13),i}(t,n),resolutions:o,tileSize:i})}function Fl(t){var e=t||{},i=e.extent||Ee("EPSG:3857").getExtent(),r={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Al(i,e.maxZoom,e.tileSize)};return new Pl(r)}function Al(t,e,i){for(var r=void 0!==e?e:Fn,n=Rt(t),o=Ot(t),s=ho(void 0!==i?i:An),a=Math.max(o/s[0],n/s[1]),h=r+1,l=new Array(h),u=0;u<h;++u)l[u]=a/Math.pow(2,u);return l}function Nl(t,e,i,r){return Ml(Gl(t),e,i,r)}function Gl(t){var e=(t=Ee(t)).getExtent();
if(!e){var i=180*Qt[$t.DEGREES]/t.getMetersPerUnit();e=lt(-i,-i,i,i)}return e}var Dl=function(t){function e(e){t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX}),this.opaque_=void 0!==e.opaque&&e.opaque,this.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,this.tileGrid=void 0!==e.tileGrid?e.tileGrid:null,this.tileCache=new Rl(e.cacheSize),this.tmpSize=[0,0],this.key_=e.key||"",this.tileOptions=
{transition:e.transition}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);i&&i.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,i,r){var n=this.getTileCacheForProjection(t);if(!n)return!1;for(var o,s,a,h=!0,l=i.minX;l<=i.maxX;++l)for(var u=i.minY;u<=i.maxY;++u)s=Sl(e,l,u),a=!1,n.containsKey(s)&&
(a=(o=n.get(s)).getState()===On.LOADED)&&(a=!1!==r(o)),a||(h=!1);return h},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,i,n,o){return r()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=
function(t){return this.tileGrid?this.tileGrid:bl(t)},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();return e&&!Ie(e,t)?null:this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,i){var r=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),o=ho(r.getTileSize(t),this.tmpSize);return 1==n?o:ao(o,n,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var i=void 0!==e?e:
this.getProjection(),r=this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){var r=e[0],n=t.getTileCoordCenter(e),o=Gl(i);if(nt(o,n))return e;var s=Ot(o),a=Math.ceil((o[0]-n[0])/s);return n[0]+=s*a,t.getTileCoordForCoordAndZ(n,r)}(r,t,i)),function(t,e){var i=t[0],r=t[1],n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;var o,s=e.getExtent();return!(o=s?e.getTileRangeForExtentAndZ(s,i):e.getFullTileRange(i))||o.containsXY(r,n)}(t,r)?t:null},e.prototype.refresh=
function(){this.tileCache.clear(),this.changed()},e.prototype.useTile=function(t,e,i,r){},e}(Il),kl=function(t){function e(e,i){t.call(this,e),this.tile=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),jl=Dl,Ul=new lh("precision mediump float;\nvarying vec2 v_texCoord;\n\n\nuniform sampler2D u_texture;\n\nvoid main(void) {\n  gl_FragColor \x3d texture2D(u_texture, v_texCoord);\n}\n"),Yl=new uh("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 \x3d vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);\n  v_texCoord \x3d a_texCoord;\n}\n\n\n"),
Bl=function(t,e){this.u_tileOffset=t.getUniformLocation(e,"u_tileOffset"),this.u_texture=t.getUniformLocation(e,"u_texture"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord")},Vl=function(t){function e(e,i){t.call(this,e,i),this.fragmentShader_=Ul,this.vertexShader_=Yl,this.locations_=null,this.renderArrayBuffer_=new Th([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]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.mapRenderer.getContext().deleteBuffer(this.renderArrayBuffer_),t.prototype.disposeInternal.call(this)},e.prototype.createLoadedTileFinder=function(t,e,i){var r=this.mapRenderer;return function(n,o){return t.forEachLoadedTile(e,n,o,function(t){var e=r.isTileTextureLoaded(t);return e&&(i[n]||(i[n]={}),i[n][t.tileCoord.toString()]=t),e})}},e.prototype.handleWebGLContextLost=
function(){t.prototype.handleWebGLContextLost.call(this),this.locations_=null},e.prototype.prepareFrame=function(t,e,i){var r=this.mapRenderer,n=i.getGL(),o=t.viewState,s=o.projection,a=this.getLayer(),h=a.getSource();if(!(h instanceof jl))return!0;var l,u=h.getTileGridForProjection(s),p=u.getZForResolution(o.resolution),c=u.getResolution(p),d=h.getTilePixelSize(p,t.pixelRatio,s),f=d[0]/ho(u.getTileSize(p),this.tmpSize_)[0],_=c/f,g=h.getTilePixelRatio(f)*h.getGutterForProjection(s),y=o.center,v=t.extent,
m=u.getTileRangeForExtentAndZ(v,p);if(this.renderedTileRange_&&this.renderedTileRange_.equals(m)&&this.renderedRevision_==h.getRevision())l=this.renderedFramebufferExtent_;else{var x=m.getSize(),E=function(t){return Y(0<t,29),Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}(Math.max(x[0]*d[0],x[1]*d[1])),S=_*E,T=u.getOrigin(p),C=T[0]+m.minX*d[0]*_,R=T[1]+m.minY*d[1]*_;l=[C,R,C+S,R+S],this.bindFramebuffer(t,E),n.viewport(0,0,E,E),n.clearColor(0,0,0,0),n.clear(16384),n.disable(3042);var w=i.getProgram(this.fragmentShader_,
this.vertexShader_);i.useProgram(w),this.locations_||(this.locations_=new Bl(n,w)),i.bindBuffer(34962,this.renderArrayBuffer_),n.enableVertexAttribArray(this.locations_.a_position),n.vertexAttribPointer(this.locations_.a_position,2,5126,!1,16,0),n.enableVertexAttribArray(this.locations_.a_texCoord),n.vertexAttribPointer(this.locations_.a_texCoord,2,5126,!1,16,8),n.uniform1i(this.locations_.u_texture,0);var I={};I[p]={};var L,O,P,b,M,F,A=this.createLoadedTileFinder(h,s,I),N=a.getUseInterimTilesOnError(),
G=!0,D=[1/0,1/0,-1/0,-1/0],k=new sa(0,0,0,0);for(b=m.minX;b<=m.maxX;++b)for(M=m.minY;M<=m.maxY;++M)if(O=h.getTile(p,b,M,f,s),void 0===e.extent||Pt(F=u.getTileCoordExtent(O.tileCoord,D),e.extent)){if((P=O.getState())==On.LOADED||P==On.EMPTY||P==On.ERROR&&!N||(O=O.getInterimTile()),(P=O.getState())==On.LOADED){if(r.isTileTextureLoaded(O)){I[p][O.tileCoord.toString()]=O;continue}}else if(P==On.EMPTY||P==On.ERROR&&!N)continue;G=!1,u.forEachTileCoordParentTileRange(O.tileCoord,A,null,k,D)||(L=u.getTileCoordChildTileRange(O.tileCoord,
k,D))&&A(p+1,L)}var j=Object.keys(I).map(Number);j.sort(V);for(var U=new Float32Array(4),B=0,X=j.length;B<X;++B){var z=I[j[B]];for(var W in z)(O=z[W])instanceof xl&&(F=u.getTileCoordExtent(O.tileCoord,D),U[0]=2*(F[2]-F[0])/S,U[1]=2*(F[3]-F[1])/S,U[2]=2*(F[0]-l[0])/S-1,U[3]=2*(F[1]-l[1])/S-1,n.uniform4fv(this.locations_.u_tileOffset,U),r.bindTileTexture(O,d,g*f,Qa,Qa),n.drawArrays(5,0,4))}G?(this.renderedTileRange_=m,this.renderedFramebufferExtent_=l,this.renderedRevision_=h.getRevision()):(this.renderedTileRange_=
null,this.renderedFramebufferExtent_=null,this.renderedRevision_=-1,t.animate=!0)}this.updateUsedTiles(t.usedTiles,h,p,m);var K=r.getTileTextureQueue();this.manageTilePyramid(t,h,u,f,s,v,p,a.getPreload(),function(t){t.getState()!=On.LOADED||r.isTileTextureLoaded(t)||K.isKeyQueued(t.getKey())||K.enqueue([t,u.getTileCoordCenter(t.tileCoord),u.getResolution(t.tileCoord[0]),d,g*f])},this),this.scheduleExpireCache(t,h);var H=this.texCoordMatrix;return Fe(H),Ue(H,(Math.round(y[0]/c)*c-l[0])/(l[2]-l[0]),
(Math.round(y[1]/c)*c-l[1])/(l[3]-l[1])),0!==o.rotation&&ke(H,o.rotation),je(H,t.size[0]*o.resolution/(l[2]-l[0]),t.size[1]*o.resolution/(l[3]-l[1])),Ue(H,-.5,-.5),!0},e.prototype.forEachLayerAtPixel=function(t,e,i,r){if(this.framebuffer){var n=[t[0]/e.size[0],(e.size[1]-t[1])/e.size[1]],o=De(this.texCoordMatrix,n.slice()),s=[o[0]*this.framebufferDimension,o[1]*this.framebufferDimension],a=this.mapRenderer.getContext().getGL();a.bindFramebuffer(a.FRAMEBUFFER,this.framebuffer);var h=new Uint8Array(4);
return a.readPixels(s[0],s[1],1,1,a.RGBA,a.UNSIGNED_BYTE,h),h[3]>0?i.call(r,this.getLayer(),h):void 0}},e}(fl);Vl.handles=function(t){return t.getType()===Ss.TILE},Vl.create=function(t,e){return new Vl(t,e)};var Xl=Vl,zl=function(t){function e(e,i){t.call(this,e,i),this.dirty_=!1,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRenderOrder_=null,this.replayGroup_=null,this.layerState_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.composeFrame=function(t,e,i){this.layerState_=e;var r=t.viewState,n=this.replayGroup_,o=t.size,s=t.pixelRatio,a=this.mapRenderer.getGL();n&&!n.isEmpty()&&(a.enable(a.SCISSOR_TEST),a.scissor(0,0,o[0]*s,o[1]*s),n.replay(i,r.center,r.resolution,r.rotation,o,s,e.opacity,e.managed?t.skippedFeatureUids:{}),a.disable(a.SCISSOR_TEST))},e.prototype.disposeInternal=function(){var e=this.replayGroup_;if(e){var i=this.mapRenderer.getContext();e.getDeleteResourcesFunction(i)(),
this.replayGroup_=null}t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.replayGroup_&&this.layerState_){var s=this.mapRenderer.getContext(),a=e.viewState,h=this.getLayer(),l=this.layerState_,u={};return this.replayGroup_.forEachFeatureAtCoordinate(t,s,a.center,a.resolution,a.rotation,e.size,e.pixelRatio,l.opacity,{},function(t){var e=o(t);if(!(e in u))return u[e]=!0,r.call(n,t,h)})}},e.prototype.hasFeatureAtCoordinate=function(t,e){if(this.replayGroup_&&
this.layerState_){var i=this.mapRenderer.getContext(),r=e.viewState,n=this.layerState_;return this.replayGroup_.hasFeatureAtCoordinate(t,i,r.center,r.resolution,r.rotation,e.size,e.pixelRatio,n.opacity,e.skippedFeatureUids)}return!1},e.prototype.forEachLayerAtPixel=function(t,e,i,r){var n=De(e.pixelToCoordinateTransform,t.slice());return this.hasFeatureAtCoordinate(n,e)?i.call(r,this.getLayer(),null):void 0},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=
function(t,e,i){var r=this.getLayer(),n=r.getSource(),o=t.viewHints[kn],s=t.viewHints[jn],a=r.getUpdateWhileAnimating(),h=r.getUpdateWhileInteracting();if(!this.dirty_&&!a&&o||!h&&s)return!0;var l=t.extent,u=t.viewState,p=u.projection,c=u.resolution,d=t.pixelRatio,f=r.getRevision(),_=r.getRenderBuffer(),g=r.getRenderOrder();void 0===g&&(g=Da);var y=et(l,_*c);if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==f&&this.renderedRenderOrder_==g&&ot(this.renderedExtent_,y))return!0;this.replayGroup_&&
t.postRenderFunctions.push(this.replayGroup_.getDeleteResourcesFunction(i)),this.dirty_=!1;var v=new ll(ja(c,d),y,r.getRenderBuffer());n.loadFeatures(y,c,p);var m=function(t){var e,i=t.getStyleFunction()||r.getStyleFunction();if(i&&(e=i(t,c)),e){var n=this.renderFeature(t,c,d,e,v);this.dirty_=this.dirty_||n}}.bind(this);if(g){var x=[];n.forEachFeatureInExtent(y,function(t){x.push(t)}),x.sort(g),x.forEach(m.bind(this))}else n.forEachFeatureInExtent(y,m);return v.finish(i),this.renderedResolution_=
c,this.renderedRevision_=f,this.renderedRenderOrder_=g,this.renderedExtent_=y,this.replayGroup_=v,!0},e.prototype.renderFeature=function(t,e,i,r,n){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var s=r.length-1;s>=0;--s)o=Ua(n,t,r[s],ka(e,i),this.handleStyleImageChange_,this)||o;else o=Ua(n,t,r,ka(e,i),this.handleStyleImageChange_,this)||o;return o},e}(fl);zl.handles=function(t){return t.getType()===Ss.VECTOR},zl.create=function(t,e){return new zl(t,e)};var Wl=zl,Kl=function(t){function e(e){(e=
u({},e)).controls||(e.controls=wo()),e.interactions||(e.interactions=ys()),t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createRenderer=function(){var t=new yl(this);return t.registerLayerRenderers([gl,Xl,Wl]),t},e}(lo),Hl={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};function Zl(t,e,i,r){return function(n,o,s){var a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(n,o,s):t,!0),e.getType()==Hl.ARRAY_BUFFER&&
(a.responseType="arraybuffer"),a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){var n,o=e.getType();o==Hl.JSON||o==Hl.TEXT?n=a.responseText:o==Hl.XML?(n=a.responseXML)||(n=(new DOMParser).parseFromString(a.responseText,"application/xml")):o==Hl.ARRAY_BUFFER&&(n=a.response),n?i.call(this,e.readFeatures(n,{featureProjection:s}),e.readProjection(n),e.getLastExtent()):r.call(this)}else r.call(this)}.bind(this),a.onerror=function(){r.call(this)}.bind(this),a.send()}}function ql(t,e){return Zl(t,
e,function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)},I)}function Jl(t,e){return[[-1/0,-1/0,1/0,1/0]]}var Ql=document.implementation.createDocument("","",null),$l="http://www.w3.org/2001/XMLSchema-instance";function tu(t,e){return Ql.createElementNS(t,e)}function eu(t,e){return function t(e,i,r){if(e.nodeType==Node.CDATA_SECTION_NODE||e.nodeType==Node.TEXT_NODE)i?r.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):r.push(e.nodeValue);else{var n;for(n=e.firstChild;n;n=n.nextSibling)t(n,
i,r)}return r}(t,e,[]).join("")}function iu(t){return"documentElement"in t}function ru(t){return(new DOMParser).parseFromString(t,"application/xml")}function nu(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&K(r[r.length-1],n)}}function ou(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&r[r.length-1].push(n)}}function su(t,e){return function(i,r){var n=t.call(void 0!==e?e:this,i,r);void 0!==n&&(r[r.length-1]=n)}}function au(t,e,i){return function(r,
n){var o=t.call(void 0!==i?i:this,r,n);if(void 0!==o){var s=n[n.length-1],a=void 0!==e?e:r.localName;(a in s?s[a]:s[a]=[]).push(o)}}}function hu(t,e,i){return function(r,n){var o=t.call(void 0!==i?i:this,r,n);void 0!==o&&(n[n.length-1][void 0!==e?e:r.localName]=o)}}function lu(t,e){return function(i,r,n){t.call(void 0!==e?e:this,i,r,n),n[n.length-1].node.appendChild(i)}}function uu(t,e){var i,r;return function(e,n,o){if(void 0===i){i={};var s={};s[e.localName]=t,i[e.namespaceURI]=s,r=pu(e.localName)}yu(i,
r,n,o)}}function pu(t,e){var i=t;return function(t,r,n){var o=r[r.length-1].node,s=i;return void 0===s&&(s=n),tu(void 0!==e?e:o.namespaceURI,s)}}var cu=pu();function du(t,e){for(var i=e.length,r=new Array(i),n=0;n<i;++n)r[n]=t[e[n]];return r}function fu(t,e,i){var r,n,o=void 0!==i?i:{};for(r=0,n=t.length;r<n;++r)o[t[r]]=e;return o}function _u(t,e,i,r){var n;for(n=e.firstElementChild;n;n=n.nextElementSibling){var o=t[n.namespaceURI];if(void 0!==o){var s=o[n.localName];void 0!==s&&s.call(r,n,i)}}}function gu(t,
e,i,r,n){return r.push(t),_u(e,i,r,n),r.pop()}function yu(t,e,i,r,n,o){for(var s,a,h=(void 0!==n?n:i).length,l=0;l<h;++l)void 0!==(s=i[l])&&void 0!==(a=e.call(void 0!==o?o:this,s,r,void 0!==n?n[l]:void 0))&&t[a.namespaceURI][a.localName].call(o,a,s,r)}function vu(t,e,i,r,n,o,s){return n.push(t),yu(e,i,r,n,o,s),n.pop()}var mu=function(t){function e(e){t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=
e.matrixIds}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(Pl),xu=mu;function Eu(t,e,i){var r=[],n=[],o=[],s=[],a=[],h=void 0!==i?i:[],l=t.SupportedCRS,u=Ee(l.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ee(l),p=u.getMetersPerUnit(),c="ne"==u.getAxisOrientation().substr(0,2);return t.TileMatrix.sort(function(t,e){return e.ScaleDenominator-
t.ScaleDenominator}),t.TileMatrix.forEach(function(e){if(!(h.length>0)||H(h,function(i){return e.Identifier==i.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===i.TileMatrix})){n.push(e.Identifier);var i=2.8E-4*e.ScaleDenominator/p,l=e.TileWidth,u=e.TileHeight;c?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),r.push(i),s.push(l==u?l:[l,u]),a.push([e.MatrixWidth,-e.MatrixHeight])}}),new mu({extent:e,origins:o,resolutions:r,matrixIds:n,tileSizes:s,sizes:a})}
var Su=function(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale};Su.prototype.clone=function(){return new Su({opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},Su.prototype.getOpacity=function(){return this.opacity_},Su.prototype.getRotateWithView=function(){return this.rotateWithView_},Su.prototype.getRotation=function(){return this.rotation_},Su.prototype.getScale=
function(){return this.scale_},Su.prototype.getSnapToPixel=function(){return!1},Su.prototype.getAnchor=function(){return r()},Su.prototype.getImage=function(t){return r()},Su.prototype.getHitDetectionImage=function(t){return r()},Su.prototype.getImageState=function(){return r()},Su.prototype.getImageSize=function(){return r()},Su.prototype.getHitDetectionImageSize=function(){return r()},Su.prototype.getOrigin=function(){return r()},Su.prototype.getSize=function(){return r()},Su.prototype.setOpacity=
function(t){this.opacity_=t},Su.prototype.setRotateWithView=function(t){this.rotateWithView_=t},Su.prototype.setRotation=function(t){this.rotation_=t},Su.prototype.setScale=function(t){this.scale_=t},Su.prototype.setSnapToPixel=function(t){},Su.prototype.listenImageChange=function(t,e){return r()},Su.prototype.load=function(){r()},Su.prototype.unlistenImageChange=function(t,e){r()};var Tu=Su,Cu=function(t){function e(e){var i=void 0!==e.rotateWithView&&e.rotateWithView;t.call(this,{opacity:1,rotateWithView:i,
rotation:void 0!==e.rotation?e.rotation:0,scale:1}),this.checksums_=null,this.canvas_=null,this.hitDetectionCanvas_=null,this.fill_=void 0!==e.fill?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=void 0!==e.radius?e.radius:e.radius1,this.radius2_=e.radius2,this.angle_=void 0!==e.angle?e.angle:0,this.stroke_=void 0!==e.stroke?e.stroke:null,this.anchor_=null,this.size_=null,this.imageSize_=null,this.hitDetectionImageSize_=null,this.atlasManager_=e.atlasManager,this.render_(this.atlasManager_)}
return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),
t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_},e.prototype.getImage=function(t){return this.canvas_},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return xs.LOADED},e.prototype.getOrigin=
function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t,e){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t,e){},e.prototype.render_=function(t){var e,i,r="",n="",o=0,s=null,a=0,h=0;this.stroke_&&
(null===(i=this.stroke_.getColor())&&(i=Ls),i=Ys(i),void 0===(h=this.stroke_.getWidth())&&(h=1),s=this.stroke_.getLineDash(),a=this.stroke_.getLineDashOffset(),ki||(s=null,a=0),void 0===(n=this.stroke_.getLineJoin())&&(n="round"),void 0===(r=this.stroke_.getLineCap())&&(r="round"),void 0===(o=this.stroke_.getMiterLimit())&&(o=10));var l=2*(this.radius_+h)+1,u={strokeStyle:i,strokeWidth:h,size:l,lineCap:r,lineDash:s,lineDashOffset:a,lineJoin:n,miterLimit:o};if(void 0===t){var p=Jn(l,l);this.canvas_=
p.canvas,e=l=this.canvas_.width,this.draw_(u,p,0,0),this.createHitDetectionCanvas_(u)}else{l=Math.round(l);var c,d=!this.fill_;d&&(c=this.drawHitDetectionCanvas_.bind(this,u));var f=this.getChecksum(),_=t.add(f,l,l,this.draw_.bind(this,u),c);this.canvas_=_.image,this.origin_=[_.offsetX,_.offsetY],e=_.image.width,d?(this.hitDetectionCanvas_=_.hitImage,this.hitDetectionImageSize_=[_.hitImage.width,_.hitImage.height]):(this.hitDetectionCanvas_=this.canvas_,this.hitDetectionImageSize_=[e,e])}this.anchor_=
[l/2,l/2],this.size_=[l,l],this.imageSize_=[e,e]},e.prototype.draw_=function(t,e,i,r){var n,o,s;e.setTransform(1,0,0,1,0,0),e.translate(i,r),e.beginPath();var a=this.points_;if(a===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(a*=2),n=0;n<=a;n++)o=2*n*Math.PI/a-Math.PI/2+this.angle_,s=n%2==0?this.radius_:h,e.lineTo(t.size/2+s*Math.cos(o),t.size/2+s*Math.sin(o))}if(this.fill_){var l=this.fill_.getColor();
null===l&&(l=ws),e.fillStyle=Ys(l),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,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()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.fill_)this.hitDetectionCanvas_=this.canvas_;else{var e=Jn(t.size,t.size);this.hitDetectionCanvas_=e.canvas,this.drawHitDetectionCanvas_(t,
e,0,0)}},e.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===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o,s,a,h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(n*=2),o=0;o<=n;o++)a=2*o*Math.PI/n-Math.PI/2+this.angle_,s=o%2==0?this.radius_:h,e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}e.fillStyle=dr(ws),e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,
e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e.prototype.getChecksum=function(){var t=this.stroke_?this.stroke_.getChecksum():"-",e=this.fill_?this.fill_.getChecksum():"-";if(!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]){var i="r"+t+e+(void 0!==this.radius_?this.radius_.toString():
"-")+(void 0!==this.radius2_?this.radius2_.toString():"-")+(void 0!==this.angle_?this.angle_.toString():"-")+(void 0!==this.points_?this.points_.toString():"-");this.checksums_=[i,t,e,this.radius_,this.radius2_,this.angle_,this.points_]}return this.checksums_[0]},e}(Tu),Ru=function(t){function e(e){var i=e||{};t.call(this,{points:1/0,fill:i.fill,radius:i.radius,stroke:i.stroke,atlasManager:i.atlasManager})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),atlasManager:this.atlasManager_});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render_(this.atlasManager_)},e}(Cu),wu={FRACTION:"fraction",PIXELS:"pixels"},Iu=function(t){function e(e,i,r,n,o,s){t.call(this),this.hitDetectionImage_=null,this.image_=
e||new Image,null!==n&&(this.image_.crossOrigin=n),this.canvas_=s?document.createElement("canvas"):null,this.color_=s,this.imageListenerKeys_=null,this.imageState_=o,this.size_=r,this.src_=i,this.tainted_}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===xs.LOADED){this.tainted_=!1;var t=Jn(1,1);try{t.drawImage(this.image_,0,0),t.getImageData(0,0,1,1)}catch(t){this.tainted_=
!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(M.CHANGE)},e.prototype.handleImageError_=function(){this.imageState_=xs.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=xs.LOADED,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.replaceColor_(),this.dispatchChangeEvent_()},e.prototype.getImage=
function(t){return this.canvas_?this.canvas_:this.image_},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_)if(this.isTainted_()){var e=this.size_[0],i=this.size_[1],r=Jn(e,i);r.fillRect(0,0,e,i),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=
function(){if(this.imageState_==xs.IDLE){this.imageState_=xs.LOADING,this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)];try{this.image_.src=this.src_}catch(t){this.handleImageError_()}}},e.prototype.replaceColor_=function(){if(this.color_&&!this.isTainted_()){this.canvas_.width=this.image_.width,this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");t.drawImage(this.image_,0,0);for(var e=t.getImageData(0,
0,this.image_.width,this.image_.height),i=e.data,r=this.color_[0]/255,n=this.color_[1]/255,o=this.color_[2]/255,s=0,a=i.length;s<a;s+=4)i[s]*=r,i[s+1]*=n,i[s+2]*=o;t.putImageData(e,0,0)}},e.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(E),this.imageListenerKeys_=null},e}(b);var Lu={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"},Ou=function(t){function e(e){var i=e||{},r=void 0!==i.opacity?i.opacity:1,n=void 0!==i.rotation?i.rotation:
0,s=void 0!==i.scale?i.scale:1,a=void 0!==i.rotateWithView&&i.rotateWithView;t.call(this,{opacity:r,rotation:n,scale:s,rotateWithView:a}),this.anchor_=void 0!==i.anchor?i.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==i.anchorOrigin?i.anchorOrigin:Lu.TOP_LEFT,this.anchorXUnits_=void 0!==i.anchorXUnits?i.anchorXUnits:wu.FRACTION,this.anchorYUnits_=void 0!==i.anchorYUnits?i.anchorYUnits:wu.FRACTION,this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null;var h=void 0!==i.img?
i.img:null,l=void 0!==i.imgSize?i.imgSize:null,u=i.src;Y(!(void 0!==u&&h),4),Y(!h||h&&l,5),void 0!==u&&0!==u.length||!h||(u=h.src||o(h)),Y(void 0!==u&&u.length>0,6);var p=void 0!==i.src?xs.IDLE:xs.LOADED;this.color_=void 0!==i.color?_r(i.color):null,this.iconImage_=function(t,e,i,r,n,o){var s=Ks.get(e,r,o);return s||(s=new Iu(t,e,i,r,n,o),Ks.set(e,r,o,s)),s}(h,u,l,this.crossOrigin_,p,this.color_),this.offset_=void 0!==i.offset?i.offset:[0,0],this.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:
Lu.TOP_LEFT,this.origin_=null,this.size_=void 0!==i.size?i.size:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e({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_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,
size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==wu.FRACTION||this.anchorYUnits_==wu.FRACTION){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==wu.FRACTION&&(t[0]*=e[0]),this.anchorYUnits_==wu.FRACTION&&(t[1]*=e[1])}if(this.anchorOrigin_!=
Lu.TOP_LEFT){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Lu.TOP_RIGHT&&this.anchorOrigin_!=Lu.BOTTOM_RIGHT||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Lu.BOTTOM_LEFT&&this.anchorOrigin_!=Lu.BOTTOM_RIGHT||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},
e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=Lu.TOP_LEFT){var e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;
t=t.slice(),this.offsetOrigin_!=Lu.TOP_RIGHT&&this.offsetOrigin_!=Lu.BOTTOM_RIGHT||(t[0]=i[0]-e[0]-t[0]),this.offsetOrigin_!=Lu.BOTTOM_LEFT&&this.offsetOrigin_!=Lu.BOTTOM_RIGHT||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t,e){return v(this.iconImage_,M.CHANGE,t,e)},e.prototype.load=function(){this.iconImage_.load()},
e.prototype.unlistenImageChange=function(t,e){x(this.iconImage_,M.CHANGE,t,e)},e}(Tu),Pu=function(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Au,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex};Pu.prototype.clone=function(){var t=this.getGeometry();
return t&&"object"==typeof t&&(t=t.clone()),new Pu({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},Pu.prototype.getRenderer=function(){return this.renderer_},Pu.prototype.setRenderer=function(t){this.renderer_=t},Pu.prototype.getGeometry=function(){return this.geometry_},Pu.prototype.getGeometryFunction=
function(){return this.geometryFunction_},Pu.prototype.getFill=function(){return this.fill_},Pu.prototype.setFill=function(t){this.fill_=t},Pu.prototype.getImage=function(){return this.image_},Pu.prototype.setImage=function(t){this.image_=t},Pu.prototype.getStroke=function(){return this.stroke_},Pu.prototype.setStroke=function(t){this.stroke_=t},Pu.prototype.getText=function(){return this.text_},Pu.prototype.setText=function(t){this.text_=t},Pu.prototype.getZIndex=function(){return this.zIndex_},
Pu.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Au,this.geometry_=t},Pu.prototype.setZIndex=function(t){this.zIndex_=t};var bu=null;function Mu(t,e){if(!bu){var i=new mr({color:"rgba(255,255,255,0.4)"}),r=new Er({color:"#3399CC",width:1.25});bu=[new Pu({image:new Ru({fill:i,stroke:r,radius:5}),fill:i,stroke:r})]}return bu}
function Fu(){var t={},e=[255,255,255,1],i=[0,153,255,1];return t[Nt.POLYGON]=[new Pu({fill:new mr({color:[255,255,255,.5]})})],t[Nt.MULTI_POLYGON]=t[Nt.POLYGON],t[Nt.LINE_STRING]=[new Pu({stroke:new Er({color:e,width:5})}),new Pu({stroke:new Er({color:i,width:3})})],t[Nt.MULTI_LINE_STRING]=t[Nt.LINE_STRING],t[Nt.CIRCLE]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING]),t[Nt.POINT]=[new Pu({image:new Ru({radius:6,fill:new mr({color:i}),stroke:new Er({color:e,width:1.5})}),zIndex:1/0})],t[Nt.MULTI_POINT]=t[Nt.POINT],
t[Nt.GEOMETRY_COLLECTION]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING],t[Nt.POINT]),t}function Au(t){return t.getGeometry()}var Nu=Pu;function Gu(t,e){var i=/\{z\}/g,r=/\{x\}/g,n=/\{y\}/g,o=/\{-y\}/g;return function(s,a,h){return s?t.replace(i,s[0].toString()).replace(r,s[1].toString()).replace(n,function(){return(-s[2]-1).toString()}).replace(o,function(){var t=s[0],i=e.getFullTileRange(t);return Y(i,55),(i.getHeight()+s[2]).toString()}):void 0}}function Du(t,e){for(var i=t.length,r=new Array(i),n=0;n<
i;++n)r[n]=Gu(t[n],e);return ku(r)}function ku(t){return 1===t.length?t[0]:function(e,i,r){if(e){var n=Xt(Cl(e),t.length);return t[n](e,i,r)}}}function ju(t,e,i){}function Uu(t){var e=[],i=/\{([a-z])-([a-z])\}/.exec(t);if(i){var r,n=i[1].charCodeAt(0),o=i[2].charCodeAt(0);for(r=n;r<=o;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=i=/\{(\d+)-(\d+)\}/.exec(t)){for(var s=parseInt(i[2],10),a=parseInt(i[1],10);a<=s;a++)e.push(t.replace(i[0],a.toString()));return e}return e.push(t),e}
function Yu(t,e,i,r){var n=document.createElement("script"),s="olc_"+o(e);function a(){delete window[s],n.parentNode.removeChild(n)}n.async=!0,n.src=t+(-1==t.indexOf("?")?"?":"\x26")+(r||"callback")+"\x3d"+s;var h=setTimeout(function(){a(),i&&i()},1E4);window[s]=function(t){clearTimeout(h),a(),e(t)},document.getElementsByTagName("head")[0].appendChild(n)}function Bu(t,e,i,r){var n=Pe(i,e,t),o=Se(e,r,i),s=e.getMetersPerUnit();void 0!==s&&(o*=s);var a=t.getMetersPerUnit();void 0!==a&&(o/=a);var h=t.getExtent();
if(!h||nt(h,n)){var l=Se(t,o,n)/o;isFinite(l)&&l>0&&(o/=l)}return o}function Vu(t,e,i,r){var n=i-t,o=r-e,s=Math.sqrt(n*n+o*o);return[Math.round(i+n/s),Math.round(r+o/s)]}function Xu(t,e,i,r,n,o,s,a,h,l,u){var p=Jn(Math.round(i*t),Math.round(i*e));if(0===h.length)return p.canvas;p.scale(i,i);var c=[1/0,1/0,-1/0,-1/0];h.forEach(function(t,e,i){ft(c,t.extent)});var d=Ot(c),f=Rt(c),_=Jn(Math.round(i*d/r),Math.round(i*f/r)),g=i/r;h.forEach(function(t,e,i){var r=t.extent[0]-c[0],n=-(t.extent[3]-c[3]),o=
Ot(t.extent),s=Rt(t.extent);_.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,r*g,n*g,o*g,s*g)});var y=It(s);return a.getTriangles().forEach(function(t,e,n){var s=t.source,a=t.target,h=s[0][0],l=s[0][1],u=s[1][0],d=s[1][1],f=s[2][0],g=s[2][1],v=(a[0][0]-y[0])/o,m=-(a[0][1]-y[1])/o,x=(a[1][0]-y[0])/o,E=-(a[1][1]-y[1])/o,S=(a[2][0]-y[0])/o,T=-(a[2][1]-y[1])/o,C=h,R=l;h=0,l=0;var w=function(t){for(var e=t.length,i=0;i<e;i++){for(var r=i,n=Math.abs(t[i][i]),o=i+1;o<e;o++){var s=Math.abs(t[o][i]);
s>n&&(n=s,r=o)}if(0===n)return null;var a=t[r];t[r]=t[i],t[i]=a;for(var h=i+1;h<e;h++)for(var l=-t[h][i]/t[i][i],u=i;u<e+1;u++)i==u?t[h][u]=0:t[h][u]+=l*t[i][u]}for(var p=new Array(e),c=e-1;c>=0;c--){p[c]=t[c][e]/t[c][c];for(var d=c-1;d>=0;d--)t[d][e]-=t[d][c]*p[c]}return p}([[u-=C,d-=R,0,0,x-v],[f-=C,g-=R,0,0,S-v],[0,0,u,d,E-m],[0,0,f,g,T-m]]);if(w){p.save(),p.beginPath();var I=(v+x+S)/3,L=(m+E+T)/3,O=Vu(I,L,v,m),P=Vu(I,L,x,E),b=Vu(I,L,S,T);p.moveTo(P[0],P[1]),p.lineTo(O[0],O[1]),p.lineTo(b[0],b[1]),
p.clip(),p.transform(w[0],w[2],w[1],w[3],v,m),p.translate(c[0]-C,c[3]-R),p.scale(r/i,-r/i),p.drawImage(_.canvas,0,0),p.restore()}}),u&&(p.save(),p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){var r=t.target,n=(r[0][0]-y[0])/o,s=-(r[0][1]-y[1])/o,a=(r[1][0]-y[0])/o,h=-(r[1][1]-y[1])/o,l=(r[2][0]-y[0])/o,u=-(r[2][1]-y[1])/o;p.beginPath(),p.moveTo(a,h),p.lineTo(n,s),p.lineTo(l,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}var zu=function(t,e,i,r,n){this.sourceProj_=
t,this.targetProj_=e;var o={},s=Oe(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return o[e]||(o[e]=s(t)),o[e]},this.maxSourceExtent_=r,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Ot(r)==Ot(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ot(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?
Ot(this.targetProj_.getExtent()):null;var a=It(i),h=Lt(i),l=St(i),u=Et(i),p=this.transformInv_(a),c=this.transformInv_(h),d=this.transformInv_(l),f=this.transformInv_(u);if(this.addQuad_(a,h,l,u,p,c,d,f,10),this.wrapsXInSource_){var _=1/0;this.triangles_.forEach(function(t,e,i){_=Math.min(_,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])-_>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]]];e[0][0]-_>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-_>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-_>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i<this.sourceWorldWidth_/2&&(t.source=e)}}.bind(this))}o={}};zu.prototype.addTriangle_=function(t,e,i,r,n,o){this.triangles_.push({source:[r,n,o],target:[t,
e,i]})},zu.prototype.addQuad_=function(t,e,i,r,n,o,s,a,h){var l=tt([n,o,s,a]),u=this.sourceWorldWidth_?Ot(l)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,c=this.sourceProj_.canWrapX()&&u>.5&&u<1,d=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)d=Ot(tt([t,e,i,r]))/this.targetWorldWidth_>.25||d;!c&&this.sourceProj_.isGlobal()&&u&&(d=u>.25||d)}if(d||!this.maxSourceExtent_||Pt(l,this.maxSourceExtent_)){if(!(d||isFinite(n[0])&&isFinite(n[1])&&isFinite(o[0])&&isFinite(o[1])&&
isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1]))){if(!(h>0))return;d=!0}if(h>0){if(!d){var f,_=[(t[0]+i[0])/2,(t[1]+i[1])/2],g=this.transformInv_(_);if(c)f=(Xt(n[0],p)+Xt(s[0],p))/2-Xt(g[0],p);else f=(n[0]+s[0])/2-g[0];var y=(n[1]+s[1])/2-g[1];d=f*f+y*y>this.errorThresholdSquared_}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var v=[(e[0]+i[0])/2,(e[1]+i[1])/2],m=this.transformInv_(v),x=[(r[0]+t[0])/2,(r[1]+t[1])/2],E=this.transformInv_(x);this.addQuad_(t,e,v,x,n,o,m,E,h-1),this.addQuad_(x,
v,i,r,E,m,s,a,h-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],T=this.transformInv_(S),C=[(i[0]+r[0])/2,(i[1]+r[1])/2],R=this.transformInv_(C);this.addQuad_(t,S,C,r,n,T,R,a,h-1),this.addQuad_(S,e,i,C,T,o,s,R,h-1)}return}}if(c){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,i,r,n,s,a),this.addTriangle_(t,e,i,n,o,s)}},zu.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,r){var n=e.source;_t(t,n[0]),_t(t,n[1]),
_t(t,n[2])}),t},zu.prototype.getTriangles=function(){return this.triangles_};var Wu=zu,Ku=function(t){function e(e,i,r,n,o,s,a,h,l,u,p){t.call(this,o,On.IDLE),this.renderEdges_=void 0!==p&&p,this.pixelRatio_=a,this.gutter_=h,this.canvas_=null,this.sourceTileGrid_=i,this.targetTileGrid_=n,this.wrappedTileCoord_=s||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;var c=n.getTileCoordExtent(this.wrappedTileCoord_),d=this.targetTileGrid_.getExtent(),f=this.sourceTileGrid_.getExtent(),
_=d?wt(c,d):c;if(0!==xt(_)){var g=e.getExtent();g&&(f=f?wt(f,g):g);var y=n.getResolution(this.wrappedTileCoord_[0]),v=Bu(e,r,Tt(_),y);if(!isFinite(v)||v<=0)this.state=On.EMPTY;else{var m=void 0!==u?u:vs;if(this.triangulation_=new Wu(e,r,_,f,v*m),0!==this.triangulation_.getTriangles().length){this.sourceZ_=i.getZForResolution(v);var x=this.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(x[1]=kt(x[1],f[1],f[3]),x[3]=kt(x[3],f[1],f[3])):x=wt(x,f)),xt(x)){for(var E=i.getTileRangeForExtentAndZ(x,
this.sourceZ_),S=E.minX;S<=E.maxX;S++)for(var T=E.minY;T<=E.maxY;T++){var C=l(this.sourceZ_,S,T,a);C&&this.sourceTiles_.push(C)}0===this.sourceTiles_.length&&(this.state=On.EMPTY)}else this.state=On.EMPTY}else this.state=On.EMPTY}}else this.state=On.EMPTY}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==On.LOADING&&this.unlistenSources_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},
e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,r){e&&e.getState()==On.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=On.ERROR;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),r="number"==typeof i?i:i[0],n="number"==typeof i?i:i[1],o=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),
a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Xu(r,n,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=On.LOADED}this.changed()},e.prototype.load=function(){if(this.state==On.IDLE){this.state=On.LOADING,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,r){var n=e.getState();if(n==On.IDLE||n==On.LOADING){t++;var o=v(e,M.CHANGE,function(i){var r=e.getState();
r!=On.LOADED&&r!=On.ERROR&&r!=On.EMPTY||(E(o),0===--t&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach(function(t,e,i){t.getState()==On.IDLE&&t.load()}),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(E),this.sourcesListenerKeys_=null},e}(vl),Hu="tileloadstart",Zu="tileloadend",qu="tileloaderror",Ju=function(t){function e(e){t.call(this,{attributions:e.attributions,
cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible}),this.generateTileUrlFunction_=!e.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,this.tileUrlFunction=e.tileUrlFunction?e.tileUrlFunction.bind(this):ju,this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),e.tileUrlFunction&&this.setTileUrlFunction(e.tileUrlFunction,
this.key_),this.tileLoadingKeys_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,i=t.target,r=o(i),n=i.getState();n==On.LOADING?(this.tileLoadingKeys_[r]=!0,e=Hu):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],
e=n==On.ERROR?qu:n==On.LOADED||n==On.ABORT?Zu:void 0),void 0!=e&&this.dispatchEvent(new kl(e,i))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=this.urls=Uu(t);this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?
this.setTileUrlFunction(Du(t,this.tileGrid),e):this.setKey(e)},e.prototype.useTile=function(t,e,i){var r=Sl(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},e}(jl);function Qu(t,e){t.getImage().src=e}var $u=function(t){function e(e){t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Qu,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,
url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible}),this.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,this.tileClass=void 0!==e.tileClass?e.tileClass:xl,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canExpireCache=
function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var r in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var n=this.tileCacheForProjection[r];n.expireCache(n==i?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Ie(this.getProjection(),
t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Ie(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Ie(e,t)){var i=o(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=bl(t)),this.tileGridForProjection[i]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=
this.getProjection();if(!e||Ie(e,t))return this.tileCache;var i=o(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Rl(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},e.prototype.createTile_=function(t,e,i,r,n,o){var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=a?this.tileUrlFunction(a,r,n):void 0,l=new this.tileClass(s,void 0!==h?On.IDLE:On.EMPTY,void 0!==h?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,v(l,M.CHANGE,
this.handleTileChange,this),l},e.prototype.getTile=function(t,e,i,r,n){var o=this.getProjection();if(o&&n&&!Ie(o,n)){var s,a=this.getTileCacheForProjection(n),h=[t,e,i],l=Tl(h);a.containsKey(l)&&(s=a.get(l));var u=this.getKey();if(s&&s.key==u)return s;var p=this.getTileGridForProjection(o),c=this.getTileGridForProjection(n),d=this.getTileCoordForTileUrlFunction(h,n),f=new Ku(o,p,n,c,h,d,this.getTilePixelRatio(r),this.getGutter(),function(t,e,i,r){return this.getTileInternal(t,e,i,r,o)}.bind(this),
this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return f.key=u,s?(f.interimTile=s,f.refreshInterimChain(),a.replace(l,f)):a.set(l,f),f}return this.getTileInternal(t,e,i,r,o||n)},e.prototype.getTileInternal=function(t,e,i,r,n){var o=null,s=Sl(t,e,i),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var h=o;o=this.createTile_(t,e,i,r,n,a),h.getState()==On.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(s,
o)}}else o=this.createTile_(t,e,i,r,n,a),this.tileCache.set(s,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var i=Ee(t);if(i){var r=o(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}},e}(Ju),tp=function(t){function e(e){var i=void 0!==e.hidpi&&
e.hidpi;t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:Ee("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:ro.LOADING,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:i?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.hidpi_=i,this.culture_=void 0!==e.culture?e.culture:"en-us",this.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,this.apiKey_=e.key,this.imagerySet_=e.imagerySet,Yu("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+
this.imagerySet_+"?uriScheme\x3dhttps\x26include\x3dImageryProviders\x26key\x3d"+this.apiKey_+"\x26c\x3d"+this.culture_,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==
t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,r=Gl(this.getProjection()),n=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/n:[e.imageWidth/n,e.imageHeight/n],s=Fl({extent:r,minZoom:e.zoomMin,maxZoom:i,tileSize:o});this.tileGrid=s;var a=this.culture_,h=this.hidpi_;if(this.tileUrlFunction=ku(e.imageUrlSubdomains.map(function(t){var i=[0,0,0],r=e.imageUrl.replace("{subdomain}",
t).replace("{culture}",a);return function(t,e,n){if(t){El(t[0],t[1],-t[2]-1,i);var o=r;return h&&(o+="\x26dpi\x3dd1\x26device\x3dmobile"),o.replace("{quadkey}",function(t){var e,i,r=t[0],n=new Array(r),o=1<<r-1;for(e=0;e<r;++e)i=48,t[1]&o&&(i+=1),t[2]&o&&(i+=2),n[e]=String.fromCharCode(i),o>>=1;return n.join("")}(i))}}})),e.imageryProviders){var l=Le(Ee("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var i=[],r=t.viewState,n=this.getTileGrid().getTileCoordForCoordAndResolution(r.center,
r.resolution)[0];return e.imageryProviders.map(function(e){for(var r=!1,o=e.coverageAreas,s=0,a=o.length;s<a;++s){var h=o[s];if(n>=h.zoomMin&&n<=h.zoomMax){var u=h.bbox;if(Pt(Ft([u[1],u[0],u[3],u[2]],l),t.extent)){r=!0;break}}}r&&i.push(e.attribution)}),i.push('\x3ca class\x3d"ol-attribution-bing-tos" href\x3d"https://www.microsoft.com/maps/product/terms.html"\x3eTerms of Use\x3c/a\x3e'),i}.bind(this))}this.setState(ro.READY)}else this.setState(ro.ERROR)},e}($u),ep=function(t){function e(e){var i=
e||{},r=void 0!==i.projection?i.projection:"EPSG:3857",n=void 0!==i.tileGrid?i.tileGrid:Fl({extent:Gl(r),maxZoom:i.maxZoom,minZoom:i.minZoom,tileSize:i.tileSize});t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,opaque:i.opaque,projection:r,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:i.tileLoadFunction,tilePixelRatio:i.tilePixelRatio,tileUrlFunction:i.tileUrlFunction,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,
transition:i.transition,attributionsCollapsible:i.attributionsCollapsible})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($u),ip=function(t){function e(e){t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX}),this.account_=e.account,this.mapId_=e.map||"",this.config_=e.config||{},this.templateCache_={},this.initializeMap_()}
return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){u(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";
this.mapId_&&(e+="/named/"+this.mapId_);var i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var i=e.target;if(!i.status||i.status>=200&&i.status<300){var r;try{r=JSON.parse(i.responseText)}catch(t){return void this.setState(ro.ERROR)}this.applyTemplate_(r),
this.templateCache_[t]=r,this.setState(ro.READY)}else this.setState(ro.ERROR)},e.prototype.handleInitError_=function(t){this.setState(ro.ERROR)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(ep),rp={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"},np=function(t){function e(e,i){t.call(this,e),this.feature=i}return t&&(e.__proto__=t),e.prototype=
Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),op=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:void 0,state:ro.READY,wrapX:void 0===i.wrapX||i.wrapX}),this.loader_=I,this.format_=i.format,this.overlaps_=void 0==i.overlaps||i.overlaps,this.url_=i.url,void 0!==i.loader?this.loader_=i.loader:void 0!==this.url_&&(Y(this.format_,7),this.loader_=ql(this.url_,this.format_)),this.strategy_=void 0!==i.strategy?i.strategy:Jl;var r,n,o=void 0===i.useSpatialIndex||
i.useSpatialIndex;this.featuresRtree_=o?new tl:null,this.loadedExtentsRtree_=new tl,this.nullGeometryFeatures_={},this.idIndex_={},this.undefIdIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(i.features)?n=i.features:i.features&&(n=(r=i.features).getArray()),o||void 0!==r||(r=new U(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==r&&this.bindFeaturesCollection_(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeature=
function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=o(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new np(rp.ADDFEATURE,t))}},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[v(e,M.CHANGE,this.handleFeatureChange_,this),v(e,l,this.handleFeatureChange_,this)]},
e.prototype.addToIndex_=function(t,e){var i=!0,r=e.getId();return void 0!==r?r.toString()in this.idIndex_?i=!1:this.idIndex_[r.toString()]=e:(Y(!(t in this.undefIdIndex_),30),this.undefIdIndex_[t]=e),i},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],r=[],n=0,s=t.length;n<s;n++){var a=t[n],h=o(a);this.addToIndex_(h,a)&&i.push(a)}for(var l=0,u=i.length;l<u;l++){var p=i[l],c=o(p);this.setupChangeEvents_(c,
p);var d=p.getGeometry();if(d){var f=d.getExtent();e.push(f),r.push(p)}else this.nullGeometryFeatures_[c]=p}this.featuresRtree_&&this.featuresRtree_.load(e,r);for(var _=0,g=i.length;_<g;_++)this.dispatchEvent(new np(rp.ADDFEATURE,i[_]))},e.prototype.bindFeaturesCollection_=function(t){var e=!1;v(this,rp.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),v(this,rp.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),v(t,h.ADD,function(t){e||(e=!0,this.addFeature(t.element),e=!1)},
this),v(t,h.REMOVE,function(t){e||(e=!0,this.removeFeature(t.element),e=!1)},this),this.featuresCollection_=t},e.prototype.clear=function(t){if(t){for(var e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(E);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.undefIdIndex_={})}else if(this.featuresRtree_)for(var i in this.featuresRtree_.forEach(this.removeFeatureInternal,this),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i]);
this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.loadedExtentsRtree_.clear(),this.nullGeometryFeatures_={};var r=new np(rp.CLEAR);this.dispatchEvent(r),this.changed()},e.prototype.forEachFeature=function(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)},e.prototype.forEachFeatureAtCoordinateDirect=function(t,e){var i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,
function(i){return i.getGeometry().intersectsCoordinate(t)?e(i):void 0})},e.prototype.forEachFeatureInExtent=function(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)},e.prototype.forEachFeatureIntersectingExtent=function(t,e){return this.forEachFeatureInExtent(t,function(i){if(i.getGeometry().intersectsExtent(t)){var r=e(i);if(r)return r}})},e.prototype.getFeaturesCollection=function(){return this.featuresCollection_},
e.prototype.getFeatures=function(){var t;return this.featuresCollection_?t=this.featuresCollection_.getArray():this.featuresRtree_&&(t=this.featuresRtree_.getAll(),d(this.nullGeometryFeatures_)||K(t,c(this.nullGeometryFeatures_))),t},e.prototype.getFeaturesAtCoordinate=function(t){var e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e},e.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_.getInExtent(t)},e.prototype.getClosestFeatureToCoordinate=function(t,
e){var i=t[0],r=t[1],n=null,o=[NaN,NaN],s=1/0,a=[-1/0,-1/0,1/0,1/0],h=e||R;return this.featuresRtree_.forEachInExtent(a,function(t){if(h(t)){var e=t.getGeometry(),l=s;if((s=e.closestPointXY(i,r,o,s))<l){n=t;var u=Math.sqrt(s);a[0]=i-u,a[1]=r-u,a[2]=i+u,a[3]=r+u}}}),n},e.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)},e.prototype.getFeatureById=function(t){var e=this.idIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getFormat=function(){return this.format_},e.prototype.getOverlaps=
function(){return this.overlaps_},e.prototype.getUrl=function(){return this.url_},e.prototype.handleFeatureChange_=function(t){var e=t.target,i=o(e),r=e.getGeometry();if(r){var n=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(n,e)):this.featuresRtree_&&this.featuresRtree_.update(n,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);var s=e.getId();
if(void 0!==s){var a=s.toString();i in this.undefIdIndex_?(delete this.undefIdIndex_[i],this.idIndex_[a]=e):this.idIndex_[a]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[a]=e)}else i in this.undefIdIndex_||(this.removeFromIdIndex_(e),this.undefIdIndex_[i]=e);this.changed(),this.dispatchEvent(new np(rp.CHANGEFEATURE,e))},e.prototype.hasFeature=function(t){var e=t.getId();return void 0!==e?e in this.idIndex_:o(t)in this.undefIdIndex_},e.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&
d(this.nullGeometryFeatures_)},e.prototype.loadFeatures=function(t,e,i){var r=this,n=this.loadedExtentsRtree_,o=this.strategy_(t,e);this.loading=!1;for(var s=function(t,s){var a=o[t];n.forEachInExtent(a,function(t){return ot(t.extent,a)})||(r.loader_.call(r,a,e,i),n.insert(a,{extent:a.slice()}),r.loading=r.loader_!==I)},a=0,h=o.length;a<h;++a)s(a)},e.prototype.removeLoadedExtent=function(t){var e,i=this.loadedExtentsRtree_;i.forEachInExtent(t,function(i){if(dt(i.extent,t))return e=i,!0}),e&&i.remove(e)},
e.prototype.removeFeature=function(t){var e=o(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t),this.changed()},e.prototype.removeFeatureInternal=function(t){var e=o(t);this.featureChangeKeys_[e].forEach(E),delete this.featureChangeKeys_[e];var i=t.getId();void 0!==i?delete this.idIndex_[i.toString()]:delete this.undefIdIndex_[e],this.dispatchEvent(new np(rp.REMOVEFEATURE,t))},e.prototype.removeFromIdIndex_=
function(t){var e=!1;for(var i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e},e.prototype.setLoader=function(t){this.loader_=t},e}(Il),sp=function(t){function e(e){t.call(this,{attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=void 0!==e.distance?e.distance:20,this.features=[],this.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return Y(e.getType()==Nt.POINT,10),e},this.source=e.source,v(this.source,M.CHANGE,
this.refresh,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.clear(),this.resolution=e,this.cluster(),this.addFeatures(this.features))},e.prototype.setDistance=function(t){this.distance=t,this.refresh()},e.prototype.refresh=function(){this.clear(),
this.cluster(),this.addFeatures(this.features),t.prototype.refresh.call(this)},e.prototype.cluster=function(){if(void 0!==this.resolution){this.features.length=0;for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),r={},n=0,s=i.length;n<s;n++){var a=i[n];if(!(o(a)in r)){var h=this.geometryFunction(a);if(h){pt(h.getCoordinates(),t),et(t,e,t);var l=this.source.getFeaturesInExtent(t);l=l.filter(function(t){var e=o(t);return!(e in r)&&(r[e]=!0,!0)}),this.features.push(this.createCluster(l))}}}}},
e.prototype.createCluster=function(t){for(var e=[0,0],i=t.length-1;i>=0;--i){var r=this.geometryFunction(t[i]);r?Hi(e,r.getCoordinates()):t.splice(i,1)}tr(e,1/t.length);var n=new B(new ci(e));return n.set("features",t),n},e}(op),ap=function(t){function e(e,i,r,n,o,s){var a=e.getExtent(),h=i.getExtent(),l=h?wt(r,h):r,u=Bu(e,i,Tt(l),n),p=new Wu(e,i,l,a,u*vs),c=s(p.calculateSourceExtent(),u,o),d=xs.LOADED;c&&(d=xs.IDLE);var f=c?c.getPixelRatio():1;t.call(this,r,n,f,d),this.targetProj_=i,this.maxSourceExtent_=
a,this.triangulation_=p,this.targetResolution_=n,this.targetExtent_=r,this.sourceImage_=c,this.sourcePixelRatio_=f,this.canvas_=null,this.sourceListenerKey_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.state==xs.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=
function(){var t=this.sourceImage_.getState();if(t==xs.LOADED){var e=Ot(this.targetExtent_)/this.targetResolution_,i=Rt(this.targetExtent_)/this.targetResolution_;this.canvas_=Xu(e,i,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==xs.IDLE){this.state=xs.LOADING,
this.changed();var t=this.sourceImage_.getState();t==xs.LOADED||t==xs.ERROR?this.reproject_():(this.sourceListenerKey_=v(this.sourceImage_,M.CHANGE,function(t){var e=this.sourceImage_.getState();e!=xs.LOADED&&e!=xs.ERROR||(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){E(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(ms),hp="imageloadstart",lp="imageloadend",up="imageloaderror",pp=function(t){function e(e,i){t.call(this,
e),this.image=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function cp(t,e){t.getImage().src=e}var dp=function(t){function e(e){t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state}),this.resolutions_=void 0!==e.resolutions?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getResolutions=
function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=z(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,i,r){var n=this.getProjection();if(n&&r&&!Ie(n,r)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Ie(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==e&&dt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),
this.reprojectedImage_=null}return this.reprojectedImage_=new ap(n,r,t,e,i,function(t,e,i){return this.getImageInternal(t,e,i,n)}.bind(this)),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return n&&(r=n),this.getImageInternal(t,e,i,r)},e.prototype.getImageInternal=function(t,e,i,n){return r()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case xs.LOADING:this.loading=!0,this.dispatchEvent(new pp(hp,e));break;case xs.LOADED:this.loading=!1,this.dispatchEvent(new pp(lp,
e));break;case xs.ERROR:this.loading=!1,this.dispatchEvent(new pp(up,e))}},e}(Il),fp=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,r,xs.IDLE),this.src_=n,this.image_=new Image,null!==o&&(this.image_.crossOrigin=o),this.imageListenerKeys_=null,this.state=xs.IDLE,this.imageLoadFunction_=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=xs.ERROR,
this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Rt(this.extent)/this.image_.height),this.state=xs.LOADED,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=xs.IDLE&&this.state!=xs.ERROR||(this.state=xs.LOADING,this.changed(),this.imageListenerKeys_=[m(this.image_,M.ERROR,this.handleImageError_,this),m(this.image_,M.LOAD,this.handleImageLoad_,this)],this.imageLoadFunction_(this,this.src_))},e.prototype.setImage=
function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(E),this.imageListenerKeys_=null},e}(ms);function _p(t,e){var i=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"\x3d"+encodeURIComponent(e[t]))});var r=i.join("\x26");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"\x26")+r}var gp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions}),this.crossOrigin_=
void 0!==i.crossOrigin?i.crossOrigin:null,this.hidpi_=void 0===i.hidpi||i.hidpi,this.url_=i.url,this.imageLoadFunction_=void 0!==i.imageLoadFunction?i.imageLoadFunction:cp,this.params_=i.params||{},this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,r){if(void 0===
this.url_)return null;e=this.findNearestResolution(e),i=this.hidpi_?i:1;var n=this.image_;if(n&&this.renderedRevision_==this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};u(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var h=this.ratio_*Ot(t)/2,l=this.ratio_*Rt(t)/2;t[0]=s-h,t[1]=a-l,t[2]=s+h,t[3]=a+l}var p=e/i,c=Math.ceil(Ot(t)/p),d=Math.ceil(Rt(t)/p);t[0]=s-p*c/2,t[2]=s+
p*c/2,t[1]=a-p*d/2,t[3]=a+p*d/2,this.imageSize_[0]=c,this.imageSize_[1]=d;var f=this.getRequestUrl_(t,this.imageSize_,i,r,o);return this.image_=new fp(t,e,i,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),v(this.image_,M.CHANGE,this.handleImageChange,this),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,i,r,n){var o=r.getCode().split(":").pop();n.SIZE=e[0]+","+e[1],n.BBOX=t.join(","),
n.BBOXSR=o,n.IMAGESR=o,n.DPI=Math.round(90*i);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&Y(!1,50),_p(a,n)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){u(this.params_,t),this.image_=
null,this.changed()},e}(dp),yp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions,state:i.state}),this.canvasFunction_=i.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImageInternal=function(t,e,i,r){e=this.findNearestResolution(e);var n=this.canvas_;if(n&&this.renderedRevision_==
this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;Mt(t=t.slice(),this.ratio_);var o=[Ot(t)/e*i,Rt(t)/e*i],s=this.canvasFunction_.call(this,t,e,i,o,r);return s&&(n=new Es(t,e,i,s)),this.canvas_=n,this.renderedRevision_=this.getRevision(),n},e}(dp);var vp=function(t){function e(e){t.call(this,{projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,this.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,
this.params_=e.params||{},this.url_=e.url,this.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:cp,this.hidpi_=void 0===e.hidpi||e.hidpi,this.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,this.ratio_=void 0!==e.ratio?e.ratio:1,this.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,this.image_=null,this.renderedRevision_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getParams=function(){return this.params_},
e.prototype.getImageInternal=function(t,e,i,r){e=this.findNearestResolution(e),i=this.hidpi_?i:1;var n=this.image_;if(n&&this.renderedRevision_==this.getRevision()&&n.getResolution()==e&&n.getPixelRatio()==i&&ot(n.getExtent(),t))return n;1!=this.ratio_&&Mt(t=t.slice(),this.ratio_);var o=[Ot(t)/e*i,Rt(t)/e*i];if(void 0!==this.url_){var s=this.getUrl(this.url_,this.params_,t,o,r);v(n=new fp(t,e,i,s,this.crossOrigin_,this.imageLoadFunction_),M.CHANGE,this.handleImageChange,this)}else n=null;return this.image_=
n,this.renderedRevision_=this.getRevision(),n},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){u(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,i,r,n){var o=function(t,e,i,r){var n=Ot(t),o=Rt(t),s=e[0],a=e[1],h=.0254/r;return a*n>s*o?n*i/(s*h):o*i/(a*h)}(i,r,this.metersPerUnit_,this.displayDpi_),s=Tt(i),a={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",
CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(r[0]),SETDISPLAYHEIGHT:Math.round(r[1]),SETVIEWSCALE:o,SETVIEWCENTERX:s[0],SETVIEWCENTERY:s[1]};return u(a,e),_p(t,a)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(dp),mp=function(t){function e(e){var i=void 0!==e.crossOrigin?e.crossOrigin:null,r=void 0!==e.imageLoadFunction?e.imageLoadFunction:cp;t.call(this,{attributions:e.attributions,projection:Ee(e.projection)}),this.url_=
e.url,this.imageExtent_=e.imageExtent,this.image_=new fp(this.imageExtent_,void 0,1,this.url_,i,r),this.imageSize_=e.imageSize?e.imageSize:null,v(this.image_,M.CHANGE,this.handleImageChange,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,i,r){return Pt(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},
e.prototype.handleImageChange=function(e){if(this.image_.getState()==xs.LOADED){var i,r,n=this.image_.getExtent(),o=this.image_.getImage();this.imageSize_?(i=this.imageSize_[0],r=this.imageSize_[1]):(i=o.width,r=o.height);var s=Rt(n)/r,a=Math.ceil(Ot(n)/s);if(a!=i){var h=Jn(a,r),l=h.canvas;h.drawImage(o,0,0,i,r,0,0,l.width,l.height),this.image_.setImage(l)}}t.prototype.handleImageChange.call(this,e)},e}(dp),xp="1.3.0",Ep="carmentaserver",Sp="geoserver",Tp="mapserver",Cp="qgis",Rp=[101,101],wp=function(t){function e(e){var i=
e||{};t.call(this,{attributions:i.attributions,projection:i.projection,resolutions:i.resolutions}),this.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:null,this.url_=i.url,this.imageLoadFunction_=void 0!==i.imageLoadFunction?i.imageLoadFunction:cp,this.params_=i.params||{},this.v13_=!0,this.updateV13_(),this.serverType_=i.serverType,this.hidpi_=void 0===i.hidpi||i.hidpi,this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=void 0!==i.ratio?i.ratio:1.5}return t&&(e.__proto__=
t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getGetFeatureInfoUrl=function(t,e,i,r){if(void 0!==this.url_){var n=Ee(i),o=this.getProjection();o&&o!==n&&(e=Bu(o,n,t,e),t=Pe(t,n,o));var s=Ct(t,e,0,Rp),a={SERVICE:"WMS",VERSION:xp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};u(a,this.params_,r);var h=Math.floor((t[0]-s[0])/e),l=Math.floor((s[3]-t[1])/e);return a[this.v13_?"I":"X"]=h,a[this.v13_?"J":"Y"]=l,this.getRequestUrl_(s,
Rp,1,o||n,a)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,r){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==i||this.hidpi_&&void 0!==this.serverType_||(i=1);var n=e/i,o=Tt(t),s=Ct(o,n,0,[Math.ceil(Ot(t)/n),Math.ceil(Rt(t)/n)]),a=Ct(o,n,0,[Math.ceil(this.ratio_*Ot(t)/n),Math.ceil(this.ratio_*Rt(t)/n)]),h=this.image_;if(h&&this.renderedRevision_==this.getRevision()&&h.getResolution()==e&&h.getPixelRatio()==i&&ot(h.getExtent(),
s))return h;var l={SERVICE:"WMS",VERSION:xp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};u(l,this.params_),this.imageSize_[0]=Math.round(Ot(a)/n),this.imageSize_[1]=Math.round(Rt(a)/n);var p=this.getRequestUrl_(a,this.imageSize_,i,r,l);return this.image_=new fp(a,e,i,p,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),v(this.image_,M.CHANGE,this.handleImageChange,this),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},
e.prototype.getRequestUrl_=function(t,e,i,r,n){if(Y(void 0!==this.url_,9),n[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(n.STYLES=""),1!=i)switch(this.serverType_){case Sp:var o=90*i+.5|0;"FORMAT_OPTIONS"in n?n.FORMAT_OPTIONS+=";dpi:"+o:n.FORMAT_OPTIONS="dpi:"+o;break;case Tp:n.MAP_RESOLUTION=90*i;break;case Ep:case Cp:n.DPI=90*i;break;default:Y(!1,8)}n.WIDTH=e[0],n.HEIGHT=e[1];var s,a=r.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,n.BBOX=s.join(","),
_p(this.url_,n)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){u(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||xp;this.v13_=Ki(t,"1.3")>=0},e}(dp),Ip='\x26#169; \x3ca href\x3d"https://www.openstreetmap.org/copyright"\x3eOpenStreetMap\x3c/a\x3e contributors.',
Lp=function(t){function e(e){var i,r=e||{};i=void 0!==r.attributions?r.attributions:[Ip];var n=void 0!==r.crossOrigin?r.crossOrigin:"anonymous",o=void 0!==r.url?r.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";t.call(this,{attributions:i,cacheSize:r.cacheSize,crossOrigin:n,opaque:void 0===r.opaque||r.opaque,maxZoom:void 0!==r.maxZoom?r.maxZoom:19,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileLoadFunction:r.tileLoadFunction,url:o,wrapX:r.wrapX,attributionsCollapsible:!1})}
return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ep),Op=i(2),Pp=function(t){function e(e){var i=e||{};t.call(this,i),this.type=Ss.IMAGE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(xo);Pp.prototype.getSource;var bp=Pp,Mp="preload",Fp="useInterimTilesOnError",Ap=function(t){function e(e){var i=e||{},r=u({},i);delete r.preload,delete r.useInterimTilesOnError,t.call(this,r),this.setPreload(void 0!==i.preload?
i.preload:0),this.setUseInterimTilesOnError(void 0===i.useInterimTilesOnError||i.useInterimTilesOnError),this.type=Ss.TILE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPreload=function(){return this.get(Mp)},e.prototype.setPreload=function(t){this.set(Mp,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(Fp)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Fp,t)},e}(xo);Ap.prototype.getSource;var Np=Ap,Gp=
"beforeoperations",Dp="afteroperations",kp={PIXEL:"pixel",IMAGE:"image"},jp=function(t){function e(e,i,r){t.call(this,e),this.extent=i.extent,this.resolution=i.viewState.resolution/i.pixelRatio,this.data=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),Up=null;function Yp(t,e,i){if(!t.prepareFrame(e,i))return null;var r=e.size[0],n=e.size[1];if(Up){var o=Up.canvas;o.width!==r||o.height!==n?Up=Jn(r,n):Up.clearRect(0,0,r,n)}else Up=Jn(r,n);return t.composeFrame(e,
i,Up),Up.getImageData(0,0,r,n)}function Bp(t){var e=t,i=t,r=t,n=null;return"function"==typeof e.getTile?n=function(t){var e=new Np({source:t});return new ha(e)}(e):"function"==typeof i.getImage?n=function(t){var e=new bp({source:t});return new ra(e)}(i):r.getType()===Ss.TILE?n=new ha(r):r.getType()!=Ss.IMAGE&&r.getType()!=Ss.VECTOR||(n=new ra(r)),n}var Vp=function(t){function e(e){t.call(this,{projection:null}),this.worker_=null,this.operationType_=void 0!==e.operationType?e.operationType:kp.PIXEL,
this.threads_=void 0!==e.threads?e.threads:1,this.renderers_=function(t){for(var e=t.length,i=new Array(e),r=0;r<e;++r)i[r]=Bp(t[r]);return i}(e.sources);for(var i=0,r=this.renderers_.length;i<r;++i)v(this.renderers_[i],M.CHANGE,this.changed,this);this.tileQueue_=new Mn(function(){return 1},this.changed.bind(this));for(var n=function(t){return t.map(function(t){return t.getLayer().getLayerState()})}(this.renderers_),s={},a=0,h=n.length;a<h;++a)s[o(n[a].layer)]=n[a];this.requestedFrameState_,this.renderedImageCanvas_=
null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:[1,0,0,1,0,0],extent:null,focus:null,index:0,layerStates:s,layerStatesArray:n,pixelRatio:1,pixelToCoordinateTransform:[1,0,0,1,0,0],postRenderFunctions:[],size:[0,0],skippedFeatureUids:{},tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{}},void 0!==e.operation&&this.setOperation(e.operation,e.lib)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),
e.prototype.constructor=e,e.prototype.setOperation=function(t,e){this.worker_=new Op.Processor({operation:t,imageOps:this.operationType_===kp.IMAGE,queue:1,lib:e,threads:this.threads_}),this.changed()},e.prototype.updateFrameState_=function(t,e,i){var r=u({},this.frameState_);r.viewState=u({},r.viewState);var n=Tt(t);r.extent=t.slice(),r.focus=n,r.size[0]=Math.round(Ot(t)/e),r.size[1]=Math.round(Rt(t)/e),r.time=Date.now(),r.animate=!1;var o=r.viewState;return o.center=n,o.projection=i,o.resolution=
e,r},e.prototype.allSourcesReady_=function(){for(var t=!0,e=0,i=this.renderers_.length;e<i;++e)if(this.renderers_[e].getLayer().getSource().getState()!==ro.READY){t=!1;break}return t},e.prototype.getImage=function(t,e,i,r){if(!this.allSourcesReady_())return null;var n=this.updateFrameState_(t,e,r);if(this.requestedFrameState_=n,this.renderedImageCanvas_){var o=this.renderedImageCanvas_.getResolution(),s=this.renderedImageCanvas_.getExtent();e===o&&dt(t,s)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&
this.getRevision()===this.renderedRevision_||this.processSources_(),n.tileQueue.loadMoreTiles(16,16),n.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_},e.prototype.processSources_=function(){for(var t=this.requestedFrameState_,e=this.renderers_.length,i=new Array(e),r=0;r<e;++r){var n=Yp(this.renderers_[r],t,t.layerStatesArray[r]);if(!n)return;i[r]=n}var o={};this.dispatchEvent(new jp(Gp,t,o)),this.worker_.process(i,o,this.onWorkerComplete_.bind(this,t))},e.prototype.onWorkerComplete_=
function(t,e,i,r){if(!e&&i){var n=t.extent,o=t.viewState.resolution;if(o===this.requestedFrameState_.viewState.resolution&&dt(n,this.requestedFrameState_.extent)){var s;if(this.renderedImageCanvas_)s=this.renderedImageCanvas_.getImage().getContext("2d");else s=Jn(Math.round(Ot(n)/o),Math.round(Rt(n)/o)),this.renderedImageCanvas_=new Es(n,o,1,s.canvas);s.putImageData(i,0,0),this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new jp(Dp,t,r))}}},e.prototype.getImageInternal=function(){return null},
e}(dp),Xp=['Map tiles by \x3ca href\x3d"https://stamen.com/"\x3eStamen Design\x3c/a\x3e, under \x3ca href\x3d"https://creativecommons.org/licenses/by/3.0/"\x3eCC BY 3.0\x3c/a\x3e.',Ip],zp={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",
opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},Wp={terrain:{minZoom:4,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:1,maxZoom:16}},Kp=function(t){function e(e){var i=e.layer.indexOf("-"),r=-1==i?e.layer:e.layer.slice(0,i),n=Wp[r],o=zp[e.layer],s=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;t.call(this,{attributions:Xp,cacheSize:e.cacheSize,
crossOrigin:"anonymous",maxZoom:void 0!=e.maxZoom?e.maxZoom:n.maxZoom,minZoom:void 0!=e.minZoom?e.minZoom:n.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,url:s,wrapX:e.wrapX})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ep);function Hp(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){var n=r.getTileCoordExtent(t,this.tmpExtent_),
o=ho(r.getTileSize(t[0]),this.tmpSize);1!=e&&(o=ao(o,e,this.tmpSize));var s={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return u(s,this.params_),this.getRequestUrl_(t,o,n,e,i,s)}}var Zp=function(t){function e(e){var i=e||{};t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileGrid:i.tileGrid,tileLoadFunction:i.tileLoadFunction,tileUrlFunction:Hp,url:i.url,urls:i.urls,wrapX:void 0===
i.wrapX||i.wrapX,transition:i.transition}),this.params_=i.params||{},this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){var a,h=n.getCode().split(":").pop();
if(o.SIZE=e[0]+","+e[1],o.BBOX=i.join(","),o.BBOXSR=h,o.IMAGESR=h,o.DPI=Math.round(o.DPI?o.DPI*r:90*r),1==s.length)a=s[0];else a=s[Xt(Cl(t),s.length)];return _p(a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return t},e.prototype.updateParams=function(t){u(this.params_,t),this.setKey(this.getKeyForParams_())},e}($u),qp=function(t){function e(e,i,r){t.call(this,e,On.LOADED),this.tileSize_=i,this.text_=
r,this.canvas_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=Jn(t[0],t[1]);return e.strokeStyle="black",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="black",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.fillText(this.text_,t[0]/2,t[1]/2),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(vl),Jp=function(t){function e(e){t.call(this,
{opaque:!1,projection:e.projection,tileGrid:e.tileGrid,wrapX:void 0===e.wrapX||e.wrapX})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getTile=function(t,e,i){var r=Sl(t,e,i);if(this.tileCache.containsKey(r))return this.tileCache.get(r);var n=ho(this.tileGrid.getTileSize(t)),o=[t,e,i],s=this.getTileCoordForTileUrlFunction(o),a=s?this.getTileCoordForTileUrlFunction(s).toString():"",h=new qp(o,n,a);return this.tileCache.set(r,h),h},e}(jl),
Qp=function(t){function e(e){if(t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:Ee("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:ro.LOADING,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.tileJSON_=null,e.url)if(e.jsonp)Yu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var i=new XMLHttpRequest;i.addEventListener("load",this.onXHRLoad_.bind(this)),
i.addEventListener("error",this.onXHRError_.bind(this)),i.open("GET",e.url),i.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):Y(!1,51)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},e.prototype.onXHRError_=
function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,i=Ee("EPSG:4326"),r=this.getProjection();if(void 0!==t.bounds){var n=Le(i,r);e=Ft(t.bounds,n)}var o=t.minzoom||0,s=t.maxzoom||22,a=Fl({extent:Gl(r),maxZoom:s,minZoom:o});if(this.tileGrid=a,this.tileUrlFunction=Du(t.tiles,a),void 0!==t.attribution&&!this.getAttributions()){var h=void 0!==e?e:i.getExtent();this.setAttributions(function(e){return Pt(h,
e.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState(ro.READY)},e.prototype.handleTileJSONError=function(){this.setState(ro.ERROR)},e}($u);function $p(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var n=r.getResolution(t[0]),o=r.getTileCoordExtent(t,this.tmpExtent_),s=ho(r.getTileSize(t[0]),this.tmpSize),a=this.gutter_;0!==a&&(s=so(s,a,this.tmpSize),o=et(o,n*a,o)),1!=e&&
(s=ao(s,e,this.tmpSize));var h={SERVICE:"WMS",VERSION:xp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return u(h,this.params_),this.getRequestUrl_(t,s,o,e,i,h)}}var tc=function(t){function e(e){var i=e||{},r=i.params||{},n=!("TRANSPARENT"in r)||r.TRANSPARENT;t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,opaque:!n,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileClass:i.tileClass,tileGrid:i.tileGrid,tileLoadFunction:i.tileLoadFunction,
tileUrlFunction:$p,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition}),this.gutter_=void 0!==i.gutter?i.gutter:0,this.params_=r,this.v13_=!0,this.serverType_=i.serverType,this.hidpi_=void 0===i.hidpi||i.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getGetFeatureInfoUrl=function(t,e,i,r){var n=Ee(i),o=this.getProjection(),
s=this.getTileGrid();s||(s=this.getTileGridForProjection(n));var a=s.getTileCoordForCoordAndResolution(t,e);if(!(s.getResolutions().length<=a[0])){var h=s.getResolution(a[0]),l=s.getTileCoordExtent(a,this.tmpExtent_),p=ho(s.getTileSize(a[0]),this.tmpSize),c=this.gutter_;0!==c&&(p=so(p,c,this.tmpSize),l=et(l,h*c,l)),o&&o!==n&&(h=Bu(o,n,t,h),l=be(l,n,o),t=Pe(t,n,o));var d={SERVICE:"WMS",VERSION:xp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};u(d,this.params_,
r);var f=Math.floor((t[0]-l[0])/h),_=Math.floor((l[3]-t[1])/h);return d[this.v13_?"I":"X"]=f,d[this.v13_?"J":"Y"]=_,this.getRequestUrl_(a,p,l,1,o||n,d)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=r)switch(this.serverType_){case Sp:var a=90*r+.5|0;"FORMAT_OPTIONS"in
o?o.FORMAT_OPTIONS+=";dpi:"+a:o.FORMAT_OPTIONS="dpi:"+a;break;case Tp:o.MAP_RESOLUTION=90*r;break;case Ep:case Cp:o.DPI=90*r;break;default:Y(!1,52)}var h,l,u=n.getAxisOrientation(),p=i;if(this.v13_&&"ne"==u.substr(0,2))h=i[0],p[0]=i[1],p[1]=h,h=i[2],p[2]=i[3],p[3]=h;if(o.BBOX=p.join(","),1==s.length)l=s[0];else l=s[Xt(Cl(t),s.length)];return _p(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=
i+"-"+this.params_[i];return e.join("/")},e.prototype.updateParams=function(t){u(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||xp;this.v13_=Ki(t,"1.3")>=0},e}($u),ec=function(t){function e(e,i,r,n,o,s){t.call(this,e,i),this.src_=r,this.extent_=n,this.preemptive_=o,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),r=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof r)return null;var n=r.charCodeAt(Math.floor(e*r.length));n>=93&&n--,n>=35&&n--;var o=null;if((n-=32)in this.keys_){var s=this.keys_[n];o=this.data_&&s in this.data_?this.data_[s]:s}return o},
e.prototype.forDataAtCoordinate=function(t,e,i,r){this.state==On.IDLE&&!0===r?(m(this,M.CHANGE,function(r){e.call(i,this.getData(t))},this),this.loadInternal_()):!0===r?setTimeout(function(){e.call(i,this.getData(t))}.bind(this),0):e.call(i,this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=On.ERROR,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=On.EMPTY,this.changed()},
e.prototype.loadInternal_=function(){if(this.state==On.IDLE)if(this.state=On.LOADING,this.jsonp_)Yu(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(i)}else this.handleError_()},
e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_&&this.loadInternal_()},e}(vl),ic=function(t){function e(e){if(t.call(this,{projection:Ee("EPSG:3857"),state:ro.LOADING}),this.preemptive_=void 0===e.preemptive||e.preemptive,this.tileUrlFunction_=ju,this.template_=void 0,this.jsonp_=e.jsonp||!1,e.url)if(this.jsonp_)Yu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var i=new XMLHttpRequest;i.addEventListener("load",
this.onXHRLoad_.bind(this)),i.addEventListener("error",this.onXHRError_.bind(this)),i.open("GET",e.url),i.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):Y(!1,51)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},
e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,i,r){if(this.tileGrid){var n=this.tileGrid.getTileCoordForCoordAndResolution(t,e);this.getTile(n[0],n[1],n[2],1,this.getProjection()).forDataAtCoordinate(t,i,null,r)}else!0===r?setTimeout(function(){i(null)},0):i(null)},e.prototype.handleTileJSONError=function(){this.setState(ro.ERROR)},e.prototype.handleTileJSONResponse=
function(t){var e,i=Ee("EPSG:4326"),r=this.getProjection();if(void 0!==t.bounds){var n=Le(i,r);e=Ft(t.bounds,n)}var o=t.minzoom||0,s=t.maxzoom||22,a=Fl({extent:Gl(r),maxZoom:s,minZoom:o});this.tileGrid=a,this.template_=t.template;var h=t.grids;if(h){if(this.tileUrlFunction_=Du(h,a),void 0!==t.attribution){var l=void 0!==e?e:i.getExtent();this.setAttributions(function(e){return Pt(l,e.extent)?[t.attribution]:null})}this.setState(ro.READY)}else this.setState(ro.ERROR)},e.prototype.getTile=function(t,
e,i,r,n){var o=Sl(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=this.tileUrlFunction_(a,r,n),l=new ec(s,void 0!==h?On.IDLE:On.EMPTY,void 0!==h?h:"",this.tileGrid.getTileCoordExtent(s),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},e.prototype.useTile=function(t,e,i){var r=Sl(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},e}(jl),rc=function(t){function e(i,r,n,o,s,a,h,l,u,p,c,d,f,_,g){if(t.call(this,
i,r,{transition:0}),this.context_={},this.loader_,this.replayState_={},this.sourceTiles_=p,this.tileKeys=[],this.extent=null,this.sourceRevision_=n,this.wrappedTileCoord=a,this.loadListenerKeys_=[],this.sourceTileListenerKeys_=[],a){var y=this.extent=u.getTileCoordExtent(a),m=u.getResolution(g),x=l.getZForResolution(m),E=g!=i[0],S=0;if(l.forEachTileCoord(y,x,function(t){var e=wt(y,l.getTileCoordExtent(t)),i=l.getExtent();if(i&&(e=wt(e,i,e)),Ot(e)/m>=.5&&Rt(e)/m>=.5){++S;var r=t.toString(),n=p[r];
if(!n&&!E){var a=h(t,c,d);n=p[r]=new f(t,void 0==a?On.EMPTY:On.IDLE,void 0==a?"":a,o,s),this.sourceTileListenerKeys_.push(v(n,M.CHANGE,_))}!n||E&&n.getState()!=On.LOADED||(n.consumers++,this.tileKeys.push(r))}}.bind(this)),E&&S==this.tileKeys.length&&this.finishLoading_(),g<=i[0]&&this.state!=On.LOADED)for(;g>u.getMinZoom();){var T=new e(i,r,n,o,s,a,h,l,u,p,c,d,f,I,--g);if(T.state==On.LOADED){this.interimTile=T;break}}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.disposeInternal=function(){this.state=On.ABORT,this.changed(),this.interimTile&&this.interimTile.dispose();for(var e=0,i=this.tileKeys.length;e<i;++e){var r=this.tileKeys[e],n=this.getTile(r);n.consumers--,0==n.consumers&&(delete this.sourceTiles_[r],n.dispose())}this.tileKeys.length=0,this.sourceTiles_=null,this.loadListenerKeys_.forEach(E),this.loadListenerKeys_.length=0,this.sourceTileListenerKeys_.forEach(E),this.sourceTileListenerKeys_.length=0,t.prototype.disposeInternal.call(this)},
e.prototype.getContext=function(t){var e=o(t);return e in this.context_||(this.context_[e]=Jn()),this.context_[e]},e.prototype.getImage=function(t){return-1==this.getReplayState(t).renderedTileRevision?null:this.getContext(t).canvas},e.prototype.getReplayState=function(t){var e=o(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedRevision:-1,renderedTileRevision:-1}),this.replayState_[e]},e.prototype.getKey=function(){return this.tileKeys.join("/")+
"-"+this.sourceRevision_},e.prototype.getTile=function(t){return this.sourceTiles_[t]},e.prototype.load=function(){var t=0,e={};this.state==On.IDLE&&this.setState(On.LOADING),this.state==On.LOADING&&this.tileKeys.forEach(function(i){var r=this.getTile(i);if(r.state==On.IDLE&&(r.setLoader(this.loader_),r.load()),r.state==On.LOADING){var n=v(r,M.CHANGE,function(i){var n=r.getState();if(n==On.LOADED||n==On.ERROR){var s=o(r);n==On.ERROR?e[s]=!0:(--t,delete e[s]),t-Object.keys(e).length==0&&this.finishLoading_()}}.bind(this));
this.loadListenerKeys_.push(n),++t}}.bind(this)),t-Object.keys(e).length==0&&setTimeout(this.finishLoading_.bind(this),0)},e.prototype.finishLoading_=function(){for(var t=this.tileKeys.length,e=0,i=t-1;i>=0;--i){var r=this.getTile(this.tileKeys[i]).getState();r!=On.LOADED&&--t,r==On.EMPTY&&++e}t==this.tileKeys.length?(this.loadListenerKeys_.forEach(E),this.loadListenerKeys_.length=0,this.setState(On.LOADED)):this.setState(e==this.tileKeys.length?On.EMPTY:On.ERROR)},e}(vl);function nc(t,e){var i=Zl(e,
t.getFormat(),t.onLoad.bind(t),t.onError.bind(t));t.setLoader(i)}var oc=[0,0,4096,4096],sc=function(t){function e(e,i,r,n,o,s){t.call(this,e,i,s),this.consumers=0,this.extent_=null,this.format_=n,this.features_=null,this.loader_,this.projection_=null,this.replayGroups_={},this.tileLoadFunction_=o,this.url_=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.features_=null,this.replayGroups_={},this.state=On.ABORT,
this.changed(),t.prototype.disposeInternal.call(this)},e.prototype.getExtent=function(){return this.extent_||oc},e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.getKey=function(){return this.url_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getReplayGroup=function(t,e){return this.replayGroups_[o(t)+","+e]},e.prototype.load=function(){this.state==On.IDLE&&(this.setState(On.LOADING),this.tileLoadFunction_(this,
this.url_),this.loader_(null,NaN,null))},e.prototype.onLoad=function(t,e,i){this.setProjection(e),this.setFeatures(t),this.setExtent(i)},e.prototype.onError=function(){this.setState(On.ERROR)},e.prototype.setExtent=function(t){this.extent_=t},e.prototype.setFeatures=function(t){this.features_=t,this.setState(On.LOADED)},e.prototype.setProjection=function(t){this.projection_=t},e.prototype.setReplayGroup=function(t,e,i){this.replayGroups_[o(t)+","+e]=i},e.prototype.setLoader=function(t){this.loader_=
t},e}(vl),ac=function(t){function e(e){var i=e.projection||"EPSG:3857",r=e.extent||Gl(i),n=e.tileGrid||Fl({extent:r,maxZoom:e.maxZoom||22,minZoom:e.minZoom,tileSize:e.tileSize||512});t.call(this,{attributions:e.attributions,cacheSize:void 0!==e.cacheSize?e.cacheSize:128,opaque:!1,projection:i,state:e.state,tileGrid:n,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:nc,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.format_=
e.format?e.format:null,this.sourceTiles_={},this.overlaps_=void 0==e.overlaps||e.overlaps,this.tileClass=e.tileClass?e.tileClass:sc,this.tileGrids_={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getOverlaps=function(){return this.overlaps_},e.prototype.clear=function(){this.tileCache.clear(),this.sourceTiles_={}},e.prototype.getTile=function(t,e,i,r,n){var o=Sl(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var s=
[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=new rc(s,null!==a?On.IDLE:On.EMPTY,this.getRevision(),this.format_,this.tileLoadFunction,a,this.tileUrlFunction,this.tileGrid,this.getTileGridForProjection(n),this.sourceTiles_,r,n,this.tileClass,this.handleTileChange.bind(this),s[0]);return this.tileCache.set(o,h),h},e.prototype.getTileGridForProjection=function(t){var e=t.getCode(),i=this.tileGrids_[e];if(!i){var r=this.tileGrid;i=this.tileGrids_[e]=Nl(t,void 0,r?r.getTileSize(r.getMinZoom()):
void 0)}return i},e.prototype.getTilePixelRatio=function(t){return t},e.prototype.getTilePixelSize=function(t,e,i){var r=ho(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]},e}(Ju),hc={KVP:"KVP",REST:"REST"},lc=function(t){function e(e){var i=void 0!==e.requestEncoding?e.requestEncoding:hc.KVP,r=e.tileGrid,n=e.urls;void 0===n&&void 0!==e.url&&(n=Uu(e.url)),t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,
projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:ju,urls:n,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition}),this.version_=void 0!==e.version?e.version:"1.0.0",this.format_=void 0!==e.format?e.format:"image/jpeg",this.dimensions_=void 0!==e.dimensions?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=
i,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=ku(n.map(uc.bind(this))))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(ku(t.map(uc.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=
function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var i in this.dimensions_)e[t++]=i+"-"+this.dimensions_[i];return e.join("/")},e.prototype.updateDimensions=function(t){u(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e}($u);function uc(t){var e=this.requestEncoding_,
i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==hc.KVP&&u(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==hc.KVP?_p(t,i):t.replace(/\{(\w+?)\}/g,function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t});var r=this.tileGrid,n=this.dimensions_;return function(i,o,s){if(i){var a={TileMatrix:r.getMatrixId(i[0]),TileCol:i[1],TileRow:-i[2]-1};u(a,n);var h=t;return h=e==hc.KVP?_p(h,a):h.replace(/\{(\w+?)\}/g,function(t,e){return a[e]})}}}
var pc={DEFAULT:"default",TRUNCATED:"truncated"},cc=function(t){function e(e,i,r,n,o,s,a){t.call(this,i,r,n,o,s,a),this.zoomifyImage_=null,this.tileSize_=ho(e.getTileSize(i[0]))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==On.LOADED){var i=this.tileSize_;if(e.width==i[0]&&e.height==i[1])return this.zoomifyImage_=e,e;var r=
Jn(i[0],i[1]);return r.drawImage(e,0,0),this.zoomifyImage_=r.canvas,r.canvas}return e},e}(xl),dc=function(t){function e(e){var i=e||{},r=i.size,n=void 0!==i.tierSizeCalculation?i.tierSizeCalculation:pc.DEFAULT,o=r[0],s=r[1],a=i.extent||[0,-r[1],r[0],0],h=[],l=i.tileSize||An,u=l;switch(n){case pc.DEFAULT:for(;o>u||s>u;)h.push([Math.ceil(o/u),Math.ceil(s/u)]),u+=u;break;case pc.TRUNCATED:for(var p=o,c=s;p>u||c>u;)h.push([Math.ceil(p/u),Math.ceil(c/u)]),p>>=1,c>>=1;break;default:Y(!1,53)}h.push([1,1]),
h.reverse();for(var d=[1],f=[0],_=1,g=h.length;_<g;_++)d.push(1<<_),f.push(h[_-1][0]*h[_-1][1]+f[_-1]);d.reverse();var y=new Pl({tileSize:l,extent:a,origin:It(a),resolutions:d}),v=i.url;v&&-1==v.indexOf("{TileGroup}")&&-1==v.indexOf("{tileIndex}")&&(v+="{TileGroup}/{z}-{x}-{y}.jpg");var m=ku(Uu(v).map(function(t){return function(e,i,r){if(e){var n=e[0],o=e[1],s=-e[2]-1,a=o+s*h[n][0],l=y.getTileSize(n),u=Array.isArray(l)?l[0]:l,p={z:n,x:o,y:s,tileIndex:a,TileGroup:"TileGroup"+((a+f[n])/u|0)};return t.replace(/\{(\w+?)\}/g,
function(t,e){return p[e]})}}})),x=cc.bind(null,y);t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileClass:x,tileGrid:y,tileUrlFunction:m,transition:i.transition})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}($u);var fc="renderOrder",_c=function(t){function e(e){var i=e||{},r=u({},i);delete r.style,delete r.renderBuffer,delete r.updateWhileAnimating,
delete r.updateWhileInteracting,t.call(this,r),this.declutter_=void 0!==i.declutter&&i.declutter,this.renderBuffer_=void 0!==i.renderBuffer?i.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(i.style),this.updateWhileAnimating_=void 0!==i.updateWhileAnimating&&i.updateWhileAnimating,this.updateWhileInteracting_=void 0!==i.updateWhileInteracting&&i.updateWhileInteracting,this.renderMode_=i.renderMode||Ts.VECTOR,this.type=Ss.VECTOR}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.setDeclutter=function(t){this.declutter_=t},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(fc)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=
function(){return this.updateWhileInteracting_},e.prototype.setRenderOrder=function(t){this.set(fc,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:Mu,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var i;Array.isArray(t)?i=t:(Y("function"==typeof t.getZIndex,41),i=[t]),e=function(){return i}}return e}(this.style_),this.changed()},e.prototype.getRenderMode=function(){return this.renderMode_},e}(xo);_c.prototype.getSource;var gc=_c,yc={BLUR:"blur",
GRADIENT:"gradient",RADIUS:"radius"},vc=["#00f","#0ff","#0f0","#ff0","#f00"];var mc=function(t){function e(e){var i=e||{},r=u({},i);delete r.gradient,delete r.radius,delete r.blur,delete r.shadow,delete r.weight,t.call(this,r),this.gradient_=null,this.shadow_=void 0!==i.shadow?i.shadow:250,this.circleImage_=void 0,this.styleCache_=null,v(this,G(yc.GRADIENT),this.handleGradientChanged_,this),this.setGradient(i.gradient?i.gradient:vc),this.setBlur(void 0!==i.blur?i.blur:15),this.setRadius(void 0!==
i.radius?i.radius:8),v(this,G(yc.BLUR),this.handleStyleChanged_,this),v(this,G(yc.RADIUS),this.handleStyleChanged_,this),this.handleStyleChanged_();var n,o=i.weight?i.weight:"weight";n="string"==typeof o?function(t){return t.get(o)}:o,this.setStyle(function(t,e){var i=n(t),r=void 0!==i?kt(i,0,1):1,o=255*r|0,s=this.styleCache_[o];return s||(s=[new Nu({image:new Ou({opacity:r,src:this.circleImage_})})],this.styleCache_[o]=s),s}.bind(this)),this.setRenderOrder(null),v(this,ur.RENDER,this.handleRender_,
this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createCircle_=function(){var t=this.getRadius(),e=this.getBlur(),i=t+e+1,r=2*i,n=Jn(r,r);n.shadowOffsetX=n.shadowOffsetY=this.shadow_,n.shadowBlur=e,n.shadowColor="#000",n.beginPath();var o=i-this.shadow_;return n.arc(o,o,t,0,2*Math.PI,!0),n.fill(),n.canvas.toDataURL()},e.prototype.getBlur=function(){return this.get(yc.BLUR)},e.prototype.getGradient=function(){return this.get(yc.GRADIENT)},
e.prototype.getRadius=function(){return this.get(yc.RADIUS)},e.prototype.handleGradientChanged_=function(){this.gradient_=function(t){for(var e=Jn(1,256),i=e.createLinearGradient(0,0,1,256),r=1/(t.length-1),n=0,o=t.length;n<o;++n)i.addColorStop(n*r,t[n]);return e.fillStyle=i,e.fillRect(0,0,1,256),e.getImageData(0,0,1,256).data}(this.getGradient())},e.prototype.handleStyleChanged_=function(){this.circleImage_=this.createCircle_(),this.styleCache_=new Array(256),this.changed()},e.prototype.handleRender_=
function(t){for(var e=t.context,i=e.canvas,r=e.getImageData(0,0,i.width,i.height),n=r.data,o=0,s=n.length;o<s;o+=4){var a=4*n[o+3];a&&(n[o]=this.gradient_[a],n[o+1]=this.gradient_[a+1],n[o+2]=this.gradient_[a+2])}e.putImageData(r,0,0)},e.prototype.setBlur=function(t){this.set(yc.BLUR,t)},e.prototype.setGradient=function(t){this.set(yc.GRADIENT,t)},e.prototype.setRadius=function(t){this.set(yc.RADIUS,t)},e}(gc),xc=function(t){function e(e){var i=e||{},r=i.renderMode||Va.HYBRID;Y(void 0==r||r==Va.IMAGE||
r==Va.HYBRID||r==Va.VECTOR,28),i.declutter&&r==Va.IMAGE&&(r=Va.HYBRID),i.renderMode=r;var n=u({},i);delete n.preload,delete n.useInterimTilesOnError,t.call(this,n),this.setPreload(i.preload?i.preload:0),this.setUseInterimTilesOnError(void 0===i.useInterimTilesOnError||i.useInterimTilesOnError),this.type=Ss.VECTOR_TILE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPreload=function(){return this.get(Mp)},e.prototype.getUseInterimTilesOnError=
function(){return this.get(Fp)},e.prototype.setPreload=function(t){this.set(Mp,t)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Fp,t)},e}(gc);xc.prototype.getSource;var Ec=xc,Sc="addfeatures",Tc=function(t){function e(e,i,r,n){t.call(this,e),this.features=r,this.file=i,this.projection=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function Cc(t){for(var e=t.dataTransfer.files,i=0,r=e.length;i<r;++i){var n=e.item(i),o=new FileReader;
o.addEventListener(M.LOAD,this.handleResult_.bind(this,n)),o.readAsText(n)}}function Rc(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}var wc=function(t){function e(e){var i=e||{};t.call(this,{handleEvent:R}),this.formatConstructors_=i.formatConstructors?i.formatConstructors:[],this.projection_=i.projection?Ee(i.projection):null,this.dropListenKeys_=null,this.source_=i.source||null,this.target=i.target?i.target:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.handleResult_=function(t,e){var i=e.target.result,r=this.getMap(),n=this.projection_;n||(n=r.getView().getProjection());for(var o=this.formatConstructors_,s=[],a=0,h=o.length;a<h;++a){var l=new o[a];if((s=this.tryReadFeatures_(l,i,{featureProjection:n}))&&s.length>0)break}this.source_&&(this.source_.clear(),this.source_.addFeatures(s)),this.dispatchEvent(new Tc(Sc,t,s,n))},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=
this.target?this.target:t.getViewport();this.dropListenKeys_=[v(e,M.DROP,Cc,this),v(e,M.DRAGENTER,Rc,this),v(e,M.DRAGOVER,Rc,this),v(e,M.DROP,Rc,this)]}},e.prototype.setActive=function(e){t.prototype.setActive.call(this,e),e?this.registerListeners_():this.unregisterListeners_()},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}},
e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(E),this.dropListenKeys_=null)},e}(Fo),Ic=function(t){function e(e){var i=e||{};t.call(this,i),this.condition_=i.condition?i.condition:zo,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=void 0!==i.duration?i.duration:400}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDragEvent=function(t){if(Ko(t)){var e=
t.map,i=e.getSize(),r=t.pixel,n=r[0]-i[0]/2,o=i[1]/2-r[1],s=Math.atan2(o,n),a=Math.sqrt(n*n+o*o),h=e.getView();if(h.getConstraints().rotation!==Gn&&void 0!==this.lastAngle_){var l=s-this.lastAngle_;Oo(h,h.getRotation()-l)}if(this.lastAngle_=s,void 0!==this.lastMagnitude_)Mo(h,this.lastMagnitude_*(h.getResolution()/a));void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/a),this.lastMagnitude_=a}},e.prototype.handleUpEvent=function(t){if(!Ko(t))return!0;var e=t.map.getView();e.setHint(jn,
-1);var i=this.lastScaleDelta_-1;return Lo(e,e.getRotation()),Po(e,e.getResolution(),void 0,this.duration_,i),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!Ko(t)&&(!!this.condition_(t)&&(t.map.getView().setHint(jn,1),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(qo),Lc=function(t){function e(e,i,r){if(t.call(this),void 0!==r&&void 0===i)this.setFlatCoordinates(r,e);else{var n=i||0;this.setCenterAndRadius(e,n,r)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,i,r){var n=this.flatCoordinates,o=t-n[0],s=e-n[1],a=o*o+s*s;if(a<r){if(0===a)for(var h=0;h<this.stride;++h)i[h]=n[h];else{var l=this.getRadius()/Math.sqrt(a);i[0]=n[0]+l*o,i[1]=n[1]+l*s;for(var u=2;u<this.stride;++u)i[u]=n[u]}return i.length=this.stride,a}return r},e.prototype.containsXY=function(t,e){var i=this.flatCoordinates,
r=t-i[0],n=e-i[1];return r*r+n*n<=this.getRadiusSquared_()},e.prototype.getCenter=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.computeExtent=function(t){var e=this.flatCoordinates,i=e[this.stride]-e[0];return lt(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)},e.prototype.getRadius=function(){return Math.sqrt(this.getRadiusSquared_())},e.prototype.getRadiusSquared_=function(){var t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];
return t*t+e*e},e.prototype.getType=function(){return Nt.CIRCLE},e.prototype.intersectsExtent=function(t){if(Pt(t,this.getExtent())){var e=this.getCenter();return t[0]<=e[0]&&t[2]>=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||mt(t,this.intersectsCoordinate,this))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],r=t.slice();r[e]=r[0]+i;for(var n=1;n<e;++n)r[e+n]=t[n];this.setFlatCoordinates(this.layout,r),this.changed()},e.prototype.setCenterAndRadius=
function(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);var r=this.flatCoordinates,n=ti(r,0,t,this.stride);r[n++]=r[0]+e;for(var o=1,s=this.stride;o<s;++o)r[n++]=r[o];r.length=n,this.changed()},e.prototype.getCoordinates=function(){return null},e.prototype.setCoordinates=function(t,e){},e.prototype.setRadius=function(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()},e}(We);Lc.prototype.transform;var Oc=Lc,Pc=function(t){function e(e,i,r){if(t.call(this),
this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,i);else if(void 0!==i&&r)this.setFlatCoordinates(i,e),this.ends_=r;else{for(var n=this.getLayout(),o=e,s=[],a=[],h=0,l=o.length;h<l;++h){var u=o[h];0===h&&(n=u.getLayout()),K(s,u.getFlatCoordinates()),a.push(s.length)}this.setFlatCoordinates(n,s),this.ends_=a}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.appendLineString=function(t){this.flatCoordinates?
K(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice())},e.prototype.closestPointXY=function(t,e,i,r){return r<rt(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Je(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),
$e(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,r))},e.prototype.getCoordinateAtM=function(t,e,i){if(this.layout!=At.XYM&&this.layout!=At.XYZM||0===this.flatCoordinates.length)return null;var r=void 0!==e&&e,n=void 0!==i&&i;return function(t,e,i,r,n,o,s){if(s)return sr(t,e,i[i.length-1],r,n,o);var a;if(n<t[r-1])return o?((a=t.slice(0,r))[r-1]=n,a):null;if(t[t.length-1]<n)return o?((a=t.slice(t.length-r))[r-1]=n,a):null;for(var h=0,l=i.length;h<l;++h){var u=i[h];if(e!=u){if(n<
t[e+r-1])return null;if(n<=t[u-1])return sr(t,e,u,r,n,!1);e=u}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,r,n)},e.prototype.getCoordinates=function(){return ni(this.flatCoordinates,0,this.ends_,this.stride)},e.prototype.getEnds=function(){return this.ends_},e.prototype.getLineString=function(t){return t<0||this.ends_.length<=t?null:new hr(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)},e.prototype.getLineStrings=function(){for(var t=this.flatCoordinates,
e=this.ends_,i=this.layout,r=[],n=0,o=0,s=e.length;o<s;++o){var a=e[o],h=new hr(t.slice(n,a),i);r.push(h),n=a}return r},e.prototype.getFlatMidpoints=function(){for(var t=[],e=this.flatCoordinates,i=0,r=this.ends_,n=this.stride,o=0,s=r.length;o<s;++o){var a=r[o];K(t,or(e,i,a,n,.5)),i=a}return t},e.prototype.getSimplifiedGeometryInternal=function(t){var i=[],r=[];return i.length=ai(this.flatCoordinates,0,this.ends_,this.stride,t,i,0,r),new e(i,At.XY,r)},e.prototype.getType=function(){return Nt.MULTI_LINE_STRING},
e.prototype.intersectsExtent=function(t){return function(t,e,i,r,n){for(var o=0,s=i.length;o<s;++o){if(mi(t,e,i[o],r,n))return!0;e=i[o]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var i=ii(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()},e}(We),bc=function(t){function e(e,i){t.call(this),i&&!Array.isArray(e[0])?
this.setFlatCoordinates(i,e):this.setCoordinates(e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.appendPoint=function(t){this.flatCoordinates?K(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,i,r){if(r<rt(this.getExtent(),t,e))return r;for(var n=this.flatCoordinates,
o=this.stride,s=0,a=n.length;s<a;s+=o){var h=Yt(t,e,n[s],n[s+1]);if(h<r){r=h;for(var l=0;l<o;++l)i[l]=n[s+l];i.length=o}}return r},e.prototype.getCoordinates=function(){return ri(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getPoint=function(t){var e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new ci(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)},e.prototype.getPoints=function(){for(var t=this.flatCoordinates,
e=this.layout,i=this.stride,r=[],n=0,o=t.length;n<o;n+=i){var s=new ci(t.slice(n,n+i),e);r.push(s)}return r},e.prototype.getType=function(){return Nt.MULTI_POINT},e.prototype.intersectsExtent=function(t){for(var e=this.flatCoordinates,i=this.stride,r=0,n=e.length;r<n;r+=i)if(st(t,e[r],e[r+1]))return!0;return!1},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ei(this.flatCoordinates,0,t,this.stride),this.changed()},
e}(We);function Mc(t,e,i,r){for(var n=[],o=[1/0,1/0,-1/0,-1/0],s=0,a=i.length;s<a;++s){var h=i[s];o=ct(t,e,h[0],r),n.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=h[h.length-1]}return n}var Fc=function(t){function e(e,i,r){if(t.call(this),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!r&&!Array.isArray(e[0])){for(var n=this.getLayout(),o=e,s=[],a=[],h=0,l=o.length;h<l;++h){var u=
o[h];0===h&&(n=u.getLayout());for(var p=s.length,c=u.getEnds(),d=0,f=c.length;d<f;++d)c[d]+=p;K(s,u.getFlatCoordinates()),a.push(c)}i=n,e=s,r=a}void 0!==i&&r?(this.setFlatCoordinates(i,e),this.endss_=r):this.setCoordinates(e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.appendPolygon=function(t){var e;if(this.flatCoordinates){var i=this.flatCoordinates.length;K(this.flatCoordinates,t.getFlatCoordinates());for(var r=0,n=(e=t.getEnds().slice()).length;r<
n;++r)e[r]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()},e.prototype.clone=function(){for(var t=this.endss_.length,i=new Array(t),r=0;r<t;++r)i[r]=this.endss_[r].slice();return new e(this.flatCoordinates.slice(),this.layout,i)},e.prototype.closestPointXY=function(t,e,i,r){return r<rt(this.getExtent(),t,e)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,r,n){for(var o=
0,s=i.length;o<s;++o){var a=i[o];n=Je(t,e,a,r,n),e=a[a.length-1]}return n}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,r,n,o,s,a,h,l,u){for(var p=u||[NaN,NaN],c=0,d=i.length;c<d;++c){var f=i[c];l=$e(t,e,f,r,n,o,s,a,h,l,p),e=f[f.length-1]}return l}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,r))},e.prototype.containsXY=function(t,e){return function(t,e,i,r,n,o){if(0===i.length)return!1;for(var s=
0,a=i.length;s<a;++s){var h=i[s];if(_i(t,e,h,r,n,o))return!0;e=h[h.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)},e.prototype.getArea=function(){return function(t,e,i,r){for(var n=0,o=0,s=i.length;o<s;++o){var a=i[o];n+=He(t,e,a,r),e=a[a.length-1]}return n}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},e.prototype.getCoordinates=function(t){var e;return void 0!==t?Ri(e=this.getOrientedFlatCoordinates().slice(),0,this.endss_,this.stride,t):e=this.flatCoordinates,
oi(e,0,this.endss_,this.stride)},e.prototype.getEndss=function(){return this.endss_},e.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var t=Mc(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=yi(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},e.prototype.getInteriorPoints=function(){return new bc(this.getFlatInteriorPoints().slice(),
At.XYM)},e.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;!function(t,e,i,r,n){for(var o=0,s=i.length;o<s;++o)if(!Ti(t,e,i[o],r,n))return!1;return!0}(t,0,this.endss_,this.stride)?(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ri(this.orientedFlatCoordinates_,0,this.endss_,this.stride)):this.orientedFlatCoordinates_=t,this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},
e.prototype.getSimplifiedGeometryInternal=function(t){var i=[],r=[];return i.length=function(t,e,i,r,n,o,s,a){for(var h=0,l=i.length;h<l;++h){var u=i[h],p=[];s=ui(t,e,u,r,n,o,s,p),a.push(p),e=u[u.length-1]}return s}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),i,0,r),new e(i,At.XY,r)},e.prototype.getPolygon=function(t){if(t<0||this.endss_.length<=t)return null;var e;if(0===t)e=0;else{var i=this.endss_[t-1];e=i[i.length-1]}var r=this.endss_[t].slice(),n=r[r.length-1];if(0!==e)for(var o=
0,s=r.length;o<s;++o)r[o]-=e;return new Ii(this.flatCoordinates.slice(e,n),this.layout,r)},e.prototype.getPolygons=function(){for(var t=this.layout,e=this.flatCoordinates,i=this.endss_,r=[],n=0,o=0,s=i.length;o<s;++o){var a=i[o].slice(),h=a[a.length-1];if(0!==n)for(var l=0,u=a.length;l<u;++l)a[l]-=n;var p=new Ii(e.slice(n,h),t,a);r.push(p),n=h}return r},e.prototype.getType=function(){return Nt.MULTI_POLYGON},e.prototype.intersectsExtent=function(t){return function(t,e,i,r,n){for(var o=0,s=i.length;o<
s;++o){var a=i[o];if(xi(t,e,a,r,n))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);var i=function(t,e,i,r,n){for(var o=n||[],s=0,a=0,h=i.length;a<h;++a){var l=ii(t,e,i[a],r,o[s]);o[s++]=l,e=l[l.length-1]}return o.length=s,o}(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{var r=i[i.length-
1];this.flatCoordinates.length=0===r.length?0:r[r.length-1]}this.changed()},e}(We),Ac={POINT:"Point",LINE_STRING:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"},Nc="drawstart",Gc="drawend",Dc=function(t){function e(e,i){t.call(this,e),this.feature=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);var kc=function(t){function e(e){var i=e;i.stopDown||(i.stopDown=w),t.call(this,i),this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,
this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=function(t){var e;t===Nt.POINT||t===Nt.MULTI_POINT?e=Ac.POINT:t===Nt.LINE_STRING||t===Nt.MULTI_LINE_STRING?e=Ac.LINE_STRING:t===Nt.POLYGON||t===Nt.MULTI_POLYGON?e=Ac.POLYGON:t===Nt.CIRCLE&&(e=Ac.CIRCLE);return e}(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_===Ac.POLYGON?3:
2,this.maxPoints_=e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:R;var r=e.geometryFunction;if(!r)if(this.type_===Nt.CIRCLE)r=function(t,e){var i=e||new Oc([NaN,NaN]),r=er(t[0],t[1]);return i.setCenterAndRadius(t[0],Math.sqrt(r)),i};else{var n,o=this.mode_;o===Ac.POINT?n=ci:o===Ac.LINE_STRING?n=hr:o===Ac.POLYGON&&(n=Ii),r=function(t,e){var i=e;return i?o===Ac.POLYGON?t[0].length?i.setCoordinates([t[0].concat([t[0][0]])]):i.setCoordinates([]):i.setCoordinates(t):
i=new n(t),i}}this.geometryFunction_=r,this.dragVertexDelay_=void 0!==e.dragVertexDelay?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new gc({source:new op({useSpatialIndex:!1,wrapX:!!e.wrapX&&e.wrapX}),style:e.style?e.style:function(){var t=Fu();return function(e,i){return t[e.getGeometry().getType()]}}(),
updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Xo,this.freehandCondition_,e.freehand?this.freehandCondition_=jo:this.freehandCondition_=e.freehandCondition?e.freehandCondition:zo,v(this,G(Io.ACTIVE),this.updateState_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),this.updateState_()},e.prototype.getOverlay=function(){return this.overlay_},
e.prototype.handleEvent=function(e){e.originalEvent.type===M.CONTEXTMENU&&e.preventDefault(),this.freehand_=this.mode_!==Ac.POINT&&this.freehandCondition_(e);var i=e.type===Ar.POINTERMOVE,r=!0;!this.freehand_&&this.lastDragTime_&&e.type===Ar.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));
return this.freehand_&&e.type===Ar.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e),r=!1):this.freehand_&&e.type===Ar.POINTERDOWN?r=!1:i?(r=e.type===Ar.POINTERMOVE)&&this.freehand_?r=this.handlePointerMove_(e):(e.pointerEvent.pointerType==Ur||e.type===Ar.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ar.DBLCLICK&&(r=!1),t.prototype.handleEvent.call(this,e)&&r},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?
(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):!!this.condition_(t)&&(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Nr(Ar.POINTERMOVE,t.map,t.pointerEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var i=this.mode_===Ac.CIRCLE;return this.shouldHandle_?
(this.finishCoordinate_?this.freehand_||i?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t):(this.startDrawing_(t),this.mode_===Ac.POINT&&this.finishDrawing()),e=!1):this.freehand_&&(this.finishCoordinate_=null,this.abortDrawing_()),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,r=
e[0]-i[0],n=e[1]-i[1],o=r*r+n*n;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,r=[this.finishCoordinate_];if(this.mode_===Ac.LINE_STRING)i=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===Ac.POLYGON){var n=this.sketchCoords_;i=n[0].length>
this.minPoints_,r=[n[0][0],n[0][n[0].length-2]]}if(i)for(var o=t.map,s=0,a=r.length;s<a;s++){var h=r[s],l=o.getPixelFromCoordinate(h),u=t.pixel,p=u[0]-l[0],c=u[1]-l[1],d=this.freehand_?1:this.snapTolerance_;if(e=Math.sqrt(p*p+c*c)<=d){this.finishCoordinate_=h;break}}}return e},e.prototype.createOrUpdateSketchPoint_=function(t){var e=t.coordinate.slice();this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new B(new ci(e)),this.updateSketchFeatures_())},e.prototype.startDrawing_=
function(t){var e=t.coordinate;this.finishCoordinate_=e,this.mode_===Ac.POINT?this.sketchCoords_=e.slice():this.mode_===Ac.POLYGON?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new B(new hr(this.sketchLineCoords_)));var i=this.geometryFunction_(this.sketchCoords_);this.sketchFeature_=new B,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(i),
this.updateSketchFeatures_(),this.dispatchEvent(new Dc(Nc,this.sketchFeature_))},e.prototype.modifyDrawing_=function(t){var e,i,r,n=t.coordinate,o=this.sketchFeature_.getGeometry();(this.mode_===Ac.POINT?i=this.sketchCoords_:this.mode_===Ac.POLYGON?(i=(e=this.sketchCoords_[0])[e.length-1],this.atFinish_(t)&&(n=this.finishCoordinate_.slice())):i=(e=this.sketchCoords_)[e.length-1],i[0]=n[0],i[1]=n[1],this.geometryFunction_(this.sketchCoords_,o),this.sketchPoint_)&&this.sketchPoint_.getGeometry().setCoordinates(n);
if(o.getType()==Nt.POLYGON&&this.mode_!==Ac.POLYGON){this.sketchLine_||(this.sketchLine_=new B);var s=o.getLinearRing(0);(r=this.sketchLine_.getGeometry())?(r.setFlatCoordinates(s.getLayout(),s.getFlatCoordinates()),r.changed()):(r=new hr(s.getFlatCoordinates(),s.getLayout()),this.sketchLine_.setGeometry(r))}else this.sketchLineCoords_&&(r=this.sketchLine_.getGeometry()).setCoordinates(this.sketchLineCoords_);this.updateSketchFeatures_()},e.prototype.addToDrawing_=function(t){var e,i,r=t.coordinate,
n=this.sketchFeature_.getGeometry();this.mode_===Ac.LINE_STRING?(this.finishCoordinate_=r.slice(),(i=this.sketchCoords_).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),this.geometryFunction_(i,n)):this.mode_===Ac.POLYGON&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=
function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry();this.mode_===Ac.LINE_STRING?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Ac.POLYGON&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e)),0===t.length&&(this.finishCoordinate_=null),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=
this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry();this.mode_===Ac.LINE_STRING?(e.pop(),this.geometryFunction_(e,i)):this.mode_===Ac.POLYGON&&(e[0].pop(),this.geometryFunction_(e,i),e=i.getCoordinates()),this.type_===Nt.MULTI_POINT?t.setGeometry(new bc([e])):this.type_===Nt.MULTI_LINE_STRING?t.setGeometry(new Pc([e])):this.type_===Nt.MULTI_POLYGON&&t.setGeometry(new Fc([e])),this.dispatchEvent(new Dc(Gc,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},
e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return t&&(this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0)),t},e.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.updateSketchFeatures_(),this.dispatchEvent(new Dc(Nc,
this.sketchFeature_))},e.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},e.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing_(),this.overlay_.setMap(e?t:null)},e}(qo),jc={EXTENTCHANGED:"extentchanged"},Uc=function(t){function e(e){t.call(this,jc.EXTENTCHANGED),
this.extent=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function Yc(t){return function(e){return tt([t,e])}}function Bc(t,e){return t[0]==e[0]?function(i){return tt([t,[i[0],e[1]]])}:t[1]==e[1]?function(i){return tt([t,[e[0],i[1]]])}:null}var Vc=function(t){function e(e){var i=e||{};t.call(this,i),this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=
null,this.vertexFeature_=null,e||(e={}),this.extentOverlay_=new gc({source:new op({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:function(){var t=Fu();return function(e,i){return t[Nt.POLYGON]}}(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new gc({source:new op({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:function(){var t=Fu();return function(e,i){return t[Nt.POINT]}}(),updateWhileAnimating:!0,updateWhileInteracting:!0}),
e.extent&&this.setExtent(e.extent)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapToVertex_=function(t,e){var i=e.getCoordinateFromPixel(t),r=this.getExtent();if(r){var n=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(r);n.sort(function(t,e){return rr(i,t)-rr(i,e)});var o=n[0],s=Zi(i,o),a=e.getPixelFromCoordinate(s);if(ir(t,a)<=this.pixelTolerance_){var h=e.getPixelFromCoordinate(o[0]),
l=e.getPixelFromCoordinate(o[1]),u=er(a,h),p=er(a,l),c=Math.sqrt(Math.min(u,p));return this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(s=u>p?o[1]:o[0]),s}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,i=t.map,r=this.snapToVertex_(e,i);r||(r=i.getCoordinateFromPixel(e)),this.createOrUpdatePointerFeature_(r)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Oi(t)):e.setGeometry(void 0):(e=new B(t?Oi(t):
{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new B(new ci(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(e.type!=Ar.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=
function(t){var e=t.pixel,i=t.map,r=this.getExtent(),n=this.snapToVertex_(e,i),o=function(t){var e=null,i=null;return t[0]==r[0]?e=r[2]:t[0]==r[2]&&(e=r[0]),t[1]==r[1]?i=r[3]:t[1]==r[3]&&(i=r[1]),null!==e&&null!==i?[e,i]:null};if(n&&r){var s=n[0]==r[0]||n[0]==r[2]?n[0]:null,a=n[1]==r[1]||n[1]==r[3]?n[1]:null;null!==s&&null!==a?this.pointerHandler_=Yc(o(n)):null!==s?this.pointerHandler_=Bc(o([s,r[1]]),o([s,r[3]])):null!==a&&(this.pointerHandler_=Bc(o([r[0],a]),o([r[2],a])))}else n=i.getCoordinateFromPixel(e),
this.setExtent([n[0],n[1],n[0],n[1]]),this.pointerHandler_=Yc(n);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}return!0},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtent();return e&&0!==xt(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},
e.prototype.getExtent=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new Uc(this.extent_))},e}(qo),Xc=1,zc="modifystart",Wc="modifyend",Kc=function(t){function e(e,i,r){t.call(this,e),this.features=i,this.mapBrowserEvent=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function Hc(t,e){return t.index-e.index}function Zc(t,e){var i=e.geometry;if(i.getType()===
Nt.CIRCLE){var r=i;if(e.index===Xc){var n=er(r.getCenter(),t),o=Math.sqrt(n)-r.getRadius();return o*o}}return rr(t,e.segment)}function qc(t,e){var i=e.geometry;return i.getType()===Nt.CIRCLE&&e.index===Xc?i.getClosestPoint(t):Zi(t,e.segment)}var Jc=function(t){function e(e){var i;if(t.call(this,e),this.condition_=e.condition?e.condition:Ho,this.defaultDeleteCondition_=function(t){return Go(t)&&Vo(t)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=
e.insertVertexCondition?e.insertVertexCondition:jo,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.modified_=!1,this.rBush_=new tl,this.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new gc({source:new op({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:function(){var t=Fu();return function(e,i){return t[Nt.POINT]}}(),updateWhileAnimating:!0,
updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_,LineString:this.writeLineStringGeometry_,LinearRing:this.writeLineStringGeometry_,Polygon:this.writePolygonGeometry_,MultiPoint:this.writeMultiPointGeometry_,MultiLineString:this.writeMultiLineStringGeometry_,MultiPolygon:this.writeMultiPolygonGeometry_,Circle:this.writeCircleGeometry_,GeometryCollection:this.writeGeometryCollectionGeometry_},this.source_=null,e.source?(this.source_=e.source,i=new U(this.source_.getFeatures()),
v(this.source_,rp.ADDFEATURE,this.handleSourceAdd_,this),v(this.source_,rp.REMOVEFEATURE,this.handleSourceRemove_,this)):i=e.features,!i)throw new Error("The modify interaction requires features or a source");this.features_=i,this.features_.forEach(this.addFeature_.bind(this)),v(this.features_,h.ADD,this.handleFeatureAdd_,this),v(this.features_,h.REMOVE,this.handleFeatureRemove_,this),this.lastPointerEvent_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e.prototype.addFeature_=function(t){var e=t.getGeometry();e&&e.getType()in this.SEGMENT_WRITERS_&&this.SEGMENT_WRITERS_[e.getType()].call(this,t,e);var i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),v(t,M.CHANGE,this.handleFeatureChange_,this)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Kc(zc,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),
this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),x(t,M.CHANGE,this.handleFeatureChange_,this)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,i=[];e.forEach(function(e){t===e.feature&&i.push(e)});for(var r=i.length-1;r>=0;--r)e.remove(i[r])},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),
t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=
t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),r={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),r)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r){var o=i[r],s={feature:t,geometry:e,depth:[r],index:r,segment:[o,o]};this.rBush_.insert(e.getExtent(),s)}},e.prototype.writeLineStringGeometry_=
function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length-1;r<n;++r){var o=i.slice(r,r+2),s={feature:t,geometry:e,index:r,segment:o};this.rBush_.insert(tt(o),s)}},e.prototype.writeMultiLineStringGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r)for(var o=i[r],s=0,a=o.length-1;s<a;++s){var h=o.slice(s,s+2),l={feature:t,geometry:e,depth:[r],index:s,segment:h};this.rBush_.insert(tt(h),l)}},e.prototype.writePolygonGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<
n;++r)for(var o=i[r],s=0,a=o.length-1;s<a;++s){var h=o.slice(s,s+2),l={feature:t,geometry:e,depth:[r],index:s,segment:h};this.rBush_.insert(tt(h),l)}},e.prototype.writeMultiPolygonGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r)for(var o=i[r],s=0,a=o.length;s<a;++s)for(var h=o[s],l=0,u=h.length-1;l<u;++l){var p=h.slice(l,l+2),c={feature:t,geometry:e,depth:[s,r],index:l,segment:p};this.rBush_.insert(tt(p),c)}},e.prototype.writeCircleGeometry_=function(t,e){var i=e.getCenter(),
r={feature:t,geometry:e,index:0,segment:[i,i]},n={feature:t,geometry:e,index:Xc,segment:[i,i]},o=[r,n];r.featureSegments=n.featureSegments=o,this.rBush_.insert(pt(i),r),this.rBush_.insert(e.getExtent(),n)},e.prototype.writeGeometryCollectionGeometry_=function(t,e){for(var i=e.getGeometriesArray(),r=0;r<i.length;++r)this.SEGMENT_WRITERS_[i[r].getType()].call(this,t,i[r])},e.prototype.createOrUpdateVertexFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new B(new ci(t)),
this.vertexFeature_=e,this.overlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(this.lastPointerEvent_=e,e.map.getView().getInteracting()||e.type!=Ar.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(i=!(e.type!=Ar.SINGLECLICK||!this.ignoreNextSingleClick_)||this.removePoint()),e.type==Ar.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),t.prototype.handleEvent.call(this,e)&&!i);var i},
e.prototype.handleDragEvent=function(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t);for(var e=t.coordinate,i=0,r=this.dragSegments_.length;i<r;++i){for(var n=this.dragSegments_[i],o=n[0],s=o.depth,a=o.geometry,h=void 0,l=o.segment,u=n[1];e.length<a.getStride();)e.push(l[u][e.length]);switch(a.getType()){case Nt.POINT:h=e,l[0]=l[1]=e;break;case Nt.MULTI_POINT:(h=a.getCoordinates())[o.index]=e,l[0]=l[1]=e;break;case Nt.LINE_STRING:(h=a.getCoordinates())[o.index+u]=e,l[u]=e;break;case Nt.MULTI_LINE_STRING:case Nt.POLYGON:(h=
a.getCoordinates())[s[0]][o.index+u]=e,l[u]=e;break;case Nt.MULTI_POLYGON:(h=a.getCoordinates())[s[1]][s[0]][o.index+u]=e,l[u]=e;break;case Nt.CIRCLE:l[0]=l[1]=e,0===o.index?(this.changingFeature_=!0,a.setCenter(e),this.changingFeature_=!1):(this.changingFeature_=!0,a.setRadius(ir(a.getCenter(),e)),this.changingFeature_=!1)}h&&this.setGeometryCoordinates_(a,h)}this.createOrUpdateVertexFeature_(e)},e.prototype.handleDownEvent=function(t){if(!this.condition_(t))return!1;this.handlePointerAtPixel_(t.pixel,
t.map);var e=t.map.getCoordinateFromPixel(t.pixel);this.dragSegments_.length=0,this.modified_=!1;var i=this.vertexFeature_;if(i){var r=[],n=i.getGeometry().getCoordinates(),s=tt([n]),a=this.rBush_.getInExtent(s),h={};a.sort(Hc);for(var l=0,u=a.length;l<u;++l){var p=a[l],c=p.segment,d=o(p.feature),f=p.depth;if(f&&(d+="-"+f.join("-")),h[d]||(h[d]=new Array(2)),p.geometry.getType()===Nt.CIRCLE&&p.index===Xc)Qi(qc(e,p),n)&&!h[d][0]&&(this.dragSegments_.push([p,0]),h[d][0]=p);else if(Qi(c[0],n)&&!h[d][0])this.dragSegments_.push([p,
0]),h[d][0]=p;else if(Qi(c[1],n)&&!h[d][1]){if((p.geometry.getType()===Nt.LINE_STRING||p.geometry.getType()===Nt.MULTI_LINE_STRING)&&h[d][0]&&0===h[d][0].index)continue;this.dragSegments_.push([p,1]),h[d][1]=p}else this.insertVertexCondition_(t)&&o(c)in this.vertexSegments_&&!h[d][0]&&!h[d][1]&&r.push([p,n])}r.length&&this.willModifyFeatures_(t);for(var _=r.length-1;_>=0;--_)this.insertVertex_.apply(this,r[_])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-
1;e>=0;--e){var i=this.dragSegments_[e][0],r=i.geometry;if(r.getType()===Nt.CIRCLE){var n=r.getCenter(),o=i.featureSegments[0],s=i.featureSegments[1];o.segment[0]=o.segment[1]=n,s.segment[0]=s.segment[1]=n,this.rBush_.update(pt(n),o),this.rBush_.update(r.getExtent(),s)}else this.rBush_.update(tt(i.segment),i)}return this.modified_&&(this.dispatchEvent(new Kc(Wc,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,
t.map)},e.prototype.handlePointerAtPixel_=function(t,e){var i=e.getCoordinateFromPixel(t),r=et(pt(i),e.getView().getResolution()*this.pixelTolerance_),n=this.rBush_.getInExtent(r);if(n.length>0){n.sort(function(t,e){return Zc(i,t)-Zc(i,e)});var s=n[0],a=s.segment,h=qc(i,s),l=e.getPixelFromCoordinate(h),u=ir(t,l);if(u<=this.pixelTolerance_){var p={};if(s.geometry.getType()===Nt.CIRCLE&&s.index===Xc)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var c=e.getPixelFromCoordinate(a[0]),
d=e.getPixelFromCoordinate(a[1]),f=er(l,c),_=er(l,d);u=Math.sqrt(Math.min(f,_)),this.snappedToVertex_=u<=this.pixelTolerance_,this.snappedToVertex_&&(h=f>_?a[1]:a[0]),this.createOrUpdateVertexFeature_(h);for(var g=1,y=n.length;g<y;++g){var v=n[g].segment;if(!(Qi(a[0],v[0])&&Qi(a[1],v[1])||Qi(a[0],v[1])&&Qi(a[1],v[0])))break;p[o(v)]=!0}}return p[o(a)]=!0,void(this.vertexSegments_=p)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},e.prototype.insertVertex_=
function(t,e){for(var i,r=t.segment,n=t.feature,o=t.geometry,s=t.depth,a=t.index;e.length<o.getStride();)e.push(0);switch(o.getType()){case Nt.MULTI_LINE_STRING:case Nt.POLYGON:(i=o.getCoordinates())[s[0]].splice(a+1,0,e);break;case Nt.MULTI_POLYGON:(i=o.getCoordinates())[s[1]][s[0]].splice(a+1,0,e);break;case Nt.LINE_STRING:(i=o.getCoordinates()).splice(a+1,0,e);break;default:return}this.setGeometryCoordinates_(o,i);var h=this.rBush_;h.remove(t),this.updateSegmentIndices_(o,a,s,1);var l={segment:[r[0],
e],feature:n,geometry:o,depth:s,index:a};h.insert(tt(l.segment),l),this.dragSegments_.push([l,1]);var u={segment:[e,r[1]],feature:n,geometry:o,depth:s,index:a+1};h.insert(tt(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0},e.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Ar.POINTERDRAG){var t=this.lastPointerEvent_;return this.willModifyFeatures_(t),this.removeVertex_(),this.dispatchEvent(new Kc(Wc,this.features_,t)),this.modified_=
!1,!0}return!1},e.prototype.removeVertex_=function(){var t,e,i,r,n,s,a,h,l,u,p,c=this.dragSegments_,d={},f=!1;for(n=c.length-1;n>=0;--n)p=o((u=(i=c[n])[0]).feature),u.depth&&(p+="-"+u.depth.join("-")),p in d||(d[p]={}),0===i[1]?(d[p].right=u,d[p].index=u.index):1==i[1]&&(d[p].left=u,d[p].index=u.index+1);for(p in d){switch(l=d[p].right,a=d[p].left,h=(s=d[p].index)-1,u=void 0!==a?a:l,h<0&&(h=0),t=e=(r=u.geometry).getCoordinates(),f=!1,r.getType()){case Nt.MULTI_LINE_STRING:e[u.depth[0]].length>2&&
(e[u.depth[0]].splice(s,1),f=!0);break;case Nt.LINE_STRING:e.length>2&&(e.splice(s,1),f=!0);break;case Nt.MULTI_POLYGON:t=t[u.depth[1]];case Nt.POLYGON:(t=t[u.depth[0]]).length>4&&(s==t.length-1&&(s=0),t.splice(s,1),f=!0,0===s&&(t.pop(),t.push(t[0]),h=t.length-1))}if(f){this.setGeometryCoordinates_(r,e);var _=[];if(void 0!==a&&(this.rBush_.remove(a),_.push(a.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==a&&void 0!==l){var g={depth:u.depth,feature:u.feature,geometry:u.geometry,
index:h,segment:_};this.rBush_.insert(tt(g.segment),g)}this.updateSegmentIndices_(r,s,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),c.length=0}}return f},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,i,r){this.rBush_.forEachInExtent(t.getExtent(),function(n){n.geometry===t&&(void 0===i||void 0===n.depth||
Z(n.depth,i))&&n.index>e&&(n.index+=r)})},e}(qo),Qc={SELECT:"select"},$c=function(t){function e(e,i,r,n){t.call(this,e),this.selected=i,this.deselected=r,this.mapBrowserEvent=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P);function td(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),i=this.removeCondition_(t),r=this.toggleCondition_(t),n=!e&&!i&&!r,o=t.map,s=this.getFeatures(),a=[],h=[];if(n){p(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,
function(t,e){if(this.filter_(t,e))return h.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=s.getLength()-1;l>=0;--l){var u=s.item(l),c=h.indexOf(u);c>-1?h.splice(c,1):(s.remove(u),a.push(u))}0!==h.length&&s.extend(h)}else{o.forEachFeatureAtPixel(t.pixel,function(t,n){if(this.filter_(t,n))return!e&&!r||X(s.getArray(),t)?(i||r)&&X(s.getArray(),t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(h.push(t),
this.addFeatureLayerAssociation_(t,n)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var d=a.length-1;d>=0;--d)s.remove(a[d]);s.extend(h)}return(h.length>0||a.length>0)&&this.dispatchEvent(new $c(Qc.SELECT,h,a,t)),Bo(t)}var ed=function(t){function e(e){t.call(this,{handleEvent:td});var i=e||{};this.condition_=i.condition?i.condition:Vo,this.addCondition_=i.addCondition?i.addCondition:Yo,this.removeCondition_=i.removeCondition?i.removeCondition:Yo,this.toggleCondition_=
i.toggleCondition?i.toggleCondition:zo,this.multi_=!!i.multi&&i.multi,this.filter_=i.filter?i.filter:R,this.hitTolerance_=i.hitTolerance?i.hitTolerance:0;var r,n=new gc({source:new op({useSpatialIndex:!1,features:i.features,wrapX:i.wrapX}),style:i.style?i.style:function(){var t=Fu();return K(t[Nt.POLYGON],t[Nt.LINE_STRING]),K(t[Nt.GEOMETRY_COLLECTION],t[Nt.LINE_STRING]),function(e,i){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),updateWhileAnimating:!0,updateWhileInteracting:!0});if(this.featureOverlay_=
n,i.layers)if("function"==typeof i.layers)r=i.layers;else{var o=i.layers;r=function(t){return X(o,t)}}else r=R;this.layerFilter_=r,this.featureLayerAssociation_={};var s=this.getFeatures();v(s,h.ADD,this.addFeature_,this),v(s,h.REMOVE,this.removeFeature_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.featureOverlay_.getSource().getFeaturesCollection()},
e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.getOverlay=function(){return this.featureOverlay_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var i=this.getMap(),r=this.getFeatures();i&&r.forEach(i.unskipFeature.bind(i)),t.prototype.setMap.call(this,e),this.featureOverlay_.setMap(e),e&&r.forEach(e.skipFeature.bind(e))},e.prototype.addFeature_=
function(t){var e=this.getMap();e&&e.skipFeature(t.element)},e.prototype.removeFeature_=function(t){var e=this.getMap();e&&e.unskipFeature(t.element)},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e}(Fo);function id(t){return t.feature?t.feature:t.element?t.element:void 0}var rd=function(t){function e(e){var i=e||{},r=i;r.handleDownEvent||(r.handleDownEvent=R),r.stopDown||(r.stopDown=w),t.call(this,r),this.source_=i.source?i.source:null,this.vertex_=
void 0===i.vertex||i.vertex,this.edge_=void 0===i.edge||i.edge,this.features_=i.features?i.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelCoordinate_=null,this.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,this.sortByDistance_=function(t,e){var i=rr(this.pixelCoordinate_,t.segment),r=rr(this.pixelCoordinate_,e.segment);return i-r}.bind(this),this.rBush_=new tl,this.SEGMENT_WRITERS_={Point:this.writePointGeometry_,
LineString:this.writeLineStringGeometry_,LinearRing:this.writeLineStringGeometry_,Polygon:this.writePolygonGeometry_,MultiPoint:this.writeMultiPointGeometry_,MultiLineString:this.writeMultiLineStringGeometry_,MultiPolygon:this.writeMultiPolygonGeometry_,GeometryCollection:this.writeGeometryCollectionGeometry_,Circle:this.writeCircleGeometry_}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addFeature=function(t,e){var i=void 0===e||e,r=o(t),
n=t.getGeometry();if(n){var s=this.SEGMENT_WRITERS_[n.getType()];s&&(this.indexedFeaturesExtents_[r]=n.getExtent([1/0,1/0,-1/0,-1/0]),s.call(this,t,n))}i&&(this.featureChangeListenerKeys_[r]=v(t,M.CHANGE,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=
function(e){var i=this.snapTo(e.pixel,e.coordinate,e.map);return i.snapped&&(e.coordinate=i.vertex.slice(0,2),e.pixel=i.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=id(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=id(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var i=o(e);i in this.pendingFeatures_||(this.pendingFeatures_[i]=e)}else this.updateFeature_(e)},
e.prototype.handleUpEvent=function(t){var e=c(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var i=void 0===e||e,r=o(t),n=this.indexedFeaturesExtents_[r];if(n){var s=this.rBush_,a=[];s.forEachInExtent(n,function(e){t===e.feature&&a.push(e)});for(var h=a.length-1;h>=0;--h)s.remove(a[h])}i&&(E(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])},e.prototype.setMap=function(e){var i=
this.getMap(),r=this.featuresListenerKeys_,n=this.getFeatures_();i&&(r.forEach(E),r.length=0,n.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?r.push(v(this.features_,h.ADD,this.handleFeatureAdd_,this),v(this.features_,h.REMOVE,this.handleFeatureRemove_,this)):this.source_&&r.push(v(this.source_,rp.ADDFEATURE,this.handleFeatureAdd_,this),v(this.source_,rp.REMOVEFEATURE,this.handleFeatureRemove_,this)),n.forEach(this.forEachFeatureAdd_.bind(this)))},
e.prototype.snapTo=function(t,e,i){var r=tt([i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),n=this.rBush_.getInExtent(r);this.vertex_&&!this.edge_&&(n=n.filter(function(t){return t.feature.getGeometry().getType()!==Nt.CIRCLE}));var o,s,a,h,l=!1,u=null,p=null;if(n.length>0){this.pixelCoordinate_=e,n.sort(this.sortByDistance_);var c=n[0].segment,d=n[0].feature.getGeometry().getType()===
Nt.CIRCLE;this.vertex_&&!this.edge_?(o=i.getPixelFromCoordinate(c[0]),s=i.getPixelFromCoordinate(c[1]),a=er(t,o),h=er(t,s),Math.sqrt(Math.min(a,h))<=this.pixelTolerance_&&(l=!0,u=a>h?c[1]:c[0],p=i.getPixelFromCoordinate(u))):this.edge_&&(u=d?function(t,e){var i=e.getRadius(),r=e.getCenter(),n=r[0],o=r[1],s=t[0]-n,a=t[1]-o;0===s&&0===a&&(s=1);var h=Math.sqrt(s*s+a*a);return[n+i*s/h,o+i*a/h]}(e,n[0].feature.getGeometry()):Zi(e,c),ir(t,p=i.getPixelFromCoordinate(u))<=this.pixelTolerance_&&(l=!0,this.vertex_&&
!d&&(o=i.getPixelFromCoordinate(c[0]),s=i.getPixelFromCoordinate(c[1]),a=er(p,o),h=er(p,s),Math.sqrt(Math.min(a,h))<=this.pixelTolerance_&&(u=a>h?c[1]:c[0],p=i.getPixelFromCoordinate(u))))),l&&(p=[Math.round(p[0]),Math.round(p[1])])}return{snapped:l,vertex:u,vertexPixel:p}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){for(var i=Pi(e).getCoordinates()[0],r=0,n=i.length-1;r<n;++r){var o=i.slice(r,r+2),s={feature:t,
segment:o};this.rBush_.insert(tt(o),s)}},e.prototype.writeGeometryCollectionGeometry_=function(t,e){for(var i=e.getGeometriesArray(),r=0;r<i.length;++r){var n=this.SEGMENT_WRITERS_[i[r].getType()];n&&n.call(this,t,i[r])}},e.prototype.writeLineStringGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length-1;r<n;++r){var o=i.slice(r,r+2),s={feature:t,segment:o};this.rBush_.insert(tt(o),s)}},e.prototype.writeMultiLineStringGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<
n;++r)for(var o=i[r],s=0,a=o.length-1;s<a;++s){var h=o.slice(s,s+2),l={feature:t,segment:h};this.rBush_.insert(tt(h),l)}},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r){var o=i[r],s={feature:t,segment:[o,o]};this.rBush_.insert(e.getExtent(),s)}},e.prototype.writeMultiPolygonGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r)for(var o=i[r],s=0,a=o.length;s<a;++s)for(var h=o[s],l=0,u=h.length-1;l<u;++l){var p=h.slice(l,
l+2),c={feature:t,segment:p};this.rBush_.insert(tt(p),c)}},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),r={feature:t,segment:[i,i]};this.rBush_.insert(e.getExtent(),r)},e.prototype.writePolygonGeometry_=function(t,e){for(var i=e.getCoordinates(),r=0,n=i.length;r<n;++r)for(var o=i[r],s=0,a=o.length-1;s<a;++s){var h=o.slice(s,s+2),l={feature:t,segment:h};this.rBush_.insert(tt(h),l)}},e}(qo),nd="translatestart",od="translating",sd="translateend",ad=function(t){function e(e,
i,r){t.call(this,e),this.features=i,this.coordinate=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(P),hd=function(t){function e(e){var i,r=e||{};if(t.call(this,r),this.lastCoordinate_=null,this.features_=void 0!==r.features?r.features:null,r.layers)if("function"==typeof r.layers)i=r.layers;else{var n=r.layers;i=function(t){return X(n,t)}}else i=R;this.layerFilter_=i,this.hitTolerance_=r.hitTolerance?r.hitTolerance:0,this.lastFeature_=null,v(this,
G(Io.ACTIVE),this.handleActiveChanged_,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleDownEvent=function(t){if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);var e=this.features_||new U([this.lastFeature_]);return this.dispatchEvent(new ad(nd,e,t.coordinate)),!0}return!1},e.prototype.handleUpEvent=function(t){if(this.lastCoordinate_){this.lastCoordinate_=
null,this.handleMoveEvent(t);var e=this.features_||new U([this.lastFeature_]);return this.dispatchEvent(new ad(sd,e,t.coordinate)),!0}return!1},e.prototype.handleDragEvent=function(t){if(this.lastCoordinate_){var e=t.coordinate,i=e[0]-this.lastCoordinate_[0],r=e[1]-this.lastCoordinate_[1],n=this.features_||new U([this.lastFeature_]);n.forEach(function(t){var e=t.getGeometry();e.translate(i,r),t.setGeometry(e)}),this.lastCoordinate_=e,this.dispatchEvent(new ad(od,n,e))}},e.prototype.handleMoveEvent=
function(t){var e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")},e.prototype.featuresAtPixel_=function(t,e){return e.forEachFeatureAtPixel(t,function(t){if(!this.features_||X(this.features_.getArray(),t))return t}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})},e.prototype.getHitTolerance=
function(){return this.hitTolerance_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var i=this.getMap();t.prototype.setMap.call(this,e),this.updateState_(i)},e.prototype.handleActiveChanged_=function(){this.updateState_(null)},e.prototype.updateState_=function(t){var e=this.getMap(),i=this.getActive();e&&i||(e=e||t)&&e.getViewport().classList.remove("ol-grab","ol-grabbing")},e}(qo);function ld(t){for(var e=[],i=0,r=t.length;i<r;++i)e.push(t[i].clone());
return e}var ud=function(t){function e(e){t.call(this),this.geometries_=e||null,this.listenGeometriesChange_()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.unlistenGeometriesChange_=function(){if(this.geometries_)for(var t=0,e=this.geometries_.length;t<e;++t)x(this.geometries_[t],M.CHANGE,this.changed,this)},e.prototype.listenGeometriesChange_=function(){if(this.geometries_)for(var t=0,e=this.geometries_.length;t<e;++t)v(this.geometries_[t],
M.CHANGE,this.changed,this)},e.prototype.clone=function(){var t=new e(null);return t.setGeometries(this.geometries_),t},e.prototype.closestPointXY=function(t,e,i,r){if(r<rt(this.getExtent(),t,e))return r;for(var n=this.geometries_,o=0,s=n.length;o<s;++o)r=n[o].closestPointXY(t,e,i,r);return r},e.prototype.containsXY=function(t,e){for(var i=this.geometries_,r=0,n=i.length;r<n;++r)if(i[r].containsXY(t,e))return!0;return!1},e.prototype.computeExtent=function(t){ut(t);for(var e=this.geometries_,i=0,r=
e.length;i<r;++i)ft(t,e[i].getExtent());return t},e.prototype.getGeometries=function(){return ld(this.geometries_)},e.prototype.getGeometriesArray=function(){return this.geometries_},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!=this.getRevision()&&(p(this.simplifiedGeometryCache),this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;
var i=t.toString();if(this.simplifiedGeometryCache.hasOwnProperty(i))return this.simplifiedGeometryCache[i];for(var r=[],n=this.geometries_,o=!1,s=0,a=n.length;s<a;++s){var h=n[s],l=h.getSimplifiedGeometry(t);r.push(l),l!==h&&(o=!0)}if(o){var u=new e(null);return u.setGeometriesArray(r),this.simplifiedGeometryCache[i]=u,u}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this},e.prototype.getType=function(){return Nt.GEOMETRY_COLLECTION},e.prototype.intersectsExtent=function(t){for(var e=this.geometries_,
i=0,r=e.length;i<r;++i)if(e[i].intersectsExtent(t))return!0;return!1},e.prototype.isEmpty=function(){return 0===this.geometries_.length},e.prototype.rotate=function(t,e){for(var i=this.geometries_,r=0,n=i.length;r<n;++r)i[r].rotate(t,e);this.changed()},e.prototype.scale=function(t,e,i){var r=i;r||(r=Tt(this.getExtent()));for(var n=this.geometries_,o=0,s=n.length;o<s;++o)n[o].scale(t,e,r);this.changed()},e.prototype.setGeometries=function(t){this.setGeometriesArray(ld(t))},e.prototype.setGeometriesArray=
function(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()},e.prototype.applyTransform=function(t){for(var e=this.geometries_,i=0,r=e.length;i<r;++i)e[i].applyTransform(t);this.changed()},e.prototype.translate=function(t,e){for(var i=this.geometries_,r=0,n=i.length;r<n;++r)i[r].translate(t,e);this.changed()},e.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),t.prototype.disposeInternal.call(this)},e}(Xe),pd=function(){this.dataProjection=
null,this.defaultFeatureProjection=null};pd.prototype.getReadOptions=function(t,e){var i;return e&&(i={dataProjection:e.dataProjection?e.dataProjection:this.readProjection(t),featureProjection:e.featureProjection}),this.adaptOptions(i)},pd.prototype.adaptOptions=function(t){return u({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},pd.prototype.getLastExtent=function(){return null},pd.prototype.getType=function(){return r()},pd.prototype.readFeature=function(t,
e){return r()},pd.prototype.readFeatures=function(t,e){return r()},pd.prototype.readGeometry=function(t,e){return r()},pd.prototype.readProjection=function(t){return r()},pd.prototype.writeFeature=function(t,e){return r()},pd.prototype.writeFeatures=function(t,e){return r()},pd.prototype.writeGeometry=function(t,e){return r()};var cd=pd;function dd(t,e,i){var r,n=i?Ee(i.featureProjection):null,o=i?Ee(i.dataProjection):null;if(r=n&&o&&!Ie(n,o)?Array.isArray(t)?be(t,o,n):(e?t.clone():t).transform(e?
n:o,e?o:n):t,e&&i&&void 0!==i.decimals&&!Array.isArray(r)){var s=Math.pow(10,i.decimals);r===t&&(r=t.clone()),r.applyTransform(function(t){for(var e=0,i=t.length;e<i;++e)t[e]=Math.round(t[e]*s)/s;return t})}return r}function fd(t){if("string"==typeof t){var e=JSON.parse(t);return e||null}return null!==t?t:null}var _d=function(t){function e(){t.call(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getType=function(){return Hl.JSON},e.prototype.readFeature=
function(t,e){return this.readFeatureFromObject(fd(t),this.getReadOptions(t,e))},e.prototype.readFeatures=function(t,e){return this.readFeaturesFromObject(fd(t),this.getReadOptions(t,e))},e.prototype.readFeatureFromObject=function(t,e){return r()},e.prototype.readFeaturesFromObject=function(t,e){return r()},e.prototype.readGeometry=function(t,e){return this.readGeometryFromObject(fd(t),this.getReadOptions(t,e))},e.prototype.readGeometryFromObject=function(t,e){return r()},e.prototype.readProjection=
function(t){return this.readProjectionFromObject(fd(t))},e.prototype.readProjectionFromObject=function(t){return r()},e.prototype.writeFeature=function(t,e){return JSON.stringify(this.writeFeatureObject(t,e))},e.prototype.writeFeatureObject=function(t,e){return r()},e.prototype.writeFeatures=function(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))},e.prototype.writeFeaturesObject=function(t,e){return r()},e.prototype.writeGeometry=function(t,e){return JSON.stringify(this.writeGeometryObject(t,
e))},e.prototype.writeGeometryObject=function(t,e){return r()},e}(cd),gd={};gd[Nt.POINT]=function(t){var e;e=void 0!==t.m&&void 0!==t.z?new ci([t.x,t.y,t.z,t.m],At.XYZM):void 0!==t.z?new ci([t.x,t.y,t.z],At.XYZ):void 0!==t.m?new ci([t.x,t.y,t.m],At.XYM):new ci([t.x,t.y]);return e},gd[Nt.LINE_STRING]=function(t){var e=md(t);return new hr(t.paths[0],e)},gd[Nt.POLYGON]=function(t){var e=md(t);return new Ii(t.rings,e)},gd[Nt.MULTI_POINT]=function(t){var e=md(t);return new bc(t.points,e)},gd[Nt.MULTI_LINE_STRING]=
function(t){var e=md(t);return new Pc(t.paths,e)},gd[Nt.MULTI_POLYGON]=function(t){var e=md(t);return new Fc(t.rings,e)};var yd={};function vd(t,e){if(!t)return null;var i;if("number"==typeof t.x&&"number"==typeof t.y)i=Nt.POINT;else if(t.points)i=Nt.MULTI_POINT;else if(t.paths)i=1===t.paths.length?Nt.LINE_STRING:Nt.MULTI_LINE_STRING;else if(t.rings){var r=t,n=md(r),o=function(t,e){var i,r,n=[],o=[],s=[];for(i=0,r=t.length;i<r;++i){n.length=0,ei(n,0,t[i],e.length);var a=Si(n,0,n.length,e.length);
a?o.push([t[i]]):s.push(t[i])}for(;s.length;){var h=s.shift(),l=!1;for(i=o.length-1;i>=0;i--){var u=o[i][0],p=ot((new pi(u)).getExtent(),(new pi(h)).getExtent());if(p){o[i].push(h),l=!0;break}}l||o.push([h.reverse()])}return o}(r.rings,n);1===o.length?(i=Nt.POLYGON,t.rings=o[0]):(i=Nt.MULTI_POLYGON,t.rings=o)}return dd((0,gd[i])(t),!1,e)}function md(t){var e=At.XY;return!0===t.hasZ&&!0===t.hasM?e=At.XYZM:!0===t.hasZ?e=At.XYZ:!0===t.hasM&&(e=At.XYM),e}function xd(t){var e=t.getLayout();return{hasZ:e===
At.XYZ||e===At.XYZM,hasM:e===At.XYM||e===At.XYZM}}function Ed(t,e){return(0,yd[t.getType()])(dd(t,!0,e),e)}yd[Nt.POINT]=function(t,e){var i,r=t.getCoordinates(),n=t.getLayout();n===At.XYZ?i={x:r[0],y:r[1],z:r[2]}:n===At.XYM?i={x:r[0],y:r[1],m:r[2]}:n===At.XYZM?i={x:r[0],y:r[1],z:r[2],m:r[3]}:n===At.XY?i={x:r[0],y:r[1]}:Y(!1,34);return i},yd[Nt.LINE_STRING]=function(t,e){var i=t,r=xd(i);return{hasZ:r.hasZ,hasM:r.hasM,paths:[i.getCoordinates()]}},yd[Nt.POLYGON]=function(t,e){var i=t,r=xd(i);return{hasZ:r.hasZ,
hasM:r.hasM,rings:i.getCoordinates(!1)}},yd[Nt.MULTI_POINT]=function(t,e){var i=t,r=xd(i);return{hasZ:r.hasZ,hasM:r.hasM,points:i.getCoordinates()}},yd[Nt.MULTI_LINE_STRING]=function(t,e){var i=t,r=xd(i);return{hasZ:r.hasZ,hasM:r.hasM,paths:i.getCoordinates()}},yd[Nt.MULTI_POLYGON]=function(t,e){for(var i=xd(t),r=t.getCoordinates(!1),n=[],o=0;o<r.length;o++)for(var s=r[o].length-1;s>=0;s--)n.push(r[o][s]);return{hasZ:i.hasZ,hasM:i.hasM,rings:n}};var Sd=function(t){function e(e){var i=e||{};t.call(this),
this.geometryName_=i.geometryName}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromObject=function(t,e){var i=t,r=vd(i.geometry,e),n=new B;return this.geometryName_&&n.setGeometryName(this.geometryName_),n.setGeometry(r),e&&e.idField&&i.attributes[e.idField]&&n.setId(i.attributes[e.idField]),i.attributes&&n.setProperties(i.attributes),n},e.prototype.readFeaturesFromObject=function(t,e){var i=e||{};if(t.features){var r=[],n=t.features;
i.idField=t.objectIdFieldName;for(var o=0,s=n.length;o<s;++o)r.push(this.readFeatureFromObject(n[o],i));return r}return[this.readFeatureFromObject(t,i)]},e.prototype.readGeometryFromObject=function(t,e){return vd(t,e)},e.prototype.readProjectionFromObject=function(t){return t.spatialReference&&void 0!==t.spatialReference.wkid?Ee("EPSG:"+t.spatialReference.wkid):null},e.prototype.writeGeometryObject=function(t,e){return Ed(t,this.adaptOptions(e))},e.prototype.writeFeatureObject=function(t,e){e=this.adaptOptions(e);
var i={},r=t.getGeometry();r&&(i.geometry=Ed(r,e),e&&e.featureProjection&&(i.geometry.spatialReference={wkid:Number(Ee(e.featureProjection).getCode().split(":").pop())}));var n=t.getProperties();return delete n[t.getGeometryName()],d(n)?i.attributes={}:i.attributes=n,i},e.prototype.writeFeaturesObject=function(t,e){e=this.adaptOptions(e);for(var i=[],r=0,n=t.length;r<n;++r)i.push(this.writeFeatureObject(t[r],e));return{features:i}},e}(_d),Td=function(t){function e(){t.call(this),this.xmlSerializer_=
new XMLSerializer}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getType=function(){return Hl.XML},e.prototype.readFeature=function(t,e){if(t){if("string"==typeof t){var i=ru(t);return this.readFeatureFromDocument(i,e)}return iu(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}return null},e.prototype.readFeatureFromDocument=function(t,e){var i=this.readFeaturesFromDocument(t,e);return i.length>0?i[0]:null},e.prototype.readFeatureFromNode=
function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var i=ru(t);return this.readFeaturesFromDocument(i,e)}return iu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var i=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&K(i,this.readFeaturesFromNode(r,e));return i},e.prototype.readFeaturesFromNode=function(t,e){return r()},e.prototype.readGeometry=function(t,
e){if(t){if("string"==typeof t){var i=ru(t);return this.readGeometryFromDocument(i,e)}return iu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=ru(t);return this.readProjectionFromDocument(e)}return iu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},
e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeFeaturesNode=function(t,e){return null},
e.prototype.writeGeometry=function(t,e){var i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)},e.prototype.writeGeometryNode=function(t,e){return null},e}(cd),Cd="http://www.opengis.net/gml",Rd=/^[\s\xa0]*$/,wd=function(t){function e(e){t.call(this);var i=e||{};this.featureType=i.featureType,this.featureNS=i.featureNS,this.srsName=i.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:ou(this.readFeaturesInternal),
featureMembers:su(this.readFeaturesInternal)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeaturesInternal=function(t,e){var i=t.localName,r=null;if("FeatureCollection"==i)r=gu([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i){var n=e[0],o=n.featureType,s=n.featureNS;if(!o&&t.childNodes){o=[],s={};for(var a=0,h=t.childNodes.length;a<h;++a){var l=t.childNodes[a];if(1===l.nodeType){var u=l.nodeName.split(":").pop();
if(-1===o.indexOf(u)){var p="",c=0,d=l.namespaceURI;for(var f in s){if(s[f]===d){p=f;break}++c}p||(s[p="p"+c]=d),o.push(p+":"+u)}}}"featureMember"!=i&&(n.featureType=o,n.featureNS=s)}if("string"==typeof s){var _=s;(s={}).p0=_}var g={},y=Array.isArray(o)?o:[o];for(var v in s){for(var m={},x=0,E=y.length;x<E;++x)(-1===y[x].indexOf(":")?"p0":y[x].split(":")[0])===v&&(m[y[x].split(":").pop()]="featureMembers"==i?ou(this.readFeatureElement,this):su(this.readFeatureElement,this));g[s[v]]=m}r=gu("featureMember"==
i?void 0:[],g,t,e)}return null===r&&(r=[]),r},e.prototype.readGeometryElement=function(t,e){var i=e[0];i.srsName=t.firstElementChild.getAttribute("srsName"),i.srsDimension=t.firstElementChild.getAttribute("srsDimension");var r=gu(null,this.GEOMETRY_PARSERS,t,e,this);return r?dd(r,!1,i):void 0},e.prototype.readFeatureElementInternal=function(t,e,i){for(var r,n={},o=t.firstElementChild;o;o=o.nextElementSibling){var s=void 0,a=o.localName;0===o.childNodes.length||1===o.childNodes.length&&(3===o.firstChild.nodeType||
4===o.firstChild.nodeType)?(s=eu(o,!1),Rd.test(s)&&(s=void 0)):(i&&(s=this.readGeometryElement(o,e)),s?"boundedBy"!==a&&(r=a):s=this.readFeatureElementInternal(o,e,!1)),n[a]?(n[a]instanceof Array||(n[a]=[n[a]]),n[a].push(s)):n[a]=s;var h=o.attributes.length;if(h>0){n[a]={_content_:n[a]};for(var l=0;l<h;l++){var u=o.attributes[l].name;n[a][u]=o.attributes[l].value}}}if(i){var p=new B(n);r&&p.setGeometryName(r);var c=t.getAttribute("fid")||function(t,e,i){return t.getAttributeNS(e,i)||""}(t,this.namespace,
"id");return c&&p.setId(c),p}return n},e.prototype.readFeatureElement=function(t,e){return this.readFeatureElementInternal(t,e,!0)},e.prototype.readPoint=function(t,e){var i=this.readFlatCoordinatesFromNode_(t,e);if(i)return new ci(i,At.XYZ)},e.prototype.readMultiPoint=function(t,e){var i=gu([],this.MULTIPOINT_PARSERS_,t,e,this);return i?new bc(i):void 0},e.prototype.readMultiLineString=function(t,e){var i=gu([],this.MULTILINESTRING_PARSERS_,t,e,this);if(i)return new Pc(i)},e.prototype.readMultiPolygon=
function(t,e){var i=gu([],this.MULTIPOLYGON_PARSERS_,t,e,this);if(i)return new Fc(i)},e.prototype.pointMemberParser_=function(t,e){_u(this.POINTMEMBER_PARSERS_,t,e,this)},e.prototype.lineStringMemberParser_=function(t,e){_u(this.LINESTRINGMEMBER_PARSERS_,t,e,this)},e.prototype.polygonMemberParser_=function(t,e){_u(this.POLYGONMEMBER_PARSERS_,t,e,this)},e.prototype.readLineString=function(t,e){var i=this.readFlatCoordinatesFromNode_(t,e);return i?new hr(i,At.XYZ):void 0},e.prototype.readFlatLinearRing_=
function(t,e){var i=gu(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this);return i||void 0},e.prototype.readLinearRing=function(t,e){var i=this.readFlatCoordinatesFromNode_(t,e);if(i)return new pi(i,At.XYZ)},e.prototype.readPolygon=function(t,e){var i=gu([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(i&&i[0]){var r,n,o=i[0],s=[o.length];for(r=1,n=i.length;r<n;++r)K(o,i[r]),s.push(o.length);return new Ii(o,At.XYZ,s)}},e.prototype.readFlatCoordinatesFromNode_=function(t,e){return gu(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,
t,e,this)},e.prototype.readGeometryFromNode=function(t,e){var i=this.readGeometryElement(t,[this.getReadOptions(t,e||{})]);return i||null},e.prototype.readFeaturesFromNode=function(t,e){var i={featureType:this.featureType,featureNS:this.featureNS};return e&&u(i,this.getReadOptions(t,e)),this.readFeaturesInternal(t,[i])||[]},e.prototype.readProjectionFromNode=function(t){return Ee(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))},e}(Td);wd.prototype.namespace=Cd,wd.prototype.FLAT_LINEAR_RINGS_PARSERS=
{"http://www.opengis.net/gml":{}},wd.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},wd.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},wd.prototype.MULTIPOINT_PARSERS_={"http://www.opengis.net/gml":{pointMember:ou(wd.prototype.pointMemberParser_),pointMembers:ou(wd.prototype.pointMemberParser_)}},wd.prototype.MULTILINESTRING_PARSERS_={"http://www.opengis.net/gml":{lineStringMember:ou(wd.prototype.lineStringMemberParser_),lineStringMembers:ou(wd.prototype.lineStringMemberParser_)}},
wd.prototype.MULTIPOLYGON_PARSERS_={"http://www.opengis.net/gml":{polygonMember:ou(wd.prototype.polygonMemberParser_),polygonMembers:ou(wd.prototype.polygonMemberParser_)}},wd.prototype.POINTMEMBER_PARSERS_={"http://www.opengis.net/gml":{Point:ou(wd.prototype.readFlatCoordinatesFromNode_)}},wd.prototype.LINESTRINGMEMBER_PARSERS_={"http://www.opengis.net/gml":{LineString:ou(wd.prototype.readLineString)}},wd.prototype.POLYGONMEMBER_PARSERS_={"http://www.opengis.net/gml":{Polygon:ou(wd.prototype.readPolygon)}},
wd.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:su(wd.prototype.readFlatLinearRing_)}};var Id=wd;function Ld(t){return Od(eu(t,!1))}function Od(t){var e=/^\s*(true|1)|(false|0)\s*$/.exec(t);return e?void 0!==e[1]||!1:void 0}function Pd(t){var e=eu(t,!1),i=Date.parse(e);return isNaN(i)?void 0:i/1E3}function bd(t){return Md(eu(t,!1))}function Md(t){var e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);return e?parseFloat(e[1]):void 0}function Fd(t){return Ad(eu(t,!1))}function Ad(t){var e=
/^\s*(\d+)\s*$/.exec(t);return e?parseInt(e[1],10):void 0}function Nd(t){return eu(t,!1).trim()}function Gd(t,e){jd(t,e?"1":"0")}function Dd(t,e){var i=e.toPrecision();t.appendChild(Ql.createTextNode(i))}function kd(t,e){var i=e.toString();t.appendChild(Ql.createTextNode(i))}function jd(t,e){t.appendChild(Ql.createTextNode(e))}var Ud=Cd+" http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",Yd={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",
MultiSurface:"surfaceMember"},Bd=function(t){function e(e){var i=e||{};t.call(this,i),this.surface_=void 0!==i.surface&&i.surface,this.curve_=void 0!==i.curve&&i.curve,this.multiCurve_=void 0===i.multiCurve||i.multiCurve,this.multiSurface_=void 0===i.multiSurface||i.multiSurface,this.schemaLocation=i.schemaLocation?i.schemaLocation:Ud,this.hasZ=void 0!==i.hasZ&&i.hasZ}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readMultiCurve_=function(t,
e){var i=gu([],this.MULTICURVE_PARSERS_,t,e,this);return i?new Pc(i):void 0},e.prototype.readMultiSurface_=function(t,e){var i=gu([],this.MULTISURFACE_PARSERS_,t,e,this);if(i)return new Fc(i)},e.prototype.curveMemberParser_=function(t,e){_u(this.CURVEMEMBER_PARSERS_,t,e,this)},e.prototype.surfaceMemberParser_=function(t,e){_u(this.SURFACEMEMBER_PARSERS_,t,e,this)},e.prototype.readPatch_=function(t,e){return gu([null],this.PATCHES_PARSERS_,t,e,this)},e.prototype.readSegment_=function(t,e){return gu([null],
this.SEGMENTS_PARSERS_,t,e,this)},e.prototype.readPolygonPatch_=function(t,e){return gu([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)},e.prototype.readLineStringSegment_=function(t,e){return gu([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.interiorParser_=function(t,e){var i=gu(void 0,this.RING_PARSERS,t,e,this);i&&e[e.length-1].push(i)},e.prototype.exteriorParser_=function(t,e){var i=gu(void 0,this.RING_PARSERS,t,e,this);i&&(e[e.length-1][0]=i)},e.prototype.readSurface_=
function(t,e){var i=gu([null],this.SURFACE_PARSERS_,t,e,this);if(i&&i[0]){var r,n,o=i[0],s=[o.length];for(r=1,n=i.length;r<n;++r)K(o,i[r]),s.push(o.length);return new Ii(o,At.XYZ,s)}},e.prototype.readCurve_=function(t,e){var i=gu([null],this.CURVE_PARSERS_,t,e,this);return i?new hr(i,At.XYZ):void 0},e.prototype.readEnvelope_=function(t,e){var i=gu([null],this.ENVELOPE_PARSERS_,t,e,this);return lt(i[1][0],i[1][1],i[2][0],i[2][1])},e.prototype.readFlatPos_=function(t,e){for(var i,r=eu(t,!1),n=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,
o=[];i=n.exec(r);)o.push(parseFloat(i[1])),r=r.substr(i[0].length);if(""===r){var s,a,h=e[0].srsName,l="enu";if(h)l=Ee(h).getAxisOrientation();if("neu"===l)for(s=0,a=o.length;s<a;s+=3){var u=o[s],p=o[s+1];o[s]=p,o[s+1]=u}var c=o.length;if(2==c&&o.push(0),0!==c)return o}},e.prototype.readFlatPosList_=function(t,e){var i=eu(t,!1).replace(/^\s*|\s*$/g,""),r=e[0],n=r.srsName,o=r.srsDimension,s="enu";n&&(s=Ee(n).getAxisOrientation());var a,h,l,u=i.split(/\s+/),p=2;t.getAttribute("srsDimension")?p=Ad(t.getAttribute("srsDimension")):
t.getAttribute("dimension")?p=Ad(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?p=Ad(t.parentNode.getAttribute("srsDimension")):o&&(p=Ad(o));for(var c=[],d=0,f=u.length;d<f;d+=p)a=parseFloat(u[d]),h=parseFloat(u[d+1]),l=3===p?parseFloat(u[d+2]):0,"en"===s.substr(0,2)?c.push(a,h,l):c.push(h,a,l);return c},e.prototype.writePos_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=n?"3":"2";t.setAttribute("srsDimension",o);var s=r.srsName,a="enu";s&&(a=Ee(s).getAxisOrientation());var h,
l=e.getCoordinates();(h="en"===a.substr(0,2)?l[0]+" "+l[1]:l[1]+" "+l[0],n)&&(h+=" "+(l[2]||0));jd(t,h)},e.prototype.getCoords_=function(t,e,i){var r="enu";e&&(r=Ee(e).getAxisOrientation());var n="en"===r.substr(0,2)?t[0]+" "+t[1]:t[1]+" "+t[0];i&&(n+=" "+(t[2]||0));return n},e.prototype.writePosList_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=n?"3":"2";t.setAttribute("srsDimension",o);for(var s,a=r.srsName,h=e.getCoordinates(),l=h.length,u=new Array(l),p=0;p<l;++p)s=h[p],u[p]=this.getCoords_(s,
a,n);jd(t,u.join(" "))},e.prototype.writePoint_=function(t,e,i){var r=i[i.length-1].srsName;r&&t.setAttribute("srsName",r);var n=tu(t.namespaceURI,"pos");t.appendChild(n),this.writePos_(n,e,i)},e.prototype.writeEnvelope=function(t,e,i){var r=i[i.length-1].srsName;r&&t.setAttribute("srsName",r);var n=[e[0]+" "+e[1],e[2]+" "+e[3]];vu({node:t},this.ENVELOPE_SERIALIZERS_,cu,n,i,["lowerCorner","upperCorner"],this)},e.prototype.writeLinearRing_=function(t,e,i){var r=i[i.length-1].srsName;r&&t.setAttribute("srsName",
r);var n=tu(t.namespaceURI,"posList");t.appendChild(n),this.writePosList_(n,e,i)},e.prototype.RING_NODE_FACTORY_=function(t,e,i){var r=e[e.length-1],n=r.node,o=r.exteriorWritten;return void 0===o&&(r.exteriorWritten=!0),tu(n.namespaceURI,void 0!==o?"interior":"exterior")},e.prototype.writeSurfaceOrPolygon_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();
vu({node:t,hasZ:n,srsName:o},this.RING_SERIALIZERS_,this.RING_NODE_FACTORY_,s,i,void 0,this)}else if("Surface"===t.nodeName){var a=tu(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,i)}},e.prototype.writeCurveOrLineString_=function(t,e,i){var r=i[i.length-1].srsName;if("LineStringSegment"!==t.nodeName&&r&&t.setAttribute("srsName",r),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var n=tu(t.namespaceURI,"posList");t.appendChild(n),this.writePosList_(n,e,i)}else if("Curve"===
t.nodeName){var o=tu(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,i)}},e.prototype.writeMultiSurfaceOrPolygon_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName,s=r.surface;o&&t.setAttribute("srsName",o);var a=e.getPolygons();vu({node:t,hasZ:n,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)},e.prototype.writeMultiPoint_=function(t,e,i){var r=i[i.length-1],n=r.srsName,o=r.hasZ;n&&t.setAttribute("srsName",
n);var s=e.getPoints();vu({node:t,hasZ:o,srsName:n},this.POINTMEMBER_SERIALIZERS_,pu("pointMember"),s,i,void 0,this)},e.prototype.writeMultiCurveOrLineString_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName,s=r.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();vu({node:t,hasZ:n,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)},e.prototype.writeRing_=function(t,e,i){var r=tu(t.namespaceURI,"LinearRing");t.appendChild(r),
this.writeLinearRing_(r,e,i)},e.prototype.writeSurfaceOrPolygonMember_=function(t,e,i){var r=this.GEOMETRY_NODE_FACTORY_(e,i);r&&(t.appendChild(r),this.writeSurfaceOrPolygon_(r,e,i))},e.prototype.writePointMember_=function(t,e,i){var r=tu(t.namespaceURI,"Point");t.appendChild(r),this.writePoint_(r,e,i)},e.prototype.writeLineStringOrCurveMember_=function(t,e,i){var r=this.GEOMETRY_NODE_FACTORY_(e,i);r&&(t.appendChild(r),this.writeCurveOrLineString_(r,e,i))},e.prototype.writeSurfacePatches_=function(t,
e,i){var r=tu(t.namespaceURI,"PolygonPatch");t.appendChild(r),this.writeSurfaceOrPolygon_(r,e,i)},e.prototype.writeCurveSegments_=function(t,e,i){var r=tu(t.namespaceURI,"LineStringSegment");t.appendChild(r),this.writeCurveOrLineString_(r,e,i)},e.prototype.writeGeometryElement=function(t,e,i){var r,n=i[i.length-1],o=u({},n);o.node=t,r=Array.isArray(e)?n.dataProjection?be(e,n.featureProjection,n.dataProjection):e:dd(e,!0,n),vu(o,this.GEOMETRY_SERIALIZERS_,this.GEOMETRY_NODE_FACTORY_,[r],i,void 0,this)},
e.prototype.writeFeatureElement=function(t,e,i){var r=e.getId();r&&t.setAttribute("fid",r);var n=i[i.length-1],o=n.featureNS,s=e.getGeometryName();n.serializers||(n.serializers={},n.serializers[o]={});var a=e.getProperties(),h=[],l=[];for(var p in a){var c=a[p];null!==c&&(h.push(p),l.push(c),p==s||"function"==typeof c.getSimplifiedGeometry?p in n.serializers[o]||(n.serializers[o][p]=lu(this.writeGeometryElement,this)):p in n.serializers[o]||(n.serializers[o][p]=lu(jd)))}var d=u({},n);d.node=t,vu(d,
n.serializers,pu(void 0,o),l,i,h)},e.prototype.writeFeatureMembers_=function(t,e,i){var r=i[i.length-1],n=r.featureType,o=r.featureNS,s={};s[o]={},s[o][n]=lu(this.writeFeatureElement,this);var a=u({},r);a.node=t,vu(a,s,pu(n,o),e,i)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,i){var r=e[e.length-1].node;return tu(this.namespace,Yd[r.nodeName])},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,i){var r,n=e[e.length-1],o=n.multiSurface,s=n.surface,a=n.curve,h=n.multiCurve;return Array.isArray(t)?
r="Envelope":"MultiPolygon"===(r=t.getType())&&!0===o?r="MultiSurface":"Polygon"===r&&!0===s?r="Surface":"LineString"===r&&!0===a?r="Curve":"MultiLineString"===r&&!0===h&&(r="MultiCurve"),tu(this.namespace,r)},e.prototype.writeGeometryNode=function(t,e){e=this.adaptOptions(e);var i=tu(this.namespace,"geom"),r={node:i,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return e&&u(r,e),this.writeGeometryElement(i,
t,[r]),i},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var i=tu(this.namespace,"featureMembers");i.setAttributeNS($l,"xsi:schemaLocation",this.schemaLocation);var r={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return e&&u(r,e),this.writeFeatureMembers_(i,t,[r]),i},e}(Id);Bd.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:su(Bd.prototype.readFlatPos_),
posList:su(Bd.prototype.readFlatPosList_)}},Bd.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:Bd.prototype.interiorParser_,exterior:Bd.prototype.exteriorParser_}},Bd.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:su(Id.prototype.readPoint),MultiPoint:su(Id.prototype.readMultiPoint),LineString:su(Id.prototype.readLineString),MultiLineString:su(Id.prototype.readMultiLineString),LinearRing:su(Id.prototype.readLinearRing),Polygon:su(Id.prototype.readPolygon),
MultiPolygon:su(Id.prototype.readMultiPolygon),Surface:su(Bd.prototype.readSurface_),MultiSurface:su(Bd.prototype.readMultiSurface_),Curve:su(Bd.prototype.readCurve_),MultiCurve:su(Bd.prototype.readMultiCurve_),Envelope:su(Bd.prototype.readEnvelope_)}},Bd.prototype.MULTICURVE_PARSERS_={"http://www.opengis.net/gml":{curveMember:ou(Bd.prototype.curveMemberParser_),curveMembers:ou(Bd.prototype.curveMemberParser_)}},Bd.prototype.MULTISURFACE_PARSERS_={"http://www.opengis.net/gml":{surfaceMember:ou(Bd.prototype.surfaceMemberParser_),
surfaceMembers:ou(Bd.prototype.surfaceMemberParser_)}},Bd.prototype.CURVEMEMBER_PARSERS_={"http://www.opengis.net/gml":{LineString:ou(Id.prototype.readLineString),Curve:ou(Bd.prototype.readCurve_)}},Bd.prototype.SURFACEMEMBER_PARSERS_={"http://www.opengis.net/gml":{Polygon:ou(Id.prototype.readPolygon),Surface:ou(Bd.prototype.readSurface_)}},Bd.prototype.SURFACE_PARSERS_={"http://www.opengis.net/gml":{patches:su(Bd.prototype.readPatch_)}},Bd.prototype.CURVE_PARSERS_={"http://www.opengis.net/gml":{segments:su(Bd.prototype.readSegment_)}},
Bd.prototype.ENVELOPE_PARSERS_={"http://www.opengis.net/gml":{lowerCorner:ou(Bd.prototype.readFlatPosList_),upperCorner:ou(Bd.prototype.readFlatPosList_)}},Bd.prototype.PATCHES_PARSERS_={"http://www.opengis.net/gml":{PolygonPatch:su(Bd.prototype.readPolygonPatch_)}},Bd.prototype.SEGMENTS_PARSERS_={"http://www.opengis.net/gml":{LineStringSegment:su(Bd.prototype.readLineStringSegment_)}},Bd.prototype.writeFeatures,Bd.prototype.RING_SERIALIZERS_={"http://www.opengis.net/gml":{exterior:lu(Bd.prototype.writeRing_),
interior:lu(Bd.prototype.writeRing_)}},Bd.prototype.ENVELOPE_SERIALIZERS_={"http://www.opengis.net/gml":{lowerCorner:lu(jd),upperCorner:lu(jd)}},Bd.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{surfaceMember:lu(Bd.prototype.writeSurfaceOrPolygonMember_),polygonMember:lu(Bd.prototype.writeSurfaceOrPolygonMember_)}},Bd.prototype.POINTMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{pointMember:lu(Bd.prototype.writePointMember_)}},Bd.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_=
{"http://www.opengis.net/gml":{lineStringMember:lu(Bd.prototype.writeLineStringOrCurveMember_),curveMember:lu(Bd.prototype.writeLineStringOrCurveMember_)}},Bd.prototype.GEOMETRY_SERIALIZERS_={"http://www.opengis.net/gml":{Curve:lu(Bd.prototype.writeCurveOrLineString_),MultiCurve:lu(Bd.prototype.writeMultiCurveOrLineString_),Point:lu(Bd.prototype.writePoint_),MultiPoint:lu(Bd.prototype.writeMultiPoint_),LineString:lu(Bd.prototype.writeCurveOrLineString_),MultiLineString:lu(Bd.prototype.writeMultiCurveOrLineString_),
LinearRing:lu(Bd.prototype.writeLinearRing_),Polygon:lu(Bd.prototype.writeSurfaceOrPolygon_),MultiPolygon:lu(Bd.prototype.writeMultiSurfaceOrPolygon_),Surface:lu(Bd.prototype.writeSurfaceOrPolygon_),MultiSurface:lu(Bd.prototype.writeMultiSurfaceOrPolygon_),Envelope:lu(Bd.prototype.writeEnvelope)}};var Vd=Bd,Xd=Vd;Xd.prototype.writeFeatures,Xd.prototype.writeFeaturesNode;var zd=Xd,Wd=Cd+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",Kd={MultiLineString:"lineStringMember",MultiCurve:"curveMember",
MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},Hd=function(t){function e(e){var i=e||{};t.call(this,i),this.FEATURE_COLLECTION_PARSERS[Cd].featureMember=ou(this.readFeaturesInternal),this.schemaLocation=i.schemaLocation?i.schemaLocation:Wd}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFlatCoordinates_=function(t,e){var i=eu(t,!1).replace(/^\s*|\s*$/g,""),r=e[0].srsName,n="enu";if(r){var o=Ee(r);o&&(n=o.getAxisOrientation())}for(var s=
i.trim().split(/\s+/),a=[],h=0,l=s.length;h<l;h++){var u=s[h].split(/,+/),p=parseFloat(u[0]),c=parseFloat(u[1]),d=3===u.length?parseFloat(u[2]):0;"en"===n.substr(0,2)?a.push(p,c,d):a.push(c,p,d)}return a},e.prototype.readBox_=function(t,e){var i=gu([null],this.BOX_PARSERS_,t,e,this);return lt(i[1][0],i[1][1],i[1][3],i[1][4])},e.prototype.innerBoundaryIsParser_=function(t,e){var i=gu(void 0,this.RING_PARSERS,t,e,this);i&&e[e.length-1].push(i)},e.prototype.outerBoundaryIsParser_=function(t,e){var i=
gu(void 0,this.RING_PARSERS,t,e,this);i&&(e[e.length-1][0]=i)},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,i){var r,n=e[e.length-1],o=n.multiSurface,s=n.surface,a=n.multiCurve;return Array.isArray(t)?r="Envelope":"MultiPolygon"===(r=t.getType())&&!0===o?r="MultiSurface":"Polygon"===r&&!0===s?r="Surface":"MultiLineString"===r&&!0===a&&(r="MultiCurve"),tu("http://www.opengis.net/gml",r)},e.prototype.writeFeatureElement=function(t,e,i){var r=e.getId();r&&t.setAttribute("fid",r);var n=i[i.length-
1],o=n.featureNS,s=e.getGeometryName();n.serializers||(n.serializers={},n.serializers[o]={});var a=e.getProperties(),h=[],l=[];for(var p in a){var c=a[p];null!==c&&(h.push(p),l.push(c),p==s||"function"==typeof c.getSimplifiedGeometry?p in n.serializers[o]||(n.serializers[o][p]=lu(this.writeGeometryElement,this)):p in n.serializers[o]||(n.serializers[o][p]=lu(jd)))}var d=u({},n);d.node=t,vu(d,n.serializers,pu(void 0,o),l,i,h)},e.prototype.writeCurveOrLineString_=function(t,e,i){var r=i[i.length-1].srsName;
if("LineStringSegment"!==t.nodeName&&r&&t.setAttribute("srsName",r),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var n=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(n),this.writeCoordinates_(n,e,i)}else if("Curve"===t.nodeName){var o=tu(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,i)}},e.prototype.writeLineStringOrCurveMember_=function(t,e,i){var r=this.GEOMETRY_NODE_FACTORY_(e,i);r&&(t.appendChild(r),this.writeCurveOrLineString_(r,e,i))},e.prototype.writeMultiCurveOrLineString_=
function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName,s=r.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();vu({node:t,hasZ:n,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)},e.prototype.writeGeometryElement=function(t,e,i){var r,n=i[i.length-1],o=u({},n);o.node=t,r=Array.isArray(e)?n.dataProjection?be(e,n.featureProjection,n.dataProjection):e:dd(e,!0,n),vu(o,this.GEOMETRY_SERIALIZERS_,this.GEOMETRY_NODE_FACTORY_,
[r],i,void 0,this)},e.prototype.createCoordinatesNode_=function(t){var e=tu(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e},e.prototype.writeCoordinates_=function(t,e,i){for(var r=i[i.length-1],n=r.hasZ,o=r.srsName,s=e.getCoordinates(),a=s.length,h=new Array(a),l=0;l<a;++l){var u=s[l];h[l]=this.getCoords_(u,o,n)}jd(t,h.join(" "))},e.prototype.writeCurveSegments_=function(t,e,i){var r=tu(t.namespaceURI,"LineStringSegment");t.appendChild(r),
this.writeCurveOrLineString_(r,e,i)},e.prototype.writeSurfaceOrPolygon_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();vu({node:t,hasZ:n,srsName:o},this.RING_SERIALIZERS_,this.RING_NODE_FACTORY_,s,i,void 0,this)}else if("Surface"===t.nodeName){var a=tu(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,i)}},e.prototype.RING_NODE_FACTORY_=
function(t,e,i){var r=e[e.length-1],n=r.node,o=r.exteriorWritten;return void 0===o&&(r.exteriorWritten=!0),tu(n.namespaceURI,void 0!==o?"innerBoundaryIs":"outerBoundaryIs")},e.prototype.writeSurfacePatches_=function(t,e,i){var r=tu(t.namespaceURI,"PolygonPatch");t.appendChild(r),this.writeSurfaceOrPolygon_(r,e,i)},e.prototype.writeRing_=function(t,e,i){var r=tu(t.namespaceURI,"LinearRing");t.appendChild(r),this.writeLinearRing_(r,e,i)},e.prototype.getCoords_=function(t,e,i){var r="enu";e&&(r=Ee(e).getAxisOrientation());
var n="en"===r.substr(0,2)?t[0]+","+t[1]:t[1]+","+t[0];i&&(n+=","+(t[2]||0));return n},e.prototype.writePoint_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName;o&&t.setAttribute("srsName",o);var s=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(s);var a=e.getCoordinates();jd(s,this.getCoords_(a,o,n))},e.prototype.writeMultiPoint_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName;o&&t.setAttribute("srsName",o);var s=e.getPoints();vu({node:t,hasZ:n,srsName:o},this.POINTMEMBER_SERIALIZERS_,
pu("pointMember"),s,i,void 0,this)},e.prototype.writePointMember_=function(t,e,i){var r=tu(t.namespaceURI,"Point");t.appendChild(r),this.writePoint_(r,e,i)},e.prototype.writeLinearRing_=function(t,e,i){var r=i[i.length-1].srsName;r&&t.setAttribute("srsName",r);var n=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(n),this.writeCoordinates_(n,e,i)},e.prototype.writeMultiSurfaceOrPolygon_=function(t,e,i){var r=i[i.length-1],n=r.hasZ,o=r.srsName,s=r.surface;o&&t.setAttribute("srsName",o);var a=
e.getPolygons();vu({node:t,hasZ:n,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,i,void 0,this)},e.prototype.writeSurfaceOrPolygonMember_=function(t,e,i){var r=this.GEOMETRY_NODE_FACTORY_(e,i);r&&(t.appendChild(r),this.writeSurfaceOrPolygon_(r,e,i))},e.prototype.writeEnvelope=function(t,e,i){var r=i[i.length-1].srsName;r&&t.setAttribute("srsName",r);var n=[e[0]+" "+e[1],e[2]+" "+e[3]];vu({node:t},this.ENVELOPE_SERIALIZERS_,cu,n,i,["lowerCorner",
"upperCorner"],this)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,i){var r=e[e.length-1].node;return tu("http://www.opengis.net/gml",Kd[r.nodeName])},e}(Id);Hd.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:su(Hd.prototype.readFlatCoordinates_)}},Hd.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:Hd.prototype.innerBoundaryIsParser_,outerBoundaryIs:Hd.prototype.outerBoundaryIsParser_}},Hd.prototype.BOX_PARSERS_=
{"http://www.opengis.net/gml":{coordinates:ou(Hd.prototype.readFlatCoordinates_)}},Hd.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:su(Id.prototype.readPoint),MultiPoint:su(Id.prototype.readMultiPoint),LineString:su(Id.prototype.readLineString),MultiLineString:su(Id.prototype.readMultiLineString),LinearRing:su(Id.prototype.readLinearRing),Polygon:su(Id.prototype.readPolygon),MultiPolygon:su(Id.prototype.readMultiPolygon),Box:su(Hd.prototype.readBox_)}},Hd.prototype.GEOMETRY_SERIALIZERS_=
{"http://www.opengis.net/gml":{Curve:lu(Hd.prototype.writeCurveOrLineString_),MultiCurve:lu(Hd.prototype.writeMultiCurveOrLineString_),Point:lu(Hd.prototype.writePoint_),MultiPoint:lu(Hd.prototype.writeMultiPoint_),LineString:lu(Hd.prototype.writeCurveOrLineString_),MultiLineString:lu(Hd.prototype.writeMultiCurveOrLineString_),LinearRing:lu(Hd.prototype.writeLinearRing_),Polygon:lu(Hd.prototype.writeSurfaceOrPolygon_),MultiPolygon:lu(Hd.prototype.writeMultiSurfaceOrPolygon_),Surface:lu(Hd.prototype.writeSurfaceOrPolygon_),
MultiSurface:lu(Hd.prototype.writeMultiSurfaceOrPolygon_),Envelope:lu(Hd.prototype.writeEnvelope)}},Hd.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{lineStringMember:lu(Hd.prototype.writeLineStringOrCurveMember_),curveMember:lu(Hd.prototype.writeLineStringOrCurveMember_)}},Hd.prototype.RING_SERIALIZERS_={"http://www.opengis.net/gml":{outerBoundaryIs:lu(Hd.prototype.writeRing_),innerBoundaryIs:lu(Hd.prototype.writeRing_)}},Hd.prototype.POINTMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{pointMember:lu(Hd.prototype.writePointMember_)}},
Hd.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{surfaceMember:lu(Hd.prototype.writeSurfaceOrPolygonMember_),polygonMember:lu(Hd.prototype.writeSurfaceOrPolygonMember_)}},Hd.prototype.ENVELOPE_SERIALIZERS_={"http://www.opengis.net/gml":{lowerCorner:lu(jd),upperCorner:lu(jd)}};var Zd=Hd,qd=function(t){function e(e){var i=e||{};t.call(this,i),this.schemaLocation=i.schemaLocation?i.schemaLocation:this.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd"}return t&&
(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Vd);qd.prototype.namespace="http://www.opengis.net/gml/3.2",qd.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:su(Vd.prototype.readFlatPos_),posList:su(Vd.prototype.readFlatPosList_)}},qd.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:Vd.prototype.interiorParser_,exterior:Vd.prototype.exteriorParser_}},qd.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:su(Id.prototype.readPoint),
MultiPoint:su(Id.prototype.readMultiPoint),LineString:su(Id.prototype.readLineString),MultiLineString:su(Id.prototype.readMultiLineString),LinearRing:su(Id.prototype.readLinearRing),Polygon:su(Id.prototype.readPolygon),MultiPolygon:su(Id.prototype.readMultiPolygon),Surface:su(qd.prototype.readSurface_),MultiSurface:su(Vd.prototype.readMultiSurface_),Curve:su(qd.prototype.readCurve_),MultiCurve:su(Vd.prototype.readMultiCurve_),Envelope:su(qd.prototype.readEnvelope_)}},qd.prototype.MULTICURVE_PARSERS_=
{"http://www.opengis.net/gml/3.2":{curveMember:ou(Vd.prototype.curveMemberParser_),curveMembers:ou(Vd.prototype.curveMemberParser_)}},qd.prototype.MULTISURFACE_PARSERS_={"http://www.opengis.net/gml/3.2":{surfaceMember:ou(Vd.prototype.surfaceMemberParser_),surfaceMembers:ou(Vd.prototype.surfaceMemberParser_)}},qd.prototype.CURVEMEMBER_PARSERS_={"http://www.opengis.net/gml/3.2":{LineString:ou(Id.prototype.readLineString),Curve:ou(Vd.prototype.readCurve_)}},qd.prototype.SURFACEMEMBER_PARSERS_={"http://www.opengis.net/gml/3.2":{Polygon:ou(Id.prototype.readPolygon),
Surface:ou(Vd.prototype.readSurface_)}},qd.prototype.SURFACE_PARSERS_={"http://www.opengis.net/gml/3.2":{patches:su(Vd.prototype.readPatch_)}},qd.prototype.CURVE_PARSERS_={"http://www.opengis.net/gml/3.2":{segments:su(Vd.prototype.readSegment_)}},qd.prototype.ENVELOPE_PARSERS_={"http://www.opengis.net/gml/3.2":{lowerCorner:ou(Vd.prototype.readFlatPosList_),upperCorner:ou(Vd.prototype.readFlatPosList_)}},qd.prototype.PATCHES_PARSERS_={"http://www.opengis.net/gml/3.2":{PolygonPatch:su(Vd.prototype.readPolygonPatch_)}},
qd.prototype.SEGMENTS_PARSERS_={"http://www.opengis.net/gml/3.2":{LineStringSegment:su(Vd.prototype.readLineStringSegment_)}},qd.prototype.MULTIPOINT_PARSERS_={"http://www.opengis.net/gml/3.2":{pointMember:ou(Id.prototype.pointMemberParser_),pointMembers:ou(Id.prototype.pointMemberParser_)}},qd.prototype.MULTILINESTRING_PARSERS_={"http://www.opengis.net/gml/3.2":{lineStringMember:ou(Id.prototype.lineStringMemberParser_),lineStringMembers:ou(Id.prototype.lineStringMemberParser_)}},qd.prototype.MULTIPOLYGON_PARSERS_=
{"http://www.opengis.net/gml/3.2":{polygonMember:ou(Id.prototype.polygonMemberParser_),polygonMembers:ou(Id.prototype.polygonMemberParser_)}},qd.prototype.POINTMEMBER_PARSERS_={"http://www.opengis.net/gml/3.2":{Point:ou(Id.prototype.readFlatCoordinatesFromNode_)}},qd.prototype.LINESTRINGMEMBER_PARSERS_={"http://www.opengis.net/gml/3.2":{LineString:ou(Id.prototype.readLineString)}},qd.prototype.POLYGONMEMBER_PARSERS_={"http://www.opengis.net/gml/3.2":{Polygon:ou(Id.prototype.readPolygon)}},qd.prototype.RING_PARSERS=
{"http://www.opengis.net/gml/3.2":{LinearRing:su(Id.prototype.readFlatLinearRing_)}},qd.prototype.RING_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{exterior:lu(Vd.prototype.writeRing_),interior:lu(Vd.prototype.writeRing_)}},qd.prototype.ENVELOPE_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{lowerCorner:lu(jd),upperCorner:lu(jd)}},qd.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{surfaceMember:lu(Vd.prototype.writeSurfaceOrPolygonMember_),polygonMember:lu(Vd.prototype.writeSurfaceOrPolygonMember_)}},
qd.prototype.POINTMEMBER_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{pointMember:lu(Vd.prototype.writePointMember_)}},qd.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{lineStringMember:lu(Vd.prototype.writeLineStringOrCurveMember_),curveMember:lu(Vd.prototype.writeLineStringOrCurveMember_)}},qd.prototype.GEOMETRY_SERIALIZERS_={"http://www.opengis.net/gml/3.2":{Curve:lu(Vd.prototype.writeCurveOrLineString_),MultiCurve:lu(Vd.prototype.writeMultiCurveOrLineString_),
Point:lu(qd.prototype.writePoint_),MultiPoint:lu(Vd.prototype.writeMultiPoint_),LineString:lu(Vd.prototype.writeCurveOrLineString_),MultiLineString:lu(Vd.prototype.writeMultiCurveOrLineString_),LinearRing:lu(Vd.prototype.writeLinearRing_),Polygon:lu(Vd.prototype.writeSurfaceOrPolygon_),MultiPolygon:lu(Vd.prototype.writeMultiSurfaceOrPolygon_),Surface:lu(Vd.prototype.writeSurfaceOrPolygon_),MultiSurface:lu(Vd.prototype.writeMultiSurfaceOrPolygon_),Envelope:lu(Vd.prototype.writeEnvelope)}};var Jd=qd,
Qd=[null,"http://www.topografix.com/GPX/1/0","http://www.topografix.com/GPX/1/1"],$d={rte:Lf,trk:Of,wpt:Pf},tf=fu(Qd,{rte:ou(Lf),trk:ou(Of),wpt:ou(Pf)}),ef=fu(Qd,{text:hu(Nd,"linkText"),type:hu(Nd,"linkType")}),rf=fu(Qd,{rte:lu(function(t,e,i){var r=i[0],n=e.getProperties(),o={node:t};o.properties=n;var s=e.getGeometry();if(s.getType()==Nt.LINE_STRING){var a=dd(s,!0,r);o.geometryLayout=a.getLayout(),n.rtept=a.getCoordinates()}var h=i[i.length-1].node,l=df[h.namespaceURI],u=du(n,l);vu(o,ff,cu,u,i,
l)}),trk:lu(function(t,e,i){var r=i[0],n=e.getProperties(),o={node:t};o.properties=n;var s=e.getGeometry();if(s.getType()==Nt.MULTI_LINE_STRING){var a=dd(s,!0,r);n.trkseg=a.getLineStrings()}var h=i[i.length-1].node,l=gf[h.namespaceURI],u=du(n,l);vu(o,yf,cu,u,i,l)}),wpt:lu(function(t,e,i){var r=i[0],n=i[i.length-1];n.properties=e.getProperties();var o=e.getGeometry();if(o.getType()==Nt.POINT){var s=dd(o,!0,r);n.geometryLayout=s.getLayout(),Mf(t,s.getCoordinates(),i)}})}),nf=function(t){function e(e){t.call(this);
var i=e||{};this.dataProjection=Ee("EPSG:4326"),this.readExtensions_=i.readExtensions}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleReadExtensions_=function(t){t||(t=[]);for(var e=0,i=t.length;e<i;++e){var r=t[e];if(this.readExtensions_){var n=r.get("extensionsNode_")||null;this.readExtensions_(r,n)}r.set("extensionsNode_",void 0)}},e.prototype.readFeatureFromNode=function(t,e){if(!X(Qd,t.namespaceURI))return null;var i=$d[t.localName];
if(!i)return null;var r=i(t,[this.getReadOptions(t,e)]);return r?(this.handleReadExtensions_([r]),r):null},e.prototype.readFeaturesFromNode=function(t,e){if(!X(Qd,t.namespaceURI))return[];if("gpx"==t.localName){var i=gu([],tf,t,[this.getReadOptions(t,e)]);return i?(this.handleReadExtensions_(i),i):[]}return[]},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var i=tu("http://www.topografix.com/GPX/1/1","gpx");return i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi",$l),
i.setAttributeNS($l,"xsi:schemaLocation","http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"),i.setAttribute("version","1.1"),i.setAttribute("creator","OpenLayers"),vu({node:i},rf,Tf,t,[e]),i},e}(Td),of=fu(Qd,{name:hu(Nd),cmt:hu(Nd),desc:hu(Nd),src:hu(Nd),link:wf,number:hu(Fd),extensions:If,type:hu(Nd),rtept:function(t,e){var i=gu({},sf,t,e);if(i){var r=e[e.length-1],n=r.flatCoordinates,o=r.layoutOptions;Cf(n,o,t,i)}}}),sf=fu(Qd,{ele:hu(bd),time:hu(Pd)}),af=fu(Qd,{name:hu(Nd),
cmt:hu(Nd),desc:hu(Nd),src:hu(Nd),link:wf,number:hu(Fd),type:hu(Nd),extensions:If,trkseg:function(t,e){var i=e[e.length-1];_u(hf,t,e);var r=i.flatCoordinates;i.ends.push(r.length)}}),hf=fu(Qd,{trkpt:function(t,e){var i=gu({},lf,t,e);if(i){var r=e[e.length-1],n=r.flatCoordinates,o=r.layoutOptions;Cf(n,o,t,i)}}}),lf=fu(Qd,{ele:hu(bd),time:hu(Pd)}),uf=fu(Qd,{ele:hu(bd),time:hu(Pd),magvar:hu(bd),geoidheight:hu(bd),name:hu(Nd),cmt:hu(Nd),desc:hu(Nd),src:hu(Nd),link:wf,sym:hu(Nd),type:hu(Nd),fix:hu(Nd),
sat:hu(Fd),hdop:hu(bd),vdop:hu(bd),pdop:hu(bd),ageofdgpsdata:hu(bd),dgpsid:hu(Fd),extensions:If}),pf=["text","type"],cf=fu(Qd,{text:lu(jd),type:lu(jd)}),df=fu(Qd,["name","cmt","desc","src","link","number","type","rtept"]),ff=fu(Qd,{name:lu(jd),cmt:lu(jd),desc:lu(jd),src:lu(jd),link:lu(bf),number:lu(kd),type:lu(jd),rtept:uu(lu(Mf))}),_f=fu(Qd,["ele","time"]),gf=fu(Qd,["name","cmt","desc","src","link","number","type","trkseg"]),yf=fu(Qd,{name:lu(jd),cmt:lu(jd),desc:lu(jd),src:lu(jd),link:lu(bf),number:lu(kd),
type:lu(jd),trkseg:uu(lu(function(t,e,i){var r={node:t};r.geometryLayout=e.getLayout(),r.properties={},vu(r,mf,vf,e.getCoordinates(),i)}))}),vf=pu("trkpt"),mf=fu(Qd,{trkpt:lu(Mf)}),xf=fu(Qd,["ele","time","magvar","geoidheight","name","cmt","desc","src","link","sym","type","fix","sat","hdop","vdop","pdop","ageofdgpsdata","dgpsid"]),Ef=fu(Qd,{ele:lu(Dd),time:lu(function(t,e){var i=new Date(1E3*e),r=i.getUTCFullYear()+"-"+Wi(i.getUTCMonth()+1,2)+"-"+Wi(i.getUTCDate(),2)+"T"+Wi(i.getUTCHours(),2)+":"+
Wi(i.getUTCMinutes(),2)+":"+Wi(i.getUTCSeconds(),2)+"Z";t.appendChild(Ql.createTextNode(r))}),magvar:lu(Dd),geoidheight:lu(Dd),name:lu(jd),cmt:lu(jd),desc:lu(jd),src:lu(jd),link:lu(bf),sym:lu(jd),type:lu(jd),fix:lu(jd),sat:lu(kd),hdop:lu(Dd),vdop:lu(Dd),pdop:lu(Dd),ageofdgpsdata:lu(Dd),dgpsid:lu(kd)}),Sf={Point:"wpt",LineString:"rte",MultiLineString:"trk"};function Tf(t,e,i){var r=t.getGeometry();if(r){var n=Sf[r.getType()];if(n)return tu(e[e.length-1].node.namespaceURI,n)}}function Cf(t,e,i,r){return t.push(parseFloat(i.getAttribute("lon")),
parseFloat(i.getAttribute("lat"))),"ele"in r?(t.push(r.ele),delete r.ele,e.hasZ=!0):t.push(0),"time"in r?(t.push(r.time),delete r.time,e.hasM=!0):t.push(0),t}function Rf(t,e,i){var r=At.XY,n=2;if(t.hasZ&&t.hasM?(r=At.XYZM,n=4):t.hasZ?(r=At.XYZ,n=3):t.hasM&&(r=At.XYM,n=3),4!==n){for(var o=0,s=e.length/4;o<s;o++)e[o*n]=e[4*o],e[o*n+1]=e[4*o+1],t.hasZ&&(e[o*n+2]=e[4*o+2]),t.hasM&&(e[o*n+2]=e[4*o+3]);if(e.length=e.length/4*n,i)for(var a=0,h=i.length;a<h;a++)i[a]=i[a]/4*n}return r}function wf(t,e){var i=
e[e.length-1],r=t.getAttribute("href");null!==r&&(i.link=r),_u(ef,t,e)}function If(t,e){e[e.length-1].extensionsNode_=t}function Lf(t,e){var i=e[0],r=gu({flatCoordinates:[],layoutOptions:{}},of,t,e);if(r){var n=r.flatCoordinates;delete r.flatCoordinates;var o=r.layoutOptions;delete r.layoutOptions;var s=Rf(o,n),a=new hr(n,s);dd(a,!1,i);var h=new B(a);return h.setProperties(r),h}}function Of(t,e){var i=e[0],r=gu({flatCoordinates:[],ends:[],layoutOptions:{}},af,t,e);if(r){var n=r.flatCoordinates;delete r.flatCoordinates;
var o=r.ends;delete r.ends;var s=r.layoutOptions;delete r.layoutOptions;var a=Rf(s,n,o),h=new Pc(n,a,o);dd(h,!1,i);var l=new B(h);return l.setProperties(r),l}}function Pf(t,e){var i=e[0],r=gu({},uf,t,e);if(r){var n={},o=Cf([],n,t,r),s=Rf(n,o),a=new ci(o,s);dd(a,!1,i);var h=new B(a);return h.setProperties(r),h}}function bf(t,e,i){t.setAttribute("href",e);var r=i[i.length-1].properties,n=[r.linkText,r.linkType];vu({node:t},cf,cu,n,i,pf)}function Mf(t,e,i){var r=i[i.length-1],n=r.node.namespaceURI,o=
r.properties;switch(t.setAttributeNS(null,"lat",String(e[1])),t.setAttributeNS(null,"lon",String(e[0])),r.geometryLayout){case At.XYZM:0!==e[3]&&(o.time=e[3]);case At.XYZ:0!==e[2]&&(o.ele=e[2]);break;case At.XYM:0!==e[2]&&(o.time=e[2])}var s="rtept"==t.nodeName?_f[n]:xf[n],a=du(o,s);vu({node:t,properties:o},Ef,cu,a,i,s)}var Ff=nf;function Af(t,e){if(!t)return null;var i;switch(t.type){case Nt.POINT:i=function(t){return new ci(t.coordinates)}(t);break;case Nt.LINE_STRING:i=function(t){return new hr(t.coordinates)}(t);
break;case Nt.POLYGON:i=function(t){return new Ii(t.coordinates)}(t);break;case Nt.MULTI_POINT:i=function(t){return new bc(t.coordinates)}(t);break;case Nt.MULTI_LINE_STRING:i=function(t){return new Pc(t.coordinates)}(t);break;case Nt.MULTI_POLYGON:i=function(t){return new Fc(t.coordinates)}(t);break;case Nt.GEOMETRY_COLLECTION:i=function(t,e){var i=t.geometries.map(function(t){return Af(t,e)});return new ud(i)}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type);}return dd(i,!1,
e)}function Nf(t,e){var i,r=(t=dd(t,!0,e)).getType();switch(r){case Nt.POINT:i=function(t,e){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case Nt.LINE_STRING:i=function(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case Nt.POLYGON:i=function(t,e){var i;e&&(i=e.rightHanded);return{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case Nt.MULTI_POINT:i=function(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case Nt.MULTI_LINE_STRING:i=
function(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case Nt.MULTI_POLYGON:i=function(t,e){var i;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case Nt.GEOMETRY_COLLECTION:i=function(t,e){return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){var i=u({},e);return delete i.featureProjection,Nf(t,i)})}}(t,e);break;case Nt.CIRCLE:i={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+
r);}return i}var Gf=function(t){function e(e){var i=e||{};t.call(this),this.dataProjection=Ee(i.dataProjection?i.dataProjection:"EPSG:4326"),i.featureProjection&&(this.defaultFeatureProjection=Ee(i.featureProjection)),this.geometryName_=i.geometryName,this.extractGeometryName_=i.extractGeometryName}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromObject=function(t,e){var i=null,r=Af((i="Feature"===t.type?t:{type:"Feature",geometry:t,
properties:null}).geometry,e),n=new B;return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&n.setGeometryName(i.geometry_name),n.setGeometry(r),"id"in i&&n.setId(i.id),i.properties&&n.setProperties(i.properties),n},e.prototype.readFeaturesFromObject=function(t,e){var i=null;if("FeatureCollection"===t.type){i=[];for(var r=t.features,n=0,o=r.length;n<o;++n)i.push(this.readFeatureFromObject(r[n],e))}else i=[this.readFeatureFromObject(t,
e)];return i},e.prototype.readGeometryFromObject=function(t,e){return Af(t,e)},e.prototype.readProjectionFromObject=function(t){var e,i=t.crs;return i?"name"==i.type?e=Ee(i.properties.name):Y(!1,36):e=this.dataProjection,e},e.prototype.writeFeatureObject=function(t,e){e=this.adaptOptions(e);var i={type:"Feature",geometry:null,properties:null},r=t.getId();void 0!==r&&(i.id=r);var n=t.getGeometry();n&&(i.geometry=Nf(n,e));var o=t.getProperties();return delete o[t.getGeometryName()],d(o)||(i.properties=
o),i},e.prototype.writeFeaturesObject=function(t,e){e=this.adaptOptions(e);for(var i=[],r=0,n=t.length;r<n;++r)i.push(this.writeFeatureObject(t[r],e));return{type:"FeatureCollection",features:i}},e.prototype.writeGeometryObject=function(t,e){return Nf(t,this.adaptOptions(e))},e}(_d);function Df(t){return"string"==typeof t?t:""}var kf,jf,Uf,Yf,Bf,Vf,Xf,zf=function(t){function e(){t.call(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getType=
function(){return Hl.TEXT},e.prototype.readFeature=function(t,e){return this.readFeatureFromText(Df(t),this.adaptOptions(e))},e.prototype.readFeatureFromText=function(t,e){return r()},e.prototype.readFeatures=function(t,e){return this.readFeaturesFromText(Df(t),this.adaptOptions(e))},e.prototype.readFeaturesFromText=function(t,e){return r()},e.prototype.readGeometry=function(t,e){return this.readGeometryFromText(Df(t),this.adaptOptions(e))},e.prototype.readGeometryFromText=function(t,e){return r()},
e.prototype.readProjection=function(t){return this.readProjectionFromText(Df(t))},e.prototype.readProjectionFromText=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){return this.writeFeatureText(t,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){return r()},e.prototype.writeFeatures=function(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))},e.prototype.writeFeaturesText=function(t,e){return r()},e.prototype.writeGeometry=function(t,e){return this.writeGeometryText(t,
this.adaptOptions(e))},e.prototype.writeGeometryText=function(t,e){return r()},e}(cd),Wf={BAROMETRIC:"barometric",GPS:"gps",NONE:"none"},Kf=/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,Hf=/^H.([A-Z]{3}).*?:(.*)/,Zf=/^HFDTE(\d{2})(\d{2})(\d{2})/,qf=/\r\n|\r|\n/,Jf=function(t){function e(e){t.call(this);var i=e||{};this.dataProjection=Ee("EPSG:4326"),this.altitudeMode_=i.altitudeMode?i.altitudeMode:Wf.NONE}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromText=function(t,e){var i,r,n=this.altitudeMode_,o=t.split(qf),s={},a=[],h=2E3,l=0,u=1,p=-1;for(i=0,r=o.length;i<r;++i){var c=o[i],d=void 0;if("B"==c.charAt(0)){if(d=Kf.exec(c)){var f=parseInt(d[1],10),_=parseInt(d[2],10),g=parseInt(d[3],10),y=parseInt(d[4],10)+parseInt(d[5],10)/6E4;"S"==d[6]&&(y=-y);var v=parseInt(d[7],10)+parseInt(d[8],10)/6E4;if("W"==d[9]&&(v=-v),a.push(v,y),n!=Wf.NONE){var m=void 0;m=n==Wf.GPS?parseInt(d[11],10):
n==Wf.BAROMETRIC?parseInt(d[12],10):0,a.push(m)}var x=Date.UTC(h,l,u,f,_,g);x<p&&(x=Date.UTC(h,l,u+1,f,_,g)),a.push(x/1E3),p=x}}else"H"==c.charAt(0)&&((d=Zf.exec(c))?(u=parseInt(d[1],10),l=parseInt(d[2],10)-1,h=2E3+parseInt(d[3],10)):(d=Hf.exec(c))&&(s[d[1]]=d[2].trim()))}if(0===a.length)return null;var E=n==Wf.NONE?At.XYM:At.XYZM,S=new hr(a,E),T=new B(dd(S,!1,e));return T.setProperties(s),T},e.prototype.readFeaturesFromText=function(t,e){var i=this.readFeatureFromText(t,e);return i?[i]:[]},e}(zf),
Qf=["http://www.google.com/kml/ext/2.2"],$f=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],t_={fraction:wu.FRACTION,pixels:wu.PIXELS,insetPixels:wu.PIXELS},e_=fu($f,{ExtendedData:H_,Region:Z_,MultiGeometry:hu(j_,"geometry"),LineString:hu(G_,"geometry"),LinearRing:hu(D_,"geometry"),Point:hu(U_,"geometry"),Polygon:hu(B_,"geometry"),Style:hu(X_),StyleMap:function(t,e){var i=S_(t,e);if(!i)return;var r=e[e.length-
1];Array.isArray(i)?r.Style=i:"string"==typeof i?r.styleUrl=i:Y(!1,38)},address:hu(Nd),description:hu(Nd),name:hu(Nd),open:hu(Ld),phoneNumber:hu(Nd),styleUrl:hu(m_),visibility:hu(Ld)},fu(Qf,{MultiTrack:hu(function(t,e){var i=gu([],O_,t,e);if(!i)return;return new Pc(i)},"geometry"),Track:hu(b_,"geometry")})),i_=fu($f,{ExtendedData:H_,Region:Z_,Link:function(t,e){_u(r_,t,e)},address:hu(Nd),description:hu(Nd),name:hu(Nd),open:hu(Ld),phoneNumber:hu(Nd),visibility:hu(Ld)}),r_=fu($f,{href:hu(m_)}),n_=fu($f,
{LatLonAltBox:function(t,e){var i=gu({},Q_,t,e);if(!i)return;var r=e[e.length-1],n=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];r.extent=n,r.altitudeMode=i.altitudeMode,r.minAltitude=parseFloat(i.minAltitude),r.maxAltitude=parseFloat(i.maxAltitude)},Lod:function(t,e){var i=gu({},$_,t,e);if(!i)return;var r=e[e.length-1];r.minLodPixels=parseFloat(i.minLodPixels),r.maxLodPixels=parseFloat(i.maxLodPixels),r.minFadeExtent=parseFloat(i.minFadeExtent),r.maxFadeExtent=parseFloat(i.maxFadeExtent)}}),
o_=fu($f,["Document","Placemark"]),s_=fu($f,{Document:lu(function(t,e,i){vu({node:t},ng,og,e,i,void 0,this)}),Placemark:lu(Og)}),a_=null;var h_,l_=null;var u_,p_=null;var c_=null;var d_=null;var f_=null;var __=function(t){function e(e){t.call(this);var i=e||{};f_||(a_=new mr({color:kf=[255,255,255,1]}),jf=[20,2],Uf=wu.PIXELS,Yf=wu.PIXELS,Bf=[64,64],Vf="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Xf=.5,l_=new Ou({anchor:jf,anchorOrigin:Lu.BOTTOM_LEFT,anchorXUnits:Uf,anchorYUnits:Yf,
crossOrigin:"anonymous",rotation:0,scale:Xf,size:Bf,src:Vf}),h_="NO_IMAGE",p_=new Er({color:kf,width:1}),u_=new Er({color:[51,51,51,1],width:2}),c_=new Rr({font:"bold 16px Helvetica",fill:a_,stroke:u_,scale:.8}),d_=new Nu({fill:a_,image:l_,text:c_,stroke:p_,zIndex:0}),f_=[d_]),this.dataProjection=Ee("EPSG:4326"),this.defaultStyle_=i.defaultStyle?i.defaultStyle:f_,this.extractStyles_=void 0===i.extractStyles||i.extractStyles,this.writeStyles_=void 0===i.writeStyles||i.writeStyles,this.sharedStyles_=
{},this.showPointNames_=void 0===i.showPointNames||i.showPointNames}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readDocumentOrFolder_=function(t,e){var i=gu([],fu($f,{Document:nu(this.readDocumentOrFolder_,this),Folder:nu(this.readDocumentOrFolder_,this),Placemark:ou(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);return i||void 0},e.prototype.readPlacemark_=function(t,
e){var i=gu({geometry:null},e_,t,e);if(i){var r=new B,n=t.getAttribute("id");null!==n&&r.setId(n);var o=e[0],s=i.geometry;if(s&&dd(s,!1,o),r.setGeometry(s),delete i.geometry,this.extractStyles_){var a=function(t,e,i,r,n){return function(o,s){var a,h=n,l="";if(h){var u=o.getGeometry();u&&(h=u.getType()===Nt.POINT)}if(h&&(l=o.get("name"),h=h&&!!l),t)return h?(a=g_(t[0],l),t.concat(a)):t;if(e){var p=function t(e,i,r){return Array.isArray(e)?e:"string"==typeof e?(!(e in r)&&"#"+e in r&&(e="#"+e),t(r[e],
i,r)):i}(e,i,r);return h?(a=g_(p[0],l),p.concat(a)):p}return h?(a=g_(i[0],l),i.concat(a)):i}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);r.setStyle(a)}return delete i.Style,r.setProperties(i),r}},e.prototype.readSharedStyle_=function(t,e){var i=t.getAttribute("id");if(null!==i){var r=X_(t,e);if(r){var n,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)n=(new URL("#"+i,o)).href;else n="#"+i;this.sharedStyles_[n]=r}}},e.prototype.readSharedStyleMap_=
function(t,e){var i=t.getAttribute("id");if(null!==i){var r=S_(t,e);if(r){var n,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)n=(new URL("#"+i,o)).href;else n="#"+i;this.sharedStyles_[n]=r}}},e.prototype.readFeatureFromNode=function(t,e){if(!X($f,t.namespaceURI))return null;var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null},e.prototype.readFeaturesFromNode=function(t,e){var i;if(!X($f,t.namespaceURI))return[];var r=t.localName;if("Document"==r||"Folder"==r)return(i=
this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==r){var n=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return n?[n]:[]}if("kml"==r){i=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var s=this.readFeaturesFromNode(o,e);s&&K(i,s)}return i}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=ru(t);return this.readNameFromDocument(e)}return iu(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=
function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var i=this.readNameFromNode(e);if(i)return i}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(X($f,e.namespaceURI)&&"name"==e.localName)return Nd(e);for(var i=t.firstElementChild;i;i=i.nextElementSibling){var r=i.localName;if(X($f,i.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(i);if(n)return n}}},e.prototype.readNetworkLinks=
function(t){var e=[];if("string"==typeof t){var i=ru(t);K(e,this.readNetworkLinksFromDocument(i))}else iu(t)?K(e,this.readNetworkLinksFromDocument(t)):K(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&K(e,this.readNetworkLinksFromNode(i));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],i=t.firstElementChild;i;i=i.nextElementSibling)if(X($f,i.namespaceURI)&&
"NetworkLink"==i.localName){var r=gu({},i_,i,[]);e.push(r)}for(var n=t.firstElementChild;n;n=n.nextElementSibling){var o=n.localName;!X($f,n.namespaceURI)||"Document"!=o&&"Folder"!=o&&"kml"!=o||K(e,this.readNetworkLinksFromNode(n))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var i=ru(t);K(e,this.readRegionFromDocument(i))}else iu(t)?K(e,this.readRegionFromDocument(t)):K(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=
[],i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&K(e,this.readRegionFromNode(i));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],i=t.firstElementChild;i;i=i.nextElementSibling)if(X($f,i.namespaceURI)&&"Region"==i.localName){var r=gu({},n_,i,[]);e.push(r)}for(var n=t.firstElementChild;n;n=n.nextElementSibling){var o=n.localName;!X($f,n.namespaceURI)||"Document"!=o&&"Folder"!=o&&"kml"!=o||K(e,this.readRegionFromNode(n))}return e},e.prototype.writeFeaturesNode=function(t,
e){e=this.adaptOptions(e);var i=tu($f[4],"kml"),r="http://www.w3.org/2000/xmlns/";i.setAttributeNS(r,"xmlns:gx",Qf[0]),i.setAttributeNS(r,"xmlns:xsi",$l),i.setAttributeNS($l,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var n={node:i},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var s=o_[i.namespaceURI],a=du(o,s);return vu(n,s_,cu,a,[e],s,this),i},e}(Td);function g_(t,e){var i=null,r=[0,0],n="start";if(t.getImage()){var o=
t.getImage().getImageSize();if(null===o&&(o=Bf),2==o.length){var s=t.getImage().getScale();r[0]=s*o[0]/2,r[1]=-s*o[1]/2,n="left"}}if(null!==t.getText()){var a=t.getText();(i=a.clone()).setFont(a.getFont()||c_.getFont()),i.setScale(a.getScale()||c_.getScale()),i.setFill(a.getFill()||c_.getFill()),i.setStroke(a.getStroke()||u_)}else i=c_.clone();return i.setText(e),i.setOffsetX(r[0]),i.setOffsetY(r[1]),i.setTextAlign(n),new Nu({text:i})}function y_(t){var e=eu(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);
if(i){var r=i[1];return[parseInt(r.substr(6,2),16),parseInt(r.substr(4,2),16),parseInt(r.substr(2,2),16),parseInt(r.substr(0,2),16)/255]}}function v_(t){for(var e,i=eu(t,!1),r=[],n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=n.exec(i);){var o=parseFloat(e[1]),s=parseFloat(e[2]),a=e[3]?parseFloat(e[3]):0;r.push(o,s,a),i=i.substr(e[0].length)}if(""===i)return r}function m_(t){var e=eu(t,!1).trim(),i=t.baseURI;return i&&
"about:blank"!=i||(i=window.location.href),i?(new URL(e,i)).href:e}function x_(t){return bd(t)}var E_=fu($f,{Pair:function(t,e){var i=gu({},q_,t,e);if(!i)return;var r=i.key;if(r&&"normal"==r){var n=i.styleUrl;n&&(e[e.length-1]=n);var o=i.Style;o&&(e[e.length-1]=o)}}});function S_(t,e){return gu(void 0,E_,t,e)}var T_=fu($f,{Icon:hu(function(t,e){var i=gu({},M_,t,e);return i||null}),heading:hu(bd),hotSpot:hu(function(t){var e,i=t.getAttribute("xunits"),r=t.getAttribute("yunits");return e="insetPixels"!==
i?"insetPixels"!==r?Lu.BOTTOM_LEFT:Lu.TOP_LEFT:"insetPixels"!==r?Lu.BOTTOM_RIGHT:Lu.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:t_[i],y:parseFloat(t.getAttribute("y")),yunits:t_[r],origin:e}}),scale:hu(x_)});var C_=fu($f,{color:hu(y_),scale:hu(x_)});var R_=fu($f,{color:hu(y_),width:hu(bd)});var w_=fu($f,{color:hu(y_),fill:hu(Ld),outline:hu(Ld)});var I_=fu($f,{coordinates:su(v_)});function L_(t,e){return gu(null,I_,t,e)}var O_=fu(Qf,{Track:ou(b_)});var P_=fu($f,{when:function(t,e){var i=e[e.length-
1].whens,r=eu(t,!1),n=Date.parse(r);i.push(isNaN(n)?0:n)}},fu(Qf,{coord:function(t,e){var i=e[e.length-1].flatCoordinates,r=eu(t,!1),n=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(r);if(n){var o=parseFloat(n[1]),s=parseFloat(n[2]),a=parseFloat(n[3]);i.push(o,s,a,0)}else i.push(0,0,0,0)}}));function b_(t,e){var i=gu({flatCoordinates:[],whens:[]},P_,t,e);if(i){for(var r=i.flatCoordinates,n=i.whens,o=0,s=Math.min(r.length,
n.length);o<s;++o)r[4*o+3]=n[o];return new hr(r,At.XYZM)}}var M_=fu($f,{href:hu(m_)},fu(Qf,{x:hu(bd),y:hu(bd),w:hu(bd),h:hu(bd)}));var F_=fu($f,{coordinates:su(v_)});function A_(t,e){return gu(null,F_,t,e)}var N_=fu($f,{extrude:hu(Ld),tessellate:hu(Ld),altitudeMode:hu(Nd)});function G_(t,e){var i=gu({},N_,t,e),r=A_(t,e);if(r){var n=new hr(r,At.XYZ);return n.setProperties(i),n}}function D_(t,e){var i=gu({},N_,t,e),r=A_(t,e);if(r){var n=new Ii(r,At.XYZ,[r.length]);return n.setProperties(i),n}}var k_=
fu($f,{LineString:ou(G_),LinearRing:ou(D_),MultiGeometry:ou(j_),Point:ou(U_),Polygon:ou(B_)});function j_(t,e){var i,r=gu([],k_,t,e);if(!r)return null;if(0===r.length)return new ud(r);for(var n,o,s=!0,a=r[0].getType(),h=1,l=r.length;h<l;++h)if(r[h].getType()!=a){s=!1;break}if(s)if(a==Nt.POINT){var u=r[0];n=u.getLayout(),o=u.getFlatCoordinates();for(var p=1,c=r.length;p<c;++p)K(o,r[p].getFlatCoordinates());z_(i=new bc(o,n),r)}else a==Nt.LINE_STRING?z_(i=new Pc(r),r):a==Nt.POLYGON?z_(i=new Fc(r),r):
a==Nt.GEOMETRY_COLLECTION?i=new ud(r):Y(!1,37);else i=new ud(r);return i}function U_(t,e){var i=gu({},N_,t,e),r=A_(t,e);if(r){var n=new ci(r,At.XYZ);return n.setProperties(i),n}}var Y_=fu($f,{innerBoundaryIs:function(t,e){var i=gu(void 0,tg,t,e);if(i){var r=e[e.length-1];r.push(i)}},outerBoundaryIs:function(t,e){var i=gu(void 0,eg,t,e);if(i){var r=e[e.length-1];r[0]=i}}});function B_(t,e){var i=gu({},N_,t,e),r=gu([null],Y_,t,e);if(r&&r[0]){for(var n=r[0],o=[n.length],s=1,a=r.length;s<a;++s)K(n,r[s]),
o.push(n.length);var h=new Ii(n,At.XYZ,o);return h.setProperties(i),h}}var V_=fu($f,{IconStyle:function(t,e){var i=gu({},T_,t,e);if(i){var r,n,o,s,a=e[e.length-1],h="Icon"in i?i.Icon:{},l=!("Icon"in i)||Object.keys(h).length>0,u=h.href;u?r=u:l&&(r=Vf);var p,c=Lu.BOTTOM_LEFT,d=i.hotSpot;d?(n=[d.x,d.y],o=d.xunits,s=d.yunits,c=d.origin):r===Vf?(n=jf,o=Uf,s=Yf):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(r)&&(n=[.5,0],o=wu.FRACTION,s=wu.FRACTION);var f,_=h.x,g=h.y;void 0!==_&&void 0!==g&&(p=[_,g]);
var y,v=h.w,m=h.h;void 0!==v&&void 0!==m&&(f=[v,m]);var x=i.heading;void 0!==x&&(y=Vt(x));var E=i.scale;if(l){r==Vf&&(f=Bf,void 0===E&&(E=Xf));var S=new Ou({anchor:n,anchorOrigin:c,anchorXUnits:o,anchorYUnits:s,crossOrigin:"anonymous",offset:p,offsetOrigin:Lu.BOTTOM_LEFT,rotation:y,scale:E,size:f,src:r});a.imageStyle=S}else a.imageStyle=h_}},LabelStyle:function(t,e){var i=gu({},C_,t,e);if(i){var r=e[e.length-1],n=new Rr({fill:new mr({color:"color"in i?i.color:kf}),scale:i.scale});r.textStyle=n}},
LineStyle:function(t,e){var i=gu({},R_,t,e);if(i){var r=e[e.length-1],n=new Er({color:"color"in i?i.color:kf,width:"width"in i?i.width:1});r.strokeStyle=n}},PolyStyle:function(t,e){var i=gu({},w_,t,e);if(i){var r=e[e.length-1],n=new mr({color:"color"in i?i.color:kf});r.fillStyle=n;var o=i.fill;void 0!==o&&(r.fill=o);var s=i.outline;void 0!==s&&(r.outline=s)}}});function X_(t,e){var i=gu({},V_,t,e);if(!i)return null;var r,n="fillStyle"in i?i.fillStyle:a_,o=i.fill;void 0===o||o||(n=null),"imageStyle"in
i?i.imageStyle!=h_&&(r=i.imageStyle):r=l_;var s="textStyle"in i?i.textStyle:c_,a="strokeStyle"in i?i.strokeStyle:p_,h=i.outline;return void 0===h||h||(a=null),[new Nu({fill:n,image:r,stroke:a,text:s,zIndex:void 0})]}function z_(t,e){var i,r,n,o=e.length,s=new Array(e.length),a=new Array(e.length),h=new Array(e.length);i=r=n=!1;for(var l=0;l<o;++l){var u=e[l];s[l]=u.get("extrude"),a[l]=u.get("tessellate"),h[l]=u.get("altitudeMode"),i=i||void 0!==s[l],r=r||void 0!==a[l],n=n||h[l]}i&&t.set("extrude",
s),r&&t.set("tessellate",a),n&&t.set("altitudeMode",h)}var W_=fu($f,{displayName:hu(Nd),value:hu(Nd)});var K_=fu($f,{Data:function(t,e){var i=t.getAttribute("name");_u(W_,t,e);var r=e[e.length-1];null!==i?r[i]=r.value:null!==r.displayName&&(r[r.displayName]=r.value),delete r.value},SchemaData:function(t,e){_u(J_,t,e)}});function H_(t,e){_u(K_,t,e)}function Z_(t,e){_u(n_,t,e)}var q_=fu($f,{Style:hu(X_),key:hu(Nd),styleUrl:hu(m_)});var J_=fu($f,{SimpleData:function(t,e){var i=t.getAttribute("name");
if(null!==i){var r=Nd(t),n=e[e.length-1];n[i]=r}}});var Q_=fu($f,{altitudeMode:hu(Nd),minAltitude:hu(bd),maxAltitude:hu(bd),north:hu(bd),south:hu(bd),east:hu(bd),west:hu(bd)});var $_=fu($f,{minLodPixels:hu(bd),maxLodPixels:hu(bd),minFadeExtent:hu(bd),maxFadeExtent:hu(bd)});var tg=fu($f,{LinearRing:su(L_)});var eg=fu($f,{LinearRing:su(L_)});function ig(t,e){for(var i=_r(e),r=[255*(4==i.length?i[3]:1),i[2],i[1],i[0]],n=0;n<4;++n){var o=Math.floor(r[n]).toString(16);r[n]=1==o.length?"0"+o:o}jd(t,r.join(""))}
var rg=fu($f,{Data:lu(function(t,e,i){t.setAttribute("name",e.name);var r={node:t},n=e.value;"object"==typeof n?(null!==n&&n.displayName&&vu(r,rg,cu,[n.displayName],i,["displayName"]),null!==n&&n.value&&vu(r,rg,cu,[n.value],i,["value"])):vu(r,rg,cu,[n],i,["value"])}),value:lu(function(t,e){jd(t,e)}),displayName:lu(function(t,e){!function(t,e){t.appendChild(Ql.createCDATASection(e))}(t,e)})});var ng=fu($f,{Placemark:lu(Og)}),og=function(t,e,i){return tu(e[e.length-1].node.namespaceURI,"Placemark")};
var sg=pu("Data");var ag=fu($f,["href"],fu(Qf,["x","y","w","h"])),hg=fu($f,{href:lu(jd)},fu(Qf,{x:lu(Dd),y:lu(Dd),w:lu(Dd),h:lu(Dd)})),lg=function(t,e,i){return tu(Qf[0],"gx:"+i)};var ug=fu($f,["scale","heading","Icon","hotSpot"]),pg=fu($f,{Icon:lu(function(t,e,i){var r={node:t},n=i[i.length-1].node,o=ag[n.namespaceURI],s=du(e,o);vu(r,hg,cu,s,i,o),s=du(e,o=ag[Qf[0]]),vu(r,hg,lg,s,i,o)}),heading:lu(Dd),hotSpot:lu(function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",
e.xunits),t.setAttribute("yunits",e.yunits)}),scale:lu(jg)});var cg=fu($f,["color","scale"]),dg=fu($f,{color:lu(ig),scale:lu(jg)});var fg=fu($f,["color","width"]),_g=fu($f,{color:lu(ig),width:lu(Dd)});var gg={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},yg=function(t,e,i){if(t)return tu(e[e.length-1].node.namespaceURI,gg[t.getType()])},vg=pu("Point"),
mg=pu("LineString"),xg=pu("LinearRing"),Eg=pu("Polygon"),Sg=fu($f,{LineString:lu(Mg),Point:lu(Mg),Polygon:lu(Gg),GeometryCollection:lu(Tg)});function Tg(t,e,i){var r,n,o={node:t},s=e.getType();s==Nt.GEOMETRY_COLLECTION?(r=e.getGeometries(),n=yg):s==Nt.MULTI_POINT?(r=e.getPoints(),n=vg):s==Nt.MULTI_LINE_STRING?(r=e.getLineStrings(),n=mg):s==Nt.MULTI_POLYGON?(r=e.getPolygons(),n=Eg):Y(!1,39),vu(o,Sg,n,r,i)}var Cg=fu($f,{LinearRing:lu(Mg)});function Rg(t,e,i){vu({node:t},Cg,xg,[e],i)}var wg=fu($f,{ExtendedData:lu(function(t,
e,i){for(var r={node:t},n=e.names,o=e.values,s=n.length,a=0;a<s;a++)vu(r,rg,sg,[{name:n[a],value:o[a]}],i)}),MultiGeometry:lu(Tg),LineString:lu(Mg),LinearRing:lu(Mg),Point:lu(Mg),Polygon:lu(Gg),Style:lu(function(t,e,i){var r={node:t},n={},o=e.getFill(),s=e.getStroke(),a=e.getImage(),h=e.getText();a&&"function"==typeof a.getSrc&&(n.IconStyle=a);h&&(n.LabelStyle=h);s&&(n.LineStyle=s);o&&(n.PolyStyle=o);var l=i[i.length-1].node,u=Ug[l.namespaceURI],p=du(n,u);vu(r,Yg,cu,p,i,u)}),address:lu(jd),description:lu(jd),
name:lu(jd),open:lu(Gd),phoneNumber:lu(jd),styleUrl:lu(jd),visibility:lu(Gd)}),Ig=fu($f,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),Lg=pu("ExtendedData");function Og(t,e,i){var r={node:t};e.getId()&&t.setAttribute("id",e.getId());var n=e.getProperties(),o={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};o[e.getGeometryName()]=1;var s=Object.keys(n||{}).sort().filter(function(t){return!o[t]});if(s.length>0){var a=du(n,s);vu(r,
wg,Lg,[{names:s,values:a}],i)}var h=e.getStyleFunction();if(h){var l=h(e,0);if(l){var u=Array.isArray(l)?l[0]:l;this.writeStyles_&&(n.Style=u);var p=u.getText();p&&(n.name=p.getText())}}var c=i[i.length-1].node,d=Ig[c.namespaceURI],f=du(n,d);vu(r,wg,cu,f,i,d);var _=i[0],g=e.getGeometry();g&&(g=dd(g,!0,_)),vu(r,wg,yg,[g],i)}var Pg=fu($f,["extrude","tessellate","altitudeMode","coordinates"]),bg=fu($f,{extrude:lu(Gd),tessellate:lu(Gd),altitudeMode:lu(jd),coordinates:lu(function(t,e,i){var r,n=i[i.length-
1],o=n.layout,s=n.stride;o==At.XY||o==At.XYM?r=2:o==At.XYZ||o==At.XYZM?r=3:Y(!1,34);var a=e.length,h="";if(a>0){h+=e[0];for(var l=1;l<r;++l)h+=","+e[l];for(var u=s;u<a;u+=s){h+=" "+e[u];for(var p=1;p<r;++p)h+=","+e[u+p]}}jd(t,h)})});function Mg(t,e,i){var r=e.getFlatCoordinates(),n={node:t};n.layout=e.getLayout(),n.stride=e.getStride();var o=e.getProperties();o.coordinates=r;var s=i[i.length-1].node,a=Pg[s.namespaceURI],h=du(o,a);vu(n,bg,cu,h,i,a)}var Fg=fu($f,{outerBoundaryIs:lu(Rg),innerBoundaryIs:lu(Rg)}),
Ag=pu("innerBoundaryIs"),Ng=pu("outerBoundaryIs");function Gg(t,e,i){var r=e.getLinearRings(),n=r.shift(),o={node:t};vu(o,Fg,Ag,r,i),vu(o,Fg,Ng,[n],i)}var Dg=fu($f,{color:lu(ig)}),kg=pu("color");function jg(t,e){Dd(t,Math.round(1E6*e)/1E6)}var Ug=fu($f,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),Yg=fu($f,{IconStyle:lu(function(t,e,i){var r={node:t},n={},o=e.getSrc(),s=e.getSize(),a=e.getImageSize(),h={href:o};if(s){h.w=s[0],h.h=s[1];var l=e.getAnchor(),u=e.getOrigin();if(u&&a&&0!==u[0]&&u[1]!==
s[1]&&(h.x=u[0],h.y=a[1]-(u[1]+s[1])),l&&(l[0]!==s[0]/2||l[1]!==s[1]/2)){var p={x:l[0],xunits:wu.PIXELS,y:s[1]-l[1],yunits:wu.PIXELS};n.hotSpot=p}}n.Icon=h;var c=e.getScale();1!==c&&(n.scale=c);var d=e.getRotation();0!==d&&(n.heading=d);var f=i[i.length-1].node,_=ug[f.namespaceURI],g=du(n,_);vu(r,pg,cu,g,i,_)}),LabelStyle:lu(function(t,e,i){var r={node:t},n={},o=e.getFill();o&&(n.color=o.getColor());var s=e.getScale();s&&1!==s&&(n.scale=s);var a=i[i.length-1].node,h=cg[a.namespaceURI],l=du(n,h);vu(r,
dg,cu,l,i,h)}),LineStyle:lu(function(t,e,i){var r={node:t},n={color:e.getColor(),width:e.getWidth()},o=i[i.length-1].node,s=fg[o.namespaceURI],a=du(n,s);vu(r,_g,cu,a,i,s)}),PolyStyle:lu(function(t,e,i){vu({node:t},Dg,kg,[e.getColor()],i)})});var Bg=__,Vg=i(1),Xg=i.n(Vg),zg=[1,0,0,1,0,0],Wg=function(t,e,i,r,n){this.extent_,this.id_=n,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=r};Wg.prototype.get=function(t){return this.properties_[t]},
Wg.prototype.getExtent=function(){return this.extent_||(this.extent_=this.type_===Nt.POINT?pt(this.flatCoordinates_):ct(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_},Wg.prototype.getFlatInteriorPoint=function(){if(!this.flatInteriorPoints_){var t=Tt(this.getExtent());this.flatInteriorPoints_=gi(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_},Wg.prototype.getFlatInteriorPoints=function(){if(!this.flatInteriorPoints_){var t=Mc(this.flatCoordinates_,
0,this.ends_,2);this.flatInteriorPoints_=yi(this.flatCoordinates_,0,this.ends_,2,t)}return this.flatInteriorPoints_},Wg.prototype.getFlatMidpoint=function(){return this.flatMidpoints_||(this.flatMidpoints_=or(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_},Wg.prototype.getFlatMidpoints=function(){if(!this.flatMidpoints_){this.flatMidpoints_=[];for(var t=this.flatCoordinates_,e=0,i=this.ends_,r=0,n=i.length;r<n;++r){var o=i[r],s=or(t,e,o,2,.5);K(this.flatMidpoints_,
s),e=o}}return this.flatMidpoints_},Wg.prototype.getId=function(){return this.id_},Wg.prototype.getOrientedFlatCoordinates=function(){return this.flatCoordinates_},Wg.prototype.getGeometry=function(){return this},Wg.prototype.getSimplifiedGeometry=function(t){return this},Wg.prototype.getProperties=function(){return this.properties_},Wg.prototype.getStride=function(){return 2},Wg.prototype.getStyleFunction=function(){},Wg.prototype.getType=function(){return this.type_},Wg.prototype.transform=function(t,
e){var i=(t=Ee(t)).getExtent(),r=t.getWorldExtent(),n=Rt(r)/Rt(i);Ye(zg,r[0],r[3],n,-n,0,0,0),Gt(this.flatCoordinates_,0,this.flatCoordinates_.length,2,zg,this.flatCoordinates_)},Wg.prototype.getEnds=Wg.prototype.getEndss=function(){return this.ends_},Wg.prototype.getFlatCoordinates=Wg.prototype.getOrientedFlatCoordinates;var Kg=Wg;function Hg(t,e,i){if(3===t){var r={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(Zg,r,n),r.length=r.features.length,r.length&&(e[r.name]=r)}}function Zg(t,
e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){for(var r=null,n=i.readVarint()+i.pos;i.pos<n;)r=1===(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(r)}}function qg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==
t)for(var r=i.readVarint()+i.pos;i.pos<r;){var n=e.layer.keys[i.readVarint()],o=e.layer.values[i.readVarint()];e.properties[n]=o}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function Jg(t,e,i){t.pos=e.features[i];var r=t.readVarint()+t.pos,n={layer:e,type:0,properties:{}};return t.readFields(qg,n,r),n}var Qg=function(t){function e(e){t.call(this);var i=e||{};this.dataProjection=new ee({code:"",units:$t.TILE_PIXELS}),this.featureClass_=i.featureClass?i.featureClass:Kg,this.geometryName_=
i.geometryName,this.layerName_=i.layerName?i.layerName:"layer",this.layers_=i.layers?i.layers:null,this.extent_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readRawGeometry_=function(t,e,i,r){t.pos=e.geometry;for(var n=t.readVarint()+t.pos,o=1,s=0,a=0,h=0,l=0,u=0;t.pos<n;){if(!s){var p=t.readVarint();o=7&p,s=p>>3}s--,1===o||2===o?(a+=t.readSVarint(),h+=t.readSVarint(),1===o&&l>u&&(r.push(l),u=l),i.push(a,h),l+=2):7===o?l>u&&(i.push(i[u],
i[u+1]),l+=2):Y(!1,59)}l>u&&(r.push(l),u=l)},e.prototype.createFeature_=function(t,e,i){var r,n=e.type;if(0===n)return null;var o=e.id,s=e.properties;s[this.layerName_]=e.layer.name;var a=[],h=[];this.readRawGeometry_(t,e,a,h);var l=function(t,e){var i;1===t?i=1===e?Nt.POINT:Nt.MULTI_POINT:2===t?i=1===e?Nt.LINE_STRING:Nt.MULTI_LINE_STRING:3===t&&(i=Nt.POLYGON);return i}(n,h.length);if(this.featureClass_===Kg)r=new this.featureClass_(l,a,h,s,o);else{var u;if(l==Nt.POLYGON){for(var p=[],c=0,d=0,f=0,
_=h.length;f<_;++f){var g=h[f];Si(a,c,g,2)||(p.push(h.slice(d,f)),d=f),c=g}u=p.length>1?new Fc(a,At.XY,p):new Ii(a,At.XY,h)}else u=l===Nt.POINT?new ci(a,At.XY):l===Nt.LINE_STRING?new hr(a,At.XY):l===Nt.POLYGON?new Ii(a,At.XY,h):l===Nt.MULTI_POINT?new bc(a,At.XY):l===Nt.MULTI_LINE_STRING?new Pc(a,At.XY,h):null;r=new (0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);var y=dd(u,!1,this.adaptOptions(i));r.setGeometry(y),r.setId(o),r.setProperties(s)}return r},e.prototype.getLastExtent=
function(){return this.extent_},e.prototype.getType=function(){return Hl.ARRAY_BUFFER},e.prototype.readFeatures=function(t,e){var i=this.layers_,r=new Xg.a(t),n=r.readFields(Hg,{}),o=[];for(var s in n)if(!i||-1!=i.indexOf(s)){for(var a=n[s],h=0,l=a.length;h<l;++h){var u=Jg(r,a,h);o.push(this.createFeature_(r,u))}this.extent_=a?[0,0,a.extent,a.extent]:null}return o},e.prototype.readProjection=function(t){return this.dataProjection},e.prototype.setLayers=function(t){this.layers_=t},e}(cd),$g=[null],
ty=fu($g,{nd:function(t,e){e[e.length-1].ndrefs.push(t.getAttribute("ref"))},tag:ny}),ey=fu($g,{node:function(t,e){var i=e[0],r=e[e.length-1],n=t.getAttribute("id"),o=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))];r.nodes[n]=o;var s=gu({tags:{}},ry,t,e);if(!d(s.tags)){var a=new ci(o);dd(a,!1,i);var h=new B(a);h.setId(n),h.setProperties(s.tags),r.features.push(h)}},way:function(t,e){var i=gu({id:t.getAttribute("id"),ndrefs:[],tags:{}},ty,t,e);e[e.length-1].ways.push(i)}}),iy=
function(t){function e(){t.call(this),this.dataProjection=Ee("EPSG:4326")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeaturesFromNode=function(t,e){var i=this.getReadOptions(t,e);if("osm"==t.localName){for(var r=gu({nodes:{},ways:[],features:[]},ey,t,[i]),n=0;n<r.ways.length;n++){for(var o=r.ways[n],s=[],a=0,h=o.ndrefs.length;a<h;a++)K(s,r.nodes[o.ndrefs[a]]);var l=void 0;dd(l=o.ndrefs[0]==o.ndrefs[o.ndrefs.length-1]?new Ii(s,At.XY,
[s.length]):new hr(s,At.XY),!1,i);var u=new B(l);u.setId(o.id),u.setProperties(o.tags),r.features.push(u)}if(r.features)return r.features}return[]},e}(Td),ry=fu($g,{tag:ny});function ny(t,e){e[e.length-1].tags[t.getAttribute("k")]=t.getAttribute("v")}var oy=iy;function sy(t,e,i,r,n,o){var s,a;void 0!==n?(s=n,a=void 0!==o?o:0):(s=[],a=0);for(var h=e;h<i;){var l=t[h++];s[a++]=t[h++],s[a++]=l;for(var u=2;u<r;++u)s[a++]=t[h++]}return s.length=a,s}function ay(t,e,i){var r,n=i||1E5,o=new Array(e);for(r=
0;r<e;++r)o[r]=0;for(var s=0,a=t.length;s<a;)for(r=0;r<e;++r,++s){var h=t[s],l=h-o[r];o[r]=h,t[s]=l}return ly(t,n)}function hy(t,e,i){var r,n=i||1E5,o=new Array(e);for(r=0;r<e;++r)o[r]=0;for(var s=uy(t,n),a=0,h=s.length;a<h;)for(r=0;r<e;++r,++a)o[r]+=s[a],s[a]=o[r];return s}function ly(t,e){for(var i=e||1E5,r=0,n=t.length;r<n;++r)t[r]=Math.round(t[r]*i);return function(t){for(var e=0,i=t.length;e<i;++e){var r=t[e];t[e]=r<0?~(r<<1):r<<1}return function(t){for(var e="",i=0,r=t.length;i<r;++i)e+=py(t[i]);
return e}(t)}(t)}function uy(t,e){for(var i=e||1E5,r=function(t){for(var e=function(t){for(var e=[],i=0,r=0,n=0,o=t.length;n<o;++n){var s=t.charCodeAt(n)-63;i|=(31&s)<<r,s<32?(e.push(i),i=0,r=0):r+=5}return e}(t),i=0,r=e.length;i<r;++i){var n=e[i];e[i]=1&n?~(n>>1):n>>1}return e}(t),n=0,o=r.length;n<o;++n)r[n]/=i;return r}function py(t){for(var e,i="";t>=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e)}var cy=function(t){function e(e){t.call(this);var i=e||
{};this.dataProjection=Ee("EPSG:4326"),this.factor_=i.factor?i.factor:1E5,this.geometryLayout_=i.geometryLayout?i.geometryLayout:At.XY}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeatureFromText=function(t,e){var i=this.readGeometryFromText(t,e);return new B(i)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var i=ze(this.geometryLayout_),r=hy(t,i,
this.factor_);sy(r,0,r.length,i,r);var n=ri(r,0,r.length,i);return dd(new hr(n,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var i=t.getGeometry();return i?this.writeGeometryText(i,e):(Y(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var i=(t=dd(t,!0,this.adaptOptions(e))).getFlatCoordinates(),r=t.getStride();return sy(i,0,i.length,r,i),ay(i,r,this.factor_)},e}(zf),
dy={Point:function(t,e,i){var r=t.coordinates;e&&i&&vy(r,e,i);return new ci(r)},LineString:function(t,e){var i=fy(t.arcs,e);return new hr(i)},Polygon:function(t,e){for(var i=[],r=0,n=t.arcs.length;r<n;++r)i[r]=fy(t.arcs[r],e);return new Ii(i)},MultiPoint:function(t,e,i){var r=t.coordinates;if(e&&i)for(var n=0,o=r.length;n<o;++n)vy(r[n],e,i);return new bc(r)},MultiLineString:function(t,e){for(var i=[],r=0,n=t.arcs.length;r<n;++r)i[r]=fy(t.arcs[r],e);return new Pc(i)},MultiPolygon:function(t,e){for(var i=
[],r=0,n=t.arcs.length;r<n;++r){for(var o=t.arcs[r],s=[],a=0,h=o.length;a<h;++a)s[a]=fy(o[a],e);i[r]=s}return new Fc(i)}};function fy(t,e){for(var i,r,n=[],o=0,s=t.length;o<s;++o)i=t[o],o>0&&n.pop(),r=i>=0?e[i]:e[~i].slice().reverse(),n.push.apply(n,r);for(var a=0,h=n.length;a<h;++a)n[a]=n[a].slice();return n}function _y(t,e,i,r,n,o,s){for(var a=t.geometries,h=[],l=0,u=a.length;l<u;++l)h[l]=gy(a[l],e,i,r,n,o,s);return h}function gy(t,e,i,r,n,o,s){var a,h=t.type,l=dy[h];a="Point"===h||"MultiPoint"===
h?l(t,i,r):l(t,e);var u=new B;u.setGeometry(dd(a,!1,s)),void 0!==t.id&&u.setId(t.id);var p=t.properties;return n&&(p||(p={}),p[n]=o),p&&u.setProperties(p),u}function yy(t,e,i){for(var r=0,n=0,o=0,s=t.length;o<s;++o){var a=t[o];r+=a[0],n+=a[1],a[0]=r,a[1]=n,vy(a,e,i)}}function vy(t,e,i){t[0]=t[0]*e[0]+i[0],t[1]=t[1]*e[1]+i[1]}var my=function(t){function e(e){t.call(this);var i=e||{};this.layerName_=i.layerName,this.layers_=i.layers?i.layers:null,this.dataProjection=Ee(i.dataProjection?i.dataProjection:
"EPSG:4326")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var i,r=t,n=null,o=null;r.transform&&(n=(i=r.transform).scale,o=i.translate);var s=r.arcs;i&&function(t,e,i){for(var r=0,n=t.length;r<n;++r)yy(t[r],e,i)}(s,n,o);var a,h=[],l=r.objects,u=this.layerName_;for(var p in l)this.layers_&&-1==this.layers_.indexOf(p)||("GeometryCollection"===l[p].type?(a=l[p],h.push.apply(h,_y(a,
s,n,o,u,p,e))):(a=l[p],h.push(gy(a,s,n,o,u,p,e))));return h}return[]},e.prototype.readProjectionFromObject=function(t){return this.dataProjection},e}(_d),xy=function(t){this.tagName_=t};xy.prototype.getTagName=function(){return this.tagName_};var Ey=xy,Sy=function(t){function e(e,i){t.call(this,e),this.conditions=i,Y(this.conditions.length>=2,57)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ey),Ty=function(t){function e(e){t.call(this,"And",Array.prototype.slice.call(arguments))}
return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Sy),Cy=function(t){function e(e,i,r){t.call(this,"BBOX"),this.geometryName=e,this.extent=i,this.srsName=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ey),Ry=function(t){function e(e,i,r,n){t.call(this,e),this.geometryName=i||"the_geom",this.geometry=r,this.srsName=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e}(Ey),wy=function(t){function e(e,i,r){t.call(this,"Contains",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ry),Iy=function(t){function e(e,i){t.call(this,e),this.propertyName=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ey),Ly=function(t){function e(e,i,r){t.call(this,"During",e),this.begin=i,this.end=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=
e,e}(Iy),Oy=function(t){function e(e,i,r,n){t.call(this,e,i),this.expression=r,this.matchCase=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Iy),Py=function(t){function e(e,i,r){t.call(this,"PropertyIsEqualTo",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Oy),by=function(t){function e(e,i){t.call(this,"PropertyIsGreaterThan",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),
e.prototype.constructor=e,e}(Oy),My=function(t){function e(e,i){t.call(this,"PropertyIsGreaterThanOrEqualTo",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Oy),Fy=function(t){function e(e,i,r){t.call(this,"Intersects",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ry),Ay=function(t){function e(e,i,r){t.call(this,"PropertyIsBetween",e),this.lowerBoundary=i,this.upperBoundary=r}return t&&
(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Iy),Ny=function(t){function e(e,i,r,n,o,s){t.call(this,"PropertyIsLike",e),this.pattern=i,this.wildCard=void 0!==r?r:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==o?o:"!",this.matchCase=s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Iy),Gy=function(t){function e(e){t.call(this,"PropertyIsNull",e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e}(Iy),Dy=function(t){function e(e,i){t.call(this,"PropertyIsLessThan",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Oy),ky=function(t){function e(e,i){t.call(this,"PropertyIsLessThanOrEqualTo",e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Oy),jy=function(t){function e(e){t.call(this,"Not"),this.condition=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e}(Ey),Uy=function(t){function e(e,i,r){t.call(this,"PropertyIsNotEqualTo",e,i,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Oy),Yy=function(t){function e(e){t.call(this,"Or",Array.prototype.slice.call(arguments))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Sy),By=function(t){function e(e,i,r){t.call(this,"Within",e,i,r)}return t&&(e.__proto__=t),e.prototype=
Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ry);function Vy(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new (Function.prototype.bind.apply(Ty,e))}function Xy(t,e,i){return new Cy(t,e,i)}var zy={"http://www.opengis.net/gml":{boundedBy:hu(Id.prototype.readGeometryElement,"bounds")}},Wy={"http://www.opengis.net/wfs":{totalInserted:hu(Fd),totalUpdated:hu(Fd),totalDeleted:hu(Fd)}},Ky={"http://www.opengis.net/wfs":{TransactionSummary:hu(function(t,e){return gu({},
Wy,t,e)},"transactionSummary"),InsertResults:hu(function(t,e){return gu([],ov,t,e)},"insertIds")}},Hy={"http://www.opengis.net/wfs":{PropertyName:lu(jd)}},Zy={"http://www.opengis.net/wfs":{Insert:lu(function(t,e,i){var r=i[i.length-1],n=r.featureType,o=r.featureNS,s=r.gmlVersion,a=tu(o,n);t.appendChild(a),2===s?Zd.prototype.writeFeatureElement(a,e,i):Vd.prototype.writeFeatureElement(a,e,i)}),Update:lu(function(t,e,i){var r=i[i.length-1];Y(void 0!==e.getId(),27);var n=r.featureType,o=r.featurePrefix,
s=r.featureNS,a=av(o,n),h=e.getGeometryName();t.setAttribute("typeName",a),t.setAttributeNS(Jy,"xmlns:"+o,s);var l=e.getId();if(void 0!==l){for(var u=e.getKeys(),p=[],c=0,d=u.length;c<d;c++){var f=e.get(u[c]);if(void 0!==f){var _=u[c];f&&"function"==typeof f.getSimplifiedGeometry&&(_=h),p.push({name:_,value:f})}}vu({gmlVersion:r.gmlVersion,node:t,hasZ:r.hasZ,srsName:r.srsName},Zy,pu("Property"),p,i),sv(t,l,i)}}),Delete:lu(function(t,e,i){var r=i[i.length-1];Y(void 0!==e.getId(),26);var n=r.featureType,
o=r.featurePrefix,s=r.featureNS,a=av(o,n);t.setAttribute("typeName",a),t.setAttributeNS(Jy,"xmlns:"+o,s);var h=e.getId();void 0!==h&&sv(t,h,i)}),Property:lu(function(t,e,i){var r=tu($y,"Name"),n=i[i.length-1].gmlVersion;if(t.appendChild(r),jd(r,e.name),void 0!==e.value&&null!==e.value){var o=tu($y,"Value");t.appendChild(o),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===n?Zd.prototype.writeGeometryElement(o,e.value,i):Vd.prototype.writeGeometryElement(o,e.value,i):jd(o,e.value)}}),Native:lu(function(t,
e,i){e.vendorId&&t.setAttribute("vendorId",e.vendorId);void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore));void 0!==e.value&&jd(t,e.value)})}},qy="feature",Jy="http://www.w3.org/2000/xmlns/",Qy="http://www.opengis.net/ogc",$y="http://www.opengis.net/wfs",tv="http://www.opengis.net/fes",ev={"1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},iv="1.1.0",rv=function(t){function e(e){t.call(this);
var i=e||{};this.featureType_=i.featureType,this.featureNS_=i.featureNS,this.gmlFormat_=i.gmlFormat?i.gmlFormat:new Vd,this.schemaLocation_=i.schemaLocation?i.schemaLocation:ev[iv]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var i={node:t};u(i,{featureType:this.featureType_,featureNS:this.featureNS_}),
u(i,this.getReadOptions(t,e||{}));var r=[i];this.gmlFormat_.FEATURE_COLLECTION_PARSERS[Cd].featureMember=ou(Id.prototype.readFeaturesInternal);var n=gu([],this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,r,this.gmlFormat_);return n||(n=[]),n},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=ru(t);return this.readTransactionResponseFromDocument(e)}return iu(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=
function(t){if(t){if("string"==typeof t){var e=ru(t);return this.readFeatureCollectionMetadataFromDocument(e)}return iu(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},i=Ad(t.getAttribute("numberOfFeatures"));
return e.numberOfFeatures=i,gu(e,zy,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return gu({},Ky,t,[])},e.prototype.writeGetFeature=function(t){var e,i=tu($y,"GetFeature");if(i.setAttribute("service","WFS"),i.setAttribute("version","1.1.0"),t&&(t.handle&&i.setAttribute("handle",t.handle),
t.outputFormat&&i.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&i.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&i.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&i.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&i.setAttribute("count",String(t.count)),void 0!==t.viewParams&&i.setAttribute("viewParams ",t.viewParams),e=t.filter,t.bbox)){Y(t.geometryName,12);var r=Xy(t.geometryName,t.bbox,t.srsName);e=e?Vy(e,r):r}i.setAttributeNS($l,
"xsi:schemaLocation",this.schemaLocation_);var n={node:i};return u(n,{srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,geometryName:t.geometryName,filter:e,propertyNames:t.propertyNames?t.propertyNames:[]}),Y(Array.isArray(t.featureTypes),11),function(t,e,i){var r=i[i.length-1],n=u({},r);n.node=t,vu(n,hv,pu("Query"),e,i)}(i,t.featureTypes,[n]),i},e.prototype.writeTransaction=function(t,e,i,r){var n,o,s=[],a=tu($y,"Transaction"),h=r.version?r.version:
iv,l="1.0.0"===h?2:3;a.setAttribute("service","WFS"),a.setAttribute("version",h),r&&(n=r.gmlOptions?r.gmlOptions:{},r.handle&&a.setAttribute("handle",r.handle));var p=ev[h];a.setAttributeNS($l,"xsi:schemaLocation",p);var c=r.featurePrefix?r.featurePrefix:qy;return t&&(o=u({node:a},{featureNS:r.featureNS,featureType:r.featureType,featurePrefix:c,gmlVersion:l,hasZ:r.hasZ,srsName:r.srsName}),u(o,n),vu(o,Zy,pu("Insert"),t,s)),e&&(o=u({node:a},{featureNS:r.featureNS,featureType:r.featureType,featurePrefix:c,
gmlVersion:l,hasZ:r.hasZ,srsName:r.srsName}),u(o,n),vu(o,Zy,pu("Update"),e,s)),i&&vu({node:a,featureNS:r.featureNS,featureType:r.featureType,featurePrefix:c,gmlVersion:l,srsName:r.srsName},Zy,pu("Delete"),i,s),r.nativeElements&&vu({node:a,featureNS:r.featureNS,featureType:r.featureType,featurePrefix:c,gmlVersion:l,srsName:r.srsName},Zy,pu("Native"),r.nativeElements,s),a},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);
return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var i=[{}];return this.gmlFormat_.readGeometryElement(e,i),Ee(i.pop().srsName)}return null},e}(Td);var nv={"http://www.opengis.net/ogc":{FeatureId:ou(function(t,e){return t.getAttribute("fid")})}};var ov=
{"http://www.opengis.net/wfs":{Feature:function(t,e){_u(nv,t,e)}}};function sv(t,e,i){var r=tu(Qy,"Filter"),n=tu(Qy,"FeatureId");r.appendChild(n),n.setAttribute("fid",e),t.appendChild(r)}function av(t,e){var i=(t=t||qy)+":";return 0===e.indexOf(i)?e:i+e}var hv={"http://www.opengis.net/wfs":{Query:lu(function(t,e,i){var r,n=i[i.length-1],o=n.featurePrefix,s=n.featureNS,a=n.propertyNames,h=n.srsName;r=o?av(o,e):e;t.setAttribute("typeName",r),h&&t.setAttribute("srsName",h);s&&t.setAttributeNS(Jy,"xmlns:"+
o,s);var l=u({},n);l.node=t,vu(l,Hy,pu("PropertyName"),a,i);var p=n.filter;if(p){var c=tu(Qy,"Filter");t.appendChild(c),lv(c,p,i)}})},"http://www.opengis.net/ogc":{During:lu(function(t,e,i){var r=tu(tv,"ValueReference");jd(r,e.propertyName),t.appendChild(r);var n=tu(Cd,"TimePeriod");t.appendChild(n);var o=tu(Cd,"begin");n.appendChild(o),_v(o,e.begin);var s=tu(Cd,"end");n.appendChild(s),_v(s,e.end)}),And:lu(uv),Or:lu(uv),Not:lu(function(t,e,i){var r={node:t},n=e.condition;vu(r,hv,pu(n.getTagName()),
[n],i)}),BBOX:lu(function(t,e,i){i[i.length-1].srsName=e.srsName,dv(t,e.geometryName),Vd.prototype.writeGeometryElement(t,e.extent,i)}),Contains:lu(function(t,e,i){i[i.length-1].srsName=e.srsName,dv(t,e.geometryName),Vd.prototype.writeGeometryElement(t,e.geometry,i)}),Intersects:lu(function(t,e,i){i[i.length-1].srsName=e.srsName,dv(t,e.geometryName),Vd.prototype.writeGeometryElement(t,e.geometry,i)}),Within:lu(function(t,e,i){i[i.length-1].srsName=e.srsName,dv(t,e.geometryName),Vd.prototype.writeGeometryElement(t,
e.geometry,i)}),PropertyIsEqualTo:lu(pv),PropertyIsNotEqualTo:lu(pv),PropertyIsLessThan:lu(pv),PropertyIsLessThanOrEqualTo:lu(pv),PropertyIsGreaterThan:lu(pv),PropertyIsGreaterThanOrEqualTo:lu(pv),PropertyIsNull:lu(function(t,e,i){dv(t,e.propertyName)}),PropertyIsBetween:lu(function(t,e,i){dv(t,e.propertyName);var r=tu(Qy,"LowerBoundary");t.appendChild(r),fv(r,""+e.lowerBoundary);var n=tu(Qy,"UpperBoundary");t.appendChild(n),fv(n,""+e.upperBoundary)}),PropertyIsLike:lu(function(t,e,i){t.setAttribute("wildCard",
e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString());dv(t,e.propertyName),fv(t,""+e.pattern)})}};function lv(t,e,i){vu({node:t},hv,pu(e.getTagName()),[e],i)}function uv(t,e,i){for(var r={node:t},n=e.conditions,o=0,s=n.length;o<s;++o){var a=n[o];vu(r,hv,pu(a.getTagName()),[a],i)}}function pv(t,e,i){void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),dv(t,e.propertyName),
fv(t,""+e.expression)}function cv(t,e,i){var r=tu(Qy,t);jd(r,i),e.appendChild(r)}function dv(t,e){cv("PropertyName",t,e)}function fv(t,e){cv("Literal",t,e)}function _v(t,e){var i=tu(Cd,"TimeInstant");t.appendChild(i);var r=tu(Cd,"timePosition");i.appendChild(r),jd(r,e)}var gv=rv,yv={POINT:ci,LINESTRING:hr,POLYGON:Ii,MULTIPOINT:bc,MULTILINESTRING:Pc,MULTIPOLYGON:Fc},vv="EMPTY",mv="Z",xv="M",Ev=1,Sv=2,Tv=3,Cv=4,Rv=5,wv=6,Iv={};for(var Lv in Nt)Iv[Lv]=Nt[Lv].toUpperCase();var Ov=function(t){this.wkt=
t,this.index_=-1};Ov.prototype.isAlpha_=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"},Ov.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},Ov.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},Ov.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},Ov.prototype.nextToken=function(){var t,e=this.nextChar_(),i=this.index_,r=e;if("("==e)t=Sv;else if(","==e)t=Rv;else if(")"==e)t=Tv;else if(this.isNumeric_(e)||"-"==e)t=Cv,
r=this.readNumber_();else if(this.isAlpha_(e))t=Ev,r=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=wv}return{position:i,value:r,type:t}},Ov.prototype.readNumber_=function(){var t,e=this.index_,i=!1,r=!1;do"."==t?i=!0:"e"!=t&&"E"!=t||(r=!0),t=this.nextChar_();while(this.isNumeric_(t,i)||!r&&("e"==t||"E"==t)||r&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},Ov.prototype.readText_=function(){var t,
e=this.index_;do t=this.nextChar_();while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()};var Pv=function(t){this.lexer_=t,this.token_,this.layout_=At.XY};function bv(t){var e=t.getCoordinates();return 0===e.length?"":e.join(" ")}function Mv(t){for(var e=t.getCoordinates(),i=[],r=0,n=e.length;r<n;++r)i.push(e[r].join(" "));return i.join(",")}function Fv(t){for(var e=[],i=t.getLinearRings(),r=0,n=i.length;r<n;++r)e.push("("+Mv(i[r])+")");return e.join(",")}Pv.prototype.consume_=
function(){this.token_=this.lexer_.nextToken()},Pv.prototype.isTokenType=function(t){return this.token_.type==t},Pv.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},Pv.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},Pv.prototype.parseGeometryLayout_=function(){var t=At.XY,e=this.token_;if(this.isTokenType(Ev)){var i=e.value;i===mv?t=At.XYZ:i===xv?t=At.XYM:"ZM"===i&&(t=At.XYZM),t!==At.XY&&this.consume_()}return t},Pv.prototype.parseGeometryCollectionText_=
function(){if(this.match(Sv)){var t=[];do t.push(this.parseGeometry_());while(this.match(Rv));if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_());},Pv.prototype.parsePointText_=function(){if(this.match(Sv)){var t=this.parsePoint_();if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_());},Pv.prototype.parseLineStringText_=function(){if(this.match(Sv)){var t=this.parsePointList_();
if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_());},Pv.prototype.parsePolygonText_=function(){if(this.match(Sv)){var t=this.parseLineStringTextList_();if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_());},Pv.prototype.parseMultiPointText_=function(){var t;if(this.match(Sv)){if(t=this.token_.type==Sv?this.parsePointTextList_():this.parsePointList_(),this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];
throw new Error(this.formatErrorMessage_());},Pv.prototype.parseMultiLineStringText_=function(){if(this.match(Sv)){var t=this.parseLineStringTextList_();if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_());},Pv.prototype.parseMultiPolygonText_=function(){if(this.match(Sv)){var t=this.parsePolygonTextList_();if(this.match(Tv))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_());},Pv.prototype.parsePoint_=
function(){for(var t=[],e=this.layout_.length,i=0;i<e;++i){var r=this.token_;if(!this.match(Cv))break;t.push(r.value)}if(t.length==e)return t;throw new Error(this.formatErrorMessage_());},Pv.prototype.parsePointList_=function(){for(var t=[this.parsePoint_()];this.match(Rv);)t.push(this.parsePoint_());return t},Pv.prototype.parsePointTextList_=function(){for(var t=[this.parsePointText_()];this.match(Rv);)t.push(this.parsePointText_());return t},Pv.prototype.parseLineStringTextList_=function(){for(var t=
[this.parseLineStringText_()];this.match(Rv);)t.push(this.parseLineStringText_());return t},Pv.prototype.parsePolygonTextList_=function(){for(var t=[this.parsePolygonText_()];this.match(Rv);)t.push(this.parsePolygonText_());return t},Pv.prototype.isEmptyGeometry_=function(){var t=this.isTokenType(Ev)&&this.token_.value==vv;return t&&this.consume_(),t},Pv.prototype.formatErrorMessage_=function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"},
Pv.prototype.parseGeometry_=function(){var t=this.token_;if(this.match(Ev)){var e=t.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==e){var i=this.parseGeometryCollectionText_();return new ud(i)}var r,n=yv[e];if(!n)throw new Error("Invalid geometry type: "+e);switch(e){case "POINT":r=this.parsePointText_();break;case "LINESTRING":r=this.parseLineStringText_();break;case "POLYGON":r=this.parsePolygonText_();break;case "MULTIPOINT":r=this.parseMultiPointText_();break;case "MULTILINESTRING":r=
this.parseMultiLineStringText_();break;case "MULTIPOLYGON":r=this.parseMultiPolygonText_();break;default:throw new Error("Invalid geometry type: "+e);}return r||(r=n===yv.POINT?[NaN,NaN]:[]),new n(r,this.layout_)}throw new Error(this.formatErrorMessage_());};var Av={Point:bv,LineString:Mv,Polygon:Fv,MultiPoint:function(t){for(var e=[],i=t.getPoints(),r=0,n=i.length;r<n;++r)e.push("("+bv(i[r])+")");return e.join(",")},MultiLineString:function(t){for(var e=[],i=t.getLineStrings(),r=0,n=i.length;r<n;++r)e.push("("+
Mv(i[r])+")");return e.join(",")},MultiPolygon:function(t){for(var e=[],i=t.getPolygons(),r=0,n=i.length;r<n;++r)e.push("("+Fv(i[r])+")");return e.join(",")},GeometryCollection:function(t){for(var e=[],i=t.getGeometries(),r=0,n=i.length;r<n;++r)e.push(Nv(i[r]));return e.join(",")}};function Nv(t){var e=t.getType(),i=(0,Av[e])(t);if(e=e.toUpperCase(),"function"==typeof t.getFlatCoordinates){var r=function(t){var e=t.getLayout(),i="";return e!==At.XYZ&&e!==At.XYZM||(i+=mv),e!==At.XYM&&e!==At.XYZM||
(i+=xv),i}(t);r.length>0&&(e+=" "+r)}return 0===i.length?e+" "+vv:e+"("+i+")"}var Gv=function(t){function e(e){t.call(this);var i=e||{};this.splitCollection_=void 0!==i.splitCollection&&i.splitCollection}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parse_=function(t){var e=new Ov(t);return(new Pv(e)).parse()},e.prototype.readFeatureFromText=function(t,e){var i=this.readGeometryFromText(t,e);if(i){var r=new B;return r.setGeometry(i),r}return null},
e.prototype.readFeaturesFromText=function(t,e){for(var i=[],r=this.readGeometryFromText(t,e),n=[],o=0,s=(i=this.splitCollection_&&r.getType()==Nt.GEOMETRY_COLLECTION?r.getGeometriesArray():[r]).length;o<s;++o){var a=new B;a.setGeometry(i[o]),n.push(a)}return n},e.prototype.readGeometryFromText=function(t,e){var i=this.parse_(t);return i?dd(i,!1,e):null},e.prototype.writeFeatureText=function(t,e){var i=t.getGeometry();return i?this.writeGeometryText(i,e):""},e.prototype.writeFeaturesText=function(t,
e){if(1==t.length)return this.writeFeatureText(t[0],e);for(var i=[],r=0,n=t.length;r<n;++r)i.push(t[r].getGeometry());var o=new ud(i);return this.writeGeometryText(o,e)},e.prototype.writeGeometryText=function(t,e){return Nv(dd(t,!0,e))},e}(zf),Dv="http://www.w3.org/1999/xlink";function kv(t){return t.getAttributeNS(Dv,"href")}var jv=function(){};jv.prototype.read=function(t){if(t){if("string"==typeof t){var e=ru(t);return this.readFromDocument(e)}return iu(t)?this.readFromDocument(t):this.readFromNode(t)}return null},
jv.prototype.readFromDocument=function(t){},jv.prototype.readFromNode=function(t){};var Uv=jv,Yv=[null,"http://www.opengis.net/wms"],Bv=fu(Yv,{Service:hu(function(t,e){return gu({},zv,t,e)}),Capability:hu(function(t,e){return gu({},Vv,t,e)})}),Vv=fu(Yv,{Request:hu(function(t,e){return gu({},$v,t,e)}),Exception:hu(function(t,e){return gu([],Zv,t,e)}),Layer:hu(function(t,e){return gu({},qv,t,e)})}),Xv=function(t){function e(){t.call(this),this.version=void 0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=gu({version:this.version},Bv,t,[]);return e||null},e}(Uv),zv=fu(Yv,{Name:hu(Nd),Title:hu(Nd),Abstract:hu(Nd),KeywordList:hu(lm),OnlineResource:hu(kv),ContactInformation:hu(function(t,e){return gu({},Wv,t,e)}),Fees:hu(Nd),
AccessConstraints:hu(Nd),LayerLimit:hu(Fd),MaxWidth:hu(Fd),MaxHeight:hu(Fd)}),Wv=fu(Yv,{ContactPersonPrimary:hu(function(t,e){return gu({},Kv,t,e)}),ContactPosition:hu(Nd),ContactAddress:hu(function(t,e){return gu({},Hv,t,e)}),ContactVoiceTelephone:hu(Nd),ContactFacsimileTelephone:hu(Nd),ContactElectronicMailAddress:hu(Nd)}),Kv=fu(Yv,{ContactPerson:hu(Nd),ContactOrganization:hu(Nd)}),Hv=fu(Yv,{AddressType:hu(Nd),Address:hu(Nd),City:hu(Nd),StateOrProvince:hu(Nd),PostCode:hu(Nd),Country:hu(Nd)}),Zv=
fu(Yv,{Format:ou(Nd)}),qv=fu(Yv,{Name:hu(Nd),Title:hu(Nd),Abstract:hu(Nd),KeywordList:hu(lm),CRS:au(Nd),EX_GeographicBoundingBox:hu(function(t,e){var i=gu({},Qv,t,e);if(!i)return;var r=i.westBoundLongitude,n=i.southBoundLatitude,o=i.eastBoundLongitude,s=i.northBoundLatitude;if(void 0===r||void 0===n||void 0===o||void 0===s)return;return[r,n,o,s]}),BoundingBox:au(function(t,e){var i=[Md(t.getAttribute("minx")),Md(t.getAttribute("miny")),Md(t.getAttribute("maxx")),Md(t.getAttribute("maxy"))],r=[Md(t.getAttribute("resx")),
Md(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:i,res:r}}),Dimension:au(function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:Od(t.getAttribute("multipleValues")),nearestValue:Od(t.getAttribute("nearestValue")),current:Od(t.getAttribute("current")),values:Nd(t)}}),Attribution:hu(function(t,e){return gu({},Jv,t,e)}),AuthorityURL:au(function(t,e){var i=sm(t,e);if(i)return i.name=
t.getAttribute("name"),i;return}),Identifier:au(Nd),MetadataURL:au(function(t,e){var i=sm(t,e);if(i)return i.type=t.getAttribute("type"),i;return}),DataURL:au(sm),FeatureListURL:au(sm),Style:au(function(t,e){return gu({},rm,t,e)}),MinScaleDenominator:hu(bd),MaxScaleDenominator:hu(bd),Layer:au(function(t,e){var i=e[e.length-1],r=gu({},qv,t,e);if(!r)return;var n=Od(t.getAttribute("queryable"));void 0===n&&(n=i.queryable);r.queryable=void 0!==n&&n;var o=Ad(t.getAttribute("cascaded"));void 0===o&&(o=
i.cascaded);r.cascaded=o;var s=Od(t.getAttribute("opaque"));void 0===s&&(s=i.opaque);r.opaque=void 0!==s&&s;var a=Od(t.getAttribute("noSubsets"));void 0===a&&(a=i.noSubsets);r.noSubsets=void 0!==a&&a;var h=Md(t.getAttribute("fixedWidth"));h||(h=i.fixedWidth);r.fixedWidth=h;var l=Md(t.getAttribute("fixedHeight"));l||(l=i.fixedHeight);r.fixedHeight=l,["Style","CRS","AuthorityURL"].forEach(function(t){if(t in i){var e=r[t]||[];r[t]=e.concat(i[t])}});return["EX_GeographicBoundingBox","BoundingBox","Dimension",
"Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach(function(t){if(!(t in r)){var e=i[t];r[t]=e}}),r})}),Jv=fu(Yv,{Title:hu(Nd),OnlineResource:hu(kv),LogoURL:hu(hm)}),Qv=fu(Yv,{westBoundLongitude:hu(bd),eastBoundLongitude:hu(bd),southBoundLatitude:hu(bd),northBoundLatitude:hu(bd)}),$v=fu(Yv,{GetCapabilities:hu(am),GetMap:hu(am),GetFeatureInfo:hu(am)}),tm=fu(Yv,{Format:au(Nd),DCPType:au(function(t,e){return gu({},em,t,e)})}),em=fu(Yv,{HTTP:hu(function(t,e){return gu({},im,t,e)})}),im=
fu(Yv,{Get:hu(sm),Post:hu(sm)}),rm=fu(Yv,{Name:hu(Nd),Title:hu(Nd),Abstract:hu(Nd),LegendURL:au(hm),StyleSheetURL:hu(sm),StyleURL:hu(sm)}),nm=fu(Yv,{Format:hu(Nd),OnlineResource:hu(kv)}),om=fu(Yv,{Keyword:ou(Nd)});function sm(t,e){return gu({},nm,t,e)}function am(t,e){return gu({},tm,t,e)}function hm(t,e){var i=sm(t,e);if(i){var r=[Ad(t.getAttribute("width")),Ad(t.getAttribute("height"))];return i.size=r,i}}function lm(t,e){return gu([],om,t,e)}var um=Xv,pm=function(t){function e(e){t.call(this);
var i=e||{};this.featureNS_="http://mapserver.gis.umn.edu/mapserver",this.gmlFormat_=new Zd,this.layers_=i.layers?i.layers:null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var i=t.localName,r=[];if(0===t.childNodes.length)return r;if("msGMLOutput"==i)for(var n=
0,o=t.childNodes.length;n<o;n++){var s=t.childNodes[n];if(s.nodeType===Node.ELEMENT_NODE){var a=s,h=e[0],l=a.localName.replace("_layer","");if(!this.layers_||X(this.layers_,l)){var u=l+"_feature";h.featureType=u,h.featureNS=this.featureNS_;var p={};p[u]=ou(this.gmlFormat_.readFeatureElement,this.gmlFormat_);var c=fu([h.featureNS,null],p);a.setAttribute("namespaceURI",this.featureNS_);var d=gu([],c,a,e,this.gmlFormat_);d&&K(r,d)}}}if("FeatureCollection"==i){var f=gu([],this.gmlFormat_.FEATURE_COLLECTION_PARSERS,
t,[{}],this.gmlFormat_);f&&(r=f)}return r},e.prototype.readFeaturesFromNode=function(t,e){var i={};return e&&u(i,this.getReadOptions(t,e)),this.readFeatures_(t,[i])},e}(Td),cm=[null,"http://www.opengis.net/ows/1.1"],dm=fu(cm,{ServiceIdentification:hu(function(t,e){return gu({},wm,t,e)}),ServiceProvider:hu(function(t,e){return gu({},Im,t,e)}),OperationsMetadata:hu(function(t,e){return gu({},Sm,t,e)})}),fm=function(t){function e(){t.call(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&
t.prototype),e.prototype.constructor=e,e.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},e.prototype.readFromNode=function(t){var e=gu({},dm,t,[]);return e||null},e}(Uv),_m=fu(cm,{DeliveryPoint:hu(Nd),City:hu(Nd),AdministrativeArea:hu(Nd),PostalCode:hu(Nd),Country:hu(Nd),ElectronicMailAddress:hu(Nd)}),gm=fu(cm,{Value:au(function(t,e){return Nd(t)})}),ym=fu(cm,{AllowedValues:hu(function(t,e){return gu({},
gm,t,e)})}),vm=fu(cm,{Phone:hu(function(t,e){return gu({},Tm,t,e)}),Address:hu(function(t,e){return gu({},_m,t,e)})}),mm=fu(cm,{HTTP:hu(function(t,e){return gu({},xm,t,e)})}),xm=fu(cm,{Get:au(function(t,e){var i=kv(t);if(!i)return;return gu({href:i},Cm,t,e)}),Post:void 0}),Em=fu(cm,{DCP:hu(function(t,e){return gu({},mm,t,e)})}),Sm=fu(cm,{Operation:function(t,e){var i=t.getAttribute("name"),r=gu({},Em,t,e);if(!r)return;e[e.length-1][i]=r}}),Tm=fu(cm,{Voice:hu(Nd),Facsimile:hu(Nd)}),Cm=fu(cm,{Constraint:au(function(t,
e){var i=t.getAttribute("name");if(!i)return;return gu({name:i},ym,t,e)})}),Rm=fu(cm,{IndividualName:hu(Nd),PositionName:hu(Nd),ContactInfo:hu(function(t,e){return gu({},vm,t,e)})}),wm=fu(cm,{Abstract:hu(Nd),AccessConstraints:hu(Nd),Fees:hu(Nd),Title:hu(Nd),ServiceTypeVersion:hu(Nd),ServiceType:hu(Nd)}),Im=fu(cm,{ProviderName:hu(Nd),ProviderSite:hu(kv),ServiceContact:hu(function(t,e){return gu({},Rm,t,e)})});var Lm=fm,Om=[null,"http://www.opengis.net/wmts/1.0"],Pm=[null,"http://www.opengis.net/ows/1.1"],
bm=fu(Om,{Contents:hu(function(t,e){return gu({},Fm,t,e)})}),Mm=function(t){function e(){t.call(this),this.owsParser_=new Lm}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.readFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null},e.prototype.readFromNode=function(t){var e=t.getAttribute("version").trim(),i=this.owsParser_.readFromNode(t);return i?(i.version=
e,(i=gu(i,bm,t,[]))||null):null},e}(Uv),Fm=fu(Om,{Layer:au(function(t,e){return gu({},Am,t,e)}),TileMatrixSet:au(function(t,e){return gu({},Ym,t,e)})}),Am=fu(Om,{Style:au(function(t,e){var i=gu({},Nm,t,e);if(!i)return;var r="true"===t.getAttribute("isDefault");return i.isDefault=r,i}),Format:au(Nd),TileMatrixSetLink:au(function(t,e){return gu({},Gm,t,e)}),Dimension:au(function(t,e){return gu({},jm,t,e)}),ResourceURL:au(function(t,e){var i=t.getAttribute("format"),r=t.getAttribute("template"),n=t.getAttribute("resourceType"),
o={};i&&(o.format=i);r&&(o.template=r);n&&(o.resourceType=n);return o})},fu(Pm,{Title:hu(Nd),Abstract:hu(Nd),WGS84BoundingBox:hu(function(t,e){var i=gu([],Um,t,e);if(2!=i.length)return;return tt(i)}),Identifier:hu(Nd)})),Nm=fu(Om,{LegendURL:au(function(t,e){var i={};return i.format=t.getAttribute("format"),i.href=kv(t),i})},fu(Pm,{Title:hu(Nd),Identifier:hu(Nd)})),Gm=fu(Om,{TileMatrixSet:hu(Nd),TileMatrixSetLimits:hu(function(t,e){return gu([],Dm,t,e)})}),Dm=fu(Om,{TileMatrixLimits:ou(function(t,
e){return gu({},km,t,e)})}),km=fu(Om,{TileMatrix:hu(Nd),MinTileRow:hu(Fd),MaxTileRow:hu(Fd),MinTileCol:hu(Fd),MaxTileCol:hu(Fd)}),jm=fu(Om,{Default:hu(Nd),Value:au(Nd)},fu(Pm,{Identifier:hu(Nd)})),Um=fu(Pm,{LowerCorner:ou(Vm),UpperCorner:ou(Vm)}),Ym=fu(Om,{WellKnownScaleSet:hu(Nd),TileMatrix:au(function(t,e){return gu({},Bm,t,e)})},fu(Pm,{SupportedCRS:hu(Nd),Identifier:hu(Nd)})),Bm=fu(Om,{TopLeftCorner:hu(Vm),ScaleDenominator:hu(bd),TileWidth:hu(Fd),TileHeight:hu(Fd),MatrixWidth:hu(Fd),MatrixHeight:hu(Fd)},
fu(Pm,{Identifier:hu(Nd)}));function Vm(t,e){var i=Nd(t).split(/\s+/);if(i&&2==i.length){var r=+i[0],n=+i[1];if(!isNaN(r)&&!isNaN(n))return[r,n]}}var Xm=Mm,zm=function(){var t;return function(){if(!t){var e=document.body;e.webkitRequestFullscreen?t="webkitfullscreenchange":e.mozRequestFullScreen?t="mozfullscreenchange":e.msRequestFullscreen?t="MSFullscreenChange":e.requestFullscreen&&(t="fullscreenchange")}return t}}();function Wm(){var t=document.body;return!!(t.webkitRequestFullscreen||t.mozRequestFullScreen&&
document.mozFullScreenEnabled||t.msRequestFullscreen&&document.msFullscreenEnabled||t.requestFullscreen&&document.fullscreenEnabled)}function Km(){return!!(document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement||document.fullscreenElement)}function Hm(t){t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}var Zm=function(t){function e(e){var i=
e||{};t.call(this,{element:document.createElement("div"),target:i.target}),this.cssClassName_=void 0!==i.className?i.className:"ol-full-screen";var r=void 0!==i.label?i.label:"\u2922";this.labelNode_="string"==typeof r?document.createTextNode(r):r;var n=void 0!==i.labelActive?i.labelActive:"\u00d7";this.labelActiveNode_="string"==typeof n?document.createTextNode(n):n,this.button_=document.createElement("button");var o=i.tipLabel?i.tipLabel:"Toggle full-screen";this.setClassName_(this.button_,Km()),
this.button_.setAttribute("type","button"),this.button_.title=o,this.button_.appendChild(this.labelNode_),v(this.button_,M.CLICK,this.handleClick_,this);var s=this.cssClassName_+" "+fo+" "+go+" "+(Wm()?"":_o),a=this.element;a.className=s,a.appendChild(this.button_),this.keys_=void 0!==i.keys&&i.keys,this.source_=i.source}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t){t.preventDefault(),this.handleFullScreen_()},e.prototype.handleFullScreen_=
function(){if(Wm()){var t,e=this.getMap();if(e)if(Km())document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen();else t=this.source_?"string"==typeof this.source_?document.getElementById(this.source_):this.source_:e.getTargetElement(),this.keys_?function(t){t.mozRequestFullScreenWithKeys?t.mozRequestFullScreenWithKeys():t.webkitRequestFullscreen?
t.webkitRequestFullscreen():Hm(t)}(t):Hm(t)}},e.prototype.handleFullScreenChange_=function(){var t=this.getMap();Km()?(this.setClassName_(this.button_,!0),Qn(this.labelActiveNode_,this.labelNode_)):(this.setClassName_(this.button_,!1),Qn(this.labelNode_,this.labelActiveNode_)),t&&t.updateSize()},e.prototype.setClassName_=function(t,e){var i=this.cssClassName_+"-true",r=this.cssClassName_+"-false",n=e?i:r;t.classList.remove(i),t.classList.remove(r),t.classList.add(n)},e.prototype.setMap=function(e){t.prototype.setMap.call(this,
e),e&&this.listenerKeys.push(v(document,zm(),this.handleFullScreenChange_,this))},e}(uo),qm="projection";function Jm(t){var e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}var Qm=function(t){function e(e){var i=e||{},r=document.createElement("div");r.className=void 0!==i.className?i.className:"ol-mouse-position",t.call(this,{element:r,render:i.render||Jm,target:i.target}),v(this,G(qm),this.handleProjectionChanged_,
this),i.coordinateFormat&&this.setCoordinateFormat(i.coordinateFormat),i.projection&&this.setProjection(i.projection),this.undefinedHTML_=void 0!==i.undefinedHTML?i.undefinedHTML:"\x26#160;",this.renderOnMouseOut_=!!this.undefinedHTML_,this.renderedHTML_=r.innerHTML,this.mapProjection_=null,this.transform_=null,this.lastMouseMovePixel_=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleProjectionChanged_=function(){this.transform_=
null},e.prototype.getCoordinateFormat=function(){return this.get("coordinateFormat")},e.prototype.getProjection=function(){return this.get(qm)},e.prototype.handleMouseMove=function(t){var e=this.getMap();this.lastMouseMovePixel_=e.getEventPixel(t),this.updateHTML_(this.lastMouseMovePixel_)},e.prototype.handleMouseOut=function(t){this.updateHTML_(null),this.lastMouseMovePixel_=null},e.prototype.setMap=function(e){if(t.prototype.setMap.call(this,e),e){var i=e.getViewport();this.listenerKeys.push(v(i,
M.MOUSEMOVE,this.handleMouseMove,this),v(i,M.TOUCHSTART,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(v(i,M.MOUSEOUT,this.handleMouseOut,this),v(i,M.TOUCHEND,this.handleMouseOut,this))}},e.prototype.setCoordinateFormat=function(t){this.set("coordinateFormat",t)},e.prototype.setProjection=function(t){this.set(qm,Ee(t))},e.prototype.updateHTML_=function(t){var e=this.undefinedHTML_;if(t&&this.mapProjection_){if(!this.transform_){var i=this.getProjection();this.transform_=
i?Le(this.mapProjection_,i):me}var r=this.getMap().getCoordinateFromPixel(t);if(r){this.transform_(r,r);var n=this.getCoordinateFormat();e=n?n(r):r.toString()}}this.renderedHTML_&&e===this.renderedHTML_||(this.element.innerHTML=e,this.renderedHTML_=e)},e}(uo);function $m(t){this.validateExtent_(),this.updateBox_()}var tx=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),render:i.render||$m,target:i.target}),this.collapsed_=void 0===i.collapsed||i.collapsed,this.collapsible_=
void 0===i.collapsible||i.collapsible,this.collapsible_||(this.collapsed_=!1);var r=void 0!==i.className?i.className:"ol-overviewmap",n=void 0!==i.tipLabel?i.tipLabel:"Overview map",o=void 0!==i.collapseLabel?i.collapseLabel:"\u00ab";"string"==typeof o?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o):this.collapseLabel_=o;var s=void 0!==i.label?i.label:"\u00bb";"string"==typeof s?(this.label_=document.createElement("span"),this.label_.textContent=s):this.label_=
s;var a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,h=document.createElement("button");h.setAttribute("type","button"),h.title=n,h.appendChild(a),v(h,M.CLICK,this.handleClick_,this),this.ovmapDiv_=document.createElement("div"),this.ovmapDiv_.className="ol-overviewmap-map",this.ovmap_=new Ha({controls:new U,interactions:new U,view:i.view});var l=this.ovmap_;i.layers&&i.layers.forEach(function(t){l.addLayer(t)}.bind(this));var u=document.createElement("div");u.className="ol-overviewmap-box",
u.style.boxSizing="border-box",this.boxOverlay_=new Ja({position:[0,0],positioning:Za.BOTTOM_LEFT,element:u}),this.ovmap_.addOverlay(this.boxOverlay_);var p=r+" "+fo+" "+go+(this.collapsed_&&this.collapsible_?" "+yo:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=p,c.appendChild(this.ovmapDiv_),c.appendChild(h);var d=this,f=this.boxOverlay_,_=this.boxOverlay_.getElement(),g=function(t){var e=function(t){return{clientX:t.clientX-_.offsetWidth/2,clientY:t.clientY+_.offsetHeight/
2}}(t),i=l.getEventCoordinate(e);f.setPosition(i)},y=function(t){var e=l.getEventCoordinate(t);d.getMap().getView().setCenter(e),window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",y)};_.addEventListener("mousedown",function(){window.addEventListener("mousemove",g),window.addEventListener("mouseup",y)})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setMap=function(e){var i=this.getMap();if(e!==i){if(i){var r=i.getView();
r&&this.unbindView_(r),this.ovmap_.setTarget(null)}if(t.prototype.setMap.call(this,e),e){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(v(e,l,this.handleMapPropertyChange_,this)),0===this.ovmap_.getLayers().getLength()&&this.ovmap_.setLayerGroup(e.getLayerGroup());var n=e.getView();n&&(this.bindView_(n),n.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_()))}}},e.prototype.handleMapPropertyChange_=function(t){if(t.key===Ln.VIEW){var e=t.oldValue;e&&this.unbindView_(e);var i=this.getMap().getView();
this.bindView_(i)}},e.prototype.bindView_=function(t){v(t,G(Bn),this.handleRotationChanged_,this)},e.prototype.unbindView_=function(t){x(t,G(Bn),this.handleRotationChanged_,this)},e.prototype.handleRotationChanged_=function(){this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},e.prototype.validateExtent_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),r=t.getView().calculateExtent(i),n=e.getSize(),o=e.getView().calculateExtent(n),
s=e.getPixelFromCoordinate(It(r)),a=e.getPixelFromCoordinate(St(r)),h=Math.abs(s[0]-a[0]),l=Math.abs(s[1]-a[1]),u=n[0],p=n[1];h<.1*u||l<.1*p||h>.75*u||l>.75*p?this.resetExtent_():ot(o,r)||this.recenter_()}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getSize(),r=t.getView().calculateExtent(i),n=e.getView(),o=Math.log(7.5)/Math.LN2;Mt(r,1/(.1*Math.pow(2,o/2))),n.fit(r)},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenter(i.getCenter())},
e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),r=t.getView(),n=e.getView(),o=r.getRotation(),s=this.boxOverlay_,a=this.boxOverlay_.getElement(),h=r.calculateExtent(i),l=n.getResolution(),u=Et(h),p=Lt(h),c=this.calculateCoordinateRotate_(o,u);s.setPosition(c),a&&(a.style.width=Math.abs((u[0]-p[0])/l)+"px",a.style.height=Math.abs((p[1]-u[1])/l)+"px")}},e.prototype.calculateCoordinateRotate_=function(t,e){var i,r=this.getMap().getView().getCenter();
return r&&($i(i=[e[0]-r[0],e[1]-r[1]],t),Hi(i,r)),i},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle(yo),this.collapsed_?Qn(this.collapseLabel_,this.label_):Qn(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;this.collapsed_||t.isRendered()||(t.updateSize(),this.resetExtent_(),m(t,Rn,function(t){this.updateBox_()},this))},e.prototype.getCollapsible=function(){return this.collapsible_},
e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getOverviewMap=function(){return this.ovmap_},e}(uo),ex="units",ix={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",US:"us"},rx=
[1,2,5];function nx(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var ox=function(t){function e(e){var i=e||{},r=void 0!==i.className?i.className:"ol-scale-line";t.call(this,{element:document.createElement("div"),render:i.render||nx,target:i.target}),this.innerElement_=document.createElement("div"),this.innerElement_.className=r+"-inner",this.element.className=r+" "+fo,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==i.minWidth?
i.minWidth:64,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",v(this,G(ex),this.handleUnitsChanged_,this),this.setUnits(i.units||ix.METRIC)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getUnits=function(){return this.get(ex)},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set(ex,t)},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,
i=t.projection,r=this.getUnits(),n=r==ix.DEGREES?$t.DEGREES:$t.METERS,o=Se(i,t.resolution,e,n);i.getUnits()!=$t.DEGREES&&i.getMetersPerUnit()&&n==$t.METERS&&(o*=i.getMetersPerUnit());var s=this.minWidth_*o,a="";if(r==ix.DEGREES){var h=Qt[$t.DEGREES];i.getUnits()==$t.DEGREES?s*=h:o/=h,s<h/60?(a="\u2033",o*=3600):s<h?(a="\u2032",o*=60):a="\u00b0"}else r==ix.IMPERIAL?s<.9144?(a="in",o/=.0254):s<1609.344?(a="ft",o/=.3048):(a="mi",o/=1609.344):r==ix.NAUTICAL?(o/=1852,a="nm"):r==ix.METRIC?s<.001?(a="\u03bcm",
o*=1E6):s<1?(a="mm",o*=1E3):s<1E3?a="m":(a="km",o/=1E3):r==ix.US?s<.9144?(a="in",o*=39.37):s<1609.344?(a="ft",o/=.30480061):(a="mi",o/=1609.3472):Y(!1,33);for(var l,u,p=3*Math.floor(Math.log(this.minWidth_*o)/Math.log(10));;){if(l=rx[(p%3+3)%3]*Math.pow(10,Math.floor(p/3)),u=Math.round(l/o),isNaN(u))return this.element.style.display="none",void(this.renderedVisible_=!1);if(u>=this.minWidth_)break;++p}var c=l+" "+a;this.renderedHTML_!=c&&(this.innerElement_.innerHTML=c,this.renderedHTML_=c),this.renderedWidth_!=
u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e}(uo),sx={VERTICAL:0,HORIZONTAL:1};function ax(t){if(t.frameState){this.sliderInitialized_||this.initSlider_();var e=t.frameState.viewState.resolution;e!==this.currentResolution_&&(this.currentResolution_=e,this.setThumbPosition_(e))}}var hx=function(t){function e(e){var i=
e||{};t.call(this,{element:document.createElement("div"),render:i.render||ax}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=sx.VERTICAL,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.previousX_,this.previousY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==i.duration?i.duration:200;var r=void 0!==i.className?i.className:"ol-zoomslider",n=document.createElement("button");n.setAttribute("type","button"),n.className=r+"-thumb "+fo;var o=
this.element;o.className=r+" "+fo+" "+go,o.appendChild(n),this.dragger_=new Tn(o),v(this.dragger_,Gr.POINTERDOWN,this.handleDraggerStart_,this),v(this.dragger_,Gr.POINTERMOVE,this.handleDraggerDrag_,this),v(this.dragger_,Gr.POINTERUP,this.handleDraggerEnd_,this),v(o,M.CLICK,this.handleContainerClick_,this),v(n,M.CLICK,O)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.disposeInternal=function(){this.dragger_.dispose(),t.prototype.disposeInternal.call(this)},
e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,i=t.offsetHeight,r=t.firstElementChild,n=getComputedStyle(r),o=r.offsetWidth+parseFloat(n.marginRight)+parseFloat(n.marginLeft),s=r.offsetHeight+parseFloat(n.marginTop)+parseFloat(n.marginBottom);this.thumbSize_=[o,s],e>i?(this.direction_=sx.HORIZONTAL,this.widthLimit_=e-o):(this.direction_=sx.VERTICAL,this.heightLimit_=i-s),this.sliderInitialized_=!0},
e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),r=this.getResolutionForPosition_(i);e.animate({resolution:e.constrainResolution(r),duration:this.duration_,easing:Xn})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.originalEvent.target===this.element.firstElementChild&&(this.getMap().getView().setHint(jn,1),this.previousX_=t.clientX,this.previousY_=t.clientY,this.dragging_=
!0,0===this.dragListenerKeys_.length)){var e=this.handleDraggerDrag_,i=this.handleDraggerEnd_;this.dragListenerKeys_.push(v(document,M.MOUSEMOVE,e,this),v(document,Gr.POINTERMOVE,e,this),v(document,M.MOUSEUP,i,this),v(document,Gr.POINTERUP,i,this))}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=this.element.firstElementChild,i=t.clientX-this.previousX_+parseFloat(e.style.left),r=t.clientY-this.previousY_+parseFloat(e.style.top),n=this.getRelativePosition_(i,r);this.currentResolution_=
this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_),this.setThumbPosition_(this.currentResolution_),this.previousX_=t.clientX,this.previousY_=t.clientY}},e.prototype.handleDraggerEnd_=function(t){if(this.dragging_){var e=this.getMap().getView();e.setHint(jn,-1),e.animate({resolution:e.constrainResolution(this.currentResolution_),duration:this.duration_,easing:Xn}),this.dragging_=!1,this.previousX_=void 0,this.previousY_=void 0,this.dragListenerKeys_.forEach(E),
this.dragListenerKeys_.length=0}},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==sx.HORIZONTAL?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return kt(this.direction_===sx.HORIZONTAL?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-
t)},e.prototype.getPositionForResolution_=function(t){return 1-this.getMap().getView().getValueForResolutionFunction()(t)},e}(uo),lx=function(t){function e(e){var i=e||{};t.call(this,{element:document.createElement("div"),target:i.target}),this.extent=i.extent?i.extent:null;var r=void 0!==i.className?i.className:"ol-zoom-extent",n=void 0!==i.label?i.label:"E",o=void 0!==i.tipLabel?i.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=o,s.appendChild("string"==
typeof n?document.createTextNode(n):n),v(s,M.CLICK,this.handleClick_,this);var a=r+" "+fo+" "+go,h=this.element;h.className=a,h.appendChild(s)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fit(e)},e}(uo),ux={array:{},color:{},colorlike:{},control:{},
coordinate:{},easing:{},events:{}};ux.events.condition={},ux.extent={},ux.featureloader={},ux.format={},ux.format.filter={},ux.geom={},ux.has={},ux.interaction={},ux.layer={},ux.loadingstrategy={},ux.proj={},ux.proj.Units={},ux.proj.proj4={},ux.render={},ux.render.canvas={},ux.renderer={},ux.renderer.canvas={},ux.renderer.webgl={},ux.size={},ux.source={},ux.sphere={},ux.style={},ux.style.IconImageCache={},ux.tilegrid={},ux.xml={},ux.Collection=U,ux.Feature=B,ux.Geolocation=zi,ux.Graticule=Or,ux.Kinetic=
br,ux.Map=Ha,ux.Object=D,ux.Observable=F,ux.Observable.unByKey=function(t){if(Array.isArray(t))for(var e=0,i=t.length;e<i;++e)E(t[e]);else E(t)},ux.Overlay=Ja,ux.PluggableMap=lo,ux.View=qn,ux.WebGLMap=Kl,ux.array.stableSort=q,ux.color.asArray=_r,ux.color.asString=dr,ux.colorlike.asColorLike=Ys,ux.control.Attribution=So,ux.control.Attribution.render=Eo,ux.control.Control=uo,ux.control.FullScreen=Zm,ux.control.MousePosition=Qm,ux.control.MousePosition.render=Jm,ux.control.OverviewMap=tx,ux.control.OverviewMap.render=
$m,ux.control.Rotate=Co,ux.control.Rotate.render=To,ux.control.ScaleLine=ox,ux.control.ScaleLine.render=nx,ux.control.Zoom=Ro,ux.control.ZoomSlider=hx,ux.control.ZoomSlider.render=ax,ux.control.ZoomToExtent=lx,ux.control.defaults=wo,ux.coordinate.add=Hi,ux.coordinate.createStringXY=function(t){return function(e){return nr(e,t)}},ux.coordinate.format=Ji,ux.coordinate.rotate=$i,ux.coordinate.toStringHDMS=function(t,e){return t?qi("NS",t[1],e)+" "+qi("EW",t[0],e):""},ux.coordinate.toStringXY=nr,ux.easing.easeIn=
Vn,ux.easing.easeOut=Xn,ux.easing.inAndOut=zn,ux.easing.linear=Wn,ux.easing.upAndDown=function(t){return t<.5?zn(2*t):1-zn(2*(t-.5))},ux.events.condition.altKeyOnly=Go,ux.events.condition.altShiftKeysOnly=Do,ux.events.condition.always=jo,ux.events.condition.click=function(t){return t.type==Ar.CLICK},ux.events.condition.doubleClick=function(t){return t.type==Ar.DBLCLICK},ux.events.condition.focus=ko,ux.events.condition.mouseOnly=Ko,ux.events.condition.never=Yo,ux.events.condition.noModifierKeys=Xo,
ux.events.condition.platformModifierKeyOnly=function(t){var e=t.originalEvent;return!e.altKey&&(Gi?e.metaKey:e.ctrlKey)&&!e.shiftKey},ux.events.condition.pointerMove=Bo,ux.events.condition.primaryAction=Ho,ux.events.condition.shiftKeyOnly=zo,ux.events.condition.singleClick=Vo,ux.events.condition.targetNotEditable=Wo,ux.extent.applyTransform=Ft,ux.extent.boundingExtent=tt,ux.extent.buffer=et,ux.extent.containsCoordinate=nt,ux.extent.containsExtent=ot,ux.extent.containsXY=st,ux.extent.createEmpty=ht,
ux.extent.equals=dt,ux.extent.extend=ft,ux.extent.getArea=xt,ux.extent.getBottomLeft=Et,ux.extent.getBottomRight=St,ux.extent.getCenter=Tt,ux.extent.getHeight=Rt,ux.extent.getIntersection=wt,ux.extent.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]},ux.extent.getTopLeft=It,ux.extent.getTopRight=Lt,ux.extent.getWidth=Ot,ux.extent.intersects=Pt,ux.extent.isEmpty=bt,ux.featureloader.xhr=ql,ux.format.EsriJSON=Sd,ux.format.Feature=cd,ux.format.GML=zd,ux.format.GML2=Zd,ux.format.GML3=Vd,ux.format.GML32=
Jd,ux.format.GPX=Ff,ux.format.GeoJSON=Gf,ux.format.IGC=Jf,ux.format.KML=Bg,ux.format.MVT=Qg,ux.format.OSMXML=oy,ux.format.Polyline=cy,ux.format.Polyline.decodeDeltas=hy,ux.format.Polyline.decodeFloats=uy,ux.format.Polyline.encodeDeltas=ay,ux.format.Polyline.encodeFloats=ly,ux.format.TopoJSON=my,ux.format.WFS=gv,ux.format.WFS.writeFilter=function(t){var e=tu(Qy,"Filter");return lv(e,t,[]),e},ux.format.WKT=Gv,ux.format.WMSCapabilities=um,ux.format.WMSGetFeatureInfo=pm,ux.format.WMTSCapabilities=Xm,
ux.format.filter.Bbox=Cy,ux.format.filter.Contains=wy,ux.format.filter.During=Ly,ux.format.filter.EqualTo=Py,ux.format.filter.GreaterThan=by,ux.format.filter.GreaterThanOrEqualTo=My,ux.format.filter.Intersects=Fy,ux.format.filter.IsBetween=Ay,ux.format.filter.IsLike=Ny,ux.format.filter.IsNull=Gy,ux.format.filter.LessThan=Dy,ux.format.filter.LessThanOrEqualTo=ky,ux.format.filter.Not=jy,ux.format.filter.NotEqualTo=Uy,ux.format.filter.Or=Yy,ux.format.filter.Within=By,ux.format.filter.and=Vy,ux.format.filter.bbox=
Xy,ux.format.filter.between=function(t,e,i){return new Ay(t,e,i)},ux.format.filter.contains=function(t,e,i){return new wy(t,e,i)},ux.format.filter.during=function(t,e,i){return new Ly(t,e,i)},ux.format.filter.equalTo=function(t,e,i){return new Py(t,e,i)},ux.format.filter.greaterThan=function(t,e){return new by(t,e)},ux.format.filter.greaterThanOrEqualTo=function(t,e){return new My(t,e)},ux.format.filter.intersects=function(t,e,i){return new Fy(t,e,i)},ux.format.filter.isNull=function(t){return new Gy(t)},
ux.format.filter.lessThan=function(t,e){return new Dy(t,e)},ux.format.filter.lessThanOrEqualTo=function(t,e){return new ky(t,e)},ux.format.filter.like=function(t,e,i,r,n,o){return new Ny(t,e,i,r,n,o)},ux.format.filter.not=function(t){return new jy(t)},ux.format.filter.notEqualTo=function(t,e,i){return new Uy(t,e,i)},ux.format.filter.or=function(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new (Function.prototype.bind.apply(Yy,e))},ux.format.filter.within=function(t,e,i){return new By(t,
e,i)},ux.geom.Circle=Oc,ux.geom.Geometry=Xe,ux.geom.GeometryCollection=ud,ux.geom.LineString=hr,ux.geom.LinearRing=pi,ux.geom.MultiLineString=Pc,ux.geom.MultiPoint=bc,ux.geom.MultiPolygon=Fc,ux.geom.Point=ci,ux.geom.Polygon=Ii,ux.geom.Polygon.circular=Li,ux.geom.Polygon.fromCircle=Pi,ux.geom.Polygon.fromExtent=Oi,ux.geom.SimpleGeometry=We,ux.getUid=o,ux.has.DEVICE_PIXEL_RATIO=Di,ux.has.GEOLOCATION=ji,ux.has.TOUCH=Ui,ux.inherits=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=
t},ux.interaction.DoubleClickZoom=No,ux.interaction.DragAndDrop=wc,ux.interaction.DragBox=ns,ux.interaction.DragPan=Jo,ux.interaction.DragRotate=Qo,ux.interaction.DragRotateAndZoom=Ic,ux.interaction.DragZoom=ss,ux.interaction.Draw=kc,ux.interaction.Draw.createBox=function(){return function(t,e){var i=tt(t),r=[[Et(i),St(i),Lt(i),It(i),Et(i)]],n=e;return n?n.setCoordinates(r):n=new Ii(r),n}},ux.interaction.Draw.createRegularPolygon=function(t,e){return function(i,r){var n=i[0],o=i[1],s=Math.sqrt(er(n,
o)),a=r||Pi(new Oc(n),t),h=e;if(!e){var l=o[0]-n[0],u=o[1]-n[1];h=Math.atan(u/l)-(l<0?Math.PI:0)}return bi(a,n,s,h),a}},ux.interaction.Extent=Vc,ux.interaction.Interaction=Fo,ux.interaction.KeyboardPan=ls,ux.interaction.KeyboardZoom=ps,ux.interaction.Modify=Jc,ux.interaction.MouseWheelZoom=fs,ux.interaction.PinchRotate=_s,ux.interaction.PinchZoom=gs,ux.interaction.Pointer=qo,ux.interaction.Select=ed,ux.interaction.Snap=rd,ux.interaction.Translate=hd,ux.interaction.defaults=ys,ux.layer.Base=io,ux.layer.Group=
oo,ux.layer.Heatmap=mc,ux.layer.Image=bp,ux.layer.Tile=Np,ux.layer.Vector=gc,ux.layer.VectorTile=Ec,ux.loadingstrategy.all=Jl,ux.loadingstrategy.bbox=function(t,e){return[t]},ux.loadingstrategy.tile=function(t){return function(e,i){var r=t.getZForResolution(i),n=t.getTileRangeForExtentAndZ(e,r),o=[],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])o.push(t.getTileCoordExtent(s));return o}},ux.proj.Projection=ee,ux.proj.Units.METERS_PER_UNIT=Qt,ux.proj.addCoordinateTransforms=
we,ux.proj.addEquivalentProjections=Te,ux.proj.addProjection=xe,ux.proj.equivalent=Ie,ux.proj.fromLonLat=function(t,e){return Pe(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")},ux.proj.get=Ee,ux.proj.getPointResolution=Se,ux.proj.getTransform=Oe,ux.proj.proj4.register=function(t){var e,i,r=Object.keys(t.defs),n=r.length;for(e=0;e<n;++e){var o=r[e];if(!Ee(o)){var s=t.defs(o);xe(new ee({code:o,axisOrientation:s.axis,metersPerUnit:s.to_meter,units:s.units}))}}for(e=0;e<n;++e){var a=r[e],h=Ee(a);for(i=0;i<n;++i){var l=
r[i],u=Ee(l);if(!ye(a,l))if(t.defs[a]===t.defs[l])Te([h,u]);else{var p=t(a,l);we(h,u,p.forward,p.inverse)}}}},ux.proj.toLonLat=function(t,e){var i=Pe(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),r=i[0];return(r<-180||r>180)&&(i[0]=Xt(r+180,360)-180),i},ux.proj.transform=Pe,ux.proj.transformExtent=be,ux.render.VectorContext=Vs,ux.render.canvas.labelCache=Ps,ux.render.toContext=function(t,e){var i=t.canvas,r=e||{},n=r.pixelRatio||Di,o=r.size;o&&(i.width=o[0]*n,i.height=o[1]*n,i.style.width=o[0]+"px",i.style.height=
o[1]+"px");var s=[0,0,i.width,i.height],a=je([1,0,0,1,0,0],n,n);return new Xs(t,n,s,a,0)},ux.renderer.canvas.ImageLayer=ra,ux.renderer.canvas.Map=Qs,ux.renderer.canvas.TileLayer=ha,ux.renderer.canvas.VectorLayer=Ba,ux.renderer.canvas.VectorTileLayer=Ka,ux.renderer.webgl.ImageLayer=gl,ux.renderer.webgl.Map=yl,ux.renderer.webgl.TileLayer=Xl,ux.renderer.webgl.VectorLayer=Wl,ux.size.toSize=ho,ux.source.BingMaps=tp,ux.source.CartoDB=ip,ux.source.Cluster=sp,ux.source.Image=dp,ux.source.ImageArcGISRest=
gp,ux.source.ImageCanvas=yp,ux.source.ImageMapGuide=vp,ux.source.ImageStatic=mp,ux.source.ImageWMS=wp,ux.source.OSM=Lp,ux.source.OSM.ATTRIBUTION=Ip,ux.source.Raster=Vp,ux.source.Source=Il,ux.source.Stamen=Kp,ux.source.Tile=jl,ux.source.TileArcGISRest=Zp,ux.source.TileDebug=Jp,ux.source.TileImage=$u,ux.source.TileJSON=Qp,ux.source.TileWMS=tc,ux.source.UTFGrid=ic,ux.source.Vector=op,ux.source.VectorTile=ac,ux.source.WMTS=lc,ux.source.WMTS.optionsFromCapabilities=function(t,e){var i=H(t.Contents.Layer,
function(t,i,r){return t.Identifier==e.layer});if(null===i)return null;var r,n=t.Contents.TileMatrixSet;(r=i.TileMatrixSetLink.length>1?J(i.TileMatrixSetLink,"projection"in e?function(t,i,r){var o=H(n,function(e){return e.Identifier==t.TileMatrixSet}).SupportedCRS,s=Ee(o.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ee(o),a=Ee(e.projection);return s&&a?Ie(s,a):o==e.projection}:function(t,i,r){return t.TileMatrixSet==e.matrixSet}):0)<0&&(r=0);var o=i.TileMatrixSetLink[r].TileMatrixSet,s=
i.TileMatrixSetLink[r].TileMatrixSetLimits,a=i.Format[0];"format"in e&&(a=e.format),(r=J(i.Style,function(t,i,r){return"style"in e?t.Title==e.style:t.isDefault}))<0&&(r=0);var h=i.Style[r].Identifier,l={};"Dimension"in i&&i.Dimension.forEach(function(t,e,i){var r=t.Identifier,n=t.Default;void 0===n&&(n=t.Value[0]),l[r]=n});var u,p=H(t.Contents.TileMatrixSet,function(t,e,i){return t.Identifier==o}),c=p.SupportedCRS;if(c&&(u=Ee(c.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"))||Ee(c)),"projection"in
e){var d=Ee(e.projection);d&&(u&&!Ie(d,u)||(u=d))}var f,_,g=i.WGS84BoundingBox;if(void 0!==g){var y=Ee("EPSG:4326").getExtent();_=g[0]==y[0]&&g[2]==y[2],f=be(g,"EPSG:4326",u);var v=u.getExtent();v&&(ot(v,f)||(f=void 0))}var m=Eu(p,f,s),x=[],E=e.requestEncoding;if(E=void 0!==E?E:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var S=t.OperationsMetadata.GetTile.DCP.HTTP.Get,T=0,C=S.length;T<C;++T)if(S[T].Constraint){var R=H(S[T].Constraint,function(t){return"GetEncoding"==t.name}).AllowedValues.Value;
if(""===E&&(E=R[0]),E!==hc.KVP)break;X(R,hc.KVP)&&x.push(S[T].href)}else S[T].href&&(E=hc.KVP,x.push(S[T].href));return 0===x.length&&(E=hc.REST,i.ResourceURL.forEach(function(t){"tile"===t.resourceType&&(a=t.format,x.push(t.template))})),{urls:x,layer:e.layer,matrixSet:o,format:a,projection:u,requestEncoding:E,tileGrid:m,style:h,dimensions:l,wrapX:_,crossOrigin:e.crossOrigin}},ux.source.XYZ=ep,ux.source.Zoomify=dc,ux.sphere.getArea=function t(e,i){var r=i||{},n=r.radius||Wt,o=r.projection||"EPSG:3857",
s=e.getType();s!==Nt.GEOMETRY_COLLECTION&&(e=e.clone().transform(o,"EPSG:4326"));var a,h,l,u,p,c,d=0;switch(s){case Nt.POINT:case Nt.MULTI_POINT:case Nt.LINE_STRING:case Nt.MULTI_LINE_STRING:case Nt.LINEAR_RING:break;case Nt.POLYGON:for(a=e.getCoordinates(),d=Math.abs(Zt(a[0],n)),l=1,u=a.length;l<u;++l)d-=Math.abs(Zt(a[l],n));break;case Nt.MULTI_POLYGON:for(l=0,u=(a=e.getCoordinates()).length;l<u;++l)for(h=a[l],d+=Math.abs(Zt(h[0],n)),p=1,c=h.length;p<c;++p)d-=Math.abs(Zt(h[p],n));break;case Nt.GEOMETRY_COLLECTION:var f=
e.getGeometries();for(l=0,u=f.length;l<u;++l)d+=t(f[l],i);break;default:throw new Error("Unsupported geometry type: "+s);}return d},ux.sphere.getDistance=Kt,ux.sphere.getLength=function t(e,i){var r=i||{},n=r.radius||Wt,o=r.projection||"EPSG:3857",s=e.getType();s!==Nt.GEOMETRY_COLLECTION&&(e=e.clone().transform(o,"EPSG:4326"));var a,h,l,u,p,c,d=0;switch(s){case Nt.POINT:case Nt.MULTI_POINT:break;case Nt.LINE_STRING:case Nt.LINEAR_RING:d=Ht(a=e.getCoordinates(),n);break;case Nt.MULTI_LINE_STRING:case Nt.POLYGON:for(l=
0,u=(a=e.getCoordinates()).length;l<u;++l)d+=Ht(a[l],n);break;case Nt.MULTI_POLYGON:for(l=0,u=(a=e.getCoordinates()).length;l<u;++l)for(p=0,c=(h=a[l]).length;p<c;++p)d+=Ht(h[p],n);break;case Nt.GEOMETRY_COLLECTION:var f=e.getGeometries();for(l=0,u=f.length;l<u;++l)d+=t(f[l],i);break;default:throw new Error("Unsupported geometry type: "+s);}return d},ux.style.AtlasManager=ol,ux.style.Circle=Ru,ux.style.Fill=mr,ux.style.Icon=Ou,ux.style.IconImageCache.shared=Ks,ux.style.Image=Tu,ux.style.RegularShape=
Cu,ux.style.Stroke=Er,ux.style.Style=Nu,ux.style.Text=Rr,ux.tilegrid.TileGrid=Pl,ux.tilegrid.WMTS=xu,ux.tilegrid.WMTS.createFromCapabilitiesMatrixSet=Eu,ux.tilegrid.createXYZ=Fl,ux.xml.getAllTextContent=eu,ux.xml.parse=ru;e.default=ux}]).default});
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.proj4=s()}(this,function(){function t(t,s){if(t[s])return t[s];for(var i,a=Object.keys(t),h=s.toLowerCase().replace(dt,""),e=-1;++e<a.length;)if(i=a[e],i.toLowerCase().replace(dt,"")===h)return t[i]}function s(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,
this.state=_t}function i(t){return(new s(t)).output()}function a(t,s,i){Array.isArray(s)&&(i.unshift(s),s=null);var a=s?{}:t,e=i.reduce(function(t,s){return h(s,t),t},a);s&&(t[s]=e)}function h(t,s){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(s[i]={},void h(t[0],s[i])):void(s[i]=t[0]);if(t.length)if("TOWGS84"!==i){Array.isArray(i)||(s[i]={});var e;switch(i){case "UNIT":case "PRIMEM":case "VERT_DATUM":return s[i]={name:t[0].toLowerCase(),
convert:t[1]},void(3===t.length&&h(t[2],s[i]));case "SPHEROID":case "ELLIPSOID":return s[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&h(t[3],s[i]));case "PROJECTEDCRS":case "PROJCRS":case "GEOGCS":case "GEOCCS":case "PROJCS":case "LOCAL_CS":case "GEODCRS":case "GEODETICCRS":case "GEODETICDATUM":case "EDATUM":case "ENGINEERINGDATUM":case "VERT_CS":case "VERTCRS":case "VERTICALCRS":case "COMPD_CS":case "COMPOUNDCRS":case "ENGINEERINGCRS":case "ENGCRS":case "FITTED_CS":case "LOCAL_DATUM":case "DATUM":return t[0]=
["name",t[0]],void a(s,i,t);default:for(e=-1;++e<t.length;)if(!Array.isArray(t[e]))return h(t,s[i]);return a(s,i,t)}}else s[i]=t;else s[i]=!0}else s[t]=!0}function e(t,s){var i=s[0],a=s[1];!(i in t)&&a in t&&(t[i]=t[a],3===s.length&&(t[i]=s[2](t[i])))}function n(t){return t*At}function r(t){function s(s){return s*(t.to_meter||1)}"GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=
t.PROJECTION,t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var i=t.GEOGCS;"GEOGCS"===t.type&&(i=t),i&&(i.DATUM?t.datumCode=i.DATUM.name.toLowerCase():t.datumCode=i.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_geodetic_datum_1949"!==t.datumCode&&"new_zealand_1949"!==t.datumCode||
(t.datumCode="nzgd49"),"wgs_1984"===t.datumCode&&("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),i.DATUM&&i.DATUM.SPHEROID&&(t.ellps=i.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),
t.a=i.DATUM.SPHEROID.a,t.rf=parseFloat(i.DATUM.SPHEROID.rf,10)),i.DATUM&&i.DATUM.TOWGS84&&(t.datum_params=i.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a);[["standard_parallel_1","Standard_Parallel_1"],
["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",n],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],
["longc","longitude_of_center",n],["x0","false_easting",s],["y0","false_northing",s],["long0","central_meridian",n],["lat0","latitude_of_origin",n],["lat0","standard_parallel_1",n],["lat1","standard_parallel_1",n],["lat2","standard_parallel_2",n],["azimuth","Azimuth"],["alpha","azimuth",n],["srsCode","name"]].forEach(function(s){return e(t,s)}),t.long0||!t.longc||"Albers_Conic_Equal_Area"!==t.projName&&"Lambert_Azimuthal_Equal_Area"!==t.projName||(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==
t.projName&&"Polar Stereographic (variant B)"!==t.projName||(t.lat0=n(t.lat1>0?90:-90),t.lat_ts=t.lat1)}function o(t){var s=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?o[t]=yt(arguments[1]):o[t]=Ct(arguments[1]):o[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?o.apply(s,t):o(t)});if("string"==typeof t){if(t in o)return o[t]}else"EPSG"in t?o["EPSG:"+t.EPSG]=t:"ESRI"in t?o["ESRI:"+t.ESRI]=t:"IAU2000"in t?o["IAU2000:"+
t.IAU2000]=t:console.log(t);return}}function l(t){return"string"==typeof t}function M(t){return t in o}function c(t){return Et.some(function(s){return t.indexOf(s)>-1})}function u(s){var i=t(s,"authority");if(i){var a=t(i,"epsg");return a&&Pt.indexOf(a)>-1}}function f(s){var i=t(s,"extension");if(i)return t(i,"proj4")}function m(t){return"+"===t[0]}function p(t){if(!l(t))return t;if(M(t))return o[t];if(c(t)){var s=Ct(t);if(u(s))return o["EPSG:3857"];var i=f(s);return i?yt(i):s}return m(t)?yt(t):void 0}
function d(t){return t}function y(t,s){var i=Tt.length;return t.names?(Tt[i]=t,t.names.forEach(function(t){Gt[t.toLowerCase()]=i}),this):(console.log(s),!0)}function _(t,s,i,a){var h=t*t,e=s*s,n=(h-e)/h,r=0;return a?(h=(t*=1-n*(et+n*(nt+n*rt)))*t,n=0):r=Math.sqrt(n),{es:n,e:r,ep2:(h-e)/e}}function x(s,i,a,h,e){if(!s){var n=t(Lt,h);n||(n=zt),s=n.a,i=n.b,a=n.rf}return a&&!i&&(i=(1-1/a)*s),(0===a||Math.abs(s-i)<ot)&&(e=!0,i=s),{a:s,b:i,rf:a,sphere:e}}function v(t,s,i,a,h,e){var n={};return n.datum_type=
void 0===t||"none"===t?it:st,s&&(n.datum_params=s.map(parseFloat),0===n.datum_params[0]&&0===n.datum_params[1]&&0===n.datum_params[2]||(n.datum_type=$),n.datum_params.length>3&&(0===n.datum_params[3]&&0===n.datum_params[4]&&0===n.datum_params[5]&&0===n.datum_params[6]||(n.datum_type=tt,n.datum_params[3]*=at,n.datum_params[4]*=at,n.datum_params[5]*=at,n.datum_params[6]=n.datum_params[6]/1E6+1))),n.a=i,n.b=a,n.es=h,n.ep2=e,n}function Projection(s,i){if(!(this instanceof Projection))return new Projection(s);
i=i||function(t){if(t)throw t;};var a=p(s);if("object"==typeof a){var h=Projection.projections.get(a.projName);if(h){if(a.datumCode&&"none"!==a.datumCode){var e=t(Dt,a.datumCode);e&&(a.datum_params=e.towgs84?e.towgs84.split(","):null,a.ellps=e.ellipse,a.datumName=e.datumName?e.datumName:a.datumCode)}a.k0=a.k0||1,a.axis=a.axis||"enu",a.ellps=a.ellps||"wgs84";var n=x(a.a,a.b,a.rf,a.ellps,a.sphere),r=_(n.a,n.b,n.rf,a.R_A),o=a.datum||v(a.datumCode,a.datum_params,n.a,n.b,r.es,r.ep2);Nt(this,a),Nt(this,
h),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=r.es,this.e=r.e,this.ep2=r.ep2,this.datum=o,this.init(),i(null,this)}else i(s)}else i(s)}function g(t,s){return t.datum_type===s.datum_type&&(!(t.a!==s.a||Math.abs(t.es-s.es)>5E-11)&&(t.datum_type===$?t.datum_params[0]===s.datum_params[0]&&t.datum_params[1]===s.datum_params[1]&&t.datum_params[2]===s.datum_params[2]:t.datum_type!==tt||t.datum_params[0]===s.datum_params[0]&&t.datum_params[1]===s.datum_params[1]&&t.datum_params[2]===
s.datum_params[2]&&t.datum_params[3]===s.datum_params[3]&&t.datum_params[4]===s.datum_params[4]&&t.datum_params[5]===s.datum_params[5]&&t.datum_params[6]===s.datum_params[6]))}function b(t,s,i){var a,h,e,n,r=t.x,o=t.y,l=t.z?t.z:0;if(o<-ht&&o>-1.001*ht)o=-ht;else if(o>ht&&o<1.001*ht)o=ht;else{if(o<-ht)return{x:-1/0,y:-1/0,z:t.z};if(o>ht)return{x:1/0,y:1/0,z:t.z}}return r>Math.PI&&(r-=2*Math.PI),h=Math.sin(o),n=Math.cos(o),e=h*h,a=i/Math.sqrt(1-s*e),{x:(a+l)*n*Math.cos(r),y:(a+l)*n*Math.sin(r),z:(a*
(1-s)+l)*h}}function w(t,s,i,a){var h,e,n,r,o,l,M,c,u,f,m,p,d,y,_,x,v=t.x,g=t.y,b=t.z?t.z:0;if(h=Math.sqrt(v*v+g*g),e=Math.sqrt(v*v+g*g+b*b),h/i<1E-12){if(y=0,e/i<1E-12)return _=ht,x=-a,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(g,v);n=b/e,c=(r=h/e)*(1-s)*(o=1/Math.sqrt(1-s*(2-s)*r*r)),u=n*o,d=0;do d++,l=s*(M=i/Math.sqrt(1-s*u*u))/(M+(x=h*c+b*u-M*(1-s*u*u))),p=(m=n*(o=1/Math.sqrt(1-l*(2-l)*r*r)))*c-(f=r*(1-l)*o)*u,c=f,u=m;while(p*p>1E-24&&d<30);return _=Math.atan(m/Math.abs(f)),{x:y,y:_,z:x}}function A(t,
s,i){if(s===$)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(s===tt){var a=i[0],h=i[1],e=i[2],n=i[3],r=i[4],o=i[5],l=i[6];return{x:l*(t.x-o*t.y+r*t.z)+a,y:l*(o*t.x+t.y-n*t.z)+h,z:l*(-r*t.x+n*t.y+t.z)+e}}}function C(t,s,i){if(s===$)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(s===tt){var a=i[0],h=i[1],e=i[2],n=i[3],r=i[4],o=i[5],l=i[6],M=(t.x-a)/l,c=(t.y-h)/l,u=(t.z-e)/l;return{x:M+o*c-r*u,y:-o*M+c+n*u,z:r*M-n*c+u}}}function E(t){return t===$||t===tt}function P(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;
throw new TypeError("coordinates must be finite numbers");}if("number"!=typeof t||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers");}function N(t,s){return(t.datum.datum_type===$||t.datum.datum_type===tt)&&"WGS84"!==s.datumCode||(s.datum.datum_type===$||s.datum.datum_type===tt)&&"WGS84"!==t.datumCode}function S(t,s,i){var a;return Array.isArray(i)&&(i=Ft(i)),Qt(i),t.datum&&s.datum&&N(t,s)&&(i=S(t,a=new Projection("WGS84"),i),t=a),"enu"!==t.axis&&(i=Ut(t,!1,i)),"longlat"===
t.projName?i={x:i.x*lt,y:i.y*lt}:(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter}),i=t.inverse(i)),t.from_greenwich&&(i.x+=t.from_greenwich),i=Bt(t.datum,s.datum,i),s.from_greenwich&&(i={x:i.x-s.from_greenwich,y:i.y}),"longlat"===s.projName?i={x:i.x*Mt,y:i.y*Mt}:(i=s.forward(i),s.to_meter&&(i={x:i.x/s.to_meter,y:i.y/s.to_meter})),"enu"!==s.axis?Ut(s,!0,i):i}function k(t,s,i){var a,h,e;return Array.isArray(i)?(a=S(t,s,i),3===i.length?[a.x,a.y,a.z]:[a.x,a.y]):(h=S(t,s,i),2===(e=Object.keys(i)).length?
h:(e.forEach(function(t){"x"!==t&&"y"!==t&&(h[t]=i[t])}),h))}function q(t){return t instanceof Projection?t:t.oProj?t.oProj:Projection(t)}function I(t,s,i){t=q(t);var a,h=!1;return void 0===s?(s=t,t=Wt,h=!0):(void 0!==s.x||Array.isArray(s))&&(i=s,s=t,t=Wt,h=!0),s=q(s),i?k(t,s,i):(a={forward:function(i){return k(t,s,i)},inverse:function(i){return k(s,t,i)}},h&&(a.oProj=s),a)}function O(t,s){return s=s||5,D(j({lat:t[1],lon:t[0]}),s)}function R(t){var s=L(Q(t.toUpperCase()));return s.lat&&s.lon?[s.lon,
s.lat]:[(s.left+s.right)/2,(s.top+s.bottom)/2]}function G(t){return t*(Math.PI/180)}function T(t){return t/Math.PI*180}function j(t){var s,i,a,h,e,n,r,o=t.lat,l=t.lon,M=6378137,c=G(o),u=G(l);r=Math.floor((l+180)/6)+1,180===l&&(r=60),o>=56&&o<64&&l>=3&&l<12&&(r=32),o>=72&&o<84&&(l>=0&&l<9?r=31:l>=9&&l<21?r=33:l>=21&&l<33?r=35:l>=33&&l<42&&(r=37)),n=G(6*(r-1)-180+3),s=M/Math.sqrt(1-.00669438*Math.sin(c)*Math.sin(c)),i=Math.tan(c)*Math.tan(c),a=.006739496752268451*Math.cos(c)*Math.cos(c);var f=.9996*
s*((h=Math.cos(c)*(u-n))+(1-i+a)*h*h*h/6+(5-18*i+i*i+72*a-.39089081163157013)*h*h*h*h*h/120)+5E5,m=.9996*((e=M*(.9983242984503243*c-.002514607064228144*Math.sin(2*c)+2.639046602129982E-6*Math.sin(4*c)-3.418046101696858E-9*Math.sin(6*c)))+s*Math.tan(c)*(h*h/2+(5-i+9*a+4*a*a)*h*h*h*h/24+(61-58*i+i*i+600*a-2.2240339282485886)*h*h*h*h*h*h/720));return o<0&&(m+=1E7),{northing:Math.round(m),easting:Math.round(f),zoneNumber:r,zoneLetter:z(o)}}function L(t){var s=t.northing,i=t.easting,a=t.zoneLetter,h=t.zoneNumber;
if(h<0||h>60)return null;var e,n,r,o,l,M,c,u,f=6378137,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),p=i-5E5,d=s;a<"N"&&(d-=1E7),M=6*(h-1)-180+3,u=(c=d/.9996/6367449.145945056)+(3*m/2-27*m*m*m/32)*Math.sin(2*c)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*c)+151*m*m*m/96*Math.sin(6*c),e=f/Math.sqrt(1-.00669438*Math.sin(u)*Math.sin(u)),n=Math.tan(u)*Math.tan(u),r=.006739496752268451*Math.cos(u)*Math.cos(u),o=.99330562*f/Math.pow(1-.00669438*Math.sin(u)*Math.sin(u),1.5),l=p/(.9996*e);var y=u-e*Math.tan(u)/
o*(l*l/2-(5+3*n+10*r-4*r*r-.06065547077041606)*l*l*l*l/24+(61+90*n+298*r+45*n*n-1.6983531815716497-3*r*r)*l*l*l*l*l*l/720);y=T(y);var _=(l-(1+2*n+r)*l*l*l/6+(5-2*r+28*n-3*r*r+.05391597401814761+24*n*n)*l*l*l*l*l/120)/Math.cos(u);_=M+T(_);var x;if(t.accuracy){var v=L({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});x={top:v.lat,right:v.lon,bottom:y,left:_}}else x={lat:y,lon:_};return x}function z(t){var s="Z";return 84>=t&&t>=72?s="X":72>
t&&t>=64?s="W":64>t&&t>=56?s="V":56>t&&t>=48?s="U":48>t&&t>=40?s="T":40>t&&t>=32?s="S":32>t&&t>=24?s="R":24>t&&t>=16?s="Q":16>t&&t>=8?s="P":8>t&&t>=0?s="N":0>t&&t>=-8?s="M":-8>t&&t>=-16?s="L":-16>t&&t>=-24?s="K":-24>t&&t>=-32?s="J":-32>t&&t>=-40?s="H":-40>t&&t>=-48?s="G":-48>t&&t>=-56?s="F":-56>t&&t>=-64?s="E":-64>t&&t>=-72?s="D":-72>t&&t>=-80&&(s="C"),s}function D(t,s){var i="00000"+t.easting,a="00000"+t.northing;return t.zoneNumber+t.zoneLetter+B(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-
5,s)+a.substr(a.length-5,s)}function B(t,s,i){var a=U(i);return F(Math.floor(t/1E5),Math.floor(s/1E5)%20,a)}function U(t){var s=t%Ht;return 0===s&&(s=Ht),s}function F(t,s,i){var a=i-1,h=Kt.charCodeAt(a),e=Xt.charCodeAt(a),n=h+t-1,r=e+s,o=!1;return n>$t&&(n=n-$t+Jt-1,o=!0),(n===Vt||h<Vt&&n>Vt||(n>Vt||h<Vt)&&o)&&n++,(n===Zt||h<Zt&&n>Zt||(n>Zt||h<Zt)&&o)&&++n===Vt&&n++,n>$t&&(n=n-$t+Jt-1),r>Yt?(r=r-Yt+Jt-1,o=!0):o=!1,(r===Vt||e<Vt&&r>Vt||(r>Vt||e<Vt)&&o)&&r++,(r===Zt||e<Zt&&r>Zt||(r>Zt||e<Zt)&&o)&&++r===
Vt&&r++,r>Yt&&(r=r-Yt+Jt-1),String.fromCharCode(n)+String.fromCharCode(r)}function Q(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var s,i=t.length,a=null,h="",e=0;!/[A-Z]/.test(s=t.charAt(e));){if(e>=2)throw"MGRSPoint bad conversion from: "+t;h+=s,e++}var n=parseInt(h,10);if(0===e||e+3>i)throw"MGRSPoint bad conversion from: "+t;var r=t.charAt(e++);if(r<="A"||"B"===r||"Y"===r||r>="Z"||"I"===r||"O"===r)throw"MGRSPoint zone letter "+r+" not handled: "+t;a=t.substring(e,e+=2);for(var o=
U(n),l=W(a.charAt(0),o),M=H(a.charAt(1),o);M<K(r);)M+=2E6;var c=i-e;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var u,f,m,p,d,y=c/2,_=0,x=0;return y>0&&(u=1E5/Math.pow(10,y),f=t.substring(e,e+y),_=parseFloat(f)*u,m=t.substring(e+y),x=parseFloat(m)*u),p=_+l,d=x+M,{easting:p,northing:d,zoneLetter:r,zoneNumber:n,accuracy:u}}function W(t,s){for(var i=Kt.charCodeAt(s-
1),a=1E5,h=!1;i!==t.charCodeAt(0);){if(++i===Vt&&i++,i===Zt&&i++,i>$t){if(h)throw"Bad character: "+t;i=Jt,h=!0}a+=1E5}return a}function H(t,s){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Xt.charCodeAt(s-1),a=0,h=!1;i!==t.charCodeAt(0);){if(++i===Vt&&i++,i===Zt&&i++,i>Yt){if(h)throw"Bad character: "+t;i=Jt,h=!0}a+=1E5}return a}function K(t){var s;switch(t){case "C":s=11E5;break;case "D":s=2E6;break;case "E":s=28E5;break;case "F":s=37E5;break;case "G":s=46E5;break;case "H":s=55E5;
break;case "J":s=64E5;break;case "K":s=73E5;break;case "L":s=82E5;break;case "M":s=91E5;break;case "N":s=0;break;case "P":s=8E5;break;case "Q":s=17E5;break;case "R":s=26E5;break;case "S":s=35E5;break;case "T":s=44E5;break;case "U":s=53E5;break;case "V":s=62E5;break;case "W":s=7E6;break;case "X":s=79E5;break;default:s=-1}if(s>=0)return s;throw"Invalid zone letter: "+t;}function Point(t,s,i){if(!(this instanceof Point))return new Point(t,s,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||
0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===s){var a=t.split(",");this.x=parseFloat(a[0],10),this.y=parseFloat(a[1],10),this.z=parseFloat(a[2],10)||0}else this.x=t,this.y=s,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}function X(t){var s,i=[];return i[0]=t*Ts,s=t*t,i[0]+=s*js,i[1]=s*zs,s*=t,i[0]+=s*Ls,i[1]+=s*Ds,i[2]=s*Bs,i}function J(t,s){var i=t+t;return t+s[0]*Math.sin(i)+s[1]*Math.sin(i+i)+s[2]*
Math.sin(i+i+i)}function V(t,s,i,a){var h;return t<ot?(a.value=ri.AREA_0,h=0):(h=Math.atan2(s,i),Math.abs(h)<=ct?a.value=ri.AREA_0:h>ct&&h<=ht+ct?(a.value=ri.AREA_1,h-=ht):h>ht+ct||h<=-(ht+ct)?(a.value=ri.AREA_2,h=h>=0?h-ft:h+ft):(a.value=ri.AREA_3,h+=ht)),h}function Z(t,s){var i=t+s;return i<-ft?i+=ut:i>+ft&&(i-=ut),i}function Y(t,s,i,a){for(var h=s;a;--a){var e=t(h);if(h-=e,Math.abs(e)<i)break}return h}var $=1,tt=2,st=4,it=5,at=4.84813681109536E-6,ht=Math.PI/2,et=.16666666666666666,nt=.04722222222222222,
rt=.022156084656084655,ot=1E-10,lt=.017453292519943295,Mt=57.29577951308232,ct=Math.PI/4,ut=2*Math.PI,ft=3.14159265359,mt={};mt.greenwich=0,mt.lisbon=-9.131906111111,mt.paris=2.337229166667,mt.bogota=-74.080916666667,mt.madrid=-3.687938888889,mt.rome=12.452333333333,mt.bern=7.439583333333,mt.jakarta=106.807719444444,mt.ferro=-17.666666666667,mt.brussels=4.367975,mt.stockholm=18.058277777778,mt.athens=23.7163375,mt.oslo=10.722916666667;var pt={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},dt=/[\s_\-\/\(\)]/g,
yt=function(s){var i,a,h,e={},n=s.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,s){var i=s.split("\x3d");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),r={proj:"projName",datum:"datumCode",rf:function(t){e.rf=parseFloat(t)},lat_0:function(t){e.lat0=t*lt},lat_1:function(t){e.lat1=t*lt},lat_2:function(t){e.lat2=t*lt},lat_ts:function(t){e.lat_ts=t*lt},lon_0:function(t){e.long0=t*lt},lon_1:function(t){e.long1=t*lt},lon_2:function(t){e.long2=t*lt},alpha:function(t){e.alpha=
parseFloat(t)*lt},lonc:function(t){e.longc=t*lt},x_0:function(t){e.x0=parseFloat(t)},y_0:function(t){e.y0=parseFloat(t)},k_0:function(t){e.k0=parseFloat(t)},k:function(t){e.k0=parseFloat(t)},a:function(t){e.a=parseFloat(t)},b:function(t){e.b=parseFloat(t)},r_a:function(){e.R_A=!0},zone:function(t){e.zone=parseInt(t,10)},south:function(){e.utmSouth=!0},towgs84:function(t){e.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){e.to_meter=parseFloat(t)},units:function(s){e.units=
s;var i=t(pt,s);i&&(e.to_meter=i.to_meter)},from_greenwich:function(t){e.from_greenwich=t*lt},pm:function(s){var i=t(mt,s);e.from_greenwich=(i||parseFloat(s))*lt},nadgrids:function(t){"@null"===t?e.datumCode="none":e.nadgrids=t},axis:function(t){3===t.length&&-1!=="ewnsud".indexOf(t.substr(0,1))&&-1!=="ewnsud".indexOf(t.substr(1,1))&&-1!=="ewnsud".indexOf(t.substr(2,1))&&(e.axis=t)}};for(i in n)a=n[i],i in r?"function"==typeof(h=r[i])?h(a):e[h]=a:e[i]=a;return"string"==typeof e.datumCode&&"WGS84"!==
e.datumCode&&(e.datumCode=e.datumCode.toLowerCase()),e},_t=1,xt=/\s/,vt=/[A-Za-z]/,gt=/[A-Za-z84]/,bt=/[,\]]/,wt=/[\d\.E\-\+]/;s.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;xt.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case _t:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case -1:return}},s.prototype.afterquote=
function(t){if('"'===t)return this.word+='"',void(this.state=4);if(bt.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place);},s.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=_t)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=_t,this.currentObject=this.stack.pop(),void(this.currentObject||
(this.state=-1))):void 0},s.prototype.number=function(t){if(!wt.test(t)){if(bt.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place);}this.word+=t},s.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},s.prototype.keyword=function(t){if(gt.test(t))this.word+=t;else{if("["===t){var s=[];return s.push(this.word),this.level++,null===this.root?this.root=s:this.currentObject.push(s),this.stack.push(this.currentObject),
this.currentObject=s,void(this.state=_t)}if(!bt.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},s.prototype.neutral=function(t){if(vt.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(wt.test(t))return this.word=t,void(this.state=3);{if(!bt.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)}},s.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();
if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state);};var At=.017453292519943295,Ct=function(t){var s=i(t),a=s.shift(),e=s.shift();s.unshift(["name",e]),s.unshift(["type",a]);var n={};return h(s,n),r(n),n};!function(t){t("EPSG:4326","+title\x3dWGS 84 (long/lat) +proj\x3dlonglat +ellps\x3dWGS84 +datum\x3dWGS84 +units\x3ddegrees"),t("EPSG:4269","+title\x3dNAD83 (long/lat) +proj\x3dlonglat +a\x3d6378137.0 +b\x3d6356752.31414036 +ellps\x3dGRS80 +datum\x3dNAD83 +units\x3ddegrees"),
t("EPSG:3857","+title\x3dWGS 84 / Pseudo-Mercator +proj\x3dmerc +a\x3d6378137 +b\x3d6378137 +lat_ts\x3d0.0 +lon_0\x3d0.0 +x_0\x3d0.0 +y_0\x3d0 +k\x3d1.0 +units\x3dm +nadgrids\x3d@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(o);var Et=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"],Pt=["3857","900913","3785",
"102113"],Nt=function(t,s){t=t||{};var i,a;if(!s)return t;for(a in s)void 0!==(i=s[a])&&(t[a]=i);return t},St=function(t,s,i){var a=t*s;return i/Math.sqrt(1-a*a)},kt=function(t){return t<0?-1:1},qt=function(t){return Math.abs(t)<=ft?t:t-kt(t)*ut},It=function(t,s,i){var a=t*i,h=.5*t;return a=Math.pow((1-a)/(1+a),h),Math.tan(.5*(ht-s))/a},Ot=function(t,s){for(var i,a,h=.5*t,e=ht-2*Math.atan(s),n=0;n<=15;n++)if(i=t*Math.sin(e),a=ht-2*Math.atan(s*Math.pow((1-i)/(1+i),h))-e,e+=a,Math.abs(a)<=1E-10)return e;
return-9999},Rt=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=St(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var s=t.x,i=t.y;if(i*Mt>90&&i*Mt<-90&&s*Mt>180&&s*Mt<-180)return null;var a,h;if(Math.abs(Math.abs(i)-ht)<=ot)return null;if(this.sphere)a=this.x0+this.a*this.k0*qt(s-this.long0),
h=this.y0+this.a*this.k0*Math.log(Math.tan(ct+.5*i));else{var e=Math.sin(i),n=It(this.e,i,e);a=this.x0+this.a*this.k0*qt(s-this.long0),h=this.y0-this.a*this.k0*Math.log(n)}return t.x=a,t.y=h,t},inverse:function(t){var s,i,a=t.x-this.x0,h=t.y-this.y0;if(this.sphere)i=ht-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var e=Math.exp(-h/(this.a*this.k0));if(-9999===(i=Ot(this.e,e)))return null}return s=qt(this.long0+a/(this.a*this.k0)),t.x=s,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator",
"Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:d,inverse:d,names:["longlat","identity"]}],Gt={},Tt=[],jt={start:function(){Rt.forEach(y)},add:y,get:function(t){if(!t)return!1;var s=t.toLowerCase();return void 0!==Gt[s]&&Tt[Gt[s]]?Tt[Gt[s]]:void 0}},Lt={};Lt.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},Lt.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},Lt.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},Lt.IAU76={a:6378140,
rf:298.257,ellipseName:"IAU 1976"},Lt.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},Lt.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},Lt.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},Lt.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},Lt.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},Lt.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl \x26 S. Amer. 1969"},Lt.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},
Lt.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},Lt.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},Lt.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},Lt.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},Lt.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},Lt.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},Lt.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},
Lt.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},Lt.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},Lt.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},Lt.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},Lt.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},Lt.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah \x26 Sarawak)"},Lt.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},Lt.fschr60m={a:6378155,
rf:298.3,ellipseName:"Fischer 1960"},Lt.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},Lt.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},Lt.hough={a:6378270,rf:297,ellipseName:"Hough"},Lt.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},Lt.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},Lt.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},Lt.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},Lt.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},
Lt.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},Lt.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},Lt.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},Lt.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},Lt.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},Lt.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},Lt.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var zt=Lt.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Lt.sphere={a:6370997,b:6370997,
ellipseName:"Normal Sphere (r\x3d6370997)"};var Dt={};Dt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Dt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Dt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Dt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Dt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},
Dt.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Dt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Dt.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},Dt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Dt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},
Dt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Dt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Dt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Dt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Dt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Dt.gunung_segara={towgs84:"-403,684,41",
ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Dt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},Projection.projections=jt,Projection.projections.start();var Bt=function(t,s,i){return g(t,s)?i:t.datum_type===it||s.datum_type===it?i:t.es!==s.es||t.a!==s.a||E(t.datum_type)||E(s.datum_type)?(i=b(i,t.es,t.a),E(t.datum_type)&&(i=A(i,t.datum_type,t.datum_params)),E(s.datum_type)&&(i=C(i,s.datum_type,s.datum_params)),w(i,
s.es,s.a,s.b)):i},Ut=function(t,s,i){var a,h,e,n=i.x,r=i.y,o=i.z||0,l={};for(e=0;e<3;e++)if(!s||2!==e||void 0!==i.z)switch(0===e?(a=n,h="x"):1===e?(a=r,h="y"):(a=o,h="z"),t.axis[e]){case "e":l[h]=a;break;case "w":l[h]=-a;break;case "n":l[h]=a;break;case "s":l[h]=-a;break;case "u":void 0!==i[h]&&(l.z=a);break;case "d":void 0!==i[h]&&(l.z=-a);break;default:return null}return l},Ft=function(t){var s={x:t[0],y:t[1]};return t.length>2&&(s.z=t[2]),t.length>3&&(s.m=t[3]),s},Qt=function(t){P(t.x),P(t.y)},
Wt=Projection("WGS84"),Ht=6,Kt="AJSAJS",Xt="AFAFAF",Jt=65,Vt=73,Zt=79,Yt=86,$t=90,ts={forward:O,inverse:function(t){var s=L(Q(t.toUpperCase()));return s.lat&&s.lon?[s.lon,s.lat,s.lon,s.lat]:[s.left,s.bottom,s.right,s.top]},toPoint:R};Point.fromMGRS=function(t){return new Point(R(t))},Point.prototype.toMGRS=function(t){return O([this.x,this.y],t)};var ss=.01068115234375,is=function(t){var s=[];s[0]=1-t*(.25+t*(.046875+t*(.01953125+t*ss))),s[1]=t*(.75-t*(.046875+t*(.01953125+t*ss)));var i=t*t;return s[2]=
i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,s[3]=i*(.3645833333333333-.005696614583333333*t),s[4]=i*t*.3076171875,s},as=function(t,s,i,a){return i*=s,s*=s,a[0]*t-i*(a[1]+s*(a[2]+s*(a[3]+s*a[4])))},hs=function(t,s,i){for(var a=1/(1-s),h=t,e=20;e;--e){var n=Math.sin(h),r=1-s*n*n;if(r=(as(h,n,Math.cos(h),i)-t)*(r*Math.sqrt(r))*a,h-=r,Math.abs(r)<ot)return h}return h},es={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?
this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=is(this.es),this.ml0=as(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var s,i,a,h=t.x,e=t.y,n=qt(h-this.long0),r=Math.sin(e),o=Math.cos(e);if(this.es){var l=o*n,M=Math.pow(l,2),c=this.ep2*Math.pow(o,2),u=Math.pow(c,2),f=Math.abs(o)>ot?Math.tan(e):0,m=Math.pow(f,2),p=Math.pow(m,2);s=1-this.es*Math.pow(r,2),l/=Math.sqrt(s);var d=as(e,r,o,this.en);i=this.a*(this.k0*l*(1+M/6*(1-m+c+M/20*(5-18*m+
p+14*c-58*m*c+M/42*(61+179*p-p*m-479*m)))))+this.x0,a=this.a*(this.k0*(d-this.ml0+r*n*l/2*(1+M/12*(5-m+9*c+4*u+M/30*(61+p-58*m+270*c-330*m*c+M/56*(1385+543*p-p*m-3111*m))))))+this.y0}else{var y=o*Math.sin(n);if(Math.abs(Math.abs(y)-1)<ot)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,a=o*Math.cos(n)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(a))>=1){if(y-1>ot)return 93;a=0}else a=Math.acos(a);e<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return t.x=i,t.y=a,t},inverse:function(t){var s,
i,a,h,e=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(s=this.ml0+n/this.k0,i=hs(s,this.es,this.en),Math.abs(i)<ht){var r=Math.sin(i),o=Math.cos(i),l=Math.abs(o)>ot?Math.tan(i):0,M=this.ep2*Math.pow(o,2),c=Math.pow(M,2),u=Math.pow(l,2),f=Math.pow(u,2);s=1-this.es*Math.pow(r,2);var m=e*Math.sqrt(s)/this.k0,p=Math.pow(m,2);a=i-(s*=l)*p/(1-this.es)*.5*(1-p/12*(5+3*u-9*M*u+M-4*c-p/30*(61+90*u-252*M*u+45*f+46*M-p/56*(1385+3633*u+4095*f+1574*f*u)))),h=qt(this.long0+m*(1-p/6*(1+2*u+M-
p/20*(5+28*u+24*f+8*M*u+6*M-p/42*(61+662*u+1320*f+720*f*u))))/o)}else a=ht*kt(n),h=0;else{var d=Math.exp(e/this.k0),y=.5*(d-1/d),_=this.lat0+n/this.k0,x=Math.cos(_);s=Math.sqrt((1-Math.pow(x,2))/(1+Math.pow(y,2))),a=Math.asin(s),n<0&&(a=-a),h=0===y&&0===x?0:qt(Math.atan2(y,x)+this.long0)}return t.x=h,t.y=a,t},names:["Transverse_Mercator","Transverse Mercator","tmerc"]},ns=function(t){var s=Math.exp(t);return s=(s-1/s)/2},rs=function(t,s){t=Math.abs(t),s=Math.abs(s);var i=Math.max(t,s),a=Math.min(t,
s)/(i||1);return i*Math.sqrt(1+Math.pow(a,2))},os=function(t){var s=1+t,i=s-1;return 0===i?t:t*Math.log(s)/i},ls=function(t){var s=Math.abs(t);return s=os(s*(1+s/(rs(1,s)+1))),t<0?-s:s},Ms=function(t,s){for(var i,a=2*Math.cos(2*s),h=t.length-1,e=t[h],n=0;--h>=0;)i=a*e-n+t[h],n=e,e=i;return s+i*Math.sin(2*s)},cs=function(t,s){for(var i,a=2*Math.cos(s),h=t.length-1,e=t[h],n=0;--h>=0;)i=a*e-n+t[h],n=e,e=i;return Math.sin(s)*i},us=function(t){var s=Math.exp(t);return s=(s+1/s)/2},fs=function(t,s,i){for(var a,
h,e=Math.sin(s),n=Math.cos(s),r=ns(i),o=us(i),l=2*n*o,M=-2*e*r,c=t.length-1,u=t[c],f=0,m=0,p=0;--c>=0;)a=m,h=f,u=l*(m=u)-a-M*(f=p)+t[c],p=M*m-h+l*f;return l=e*o,M=n*r,[l*u-M*p,l*p+M*u]},ms={init:function(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/
(1+Math.sqrt(1-this.es)),s=t/(2-t),i=s;this.cgb[0]=s*(2+s*(-2/3+s*(s*(116/45+s*(26/45+s*(-2854/675)))-2))),this.cbg[0]=s*(s*(2/3+s*(4/3+s*(-82/45+s*(32/45+s*(4642/4725)))))-2),i*=s,this.cgb[1]=i*(7/3+s*(s*(-227/45+s*(2704/315+s*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+s*(-16/15+s*(-13/9+s*(904/315+s*(-1522/945))))),i*=s,this.cgb[2]=i*(56/15+s*(-136/35+s*(-1262/105+s*(73814/2835)))),this.cbg[2]=i*(-26/15+s*(34/21+s*(1.6+s*(-12686/2835)))),i*=s,this.cgb[3]=i*(4279/630+s*(-332/35+s*(-399572/14175))),this.cbg[3]=
i*(1237/630+s*(s*(-24832/14175)-2.4)),i*=s,this.cgb[4]=i*(4174/315+s*(-144838/6237)),this.cbg[4]=i*(-734/315+s*(109598/31185)),i*=s,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(s,2),this.Qn=this.k0/(1+s)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=s*(s*(2/3+s*(-37/96+s*(1/360+s*(81/512+s*(-96199/604800)))))-.5),this.gtu[0]=s*(.5+s*(-2/3+s*(5/16+s*(41/180+s*(-127/288+s*(7891/37800)))))),this.utg[1]=i*(-1/48+s*(-1/15+s*(437/1440+s*(-46/105+s*(1118711/3870720))))),this.gtu[1]=i*(13/
48+s*(s*(557/1440+s*(281/630+s*(-1983433/1935360)))-.6)),i*=s,this.utg[2]=i*(-17/480+s*(37/840+s*(209/4480+s*(-5569/90720)))),this.gtu[2]=i*(61/240+s*(-103/140+s*(15061/26880+s*(167603/181440)))),i*=s,this.utg[3]=i*(-4397/161280+s*(11/504+s*(830251/7257600))),this.gtu[3]=i*(49561/161280+s*(-179/168+s*(6601661/7257600))),i*=s,this.utg[4]=i*(-4583/161280+s*(108847/3991680)),this.gtu[4]=i*(34729/80640+s*(-3418889/1995840)),i*=s,this.utg[5]=-.03233083094085698*i,this.gtu[5]=.6650675310896665*i;var a=
Ms(this.cbg,this.lat0);this.Zb=-this.Qn*(a+cs(this.gtu,2*a))},forward:function(t){var s=qt(t.x-this.long0),i=t.y;i=Ms(this.cbg,i);var a=Math.sin(i),h=Math.cos(i),e=Math.sin(s),n=Math.cos(s);i=Math.atan2(a,n*h),s=Math.atan2(e*h,rs(a,h*n)),s=ls(Math.tan(s));var r=fs(this.gtu,2*i,2*s);i+=r[0],s+=r[1];var o,l;return Math.abs(s)<=2.623395162778?(o=this.a*(this.Qn*s)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(o=1/0,l=1/0),t.x=o,t.y=l,t},inverse:function(t){var s=(t.x-this.x0)*(1/this.a),i=(t.y-this.y0)*
(1/this.a);i=(i-this.Zb)/this.Qn,s/=this.Qn;var a,h;if(Math.abs(s)<=2.623395162778){var e=fs(this.utg,2*i,2*s);i+=e[0],s+=e[1],s=Math.atan(ns(s));var n=Math.sin(i),r=Math.cos(i),o=Math.sin(s),l=Math.cos(s);i=Math.atan2(n*l,rs(o,l*r)),s=Math.atan2(o,l*r),a=qt(s+this.long0),h=Ms(this.cgb,i)}else a=1/0,h=1/0;return t.x=a,t.y=h,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"]},ps=function(t,s){if(void 0===t){if((t=Math.floor(30*(qt(s)+Math.PI)/Math.PI)+1)<0)return 0;if(t>
60)return 60}return t},ds={init:function(){var t=ps(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*lt,this.x0=5E5,this.y0=this.utmSouth?1E7:0,this.k0=.9996,ms.init.apply(this),this.forward=ms.forward,this.inverse=ms.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"},ys=function(t,s){return Math.pow((1-t)/(1+t),s)},_s=20,xs={init:function(){var t=Math.sin(this.lat0),s=Math.cos(this.lat0);s*=s,this.rc=
Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*s*s/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ct)/(Math.pow(Math.tan(.5*this.lat0+ct),this.C)*ys(this.e*t,this.ratexp))},forward:function(t){var s=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ct),this.C)*ys(this.e*Math.sin(i),this.ratexp))-ht,t.x=this.C*s,t},inverse:function(t){for(var s=t.x/this.C,i=t.y,a=Math.pow(Math.tan(.5*i+ct)/this.K,1/this.C),h=_s;h>
0&&(i=2*Math.atan(a*ys(this.e*Math.sin(t.y),-.5*this.e))-ht,!(Math.abs(i-t.y)<1E-14));--h)t.y=i;return h?(t.x=s,t.y=i,t):null},names:["gauss"]},vs={init:function(){xs.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var s,i,a,h;return t.x=qt(t.x-this.long0),xs.forward.apply(this,[t]),s=Math.sin(t.y),i=Math.cos(t.y),a=Math.cos(t.x),h=this.k0*this.R2/(1+this.sinc0*
s+this.cosc0*i*a),t.x=h*i*Math.sin(t.x),t.y=h*(this.cosc0*s-this.sinc0*i*a),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var s,i,a,h,e;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,e=Math.sqrt(t.x*t.x+t.y*t.y)){var n=2*Math.atan2(e,this.R2);s=Math.sin(n),i=Math.cos(n),h=Math.asin(i*this.sinc0+t.y*s*this.cosc0/e),a=Math.atan2(t.x*s,e*this.cosc0*i-t.y*this.sinc0*s)}else h=this.phic0,a=0;return t.x=a,t.y=h,xs.inverse.apply(this,[t]),t.x=qt(t.x+
this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]},gs={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=ot&&(this.k0=.5*(1+kt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=ot&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-
this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=ot&&(this.k0=.5*this.cons*St(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/It(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=St(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-ht,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var s,i,a,h,e,n,r=t.x,o=t.y,l=Math.sin(o),M=Math.cos(o),c=qt(r-this.long0);return Math.abs(Math.abs(r-
this.long0)-Math.PI)<=ot&&Math.abs(o+this.lat0)<=ot?(t.x=NaN,t.y=NaN,t):this.sphere?(s=2*this.k0/(1+this.sinlat0*l+this.coslat0*M*Math.cos(c)),t.x=this.a*s*M*Math.sin(c)+this.x0,t.y=this.a*s*(this.coslat0*l-this.sinlat0*M*Math.cos(c))+this.y0,t):(i=2*Math.atan(this.ssfn_(o,l,this.e))-ht,h=Math.cos(i),a=Math.sin(i),Math.abs(this.coslat0)<=ot?(e=It(this.e,o*this.con,this.con*l),n=2*this.a*this.k0*e/this.cons,t.x=this.x0+n*Math.sin(r-this.long0),t.y=this.y0-this.con*n*Math.cos(r-this.long0),t):(Math.abs(this.sinlat0)<
ot?(s=2*this.a*this.k0/(1+h*Math.cos(c)),t.y=s*a):(s=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(c))),t.y=s*(this.cosX0*a-this.sinX0*h*Math.cos(c))+this.y0),t.x=s*h*Math.sin(c)+this.x0,t))},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a,h,e,n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var r=2*Math.atan(n/(2*this.a*this.k0));return s=this.long0,i=this.lat0,n<=ot?(t.x=s,t.y=i,t):(i=Math.asin(Math.cos(r)*this.sinlat0+t.y*Math.sin(r)*this.coslat0/n),s=qt(Math.abs(this.coslat0)<
ot?this.lat0>0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(r),n*this.coslat0*Math.cos(r)-t.y*this.sinlat0*Math.sin(r))),t.x=s,t.y=i,t)}if(Math.abs(this.coslat0)<=ot){if(n<=ot)return i=this.lat0,s=this.long0,t.x=s,t.y=i,t;t.x*=this.con,t.y*=this.con,a=n*this.cons/(2*this.a*this.k0),i=this.con*Ot(this.e,a),s=this.con*qt(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else h=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),s=this.long0,n<=ot?e=
this.X0:(e=Math.asin(Math.cos(h)*this.sinX0+t.y*Math.sin(h)*this.cosX0/n),s=qt(this.long0+Math.atan2(t.x*Math.sin(h),n*this.cosX0*Math.cos(h)-t.y*this.sinX0*Math.sin(h)))),i=-1*Ot(this.e,Math.tan(.5*(ht+e)));return t.x=s,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,s,i){return s*=i,Math.tan(.5*(ht+t))*Math.pow((1-s)/(1+s),.5*i)}},bs={init:function(){var t=this.lat0;this.lambda0=this.long0;var s=Math.sin(t),i=this.a,a=1/this.rf,h=2*a-Math.pow(a,
2),e=this.e=Math.sqrt(h);this.R=this.k0*i*Math.sqrt(1-h)/(1-h*Math.pow(s,2)),this.alpha=Math.sqrt(1+h/(1-h)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(s/this.alpha);var n=Math.log(Math.tan(Math.PI/4+this.b0/2)),r=Math.log(Math.tan(Math.PI/4+t/2)),o=Math.log((1+e*s)/(1-e*s));this.K=n-this.alpha*r+this.alpha*e/2*o},forward:function(t){var s=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),a=-this.alpha*(s+i)+this.K,h=2*(Math.atan(Math.exp(a))-
Math.PI/4),e=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(e)/(Math.sin(this.b0)*Math.tan(h)+Math.cos(this.b0)*Math.cos(e))),r=Math.asin(Math.cos(this.b0)*Math.sin(h)-Math.sin(this.b0)*Math.cos(h)*Math.cos(e));return t.y=this.R/2*Math.log((1+Math.sin(r))/(1-Math.sin(r)))+this.y0,t.x=this.R*n+this.x0,t},inverse:function(t){for(var s=t.x-this.x0,i=t.y-this.y0,a=s/this.R,h=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),e=Math.asin(Math.cos(this.b0)*Math.sin(h)+Math.sin(this.b0)*Math.cos(h)*Math.cos(a)),
n=Math.atan(Math.sin(a)/(Math.cos(this.b0)*Math.cos(a)-Math.sin(this.b0)*Math.tan(h))),r=this.lambda0+n/this.alpha,o=0,l=e,M=-1E3,c=0;Math.abs(l-M)>1E-7;){if(++c>20)return;o=1/this.alpha*(Math.log(Math.tan(Math.PI/4+e/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),M=l,l=2*Math.atan(Math.exp(o))-Math.PI/2}return t.x=r,t.y=l,t},names:["somerc"]},ws={init:function(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),
s=Math.cos(this.lat0),i=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(s,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-i*i);var a=It(this.e,this.lat0,t),h=this.bl/s*Math.sqrt((1-this.es)/(1-i*i));h*h<1&&(h=1);var e,n;if(isNaN(this.longc)){var r=It(this.e,this.lat1,Math.sin(this.lat1)),o=It(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(h+Math.sqrt(h*h-1))*Math.pow(a,this.bl):this.el=(h-Math.sqrt(h*h-1))*Math.pow(a,this.bl);var l=Math.pow(r,this.bl),M=Math.pow(o,
this.bl);n=.5*((e=this.el/l)-1/e);var c=(this.el*this.el-M*l)/(this.el*this.el+M*l),u=(M-l)/(M+l),f=qt(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(c*Math.tan(.5*this.bl*f)/u)/this.bl,this.long0=qt(this.long0);var m=qt(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/n),this.alpha=Math.asin(h*Math.sin(this.gamma0))}else e=this.lat0>=0?h+Math.sqrt(h*h-1):h-Math.sqrt(h*h-1),this.el=e*Math.pow(a,this.bl),n=.5*(e-1/e),this.gamma0=Math.asin(Math.sin(this.alpha)/
h),this.long0=this.longc-Math.asin(n*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(h*h-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(h*h-1),Math.cos(this.alpha))},forward:function(t){var s,i,a,h=t.x,e=t.y,n=qt(h-this.long0);if(Math.abs(Math.abs(e)-ht)<=ot)a=e>0?-1:1,i=this.al/this.bl*Math.log(Math.tan(ct+a*this.gamma0*.5)),s=-1*a*ht*this.al/this.bl;else{var r=It(this.e,e,Math.sin(e)),o=this.el/Math.pow(r,this.bl),
l=.5*(o-1/o),M=.5*(o+1/o),c=Math.sin(this.bl*n),u=(l*Math.sin(this.gamma0)-c*Math.cos(this.gamma0))/M;i=Math.abs(Math.abs(u)-1)<=ot?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-u)/(1+u))/this.bl,s=Math.abs(Math.cos(this.bl*n))<=ot?this.al*this.bl*n:this.al*Math.atan2(l*Math.cos(this.gamma0)+c*Math.sin(this.gamma0),Math.cos(this.bl*n))/this.bl}return this.no_rot?(t.x=this.x0+s,t.y=this.y0+i):(s-=this.uc,t.x=this.x0+i*Math.cos(this.alpha)+s*Math.sin(this.alpha),t.y=this.y0+s*Math.cos(this.alpha)-
i*Math.sin(this.alpha)),t},inverse:function(t){var s,i;this.no_rot?(i=t.y-this.y0,s=t.x-this.x0):(i=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),s=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),s+=this.uc);var a=Math.exp(-1*this.bl*i/this.al),h=.5*(a-1/a),e=.5*(a+1/a),n=Math.sin(this.bl*s/this.al),r=(n*Math.cos(this.gamma0)+h*Math.sin(this.gamma0))/e,o=Math.pow(this.el/Math.sqrt((1+r)/(1-r)),1/this.bl);return Math.abs(r-1)<ot?(t.x=this.long0,t.y=ht):
Math.abs(r+1)<ot?(t.x=this.long0,t.y=-1*ht):(t.y=Ot(this.e,o),t.x=qt(this.long0-Math.atan2(h*Math.cos(this.gamma0)-n*Math.sin(this.gamma0),Math.cos(this.bl*s/this.al))/this.bl)),t},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"]},As={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<ot)){var t=this.b/
this.a;this.e=Math.sqrt(1-t*t);var s=Math.sin(this.lat1),i=Math.cos(this.lat1),a=St(this.e,s,i),h=It(this.e,this.lat1,s),e=Math.sin(this.lat2),n=Math.cos(this.lat2),r=St(this.e,e,n),o=It(this.e,this.lat2,e),l=It(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>ot?this.ns=Math.log(a/r)/Math.log(h/o):this.ns=s,isNaN(this.ns)&&(this.ns=s),this.f0=a/(this.ns*Math.pow(h,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var s=
t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=ot&&(i=kt(i)*(ht-2*ot));var a,h,e=Math.abs(Math.abs(i)-ht);if(e>ot)a=It(this.e,i,Math.sin(i)),h=this.a*this.f0*Math.pow(a,this.ns);else{if((e=i*this.ns)<=0)return null;h=0}var n=this.ns*qt(s-this.long0);return t.x=this.k0*(h*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-h*Math.cos(n))+this.y0,t},inverse:function(t){var s,i,a,h,e,n=(t.x-this.x0)/this.k0,r=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(s=Math.sqrt(n*n+r*r),i=1):(s=-Math.sqrt(n*n+r*r),i=-1);var o=0;if(0!==
s&&(o=Math.atan2(i*n,i*r)),0!==s||this.ns>0){if(i=1/this.ns,a=Math.pow(s/(this.a*this.f0),i),-9999===(h=Ot(this.e,a)))return null}else h=-ht;return e=qt(o/this.ns+this.long0),t.x=e,t.y=h,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"]},Cs={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),
this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*
Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var s,i,a,h,e,n,r,o=t.x,l=t.y,M=qt(o-this.long0);return s=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/s)-this.s45),a=-M*this.alfa,h=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(a)),e=Math.asin(Math.cos(i)*
Math.sin(a)/Math.cos(h)),n=this.n*e,r=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(h/2+this.s45),this.n),t.y=r*Math.cos(n)/1,t.x=r*Math.sin(n)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var s,i,a,h,e,n,r,o=t.x;t.x=t.y,t.y=o,this.czech||(t.y*=-1,t.x*=-1),e=Math.sqrt(t.x*t.x+t.y*t.y),h=Math.atan2(t.y,t.x)/Math.sin(this.s0),a=2*(Math.atan(Math.pow(this.ro0/e,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),s=Math.asin(Math.cos(this.ad)*Math.sin(a)-Math.sin(this.ad)*
Math.cos(a)*Math.cos(h)),i=Math.asin(Math.cos(a)*Math.sin(h)/Math.cos(s)),t.x=this.long0-i/this.alfa,n=s,r=0;var l=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(s/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(n))/(1-this.e*Math.sin(n)),this.e/2))-this.s45),Math.abs(n-t.y)<1E-10&&(r=1),n=t.y,l+=1;while(0===r&&l<15);return l>=15?null:t},names:["Krovak","krovak"]},Es=function(t,s,i,a,h){return t*h-s*Math.sin(2*h)+i*Math.sin(4*h)-a*Math.sin(6*h)},Ps=function(t){return 1-
.25*t*(1+t/16*(3+1.25*t))},Ns=function(t){return.375*t*(1+.25*t*(1+.46875*t))},Ss=function(t){return.05859375*t*t*(1+.75*t)},ks=function(t){return t*t*t*(35/3072)},qs=function(t,s,i){var a=s*i;return t/Math.sqrt(1-a*a)},Is=function(t){return Math.abs(t)<ht?t:t-kt(t)*Math.PI},Os=function(t,s,i,a,h){var e,n;e=t/s;for(var r=0;r<15;r++)if(n=(t-(s*e-i*Math.sin(2*e)+a*Math.sin(4*e)-h*Math.sin(6*e)))/(s-2*i*Math.cos(2*e)+4*a*Math.cos(4*e)-6*h*Math.cos(6*e)),e+=n,Math.abs(n)<=1E-10)return e;return NaN},Rs=
{init:function(){this.sphere||(this.e0=Ps(this.es),this.e1=Ns(this.es),this.e2=Ss(this.es),this.e3=ks(this.es),this.ml0=this.a*Es(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var s,i,a=t.x,h=t.y;if(a=qt(a-this.long0),this.sphere)s=this.a*Math.asin(Math.cos(h)*Math.sin(a)),i=this.a*(Math.atan2(Math.tan(h),Math.cos(a))-this.lat0);else{var e=Math.sin(h),n=Math.cos(h),r=qs(this.a,this.e,e),o=Math.tan(h)*Math.tan(h),l=a*Math.cos(h),M=l*l,c=this.es*n*n/(1-this.es);s=r*l*(1-M*o*(1/6-
(8-o+8*c)*M/120)),i=this.a*Es(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+r*e/n*M*(.5+(5-o+6*c)*M/24)}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a=t.x/this.a,h=t.y/this.a;if(this.sphere){var e=h+this.lat0;s=Math.asin(Math.sin(e)*Math.cos(a)),i=Math.atan2(Math.tan(a),Math.cos(e))}else{var n=this.ml0/this.a+h,r=Os(n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(r)-ht)<=ot)return t.x=this.long0,t.y=ht,h<0&&(t.y*=-1),t;var o=qs(this.a,this.e,Math.sin(r)),
l=o*o*o/this.a/this.a*(1-this.es),M=Math.pow(Math.tan(r),2),c=a*this.a/o,u=c*c;s=r-o*Math.tan(r)/l*c*c*(.5-(1+3*M)*c*c/24),i=c*(1-u*(M/3+(1+3*M)*M*u/15))/Math.cos(r)}return t.x=qt(i+this.long0),t.y=Is(s),t},names:["Cassini","Cassini_Soldner","cass"]},Gs=function(t,s){var i;return t>1E-7?(i=t*s,(1-t*t)*(s/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*s},Ts=.3333333333333333,js=.17222222222222222,Ls=.10257936507936508,zs=.06388888888888888,Ds=.0664021164021164,Bs=.016415012942191543,Us={init:function(){var t=
Math.abs(this.lat0);if(Math.abs(t-ht)<ot?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<ot?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var s;switch(this.qp=Gs(this.e,1),this.mmf=.5/(1-this.es),this.apa=X(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),s=Math.sin(this.lat0),this.sinb1=Gs(this.e,s)/this.qp,this.cosb1=
Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*s*s)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var s,i,a,h,e,n,r,o,l,M,c=t.x,u=t.y;if(c=qt(c-this.long0),this.sphere)if(e=Math.sin(u),M=Math.cos(u),a=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+M*a:1+this.sinph0*e+this.cosph0*
M*a)<=ot)return null;s=(i=Math.sqrt(2/i))*M*Math.sin(c),i*=this.mode===this.EQUIT?e:this.cosph0*e-this.sinph0*M*a}else{if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(a=-a),Math.abs(u+this.phi0)<ot)return null;i=ct-.5*u,s=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=a}}else{switch(r=0,o=0,l=0,a=Math.cos(c),h=Math.sin(c),e=Math.sin(u),n=Gs(this.e,e),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(r=n/this.qp,o=Math.sqrt(1-r*r)),this.mode){case this.OBLIQ:l=
1+this.sinb1*r+this.cosb1*o*a;break;case this.EQUIT:l=1+o*a;break;case this.N_POLE:l=ht+u,n=this.qp-n;break;case this.S_POLE:l=u-ht,n=this.qp+n}if(Math.abs(l)<ot)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*r-this.sinb1*o*a):(l=Math.sqrt(2/(1+o*a)))*r*this.ymf,s=this.xmf*l*o*h;break;case this.N_POLE:case this.S_POLE:n>=0?(s=(l=Math.sqrt(n))*h,i=a*(this.mode===this.S_POLE?l:-l)):s=i=0}}return t.x=this.a*s+this.x0,t.y=
this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a,h,e,n,r,o=t.x/this.a,l=t.y/this.a;if(this.sphere){var M,c=0,u=0;if(M=Math.sqrt(o*o+l*l),(i=.5*M)>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(u=Math.sin(i),c=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(M)<=ot?0:Math.asin(l*u/M),o*=u,l=c*M;break;case this.OBLIQ:i=Math.abs(M)<=ot?this.phi0:Math.asin(c*this.sinph0+l*u*this.cosph0/M),o*=u*this.cosph0,l=(c-Math.sin(i)*this.sinph0)*
M;break;case this.N_POLE:l=-l,i=ht-i;break;case this.S_POLE:i-=ht}s=0!==l||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(o,l):0}else{if(r=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(o/=this.dd,l*=this.dd,(n=Math.sqrt(o*o+l*l))<ot)return t.x=0,t.y=this.phi0,t;h=2*Math.asin(.5*n/this.rq),a=Math.cos(h),o*=h=Math.sin(h),this.mode===this.OBLIQ?(r=a*this.sinb1+l*h*this.cosb1/n,e=this.qp*r,l=n*this.cosb1*a-l*this.sinb1*h):(r=l*h/n,e=this.qp*r,l=n*a)}else if(this.mode===this.N_POLE||
this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(l=-l),!(e=o*o+l*l))return t.x=0,t.y=this.phi0,t;r=1-e/this.qp,this.mode===this.S_POLE&&(r=-r)}s=Math.atan2(o,l),i=J(Math.asin(r),this.apa)}return t.x=qt(this.long0+s),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4},Fs=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)},Qs={init:function(){Math.abs(this.lat1+this.lat2)<ot||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,
2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=St(this.e3,this.sin_po,this.cos_po),this.qs1=Gs(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=St(this.e3,this.sin_po,this.cos_po),this.qs2=Gs(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Gs(this.e3,
this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>ot?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var s=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var a=Gs(this.e3,this.sin_phi,this.cos_phi),h=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,e=this.ns0*qt(s-this.long0),n=h*Math.sin(e)+this.x0,r=this.rh-h*Math.cos(e)+
this.y0;return t.x=n,t.y=r,t},inverse:function(t){var s,i,a,h,e,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(s=Math.sqrt(t.x*t.x+t.y*t.y),a=1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),a=-1),h=0,0!==s&&(h=Math.atan2(a*t.x,a*t.y)),a=s*this.ns0/this.a,this.sphere?n=Math.asin((this.c-a*a)/(2*this.ns0)):(i=(this.c-a*a)/this.ns0,n=this.phi1z(this.e3,i)),e=qt(h/this.ns0+this.long0),t.x=e,t.y=n,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,s){var i,a,h,e,n,r=Fs(.5*s);if(t<ot)return r;
for(var o=t*t,l=1;l<=25;l++)if(i=Math.sin(r),a=Math.cos(r),h=t*i,e=1-h*h,n=.5*e*e/a*(s/(1-o)-i/e+.5/t*Math.log((1-h)/(1+h))),r+=n,Math.abs(n)<=1E-7)return r;return null}},Ws={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1E3*this.a,this.rc=1},forward:function(t){var s,i,a,h,e,n,r,o=t.x,l=t.y;return a=qt(o-this.long0),s=Math.sin(l),i=Math.cos(l),h=Math.cos(a),(e=this.sin_p14*s+this.cos_p14*i*h)>0||Math.abs(e)<=ot?(n=this.x0+1*this.a*i*Math.sin(a)/
e,r=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*h)/e):(n=this.x0+this.infinity_dist*i*Math.sin(a),r=this.y0+this.infinity_dist*(this.cos_p14*s-this.sin_p14*i*h)),t.x=n,t.y=r,t},inverse:function(t){var s,i,a,h,e,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(s=Math.sqrt(t.x*t.x+t.y*t.y))?(h=Math.atan2(s,this.rc),i=Math.sin(h),a=Math.cos(h),n=Fs(a*this.sin_p14+t.y*i*this.cos_p14/s),e=Math.atan2(t.x*i,s*this.cos_p14*a-t.y*this.sin_p14*i),e=qt(this.long0+e)):
(n=this.phic0,e=0),t.x=e,t.y=n,t},names:["gnom"]},Hs=function(t,s){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(s)-i)<1E-6)return s<0?-1*ht:ht;for(var a,h,e,n,r=Math.asin(.5*s),o=0;o<30;o++)if(h=Math.sin(r),e=Math.cos(r),n=t*h,a=Math.pow(1-n*n,2)/(2*e)*(s/(1-t*t)-h/(1-n*n)+.5/t*Math.log((1-n)/(1+n))),r+=a,Math.abs(a)<=1E-10)return r;return NaN},Ks={init:function(){this.sphere||(this.k0=St(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var s,i,a=t.x,h=
t.y,e=qt(a-this.long0);if(this.sphere)s=this.x0+this.a*e*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var n=Gs(this.e,Math.sin(h));s=this.x0+this.a*this.k0*e,i=this.y0+this.a*n*.5/this.k0}return t.x=s,t.y=i,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i;return this.sphere?(s=qt(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=Hs(this.e,2*t.y*this.k0/this.a),s=qt(this.long0+t.x/(this.a*this.k0))),t.x=s,t.y=i,t},
names:["cea"]},Xs={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var s=t.x,i=t.y,a=qt(s-this.long0),h=Is(i-this.lat0);return t.x=this.x0+this.a*a*this.rc,t.y=this.y0+this.a*h,t},inverse:function(t){var s=t.x,i=t.y;return t.x=qt(this.long0+(s-this.x0)/(this.a*this.rc)),t.y=Is(this.lat0+(i-this.y0)/this.a),
t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]},Js=20,Vs={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ps(this.es),this.e1=Ns(this.es),this.e2=Ss(this.es),this.e3=ks(this.es),this.ml0=this.a*Es(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var s,i,a,h=t.x,e=t.y,n=qt(h-this.long0);if(a=n*Math.sin(e),this.sphere)Math.abs(e)<=ot?(s=this.a*n,i=-1*this.a*this.lat0):(s=this.a*Math.sin(a)/Math.tan(e),i=this.a*(Is(e-
this.lat0)+(1-Math.cos(a))/Math.tan(e)));else if(Math.abs(e)<=ot)s=this.a*n,i=-1*this.ml0;else{var r=qs(this.a,this.e,Math.sin(e))/Math.tan(e);s=r*Math.sin(a),i=this.a*Es(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+r*(1-Math.cos(a))}return t.x=s+this.x0,t.y=i+this.y0,t},inverse:function(t){var s,i,a,h,e,n,r,o,l;if(a=t.x-this.x0,h=t.y-this.y0,this.sphere)if(Math.abs(h+this.a*this.lat0)<=ot)s=qt(a/this.a+this.long0),i=0;else{n=this.lat0+h/this.a,r=a*a/this.a/this.a+n*n,o=n;var M;for(e=Js;e;--e)if(M=
Math.tan(o),l=-1*(n*(o*M+1)-o-.5*(o*o+r)*M)/((o-n)/M-1),o+=l,Math.abs(l)<=ot){i=o;break}s=qt(this.long0+Math.asin(a*Math.tan(o)/this.a)/Math.sin(i))}else if(Math.abs(h+this.ml0)<=ot)i=0,s=qt(this.long0+a/this.a);else{n=(this.ml0+h)/this.a,r=a*a/this.a/this.a+n*n,o=n;var c,u,f,m,p;for(e=Js;e;--e)if(p=this.e*Math.sin(o),c=Math.sqrt(1-p*p)*Math.tan(o),u=this.a*Es(this.e0,this.e1,this.e2,this.e3,o),f=this.e0-2*this.e1*Math.cos(2*o)+4*this.e2*Math.cos(4*o)-6*this.e3*Math.cos(6*o),m=u/this.a,l=(n*(c*m+
1)-m-.5*c*(m*m+r))/(this.es*Math.sin(2*o)*(m*m+r-2*n*m)/(4*c)+(n-m)*(c*f-2/Math.sin(2*o))-f),o-=l,Math.abs(l)<=ot){i=o;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),s=qt(this.long0+Math.asin(a*c/this.a)/Math.sin(i))}return t.x=s,t.y=i,t},names:["Polyconic","poly"]},Zs={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=6.7E-4,this.A[10]=
-3.4E-4,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,
this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var s,i=t.x,a=t.y-this.lat0,h=i-this.long0,e=a/at*1E-5,n=h,r=1,o=0;for(s=1;s<=10;s++)r*=e,o+=this.A[s]*r;var l,M=o,c=n,u=1,f=0,m=0,p=0;for(s=1;s<=6;s++)l=f*M+u*c,u=u*M-f*c,f=l,m=m+
this.B_re[s]*u-this.B_im[s]*f,p=p+this.B_im[s]*u+this.B_re[s]*f;return t.x=p*this.a+this.x0,t.y=m*this.a+this.y0,t},inverse:function(t){var s,i,a=t.x,h=t.y,e=a-this.x0,n=(h-this.y0)/this.a,r=e/this.a,o=1,l=0,M=0,c=0;for(s=1;s<=6;s++)i=l*n+o*r,o=o*n-l*r,l=i,M=M+this.C_re[s]*o-this.C_im[s]*l,c=c+this.C_im[s]*o+this.C_re[s]*l;for(var u=0;u<this.iterations;u++){var f,m=M,p=c,d=n,y=r;for(s=2;s<=6;s++)f=p*M+m*c,m=m*M-p*c,p=f,d+=(s-1)*(this.B_re[s]*m-this.B_im[s]*p),y+=(s-1)*(this.B_im[s]*m+this.B_re[s]*
p);m=1,p=0;var _=this.B_re[1],x=this.B_im[1];for(s=2;s<=6;s++)f=p*M+m*c,m=m*M-p*c,p=f,_+=s*(this.B_re[s]*m-this.B_im[s]*p),x+=s*(this.B_im[s]*m+this.B_re[s]*p);var v=_*_+x*x;M=(d*_+y*x)/v,c=(y*_-d*x)/v}var g=M,b=c,w=1,A=0;for(s=1;s<=9;s++)w*=g,A+=this.D[s]*w;var C=this.lat0+A*at*1E5,E=this.long0+b;return t.x=E,t.y=C,t},names:["New_Zealand_Map_Grid","nzmg"]},Ys={init:function(){},forward:function(t){var s=t.x,i=t.y,a=qt(s-this.long0),h=this.x0+this.a*a,e=this.y0+this.a*Math.log(Math.tan(Math.PI/4+
i/2.5))*1.25;return t.x=h,t.y=e,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s=qt(this.long0+t.x/this.a),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=s,t.y=i,t},names:["Miller_Cylindrical","mill"]},$s=20,ti={init:function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=is(this.es)},forward:function(t){var s,i,a=t.x,h=t.y;if(a=qt(a-this.long0),this.sphere){if(this.m)for(var e=this.n*Math.sin(h),n=$s;n;--n){var r=
(this.m*h+Math.sin(h)-e)/(this.m+Math.cos(h));if(h-=r,Math.abs(r)<ot)break}else h=1!==this.n?Math.asin(this.n*Math.sin(h)):h;s=this.a*this.C_x*a*(this.m+Math.cos(h)),i=this.a*this.C_y*h}else{var o=Math.sin(h),l=Math.cos(h);i=this.a*as(h,o,l,this.en),s=this.a*a*l/Math.sqrt(1-this.es*o*o)}return t.x=s,t.y=i,t},inverse:function(t){var s,i,a,h;return t.x-=this.x0,a=t.x/this.a,t.y-=this.y0,s=t.y/this.a,this.sphere?(s/=this.C_y,a/=this.C_x*(this.m+Math.cos(s)),this.m?s=Fs((this.m*s+Math.sin(s))/this.n):
1!==this.n&&(s=Fs(Math.sin(s)/this.n)),a=qt(a+this.long0),s=Is(s)):(s=hs(t.y/this.a,this.es,this.en),(h=Math.abs(s))<ht?(h=Math.sin(s),i=this.long0+t.x*Math.sqrt(1-this.es*h*h)/(this.a*Math.cos(s)),a=qt(i)):h-ot<ht&&(a=this.long0)),t.x=a,t.y=s,t},names:["Sinusoidal","sinu"]},si={init:function(){},forward:function(t){for(var s=t.x,i=t.y,a=qt(s-this.long0),h=i,e=Math.PI*Math.sin(i);;){var n=-(h+Math.sin(h)-e)/(1+Math.cos(h));if(h+=n,Math.abs(n)<ot)break}h/=2,Math.PI/2-Math.abs(i)<ot&&(a=0);var r=.900316316158*
this.a*a*Math.cos(h)+this.x0,o=1.4142135623731*this.a*Math.sin(h)+this.y0;return t.x=r,t.y=o,t},inverse:function(t){var s,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),s=Math.asin(i);var a=qt(this.long0+t.x/(.900316316158*this.a*Math.cos(s)));a<-Math.PI&&(a=-Math.PI),a>Math.PI&&(a=Math.PI),i=(2*s+Math.sin(2*s))/Math.PI,Math.abs(i)>1&&(i=1);var h=Math.asin(i);return t.x=a,t.y=h,t},names:["Mollweide","moll"]},ii={init:function(){Math.abs(this.lat1+
this.lat2)<ot||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ps(this.es),this.e1=Ns(this.es),this.e2=Ss(this.es),this.e3=ks(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=St(this.e,this.sinphi,this.cosphi),this.ml1=Es(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<ot?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=St(this.e,
this.sinphi,this.cosphi),this.ml2=Es(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Es(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var s,i=t.x,a=t.y;if(this.sphere)s=this.a*(this.g-a);else{var h=Es(this.e0,this.e1,this.e2,this.e3,a);s=this.a*(this.g-h)}var e=this.ns*qt(i-this.long0),n=this.x0+s*Math.sin(e),r=this.y0+this.rh-s*Math.cos(e);return t.x=n,t.y=r,t},
inverse:function(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var s,i,a,h;this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1);var e=0;if(0!==i&&(e=Math.atan2(s*t.x,s*t.y)),this.sphere)return h=qt(this.long0+e/this.ns),a=Is(this.g-i/this.a),t.x=h,t.y=a,t;var n=this.g-i/this.a;return a=Os(n,this.e0,this.e1,this.e2,this.e3),h=qt(this.long0+e/this.ns),t.x=h,t.y=a,t},names:["Equidistant_Conic","eqdc"]},ai={init:function(){this.R=this.a},forward:function(t){var s,i,a=t.x,h=t.y,
e=qt(a-this.long0);Math.abs(h)<=ot&&(s=this.x0+this.R*e,i=this.y0);var n=Fs(2*Math.abs(h/Math.PI));(Math.abs(e)<=ot||Math.abs(Math.abs(h)-ht)<=ot)&&(s=this.x0,i=h>=0?this.y0+Math.PI*this.R*Math.tan(.5*n):this.y0+Math.PI*this.R*-Math.tan(.5*n));var r=.5*Math.abs(Math.PI/e-e/Math.PI),o=r*r,l=Math.sin(n),M=Math.cos(n),c=M/(l+M-1),u=c*c,f=c*(2/l-1),m=f*f,p=Math.PI*this.R*(r*(c-m)+Math.sqrt(o*(c-m)*(c-m)-(m+o)*(u-m)))/(m+o);e<0&&(p=-p),s=this.x0+p;var d=o+c;return p=Math.PI*this.R*(f*d-r*Math.sqrt((m+
o)*(o+1)-d*d))/(m+o),i=h>=0?this.y0+p:this.y0-p,t.x=s,t.y=i,t},inverse:function(t){var s,i,a,h,e,n,r,o,l,M,c,u,f;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,a=t.x/c,h=t.y/c,e=a*a+h*h,n=-Math.abs(h)*(1+e),r=n-2*h*h+a*a,o=-2*n+1+2*h*h+e*e,f=h*h/o+(2*r*r*r/o/o/o-9*n*r/o/o)/27,l=(n-r*r/3/o)/o,M=2*Math.sqrt(-l/3),c=3*f/l/M,Math.abs(c)>1&&(c=c>=0?1:-1),u=Math.acos(c)/3,i=t.y>=0?(-M*Math.cos(u+Math.PI/3)-r/3/o)*Math.PI:-(-M*Math.cos(u+Math.PI/3)-r/3/o)*Math.PI,s=Math.abs(a)<ot?this.long0:qt(this.long0+
Math.PI*(e-1+Math.sqrt(1+2*(a*a-h*h)+e*e))/2/a),t.x=s,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","vandg"]},hi={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},forward:function(t){var s,i,a,h,e,n,r,o,l,M,c,u,f,m,p,d,y,_,x,v,g,b,w,A=t.x,C=t.y,E=Math.sin(t.y),P=Math.cos(t.y),N=qt(A-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=ot?(t.x=this.x0+this.a*(ht-C)*Math.sin(N),t.y=this.y0-this.a*(ht-C)*Math.cos(N),t):Math.abs(this.sin_p12+1)<=ot?(t.x=this.x0+
this.a*(ht+C)*Math.sin(N),t.y=this.y0+this.a*(ht+C)*Math.cos(N),t):(_=this.sin_p12*E+this.cos_p12*P*Math.cos(N),d=Math.acos(_),y=d/Math.sin(d),t.x=this.x0+this.a*y*P*Math.sin(N),t.y=this.y0+this.a*y*(this.cos_p12*E-this.sin_p12*P*Math.cos(N)),t):(s=Ps(this.es),i=Ns(this.es),a=Ss(this.es),h=ks(this.es),Math.abs(this.sin_p12-1)<=ot?(e=this.a*Es(s,i,a,h,ht),n=this.a*Es(s,i,a,h,C),t.x=this.x0+(e-n)*Math.sin(N),t.y=this.y0-(e-n)*Math.cos(N),t):Math.abs(this.sin_p12+1)<=ot?(e=this.a*Es(s,i,a,h,ht),n=this.a*
Es(s,i,a,h,C),t.x=this.x0+(e+n)*Math.sin(N),t.y=this.y0+(e+n)*Math.cos(N),t):(r=E/P,o=qs(this.a,this.e,this.sin_p12),l=qs(this.a,this.e,E),M=Math.atan((1-this.es)*r+this.es*o*this.sin_p12/(l*P)),c=Math.atan2(Math.sin(N),this.cos_p12*Math.tan(M)-this.sin_p12*Math.cos(N)),x=0===c?Math.asin(this.cos_p12*Math.sin(M)-this.sin_p12*Math.cos(M)):Math.abs(Math.abs(c)-Math.PI)<=ot?-Math.asin(this.cos_p12*Math.sin(M)-this.sin_p12*Math.cos(M)):Math.asin(Math.sin(N)*Math.cos(M)/Math.sin(c)),u=this.e*this.sin_p12/
Math.sqrt(1-this.es),f=this.e*this.cos_p12*Math.cos(c)/Math.sqrt(1-this.es),m=u*f,p=f*f,v=x*x,g=v*x,b=g*x,w=b*x,d=o*x*(1-v*p*(1-p)/6+g/8*m*(1-2*p)+b/120*(p*(4-7*p)-3*u*u*(1-7*p))-w/48*m),t.x=this.x0+d*Math.sin(c),t.y=this.y0+d*Math.cos(c),t))},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var s,i,a,h,e,n,r,o,l,M,c,u,f,m,p,d,y,_,x,v,g,b,w;if(this.sphere){if((s=Math.sqrt(t.x*t.x+t.y*t.y))>2*ht*this.a)return;return i=s/this.a,a=Math.sin(i),h=Math.cos(i),e=this.long0,Math.abs(s)<=ot?n=this.lat0:(n=Fs(h*
this.sin_p12+t.y*a*this.cos_p12/s),r=Math.abs(this.lat0)-ht,e=qt(Math.abs(r)<=ot?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*a,s*this.cos_p12*h-t.y*this.sin_p12*a))),t.x=e,t.y=n,t}return o=Ps(this.es),l=Ns(this.es),M=Ss(this.es),c=ks(this.es),Math.abs(this.sin_p12-1)<=ot?(u=this.a*Es(o,l,M,c,ht),s=Math.sqrt(t.x*t.x+t.y*t.y),f=u-s,n=Os(f/this.a,o,l,M,c),e=qt(this.long0+Math.atan2(t.x,-1*t.y)),t.x=e,t.y=n,t):Math.abs(this.sin_p12+1)<=ot?(u=
this.a*Es(o,l,M,c,ht),s=Math.sqrt(t.x*t.x+t.y*t.y),f=s-u,n=Os(f/this.a,o,l,M,c),e=qt(this.long0+Math.atan2(t.x,t.y)),t.x=e,t.y=n,t):(s=Math.sqrt(t.x*t.x+t.y*t.y),d=Math.atan2(t.x,t.y),m=qs(this.a,this.e,this.sin_p12),y=Math.cos(d),_=this.e*this.cos_p12*y,x=-_*_/(1-this.es),v=3*this.es*(1-x)*this.sin_p12*this.cos_p12*y/(1-this.es),g=s/m,b=g-x*(1+x)*Math.pow(g,3)/6-v*(1+3*x)*Math.pow(g,4)/24,w=1-x*b*b/2-g*b*b*b/6,p=Math.asin(this.sin_p12*Math.cos(b)+this.cos_p12*Math.sin(b)*y),e=qt(this.long0+Math.asin(Math.sin(d)*
Math.sin(b)/Math.cos(p))),n=Math.atan((1-this.es*w*this.sin_p12/Math.sin(p))*Math.tan(p)/(1-this.es)),t.x=e,t.y=n,t)},names:["Azimuthal_Equidistant","aeqd"]},ei={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var s,i,a,h,e,n,r,o=t.x,l=t.y;return a=qt(o-this.long0),s=Math.sin(l),i=Math.cos(l),h=Math.cos(a),((e=this.sin_p14*s+this.cos_p14*i*h)>0||Math.abs(e)<=ot)&&(n=1*this.a*i*Math.sin(a),r=this.y0+1*this.a*(this.cos_p14*s-this.sin_p14*i*h)),
t.x=n,t.y=r,t},inverse:function(t){var s,i,a,h,e,n,r;return t.x-=this.x0,t.y-=this.y0,s=Math.sqrt(t.x*t.x+t.y*t.y),i=Fs(s/this.a),a=Math.sin(i),h=Math.cos(i),n=this.long0,Math.abs(s)<=ot?(r=this.lat0,t.x=n,t.y=r,t):(r=Fs(h*this.sin_p14+t.y*a*this.cos_p14/s),e=Math.abs(this.lat0)-ht,Math.abs(e)<=ot?(n=qt(this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=r,t):(n=qt(this.long0+Math.atan2(t.x*a,s*this.cos_p14*h-t.y*this.sin_p14*a)),t.x=n,t.y=r,t))},names:["ortho"]},
ni={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ri={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4},oi={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=ht-ct/2?this.face=ni.TOP:this.lat0<=-(ht-ct/2)?this.face=ni.BOTTOM:Math.abs(this.long0)<=ct?this.face=ni.FRONT:Math.abs(this.long0)<=ht+ct?this.face=this.long0>0?ni.RIGHT:ni.LEFT:this.face=ni.BACK,0!==this.es&&
(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var s,i,a,h,e,n,r={x:0,y:0},o={value:0};if(t.x-=this.long0,s=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===ni.TOP)h=ht-s,i>=ct&&i<=ht+ct?(o.value=ri.AREA_0,a=i-ht):i>ht+ct||i<=-(ht+ct)?(o.value=ri.AREA_1,a=i>0?i-ft:i+ft):i>-(ht+ct)&&i<=-ct?(o.value=ri.AREA_2,a=i+ht):(o.value=ri.AREA_3,a=i);else if(this.face===ni.BOTTOM)h=ht+s,i>=ct&&i<=ht+
ct?(o.value=ri.AREA_0,a=-i+ht):i<ct&&i>=-ct?(o.value=ri.AREA_1,a=-i):i<-ct&&i>=-(ht+ct)?(o.value=ri.AREA_2,a=-i-ht):(o.value=ri.AREA_3,a=i>0?-i+ft:-i-ft);else{var l,M,c,u,f,m;this.face===ni.RIGHT?i=Z(i,+ht):this.face===ni.BACK?i=Z(i,+ft):this.face===ni.LEFT&&(i=Z(i,-ht)),u=Math.sin(s),f=Math.cos(s),m=Math.sin(i),l=f*Math.cos(i),M=f*m,c=u,this.face===ni.FRONT?a=V(h=Math.acos(l),c,M,o):this.face===ni.RIGHT?a=V(h=Math.acos(M),c,-l,o):this.face===ni.BACK?a=V(h=Math.acos(-l),c,-M,o):this.face===ni.LEFT?
a=V(h=Math.acos(-M),c,l,o):(h=a=0,o.value=ri.AREA_0)}return n=Math.atan(12/ft*(a+Math.acos(Math.sin(a)*Math.cos(ct))-ht)),e=Math.sqrt((1-Math.cos(h))/(Math.cos(n)*Math.cos(n))/(1-Math.cos(Math.atan(1/Math.cos(a))))),o.value===ri.AREA_1?n+=ht:o.value===ri.AREA_2?n+=ft:o.value===ri.AREA_3&&(n+=1.5*ft),r.x=e*Math.cos(n),r.y=e*Math.sin(n),r.x=r.x*this.a+this.x0,r.y=r.y*this.a+this.y0,t.x=r.x,t.y=r.y,t},inverse:function(t){var s,i,a,h,e,n,r,o,l,M={lam:0,phi:0},c={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=
(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),s=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?c.value=ri.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(c.value=ri.AREA_1,s-=ht):t.x<0&&-t.x>=Math.abs(t.y)?(c.value=ri.AREA_2,s=s<0?s+ft:s-ft):(c.value=ri.AREA_3,s+=ht),l=ft/12*Math.tan(s),e=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),n=Math.atan(e),a=Math.cos(s),h=Math.tan(i),(r=1-a*a*h*h*(1-Math.cos(Math.atan(1/Math.cos(n)))))<-1?r=-1:r>1&&(r=1),this.face===ni.TOP)o=Math.acos(r),M.phi=ht-o,c.value===
ri.AREA_0?M.lam=n+ht:c.value===ri.AREA_1?M.lam=n<0?n+ft:n-ft:c.value===ri.AREA_2?M.lam=n-ht:M.lam=n;else if(this.face===ni.BOTTOM)o=Math.acos(r),M.phi=o-ht,c.value===ri.AREA_0?M.lam=-n+ht:c.value===ri.AREA_1?M.lam=-n:c.value===ri.AREA_2?M.lam=-n-ht:M.lam=n<0?-n-ft:-n+ft;else{var u,f,m;l=(u=r)*u,f=(l+=(m=l>=1?0:Math.sqrt(1-l)*Math.sin(n))*m)>=1?0:Math.sqrt(1-l),c.value===ri.AREA_1?(l=f,f=-m,m=l):c.value===ri.AREA_2?(f=-f,m=-m):c.value===ri.AREA_3&&(l=f,f=m,m=-l),this.face===ni.RIGHT?(l=u,u=-f,f=l):
this.face===ni.BACK?(u=-u,f=-f):this.face===ni.LEFT&&(l=u,u=f,f=-l),M.phi=Math.acos(-m)-ht,M.lam=Math.atan2(f,u),this.face===ni.RIGHT?M.lam=Z(M.lam,-ht):this.face===ni.BACK?M.lam=Z(M.lam,-ft):this.face===ni.LEFT&&(M.lam=Z(M.lam,+ht))}if(0!==this.es){var p,d,y;p=M.phi<0?1:0,d=Math.tan(M.phi),y=this.b/Math.sqrt(d*d+this.one_minus_f_squared),M.phi=Math.atan(Math.sqrt(this.a*this.a-y*y)/(this.one_minus_f*y)),p&&(M.phi=-M.phi)}return M.lam+=this.long0,t.x=M.lam,t.y=M.phi,t},names:["Quadrilateralized Spherical Cube",
"Quadrilateralized_Spherical_Cube","qsc"]},li=[[1,2.2199E-17,-7.15515E-5,3.1103E-6],[.9986,-4.82243E-4,-2.4897E-5,-1.3309E-6],[.9954,-8.3103E-4,-4.48605E-5,-9.86701E-7],[.99,-.00135364,-5.9661E-5,3.6777E-6],[.9822,-.00167442,-4.49547E-6,-5.72411E-6],[.973,-.00214868,-9.03571E-5,1.8736E-8],[.96,-.00305085,-9.00761E-5,1.64917E-6],[.9427,-.00382792,-6.53386E-5,-2.6154E-6],[.9216,-.00467746,-1.0457E-4,4.81243E-6],[.8962,-.00536223,-3.23831E-5,-5.43432E-6],[.8679,-.00609363,-1.13898E-4,3.32484E-6],[.835,
-.00698325,-6.40253E-5,9.34959E-7],[.7986,-.00755338,-5.00009E-5,9.35324E-7],[.7597,-.00798324,-3.5971E-5,-2.27626E-6],[.7186,-.00851367,-7.01149E-5,-8.6303E-6],[.6732,-.00986209,-1.99569E-4,1.91974E-5],[.6213,-.010418,8.83923E-5,6.24051E-6],[.5722,-.00906601,1.82E-4,6.24051E-6],[.5322,-.00677797,2.75608E-4,6.24051E-6]],Mi=[[-5.20417E-18,.0124,1.21431E-18,-8.45284E-11],[.062,.0124,-1.26793E-9,4.22642E-10],[.124,.0124,5.07171E-9,-1.60604E-9],[.186,.0123999,-1.90189E-8,6.00152E-9],[.248,.0124002,7.10039E-8,
-2.24E-8],[.31,.0123992,-2.64997E-7,8.35986E-8],[.372,.0124029,9.88983E-7,-3.11994E-7],[.434,.0123893,-3.69093E-6,-4.35621E-7],[.4958,.0123198,-1.02252E-5,-3.45523E-7],[.5571,.0121916,-1.54081E-5,-5.82288E-7],[.6176,.0119938,-2.41424E-5,-5.25327E-7],[.6769,.011713,-3.20223E-5,-5.16405E-7],[.7346,.0113541,-3.97684E-5,-6.09052E-7],[.7903,.0109107,-4.89042E-5,-1.04739E-6],[.8435,.0103431,-6.4615E-5,-1.40374E-9],[.8936,.00969686,-6.4636E-5,-8.547E-6],[.9394,.00840947,-1.92841E-4,-4.2106E-6],[.9761,.00616527,
-2.56E-4,-4.2106E-6],[1,.00328947,-3.19159E-4,-4.2106E-6]],ci=.8487,ui=1.3523,fi=Mt/5,mi=1/fi,pi=18,di=function(t,s){return t[0]+s*(t[1]+s*(t[2]+s*t[3]))},yi=function(t,s){return t[1]+s*(2*t[2]+3*s*t[3])},_i={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var s=qt(t.x-this.long0),i=Math.abs(t.y),a=Math.floor(i*fi);a<0?a=0:a>=pi&&(a=pi-1),i=Mt*(i-mi*a);var h={x:di(li[a],i)*s,y:di(Mi[a],i)};return t.y<0&&
(h.y=-h.y),h.x=h.x*this.a*ci+this.x0,h.y=h.y*this.a*ui+this.y0,h},inverse:function(t){var s={x:(t.x-this.x0)/(this.a*ci),y:Math.abs(t.y-this.y0)/(this.a*ui)};if(s.y>=1)s.x/=li[pi][0],s.y=t.y<0?-ht:ht;else{var i=Math.floor(s.y*pi);for(i<0?i=0:i>=pi&&(i=pi-1);;)if(Mi[i][0]>s.y)--i;else{if(!(Mi[i+1][0]<=s.y))break;++i}var a=Mi[i],h=5*(s.y-a[0])/(Mi[i+1][0]-a[0]);h=Y(function(t){return(di(a,t)-s.y)/yi(a,t)},h,ot,100),s.x/=di(li[i],h),s.y=(5*i+h)*lt,t.y<0&&(s.y=-s.y)}return s.x=qt(s.x+this.long0),s},names:["Robinson",
"robin"]};return I.defaultDatum="WGS84",I.Proj=Projection,I.WGS84=new I.Proj("WGS84"),I.Point=Point,I.toPoint=Ft,I.defs=o,I.transform=S,I.mgrs=ts,I.version="2.5.0",function(proj4){proj4.Proj.projections.add(es),proj4.Proj.projections.add(ms),proj4.Proj.projections.add(ds),proj4.Proj.projections.add(vs),proj4.Proj.projections.add(gs),proj4.Proj.projections.add(bs),proj4.Proj.projections.add(ws),proj4.Proj.projections.add(As),proj4.Proj.projections.add(Cs),proj4.Proj.projections.add(Rs),proj4.Proj.projections.add(Us),
proj4.Proj.projections.add(Qs),proj4.Proj.projections.add(Ws),proj4.Proj.projections.add(Ks),proj4.Proj.projections.add(Xs),proj4.Proj.projections.add(Vs),proj4.Proj.projections.add(Zs),proj4.Proj.projections.add(Ys),proj4.Proj.projections.add(ti),proj4.Proj.projections.add(si),proj4.Proj.projections.add(ii),proj4.Proj.projections.add(ai),proj4.Proj.projections.add(hi),proj4.Proj.projections.add(ei),proj4.Proj.projections.add(oi),proj4.Proj.projections.add(_i)}(I),I});
jsonpOSRM={fences:{},callbacks:{},timeouts:{},timers:{},late:function(){},empty:function(){},call:function(source,callback_function,timeout_function,timeout,id,parameter){if(jsonpOSRM.fences[id]==true)return false;jsonpOSRM.fences[id]=true;jsonpOSRM.timeouts[id]=function(response){try{timeout_function(response,parameter)}finally{jsonpOSRM.callbacks[id]=jsonpOSRM.late;jsonpOSRM.timeouts[id]=jsonpOSRM.empty;jsonpOSRM.fences[id]=undefined}};jsonpOSRM.callbacks[id]=function(response){clearTimeout(jsonpOSRM.timers[id]);
jsonpOSRM.timers[id]=undefined;try{callback_function(response,parameter)}finally{jsonpOSRM.callbacks[id]=jsonpOSRM.empty;jsonpOSRM.timeouts[id]=jsonpOSRM.late;jsonpOSRM.fences[id]=undefined}};jsonpOSRM.timers[id]=setTimeout(jsonpOSRM.timeouts[id],timeout);return true},clear:function(id){clearTimeout(jsonpOSRM.timers[id]);jsonpOSRM.callbacks[id]=jsonpOSRM.empty;jsonpOSRM.timeouts[id]=jsonpOSRM.empty;jsonpOSRM.fences[id]=undefined;var jsonp=document.getElementById("jsonp_"+id);if(jsonp)jsonp.parentNode.removeChild(jsonp)},
reset:function(){jsonpOSRM.fences={};jsonpOSRM.callbacks={};jsonpOSRM.timeouts={};jsonpOSRM.timers={}}};
osrmRequestHandler={ajaxCalls:{},paramters:{},fences:{},empty:function(){},call:function(source,callback_function,timeout_function,timeout,id,parameter,data){if(osrmRequestHandler.fences[id]==true)return false;osrmRequestHandler.fences[id]=true;osrmRequestHandler.paramters[id]=parameter;osrmRequestHandler.ajaxCalls[id]=$.ajax(source,{type:"GET",cache:true,data:data,dataType:"json",timeout:timeout}).done(function(data,textStatus,jqXHR){try{if(osrmRequestHandler.ajaxCalls[id]){if(parameter.rejectSecondCall)osrmRequestHandler.paramters[id].rejectSecondCall=
parameter.rejectSecondCall;callback_function(data,osrmRequestHandler.paramters[id])}}finally{osrmRequestHandler.paramters[id]=undefined;osrmRequestHandler.ajaxCalls[id]=undefined;osrmRequestHandler.fences[id]=undefined}}).fail(function(jqXHR,textStatus,errorThrown){try{if(osrmRequestHandler.ajaxCalls[id])timeout_function(jqXHR,osrmRequestHandler.paramters[id])}finally{osrmRequestHandler.paramters[id]=undefined;osrmRequestHandler.ajaxCalls[id]=undefined;osrmRequestHandler.fences[id]=undefined}});return true},
clear:function(id){if(id&&osrmRequestHandler.ajaxCalls[id])osrmRequestHandler.ajaxCalls[id].abort();osrmRequestHandler.ajaxCalls[id]=undefined;osrmRequestHandler.paramters[id]=undefined;osrmRequestHandler.fences[id]=undefined},reset:function(){$.each(osrmRequestHandler.ajaxCalls,function(ajaxCallId,ajaxCallItem){if(ajaxCallItem)ajaxCallItem.abort()});osrmRequestHandler.ajaxCalls={};osrmRequestHandler.paramters={};osrmRequestHandler.fences={}}};
var Localization={"en":{directions:{N:"north",NE:"northeast",E:"east",SE:"southeast",S:"south",SW:"southwest",W:"west",NW:"northwest"},instructions:{"Head":["Head {dir}"," on {road}"],"Continue":["Continue {dir}"," on {road}"],"SlightRight":["Slight right"," onto {road}"],"Right":["Right"," onto {road}"],"SharpRight":["Sharp right"," onto {road}"],"TurnAround":["Turn around"],"SharpLeft":["Sharp left"," onto {road}"],"Left":["Left"," onto {road}"],"SlightLeft":["Slight left"," onto {road}"],"WaypointReached":["Waypoint reached"],
"Roundabout":["Take the {exitStr} exit in the roundabout"," onto {road}"],"DestinationReached":["Destination reached"]},formatOrder:function(n){var i=n%10-1,suffix=["st","nd","rd"];return suffix[i]?n+suffix[i]:n+"th"},ui:{startPlaceholder:"Start",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"End"}},"de":{directions:{N:"Norden",NE:"Nordosten",E:"Osten",SE:"S\u00fcdosten",S:"S\u00fcden",SW:"S\u00fcdwesten",W:"Westen",NW:"Nordwesten"},instructions:{"Head":["Richtung {dir}"," auf {road}"],"Continue":["Geradeaus Richtung {dir}",
" auf {road}"],"SlightRight":["Leicht rechts abbiegen"," auf {road}"],"Right":["Rechts abbiegen"," auf {road}"],"SharpRight":["Scharf rechts abbiegen"," auf {road}"],"TurnAround":["Wenden"],"SharpLeft":["Scharf links abbiegen"," auf {road}"],"Left":["Links abbiegen"," auf {road}"],"SlightLeft":["Leicht links abbiegen"," auf {road}"],"WaypointReached":["Zwischenhalt erreicht"],"Roundabout":["Nehmen Sie die {exitStr} Ausfahrt im Kreisverkehr"," auf {road}"],"DestinationReached":["Sie haben ihr Ziel erreicht"]},
formatOrder:function(n){return n+"."},ui:{startPlaceholder:"Start",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Ziel"}},"sv":{directions:{N:"norr",NE:"nordost",E:"\u00f6st",SE:"sydost",S:"syd",SW:"sydv\u00e4st",W:"v\u00e4st",NW:"nordv\u00e4st"},instructions:{"Head":["\u00c5k \u00e5t {dir}"," p\u00e5 {road}"],"Continue":["Forts\u00e4tt {dir}"," p\u00e5 {road}"],"SlightRight":["Svagt h\u00f6ger"," p\u00e5 {road}"],"Right":["Sv\u00e4ng h\u00f6ger"," p\u00e5 {road}"],"SharpRight":["Skarpt h\u00f6ger",
" p\u00e5 {road}"],"TurnAround":["V\u00e4nd"],"SharpLeft":["Skarpt v\u00e4nster"," p\u00e5 {road}"],"Left":["Sv\u00e4ng v\u00e4nster"," p\u00e5 {road}"],"SlightLeft":["Svagt v\u00e4nster"," p\u00e5 {road}"],"WaypointReached":["Viapunkt n\u00e5dd"],"Roundabout":["Tag {exitStr} avfarten i rondellen"," till {road}"],"DestinationReached":["Framme vid resans m\u00e5l"]},formatOrder:function(n){return["f\u00f6rsta","andra","tredje","fj\u00e4rde","femte","sj\u00e4tte","sjunde","\u00e5ttonde","nionde","tionde"][n-
1]},ui:{startPlaceholder:"Fr\u00e5n",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Till"}},"sp":{directions:{N:"norte",NE:"noreste",E:"este",SE:"sureste",S:"sur",SW:"suroeste",W:"oeste",NW:"noroeste"},instructions:{"Head":["Derecho {dir}"," sobre {road}"],"Continue":["Continuar {dir}"," en {road}"],"SlightRight":["Leve giro a la derecha"," sobre {road}"],"Right":["Derecha"," sobre {road}"],"SharpRight":["Giro pronunciado a la derecha"," sobre {road}"],"TurnAround":["Dar vuelta"],"SharpLeft":["Giro pronunciado a la izquierda",
" sobre {road}"],"Left":["Izquierda"," en {road}"],"SlightLeft":["Leve giro a la izquierda"," en {road}"],"WaypointReached":["Lleg\u00f3 a un punto del camino"],"Roundabout":["Tomar {exitStr} salida en la rotonda"," en {road}"],"DestinationReached":["Llegada a destino"]},formatOrder:function(n){return n+"\u00ba"},ui:{startPlaceholder:"Inicio",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Destino"}},"nl":{directions:{N:"noordelijke",NE:"noordoostelijke",E:"oostelijke",SE:"zuidoostelijke",S:"zuidelijke",
SW:"zuidewestelijke",W:"westelijke",NW:"noordwestelijke"},instructions:{"Head":["Vertrek in {dir} richting"," de {road} op"],"Continue":["Ga in {dir} richting"," de {road} op"],"SlightRight":["Volg de weg naar rechts"," de {road} op"],"Right":["Ga rechtsaf"," de {road} op"],"SharpRight":["Ga scherpe bocht naar rechts"," de {road} op"],"TurnAround":["Keer om"],"SharpLeft":["Ga scherpe bocht naar links"," de {road} op"],"Left":["Ga linksaf"," de {road} op"],"SlightLeft":["Volg de weg naar links"," de {road} op"],
"WaypointReached":["Aangekomen bij tussenpunt"],"Roundabout":["Neem de {exitStr} afslag op de rotonde"," de {road} op"],"DestinationReached":["Aangekomen op eindpunt"]},formatOrder:function(n){if(n===1||n>=20)return n+"ste";else return n+"de"},ui:{startPlaceholder:"Vertrekpunt",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Bestemming"}},"fr":{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ouest",W:"ouest",NW:"nord-ouest"},instructions:{"Head":["Tout droit au {dir}"," sur {road}"],
"Continue":["Continuer au {dir}"," sur {road}"],"SlightRight":["L\u00e9g\u00e8rement \u00e0 droite"," sur {road}"],"Right":["A droite"," sur {road}"],"SharpRight":["Compl\u00e8tement \u00e0 droite"," sur {road}"],"TurnAround":["Faire demi-tour"],"SharpLeft":["Compl\u00e8tement \u00e0 gauche"," sur {road}"],"Left":["A gauche"," sur {road}"],"SlightLeft":["L\u00e9g\u00e8rement \u00e0 gauche"," sur {road}"],"WaypointReached":["Point d'\u00e9tape atteint"],"Roundabout":["Au rond-point, prenez la {exitStr} sortie",
" sur {road}"],"DestinationReached":["Destination atteinte"]},formatOrder:function(n){return n+"\u00ba"},ui:{startPlaceholder:"D\u00e9part",viaPlaceholder:"Interm\u00e9diaire {viaNumber}",endPlaceholder:"Arriv\u00e9e"}},"it":{directions:{N:"nord",NE:"nord-est",E:"est",SE:"sud-est",S:"sud",SW:"sud-ovest",W:"ovest",NW:"nord-ovest"},instructions:{"Head":["Dritto verso {dir}"," su {road}"],"Continue":["Continuare verso {dir}"," su {road}"],"SlightRight":["Mantenere la destra"," su {road}"],"Right":["A destra",
" su {road}"],"SharpRight":["Strettamente a destra"," su {road}"],"TurnAround":["Fare inversione di marcia"],"SharpLeft":["Strettamente a sinistra"," su {road}"],"Left":["A sinistra"," sur {road}"],"SlightLeft":["Mantenere la sinistra"," su {road}"],"WaypointReached":["Punto di passaggio raggiunto"],"Roundabout":["Alla rotonda, prendere la {exitStr} uscita"],"DestinationReached":["Destinazione raggiunta"]},formatOrder:function(n){return n+"\u00ba"},ui:{startPlaceholder:"Partenza",viaPlaceholder:"Intermedia {viaNumber}",
endPlaceholder:"Destinazione"}},"pt":{directions:{N:"norte",NE:"nordeste",E:"leste",SE:"sudeste",S:"sul",SW:"sudoeste",W:"oeste",NW:"noroeste"},instructions:{"Head":["Siga {dir}"," na {road}"],"Continue":["Continue {dir}"," na {road}"],"SlightRight":["Curva ligeira a direita"," na {road}"],"Right":["Curva a direita"," na {road}"],"SharpRight":["Curva fechada a direita"," na {road}"],"TurnAround":["Retorne"],"SharpLeft":["Curva fechada a esquerda"," na {road}"],"Left":["Curva a esquerda"," na {road}"],
"SlightLeft":["Curva ligueira a esquerda"," na {road}"],"WaypointReached":["Ponto de interesse atingido"],"Roundabout":["Pegue a {exitStr} sa\u00edda na rotat\u00f3ria"," na {road}"],"DestinationReached":["Destino atingido"]},formatOrder:function(n){return n+"\u00ba"},ui:{startPlaceholder:"Origem",viaPlaceholder:"Interm\u00e9dio {viaNumber}",endPlaceholder:"Destino"}},"sk":{directions:{N:"sever",NE:"serverov\u00fdchod",E:"v\u00fdchod",SE:"juhov\u00fdchod",S:"juh",SW:"juhoz\u00e1pad",W:"z\u00e1pad",
NW:"serveroz\u00e1pad"},instructions:{"Head":["Mierte na {dir}"," na {road}"],"Continue":["Pokra\u010dujte na {dir}"," na {road}"],"SlightRight":["Mierne doprava"," na {road}"],"Right":["Doprava"," na {road}"],"SharpRight":["Prudko doprava"," na {road}"],"TurnAround":["Oto\u010dte sa"],"SharpLeft":["Prudko do\u013eava"," na {road}"],"Left":["Do\u013eava"," na {road}"],"SlightLeft":["Mierne do\u013eava"," na {road}"],"WaypointReached":["Ste v prejazdovom bode."],"Roundabout":["Odbo\u010dte na {exitStr} v\u00fdjazde",
" na {road}"],"DestinationReached":["Pri\u0161li ste do cie\u013ea."]},formatOrder:function(n){var i=n%10-1,suffix=[".",".","."];return suffix[i]?n+suffix[i]:n+"."},ui:{startPlaceholder:"Za\u010diatok",viaPlaceholder:"Cez {viaNumber}",endPlaceholder:"Koniec"}},"el":{directions:{N:"\u03b2\u03cc\u03c1\u03b5\u03b9\u03b1",NE:"\u03b2\u03bf\u03c1\u03b5\u03b9\u03bf\u03b1\u03bd\u03b1\u03c4\u03bf\u03bb\u03b9\u03ba\u03ac",E:"\u03b1\u03bd\u03b1\u03c4\u03bf\u03bb\u03b9\u03ba\u03ac",SE:"\u03bd\u03bf\u03c4\u03b9\u03bf\u03b1\u03bd\u03b1\u03c4\u03bf\u03bb\u03b9\u03ba\u03ac",
S:"\u03bd\u03cc\u03c4\u03b9\u03b1",SW:"\u03bd\u03bf\u03c4\u03b9\u03bf\u03b4\u03c5\u03c4\u03b9\u03ba\u03ac",W:"\u03b4\u03c5\u03c4\u03b9\u03ba\u03ac",NW:"\u03b2\u03bf\u03c1\u03b5\u03b9\u03bf\u03b4\u03c5\u03c4\u03b9\u03ba\u03ac"},instructions:{"Head":["\u039a\u03b1\u03c4\u03b5\u03c5\u03b8\u03c5\u03bd\u03b8\u03b5\u03af\u03c4\u03b5 {dir}"," \u03c3\u03c4\u03b7\u03bd {road}"],"Continue":["\u03a3\u03c5\u03bd\u03b5\u03c7\u03af\u03c3\u03c4\u03b5 {dir}"," \u03c3\u03c4\u03b7\u03bd {road}"],"SlightRight":["\u0395\u03bb\u03b1\u03c6\u03c1\u03ce\u03c2 \u03b4\u03b5\u03be\u03b9\u03ac",
" \u03c3\u03c4\u03b7\u03bd {road}"],"Right":["\u0394\u03b5\u03be\u03b9\u03ac"," \u03c3\u03c4\u03b7\u03bd {road}"],"SharpRight":["\u0391\u03c0\u03cc\u03c4\u03bf\u03bc\u03b7 \u03b4\u03b5\u03be\u03b9\u03ac \u03c3\u03c4\u03c1\u03bf\u03c6\u03ae"," \u03c3\u03c4\u03b7\u03bd {road}"],"TurnAround":["\u039a\u03ac\u03bd\u03c4\u03b5 \u03b1\u03bd\u03b1\u03c3\u03c4\u03c1\u03bf\u03c6\u03ae"],"SharpLeft":["\u0391\u03c0\u03cc\u03c4\u03bf\u03bc\u03b7 \u03b1\u03c1\u03b9\u03c3\u03c4\u03b5\u03c1\u03ae \u03c3\u03c4\u03c1\u03bf\u03c6\u03ae",
" \u03c3\u03c4\u03b7\u03bd {road}"],"Left":["\u0391\u03c1\u03b9\u03c3\u03c4\u03b5\u03c1\u03ac"," \u03c3\u03c4\u03b7\u03bd {road}"],"SlightLeft":["\u0395\u03bb\u03b1\u03c6\u03c1\u03ce\u03c2 \u03b1\u03c1\u03b9\u03c3\u03c4\u03b5\u03c1\u03ac"," \u03c3\u03c4\u03b7\u03bd {road}"],"WaypointReached":["\u03a6\u03c4\u03ac\u03c3\u03b1\u03c4\u03b5 \u03c3\u03c4\u03bf \u03c3\u03b7\u03bc\u03b5\u03af\u03bf \u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03ac\u03c2"],"Roundabout":["\u0391\u03ba\u03bf\u03bb\u03bf\u03c5\u03b8\u03ae\u03c3\u03c4\u03b5 \u03c4\u03b7\u03bd {exitStr} \u03ad\u03be\u03bf\u03b4\u03bf \u03c3\u03c4\u03bf \u03ba\u03c5\u03ba\u03bb\u03b9\u03ba\u03cc \u03ba\u03cc\u03bc\u03b2\u03bf",
" \u03c3\u03c4\u03b7\u03bd {road}"],"DestinationReached":["\u03a6\u03c4\u03ac\u03c3\u03b1\u03c4\u03b5 \u03c3\u03c4\u03bf\u03bd \u03c0\u03c1\u03bf\u03bf\u03c1\u03b9\u03c3\u03bc\u03cc \u03c3\u03b1\u03c2"]},formatOrder:function(n){return n+"\u00ba"},ui:{startPlaceholder:"\u0391\u03c6\u03b5\u03c4\u03b7\u03c1\u03af\u03b1",viaPlaceholder:"\u03bc\u03ad\u03c3\u03c9 {viaNumber}",endPlaceholder:"\u03a0\u03c1\u03bf\u03bf\u03c1\u03b9\u03c3\u03bc\u03cc\u03c2"}}};
function initPointerMoveEvent(){map.on("pointermove",function(evt){if(evt.dragging)return;let pixel=map.getEventPixel(evt.originalEvent);handleFeatureHoverAtPixel(pixel)})}
function handleFeatureHoverAtPixel(pixel){let wfsFeatures=[];let otherVectorFeatures=[];let hit=map.hasFeatureAtPixel(pixel);map.getViewport().style.cursor=hit?"pointer":"";map.forEachFeatureAtPixel(pixel,function(cluster){let features=cluster.get("features");if(features)features.forEach(function(feature){setHovered(feature,wfsFeatures,otherVectorFeatures)});else setHovered(cluster,wfsFeatures,otherVectorFeatures)});hoverWfsFeatures(wfsFeatures);hoverRoutingFeatureInfo(otherVectorFeatures,pixel)}
function setHovered(feature,wfsFeatures,otherVectorFeatures){feature.set("isHovered",true);if(feature.get("wfs"))wfsFeatures.push(feature);else otherVectorFeatures.push(feature)};
jsonpWFS={fences:{},callbacks:{},timeouts:{},timers:{},late:function(){},empty:function(){},call:function(source,callback_function,timeout_function,timeout,id,parameter){if(jsonpWFS.fences[id]==true)return false;jsonpWFS.fences[id]=true;jsonpWFS.timeouts[id]=function(response){try{timeout_function(response,parameter)}finally{jsonpWFS.callbacks[id]=jsonpWFS.late;jsonpWFS.timeouts[id]=jsonpWFS.empty;jsonpWFS.fences[id]=undefined}};jsonpWFS.callbacks[id]=function(response){clearTimeout(jsonpWFS.timers[id]);
jsonpWFS.timers[id]=undefined;try{callback_function(response,parameter)}finally{jsonpWFS.callbacks[id]=jsonpWFS.empty;jsonpWFS.timeouts[id]=jsonpWFS.late;jsonpWFS.fences[id]=undefined}};var jsonp=document.getElementById("jsonp_"+id);if(jsonp)jsonp.parentNode.removeChild(jsonp);var script=document.createElement("script");script.type="text/javascript";script.id="jsonp_"+id;script.src=source.replace(/%jsonp/,"callback:jsonpWFS.callbacks."+id);document.head.appendChild(script);jsonpWFS.timers[id]=setTimeout(jsonpWFS.timeouts[id],
timeout);return true},clear:function(id){clearTimeout(jsonpWFS.timers[id]);jsonpWFS.callbacks[id]=jsonpWFS.empty;jsonpWFS.timeouts[id]=jsonpWFS.empty;jsonpWFS.fences[id]=undefined;var jsonp=document.getElementById("jsonp_"+id);if(jsonp)jsonp.parentNode.removeChild(jsonp)},reset:function(){jsonpWFS.fences={};jsonpWFS.callbacks={};jsonpWFS.timeouts={};jsonpWFS.timers={}}};
var wfsCluster=null;var wfsVectorLayer=null;var wfsVectorSource=null;var wfsUpdateTimeoutId=null;var obstructionLayer=null;var obstructionSource=null;var obstructionCluster=null;var roadworkLayer=null;var roadworkSource=null;var roadworkCluster=null;var unclusteredLayer=null;var unclusteredSource=null;var hoveredWfsFeatures=[];var notUrbanResolutionStart=850;var wfsLayerString="";function clearLayers(){clearWfsSources();wfsVectorLayer.setVisible(false);unclusteredLayer.setVisible(false)}
function clearWfsSources(){unclusteredSource.clear();wfsVectorSource.clear()}
function showLayers(wfsFeatures){clearWfsSources();var unclusteredFeatures=[];var clusteredFeatures=[];wfsFeatures.forEach(function(feature){var displayType=feature.get("display_type");if(displayType=="CONGESTION")unclusteredFeatures.push(feature);else clusteredFeatures.push(feature)});unclusteredSource.addFeatures(unclusteredFeatures);wfsVectorSource.addFeatures(clusteredFeatures);wfsVectorLayer.setVisible(true);unclusteredLayer.setVisible(true)}
function initWFSLayers(){unclusteredSource=new ol.source.Vector({format:new ol.format.GeoJSON,projection:mapProjectionName,strategy:ol.loadingstrategy.bbox,loader:function(extent,resolution,projection){}});wfsVectorSource=new ol.source.Vector({format:new ol.format.GeoJSON,projection:mapProjectionName,strategy:ol.loadingstrategy.bbox,loader:function(extent,resolution,projection){}});wfsCluster=new ol.source.Cluster({distance:13,source:wfsVectorSource});unclusteredLayer=new ol.layer.Vector({source:unclusteredSource,
style:getStyle,minResolution:0,maxResolution:notUrbanResolutionStart});map.addLayer(unclusteredLayer);wfsVectorLayer=new ol.layer.Vector({source:wfsCluster,style:getStyle,minResolution:0,maxResolution:notUrbanResolutionStart});map.addLayer(wfsVectorLayer);preLoadAllImages()}
function getStyle(feature,resolution){var features=feature.get("features");if(features){var size=features.length;if(size>1){var ret=null;for(var i=0;i<features.length;i++){var currentFeature=features[i];var style=getWfsLayerStyle(currentFeature,resolution);if(style!=null&&(ret==null||ret.zIndex_<=style.zIndex_))ret=style}return ret}else return getWfsLayerStyle(features[0],resolution)}else return getWfsLayerStyle(feature,resolution)}
function handleWfsLayersUpdate(){if(wfsUpdateTimeoutId)clearTimeout(wfsUpdateTimeoutId);var mapResolution=map.getView().getResolution();if(mapResolution>notUrbanResolutionStart){clearLayers();map.render()}wfsUpdateTimeoutId=setTimeout(function(){updateWfsLayerStrings();var resolution=map.getView().getResolution();var extent=map.getView().calculateExtent(map.getSize());wfsVectorSourceLoader(resolution,extent)},300)}
function updateWfsLayerStrings(){wfsLayerString="";var currentZoom=getMapCurrentZoomLevelInteger();if(isParkingInfosVisible){if(isLayerVisibleInZoomLevel(layerNameMap["Parking"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"Parking","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["Parking"],false,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"Parking","wfs_not_urban")}if(isRoadworksVisible){if(isLayerVisibleInZoomLevel(layerNameMap["ROAD_MAINTENANCE"],
true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"ROAD_MAINTENANCE","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["ROAD_MAINTENANCE"],false,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"ROAD_MAINTENANCE","wfs_not_urban")}if(isObstructionsVisible){if(isLayerVisibleInZoomLevel(layerNameMap["OBSTRUCTION"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"OBSTRUCTION","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["OBSTRUCTION"],false,
currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"OBSTRUCTION","wfs_not_urban")}if(isWebcamsVisible)if(isLayerVisibleInZoomLevel(layerNameMap["WebCam"],false,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"WebCam","wfs_not_urban");if(isStationsVisible)if(isLayerVisibleInZoomLevel(layerNameMap["Station"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"Station","wfs_urban");if(isPlannedLayerVisible){if(isLayerVisibleInZoomLevel(layerNameMap["PLANED_FEATURES"],
true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"PLANED_FEATURES","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["PLANED_FEATURES"],false,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"PLANED_FEATURES","wfs_not_urban")}if(isLosVisible&&!isForecastEnabled()){if(isLayerVisibleInZoomLevel(layerNameMap["LOS"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"LOS","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["LOS"],false,currentZoom))wfsLayerString+=
getWfsLayerString(wfsLayerString,"LOS","wfs_not_urban")}if(isLosColorBlindVisible&&!isForecastEnabled()){if(isLayerVisibleInZoomLevel(layerNameMap["LOS-COLOR-BLIND"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"LOS-COLOR-BLIND","wfs_urban");if(isLayerVisibleInZoomLevel(layerNameMap["LOS-COLOR-BLIND"],false,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"LOS-COLOR-BLIND","wfs_not_urban")}if(isElectricChargingLayerVisible&&!isForecastEnabled())if(isLayerVisibleInZoomLevel(layerNameMap["ELECTRIC_CHARGING_STATION"],
true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"ELECTRIC_CHARGING_STATION","wfs_urban");if(isGasStationLayerVisible&&!isForecastEnabled())if(isLayerVisibleInZoomLevel(layerNameMap["GAS_STATION"],true,currentZoom))wfsLayerString+=getWfsLayerString(wfsLayerString,"GAS_STATION","wfs_urban")}
function isLayerVisibleInZoomLevel(layerInfo,isUrban,zoomLevel){var isVisible=false;if(layerInfo&&layerInfo["style_types"]){var styleTypes=layerInfo["style_types"];if(isUrban)$.each(urbanWfsIconMap,function(display_type,typeItem){var contains=false;for(var i=0;i<styleTypes.length;i++)if(styleTypes[i]==display_type&&typeItem[zoomLevel])isVisible=true});else $.each(wfsIconMap,function(display_type,typeItem){var contains=false;for(var i=0;i<styleTypes.length;i++)if(styleTypes[i]==display_type&&typeItem[zoomLevel])isVisible=
true})}return isVisible}function getWfsLayerString(currentLayerString,type,urban){var result="";if(currentLayerString.length>0)result=",";result+=layerNameMap[type][urban];return result}
function wfsVectorSourceLoader(resolution,extent){if(resolution<notUrbanResolutionStart&&wfsLayerString.length>0)$.ajax(urlGeoServer,{type:"GET",data:{service:"WFS",version:"2.0.0",request:"GetFeature",timeout:1E4,typename:wfsLayerString,srsname:mapProjectionName,outputFormat:"text/javascript",propertyName:"identifier,display_type,point,start_timestamp,end_timestamp,future,urban,info,dx,dy",filter:createFilter(extent)},dataType:"jsonp",jsonpCallback:"callback:loadWFSFeatures",jsonp:"format_options"});
else clearLayers()}
function createFilter(extent){var timeFilter="";if(!isPlannedLayerVisible)timeFilter="\x3cNot\x3e"+"\x3cPropertyIsGreaterThan\x3e"+"\x3cValueReference\x3estart_timestamp\x3c/ValueReference\x3e"+"\x3cFunction name\x3d'dateParse'\x3e"+"\x3cLiteral\x3eyyyy-MM-dd'T'HH:mm:ss.SSSZ\x3c/Literal\x3e"+"\x3cLiteral\x3e"+getWFSTimestampFilter(true)+"\x3c/Literal\x3e"+"\x3c/Function\x3e"+"\x3c/PropertyIsGreaterThan\x3e"+"\x3c/Not\x3e"+"\x3cNot\x3e"+"\x3cPropertyIsLessThan\x3e"+"\x3cValueReference\x3eend_timestamp\x3c/ValueReference\x3e"+"\x3cFunction name\x3d'dateParse'\x3e"+
"\x3cLiteral\x3eyyyy-MM-dd'T'HH:mm:ss.SSSZ\x3c/Literal\x3e"+"\x3cLiteral\x3e"+getWFSTimestampFilter(false)+"\x3c/Literal\x3e"+"\x3c/Function\x3e"+"\x3c/PropertyIsLessThan\x3e"+"\x3c/Not\x3e";return"\x3cFilter\x3e"+"\x3cAnd\x3e"+timeFilter+"\x3cBBOX xmlns:gml\x3d'http://www.opengis.net/gml/3.2'\x3e"+"\x3cValueReference\x3epoint\x3c/ValueReference\x3e"+"\x3cgml:Envelope srsName\x3d'http://www.opengis.net/def/crs/EPSG/0/900913'\x3e"+"\x3cgml:lowerCorner\x3e"+extent[0]+" "+extent[1]+"\x3c/gml:lowerCorner\x3e"+
"\x3cgml:upperCorner\x3e"+extent[2]+" "+extent[3]+"\x3c/gml:upperCorner\x3e"+"\x3c/gml:Envelope\x3e"+"\x3c/BBOX\x3e"+"\x3c/And\x3e"+"\x3c/Filter\x3e"}
function getWFSTimestampFilter(addTrafficMessageDays){var trafficMessageDate=new Date;var trafficMessageDays=5;if(isForecastEnabled()){trafficMessageDate=globalForecastDate;trafficMessageDays=globalForecastTrafficMessageDays}if(addTrafficMessageDays)trafficMessageDate=trafficMessageDate.addDays(trafficMessageDays);return trafficMessageDate.toISOString().replace("Z","-0000")}Date.prototype.addDays=function(days){var date=new Date(this.valueOf());date.setDate(date.getDate()+days);return date};
function loadWFSFeatures(response){var wfsFeatures=(new ol.format.GeoJSON).readFeatures(response);var d=new Set;for(var i=0;i<wfsFeatures.length;i++)wfsFeatures[i].set("wfs",true);wfsFeatures.sort(function(a,b){var dateA=(new Date(a.values_.start_timestamp)).getTime();var dateB=(new Date(b.values_.start_timestamp)).getTime();return dateA<dateB?1:-1});showLayers(wfsFeatures);map.render()}
function hoverWfsFeatures(wfsFeatures){for(var i=0;i<hoveredWfsFeatures.length;i++){var hoveredFeature=hoveredWfsFeatures[i];var contains=false;for(var k=0;k<wfsFeatures.length;k++)if(wfsFeatures[k].getId()==hoveredFeature.getId()){contains=true;break}if(!contains){hoveredFeature.set("isHovered",false);var urban=hoveredFeature.get("urban");var display_type=hoveredFeature.get("display_type");if(display_type)if(urban)hoveredFeature.setStyle(null);else hoveredFeature.setStyle(null)}}hoveredWfsFeatures=
wfsFeatures};
var allImagesLoaded=false;var carRouteInterferences=null;var currentZoomLevelInteger=0;
function preLoadAllImages(){var loaders=[];$.each(urbanWfsIconMap,function(displayType,typeItem){loaders.push(loadOneSvgImage(displayType,urbanWfsIconMap))});$.each(urbanWfsIconMapFuture,function(displayType,typeItem){loaders.push(loadOneSvgImage(displayType,urbanWfsIconMapFuture))});$.each(wfsIconMap,function(displayType,typeItem){loaders.push(loadOneSvgImage(displayType,wfsIconMap))});$.each(wfsIconMapFuture,function(displayType,typeItem){loaders.push(loadOneSvgImage(displayType,wfsIconMapFuture))});
$.when.apply(null,loaders).done(function(){allImagesLoaded=true;updateWfsImageSources(getMapCurrentZoomLevelInteger())})}function loadOneSvgImage(displayType,map){var deferred=$.Deferred();var img=new Image;img.onload=function(){map[displayType]["image"]=img;deferred.resolve()};img.src=map[displayType]["img"];return deferred.promise()}
function getWfsIconStyle(zoom,urban,display_type,isHovered,future,isOnCarRoute,label,dx,dy){var size=null;var imgSrc=null;var preLoadedImg=null;var zIndex=4;var styleMap=null;if(urban)if(future)styleMap=urbanWfsIconMapFuture;else styleMap=urbanWfsIconMap;else if(future)styleMap=wfsIconMapFuture;else styleMap=wfsIconMap;if(styleMap&&styleMap[display_type]){size=styleMap[display_type][zoom];imgSrc=styleMap[display_type]["img"];textZoomLevel=styleMap[display_type]["text-zoom"];preLoadedImg=styleMap[display_type]["image"];
if(!preLoadedImg)console.error("No Image found for display_type: "+display_type+", future: "+future+", urban: "+urban+", isOnCarRoute: "+isOnCarRoute);zIndex=styleMap[display_type]["zIndex"];if(isHovered){size+=10;zIndex+=200}if(isOnCarRoute){size+=10;zIndex+=200}var style=null;if(size&&imgSrc){var imgCanvas=getVectorImage2(preLoadedImg,size);if(zoom<=textZoomLevel&&!isHovered)style=new ol.style.Style({image:new ol.style.Icon({img:imgCanvas,imgSize:[size,size]}),zIndex:zIndex});else if(label){var offsetY=
label.split("\n").length*10+size/4+2;var offsetX=0;var font="14px sans-serif";var strokeColor=[255,255,255,.9];var fillColor=[0,0,0,1];var opacity=1;if(dx!=0&&dy!=0){var offset=styleMap[display_type]["offset"][currentZoomLevelInteger];offsetY=-offset*dy;offsetX=offset*dx;opacity=0;font="14px Arial";fillColor="#CC0000";strokeColor=[255,255,255,.5]}style=new ol.style.Style({image:new ol.style.Icon({img:imgCanvas,imgSize:[size,size],opacity:opacity}),text:new ol.style.Text({text:label,font:font,offsetY:offsetY,
offsetX:offsetX,textBaseline:"top",fill:new ol.style.Fill({color:fillColor}),stroke:new ol.style.Stroke({width:9,color:strokeColor})}),zIndex:zIndex})}else{var offsetY=size;var offsetX=0;var font="9px sans-serif";var strokeColor=[255,255,255,.8];style=new ol.style.Style({image:new ol.style.Icon({img:imgCanvas,imgSize:[size,size]}),text:new ol.style.Text({text:"",font:font,offsetY:offsetY,offsetX:offsetX,textBaseline:"top",fill:new ol.style.Fill({color:[0,0,0,.9]}),stroke:new ol.style.Stroke({width:6,
color:strokeColor})}),zIndex:zIndex})}}}return style}function getVectorImage2(preLoadedImg,size){var canvas=document.createElement("canvas");try{canvas.setAttribute("width",size);canvas.setAttribute("height",size);if(preLoadedImg&&preLoadedImg!=null){var ctx=canvas.getContext("2d");ctx.drawImage(preLoadedImg,0,0,size,size)}}catch(e){console.error(e)}return canvas}
function updateWfsImageSources(zoom){if(allImagesLoaded){currentZoomLevelInteger=zoom;$.each(wfsUrbanStyles,function(display_type,typeItem){wfsUrbanStyles[display_type]=getWfsIconStyle(zoom,true,display_type,false,false,false,null,0,0)});$.each(wfsStyles,function(display_type,typeItem){wfsStyles[display_type]=getWfsIconStyle(zoom,false,display_type,false,false,false,null,0,0)});$.each(wfsUrbanStylesFuture,function(display_type,typeItem){wfsUrbanStylesFuture[display_type]=getWfsIconStyle(zoom,true,
display_type,false,true,false,null,0,0)});$.each(wfsStylesFuture,function(display_type,typeItem){wfsStylesFuture[display_type]=getWfsIconStyle(zoom,false,display_type,false,true,false,null,0,0)})}}
function getWfsLayerStyle(feature,resolution){var style=null;var urban=feature.get("urban");var featureIdentifier=feature.get("identifier");var isOnCarRoute=false;if(carRouteInterferences!=null&&carRouteInterferences.length>0)for(var i=0;i<carRouteInterferences.length;i++)if(featureIdentifier==carRouteInterferences[i].identifier){isOnCarRoute=true;break}var startTimestamp=feature.get("start_timestamp");var isFuture;if(isForecastEnabled())isFuture=new Date(startTimestamp)>globalForecastDate;else isFuture=
feature.get("future");var isHovered=feature.get("isHovered");var display_type=feature.get("display_type");var label=feature.get("info");var dx=feature.get("dx");var dy=feature.get("dy");if(label)if(label.indexOf("|")>=0)label=label.replace("|","\n");else label=addNewLineRoutePointText(label,25,"\n");var imgSource=null;var styleMap=null;if(urban)if(isFuture)styleMap=wfsUrbanStylesFuture;else styleMap=wfsUrbanStyles;else if(isFuture)styleMap=wfsStylesFuture;else styleMap=wfsStyles;if(styleMap[display_type]!=
null&&!isOnCarRoute)if(isHovered)style=getWfsIconStyle(currentZoomLevelInteger,urban,display_type,isHovered,isFuture,isOnCarRoute,label,dx,dy);else{style=styleMap[display_type];if(style.getText()!=null){if(!label)label="";var iconStyleMap=null;if(urban)if(isFuture)iconStyleMap=urbanWfsIconMapFuture;else iconStyleMap=urbanWfsIconMap;else if(isFuture)iconStyleMap=wfsIconMapFuture;else iconStyleMap=wfsIconMap;style.getText().setText(label);var size=iconStyleMap[display_type][currentZoomLevelInteger];
if(!size)size=0;var offsetY=label.split("\n").length*10+size/4;style.getText().setOffsetY(offsetY)}if(dx!=0&&dy!=0){var offsetMap=iconStyleMap[display_type]["offset"];var offset=offsetMap[currentZoomLevelInteger];style.getImage().setOpacity(0);style.getText().setOffsetY(-offset*dy);style.getText().setOffsetX(offset*dx);style.getText().setFont("11px Arial");style.getText().setText(label);style.getText().getStroke().setColor([255,255,255,.5]);style.getText().getFill().setColor("#CC0000")}}return style}
;
var contextPath="/o/de.strassennrw.vipnrw.map";
var wfsIconMap={"WARNING":{"zIndex":130,"image":null,"img":contextPath+"/images/wfs/svg/101.svg","text-zoom":10,10:17,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"SHORT_TERM_ROADWORKS":{"zIndex":127,"image":null,"img":contextPath+"/images/wfs/svg/warnkegel.svg","text-zoom":16,11:18,12:18,13:18,14:21,15:21,16:21,17:21,18:21},"ROADWORKS":{"zIndex":128,"image":null,"img":contextPath+"/images/wfs/svg/123.svg","text-zoom":16,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"PLANED_SHORT_TERM_ROADWORKS":{"zIndex":127,
"image":null,"img":contextPath+"/images/wfs/svg/warnkegel.svg","text-zoom":11,8:10,9:14,10:17,11:18,12:18,13:18,14:21,15:21,16:21,17:21,18:21},"PLANED_ROADWORKS":{"zIndex":128,"image":null,"img":contextPath+"/images/wfs/svg/123.svg","text-zoom":11,8:10,9:14,10:17,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"CONGESTION":{"zIndex":39,"image":null,"img":contextPath+"/images/wfs/svg/124.svg","text-zoom":0,10:17,11:17,12:21,13:17,14:17,15:17,16:21,17:25,18:25,"offset":{10:20,11:20,12:20,13:30,14:30,
15:40,16:40,17:40,18:40}},"CLOSURE":closureEntry(140,"/images/wfs/svg/250.svg"),"CLOSURE_ENTRY_EXIT":closureEntry(139,"/images/wfs/svg/448.svg"),"CLOSURE_TRUCKS":closureEntry(135,"/images/wfs/svg/253.svg"),"WEIGHT_LIMIT_35":closureEntry(137,"/images/wfs/svg/262-2.svg"),"WEIGHT_LIMIT_55":closureEntry(136,"/images/wfs/svg/262.svg"),"WEBCAM":{"zIndex":124,"image":null,"img":contextPath+"/images/wfs/svg/webcam.svg","text-zoom":16,11:12,12:12,13:16,14:16,15:16,16:16,17:16,18:16},"PARKING":{"zIndex":125,
"image":null,"img":contextPath+"/images/wfs/svg/314-50.svg","text-zoom":16,11:12,12:12,13:14,14:14,15:16,16:18,17:24,18:24},"REROUTING":reroutingEntry(100,"/images/wfs/svg/467.svg")};
var wfsIconMapFuture={"WARNING":{"zIndex":110,"image":null,"img":contextPath+"/images/wfs/svg/101_sw.svg","text-zoom":10,10:17,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"SHORT_TERM_ROADWORKS":{"zIndex":107,"image":null,"img":contextPath+"/images/wfs/svg/warnkegel_sw.svg","text-zoom":16,11:18,12:18,13:18,14:21,15:21,16:21,17:21,18:21},"ROADWORKS":{"zIndex":108,"image":null,"img":contextPath+"/images/wfs/svg/123_sw.svg","text-zoom":16,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"PLANED_SHORT_TERM_ROADWORKS":{"zIndex":107,
"image":null,"img":contextPath+"/images/wfs/svg/warnkegel_sw.svg","text-zoom":11,8:10,9:14,10:17,11:18,12:18,13:18,14:21,15:21,16:21,17:21,18:21},"PLANED_ROADWORKS":{"zIndex":108,"image":null,"img":contextPath+"/images/wfs/svg/123_sw.svg","text-zoom":11,8:10,9:14,10:17,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31},"CONGESTION":{"zIndex":19,"image":null,"img":contextPath+"/images/wfs/svg/124_sw.svg","text-zoom":16,10:17,11:17,12:21,13:21,14:25,15:25,16:31,17:31,18:31},"CLOSURE":closureEntry(120,
"/images/wfs/svg/250_sw.svg"),"CLOSURE_ENTRY_EXIT":closureEntry(119,"/images/wfs/svg/448_sw.svg"),"CLOSURE_TRUCKS":closureEntry(115,"/images/wfs/svg/253_sw.svg"),"WEIGHT_LIMIT_35":closureEntry(117,"/images/wfs/svg/262-2_sw.svg"),"WEIGHT_LIMIT_55":closureEntry(116,"/images/wfs/svg/262_sw.svg"),"ELECTRIC_CHARGING_STATION":{"zIndex":30,"image":null,"img":contextPath+"/images/wfs/svg/charging_station.svg","text-zoom":16,11:15,12:16,13:17,14:19,15:21,16:25,17:25,18:35},"GAS_STATION":{"zIndex":30,"image":null,
"img":contextPath+"/images/wfs/svg/gas_station.svg","text-zoom":16,11:15,12:16,13:17,14:19,15:21,16:25,17:25,18:35},"REROUTING":reroutingEntry(100,"/images/wfs/svg/467_sw.svg")};var wfsStylesFuture={"WARNING":null,"CONGESTION":null,"SHORT_TERM_ROADWORKS":null,"ROADWORKS":null,"PLANED_SHORT_TERM_ROADWORKS":null,"PLANED_ROADWORKS":null,"CLOSURE":null,"CLOSURE_ENTRY_EXIT":null,"CLOSURE_TRUCKS":null,"WEIGHT_LIMIT_35":null,"WEIGHT_LIMIT_55":null,"REROUTING":null};
var wfsStyles={"WEBCAM":null,"WARNING":null,"SHORT_TERM_ROADWORKS":null,"ROADWORKS":null,"PLANED_SHORT_TERM_ROADWORKS":null,"PLANED_ROADWORKS":null,"CONGESTION":null,"CLOSURE":null,"CLOSURE_ENTRY_EXIT":null,"CLOSURE_TRUCKS":null,"WEIGHT_LIMIT_35":null,"WEIGHT_LIMIT_55":null,"PARKING":null,"REROUTING":null};function closureEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":10,8:10,9:14,10:17,11:21,12:21,13:21,14:25,15:25,16:31,17:31,18:31}}
function reroutingEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":16,13:15,14:15,15:19,16:19,17:25,18:25}};
var contextPath="/o/de.strassennrw.vipnrw.map";
var urbanWfsIconMap={"WARNING":warningUrbanEntry(44,"/images/wfs/svg/101.svg"),"SHORT_TERM_ROADWORKS":shortRoadworksUrbanEntry(40,"/images/wfs/svg/warnkegel.svg"),"ROADWORKS":roadworksUrbanEntry(41,"/images/wfs/svg/123.svg"),"CONGESTION":congestionUrbanEntry(39,"/images/wfs/svg/124.svg"),"CLOSURE":closureUrbanEntry(50,"/images/wfs/svg/250.svg"),"CLOSURE_ENTRY_EXIT":closureUrbanEntry(49,"/images/wfs/svg/448.svg"),"CLOSURE_TRUCKS":closureUrbanEntry(45,"/images/wfs/svg/253.svg"),"WEIGHT_LIMIT_35":closureUrbanEntry(47,
"/images/wfs/svg/262-2.svg"),"WEIGHT_LIMIT_55":closureUrbanEntry(46,"/images/wfs/svg/262.svg"),"STATION":{"zIndex":34,"image":null,"img":contextPath+"/images/wfs/svg/224-50.svg","text-zoom":16,14:15,15:19,16:19,17:25,18:25},"REROUTING":reroutingUrbanEntry(35,"/images/wfs/svg/467.svg"),"PARKING_UNDERGROUND":parkingUrbanEntry(36,"/images/wfs/svg/314-50.svg"),"PARKING_GARAGE":parkingUrbanEntry(36,"/images/wfs/svg/314-50-1.svg"),"PARKING_PASSENGER":{"zIndex":36,"image":null,"img":contextPath+"/images/wfs/svg/314-50-2.svg",
"text-zoom":16,14:19,15:25,16:31,17:31,18:45},"PARKING":parkingUrbanEntry(36,"/images/wfs/svg/314-50.svg"),"STRONG_ELECTRIC_CHARGING_STATION":{"zIndex":31,"image":null,"img":contextPath+"/images/wfs/svg/charging_station_strong.svg","text-zoom":16,12:16,13:17,14:19,15:21,16:25,17:25,18:35},"ELECTRIC_CHARGING_STATION":{"zIndex":30,"image":null,"img":contextPath+"/images/wfs/svg/charging_station.svg","text-zoom":16,12:16,13:17,14:19,15:21,16:25,17:25,18:35},"GAS_STATION":{"zIndex":30,"image":null,"img":contextPath+
"/images/wfs/svg/gas_station.svg","text-zoom":16,12:16,13:17,14:19,15:21,16:25,17:25,18:35}};
var urbanWfsIconMapFuture={"WARNING":warningUrbanEntry(10,"/images/wfs/svg/101_sw.svg"),"SHORT_TERM_ROADWORKS":shortRoadworksUrbanEntry(7,"/images/wfs/svg/warnkegel_sw.svg"),"ROADWORKS":roadworksUrbanEntry(8,"/images/wfs/svg/123_sw.svg"),"CONGESTION":{"zIndex":9,"image":null,"img":contextPath+"/images/wfs/svg/124_sw.svg","text-zoom":16,13:17,14:17,15:17,16:21,17:25,18:25},"CLOSURE":closureUrbanEntry(20,"/images/wfs/svg/250_sw.svg"),"CLOSURE_ENTRY_EXIT":closureUrbanEntry(19,"/images/wfs/svg/448_sw.svg"),
"CLOSURE_TRUCKS":closureUrbanEntry(15,"/images/wfs/svg/253_sw.svg"),"WEIGHT_LIMIT_35":closureUrbanEntry(17,"/images/wfs/svg/262-2_sw.svg"),"WEIGHT_LIMIT_55":closureUrbanEntry(16,"/images/wfs/svg/262_sw.svg"),"REROUTING":reroutingUrbanEntry(5,"/images/wfs/svg/467_sw.svg")};var wfsUrbanStylesFuture={"CONGESTION":null,"WARNING":null,"SHORT_TERM_ROADWORKS":null,"ROADWORKS":null,"CLOSURE":null,"CLOSURE_ENTRY_EXIT":null,"CLOSURE_TRUCKS":null,"WEIGHT_LIMIT_35":null,"WEIGHT_LIMIT_55":null,"REROUTING":null};
var wfsUrbanStyles={"STATION":null,"REROUTING":null,"PARKING_PASSENGER":null,"PARKING_UNDERGROUND":null,"PARKING_GARAGE":null,"PARKING":null,"WARNING":null,"SHORT_TERM_ROADWORKS":null,"ROADWORKS":null,"CONGESTION":null,"CLOSURE":null,"CLOSURE_ENTRY_EXIT":null,"CLOSURE_TRUCKS":null,"WEIGHT_LIMIT_35":null,"WEIGHT_LIMIT_55":null,"ELECTRIC_CHARGING_STATION":null,"STRONG_ELECTRIC_CHARGING_STATION":null,"GAS_STATION":null};
function warningUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":15,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31}}function shortRoadworksUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":16,11:18,12:18,13:18,14:21,15:21,16:21,17:21,18:21}}
function roadworksUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":16,11:21,12:21,13:21,14:31,15:31,16:31,17:31,18:31}}function closureUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":15,11:21,12:21,13:21,14:25,15:25,16:31,17:31,18:31}}
function congestionUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":0,11:17,12:21,13:17,14:17,15:17,16:21,17:25,18:25,"offset":{11:20,12:20,13:30,14:30,15:40,16:40,17:40,18:40}}}function reroutingUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":16,13:15,14:15,15:19,16:19,17:25,18:25}}
function parkingUrbanEntry(zIndex,imgPath){return{"zIndex":zIndex,"image":null,"img":contextPath+imgPath,"text-zoom":16,14:14,15:16,16:18,17:24,18:24}};
var mapWfsFeatureInfoPopupOverlay=null;var mapWfsFeatureInfoPopup=null;var mapWfsFeatureInfoPopupContent=null;var mapWfsFeatureInfoPopupCloser=null;var mapWfsFeatureInfoPopupTitle=null;var monitorWfsIntervalIdList=[];var mapWfsFeatureInfoAjaxId=null;
function initWfsFeatureInfoPopup(){mapWfsFeatureInfoPopup=document.getElementById(map_portlet_id+"mapWfsFeatureInfoPopup");mapWfsFeatureInfoPopupContent=document.getElementById(map_portlet_id+"mapWfsFeatureInfoPopupContent");mapWfsFeatureInfoPopupCloser=document.getElementById(map_portlet_id+"mapWfsFeatureInfoPopupCloser");mapWfsFeatureInfoPopupTitle=document.getElementById(map_portlet_id+"mapWfsFeatureInfoPopupTitle");mapWfsFeatureInfoPopupOverlay=new ol.Overlay({element:mapWfsFeatureInfoPopup,autoPan:true,
positioning:"bottom-left",offset:[-50,-12],autoPanMargin:70,autoPanAnimation:{duration:250}});mapWfsFeatureInfoPopupCloser.onclick=function(){closeWfsFeatureInfo()};map.addOverlay(mapWfsFeatureInfoPopupOverlay)}function closeWfsFeatureInfo(){for(var i=0;i<monitorWfsIntervalIdList.length;i++)clearInterval(monitorWfsIntervalIdList[i]);monitorWfsIntervalIdList=[];$(mapWfsFeatureInfoPopup).hide();mapWfsFeatureInfoPopupOverlay.setPosition(undefined);mapWfsFeatureInfoPopupCloser.blur();return false}
function showWfsFeatureInfo(htmlContent,coordinate,width){if(Liferay.Browser.isMobile()||isSmallWindow())showPortalPopupOverlay(htmlContent);else{closeWfsFeatureInfo();if(htmlContent){if(width!=null&&width<400)if(width<170){width=170;$(mapWfsFeatureInfoPopupContent).css("width",width+"px")}$(mapWfsFeatureInfoPopupContent).html(htmlContent);$(mapWfsFeatureInfoPopup).show();mapWfsFeatureInfoPopupOverlay.setPosition(coordinate)}}}
function showWfsFeatureInfoPopup(coordinate,featureIdentifier,isClick){if(coordinate!=null&&coordinate.length==2&&featureIdentifier!=null&&featureIdentifier.length>0){var loadingHtml='\x3cdiv style\x3d"text-align: center;"\x3e\x3cdiv class\x3d"loader"\x3e\x3c/div\x3e'+"Lade Daten..."+"\x3c/div\x3e";$(mapWfsFeatureInfoPopupContent).html(loadingHtml);if(isClick&&!Liferay.Browser.isMobile()){$(mapWfsFeatureInfoPopup).show();mapWfsFeatureInfoPopupOverlay.setPosition(coordinate)}if(Liferay.Browser.isMobile()||
isSmallWindow())showPortalPopupOverlay(loadingHtml);var featureIdentifierString=featureIdentifier.join("|");if(mapWfsFeatureInfoAjaxId!=null)try{mapWfsFeatureInfoAjaxId.abort()}catch(e){console.error(e)}mapWfsFeatureInfoAjaxId=$.ajax({url:map_portlet_resource_url,type:"POST",datatype:"json",timeout:1E4,data:{action:"getTrafficObjectsByIdentifier",identifier:featureIdentifierString},success:function(data){if(data!=null){if(!Liferay.Browser.isMobile())$(mapWfsFeatureInfoPopup).show();var content=JSON.parse(data);
var html=null;html=convertTrafficObjectsToHtml(content);if(html)if(Liferay.Browser.isMobile()||isSmallWindow())showPortalPopupOverlay(html);else $(mapWfsFeatureInfoPopupContent).html(html);else if(Liferay.Browser.isMobile()||isSmallWindow())showPortalPopupOverlay("Keine Eintr\u00e4ge gefunden");else $(mapWfsFeatureInfoPopupContent).html("Keine Eintr\u00e4ge gefunden");if(content.error!=null){var htmlError='\x3cdiv class\x3d"portlet-msg-error"\x3e'+content.error+"\x3c/div\x3e";if(Liferay.Browser.isMobile())appendPortalPopupOverlay("Keine Eintr\u00e4ge gefunden");
else $(mapWfsFeatureInfoPopupContent).append(htmlError)}if(!Liferay.Browser.isMobile())if(!isClick)mapWfsFeatureInfoPopupOverlay.setPosition(coordinate);else mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}else;},fail:function(jqXHR,textStatus,errorThrown){if(!Liferay.Browser.isMobile()){$(mapWfsFeatureInfoPopupContent).css("width","320px");$(mapWfsFeatureInfoPopup).show()}var htmlError='\x3cdiv class\x3d"portlet-msg-error"\x3e'+"Fehler beim holen der Daten."+"\x3c/div\x3e";if(Liferay.Browser.isMobile()||
isSmallWindow())showPortalPopupOverlay(htmlError);else{$(mapWfsFeatureInfoPopupContent).html(htmlError);if(!isClick)mapWfsFeatureInfoPopupOverlay.setPosition(coordinate);else mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}console.error(errorThrown)}})}}
function handleWfsFeatureInfoClick(evt,wfsFeatures){var coordinate=evt.coordinate;var featureIdentifier=[];for(var i=0;i<wfsFeatures.length;i++){if(wfsFeatures[i].getGeometry()&&wfsFeatures[i].getGeometry().getCoordinates())coordinate=wfsFeatures[0].getGeometry().getCoordinates();featureIdentifier.push(wfsFeatures[i].get("identifier"))}addUserBehavior(UserAction.FEATURE_INFO_MAP,undefined,featureIdentifier);showWfsFeatureInfoPopup(coordinate,featureIdentifier,true)}
function getWfsFeaturesByBoundingBox(evt,wfsFeatures){var coordinate=evt.coordinate;for(var i=0;i<monitorWfsIntervalIdList.length;i++)clearInterval(monitorWfsIntervalIdList[i]);monitorWfsIntervalIdList=[];$(mapWfsFeatureInfoPopupContent).html("");if(wfsLayerString.length>0){var url=urlGeoServer+"?format_options\x3d%jsonp"+"\x26service\x3dWFS"+"\x26version\x3d2.0.0"+"\x26request\x3dGetFeature"+"\x26typename\x3d"+wfsLayerString+"\x26srsname\x3d"+mapProjectionName+"\x26outputFormat\x3dtext/javascript"+
createWfsFeatureBbox(wfsFeatures);jsonpWFS.clear("wfsFeatureInfo");jsonpWFS.call(url,handleFeatureResponse,handleFeatureResponseTimeout,2E4,"wfsFeatureInfo",{coordinate:coordinate});$(mapWfsFeatureInfoPopupContent).css("width","320px");$(mapWfsFeatureInfoPopup).show();mapWfsFeatureInfoPopupOverlay.setPosition(coordinate)}}function handleFeatureResponseTimeout(response,parameter){}
function handleFeatureResponse(response,parameter){if(!response)return;var wfsFeatures=(new ol.format.GeoJSON).readFeatures(response);var html="";var hasStations=false;var coordinate=parameter.coordinate;wfsFeatures.forEach(function(feature,i){var tmpHtml="";if(feature.get("type")=="WARNINGS"||feature.get("type")=="ROAD_MAINTENANCE"||feature.get("type")=="ABNORMAL_TRAFFIC"||feature.get("type")=="OBSTRUCTION")tmpHtml=buildTrafficInfoFeatureInfo(feature,i);else if(feature.get("type")=="WebCam")tmpHtml=
buildWebCamFeatureInfo(feature,i);else if(feature.get("type")=="ParkingSite"||feature.get("type")=="ParkingArea")tmpHtml=buildParkingFeatureInfo(feature,i);else if(feature.get("type")=="Station"){hasStations=true;tmpHtml=buildStationFeatureInfo(feature,i,coordinate)}if(tmpHtml.length>0){if(html.length>0)html+="\x3c/br\x3e";html+=tmpHtml}});if(html.length>0){if($(mapWfsFeatureInfoPopupContent).html().length==0)$(mapWfsFeatureInfoPopupContent).html($(mapWfsFeatureInfoPopupContent).html()+html);else $(mapWfsFeatureInfoPopupContent).html($(mapWfsFeatureInfoPopupContent).html()+
"\x3c/br\x3e"+html);if(hasStations)handlePublicTransportClicks();mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}}
function handlePublicTransportClicks(){$("#p_p_id"+map_portlet_id+" .featureInfoDiv").each(function(){var stopID=$(this).find(".featureInfoStopID").val();var headerAbfahrtsmonitor=$(this).find(".featureInfoHeaderAbfahrtsmonitor");var contentAbfahrtsmonitor=$(this).find(".featureInfoContentAbfahrtsmonitor");var headerAnkunftsmonitor=$(this).find(".featureInfoHeaderAnkunftsmonitor");var contentAnkunftsmonitor=$(this).find(".featureInfoContentAnkunftsmonitor");var headerAushangfahrplan=$(this).find(".featureInfoHeaderAushangfahrplan");
var contentAushangfahrplan=$(this).find(".featureInfoContentAushangfahrplan");var abfahrtsmonitorIntervalId=$(this).find(".featureInfoAbfahrtHeaderIntervalId");var ankunftsmonitorIntervalId=$(this).find(".featureInfoAnkunftHeaderIntervalId");$(headerAbfahrtsmonitor).click(function(){monitorIntervalId=handleDepatureMonitorClick(abfahrtsmonitorIntervalId,$(contentAbfahrtsmonitor),"dep",stopID)});$(headerAnkunftsmonitor).click(function(){monitorIntervalId=handleDepatureMonitorClick(ankunftsmonitorIntervalId,
$(contentAnkunftsmonitor),"arr",stopID)});$(headerAushangfahrplan).click(function(){if($(contentAushangfahrplan).css("display")=="block"){$(contentAushangfahrplan).empty();$(contentAushangfahrplan).css("display","none");mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}else{var loadingText="Bitte warten...";var html="\x3cdiv class\x3d'aui-loadingmask-message-content'\x3e"+loadingText+"\x3c/div\x3e";$(contentAushangfahrplan).empty();$(contentAushangfahrplan).html(html);$(contentAushangfahrplan).css("display",
"block");mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position");getNoticeMonitor($(contentAushangfahrplan),stopID)}})})}
function handleDepatureMonitorClick(monitorIntervalId,contentDiv,depArr,stopID){if($(contentDiv).css("display")=="block"){if(monitorIntervalId&&monitorIntervalId.val()&&monitorIntervalId.val().length>0){clearInterval(monitorIntervalId.val());monitorIntervalId.val("")}$(contentDiv).empty();$(contentDiv).css("display","none");mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}else{updateDepatureMonitorDiv(contentDiv,depArr,stopID);var intervalId=setInterval(function(){updateDepatureMonitorDiv(contentDiv,
depArr,stopID)},3E4);monitorIntervalId.val(intervalId);monitorWfsIntervalIdList.push(intervalId);mapWfsFeatureInfoPopupOverlay.dispatchEvent("change:position")}return monitorIntervalId}function updateDepatureMonitorDiv(contentDiv,depArr,stopID){var loadingText="Bitte warten...";var html="\x3cdiv\x3e"+loadingText+"\x3c/div\x3e";$(contentDiv).empty();$(contentDiv).html(html);$(contentDiv).css("display","block");getDepatureMonitor($(contentDiv),stopID,depArr)}
function buildTrafficInfoFeatureInfo(feature,index){var isFuture=feature.get("future_int")=="1";var isUrban=feature.get("urban_int")=="1";var title="";var advice=getAdviceHtml(feature.get("advice"));var feature_id=feature.get("id");var subtitle="Richtung: TODO";var end="";var start="";var firstTitlePart="";var secondTitlePart="";if(!isUrban){if(feature.get("road"))firstTitlePart=feature.get("road");if(feature.get("comment"))secondTitlePart=feature.get("comment")}else{if(feature.get("city"))firstTitlePart=
feature.get("city");if(feature.get("road"))secondTitlePart=feature.get("road")}if(firstTitlePart.length>0&&secondTitlePart.length>0)secondTitlePart=" | "+secondTitlePart;title+=firstTitlePart+secondTitlePart;if(feature.get("end_timestamp"))end="\x3c/br\x3eEnde: "+feature.get("end_timestamp")+"\x3c/br\x3e";if(feature.get("start_timestamp")){start="\x3c/br\x3eBeginn: "+feature.get("start_timestamp");if(end.length==0)start+="\x3c/br\x3e"}var innerContentHtml=start+end+"\x3c/br\x3e"+feature.get("description")+
advice;return getHTmlFeatureInfoContent(index,feature_id,title,subtitle,innerContentHtml,feature.get("type"),feature.get("sub_type"),isFuture)}
function buildParkingFeatureInfo(feature,index){var isFuture=feature.get("future_int")=="1";var occupancy=" -";if(feature.get("occupancy_total")!=null)occupancy=feature.get("occupancy_total");else if(feature.get("occupancy_short")!=null)occupancy=feature.get("occupancy_short");var trend=feature.get("occupancy_total_trend");var trendString="";if(trend&&trend=="FALLING")trendString=" Fallend";else if(trend==="ASCENDING")trendString=" Steigend";else if(trend==="UNCHANGED")trendString=" Konstant";var capacity=
"";if(feature.get("capa_total")!=null)capacity=feature.get("capa_total");else if(feature.get("capa_short")!=null)capacity=feature.get("capa_short");var feature_id=feature.get("id");var title=feature.get("name");var subtitle=feature.get("subtype");var innerContentHtml="\x3c/br\x3eKapazit\u00e4t: "+capacity+" ("+occupancy+" frei"+trendString+")\x3c/br\x3e\x3c/br\x3e"+"TODO...";return getHTmlFeatureInfoContent(index,feature_id,title,subtitle,innerContentHtml,feature.get("type"),feature.get("subtype"),
isFuture)}
function buildStationFeatureInfo(feature,index,coordinate){var lonlat={lon:coordinate[0],lat:coordinate[1]};var stopID=feature.get("identifier");var isFuture=feature.get("future_int")=="1";var feature_id=feature.get("id");var title=feature.get("location");var subtitle=feature.get("name");var loadingText="Bitte warten...";var innerContentHtml="\x3cdiv id\x3d'"+map_portlet_id+"featureInfo_"+feature_id+"' class\x3d'featureInfoDiv'\x3e"+"\x3cinput type\x3d'hidden' class\x3d'featureInfoStopID' value\x3d'"+stopID+
"'\x3e"+"\x3ctable style\x3d'width: 100%'\x3e"+"\x3ctr\x3e"+"\x3ctd style\x3d'width: 50%; padding-right: 5px;'\x3e"+"\x3cbutton type\x3d'button' onclick\x3d'javascript:routeStartHere("+lonlat.lon+","+lonlat.lat+","+stopID+")' style\x3d'width: 100%' class\x3d'ui-button ui-widget ui-corner-all'\x3e"+"Start setzen"+"\x3c/button\x3e"+"\x3c/td\x3e"+"\x3ctd style\x3d'width: 50%;'\x3e"+"\x3cbutton type\x3d'button' onclick\x3d'javascript:routeEndHere("+lonlat.lon+","+lonlat.lat+","+stopID+")' style\x3d'width: 100%' class\x3d'ui-button ui-widget ui-corner-all'\x3e"+
"Ziel setzen"+"\x3c/button\x3e"+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e"+"\x3cdiv style\x3d'height: 5px;'\x3e\x3c/div\x3e"+"\x3cinput type\x3d'hidden' class\x3d'featureInfoAbfahrtHeaderIntervalId' value\x3d''\x3e"+"\x3cbutton type\x3d'button' class\x3d'featureInfoHeaderAbfahrtsmonitor ui-button ui-widget ui-corner-all'\x3e"+"Abfahrt"+"\x3c/button\x3e"+"\x3cdiv class\x3d'featureInfoContentAbfahrtsmonitor'\x3e"+"\x3cdiv\x3e"+loadingText+"\x3c/div\x3e"+"\x3c/div\x3e"+"\x3cinput type\x3d'hidden' class\x3d'featureInfoAnkunftHeaderIntervalId' value\x3d''\x3e"+
"\x3cbutton type\x3d'button' class\x3d'featureInfoHeaderAnkunftsmonitor ui-button ui-widget ui-corner-all'\x3e"+"Ankunft"+"\x3c/button\x3e"+"\x3cdiv class\x3d'featureInfoContentAnkunftsmonitor'\x3e"+"\x3cdiv\x3e"+loadingText+"\x3c/div\x3e"+"\x3c/div\x3e"+"\x3cdiv style\x3d'height: 5px;'\x3e\x3c/div\x3e"+"\x3cbutton type\x3d'button' class\x3d'featureInfoHeaderAushangfahrplan ui-button ui-widget ui-corner-all'\x3e"+"Aushangfahrplan"+"\x3c/button\x3e"+"\x3cdiv class\x3d'featureInfoContentAushangfahrplan'\x3e"+
"\x3cdiv\x3e"+loadingText+"\x3c/div\x3e"+"\x3c/div\x3e";return getHTmlFeatureInfoContent(index,feature_id,title,subtitle,innerContentHtml,feature.get("type"),feature.get("sub_type"),isFuture)}
function buildWebCamFeatureInfo(feature,index){var isFuture=feature.get("future_int")=="1";var feature_id=feature.get("id");var title=feature.get("name_long");var subtitle="TODO...";var innerContentHtml='\x3cimg style\x3d"max-width: auto;" src\x3d"'+feature.get("picture_url1")+'"\x3e';return getHTmlFeatureInfoContent(index,feature_id,title,subtitle,innerContentHtml,feature.get("type"),feature.get("sub_type"),isFuture)}
function getHTmlFeatureInfoContent(index,feature_id,title,subtitle,innerContentHtml,type,sub_type,isFuture){var html='\x3ctable id\x3d"'+map_portlet_id+"_"+type+"_"+feature_id+'" style\x3d"width: 100%;"\x3e'+"\x3ctr\x3e"+'\x3ctd rowspan\x3d"2" class\x3d"feature-info-icon"\x3e'+'\x3cimg src\x3d"'+getIconPath(type,sub_type,isFuture)+'"\x3e'+"\x3c/td\x3e"+'\x3ctd class\x3d"feature-info-title"\x3e'+title+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3ctr\x3e"+'\x3ctd class\x3d"feature-info-subtitle"\x3e'+subtitle+"\x3c/td\x3e"+
"\x3c/tr\x3e"+"\x3ctr\x3e"+'\x3ctd colspan\x3d"2"\x3e'+innerContentHtml+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e";return html}
function getIconPath(type,sub_type,isFuture){var image="";if(type==="OBSTRUCTION")if(sub_type==="ROADMAINTENANCE_EXIT")image="250_35_exit.png";else if(sub_type==="OBSTRUCTION_LORRIES")image="250_31_253.png";else if(sub_type==="OBSTRUCTION_LORRIES_3_5")image="250_31_254.png";else if(sub_type==="OBSTRUCTION_LORRIES_5_5")image="250_31_255.png";else image="250_31.png";else if(type==="ROAD_MAINTENANCE")if(sub_type==="ROADMAINTENANCE_DAYTIME")image+="123_35_dt.png";else image="123_35.png";else if(type===
"WARNINGS"||type==="INCIDENTS"||type==="EVENTS")image="101_35.png";else if(type==="ABNORMAL_TRAFFIC"||type==="ACCIDENTS")image="124_35.png";else if(type=="Station")image+="Haltestelle_224_30.png";else if(type=="ParkingSite")if(sub_type=="Parkhaus"||sub_type=="Tiefgarage")image="pg_30.png";else image="ps_30.png";else if(type=="WebCam")image+="webcam_30.png";if(isFuture)image="gray_"+image;var contextPath="/o/de.strassennrw.vipnrw.map";image=contextPath+"/legend/"+image;return image}
function getAdviceHtml(adviceString){var advice="";if(adviceString&&adviceString.match(/(x|\-|\^|v|e|i|w|r|l)+ \|\| (x|\-|\^|v|e|i|w|r|l)+/)!=null){var parts=adviceString.split(" ");var up="";var down="";for(var l=0;l<parts[0].length;l++)if("x"==parts[0].charAt(l))up+=getBlocked();else if("-"==parts[0].charAt(l))up+=getBlocked();else if("^"==parts[0].charAt(l))up+=getPassing(true);else if("v"==parts[0].charAt(l))up+=getPassing(false);else if("i"==parts[0].charAt(l))up+=getSmaller(true);else if("e"==
parts[0].charAt(l))up+=getSmaller(false);else if("w"==parts[0].charAt(l))up+=getBooth();else if("r"==parts[0].charAt(l))up+=getBorderLeft();else if("l"==parts[0].charAt(l))up+=getBorderRight();else if("s"==parts[0].charAt(l))up+=getBreakdownLane();else if("1"==parts[0].charAt(l));for(var r=0;r<parts[2].length;r++)if("x"==parts[2].charAt(r))down+=getBlocked();else if("-"==parts[2].charAt(r))down+=getBlocked();else if("^"==parts[2].charAt(r))down+=getPassing(true);else if("v"==parts[2].charAt(r))down+=
getPassing(false);else if("i"==parts[2].charAt(r))down+=getSmaller(true);else if("e"==parts[2].charAt(r))down+=getSmaller(false);else if("w"==parts[2].charAt(r))down+=getBooth();else if("r"==parts[2].charAt(l))down+=getBorderLeft();else if("l"==parts[2].charAt(l))down+=getBorderRight();else if("s"==parts[2].charAt(l))down+=getBreakdownLane();else if("1"==parts[2].charAt(l));advice+="\x3c/br\x3e"+up+'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_2.png"\x3e'+down}return advice}
function getBreakdownLane(){return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_s.png"\x3e'}function getBooth(){return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_w.png"\x3e'}function getBorderRight(){return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_r.png"\x3e'}function getBorderLeft(){return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_l.png"\x3e'}
function getSmaller(up){if(up)return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_e.png"\x3e';return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_i.png"\x3e'}function getBlocked(){return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_x.png"\x3e'}
function getPassing(up){if(up)return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_o.png"\x3e';return'\x3cimg src\x3d"/o/de.strassennrw.vipnrw.map/images/feature-info/img_u.png"\x3e'};
function createWfsFeatureBbox(wfsFeatures){var coordArray=[];for(var i=0;i<wfsFeatures.length;i++)coordArray.push(wfsFeatures[i].getGeometry().getCoordinates());var extent=ol.extent.boundingExtent(coordArray);var bufferedExtent=ol.extent.buffer(extent,1.2);return"\x26bbox\x3d"+bufferedExtent.join(",")+","+mapProjectionName}function getByIdentifier(identifier){};
var app={};var dragging=false;var dragInteraction=null;
function initDragDrop(){app.Drag=function(){ol.interaction.Pointer.call(this,{handleDownEvent:app.Drag.prototype.handleDownEvent,handleDragEvent:app.Drag.prototype.handleDragEvent,handleMoveEvent:app.Drag.prototype.handleMoveEvent,handleUpEvent:app.Drag.prototype.handleUpEvent});this.coordinate_=null;this.cursor_="pointer";this.feature_=null;this.previousCursor_=undefined};ol.inherits(app.Drag,ol.interaction.Pointer);app.Drag.prototype.handleDownEvent=handleDownEvent;app.Drag.prototype.handleDragEvent=
handleDragEvent;app.Drag.prototype.handleMoveEvent=handleMoveEvent;app.Drag.prototype.handleUpEvent=handleUpEvent;dragInteraction=new app.Drag;map.addInteraction(dragInteraction)}
function handleDownEvent(evt){var map=evt.map;var pointerEvent=evt.originalEvent;var pointFeature=null;if(pointerEvent&&pointerEvent.button==0){var carRouteLineFeature=null;var carRouteWfsFeatures=[];map.forEachFeatureAtPixel(evt.pixel,function(feature){if(feature.get("type")==pointNameStart||feature.get("type")==pointNameTarget||feature.get("type")==pointNameVia){pointFeature=feature;return}else if(feature.get("carRouteWfs"))carRouteWfsFeatures.push(feature);else if(feature.get("type")==carRouteLineName)carRouteLineFeature=
feature});if(pointFeature){dragging=true;this.coordinate_=evt.coordinate;this.feature_=pointFeature;pointFeature.set("address",null)}else if(carRouteWfsFeatures.length>0);else if(carRouteLineFeature){dragging=true;var point=carRouteLineFeature.getGeometry().getClosestPoint(evt.coordinate);pointFeature=addFeaturePoint(pointNameVia,point[0],point[1],null,true);var newViaIndex=getViaIndexByClosestPoint(point);moveViaFeatureByIndex(newViaIndex,pointFeature);updateAllRoutingPortletPoints(pointFeature,
true);this.coordinate_=point;this.feature_=pointFeature}if(pointFeature&&routeLinePointHover){var vectorSource=mapRoutingLayer.getSource();vectorSource.removeFeature(routeLinePointHover);routeLinePointHover=null}}else dragging=false;return!!pointFeature}
function handleDragEvent(evt){if(dragging){var deltaX=evt.coordinate[0]-this.coordinate_[0];var deltaY=evt.coordinate[1]-this.coordinate_[1];var geometry=this.feature_.getGeometry();geometry.translate(deltaX,deltaY);this.coordinate_[0]=evt.coordinate[0];this.coordinate_[1]=evt.coordinate[1];dragRoute()}}
function handleMoveEvent(evt){if(this.cursor_){var map=evt.map;var feature=map.forEachFeatureAtPixel(evt.pixel,function(feature){var type=feature.get("type");if(type&&type!=pointNameW3C)return feature});var element=evt.map.getTargetElement();if(feature){if(element.style.cursor!=this.cursor_){this.previousCursor_=element.style.cursor;element.style.cursor=this.cursor_}}else if(this.previousCursor_!==undefined){element.style.cursor=this.previousCursor_;this.previousCursor_=undefined}}}
function handleUpEvent(){if(dragging){dragging=false;this.coordinate_=null;drawRoute()}return false};
const carRouteLineName="car-route-line";const carRouteLineColoredName="car-route-line-colored";const carRouteLineBorderName="car-route-line-border";const busRouteLineBorderName="bus-route-line-border";const bikeRouteLineBorderName="bike-route-line-border";const publicTransportRouteLineName="bus-route-line";const publicTransportRouteIconName="bus-route-icon";const publicTransportRouteLineRemovedName="bus-route-line-removed";const publicTransportPointName="bus-route-point";const bikeRouteLineName="bike-route-line";
const pointNameHover="route-point-hover";const routeDescriptionPointName="route-description-point";const pointNameW3C_circle="w3c-point-circle";const pointNameW3C="w3c-point";const intermodalRouteIconName="intermodal-route-icon";const intermodalLineName="intermodal-route-line";const intermodalconnectingLineName="intermodal-connecting-line";const intermodalLineBorderName="intermodal-route-line-border";var mapRoutingLayer=null;var routeLinePointHover=null;var hoveredFeatures=[];
var carRoutingHighlighted=false;const losColorMap=[[55,126,184,1],[55,126,184,1,0],[55,126,184,1,0],[231,140,0,1],[232,22,0,1],[150,0,0,1],[0,0,0,1]];const losColorBlindMap=[[55,126,184,1],[55,126,184,1,0],[55,126,184,1,0],[0,0,255,1],[232,22,0,1],[150,0,0,1],[0,0,0,1]];const publicTransportRouteColorMap=[[166,86,40,1],[166,86,40,1]];
var routingLayerStyle={"intermodal-route-line":[new ol.style.Style({stroke:new ol.style.Stroke({lineCap:"butt",width:7,color:[0,0,0,1]}),zIndex:53}),new ol.style.Style({stroke:new ol.style.Stroke({color:"#984ea3",width:5}),zIndex:53})],"intermodal-connecting-line":[new ol.style.Style({stroke:new ol.style.Stroke({lineCap:"butt",width:2,color:[0,0,0,1],lineDash:[5,5]}),zIndex:53})],"car-route-debug-point":new ol.style.Style({image:new ol.style.Circle({radius:3,snapToPixel:false,fill:new ol.style.Fill({color:[0,
0,255,1]}),stroke:new ol.style.Stroke({color:[255,255,255,1],width:2})}),text:new ol.style.Text({text:"",font:"12px sans-serif",offsetY:10,offsetX:-20,fill:new ol.style.Fill({color:[0,0,255,1]}),stroke:new ol.style.Stroke({width:6,color:[255,255,255,1]})}),zIndex:999}),"car-route-line":new ol.style.Style({stroke:new ol.style.Stroke({width:5,color:[55,126,184,.85]}),zIndex:54}),"car-route-line-colored":new ol.style.Style({stroke:new ol.style.Stroke({width:3,color:[55,126,184,1]}),zIndex:54}),"car-route-line-border":new ol.style.Style({stroke:new ol.style.Stroke({lineCap:"butt",
width:7,color:[0,0,0,1]}),zIndex:53}),"bus-route-line":new ol.style.Style({stroke:new ol.style.Stroke({width:5,color:[166,86,40,1]}),zIndex:52}),"bus-route-line-border":new ol.style.Style({stroke:new ol.style.Stroke({lineCap:"butt",width:7,color:[0,0,0,1]}),zIndex:51}),"bus-route-line-removed":new ol.style.Style({stroke:new ol.style.Stroke({width:5,lineDash:[4,4],color:[255,0,255,.7],lineCap:"butt"}),zIndex:52}),"bike-route-line":new ol.style.Style({stroke:new ol.style.Stroke({width:5,color:[255,
127,0,1]}),zIndex:53}),"bike-route-line-border":new ol.style.Style({stroke:new ol.style.Stroke({lineCap:"butt",width:7,color:[0,0,0,1]}),zIndex:52}),"route-point-start":new ol.style.Style({image:new ol.style.Icon({anchor:[.4,1],src:"/o/de.strassennrw.vipnrw.map/images/routing/directions_start_32.png"}),text:new ol.style.Text({text:"",font:"12px sans-serif, FontAwesome",offsetY:-40,fill:new ol.style.Fill({color:"#444"}),stroke:new ol.style.Stroke({width:8,color:[255,255,255,.5]})}),zIndex:57}),"route-point-target":new ol.style.Style({image:new ol.style.Icon({anchor:[.4,
1],src:"/o/de.strassennrw.vipnrw.map/images/routing/directions_end_32.png"}),text:new ol.style.Text({text:"",font:"12px sans-serif, FontAwesome",offsetY:-40,fill:new ol.style.Fill({color:"#444"}),stroke:new ol.style.Stroke({width:8,color:[255,255,255,.5]})}),fill:new ol.style.Fill({color:[0,255,0,.5]}),zIndex:57}),"route-point-via":new ol.style.Style({image:new ol.style.Icon({anchor:[.4,1],src:"/o/de.strassennrw.vipnrw.map/images/routing/directions_via_32.png"}),text:new ol.style.Text({text:"",font:"12px sans-serif, FontAwesome",
offsetY:-40,fill:new ol.style.Fill({color:"#444"}),stroke:new ol.style.Stroke({width:8,color:[255,255,255,.5]})}),zIndex:57}),"route-point-hover":new ol.style.Style({image:new ol.style.Circle({radius:5,snapToPixel:false,fill:new ol.style.Fill({color:[255,255,255,.8]}),stroke:new ol.style.Stroke({color:[0,0,0,.7],width:2})}),zIndex:56}),"route-description-point":new ol.style.Style({image:new ol.style.Circle({radius:3,snapToPixel:false,fill:new ol.style.Fill({color:[255,255,255,1]}),stroke:new ol.style.Stroke({color:[0,
0,0,.8],width:1})}),zIndex:55}),"w3c-point-circle":new ol.style.Style({image:new ol.style.Circle({radius:5,snapToPixel:false,fill:new ol.style.Fill({color:[0,174,239,.1]}),stroke:new ol.style.Stroke({color:[36,56,85,.2],width:1})}),zIndex:51}),"w3c-point":new ol.style.Style({image:new ol.style.Circle({radius:7,snapToPixel:false,fill:new ol.style.Fill({color:[0,174,239,1]}),stroke:new ol.style.Stroke({color:[36,56,85,.8],width:1})}),zIndex:52})};
function initRoutingLayer(){mapRoutingLayer=new ol.layer.Vector({source:new ol.source.Vector,features:new ol.Collection,style:function(feature,resolution){if(!feature.get("type"))feature.set("type",feature.get("modality"));var featureType=feature.get("type");if(featureType=="car-route_debug-point"){var style=routingLayerStyle["car-route-debug-point"];if(style.getText()!=null&&feature.get("label")!=null)style.getText().setText(feature.get("label"));return style}if(featureType=="carRouteWfs"){var isFuture=
feature.get("future");var isHovered=feature.get("isHovered");var display_type=feature.get("display_type");var label=feature.get("info");var trend=feature.get("trend");var dx=feature.get("dx");var dy=feature.get("dy");return getCarRouteWfsIconStyle(getMapCurrentZoomLevelInteger(),display_type,isHovered,isFuture,label,trend,dx,dy)}else if(featureType==publicTransportRouteIconName)return stylePublicTransportRouteIcon(feature);else if(feature.intermodal)if(feature.getGeometry().getType()=="LineString")if(feature.intermodal&&
feature.connectingLine)return routingLayerStyle[intermodalconnectingLineName];else return routingLayerStyle[intermodalLineName];else return styleIntermodalRouteIcon(feature);else{var style=routingLayerStyle[featureType];if(style){var featureAddress=feature.get("address");if(featureAddress!=null&&featureAddress.length>0){if(!Liferay.Browser.isMobile())featureAddress+="\n                              \uf047";style.getText().setText(featureAddress)}else if(style.getText()!=null)if(!Liferay.Browser.isMobile())style.getText().setText("\n                              \uf047");
var isHovered=feature.get("isHovered");if(featureType==pointNameW3C_circle)style=updateW3CCircleRadius();else if(featureType==carRouteLineName)return styleLosCarRoute(feature,isHovered);else if(featureType==carRouteLineColoredName)return routingLayerStyle[carRouteLineColoredName];else if(featureType==publicTransportRouteLineName)return stylePublicTransportRoute(feature)}}return style}});map.addLayer(mapRoutingLayer);if(!Liferay.Browser.isMobile())initDragDrop()}
function hexToRgb(hex,opacity){var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result?"rgba("+parseInt(result[1],16)+","+parseInt(result[2],16)+","+parseInt(result[3],16)+","+opacity+")":null}
function styleIntermodalRouteIcon(feature){let isHovered=feature.get("isHovered");let modalityTransition=feature.get("modality-transition");let filename=modalityTransition+".png";let imageIcon=preloadedPublicTransportRouteImages[filename];if(imageIcon)if(isHovered)return new ol.style.Style({image:new ol.style.Icon({img:imageIcon,imgSize:[imageIcon.width,imageIcon.height]}),text:new ol.style.Text({text:feature.get("name"),font:"normal 18px FontAwesome",offsetY:25,offsetX:0,fill:new ol.style.Fill({color:[0,
0,0,1]}),stroke:new ol.style.Stroke({width:6,color:[255,255,255,1]})}),zIndex:99});else return new ol.style.Style({image:new ol.style.Icon({img:imageIcon,imgSize:[imageIcon.width,imageIcon.height]}),zIndex:99})}
function matchOvImages(feature){let featureType=feature.get("type");if(featureType=="platform"||featureType=="public_transport")return preloadedPublicTransportRouteImages["abellio-zug.png"];else if(featureType=="stop")return preloadedPublicTransportRouteImages["fussweg.png"];else if(featureType=="address")return undefined;else if(featureType=="bicycle"||featureType=="optimized_bicycle")return preloadedPublicTransportRouteImages["bike.png"];else if(featureType=="walking")return preloadedPublicTransportRouteImages["fussweg.png"]}
function stylePublicTransportRouteIcon(feature){var isHovered=feature.get("isHovered");var imageIcon=preloadedPublicTransportRouteImages[feature.get("iconName")];if(isHovered)return new ol.style.Style({image:new ol.style.Icon({img:imageIcon,imgSize:[imageIcon.width,imageIcon.height],opacity:.7}),text:new ol.style.Text({text:feature.get("stopName"),font:"12px sans-serif",offsetY:25,offsetX:0,fill:new ol.style.Fill({color:[255,255,255,1]}),stroke:new ol.style.Stroke({width:6,color:[162,102,103,.8]})}),
zIndex:99});else return new ol.style.Style({image:new ol.style.Icon({img:imageIcon,imgSize:[imageIcon.width,imageIcon.height],opacity:.7}),zIndex:53})}
function stylePublicTransportRoute(feature){let geometry=feature.getGeometry();if(geometry.getType()=="MultiLineString"){let linestringArray=geometry.getLineStrings();let status=geometry.get("status");let styleResult=[];for(let i=0;i<linestringArray.length;i++){let lineColor=publicTransportRouteColorMap[status[i]];let tmpStyle=new ol.style.Style({geometry:linestringArray[i],stroke:new ol.style.Stroke({lineCap:"butt",width:6,color:lineColor}),zIndex:52});styleResult.push(tmpStyle)}return styleResult}else return routingLayerStyle["bus-route-line"]}
function getCarRouteWfsIconStyle(zoom,display_type,isHovered,future,label,trend,dx,dy){var size=null;var imgSrc=null;var preLoadedImg=null;var zIndex=4;var map=null;var style=null;var opacity=1;if(isVisibleDisplayType(display_type)){if(future)if(wfsIconMapFuture[display_type])map=wfsIconMapFuture;else{if(urbanWfsIconMapFuture[display_type])map=urbanWfsIconMapFuture}else if(wfsIconMap[display_type])map=wfsIconMap;else if(urbanWfsIconMap[display_type])map=urbanWfsIconMap;if(map&&map[display_type]){size=
map[display_type][zoom];if(size==null)size=17;imgSrc=map[display_type]["img"];preLoadedImg=map[display_type]["image"];zIndex=map[display_type]["zIndex"];size+=10;zIndex+=100;var fontSize=14;if(isHovered){size+=10;fontSize+=2}if(display_type=="CONGESTION")opacity=0;if(size&&imgSrc){var imgCanvas=getVectorImage2(preLoadedImg,size);style=new ol.style.Style({image:new ol.style.Icon({img:imgCanvas,imgSize:[size,size],opacity:opacity}),zIndex:zIndex});if(label){var font=fontSize+"px Arial";var fillColor=
"#CC0000";if(trend!="")label+=String.fromCharCode(trend);var strokeColor=[255,255,255,.5];var offset=map[display_type]["offset"][zoom];var offsetY=-offset*dy;var offsetX=offset*dx;text=new ol.style.Text({text:label,font:font,offsetX:offsetX,offsetY:offsetY,textBaseline:"top",fill:new ol.style.Fill({color:fillColor}),stroke:new ol.style.Stroke({width:9,color:strokeColor})});style.setText(text)}}}}return style}
function isVisibleDisplayType(display_type){if(carRoutingHighlighted)if(display_type=="CLOSURE"||display_type=="CLOSURE_ENTRY_EXIT"||display_type=="CLOSURE_TRUCKS"||display_type=="WEIGHT_LIMIT_35"||display_type=="WEIGHT_LIMIT_55")return true;else return false;else return true}
function styleLosCarRoute(feature,isHovered){var styleResult=[];var geometry=feature.getGeometry();if(geometry.getType()=="MultiLineString"){var linestringArray=geometry.getLineStrings();var losResult=geometry.get("los");for(var i=0;i<linestringArray.length;i++){var losValue=0;if(losResult[i])losValue=losResult[i];var lineColor=null;if(!isLosColorBlindVisible)lineColor=losColorMap[losValue];else lineColor=losColorBlindMap[losValue];var tmpStyle=new ol.style.Style({geometry:linestringArray[i],stroke:new ol.style.Stroke({lineCap:"butt",
width:5,color:lineColor}),zIndex:54});styleResult.push(tmpStyle)}}else{var style=routingLayerStyle["car-route-line"];return style}return styleResult}
function hoverRoutingFeatureInfo(featureAtPixel,pixel){var isFirstRouteDescription=mapRouteDescriptionPopupOverlay.getPosition()==undefined;var lineFeature=null;var wfsHoveredFeatures=[];for(var i=0;i<featureAtPixel.length;i++){var featureType=featureAtPixel[i].get("type");if(isFirstRouteDescription&&featureType==routeDescriptionPointName){isFirstRouteDescription=false;showRouteDescriptionPopup(featureAtPixel[i])}else if(featureType==carRouteLineName)lineFeature=featureAtPixel[i]}if(lineFeature){var vectorSource=
mapRoutingLayer.getSource();var point=new ol.geom.Point(lineFeature.getGeometry().getClosestPoint(map.getCoordinateFromPixel(pixel)));if(!routeLinePointHover){routeLinePointHover=new ol.Feature({name:pointNameHover,geometry:point,type:pointNameHover,efaId:null,isHovered:false});vectorSource.addFeature(routeLinePointHover)}else routeLinePointHover.setGeometry(point)}else if(routeLinePointHover){var vectorSource=mapRoutingLayer.getSource();vectorSource.removeFeature(routeLinePointHover);routeLinePointHover=
null}for(var i=0;i<hoveredFeatures.length;i++){var hoveredFeature=hoveredFeatures[i];var contains=false;for(var k=0;k<featureAtPixel.length;k++)if(featureAtPixel[k].getId()==hoveredFeature.getId()){contains=true;break}if(!contains){hoveredFeature.set("isHovered",false);if(hoveredFeature.get("type")==routeDescriptionPointName)closeRouteDescriptionPopup()}}hoveredFeatures=featureAtPixel}
function setStartPoint(lon,lat,efaId){updateAllRoutingPortletPoints(addFeaturePoint(pointNameStart,lon,lat,efaId,false))}function setTargetPoint(lon,lat,efaId){updateAllRoutingPortletPoints(addFeaturePoint(pointNameTarget,lon,lat,efaId,false))}function setViaPoint(lon,lat){updateAllRoutingPortletPoints(addFeaturePoint(pointNameVia,lon,lat,null,true))}function routeStartHere(lon,lat,efaId){setStartPoint(lon,lat,efaId);drawRoute()}
function routeEndHere(lon,lat,efaId){setTargetPoint(lon,lat,efaId,false);drawRoute()}function routeViaHere(lon,lat){setViaPoint(lon,lat);drawRoute()}
function updateAllRoutingPortletPoints(addedFeature,startDragging){var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();var viasFeatures=[];var startFeature=null;var targetFeature=null;var dragFeature=null;if(addedFeature){var pos=addedFeature.getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);dragFeature={lon:pos[0],lat:pos[1],viaIndex:addedFeature.get("viaIndex"),type:addedFeature.get("type"),lonWgs84:posWgs84[0],
latWgs84:posWgs84[1]}}for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia){var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);viasFeatures.push({lon:pos[0],lat:pos[1],viaIndex:features[i].get("viaIndex"),type:features[i].get("type"),lonWgs84:posWgs84[0],latWgs84:posWgs84[1]})}else if(features[i].get("type")==pointNameStart){var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,
mapProjectionName,wgs84ProjectionName);startFeature={lon:pos[0],lat:pos[1],viaIndex:null,type:features[i].get("type"),lonWgs84:posWgs84[0],latWgs84:posWgs84[1]}}else if(features[i].get("type")==pointNameTarget){var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);targetFeature={lon:pos[0],lat:pos[1],viaIndex:null,type:features[i].get("type"),lonWgs84:posWgs84[0],latWgs84:posWgs84[1]}}if(startDragging&&startDragging.lat&&startDragging.lon){var posWgs84=
new ol.proj.transform([startDragging.lat,startDragging.lon],mapProjectionName,wgs84ProjectionName);startDragging.lonWgs84=posWgs84[0];startDragging.latWgs84=posWgs84[1]}var result={viaPoints:viasFeatures,startPoint:startFeature,targetPoint:targetFeature,addedPoint:dragFeature,dragstart:startDragging};Liferay.fire("vipnrw-routing-portlet-point-coordinates",result)}
function getNextFreeViaIndex(){var index=0;var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia)index+=1;return index}
function updateFeaturesViaIndex(){var size=0;var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia){size+=1;features[i].setId(features[i].getId()+"_")}var index=0;for(var x=0;x<size;x++){var item=null;while((item=getViaFeatureByViaIndex(features,index))==null&&index<size)index++;if(item!=null){var newName=pointNameVia+x;item.setId(newName);item.set("name",newName);item.set("viaIndex",x);item.set("translation",
x+1+". "+"Zwischenziel entfernen")}index++}return index}function getViaFeatureByViaIndex(features,index){for(var i=0;i<features.length;i++)if(features[i].get("type")===pointNameVia&&features[i].get("viaIndex")===index)return features[i];return null}
function deleteRoute(){carRouteInterferences=null;var vectorSource=mapRoutingLayer.getSource();vectorSource.clear();Liferay.fire("vipnrw-remove-public-transport-route");Liferay.fire("vipnrw-remove-bike-route");Liferay.fire("vipnrw-remove-intermodal-route");Liferay.fire("vipnrw-remove-car-route");closeRouteDescriptionPopup();updateAllRoutingPortletPoints();clearSessionRoute();saveRoutePoints({start:null,vias:null,target:null});Liferay.fire("vipnrw-clear-via-points");handleWfsLayersUpdate();saveRoutePoints({});
abortPublicTransportRouteCall();osrmRequestHandler.clear("dragging");osrmRequestHandler.clear("draw");Liferay.fire("vipnrw-route-selection-update")}
function getViaIndexByClosestPoint(point){var lineLength=null;var segmentIndex=0;var tmpIndex=0;var vectorSource=mapRoutingLayer.getSource();var carRouteLineFeature=vectorSource.getFeatureById(carRouteLineName);if(carRouteLineFeature&&carRouteLineFeature.getGeometry()&&carRouteLineFeature.getGeometry().getCoordinates()){var coordinates=carRouteLineFeature.getGeometry().getCoordinates();for(var i=0;i<coordinates.length;i++)if(carRouteLineFeature.getGeometry().getType()=="MultiLineString")for(var x=
0;x<coordinates[i].length;x++){var tmpLinestringLength=(new ol.geom.LineString([point,coordinates[i][x]])).getLength();if(lineLength==null||tmpLinestringLength<lineLength){segmentIndex=tmpIndex;lineLength=tmpLinestringLength}tmpIndex++}else{var tmpLinestringLength=(new ol.geom.LineString([point,coordinates[i]])).getLength();if(lineLength==null||tmpLinestringLength<lineLength){segmentIndex=i;lineLength=tmpLinestringLength}}}var viaIndex=0;while(via_indices[viaIndex]<=segmentIndex)viaIndex++;return viaIndex-
1}function countViaFeatures(){var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();var size=0;for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia)size+=1;return size}
function moveViaFeatureByIndex(viaIndex,feature){var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();var size=0;for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia){size+=1;if(features[i].get("viaIndex")>=viaIndex)features[i].setId(features[i].getId()+"_")}if(viaIndex<size)for(var x=size-1;x>=viaIndex;x--){var item=getViaFeatureByViaIndex(features,x);if(item!=null){var newName=pointNameVia+(x+1);item.setId(newName);item.set("name",newName);item.set("viaIndex",
x+1);item.set("translation",x+2+". "+"Zwischenziel entfernen")}}var newName=pointNameVia+viaIndex;feature.setId(newName);feature.set("name",newName);feature.set("viaIndex",viaIndex);feature.set("translation",viaIndex+1+". "+"Zwischenziel entfernen")}
function addFeaturePoint(pointName,lon,lat,efaId,isVia){let vectorSource=mapRoutingLayer.getSource();let featurePoint=vectorSource.getFeatureById(pointName);let featureId=pointName;let translation=null;if(pointName==pointNameStart)translation="Start entfernen";else if(pointName==pointNameTarget)translation="Ziel entfernen";else if(pointName==pointNameVia)translation="Zwischenziel entfernen";let viaIndex=null;if(isVia){viaIndex=getNextFreeViaIndex();featureId=pointName+viaIndex;if(translation)translation=
viaIndex+1+". "+translation}let pointCoordinate=new ol.geom.Point([lon,lat]);if(featurePoint&&!isVia){featurePoint.set("efaId",efaId);featurePoint.setGeometry(pointCoordinate)}else{featurePoint=new ol.Feature({name:featureId,geometry:pointCoordinate,type:pointName,efaId:efaId,isHovered:false,translation:translation,viaIndex:viaIndex});featurePoint.setId(featureId);vectorSource.addFeature(featurePoint)}if(!isVia)updateAllRoutingPortletPoints();return featurePoint}
function removeFeature(featureId){let vectorSource=mapRoutingLayer.getSource();let feature=vectorSource.getFeatureById(featureId);if(feature){vectorSource.removeFeature(feature);updateFeaturesViaIndex();updateAllRoutingPortletPoints();drawRoute()}};
function drawRoute(){try{if(!MapRoutesHandler.getInstance().showCarRoutes&&!MapRoutesHandler.getInstance().showPtRoutes&&!MapRoutesHandler.getInstance().showBikeRoutes&&!MapRoutesHandler.getInstance().showIntermodalRoutes)vipnrwErrorMessage("Bitte einen Routentyp selektieren!","info",5,"ov-route");var routingPoints=findfeaturePoints();saveRoutePoints(routingPoints);if(isInputValidForRouting(routingPoints)){if(MapRoutesHandler.getInstance().showPtRoutes){Liferay.fire("vipnrw-remove-public-transport-route");
Liferay.fire("vipnrw-public-transport-route-started");getNewPublicTransportRoute(routingPoints)}if(MapRoutesHandler.getInstance().showBikeRoutes){Liferay.fire("vipnrw-remove-bike-route");getNewBikeRoute(routingPoints)}if(MapRoutesHandler.getInstance().showCarRoutes){Liferay.fire("vipnrw-remove-car-route");drawCarRoute(routingPoints)}else updateAllPointsBeforeRouting();if(MapRoutesHandler.getInstance().showIntermodalRoutes){Liferay.fire("vipnrw-remove-intermodal-route");drawIntermodalRoute(routingPoints)}}else{Liferay.fire("vipnrw-remove-public-transport-route");
Liferay.fire("vipnrw-remove-bike-route");Liferay.fire("vipnrw-remove-car-route");Liferay.fire("vipnrw-remove-intermodal-route");clearSessionRoute();handleWfsLayersUpdate();if(routingPoints.target!=null)updateAllRoutingPortletPoints(routingPoints.target,false);else if(routingPoints.start!=null)updateAllRoutingPortletPoints(routingPoints.start,false);else updateAllRoutingPortletPoints(null,false)}Liferay.fire("vipnrw-route-selection-update")}catch(e){console.error("error drawing route: "+e)}}
function updateAllPointsBeforeRouting(){try{var startFeature=null;var targetFeature=null;var viasFeatures=[];var routingPoints=findfeaturePoints();var startPosWgs84=new ol.proj.transform(routingPoints.start.getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);startFeature={lat:routingPoints.start.getGeometry().getCoordinates()[0],lon:routingPoints.start.getGeometry().getCoordinates()[1],viaIndex:null,type:pointNameStart,lonWgs84:startPosWgs84[0],latWgs84:startPosWgs84[1]};var targetPosWgs84=
new ol.proj.transform(routingPoints.target.getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);targetFeature={lat:routingPoints.target.getGeometry().getCoordinates()[0],lon:routingPoints.target.getGeometry().getCoordinates()[1],viaIndex:null,type:pointNameTarget,lonWgs84:targetPosWgs84[0],latWgs84:targetPosWgs84[1]};if(routingPoints.vias!=null&&routingPoints.vias.length>0)for(var i=0;i<routingPoints.vias.length;i++){var posWgs84=new ol.proj.transform(routingPoints.vias[i].getGeometry().getCoordinates(),
mapProjectionName,wgs84ProjectionName);viasFeatures.push({lon:routingPoints.vias[i].getGeometry().getCoordinates()[0],lat:routingPoints.vias[i].getGeometry().getCoordinates()[1],viaIndex:routingPoints.vias[i].get("viaIndex"),type:pointNameVia,lonWgs84:posWgs84[0],latWgs84:posWgs84[1]})}Liferay.fire("vipnrw-routing-portlet-update-all-points",{startPoint:startFeature,targetPoint:targetFeature,viaPoints:viasFeatures})}catch(e){console.error(e)}}
function isInputValidForRouting(routingPoints){return routingPoints.start!=null&&routingPoints.target!=null||routingPoints.start!=null&&routingPoints.target==null&&routingPoints.vias.lenght>0||routingPoints.start==null&&routingPoints.target!=null&&routingPoints.vias.lenght>0||routingPoints.start==null&&routingPoints.target==null&&routingPoints.vias.lenght>1}
function dragRoute(){if(dragging){var routingPoints=findfeaturePoints();if(routingPoints.start!=null&&routingPoints.target!=null||routingPoints.start!=null&&routingPoints.target==null&&routingPoints.vias.lenght>0||routingPoints.start==null&&routingPoints.target!=null&&routingPoints.vias.lenght>0||routingPoints.start==null&&routingPoints.target==null&&routingPoints.vias.lenght>1){if(dragInteraction!=null&&dragInteraction.feature_!=null){var type=dragInteraction.feature_.get("type");if(type&&(type==
pointNameStart||type==pointNameTarget))Liferay.fire("vipnrw-remove-public-transport-route")}if(MapRoutesHandler.getInstance().showBikeRoutes)Liferay.fire("vipnrw-remove-bike-route");if(MapRoutesHandler.getInstance().showIntermodalRoutes)Liferay.fire("vipnrw-remove-intermodal-route");if(MapRoutesHandler.getInstance().showCarRoutes){Liferay.fire("vipnrw-remove-car-route");dragCarRoute(routingPoints)}}else{Liferay.fire("vipnrw-remove-public-transport-route");Liferay.fire("vipnrw-remove-bike-route");
Liferay.fire("vipnrw-remove-intermodal-route");Liferay.fire("vipnrw-remove-car-route");updateAllRoutingPortletPoints(dragInteraction.feature_,true)}}}
function findfeaturePoints(){var result={start:null,target:null,vias:[]};if(mapRoutingLayer){var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia)result.vias.push(features[i]);else if(features[i].get("type")==pointNameStart)result.start=features[i];else if(features[i].get("type")==pointNameTarget)result.target=features[i];result.vias=sortViaPoints(result.vias)}return result}
function sortViaPoints(vias){if(vias.length>0){var sortedVias=[];for(var i=0;i<vias.length;i++){var index=vias[i].get("viaIndex");if(index!=null&&index<vias.length)sortedVias[index]=vias[i]}return sortedVias}return vias};
var reqNewPublicTransportRoute=null;var reqNewPublicTransportRouteXml=null;var vrrRouteResponse=null;
var publicTransportImagesAvialable=["re.png","none.png","foot-train.png","foot-bus.png","foot-sub.png","foot-bike.png","foot-foot.png","foot-unknown.png","train-train.png","train-bus.png","train-sub.png","train-bike.png","train-foot.png","train-unknown.png","bus-train.png","bus-bus.png","bus-sub.png","bus-bike.png","bus-foot.png","bus-unknown.png","bike-train.png","bike-bus.png","bike-sub.png","bike-bike.png","bike-foot.png","bike-unknown.png","sub-train.png","sub-bus.png","sub-sub.png","sub-bike.png",
"sub-foot.png","sub-unknown.png","unknown-train.png","unknown-bus.png","unknown-sub.png","unknown-bike.png","unknown-foot.png","unknown-unknown.png","abellio-zug.png","bus.png","fussweg.png","niederflurbus.png","niederflurstrab.png","r-bahn.png","regionalexpress.png","s-bahn.png","sb.png","schnellbus.png","schwebebahn.png","stadtbahn.png","stra\u00dfenbahn.png","u-bahn.png","via_pin2.png","skytrain.png","bike.png","regionalzug.png","regionalbus.png","taxibus.png","stadtbus.png","ersatzverkehr.png",
"regiobus.png","sprinterbus.png"];var preloadedPublicTransportRouteImages={};var contextPath="/o/de.strassennrw.vipnrw.map";
function preloadPublicTransportRouteImages(){try{let publicTransportIconImagePath=contextPath+"/images/pt/";for(let i=0;i<publicTransportImagesAvialable.length;i++){let img=new Image;img.onload=function(){};img.src=publicTransportIconImagePath+publicTransportImagesAvialable[i];preloadedPublicTransportRouteImages[publicTransportImagesAvialable[i]]=img}}catch(e){console.error(e)}}
function getNewPublicTransportRoute(routingPoints){try{removePublicTransportRoute();if(reqNewPublicTransportRoute&&reqNewPublicTransportRoute.readyState!=4&&reqNewPublicTransportRoute.status!=200)reqNewPublicTransportRoute.abort();let featureStart=routingPoints.start;let featureEnd=routingPoints.target;if(featureStart&&featureEnd){let urlRequest=vrrRequestUrl+"/XML_TRIP_REQUEST2?sessionID\x3d0\x26requestID\x3d0\x26language\x3dde\x26commonMacro\x3dtrue\x26trITMOTvalue100\x3d20";urlRequest+=getOvCoordinateURLPart(featureStart,
featureEnd)+getPortletOptions(false);reqNewPublicTransportRoute=new XMLHttpRequest;reqNewPublicTransportRoute.open("GET",urlRequest+"\x26mode\x3ddirect",true);reqNewPublicTransportRoute.timeout=4E4;reqNewPublicTransportRoute.ontimeout=()=>{Liferay.fire("vipnrw-public-transport-route-exception",{error:"Keine Route gefunden."})};reqNewPublicTransportRoute.onreadystatechange=function(aEvt){if(reqNewPublicTransportRoute.readyState==4)if(reqNewPublicTransportRoute.status==200){if(MapRoutesHandler.getInstance().showPtRoutes){vrrRouteResponse=
reqNewPublicTransportRoute.responseText;vrrRouteParser.parseVrrXmlString(vrrRouteResponse);if(vrrRouteParser.routeResult){vrrRouteParser.routeResult.featureStart=featureStart;vrrRouteParser.routeResult.featureEnd=featureEnd}let result=vrrRouteParser.routeResult;if(result&&result.length>0){showPublicTransportCoordinatesRoute(0);Liferay.fire("vipnrw-public-transport-route",{routeResult:result,hasViaPoints:routingPoints.vias.length>0})}else Liferay.fire("vipnrw-public-transport-route-exception",{error:"Keine Route gefunden."})}}else{console.log("public transport route error: "+
reqNewPublicTransportRoute.status);Liferay.fire("vipnrw-public-transport-route-exception",{error:"Keine Route gefunden."})}};reqNewPublicTransportRoute.send(null)}}catch(ex){console.error("error calling pt api for route: "+ex)}}function abortPublicTransportRouteCall(){if(reqNewPublicTransportRoute!=null&&(reqNewPublicTransportRoute.readyState!=4||reqNewPublicTransportRoute.status!=200))try{reqNewPublicTransportRoute.abort()}catch(e){console.error(e)}}
function getPortletOptions(limitOneTrip){let options="";try{let routingOptions=getRoutingPortletPublicTransportOptions();if(routingOptions.dep_arr)options+="\x26itdTripDateTimeDepArr\x3ddep";else options+="\x26itdTripDateTimeDepArr\x3darr";options+="\x26itdDateDayMonthYear\x3d"+routingOptions.date_dep_arr;options+="\x26itdTime\x3d"+routingOptions.time_dep_arr;options+="\x26ptOptionsActive\x3d1\x26useRealtime\x3d1";if(routingOptions.linerestriction)options+="\x26lineRestriction\x3d"+routingOptions.linerestriction;
let excludedMeans=routingOptions.excludedMeans;for(let i=0;i<excludedMeans.length;i++){if(i==0)options+="\x26excludedMeans\x3d1";options+="\x26exclMOT_"+excludedMeans[i]+"\x3d1"}if(routingOptions.speed)options+="\x26changeSpeed\x3d"+routingOptions.speed;if(routingOptions.maxchanges&&routingOptions.maxchanges>=0)options+="\x26maxChanges\x3d"+routingOptions.maxChanges;options+="\x26coordOutputFormat\x3dWGS84[GGZHTXX]\x26coordListOutputFormat\x3dSTRING"}catch(e){console.error(e);options="\x26itdTripDateTimeDepArr\x3ddep\x26ptOptionsActive\x3d1\x26useRealtime\x3d1\x26lineRestriction\x3d400"+
"\x26changeSpeed\x3dNORMAL\x26coordOutputFormat\x3dWGS84[GGZHTXX]\x26coordListOutputFormat\x3dSTRING"}if(limitOneTrip)options+="\x26calcNumberOfTrips\x3d1";return options}
function getRoutingPortletPublicTransportOptions(){let excludedMeans=[];let isTrain=getCookie("route-settings-train",true);let isInterurban=getCookie("route-settings-interurban",true);let isSubway=getCookie("route-settings-subway",true);let isCitytrain=getCookie("route-settings-citytrain",true);let isTram=getCookie("route-settings-tram",true);let isCitybus=getCookie("route-settings-citybus",true);let isRegionalbus=getCookie("route-settings-regionalbus",true);let isSpeedbus=getCookie("route-settings-speedbus",
true);let isCablerailway=getCookie("route-settings-cablerailway",true);let isShip=getCookie("route-settings-ship",true);let isCallabus=getCookie("route-settings-callabus",true);let isOther=getCookie("route-settings-other",true);if(!isTrain)excludedMeans.push("0");if(!isInterurban)excludedMeans.push("1");if(!isSubway)excludedMeans.push("2");if(!isCitytrain)excludedMeans.push("3");if(!isTram)excludedMeans.push("4");if(!isCitybus)excludedMeans.push("5");if(!isRegionalbus)excludedMeans.push("6");if(!isSpeedbus)excludedMeans.push("7");
if(!isCablerailway)excludedMeans.push("8");if(!isShip)excludedMeans.push("9");if(!isCallabus)excludedMeans.push("10");if(!isOther)excludedMeans.push("11");let valueLinerestriction=getCookie("route-settings-linerestrictionCombo");if(valueLinerestriction==null||valueLinerestriction.length==0)valueLinerestriction="NO_LONG_DISTANCE_TRAINS";let linerestriction="";if(valueLinerestriction=="ALL_ALLOWED")linerestriction="400";else if(valueLinerestriction=="NO_ICE")linerestriction="401";else if(valueLinerestriction==
"NO_LONG_DISTANCE_TRAINS")linerestriction="403";else linerestriction="400";let changeSpeedRestriction=getCookie("route-settings-changeSpeedRestriction");if(changeSpeedRestriction==null||changeSpeedRestriction.length==0)changeSpeedRestriction="NORMAL";let date=getCookie("route-settings-date");let time=getCookie("route-settings-time");let currentDateTime=new Date;if(date==null||date.length==0)date=currentDateTime.getDate()+"."+currentDateTime.getMonth()+"."+currentDateTime.getYear();if(time==null||
time.length==0)time=currentDateTime.getHours()+":"+currentDateTime.getMinutes();return{dep_arr:getCookie("route-settings-departure",true),date_dep_arr:date,time_dep_arr:time,transportTypePublicTransport:true,bikesonpublictransport:getCookie("route-settings-bikesonpublictransport",true),linerestriction:linerestriction,speed:changeSpeedRestriction,maxchanges:getCookie("route-settings-maxChanges",-1),excludedMeans:excludedMeans}}
function getOvCoordinateURLPart(featureStart,featureEnd){let urlReqeustPart="";if(featureStart)urlReqeustPart+=getFeatureUrlPart(featureStart,"origin");if(featureEnd)urlReqeustPart+=getFeatureUrlPart(featureEnd,"destination");return urlReqeustPart}
function getFeatureUrlPart(feature,vrrUsage){if(feature.get("efaId"))return"\x26type_"+vrrUsage+"\x3dstopID\x26name_"+vrrUsage+"\x3d"+feature.get("efaId");else{let coords=feature.getGeometry().getCoordinates();let pos=new ol.proj.transform(coords,mapProjectionName,wgs84ProjectionName);return"\x26type_"+vrrUsage+"\x3dcoord\x26name_"+vrrUsage+"\x3d"+pos[0]+":"+pos[1]+":WGS84[DD,DDDDD]"}}
function getPublicTransportCoordinates(vrrSessionID,vrrRouteIndex,zoomTo){let urlRequest=vrrRequestUrl+"/XML_TRIP_REQUEST2?command\x3dtripCoordSeq:"+vrrRouteIndex+"\x26coordListOutputFormat\x3dSTRING\x26filterEpsilon\x3d3:5:10:30:40:50:50:"+"\x26itdLPxx_mdvMapName\x3dmdvMap_overview\x26language\x3dde\x26output\x3dJSON\x26requestID\x3d1\x26sessionID\x3d"+vrrSessionID+"\x26coordOutputFormat\x3dWGS84[ggzhtxx]\x26jsonp\x3d%jsonp\x26commonMacro\x3dtrue\x26trITMOTvalue100\x3d20";removePublicTransportRoute();
this.jsonpOSRM.clear("publictransportcoordroute");this.jsonpOSRM.call(urlRequest,showPublicTransportCoordinatesRoute,timeoutPublicTransportCoordinatesRoute,7E3,"publictransportcoordroute",[zoomTo])}
function showPublicTransportCoordinatesRoute(selection){removePublicTransportRoute();let result=vrrRouteParser.routeResult;if(result!=null){let route=result[selection];drawPublicTransportRouteIcons(route);if(route!=null&&route.linestring!=null&&route.linestring.length>0){let startFeature=result.featureStart;let endFeature=result.featureEnd;let coordinate=route.linestring[Math.floor(route.linestring.length*.7)];let cleanedLineString=eraseInvalidPublicTrafficPoints(route.linestring,startFeature,endFeature);
let multiLineStringGeom=new ol.geom.MultiLineString([]);if(cleanedLineString.coordinates&&cleanedLineString.coordinates.length>0){let status=[];let previosPoint=cleanedLineString.coordinates[0];let lastStatus=cleanedLineString.offsetData[0];let tmpLineString=new ol.geom.LineString([]);for(let i=0;i<cleanedLineString.coordinates.length;i++){if(cleanedLineString.offsetData[i]!=lastStatus){status.push(lastStatus);multiLineStringGeom.appendLineString(tmpLineString);tmpLineString=new ol.geom.LineString([]);
lastStatus=cleanedLineString.offsetData[i];tmpLineString.appendCoordinate(previosPoint)}tmpLineString.appendCoordinate(cleanedLineString.coordinates[i]);previosPoint=cleanedLineString.coordinates[i];if(i+1==cleanedLineString.coordinates.length){multiLineStringGeom.appendLineString(tmpLineString);status.push(lastStatus)}}multiLineStringGeom.set("status",status)}let vectorSource=mapRoutingLayer.getSource();let borderLineFeature=new ol.Feature({geometry:multiLineStringGeom,name:busRouteLineBorderName,
type:busRouteLineBorderName,isHovered:false});borderLineFeature.setId(busRouteLineBorderName);vectorSource.addFeature(borderLineFeature);let lineFeature=new ol.Feature({geometry:multiLineStringGeom,name:publicTransportRouteLineName,type:publicTransportRouteLineName,isHovered:false});lineFeature.setId(publicTransportRouteLineName);vectorSource.addFeature(lineFeature);showPublicTransportRoutePopup(coordinate,route.publicduration+"h");if(map_portlet_deeplink_print_view){let extent=ol.extent.boundingExtent(route.linestring);
extent=ol.extent.buffer(extent,map.getView().getResolution()*5);map.getView().fit(extent,map.getSize())}}}}
function drawPublicTransportRouteIcons(route){try{let vectorSource=mapRoutingLayer.getSource();if(route!=null&&route.partialRouteList!=null)for(let i=0;i<route.partialRouteList.length;i++){let iconName="via_pin2.png";if(route.partialRouteList[i].meansOfTransport!=null&&route.partialRouteList[i].meansOfTransport.icon!=null&&route.partialRouteList[i].meansOfTransport.icon.length>0&&$.inArray(route.partialRouteList[i].meansOfTransport.icon,publicTransportImagesAvialable)!=-1)iconName=route.partialRouteList[i].meansOfTransport.icon;
if(route.partialRouteList[i].arrivalPoint!=null){let point=new ol.geom.Point([route.partialRouteList[i].arrivalPoint.x,route.partialRouteList[i].arrivalPoint.y]);let ovPointFeature=new ol.Feature({geometry:point,name:publicTransportRouteIconName,type:publicTransportRouteIconName,isHovered:false,stopName:route.partialRouteList[i].arrivalPoint.name,iconName:iconName,identifier:"STATION__"+route.partialRouteList[i].arrivalPoint.stopId,wfs:true});ovPointFeature.setId(publicTransportRouteIconName+i);vectorSource.addFeature(ovPointFeature)}}}catch(e){consoloe.log(e)}}
function eraseInvalidPublicTrafficPoints(points,startFeature,endFeature){let offsetData=[];let coordinates=[];try{let startPoint=startFeature.getGeometry().getCoordinates();let endPoint=endFeature.getGeometry().getCoordinates();offsetData.push(1);coordinates.push(startPoint);let removedPoints=[];let debugLines=[];let previousPoint=startPoint;let totalAirDistance=(new ol.geom.LineString([startPoint,endPoint])).getLength();if(totalAirDistance<5E3)totalAirDistance=5E3;for(let i=0;i<points.length;i++){let lineStringGeom=
new ol.geom.LineString([coordinates[coordinates.length-1],points[i]]);if(lineStringGeom.getLength()>5E3){let lineStringGeomToEndPrevios=new ol.geom.LineString([coordinates[coordinates.length-1],endPoint]);let lineStringGeomToEnd=new ol.geom.LineString([points[i],endPoint]);if(lineStringGeom.getLength()>totalAirDistance||lineStringGeomToEndPrevios.getLength()<lineStringGeomToEnd.getLength()){if(map_portlet_debugging){removedPoints.push(points[i]);debugLines.push(new ol.geom.LineString([previousPoint,
points[i]]))}}else{offsetData.push(1);coordinates.push(points[i])}}else{offsetData.push(0);coordinates.push(points[i])}previousPoint=points[i]}offsetData.push(1);coordinates.push(endPoint);if(map_portlet_debugging&&map_portlet_debugging!="false")logRemovedPublicTransportRoutePoints(removedPoints,debugLines)}catch(e){consoloe.log(e)}return{coordinates:coordinates,offsetData:offsetData}}
function logRemovedPublicTransportRoutePoints(removedPoints,debugLines){if(removedPoints.length!=0){let vectorSource=mapRoutingLayer.getSource();for(let i=0;i<debugLines.length;i++){let lineFeature=new ol.Feature({geometry:debugLines[i],name:publicTransportRouteLineRemovedName,type:publicTransportRouteLineRemovedName,isHovered:false});lineFeature.setId(publicTransportRouteLineRemovedName+i);vectorSource.addFeature(lineFeature)}}}
function timeoutPublicTransportCoordinatesRoute(response,parameters){removePublicTransportRoute()}
function removePublicTransportRoute(){let vectorSource=mapRoutingLayer.getSource();let lineFeatureBorder=vectorSource.getFeatureById(busRouteLineBorderName);if(lineFeatureBorder)vectorSource.removeFeature(lineFeatureBorder);let features=vectorSource.getFeatures();for(let i=0;i<features.length;i++)if(features[i].get("type")==publicTransportPointName||features[i].get("type")==publicTransportRouteLineName||features[i].get("type")==publicTransportRouteLineRemovedName||features[i].get("type")==publicTransportRouteIconName)vectorSource.removeFeature(features[i]);
closePublicTransportRoutePopup()};
var decodePercision=5;var carRouteDragPending=false;var via_indices=null;var hints=null;var updateCarRouteLos=false;
function drawCarRoute(routingPoints){if(routingPoints.start&&routingPoints.target){updateCarRouteLos=false;Liferay.fire("vipnrw-car-route-started");let host=window.location.protocol+"//"+window.location.hostname;let urlRequest=getCarRouteUrlRequestString(routingPoints.start,routingPoints.target,routingPoints.vias,false,true,false);let routingUrl=host+urlRequest.url;osrmRequestHandler.clear("dragging");osrmRequestHandler.clear("draw");removeCarRoute();closeCarRoutePopup();$.get(routingUrl,function(data,
status){showCarRoute(data,{"initial":true})});osrmRequestHandler.call(map_portlet_resource_url,showCarRoute,timeoutCarRoute,1E4,"draw",{showInstructions:true,featurePoints:routingPoints},{action:"getOsrmCarRoute",url:urlRequest.url,urlPath:urlRequest.path,urlParameter:urlRequest.parameter})}}
function dragCarRoute(routingPoints){updateCarRouteLos=false;let urlRequest=getCarRouteUrlRequestString(routingPoints.start,routingPoints.target,routingPoints.vias,false,false,true);osrmRequestHandler.clear("draw");carRouteDragPending=!osrmRequestHandler.call(urlRequest.url,showCarRouteDragging,draggingCarTimeout,5E3,"dragging",{featurePoints:routingPoints})}
function timeoutCarRoute(response,parameters){closeCarRoutePopup();removeCarRoute();Liferay.fire("vipnrw-car-route-exception",{error:"Keine Route gefunden."})}
function showCarRouteDragging(response,parameters){if(!response||!response.routes||response.routes.length==0)return;if(!dragging)return;try{removeCarRoute();let responseRoute=response.routes[0];let responseWaypoints=response.waypoints;let geometry=decodeCarRoute(responseRoute.geometry,decodePercision,null);let lineStringGeom=new ol.geom.LineString(geometry);let vectorSource=mapRoutingLayer.getSource();let lineFeature=new ol.Feature({geometry:lineStringGeom,name:carRouteLineName,type:carRouteLineName,
isHovered:false});lineFeature.setId(carRouteLineName);vectorSource.addFeature(lineFeature);let times=getOsrmResponseOverallDuration(response,responseRoute,false);let distance=getOsrmResponseDistance(responseRoute,false);setCarRoutePopup(lineStringGeom,responseRoute,times,distance,null);updateAllRoutingPortletPoints(dragInteraction.feature_,true)}catch(e){console.error("Error while dragging the route: "+e.message)}if(carRouteDragPending)setTimeout(draggingCarTimeout,1)}
function draggingCarTimeout(){closePublicTransportRoutePopup();closeBikeRoutePopup();dragRoute()}function getLosByName(name){if(name)if(name=="LOS1")return 1;else if(name=="LOS2")return 2;else if(name=="LOS3")return 3;else if(name=="LOS4")return 4;else if(name=="LOS5")return 5;else if(name=="LOS_CLOSED")return 6;return 0}
function showCarRoute(response,parameters){try{if(response.error)throw response.error;if(parameters.initial){if(response.routes){removeCarRoute();let responseRoute=response.routes[0];let responseWaypoints=response.waypoints;let geometry=decodeCarRoute(responseRoute.geometry,decodePercision,responseWaypoints);if(geometry&&geometry.length>0){let lineStringGeom=new ol.geom.LineString(geometry);drawCarRouteLosMultiLineColor(lineStringGeom,geometry,response,parameters.initial)}if(map_portlet_deeplink_print_view){let extent=
ol.extent.boundingExtent(geometry);extent=ol.extent.buffer(extent,map.getView().getResolution()*5);map.getView().fit(extent,map.getSize())}updateCarRouteLos=false}}else{removeCarRoute();if(!response||!response.routes||response.routes.length==0||!MapRoutesHandler.getInstance().showCarRoutes){if(response.routingResponseCode==="CLOSURE_ON_ROUTE"){let closureTranslation="Aufgrund einer Vollsperrung kann keine Route gefunden werden. Setzen Sie bitte ein Zwischenziel um die Sperrung zu umfahren.";Liferay.fire("vipnrw-car-route-exception",
{error:closureTranslation});if(parameters.rejectSecondCall)response.rejectSecondCall=parameters.rejectSecondCall}return}let responseRoute=response.routes[0];let responseWaypoints=response.waypoints;let geometry=decodeCarRoute(responseRoute.geometry,decodePercision,responseWaypoints);if(geometry&&geometry.length>0){let lineStringGeom=new ol.geom.LineString(geometry);drawCarRouteLosMultiLineColor(lineStringGeom,geometry,response);snapCarRoute(responseWaypoints);let times=getOsrmResponseOverallDuration(response,
responseRoute,false);let duration=times.durationString;let distance=getOsrmResponseDistance(responseRoute,false);let instructionHtml=null;setCarRoutePopup(lineStringGeom,responseRoute,duration,distance,getOsrmResponseTravelTimeLoss(response,false));if(parameters.showInstructions)instructionHtml=showCarRouteDescription(responseRoute,"de",geometry);distance=getOsrmResponseDistance(responseRoute,true);Liferay.fire("vipnrw-car-route-finished",{durationSec:times.durationSec,instructionHtml:instructionHtml,
duration:duration,distance:distance,osmids:response.osmids,"travelTimeLoss":getOsrmResponseTravelTimeLoss(response,false)});if(map_portlet_deeplink_print_view){let extent=ol.extent.boundingExtent(geometry);extent=ol.extent.buffer(extent,map.getView().getResolution()*5);map.getView().fit(extent,map.getSize())}updateCarRouteLos=true}if(!Liferay.Browser.isMobile()){updateAllRoutingPortletPoints(dragInteraction.feature_,false);dragInteraction.feature_=null}}}catch(e){console.log("unknown response:"+e);
Liferay.fire("vipnrw-car-route-exception",{error:"Keine Route gefunden."})}}
function updateCarRouteData(){let routingPoints=findfeaturePoints();if(isInputValidForRouting(routingPoints)&&updateCarRouteLos&&MapRoutesHandler.getInstance().showCarRoutes){osrmRequestHandler.clear("dragging");osrmRequestHandler.clear("draw");osrmRequestHandler.call(map_portlet_resource_url,showRefreshCarRouteLos,timeoutRefreshCarRouteLos,1E4,"draw",{showInstructions:false,featurePoints:routingPoints},{action:"refreshCarRouteLos"})}}
function showRefreshCarRouteLos(response,parameters){try{if(!response||!response.routes||response.routes.length==0||!MapRoutesHandler.getInstance().showCarRoutes)return;let routeIndex=0;let responseRoute=response.routes[routeIndex];let responseWaypoints=response.waypoints;let geometry=decodeCarRoute(responseRoute.geometry,decodePercision,responseWaypoints);if(geometry&&geometry.length>0){removeCarRouteLos();deleteCarRouteInterferences();let vectorSource=mapRoutingLayer.getSource();let routingLine=
vectorSource.getFeatureById(carRouteLineName);if(routingLine)vectorSource.removeFeature(routingLine);let lineFeatureBorder=vectorSource.getFeatureById(carRouteLineBorderName);if(lineFeatureBorder)vectorSource.removeFeature(lineFeatureBorder);let lineStringGeom=new ol.geom.LineString(geometry);drawCarRouteLosMultiLineColor(lineStringGeom,geometry,response);let times=getOsrmResponseOverallDuration(response,responseRoute,false);let duration=times.durationString;let distance=getOsrmResponseDistance(responseRoute,
false);let travelTimeLoss=getOsrmResponseTravelTimeLoss(response,false);setCarRoutePopup(lineStringGeom,responseRoute,duration,distance,travelTimeLoss);Liferay.fire("vipnrw-car-route-update",{"duration":duration,"durationSec":times.durationSec,"distance":distance,"travelTimeLoss":travelTimeLoss,"selection":routeIndex})}}catch(e){Liferay.fire("vipnrw-car-route-exception",{error:"Unknown response."})}}
function removeCarRouteLos(){deleteCarRouteInterferences();let vectorSource=mapRoutingLayer.getSource();let routingLine=vectorSource.getFeatureById(carRouteLineName);if(routingLine)vectorSource.removeFeature(routingLine);let lineFeatureBorder=vectorSource.getFeatureById(carRouteLineBorderName);if(lineFeatureBorder)vectorSource.removeFeature(lineFeatureBorder)}
function timeoutRefreshCarRouteLos(response,parameters){let errorTranslation="Fehler beim aktualisieren der Verkehrslage auf der Auto Route.";Liferay.fire("vipnrw-car-route-exception",{error:errorTranslation})}
function drawCarRouteLosMultiLineColor(lineStringGeom,geometry,response,initial){let lineFeatureGeometry=null;let tmpLineString=null;let losResult=[];let currentLos=0;let lastLos=0;let losOffsetData=response.losOffsetData;let vectorSource=mapRoutingLayer.getSource();carRouteInterferences=response.interferences;if(isForecastEnabled()){$.each(losOffsetData,function(i,item){item.los="LOS_UNKNOWN"});carRouteInterferences=[]}drawCarRouteInterferences();if(!losOffsetData||losOffsetData.length==0)lineFeatureGeometry=
new ol.geom.LineString(geometry);else{lineFeatureGeometry=new ol.geom.MultiLineString([]);for(let i=0;i<geometry.length;i++){for(let k=0;k<losOffsetData.length;k++)if(losOffsetData[k].offset==i){currentLos=getLosByName(losOffsetData[k].los);break}if(i==0)tmpLineString=new ol.geom.LineString([]);tmpLineString.appendCoordinate(geometry[i]);if(i>0&&(lastLos!=currentLos||i+1==geometry.length)){if(i+1<geometry.length)tmpLineString.appendCoordinate(geometry[i+1]);losResult.push(lastLos);lineFeatureGeometry.appendLineString(tmpLineString);
tmpLineString=new ol.geom.LineString([]);tmpLineString.appendCoordinate(geometry[i])}lastLos=currentLos}lineFeatureGeometry.set("los",losResult);let lineFeatureBorder=new ol.Feature({geometry:lineStringGeom,name:carRouteLineBorderName,type:carRouteLineBorderName,isHovered:false});lineFeatureBorder.setId(carRouteLineBorderName);vectorSource.addFeature(lineFeatureBorder)}if(initial){let lineFeature=new ol.Feature({geometry:lineFeatureGeometry,name:carRouteLineColoredName,type:carRouteLineColoredName,
isHovered:false});lineFeature.setId(carRouteLineColoredName);vectorSource.addFeature(lineFeature)}else{let lineFeature=new ol.Feature({geometry:lineFeatureGeometry,name:carRouteLineName,type:carRouteLineName,isHovered:false});lineFeature.setId(carRouteLineName);vectorSource.addFeature(lineFeature)}}
function drawCarRouteInterferences(){if(carRouteInterferences!=null){let vectorSource=mapRoutingLayer.getSource();for(let i=0;i<carRouteInterferences.length;i++)try{let interference=carRouteInterferences[i];if(interference.point){let latLon=interference.point.split(",");if(latLon&&latLon.length==2){let lat=parseFloat(latLon[1]);let lon=parseFloat(latLon[0]);let pos=new ol.proj.transform([lon,lat],wgs84ProjectionName,mapProjectionName);let point=new ol.geom.Point(pos);let pointFeature=new ol.Feature({geometry:point,
name:"carRouteWfs",type:"carRouteWfs",isHovered:false,urban:false,display_type:interference.display_type,future:interference.future,identifier:interference.identifier,carRouteWfs:true,info:interference.info,trend:interference.trend,dx:interference.dx,dy:interference.dy});pointFeature.setId(interference.identifier);vectorSource.addFeature(pointFeature)}}}catch(e){console.error(e)}}else deleteCarRouteInterferences();handleWfsLayersUpdate()}
function deleteCarRouteInterferences(){let vectorSource=mapRoutingLayer.getSource();let features=vectorSource.getFeatures();for(let i=0;i<features.length;i++)if(features[i].get("carRouteWfs")==true)vectorSource.removeFeature(features[i]);carRouteInterferences=null}
function getOsrmResponseOverallDuration(response,responseRoute,addSpace){let ret={};let time="";if(responseRoute){let sec_num=responseRoute.duration;sec_num=response.traveltimeLoss?sec_num+response.traveltimeLoss:sec_num;ret.durationSec=sec_num;let hours=Math.floor(sec_num/3600);let minutes=((sec_num-hours*3600)/60).toFixed(0);if(hours>0){if(hours<10)hours="0"+hours;time=hours+":"}else time="00:";if(minutes>0){if(minutes<10)time+="0";time+=minutes}else time+="00";if(addSpace)time+=" ";time+="h"}ret.durationString=
time;return ret}function getOsrmResponseDuration(response,addSpace){let time="";if(response){let sec_num=response.duration;let hours=Math.floor(sec_num/3600);let minutes=((sec_num-hours*3600)/60).toFixed(0);if(hours>0){if(hours<10)hours="0"+hours;time=hours+":"}else time="00:";if(minutes>0){if(minutes<10)time+="0";time+=minutes}else time+="00";if(addSpace)time+=" ";time+="h"}return time}
function getOsrmResponseTravelTimeLoss(response,addSpace){if(response==null)return null;let sec_num=response.traveltimeLoss;if(sec_num<30)return null;let time="+";time+=(sec_num/60).toFixed(0);time+=" Min.";return time}function getOsrmResponseDistance(response,addSpace){let distanceString="";if(response){distanceString=(response.distance/1E3).toFixed(1).replace(".",",");if(addSpace)distanceString+=" ";distanceString+="km"}return distanceString}
function setCarRoutePopup(lineStringGeom,route,times,distance,traveltimeLoss){if(route&&lineStringGeom&&lineStringGeom.getCoordinates()&&lineStringGeom.getCoordinates().length>1){let cooradinate=null;let offset=[-10,0];if(dragging&&dragInteraction!=null&&dragInteraction.feature_!=null&&dragInteraction.feature_.getGeometry()&&dragInteraction.feature_.getGeometry().getCoordinates()){cooradinate=dragInteraction.feature_.getGeometry().getCoordinates();offset=[-45,-60]}else{let index=parseInt(lineStringGeom.getCoordinates().length/
2);cooradinate=lineStringGeom.getCoordinates()[index]}showCarRoutePopup(cooradinate,distance,times,traveltimeLoss,offset)}else;}
function snapCarRoute(waypoints){if(waypoints){let routingPoints=findfeaturePoints();for(let i=0;i<waypoints.length;i++){let location=waypoints[i].location;let pos=new ol.proj.transform([location[0],location[1]],wgs84ProjectionName,mapProjectionName);if(i==0)routingPoints.start.setGeometry(new ol.geom.Point(pos));else if(i==waypoints.length-1)routingPoints.target.setGeometry(new ol.geom.Point(pos));else routingPoints.vias[i-1].setGeometry(new ol.geom.Point(pos))}}}
function decodeCarRoute(encoded,precision,waypoints){precision=Math.pow(10,-precision);let array=[];let wgs84Array=[];if(encoded!=undefined){let len=encoded.length;let index=0;let lat=0;let lng=0;while(index<len){let b,shift=0,result=0;do{b=encoded.charCodeAt(index++)-63;result|=(b&31)<<shift;shift+=5}while(b>=32);let dlat=result&1?~(result>>1):result>>1;lat+=dlat;shift=0;result=0;do{b=encoded.charCodeAt(index++)-63;result|=(b&31)<<shift;shift+=5}while(b>=32);let dlng=result&1?~(result>>1):result>>
1;lng+=dlng;let wgsLon=lng*precision;let wgsLat=lat*precision;let pos=new ol.proj.transform([wgsLon,wgsLat],wgs84ProjectionName,mapProjectionName);wgs84Array.push([wgsLon,wgsLat]);array.push(pos)}}via_indices=[];if(waypoints!=null)for(let i=0;i<waypoints.length;i++){let index=getClosestPointIndex(waypoints[i].location,wgs84Array);via_indices.push(index)}return array}
function getClosestPointIndex(point,coordinates){let lineLength=null;let segmentIndex=0;if(point&&coordinates)for(let i=0;i<coordinates.length;i++){let tmpLinestringLength=(new ol.geom.LineString([point,coordinates[i]])).getLength();if(lineLength==null||tmpLinestringLength<lineLength){segmentIndex=i;lineLength=tmpLinestringLength}}return segmentIndex}
function removeCarRoute(){deleteCarRouteInterferences();let vectorSource=mapRoutingLayer.getSource();let routingLinesToRemove=[];let rLine=vectorSource.getFeatureById(carRouteLineName);if(rLine!=null)routingLinesToRemove.push(rLine);let rLineColored=vectorSource.getFeatureById(carRouteLineColoredName);if(rLineColored!=null)routingLinesToRemove.push(rLineColored);routingLinesToRemove.forEach(function(routingLine){if(routingLine)vectorSource.removeFeature(routingLine);let lineFeatureBorder=vectorSource.getFeatureById(carRouteLineBorderName);
if(lineFeatureBorder)vectorSource.removeFeature(lineFeatureBorder);let features=vectorSource.getFeatures();for(let i=0;i<features.length;i++)if(features[i].get("type")==routeDescriptionPointName||features[i].get("type")=="car-route_debug-point")vectorSource.removeFeature(features[i])});closeRouteDescriptionPopup()}
function getCarRouteUrlRequestString(featureStart,featureEnd,featureVias,alternative,loadInstructions,isDragging){let overview="full";if(isDragging)overview="simplified";let urlRequest="";let locationString=buildLocationString(featureStart,featureVias,featureEnd);let paramterString="alternatives\x3d"+alternative+"\x26overview\x3d"+overview+"\x26steps\x3d"+loadInstructions;if(locationString.length>0)urlRequest=osrmViaroutingUrl+locationString+"?"+paramterString;return{url:urlRequest,path:locationString,
parameter:paramterString}}function buildLocationString(featureStart,featureVias,featureEnd){let locations=[];if(featureStart!=null)locations.push(getCarRoutePointString(featureStart));if(featureVias.length>0)for(let i=0;i<featureVias.length;i++)locations.push(getCarRoutePointString(featureVias[i]));if(featureEnd!=null)locations.push(getCarRoutePointString(featureEnd));return locations.join(";")}
function getCarRoutePointString(feature){let result="";let pos=new ol.proj.transform(feature.getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);result+=pos[0]+","+pos[1];return result};
var reqNewBikeRoute=null;var lastBikeRoutePopupCoordinate=null;
function getNewBikeRoute(points){removeBikeRoute();closeBikeRoutePopup();if(points.start&&points.target){var viaPointsString=[];var viaPointsUTMString=[];var startPos=new ol.proj.transform(points.start.getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);var startPosUTM=new ol.proj.transform(points.start.getGeometry().getCoordinates(),mapProjectionName,airViewProjectionName);var targetPos=new ol.proj.transform(points.target.getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);
var targetPosUTM=new ol.proj.transform(points.target.getGeometry().getCoordinates(),mapProjectionName,airViewProjectionName);for(var i=0;i<points.vias.length;i++){var viaPos=new ol.proj.transform(points.vias[i].getGeometry().getCoordinates(),mapProjectionName,wgs84ProjectionName);viaPointsString.push(viaPos.join(","));var viaPosUTM=new ol.proj.transform(points.vias[i].getGeometry().getCoordinates(),mapProjectionName,airViewProjectionName);viaPointsUTMString.push(viaPosUTM.join(","))}var result={data:{startPoint:startPos.join(","),
targetPoint:targetPos.join(","),viaPoints:viaPointsString.join(";"),startPointUTM:startPosUTM.join(","),targetPointUTM:targetPosUTM.join(","),viaPointsUTM:viaPointsUTMString.join(";")}};for(var i=0;i<points.vias;i++)result.points.viaPoints.push(points.vias[i].getGeometry().getCoordinates());Liferay.fire("vipnrw-routing-portlet-request-bike-route",result)}}
function drawBikeRoute(totalDistance,totalDuration,linestring){removeBikeRoute();closeBikeRoutePopup();if(linestring&&linestring.length>0){var transformedLinestring=[];for(var i=0;i<linestring.length;i++){var point=new ol.proj.transform(linestring[i],wgs84ProjectionName,mapProjectionName);transformedLinestring.push(point)}var lineStringGeom=new ol.geom.LineString(transformedLinestring);var vectorSource=mapRoutingLayer.getSource();var borderLineFeature=new ol.Feature({geometry:lineStringGeom,name:bikeRouteLineBorderName,
type:bikeRouteLineBorderName,isHovered:false});borderLineFeature.setId(bikeRouteLineBorderName);vectorSource.addFeature(borderLineFeature);var lineFeature=new ol.Feature({geometry:lineStringGeom,name:bikeRouteLineName,type:bikeRouteLineName,isHovered:false});lineFeature.setId(bikeRouteLineName);vectorSource.addFeature(lineFeature);var coordinate=transformedLinestring[Math.floor(transformedLinestring.length*.3)];showBikeRoutePopup(coordinate,totalDistance,totalDuration);lastBikeRoutePopupCoordinate=
coordinate;if(map_portlet_deeplink_print_view){var extent=ol.extent.boundingExtent(transformedLinestring);extent=ol.extent.buffer(extent,map.getView().getResolution()*5);map.getView().fit(extent,map.getSize())}}}function updateBikeRouteDuration(totalDistance,totalDuration){if(lastBikeRoutePopupCoordinate)showBikeRoutePopup(lastBikeRoutePopupCoordinate,totalDistance,totalDuration)}
function removeBikeRoute(){var vectorSource=mapRoutingLayer.getSource();var lineFeatureBorder=vectorSource.getFeatureById(bikeRouteLineBorderName);if(lineFeatureBorder)vectorSource.removeFeature(lineFeatureBorder);var features=vectorSource.getFeatures();for(var i=0;i<features.length;i++)if(features[i].get("type")==bikeRouteLineName)vectorSource.removeFeature(features[i])};
var interModalRoutesToShow=[];
function determineAddress(lat,lon){let url=routing_portlet_photon_reverse_url+"?lat\x3d"+lat+"\x26lon\x3d"+lon;let json=JSON.parse($.ajax({type:"GET",dataType:"json",url:url,async:false}).responseText);if(json.features[0].properties.type&&json.features[0].properties.type=="street")return json.features[0].properties.city+", "+json.features[0].properties.name;else{let street=json.features[0].properties.street;let housenumber=json.features[0].properties.housenumber;let city=json.features[0].properties.city;
return(city?city+", ":"")+(street?street:"")+" "+(housenumber?housenumber:"")}}
function calculateInfoPopupPosition(features){let lineStringFeatures=features.filter((a)=>a.getGeometry().getType()=="LineString");if(lineStringFeatures.length>1){let popupFeature=lineStringFeatures[Math.floor(lineStringFeatures.length/2)];let popupFeature2=lineStringFeatures[Math.ceil(lineStringFeatures.length/2)];let popupFeatureCoordinatesArray=popupFeature.getGeometry().getCoordinates();let popupFeatureCoordinatesArray2=popupFeature2.getGeometry().getCoordinates();return popupFeatureCoordinatesArray.length>=
popupFeatureCoordinatesArray2.length?popupFeatureCoordinatesArray[Math.floor(popupFeatureCoordinatesArray.length/2)]:popupFeatureCoordinatesArray2[Math.floor(popupFeatureCoordinatesArray2.length/2)]}else{let popupFeatureCoordinatesArray=lineStringFeatures[0].getGeometry().getCoordinates();return popupFeatureCoordinatesArray[parseInt(popupFeatureCoordinatesArray.length/2)]}}
function productClassToIcon(transitionPreClass,transitionPostClass){return productClassToIconName(transitionPreClass)+"-"+productClassToIconName(transitionPostClass)}function productClassToIconName(productClass){switch(productClass){case 0:case 3:case 4:case 8:case 13:case 14:case 15:case 16:case 18:return"train";case 1:case 2:return"sub";case 5:case 6:case 7:case 10:case 19:return"bus";case 99:case 100:return"foot";case 201:return"bike";default:return"train"}}
function showPlatformInformation(productClass){switch(productClass){case 0:case 1:case 2:case 3:case 4:case 8:case 13:case 14:case 15:case 16:case 18:return true;default:return false}}function formatDuration(duration_journey_total){let duration=duration_journey_total?duration_journey_total:"00:00:00";if(duration.length==7)duration="0"+duration;return duration.substring(0,5)}function parseStops(stopsString){let stops=new Array;try{return stopsString.trim().split(" - ")}catch(e){return stops}}
function preprocessRoutingResponse(routingResponse){let result=new Array;for(let i=0;i<routingResponse.length;i++){let features=(new ol.format.GeoJSON).readFeatures(routingResponse[i],{featureProjection:"EPSG:3857"});let connectingLines=new Array;for(var j=0;j<features.length;j++){features[j].intermodal=true;let origin=features[j].get("origin");if(origin){if(origin.metrics.start_time){let time=origin.metrics.start_time;origin.metrics.start_time=covertToDETime(time)}if(!origin.coord){let coords=features[j].getGeometry().getFirstCoordinate();
var posWgs84=new ol.proj.transform(coords,mapProjectionName,wgs84ProjectionName);origin.coord=[posWgs84[1],posWgs84[0]]}if(origin.name==null||origin.name=="")origin.name=determineAddress(origin.coord[0],origin.coord[1])}let destination=features[j].get("destination");if(destination){if(destination.metrics.start_time){let stime=destination.metrics.start_time;destination.metrics.start_time=covertToDETime(stime)}if(destination.metrics.end_time){let etime=destination.metrics.end_time;destination.metrics.end_time=
covertToDETime(etime)}else destination.metrics.end_time=destination.metrics.start_time;if(!destination.coord){let coords=features[j].getGeometry().getLastCoordinate();var posWgs84=new ol.proj.transform(coords,mapProjectionName,wgs84ProjectionName);destination.coord=[posWgs84[1],posWgs84[0]]}if(destination.name==null||destination.name=="")destination.name=determineAddress(destination.coord[0],destination.coord[1]);let platform="";if(destination.properties&&destination.properties.platform)platform=
destination.properties.platform;if(destination.properties&&destination.properties.platformName)platform=destination.properties.platformName;let showPlatformInfo=showPlatformInformation(features[j].get("transportation").product.product_class);let stops=parseStops(features[j].get("transportation").description);destination.platformDetails={showPlatformInfo:showPlatformInfo,platform:platform,vehicleName:features[j].get("transportation").name,stops:stops,stopsHeader:result.length+"_"+j};if(features[j].get("transportation")&&
features[j].get("transportation").destination)destination.platformDetails.destination=features[j].get("transportation").destination.name}if(features[j].get("metrics").start_time)features[j].get("metrics").start_time=covertToDETime(features[j].get("metrics").start_time);if(features[j].get("metrics").end_time)features[j].get("metrics").end_time=covertToDETime(features[j].get("metrics").end_time);if(features[j].get("metrics").departure_time)features[j].get("metrics").departure_time=covertToDETime(features[j].get("metrics").departure_time);
if(features[j].getGeometry().getType()=="Point")if(j+1<features.length&&j-1>=0){let transitionPreClass=features[j-1].get("transportation").product.product_class;let transitionPostClass=features[j+1].get("transportation").product.product_class;let lastCoordsOfPre=features[j-1].getGeometry().getLastCoordinate();let firstCoordsOfPost=features[j+1].getGeometry().getFirstCoordinate();let line=new ol.geom.LineString([lastCoordsOfPre,firstCoordsOfPost]);let lineFeature=new ol.Feature({geometry:line,name:intermodalconnectingLineName,
type:intermodalconnectingLineName,isHovered:false});lineFeature.intermodal=true;lineFeature.connectingLine=true;connectingLines.push(lineFeature);features[j].set("modality-transition",productClassToIcon(transitionPreClass,transitionPostClass))}}let journeyStart=features[0];let journeyStartTime=journeyStart.get("metrics").start_time;let journeyEnd=features[features.length-1];let routeSummary=journeyEnd.get("metrics");let arrivatTime=routeSummary.start_time;let duration=formatDuration(routeSummary.duration_journey_total);
let route={description:"",features:features,connectingFeatures:connectingLines};route.popupCoordinates=calculateInfoPopupPosition(features);route.changes=routeSummary.number_of_pt_changes;route.distanceString="";route.durationString=duration;route.startTime=journeyStartTime?journeyStartTime.substring(0,5):getCurrentTime();route.sortWeight=timeStringToSec(route.startTime);route.endTime=arrivatTime;route.distanceString="";result.push(route)}result.sort((a,b)=>a.sortWeight-b.sortWeight);let maxRoutesToShow=
4;if(result.length>maxRoutesToShow)result=result.slice(1,maxRoutesToShow+1);for(let i=0;i<result.length;i++)result[i].id=i;return result}
function drawIntermodalRoute(routingPoints){removeIntermodalRoute();closeIntermodalRoutePopup();if(routingPoints.start.getGeometry().getCoordinates()&&routingPoints.target.getGeometry().getCoordinates()){let url=addRoutingURLParameter(maasRouterURL,routingPoints.start.getGeometry().getCoordinates(),routingPoints.target.getGeometry().getCoordinates());$.ajax({type:"GET",url:url,timeout:4E4,beforeSend:function(){Liferay.fire("vipnrw-intermodal-route-started",{showLoading:true})},success:function(routingResponse){if(routingResponse.code){Liferay.fire("vipnrw-intermodal-route-exception",
{error:"Keine Route gefunden."});console.error(JSON.stringify(routingResponse))}else{interModalRoutesToShow=preprocessRoutingResponse(routingResponse);addIntermpodalRoute(0);Liferay.fire("vipnrw-intermodal-route",{addedFeatures:interModalRoutesToShow})}},error:function(jqXHR,textStatus,errorThrown){if(textStatus=="timeout")Liferay.fire("vipnrw-intermodal-route-exception",{error:"Keine Route gefunden."});else Liferay.fire("vipnrw-intermodal-route-exception",{error:"Keine Route gefunden."});console.error("error: "+
textStatus+", "+errorThrown)}})}}function addRoutingURLParameter(url,startCoords,targetCoords){let pos=new ol.proj.transform(startCoords,mapProjectionName,wgs84ProjectionName);let startP=pos[0]+":"+pos[1];let pos2=new ol.proj.transform(targetCoords,mapProjectionName,wgs84ProjectionName);let targetP=pos2[0]+":"+pos2[1];return url+"?output_format\x3dgeojson\x26origin\x3d"+startP+"\x26destination\x3d"+targetP+getQueryOptions()}
function getQueryOptions(){let type=getCookie("intermodalrouter-schedule_type",true);let date=getCookie("intermodalrouter-schedule_d");let time=getCookie("intermodalrouter-schedule_t");let maxDistance=getCookie("intermodalrouter-max_distance_km");let cycleSpeed=getCookie("intermodalrouter-cycle_speed");let options="";var d=new Date,month=""+(d.getMonth()+1),day=""+d.getDate(),year=d.getFullYear();if(month.length<2)month="0"+month;if(day.length<2)day="0"+day;if(date==null||date.length==0)date=[year,
month,day].join("-");if(time==null||time.length==0)time=getCurrentTime();options+="\x26schedule_d\x3d"+date+"\x26schedule_t\x3d"+time;if(type)options+="\x26schedule_type\x3ddep";else options+="\x26schedule_type\x3darr";if(maxDistance!==null)options+="\x26max_distance_km\x3d"+maxDistance;if(cycleSpeed!==null)options+="\x26cycle_speed\x3d"+cycleSpeed;return options}
function addIntermpodalRoute(selection){removeIntermodalRoute();if(interModalRoutesToShow){let route=interModalRoutesToShow[selection];if(route){var vectorSource=mapRoutingLayer.getSource();vectorSource.addFeatures(route.features);if(route.connectingFeatures)vectorSource.addFeatures(route.connectingFeatures);showIntermodalRoutePopup(route.popupCoordinates,route.distanceString,route.durationString)}}}
function removeIntermodalRoute(){closeIntermodalRoutePopup();var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();for(var i=0;i<features.length;i++)try{if(features[i].intermodal)vectorSource.removeFeature(features[i])}catch(ex){console.log(ex)}};
var contextPath="/o/de.strassennrw.vipnrw.map";var mapRouteDescriptionPopup=null;var mapRouteDescriptionPopupOverlay=null;var supportedLanguages=[{encoding:"en",name:"English",key:"en"},{encoding:"en_EN",name:"English",key:"en"},{encoding:"de",name:"Deutsch",key:"de"},{encoding:"de_DE",name:"Deutsch",key:"de"}];var directionImagePath=contextPath+"/images/route-description/";
var directionImages={"none":"default.png","depart":"default.png","continue":"continue.png","bear-right":"slight-right.png","turn-right":"turn-right.png","sharp-right":"sharp-right.png","u-turn":"u-turn.png","sharp-left":"sharp-left.png","turn-left":"turn-left.png","bear-left":"slight-left.png","via":"head.png","enter-roundabout":"round-about.png","arrive":"target.png"};
function initRouteDescriptionPopup(){mapRouteDescriptionPopup=document.getElementById(map_portlet_id+"mapRouteDescriptionPopup");mapRouteDescriptionPopupOverlay=new ol.Overlay({positioning:"bottom-left",offset:[-50,-12],element:mapRouteDescriptionPopup});map.addOverlay(mapRouteDescriptionPopupOverlay)}
function showRouteDescriptionPopup(feature){closeRouteDescriptionPopup();if(feature&&feature.get("instruction")&&feature.getGeometry()&&feature.getGeometry().getCoordinates()){$(mapRouteDescriptionPopup).html(feature.get("instruction"));mapRouteDescriptionPopupOverlay.setPosition(feature.getGeometry().getCoordinates());$(mapRouteDescriptionPopup).show()}}function closeRouteDescriptionPopup(){$(mapRouteDescriptionPopup).hide();mapRouteDescriptionPopupOverlay.setPosition(undefined);return false}
function showCarRouteDescription(response,language,geometry){var html='\x3ctable class\x3d"car-route-table"\x3e';if(response&&geometry){var drivingInstructionList=getInstructions(response,language);var featurePointArray=[];for(var i=0;i<drivingInstructionList.length;i++){var instruction=drivingInstructionList[i];var rowHtml=getHtmlRouteInstructionRow(instruction);if(rowHtml)html+=rowHtml;if(!Liferay.Browser.isMobile()){var featurePoint=getPositionMarker(instruction,i,geometry);if(featurePoint)featurePointArray.push(featurePoint)}}if(featurePointArray.length>
0){var vectorSource=mapRoutingLayer.getSource();vectorSource.addFeatures(featurePointArray)}}html+="\x3c/table\x3e";return html}
function getHtmlRouteInstructionRow(instruction){var mapPos=new ol.proj.transform(instruction.point,wgs84ProjectionName,mapProjectionName);var html="";var distanceString="";if(instruction.distance>0)if(instruction.distance<1E3)distanceString=Math.round(instruction.distance)+"m";else distanceString=(instruction.distance/1E3).toFixed(2).replace(".",",")+"km";var imgSrc=directionImagePath+instruction.icon;var popupHtml=buildRouteInstructionPopupTableHtml(distanceString,instruction,imgSrc);var textWidth=
measureTextWidth(instruction.text,'13px "Helvetica Neue", Helvetica, Arial, sans-serif');html+="\x3ctr onclick\x3d\"Liferay.fire('vipnrw-zoom-to-coordinate', {lat: "+mapPos[1]+", lon: "+mapPos[0]+", width: "+textWidth+", text: '"+popupHtml+"'})\"\x3e";html+='\x3ctd class\x3d"first-col"\x3e';html+='\x3cimg src\x3d"'+imgSrc+'" style\x3d"width:28px;"/\x3e';html+='\x3c/td\x3e\x3ctd class\x3d"second-col"\x3e';html+=instruction.text;html+="\x3c/td\x3e\x3c/tr\x3e";return html}
function buildRouteInstructionPopupTableHtml(distanceString,instruction,imgSrc){var imgHtml="";if(imgSrc)imgHtml='\x3cimg src\x3d"'+imgSrc+'" style\x3d"height:24px; max-width: auto;"/\x3e';var timeString="";if(instruction.time>0)if(instruction.time<60)timeString="  (\x3c 1 min)";else if(parseInt(instruction.time/60)<60)timeString="  ("+parseInt(instruction.time/60)+"min)";else timeString="  ("+parseInt(instruction.time/3600)+"h "+parseInt(instruction.time%3600/60)+"min)";var html='\x3ctable\x3e\x3ctr\x3e\x3ctd style\x3d"width: 25px;"\x3e'+
imgHtml+"\x3c/td\x3e";html+="\x3ctd\x3e\x3c/td\x3e";html+="\x3c/tr\x3e";html+='\x3ctr\x3e\x3ctd colspan\x3d"2"\x3e'+instruction.text+"\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e";return html.split('"').join("\x26quot;")}
function getPositionMarker(instruction,index,geometry){var instructionText=getHtmlRouteInstructionContent(instruction);var mapPos=new ol.proj.transform(instruction.point,wgs84ProjectionName,mapProjectionName);var featurePoint=new ol.Feature({name:routeDescriptionPointName,geometry:new ol.geom.Point(mapPos),type:routeDescriptionPointName,efaId:null,isHovered:false,instruction:instructionText});featurePoint.setId(routeDescriptionPointName+"_"+index);return featurePoint}
function getInstructions(response,language){var instructions=[];var languageKey="en";for(var i=0;i<supportedLanguages.length;i++)if(supportedLanguages[i].encoding==language){languageKey=supportedLanguages[i].key;break}var legs=response.legs;if(legs!=undefined&&legs!=null)for(var i=0;i<legs.length;i++)for(var j=0;j<legs[i].steps.length;j++){var step=legs[i].steps[j];var type=getManeuverToInstructionType(step.maneuver,i===legs.length-1);if(type){var direction=getBearingToDirection(step.maneuver.bearing_after);
var text=getInstructionText(languageKey,type,direction,step.name,step.maneuver.exit,instructions.length,step.distance,step.duration,step.ref);instructions.push({point:step.maneuver.location,type:type,distance:step.distance,time:step.duration,road:step.name,direction:direction,exit:step.maneuver.exit,mode:step.mode,icon:getIcon(type,instructions.length),text:text})}}return instructions}
function getInstructionText(languageKey,type,direction,road,exit,i,distance,duration,ref){var text="";if(languageKey&&Localization[languageKey]&&type){var instructionType=type==="Straight"?i===0?"Head":"Continue":type;var instructionsText=Localization[languageKey].instructions[instructionType];var directionsText="";var exitText="";if(direction)directionsText=Localization[languageKey].directions[direction];if(exit)exitText=Localization[languageKey].formatOrder(exit);if(instructionsText)for(var i=0;i<
instructionsText.length;i++)if(instructionsText[i].indexOf("{dir}")!==-1&&directionsText.length>0)text+=instructionsText[i].replace("{dir}",directionsText);else if(instructionsText[i].indexOf("{road}")!==-1&&road)text+=instructionsText[i].replace("{road}","\x3cb\x3e"+road+"\x3c/b\x3e");else if(instructionsText[i].indexOf("{exitStr}")!==-1)text+=instructionsText[i].replace("{exitStr}",exitText);else if(instructionsText[i].indexOf("{exitStr}")===-1&&instructionsText[i].indexOf("{road}")===-1&&instructionsText[i].indexOf("{dir}")===
-1)text+=instructionsText[i];if(ref)text+=", \x3cb\x3e"+ref+"\x3c/b\x3e";var timeString="";if(duration>0)if(duration<60)timeString="  (\x3c 1 min)";else if(parseInt(duration/60)<60)timeString="  ("+parseInt(duration/60)+" min)";else timeString="  ("+parseInt(duration/3600)+" h "+parseInt(duration%3600/60)+" min)";var distanceString="";if(distance>0)if(distance<1E3)distanceString=Math.round(distance)+" m";else distanceString=(distance/1E3).toFixed(2).replace(".",",")+" km";text+='\x3cbr\x3e\x3cfont color\x3d"#00aeef" size\x3d"2"\x3e'+
distanceString+"\x26nbsp;\x26nbsp;"+timeString+"\x3c/font\x3e"}return text}function getBearingToDirection(bearing){var oct=Math.round(bearing/45)%8;return["N","NE","E","SE","S","SW","W","NW"][oct]}
function getManeuverToInstructionType(maneuver,lastLeg){switch(maneuver.type){case "new name":return"Continue";case "arrive":return lastLeg?"DestinationReached":"WaypointReached";case "roundabout":case "rotary":return"Roundabout";default:switch(maneuver.modifier){case "straight":return"Straight";case "slight right":return"SlightRight";case "right":return"Right";case "sharp right":return"SharpRight";case "sharp left":return"SharpLeft";case "left":return"Left";case "slight left":return"SlightLeft";
case "uturn":return"TurnAround";default:return null}return null}}
function getIcon(type,i){switch(type){case "Straight":return i===0?directionImages["depart"]:directionImages["continue"];case "Continue":return directionImages["continue"];case "SlightRight":return directionImages["bear-right"];case "Right":return directionImages["turn-right"];case "SharpRight":return directionImages["sharp-right"];case "TurnAround":return directionImages["u-turn"];case "SharpLeft":return directionImages["sharp-left"];case "Left":return directionImages["turn-left"];case "SlightLeft":return directionImages["bear-left"];
case "WaypointReached":return directionImages["via"];case "Roundabout":return directionImages["enter-roundabout"];case "DestinationReached":return directionImages["arrive"];default:return directionImages["none"]}}
function getHtmlRouteInstructionContent(instruction){var html="";var distanceString="";if(instruction.distance>0)if(instruction.distance<1E3)distanceString=Math.round(instruction.distance)+"m";else distanceString=(instruction.distance/1E3).toFixed(2).replace(".",",")+"km";var timeString="";if(instruction.time>0)if(instruction.time<60)timeString="  (\x3c 1 min)";else if(parseInt(instruction.time/60)<60)timeString="  ("+parseInt(instruction.time/60)+"min)";else timeString="  ("+parseInt(instruction.time/
3600)+"h "+parseInt(instruction.time%3600/60)+"min)";if(instruction.distance>0||instruction.time>0)html+='\x3ctable style\x3d"width: 250px;" class\x3d"ol-popup-content-small"\x3e'+"\x3ctr\x3e"+'\x3ctd style\x3d"width: 28px;"\x3e'+'\x3cimg src\x3d"'+directionImagePath+instruction.icon+'" style\x3d"width:28px"/\x3e'+"\x3c/td\x3e"+"\x3ctd\x3e"+distanceString+timeString+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3ctr\x3e"+'\x3ctd colspan\x3d"2"\x3e'+instruction.text+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e";else html+=
'\x3ctable style\x3d"width: 250px;" class\x3d"ol-popup-content-small"\x3e'+"\x3ctr\x3e"+'\x3ctd style\x3d"width: 34px;"\x3e'+'\x3cimg src\x3d"'+directionImagePath+instruction.icon+'" style\x3d"width:32px"/\x3e'+"\x3c/td\x3e"+"\x3ctd\x3e"+instruction.text+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e";return html};
var mapContextMenuOverlay=null;var mapContextMenu=null;var mapContextMenuCloser=null;var mapContextMenuContent=null;var mapContextMenuTitle=null;var mapContextMenuButtonZoomIn=null;var mapContextMenuButtonZoomOut=null;var mapContextMenuButtonStart=null;var mapContextMenuButtonTarget=null;var mapContextMenuButtonVia=null;var mapContextMenuButtonDelete=null;
function initContextMenu(){mapContextMenu=document.getElementById(map_portlet_id+"mapContextMenu");mapContextMenuContent=document.getElementById(map_portlet_id+"mapContextMenuContent");mapContextMenuCloser=document.getElementById(map_portlet_id+"mapContextMenuCloser");mapContextMenuTitle=document.getElementById(map_portlet_id+"mapContextMenuTitle");mapContextMenuOverlay=new ol.Overlay({element:mapContextMenu,autoPan:true,positioning:"bottom-left",autoPanMargin:70,offset:[-50,-12],autoPanAnimation:{duration:250}});
$(mapContextMenuCloser).click(closeContextMenu);map.addOverlay(mapContextMenuOverlay);mapContextMenuButtonZoomIn=document.getElementById(map_portlet_id+"mapContextMenuZoomIn");mapContextMenuButtonZoomOut=document.getElementById(map_portlet_id+"mapContextMenuZoomOut");mapContextMenuButtonStart=document.getElementById(map_portlet_id+"mapContextMenuStart");mapContextMenuButtonTarget=document.getElementById(map_portlet_id+"mapContextMenuTarget");mapContextMenuButtonVia=document.getElementById(map_portlet_id+
"mapContextMenuVia");mapContextMenuButtonDelete=document.getElementById(map_portlet_id+"mapContextMenuDelete");initContextMenuClicks()}
function initContextMenuClicks(){$(mapContextMenuButtonZoomIn).click(function(){addUserBehavior(UserAction.CLICK_ZOOM_IN_CONTEXT);mapZoomInCenter(mapContextMenuOverlay.getPosition());closeContextMenu()});$(mapContextMenuButtonZoomOut).click(function(){addUserBehavior(UserAction.CLICK_ZOOM_OUT_CONTEXT);mapZoomOutCenter(mapContextMenuOverlay.getPosition());closeContextMenu()});$(mapContextMenuButtonStart).click(function(){addUserBehavior(UserAction.CLICK_SET_START_CONTEXT,undefined,toLatLon(mapContextMenuOverlay.getPosition()));
var lon=mapContextMenuOverlay.getPosition()[0];var lat=mapContextMenuOverlay.getPosition()[1];routeStartHere(lon,lat);closeContextMenu()});$(mapContextMenuButtonTarget).click(function(){addUserBehavior(UserAction.CLICK_SET_TARGET_CONTEXT,undefined,toLatLon(mapContextMenuOverlay.getPosition()));var lon=mapContextMenuOverlay.getPosition()[0];var lat=mapContextMenuOverlay.getPosition()[1];routeEndHere(lon,lat);closeContextMenu()});$(mapContextMenuButtonVia).click(function(){addUserBehavior(UserAction.CLICK_SET_VIA_CONTEXT,
undefined,toLatLon(mapContextMenuOverlay.getPosition()));var lon=mapContextMenuOverlay.getPosition()[0];var lat=mapContextMenuOverlay.getPosition()[1];routeViaHere(lon,lat);closeContextMenu()});$(mapContextMenuButtonDelete).click(function(){addUserBehavior(UserAction.CLICK_DELETE_ROUTE_CONTEXT);deleteRoute();closeContextMenu()})}function showContextMenu(coordinate){closeFeatureContextMenu();$(mapContextMenu).css("display","flex");mapContextMenuOverlay.setPosition(coordinate)}
function closeContextMenu(){$(mapContextMenu).hide();mapContextMenuOverlay.setPosition(undefined);mapContextMenuCloser.blur();return false};
var mapContextFeatureMenuOverlay=null;var mapContextFeatureMenu=null;var mapContextFeatureMenuCloser=null;var mapContextFeatureMenuContent=null;var mapContextFeatureMenuTitle=null;var mapContextFeatureMenuList=null;
function initFeatureContextMenu(){mapContextFeatureMenu=document.getElementById(map_portlet_id+"mapContextFeatureMenu");mapContextFeatureMenuContent=document.getElementById(map_portlet_id+"mapContextFeatureMenuContent");mapContextFeatureMenuCloser=document.getElementById(map_portlet_id+"mapContextFeatureMenuCloser");mapContextFeatureMenuTitle=document.getElementById(map_portlet_id+"mapContextFeatureMenuTitle");mapContextFeatureMenuList=document.getElementById(map_portlet_id+"mapContextFeatureMenuList");
mapContextFeatureMenuOverlay=new ol.Overlay({element:mapContextFeatureMenu,autoPan:true,positioning:"bottom-left",autoPanMargin:70,offset:[-50,-12],autoPanAnimation:{duration:250}});$(mapContextFeatureMenuCloser).click(closeFeatureContextMenu);map.addOverlay(mapContextFeatureMenuOverlay)}
function showFeatureContextMenu(features,coordinate){if(features){var htmlList="";for(var i=0;i<features.length;i++)htmlList+=getFeatureContextMenuRow("remove",features[i]);closeContextMenu();$(mapContextFeatureMenuList).empty().append(htmlList);$(mapContextFeatureMenu).css("display","flex");mapContextFeatureMenuOverlay.setPosition(coordinate)}}
function getFeatureContextMenuRow(event,feature){var translation=feature.get("translation");var html="\x3cdiv onclick\x3d\"featureContextMenuOnClick('"+event+"', '"+feature.getId()+'\')"\x3e \x3cspan\x3e\x3ci class\x3d"fa fa-map-marker"\x3e\x3c/i\x3e  '+translation+"\x3c/span\x3e\x3c/div\x3e";return html}
function featureContextMenuOnClick(event,featureId){if(event=="remove"){var vectorSource=mapRoutingLayer.getSource();var feature=vectorSource.getFeatureById(featureId);addUserBehavior(UserAction.CLICK_DELETE_POINT_CONTEXT,undefined,featureId);Liferay.fire("vipnrw-routing-portlet-remove-point",{pointType:feature.get("type"),viaIndex:feature.get("viaIndex")});removeFeature(featureId)}closeFeatureContextMenu()}
function closeFeatureContextMenu(){$(mapContextFeatureMenu).hide();mapContextFeatureMenuOverlay.setPosition(undefined);return false};
var mapCarRoutePopupOverlay=null;var mapCarRoutePopup=null;var mapCarRoutePopupDistance=null;var mapCarRoutePopupDuration=null;var mapCarRoutePopupTravelTimeLoss=null;var mapPublicTransportRoutePopupOverlay=null;var mapPublicTransportRoutePopup=null;var mapPublicTransportRoutePopupDuration=null;var mapBikeRoutePopupOverlay=null;var mapBikeRoutePopup=null;var mapBikeRoutePopupDistance=null;var mapBikeRoutePopupDuration=null;var mapIntermodalRoutePopupOverlay=null;var mapIntermodalRoutePopup=null;
var mapIntermodalRoutePopupDistance=null;var mapIntermodalRoutePopupDuration=null;
function initRoutePopup(){mapCarRoutePopup=document.getElementById(map_portlet_id+"mapCarRoutePopup");mapCarRoutePopupDistance=document.getElementById(map_portlet_id+"mapCarRoutePopupDistance");mapCarRoutePopupDuration=document.getElementById(map_portlet_id+"mapCarRoutePopupDuration");mapCarRoutePopupTravelTimeLoss=document.getElementById(map_portlet_id+"mapCarRoutePopupTravelTimeLoss");mapCarRoutePopupOverlay=new ol.Overlay({element:mapCarRoutePopup,offset:[-10,0],positioning:"center-left"});map.addOverlay(mapCarRoutePopupOverlay);
mapPublicTransportRoutePopup=document.getElementById(map_portlet_id+"mapPublicTransportRoutePopup");mapPublicTransportRoutePopupDuration=document.getElementById(map_portlet_id+"mapPublicTransportRoutePopupDuration");mapPublicTransportRoutePopupOverlay=new ol.Overlay({positioning:"center-left",offset:[-10,0],element:mapPublicTransportRoutePopup});map.addOverlay(mapPublicTransportRoutePopupOverlay);mapBikeRoutePopup=document.getElementById(map_portlet_id+"mapBikeRoutePopup");mapBikeRoutePopupDistance=
document.getElementById(map_portlet_id+"mapBikeRoutePopupDistance");mapBikeRoutePopupDuration=document.getElementById(map_portlet_id+"mapBikeRoutePopupDuration");mapBikeRoutePopupOverlay=new ol.Overlay({positioning:"center-left",offset:[-10,0],element:mapBikeRoutePopup});map.addOverlay(mapBikeRoutePopupOverlay);mapIntermodalRoutePopup=document.getElementById(map_portlet_id+"mapIntermodalRoutePopup");mapIntermodalRoutePopupDistance=document.getElementById(map_portlet_id+"mapIntermodalRoutePopupDistance");
mapIntermodalRoutePopupDuration=document.getElementById(map_portlet_id+"mapIntermodalRoutePopupDuration");mapIntermodalRoutePopupTravelTimeLoss=document.getElementById(map_portlet_id+"mapIntermodalRoutePopupTravelTimeLoss");mapIntermodalRoutePopupOverlay=new ol.Overlay({element:mapIntermodalRoutePopup,offset:[-10,0],positioning:"center-left"});map.addOverlay(mapIntermodalRoutePopupOverlay);initRoutePopupClick()}
function initRoutePopupClick(){$(mapCarRoutePopup).click(function(){closeWfsFeatureInfo();Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"car"})});$(mapPublicTransportRoutePopup).click(function(){closeWfsFeatureInfo();Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"publicTransport"})});$(mapBikeRoutePopup).click(function(){closeWfsFeatureInfo();Liferay.fire("vipnrw-maximize-portlet",
{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"bike"})});$(mapIntermodalRoutePopup).click(function(){closeWfsFeatureInfo();Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"intermodal"})})}
function showCarRoutePopup(coordinate,distance,times,traveltimeLoss,offset){closeCarRoutePopup();$(mapCarRoutePopupDistance).html(distance);$(mapCarRoutePopupDuration).html(times.duration);if(traveltimeLoss)$(mapCarRoutePopupTravelTimeLoss).html("("+traveltimeLoss+")");else $(mapCarRoutePopupTravelTimeLoss).html("");mapCarRoutePopupOverlay.setPosition(coordinate);if(offset)mapCarRoutePopupOverlay.setOffset(offset);else mapCarRoutePopupOverlay.setOffset([-50,-12]);$(mapCarRoutePopup).show()}
function closeCarRoutePopup(){$(mapCarRoutePopup).hide();if(mapCarRoutePopupOverlay)mapCarRoutePopupOverlay.setPosition(undefined);return false}function showPublicTransportRoutePopup(coordinate,duration){closePublicTransportRoutePopup();$(mapPublicTransportRoutePopupDuration).html(duration);mapPublicTransportRoutePopupOverlay.setPosition(coordinate);$(mapPublicTransportRoutePopup).show()}
function closePublicTransportRoutePopup(){$(mapPublicTransportRoutePopup).hide();if(mapPublicTransportRoutePopupOverlay)mapPublicTransportRoutePopupOverlay.setPosition(undefined);return false}function showBikeRoutePopup(coordinate,distance,duration){closeBikeRoutePopup();$(mapBikeRoutePopupDistance).html(distance);$(mapBikeRoutePopupDuration).html(duration);mapBikeRoutePopupOverlay.setPosition(coordinate);$(mapBikeRoutePopup).show()}
function closeBikeRoutePopup(){$(mapBikeRoutePopup).hide();if(mapBikeRoutePopupOverlay)mapBikeRoutePopupOverlay.setPosition(undefined);return false}function showIntermodalRoutePopup(coordinate,distance,duration){closeIntermodalRoutePopup();$(mapIntermodalRoutePopupDistance).html(distance);$(mapIntermodalRoutePopupDuration).html(duration);mapIntermodalRoutePopupOverlay.setPosition(coordinate);$(mapIntermodalRoutePopup).show()}
function closeIntermodalRoutePopup(){$(mapIntermodalRoutePopup).hide();if(mapIntermodalRoutePopupOverlay)mapIntermodalRoutePopupOverlay.setPosition(undefined);return false};
var geolocation;var geolocationMarkerElement;var geolocationMarker;var contextPath="/o/de.strassennrw.vipnrw.map";var imagesPath=contextPath+"/images";var speed;var positions=new ol.geom.LineString([],"XYZM");var deltaMean=500;var previousM=0;var oldTrackingPostion;
function initPostionTracking(){geolocation=new ol.Geolocation({projection:map.getView().getProjection(),trackingOptions:{maximumAge:1E4,enableHighAccuracy:true,timeout:6E5}});geolocation.on("change",function(){try{var position=geolocation.getPosition();var accuracy=geolocation.getAccuracy();var heading=geolocation.getHeading()||0;speed=geolocation.getSpeed()||0;var m=Date.now();addPositionTracking(position,heading,m,speed);var coords=positions.getCoordinates();var len=coords.length;if(len>=2)deltaMean=
(coords[len-1][3]-coords[0][3])/(len-1);var accuracyLabel=0+" m";if(accuracy)if(accuracy>=1E3)accuracyLabel=(accuracy/1E3).toFixed(1)+" km";else accuracyLabel=Math.floor(accuracy)+" m";var info=["Genauigkeit"+": "+accuracyLabel];info.push("Geschwindigkeit"+": "+Math.floor(speed*3.6)+" km/h");document.getElementById("geolocation_info").innerHTML=info.join("\x3cbr /\x3e");if(zoomToPosition){map.getView().setCenter([position[0],position[1]]);if(map.getView().getZoom()<15)map.getView().setZoom(15);zoomToPosition=
false}map.render()}catch(e){console.error("Error updating gps postion on: 'change'.")}});geolocation.on("error",function(error){stopTracking(error)});geolocationMarkerElement=document.getElementById("geolocation_marker");geolocationMarker=new ol.Overlay({positioning:"center-center",element:geolocationMarkerElement,stopEvent:false});map.addOverlay(geolocationMarker);map.on("postcompose",updateView)}
function startTracking(){$(mapToolbarGps).addClass("selected");geolocation.setTracking(true);map.render()}
function stopTracking(error){$(mapToolbarGps).removeClass("selected");if(error){let message=getPositionErrorMessage(error);vipnrwErrorMessage(message,"info",5)}if($(mapToolbarGps).hasClass("selected"))$(mapToolbarGps).removeClass("selected");geolocation.setTracking(false);map.render();zoomToPosition=true;$(geolocationMarkerElement).css("display","none");document.getElementById("geolocation_info").innerHTML="";positions=new ol.geom.LineString([],"XYZM")}
function radToDeg(rad){return rad*360/(Math.PI*2)}
function addPositionTracking(position,heading,m,speed){var x=position[0];var y=position[1];var fCoords=positions.getCoordinates();var previous=fCoords[fCoords.length-1];var prevHeading=previous&&previous[2];if(prevHeading){var negMod=(prevHeading%(2*Math.PI)+2*Math.PI)%(2*Math.PI);var headingDiff=heading-negMod;if(Math.abs(headingDiff)>Math.PI){var sign=headingDiff>=0?1:-1;headingDiff=-sign*(2*Math.PI-Math.abs(headingDiff))}heading=prevHeading+headingDiff}positions.appendCoordinate([x,y,heading,m]);
positions.setCoordinates(positions.getCoordinates().slice(-20));if(speed!=null&&Math.floor(speed*3.6)>2)geolocationMarkerElement.src=imagesPath+"/geolocation_marker_heading.png";else geolocationMarkerElement.src=imagesPath+"/geolocation_marker.png";$(geolocationMarkerElement).css("display","block")}
function getCenterWithHeading(position,rotation,resolution){var size=map.getSize();var height=size[1];return[position[0]-Math.sin(rotation)*height*resolution*1/4,position[1]+Math.cos(rotation)*height*resolution*1/4]}
function updateView(){try{var m=Date.now()-deltaMean*1.5;m=Math.max(m,previousM);previousM=m;var c=positions.getCoordinateAtM(m,true);if(c!=null&&c&&(oldTrackingPostion==null||c[0]!=oldTrackingPostion[0]&&c[1]!=oldTrackingPostion[1])){if(zoomToPosition){map.getView().setCenter([c[0],c[1]]);if(map.getView().getZoom()<15)map.getView().setZoom(15);zoomToPosition=false}if(Math.floor(speed*3.6)>2)map.getView().setCenter(getCenterWithHeading(c,-c[2],map.getView().getResolution()));geolocationMarker.setPosition(c);
$(geolocationMarkerElement).css("-ms-transform","rotate("+Math.round(radToDeg(c[2]))+"deg)");$(geolocationMarkerElement).css("-webkit-transform","rotate("+Math.round(radToDeg(c[2]))+"deg)");$(geolocationMarkerElement).css("transform","rotate("+Math.round(radToDeg(c[2]))+"deg)");oldTrackingPostion=c;map.render()}}catch(e){console.log("Error updating gps view.")}};
function getDepatureMonitor(element,stopID,depArr,openlayersOverlay){var req=new XMLHttpRequest;var urlRequest=vrrRequestUrl+"/XML_DM_REQUEST?sessionID\x3d0\x26requestID\x3d0\x26language\x3dde\x26type_dm\x3dstopID\x26name_dm\x3d"+stopID+"\x26itdDateTimeDepArr\x3d"+depArr+"\x26useRealtime\x3d1\x26mode\x3ddirect\x26limit\x3d"+vrrDMLimit;req.open("GET",urlRequest,true);req.onreadystatechange=function(aEvt){if(req.readyState==4&&req.status==200){var html=parseDepatureMonitorXml(req.responseText,depArr);
if(html.length==0)html="Keine Eintr\u00e4ge gefunden!";$(element).empty();$(element).html(html);if(openlayersOverlay)openlayersOverlay.dispatchEvent("change:position")}};req.send(null)}
function getDepArrItem(departureList){var hasEntries=false;var htmlTable="\x3ctable class\x3d'featureInfoResultTable'\x3e\x3ctr\x3e\x3cth\x3e"+"Zeit"+"\x3c/th\x3e\x3cth\x3e"+"Heute"+"\x3c/th\x3e\x3cth\x3e"+"Linie"+"\x3c/th\x3e\x3cth\x3e"+"Richtung"+"\x3c/th\x3e\x3c/tr\x3e";var abortingLine="Ausfall";for(var i in departureList.childNodes)if(departureList.childNodes[i].nodeName==="itdDeparture"||departureList.childNodes[i].nodeName==="itdArrival"){hasEntries=true;var time="";var rtTime="";var direction=
"";var line="";var delay=null;var itdDateTimeNode=getFirstChildNodeByName(departureList.childNodes[i],"itdDateTime");if(itdDateTimeNode){var itdTimeNode=getFirstChildNodeByName(itdDateTimeNode,"itdTime");if(itdTimeNode)time=getTimeString(itdTimeNode)}var itdRTDateTimeNode=getFirstChildNodeByName(departureList.childNodes[i],"itdRTDateTime");if(itdRTDateTimeNode){var itdRTTimeNode=getFirstChildNodeByName(itdRTDateTimeNode,"itdTime");if(itdRTTimeNode)rtTime=getTimeString(itdRTTimeNode)}var itdServingLineNode=
getFirstChildNodeByName(departureList.childNodes[i],"itdServingLine");if(itdServingLineNode){line=getAttributeValueByName(itdServingLineNode.attributes,"number");if(departureList.childNodes[i].nodeName==="itdArrival")direction=getAttributeValueByName(itdServingLineNode.attributes,"directionFrom");else direction=getAttributeValueByName(itdServingLineNode.attributes,"direction");var itdNoTrainNode=getFirstChildNodeByName(itdServingLineNode,"itdNoTrain");if(itdNoTrainNode)delay=getAttributeValueByName(itdNoTrainNode.attributes,
"delay")}if(delay&&delay==-9999)rtTime=abortingLine;htmlTable+="\x3ctr\x3e\x3ctd\x3e"+time+"\x3c/td\x3e\x3ctd style\x3d'color: red;'\x3e"+rtTime+"\x3c/td\x3e\x3ctd\x3e"+line+"\x3c/td\x3e\x3ctd\x3e"+direction+"\x3c/td\x3e\x3c/tr\x3e"}htmlTable+="\x3c/table\x3e";if(!hasEntries)htmlTable="";return htmlTable}
function getTimeString(node){var time="";var hour=getAttributeValueByName(node.attributes,"hour");var minute=getAttributeValueByName(node.attributes,"minute");if(hour<10)hour="0"+hour;if(minute<10)minute="0"+minute;time=hour+":"+minute;return time}
function getDM(dm,depArr){var html="";for(var i in dm.childNodes)if(depArr=="dep"&&dm.childNodes[i].nodeName==="itdDepartureList")html+=getDepArrItem(dm.childNodes[i]);else if(depArr=="arr"&&dm.childNodes[i].nodeName==="itdArrivalList")html+=getDepArrItem(dm.childNodes[i]);return html}
function getDepatureMonitorRequestInfo(itdRequest,depArr){for(var i in itdRequest.childNodes)if(itdRequest.childNodes[i].nodeName==="itdDepartureMonitorRequest")return getDM(itdRequest.childNodes[i],depArr);return""}function parseDepatureMonitorXml(xmlContent,depArr){var parser=new DOMParser;var xmlDoc=parser.parseFromString(xmlContent,"text/xml");for(var i in xmlDoc.childNodes)if(xmlDoc.childNodes[i].nodeName==="itdRequest")return getDepatureMonitorRequestInfo(xmlDoc.childNodes[i],depArr)}
function getNoticeMonitor(element,stopID){var req=new XMLHttpRequest;var urlRequest=vrrRequestUrl+"/XML_STT_REQUEST?sessionID\x3d0\x26requestID\x3d0\x26language\x3dde"+"\x26type_stt\x3dstopID\x26name_stt\x3d"+stopID;req.open("GET",urlRequest,true);req.onreadystatechange=function(aEvt){if(req.readyState==4&&req.status==200){var html=parseNoticeMonitorXml(req.responseText,urlRequest);if(html.length==0)html="Keine Eintr\u00e4ge gefunden!";$(element).empty();$(element).html(html)}};req.send(null)}
function getServingLinesSTT(servingLines,urlRequest){var isEmtpy=true;var htmlTable="\x3cdiv style\x3d'max-height: 400px; width:400px; overflow: auto;'\x3e"+"\x3ctable class\x3d'featureInfoResultTableHovered'\x3e";for(var i in servingLines.childNodes)if(servingLines.childNodes[i].nodeName==="itdServingLine"){isEmtpy=false;var lineSelection=getLineSelection(servingLines.childNodes[i]);var tranportType="";var routeDescription="";var line=getAttributeValueByName(servingLines.childNodes[i].attributes,
"number");var tranportTypeNode=getFirstChildNodeByName(servingLines.childNodes[i],"itdNoTrain");var routeDescriptionNode=getFirstChildNodeByName(servingLines.childNodes[i],"itdRouteDescText");if(tranportTypeNode!=null)tranportType=getAttributeValueByName(tranportTypeNode.attributes,"name");if(routeDescriptionNode!=null)routeDescription=routeDescriptionNode.textContent;var rowText=tranportType+" - "+line+" - "+routeDescription;htmlTable+="\x3ctr onclick\x3d\"showPopupLoading('"+rowText.replace("'",
" ").replace('"'," ")+"', '"+urlRequest+lineSelection+"')\"\x3e\x3ctd\x3e"+tranportType+" - \x3cb\x3e"+line+"\x3c/b\x3e - "+routeDescription+"\x3c/td\x3e\x3c/tr\x3e"}htmlTable+="\x3c/table\x3e\x3c/div\x3e";if(isEmtpy)htmlTable="";return htmlTable}
function getLineSelection(itdServingLine){var lineFilter="";var node=getFirstChildNodeByName(itdServingLine,"motDivaParams");if(node!=null){var network=getAttributeValueByName(node.attributes,"network");var lineNumber=getAttributeValueByName(node.attributes,"line");var supplement=getAttributeValueByName(node.attributes,"supplement");var direction=getAttributeValueByName(node.attributes,"direction");lineFilter="\x26line\x3d"+network+":"+lineNumber+":"+supplement+":"+direction}return lineFilter}
function getSTT(dm,urlRequest){for(var i in dm.childNodes)if(dm.childNodes[i].nodeName==="itdServingLines")return getServingLinesSTT(dm.childNodes[i],urlRequest);return""}
function getNoticeMonitorRequestInfo(itdRequest,urlRequest){for(var i in itdRequest.childNodes)if(itdRequest.childNodes[i].nodeName==="itdStopTimetableRequest"){var table=getSTT(itdRequest.childNodes[i],urlRequest);var link="\x3cdiv class\x3d'featureInfoLink' onclick\x3d\"showPopupLoading('Alle Linien', '"+urlRequest+"')\"\x3e"+"Alle Linien als PDF"+"\x3c/div\x3e\x3cbr\x3e";if(table==null||table.length==0)link="";return link+table}}
function parseNoticeMonitorXml(xmlContent,urlRequest){var parser=new DOMParser;var xmlDoc=parser.parseFromString(xmlContent,"text/xml");for(var i in xmlDoc.childNodes)if(xmlDoc.childNodes[i].nodeName==="itdRequest")return getNoticeMonitorRequestInfo(xmlDoc.childNodes[i],urlRequest)}
function showPopupLoading(stationName,urlRequest){var myWindow=window.open("",stationName,"width\x3d700, height\x3d500");var html="\x3ch2\x3e"+"Aushangfahrplan"+"\x3c/h2\x3e\x3cp\x3e"+stationName+"\x3c/p\x3e\x3cbr\x3e"+"Bitte warten...";myWindow.document.write(html);myWindow.document.title="Aushangfahrplan"+":"+stationName;var req=new XMLHttpRequest;req.open("GET",urlRequest+"\x26mode\x3ddirect",true);req.onreadystatechange=function(aEvt){if(req.readyState==4&&req.status==200){var url=getSTTUrlLink(req.responseText);
if(url!=null&&url.length>0){url=vrrPdfUrl+url;myWindow.location.href=url}}};req.send(null)}
function getSTTUrlLink(xmlContent){var parser=new DOMParser;var xmlDoc=parser.parseFromString(xmlContent,"text/xml");var itdRequestNode=getFirstChildNodeByName(xmlDoc,"itdRequest");if(itdRequestNode){var itdStopTimetableRequestNode=getFirstChildNodeByName(itdRequestNode,"itdStopTimetableRequest");if(itdStopTimetableRequestNode){var itdDownloadNode=getFirstChildNodeByName(itdStopTimetableRequestNode,"itdDownload");if(itdDownloadNode){var itdDownloadFileNode=getFirstChildNodeByName(itdDownloadNode,
"itdDownloadFile");if(itdDownloadFileNode)return getAttributeValueByName(itdDownloadFileNode.attributes,"src")}}}return null}function getAttributeValueByName(attributes,name){for(var i in attributes)if(attributes[i].name===name)return attributes[i].nodeValue;return""}function getChildNodesByName(node,name){var tmpNodes=[];for(var i in node.childNodes)if(node.childNodes[i].nodeName===name)tmpNodes.push(node.childNodes[i]);return tmpNodes}
function getFirstChildNodeByName(node,name){for(var i in node.childNodes)if(node.childNodes[i].nodeName===name)return node.childNodes[i];return null};
vrrRouteParser={maxRoutesToShow:4,routeResult:null,temporaryLinestringPoints:null,parseVrrXmlString:function(xmlString){this.routeResult=null;try{var routes=[];var parser=new DOMParser;var xmlDoc=parser.parseFromString(xmlString,"text/xml");var itdRequestNode=this.getFirstChildNodeByName(xmlDoc,"itdRequest");if(itdRequestNode){var itdTripRequestNode=this.getFirstChildNodeByName(itdRequestNode,"itdTripRequest");if(itdTripRequestNode){var itdItineraryNode=this.getFirstChildNodeByName(itdTripRequestNode,
"itdItinerary");if(itdItineraryNode){var itdRouteListNode=this.getFirstChildNodeByName(itdItineraryNode,"itdRouteList");if(itdRouteListNode){var itdRouteNode=this.getChildNodesByName(itdRouteListNode,"itdRoute");if(itdRouteNode){for(var i=0;i<itdRouteNode.length;i++){routes[i]={};this.temporaryLinestringPoints=[];var routeAttributes=itdRouteNode[i].attributes;routes[i].publicduration=this.getAttributeValueByName(routeAttributes,"publicDuration");routes[i].individualduration=this.getAttributeValueByName(routeAttributes,
"individualDuration");routes[i].distance=this.getAttributeValueByName(routeAttributes,"distance");routes[i].changes=this.getAttributeValueByName(routeAttributes,"changes");routes[i].routeIndex=this.getAttributeValueByName(routeAttributes,"routeIndex");var partialRouteList=this.parseVrrPartialRouteList(itdRouteNode[i]);routes[i].partialRouteList=partialRouteList;routes[i].linestring=this.temporaryLinestringPoints;var startDate=null;var endDate=null;if(partialRouteList&&partialRouteList.length>0){if(partialRouteList[0].departurePoint)startDate=
partialRouteList[0].departurePoint.date;if(partialRouteList[partialRouteList.length-1].arrivalPoint)endDate=partialRouteList[partialRouteList.length-1].arrivalPoint.date}routes[i].startDate=startDate;routes[i].endDate=endDate;routes[i].startTime=this.getTimeString(startDate);routes[i].endTime=this.getTimeString(endDate)}let currentTime=getCurrentTime();let filtered=routes.filter((r)=>r.startTime>=currentTime);if(filtered.length>0)routes=filtered;routes.sort(function(a,b){let indexA=a.startTime;let indexB=
b.startTime;return indexA>indexB?1:-1});if(this.maxRoutesToShow>0&&routes.length>this.maxRoutesToShow)routes=routes.slice(1,this.maxRoutesToShow+1);for(let i=0;i<routes.length;i++)routes[i].id=i}}}}}this.temporaryLinestringPoints=null;this.routeResult=routes}catch(e){console.error(e.stack)}},parseVrrPartialRouteList:function(xmlRouteNodeString){var partialRoutes=[];var itdPartialRouteListNode=this.getFirstChildNodeByName(xmlRouteNodeString,"itdPartialRouteList");if(itdPartialRouteListNode){var itdPartialRouteNodes=
this.getChildNodesByName(itdPartialRouteListNode,"itdPartialRoute");if(itdPartialRouteNodes)for(var k=0;k<itdPartialRouteNodes.length;k++){var partialRoute={};partialRoute.timeMinute=this.getAttributeValueByName(itdPartialRouteNodes[k].attributes,"timeMinute");partialRoute.distance=this.getAttributeValueByName(itdPartialRouteNodes[k].attributes,"distance");partialRoute.pointStops=this.parseVrrStopSequenceList(itdPartialRouteNodes[k]);var itdPointsNodes=this.getChildNodesByName(itdPartialRouteNodes[k],
"itdPoint");if(itdPointsNodes)for(var i=0;i<itdPointsNodes.length;i++){var point=this.parseVrrPoint(itdPointsNodes[i]);if(point.usage=="departure")partialRoute.departurePoint=point;else if(point.usage=="arrival")partialRoute.arrivalPoint=point}var itdMeansOfTransportNode=this.getFirstChildNodeByName(itdPartialRouteNodes[k],"itdMeansOfTransport");if(itdMeansOfTransportNode)partialRoute.meansOfTransport=this.parseVrrMeansOfTransport(itdMeansOfTransportNode);this.parseVrrLinestring(itdPartialRouteNodes[k]);
partialRoutes.push(partialRoute)}}return partialRoutes},parseDurationToMillis:function(durationString){var duration=0;if(durationString){var times=durationString.split(":");duration=times[0]*36E5+times[1]*6E4}return duration},getTimeString:function(date){var result="";if(date!=null){var hour=date.getUTCHours();var minute=date.getUTCMinutes();if(hour<10)result+="0";result+=hour+":";if(minute<10)result+="0";result+=minute}return result},parseVrrDateString:function(dateString){var result=null;if(dateString&&
dateString.length>=17){var year=dateString.substring(0,4);var month=dateString.substring(4,6);var day=dateString.substring(6,8);var hour=dateString.substring(8,10);var minute=dateString.substring(10,12);var second=dateString.substring(12,14);var millis=dateString.substring(14,17);var formatedDateString=year+"-"+month+"-"+day+"T"+hour+":"+minute+":"+second;result=new Date(Date.UTC(year,month,day,hour,minute,second))}return result},parseVrrLinestring:function(xmlPartialRouteNodeString){var itdPathCoordinatesNode=
this.getFirstChildNodeByName(xmlPartialRouteNodeString,"itdPathCoordinates");if(itdPathCoordinatesNode){var itdCoordinateStringNode=this.getFirstChildNodeByName(itdPathCoordinatesNode,"itdCoordinateString");if(itdCoordinateStringNode){var decimal=this.getAttributeValueByName(itdCoordinateStringNode.attributes,"decimal");var coordDivider=this.getAttributeValueByName(itdCoordinateStringNode.attributes,"cs");var pointDivider=this.getAttributeValueByName(itdCoordinateStringNode.attributes,"ts");var wgsLineString=
itdCoordinateStringNode.textContent;var wgsPointStringArray=wgsLineString.split(" ");for(var i=0;i<wgsPointStringArray.length;i++){var wgsPoint=wgsPointStringArray[i].split(coordDivider);var lon=wgsPoint[0]/1E5;var lat=wgsPoint[1]/1E5;var point=new ol.proj.transform([lon,lat],wgs84ProjectionName,mapProjectionName);this.temporaryLinestringPoints.push(point)}}}},parseVrrMeansOfTransport:function(xmlMeansOfTransportString){var meansOfTransport={};if(xmlMeansOfTransportString){var attributes=xmlMeansOfTransportString.attributes;
meansOfTransport.productName=this.getAttributeValueByName(attributes,"productName");meansOfTransport.name=this.getAttributeValueByName(attributes,"name");meansOfTransport.shortname=this.getAttributeValueByName(attributes,"shortname");meansOfTransport.symbol=this.getAttributeValueByName(attributes,"symbol");meansOfTransport.destination=this.getAttributeValueByName(attributes,"destination");meansOfTransport.icon=this.getOVImageName(meansOfTransport.productName)}return meansOfTransport},parseVrrPoint:function(xmlPointString){var point=
{};var attributes=xmlPointString.attributes;point.stopId=this.getAttributeValueByName(attributes,"stopID");point.name=this.getAttributeValueByName(attributes,"name");point.name2=this.getAttributeValueByName(attributes,"nameWO");try{var x=this.getAttributeValueByName(attributes,"x")/1E5;var y=this.getAttributeValueByName(attributes,"y")/1E5;var pos=new ol.proj.transform([x,y],wgs84ProjectionName,mapProjectionName);point.x=pos[0];point.y=pos[1]}catch(e){point.x=null;point.y=null}point.area=this.getAttributeValueByName(attributes,
"area");point.place=this.getAttributeValueByName(attributes,"place");point.usage=this.getAttributeValueByName(attributes,"usage");point.pointType=this.getAttributeValueByName(attributes,"pointType");point.platform=this.getAttributeValueByName(attributes,"platform");point.platformName=this.getAttributeValueByName(attributes,"platformName");var timeResult=this.parseVrrPointTime(xmlPointString);point.date=timeResult;point.time=this.getTimeString(timeResult);return point},parseVrrPointTime:function(xmlPointString){var result=
null;var itdDateTimeNode=this.getChildNodesByName(xmlPointString,"itdDateTime");if(!itdDateTimeNode)itdDateTimeNode=this.getChildNodesByName(xmlPointString,"itdDateTimeTarget");if(itdDateTimeNode)for(var i=0;i<itdDateTimeNode.length;i++){var dtObj=this.parseVrrDateTime(itdDateTimeNode[i]);if(dtObj!=null){result=dtObj;break}}return result},parseVrrDateTime:function(xmlDateTimeString){var result=null;var itdDateNode=this.getFirstChildNodeByName(xmlDateTimeString,"itdDate");var itdTimeNode=this.getFirstChildNodeByName(xmlDateTimeString,
"itdTime");if(itdDateNode&&itdTimeNode){var dateAttributes=itdDateNode.attributes;var timeAttributes=itdTimeNode.attributes;var year=this.getAttributeValueByName(dateAttributes,"year");var month=this.getAttributeValueByName(dateAttributes,"month");var day=this.getAttributeValueByName(dateAttributes,"day");var hour=this.getAttributeValueByName(timeAttributes,"hour");var minute=this.getAttributeValueByName(timeAttributes,"minute");if(year&&year>0)try{result=new Date(Date.UTC(year,month,day,hour,minute))}catch(e){console.error("Unable to parse DateTime String: "+
xmlDateTimeString)}}return result},parseVrrStopSequenceList:function(xmlPartialRouteNode){var pointArray=[];var xmlStopSequenceListString=this.getFirstChildNodeByName(xmlPartialRouteNode,"itdStopSeq");if(xmlStopSequenceListString){var itdPointsNodes=this.getChildNodesByName(xmlStopSequenceListString,"itdPoint");if(itdPointsNodes)for(var i=0;i<itdPointsNodes.length;i++)pointArray.push(this.parseVrrPoint(itdPointsNodes[i]))}return pointArray},getOVImageName:function(productName){var name=productName.toLowerCase().replace("(regional)",
"").replace("gesicherter anschluss","bus").trim();var viaImageName="directions_via.png";if(name=="re"||name=="skytrain"||name=="abellio-zug"||name=="blank"||name=="bus"||name=="fussweg"||name=="niederflurbus"||name=="regionalzug"||name=="regionalbus"||name=="niederflurstrab"||name=="r-bahn"||name=="regionalexpress"||name=="sb"||name=="s-bahn"||name=="schnellbus"||name=="schwebebahn"||name=="stadtbahn"||name=="taxibus"||name=="regiobus"||name=="sprinterbus"||name=="stadtbus"||name=="ersatzverkehr"||
name=="stra\u00dfenbahn"||name=="u-bahn")viaImageName=name+".png";return viaImageName},getFirstChildNodeByName:function(node,name){for(var i in node.childNodes)if(node.childNodes[i].nodeName===name)return node.childNodes[i];return null},getAttributeValueByName:function(attributes,name){for(var i in attributes)if(attributes[i].name===name)return attributes[i].nodeValue;return""},getChildNodesByName:function(node,name){var tmpNodes=[];for(var i in node.childNodes)if(node.childNodes[i].nodeName===name)tmpNodes.push(node.childNodes[i]);
return tmpNodes}};
function clearSessionRoute(){$.ajax({url:map_portlet_resource_url,type:"POST",datatype:"json",timeout:1E4,data:{action:"clearRouteSession"},success:function(data){},fail:function(jqXHR,textStatus,errorThrown){console.error(errorThrown)}})}
function updateMapViewCookie(){var extent=null;if(!map_portlet_deeplink_print_view){try{extent=map.getView().calculateExtent(map.getSize());if(extent)setCookie("map-view-extent",extent.join(" "),30);var center=map.getView().getCenter();var point=new ol.proj.transform([center[0],center[1]],mapProjectionName,wgs84ProjectionName);setCookie("map-view-center",point[1].toFixed(5)+" "+point[0].toFixed(5),30)}catch(e){console.error(e)}setCookie("map-view-zoom-level",getMapCurrentZoomLevelInteger(),30)}}
function setMapViewFromCookie(){try{if(map_portlet_deeplink_center!=null&&map_portlet_deeplink_center.length>0&&map_portlet_deeplink_center!="null")try{var center=map_portlet_deeplink_center.split(",");if(center!=null&&center.length==2){var point=new ol.proj.transform([parseFloat(center[1]),parseFloat(center[0])],wgs84ProjectionName,mapProjectionName);map.getView().setCenter(point)}}catch(e){console.error(e)}else{var extent=getCookie("map-view-extent");if(extent!=null&&extent.length>0){var coordsString=
extent.split(" ");var coords=[];for(var i=0;i<coordsString.length;i++)coords.push(parseFloat(coordsString[i]));if(coords!=null&&coords.length==4)map.getView().fit(coords,map.getSize())}}var zoomLevel=null;if(map_portlet_deeplink_zoomLevel!=null&&map_portlet_deeplink_zoomLevel.length>0)zoomLevel=map_portlet_deeplink_zoomLevel;else zoomLevel=getCookie("map-view-zoom-level");if(zoomLevel!=null&&zoomLevel.length>0)map.getView().setZoom(zoomLevel);if(animationFile!=null&&animationFile.length>0&&animationFile!==
"null")$.ajax({url:map_portlet_resource_url,type:"POST",datatype:"json",timeout:1E4,data:{action:"get-points-for-animation",file:animationFile+""},success:function(data){var objects=JSON.parse(data);startAnimation(objects)},fail:function(jqXHR,textStatus,errorThrown){console.error(errorThrown)}})}catch(e){console.error(e)}}var firstStart;
function startAnimation(objects){var index=-1;firstStart=true;function next(more){if(more){++index;if(index<objects.length){var delay=10;if(index===0){if(objects[0].time)delay=objects[0].time}else if(objects[index-1].time)delay=objects[index-1].time;if(firstStart){delay=0;firstStart=false}setTimeout(function(){var center=ol.proj.fromLonLat([+objects[index].longitude,+objects[index].latitude]);flyTo(center,next,objects[index].zoom)},delay*1E3)}else{index=0;setTimeout(function(){var center=ol.proj.fromLonLat([+objects[index].longitude,
+objects[index].latitude]);flyTo(center,next,objects[index].zoom)},objects[objects.length-1].time*1E3)}}else{alert("Tour cancelled");next(true)}}next(true)}function flyTo(location,done,zoom){var duration=6E3;var parts=2;var called=false;function callback(complete){--parts;if(called)return;if(parts===0||!complete){called=true;done(complete)}}mapView.animate({center:location,duration:duration},callback);mapView.animate({zoom:zoom,duration:duration},callback)}
function saveRoutePoints(res){if(!map_portlet_deeplink_print_view){if(res.start!=null)setCookie("map-view-route-start-point",res.start.getGeometry().getCoordinates().join(" "),30);else setCookie("map-view-route-start-point","",0);if(res.vias!=null&&res.vias.length>0){var coordinates=[];for(var i=0;i<res.vias.length;i++)coordinates.push(res.vias[i].getGeometry().getCoordinates().join(" "));setCookie("map-view-route-via-points",coordinates.join(","),30)}else setCookie("map-view-route-via-points","",
0);if(res.target!=null)setCookie("map-view-route-target-point",res.target.getGeometry().getCoordinates().join(" "),30);else setCookie("map-view-route-target-point","",0)}}
function restoreRoutePointsFromUrl(){let isStartPoint=false;let isTargetPoint=false;if(map_portlet_deeplink_start!=null&&map_portlet_deeplink_start!="null"&&map_portlet_deeplink_start!="false"){isStartPoint=true;try{let pointString=map_portlet_deeplink_start.split(",");if(pointString!=null&&pointString.length==2){let point=new ol.proj.transform([parseFloat(pointString[1]),parseFloat(pointString[0])],wgs84ProjectionName,mapProjectionName);setCookie("map-view-route-start-point",point.join(" "),30);
parsedStartParam=[];parsedStartParam.push(point[0]);parsedStartParam.push(point[1])}}catch(e){console.error(e)}}else if(map_portlet_deeplink_app_parameter=="true")setCookie("map-view-route-start-point","",0);if(map_portlet_deeplink_target!=null&&map_portlet_deeplink_target!="null"&&map_portlet_deeplink_target!="false"){isTargetPoint=true;try{let pointString=map_portlet_deeplink_target.split(",");if(pointString!=null&&pointString.length==2){let point=new ol.proj.transform([parseFloat(pointString[1]),
parseFloat(pointString[0])],wgs84ProjectionName,mapProjectionName);setCookie("map-view-route-target-point",point.join(" "),30);parsedTargetParam=[];parsedTargetParam.push(point[0]);parsedTargetParam.push(point[1])}}catch(e){console.error(e)}}else if(map_portlet_deeplink_app_parameter=="true")setCookie("map-view-route-target-point","",0);if(map_portlet_deeplink_vias!=null&&map_portlet_deeplink_vias!="null"&&map_portlet_deeplink_vias!=""&&map_portlet_deeplink_vias!="false")try{let viaPoints=[];let points=
map_portlet_deeplink_vias.split("_");for(let i=0;i<points.length;i++){let pointString=points[i].split(",");if(pointString!=null&&pointString.length==2){let point=new ol.proj.transform([parseFloat(pointString[1]),parseFloat(pointString[0])],wgs84ProjectionName,mapProjectionName);viaPoints.push(point.join(" "));let v=[point[0],point[1]];if(parsedViaParam==null)parsedViaParam=[];parsedViaParam.push(v)}}if(viaPoints.length>0&&viaPoints!="false")setCookie("map-view-route-via-points",viaPoints.join(","),
30)}catch(e){console.error(e)}else if(map_portlet_deeplink_app_parameter=="true")setCookie("map-view-route-via-points","",0);else if(Boolean(isStartPoint)&&Boolean(isTargetPoint))setCookie("map-view-route-via-points","",30)}
function restoreRoutePoints(){let startPointString=getCookie("map-view-route-start-point");let viaPointsString=getCookie("map-view-route-via-points");let targetPointString=getCookie("map-view-route-target-point");if(startPointString!=null&&startPointString.length>0){let startPoint=startPointString.split(" ");if(startPoint!=null&&startPoint.length==2){let feature=addFeaturePoint(pointNameStart,parseFloat(startPoint[0]),parseFloat(startPoint[1]),null,false);updateAllRoutingPortletPoints(feature)}}else if(parsedStartParam!=
null&&parsedStartParam.length==2){let feature=addFeaturePoint(pointNameStart,parsedStartParam[0],parsedStartParam[1],null,false);updateAllRoutingPortletPoints(feature)}if(targetPointString!=null&&targetPointString.length>0){let targetPoint=targetPointString.split(" ");if(targetPoint!=null&&targetPoint.length==2){let feature=addFeaturePoint(pointNameTarget,parseFloat(targetPoint[0]),parseFloat(targetPoint[1]),null,false);updateAllRoutingPortletPoints(feature)}}else if(parsedTargetParam!=null&&parsedTargetParam.length==
2){let feature=addFeaturePoint(pointNameTarget,parsedTargetParam[0],parsedTargetParam[1],null,false);updateAllRoutingPortletPoints(feature)}if(viaPointsString!=null&&viaPointsString.length>0){let viaPoints=viaPointsString.split(",");for(let i=0;i<viaPoints.length;i++){let viaPoint=viaPoints[i].split(" ");let feature=addFeaturePoint(pointNameVia,parseFloat(viaPoint[0]),parseFloat(viaPoint[1]),null,true);updateAllRoutingPortletPoints(feature)}}else if(parsedViaParam!=null&&parsedViaParam.length>0)for(let i=
0;i<parsedViaParam.length;i++){let viaPoint=parsedViaParam[i];let feature=addFeaturePoint(pointNameVia,viaPoint[0],viaPoint[1],null,true);updateAllRoutingPortletPoints(feature)}drawRoute()};
const CLICK_LAYER="CLICK_LAYER_";var mapToolbarLayersButton=null;var mapToolbarRoute=null;var mapToolbarCar=null;var mapToolbarPublicTransport=null;var mapToolbarBike=null;var mapToolbarIntermodal=null;var mapToolbarAirView=null;var mapToolbarForecast=null;var mapToolbarZoomin=null;var mapToolbarZoomout=null;var mapToolbarPrint=null;var mapToolbarGps=null;var mapToolbarLayerMenu=null;var mapToolbarLayerMenuContent=null;var mapToolbarForecastMenu=null;var mapToolbarForecastSection=null;
var deeplinkLayerMapping={"Farbfehlsichtigenmodus":"LOS-COLOR-BLIND","Verkehrslage":"LOS","Prognose":"Forecast_LOS_51","Baustellen":"ROAD_MAINTENANCE","Haltestellen":"Station","Parken":"Parking","Webcams":"WebCam","Verkehrsmeldungen":"OBSTRUCTION","Luftbild":"AIRVIEW","Planbaustellen":"PLANED_FEATURES","ELadesaeulen":"ELECTRIC_CHARGING_STATION","Tankstellen":"GAS_STATION"};var globalForecastDate=null;var globalForecastEventId=null;var globalForecastTrafficMessageDays=5;var timeSliderStepSize=15;
var minutesPerHour=60;
function initMapToolbar(){mapToolbarLayersButton=document.getElementById(map_portlet_id+"mapToolbarLayersButton");mapToolbarRoute=document.getElementById(map_portlet_id+"mapToolbarRoute");mapToolbarCar=document.getElementById(map_portlet_id+"mapToolbarCar");mapToolbarBike=document.getElementById(map_portlet_id+"mapToolbarBike");mapToolbarIntermodal=document.getElementById(map_portlet_id+"mapToolbarIntermodal");mapToolbarPublicTransport=document.getElementById(map_portlet_id+"mapToolbarPublicTransport");
mapToolbarAirView=document.getElementById(map_portlet_id+"mapToolbarAirView");mapToolbarForecast=document.getElementById(map_portlet_id+"mapToolbarForecastItem");mapToolbarZoomin=document.getElementById(map_portlet_id+"mapToolbarZoomin");mapToolbarPrint=document.getElementById(map_portlet_id+"mapToolbarPrint");mapToolbarZoomout=document.getElementById(map_portlet_id+"mapToolbarZoomout");mapToolbarGps=document.getElementById(map_portlet_id+"mapToolbarGps");mapToolbarLayerMenu=document.getElementById(map_portlet_id+
"mapToolbarLayerMenu");mapToolbarLayerMenuContent=document.getElementById(map_portlet_id+"mapToolbarLayerMenuContent");mapToolbarForecastMenu=document.getElementById(map_portlet_id+"mapToolbarForecastMenu");mapToolbarForecastSection=document.getElementById(map_portlet_id+"mapToolbarForecastSection");initMapToolbarClickHandling();initMapToolbarLayerSwitcher();initForecast();restoreLayerState();checkToolBarCarButtonAirView();updateMapLayerCookie();if(map_portlet_deeplink_print_view){$(mapToolbarCar).css("display",
"none");$(mapToolbarBike).css("display","none");$(mapToolbarIntermodal).css("display","none");$(mapToolbarPublicTransport).css("display","none");$(mapToolbarGps).css("display","none")}checkHighlightRouteDeeplink();$("#"+map_portlet_id+"present").prop("checked",true);changeForecast();disableForecastFields(true);$('.map-css .map-toolbar-section[data-toolbar-item-type\x3d"forecast"]').css("display","block")}
function restoreRoutingButtonStates(){if(map_portlet_deeplink_car!=null){setCookie("route-settings-car",map_portlet_deeplink_car,30);MapRoutesHandler.getInstance().showCarRoutes=map_portlet_deeplink_car}else{var cookieValue=getCookie("route-settings-car");if(cookieValue!=null)MapRoutesHandler.getInstance().showCarRoutes=cookieValue}if(MapRoutesHandler.getInstance().showCarRoutes)$(mapToolbarCar).addClass("selected");else $(mapToolbarCar).removeClass("selected");if(map_portlet_deeplink_public_transport!=
null){setCookie("route-settings-publicTransport",map_portlet_deeplink_public_transport,30);MapRoutesHandler.getInstance().showPtRoutes=map_portlet_deeplink_public_transport}else{var cookieValue=getCookie("route-settings-publicTransport");if(cookieValue!=null)MapRoutesHandler.getInstance().showPtRoutes=cookieValue}if(MapRoutesHandler.getInstance().showPtRoutes)$(mapToolbarCar).addClass("selected");else $(mapToolbarCar).removeClass("selected");if(map_portlet_deeplink_bike!=null){setCookie("route-settings-bike",
map_portlet_deeplink_bike,30);MapRoutesHandler.getInstance().showBikeRoutes=map_portlet_deeplink_bike}else{var cookieValue=getCookie("route-settings-bike");if(cookieValue!=null)MapRoutesHandler.getInstance().showBikeRoutes=cookieValue}if(MapRoutesHandler.getInstance().showBikeRoutes)$(mapToolbarCar).addClass("selected");else $(mapToolbarCar).removeClass("selected");if(map_portlet_deeplink_intermodal!=null){setCookie("route-settings-intermodal",map_portlet_deeplink_intermodal,30);MapRoutesHandler.getInstance().showIntermodalRoutes=
map_portlet_deeplink_intermodal}else{var cookieValue=getCookie("route-settings-intermodal");if(cookieValue!=null)MapRoutesHandler.getInstance().showIntermodalRoutes=cookieValue}if(MapRoutesHandler.getInstance().showIntermodalRoutes)$(mapToolbarCar).addClass("selected");else $(mapToolbarCar).removeClass("selected");if(map_portlet_deeplink_print_view)if(map_portlet_deeplink_print_view_parameter=="car"){MapRoutesHandler.getInstance().showPtRoutes=false;MapRoutesHandler.getInstance().showBikeRoutes=false}else if(map_portlet_deeplink_print_view_parameter==
"bus"){MapRoutesHandler.getInstance().showCarRoutes=false;MapRoutesHandler.getInstance().showBikeRoutes=false}else if(map_portlet_deeplink_print_view_parameter=="bike"){MapRoutesHandler.getInstance().showCarRoutes=false;MapRoutesHandler.getInstance().showPtRoutes=false}updateRoutingButtonStates()}
function updateRoutingButtonStates(){if(MapRoutesHandler.getInstance().showCarRoutes){if(!$(mapToolbarCar).hasClass("selected"))$(mapToolbarCar).addClass("selected");carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected")}else if($(mapToolbarCar).hasClass("selected"))$(mapToolbarCar).removeClass("selected");if(MapRoutesHandler.getInstance().showPtRoutes){if(!$(mapToolbarPublicTransport).hasClass("selected"))$(mapToolbarPublicTransport).addClass("selected")}else if($(mapToolbarPublicTransport).hasClass("selected"))$(mapToolbarPublicTransport).removeClass("selected");
if(MapRoutesHandler.getInstance().showBikeRoutes){if(!$(mapToolbarBike).hasClass("selected"))$(mapToolbarBike).addClass("selected")}else if($(mapToolbarBike).hasClass("selected"))$(mapToolbarBike).removeClass("selected");if(MapRoutesHandler.getInstance().showIntermodalRoutes){if(!$(mapToolbarIntermodal).hasClass("selected"))$(mapToolbarIntermodal).addClass("selected")}else if($(mapToolbarIntermodal).hasClass("selected"))$(mapToolbarIntermodal).removeClass("selected")}
function checkToolBarCarButtonAirView(){if(wmsLayerAirView.getVisible())$(mapToolbarAirView).addClass("selected");else $(mapToolbarAirView).removeClass("selected")}
function restoreLayerState(){var deeplinkLayer=[];if(map_portlet_deeplink_layer!=null&&map_portlet_deeplink_layer.length>0)if(map_portlet_deeplink_layer.indexOf(",")>=0){var layerNames=map_portlet_deeplink_layer.split(",");for(var i=0;i<layerNames.length;i++){var layerName=deeplinkLayerMapping[layerNames[i]];if(layerName)deeplinkLayer.push(layerName)}}else{var layerName=deeplinkLayerMapping[map_portlet_deeplink_layer];if(layerName)deeplinkLayer.push(layerName)}if(deeplinkLayer.length>0){$.each(layerNameMap,
function(type,typeItem){setLayerVisible(type,false);var layer=getLayerByType(type);if(layer!=null)if(layer["wms"]){var source=layer["wms"].getSource();source.setTileLoadFunction(source.getTileLoadFunction());layer["wms"].setVisible(false)}});for(var i=0;i<deeplinkLayer.length;i++){setLayerVisible(deeplinkLayer[i],true);var layer=getLayerByType(deeplinkLayer[i]);if(layer!=null)if(layer["wms"]){var source=layer["wms"].getSource();source.setTileLoadFunction(source.getTileLoadFunction());layer["wms"].setVisible(true)}}}else $.each(layerNameMap,
function(type,typeItem){var cookieValue=getCookie("map-view-layer-"+type);if(cookieValue!=null){setLayerVisible(type,cookieValue);var layer=getLayerByType(type);if(layer!=null)if(layer["wms"]){var source=layer["wms"].getSource();source.setTileLoadFunction(source.getTileLoadFunction());layer["wms"].setVisible(cookieValue)}}})}
function setLayerVisible(type,isVisible){if(type.toUpperCase()=="LOS")isLosVisible=isVisible;else if(type.toUpperCase()=="LOS-COLOR-BLIND")isLosColorBlindVisible=isVisible;else if(type.toUpperCase()=="STATION")isStationsVisible=isVisible;else if(type.toUpperCase()=="PARKING")isParkingInfosVisible=isVisible;else if(type.toUpperCase()=="WEBCAM")isWebcamsVisible=isVisible;else if(type.toUpperCase()=="OBSTRUCTION")isObstructionsVisible=isVisible;else if(type.toUpperCase()=="ROAD_MAINTENANCE")isRoadworksVisible=
isVisible;else if(type.toUpperCase()=="AIRVIEW")isSatelliteVisible=isVisible;else if(type.toUpperCase()=="PLANED_FEATURES")isPlannedLayerVisible=isVisible;else if(type.toUpperCase()=="ELECTRIC_CHARGING_STATION")isElectricChargingLayerVisible=isVisible;else if(type.toUpperCase()=="GAS_STATION")isGasStationLayerVisible=isVisible}
function mapToolbarGpsClickHandler(){if($(mapToolbarGps).hasClass("selected")){addUserBehavior(UserAction.CLICK_GPS_OFF);stopTracking()}else{addUserBehavior(UserAction.CLICK_GPS_ON);startTracking()}}
function mapToolbarCarClickHandler(){if($(mapToolbarCar).hasClass("selected")){MapRoutesHandler.getInstance().showCarRoutes=false;Liferay.fire("vipnrw-toggle-car-route",{disbale:!MapRoutesHandler.getInstance().showCarRoutes,updateRoute:true})}else{MapRoutesHandler.getInstance().showCarRoutes=true;Liferay.fire("vipnrw-toggle-car-route",{disbale:!MapRoutesHandler.getInstance().showCarRoutes,updateRoute:true});carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected")}addUserBehavior("CLICK_CAR_VIEW",
MapRoutesHandler.getInstance().showCarRoutes);setCookie("route-settings-car",MapRoutesHandler.getInstance().showCarRoutes,30);Liferay.fire("vipnrw-route-selection-update")}
function mapToolbarBikeClickHandler(){if($(mapToolbarBike).hasClass("selected")){MapRoutesHandler.getInstance().showBikeRoutes=false;Liferay.fire("vipnrw-toggle-bike-route",{disbale:!MapRoutesHandler.getInstance().showBikeRoutes,updateRoute:true})}else{MapRoutesHandler.getInstance().showBikeRoutes=true;carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected");Liferay.fire("vipnrw-toggle-bike-route",{disbale:!MapRoutesHandler.getInstance().showBikeRoutes,
updateRoute:true})}addUserBehavior("CLICK_BIKE_VIEW",MapRoutesHandler.getInstance().showBikeRoutes);setCookie("route-settings-bike",MapRoutesHandler.getInstance().showBikeRoutes,30);Liferay.fire("vipnrw-route-selection-update")}
function mapToolbarPublicTransportClickHandler(){if($(mapToolbarPublicTransport).hasClass("selected")){MapRoutesHandler.getInstance().showPtRoutes=false;Liferay.fire("vipnrw-toggle-public-transport-route",{disbale:!MapRoutesHandler.getInstance().showPtRoutes,updateRoute:true})}else{carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected");MapRoutesHandler.getInstance().showPtRoutes=true;Liferay.fire("vipnrw-toggle-public-transport-route",{disbale:!MapRoutesHandler.getInstance().showPtRoutes,
updateRoute:true})}addUserBehavior("CLICK_BUS_VIEW",MapRoutesHandler.getInstance().showPtRoutes);setCookie("route-settings-publicTransport",MapRoutesHandler.getInstance().showPtRoutes,30);Liferay.fire("vipnrw-route-selection-update")}
function mapToolbarIntermodalClickHandler(){if($(mapToolbarIntermodal).hasClass("selected")){MapRoutesHandler.getInstance().showIntermodalRoutes=false;Liferay.fire("vipnrw-toggle-intermodal-route",{disbale:!MapRoutesHandler.getInstance().showIntermodalRoutes,updateRoute:true});Liferay.fire("remove-disclaimer")}else{MapRoutesHandler.getInstance().showIntermodalRoutes=true;carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected");Liferay.fire("vipnrw-toggle-intermodal-route",
{disbale:!MapRoutesHandler.getInstance().showIntermodalRoutes,updateRoute:true});Liferay.fire("add-disclaimer")}addUserBehavior("CLICK_INTERMODAL_VIEW",MapRoutesHandler.getInstance().showIntermodalRoutes);setCookie("route-settings-intermodal",MapRoutesHandler.getInstance().showIntermodalRoutes,30);Liferay.fire("vipnrw-route-selection-update")}
function mapToolBarLayerClickHandler(event){if(event.target!==this)return;if($(mapToolbarLayersButton).hasClass("selected"))closeLayerMenu();else showLayerMenu()}function mapToolbarForecastClickHandler(event){if(event.target!==this)return;if($(mapToolbarForecast).hasClass("selected"))closeForecastMenu();else showForecastMenu()}
function mapToolbarRouteClickHandler(){clearDynamicLayersTileCache();if($(mapToolbarRoute).hasClass("selected")){carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected");restoreLayerState()}else{carRoutingHighlighted=true;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).addClass("selected");wmsLayerLos.setVisible(false);wmsLayerLosColorBlind.setVisible(false);wmsLayerTrafficMessageLines.setVisible(false);wmsLayerRoadworkLines.setVisible(false);
wmsLayerPlannedLines.setVisible(false);isLosVisible=false;isLosColorBlindVisible=false;isRoadworksVisible=false;isObstructionsVisible=false;isWebcamsVisible=false;isStationsVisible=false;isParkingInfosVisible=false;isPlannedLayerVisible=false;isElectricChargingLayerVisible=false;isGasStationLayerVisible=false}addUserBehavior("CLICK_ROUTE_VIEW",carRoutingHighlighted);setCookie("highlighted-route",carRoutingHighlighted,30);updateMapToolbarLayerMenu();handleWfsLayersUpdate()}
function mapToolbarAirViewClickHandler(){if($(mapToolbarAirView).hasClass("selected")){$(mapToolbarAirView).removeClass("selected");wmsLayerAirView.setVisible(false);isSatelliteVisible=false}else{$(mapToolbarAirView).addClass("selected");wmsLayerAirView.setVisible(true);isSatelliteVisible=true}updateMapToolbarLayerMenu();updateMapLayerCookie()}function mapToolbarPrintClickHandler(){addUserBehavior(UserAction.CLICK_PRINT_VIEW);window.print()}
function initMapToolbarClickHandling(){$(mapToolbarZoomin).click(mapZoomIn);$(mapToolbarZoomout).click(mapZoomOut);$(mapToolbarGps).click(mapToolbarGpsClickHandler);$(mapToolbarPrint).click(mapToolbarPrintClickHandler);$(mapToolbarLayersButton).click(mapToolBarLayerClickHandler);$(mapToolbarForecast).click(mapToolbarForecastClickHandler);$(mapToolbarRoute).click(mapToolbarRouteClickHandler);$(mapToolbarAirView).click(mapToolbarAirViewClickHandler);$(mapToolbarCar).click(mapToolbarCarClickHandler);
$(mapToolbarPublicTransport).click(mapToolbarPublicTransportClickHandler);$(mapToolbarBike).click(mapToolbarBikeClickHandler);$(mapToolbarIntermodal).click(mapToolbarIntermodalClickHandler);restoreRoutingButtonStates()}
function getLayerVisible(type){if(type.toUpperCase()=="LOS")return isLosVisible;else if(type.toUpperCase()=="LOS-COLOR-BLIND")return isLosColorBlindVisible;else if(type.toUpperCase()=="STATION")return isStationsVisible;else if(type.toUpperCase()=="PARKING")return isParkingInfosVisible;else if(type.toUpperCase()=="WEBCAM")return isWebcamsVisible;else if(type.toUpperCase()=="OBSTRUCTION")return isObstructionsVisible;else if(type.toUpperCase()=="ROAD_MAINTENANCE")return isRoadworksVisible;else if(type.toUpperCase()==
"AIRVIEW")return isSatelliteVisible;else if(type.toUpperCase()=="PLANED_FEATURES")return isPlannedLayerVisible;else if(type.toUpperCase()=="ELECTRIC_CHARGING_STATION")return isElectricChargingLayerVisible;else if(type.toUpperCase()=="GAS_STATION")return isGasStationLayerVisible;else return false}
function initMapToolbarLayerSwitcher(){var menu=$("\x3cdiv class\x3d'layer-switcher-table'\x3e\x3c/div\x3e");$.each(layerNameMap,function(type,typeItem){if(type!="WebCam"){var layerId=type;var rowId=map_portlet_id+"_"+type;var rowIconId=map_portlet_id+"_"+type+"_icon";var onclickFunction="onclick\x3d'mapToolbarLayerSwitcherClick(\""+layerId+"\");'";var row=$("\x3cdiv "+onclickFunction+" class\x3d'layer-switcher-row'\x3e\x3c/div\x3e");if(typeItem.has_divider)menu.append("\x3cdiv class\x3d'alternative-td'\x3e\x3cdiv class\x3d'separator'\x3e\x3c/div\x3e\x3c/div\x3e");
if(getLayerVisible(type))row.append("\x3ci id\x3d"+rowIconId+" class\x3d'fa fa-check checker' aria-hidden\x3d'true'\x3e\x3c/i\x3e"+"\x3cdiv id\x3d"+rowId+"\x3e\x3cdiv\x3e"+typeItem.translation+"\x3c/div\x3e\x3c/div\x3e");else row.append("\x3ci id\x3d"+rowIconId+" class\x3d'fa fa-times checker' aria-hidden\x3d'true'\x3e\x3c/i\x3e"+"\x3cdiv id\x3d"+rowId+"\x3e\x3cdiv\x3e"+typeItem.translation+"\x3c/div\x3e\x3c/div\x3e");menu.append(row)}});$(mapToolbarLayerMenuContent).html(menu)}
function initForecast(){var datePicker=$("#"+map_portlet_id+"datePicker");var handle=$("#"+map_portlet_id+"timesliderHandle");var timeSlider=$("#"+map_portlet_id+"timeslider");var currentDate=new Date;var currentTime=currentDate.getHours()*minutesPerHour+currentDate.getMinutes();datePicker.datepicker({showButtonPanel:true,dateFormat:"dd.mm.yy",showWeek:true,minDate:0,onSelect:function(dateText){$(this).change()}});datePicker.on("change",function(){var datePickerDate=datePicker.datepicker("getDate");
var sliderValue=timeSlider.slider("value");var now=new Date;if(datePickerDate.toDateString()==now.toDateString()){var time=now.getHours()*minutesPerHour+now.getMinutes();if(sliderValue<=time&&sliderValue+timeSliderStepSize/2<=time){timeSlider.slider("value",time);return}}var hoursMinutes=getHoursMinutes(sliderValue);datePickerDate.setHours(hoursMinutes[0]);datePickerDate.setMinutes(hoursMinutes[1]);globalForecastEventId=getEventId(datePickerDate);updateForecast(datePickerDate)});datePicker.datepicker("setDate",
new Date);$.datepicker.setDefaults($.datepicker.regional["de"]);timeSlider.slider({min:0,max:1439,step:timeSliderStepSize,value:currentTime,create:function(){handle.text(convertTimeText($(this).slider("value")))},slide:function(event,ui){handle.text(convertTimeText(ui.value))},change:function(event,ui){var datePickerDate=datePicker.datepicker("getDate");var now=new Date;if(datePickerDate.toDateString()==now.toDateString()){var time=now.getHours()*minutesPerHour+now.getMinutes();if(ui.value<=time&&
ui.value+timeSliderStepSize/2<=time){timeSlider.slider("value",time);return}}var hoursMinutes=getHoursMinutes(ui.value);datePickerDate.setHours(hoursMinutes[0]);datePickerDate.setMinutes(hoursMinutes[1]);handle.text(convertTimeText(ui.value));updateForecast(datePickerDate)}});timeSlider.each(function(){var options=[0,3,6,9,12,15,18,21,24];for(var i=0;i<options.length;i++){var el=$("\x3clabel\x3e"+options[i]+"\x3c/label\x3e").css("left",i/(options.length-1)*100+"%");$("#"+map_portlet_id+"timeslider").append(el)}});
datePicker.change()}function forecastRadioClicked(selected){switch(selected){case 1:addUserBehavior(UserAction.CLICK_FORECAST_OFF);break;case 2:addUserBehavior(UserAction.CLICK_FORECAST_15);break;case 3:addUserBehavior(UserAction.CLICK_FORECAST_30);break;case 4:addUserBehavior(UserAction.CLICK_FORECAST_45);break;case 5:addUserBehavior(UserAction.CLICK_FORECAST_DATE);break;default:break}changeForecast()}
function changeForecast(){if(isForecastEnabled()){disableForecastFields(false);updateLayers(true);updateForecast(globalForecastDate);addUserBehavior(UserAction.SHOW_FORECAST,undefined,globalForecastDate)}else{disableForecastFields(true);updateLayers(false);handleWfsLayersUpdate()}updateCarRouteData()}
function disableForecastFields(isDisabled){$("#"+map_portlet_id+"datePicker").prop("disabled",isDisabled);$("#"+map_portlet_id+"trafficMessageDays").prop("disabled",isDisabled);$("#"+map_portlet_id+"timesliderButtonLeft").prop("disabled",isDisabled);$("#"+map_portlet_id+"timesliderButtonRight").prop("disabled",isDisabled);if(isDisabled)$("#"+map_portlet_id+"timeslider").slider("disable");else $("#"+map_portlet_id+"timeslider").slider("enable")}
function slideTime(forward){var timeSlider=$("#"+map_portlet_id+"timeslider");var sliderValue=timeSlider.slider("value");var sliderStep=timeSlider.slider("option","step");if(forward)timeSlider.slider("value",sliderValue+sliderStep);else timeSlider.slider("value",sliderValue-sliderStep)}
function updateForecast(dateTmp){globalForecastDate=dateTmp;if(isForecastEnabled()&&globalForecastDate!=null){if(!globalForecastEventId)globalForecastEventId=null;var dateRequest=new Date(globalForecastDate);dateRequest.setHours(globalForecastDate.getHours());dateRequest.setMinutes(dateRequest.getMinutes());dateRequest.setSeconds(0);dateRequest.setMilliseconds(0);dateRequest.setYear(2018);dateRequest.setMonth(0);dateRequest.setDate(1);var layers="";var styles="";var stylesCb="";var sep="";for(region in globalForecastEventId){layers+=
sep+"vipnrw:v_forecast_"+region.toLowerCase();styles+=sep+"vipnrw:forecast_"+globalForecastEventId[region];stylesCb+=sep+"vipnrw:forecast_"+globalForecastEventId[region]+"_colorblind";if(sep==="")sep=","}if(layers==="")layers="vipnrw:v_forecast_null";wmsLayerLos.getSource().updateParams({"LAYERS":layers,"STYLES":styles,"TIME":dateRequest.toISOString()});wmsLayerLosColorBlind.getSource().updateParams({"LAYERS":layers,"TIME":dateRequest.toISOString(),"STYLES":stylesCb});wmsLayerTrafficMessageLines.getSource().updateParams({"TIME":globalForecastDate.toISOString()});
wmsLayerRoadworkLines.getSource().updateParams({"TIME":globalForecastDate.toISOString()});handleWfsLayersUpdate()}}
function checkHighlightRouteDeeplink(){carRoutingHighlighted=map_portlet_deeplink_highlight_route;setCookie("highlighted-route",carRoutingHighlighted,30);if(carRoutingHighlighted){mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).addClass("selected");wmsLayerLos.setVisible(false);wmsLayerLosColorBlind.setVisible(false);wmsLayerTrafficMessageLines.setVisible(false);wmsLayerRoadworkLines.setVisible(false);wmsLayerPlannedLines.setVisible(false);isLosVisible=false;isLosColorBlindVisible=false;
isRoadworksVisible=false;isObstructionsVisible=false;isWebcamsVisible=false;isStationsVisible=false;isParkingInfosVisible=false;isPlannedLayerVisible=false;updateMapToolbarLayerMenu();handleWfsLayersUpdate()}}
function updateMapToolbarLayerMenu(){$.each(layerNameMap,function(type,typeItem){var rowIcon=$("#"+map_portlet_id+"_"+type+"_icon");if(!getLayerVisible(type)){if(rowIcon.hasClass("fa-check")){rowIcon.removeClass("fa-check");rowIcon.addClass("fa-times")}}else if(rowIcon.hasClass("fa-times")){rowIcon.removeClass("fa-times");rowIcon.addClass("fa-check")}})}
function mapToolbarLayerSwitcherClick(type,visibleOverride){var layer=getLayerByType(type);let isOverride=visibleOverride!==undefined;if(layer){if(layer["wms"]){var source=layer["wms"].getSource();source.setTileLoadFunction(source.getTileLoadFunction());var value=!layer["wms"].getVisible();if(isOverride)value=visibleOverride;layer["wms"].setVisible(value)}let visible=switchLayerVisible(type,visibleOverride);if(isOverride){addUserBehavior(CLICK_LAYER+type.toUpperCase().replaceAll("-",""),visible);
if(type.toUpperCase()=="LOS"&&isLosColorBlindVisible)type="LOS-COLOR-BLIND"}if(type.toUpperCase()=="LOS-COLOR-BLIND"){changeForecast();wmsLayerLos.setVisible(false);isLosVisible=false}else if(type.toUpperCase()=="LOS"){changeForecast();wmsLayerLosColorBlind.setVisible(false);isLosColorBlindVisible=false}if(type.toUpperCase()=="PLANED_FEATURES"){wmsLayerLos.setVisible(false);wmsLayerLosColorBlind.setVisible(false);wmsLayerTrafficMessageLines.setVisible(false);wmsLayerRoadworkLines.setVisible(false);
isLosColorBlindVisible=false;isLosVisible=false;isRoadworksVisible=false;isObstructionsVisible=false;isWebcamsVisible=false;isStationsVisible=false;isParkingInfosVisible=false}else{wmsLayerPlannedLines.setVisible(false);isPlannedLayerVisible=false}carRoutingHighlighted=false;mapRoutingLayer.getSource().refresh();$(mapToolbarRoute).removeClass("selected");checkToolBarCarButtonAirView();updateMapToolbarLayerMenu();handleWfsLayersUpdate();updateMapLayerCookie()}}
function updateMapLayerCookie(){if(!map_portlet_deeplink_print_view){setCookie("map-view-layer-LOS-COLOR-BLIND",isLosColorBlindVisible,30);setCookie("map-view-layer-LOS",isLosVisible,30);setCookie("map-view-layer-Station",isStationsVisible,30);setCookie("map-view-layer-Parking",isParkingInfosVisible,30);setCookie("map-view-layer-WebCam",isWebcamsVisible,30);setCookie("map-view-layer-OBSTRUCTION",isObstructionsVisible,30);setCookie("map-view-layer-ROAD_MAINTENANCE",isRoadworksVisible,30);setCookie("map-view-layer-AIRVIEW",
isSatelliteVisible,30);setCookie("map-view-layer-PLANED_FEATURES",isPlannedLayerVisible,30);setCookie("map-view-layer-ELECTRIC_CHARGING_STATION",isElectricChargingLayerVisible,30);setCookie("map-view-layer-GAS_STATION",isGasStationLayerVisible,30)}}
function switchLayerVisible(type,visibleOverride){if(type.toUpperCase()=="LOS"){isLosVisible=visibleOverride||!isLosVisible;return isLosVisible}else if(type.toUpperCase()=="LOS-COLOR-BLIND"){isLosColorBlindVisible=visibleOverride||!isLosColorBlindVisible;return isLosColorBlindVisible}else if(type.toUpperCase()=="STATION"){isStationsVisible=visibleOverride||!isStationsVisible;return isStationsVisible}else if(type.toUpperCase()=="PARKING"){isParkingInfosVisible=visibleOverride||!isParkingInfosVisible;
return isParkingInfosVisible}else if(type.toUpperCase()=="WEBCAM"){isWebcamsVisible=visibleOverride||!isWebcamsVisible;return isWebcamsVisible}else if(type.toUpperCase()=="OBSTRUCTION"){isObstructionsVisible=visibleOverride||!isObstructionsVisible;return isObstructionsVisible}else if(type.toUpperCase()=="ROAD_MAINTENANCE"){isRoadworksVisible=visibleOverride||!isRoadworksVisible;return isRoadworksVisible}else if(type.toUpperCase()=="AIRVIEW"){isSatelliteVisible=visibleOverride||!isSatelliteVisible;
return isSatelliteVisible}else if(type.toUpperCase()=="PLANED_FEATURES"){isPlannedLayerVisible=visibleOverride||!isPlannedLayerVisible;return isPlannedLayerVisible}else if(type.toUpperCase()=="ELECTRIC_CHARGING_STATION"){isElectricChargingLayerVisible=visibleOverride||!isElectricChargingLayerVisible;return isElectricChargingLayerVisible}else if(type.toUpperCase()=="GAS_STATION"){isGasStationLayerVisible=visibleOverride||!isGasStationLayerVisible;return isGasStationLayerVisible}}
function getLayerByType(typeName){var layer=null;$.each(layerNameMap,function(type,typeItem){if(type.toUpperCase()===typeName.toUpperCase())layer=layerNameMap[type]});return layer}function closeLayerMenu(){$(mapToolbarLayersButton).removeClass("selected");$(mapToolbarLayerMenu).stop().hide("slow");if(!$(mapToolbarForecastMenu).is(":visible"))$(".on-forcast-hidden").css("visibility","")}
function showLayerMenu(){$(mapToolbarLayersButton).addClass("selected");$(mapToolbarLayerMenu).stop().show("slow");$(".on-forcast-hidden").css("visibility","hidden")}function closeForecastMenu(){$(mapToolbarForecast).removeClass("selected");$(mapToolbarForecastMenu).stop().hide("slow");if(!$(mapToolbarLayerMenu).is(":visible"))$(".on-forcast-hidden").css("visibility","")}
function showForecastMenu(){$(mapToolbarForecast).addClass("selected");$(mapToolbarForecastMenu).stop().show("slow");$(".on-forcast-hidden").css("visibility","hidden")}function convertTimeText(minutes){var hoursMinutes=getHoursMinutes(minutes);return String(hoursMinutes[0]).padStart(2,"0")+":"+String(hoursMinutes[1]).padStart(2,"0")}function getHoursMinutes(minutes){var time=minutes/minutesPerHour;var hours=Math.floor(time);var mins=Math.round((time-hours)*minutesPerHour);return[hours,mins]}
function getEventId(requestDate){var returnValue=null;$.ajax({url:map_portlet_resource_url,type:"GET",dataType:"json",timeout:5E3,async:false,data:{action:event_id_action,yearMonthDate:requestDate.toISOString()},success:function(data){if(data!=null){var content=data;returnValue=content.eventId}},fail:function(jqXHR,textStatus,errorThrown){console.error(errorThrown)}});return returnValue}
function updateLayers(isForecast){var losSource=wmsLayerLos.getSource();var losCbSource=wmsLayerLosColorBlind.getSource();var trafficSource=wmsLayerTrafficMessageLines.getSource();var roadworkSouce=wmsLayerRoadworkLines.getSource();isLosForecastBaseVisible=isForecast;wmsLayerLosForecastBase.setVisible(isForecast);if(isForecast){losSource.setUrl(urlGeoServer);losCbSource.setUrl(urlGeoServer);trafficSource.setUrl(urlGeoServer);roadworkSouce.setUrl(urlGeoServer);trafficSource.updateParams({"LAYERS":layerNameMap["OBSTRUCTION"]["wms_forecast_name"]});
roadworkSouce.updateParams({"LAYERS":layerNameMap["ROAD_MAINTENANCE"]["wms_forecast_name"]});wmsLayerLos.setOpacity(1);wmsLayerLosColorBlind.setOpacity(1)}else{losSource.setUrl(urlGWCGeoServer);losCbSource.setUrl(urlGWCGeoServer);losSource.updateParams({"LAYERS":layerNameMap["LOS"]["wms_name"],"STYLES":""});losCbSource.updateParams({"LAYERS":layerNameMap["LOS-COLOR-BLIND"]["wms_name"],"STYLES":""});trafficSource.setUrl(urlGWCGeoServer);roadworkSouce.setUrl(urlGWCGeoServer);var styles=losStyles();
losSource.updateParams({"LAYERS":layerNameMap["LOS"]["wms_name"],"STYLES":styles});losCbSource.updateParams({"LAYERS":layerNameMap["LOS-COLOR-BLIND"]["wms_name"],"STYLES":styles===""?styles:styles+"-Color-Blind"});trafficSource.updateParams({"LAYERS":layerNameMap["OBSTRUCTION"]["wms_name"]});roadworkSouce.updateParams({"LAYERS":layerNameMap["ROAD_MAINTENANCE"]["wms_name"]});wmsLayerLos.setOpacity(.75);wmsLayerLosColorBlind.setOpacity(.75)}}
function losStyles(){var radios=document.getElementsByName("traffic");var selected=undefined;for(var i=0,length=radios.length;i<length;i++)if(radios[i].checked){selected=radios[i].value;break}switch(selected){case "1":return"";case "2":return"vipnrw:LOS15";case "3":return"vipnrw:LOS30";case "4":return"vipnrw:LOS45";case "5":return"";default:return""}}
function updateTileUrlFunctions(sources){$.each(sources,function(index,value){var originalTileUrlFunc=value.getTileUrlFunction();value.setTileUrlFunction(function(){wmsTileCallid++;var tmp=originalTileUrlFunc.apply(this,arguments);return tmp+"\x26CALLID\x3d"+wmsTileCallid})})}function isForecastEnabled(){var element=document.getElementById(map_portlet_id+"forecast");if(element!=null&&element!="undefined")return element.checked;return false}
function getTrafficMessageDate(){if(isForecastEnabled())return globalForecastDate.toISOString();return null}function getTrafficMessageDays(){if(isForecastEnabled())return globalForecastTrafficMessageDays;return null};
var parsedStartParam=null;var parsedTargetParam=null;var parsedViaParam=null;var mapResolutions=[4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135];var mapExtent=[-2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7];
var mapGWCExtent=[270402.7634448332,5933032.807406616,1775732.018771907,7437567.703351199];var airViewProjectionName="EPSG:25832";var mapProjectionName="EPSG:900913";var wgs84ProjectionName="EPSG:4326";var mapMinZoom=5;var mapMaxZoom=18;var oldZoomLevel=9;var wmsTileCallid=0;var tileGrids={};var scaleMap=[];var iPhonePressTimer=null;var iPhonePressPosition=null;var mapProjection=null;var mapView=null;var map=null;var mobileLongClicked=false;var wmsForegroundLayer=null;var wmsBaseLayer=null;
var wmsLayerAirView=null;var wmsLayerLosForecastBase=null;var wmsLayerLos=null;var wmsLayerLosColorBlind=null;var wmsLayerTrafficMessageLines=null;var wmsLayerRoadworkLines=null;
var layerNameMap={"AIRVIEW":{"translation":"Luftbild","wms":null,"wms_name":"nw_dop_rgb"},"LOS":{"translation":"Verkehrslage","wfs_urban":"vipnrw:traffic_abnormal_travel_time_loss_feature","wfs_not_urban":"vipnrw:traffic_abnormal_travel_time_loss_feature","wms":null,"wms_name":"LOS","style_types":["CONGESTION"]},"LOS-COLOR-BLIND":{"translation":"Farbfehlsichtigen \x3cbr\x3e\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;Ansicht","wfs_urban":"vipnrw:traffic_abnormal_travel_time_loss_feature","wfs_not_urban":"vipnrw:traffic_abnormal_travel_time_loss_feature",
"wms":null,"wms_name":"LOS-COLOR-BLIND","style_types":["CONGESTION"]},"OBSTRUCTION":{"translation":"Verkehrsmeldungen","wfs_urban":"vipnrw:traffic_obstructions_urban_feature","wfs_not_urban":"vipnrw:traffic_obstructions_interstate_feature","wms":null,"wms_name":"TrafficmessageLines","wms_forecast_name":"vipnrw:traffic_obstructions_lines_forecast","style_types":["WARNING","CONGESTION","CLOSURE","CLOSURE_ENTRY_EXIT","CLOSURE_TRUCKS","WEIGHT_LIMIT_35","WEIGHT_LIMIT_55","REROUTING"]},"ROAD_MAINTENANCE":{"translation":"Baustellen",
"wfs_urban":"vipnrw:traffic_roadworks_urban_feature","wfs_not_urban":"vipnrw:traffic_roadworks_interstate_feature","wms":null,"wms_name":"RoadworkLines","wms_forecast_name":"vipnrw:traffic_roadworks_lines_forecast","style_types":["ROADWORKS","SHORT_TERM_ROADWORKS"]},"WebCam":{"translation":"WebCams","wfs_not_urban":"vipnrw:infrastructure_webcams_feature","style_types":["WEBCAM"]},"Parking":{"translation":"Parken","wfs_urban":"vipnrw:parking_feature","wfs_not_urban":"vipnrw:parking_interstate_feature",
"style_types":["PARKING","PARKING_GARAGE","PARKING_UNDERGROUND"]},"Station":{"translation":"Haltestellen","wfs_urban":"vipnrw:publictransport_stations_feature","style_types":["STATION"]},"ELECTRIC_CHARGING_STATION":{"translation":"E-Lades\u00e4ulen","wfs_urban":"vipnrw:infrastructure_electric_charging_feature","style_types":["ELECTRIC_CHARGING_STATION","STRONG_ELECTRIC_CHARGING_STATION"]},"GAS_STATION":{"translation":"Tankstellen","wfs_urban":"vipnrw:mtsk_stationdata_feature","style_types":["GAS_STATION",
"GAS_CNG_STATION"]},"PLANED_FEATURES":{"translation":"Baustellenplanung,\x3cbr\x3e\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;langfristige Sicht","wfs_urban":"vipnrw:planed_traffic_urban_feature","wfs_not_urban":"vipnrw:planed_traffic_interstate_feature","wms":null,"wms_name":"PlannedLines","style_types":["PLANED_ROADWORKS","PLANED_SHORT_TERM_ROADWORKS"],"has_divider":true}};
function initScaleMap(){var sm=[];sm[0]="1 : 559M";sm[1]="1 : 279M";sm[2]="1 : 139M";sm[3]="1 : 70M";sm[4]="1 : 35M";sm[5]="1 : 17M";sm[6]="1 : 9M";sm[7]="1 : 4M";sm[8]="1 : 2M";sm[9]="1 : 1M";sm[10]="1 : 545K";sm[11]="1 : 273K";sm[12]="1 : 136K";sm[13]="1 : 68K";sm[14]="1 : 34K";sm[15]="1 : 17K";sm[16]="1 : 8K";sm[17]="1 : 4K";sm[18]="1 : 2K";sm[19]="1 : 1K";sm[20]="1 : 533";sm[21]="1 : 266";sm[22]="1 : 133";sm[23]="1 : 66";sm[24]="1 : 33";sm[25]="1 : 16";sm[26]="1 : 8";sm[27]="1 : 4";sm[28]="1 : 2";
sm[29]="1 : 1";sm[30]="1 : 0,5";return sm}var coordinateLatLon=function(dgts){return function(coord1){var coord2=[coord1[1],coord1[0]];return ol.coordinate.toStringXY(coord2,dgts)}};
function initMap(){scaleMap=initScaleMap();proj4.defs([[airViewProjectionName,"+proj\x3dutm +zone\x3d32 +ellps\x3dGRS80 +units\x3dm +no_defs"],[mapProjectionName,"+proj\x3dmerc +a\x3d6378137 +b\x3d6378137 +lat_ts\x3d0.0 +lon_0\x3d0.0 +x_0\x3d0.0 +y_0\x3d0 +k\x3d1.0 +units\x3dm +nadgrids\x3d@null +wktext  +no_defs "]]);ol.proj.proj4.register(proj4);if(!mapProjectionName)mapProjectionName="EPSG:900913";mapProjection=ol.proj.get(mapProjectionName);mapProjection.setExtent(mapExtent);mapView=new ol.View({projection:mapProjection,
center:[842170.3269453192,6675871.063293768],zoom:oldZoomLevel,maxZoom:mapMaxZoom,minZoom:mapMinZoom});var interactions=null;var loadTilesWhileInteracting=true;if(Liferay.Browser.isMobile()){loadTilesWhileInteracting=false;interactions=ol.interaction.defaults({dragPan:false,altShiftDragRotate:false,pinchRotate:false}).extend([new ol.interaction.DragPan({kinetic:false})])}else interactions=ol.interaction.defaults({altShiftDragRotate:false,pinchRotate:false}).extend([]);map=new ol.Map({interactions:interactions,
controls:[new ol.control.ScaleLine({target:map_portlet_id+"olScaleLineContainer"}),new ol.control.MousePosition({projection:wgs84ProjectionName,coordinateFormat:coordinateLatLon(5),target:map_portlet_id+"olMousePositionContainer"})],target:map_portlet_id+"olMap",view:mapView,loadTilesWhileInteracting:loadTilesWhileInteracting});urlGWCGeoServer=checkSSLUrl(urlGWCGeoServer);urlGeoServer=checkSSLUrl(urlGeoServer);initPointerMoveEvent();addLayers();initWFSLayers();initRoutingLayer();addClickHandler();
initWfsFeatureInfoPopup();initMapToolbar();initRouteDescriptionPopup();initRoutePopup();setMapViewFromCookie();restoreRoutePointsFromUrl();restoreRoutePoints();handleWfsLayersUpdate();setInterval(function(){refreshDynamicLayers();handleWfsLayersUpdate();updateCarRouteData()},12E4);updateMapPrintView();initPostionTracking();preloadPublicTransportRouteImages();map.render()}
function updateMapPrintView(){if(map_portlet_deeplink_print_view){$("#p_p_id"+map_portlet_id).css("height","700px");$("#p_p_id"+map_portlet_id).css("position","static");map.updateSize()}}
function addClickHandler(){initContextMenu();initFeatureContextMenu();map.on("dblclick",function(evt){console.info("map dbl-left-click event!")});map.on("singleclick",function(evt){var featureLine=null;var wfsFeatures=[];var carRouteWfsFeatures=[];map.forEachFeatureAtPixel(evt.pixel,function(cluster){var features=cluster.get("features");if(features)features.forEach(function(feature){if(feature.get("type")==carRouteLineName)featureLine=feature;else if(feature.get("type")==publicTransportRouteLineName)featureLine=
feature;else if(feature.get("type")==bikeRouteLineName)featureLine=feature;else if(feature.get("wfs"))wfsFeatures.push(feature);else if(feature.get("carRouteWfs")){wfsFeatures.push(feature);carRouteWfsFeatures.push(feature)}});else if(cluster.get("type")==carRouteLineName)featureLine=cluster;else if(cluster.get("type")==publicTransportRouteLineName)featureLine=cluster;else if(cluster.get("type")==bikeRouteLineName)featureLine=cluster;else if(cluster.get("wfs"))wfsFeatures.push(cluster);else if(cluster.get("carRouteWfs")){wfsFeatures.push(cluster);
carRouteWfsFeatures.push(cluster)}},{hitTolerance:10});if(!mobileLongClicked){closeContextMenu();closeFeatureContextMenu()}mobileLongClicked=false;closeWfsFeatureInfo();if(carRouteWfsFeatures.length>0)handleWfsFeatureInfoClick(evt,wfsFeatures);else if(featureLine&&!Liferay.Browser.isMobile())if(featureLine.get("type")==carRouteLineName)Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"car"});else if(featureLine.get("type")==publicTransportRouteLineName)Liferay.fire("vipnrw-maximize-portlet",
{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"publicTransport"});else{if(featureLine.get("type")==bikeRouteLineName)Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_routing_portlet_RoutingPortlet_",tabPage:"bike"})}else if(wfsFeatures.length>0)handleWfsFeatureInfoClick(evt,wfsFeatures);else;});if(Liferay.Browser.isIphone()||Liferay.Browser.isMobile()&&Liferay.Browser.isSafari()){try{map.getViewport().addEventListener("touchstart",function(evt){clearIPhonePressTimer(true);
iPhonePressPosition=map.getEventPixel(evt);iPhonePressTimer=window.setTimeout(function(){iPhonePressPosition=null;evt.preventDefault();var coordinate=map.getEventCoordinate(evt);var pixel=map.getEventPixel(evt);handleMapRightKlick(pixel,coordinate)},1E3)},false);map.getViewport().addEventListener("touchend",function(){clearIPhonePressTimer(true)},false);map.getViewport().addEventListener("touchcancel",function(){clearIPhonePressTimer(true)},false);map.getViewport().addEventListener("touchmove",function(event){clearIPhonePressTimer(false,
event)},false);map.on("pointerdrag",function(event){clearIPhonePressTimer(false,event)});map.on("pointermove",function(event){clearIPhonePressTimer(false,event)});map.on("moveend",function(event){clearIPhonePressTimer(true)})}catch(e){console.error(e)}map.getViewport().addEventListener("contextmenu",function(evt){evt.preventDefault()})}else map.getViewport().addEventListener("contextmenu",function(evt){evt.preventDefault();var coordinate=map.getEventCoordinate(evt);var pixel=map.getEventPixel(evt);
handleMapRightKlick(pixel,coordinate)});map.on("moveend",function(evt){handleWfsLayersUpdate();updateMapViewCookie();var zoomLevelInteger=getMapCurrentZoomLevelInteger();Liferay.fire("vipnrw-map-extent-changed",{extent:getMapWgs84Extent().join(",")});$("#"+map_portlet_id+"olMapScaleText").html(scaleMap[zoomLevelInteger]);if(oldZoomLevel!==map.getView().getZoom()){wfsVectorSource.clear();unclusteredSource.clear();updateWfsImageSources(zoomLevelInteger);map.render();clearDynamicLayersTileCache();if(map.getView().getZoom())oldZoomLevel=
map.getView().getZoom();let eventFocus=evt.target.focus_;if(eventFocus)addUserBehavior(UserAction.ZOOM_MAP,undefined,toLatLon(eventFocus))}})}function getMapCurrentZoomLevelInteger(){var zoomLevelInteger=parseInt(map.getView().getZoom());if(!zoomLevelInteger)zoomLevelInteger=parseInt(mapMaxZoom);return zoomLevelInteger}
function addWfsFeaturesClickByExtend(evt){var coordinates=evt.coordinate;var extent=(new ol.geom.Point(coordinates)).getExtent();extent=ol.extent.buffer(extent,map.getView().getResolution()*15);var wfsResult=[];var carWfsResult=[];var source=wfsVectorLayer.getSource();var features=source.getFeatures();for(var i=0;i<features.length;i++){var coordinate=features[i].getGeometry().getCoordinates();if(features[i].get("wfs")&&ol.extent.containsCoordinate(extent,coordinate))wfsResult.push(features[i])}var sourceRouting=
mapRoutingLayer.getSource();var featuresRouting=sourceRouting.getFeatures();for(var i=0;i<featuresRouting.length;i++){var coordinate=featuresRouting[i].getGeometry().getCoordinates();if(featuresRouting[i].get("carRouteWfs")&&ol.extent.containsCoordinate(extent,coordinate))carWfsResult.push(featuresRouting[i])}return{carWfsResult:carWfsResult,wfsResult:wfsResult}}
function clearIPhonePressTimer(force,event){if(force)clearTimeout(iPhonePressTimer);else if(iPhonePressPosition&&event&&event.pixel){var pixel=event.pixel;if(iPhonePressPosition[0]>pixel[0]+20||iPhonePressPosition[0]<pixel[0]-20||iPhonePressPosition[1]>pixel[1]+20||iPhonePressPosition[1]<pixel[1]-20){iPhonePressPosition=null;clearTimeout(iPhonePressTimer)}}}
function handleMapRightKlick(pixel,coordinate){closeWfsFeatureInfo();if(Liferay.Browser.isMobile()||isSmallWindow())mobileLongClicked=true;var featurePoints=[];map.forEachFeatureAtPixel(pixel,function(feature){if(feature.get("type")==pointNameStart||feature.get("type")==pointNameTarget||feature.get("type")==pointNameVia)featurePoints.push(feature)});if(featurePoints.length==0){addUserBehavior(UserAction.CONTEXT_MENU_MAP,undefined,toLatLon(coordinate));showContextMenu(coordinate)}else showFeatureContextMenu(featurePoints,
coordinate)}function getExtentForScreenSize(){var extent=map.getView().calculateExtent(map.getSize());var extentCenter=ol.extent.getCenter(extent);var topLeft=ol.extent.getTopLeft(extent);var resolution=map.getView().getResolution();var width=$(window).width();var height=$(window).height();var bottomRight=[extentCenter[0]+width/2*resolution,topLeft[1]-height*resolution];var topLeft=[extentCenter[0]-width/2*resolution,topLeft[1]];return ol.extent.boundingExtent([topLeft,bottomRight])}
function getMapWgs84Extent(){var result=[];try{var extent=getExtentForScreenSize();for(var i=0;i<extent.length;i+=2){var pos=new ol.proj.transform([extent[i],extent[i+1]],mapProjectionName,wgs84ProjectionName);result.push(pos)}}catch(e){console.error(e)}return result}
function clearDynamicLayersTileCache(){if(wmsLayerLos.getVisible()){var source=wmsLayerLos.getSource();source.setTileLoadFunction(source.getTileLoadFunction())}if(wmsLayerLosColorBlind.getVisible()){var source=wmsLayerLosColorBlind.getSource();source.setTileLoadFunction(source.getTileLoadFunction())}if(wmsLayerRoadworkLines.getVisible()){var source=wmsLayerRoadworkLines.getSource();source.setTileLoadFunction(source.getTileLoadFunction())}if(wmsLayerTrafficMessageLines.getVisible()){var source=wmsLayerTrafficMessageLines.getSource();
source.setTileLoadFunction(source.getTileLoadFunction())}}function refreshDynamicLayers(){if(wmsLayerLos.getVisible())wmsLayerLos.getSource().refresh();if(wmsLayerLosColorBlind.getVisible())wmsLayerLosColorBlind.getSource().refresh();if(wmsLayerRoadworkLines.getVisible())wmsLayerRoadworkLines.getSource().refresh();if(wmsLayerTrafficMessageLines.getVisible())wmsLayerTrafficMessageLines.getSource().refresh()}function showFAQPortlet(){}
function addLayers(){wmsBaseLayer=new ol.layer.Tile({source:new ol.source.XYZ({projection:mapProjectionName,url:checkSSLUrl(urlS3Server),maxZoom:19,tileSize:[256,256]})});wmsBaseLayer.name="Hintergrund";wmsBaseLayer.isBaseLayer=true;map.addLayer(wmsBaseLayer);wmsLayerAirView=createWMSLayer(checkSSLUrl("https://www.wms.nrw.de/geobasis/wms_nw_dop"),layerNameMap["AIRVIEW"]["wms_name"],1,isSatelliteVisible,"Luftbild",false,256,true,2048,airViewProjectionName,"","1.3.0");layerNameMap["AIRVIEW"]["wms"]=
wmsLayerAirView;map.addLayer(wmsLayerAirView);wmsLayerLosForecastBase=createWMSLayer(urlGWCGeoServer,"forecast_devices",.75,isLosForecastBaseVisible,"Prognose - Basis",false,512,false,mapProjectionName);map.addLayer(wmsLayerLosForecastBase);wmsLayerLos=createWMSLayer(urlGWCGeoServer,layerNameMap["LOS"]["wms_name"],.75,isLosVisible,"Verkehrslage",false,512,true,0,mapProjectionName);layerNameMap["LOS"]["wms"]=wmsLayerLos;map.addLayer(wmsLayerLos);wmsLayerLosColorBlind=createWMSLayer(urlGWCGeoServer,
layerNameMap["LOS-COLOR-BLIND"]["wms_name"],.75,isLosColorBlindVisible,"Farbfehlsichtigenmodus",false,512,true,0,mapProjectionName);layerNameMap["LOS-COLOR-BLIND"]["wms"]=wmsLayerLosColorBlind;map.addLayer(wmsLayerLosColorBlind);wmsLayerTrafficMessageLines=createWMSLayer(urlGWCGeoServer,layerNameMap["OBSTRUCTION"]["wms_name"],1,isObstructionsVisible,"Verkehrsmeldungen",false,512,false,0,mapProjectionName);layerNameMap["OBSTRUCTION"]["wms"]=wmsLayerTrafficMessageLines;map.addLayer(wmsLayerTrafficMessageLines);
wmsLayerRoadworkLines=createWMSLayer(urlGWCGeoServer,layerNameMap["ROAD_MAINTENANCE"]["wms_name"],1,isRoadworksVisible,"Baustellen",false,512,false,0,mapProjectionName);layerNameMap["ROAD_MAINTENANCE"]["wms"]=wmsLayerRoadworkLines;map.addLayer(wmsLayerRoadworkLines);wmsLayerPlannedLines=createWMSLayer(urlGWCGeoServer,layerNameMap["PLANED_FEATURES"]["wms_name"],1,isPlannedLayerVisible,"Geplante Baustellen",false,512,false,0,mapProjectionName);layerNameMap["PLANED_FEATURES"]["wms"]=wmsLayerPlannedLines;
map.addLayer(wmsLayerPlannedLines);if(urlS3ServerForeground){var wmsForegroundSource=new ol.source.XYZ({projection:mapProjectionName,url:checkSSLUrl(urlS3ServerForeground),maxZoom:19,tileSize:[256,256]});wmsForegroundLayer=new ol.layer.Tile({source:wmsForegroundSource});map.addLayer(wmsForegroundLayer)}}function mapZoomInCenter(centerCoordinate){if(centerCoordinate)map.getView().setCenter(centerCoordinate);mapZoomIn()}
function mapZoomOutCenter(centerCoordinate){if(centerCoordinate)map.getView().setCenter(centerCoordinate);mapZoomOut()}function mapZoomIn(){var zoomLevel=getMapCurrentZoomLevelInteger();map.getView().setZoom(zoomLevel+1)}function mapZoomOut(){var zoomLevel=getMapCurrentZoomLevelInteger();map.getView().setZoom(zoomLevel-1)}
function getWmsLayerTileGrid(tilesize){if(!tileGrids[tilesize])tileGrids[tilesize]=new ol.tilegrid.TileGrid({origin:mapGWCExtent,resolutions:mapResolutions,tileSize:[tilesize,tilesize]});return tileGrids[tilesize]}
function createWMSLayer(url,layers,opacity,isVisible,layerName,isBaseLayer,tilesize,displayInLayerSwitcher,cacheSize,layerProjection,styles,v){var version="1.1.1";if(v)version=v;var source=new ol.source.TileWMS({cacheSize:cacheSize,url:url,projection:layerProjection,params:{"LAYERS":layers,"VERSION":version,"FORMAT":"image/png","TRANSPARENT":"true","WIDTH":tilesize,"HEIGHT":tilesize,"STYLES":styles},tileGrid:getWmsLayerTileGrid(tilesize),crossOrigin:null});if(!cacheSize||cacheSize==0){var originalTileUrlFunction=
source.getTileUrlFunction();source.setTileUrlFunction(function(){wmsTileCallid++;return originalTileUrlFunction.apply(this,arguments)+"\x26CALLID\x3d"+wmsTileCallid})}var layer=new ol.layer.Tile({source:source,preload:0,opacity:opacity,visible:isVisible});layer.id=layers;layer.name=layerName;layer.isBaseLayer=isBaseLayer;layer.displayInLayerSwitcher=displayInLayerSwitcher;return layer}
function toLatLon(coordinate){if(coordinate){let eventFocus=ol.proj.toLonLat(coordinate);return eventFocus[1]+", "+eventFocus[0]}return""};
var mapZoomAnimationTimeoutId=null;
Liferay.on("vipnrw-map-resize",function(){map.updateSize();var scaleLineDiv=$("#olInfo");var attributionDiv=$("#"+map_portlet_id+"attribution");var attributionUl=$("#"+map_portlet_id+"attribution ul");var mapPortletDiv=$("#p_p_id"+map_portlet_id);if(scaleLineDiv&&mapPortletDiv&&mapPortletDiv.width()<scaleLineDiv.outerWidth(true)+20)scaleLineDiv.css("display","none");else scaleLineDiv.css("display","block");if(attributionUl&&mapPortletDiv&&attributionDiv&&mapPortletDiv.width()<attributionUl.outerWidth(true)+
10)attributionDiv.css("display","none");else attributionDiv.css("display","block")});Liferay.on("vipnrw-show-legend",function(){$("#"+map_portlet_id+"mapToolbarLegendDiv").slideToggle("slow")});Liferay.on("vipnrw-refresh-routes",function(parameter){drawRoute()});
Liferay.on("vipnrw-fly-to-point",function(parameter){var pointString=parameter.point;var projection=parameter.projection;var zoomlevel=parameter.zoomlevel;if(!zoomlevel)zoomlevel=13;var point=null;if(pointString!=null){var coords=pointString.split(",");if(coords.length==2)if(projection!=null&&projection!=mapProjectionName)point=new ol.proj.transform([parseFloat(coords[0]),parseFloat(coords[1])],projection,mapProjectionName);else point=[parseFloat(coords[0]),parseFloat(coords[1])]}if(point!=null){var extent=
map.getView().calculateExtent(map.getSize());var buffer=(extent[2]-extent[0])*4;if(buffer<0)buffer*=-1;extent=ol.extent.buffer(extent,buffer);var isZoomOutNeeded=!ol.extent.containsCoordinate(extent,point);if(map.getView().getZoom()>=12&&isZoomOutNeeded){var view=map.getView();view.animate({center:point,zoom:10,duration:1E3});if(mapZoomAnimationTimeoutId)clearTimeout(mapZoomAnimationTimeoutId);mapZoomAnimationTimeoutId=setTimeout(function(){var view=map.getView();view.animate({zoom:zoomlevel,duration:1E3})},
2E3)}else{var view=map.getView();view.animate({center:point,zoom:zoomlevel,duration:2E3})}}if(Liferay.Browser.isMobile())$(".portlet-header-button, .portlet-title").click()});
Liferay.on("vipnrw-show-wfs-feature-popup",function(parameter){var pointString=parameter.point;var identifier=parameter.identifier;var projection=parameter.projection;var point=null;if(pointString!=null){var coords=pointString.split(",");if(coords.length==2)if(projection!=null&&projection!=mapProjectionName)point=new ol.proj.transform([parseFloat(coords[0]),parseFloat(coords[1])],projection,mapProjectionName);else point=[parseFloat(coords[0]),parseFloat(coords[1])]}if(point!=null){map.getView().setZoom(13);
map.getView().setCenter(point);showWfsFeatureInfoPopup(point,[identifier])}});
Liferay.on("vipnrw-flip-route-points",function(parameter){var vectorSource=mapRoutingLayer.getSource();var features=vectorSource.getFeatures();var viaCount=0;for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia)viaCount++;var startFeature=null;var targetFeature=null;var viasFeatures=[];for(var i=0;i<features.length;i++)if(features[i].get("type")==pointNameVia)features[i].setId(pointNameVia+features[i].get("viaIndex")+"_old");for(var i=0;i<features.length;i++)if(features[i].get("type")==
pointNameVia){var newViaIndex=viaCount-(features[i].get("viaIndex")+1);features[i].set("viaIndex",newViaIndex);features[i].set("translation",newViaIndex+1+". "+"Zwischenziel entfernen");features[i].setId(pointNameVia+newViaIndex);var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);viasFeatures.push({lat:pos[0],lon:pos[1],viaIndex:features[i].get("viaIndex"),type:pointNameVia,latWgs84:posWgs84[1],lonWgs84:posWgs84[0]})}else if(features[i].get("type")==
pointNameStart){var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);targetFeature={lat:pos[0],lon:pos[1],viaIndex:null,type:pointNameTarget,latWgs84:posWgs84[1],lonWgs84:posWgs84[0]}}else if(features[i].get("type")==pointNameTarget){var pos=features[i].getGeometry().getCoordinates();var posWgs84=new ol.proj.transform(pos,mapProjectionName,wgs84ProjectionName);startFeature={lat:pos[0],lon:pos[1],viaIndex:null,type:pointNameStart,
latWgs84:posWgs84[1],lonWgs84:posWgs84[0]}}var feature=vectorSource.getFeatureById(pointNameStart);if(feature!=null&&startFeature!=null){feature.set("address","");feature.setGeometry(new ol.geom.Point([startFeature.lat,startFeature.lon]))}else if(feature==null&&startFeature!=null){removeFeature(pointNameTarget);setStartPoint(startFeature.lat,startFeature.lon)}feature=vectorSource.getFeatureById(pointNameTarget);if(feature!=null&&targetFeature!=null){feature.set("address","");feature.setGeometry(new ol.geom.Point([targetFeature.lat,
targetFeature.lon]))}else if(feature==null&&targetFeature!=null){removeFeature(pointNameStart);setTargetPoint(targetFeature.lat,targetFeature.lon)}Liferay.fire("vipnrw-routing-portlet-update-all-points",{startPoint:startFeature,targetPoint:targetFeature,viaPoints:viasFeatures});drawRoute()});
Liferay.on("vipnrw-set-route-point-name",function(parameter){var pointType=parameter.pointType;var viaIndex=parameter.viaIndex;var name=parameter.name;if(pointType==pointNameStart){var vectorSource=mapRoutingLayer.getSource();var feature=vectorSource.getFeatureById(pointType);if(feature)feature.set("address",addNewLineRoutePointText(name,25,"\n"))}else if(pointType==pointNameTarget){var vectorSource=mapRoutingLayer.getSource();var feature=vectorSource.getFeatureById(pointType);if(feature)feature.set("address",
addNewLineRoutePointText(name,25,"\n"))}else if(pointType==pointNameVia&&viaIndex!=null);});function addNewLineRoutePointText(text,width,spaceReplacer){if(text.length>width){var p=width;while(p>0&&(text[p]!=" "&&text[p]!="-"))p--;if(p>0){var left;if(text.substring(p,p+1)=="-")left=text.substring(0,p+1);else left=text.substring(0,p);var right=text.substring(p+1);return left+spaceReplacer+addNewLineRoutePointText(right,width,spaceReplacer)}}return text}
Liferay.on("vipnrw-toggle-car-route",function(parameter){var disabled=parameter.disbale;var updateRoute=parameter.updateRoute;if(updateRoute){if(disabled){Liferay.fire("vipnrw-remove-car-route");clearSessionRoute()}else{var res=findfeaturePoints();if(isInputValidForRouting(res)){Liferay.fire("vipnrw-remove-car-route");drawCarRoute(res)}}clearDynamicLayersTileCache();if(MapRoutesHandler.getInstance().showCarRoutes){if(!$(mapToolbarCar).hasClass("selected"))$(mapToolbarCar).addClass("selected");wmsLayerLos.setVisible(true);
wmsLayerTrafficMessageLines.setVisible(true);wmsLayerRoadworkLines.setVisible(true);wmsLayerPlannedLines.setVisible(false);wmsLayerLosColorBlind.setVisible(false);isLosVisible=true;isLosColorBlindVisible=false;isRoadworksVisible=true;isObstructionsVisible=true;isWebcamsVisible=true;isParkingInfosVisible=true;isPlannedLayerVisible=false}else{if($(mapToolbarCar).hasClass("selected"))$(mapToolbarCar).removeClass("selected");wmsLayerLos.setVisible(false);wmsLayerLosColorBlind.setVisible(false);wmsLayerTrafficMessageLines.setVisible(false);
wmsLayerRoadworkLines.setVisible(false);wmsLayerPlannedLines.setVisible(false);isLosVisible=false;isLosColorBlindVisible=false;isRoadworksVisible=false;isObstructionsVisible=false;isWebcamsVisible=false;isParkingInfosVisible=false;isPlannedLayerVisible=false}updateMapToolbarLayerMenu();handleWfsLayersUpdate();updateMapLayerCookie()}});
Liferay.on("vipnrw-toggle-public-transport-route",function(parameter){var disabled=parameter.disbale;var updateRoute=parameter.updateRoute;if(updateRoute){if(disabled)Liferay.fire("vipnrw-remove-public-transport-route");else{var res=findfeaturePoints();if(isInputValidForRouting(res)){Liferay.fire("vipnrw-remove-public-transport-route");Liferay.fire("vipnrw-public-transport-route-started");getNewPublicTransportRoute(res)}}clearDynamicLayersTileCache();if(MapRoutesHandler.getInstance().showPtRoutes){if(!$(mapToolbarPublicTransport).hasClass("selected"))$(mapToolbarPublicTransport).addClass("selected");
isStationsVisible=true}else{if($(mapToolbarPublicTransport).hasClass("selected"))$(mapToolbarPublicTransport).removeClass("selected");isStationsVisible=false}updateMapToolbarLayerMenu();handleWfsLayersUpdate();updateMapLayerCookie()}});
Liferay.on("vipnrw-toggle-bike-route",function(parameter){var disabled=parameter.disbale;var updateRoute=parameter.updateRoute;if(updateRoute){if(disabled)Liferay.fire("vipnrw-remove-bike-route");else{var res=findfeaturePoints();if(isInputValidForRouting(res)){Liferay.fire("vipnrw-remove-bike-route");getNewBikeRoute(res)}}if(MapRoutesHandler.getInstance().showBikeRoutes){if(!$(mapToolbarBike).hasClass("selected"))$(mapToolbarBike).addClass("selected")}else if($(mapToolbarBike).hasClass("selected"))$(mapToolbarBike).removeClass("selected")}});
Liferay.on("vipnrw-toggle-intermodal-route",function(parameter){var disabled=parameter.disbale;var updateRoute=parameter.updateRoute;if(updateRoute){if(disabled)Liferay.fire("vipnrw-remove-intermodal-route");else{var routingPoints=findfeaturePoints();if(isInputValidForRouting(routingPoints)){Liferay.fire("vipnrw-remove-intermodal-route");drawIntermodalRoute(routingPoints)}}if(MapRoutesHandler.getInstance().showIntermodalRoutes){if(!$(mapToolbarIntermodal).hasClass("selected"))$(mapToolbarIntermodal).addClass("selected")}else if($(mapToolbarIntermodal).hasClass("selected"))$(mapToolbarIntermodal).removeClass("selected")}});
Liferay.on("vipnrw-draw-bike-route",function(parameter){if(parameter!=null&&MapRoutesHandler.getInstance().showBikeRoutes){var totalDistance=parameter.totalDistance;var totalDuration=parameter.totalDuration;var linestring=parameter.linestring;drawBikeRoute(totalDistance,totalDuration,linestring)}});Liferay.on("vipnrw-draw-public-transport-route",function(parameter){if(parameter!=null&&MapRoutesHandler.getInstance().showPtRoutes)showPublicTransportCoordinatesRoute(parameter.selection)});
Liferay.on("vipnrw-update-bike-popup",function(parameter){if(parameter!=null&&MapRoutesHandler.getInstance().showBikeRoutes){var totalDistance=parameter.totalDistance;var totalDuration=parameter.totalDuration;updateBikeRouteDuration(totalDistance,totalDuration)}});Liferay.on("vipnrw-update-bike-route",function(parameter){requestBikeRouteAjax(tmpPoints)});
Liferay.on("vipnrw-zoom-to-extent",function(parameter){var extent=parameter.extent;var projection=parameter.projection;if(extent&&extent.length==4){if(projection!=null&&projection!=mapProjectionName){var pointA=new ol.proj.transform([extent[0],extent[3]],projection,mapProjectionName);var pointB=new ol.proj.transform([extent[2],extent[1]],projection,mapProjectionName)}else{var pointA=[extent[0],extent[3]];var pointB=[extent[2],extent[1]]}var correctExtent=[pointA[0],pointA[1],pointB[0],pointB[1]];
if(ol.extent.isEmpty(correctExtent));map.getView().fit(correctExtent,map.getSize())}});
Liferay.on("vipnrw-zoom-to-coordinate",function(parameter){var lat=parameter.lat;var lon=parameter.lon;var text=parameter.text;var width=parameter.width;var projection=parameter.projection;if(lat!=null&&lon!=null){if(map.getView().getZoom()<14)map.getView().setZoom(14);var point=null;if(projection!=null&&projection!=mapProjectionName)point=new ol.proj.transform([lon,lat],projection,mapProjectionName);else point=[lon,lat];if(text!=null&&text.length>0)showWfsFeatureInfo(text,point,width);map.getView().setCenter(point)}});
Liferay.on("vipnrw-zoom-to-point",function(parameter){var pointType=parameter.type;var viaIndex=parameter.viaIndex;if(pointType){var feature=null;var vectorSource=mapRoutingLayer.getSource();if(pointType==pointNameStart)feature=vectorSource.getFeatureById(pointNameStart);else if(pointType==pointNameTarget)feature=vectorSource.getFeatureById(pointNameTarget);else if(pointType==pointNameVia&&viaIndex!=null)feature=vectorSource.getFeatureById(pointType+viaIndex);if(feature){if(map.getView().getZoom()<
12)map.getView().setZoom(12);map.getView().setCenter(feature.getGeometry().getCoordinates())}else console.warn("Unable to find correct route point: "+parameter)}});
Liferay.on("vipnrw-map-portlet-point-update",function(parameter){var action=parameter.action;var type=parameter.type;var viaIndex=parameter.viaIndex;var lat=parameter.lat;var lon=parameter.lon;var extent=parameter.extent;var projectionName=parameter.projectionName;var point=null;if(projectionName!=null&&projectionName!=mapProjectionName)if((lat==null||lon==null)&&extent!=null){var tmpPoint=ol.extent.getCenter(extent);if(tmpPoint)point=new ol.proj.transform(tmpPoint,projectionName,mapProjectionName)}else point=
new ol.proj.transform([lon,lat],projectionName,mapProjectionName);else if((lat==null||lon==null)&&extent!=null)point=ol.extent.getCenter(extent);else if(lat!=null&&lon!=null)point=[lat,lon];if(action&&action=="remove")if(type==pointNameVia)removeFeature(pointNameVia+viaIndex);else if(type==pointNameStart)removeFeature(pointNameStart);else{if(type==pointNameTarget)removeFeature(pointNameTarget)}else if(action&&action=="update"&&point!=null)if(type==pointNameVia){var currentViaCount=countViaFeatures();
if(currentViaCount>viaIndex){var featureId=pointNameVia+viaIndex;var vectorSource=mapRoutingLayer.getSource();var feature=vectorSource.getFeatureById(featureId);var pointGeom=new ol.geom.Point(point);if(feature){feature.setGeometry(pointGeom);drawRoute();updateAllRoutingPortletPoints(feature)}}else routeViaHere(point[0],point[1])}else if(type==pointNameStart)routeStartHere(point[0],point[1]);else if(type==pointNameTarget)routeEndHere(point[0],point[1])});
var lastMarqueeStart=0;var marqueeStopped=0;var isMarqueeRunning=true;var MAX_ELEMENTS=7;
function initMarqueeNews(){$.ajax({cache:false,url:newsPortletResourceURL,dataType:"json",timeout:3E4,type:"POST",data:{action:"getArticlePreview"},success:function(data){if(data!=null&&data.length>0){$(".marquee").empty();var marqueeWidth=0;for(var i=0;i<data.length;i++){var customJournalArticle=data[i];var imgHtml="";if(customJournalArticle.imageURL!=null)imgHtml='\x3cimg src\x3d"'+customJournalArticle.imageURL+'"\x3e ';var onclick='onclick\x3d"showMarqueeNewsArticle('+customJournalArticle.position+
');"';if(imgHtml!=""){var element=$('\x3cdiv class\x3d"marquee-element" '+onclick+"\x3e"+imgHtml+'\x3cdiv class\x3d"marquee-element marquee-element-title"\x3e'+customJournalArticle.title+"\x3c/div\x3e"+"\x3c/div\x3e");$(".marquee").append(element);marqueeWidth+=element.width()}else{var element=$('\x3cdiv class\x3d"marquee-element" '+onclick+"\x3e"+'\x3cdiv class\x3d"marquee-element marquee-element-title"\x3e'+customJournalArticle.title+"\x3c/div\x3e"+"\x3c/div\x3e");$(".marquee").append(element);
marqueeWidth+=element.width()}if(i===MAX_ELEMENTS)break}if(marqueeWidth>0){var speed=40;var marqueeMinWidth=marqueeWidth<120?120:marqueeWidth;var time=marqueeMinWidth/speed;document.getElementById("marquee").style.width=marqueeWidth+"px";document.getElementById("marquee").style.animationDuration=time+"s";document.getElementById("marquee").style.WebkitAnimationDuration=time+"s"}}},error:function(){}})}
function showMarqueeNewsArticle(position){Liferay.fire("vipnrw-maximize-portlet",{portletId:"_de_strassennrw_vipnrw_portlet_news_portlet_NewsPortlet_",position:position,userAction:UserAction.CLICK_MARQUEE})};
function cutContent(counter){var tmpDiv=$("#"+newsPortletNamespace+"content"+counter);var text=tmpDiv.text();tmpDiv.text(cutText(text))}function cutText(text){var tmpTxt=text;if(tmpTxt&&tmpTxt.length>abstractLength){tmpTxt=tmpTxt.substring(0,abstractLength);tmpTxt+=" ..."}return tmpTxt}function fadeToArticle(event){var position=event.data.position;$("#"+newsPortletNamespace+"newsTable").stop().animate({"opacity":"0"},400,function(){getArticleData(position)})}
function createArticleTable(title,subtitle,imageUrl,content){var articleDiv=$("#"+newsPortletNamespace+"newsArticleDiv");articleDiv.empty();var html="";html+='\x3ctable style\x3d"width:100%"\x3e'+"\x3ctr\x3e"+'\x3ctd class\x3d"news-css vip-news-title-article"\x3e'+title+"\x3c/td\x3e"+'\x3ctd class\x3d"news-css vip-news-title-article" style\x3d"white-space: nowrap; vertical-align: baseline;"\x3e'+'\x3cdiv id\x3d"'+newsPortletNamespace+'newsArticleReturn" class\x3d"news-css vip-news-url-article"\x3e\u00ab '+
"Zur\u00fcck"+"\x3c/div\x3e"+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3ctr\x3e"+'\x3ctd class\x3d"news-css vip-news-sub-title-article" colspan\x3d"2"\x3e'+subtitle+"\x3c/td\x3e"+"\x3c/tr\x3e"+'\x3ctr style\x3d"vertical-align: baseline;"\x3e'+'\x3ctd colspan\x3d"2"\x3e'+"\x3cdiv\x3e";if(imageUrl&&imageUrl.length>0)html+='\x3cimg class\x3d"news-css vip-news-image-article" src\x3d"'+imageUrl+'"\x3e';html+=content+"\x3c/div\x3e"+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e";articleDiv.html(html);articleDiv.css("opacity",
"0");articleDiv.css("display","block");$("#"+newsPortletNamespace+"newsTable").css("display","none");articleDiv.stop().animate({"opacity":"1"},500,function(){articleDiv.css("opacity","1");var articleReturn=$("#"+newsPortletNamespace+"newsArticleReturn");articleReturn.click(function(){returnToOverview()})})}
function getArticleData(position){$.ajax({cache:false,url:newsPortletResourceURL,dataType:"json",timeout:3E4,data:{action:"getArticle",position:position},success:function(data){if(data==null||data.length==0)createArticleTable("No article with id: "+position+"",null,"");else createArticleTable(data.title,data.subTitle,data.imageURL,data.content)},error:function(){console.error("error: getArticle : "+position);returnToOverview()}})}
function returnToOverview(){var articleDiv=$("#"+newsPortletNamespace+"newsArticleDiv");articleDiv.empty();articleDiv.css("opacity","0");articleDiv.css("display","none");$("#"+newsPortletNamespace+"newsTable").css("display","");$("#"+newsPortletNamespace+"newsTable").stop().animate({"opacity":"1"},400,function(){$("#"+newsPortletNamespace+"newsTable").css("opacity","1")})}
function refreshNewsPreview(){setTimeout(function(){$.ajax({cache:false,url:newsPortletResourceURL,dataType:"json",timeout:3E4,data:{action:"getArticlePreview"},beforeSend:function(){$("#"+newsPortletNamespace+"newsTable").html('\x3ctr\x3e\x3ctd class\x3d"news-css vip-news-info-table-row"\x3e\x3cdiv style\x3d"display: inline-block;"\x3e\x3cdiv class\x3d"news-css loader"\x3e\x3c/div\x3e '+"Lade Artikel..."+"\x3c/div\x3e\x3c/td\x3e\x3c/tr\x3e")},success:function(data){if(data!=null&&data.length>0)buildNewsPreviewTable(data);
else $("#"+newsPortletNamespace+"newsTable").html('\x3ctr\x3e\x3ctd class\x3d"news-css vip-news-info-table-row"\x3e'+"Es wurden keine Artikel gefunden."+"\x3c/td\x3e\x3c/tr\x3e")},error:function(){$("#"+newsPortletNamespace+"newsTable").empty();$("#"+newsPortletNamespace+"newsTable").html('\x3ctr\x3e\x3ctd class\x3d"news-css vip-news-info-table-row"\x3e'+"Es wurden keine Artikel gefunden."+"\x3c/td\x3e\x3c/tr\x3e")}})},500)}
function buildNewsPreviewTable(data){$("#"+newsPortletNamespace+"newsTable").empty();for(var i=0;i<data.length;i++){var customJournalArticle=data[i];var imageHtml="";if(customJournalArticle.imageURL!=null&&customJournalArticle.imageURL!="")imageHtml='\x3cimg alt\x3d"!NO-IMAGE" class\x3d"news-css vip-news-image" src\x3d"'+customJournalArticle.imageURL+'"/\x3e';else imageHtml='\x3cdiv class\x3d"news-css vip-news-image" style\x3d"visibility: hidden;" /\x3e';var htmlTableRow="\x3ctr\x3e"+'\x3ctd id\x3d"'+
newsPortletNamespace+"newsTableRow"+i+'" class\x3d"news-css vip-news-row-div" title\x3d"'+customJournalArticle.title+'"\x3e'+'\x3cinput id\x3d"'+newsPortletNamespace+"newsTableRowArticleId"+i+'" type\x3d"hidden" value\x3d"'+customJournalArticle.position+'"\x3e'+'\x3cdiv class\x3d"news-css vip-news-top-space"\x3e\x3c/div\x3e'+'\x3ctable cellspacing\x3d"0" cellpadding\x3d"0" border\x3d"0" style\x3d"min-height: 100px;"\x3e'+'\x3ctr style\x3d"height: 0%;"\x3e'+'\x3ctd rowspan\x3d"3" class\x3d"news-css vip-news-img-column"\x3e'+
'\x3cdiv class\x3d"news-css vip-news-image-div" title\x3d"'+customJournalArticle.title+'"\x3e'+imageHtml+"\x3c/div\x3e"+"\x3c/td\x3e"+'\x3ctd class\x3d"news-css vip-news-title" title\x3d"'+customJournalArticle.title+'"\x3e'+customJournalArticle.title+"\x3c/td\x3e"+"\x3c/tr\x3e"+'\x3ctr style\x3d"height: 0%;"\x3e'+"\x3ctd\x3e"+'\x3cdiv class\x3d"news-css vip-news-sub-title" title\x3d"'+customJournalArticle.title+'"\x3e'+customJournalArticle.subTitle+"\x3c/div\x3e\t"+"\x3c/td\x3e"+"\x3c/tr\x3e"+'\x3ctr style\x3d"vertical-align: baseline;"\x3e'+
"\x3ctd\x3e"+'\x3cdiv class\x3d"'+newsPortletNamespace+'content" \x3e'+customJournalArticle.content+"\x3c/div\x3e"+'\x3clabel class\x3d"news-css vip-news-more"\x3e'+"mehr"+" \u00bb\x3c/label\x3e"+"\x3c/td\x3e"+"\x3c/tr\x3e"+"\x3c/table\x3e"+'\x3cdiv class\x3d"news-css vip-news-divider"\x3e'+"\x3c/div\x3e"+"\x3c/td\x3e"+"\x3c/tr\x3e";$("#"+newsPortletNamespace+"newsTable").append(htmlTableRow)}$("."+newsPortletNamespace+"content").each(function(){var text=$(this).text();$(this).text(cutText(text))});
registerNewsPortletClickHandler(data)}function registerNewsPortletClickHandler(data){if(data!=null&&data.length>0)for(var i=0;i<data.length;i++){var tableRow=$("#"+newsPortletNamespace+"newsTableRow"+i);tableRow.bind("click",{"position":data[i].position},fadeToArticle)}};
Liferay.on("vipnrw-setPortletMaxHeight",function(data){var height=data.details[0];setNewsMaxContentHeight(height)});
function setNewsMaxContentHeight(height){if(height==null){height=0;if(typeof window.innerWidth=="number")height=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))height=document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight))height=document.body.clientHeight}var minHeight=300;var maxHeight=567;var bottomDistance=310;if(height-bottomDistance>minHeight)minHeight=
height-bottomDistance;if(minHeight>maxHeight)minHeight=maxHeight;if(typeof newsPortletNamespace!="undefined"){var div=$("#"+newsPortletNamespace+"news");div.css("max-height",minHeight+"px")}}Liferay.on("vipnrw-refresh-portlet-content",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==newsPortletNamespace)refreshNewsPreview()});
Liferay.on("restore-portlet-width",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==newsPortletNamespace)$(".info-slider").css("width","")});Liferay.on("vipnrw-window-resize",function(parameter){updateNewsContentScrollHeight()});Liferay.on("vipnrw-maximize-portlet",function(parameter){});
Liferay.on("vipnrw-after-maximize-portlet",function(parameter){if(typeof newsPortletNamespace!="undefined"){var portletId=parameter.portletId;if(portletId&&(portletId==newsPortletNamespace||"_"+portletId+"_"==newsPortletNamespace)){refreshNewsPreview();initMarqueeNews();if(parameter!=null&&parameter.position!=null)$("#"+newsPortletNamespace+"newsTable").stop().animate({"opacity":"0"},400,function(){getArticleData(parameter.position)})}}});
var selectedRoadsContentDiv=null;var selectedMessageContentDiv=$("#"+road_details_portlet_id+"warnings-messages");var selectedCategory=null;
function retrieveRoadSigns(){clearErrorMessages();var html="";$.ajax({url:road_details_portlet_resource_url,type:"POST",datatype:"json",timeout:6E4,data:{action:road_sign_action,trafficCategory:selectedCategory,startDate:getTrafficMessageDate(),durationInDays:getTrafficMessageDays()},success:function(data){if(data!=null){var content=JSON.parse(data);if(content.error!=null)addErrorMessage(content.error);html=convertTrafficRoadSignsToHtml(content);if(html)selectedRoadsContentDiv.html(html);else selectedRoadsContentDiv.html("Keine Eintr\u00e4ge gefunden")}else error()},
fail:function(jqXHR,textStatus,errorThrown){error();console.error(errorThrown)}})}
function retrieveRoadMessages(roadnumber){clearErrorMessages();$.ajax({url:road_details_portlet_resource_url,type:"POST",datatype:"json",timeout:12E4,data:{action:road_messages_action,trafficCategory:selectedCategory,roadNumber:roadnumber,startDate:getTrafficMessageDate(),durationInDays:getTrafficMessageDays()},success:function(data){if(data!=null&&data!==""){var content=JSON.parse(data);var html="";var trafficContent=null;if(content.error!=null)addErrorMessage(content.error);changeDivVisibility("none",
"flex");trafficContent=convertTrafficObjectsToHtml(content,true);if(trafficContent)html+=trafficContent;else html+="vipnrw.traffic.road.nodata";var trafficObjects=$('\x3cdiv id\x3d"road-traffic-objects"\x3e\x3c/div\x3e');trafficObjects.css({"display":"flex","flex-wrap":"wrap"});trafficObjects.append(html);trafficObjects.children().each(function(){$(this).addClass("inside-portlet")});selectedMessageContentDiv.empty().append(trafficObjects)}else{error();changeDivVisibility("flex","none");selectedMessageContentDiv.html("")}},
fail:function(jqXHR,textStatus,errorThrown){error();changeDivVisibility("flex","none");selectedMessageContentDiv.html("");console.error(errorThrown)}})}
function convertTrafficRoadSignsToHtml(data){var html=$("\x3cdiv\x3e");if(data&&data.roads){var roads=data.roads;var highwayRoads=[];var federalRoads=[];var countryRoads=[];var countyRoads=[];var trafficSignRegex=/([ABKLabkl])(\d+)([A-Z]*[a-z]*)/;for(var i=0;i<roads.length;i++)if(roads[i]!=null){var regexResult=roads[i].match(trafficSignRegex);if(regexResult!=null&&regexResult.length==4)if(regexResult[1]=="A")highwayRoads.push(regexResult);else if(regexResult[1]=="B")federalRoads.push(regexResult);
else if(regexResult[1]=="L")countryRoads.push(regexResult);else if(regexResult[1]=="K")countyRoads.push(regexResult)}try{highwayRoads.sort(function(a,b){return a[2]-b[2]});federalRoads.sort(function(a,b){return a[2]-b[2]});countryRoads.sort(function(a,b){return a[2]-b[2]});countyRoads.sort(function(a,b){return a[2]-b[2]})}catch(e){console.error("Unable to sort road signs!")}var highwayRoadsDiv=$("\x3cdiv\x3e");for(var i=0;i<highwayRoads.length;i++){var onClickHandle="onclick\x3d\"retrieveRoadMessages('"+
highwayRoads[i][0]+"')\"";highwayRoadsDiv.append("\x3cdiv "+onClickHandle+' class\x3d"vipnrw-road-sign-highway traffic-road-highway" title\x3d"'+highwayRoads[i][0]+'"\x3e'+highwayRoads[i][2]+highwayRoads[i][3]+"\x3c/div\x3e")}html.append(highwayRoadsDiv);var federalRoadsDiv=$("\x3cdiv\x3e");for(var i=0;i<federalRoads.length;i++){var onClickHandle="onclick\x3d\"retrieveRoadMessages('"+federalRoads[i][0]+"')\"";federalRoadsDiv.append("\x3cdiv "+onClickHandle+' class\x3d"vipnrw-road-sign-country traffic-road-country" title\x3d"'+
federalRoads[i][0]+'"\x3e'+federalRoads[i][2]+federalRoads[i][3]+"\x3c/div\x3e")}html.append(federalRoadsDiv);var countryRoadsDiv=$("\x3cdiv\x3e");for(var i=0;i<countryRoads.length;i++){var onClickHandle="onclick\x3d\"retrieveRoadMessages('"+countryRoads[i][0]+"')\"";countryRoadsDiv.append("\x3cdiv "+onClickHandle+' class\x3d"vipnrw-road-sign-county traffic-road-county" title\x3d"'+countryRoads[i][0]+'"\x3e'+countryRoads[i][2]+countryRoads[i][3]+"\x3c/div\x3e")}html.append(countryRoadsDiv);var countyRoadsDiv=
$("\x3cdiv\x3e");for(var i=0;i<countyRoads.length;i++){var onClickHandle="onclick\x3d\"retrieveRoadMessages('"+countyRoads[i][0]+"')\"";countyRoadsDiv.append("\x3cdiv "+onClickHandle+' class\x3d"vipnrw-road-sign-county2 traffic-road-county" title\x3d"'+countyRoads[i][0]+'"\x3e'+countyRoads[i][2]+countyRoads[i][3]+"\x3c/div\x3e")}html.append(countyRoadsDiv)}return html}function error(){addErrorMessage("Fehler beim holen der Daten.");selectedRoadsContentDiv.html("Keine Eintr\u00e4ge gefunden")}
function clearErrorMessages(){$("#"+road_details_portlet_id+"errorMsg").html("");$("#"+road_details_portlet_id+"errorMsg").css("display","none")}function addErrorMessage(message){$("#"+road_details_portlet_id+"errorMsg").append('\x3cdiv class\x3d"portlet-msg-error"\x3e'+message+"\x3c/div\x3e");$("#"+road_details_portlet_id+"errorMsg").css("display","flex")}function clearTrafficRoadContent(){changeDivVisibility("flex","none")}
function back(){changeDivVisibility("flex","none");selectedMessageContentDiv.html("")}function changeDivVisibility(roadStyle,messageStyle){if(selectedRoadsContentDiv!=null)selectedRoadsContentDiv.css("display",roadStyle);var hideMessagesDiv=messageStyle==="none";if(selectedMessageContentDiv!=null)selectedMessageContentDiv.css("display",messageStyle);if(hideMessagesDiv)$("#"+road_details_portlet_id+"back").css("display","none");else $("#"+road_details_portlet_id+"back").css("display","flex")};
Liferay.on("vipnrw-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==road_details_portlet_id)roadDetailsWarningsTabClick()});Liferay.on("vipnrw-after-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==road_details_portlet_id)roadDetailsWarningsTabClick()});Liferay.on("vipnrw-after-portlet-resize",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==road_details_portlet_id)updateRoadDetailsPortletWidth()});
Liferay.on("restore-portlet-width",function(parameter){var portletId=parameter.portletId;if(portletId&&portletId==road_details_portlet_id){$(".info-slider").css("width","");updateRoadDetailsPortletWidth()}});
function updateRoadDetailsPortletWidth(){var labels=$("#"+road_details_portlet_id+"detailTabs li label");labels.each(function(n){$(this).css("display","inline")});var portletWidth=$("#"+road_details_portlet_id+"detailTabs").width();var tabs=$("#"+road_details_portlet_id+"detailTabs li");var overallWidth=0;tabs.each(function(n){var tabWidth=$(this).outerWidth(true);overallWidth+=tabWidth});if(portletWidth<overallWidth+10){var labels=$("#"+road_details_portlet_id+"detailTabs li label");labels.each(function(n){$(this).css("display",
"none")})}}function roadDetailsWarningsTabClick(){selectedRoadsContentDiv=$("#"+road_details_portlet_id+"warnings-roads");selectedMessageContentDiv=$("#"+road_details_portlet_id+"warnings-messages");clearTrafficRoadContent();selectedCategory="WARNING";retrieveRoadSigns()}
function roadDetailsObstructionsTabClick(){selectedRoadsContentDiv=$("#"+road_details_portlet_id+"obstructions-roads");selectedMessageContentDiv=$("#"+road_details_portlet_id+"obstructions-messages");clearTrafficRoadContent();selectedCategory="CLOSURE";retrieveRoadSigns()}
function roadDetailsRoadworksTabClick(){selectedRoadsContentDiv=$("#"+road_details_portlet_id+"roadworks-roads");selectedMessageContentDiv=$("#"+road_details_portlet_id+"roadworks-messages");clearTrafficRoadContent();selectedCategory="ROADWORKS";retrieveRoadSigns()}
function roadDetailsWebcamsTabClick(){selectedRoadsContentDiv=$("#"+road_details_portlet_id+"webcams-roads");selectedMessageContentDiv=$("#"+road_details_portlet_id+"webcams-messages");clearTrafficRoadContent();selectedCategory="WEBCAM";retrieveRoadSigns()};
var routingStartPositionName="";var routingTargetPositionName="";var routingSummaryText="";
function initRoutingPortlet(){try{$("#"+routing_portlet_id+"transportTabs").tabs();$("#"+routing_portlet_id+"busRouteTabs").tabs();$("#"+routing_portlet_id+"intermodalRouteTabs").tabs();initRoutingInput();initRoutingPortletAreas();initRoutingPortletSettings();checkFavTabIcon();$("#"+routing_portlet_id+"dialogSaveRouteName").dialog({autoOpen:false,resizable:false,height:"auto",width:"auto",modal:true,buttons:{"Speichern":function(){saveOneRoute($("#"+routing_portlet_id+"saveRouteNameTextArea").val());
$(this).dialog("close")},"Abbrechen":function(){$(this).dialog("close")}}});$("#"+routing_portlet_id+"saveRouteButton").on("click",function(){var name=getSavedRouteName();$("#"+routing_portlet_id+"saveRouteNameTextArea").val(name);$("#"+routing_portlet_id+"dialogSaveRouteName").dialog("open");$("#"+routing_portlet_id+"dialogSaveRouteName").parent().css("z-index",1E3)});initRoutingPortletSavedRoutes();initRoutingPortletAreas();initRoutingPortletCar();initRoutingPortletBike();$("#"+routing_portlet_id+
"printBusRouteButton").click(function(){var logo=$(".logo").clone();logo.css("text-align","right");var selection=$("#"+routing_portlet_id+"busAccordion").find(".ui-accordion-header-active").clone();var content=$("#"+routing_portlet_id+"busAccordion").find(".ui-accordion-content-active").clone();addUserBehavior(UserAction.CLICK_PUBLIC_TRANSPORT_ROUTE_PRINT);$("\x3cdiv\x3e\x3c/div\x3e").append(logo).append(selection).append(content).printMe()})}catch(e){console.error(e)}}
function updateRoutingPortletPrintViewHeader(){var headerText="";if(routingStartPositionName!=null&&routingStartPositionName.length>0)headerText+=routingStartPositionName;if(routingTargetPositionName!=null&&routingTargetPositionName.length>0){if(headerText.length>0)headerText+="\x26nbsp;\x26nbsp;\x26nbsp;nach\x26nbsp;\x26nbsp;\x26nbsp;";headerText+=routingTargetPositionName}if(routingSummaryText!=null&&routingSummaryText.length>0){if(headerText.length>0)headerText+="\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;";
headerText+="\x3cdiv\x3e"+routingSummaryText+"\x3c/div\x3e"}Liferay.fire("vipnrw-theme-header-update",{headerText:headerText})}
function pathWayExtension(padding){padding="0";var a='\x3cdiv style\x3d"width: 100%; padding: 0 '+padding+'; border-spacing: 0; border: none; margin-top: 8px; color:#9e9e9e;"\x3e';a+="\x3cp\x3e"+"Die Fahrroute und auch die Verkehrshinweise in Verkehr.NRW dienen allein der Planung. Es ist m\u00f6glich, dass sich die Lage auf den Stra\u00dfen und Wegen anders darstellt bspw. auf Grund von sonstigen Vorf\u00e4llen, Sachlagen oder Wetter."+"\x3c/p\x3e";a+="\x3c/div\x3e";return a};
var tmpPoints=null;var initial=true;function markSummarySelection(elementToMark,color){if(color){elementToMark.css("background-color",color);elementToMark.css("color","black");elementToMark.css("border","1px solid #243855")}else{elementToMark.css("background-color","#243855");elementToMark.css("color","white");elementToMark.find("img").css("filter","invert(100%)")}elementToMark.addClass("selected")}
function unmarkSummarySelection(elementToUnmark){elementToUnmark.removeAttr("style");elementToUnmark.find("img").removeAttr("style");elementToUnmark.removeClass("selected")}
Liferay.on("vipnrw-update-ptroutesummary-selection",function(parameter){setCookie("pt.routesummary.selection",parameter.selection);$(".publicTransportSelection").each(function(index){if(index==parameter.selection){if($(this).hasClass("selected"))$("#"+routing_portlet_id+"transportTab-3-item").click();else{markSummarySelection($(this),"#a65628");restoreBusSelectionState()}Liferay.fire("vipnrw-draw-public-transport-route",{selection:parameter.selection})}else unmarkSummarySelection($(this))})});
Liferay.on("vipnrw-update-intermodalsummary-selection",function(parameter){setCookie("intermodal.routesummary.selection",parameter.selection);$(".intermodalSelection").each(function(index){if(index==parameter.selection){if($(this).hasClass("selected"))$("#"+routing_portlet_id+"transportTab-5-item").click();else{markSummarySelection($(this),"#984ea3");restoreIntermodalSelectionState()}addIntermpodalRoute(parameter.selection)}else unmarkSummarySelection($(this))})});
function disableTab(index){if($("#"+routing_portlet_id+"transportTabs").tabs("instance")){$("#"+routing_portlet_id+"transportTabs").tabs("disable",index);let active=$("#"+routing_portlet_id+"transportTabs").tabs("option","active");if(active==index)$("#"+routing_portlet_id+"transportTabs").tabs("option","active",0)}}function enableTab(index){if($("#"+routing_portlet_id+"transportTabs").tabs("instance"))$("#"+routing_portlet_id+"transportTabs").tabs("enable",index)}
Liferay.on("vipnrw-route-selection-update",function(parameter){if(!routing_portlet_printview){let routingIsPossible=cookieIsSet("map-view-route-start-point")&&cookieIsSet("map-view-route-target-point");if(getCookie("route-settings-car",MapRoutesHandler.getInstance().showCarRoutes))if(routingIsPossible)enableTab(1);else disableTab(1);else disableTab(1);if(getCookie("route-settings-publicTransport",MapRoutesHandler.getInstance().showPtRoutes))if(routingIsPossible)enableTab(2);else disableTab(2);else disableTab(2);
if(getCookie("route-settings-bike",MapRoutesHandler.getInstance().showBikeRoutes))if(routingIsPossible)enableTab(3);else disableTab(3);else disableTab(3);if(getCookie("route-settings-intermodal",MapRoutesHandler.getInstance().showIntermodalRoutes))if(routingIsPossible)enableTab(4);else disableTab(4);else disableTab(4)}});
Liferay.on("vipnrw-bike-route-exception",function(parameter){if(parameter&&parameter.error!=null){console.log("bikeroute exception "+parameter.error);let errorMessage="Fahrrad"+": "+"Keine Route gefunden.";var htmlError='\x3cdiv class\x3d"portlet-msg-error"\x3e'+errorMessage+"\x3c/div\x3e";$("#"+routing_portlet_id+"errorMsgBike").html(htmlError);$("#"+routing_portlet_id+"errorMsgBike").css("display","block");let errorMessageTimeout=5;vipnrwErrorMessage(errorMessage,"error",errorMessageTimeout,"bike-route");
setTimeout(function(){$("#"+routing_portlet_id+"errorMsgBike").fadeOut()},errorMessageTimeout*1E3);updateRoutingSummaryBike(parameter.error,false)}else{$("#"+routing_portlet_id+"errorMsgBike").empty();$("#"+routing_portlet_id+"errorMsgBike").css("display","none");updateRoutingSummaryBike("-",false)}$("#"+routing_portlet_id+"bikeRouteTab-1-loading").hide();$("#"+routing_portlet_id+"bikeRouteTab-2").empty()});
Liferay.on("vipnrw-car-route-exception",function(parameter){if(parameter&&parameter.error!=null){let errorMessage="Auto"+": "+parameter.error;var html='\x3cdiv class\x3d"portlet-msg-error"\x3e'+errorMessage+"\x3c/div\x3e";$("#"+routing_portlet_id+"errorMsgCar").html(html);$("#"+routing_portlet_id+"errorMsgCar").css("display","block");let errorMessageTimeout=5;vipnrwErrorMessage(errorMessage,"error",errorMessageTimeout,"car-route");setTimeout(function(){$("#"+routing_portlet_id+"errorMsgCar").fadeOut()},
errorMessageTimeout*1E3);updateRoutingSummaryCar(parameter.error,false)}else{$("#"+routing_portlet_id+"errorMsgCar").empty();$("#"+routing_portlet_id+"errorMsgCar").css("display","none");updateRoutingSummaryCar("-",false)}});
Liferay.on("vipnrw-public-transport-route-exception",function(parameter){if(parameter&&parameter.error!=null){let errorMessage="Bus \x26 Bahn"+": "+parameter.error;var html='\x3cdiv class\x3d"portlet-msg-error"\x3e'+errorMessage+"\x3c/div\x3e";$("#"+routing_portlet_id+"errorMsgPublicTransport").html(html);$("#"+routing_portlet_id+"errorMsgPublicTransport").css("display","block");let errorMessageTimeout=5;vipnrwErrorMessage(errorMessage,"error",errorMessageTimeout,"ov-route");setTimeout(function(){$("#"+
routing_portlet_id+"errorMsgPublicTransport").fadeOut()},errorMessageTimeout*1E3);updateRoutingSummaryBus(parameter.error,false)}else{$("#"+routing_portlet_id+"errorMsgPublicTransport").empty();$("#"+routing_portlet_id+"errorMsgPublicTransport").css("display","none");updateRoutingSummaryBus("-",false)}});
Liferay.on("vipnrw-intermodal-route-exception",function(parameter){if(parameter&&parameter.error!=null){let errorMessage="Intermodal"+": "+parameter.error;let html='\x3cdiv class\x3d"portlet-msg-error"\x3e'+errorMessage+"\x3c/div\x3e";$("#"+routing_portlet_id+"errorMsgIntermodal").html(html);$("#"+routing_portlet_id+"errorMsgIntermodal").css("display","block");let errorMessageTimeout=5;vipnrwErrorMessage(errorMessage,"error",errorMessageTimeout,"ov-route");setTimeout(function(){$("#"+routing_portlet_id+
"errorMsgIntermodal").fadeOut()},errorMessageTimeout*1E3);updateRoutingSummaryIntermodal(parameter.error,false)}else{$("#"+routing_portlet_id+"errorMsgIntermodal").fadeOut();$("#"+routing_portlet_id+"errorMsgIntermodal").css("display","none");updateRoutingSummaryBus("-",false)}});Liferay.on("vipnrw-car-route-update",function(parameter){updateCarSummary(parameter)});
Liferay.on("vipnrw-car-route-finished",function(parameter){clearCarRoutingTabs();if(routing_portlet_printview){if(routing_portlet_print_view_parameter=="car"){loadRoutingLos();loadTrafficObjects();if(parameter!=null)updateCarRoutingResponse(parameter);else{updateRoutingSummaryCar("");$("#"+routing_portlet_id+"carResultTab-3").empty()}}}else{if(currentCarRoutingActiveTab!=null)if(currentCarRoutingActiveTab=="LOS")loadRoutingLos();else if(currentCarRoutingActiveTab=="TrafficObjects")loadTrafficObjects();
else if(currentCarRoutingActiveTab=="PREDICTION")loadLongTimePrediction();else if(currentCarRoutingActiveTab=="CONGESTION")loadCongestionPrediction();let carRouteIsChecked=true;if(parameter!=null&&carRouteIsChecked){updateCarRoutingResponse(parameter);if(parameter.osmids!=null&&parameter.osmids.length>0){$("#"+routing_portlet_id+"carResultTab-4-link").css("display","block");$("#"+routing_portlet_id+"carResultTab-4").html(parameter.osmids.join(", "))}else{$("#"+routing_portlet_id+"carResultTab-4").empty();
$("#"+routing_portlet_id+"carResultTab-4-link").css("display","none")}}else{updateRoutingSummaryCar(null);$("#"+routing_portlet_id+"carResultTab-3").empty();$("#"+routing_portlet_id+"carResultTab-4").empty()}}});Liferay.on("vipnrw-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==routing_portlet_id||"_"+portletId+"_"==routing_portlet_id))handleResizeEvent("vipnrw-maximize-portlet")});
Liferay.on("vipnrw-after-maximize-portlet",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==routing_portlet_id||"_"+portletId+"_"==routing_portlet_id)){var tabPage=parameter.tabPage;if(tabPage=="car")$("#"+routing_portlet_id+"transportTab-2-item").click();else if(tabPage=="publicTransport")$("#"+routing_portlet_id+"transportTab-3-item").click();else if(tabPage=="bike")$("#"+routing_portlet_id+"transportTab-4-item").click();handleResizeEvent("vipnrw-after-maximize-portlet")}});
Liferay.on("vipnrw-after-portlet-resize",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==routing_portlet_id||"_"+portletId+"_"==routing_portlet_id))handleResizeEvent("vipnrw-after-portlet-resize")});Liferay.on("restore-portlet-width",function(parameter){var portletId=parameter.portletId;if(portletId&&(portletId==routing_portlet_id||"_"+portletId+"_"==routing_portlet_id))handleResizeEvent("restore-portlet-width")});
Liferay.on("vipnrw-car-route-started",function(parameter){addUserBehavior(UserAction.ROUTING_CAR);updateRoutingSummaryCar("",true);$("#"+routing_portlet_id+"carResultTab-1").empty();$("#"+routing_portlet_id+"carResultTab-2").empty();$("#"+routing_portlet_id+"carResultTab-3").empty();$("#"+routing_portlet_id+"carResultTab-4").empty();$("#"+routing_portlet_id+"errorMsgCar").empty();$("#"+routing_portlet_id+"errorMsgCar").css("display","none");$("#"+routing_portlet_id+"errorMsgCarDynamic").empty();$("#"+
routing_portlet_id+"errorMsgCarDynamic").css("display","none")});
Liferay.on("vipnrw-remove-car-route",function(parameter){closeCarRoutePopup();removeCarRoute();updateRoutingSummaryCar("-");$("#"+routing_portlet_id+"carResultTabSummary").empty();$("#"+routing_portlet_id+"carResultTab-1").empty();$("#"+routing_portlet_id+"carResultTab-2").empty();$("#"+routing_portlet_id+"carResultTab-3").empty();$("#"+routing_portlet_id+"carResultTab-4").empty();$("#"+routing_portlet_id+"errorMsgCar").empty();$("#"+routing_portlet_id+"errorMsgCar").css("display","none");$("#"+routing_portlet_id+
"errorMsgCarDynamic").empty();$("#"+routing_portlet_id+"errorMsgCarDynamic").css("display","none")});
Liferay.on("vipnrw-public-transport-route",function(parameter){var result=parameter.routeResult;var hasViaPoints=parameter.hasViaPoints;$("#"+routing_portlet_id+"errorMsgPublicTransport").empty();if(hasViaPoints){var html='\x3cdiv class\x3d"portlet-msg-info"\x3e'+"Hinweis: Die Bus \x26 Bahn Route unterst\u00fctzt keine Zwischenziele"+"\x3c/div\x3e";$("#"+routing_portlet_id+"errorMsgPublicTransport").html(html);$("#"+routing_portlet_id+"errorMsgPublicTransport").css("display","block");vipnrwErrorMessage("Hinweis: Die Bus \x26 Bahn Route unterst\u00fctzt keine Zwischenziele",
"info",5,"ov-route-vias")}$("#"+routing_portlet_id+"busRoute-loading").hide();buildPublicTransportHtmlResult(result)});Liferay.on("vipnrw-intermodal-route-started",function(parameter){addUserBehavior(UserAction.ROUTING_INTERMODAL);updateRoutingSummaryIntermodal("",true)});
Liferay.on("vipnrw-public-transport-route-started",function(parameter){addUserBehavior(UserAction.ROUTING_PUBLIC_TRANSPORT);updateRoutingSummaryBus("",true);$("#"+routing_portlet_id+"busRouteText").empty();$("#"+routing_portlet_id+"busAccordion").empty();$("#"+routing_portlet_id+"busRoute-loading").show();$("#"+routing_portlet_id+"errorMsgPublicTransport").empty();$("#"+routing_portlet_id+"errorMsgPublicTransport").css("display","none");updatePrintViewHeader()});
Liferay.on("vipnrw-remove-public-transport-route",function(parameter){closePublicTransportRoutePopup();removePublicTransportRoute();let rSummary=$("#publicTransportDummySummaryRow").render();$(".publicTransportRoutes").empty();$(".publicTransportRoutes").append(rSummary);$("#"+routing_portlet_id+"busRouteText").empty();$("#"+routing_portlet_id+"busAccordion").empty();$("#"+routing_portlet_id+"busRoute-loading").hide();$("#"+routing_portlet_id+"errorMsgPublicTransport").empty();$("#"+routing_portlet_id+
"errorMsgPublicTransport").css("display","none");updatePrintViewHeader();updateRoutingSummaryBus("-",false)});Liferay.on("vipnrw-remove-intermodal-route",function(parameter){removeIntermodalRoute();closeIntermodalRoutePopup();updateRoutingSummaryIntermodal("-",false);let rSummary=$("#intermodalDummySummaryRow").render();$(".intermodalRoutes").empty();$(".intermodalRoutes").append(rSummary);$("#"+routing_portlet_id+"intermodalAccordion").empty();updatePrintViewHeader()});
Liferay.on("vipnrw-remove-bike-route",function(parameter){closeBikeRoutePopup();removeBikeRoute();if(ajaxBikeRouteCallId!=null)try{ajaxBikeRouteCallId.abort()}catch(e){console.error(e)}$("#"+routing_portlet_id+"bikeRouteSummary").empty();updateRoutingSummaryBike("-",false);$("#"+routing_portlet_id+"bikeRouteClimbing").text("Gesamth\u00f6henmeter"+": -");$("#"+routing_portlet_id+"bikeRouteImage").removeAttr("src");$("#"+routing_portlet_id+"bikeRouteTab-2").empty();$("#"+routing_portlet_id+"bikeRouteTab-1-loading").hide();
$("#"+routing_portlet_id+"errorMsgBike").empty();$("#"+routing_portlet_id+"errorMsgBike").css("display","none");$("#"+routing_portlet_id+"bikeRouteDeeplink").attr("href",defaultBikeRoutingUrl)});Liferay.on("vipnrw-routing-portlet-request-bike-route",function(parameter){addUserBehavior(UserAction.ROUTING_BIKE);var points=parameter.data;if(points&&points.startPoint&&points.targetPoint){tmpPoints=points;requestBikeRouteAjax(points)}});
Liferay.on("vipnrw-bike-route-started",function(parameter){updateRoutingSummaryBike("",true);$("#"+routing_portlet_id+"bikeRouteTab-1-loading").show();$("#"+routing_portlet_id+"bikeRouteTab-2").html('\x3cdiv style\x3d"text-align: center; padding: 10px;"\x3e\x3cdiv class\x3d"loader"\x3e\x3c/div\x3e'+"Lade Daten..."+"\x3c/div\x3e")});
Liferay.on("vipnrw-routing-portlet-update-all-points",function(parameter){try{var viasFeatures=parameter.viaPoints;var startFeature=parameter.startPoint;var targetFeature=parameter.targetPoint;if(startFeature){var latlon="Start"+" ("+startFeature.latWgs84.toFixed(5)+", "+startFeature.lonWgs84.toFixed(5)+")";$(startPointInput).attr("placeholder",latlon);searchAddressByPoint(startFeature.latWgs84,startFeature.lonWgs84,{"pointType":startFeature.type,"viaIndex":startFeature.viaIndex,"input":$(startPointInput)})}else{var latlon=
"Start";$(startPointInput).attr("placeholder",latlon);$(startPointInput).val("");routingStartPositionName="";updateRoutingPortletPrintViewHeader()}if(targetFeature){var latlon="Ziel"+" ("+targetFeature.latWgs84.toFixed(5)+", "+targetFeature.lonWgs84.toFixed(5)+")";$(targetPointInput).attr("placeholder",latlon);searchAddressByPoint(targetFeature.latWgs84,targetFeature.lonWgs84,{"pointType":targetFeature.type,"viaIndex":targetFeature.viaIndex,"input":$(targetPointInput)})}else{var latlon="Ziel";$(targetPointInput).attr("placeholder",
latlon);$(targetPointInput).val("");routingTargetPositionName="";updateRoutingPortletPrintViewHeader()}if(viasFeatures&&viaPointTable){while(viasFeatures.length>viaIndexSize)viaIndexSize++;for(var i=viasFeatures.length;i<viaPointTable.children.length;i++){var viaInput=$("#"+viaInputId+i);if(viaInput){viaInput.val("");viaInput.attr("placeholder","Zwischenziel")}}for(var i=0;i<viasFeatures.length;i++){var via=viasFeatures[i];var latlon="Zwischenziel"+" ("+via.latWgs84.toFixed(5)+", "+via.lonWgs84.toFixed(5)+
")";var viaInput=$("#"+viaInputId+via.viaIndex);if(viaInput&&viaInput.attr("placeholder")!=latlon)viaInput.attr("placeholder",latlon);searchAddressByPoint(via.latWgs84,via.lonWgs84,{"pointType":via.type,"viaIndex":via.viaIndex,"input":viaInput})}}else if(viaPointTable)for(var i=0;i<viaPointTable.children.length;i++){var viaInput=$("#"+viaInputId+i);if(viaInput){viaInput.val("");viaInput.attr("placeholder","Zwischenziel")}}}catch(e){console.error(e)}});
Liferay.on("vipnrw-routing-portlet-remove-point",function(parameter){try{var viaIndex=parameter.viaIndex;var type=parameter.pointType;if(type)if(type==pointNameStart){$(startPointInput).attr("placeholder","");$(startPointInput).val("");routingStartPositionName="";updateRoutingPortletPrintViewHeader()}else if(type==pointNameTarget){$(targetPointInput).attr("placeholder","");$(targetPointInput).val("");routingTargetPositionName="";updateRoutingPortletPrintViewHeader()}else if(type==pointNameVia&&viaIndex!=
null)removeViaPoint(viaIndex)}catch(e){console.error(e)}});
Liferay.on("vipnrw-routing-portlet-point-coordinates",function(parameter){try{let viasFeatures=parameter.viaPoints;let startFeature=parameter.startPoint;let targetFeature=parameter.targetPoint;let addedFeature=parameter.addedPoint;let dragstart=parameter.dragstart;let newViaAdded=false;if(startFeature){let latlon="Start"+" ("+startFeature.latWgs84.toFixed(5)+", "+startFeature.lonWgs84.toFixed(5)+")";$(startPointInput).attr("placeholder",latlon)}else{let latlon="Start";$(startPointInput).attr("placeholder",
latlon);$(startPointInput).val("");routingStartPositionName="";updateRoutingPortletPrintViewHeader()}if(targetFeature){let latlon="Ziel"+" ("+targetFeature.latWgs84.toFixed(5)+", "+targetFeature.lonWgs84.toFixed(5)+")";$(targetPointInput).attr("placeholder",latlon)}else{let latlon="Ziel";$(targetPointInput).attr("placeholder",latlon);$(targetPointInput).val("");routingTargetPositionName="";updateRoutingPortletPrintViewHeader()}if(viasFeatures&&viaPointTable){while(viasFeatures.length>viaIndexSize){let viaObj=
getViaButtonHtml(viaIndexSize);let htmlRow=viaObj.html;let viaTable=$(viaPointTable);if(viaTable&&htmlRow&&htmlRow.length>0){viaTable.append(htmlRow).ready(function(){let tmpVia=document.getElementById(viaObj.inputId)});newViaAdded=true}viaIndexSize++}for(let i=viasFeatures.length;i<viaPointTable.children.length;i++){let viaInput=$("#"+viaInputId+i);if(viaInput){viaInput.val("");viaInput.attr("placeholder","Zwischenziel")}}for(let i=0;i<viasFeatures.length;i++){let via=viasFeatures[i];let latlon=
"Zwischenziel"+" ("+via.latWgs84.toFixed(5)+", "+via.lonWgs84.toFixed(5)+")";let viaInput=$("#"+viaInputId+via.viaIndex);if(viaInput&&viaInput.attr("placeholder")!=latlon)viaInput.attr("placeholder",latlon)}}else if(viaPointTable)for(let i=0;i<viaPointTable.children.length;i++){let viaInput=$("#"+viaInputId+i);if(viaInput){viaInput.val("");viaInput.attr("placeholder","Zwischenziel")}}if(addedFeature)if(addedFeature.type==pointNameStart){let placeHolder="Start"+" ("+addedFeature.latWgs84.toFixed(5)+
", "+addedFeature.lonWgs84.toFixed(5)+")";$(startPointInput).val("");$(startPointInput).attr("placeholder",placeHolder);routingStartPositionName="";updateRoutingPortletPrintViewHeader();if(!dragstart)searchAddressByPoint(addedFeature.latWgs84,addedFeature.lonWgs84,{"pointType":addedFeature.type,"viaIndex":addedFeature.viaIndex,"input":$(startPointInput)})}else if(addedFeature.type==pointNameTarget){let placeHolder="Ziel"+" ("+addedFeature.latWgs84.toFixed(5)+", "+addedFeature.lonWgs84.toFixed(5)+
")";$(targetPointInput).val("");$(targetPointInput).attr("placeholder",placeHolder);routingTargetPositionName="";updateRoutingPortletPrintViewHeader();if(!dragstart)searchAddressByPoint(addedFeature.latWgs84,addedFeature.lonWgs84,{"pointType":addedFeature.type,"viaIndex":addedFeature.viaIndex,"input":$(targetPointInput)})}else if(addedFeature.type==pointNameVia&&addedFeature.viaIndex!=null){let placeHolder="Zwischenziel"+" ("+addedFeature.latWgs84.toFixed(5)+", "+addedFeature.lonWgs84.toFixed(5)+
")";let viaInput=$("#"+viaInputId+addedFeature.viaIndex);if(viaInput&&viaPointTable){if(newViaAdded)for(let i=viaPointTable.children.length-1;i>=addedFeature.viaIndex;i--)if(i-1>=0){let viaInputCurrent=$("#"+viaInputId+i);let viaInputBefore=$("#"+viaInputId+(i-1));let value=viaInputBefore.val();viaInputCurrent.val(value)}viaInput.val("");viaInput.attr("placeholder",placeHolder);if(!dragstart)searchAddressByPoint(addedFeature.latWgs84,addedFeature.lonWgs84,{"pointType":addedFeature.type,"viaIndex":addedFeature.viaIndex,
"input":viaInput})}}}catch(e){console.error(e)}});
function hideorShowRoutingPortletTabLabels(){let labels=$("#"+routing_portlet_id+"carResultTabs li label");labels.each(function(n){$(this).css("display","inline")});let routingPortletWidth=$("#"+routing_portlet_id+"carResultTabs").width();let tabs=$("#"+routing_portlet_id+"carResultTabs li");let carTabOverallWidth=0;tabs.each(function(n){let tabWidth=$(this).outerWidth(true);carTabOverallWidth+=tabWidth});if(routingPortletWidth<carTabOverallWidth+10){let labels=$("#"+routing_portlet_id+"carResultTabs li label");
labels.each(function(n){$(this).css("display","none")})}let bikeRouteLabels=$("#"+routing_portlet_id+"bikeRouteTabs li label");bikeRouteLabels.each(function(n){$(this).css("display","inline")});let bikeRoutePortletWidth=$("#"+routing_portlet_id+"bikeRouteTabs").width();let bikeRouteTabs=$("#"+routing_portlet_id+"bikeRouteTabs li");let bikeRouteOverallWidth=0;bikeRouteTabs.each(function(n){let tabWidth=$(this).outerWidth(true);bikeRouteOverallWidth+=tabWidth});if(bikeRoutePortletWidth<bikeRouteOverallWidth+
10){let labels=$("#"+routing_portlet_id+"bikeRouteTabs li label");labels.each(function(n){$(this).css("display","none")})}}
function handleResizeEvent(event){if(event=="vipnrw-maximize-portlet")if(initial){initial=false;resizeToInitial()}else resizeRoutingPortlet({portletWidth:$(".info-slider").width(),toDefaults:true});if(event=="vipnrw-after-portlet-resize"){drawRestoreSliderSizeIcon($(".info-slider").width(),routingPortletProperties.tabInitialWidth);if($(".info-slider").width()<=routingPortletProperties.tabInitialWidth)resizeRoutingPortlet({portletWidth:$(".info-slider").width(),toDefaults:true})}if(event=="restore-portlet-width")resizeRoutingPortlet({portletWidth:$(".info-slider").width(),
toDefaults:true});hideorShowRoutingPortletTabLabels()}
function resizeRoutingPortlet(parameter){let portletWidth=parameter.portletWidth;let acitiveMainTab=$("#"+routing_portlet_id+"transportTabs").tabs("option","active");if(acitiveMainTab==0||acitiveMainTab>=2||screen.width<=360)resizeToInitial();if(acitiveMainTab==1)if(screen.width>360){let activeCarTab=$("#"+routing_portlet_id+"carResultTabs").tabs("option","active");if(activeCarTab==0)if(portletWidth<=routingPortletProperties.losTabWidth||parameter.toDefaults){resizeToLosTabDefaults();drawRestoreSliderSizeIcon($(".info-slider").width(),
routingPortletProperties.losTabWidth)}if(activeCarTab==1)if(portletWidth<=routingPortletProperties.trafficObjectsTabWidth||parameter.toDefaults){resizeToTrafficObjectsTabDefaults();drawRestoreSliderSizeIcon($(".info-slider").width(),routingPortletProperties.trafficObjectsTabWidth)}if(activeCarTab==2)if(portletWidth<=routingPortletProperties.routeDescriptionTabWidth||parameter.toDefaults){resizeToRouteDescriptionTabDefaults();drawRestoreSliderSizeIcon($(".info-slider").width(),routingPortletProperties.routeDescriptionTabWidth)}if(activeCarTab>=
3)if(portletWidth<=routingPortletProperties.chartTabWidth||parameter.toDefaults){resizeToChartsTabDefaults();drawRestoreSliderSizeIcon($(".info-slider").width(),routingPortletProperties.chartTabWidth)}}}function resizeToLosTabDefaults(){$(".info-slider").css("width",routingPortletProperties.losTabWidth)}function resizeToTrafficObjectsTabDefaults(){$(".info-slider").css("width",routingPortletProperties.trafficObjectsTabWidth)}
function resizeToRouteDescriptionTabDefaults(){$(".info-slider").css("width",routingPortletProperties.routeDescriptionTabWidth)}function resizeToChartsTabDefaults(){$(".info-slider").css("width",routingPortletProperties.chartTabWidth)}function resizeToInitial(){$(".info-slider").css("width",routingPortletProperties.tabInitialWidth)}
function searchAddressByPoint(lat,lon,parameter){let searchurl=routing_portlet_photon_reverse_url;let params={"lat":lat,"lon":lon};$.ajax({method:"GET",url:searchurl,data:params,success:function(data){let features=data.features;features.forEach(function(item,index){let result=parsePhotonAddressResponse(item.properties);parameter.input.val(result.title);if(parameter.pointType)if(parameter.pointType==pointNameStart){routingStartPositionName=result.title;updateRoutingPortletPrintViewHeader()}else if(parameter.pointType==
pointNameTarget){routingTargetPositionName=result.title;updateRoutingPortletPrintViewHeader()}Liferay.fire("vipnrw-set-route-point-name",{pointType:parameter.pointType,viaIndex:parameter.viaIndex,name:result.title})})}})}Liferay.on("vipnrw-clear-via-points",function(parameter){$.each($("[id^\x3d"+viaTableRowId+"]"),function(){$(this).remove();viaIndexSize--})});Liferay.on("vipnrw-intermodal-route",function(parameter){fillIntermodalAccordion(parameter.addedFeatures)});
/**
 * jQuery PrintMe v.1.0
 * 
 * A jquery plugin that prints the given element
 *
 * Copyright 2014, Daniel Arlandis <daniarlandis@gmail.com> www.daniarlandis.es
 * Released under the WTFPL license
 * http://sam.zoy.org/wtfpl/
 *
 * Date: Mon Feb 10 19:23:00 2014
 * Last modified: Sat Dec 12 22:00:00 2015
 */
jQuery.fn.printMe=function(a){var b=$.extend({path:[],title:"",head:!1},a);return this.each(function(){var a=$(this),c=window.open();c.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'),c.document.write("<html>"),c.document.write("<head>"),c.document.write("<meta charset='utf-8'>");for(i in b.path)c.document.write('<link rel="stylesheet" href="'+b.path[i]+'">');c.document.write("</head><body>"),""!=b.title&&c.document.write("<h1>"+b.title+"</h1>"),c.document.write(a.html()),c.document.write('<script type="text/javascript">function closeme(){window.close();}setTimeout(closeme,50);window.print();</script></body></html>'),c.document.close()})};
(function($){$.fn.printElement=function(options){var settings=$.extend({title:jQuery("title").text(),css:"extend",ecss:null,lcss:[],keepHide:[],wrapper:{wrapper:null,selector:null}},options);const element=$(this).clone();var html=document.createElement("html");var head=document.createElement("head");if(settings.title!=null&&settings.title!="")head=$(head).append($(document.createElement("title")).text(settings.title));else head=$(head);if(settings.css=="extend"||settings.css=="link")$("link[rel\x3dstylesheet]").each(function(index,
linkcss){head=head.append($(document.createElement("link")).attr("href",$(linkcss).attr("href")).attr("rel","stylesheet").attr("media","print"))});for(var i=0;i<settings.lcss.length;i++)head=head.append($(document.createElement("link")).attr("href",settings.lcss[i]).attr("rel","stylesheet").attr("media","print"));if(settings.css=="extend"||settings.css=="style")head.append($(document.createElement("style")).append($("style").clone().html()));if(settings.ecss!=null)head.append($(document.createElement("style")).html(settings.ecss));
if(settings.wrapper.wrapper===null){var body=document.createElement("body");body=$(body).append(element)}else{var body=$(settings.wrapper.wrapper).clone();body.find(settings.wrapper.selector).append(element)}for(var i=0;i<settings.keepHide.length;i++)$(body).find(settings.keepHide[i]).each(function(index,data){$(this).css("display","none")});html=$(html).append(head).append(body);const fn_window=document.open("",settings.title,"width\x3d"+$(document).width()+",height\x3d"+$(document).width()+"");
fn_window.document.write(html.clone().html());setTimeout(function(){fn_window.print();fn_window.close()},250);return $(this)}})(jQuery);
function getTrafficObjectIcon(icon){if(icon=="101"||icon=="124")return"fa fa-exclamation-triangle";else if(icon=="123"||icon=="warnkegel")return"vipnrw-font vipnrw-123";else if(icon=="250"||icon=="253"||icon=="448"||icon=="262-2"||icon=="262")return"fa fa-exclamation-circle";else if(icon=="314-50"||icon=="314-50-1")return"fa fa-product-hunt";else if(icon=="467")return"fa fa-map-signs";else if(icon=="webcam")return"fa fa-video-camera";else if(icon=="224-50")return"vipnrw-font vipnrw-50";return""}
function initSearchPortlet(){$("#"+search_portlet_id+"searchInput").on("focus",function(){addUserBehavior(UserAction.FOCUS_SEARCH)});$("#"+search_portlet_id+"searchInput").catcomplete({delay:200,minLength:2,source:function(request,response){var searchResults=[];var coordinates=request.term.trim().split(",");var isCoordinate=!isNaN(coordinates[0])&&!isNaN(coordinates[1]);if(coordinates.length==2&&isCoordinate){coordinates[0]=Number(coordinates[0].trim());coordinates[1]=Number(coordinates[1].trim());
let germanyLonValues=[5.98865807458,15.0169958839];if(coordinates[0]>=germanyLonValues[0]&&coordinates[0]<=germanyLonValues[1]){let tmp=coordinates[1];coordinates[1]=coordinates[0];coordinates[0]=tmp}searchAddressByPhoton(coordinates,searchResults,response,isCoordinate)}else{searchAddressByPhoton(request.term,searchResults,response);searchTrafficObjects(request.term,searchResults,response);searchStations(request.term,searchResults,response)}},select:function(event,ui){if(ui!=null&&ui.item){var item=
ui.item.value;if(item.trafficObject)if(item.point!=null)Liferay.fire("vipnrw-show-wfs-feature-popup",{point:item.point,identifier:item.identifier,projection:item.projectionName});else{searchPortletZoomToItem(item.extent,item.projectionName,item.coordinate);searchOnSetStartPoint(item)}else{searchPortletZoomToItem(item.extent,item.projectionName,item.coordinate);searchOnSetStartPoint(item)}ui.item.value="";addUserBehavior(UserAction.CLICK_SEARCH_RESULT,undefined,item)}}}).catcomplete("instance")._renderItem=
function(ul,item){return $("\x3cli\x3e").append("\x3cdiv class\x3d'autocomplete-entry'\x3e\x3cdiv class\x3d'autocomplete-text'\x3e\x3cdiv class\x3d'autocomplete-text-title'\x3e\x3ci class\x3d'"+item.value.icon+"' aria-hidden\x3d'true'\x3e\x3c/i\x3e"+"\x26nbsp;"+item.label.title+"\x3c/div\x3e\x3cdiv class\x3d'autocomplete-text-subtitle'\x3e"+item.label.desc+"\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/i\x3e").appendTo(ul)};updateSearchRouteButtons()}
function searchAddressByPhoton(searchTerm,resultsArray,responseCallback,isCoordinate){var searchurl=isCoordinate?search_portlet_photon_reverse_url:search_portlet_photon_api_url;var params=isCoordinate?{"lat":searchTerm[0],"lon":searchTerm[1]}:{"lang":"de","q":searchTerm,"limit":search_portlet_photon_api_limit};$.ajax({method:"GET",url:searchurl,data:params,success:function(data){var features=data.features;features.forEach(function(item,index){if(item.geometry!=null&&item.geometry.coordinates!=null)item.properties.coordinate=
item.geometry.coordinates;item.properties.projectionName="EPSG:4326";item.properties.icon="fa fa-home";resultsArray.push({label:parsePhotonAddressResponse(item.properties),category:"Adresse",value:item.properties});responseCallback(resultsArray)})}})}
function searchStations(searchTerm,resultsArray,responseCallback){$.ajax({url:search_portlet_resource_url,dataType:"json",type:"GET",data:{"action":"autocompleteStations","value":searchTerm,"limit":search_portlet_traffic_object_limit},success:function(data){data.forEach(function(item,index){item.trafficObject=true;item.projectionName="EPSG:4326";if(item.x!=null&&item.y!=null)item.coordinate=[Number(item.x),Number(item.y)];item.icon="vipnrw-font vipnrw-50";resultsArray.push({label:{title:item.name,
desc:item.info},category:Liferay.Language.get("vipnrw.search.category."+item.type.toLowerCase()),value:item})});responseCallback(resultsArray)},error:function(jqXHR,textStatus,errorThrown){console.error("AJAX call failed. Status - "+textStatus);console.error("Reason - "+errorThrown)}})}
function searchTrafficObjects(searchTerm,resultsArray,responseCallback){$.ajax({url:search_portlet_resource_url,dataType:"json",type:"GET",data:{"action":"searchTrafficObject","value":searchTerm,"limit":search_portlet_traffic_object_limit},success:function(data){Object.keys(data).forEach(function(key){var value=data[key];value.data.forEach(function(item,index){item.trafficObject=true;item.projectionName="EPSG:4326";if(item.coordinate!=null&&!Array.isArray(item.coordinate))item.coordinate=[Number(item.coordinate.lat),
Number(item.coordinate.long)];if(item.extent!=null&&!Array.isArray(item.extent)){var splitted=item.extent.split(",");if(splitted.length==4)item.extent=[Number(splitted[0]),Number(splitted[1]),Number(splitted[2]),Number(splitted[3])]}item.icon=getTrafficObjectIcon(item.icon);resultsArray.push({label:{title:item.title,desc:item.subtitle},category:Liferay.Language.get("vipnrw.search.category."+key.toLowerCase()),value:item})})});responseCallback(resultsArray)},error:function(jqXHR,textStatus,errorThrown){console.error("AJAX call failed. Status - "+
textStatus);console.error("Reason - "+errorThrown)}})}function getOsmValueTranslation(osmValue){if(osmValue=="county")return"Region";if(osmValue=="city")return"Stadt";if(osmValue=="hamlet")return"Dorf";if(osmValue=="railway")return"Bahn-Station";if(osmValue=="cementery")return"Friedhof";if(osmValue=="bus_stop"||osmValue=="platform")return"Bus/Bahn-Haltestelle";if(osmValue=="residential")return"Wohngegend";return""}
function parsePhotonAddressResponse(featurePropertie){var autocompleteTitle="";var autocompleteSubtitle="";if(featurePropertie.osm_value){if(autocompleteSubtitle.length>0)autocompleteSubtitle+=", ";var osmTranslation=getOsmValueTranslation(featurePropertie.osm_value);autocompleteSubtitle+=osmTranslation!=""?"("+osmTranslation+")":""}if(featurePropertie.state&&featurePropertie.state!==featurePropertie.city){if(autocompleteSubtitle.length>0)autocompleteSubtitle+=" ";autocompleteSubtitle+=featurePropertie.state}if(featurePropertie.country){if(autocompleteSubtitle.length>
0)autocompleteSubtitle+=", ";autocompleteSubtitle+=featurePropertie.country}if(featurePropertie.postcode&&(featurePropertie.name==null||featurePropertie.name.indexOf(featurePropertie.postcode)===-1)){if(autocompleteTitle.length>0)autocompleteTitle+=" ";autocompleteTitle+=featurePropertie.postcode}if(featurePropertie.city&&(featurePropertie.name==null||featurePropertie.name.indexOf(featurePropertie.city)===-1)){if(autocompleteTitle.length>0)autocompleteTitle+=" ";autocompleteTitle+=featurePropertie.city}if(featurePropertie.street&&
(featurePropertie.name==null||featurePropertie.name.indexOf(featurePropertie.street)===-1)){if(autocompleteTitle.length>0)autocompleteTitle+=", ";autocompleteTitle+=featurePropertie.street;if(featurePropertie.housenumber)autocompleteTitle+=" "+featurePropertie.housenumber}if(featurePropertie.name){if(autocompleteTitle.length>0)autocompleteTitle+=" ";autocompleteTitle+=featurePropertie.name}if(autocompleteTitle.length==0){autocompleteTitle=autocompleteSubtitle;autocompleteSubtitle=""}return{title:autocompleteTitle,
desc:autocompleteSubtitle}}function searchPortletZoomToItem(extent,projectionName,coordinate){if(extent!=null&&extent.length>0)Liferay.fire("vipnrw-zoom-to-extent",{extent:extent,projection:projectionName});else if(coordinate!=null&&coordinate.length==2)Liferay.fire("vipnrw-zoom-to-coordinate",{lon:coordinate[0],lat:coordinate[1],projection:projectionName})}
function updateSearchRouteButtons(){var isCarSelected=getCookie("route-settings-car",MapRoutesHandler.getInstance().showCarRoutes);var isPublicTransportSelected=getCookie("route-settings-publicTransport",MapRoutesHandler.getInstance().showPtRoutes);var isBikeSelected=getCookie("route-settings-bike",MapRoutesHandler.getInstance().showBikeRoutes);var isIntermodalSelected=getCookie("route-settings-intermodal",MapRoutesHandler.getInstance().showIntermodalRoutes);var carButton=$("#"+search_portlet_id+
"car");var busButton=$("#"+search_portlet_id+"bus");var bikeButton=$("#"+search_portlet_id+"bike");var intermodalButton=$("#"+search_portlet_id+"intermodal");if(isCarSelected){if(!carButton.hasClass("pressed-button"))carButton.addClass("pressed-button")}else if(carButton.hasClass("pressed-button"))carButton.removeClass("pressed-button");if(isPublicTransportSelected){if(!busButton.hasClass("pressed-button"))busButton.addClass("pressed-button")}else if(busButton.hasClass("pressed-button"))busButton.removeClass("pressed-button");
if(isBikeSelected){if(!bikeButton.hasClass("pressed-button"))bikeButton.addClass("pressed-button")}else if(bikeButton.hasClass("pressed-button"))bikeButton.removeClass("pressed-button");if(isIntermodalSelected){if(!intermodalButton.hasClass("pressed-button"))intermodalButton.addClass("pressed-button")}else if(intermodalButton.hasClass("pressed-button"))intermodalButton.removeClass("pressed-button")}
function searchOnSetStartPoint(autocompleteItem){if(autocompleteItem!=null){var coordinate=autocompleteItem.coordinate;var extent=autocompleteItem.extent;if(coordinate!=null&&coordinate.length==2){searchPortletZoomToItem(extent,autocompleteItem.projectionName,coordinate);Liferay.fire("vipnrw-map-portlet-point-update",{action:"update",type:"route-point-start",lon:parseFloat(coordinate[0]),lat:parseFloat(coordinate[1]),projectionName:autocompleteItem.projectionName})}else if(extent!=null&&extent.length>
0){var coords=extent.split(",");for(var i=0;i<coords.length;i++)coords[i]=parseFloat(coords[i]);if(coords!=null&&coords.length==4){searchPortletZoomToItem(extent,autocompleteItem.projectionName,coordinate);Liferay.fire("vipnrw-map-portlet-point-update",{extent:coords,action:"update",type:"route-point-start",lat:null,lon:null,projectionName:autocompleteItem.projectionName})}}}};
Liferay.on("vipnrw-route-selection-update",function(parameter){updateSearchRouteButtons()});
