var MathExtensions,StringExtensions,__extends,Stao;(function(n){typeof jQuery!="undefined"&&jQuery&&(n.$=jQuery.noConflict(!0));typeof Q!="undefined"&&Q&&(n.q=Q.noConflict());typeof ko!="undefined"&&window.ko&&(n.ko=window.ko.noConflict())})(Stao||(Stao={})),function(n){var t;(function(){window.console||(window.console={},window.console.debug||(window.console.debug=function(){}),window.console.log||(window.console.log=function(){}),window.console.info||(window.console.info=function(){}),window.console.warn||(window.console.warn=function(){}),window.console.error||(window.console.error=function(){}),window.console.clear||(window.console.clear=function(){}),window.console.trace||(window.console.trace=function(){}),window.console.group||(window.console.group=function(){}),window.console.groupCollapsed||(window.console.groupCollapsed=function(){}),window.console.groupEnd||(window.console.groupEnd=function(){}),window.console.profile||(window.console.profile=function(){}),window.console.profileEnd||(window.console.profileEnd=function(){}),window.console.count||(window.console.count=function(){}));"bind"in Function.prototype||(Function.prototype.bind=function(n){if(arguments.length<=1)return function(){this.apply(n,arguments)};var t=Array.prototype.slice.call(arguments,1);return function(){this.apply(n,arguments.length===0?t:t.concat(Array.prototype.slice.call(arguments)))}});"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")});"indexOf"in Array.prototype||(Array.prototype.indexOf=function(n,t){t===undefined&&(t=0);t<0&&(t+=this.length);t<0&&(t=0);for(var i=this.length;t<i;t++)if(t in this&&this[t]===n)return t;return-1});"lastIndexOf"in Array.prototype||(Array.prototype.lastIndexOf=function(n,t){for(t===undefined&&(t=this.length-1),t<0&&(t+=this.length),t>this.length-1&&(t=this.length-1),t++;t-->0;)if(t in this&&this[t]===n)return t;return-1});"forEach"in Array.prototype||(Array.prototype.forEach=function(n,t){for(var i=0,r=this.length;i<r;i++)i in this&&n.call(t,this[i],i,this)});"map"in Array.prototype||(Array.prototype.map=function(n,t){for(var r=new Array(this.length),i=0,u=this.length;i<u;i++)i in this&&(r[i]=n.call(t,this[i],i,this));return r});"filter"in Array.prototype||(Array.prototype.filter=function(n,t){for(var r=[],u,i=0,f=this.length;i<f;i++)i in this&&n.call(t,u=this[i],i,this)&&r.push(u);return r});"every"in Array.prototype||(Array.prototype.every=function(n,t){for(var i=0,r=this.length;i<r;i++)if(i in this&&!n.call(t,this[i],i,this))return!1;return!0});"some"in Array.prototype||(Array.prototype.some=function(n,t){for(var i=0,r=this.length;i<r;i++)if(i in this&&n.call(t,this[i],i,this))return!0;return!1})})(t=n.Polyfill||(n.Polyfill={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n){this.name=n}return n}();n.RequestBase=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(t){n.call(this,t);this.name=t;this.query="";this.clusterdist=0;this.lang=""}return __extends(t,n),t}(n.RequestBase);n.FindRequestBase=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(){}return t.getBoundsFromArea=function(n){var t=new google.maps.LatLngBounds;return t.extend(new google.maps.LatLng(n.ymin,n.xmin)),t.extend(new google.maps.LatLng(n.ymax,n.xmax)),t},t.getAreaFromBounds=function(t){var i=t.getSouthWest().lng(),r=t.getSouthWest().lat(),u=t.getNorthEast().lng(),f=t.getNorthEast().lat();return new n.Area(i,r,u,f)},t.getPointFromPosition=function(t){return new n.Point(t.coords.latitude,t.coords.longitude)},t.getPointFromLatLng=function(t){return new n.Point(t.lat(),t.lng())},t.getLatLngFromPoint=function(n){return new google.maps.LatLng(n.y,n.x)},t.getCenterFromPoint=function(n){return[n.x,n.y]},t.getBboxFromArea=function(n){return[n.xmin,n.ymin,n.xmax,n.ymax]},t.getAreaFromBbox=function(t){var i=t[0],r=t[1],u=t[2],f=t[3];return new n.Area(i,r,u,f)},t}();n.Converter=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n,t){this.y=n;this.x=t}return n.prototype.equals=function(n){return n!==undefined&&n!==null&&n.y===this.y&&n.x===this.x},n}();n.Point=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n,t){this.height=n;this.width=t}return n.prototype.equals=function(n){return n!==undefined&&n!==null&&this.height===n.height&&this.width===n.width},n}();n.Rectangle=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(n,i,r){var u=this;t.call(this);this.setActive=function(n){if(u.isActive!==n){u.isActive=n;u.onActiveChanged(n)}};this.id=r;this.latlng=n;this.setMap(i)}return __extends(i,t),i.prototype.getId=function(){return this.id},i.prototype.getPosition=function(){return this.latlng},i.prototype.remove=function(){var t=this;n.$(this.div).fadeOut(i.fadeSpeed,function(){t.setMap(null);t.div&&(t.div.parentNode.removeChild(t.div),t.div=null)})},i.prototype.draw=function(){var u=this,t,e,r,f;this.div||(this.div=document.createElement("div"),this.div.style.position="absolute",n.$(this.div).hide());this.id!==undefined&&(t=this.div.dataset,t!==undefined&&t!==null&&(t.marker_id=this.id));this.onDraw(this.div);google.maps.event.addDomListener(this.div,"click",function(){u.onClick&&(u.onClick(),google.maps.event.trigger(u,"click"))});e=this.getPanes();e.overlayImage.appendChild(this.div);r=this.getProjection().fromLatLngToDivPixel(this.latlng);r&&(f=this.getPositionDiv(r)||r,this.div.style.left=f.x+"px",this.div.style.top=f.y+"px");this.onActiveChanged(this.isActive);n.$(this.div).fadeIn(i.fadeSpeed)},i.prototype.getPositionDiv=function(n){return new google.maps.Point(n.x,n.y)},i.prototype.onDraw=function(){},i.prototype.onActiveChanged=function(){},i.fadeSpeed=500,i}(google.maps.OverlayView);t.CustomMarkerBase=i})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(n,i,r){t.call(this,n,i,r)}return __extends(i,t),i.prototype.getPositionDiv=function(t){var i=t.x,r=n.$(this.div).outerHeight(),u=t.y-r;return new google.maps.Point(i,u)},i.prototype.onActiveChanged=function(t){t?n.$(this.div).addClass("active"):n.$(this.div).removeClass("active")},i}(t.CustomMarkerBase);t.SpecificPoiMarkerBase=i})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){}return t.prototype.init=function(){var t=n.q.defer();return this.resolveInit(t),t.promise},t.prototype.resolveInit=function(n){n.resolve(null)},t}();t.BaseViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t=function(){function t(){}return t.init=function(i,r,u,f,e){t.containerSelector=i;n.Utility.DomManipulation.showBusyIndicator(t.containerSelector,u);n.$.support.cors=!0;t.createConfigurationController(f).then(function(){return t.getApplicationConfiguration(r,e)}).then(function(){t.templateLoader=new n.Templating.TemplateLoader(t.applicationConfiguration.Language,t.applicationConfiguration.TemplateEndpoint);t.poiDetailControllerProxy=new n.Address.PoiDetailControllerProxy(t.applicationConfiguration.PoiDetailEndpoint);t.staoCacheClient=n.StaoCache.StaoCacheClientFactory.create(e,t.applicationConfiguration.StaoCacheEndpoint);t.injectScripts();t.injectStyles();var u=t.loadTemplates(),f=t.loadProfileConfiguration(r,e),o=t.loadQueryFragmentConverter(),i=[];return i.push(o),i.push(u),i.push(f),n.q.all(i)}).then(function(){return t.applicationViewModel=new n.ViewModel.ApplicationViewModel(t.applicationConfiguration,t.profileConfiguration,t.templateLoader,t.poiDetailControllerProxy,t.staoCacheClient,t.queryFragmentConverter),t.initApi(),t.invokeReady(),t.loadTealiumIfActivated(),t.applicationViewModel.init()}).then(function(){var i=n.Utility.DomManipulation.createKoRootNode(t.containerSelector,t.mainTemplateName);n.ko.applyBindings(t.applicationViewModel,i);n.Utility.DomManipulation.browserDetection();t.registerAdaptiveLayoutHandlers()},t.handleLoadError)},t.createConfigurationController=function(t){var r=this,i=n.q.defer(),u=n.Configuration.ConfigurationControllerProxyFactory.create(t);return u.then(function(n){r.configurationControllerProxy=n;i.resolve(null)}),i.promise},t.getApplicationConfiguration=function(i,r){var u=n.q.defer(),f=t.configurationControllerProxy.applicationConfiguration(i,r);return f.then(function(n){t.applicationConfiguration=n;u.resolve(null)}),u.promise},t.injectScripts=function(){t.applicationConfiguration.Scripts&&t.applicationConfiguration.Scripts.forEach(function(t){n.Utility.DomManipulation.appendScriptToHead(t)})},t.injectStyles=function(){t.applicationConfiguration.Styles&&t.applicationConfiguration.Styles.forEach(function(t){n.Utility.DomManipulation.appendStyleToHead(t)})},t.loadProfileConfiguration=function(i,r){var u=n.q.defer(),f=t.configurationControllerProxy.validateApiKey(i);return f.then(function(t){if(t.ValidationResult!==n.Configuration.ApiKeyValidationResult.Valid)throw{name:t.Title,message:t.Message};}).then(function(){return t.configurationControllerProxy.profileConfiguration(i,r)}).then(function(n){t.profileConfiguration=n;u.resolve(null)},t.handleLoadError),u.promise},t.loadTemplates=function(){var r=this,i=n.q.defer(),u=t.templateLoader.main();return u.then(function(n){r.mainTemplateName=n;i.resolve(null)}),i.promise},t.loadQueryFragmentConverter=function(){var i=n.q.defer(),r=t.staoCacheClient.getTypes();return r.then(function(r){t.queryFragmentConverter=new n.StaoCache.Query.QueryFragmentConverter(r);i.resolve(null)}),i.promise},t.loadTealiumIfActivated=function(){var t=this;this.profileConfiguration.IsAnalyseLibraryActivated&&n.$(document).ready(function(){setTimeout(function(){var i=new n.Utility.Tealium(t.applicationConfiguration.TealiumProfile,t.applicationConfiguration.TealiumEnvironment,t.applicationConfiguration.TealiumPageId,t.applicationConfiguration.Language);i.load()},1e3)})},t.initApi=function(){n.Api.init(t.applicationViewModel,t.profileConfiguration)},t.invokeReady=function(){n.ready!==undefined&&n.ready!==null&&n.ready()},t.registerAdaptiveLayoutHandlers=function(){n.AdaptiveLayout.AdaptiveLayoutStateObserver.registerNewHandler(t.applicationViewModel.adaptiveLayoutViewModel);t.applicationViewModel.scroll=new n.Utility.ScrollBehavoir;n.AdaptiveLayout.AdaptiveLayoutStateObserver.registerNewHandler(t.applicationViewModel.scroll);n.AdaptiveLayout.AdaptiveLayoutStateObserver.apply()},t.handleLoadError=function(i){n.Utility.DomManipulation.showLoadError(t.containerSelector,i.name,i.message)},t}();n.App=t}(Stao||(Stao={})),function(n){var t;(function(n){(function(n){n[n.Desktop=0]="Desktop";n[n.Tablet=1]="Tablet";n[n.Mobile=2]="Mobile"})(n.AdaptiveLayoutState||(n.AdaptiveLayoutState={}));var t=n.AdaptiveLayoutState})(t=n.AdaptiveLayout||(n.AdaptiveLayout={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function i(){}return i.apply=function(){setTimeout(function(){i.setState()},i.minimalTimeoutInMilliseconds);n.$(window).resize(function(){i.resizeTime=new Date;i.timeout===!1&&(i.timeout=!0,setTimeout(i.resized,i.delta))})},i.registerNewHandler=function(n){i.layoutStateChangeHandlers.push(n)},i.resized=function(){var n=Date();n-i.resizeTime<i.delta?setTimeout(i.resized,i.delta):(i.timeout=!1,i.setState())},i.setState=function(){var u=this,r;r=n.$(".mobile-detection").is(":visible")?t.AdaptiveLayoutState.Mobile:n.$(".tablet-detection").is(":visible")?t.AdaptiveLayoutState.Tablet:t.AdaptiveLayoutState.Desktop;i.lastState!==r&&(i.layoutStateChangeHandlers.forEach(function(n){return n.changeState(u.lastState,r)}),i.lastState=r)},i.delta=250,i.minimalTimeoutInMilliseconds=4,i.timeout=!1,i.layoutStateChangeHandlers=[],i}();t.AdaptiveLayoutStateObserver=i})(t=n.AdaptiveLayout||(n.AdaptiveLayout={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.poiDetailEndpointConfiguration=n}return t.prototype.detailAddress=function(t,i,r){var u=n.q(n.$.get(this.poiDetailEndpointConfiguration.DetailAddressUrl,{poiId:t,prioritizedAddress:i,lang:r}));return u.fail(function(n){return console.error("PoiDetailControllerProxy.detailAddress ",n.statusText)}),u},t}();t.PoiDetailControllerProxy=i})(t=n.Address||(n.Address={}))}(Stao||(Stao={})),function(n){var t;(function(n){n.init=function(t,i){n.events=new n.EventsApi(t);n.configuration=new n.ConfigurationApi(i)}})(t=n.Api||(n.Api={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.allowedProperties=Array("SelectAddressEnabled","PreselectText","OnStartActivatedTopicUniqueKey","OpenAt");this.config=n}return t.prototype.getConfiguration=function(){return n.$.extend(!0,{},this.config)},t.prototype.setConfiguration=function(t){var i=this.getObjectWithAllowedProperties(t);n.$.extend(this.config,i)},t.prototype.getObjectWithAllowedProperties=function(n){var r=t.deepClone(n);for(var i in r)this.isAllowedProperty(i)&&n[i]!==null&&n[i]!==undefined&&n[i]!==""||delete r[i];return r},t.prototype.isAllowedProperty=function(n){var t=!1;return this.allowedProperties.forEach(function(i){i===n&&(t=!0)}),t},t.deepClone=function(t){return n.$.extend(!0,{},t)},t}();t.ConfigurationApi=i})(t=n.Api||(n.Api={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n,t){this.name=n;this.handler=t}return n.prototype.getName=function(){return this.name},n.prototype.invoke=function(n){try{this.handler(n)}catch(t){console.error&&console.error("Error on invoking: "+this.name,t)}},n}();n.EventHandler=t})(t=n.Api||(n.Api={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(n){this.eventHandlers={};this.applicationViewModel=n;this.addEventHandlers()}return t.prototype.addEventHandlers=function(){this.addAddressSelectedEventHandler()},t.prototype.addAddressSelectedEventHandler=function(){var n=this,t="addressSelected";this.applicationViewModel.poiDetailViewModel.selectedAddress.subscribe(function(i){n.eventHandlers[t]!==undefined&&n.eventHandlers[t].forEach(function(n){n.invoke(i)})})},t.prototype.addListener=function(t,i){this.eventHandlers[t]===undefined&&(this.eventHandlers[t]=[]);var r=new n.EventHandler(t,i);return this.eventHandlers[t].push(r),r},t.prototype.removeListener=function(n){if(this.eventHandlers[n.getName()]!==undefined)for(var t=this.eventHandlers[n.getName()].length;t--;)this.eventHandlers[n.getName()][t]===n&&this.eventHandlers[n.getName()].splice(t,1)},t}();n.EventsApi=t})(t=n.Api||(n.Api={}))}(Stao||(Stao={})),function(n){var t;(function(n){(function(n){n[n.Valid=0]="Valid";n[n.ApiKeyInvalid=1]="ApiKeyInvalid";n[n.ReferrerInvalid=2]="ReferrerInvalid"})(n.ApiKeyValidationResult||(n.ApiKeyValidationResult={}));var t=n.ApiKeyValidationResult})(t=n.Configuration||(n.Configuration={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.config=n}return t.prototype.validateApiKey=function(t){var i=n.q(n.$.get(this.config.ValidateApiKeyUrl,{apiKey:t}));return i.fail(function(n){return console.error("ConfigurationControllerProxy.validateApiKey ",n.statusText)}),i},t.prototype.applicationConfiguration=function(t,i){var r=n.q(n.$.get(this.config.ApplicationConfigurationUrl,{apiKey:t,lang:i}));return r.fail(function(n){return console.error("ConfigurationControllerProxy.applicationConfiguration ",n.statusText)}),r},t.prototype.profileConfiguration=function(t,i){var r=n.q(n.$.get(this.config.ProfileConfigurationUrl,{apiKey:t,lang:i}));return r.fail(function(n){return console.error("ConfigurationControllerProxy.profileConfiguration ",n.statusText)}),r},t.prototype.templateEndpointConfiguration=function(){var t=n.q(n.$.get(this.config.TemplateEndpointConfigurationUrl));return t.fail(function(n){return console.error("ConfigurationControllerProxy.templateEndpointConfiguration ",n.statusText)}),t},t.prototype.configurationEndpointConfiguration=function(){var t=n.q(n.$.get(this.config.ConfigurationEndpointConfigurationUrl));return t.fail(function(n){return console.error("ConfigurationControllerProxy.configurationEndpointConfiguration ",n.statusText)}),t},t}();t.ConfigurationControllerProxy=i})(t=n.Configuration||(n.Configuration={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function i(){}return i.create=function(i){var u={ConfigurationEndpointConfigurationUrl:i},r=n.q.defer(),f=new t.ConfigurationControllerProxy(u),e=f.configurationEndpointConfiguration();return e.then(function(n){var i=new t.ConfigurationControllerProxy(n);r.resolve(i)}),r.promise},i}();t.ConfigurationControllerProxyFactory=i})(t=n.Configuration||(n.Configuration={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(t){var i=this;this.openCollapsable=function(t,r){var e;if(r===void 0&&(r=!1),!i.element.hasClass("active")||r){var o=i.element.find("a"),f=i.element.find(".acc-content"),u=i.element.find("[data-on='setCollapsibleText']");i.element.addClass("active");f.attr("aria-hidden","false");t?f.slideDown("fast"):f.show();e=n.$(u).attr("data-text-collapsible")+" "+n.$(u).attr("data-text-dynamic")+" "+n.$(u).attr("data-text-collapsible-opened");n.$(u).text(e)}};this.closeCollapsable=function(t,r){var e;if(r===void 0&&(r=!1),i.element.hasClass("active")||r){var o=i.element.find("a"),f=i.element.find(".acc-content"),u=i.element.find("[data-on='setCollapsibleText']");i.element.removeClass("active");f.attr("aria-hidden","true");t?f.slideUp("fast"):f.hide();e=n.$(u).attr("data-text-collapsible")+" "+n.$(u).attr("data-text-dynamic")+" "+n.$(u).attr("data-text-collapsible-closed");n.$(u).text(e)}};this.disableCollapsable=function(){i.element.addClass("disabled");i.element.find("a").attr("aria-disabled","true");i.element.find(".acc-content").hide("fast")};this.enableCollapsable=function(){i.element.removeClass("disabled");i.element.find("a").removeAttr("aria-disabled")};this.handleClick=function(){i.element.hasClass("disabled")||(i.element.hasClass("active")?i.closeCollapsable(!0):i.openCollapsable(!0))};this.element=n.$(t);this.element.find(":header a").click(function(){return i.handleClick(),!1})}return t}();t.CollapsibleControl=i})(t=n.Controls||(n.Controls={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n,t,i,r){this.xmin=n;this.ymin=t;this.xmax=i;this.ymax=r}return n.prototype.equals=function(n){return n!==undefined&&n!==null&&this.xmin===n.xmin&&this.ymin===n.ymin&&this.xmax===n.xmax&&this.ymax===n.ymax},n}();n.Area=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(){}return t.calculateCenter=function(t,i,r,u){if(t===undefined||t===null)throw new Error("Argument 'northEastLat' must not be undefined or null!");if(i===undefined||i===null)throw new Error("Argument 'northEastLng' must not be undefined or null!");if(r===undefined||r===null)throw new Error("Argument 'southWestLat' must not be undefined or null!");if(u===undefined||u===null)throw new Error("Argument 'southWestLng' must not be undefined or null!");var f=(r+t)/2,e=(u+i)/2;return new n.Point(f,e)},t.calculateDistance=function(n,t,i,r){var u=71.5*(n-t),f=111.3*(i-r);return Math.sqrt(u*u+f*f)},t.calculateZoomLevel=function(n,i,r,u,f,e){if(n===undefined||n===null)throw new Error("Argument 'northEastLat' must not be undefined or null!");if(i===undefined||i===null)throw new Error("Argument 'northEastLng' must not be undefined or null!");if(r===undefined||r===null)throw new Error("Argument 'southWestLat' must not be undefined or null!");if(u===undefined||u===null)throw new Error("Argument 'southWestLng' must not be undefined or null!");if(f===undefined||f===null)throw new Error("Argument 'mapWidth' must not be undefined or null!");if(e===undefined||e===null)throw new Error("Argument 'mapHeight' must not be undefined or null!");var s={height:256,width:256},h=(t.latRad(n)-t.latRad(r))/Math.PI,o=i-u,c=(o<0?o+360:o)/360,l=t.zoom(e,s.height,h),a=t.zoom(f,s.width,c);return Math.min(l,a,this.maxZoomLevel)},t.latRad=function(n){var t=Math.sin(n*Math.PI/180),i=Math.log((1+t)/(1-t))/2;return Math.max(Math.min(i,Math.PI),-Math.PI)/2},t.zoom=function(n,t,i){return Math.floor(Math.log(n/t/i)/Math.LN2)},t.calculateBounds=function(i,r,u,f,e){if(i===undefined||i===null)throw new Error("Argument 'centerLat' must not be undefined or null!");if(r===undefined||r===null)throw new Error("Argument 'centerLng' must not be undefined or null!");if(u===undefined||u===null)throw new Error("Argument 'mapWidth' must not be undefined or null!");if(i===f||f===null)throw new Error("Argument 'mapHeight' must not be undefined or null!");if(e===f||e===null)throw new Error("Argument 'zoomLevel' must not be undefined or null!");var s=t.scaleMapSideByZoom(u,e),h=t.scaleMapSideByZoom(f,e),c=t.latLngToPixel(i,r),o={x:c.x-s/2,y:c.y-h/2},l={x:o.x+s,y:o.y},a={x:o.x,y:o.y+h},v=t.pixelToLatLng(l.x,l.y),y=t.pixelToLatLng(a.x,a.y);return new n.Area(y.x,y.y,v.x,v.y)},t.getBboxFromPoint=function(t,i){var r=n.Converter.getAreaFromBbox(t),u=r.ymax-r.ymin,f=r.xmax-r.xmin;return r.xmin=i[0]-f/2,r.ymin=i[1]-u/2,r.xmax=r.xmin+f,r.ymax=r.ymin+u,r},t.scaleMapSideByZoom=function(n,t){var i=this.maxZoomLevel-t,r=Math.pow(2,i);return n*r},t.pixelToLatLng=function(i,r){var u=(Math.PI/2-2*Math.atan(Math.exp((Math.round(r)-t.mercatorOffset)/t.mercatorRadius)))*180/Math.PI,f=(Math.round(i)-t.mercatorOffset)/t.mercatorRadius*180/Math.PI;return new n.Point(u,f)},t.latLngToPixel=function(i,r){var u=Math.round(t.mercatorOffset+t.mercatorRadius*r*Math.PI/180),f=Math.round(t.mercatorOffset-t.mercatorRadius*Math.log((1+Math.sin(i*Math.PI/180))/(1-Math.sin(i*Math.PI/180)))/2);return new n.Point(f,u)},t.maxZoomLevel=21,t.mercatorOffset=268435456,t.mercatorRadius=85445659.447053954,t}();n.Calculator=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n.equalsLatLngBounds=function(n,t){return n!==undefined&&t!==undefined&&n!==null&&t!==null&&n.getSouthWest().lng()===t.getSouthWest().lng()&&n.getSouthWest().lat()===t.getSouthWest().lat()&&n.getNorthEast().lng()===t.getNorthEast().lng()&&n.getNorthEast().lat()===t.getNorthEast().lat()},n}();n.Comparer=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(){}return t.defaultMapSize=new n.Rectangle(500,500),t.switzerlandCenter=new n.Point(46.8131873,8.2242101),t.switzerlandZoom=7,t.poiZoom=17,t}();n.Constants=t})(t=n.Geolocation||(n.Geolocation={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(n,i,r,u){var f=this;t.call(this,n,i,r);this.getCount=function(){return f.count};this.setCount=function(n){f.count=n;f.onDraw(f.div)};this.count=u}return __extends(i,t),i.prototype.getPositionDiv=function(t){var i=n.$(this.div).outerHeight(),u=n.$(this.div).outerWidth();if(i!==u)throw new Error("The width and the height of the aggregate Div are not equal!");var r=i/2,f=t.y-r,e=t.x-r;return new google.maps.Point(e,f)},i.prototype.onDraw=function(n){n.innerHTML=this.count.toString();var t="large";this.count<150&&(t="small");n.className="aggregates "+t},i}(t.CustomMarkerBase);t.AggregateMarker=i})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(t,i,r){n.call(this,t,i,r)}return __extends(t,n),t.prototype.onDraw=function(n){var t=document.createTextNode("");n.appendChild(t);n.className="micons ico-cluster"},t}(n.SpecificPoiMarkerBase);n.ClusterMarker=t})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){}return t.createDynamicMap=function(n){var r={styles:t.mapStyle,mapTypeId:t.mapTypeId},i=new google.maps.Map(n,r);return t.waitForVisibleMap(n,i),t.makeMapResponsive(i),i},t.createStaticMap=function(n,i,r,u){var e={styles:t.mapStyle,mapTypeId:t.mapTypeId,disableDefaultUI:!0,disableDoubleClickZoom:!0,draggable:!1,scrollwheel:!1,center:new google.maps.LatLng(i,r),zoom:u},f=new google.maps.Map(n,e);return t.waitForVisibleMap(n,f),t.makeMapResponsive(f),f},t.makeMapResponsive=function(n){google.maps.event.addDomListener(window,"resize",function(){var t=n.getCenter();google.maps.event.trigger(n,"resize");n.setCenter(t)})},t.waitForVisibleMap=function(i,r){setTimeout(function(){if(n.$(i).is(":visible")){var u=r.getCenter();google.maps.event.trigger(r,"resize");r.setCenter(u)}else t.waitForVisibleMap(i,r)},100)},t.mapStyle=[{featureType:"road.highway",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"all",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"administrative",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{visibility:"on"},{color:"#DAD1C2"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{visibility:"on"},{lightness:100}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.station",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"landscape.natural.terrain",elementType:"all",stylers:[{visibility:"on"},{lightness:10}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"administrative.province",elementType:"geometry.stroke",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{hue:"#00aaff"},{saturation:-52},{lightness:-6}]},{featureType:"administrative.country",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#DAD1C2"}]},{featureType:"road.local",elementType:"geometry.stroke",stylers:[{color:"#DAD1C2"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{color:"#F8F5EF"},{saturation:-61},{lightness:-13}]},{featureType:"landscape.natural",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"administrative.country",elementType:"geometry.stroke",stylers:[{color:"#806E5F"}]},{featureType:"administrative.province",elementType:"labels",stylers:[{visibility:"off"}]}],t.mapTypeId=google.maps.MapTypeId.ROADMAP,t}();t.MapCreator=i})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(t,i,r,u){n.call(this,t,i,r);this.poiTypeId=u}return __extends(t,n),t.prototype.onDraw=function(n){n.className="micons ico-"+this.poiTypeId},t}(n.SpecificPoiMarkerBase);n.PoiMarker=t})(t=n.GoogleMaps||(n.GoogleMaps={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n.typeIdPostAgency="001PST",n.typeIdPickPost="001AG-PICK",n.typeIdMyPost24="001MP24",n.typeIdPostFinance="001PFFIL",n.typeIdLetterbox="003BE",n.typeIdCounterLetterbox="CT",n.typeIdCounterNormal="0011",n.typeIdCounterBusiness="0013",n.typeIdCounterFach="0014",n.typeCategoryCounter="CounterType",n.typeCategoryPoi="PoiType",n}();n.Constants=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.jsonpCallbackMethodNamePrefix="cb";this.requestCount=0;this.configuration=n}return t.prototype.executeRequest=function(t){var r;this.requestCount++;var u=this.getRequestUrl(t),f=this.getUniqueCallbackName(),i=JSON.parse(JSON.stringify(t));return i.encoding="UTF-8",delete i.name,r=n.q(n.$.ajax({type:"GET",url:u,jsonp:"jsonp",jsonpCallback:f,data:i,dataType:"jsonp"})),r.fail(function(n){return console.error("ServiceAccessor.executeRequest ",n.statusText)}),r},t.prototype.getRequestUrl=function(n){var t=this.configuration;return t[n.name+"Endpoint"]},t.prototype.getUniqueCallbackName=function(){return this.jsonpCallbackMethodNamePrefix+this.requestCount},t}();t.ServiceAccessor=i})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(t){this.cache=new n.Utility.Cache;this.staoCacheService=t}return t.prototype.executeRequest=function(n){var t=this,i=this.getRequestIdentifier(n);return this.cache.returnCachedValueOrRetrieve(i,function(){return t.staoCacheService.executeRequest(n)})},t.prototype.getRequestIdentifier=function(n){var t="";for(var i in n)i!=="constructor"&&(t=t+i+"="+n[i]+";");return t},t}();t.ServiceCacheDecorator=i})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.staoCacheService=n}return t.prototype.executeRequest=function(t){var i=n.q.defer();return this.staoCacheService.executeRequest(t).then(function(n){i.resolve(n)}),i.promise},t}();t.ServiceLoggingDecorator=i})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(){}return t.create=function(t,i){var r=new n.ServiceLoggingDecorator(new n.ServiceCacheDecorator(new n.ServiceAccessor(i)));return new n.StoaCacheQueryRewriteDecorator(new n.StaoCacheClient(r,t))},t}();n.StaoCacheClientFactory=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function n(n){var i=this;this.getTypes=function(){return i.types};this.getTypesByCategory=function(n){return i.types.filter(function(t){return t.cat===n})};this.getCounterTypes=function(){return i.getTypesByCategory(t.Constants.typeCategoryCounter)};this.getTypeById=function(n){var t=null;return i.types.forEach(function(i){i.id===n&&(t=i)}),t};this.getTypeByTag=function(n){var t=null;return i.types.forEach(function(i){i.tag===n&&(t=i)}),t};this.types=n}return n}(),r;t.TypeCollection=i;r=function(){function r(n,t){this.language=t;this.serviceAccessor=n}return r.prototype.getTypes=function(){var r=n.q.defer(),u=new t.TypeRequest;return u.lang=this.language,this.serviceAccessor.executeRequest(u).then(function(n){var t=new i(n.types);r.resolve(t)}),r.promise},r.prototype.getOpeningHoursTimeSpan=function(){var i=n.q.defer(),r=new t.TypeRequest;return r.lang=this.language,this.serviceAccessor.executeRequest(r).then(function(n){var r=new t.Utility.OpeningHoursTimeSpan;r.openTimeMax=new Date(n.opentmax);r.openTimeMin=new Date(n.opentmin);i.resolve(r)}),i.promise},r.prototype.getLocations=function(i,r){var o=this,f=n.q.defer(),u=new t.GeoCodeRequest,e;return u.query=i,u.pois=r,u.lang=this.language,e=this.serviceAccessor.executeRequest(u),e.then(function(n){n.locations.forEach(function(n){n.locationType=o.getLocationType(n.type)});f.resolve(n.locations)}),f.promise},r.prototype.getLocationType=function(n){switch(n){case"region":return t.LocationType.Region;case"city":return t.LocationType.City;case"zip":return t.LocationType.Zip;case"locality":return t.LocationType.Locality;case"address":return t.LocationType.Address;case"poi":return t.LocationType.Poi}return t.LocationType.Unknown},r.prototype.getByBbox=function(i,r,u,f){var o=n.q.defer(),e=new t.FindRequest;return e.query=r,e.extent=i[0]+","+i[1]+","+i[2]+","+i[3],e.maxpois=t.Utility.AggregationLevelCalculator.maxPois,e.clusterdist=t.Utility.AggregationLevelCalculator.clusterDistance,e.autoexpand=!1,e.lang=this.language,e.agglevel=t.Utility.AggregationLevelCalculator.getAggregationLevelFromZoomLevel(f),u&&(e.openat=u),this.serviceAccessor.executeRequest(e).then(function(n){o.resolve(n)}),o.promise},r.prototype.getByRadius=function(i,r,u,f){var o=n.q.defer(),e;return r=r/110,r<.0018&&(r=.0018),e=new t.NearRequest,e.query=u,e.maxdist=r,e.center=i[0]+","+i[1],e.maxpois=999,e.lang=this.language,f&&(e.openat=f),this.serviceAccessor.executeRequest(e).then(function(n){o.resolve(n)}),o.promise},r.prototype.getByTechPlz=function(i){var f=this,r=n.q.defer(),u=new t.FindRequest;return u.query="Z6:"+i,u.lang=this.language,this.serviceAccessor.executeRequest(u).then(function(n){n.pois.length===0?r.resolve(null):n.pois.length===1?r.resolve(n.pois[0]):f.getTypes().then(function(i){n.pois.forEach(function(n){var u=i.getTypes().filter(function(t){return t.tag===n.type})[0];u.id===t.Constants.typeIdPostAgency&&r.resolve(n)})})}),r.promise},r.prototype.getPoiById=function(i){var f=this,r=n.q.defer(),u=new t.DetailsRequest;return u.id=i,this.serviceAccessor.executeRequest(u).then(function(t){if(t.details===null||t.details===undefined||t.details==="")r.resolve(null);else{var e=n.$.parseXML(t.details),u=n.$(e),o={id:i,type:u.find("POI").attr("POITypeId"),name:u.find("POI").children("Description[lang='"+f.language+"']").text(),x:parseFloat(u.find("CoordinateLng").text()),y:parseFloat(u.find("CoordinateLat").text()),info:{City:u.find("Address").children("City").text(),Street:u.find("Address").children("Street").text(),Zip:u.find("Address").children("Zip").text()}};r.resolve(o)}}),r.promise},r}();t.StaoCacheClient=r})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n){this.staoCacheClient=n}return n.prototype.getTypes=function(){return this.staoCacheClient.getTypes()},n.prototype.getOpeningHoursTimeSpan=function(){return this.staoCacheClient.getOpeningHoursTimeSpan()},n.prototype.getLocations=function(n,t){return n=this.replacePoststelleByFiliale(n),this.staoCacheClient.getLocations(n,t)},n.prototype.getByBbox=function(n,t,i,r){return this.staoCacheClient.getByBbox(n,t,i,r)},n.prototype.getByRadius=function(n,t,i,r){return this.staoCacheClient.getByRadius(n,t,i,r)},n.prototype.getByTechPlz=function(n){return this.staoCacheClient.getByTechPlz(n)},n.prototype.getPoiById=function(n){return this.staoCacheClient.getPoiById(n)},n.prototype.replacePoststelleByFiliale=function(n){return n.toLocaleLowerCase().replace("poststelle","filiale").replace("postagentur","filiale").replace("office de poste","filiale").replace("agence postale","filiale").replace("ufficio postale","filiale").replace("agenzia postale","filiale").replace("post office","branch").replace("postal agency","branch")},n}();n.StoaCacheQueryRewriteDecorator=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(){this.subQueryFragments=[]}return n}();n.QueryFragment=t})(t=n.Query||(n.Query={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function t(n){this.queryFragmentSeperator=",";this.queryFragmentTagSeperator=".";this.types=n}return t.prototype.toQueryFragment=function(n){for(var t,o,u=[],f=n.split(this.queryFragmentSeperator),i=0;i<f.length;i++){var s=f[i],r=s.split(this.queryFragmentTagSeperator),h=r[0],e=this.buildQueryFragment(h);for(t=1;t<r.length;t++)o=this.buildQueryFragment(r[t]),e.subQueryFragments.push(o);u.push(e)}return u},t.prototype.buildQueryFragment=function(t){var i=new n.QueryFragment;return i.name=this.getNameByTag(t),i.tag=t,i},t.prototype.getNameByTag=function(n){var t=this.types.getTypeByTag(n);return t===null?"":t.desc},t.prototype.toPoisQuery=function(n){var i=this,t;return n.length===0?"":(t="",n.forEach(function(n){t=t+i.queryFragmentSeperator+n.tag;n.subQueryFragments.forEach(function(n){t=t+i.queryFragmentTagSeperator+n.tag})}),t=t.substring(this.queryFragmentSeperator.length))},t}();n.QueryFragmentConverter=t})(t=n.Query||(n.Query={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){(function(n){n[n.Aggregieren=0]="Aggregieren";n[n["Länder"]=1]="Länder";n[n.Kantone=2]="Kantone";n[n.Gemeinden=3]="Gemeinden"})(n.AggregationLevel||(n.AggregationLevel={}));var t=n.AggregationLevel})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(){n.call(this,"Details")}return __extends(t,n),t}(n.RequestBase);n.DetailsRequest=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(t){function i(){t.call(this,"Find");this.extent="";this.autoexpand=!1;this.maxpois=0;this.agglevel=n.AggregationLevel.Aggregieren}return __extends(i,t),i}(n.FindRequestBase);n.FindRequest=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(){n.call(this,"GeoCode");this.query="";this.start=0;this.pois="";this.lang="";this.limit=100}return __extends(t,n),t}(n.RequestBase);n.GeoCodeRequest=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(){n.call(this,"Near");this.maxpois=0;this.center="";this.maxdist=0}return __extends(t,n),t}(n.FindRequestBase);n.NearRequest=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(){n.call(this,"Types");this.lang=""}return __extends(t,n),t}(n.RequestBase);n.TypeRequest=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(n){var t=function(n){function t(){n.call(this,"Version")}return __extends(t,n),t}(n.RequestBase);n.VersionRequset=t})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){(function(n){n[n.Poi=0]="Poi";n[n.Region=1]="Region";n[n.City=2]="City";n[n.Zip=3]="Zip";n[n.Locality=4]="Locality";n[n.Address=5]="Address";n[n.Unknown=6]="Unknown"})(n.LocationType||(n.LocationType={}));var t=n.LocationType})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(t){var i=function(){function t(){}return t.getAggregationLevelFromZoomLevel=function(i){var u=t.getZoomLevelsFromAggregationLevel(n.AggregationLevel.Länder),f=t.getZoomLevelsFromAggregationLevel(n.AggregationLevel.Kantone),e=t.getZoomLevelsFromAggregationLevel(n.AggregationLevel.Gemeinden),o=t.getZoomLevelsFromAggregationLevel(n.AggregationLevel.Aggregieren),r;if(i>=u.start&&i<=u.end)r=n.AggregationLevel.Länder;else if(i>=f.start&&i<=f.end)r=n.AggregationLevel.Kantone;else if(i>=e.start&&i<=e.end)r=n.AggregationLevel.Gemeinden;else if(i>=o.start&&i<=o.end)r=n.AggregationLevel.Aggregieren;else throw new Error("No Aggregation Level defined!");return r},t.getHighestZoomLevelFromAggregationLevel=function(n){return t.getZoomLevelsFromAggregationLevel(n).end},t.getLowestZoomLevelFromAggregationLevel=function(n){return t.getZoomLevelsFromAggregationLevel(n).start},t.getZoomLevelsFromAggregationLevel=function(t){switch(t){case n.AggregationLevel.Länder:return{start:0,end:6};case n.AggregationLevel.Kantone:return{start:7,end:10};case n.AggregationLevel.Gemeinden:return{start:11,end:12};case n.AggregationLevel.Aggregieren:return{start:13,end:21};default:throw new Error("Invalid AggregationLevel!");}},t.getNextSmallerAggregationLevel=function(t){switch(t){case n.AggregationLevel.Länder:return n.AggregationLevel.Kantone;case n.AggregationLevel.Kantone:return n.AggregationLevel.Gemeinden;default:return n.AggregationLevel.Aggregieren}},t.maxPois=150,t.clusterDistance=6,t}();t.AggregationLevelCalculator=i})(t=n.Utility||(n.Utility={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(t){var i=function(){function t(){}return t.getBestMatchingLocation=function(i,r){var u,f;return i.length<=0?null:(u=t.findByType(i,n.LocationType.Poi),u.length===1)?u[0]:(f=t.findByType(i,n.LocationType.City),f.length>0?t.findBestMatch(f,r):t.findBestMatch(i,r))},t.findByType=function(n,t){for(var r,u=[],i=0;i<n.length;i++)r=n[i],r.locationType===t&&u.push(r);return u},t.findBestMatch=function(n){var i=n.sort(t.orderByLength);return i[0]},t.orderByLength=function(n,t){var i=n.name.length,r=t.name.length;return i<r?-1:i>r?1:0},t}();t.LocationFinder=i})(t=n.Utility||(n.Utility={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(){}return n}();n.OpeningHoursTimeSpan=t})(t=n.Utility||(n.Utility={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(){}return n.isTechPlz=function(n){return n!==undefined&&n!==null&&n.length===6&&!isNaN(parseInt(n))},n.isPoiId=function(n){return n!==undefined&&n!==null&&n.indexOf("_")!==-1},n}();n.SearchTextClassifier=t})(t=n.Utility||(n.Utility={}))})(t=n.StaoCache||(n.StaoCache={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n){this.templateConfiguration=n}return t.prototype.main=function(t){var i=n.q(n.$.get(this.templateConfiguration.MainTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.main ",n.statusText)}),i},t.prototype.header=function(t){var i=n.q(n.$.get(this.templateConfiguration.HeaderTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.header ",n.statusText)}),i},t.prototype.filterPanel=function(t){var i=n.q(n.$.get(this.templateConfiguration.FilterPanelTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.filterPanel ",n.statusText)}),i},t.prototype.resultList=function(t){var i=n.q(n.$.get(this.templateConfiguration.ResultListTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.resultList ",n.statusText)}),i},t.prototype.resultMap=function(t){var i=n.q(n.$.get(this.templateConfiguration.ResultMapTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.resultMap ",n.statusText)}),i},t.prototype.shortDetail=function(t,i){var r=n.q(n.$.get(this.templateConfiguration.ShortDetailTemplateUrl,{poiId:t,lang:i}));return r.fail(function(n){return console.error("TemplateControllerProxy.shortDetail ",n.statusText)}),r},t.prototype.longDetail=function(t,i){var r=n.q(n.$.get(this.templateConfiguration.LongDetailTemplateUrl,{poiId:t,lang:i}));return r.fail(function(n){return console.error("TemplateControllerProxy.longDetail ",n.statusText)}),r},t.prototype.miniResultList=function(t){var i=n.q(n.$.get(this.templateConfiguration.MiniResultListTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.miniResultList ",n.statusText)}),i},t.prototype.clusterDetail=function(t){var i=n.q(n.$.get(this.templateConfiguration.ClusterDetailTemplateUrl,{lang:t}));return i.fail(function(n){return console.error("TemplateControllerProxy.clusterDetail ",n.statusText)}),i},t}();t.TemplateControllerProxy=i})(t=n.Templating||(n.Templating={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function i(n,i){this.templateNamePrefix="poststao_";this.language=n;this.templateControllerProxy=new t.TemplateControllerProxy(i)}return i.prototype.main=function(){return this.getAndAppendTemplate("main")},i.prototype.header=function(){return this.getAndAppendTemplate("header")},i.prototype.filterPanel=function(){return this.getAndAppendTemplate("filterPanel")},i.prototype.resultList=function(){return this.getAndAppendTemplate("resultList")},i.prototype.resultMap=function(){return this.getAndAppendTemplate("resultMap")},i.prototype.shortDetail=function(n){return this.getAndAppendTemplate("shortDetail",n)},i.prototype.longDetail=function(n){return this.getAndAppendTemplate("longDetail",n)},i.prototype.miniResultList=function(){return this.getAndAppendTemplate("miniResultList")},i.prototype.clusterDetail=function(){return this.getAndAppendTemplate("clusterDetail")},i.prototype.getAndAppendTemplate=function(t,i){var r=this,u=n.q.defer(),f;return f=i?this.templateControllerProxy[t](i,this.language):this.templateControllerProxy[t](this.language),f.then(function(f){var e=r.templateNamePrefix+t,o;i!==undefined&&i!==null&&(e=e+"."+i);r.removeElement(e);o=n.$("<script id='"+e+"' type='text/html'>"+f+"<\/script>");o.appendTo(n.$("body"));u.resolve(e)}),u.promise},i.prototype.removeElement=function(t){n.$("#"+t).remove()},i}();t.TemplateLoader=i})(t=n.Templating||(n.Templating={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n.isInternetExplorer=function(){return navigator.appName==="Microsoft Internet Explorer"||!!navigator.userAgent.match(/Trident.*rv[ :]*11\./)},n.isSafariOnIOS=function(){var n=navigator.userAgent.match("/iPad|iPhone|iPod/g");return n!==null&&n!==undefined&&n.length>0},n.getInternetExplorerVersion=function(){var t=null;if(n.isInternetExplorer()){var i=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),r=!!navigator.userAgent.match(/Trident\/7.0/),u=navigator.userAgent.indexOf("rv:11.0");r&&u!==-1&&(t=11);i.exec(navigator.userAgent)!=null&&(t=parseFloat(RegExp.$1))}return t},n}();n.BrowserDetection=t})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){this.internalCache={}}return t.prototype.returnCachedValueOrRetrieve=function(t,i){var f=this,r=n.q.defer(),u=this.internalCache[t];return u!==undefined&&u!==null?r.resolve(u):i().then(function(n){f.internalCache[t]=n;r.resolve(n)}),r.promise},t}();t.Cache=i})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n.convertToDate=function(n){var t=parseInt(n.substr(0,4)),i=parseInt(n.substr(5,2))-1,r=parseInt(n.substr(8,2)),u=parseInt(n.substr(11,2)),f=parseInt(n.substr(14,2));return new Date(t,i,r,u,f)},n.convertToString=function(t){var i=t.getFullYear().toString(),r=(t.getMonth()+1).toString().padLeft(2,"0"),u=t.getDate().toString().padLeft(2,"0"),f=t.getHours().toString().padLeft(2,"0"),e=t.getMinutes().toString().padLeft(2,"0");return n.format(i,r,u,f,e)},n.format=function(t,i,r,u,f){var e=t,o=i.toString().padLeft(2,"0"),s=r.toString().padLeft(2,"0"),h=u.toString().padLeft(2,"0"),c=f.toString().padLeft(2,"0");return e+"-"+o+"-"+s+n.dateTimedelimiter+h+":"+c},n.dateTimedelimiter="T",n}();n.DateTimeConverter=t})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function i(){}return i.showBusyIndicator=function(t,r){var u=i.createRootElement(t),f=n.$("<img src='"+r+"/Content/Images/loader.gif' style='margin:0 auto; width:80px; height:80px; display:block;'>");n.$(u).append(f)},i.appendScriptToHead=function(t){var i=n.$("<script src='"+t+"'><\/script>");n.$("head").append(i)},i.appendStyleToHead=function(t){var i=n.$('<link rel="stylesheet" href=\''+t+"'>");n.$("head").append(i)},i.createKoRootNode=function(t,r){var f=i.createRootElement(t),u=n.$("<div/>").attr("data-bind","template: { name: '"+r+"' }").appendTo(f)[0];return u.id="PostStaoMainHost",u},i.showLoadError=function(t,r,u){var e=i.createRootElement(t),f=n.$("<div/>").addClass("error-message").addClass("api-key-error").addClass("error").appendTo(e)[0];n.$("<h1/>").addClass("error-header").html(r).appendTo(f);n.$("<div/>").addClass("error-body").html(u).appendTo(f);n.$("<div/>").addClass("icon").attr("aria-hidden","true").appendTo(f)},i.createRootElement=function(t){n.$("#"+i.cssScopeElementId).remove();var r=n.$("<div/>").addClass("res-state-search").appendTo(n.$(t))[0];return r.id=i.cssScopeElementId,r},i.browserDetection=function(){var i=n.$("body").attr("class");t.BrowserDetection.isInternetExplorer()?n.$("body").attr("class",i+" ie-"+t.BrowserDetection.getInternetExplorerVersion()):t.BrowserDetection.isSafariOnIOS()&&n.$("body").attr("class",i+" iOS")},i.cssScopeElementId="PostStao",i}();t.DomManipulation=i})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n.getBindingDefinitionFromElement=function(id){var element=document.getElementById(id),dataBind=n.getDataBindAttributeValue(element),dataBindObject="dataBindObject = {"+dataBind+"};";return eval(dataBindObject),dataBindObject},n.getDataBindAttributeValue=function(n){return n.dataset!==undefined?n.dataset.bind:n.getAttribute("data-bind")},n}();n.KoBindingEvaluator=t})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){var t=this;this.suppressScrollToResultsCounter=2;this.top=function(){t.scrollToTop()};this.activeItem=function(){t.currentAdaptiveLayoutState!==n.AdaptiveLayout.AdaptiveLayoutState.Mobile?t.scrollToActiveEntryDesktop():t.scrollToActiveEntryMobile()};this.results=function(){t.currentAdaptiveLayoutState===n.AdaptiveLayout.AdaptiveLayoutState.Mobile&&t.scrollToResults()};this.setSupressScrollToResultsCounter=function(n){t.suppressScrollToResultsCounter=n};this.suppressScrollToResults=function(){return t.suppressScrollToResultsCounter>0?(t.suppressScrollToResultsCounter--,!0):!1};this.scrollAfterLoad=function(){t.suppressScrollToResults()?t.scrollTopAndFocusOnSearchField():t.scrollToResults()}}return t.prototype.changeState=function(n,t){this.currentAdaptiveLayoutState=t},t.prototype.scrollToResults=function(){var t=n.$("#PostStaoResultsList").offset().top;n.$(window).scrollTop(t)},t.prototype.scrollTopAndFocusOnSearchField=function(){this.scrollToTop();n.$(document).ready(function(){setTimeout(function(){window.scrollTo(0,0);n.$("#PostStaoSearchInput").focus()},1)})},t.prototype.scrollToTop=function(){if(n.$("#PostStao").hasClass("res-state-result"))n.$(window).scrollTop(0)},t.prototype.scrollToActiveEntryMobile=function(){if(n.$("#PostStao").hasClass("res-state-search")&&n.$(".result-list li a.active").length){var t=n.$(".result-list li a.active").offset().top-200;n.$(window).scrollTop(t)}},t.prototype.scrollToActiveEntryDesktop=function(){setTimeout(function(){n.$(".result-list")&&n.$(".result-list li a.active")&&n.$("#PostStaoListContainer").mCustomScrollbar_Stao("scrollTo",n.$("#PostStaoListContainer .mCSB_container .result-list li a.active"))},200)},t}();t.ScrollBehavoir=i})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(n,t,i,r){var u=this;this.load=function(){u.validateSettings(u.profile,u.environment)&&(u.loadHeaderScript(),u.loadDataLayerScript(),u.loadBodyScript())};this.profile=n;this.environment=t;this.pageId=i;this.language=r}return t.prototype.validateSettings=function(n,t){return n!==""&&n!==null&&n!==undefined&&t!==""&&t!==null&&t!==undefined},t.prototype.loadHeaderScript=function(){var t=n.$("<script type='text/javascript' src='//tags.tiqcdn.com/utag/schweizerischepost/"+this.profile+"/"+this.environment+"/utag.sync.js'><\/script>");n.$("head").children().last().after(t)},t.prototype.loadDataLayerScript=function(){var t="<script type='text/javascript'>var digitalData = { page_pageInfo_pageID: '<ID>', page_pageInfo_unifiedURL: '<URL>', page_category_pageType: 'single-page application', page_category_primarySegment: 'private', page_category_primaryCategory: 'standortsuche', page_category_subCategory1: 'services', page_category_subCategory2: 'pois', page_pageInfo_language: '<LANG>' }<\/script>",i;t=t.replace("<ID>",this.pageId);t=t.replace("<URL>",window.location.href);t=t.replace("<LANG>",this.language);i=n.$(t);n.$("body").children().first().before(i)},t.prototype.loadBodyScript=function(){var t=n.$("<script type='text/javascript'>\n\t\t\t\t (function (a, b, c, d) {\n\t\t\t\t\ta = '//tags.tiqcdn.com/utag/schweizerischepost/"+this.profile+"/"+this.environment+"/utag.js';\n\t\t\t\t\tb = document;\n\t\t\t\t\tc = 'script';\n\t\t\t\t\td = b.createElement(c);\n\t\t\t\t\td.src = a;\n\t\t\t\t\td.type = 'text/java' + c;\n\t\t\t\t\td.async = true;\n\t\t\t\t\ta = b.getElementsByTagName(c)[0];\n\t\t\t\t\ta.parentNode.insertBefore(d, a);\n\t\t\t\t})();\n\t\t\t<\/script>");n.$("body").children().first().before(t)},t}();t.Tealium=i})(t=n.Utility||(n.Utility={}))}(Stao||(Stao={})),function(){Math.roundToMultiple=function(n,t,i){var r=Math.ceil(n/t)*t;return i&&r>=i?0:r}}(MathExtensions||(MathExtensions={})),function(){String.prototype.padLeft=function(n,t){for(var i=this;i.length<n;)i=t+i;return i}}(StringExtensions||(StringExtensions={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i,r){t.call(this);this.layoutState=n.ko.observable(null);this.tabberViewModel=i;this.searchViewModel=r}return __extends(i,t),i.prototype.changeState=function(n,t){this.layoutState(t);this.layoutChanged(t)},i.prototype.layoutChanged=function(n){this.handleStateChangeForTabberViewModel(n);this.handleStateChangeForSearchViewModel(n);this.reloadScrollbarsInDesktop(n)},i.prototype.reloadScrollbarsInDesktop=function(t){t===n.AdaptiveLayout.AdaptiveLayoutState.Desktop&&setTimeout(function(){n.$("#accordeon_services").mCustomScrollbar_Stao("destroy");n.$("#accordeon_services").mCustomScrollbar_Stao();n.$("#accordeon_locations_and_services").mCustomScrollbar_Stao("destroy");n.$("#accordeon_locations_and_services").mCustomScrollbar_Stao()},0)},i.prototype.handleStateChangeForTabberViewModel=function(t){switch(t){case n.AdaptiveLayout.AdaptiveLayoutState.Mobile:this.tabberViewModel.loadResultList();break;case n.AdaptiveLayout.AdaptiveLayoutState.Desktop:case n.AdaptiveLayout.AdaptiveLayoutState.Tablet:this.tabberViewModel.loadResultMap()}},i.prototype.handleStateChangeForSearchViewModel=function(t){switch(t){case n.AdaptiveLayout.AdaptiveLayoutState.Mobile:this.searchViewModel.useNearSearch(!0);this.searchViewModel.isTablet(!1);break;case n.AdaptiveLayout.AdaptiveLayoutState.Tablet:this.searchViewModel.useNearSearch(!1);this.searchViewModel.isTablet(!0);break;case n.AdaptiveLayout.AdaptiveLayoutState.Desktop:this.searchViewModel.useNearSearch(!1);this.searchViewModel.isTablet(!1)}},i}(t.BaseViewModel);t.AdaptiveLayoutViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(t,r,u,f,e,o){var s=this;i.call(this);this.showFilterPanel=n.ko.observable();this.mapWidth=n.ko.pureComputed(function(){return s.showFilterPanel()?s.adaptiveLayoutViewModel.layoutState()===n.AdaptiveLayout.AdaptiveLayoutState.Mobile||s.adaptiveLayoutViewModel.layoutState()===n.AdaptiveLayout.AdaptiveLayoutState.Tablet?"100%":"calc(100% - 292px)":"100%"});this.poiDetailControllerProxy=f;this.profile=r;this.applicationConfiguration=t;this.templateLoader=u;this.queryFragmentConverter=o;this.staoCacheClient=e;this.showFilterPanel=n.ko.observable(r.ShowFilterPanel);this.buildViewModels();this.addCustomBindings()}return __extends(r,i),r.prototype.buildViewModels=function(){var i=this;this.errorViewModel=new t.ErrorViewModel;this.scroll=new n.Utility.ScrollBehavoir;this.topicViewModel=new t.TopicViewModel(this.profile,this.queryFragmentConverter,this.staoCacheClient);this.locationAndServicesViewModel=new t.LocationAndServicesViewModel(this.profile,this.staoCacheClient,this.queryFragmentConverter,this.topicViewModel);this.openingTimeViewModel=new t.OpeningTimeViewModel(this.profile,this.staoCacheClient,this.locationAndServicesViewModel);this.filterViewModel=new t.FilterViewModel(this.topicViewModel,this.locationAndServicesViewModel,this.openingTimeViewModel);this.searchSuggestionViewModel=new t.SearchSuggestionViewModel(this.profile,this.staoCacheClient,this.locationAndServicesViewModel);this.searchViewModel=new t.SearchViewModel(this.applicationConfiguration,this.locationAndServicesViewModel,this.searchSuggestionViewModel,this.openingTimeViewModel,this.errorViewModel,this.staoCacheClient);this.poiDetailViewModel=new t.PoiDetailViewModel(this.profile,this.applicationConfiguration,this.searchViewModel,this.templateLoader,this.poiDetailControllerProxy);this.poiDetailOverlayViewModel=new t.PoiDetailOverlayViewModel(this.poiDetailViewModel);this.clusterViewModel=new t.ClusterViewModel(this.searchViewModel);this.tabberViewModel=new t.TabberViewModel(this.templateLoader);this.detailContainerMediatorViewModel=new t.DetailContainerMediatorViewModel(this.searchViewModel,this.tabberViewModel);this.adaptiveLayoutViewModel=new t.AdaptiveLayoutViewModel(this.tabberViewModel,this.searchViewModel);this.tabletOverlayViewModel=new t.TabletOverlayViewModel(this.adaptiveLayoutViewModel,this.detailContainerMediatorViewModel,this.filterViewModel);this.searchViewModel.isResultListVisible=n.ko.pureComputed(function(){var t=i.adaptiveLayoutViewModel.layoutState()===n.AdaptiveLayout.AdaptiveLayoutState.Mobile,r=i.searchSuggestionViewModel.isFirstSearch();return!(t&&r)})},r.prototype.addCustomBindings=function(){t.Bindings.MapBinding.addBindingHandler();t.Bindings.ZoomBinding.addBindingHandler();t.Bindings.MarkerBinding.addBindingHandler();t.Bindings.CenterBinding.addBindingHandler();t.Bindings.CollapsibleBinding.addBindingHandler();t.Bindings.DatePickerBinding.addBindingHandler();t.Bindings.ResponsiveStateBinding.addBindingHandler();t.Bindings.AutocompleteBinding.addBindingHandler();t.Bindings.DialogBoxBinding.addBindingHandler();t.Bindings.StaticMapBinding.addBindingHandler();t.Bindings.PoiMarkerBinding.addBindingHandler();t.Bindings.SliderBinding.addBindingHandler();t.Bindings.ActiveMarkerBinding.addBindingHandler();t.Bindings.EnterKeyBinding.addBindingHandler();t.Bindings.ScrollBarBinding.addBindingHandler();t.Bindings.FocusBinding.addBindingHandler();t.Bindings.RadioButtonBinding.addBindingHandler()},r.prototype.resolveInit=function(n){this.initViewModels().then(function(){return n.resolve(null)})},r.prototype.initViewModels=function(){var t=[];return t.push(this.errorViewModel.init()),t.push(this.topicViewModel.init()),t.push(this.locationAndServicesViewModel.init()),t.push(this.openingTimeViewModel.init()),t.push(this.filterViewModel.init()),t.push(this.searchSuggestionViewModel.init()),t.push(this.searchViewModel.init()),t.push(this.poiDetailViewModel.init()),t.push(this.poiDetailOverlayViewModel.init()),t.push(this.clusterViewModel.init()),t.push(this.detailContainerMediatorViewModel.init()),t.push(this.tabberViewModel.init()),t.push(this.adaptiveLayoutViewModel.init()),t.push(this.tabletOverlayViewModel.init()),n.q.all(t)},r}(t.BaseViewModel);t.ApplicationViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i){t.call(this);this.clusterItems=n.ko.observableArray([]);this.searchViewModel=i;this.subscribeEvents()}return __extends(i,t),i.prototype.subscribeEvents=function(){var n=this;this.searchViewModel.selectedSearchResultClusterItems.subscribe(function(t){return n.clusterItems(t)})},i}(t.BaseViewModel);t.ClusterViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i,r){t.call(this);this.poiDetail=n.ko.observable(!1);this.clusterDetail=n.ko.observable(!1);this.resultDetail=n.ko.observable(!1);this.tabberViewModel=r;this.searchViewModel=i;this.subscribeEvents()}return __extends(i,t),i.prototype.subscribeEvents=function(){var n=this;this.searchViewModel.results.subscribe(function(t){n.tabberViewModel.isResultListActive()||t.length>0&&t.some(function(n){return n.isAggregate})&&(n.poiDetail(!1),n.clusterDetail(!1),n.resultDetail(!0))});this.searchViewModel.selectedPoiDetailId.subscribe(function(){n.clusterDetail(!1);n.resultDetail(!1);n.poiDetail(!0)});this.searchViewModel.selectedSearchResultClusterItems.subscribe(function(){n.tabberViewModel.isResultListActive()||(n.poiDetail(!1),n.resultDetail(!1),n.clusterDetail(!0))});this.tabberViewModel.isResultListActive.subscribe(function(t){t&&(n.resultDetail(!1),n.clusterDetail(!1))})},i}(t.BaseViewModel);t.DetailContainerMediatorViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(){var i=this;t.call(this);this.geolocationError=n.ko.observable(!1).extend({notify:"always"});this.addressNotFoundError=n.ko.observable(!1).extend({notify:"always"});this.showError=n.ko.computed({read:function(){return this.geolocationError()||this.addressNotFoundError()},write:function(n){n===null||n===undefined||n||this.resetAllErrors()},owner:this});this.showGeolocationError=function(){i.resetAllErrors();i.geolocationError(!0)};this.showAddressNotFoundError=function(){i.resetAllErrors();i.addressNotFoundError(!0)}}return __extends(i,t),i.prototype.resetAllErrors=function(){var n=[];n.push(this.geolocationError);n.push(this.addressNotFoundError);n.forEach(function(n){return n(!1)})},i}(t.BaseViewModel);t.ErrorViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i){t.call(this);this.show=n.ko.observable(!1);this.templateName=n.ko.observable(null);this.selectAddressEnabled=n.ko.observable(!1);this.poiDetailViewModel=i;this.subscribeEvents()}return __extends(i,t),i.prototype.selectAddress=function(){this.poiDetailViewModel.selectAddress()},i.prototype.subscribeEvents=function(){var n=this;this.poiDetailViewModel.longDetailTemplateName.subscribe(function(){n.show(!0);n.templateName(n.poiDetailViewModel.longDetailTemplateName())});this.poiDetailViewModel.selectAddressEnabled.subscribe(function(t){n.selectAddressEnabled(t)})},i}(t.BaseViewModel);t.PoiDetailOverlayViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i,r,u,f,e){var o=this;t.call(this);this.currentdAddress=n.ko.observable(null);this.templateName=n.ko.observable(null).extend({notify:"always"});this.longDetailTemplateName=n.ko.observable(null).extend({notify:"always"});this.selectAddressEnabled=n.ko.observable(!1);this.selectedAddress=n.ko.observable(null);this.loadLongDetail=function(){var n=o.searchViewModel.selectedPoiDetailId();o.prepareForAddressSelection(n);o.getLongPoiDetail(n)};this.profile=i;this.applicationConfiguration=r;this.searchViewModel=u;this.templateLoader=f;this.poiDetailControllerProxy=e;this.subscribeEvents()}return __extends(i,t),i.prototype.subscribeEvents=function(){var n=this;this.searchViewModel.selectedPoiDetailId.subscribe(function(t){return n.getShortPoiDetail(t)})},i.prototype.getShortPoiDetail=function(n){var t=this;this.prepareForAddressSelection(n);this.templateLoader.shortDetail(n).then(function(n){t.templateName(n)})},i.prototype.getLongPoiDetail=function(n){var t=this;this.templateLoader.longDetail(n).then(function(n){t.longDetailTemplateName(n)})},i.prototype.prepareForAddressSelection=function(n){var t=this;this.profile.SelectAddressEnabled?this.poiDetailControllerProxy.detailAddress(n,this.profile.PrioritizedAddressId,this.applicationConfiguration.Language).then(function(n){t.currentdAddress(n);t.selectAddressEnabled(n.AddressFound)}):this.selectAddressEnabled(!1)},i.prototype.selectAddress=function(){this.selectedAddress(this.currentdAddress())},i}(t.BaseViewModel);t.PoiDetailViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(t,r,u){var f=this;i.call(this);this.text=n.ko.observable("").extend({notify:"always"});this.suggestionQueryText=n.ko.observable("").extend({notify:"always"});this.suggestionQueryTextDelayed=n.ko.pureComputed(function(){return f.suggestionQueryText()}).extend({rateLimit:200}).extend({notify:"always"});this.suggestions=n.ko.observableArray([]);this.range=n.ko.observable(1);this.searchText=n.ko.observable("").extend({rateLimit:0}).extend({notify:"always"});this.isFirstSearch=n.ko.observable(!0);this.isGeolocationUnavailable=n.ko.pureComputed(function(){return!navigator.geolocation});this.searchByText=function(){f.isFirstSearch(!1);f.searchText(f.text())};this.staoCacheClient=r;this.profile=t;this.locationAndServicesViewModel=u;this.subscribeEvents()}return __extends(r,i),r.prototype.subscribeEvents=function(){var n=this;this.suggestionQueryTextDelayed.subscribe(function(){return n.getSuggestions(n.suggestionQueryTextDelayed(),n.locationAndServicesViewModel.poiTypeFilter())})},r.prototype.resolveInit=function(t){var i=this;n.StaoCache.Utility.SearchTextClassifier.isPoiId(this.profile.PreselectText)?this.staoCacheClient.getPoiById(this.profile.PreselectText).then(function(n){i.text(n.name);i.searchText(n.name);t.resolve(null)}):(this.profile.PreselectText!==null&&this.profile.PreselectText!==""&&(this.text(this.profile.PreselectText),this.searchText(this.profile.PreselectText)),t.resolve(null))},r.prototype.getSuggestions=function(n,i){var u=this,r=[];this.staoCacheClient.getLocations(n,i).then(function(n){n.forEach(function(n){var i=new t.SearchSuggestionItemViewModel;i.name(n.name);i.type(n.locationType);i.poiId(n.id);i.name(n.name);r.push(i)});r.sort(function(n,t){return n.type()-t.type()});u.suggestions(r)})},r}(t.BaseViewModel);t.SearchSuggestionViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(t,r,u,f,e,o){var s=this;i.call(this);this.initialRadiusForSearchByCurrentLocation=5;this.useNearSearch=n.ko.observable(!1);this.isTablet=n.ko.observable(!1);this.isResultListVisible=n.ko.pureComputed(function(){return!0});this.size=n.ko.observable(n.Geolocation.Constants.defaultMapSize);this.center=n.ko.observable(n.Geolocation.Constants.switzerlandCenter);this.zoom=n.ko.observable(n.Geolocation.Constants.switzerlandZoom);this.sliderValue=n.ko.observable("1").extend({notify:"always"});this.searchRadius=n.ko.pureComputed(function(){return parseInt(s.sliderValue())});this.rangeSliderEnabled=n.ko.observable(!1).extend({notify:"always"});this.area=n.ko.pureComputed(function(){if(s.center()&&s.size()&&s.zoom())return n.Geolocation.Calculator.calculateBounds(s.center().y,s.center().x,s.size().width,s.size().height,s.zoom())}).extend({rateLimit:200});this.results=n.ko.observableArray([]);this.resultsCount=n.ko.computed(function(){var n=0;return s.results().forEach(function(t){n+=t.resultCount!==undefined?t.resultCount===null?1:t.resultCount:t.clusteredItems.length}),n});this.resultsUnclustered=n.ko.pureComputed(function(){return n.$.map(s.results().sort(s.alphabeticSort),function(n){return n.isCluster?n.clusteredItems:n})});this.selectedSearchResultItem=n.ko.observable();this.selectedSearchResultClusterItems=n.ko.observableArray([]);this.selectedPoiDetailId=n.ko.observable("").extend({notify:"always"});this.errorMessage=n.ko.observable("").extend({notify:"always"});this.showError=n.ko.observable(!1).extend({notify:"always"});this.itemClicked=function(n){s.selectedSearchResultItem(n)};this.applicationConfiguration=t;this.staoCacheClient=o;this.locationAndServicesViewModel=r;this.searchSuggestionViewModel=u;this.openingTimeViewModel=f;this.errorViewModel=e;this.subscribeEvents()}return __extends(r,i),r.prototype.disableRangeSlider=function(){this.rangeSliderEnabled()&&this.rangeSliderEnabled(!1)},r.prototype.enableRangeSlider=function(){this.rangeSliderEnabled()||this.rangeSliderEnabled(!0)},r.prototype.resetRangeSlider=function(){this.setRangeSlider(1)},r.prototype.setRangeSlider=function(n){this.sliderValue(n.toString())},r.prototype.subscribeEvents=function(){var n=this;this.searchSuggestionViewModel.searchText.subscribe(function(t){return n.setZoomAndCenterFromBestMatchingLocation(t,n.locationAndServicesViewModel.poiTypeFilter())});this.searchSuggestionViewModel.text.subscribe(function(){n.rangeSliderEnabled()&&(n.disableRangeSlider(),n.resetRangeSlider())});this.locationAndServicesViewModel.poiTypeFilter.subscribe(function(){return n.getPois(n.area(),n.locationAndServicesViewModel.poiTypeFilter(),n.openingTimeViewModel.openAtFilter(),n.zoom())});this.openingTimeViewModel.openAtFilter.subscribe(function(){return n.getPois(n.area(),n.locationAndServicesViewModel.poiTypeFilter(),n.openingTimeViewModel.openAtFilter(),n.zoom())});this.area.subscribe(function(t){return n.getPois(t,n.locationAndServicesViewModel.poiTypeFilter(),n.openingTimeViewModel.openAtFilter(),n.zoom())});this.selectedSearchResultItem.subscribe(function(t){return n.searchResultItemSelected(t)})},r.prototype.setZoomAndCenterFromBestMatchingLocation=function(t,i){t!==null&&t!==undefined&&(t===""?this.setInitialZoomAndCenter():n.StaoCache.Utility.SearchTextClassifier.isTechPlz(t)?this.setZoomAndCenterFromTechPlz(t):n.StaoCache.Utility.SearchTextClassifier.isPoiId(t)?this.setZoomAndCenterFromPoiId(t):t.toLocaleLowerCase()===this.applicationConfiguration.YourLocationText.toLocaleLowerCase()?(this.rangeSliderEnabled()||(this.setRangeSlider(this.initialRadiusForSearchByCurrentLocation),this.enableRangeSlider()),this.setCenterFromBrowserLocation()):this.setZoomAndCenterFromSearchText(t,i))},r.prototype.setInitialZoomAndCenter=function(){this.center(n.Geolocation.Constants.switzerlandCenter);this.zoom(n.Geolocation.Constants.switzerlandZoom)},r.prototype.setZoomAndCenterFromTechPlz=function(n){var t=this;this.staoCacheClient.getByTechPlz(parseInt(n)).then(function(n){n!==null&&n!==undefined&&t.navigateAndSelectPoi(n)})},r.prototype.setZoomAndCenterFromSearchText=function(t,i){var r=this;this.staoCacheClient.getLocations(t,i).then(function(i){if(r.location=n.StaoCache.Utility.LocationFinder.getBestMatchingLocation(i,t),r.location!==null&&r.location!==undefined){var u=r.getAreaFromBboxOrPt(t);r.setZoomAndCenterByArea(u,r.size())}else r.errorViewModel.showAddressNotFoundError()})},r.prototype.setZoomAndCenterByArea=function(t,i){if(t!==undefined&&t!==null&&i!==undefined&&i!==null){var r=n.Geolocation.Calculator.calculateZoomLevel(t.ymax,t.xmax,t.ymin,t.xmin,i.width,i.height),u=n.Geolocation.Calculator.calculateCenter(t.ymax,t.xmax,t.ymin,t.xmin);this.zoom(r);this.center(u)}},r.prototype.setZoomAndCenterFromPoiId=function(n){var t=this;this.staoCacheClient.getPoiById(n).then(function(n){n!==null&&n!==undefined&&t.navigateAndSelectPoi(n)})},r.prototype.setCenterFromBrowserLocation=function(){var t=this;navigator.geolocation.getCurrentPosition(function(i){t.center(n.Geolocation.Converter.getPointFromPosition(i))},function(){t.errorViewModel.geolocationError(!0)})},r.prototype.navigateAndSelectPoi=function(t){this.selectedPoiDetailId(t.id);this.zoom(n.Geolocation.Constants.poiZoom);this.center(new n.Geolocation.Point(t.y,t.x))},r.prototype.getPois=function(i,r){var u=this,f;if(r===undefined||r===null||r===""){this.results([]);return}this.useNearSearch()&&this.rangeSliderEnabled()?f=this.getPoisFromRadius():(f=this.getPoisFromBbox(),f.then(function(){u.rangeSliderEnabled()||u.searchSuggestionViewModel.searchText()===""||u.searchSuggestionViewModel.searchText()===null||u.enableRangeSlider()}));f.then(function(i){var r,f,e,o;if((u.results(i),!u.isTablet())&&u.results().length>0&&u.results()[0]instanceof t.SearchResultItemViewModel&&!u.results()[0].isAggregate){for(r={distance:99999,point:undefined},f=0;f<u.results().length;f++)e=u.results()[f],o=n.Geolocation.Calculator.calculateDistance(u.center().x,e.x,u.center().y,e.y),r.distance>o&&(r.distance=o,r.point=e);u.selectedSearchResultItem(r.point)}})},r.prototype.getPoisFromBbox=function(){var i=n.q.defer(),r=n.Geolocation.Converter.getBboxFromArea(this.area());return this.staoCacheClient.getByBbox(r,this.locationAndServicesViewModel.poiTypeFilter(),this.openingTimeViewModel.openAtFilter(),this.zoom()).then(function(n){var r=[];n.aggregates!==undefined?t.SearchResultItemViewModelFactory.getSearchResultItemViewModelsFromAggregates(n.aggregates,r):n.pois!==undefined&&t.SearchResultItemViewModelFactory.getSearchResultItemViewModelsFromPois(n.pois,r);i.resolve(r)}),i.promise},r.prototype.getPoisFromRadius=function(){var i=n.q.defer(),r=this.staoCacheClient.getByRadius(n.Geolocation.Converter.getCenterFromPoint(this.center()),this.searchRadius(),this.locationAndServicesViewModel.poiTypeFilter(),this.openingTimeViewModel.openAtFilter());return r.then(function(n){var r=[];n.aggregates!==undefined?t.SearchResultItemViewModelFactory.getSearchResultItemViewModelsFromAggregates(n.aggregates,r):n.pois!==undefined&&t.SearchResultItemViewModelFactory.getSearchResultItemViewModelsFromPois(n.pois,r);i.resolve(r)}),i.promise},r.prototype.searchResultItemSelected=function(n){n.isAggregate?this.selectAggregate(n.y,n.x):n.isCluster?this.selectedSearchResultClusterItems(n.clusteredItems):this.selectedPoiDetailId(n.id)},r.prototype.selectAggregate=function(t,i){var r=this.zoom(),u=n.StaoCache.Utility.AggregationLevelCalculator.getAggregationLevelFromZoomLevel(r),f=n.StaoCache.Utility.AggregationLevelCalculator.getNextSmallerAggregationLevel(u),e=n.StaoCache.Utility.AggregationLevelCalculator.getLowestZoomLevelFromAggregationLevel(f);this.zoom(e);this.center(new n.Geolocation.Point(t,i))},r.prototype.getAreaFromBboxOrPt=function(){return this.useNearSearch()?n.Geolocation.Calculator.getBboxFromPoint(this.location.bbox,this.location.pt):n.Geolocation.Converter.getAreaFromBbox(this.location.bbox)},r.prototype.alphabeticSort=function(n,t){return n.line1<t.line1?-1:n.line1>t.line1?1:0},r}(t.BaseViewModel);t.SearchViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i){var r=this;t.call(this);this.templateName=n.ko.observable(null);this.isResultMapActive=n.ko.observable(!1);this.isResultListActive=n.ko.observable(!0);this.loadResultMap=function(){r.templateLoader.resultMap().then(function(n){r.isResultMapActive(!0);r.isResultListActive(!1);r.templateName(n)})};this.loadResultList=function(){r.templateLoader.resultList().then(function(n){r.isResultMapActive(!1);r.isResultListActive(!0);r.templateName(n)})};this.templateLoader=i}return __extends(i,t),i.prototype.resolveInit=function(n){this.loadResultList();n.resolve(null)},i}(t.BaseViewModel);t.TabberViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i,r,u){var f=this;t.call(this);this.shiftTabLastPressed=n.ko.observable(!1);this.showDimmedOverlay=n.ko.pureComputed(function(){if(f.adaptiveLayoutViewModel===undefined||f.detailContainerMediatorViewModel===undefined||f.filterViewModel===undefined)return!1;return f.adaptiveLayoutViewModel.layoutState()===n.AdaptiveLayout.AdaptiveLayoutState.Tablet&&(f.detailContainerMediatorViewModel.poiDetail()||f.detailContainerMediatorViewModel.clusterDetail()||f.filterViewModel.showFilterPanelInTablet())});this.focusPoiDetail=function(t){t&&n.$("#PostStaoResultContainer").focus()};this.adaptiveLayoutViewModel=i;this.detailContainerMediatorViewModel=r;this.filterViewModel=u}return __extends(i,t),i.prototype.hideAllDetails=function(){this.detailContainerMediatorViewModel.poiDetail(!1);this.detailContainerMediatorViewModel.clusterDetail(!1);this.detailContainerMediatorViewModel.resultDetail(!1);this.filterViewModel.showFilterPanelInTablet(!1)},i.prototype.firstButtonShiftTabPressed=function(){this.shiftTabLastPressed()&&this.focusSelectedListEntry()},i.prototype.focusFilterPanel=function(){n.$("#PostStaoResultFilter").focus()},i.prototype.focusSelectedListEntry=function(){this.hideAllDetails();n.$("#PostStaoListContainer a.active").focus()},i.prototype.onFocusOutDetailContainer=function(n){this.onFocusCheckButtons(n,"PostStaoMobileCloseButtonTop","PostStaoResultContainer")},i.prototype.onFocusOutFilterPanel=function(n){this.onFocusCheckButtons(n,"PostStaoFilterPanelCloseButtonTop","PostStaoResultFilter")},i.prototype.onFocusCheckButtons=function(t,i,r){var u=t.target.id;(console.log(u),this.shiftTabLastPressed()&&this.adaptiveLayoutViewModel.layoutState()===n.AdaptiveLayout.AdaptiveLayoutState.Tablet)&&(u===i||u===r)&&this.focusSelectedListEntry()},i}(t.BaseViewModel);t.TabletOverlayViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.autocomplete={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(i,r){var u,f;t.placesText=r().categoryPlaces;t.poisText=r().categoryPois;u=t.getAutoCompleteWidgetOptions();n.$.widget("ui.autocomplete",n.$.ui.autocomplete,u);n.$("<div id='ui-autocomplete-wrapper' />").hide().appendTo("#PostStao");n.$(i).autocomplete({source:function(n,t){var i=r().suggestions.subscribe(function(){i.dispose();t(r().suggestions())});r().suggestionQueryText(n.term)},select:function(t,u){return r().inputText(u.item.value),n.$(i).parent().find("button").click(),!1},open:function(){n.$("#ui-autocomplete-wrapper").css({width:n.$(".searcher").css("width"),left:n.$("#PostStaoSearchInput").offset().left-n.$("#PostStao").offset().left});n.$(".ui-autocomplete").removeAttr("style");n.$("#ui-autocomplete-wrapper").mCustomScrollbar_Stao();n.$("#ui-autocomplete-wrapper").show();n.$(".ui-autocomplete").off("hover mouseover mouseenter");f===13&&n.$("#ui-autocomplete-wrapper").hide()},close:function(){n.$("#ui-autocomplete-wrapper").hide()}}).keypress(function(t){f=t.keyCode;t.keyCode===13&&n.$("#ui-autocomplete-wrapper").hide()});n.$(".ui-autocomplete").appendTo("#ui-autocomplete-wrapper");n.$(".ui-helper-hidden-accessible").appendTo("#PostStao")},t.getAutoCompleteWidgetOptions=function(){return{_create:function(){this._super();this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderMenu:t.renderMenu}},t.renderMenu=function(i,r){var o=this.term,f=!1,e=!1,u;n.$.each(r,function(r,s){s.type()===n.StaoCache.LocationType.Poi?(u=t.poisText,f||(f=!0,i.append(n.$("<li class='ui-autocomplete-category'>"+u+"<\/li>")))):(u=t.placesText,e||(e=!0,i.append(n.$("<li class='ui-autocomplete-category'>"+u+"<\/li>"))));t.renderItem(i,s,u,o)})},t.renderItem=function(t,i,r,u){i.value=i.name();var e=new RegExp("("+u+")","gi"),o=i.value.replace(e,"<span class='ui-state-highlight'>$1<\/span>"),f=n.$("<li/>").attr({"aria-label":" "}).appendTo(t).data("ui-autocomplete-item",i);return n.$("<a/>").attr("href","javascript:void(0)").html(o).appendTo(f),f},t}();t.AutocompleteBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.collapsible={init:function(n,i){i().notBound!==undefined&&i().notBound?t.simpleBindingInit(n,i):t.viewModelBindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.simpleBindingInit=function(t,i){var r=new n.Controls.CollapsibleControl(t);t.CollapsibleControl=r;i().isCollapsed===undefined||i().isCollapsed()||r.openCollapsable(!1);i().isDisabled!==undefined&&i().isDisabled()&&r.disableCollapsable()},t.viewModelBindingInit=function(t,i){var r=new n.Controls.CollapsibleControl(t);t.CollapsibleControl=r;i().isCollapsed()!==undefined&&i().isCollapsed()?r.closeCollapsable(!1,!0):r.openCollapsable(!1);n.$(t).find(":header a").click(function(){return i().isCollapsed(!i().isCollapsed()),!1})},t.bindingUpdate=function(t,i){var r=t.CollapsibleControl;i().isDisabled!==undefined&&i().isDisabled()?r.disableCollapsable():r.enableCollapsable();n.$(t).hasClass("disabled")||(i().isCollapsed()!==undefined&&i().isCollapsed()?r.closeCollapsable(!0):r.openCollapsable(!0))},t}();t.CollapsibleBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.datePicker={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(i,r){n.$.datepicker.setDefaults(n.$.datepicker.regional[r().language]);var u=n.$(i).datepicker({showOn:"button",buttonImageOnly:!1,minDate:r().minDate(),maxDate:r().maxDate(),buttonText:r().buttonText}).change(function(){t.updateBindingsFromInput(i,r)}).next("button.ui-datepicker-trigger").attr("tabIndex","-1");u.datepicker("widget").addClass("stao-only")},t.bindingUpdate=function(t,i){var r=i().date();n.$(t).datepicker("setDate",r)},t.updateBindingsFromInput=function(t,i){var r=n.$(t).datepicker("getDate");i().date(r)},t}();t.DatePickerBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.dialogBox={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(i,r){var u="post-stao-detail-view";return n.$(i).hasClass("error-message")&&(u="post-stao-error-view"),n.$(i).dialog({autoOpen:!1,draggable:!1,modal:!0,resizable:!1,dialogClass:u,closeText:r().closeText,position:{my:"top",at:"top+96",of:"body"},appendTo:"#PostStao",beforeClose:function(){n.$("body").css({overflow:"inherit"})},open:function(){n.$("html, body").css({overflow:"hidden",position:"fixed",width:"100%",height:"100%"});n.$(i).parents().addClass("post-stao-z-index-higher");n.$(".ui-button-icon-primary").text("G").attr("aria-hidden","true");n.$(".ui-widget-overlay").click(function(){return n.$(i).dialog("close"),!1})},close:function(){n.$("html, body").css({overflow:"auto",position:"relative",width:"auto",height:"auto"});n.$(i).parents().removeClass("post-stao-z-index-higher");t.updateViewModel(i,r)}}),!1},t.bindingUpdate=function(t,i){i().show()&&!n.$(t).dialog("isOpen")?n.$(t).dialog("open"):n.$(t).dialog("isOpen")&&n.$(t).dialog("close")},t.updateViewModel=function(t,i){(i().show.hasWriteFunction===undefined||i().show.hasWriteFunction)&&i().show(n.$(t).dialog("isOpen"))},t}();t.DialogBoxBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.enterKey={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(t,i){var r=this,u=i();n.$(t).keypress(function(n){var i=n.which?n.which:n.keyCode;return i===13?(u.call(r,t),!1):!0})},t}();t.EnterKeyBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.focus={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(t){n.$("#PostStao").children().blur();n.$(t).focus()},t}();t.FocusBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.radioButton={after:["value","attr"],init:function(n,i,r){t.bindingInit(n,i,r)}}},t.bindingInit=function(i,r,u){var f=n.ko.pureComputed(function(){return u.has("checkedValue")?n.ko.utils.unwrapObservable(u.get("checkedValue")):u.has("value")?n.ko.utils.unwrapObservable(u.get("value")):i.value});i.type==="radio"&&(r().subscribe(function(){t.updateView(i,r,f)}),n.$(i).click(function(){t.updateModel(i,r,f)}),t.updateView(i,r,f))},t.updateView=function(t,i,r){var u=n.ko.unwrap(i());t.checked=r()===u},t.updateModel=function(t,i,r){if(t.checked&&!n.ko.computedContext.isInitial()){var u=r();i()(u)}},t}();t.RadioButtonBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.responsiveState={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(t,i){n.$(t).click(function(){var r,t;return r=i().classSwitch?i().cssClassSwitchTrue:i().classSwitch!==undefined?i().cssClassSwitchFalse:i(),t=n.$("#PostStao"),t.removeClass(),t.addClass(r),!1})},t}();t.ResponsiveStateBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.scrollBar={update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingUpdate=function(t,i){var r=n.ko.unwrap(i);n.$(t).mCustomScrollbar_Stao({setHeight:!1});r().layoutState===n.AdaptiveLayout.AdaptiveLayoutState.Mobile&&n.$(t).mCustomScrollbar_Stao("destroy")},t}();t.ScrollBarBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.slider={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(t){n.$(t).slider({highlight:!0});n.$(t).on("change",function(t){var i=t.target.getAttribute("aria-valuenow"),r=i+" km";n.$(t.target).closest(".ui-slider").find(".ui-slider-handle").attr({"aria-valuenow":i,"aria-valuetext":r,title:r})})},t.bindingUpdate=function(t,i){i().value();n.$(t).change()},t}();t.SliderBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.activeMarker={update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingUpdate=function(n,i){var f,r,u;if(i()&&i()()&&(f=i()(),r=n.markers,r!==null&&r!==undefined))for(u in r)r.hasOwnProperty(u)&&t.setActive(r[u],f.id)},t.setActive=function(n,t){n.getId()===t||n.getId().indexOf(t)!==-1?n.setActive(!0):n.setActive(!1)},t}();t.ActiveMarkerBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.center={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(n,i){var r=n.map;google.maps.event.addListener(r,"center_changed",function(){t.updateValueAccessor(r,i)})},t.updateValueAccessor=function(t,i){var r=n.Geolocation.Converter.getPointFromLatLng(t.getCenter());i()(r)},t.bindingUpdate=function(t,i){var f=t.map,u=f.getCenter(),r=i()(),e,o;r!==null&&r!==undefined&&(u!==undefined&&u!==null&&(e=n.Geolocation.Converter.getPointFromLatLng(u),r.equals(e))||(o=n.Geolocation.Converter.getLatLngFromPoint(r),f.setCenter(o)))},t}();t.CenterBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.map={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(i,r){var e=n.GoogleMaps.MapCreator.createDynamicMap(i),u,f;i.map=e;u=n.$(i);f=new n.Geolocation.Rectangle(u.height(),u.width());r()(f);t.legendToggleFunctionality()},t.legendToggleFunctionality=function(){var t=".legend-box";n.$(t).find(".button").click(function(){return n.$(t).toggleClass("active"),!1})},t}();t.MapBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.marker={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(n){n.markers=[]},t.bindingUpdate=function(i,r){var e=n.ko.unwrap(r()),h=i.map,c=e.results(),u=i.markers,f=[],o=[],s;c.forEach(function(n){var t=u[n.id];t===undefined?o.push(n):(n.isAggregate&&t.getCount!==undefined&&t.setCount!==undefined&&t.getCount()!==n.resultCount&&t.setCount(n.resultCount),f[n.id]=t,delete u[n.id])});s=t.drawMarkers(o,e,h);s.forEach(function(n){f[n.getId()]=n});t.clearMarkers(u);i.markers=f},t.drawMarkers=function(t,i,r){for(var s=[],f=0;f<t.length;f++){var u=t[f],e=new google.maps.LatLng(u.y,u.x),h=u.id,o;o=u.isAggregate?new n.GoogleMaps.AggregateMarker(e,r,h,u.resultCount):u.isCluster?new n.GoogleMaps.ClusterMarker(e,r,u.id):new n.GoogleMaps.PoiMarker(e,r,u.id,u.poiTypeId);o.onClick=function(n){return function(){i.clicked(n)}}(u);s.push(o)}return s},t.clearMarkers=function(n){for(var t in n)n.hasOwnProperty(t)&&(n[t].setMap(null),n[t].remove())},t}();t.MarkerBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.poiMarker={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(t,i){var r=t.map,u=new google.maps.LatLng(i().lat,i().lng),f=new n.GoogleMaps.PoiMarker(u,r,"staticMapPoiMarkerId",i().poiTypeId);t.poiMarker=f},t}();t.PoiMarkerBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.staticMap={init:function(n,i){t.bindingInit(n,i)}}},t.bindingInit=function(t,i){var r=n.GoogleMaps.MapCreator.createStaticMap(t,i().centerLat,i().centerLng,i().zoom);t.map=r},t}();t.StaticMapBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){}return t.addBindingHandler=function(){n.ko.bindingHandlers.zoom={init:function(n,i){t.bindingInit(n,i)},update:function(n,i){t.bindingUpdate(n,i)}}},t.bindingInit=function(n,i){var r=n.map;google.maps.event.addListener(r,"zoom_changed",function(){t.updateValueAccessor(r,i)})},t.updateValueAccessor=function(n,t){var i=n.getZoom();i!==t()()&&t()(i)},t.bindingUpdate=function(n,t){var r=n.map,i=t()();i!==null&&i!==r.getZoom()&&r.setZoom(i)},t}();t.ZoomBinding=i})(i=t.Bindings||(t.Bindings={}))})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(t,r,u){var f=this;i.call(this);this.hideTopicSelection=n.ko.observable(!0);this.hideServiceSelection=n.ko.observable(!1);this.hideServiceTimesSelection=n.ko.observable(!0);this.disableTimesSelection=n.ko.observable(!0);this.showFilterPanelInTablet=n.ko.observable(!1);this.resetFilter=function(){f.locationAndServicesViewModel.resetFilter();f.openingTimeViewModel.resetFilter()};this.topicViewModel=t;this.locationAndServicesViewModel=r;this.openingTimeViewModel=u;this.subscribeEvents();this.showFilterPanelInTablet(!1)}return __extends(r,i),r.prototype.subscribeEvents=function(){var n=this;this.openingTimeViewModel.isFilteringByOpeningTimesPossible.subscribe(function(){return n.disableTimesSelection(!n.openingTimeViewModel.isFilteringByOpeningTimesPossible())})},r.prototype.resolveInit=function(n){t.FilterViewModelCollapsibleBehavoir.attachTo(this);n.resolve(null)},r}(t.BaseViewModel);t.FilterViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(n){var t=this;this.filterViewModel=n;this.filterViewModel.hideTopicSelection.subscribe(function(n){return t.handleTopicSelectionStatusChange(n)});this.filterViewModel.hideServiceSelection.subscribe(function(n){return t.handleServiceSelectionStatusChange(n)});this.filterViewModel.hideServiceTimesSelection.subscribe(function(n){return t.handleServiceTimesStatusChange(n)})}return n.attachTo=function(t){return new n(t)},n.prototype.handleTopicSelectionStatusChange=function(n){n?this.filterViewModel.hideServiceTimesSelection()&&this.filterViewModel.hideServiceSelection(!1):(this.filterViewModel.hideServiceSelection(!0),this.filterViewModel.hideServiceTimesSelection(!0))},n.prototype.handleServiceSelectionStatusChange=function(n){n||(this.filterViewModel.hideTopicSelection(!0),this.filterViewModel.hideServiceTimesSelection(!0))},n.prototype.handleServiceTimesStatusChange=function(n){n||(this.filterViewModel.hideServiceSelection(!0),this.filterViewModel.hideTopicSelection(!0))},n}();n.FilterViewModelCollapsibleBehavoir=t})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(r,u,f,e){var o=this;i.call(this);this.locations=n.ko.observableArray([]);this.selectedLocationsAndServices=n.ko.observableArray([]);this.poiTypeFilter=n.ko.pureComputed(function(){return o.fillPoiTypeFilterFromSelectedServices(o.selectedLocationsAndServices())}).extend({rateLimit:0});this.resetFilter=function(){o.loadFilterFromTopic(o.topicViewModel.selectedTopic().query())};this.loadServicesFromTopic=function(n){o.locations().forEach(function(i){n.forEach(function(n){if(i.tag()===n.tag){var r=[];n.subQueryFragments.forEach(function(n){var i=new t.FilterLocationServiceItemViewModel;i.name(n.name);i.tag(n.tag);i.isVisible(o.isServiceVisible(n.tag));i.innerObject=n;r.push(i)});i.subViewModels(r)}})})};this.isServiceVisible=function(n){var i,t;if(o.topicViewModel.selectedTopic().servicesToHide()===null)return!0;for(i=o.topicViewModel.selectedTopic().servicesToHide().split(","),t=0;t<i.length;t++)if(i[t]===n)return!1;return!0};this.profile=r;this.staoCacheClient=u;this.queryFragmentConverter=f;this.topicViewModel=e;this.subscribeEvents()}return __extends(r,i),r.prototype.subscribeEvents=function(){var n=this;this.topicViewModel.selectedTopic.subscribe(function(t){return n.loadFilterFromTopic(t.query())});this.selectedLocationsAndServices.subscribe(function(n){n.forEach(function(n){var t=n.value;n.status==="deleted"&&t.selectedSubViewModels().length>0?t.selectedSubViewModels([]):n.status==="added"&&t.subViewModels().length>0&&t.selectedSubViewModels(t.subViewModels())})},null,"arrayChange")},r.prototype.loadFilterFromTopic=function(n){var t=this,i=this.queryFragmentConverter.toQueryFragment(n);this.staoCacheClient.getTypes().then(function(n){t.types=n;t.loadLocationsFromTopic();t.loadServicesFromTopic(i);t.loadPreSelectServicesFromTopic(i)})},r.prototype.loadLocationsFromTopic=function(){var n=this,i=[];this.profile.SelectedPoiTypes.forEach(function(r){var u=new t.FilterLocationServiceItemViewModel,f;u.innerObject=null;i.push(u);f=n.types.getTypeById(r);u.name(f.desc);u.id(f.id);u.category(f.cat);u.tag(f.tag);n.locations(i)})},r.prototype.loadPreSelectServicesFromTopic=function(n){var t=[];this.locations().forEach(function(i){n.forEach(function(n){i.tag()===n.tag&&(i.innerObject=n,i.name(n.name),i.selectedSubViewModels(i.subViewModels()),t.push(i))})});this.selectedLocationsAndServices(t)},r.prototype.fillPoiTypeFilterFromSelectedServices=function(t){var i;return this.queryFragmentConverter?(i=[],t.forEach(function(t){var r=new n.StaoCache.Query.QueryFragment;r.tag=t.tag();r.name=t.name();r.subQueryFragments=[];t.selectedSubViewModels().forEach(function(n){r.subQueryFragments.push(n.innerObject)});i.push(r)}),this.queryFragmentConverter.toPoisQuery(i)):""},r}(t.BaseViewModel);t.LocationAndServicesViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(t){function i(i,r,u){var f=this;t.call(this);this.counterTypesToDisplay={};this.minDate=n.ko.observable();this.maxDate=n.ko.observable();this.counters=n.ko.observableArray([]);this.isFilteringByOpeningTimesPossible=n.ko.pureComputed(function(){return f.counters().length>0});this.date=n.ko.observable();this.hour=n.ko.observable().extend({rateLimit:200});this.minute=n.ko.observable().extend({rateLimit:200});this.selectedCounterTag=n.ko.observable("");this.openAtFilter=n.ko.observable("");this.resetFilter=function(){var t=new Date,i;f.profile.OpenAt!==""&&f.profile.OpenAt!==null&&f.profile.OpenAt!==undefined&&(i=n.Utility.DateTimeConverter.convertToDate(f.profile.OpenAt),i.toString()!=="Invalid Date"&&(t=i));f.date(t);f.hour(t.getHours().toString());f.minute(Math.roundToMultiple(t.getMinutes(),5,60).toString());f.selectedCounterTag("")};this.profile=i;this.staoCacheClient=r;this.locationAndServicesViewModel=u;this.subscribeEvents()}return __extends(i,t),i.prototype.subscribeEvents=function(){var n=this;this.locationAndServicesViewModel.selectedLocationsAndServices.subscribe(function(){return n.handleSelectedLocationsChanged()});this.date.subscribe(function(t){return n.createOpenAtQuery(t,n.selectedCounterTag(),n.hour(),n.minute())});this.selectedCounterTag.subscribe(function(t){return n.createOpenAtQuery(n.date(),t,n.hour(),n.minute())});this.hour.subscribe(function(t){return n.createOpenAtQuery(n.date(),n.selectedCounterTag(),t,n.minute())});this.minute.subscribe(function(t){return n.createOpenAtQuery(n.date(),n.selectedCounterTag(),n.hour(),t)})},i.prototype.resolveInit=function(n){var t=this;this.staoCacheClient.getTypes().then(function(n){t.allTypes=n.getTypes();t.allCounterTypes=n.getCounterTypes();t.initCounterTypesToDisplay()}).then(function(){return t.staoCacheClient.getOpeningHoursTimeSpan()}).then(function(n){t.minDate(n.openTimeMin);t.maxDate(n.openTimeMax)}).then(function(){t.resetFilter();n.resolve(null)})},i.prototype.initCounterTypesToDisplay=function(){var f=this.allCounterTypes.filter(function(t){return t.id===n.StaoCache.Constants.typeIdCounterNormal||t.id===n.StaoCache.Constants.typeIdCounterBusiness||t.id===n.StaoCache.Constants.typeIdCounterFach}),t,i,r,u;this.counterTypesToDisplay[n.StaoCache.Constants.typeIdPostAgency]=f;t=this.allCounterTypes.filter(function(t){return t.id===n.StaoCache.Constants.typeIdCounterNormal});this.counterTypesToDisplay[n.StaoCache.Constants.typeIdPickPost]=t;i=this.allCounterTypes.filter(function(t){return t.id===n.StaoCache.Constants.typeIdCounterNormal});this.counterTypesToDisplay[n.StaoCache.Constants.typeIdPostFinance]=i;r=this.allCounterTypes.filter(function(t){return t.id===n.StaoCache.Constants.typeIdCounterNormal});this.counterTypesToDisplay[n.StaoCache.Constants.typeIdMyPost24]=r;u={tag:n.StaoCache.Constants.typeIdCounterLetterbox,cat:n.StaoCache.Constants.typeCategoryCounter,desc:this.allTypes.filter(function(t){return t.id===n.StaoCache.Constants.typeIdLetterbox})[0].desc};this.counterTypesToDisplay[n.StaoCache.Constants.typeIdLetterbox]=[];this.counterTypesToDisplay[n.StaoCache.Constants.typeIdLetterbox].push(u)},i.prototype.handleSelectedLocationsChanged=function(){for(var i,r,u=this.locationAndServicesViewModel.selectedLocationsAndServices().filter(function(t){return t.category()===n.StaoCache.Constants.typeCategoryPoi}),f=[],t=0;t<u.length;t++)if(u[t].id()!==n.StaoCache.Constants.typeIdLetterbox&&(i=this.counterTypesToDisplay[u[t].id()],i!==undefined&&i!==null)){for(r=0;r<i.length;r++)f.push(i[r]);break}for(t=0;t<u.length;t++)if(u[t].id()===n.StaoCache.Constants.typeIdLetterbox){for(i=this.counterTypesToDisplay[n.StaoCache.Constants.typeIdLetterbox],r=0;r<i.length;r++)f.push(i[r]);break}this.resetIfSelectedCounterIsMissing(f);this.counters(f)},i.prototype.resetIfSelectedCounterIsMissing=function(n){var i,t;if(this.selectedCounterTag()){for(i=!1,t=0;t<n.length;t++)if(n[t].tag===this.selectedCounterTag()){i=!0;break}i||this.resetFilter()}},i.prototype.createOpenAtQuery=function(t,i,r,u){if(!this.isFilteringByOpeningTimesPossible()||!t||!i||!r||!u){this.openAtFilter("");return}parseInt(r)>23&&(r="23");parseInt(u)>59&&(u="59");var f=n.Utility.DateTimeConverter.format(t.getFullYear(),t.getMonth()+1,t.getDate(),r,u),e=i,o=e+","+f;this.openAtFilter(o)},i}(t.BaseViewModel);t.OpeningTimeViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}));__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(n){var t;(function(t){var i=function(i){function r(r,u,f){i.call(this);this.topics=n.ko.observableArray([]);this.selectedTopic=n.ko.observable(new t.FilterTopicItemViewModel);this.staoCacheClient=f;this.queryFragmentConverter=u;this.profile=r}return __extends(r,i),r.prototype.resolveInit=function(n){var t=this;this.staoCacheClient.getTypes().then(function(i){t.types=i;t.loadTopicsFromProfile();n.resolve(null)})},r.prototype.loadTopicsFromProfile=function(){var i=this,n=[],r=[];this.profile.Topics.forEach(function(u){var f=new t.FilterTopicItemViewModel;f.innerObject=u;f.title(u.Description);f.titleTrim(u.Description.replace(/ /g,""));f.query(u.Query);f.servicesToHide(u.ServicesToHide);f.isVisible(u.IsVisible);u.IsVisible===!1?r.push(f):n.push(f);u.UniqueTopicKey===i.profile.OnStartActivatedTopicUniqueKey&&i.selectedTopic(f)});r.forEach(function(t){n.push(t)});this.topics(n)},r}(t.BaseViewModel);t.TopicViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){this.name=n.ko.observable("");this.tag=n.ko.observable("");this.id=n.ko.observable("");this.category=n.ko.observable("");this.isVisible=n.ko.observable(!0);this.selectedSubViewModels=n.ko.observableArray([]);this.subViewModels=n.ko.observableArray([])}return t}();t.FilterLocationServiceItemViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){this.title=n.ko.observable("");this.titleTrim=n.ko.observable("");this.query=n.ko.observable("");this.servicesToHide=n.ko.observable("");this.isVisible=n.ko.observable(!0)}return t}();t.FilterTopicItemViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function n(){}return n}();n.SearchResultItemViewModel=t})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(n){var t=function(){function t(){}return t.getSearchResultItemViewModelsFromAggregates=function(t,i){for(var u,r,f=0;f<t.length;f++)u=t[f],r=new n.SearchResultItemViewModel,r.isAggregate=!0,r.isCluster=!1,r.id=u.key,r.resultCount=u.count,r.poiTypeId="",r.line1=u.name,r.line2=u.count.toString(),r.line3="",r.x=u.x,r.y=u.y,i.push(r)},t.getSearchResultItemViewModelsFromPois=function(i,r){for(var u,f,e,o=0;o<i.length;o++)u=i[o],u.name!==undefined&&u.name!==null?(f=new n.SearchResultItemViewModel,f.isAggregate=!1,f.isCluster=!1,f.resultCount=null,f.poiTypeId=t.getPoiTypeIdFromPoiId(u.id),f.id=u.id,f.line1="",f.line2="",f.line3="",f.x=u.x,f.y=u.y,f.line1=u.name,u.info!==undefined&&u.info!==null&&(u.info.Street!==undefined&&u.info.Street!==null&&(f.line2=""+u.info.Street),u.info.Zip!==undefined&&u.info.Zip!==null&&u.info.City!==undefined&&u.info.City!==null&&(f.line3=u.info.Zip+" "+u.info.City),u.info.AdditionalDescription!==undefined&&u.info.AdditionalDescription!==null&&(f.line1+=" "+u.info.AdditionalDescription)),r.push(f)):(e=new n.SearchResultItemViewModel,e.id=u.pois.map(function(n){return n.id}).join(";"),e.isAggregate=!1,e.isCluster=!0,e.x=u.x,e.y=u.y,r.push(e),e.clusteredItems=[],this.getSearchResultItemViewModelsFromPois(u.pois,e.clusteredItems))},t.getPoiTypeIdFromPoiId=function(n){return n.split("_")[0]},t}();n.SearchResultItemViewModelFactory=t})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={})),function(n){var t;(function(t){var i=function(){function t(){this.name=n.ko.observable("");this.poiId=n.ko.observable("");this.type=n.ko.observable(n.StaoCache.LocationType.Poi)}return t}();t.SearchSuggestionItemViewModel=i})(t=n.ViewModel||(n.ViewModel={}))}(Stao||(Stao={}))