var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),Maps;(function(n){var f=function(u){function f(n,t,i,r,f,e,o,s){var h=u.call(this,n,t,i,r)||this;return h._panoAvail=!1,h._fullscreenRequested=!0,h._showFrom=!1,h._walkColor="#777",h._mapId="map",h._mostPriorObjectMask="!*",h._isFirstInit=!0,h.showMhdZjr=0,h._CardFirst=!1,h.hasResetButton=!1,h.isMafraSK=!1,h.mapListener=function(n,t){n.type==="map-redraw"?t.getTTObjects():n.type==="map-click"&&(t.isFormMap&&!t._isMarkerClicked&&(t._mapDblClick_timeout?(clearTimeout(t._mapDblClick_timeout),t._mapDblClick_timeout=null):t._mapDblClick_timeout=setTimeout(function(){var i=SMap.Coords.fromEvent(n.data.event,t.map);t.mapClick(i);t._mapDblClick_timeout=null},200)),t._isMarkerClicked=!1)},h.removeStationMarkerFromLayer=function(n){this._stationMarkersLayer&&this._stationMarkersLayer.removeMarker(n)},h._positionData=f,h.isFormMap=e,h.isDetail=o,h.isMafraSK=s,s?n=="VlakSk"?h.showMhdZjr=2:n!="BusSk"&&n!="VlakBusSk"&&(h.showMhdZjr=1):n=="Vlak"?h.showMhdZjr=2:n!="BusC"&&n!="VlakBusCZ"&&(h.showMhdZjr=1),h}return __extends(f,u),f.prototype.init=function(n,t){var r=this,o=new Base.ModalParams("idos-modal__content--90perc map-modal","",!1,!1,0,!1,!0,!1),f,u;if(o.backgroundTransparent=!0,$(".map-controls-panel").hide(),$("#"+this._mapId).html(null),this._mapModal=new Base.Modal(null,new Messages.MessagesService(null),null,o,null),$("#delete-route").hide(),this._mapModal.show("#maps-modal"),f=null,this.hasResetButton=!1,this.isFormMap?($(".popup-close.popup-close-map").addClass("popup-close-map-search"),$(".map-modal").css("margin-top","68px"),this.initMapForm($(".map-modal").width()),f=$(window).height()-68):f=$(window).height(),this._mapModal.exitOnClikOtside(),$("#"+this._mapId).height(f),this.map=n||t?new SMap(document.getElementById("map"),n,t):new SMap(document.getElementById("map")),this.isFormMap&&(this.map.setPadding("left",70),this.map.setPadding("top",80)),this._baseMapLayer=this.map.addDefaultLayer(SMap.DEF_BASE),this._baseMapLayer.enable(),this._ophotoMapLayer=this.map.addDefaultLayer(SMap.DEF_OPHOTO),this._hybridMapLayer=this.map.addDefaultLayer(SMap.DEF_HYBRID),this.map.addDefaultControls(),this.removeCompassControl(),this.map.addControl(new i(SMap.DEF_OPHOTO,"Z letadla"),{left:"17px",top:"17px"}),this.map.setCursor(null),u=this.map.getSignals(),u.addListener(this,"layer-button-click","_layerButtonClick"),u.addListener(this,"draw-reset-click","_drawResetButtonClick"),this.mapSettings&&(this.fromPosition=SMap.Coords.fromWGS84(this.mapSettings.coorFromY,this.mapSettings.coorFromX),this.toPosition=SMap.Coords.fromWGS84(this.mapSettings.coorToY,this.mapSettings.coorToX)),$(".map-modal").height(f),this.showMhdZjr==1&&(this._Card=new SMap.Card(300,{anchor:{left:0,top:-30},left:0,bottom:0}),this._Card.setSize(362,350)),this.isFormMap){if(u.addListener(window,"map-redraw",function(n){r.mapListener(n,r)},null),u.addListener(window,"map-lock",function(n){r.mapListener(n,r)},null),u.addListener(window,"map-click",function(n){r.mapListener(n,r)},null),u.addListener(window,"map-focus",function(n){r.mapListener(n,r)},null),typeof n=="undefined"){var e=[],h=new SMap.Coords(this.mapSettings.viewportLngMin,this.mapSettings.viewportLatMin),c=new SMap.Coords(this.mapSettings.viewportLngMax,this.mapSettings.viewportLatMax);e.push(h);e.push(c);var s=this.map.computeCenterZoom(e,!0),l=s[0],a=s[1];this.map.setCenterZoom(l,a)}this.map.getSignals().addListener(this,"zoom-start",function(){r._Card!=null&&r._Card.getContainer()!=null&&r._Card.getMap()!=null&&$(r._Card.getContainer()).offset()&&r.map.getCard()&&r.map.getCard().isVisible()&&r.map.removeCard()});this.map.getSignals().addListener(this,"map-click",function(){!r._CardFirst&&r._Card!=null&&r._Card.getContainer()!=null&&r._Card.getMap()!=null&&$(r._Card.getContainer()).offset()&&r.map.getCard()&&r.map.getCard().isVisible()&&r.map.removeCard();r._CardFirst=!1});this.getTTObjects()}u.addListener(this.map,"card-open",function(){r._mapModal.disableClose();$(document).on("keyup.card",function(n){n.keyCode==27&&!r._CardFirst&&r._Card!=null&&r._Card.getContainer()!=null&&r._Card.getMap()!=null&&$(r._Card.getContainer()).offset()&&r.map.getCard()&&r.map.getCard().isVisible()&&$("#panoramaModalContent").is(":hidden")&&$("#mapsZjrModalContent").is(":hidden")&&r.map.removeCard()})});u.addListener(this.map,"card-close",function(){$(document).off("keyup.card");r._mapModal.enableClose()})},f.prototype.setData=function(n){this._positionData=n},f.prototype.showConnectionOnMap=function(n){try{if(n==null||this.IsErrorJSON(n))return;typeof n.aoTrains!="undefined"&&n.aoTrains!=null&&n.aoTrains.length>0&&(this._mapData=n,this.drawMapRoute(!0))}catch(t){}},f.prototype.showStationsMap=function(){var i=this;this._fromMarker=null;this._toMarker=null;this._myPositionMarker=null;this.removeMarkersLayer();this.resetStationMarkers();this.removeStationMarkersLayer();var n=$("#"+this.mapSettings.parentInputSelector).val(),t=$("#"+this.mapSettings.parentInputSelector).attr("placeholder"),r=$("#"+this.mapSettings.parentInputHiddenSelector).val();$("#positionAC").val(n);$("#positionAC").attr("placeholder",t);$("#positionACHidden").change(function(){return i.stationChanged(!1)});$("#positionACHidden").val(r);this.stationChanged(!0);$(".map-controls-panel .inp-combined").toggleClass("filled",typeof n=="string"&&!Base.Support.stringIsEmpty(n.toString())||!Base.Support.stringIsEmpty(t))},f.prototype.getHiddenItem=function(n,t,i){return Base.HiddenItem.parse(typeof t=="string"?t.toString():"",typeof n=="string"&&!Base.Support.stringIsEmpty(n.toString())?n.toString():i)},f.prototype.setPositionData=function(n,t){var i=Base.PositionItem.parse(typeof n=="string"?n.toString():"");i&&i.coorX>0&&i.coorY>0&&(t||(t=new Base.HiddenItem),(isNaN(t.coorX)||t.coorX===0&&isNaN(t.coorY)||t.coorY===0)&&(t.coorX=i.coorX,t.coorY=i.coorY))},f.prototype.getPositionSuccess=function(){$("#positionAC").val("");$("#positionAC").autocomplete({minLength:0});$("#positionAC").autocomplete("search")},f.prototype.removeCompassControl=function(){var n=this.map.getControls().filter(function(n){return n instanceof SMap.Control.Compass});!Base.Support.emptyArray(n)&&n[0]&&this.map.removeControl(n[0])},f.prototype._layerButtonClick=function(n){var t=n.target;t.toggleActive();switch(t.layer){case SMap.DEF_OPHOTO:t.isActive?(this._baseMapLayer.disable(),this._ophotoMapLayer.enable(),this._hybridMapLayer.enable()):(this._baseMapLayer.enable(),this._ophotoMapLayer.disable(),this._hybridMapLayer.disable());break;case SMap.DEF_PANO:this._panoMapLayer&&(this._panoMapLayer.isActive()?this._panoMapLayer.disable():this._panoMapLayer.enable())}},f.prototype._drawResetButtonClick=function(n){var t=n.target;this.map.removeControl(t);this.removeLinesLayer();this.removeDrawLineMarkers();this.hasResetButton=!1},f.prototype._panoAvailable=function(){this._panoAvail||(this._panoAvail=!0,this.map.setCursor("pointer"))},f.prototype._panoUnavailable=function(){this._panoAvail&&(this.map.setCursor(null),this._panoAvail=!1)},f.prototype.getMapBorder=function(){var n=this.getMapBorderCorners(),t=n[0],i=n[1],u=t.toCoords(this.map),f=u.toWGS84().reverse().join(", "),e=i.toCoords(this.map),o=e.toWGS84().reverse().join(", ");return new r(f,o)},f.prototype.removeNotUsedStationMarkers=function(n){var i=this.getStationMarkers(),r,u,t;if(!Base.Support.emptyArray(i))for(r=function(){var r=i[t];(Base.Support.emptyArray(n)||!n.some(function(n){return r.getCoords().equals(new SMap.Coords(n.lng,n.lat))}))&&u.removeStationMarker(r)},u=this,t=i.length-1;t>=0;t--)r()},f.prototype.addOrRemoveMarkerLabel=function(n,t,i){var e=this,r=t.getElementsByClassName("marker-label"),u,f;if(i>=e.mapSettings.showLabelZoom)r&&r.length!==0||(u=document.createElement("div"),u.className="marker-label zindexOneLabel",u.innerHTML=n.name,t.appendChild(u));else if(r&&r.length>0)for(f=0;f<r.length;f++)t.removeChild(r[f])},f.prototype.drawMapRoute=function(n){var i,t,r;try{if(typeof this._mapData!="undefined"&&this._mapData!=null){if(this.deleteMapRoutes(),i=[],typeof this._mapData.aoLines=="undefined"||this._mapData.aoLines.length==0){for(this._mapData.aoLines=[],this._mapData.aoBlackLines=[],this._mapData.aoMarkers=[],t=0;t<this._mapData.aoTrains.length;t++)this.drawTrainRoute(t,i);this.addStartAndFinishMarkers(i)}else for(t=0;t<this._mapData.aoLines.length;t++)r=this.getLinesLayer(),r.addGeometry(this._mapData.aoLines[t]),r.addGeometry(this._mapData.aoBlackLines[t]);if(!Base.Support.emptyArray(i)&&n){var u=this.map.computeCenterZoom(i,!1),f=u[0],e=u[1];this.map.setCenterZoom(f,e)}}else{this.getMapRoute(this._mapData.iID);return}}catch(o){}},f.prototype.getTTObjects=function(){var i=this,t=this.map.getZoom();if(t>=this.mapSettings.minZoom){var n=this.getMapBorder(),u=n.GetMaxX(),f=n.GetMinX(),e=n.GetMinY(),o=n.GetMaxY(),r=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"SearchTimetableObjectsInRect",dataType:"jsonp",data:{combID:this.combId,minX:u,minY:f,maxX:e,maxY:o,zoom:t,format:"json"}});r.done(function(n){Base.Support.emptyArray(n)?i.removeStationMarkers():i.showTTObjects(n,t)});r.fail(function(){})}else this.removeStationMarkers()},f.prototype.getZJR=function(n,t,i,r,u,f,e,o,s,h){var c=this,l;o===void 0&&(o=-1);s===void 0&&(s=-1);h===void 0&&(h=-1);l=$.ajax({type:"POST",cache:!1,url:this.ajaxBaseUrl+"ZJR",dataType:"jsonp",data:{iLine:o,sLine:n,iFrom:s,sFrom:t,iTo:h,sTo:i,sStation:null,iStationIndex:u,iTTIndex:f,bPrefereBack:e,sAbsCombID:"",format:"json"}});l.done(function(n){c.SucessZjrAjax(n,f)});l.fail(function(){c.openErrorModal(c.msgService.getMessages().showZjr.sErrorMessageForNoZJR)})},f.prototype.mangePdfIcon=function(n,t){var i=this;$(".ico-pdfzjr").click(function(){i.zjrPDF(n,t)});this.manageIconWraper("pdfWrapper",i.msgService.getMessages().showZjr.sPDF)},f.prototype.manageRouteIcon=function(n,i){var r=this;$(".ico-route").click(function(){r.closeModals();r.removeLinesLayer();r.removeDrawLineMarkers();r.getLineForDrawLine(n.sLine,i,n.aoStations[0].sFrom,n.aoStations[n.aoStations.length-1].sFrom,n.iStationIndex,n.sAbsCombID);!r.hasResetButton&&r.isFormMap&&(r.map.addControl(new t("Smazat trasy linky"),{left:"120px",top:"17px"}),r.hasResetButton=!0)});this.manageIconWraper("routeWraper",r.msgService.getMessages().showZjr.sRoute)},f.prototype.manageIconWraper=function(n,t){var i=this;$("."+n).mouseover(function(r){var e=$(i.getElement(r,n)),u=document.createElement("div"),f;u.innerHTML='<span class="notes-container">'+t+"<\/span>";u.classList.add("map-station-tooltip");u.classList.add("note-container");f=$(e).offset();i.showStationTooltip($(e)[0],u,new SMap.Pixel(f.top,f.left))});$("."+n).mouseout(function(t){var r=$(i.getElement(t,n));$(r).children(".map-station-tooltip").remove()})},f.prototype.managePanoIcon=function(n){var t=this;$(".ico-pano").click(function(){t.stationPanorama(n.aoStations[n.iStationIndex])});this.manageIconWraper("panoWrapper",t.msgService.getMessages().showZjr.sPano)},f.prototype.manageNoteBubbles=function(n){var t=this;$(".bhlpS").mouseover(function(i){for(var r,e,c=$(i.target),o=$(t.getElement(i,"bhlpS")),h=$(o).attr("i"),s=h.split("|"),u="",f=0;f<s.length;f++)u+=n.asBubble[s[f]],u+="<br>";r=document.createElement("div");r.innerHTML='<span class="notes-container"><h4 style="display: inline; " >'+t.msgService.getMessages().showZjr.sNotes+"<\/h4><br>"+u+"<\/span>";r.classList.add("map-station-tooltip");r.classList.add("note-container");e=$(o).offset();t.showStationTooltip($(t.getElement(i,"bhlpS"))[0],r,new SMap.Pixel(e.top,e.left))});$(".bhlpS").mouseout(function(n){var i=$(t.getElement(n,"bhlpS"));$(i).children(".map-station-tooltip").remove()})},f.prototype.makeZjrHtmlHeader=function(n){return'<div class="headZjr"><h2>'+(n.bExclusion?'<span class="vylukaWrapper"><img src=/images/vyluka.png class="vyluka" alt="Vyluka"  /><\/span>':"")+this.msgService.getMessages().showZjr.sLineLabelCap+" "+n.sRecap+'<span style="margin-left:50px;"><\/span><span class="pdfWrapper"><img src=/images/file-pdf-regular.svg class="ico-pdfzjr" alt="PDF" /><\/span>'+(this.isMafraSK?"":'<span class="panoWrapper"><img src=/images/panorama-solid.svg class="ico-pano" alt="Panorama" /><\/span>')+'<span class="routeWraper"><img src=/images/route-solid.svg class="ico-route" alt="Route" /><\/span><\/h2><\/div>'},f.prototype.showZjrModal=function(n,t){this._zjrModal.isOpen?$(".stat").height($(".zjrtd1 .zjr2").height()+$(".zjrrem div").height()+10-$(".changes").height()):(this._zjrModal.show("#maps-zjr-modal"),this._zjrModal.exitOnClikOtside(),$(".stat").height($(".zjrtd1 .zjr2").height()+$(".zjrrem div").height()+10-$(".changes").height()),$(".widthForParam")[0].style.left=$(".widthForParam").parent().width()/2-$(".widthForParam")[0].offsetWidth/2+"px",$(".widthForParam")[0].style.top=$(".widthForParam").parent().height()/2-$(".widthForParam")[0].offsetHeight/2+"px");this.manageZjrProcesses(n,t)},f.prototype.makeZjrMovable=function(){var t=[0,0],n=$(".widthForParam")[0],r=$("#mapsZjrModalContent .headZjr")[0],i=!1;r.addEventListener("mousedown",function(r){r.which==1&&(i=!0,t=[n.offsetLeft-r.clientX,n.offsetTop-r.clientY])},!0);r.addEventListener("mouseup",function(){i=!1},!0);document.addEventListener("mousemove",function(r){r.preventDefault();i&&(n.style.left=r.clientX+t[0]+"px",n.style.top=r.clientY+t[1]+"px")},!0)},f.prototype.resizeZjrModal=function(){var n=$(".stat"),t=$(".stat .zjr2"),i,r;n.height()<t.height()&&(i=$(".selsttr").position(),i.top+$(".selsttr").height()/2>$(".stat").height()&&$(".stat").scrollTop(i.top));n.height()<t.height()&&n[0].clientWidth<n[0].offsetWidth&&(r=n[0].offsetWidth-n[0].clientWidth-n[0].clientLeft,n.css("min-width",t[0].clientWidth+r),n[0].offsetWidth>n[0].clientWidth&&$(".mapsZjrModalContent .headZjr").outerWidth($(".zjr1").width()))},f.prototype.changeStationbyClick=function(n,t){var i=this;$(".zjr2 a").click(function(r){var f=$(r.target).attr("i"),u;f!=""&&(u=n.aoStations[f],i.getZJR(n.sLine,u.sFrom,u.sTo,null,u.iStationIndex,t,u.bPrefereBack,n.iLine,u.iFrom,u.iTo))})},f.prototype.changeStationBySelect=function(n,t){var i=this;$("#chsel").change(function(r){var u=r.target.value;u!=""&&n.aoChange[u]&&i.getZJR(n.aoChange[u].sLine,n.aoChange[u].sFrom,n.aoChange[u].sTo,null,n.aoChange[u].iStationIndex,t,n.aoChange[u].bPrefereBack,n.aoChange[u].iLine,n.aoChange[u].iFrom,n.aoChange[u].iTo)})},f.prototype.manageChangeStation=function(n,t){this.changeStationbyClick(n,t);this.changeStationBySelect(n,t)},f.prototype.manageZjrProcesses=function(n,t){var i=this;this.manageChangeStation(n,t);this.mangePdfIcon(n,t);this.manageRouteIcon(n,t);this.isMafraSK||this.managePanoIcon(n);this.manageIconWraper("vylukaWrapper",i.msgService.getMessages().showZjr.sExclave);this.manageNoteBubbles(n);this.makeZjrMovable();this.resizeZjrModal()},f.prototype.SucessZjrAjax=function(n,t){if(n){if(this._zjrModal==null){var i=new Base.ModalParams("widthForParam",null,!1,!0,1,!1,!1);this._zjrModal=new Base.Modal(null,this.msgService,null,i,null)}$("#mapsZjrModalContent").html(this.makeZjrHtmlHeader(n)+this.zjrResults(n));this.showZjrModal(n,t)}else this.openErrorModal(this.msgService.getMessages().showZjr.sErrorMessageForNoZJR)},f.prototype.closeModals=function(){this._paoramaModal&&this._paoramaModal.isOpen&&this._paoramaModal.close();this._zjrModal&&this._zjrModal.isOpen&&this._zjrModal.close();this.map.getCard()&&this.map.removeCard()},f.prototype.getStationLinesDepParams=function(n,t,i,r,u,f,e){var o=this,h,s;if(this._Card!=null&&this._Card.getContainer()!=null&&this._Card.getMap()!=null&&$(this._Card.getContainer()).offset()&&this.map.getCard()&&this.map.getCard().isVisible()){if(h=this.map.getCard().getAnchor(),e.equals(h))return;this.map.removeCard()}s=$.ajax({type:"POST",cache:!1,url:this.ajaxBaseUrl+"StationLinesDep",dataType:"jsonp",data:{iItem:n,SLine:t,sDate:i,sTime:r,iListID:u,sName:f,format:"json"}});s.done(function(n){o.depLinesAjaxSucess(n,f,e)});s.fail(function(){o.openErrorModal(o.msgService.getMessages().showZjr.sErrorMessageForNoListOfLines)})},f.prototype.makeCardName=function(n){var t=document.createElement("div");return t.innerHTML="<strong>"+n+"<\/strong>",t.classList.add("panoTextNoHover"),t},f.prototype.addLineToCard=function(n){var u=this,t=document.createElement("div"),i,r;return t.className="linebox"+n.bIsRouteLine,i=document.createElement("img"),i.src=n.imagePath,i.title=n.imageTitle,i.className=n.imageClass,t.appendChild(i),r=document.createElement("span"),r.className="bignum",r.style.color=n.imageColor,r.innerHTML="&nbsp"+n.sLineName,t.appendChild(r),t.innerHTML+="&nbsp"+(n.sLangDirection+" "+n.sDirection+"<br />")+n.sDepTime+'<div class="break"><\/div><\/div>',t.addEventListener("click",function(){u.getZJR(n.sLineName,n.sStation,n.sDirection,n.sStation,0,n.iTTIndex,!1,null)}),this._Card.getBody().appendChild(t),$(t).outerHeight()+3},f.prototype.depLinesAjaxSucess=function(n,t,i){var r,f,o,e,u,s;if(n&&this.showMhdZjr==1){if(this._Card.getBody().innerHTML="",this._Card.getHeader().innerHTML="",this._Card.getHeader().appendChild(this.makeCardName(t)),r=document.createElement("div"),r.className="deptitle cb",r.innerHTML=n.title,this._Card.getBody().appendChild(r),this.map.addCard(this._Card,i,!0),f=0,o=0,n.aoContent!=null)for(e=0;e<n.aoContent.length;e++)u=n.aoContent[e],u.iType!=200&&u.iType!=202&&u.iType!=201&&u.sLineName.length<5&&(o++,s=this.addLineToCard(u),o<7&&(f+=s));n.aoContent==null||f==0?(r.innerHTML=this.msgService.getMessages().showZjr.sNoMhdLines24hours,this._Card.getBody().style.height=r.offsetHeight+4+"px"):this._Card.getBody().style.height=f+r.offsetHeight+4+"px";this._Card.makeVisible()}},f.prototype.showTTObjects=function(n,t){for(var i=this,u=this.getStationMarkers(),e=typeof $("#positionAC").val()=="string"?$("#positionAC").val().toString():"",o=function(){var o=n[f],l=new SMap.Coords(o.lng,o.lat),y,a,s,v,h,c;if(e&&r._drawLineMarkers&&r._drawLineMarkers.length!=0&&!r.hasResetButton&&o.name==e&&r.setSelectedStation(l,!1,o),y=!1,u&&u.length)for(a=0;a<u.length;a++)if(c=u[a],c&&c.getCoords().equals(l)){y=!0;r.addOrRemoveMarkerLabel(o,c.getContainer()[SMap.LAYER_MARKER],t);break}y||(s=document.createElement("div"),v=document.createElement("img"),v.src=r.mapSettings.parentInputType==Components.AutocompleteInputType.To?"/images/map_pin_finish_focus_bg.png":r.mapSettings.parentInputType==Components.AutocompleteInputType.Via?"/images/map_pin_transfer_focus_bg.png":"/images/map_pin_start_focus_bg.png",v.classList.add("zindexOne"),s.appendChild(v),s.className="station-marker",s.id="st-marker-"+o.listId+"-"+o.item,h=document.createElement("div"),h.innerHTML="<strong>"+o.name+" <\/strong>",o.info&&(h.innerHTML=h.innerHTML+'Linka: <span class="station-desc-container" style="font-weight:bold">'+o.info+"<\/span>"),h.classList.add("map-station-tooltip"),s.addEventListener("mouseover",function(){var n=i.getMarkerPosition(l);i.showStationTooltip(s,h,n,6,0,20)}),s.addEventListener("mouseout",function(){s.contains(h)&&s.removeChild(h)}),c=new SMap.Marker(l,"st-"+o.key,{url:s,anchor:{left:12,bottom:18}}),s.addEventListener("click",function(){var n=o,t,r;i._isMarkerClicked=!0;i._CardFirst=!0;i.setSelectedStation(SMap.Coords.fromWGS84(o.lng,o.lat),!1,n);i.showMhdZjr==1&&o.nodeName!=""&&(t=new SMap.Coords(n.lng,n.lat),i._Card!=null&&i._Card.getContainer()!=null&&i._Card.getMap()!=null&&$(i._Card.getContainer()).offset()&&i.map.getCard()&&i.map.getCard().isVisible()&&(r=i.map.getCard().getAnchor(),t.equals(r)||i.map.removeCard()),i.getStationLinesDepParams(o.stationItem,null,null,null,o.listId,o.name,t));s.contains(h)&&s.removeChild(h)}),r.addOrRemoveMarkerLabel(o,s,t),r.getStations().push(o),r.getStationMarkers().push(c),r.getStationMarkersLayer().addMarker(c))},r=this,f=0;f<n.length;f++)o();this.removeNotUsedStationMarkers(n)},f.prototype._genStations=function(n){var t="",u=n.aoStations.length,r,i;if(u>0){for(r=n.asZones!=null,t+='<div class="stat">',t+='<table class="zjr2"><thead><tr><th colspan="2" class="zjrday">'+this.msgService.getMessages().showZjr.sStop+"<\/th>",r&&(t+='<th class="zones">'+this.msgService.getMessages().showZjr.sZones+"<\/th>"),t+="<\/tr><\/thead>",t+="<tbody>",i=0;i<u;i++)t+="<tr",n.iStationIndex==i&&(t+=' class="selsttr" '),t+='><td class="statm">',t+=n.aiStDist[i]>-1?n.aiStDist[i]:"&nbsp;",t+='<\/td><td class="zast">',t+=n.iStationIndex==i?'<span class="selst">'+n.aoStations[i].sFrom+"<\/span>":'<a href="#" title="'+this.msgService.getMessages().showZjr.sGetFromStation+'" i="'+i+'">'+n.aoStations[i].sFrom+"<\/a>",n.aoStations[i].sNotes&&n.aoStations[i].sNotes!=""&&(t+=" "+n.aoStations[i].sNotes),t+="<\/td>",r&&(t+='<td class="zones">'+n.asZones[i]+"<\/td>"),t+="<\/tr>";t+="<\/tbody><\/table><\/div>"}return t},f.prototype.genZJRData=function(n){var t="",o,i,f;if(t+='<td class="zjrtd1" ><table class="zjr2"><thead><tr>',n.asTabValidity&&n.asTabValidity.length>=0)for(i=0;i<=n.asTabValidity.length-1;i++)t+='<th colspan="2" class="zjrday',i==n.asTabValidity.length-1&&(t+=" nob"),t+='">'+n.asTabValidity[i]+"<\/th>";else this.openErrorModal(n.sRecap);t+="<\/tr><\/thead><tbody>";for(var u=!1,s=!1,r=n.iMinHour,e=0;!s;){for(e++,t+="<tr",u&&(t+=' class="even"'),u=!u,t+=">",i=0;i<=n.asTabValidity.length-1;i++)t+='<td class="zjrhour">'+r+'<\/td><td class="zjrmin',i==n.asTabValidity.length-1&&(t+=" nob"),t+='">',t+=n.asTimes[i][r]?n.asTimes[i][r]:"&nbsp;",t+="<\/td>";t+="<\/tr>";n.iMaxHour==r&&(s=!0);r++;r>23&&(r=0)}if(o=24,e<o)for(i=e;i<o;i++){for(t+="<tr",u&&(t+=' class="even"'),t+=">",f=0;f<n.asTabValidity.length;f++)t+='<td class="zjrhour">&nbsp;<\/td><td class="zjrmin',f==n.asTabValidity.length-1&&(t+=" nob"),t+='">&nbsp;<\/td>';t+="<\/tr>"}return t+"<\/tbody><\/table><\/td>"},f.prototype._genChanges=function(n){var t="",r,i;if(t+='<div class="changes"><div class="chlbl">'+this.msgService.getMessages().showZjr.sLinesAtStopLabel+":<\/div>",n.aoChange&&n.aoChange.length>0){for(r=n.aoChange.length,t+='<select id="chsel"><option value="">&nbsp;'+this.msgService.getMessages().showZjr.sLineLabel1+" → "+this.msgService.getMessages().showZjr.sDirectionLabel,i=0;i<r;i++)t+='<option value="'+i+'">&nbsp;'+n.aoChange[i].sLine+" → "+n.aoChange[i].sTo+"<\/option>";t+="<\/select>"}else t+="<span>"+this.msgService.getMessages().showZjr.sNoLinesLabel+"<\/span>";return t+"<\/div>"},f.prototype._genRem=function(){return'<td class="zjrrem btop"><div>'+this.msgService.getMessages().showZjr.sMessageForUndrstanfing+"<\/div><\/td>"},f.prototype.generateZJR=function(n,t){var i="";return i+='<table class="zjr1"><tr>',i+=this.genZJRData(n),i+="<\/td>",i+="<td ",t&&(i+='rowspan="2" '),i+='class="stattd">',i+=this._genStations(n),i+=this._genChanges(n),i+="<\/td><\/tr><tr>",t&&(i+=this._genRem()),i+"<\/tr><\/table>"},f.prototype.zjrResults=function(n){var t=n.asBubble!=null&&n.asBubble.length>0;return this.generateZJR(n,t)},f.prototype.getLineForDrawLine=function(n,t,i,r,u,f){var e=this,o=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"ZJRLinesForDraw",dataType:"jsonp",data:{prefixText:n,ttIndex:t,sFrom:i,sTo:r,iStationIndex:u,absCombId:f,format:"json"}});o.done(function(n){var u=[],t,i,r,s;if(n)for(t=0;t<n.aoTrains[0].aoStations.length;t++){var f=n.aoTrains[0].aoStations[t],o=SMap.Coords.fromWGS84(f.lng,f.lat),c="<strong>"+f.name+"<\/strong>"+e.getConnDesc(n.aoTrains[0],"");if(e.addDrawLineMarker(o,f,t==0,c),u.push(o),i=n.aoTrains[0].aoStations[t].aoCoor,i)for(r=0;r<i.length;r++)s=SMap.Coords.fromWGS84(i[r].y,i[r].x),u.push(s)}e.addRouteLine("#000000",u);var h=e.map.computeCenterZoom(u,!0),l=h[0],a=h[1];e.map.setCenterZoom(l,a);e.getLinesLayer().redraw(!0)});o.fail(function(){return e.openErrorModal(e.msgService.getMessages().showZjr.sErrorMessageForNoZJR),null})},f.prototype.addDrawLineMarker=function(n,t,i,r){var s=this,u=document.createElement("div"),c=document.createElement("img"),o,e,f,h,l;c.src="/images/stopmarker.png";c.classList.add("zindexZero");u.appendChild(c);u.className="station-marker";o=new SMap.Marker(n,t+"-"+n.x+"-"+n.y,{url:u,anchor:{left:6,bottom:12}});e=document.createElement("div");e.innerHTML=r;e.classList.add("map-station-tooltip");u.addEventListener("mouseover",function(){var t=s.getMarkerPosition(n);s.showStationTooltip(u,e,t)});u.addEventListener("mouseout",function(){u.contains(e)&&u.removeChild(e)});s=this;u.addEventListener("click",function(i){s.setSelectedStation(n,!1,t);i.stopImmediatePropagation()});i?(f=document.createElement("div"),h=document.createElement("a"),h.classList.add("bubble-close"),f.innerHTML=r,f.appendChild(h),$(h).click(function(n){u.contains(f)&&u.removeChild(f);n.stopImmediatePropagation()}),$(f).mouseover(function(n){n.stopImmediatePropagation()}),f.classList.add("map-train-tooltip"),u.appendChild(f),this.getDrawLineMarkers().push(o),this.getStationMarkersLayer().addMarker(o)):(this.getDrawLineMarkers().push(o),this.getStationMarkersLayer().addMarker(o));l=typeof $("#positionAC").val()=="string"?$("#positionAC").val().toString():"";l&&t.name==l&&this.setSelectedStation(n,!1,t)},f.prototype.stationPanorama=function(n){var t=n.iCooX,i=n.iCooY;this.showPanoramaAtStationPosition(new SMap.Coords(i,t),n.sFrom)},f.prototype.showPanoramaAtStationPosition=function(n,t){var i,r;this._paoramaModal==null&&(this._paoramaModal=new Base.Modal(null,this.msgService,null,new Base.ModalParams("panoramaWidth",null,null,null,3),null));this._paoramaModal.show("#maps-panorama-modal");this._paoramaModal.exitOnClikOtside();i='<div class="headPano"><h2>'+t+"<\/h2><\/div>";$("#panoramaModalContent").html(i);$("#panoramaModalContent").height("100%");$("#panoramaModalContent").width("100%");r=new SMap.Pano.Scene(document.querySelector("#panoramaModalContent"));SMap.Pano.getBest(n,50).then(function(n){r.show(n)})},f.prototype.zjrPDF=function(n,t){var i=new Conn.PdfModel;i.context=1;i.jsZjrData=new Zjr.ResultJsModel;i.jsZjrData.stationIndex=n.iStationIndex;i.jsZjrData.TTIndex=t;i.jsZjrData.searchItem=new Pref.PrefsSearchItem;i.jsZjrData.searchItem.oZjr=new Pref.PrefsItemZjr;i.jsZjrData.searchItem.sCombId=n.sAbsCombID;i.jsZjrData.searchItem.oZjr.oUserInput=new Pref.PrefsUserInputZjr;i.jsZjrData.searchItem.oZjr.oUserInput.bWholeWeek=!0;var r=new Date,e=r.getTimezoneOffset(),o=r.toISOString().split(".")[0]+"+"+("0"+Math.abs(e/60)).slice(-2)+":00";i.jsZjrData.searchItem.oZjr.oUserInput.dtSearchDate=o;i.jsZjrData.searchItem.oZjr.oUserInput.sLine=n.sLine;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom=new Pref.PrefsObjectItem;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom.sAdvancedName=n.aoStations[n.iStationIndex].sFrom;i.jsZjrData.searchItem.oZjr.oUserInput.oFrom.sName=n.aoStations[n.iStationIndex].sFrom;i.jsZjrData.searchItem.oZjr.oUserInput.oTo=new Pref.PrefsObjectItem;i.jsZjrData.searchItem.oZjr.oUserInput.oTo.sAdvancedName=n.aoStations[n.iStationIndex].sTo;i.jsZjrData.searchItem.oZjr.oUserInput.oTo.sName=n.aoStations[n.iStationIndex].sTo;var s=this.isMafraSK?this.ajaxBaseUrl.replace("Ajax","zcp/pdf"):this.ajaxBaseUrl.replace("Ajax","zjr/pdf"),u=$("#idosform"),f=$("<form />",{target:"_blank",action:s,method:"post",id:"pdfForm"}).append($("<input/>",{type:"hidden",name:"model",value:JSON.stringify(i)}));u.append(f);f.submit();u.remove("#pdfForm");event.preventDefault()},f.prototype.drawTrainRoute=function(t,i){var r=this._mapData.aoTrains[t],l,a,u;if(n.TrainMapData.hasStations(r)){var e="#aaa",o=!1,s=[],h=[],c=[];for(this.hasWalkToNextTrain(this._mapData.aoTrains,t)&&(o=!0,l=r.aoStations[r.aoStations.length-1],a=f.getStationCoords(l),this.addWalkLine(a,f.getStationCoords(n.TrainMapData.getFirstStation(this._mapData.aoTrains[t+1])))),u=0;u<r.aoStations.length;u++)this.drawTrainStation(r,t,u,s,h,c,i,o&&u===r.aoStations.length-1);this.addRouteLine(e,h);this.addRouteLine(r.sColor,s);this.addRouteLine(e,c)}},f.prototype.addStartAndFinishMarkers=function(n){var h=this._mapData.aoTrains.filter(function(n){return n.bHasStart}),t=this._mapData.aoTrains.filter(function(n){return n.bHasEnd}),i,r,u,c,e,o,s,l;Base.Support.emptyArray(h)||(i=h[0],r=i.aoStations.filter(function(n){return n.bIsOnSearchedRoute}),Base.Support.emptyArray(r)||(u=r[0],c=f.getStationCoords(u),this.drawStartOrFinishMarker(!0,c,this.fromPosition,u,i,n)));Base.Support.emptyArray(t)||(e=t[t.length-1],o=e.aoStations.filter(function(n){return n.bIsLastOnSearchedRoute}),Base.Support.emptyArray(o)||(s=o[0],l=f.getStationCoords(s),this.drawStartOrFinishMarker(!1,l,this.toPosition,s,e,n)))},f.prototype.drawTrainStation=function(t,i,r,u,e,o,s,h){var c=t.aoStations[r],a=f.getStationCoords(c),v=null,l=null,y;this.fillRouteCoors(c,a,u,e,o,s);r==0&&i>0&&i<=this._mapData.aoTrains.length-1&&!this.hasWalkToNextTrain(this._mapData.aoTrains,i-1)&&(l=this._mapData.aoTrains[i-1],v=n.TrainMapData.getLastStation(l));y=r===n.TrainMapData.getStationIndexOnRoute(n.TrainMapData.getFirstStationOnRoute(t),t);this.addStationMarker("/images/map_pin_bg.png",a,this.getTooltipDescription(c,v,t,l,r<t.aoStations.length-1,h),"st-"+i+"-"+r,y,!1,s,t,null,null,null)},f.prototype.drawStartOrFinishMarker=function(n,t,i,r,u,f){var o=null,e="",c=n?this.canDrawUserFromPositionPoint():this.canDrawUserToPositionPoint(),h=!1,s;i!=null&&!t.equals(i)&&c?(o=i,e=this.msgService.getMessages().conn.placeFrom(this.mapSettings.sFromName),h=!0,s="walk-start",n||(e=this.msgService.getMessages().conn.placeTo(this.mapSettings.sToName),s="walk-finish"),this.addStationMarker("/images/map_pin_bg.png",i,null,s,!1,!1,f,null,null,null,null),this.addWalkLine(i,t)):(o=t,e=this.getTooltipDescription(r,null,u,null,n));this.addStationMarker(n?"/images/map_pin_start.png":"/images/map_pin_finish_edge.png",o,e,n?"st-start":"st-finish",!h&&n,!0,null,null,null,null,null)},f.prototype.hasWalkToNextTrain=function(t,i){return i>=0&&i<t.length-1&&t[i].bHasEnd&&t[i+1].bHasStart&&n.TrainMapData.hasStations(t[i])&&n.TrainMapData.hasStations(t[i+1])&&!f.getStationCoords(n.TrainMapData.getLastStation(t[i])).equals(f.getStationCoords(n.TrainMapData.getFirstStation(t[i+1])))},f.prototype.fillRouteCoors=function(n,t,i,r,u,f){if(n.bIsOnSearchedRoute?i[i.length]=t:i.length===0?r[r.length]=t:u[u.length]=t,f.push(t),n.aoCoor!=null)for(var e=0;e<n.aoCoor.length;e++)n.bIsOnSearchedRoute?(i[i.length]=SMap.Coords.fromWGS84(n.aoCoor[e].y,n.aoCoor[e].x),f.push(i[i.length-1])):i.length===0?(r[r.length]=SMap.Coords.fromWGS84(n.aoCoor[e].y,n.aoCoor[e].x),f.push(r[r.length-1])):(u[u.length]=SMap.Coords.fromWGS84(n.aoCoor[e].y,n.aoCoor[e].x),f.push(u[u.length-1]))},f.prototype.deleteMapRoutes=function(){this.removeLinesLayer();this.removeMarkersLayer();this._mapData&&(typeof this._mapData.aoLines!="undefined"&&(this._mapData.aoLines=[]),typeof this._mapData.aoBlackLines!="undefined"&&(this._mapData.aoBlackLines=[]))},f.prototype.addRouteLine=function(n,t){if(t&&t.length>0){var i=new SMap.Geometry(SMap.GEOMETRY_POLYLINE,null,t,{color:"#000000",outlineWidth:0,width:6,opacity:1}),r=new SMap.Geometry(SMap.GEOMETRY_POLYLINE,null,t,{color:n,outlineWidth:0,width:4,opacity:1}),u=this.getLinesLayer();u.addGeometry(i);u.addGeometry(r);this._mapData&&(this._mapData.aoBlackLines.push(i),this._mapData.aoLines.push(r))}},f.prototype.addWalkLine=function(n,t){var i=[],r,u;i[0]=n;i[1]=t;r=new SMap.Geometry(SMap.GEOMETRY_POLYLINE,null,i,{color:this._walkColor,outlineWidth:0,width:3,opacity:1});u=this.getLinesLayer();u.addGeometry(r);this._mapData.aoBlackLines.push(null);this._mapData.aoLines.push(r)},f.prototype.addStationMarker=function(n,t,i,r,u,f,e,o,s,h,c){var k=this,l,d,it,g,y,p,a,b,rt,w,nt,v,tt;return r===void 0&&(r=null),e===void 0&&(e=null),o===void 0&&(o=null),s===void 0&&(s=null),l=document.createElement("div"),d=document.createElement("img"),d.src=n,f&&(this.isFormMap?l.classList.add("map-start-end-marker-from"):l.classList.add("map-start-end-marker")),l.appendChild(d),!f&&e&&e.push(t),it=this.getMarkersLayer(),s||(s=f?{left:9,bottom:8}:{left:6,bottom:12}),g=new SMap.Marker(t,r,{url:l,anchor:s}),this.showMhdZjr==1&&!f&&c&&l.addEventListener("click",function(){c&&k.showMhdZjr==1&&(k._Card.setSize(362,350),k.getStationLinesDepParams(c.item,null,null,null,c.listId,c.name,t))}),f&&(y=document.createElement("div"),y.innerHTML=i,y.classList.add("map-station-tooltip"),p=this,l.addEventListener("mouseover",function(){if(p._showFrom){var n=p.getMarkerPosition(t);p.showStationTooltip(l,y,n)}}),l.addEventListener("mouseout",function(){p._showFrom&&l.removeChild(y)})),!i||f&&u||(u&&o?(a=document.createElement("div"),b=document.createElement("a"),b.classList.add("bubble-close"),a.innerHTML=i,a.appendChild(b),rt=this.getMarkerPosition(t),w=document.createElement("div"),w.innerHTML=i,w.classList.add("map-station-tooltip"),nt=this,$(b).click(function(){l.removeChild(a);l.addEventListener("mouseover",function(){nt.showStationTooltip(l,w,rt)});l.addEventListener("mouseout",function(){l.removeChild(w)});nt._showFrom=!0}),a.classList.add("map-train-tooltip"),l.appendChild(a)):(v=document.createElement("div"),v.innerHTML=i,v.classList.add("map-station-tooltip"),v.clientWidth,tt=this,l.addEventListener("mouseover",function(){var n=tt.getMarkerPosition(t);tt.showStationTooltip(l,v,n)}),l.addEventListener("mouseout",function(){l.removeChild(v)}))),it.addMarker(g),g},f.prototype.positionMarker=function(n,t){n.setCoords(t);this.getMarkersLayer().positionMarker(n)},f.prototype.getElement=function(n,t){var i=$(n.target),r;return i.hasClass(t)?i[0]:(r=i.parents("."+t),r.length>0)?r[0]:null},f.prototype.showStationTooltip=function(n,t,i,r,u,f){var k,c;r===void 0&&(r=0);u===void 0&&(u=0);f===void 0&&(f=0);n.appendChild(t);var s=$(t),p=0,l=$("#"+this._mapId).width(),a="left",v="bottom",e,o,w=-1,b=-1,d=parseFloat(getComputedStyle(n).fontSize),h=.7*d,y=1.2*d;n?(w=$("#"+this._mapId).offset().left-$(document).scrollLeft(),b=$("#"+this._mapId).offset().top-$(document).scrollTop(),e=$(n).offset().left-$(document).scrollLeft()-w,o=$(n).offset().top-$(document).scrollTop()-b):(e=Math.round(i.x),o=Math.round(i.y));e+=r;o+=u;k=s.outerHeight();c=s.outerWidth();$(s).width(s.width());o-k-y<=0&&(v="top",u+=$(n).height());e-3*h+c>=l&&(a="right");a=="left"&&v=="top"?(e=e-h,o=o+y+u+f,e<p&&(e=p),this.addMarkerTooltipPositionClass(s,"left-top")):a=="right"&&v=="top"?(e=e-r+3*h>l?l-c:e+3*h-c-r,o=o+y+u+f,this.addMarkerTooltipPositionClass(s,"right-top")):a=="left"&&v=="bottom"?(e=e-h,o=o-y-k-u,e<p&&(e=p),this.addMarkerTooltipPositionClass(s,"left-bottom")):a=="right"&&v=="bottom"&&(e=e-r+3*h>l?l-c:e+3*h-c-r,o=o-y-k-u,this.addMarkerTooltipPositionClass(s,"right-bottom"));w>-1&&(e=e+w);b>-1&&(o=o+b);s.css("left",e+"px");s.css("top",o+"px")},f.prototype.addMarkerTooltipPositionClass=function(n,t){n.removeClass("left-bottom right-bottom left-top right-top").addClass(t)},f.prototype.getMarkerPosition=function(n){var t=this.latLngToPixels(n),i=$("#"+this._mapId).offset();return new SMap.Pixel(t.x+i.left,t.y+i.top)},f.prototype.latLngToPixels=function(n){var t=this.map.getProjection().coordsToPixel(n,this.map.getCenter(),this.map.getZoom(),SMap.NORTH),i=this.getMapBorderCorners(),u=i[0],f=i[1],r=Math.pow(2,this.map.getZoom());return new SMap.Pixel((t.x-u.x)*r,(t.y-f.y)*r)},f.prototype.getMapBorderCorners=function(){var n=this.map.getSize(),t=Math.round(n.x/2),i=Math.round(n.y/2),r=new SMap.Pixel(-t,-i),u=new SMap.Pixel(t,i);return[r,u]},f.prototype.getTooltipDescription=function(n,t,i,r,u,f){var h,o,c,s,e,l;return f===void 0&&(f=!1),c="",s="",u?(h=this.msgService.getMessages().conn.dep,o=this.msgService.getMessages().conn.arr,Base.Support.stringIsEmpty(n.sArr)||(c=" "+o+" "+n.sArr+", "),s=n.sDep):(h=this.msgService.getMessages().conn.arr,o=this.msgService.getMessages().conn.dep,s=Base.Support.stringIsEmpty(n.sArr)?n.sDep:n.sArr),e="<strong>"+n.name+"<\/strong>",t&&r&&(l="",l=Base.Support.stringIsEmpty(t.sArr)?t.sDep:t.sArr,e+=this.getConnDesc(r,", "+o+" "+l)+"<br/>"),e+=this.getConnDesc(i,", "+c+h+" "+s),f&&(e+="<br/>"+this.getWalkDesc(i)),e},f.prototype.getConnDesc=function(n,t){var r="",i;return n.bHasIDSLineSName||(r=Base.Support.stringIsEmpty(n.sLineDesc)?n.sType+" "+n.sLine:n.sType+" "+n.sLineDesc),i='<span class="conn-desc-container"><span class="wwwtt tt-icon" style="color:'+n.sColor+'">&#'+n.iAsc+";<\/span>"+('<span style="color:'+n.sColor+';">'+r),Base.Support.stringIsEmpty(n.sName)||(i+=" "+n.sName),i+"<\/span>"+t+"<\/span>"},f.prototype.getWalkDesc=function(n){var i=this.msgService.getMessages().conn.nodePedestrianShift,r="",t;return n.iLinkDist>0&&(i=this.msgService.getMessages().conn.pedestrianShiftLabel,t=this.msgService.getMessages().share.minutes(n.iLinkDist),r=Base.Support.stringIsEmpty(n.sLinkDesc)?t:t+", "+n.sLinkDesc),'<span style="color: #000;">'+i+"<\/span>"+r},f.prototype.initMapForm=function(){var t=this,n=this;$(".map-controls-panel").show();$("label[for='positionAC'] .label-span").html(Components.Autocomplete.GetLabelForInputType(this.mapSettings.parentInputType,this.msgService));this.mapSettings.parentInputType===Components.AutocompleteInputType.From?($("#positionAC").data("searchbyposition","true"),$(".map-controls-panel .ico-position").show(),$(".map-controls-panel .ico-position").click(function(n){n.preventDefault();n.stopPropagation();t._positionData.GetCurrentPosition(!0,t.getPositionSuccess.bind(t))})):($("#positionAC").removeData("searchbyposition"),$(".map-controls-panel .ico-position").hide());this.positionAC=new Components.Autocomplete("positionAC",this._positionData,this.msgService,undefined,!1,this.mapSettings.parentInputType,function(){$(".map-controls-panel button").click()},this._isFirstInit,!0);Components.Autocomplete.hasError($("#"+n.mapSettings.parentInputSelector))&&$("#positionAC").click();$(".map-controls-panel button").click(function(){var t=$("#positionAC").val(),i=$("#positionACHidden").val();$("#"+n.mapSettings.parentInputSelector).val(t);$("#"+n.mapSettings.parentInputHiddenSelector).val(i);$("#"+n.mapSettings.parentInputSelector).closest(".inp-combined").toggleClass("filled",t&&typeof t=="string"&&!Base.Support.stringIsEmpty(t.toString()));n.positionAC.hasError()?$("#"+n.mapSettings.parentInputSelector).click():Components.Autocomplete.hideError($('label[for="'+n.mapSettings.parentInputSelector+'"]'),$("#"+n.mapSettings.parentInputSelector));n._mapModal.close()});this._isFirstInit&&(this._isFirstInit=!1)},f.prototype.stationChanged=function(n){var f=typeof $("#positionAC").val()=="string"?$("#positionAC").val().toString():"",r=$("#positionAC").attr("placeholder"),e=$("#positionACHidden").val(),t=this.getHiddenItem(f,e,r),o=$("#positionACPosition").val(),i,u;this.setPositionData(o,t);!t||(isNaN(t.coorX)||t.coorX===0)&&(isNaN(t.coorY)||t.coorY===0)?(i=f,u=!1,Base.Support.stringIsEmpty(i)&&(Base.Support.stringIsEmpty(r)?i=this._mostPriorObjectMask:(i=r,u=!0)),this.showOnMapByObjectName(i,u,!0,n)):t.myPosition?this.setMapAndObjectMarker(t.coorX,t.coorY,!0,!1,!1,n):this.setMapAndObjectMarker(t.coorX,t.coorY,!1,!1,t.isAddressPoint,n)},f.prototype.setMapAndObjectMarker=function(n,t,i,r,u,f){var e=null,s=!isNaN(n)&&n!==0&&!isNaN(t)&&t!==0,o;s&&(e=SMap.Coords.fromWGS84(t,n));s?(o=r&&u?this.mapSettings.notSelectedStationZoom:this.mapSettings.defaultZoom,f?this.init(e,o):this.map.setCenterZoom(e,o),r||this.setSelectedStation(e,i)):f&&this.init()},f.prototype.setSelectedStation=function(n,t,i){i&&($("#positionAC").val(i.name),$("#positionACHidden").val(Base.HiddenItem.stringify(i.name,i.listId,i.item,"",i.lat,i.lng,!1,"")),$(".map-controls-panel .inp-combined").toggleClass("filled",!Base.Support.stringIsEmpty(i.name)));switch(this.mapSettings.parentInputType){case Components.AutocompleteInputType.From:this._fromMarker?this.positionMarker(this._fromMarker,n):this._fromMarker=this.addStationMarker("/images/map_pin_start.png",n,null,"st-start",!1,!0,null,null,null,null,i?i:null);break;case Components.AutocompleteInputType.To:this._toMarker?this.positionMarker(this._toMarker,n):this._toMarker=this.addStationMarker("/images/map_pin_finish_edge.png",n,null,"st-finish",!1,!0,null,null,null,null,i?i:null)}t&&(this._myPositionMarker?this.positionMarker(this._myPositionMarker,n):this._myPositionMarker=this.addStationMarker("/images/departures.png",n,null,"my-position",!1,!1,null,null,{left:12,bottom:19},null,i?i:null))},f.prototype.showOnMapByObjectName=function(n,t,i,r){var f=n===this._mostPriorObjectMask,u=this,e=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"FindObjectByName",dataType:"jsonp",data:{name:n,onlyStations:this.mapSettings.isDeparture,format:"json"}});e.done(function(n){if(n){var o=0,s=0,e=null,h=0,c=-1;if(n&&n.name&&n.lat&&n.lng&&n.lat>0&&n.lng>0)o=n.lat,s=n.lng,e=n.name,h=n.listId,c=n.item;else if(i){u.showOnMapByObjectName(u._mostPriorObjectMask,t,!1,r);return}f||(t||$("#positionAC").val(e),$("#positionAC").attr("placeholder",e),$("#positionACHidden").val(Base.HiddenItem.stringify(e,h,c,"",o,s,!1,"")),$(".map-controls-panel .inp-combined").toggleClass("filled",!Base.Support.stringIsEmpty(e)));u.setMapAndObjectMarker(o,s,!1,f,h===1,r)}else u.setMapAndObjectMarker(0,0,!1,!0,!1,r)});e.fail(function(){u.setMapAndObjectMarker(0,0,!1,!0,!1,r);u.openErrorModal(u.msgService.getMessages().general.loadError)})},f.prototype.unselectStationMarker=function(){switch(this.mapSettings.parentInputType){case Components.AutocompleteInputType.From:this._fromMarker&&this.removeMarkerFromLayer(this._fromMarker);break;case Components.AutocompleteInputType.To:this._toMarker&&this.removeMarkerFromLayer(this._toMarker)}},f.prototype.mapClick=function(n){this.findStationMarker(n)||this.mapSettings.isDeparture||this.showOnMapByMyPosition(n.y,n.x)},f.prototype.findStationMarker=function(n){var r=this,t,u,e,i;try{if(t=r.getStationMarkers(),u=r.getStations(),typeof t!="undefined"&&t.length>0&&typeof u!="undefined"&&u.length>0&&t.length===u.length)for(e=r.map.getProjection().coordsToPixel(n,this.map.getCenter(),this.map.getZoom(),SMap.NORTH),i=t.length-1;i>=0;i--){var c=r.map.getProjection().coordsToPixel(t[i].getCoords(),this.map.getCenter(),this.map.getZoom(),SMap.NORTH),f=new SMap.Pixel(c.x-e.x,c.y-e.y),o=$(t[i].getContainer()[SMap.LAYER_MARKER]),s=0,h=0;if(o&&(s=o.width()/2,h=o.height()/2),f.x>-s&&f.x<s&&f.y>-h&&f.y<h)return r.setSelectedStation(t[i].getCoords(),!1,u[i]),!0}return!1}catch(l){}},f.prototype.showOnMapByMyPosition=function(n,t,i){var r=this,u;n&&t&&(u=$.ajax({cache:!1,dataType:"jsonp",url:r.ajaxBaseUrl+"FindObjectByPosition",data:{lat:n,lng:t,accuracy:i,format:"json"}}),u.done(function(n){n?r.setSelectedStation(SMap.Coords.fromWGS84(n.lng,n.lat),!1,n):r.openErrorModal(r.msgService.getMessages().general.noClosestObjects)}),u.fail(function(){r.openErrorModal(r.msgService.getMessages().general.noClosestObjects)}))},f.getStationCoords=function(n){return SMap.Coords.fromWGS84(n.lng,n.lat)},f.prototype.getLinesLayer=function(){return this._linesLayer||(this._linesLayer=new SMap.Layer.Geometry("geometry-layer",{supportsAnimation:!0}),this.map.addLayer(this._linesLayer).enable()),this._linesLayer},f.prototype.removeLinesLayer=function(){this._linesLayer&&(this.map.getLayer(this._linesLayer.getId())&&this.map.removeLayer(this._linesLayer),this._linesLayer=null)},f.prototype.getMarkersLayer=function(){return this._markersLayer||(this._markersLayer=new SMap.Layer.Marker("markers-layer",{supportsAnimation:!0}),this.map.addLayer(this._markersLayer).enable()),this._markersLayer},f.prototype.removeMarkersLayer=function(){this._markersLayer&&(this.map.getLayer(this._markersLayer.getId())&&this.map.removeLayer(this._markersLayer),this._markersLayer=null)},f.prototype.removeMarkerFromLayer=function(n){this._markersLayer&&this._markersLayer.removeMarker(n)},f.prototype.getStationMarkersLayer=function(){return this._stationMarkersLayer||(this._stationMarkersLayer=new SMap.Layer.Marker("station-markers-layer",{supportsAnimation:!0}),this.map.addLayer(this._stationMarkersLayer).enable()),this._stationMarkersLayer},f.prototype.removeStationMarkers=function(){if(!Base.Support.emptyArray(this._stationMarkers))for(var n=this._stationMarkers.length-1;n>=0;n--)this.removeStationMarker(this._stationMarkers[n])},f.prototype.removeStationMarker=function(n){if(this.removeStationMarkerFromLayer(n),!Base.Support.emptyArray(this._stationMarkers)){var t=this._stationMarkers.indexOf(n);t>-1&&(this._stationMarkers.splice(t,1),this._stations&&t<this._stations.length&&this._stations.splice(t,1))}},f.prototype.removeStationMarkersLayer=function(){this._stationMarkersLayer&&(this.map.getLayer(this._stationMarkersLayer.getId())&&this.map.removeLayer(this._stationMarkersLayer),this._stationMarkersLayer=null)},f.prototype.getDrawLineMarkers=function(){return this._drawLineMarkers||(this._drawLineMarkers=[]),this._drawLineMarkers},f.prototype.removeDrawLineMarkers=function(){for(var t=this.getDrawLineMarkers(),n=t.length-1;n>=0;n--)this.getStationMarkersLayer().removeMarker(t[n]);this.resetDrawLineMarkers()},f.prototype.resetDrawLineMarkers=function(){this._drawLineMarkers=[]},f.prototype.getStationMarkers=function(){return this._stationMarkers||(this._stationMarkers=[]),this._stationMarkers},f.prototype.resetStationMarkers=function(){this._stationMarkers=[]},f.prototype.getStations=function(){return this._stations||(this._stations=[]),this._stations},f.prototype.canDrawUserFromPositionPoint=function(){return!this.isDetail&&this.mapSettings&&(this.mapSettings.bIsFromMyPosition||this.mapSettings.bIsFromAddressPoint||this.mapSettings.bIsFromUserLocation)},f.prototype.canDrawUserToPositionPoint=function(){return!this.isDetail&&this.mapSettings&&(this.mapSettings.bIsToMyPosition||this.mapSettings.bIsToAddressPoint||this.mapSettings.bIsToUserLocation)},f.prototype.getMapRoute=function(n){var t=this,i=$.ajax({type:"GET",cache:!1,url:this.ajaxBaseUrl+"GetMapRoute",dataType:"jsonp",data:{handle:this.handle,connID:n,combID:this.combId,format:"json"}});i.done(function(n){n&&t.showMapRoute(n)});i.fail(function(){t.openErrorModal(t.msgService.getMessages().general.loadError)})},f.prototype.openErrorModal=function(n){var t=new Base.Modal(null,this.msgService,null,new Base.SwalModalParams);t.show("#errorModal");$("#errorModalContent").text(n)},f.prototype.showMapRoute=function(n){try{if(n!=null){if(!n)return;typeof n.aoTrains!="undefined"&&n.aoTrains!=null&&n.aoTrains.length>0&&(this._mapData=n,this.drawMapRoute(!0))}}catch(t){}},f}(n.MapsBase),r,t,i,u;n.MapyCz=f;r=function(){function n(n,t){this.LeftTopWGS=n;this.RightBottomWGS=t}return n.prototype.GetMaxX=function(){var n=this.RightBottomWGS.split(",");return n[0]},n.prototype.GetMaxY=function(){var n=this.RightBottomWGS.split(",");return n[1]},n.prototype.GetMinX=function(){var n=this.LeftTopWGS.split(",");return n[0]},n.prototype.GetMinY=function(){var n=this.LeftTopWGS.split(",");return n[1]},n}();t=function(n){function t(t){var i=n.call(this)||this;return i._title=t,i._build(),i}return __extends(t,n),Object.defineProperty(t.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),t.prototype._build=function(){this._dom.container=document.createElement("button");this._dom.container.innerHTML='<svg class="routePhoto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" ><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M320 256C302.3 256 288 270.3 288 288C288 305.7 302.3 320 320 320H416C469 320 512 362.1 512 416C512 469 469 512 416 512H139.6C148.3 502.1 158.9 489.4 169.6 475.2C175.9 466.8 182.4 457.6 188.6 448H416C433.7 448 448 433.7 448 416C448 398.3 433.7 384 416 384H320C266.1 384 223.1 341 223.1 288C223.1 234.1 266.1 192 320 192H362.1C340.2 161.5 320 125.4 320 96C320 42.98 362.1 0 416 0C469 0 512 42.98 512 96C512 160 416 256 416 256H320zM416 128C433.7 128 448 113.7 448 96C448 78.33 433.7 64 416 64C398.3 64 384 78.33 384 96C384 113.7 398.3 128 416 128zM118.3 487.8C118.1 488 117.9 488.2 117.7 488.4C113.4 493.4 109.5 497.7 106.3 501.2C105.9 501.6 105.5 502 105.2 502.4C99.5 508.5 96 512 96 512C96 512 0 416 0 352C0 298.1 42.98 255.1 96 255.1C149 255.1 192 298.1 192 352C192 381.4 171.8 417.5 149.9 448C138.1 463.2 127.7 476.9 118.3 487.8L118.3 487.8zM95.1 384C113.7 384 127.1 369.7 127.1 352C127.1 334.3 113.7 320 95.1 320C78.33 320 63.1 334.3 63.1 352C63.1 369.7 78.33 384 95.1 384z"/><\/svg>'+this._title;this._dom.container.title=this._title;this._dom.container.classList.add("drew-reset-button");this._ec.push(JAK.Events.addListener(this._dom.container,"click",this,"_click"))},t.prototype._click=function(){this.getMap().getSignals().makeEvent("draw-reset-click",this)},t}(SMap.Control.Visible);n.DrawResetButton=t;i=function(n){function t(t,i){var r=n.call(this)||this;return r._isActive=!1,r._layer=t,r._title=i,r._setIcon(),r._build(),r}return __extends(t,n),Object.defineProperty(t.prototype,"layer",{get:function(){return this._layer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),t.prototype.toggleActive=function(){this._isActive=!this._isActive;this._isActive?this._dom.container.classList.add("active"):this._dom.container.classList.remove("active")},t.prototype._setIcon=function(){if(this._layer)switch(this._layer){case SMap.DEF_OPHOTO:this._icon="ophoto";break;case SMap.DEF_PANO:this._icon="panorama"}},t.prototype._build=function(){this._dom.container=document.createElement("button");this._dom.container.innerHTML=this._title;this._dom.container.title=this._title;this._dom.container.classList.add("layer-button");this._ec.push(JAK.Events.addListener(this._dom.container,"click",this,"_click"));Base.Support.stringIsEmpty(this._icon)||(this._dom.container.classList.add("icon"),this._dom.container.classList.add(this._icon))},t.prototype._click=function(){this.getMap().getSignals().makeEvent("layer-button-click",this)},t}(SMap.Control.Visible);n.LayerButton=i;u=function(n){function t(t){var i=n.call(this)||this;return i._isActive=!1,i._activeImgData="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%3E%0A%20%20%3Cpath%20fill%3D%22%23666%22%20d%3D%22M4%2C4H0v2h6V0H4V4z%20M14%2C4V0h-2v6h6V4H14z%20M12%2C18h2v-4h4v-2h-6V18z%20M0%2C14h4v4h2v-6H0V14z%22%2F%3E%0A%3C%2Fsvg%3E%0A",i._inactiveImgData="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%3E%0A%20%20%3Cpath%20fill%3D%22%23666%22%20d%3D%22M0%2C0v2v4h2V2h4V0H2H0z%20M16%2C0h-4v2h4v4h2V2V0H16z%20M16%2C16h-4v2h4h2v-2v-4h-2V16z%20M2%2C12H0v4v2h2h4v-2H2V12z%22%2F%3E%0A%3C%2Fsvg%3E%0A",i._title=t,i._build(),i}return __extends(t,n),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),t.prototype.toggleActive=function(){this._isActive=!this._isActive;this._imageEl.src=this._isActive?this._activeImgData:this._inactiveImgData},t.prototype._build=function(){this._dom.container=document.createElement("button");this._dom.container.title=this._title;this._dom.container.classList.add("fullscreen-button");this._ec.push(JAK.Events.addListener(this._dom.container,"click",this,"_click"));this._imageEl=document.createElement("img");this._imageEl.src=this._inactiveImgData;this._dom.container.appendChild(this._imageEl)},t.prototype._click=function(){this.getMap().getSignals().makeEvent("fullscreen-button-click",this)},t}(SMap.Control.Visible);n.FullscreenButton=u})(Maps||(Maps={}))