XA.component.locationService=function(){"use strict";var u={},f,e,o,n=!1,t=[],i=[],r;return f=function(u,f){var o;(t.push(f),i.push(u),n)||(n=!0,navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){for(o=0;o0?setTimeout(l,1e3):(t&&XA.component.search.vent.trigger("internal-results-loaded",c),i&&XA.component.search.vent.trigger("internal-my-location-coordinates-changed",u)))},d=Backbone.Model.extend({defaults:{dataProperties:{},dynamicPoiList:[],showed:!1,myLocation:["",""],id:null,loadMore:!1},initialize:function(){var n=this.get("dataProperties").searchResultsSignature,t=f.parseHashParameters(window.location.hash),i=typeof n!="undefined"&&n!==""?n+"_g":"g";if(typeof XA.component.search!="undefined"){XA.component.search.vent.on("results-loaded",this.updateDynamicPoiList.bind(this));XA.component.search.vent.on("internal-results-loaded",this.updateDynamicPoiList.bind(this));XA.component.search.vent.on("my-location-coordinates-changed",this.changeMyLocation.bind(this));XA.component.search.vent.on("internal-my-location-coordinates-changed",this.changeMyLocation.bind(this));XA.component.search.vent.on("hashChanged",this.hashChanged.bind(this))}t.hasOwnProperty(i)&&t[i]!==""&&this.set("myLocation",t[i].split("|"))},getPoiVariant:function(n,t){var r=this.get("dataProperties").typeToVariantMapping,i;return typeof n!="undefined"&&n!=null?(i="{"+n.toUpperCase()+"}",r.hasOwnProperty(i)?r[i]:t):t},updateDynamicPoiList:function(n){var r=[],f=this.get("dataProperties").searchResultsSignature,u=n.data.filter(function(n){return n.hasOwnProperty("Geospatial")?!0:!1}),i,t;if(f===n.searchResultsSignature){for(this.set("loadMore",n.loadMore),i=0;i1&&this.set("myLocation",[i[0],i[1]]))}}),g=Backbone.View.extend({initialize:function(){var n=this.$el.data(),t=n.properties;this.model&&(this.model.set({dataProperties:t}),this.model.set({id:this.$el.find(".map-canvas").prop("id")}));this.render();this.model.on("change:dynamicPoiList",this.renderDynamicPois,this);this.model.on("change:myLocation",this.updateMyLocationPoi,this);if(typeof XA.component.search!="undefined")XA.component.search.vent.on("center-map",this.handleCenterMap.bind(this));this.updateMyLocationPoi()},render:function(){var u=this,n=this.model.get("showed"),r=t.getElementById(this.model.get("id"));n||r===null||this.getCentralPoint(function(n,t){if(typeof n!="undefined"){var u=typeof t!="undefined"?t:this,f=u.model.get("id"),r=u.model.get("dataProperties"),e={canvasId:f,zoom:typeof r.zoom=="number"?r.zoom:u.parseZoom(r.zoom,15),mode:r.mode,poiCount:r.pois.length,key:r.key,disableMapScrolling:r.disableMapScrolling,disableMapZoomOnScroll:r.disableMapZoomOnScroll};i.showMap(f,e,n);u.renderPoiList(f,r.pois);u.model.set("showed",!0)}})},renderDynamicPois:function(){var u=this.model.get("dataProperties"),t=this.model.get("dynamicPoiList"),f=this.model.get("dataProperties"),r=this.model.get("id"),n;for(this.model.get("loadMore")||i.clearMarkers(r),n=0;n0?n.call(i,[t.pois[0].Latitude,t.pois[0].Longitude]):this.getCurrentPosition(n);break;case"MidOfPoi":n.call(i,this.getPoisCentralPoint());break;case"Location":this.getCurrentPosition(n)}},getCurrentPosition:function(n){var t=this;XA.component.locationService.detectLocation(function(i){n.call(t,i,t)},function(i){n.call(t,[0,0],t);console.log(i)})},getPoisCentralPoint:function(){for(var n,u=[],r=this.model.get("myLocation"),f=this.model.get("dataProperties"),e=f.pois.length,t=0;t0&&(isNaN(n)||(i=parseInt(n))),i}}),r.init=function(){var t,c=n(".map.component:not(.initialized)"),l=c.length,r,u;if(typeof XA.component.search!="undefined"){f=XA.component.search.query;o=XA.component.search.url;s=XA.component.search.ajax;XA.component.search.vent.on("results-loaded",w);XA.component.search.vent.on("my-location-coordinates-changed",b)}if(i=XA.connector.mapsConnector,l>0){for(t=0;t