route360
Version:
The Route360° JavaScript API for Motion Intelligence's time-based access mapping service.
6 lines • 68.1 kB
JavaScript
/*
Route360° JavaScript API v0.5.3 (a575c9e), a JS library for leaflet.js and google maps API. http://route360.net
(c) 2017 Henning Hollburg, Daniel Gerber and Jan Silbersiepe, (c) 2017 Motion Intelligence GmbH
*/
!function(t,e,n){function o(){var e=t.r360;a.noConflict=function(){return t.r360=e,this},t.r360=a}function r(t,e){this.map=t,this.id=a.Util.generateId(),this.inverse=!1,this.topRight={lat:-90,lng:-180},this.bottomLeft={lat:90,lng:180},this.opacity=a.config.defaultPolygonLayerOptions.opacity,this.strokeWidth=a.config.defaultPolygonLayerOptions.strokeWidth,this.backgroundColor=a.config.defaultPolygonLayerOptions.backgroundColor,this.backgroundOpacity=a.config.defaultPolygonLayerOptions.backgroundOpacity,this.tolerance=a.config.defaultPolygonLayerOptions.tolerance,this.extendWidthX=a.config.defaultPolygonLayerOptions.strokeWidth/2,this.extendWidthY=a.config.defaultPolygonLayerOptions.strokeWidth/2,"undefined"!=typeof e&&("undefined"!=typeof e.opacity&&(this.opacity=e.opacity),"undefined"!=typeof e.strokeWidth&&(this.strokeWidth=e.strokeWidth),"undefined"!=typeof e.inverse&&(this.inverse=e.inverse),"undefined"!=typeof e.tolerance&&(this.tolerance=e.tolerance),"undefined"!=typeof e.extendWidthX&&(this.extendWidthX=e.extendWidthX),"undefined"!=typeof e.extendWidthY&&(this.extendWidthY=e.extendWidthY)),this.element=null,this.setMap(this.map),this.addListener()}var a={version:"v0.5.3",isUndefined:function(t){return void 0===t},has:function(t,e){return null!=t&&hasOwnProperty.call(t,e)},isFunction:function(t){return"function"==typeof t||!1},findWhere:function(t,e){var i=n;return t.some(function(t,n,o){var r=!1;for(var n in e)r=!(!a.has(t,n)||t[n]!==e[n]);if(r)return i=t,!0}),i},filter:function(t,e){var i=[];return t.forEach(function(t,n,o){e(t,n,o)&&i.push(t)}),i},contains:function(t,e){return t.indexOf(e)>-1},each:function(t,e){t.forEach(function(t,i,n){e(t,i,n)})},max:function(t,e,i){var n,o,r=-(1/0),s=-(1/0);if(null==e||"number"==typeof e&&"arrayect"!=typeof t[0]&&null!=t)for(var l=0,h=t.length;l<h;l++)n=t[l],null!=n&&n>r&&(r=n);else a.each(t,function(t,i,n){o=e(t,i,n),(o>s||o===-(1/0)&&r===-(1/0))&&(r=t,s=o)});return r},keys:function(t){if("Object"!=typeof t)return[];if(Object.keys(t))return Object.keys(t);var e=[];for(var i in t)a.has(t,i)&&e.push(i);return e}};"object"==typeof module&&"object"==typeof module.exports?module.exports=a:"function"==typeof define&&define.amd?define(a):o(),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,n=function(){},o=function(){return i.apply(this instanceof n&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,o.prototype=new n,o}),a.config={serviceVersion:"v1",pathSerializer:"compact",requestTimeout:1e4,maxRoutingTime:3600,maxRoutingLength:1e5,bikeSpeed:15,bikeUphill:20,bikeDownhill:-10,walkSpeed:5,walkUphill:10,walkDownhill:0,travelTimes:[300,600,900,1200,1500,1800],travelType:"walk",logging:!1,rushHour:!1,defaultTravelTimeControlOptions:{travelTimes:[{time:300,color:"#006837",opacity:.1},{time:600,color:"#39B54A",opacity:.2},{time:900,color:"#8CC63F",opacity:.3},{time:1200,color:"#F7931E",opacity:.4},{time:1500,color:"#F15A24",opacity:.5},{time:1800,color:"#C1272D",opacity:1}],position:"topright",label:"travel time",initValue:30},routeTypes:[{routeType:"WALK",color:"red",haloColor:"white"},{routeType:"BIKE",color:"#558D54",haloColor:"white"},{routeType:"CAR",color:"#558D54",haloColor:"white"},{routeType:"TRANSFER",color:"#C1272D",haloColor:"white"},{routeType:102,color:"#006837",haloColor:"white"},{routeType:400,color:"#156ab8",haloColor:"white"},{routeType:900,color:"red",haloColor:"white"},{routeType:700,color:"#A3007C",haloColor:"white"},{routeType:1e3,color:"blue",haloColor:"white"},{routeType:109,color:"#006F35",haloColor:"white"},{routeType:100,color:"red",haloColor:"white"},{routeType:1,color:"red",haloColor:"red"},{routeType:2,color:"blue",haloColor:"blue"},{routeType:3,color:"yellow",haloColor:"yellow"},{routeType:0,color:"green",haloColor:"green"},{routeType:4,color:"orange",haloColor:"orange"},{routeType:5,color:"red",haloColor:"red"},{routeType:6,color:"blue",haloColor:"blue"},{routeType:7,color:"yellow",haloColor:"yellow"}],photonPlaceAutoCompleteOptions:{serviceUrl:"https://service.route360.net/geocode/",position:"topleft",reset:!1,reverse:!1,placeholder:"Select source",maxRows:5,width:300},defaultRadioOptions:{position:"topright"},defaultPolygonLayerOptions:{opacity:.4,strokeWidth:30,tolerance:15,backgroundColor:"black",backgroundOpacity:.5,inverse:!1,animate:!1,animationDuration:1}},a.Bounds=function(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])},a.Bounds.prototype={extend:function(t){return t=a.point(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new a.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new a.Point(this.min.x,this.max.y)},getTopRight:function(){return new a.Point(this.max.x,this.min.y)},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return t="number"==typeof t[0]||t instanceof a.Point?a.point(t):a.bounds(t),t instanceof a.Bounds?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=a.bounds(t);var e=this.min,i=this.max,n=t.min,o=t.max,r=o.x>=e.x&&n.x<=i.x,s=o.y>=e.y&&n.y<=i.y;return r&&s},overlaps:function(t){t=a.bounds(t);var e=this.min,i=this.max,n=t.min,o=t.max,r=o.x>e.x&&n.x<i.x,s=o.y>e.y&&n.y<i.y;return r&&s},isValid:function(){return!(!this.min||!this.max)}},a.bounds=function(t,e){return!t||t instanceof a.Bounds?t:new a.Bounds(t,e)},a.LatLngBounds=function(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])},a.LatLngBounds.prototype={extend:function(t){var e,i,n=this._southWest,o=this._northEast;if(t instanceof a.LatLng)e=t,i=t;else{if(!(t instanceof a.LatLngBounds))return t?this.extend(a.latLng(t)||a.latLngBounds(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||o?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),o.lat=Math.max(i.lat,o.lat),o.lng=Math.max(i.lng,o.lng)):(this._southWest=new a.LatLng(e.lat,e.lng),this._northEast=new a.LatLng(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new a.LatLngBounds(new a.LatLng(e.lat-n,e.lng-o),new a.LatLng(i.lat+n,i.lng+o))},getCenter:function(){return new a.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new a.LatLng(this.getNorth(),this.getWest())},getSouthEast:function(){return new a.LatLng(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof a.LatLng?a.latLng(t):a.latLngBounds(t);var e,i,n=this._southWest,o=this._northEast;return t instanceof a.LatLngBounds?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=a.latLngBounds(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>=e.lat&&n.lat<=i.lat,s=o.lng>=e.lng&&n.lng<=i.lng;return r&&s},overlaps:function(t){t=a.latLngBounds(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>e.lat&&n.lat<i.lat,s=o.lng>e.lng&&n.lng<i.lng;return r&&s},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t){return!!t&&(t=a.latLngBounds(t),this._southWest.equals(t.getSouthWest())&&this._northEast.equals(t.getNorthEast()))},isValid:function(){return!(!this._southWest||!this._northEast)}},a.latLngBounds=function(t,e){return!t||t instanceof a.LatLngBounds?t:new a.LatLngBounds(t,e)},a.Point=function(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e},a.Point.prototype={clone:function(){return new a.Point(this.x,this.y)},add:function(t){return this.clone()._add(a.point(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(a.point(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},distanceTo:function(t){t=a.point(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=a.point(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=a.point(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+a.Util.formatNum(this.x)+", "+a.Util.formatNum(this.y)+")"}},a.point=function(t,e,i){return t instanceof a.Point?t:a.Util.isArray(t)?new a.Point(t[0],t[1]):t===n||null===t?t:new a.Point(t,e,i)},a.LatLng=function(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,i!==n&&(this.alt=+i)},a.LatLng.prototype={equals:function(t,e){if(!t)return!1;t=a.latLng(t);var i=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return i<=(e===n?1e-9:e)},toString:function(t){return"LatLng("+a.Util.formatNum(this.lat,t)+", "+a.Util.formatNum(this.lng,t)+")"},distanceTo:function(t){return a.CRS.Earth.distance(this,a.latLng(t))},wrap:function(){return a.CRS.Earth.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return a.latLngBounds([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new a.LatLng(this.lat,this.lng,this.alt)}},a.latLng=function(t,e,i){return t instanceof a.LatLng?t:a.Util.isArray(t)&&"object"!=typeof t[0]?3===t.length?new a.LatLng(t[0],t[1],t[2]):2===t.length?new a.LatLng(t[0],t[1]):null:t===n||null===t?t:"object"==typeof t&&"lat"in t?new a.LatLng(t.lat,"lng"in t?t.lng:t.lon,t.alt):e===n?null:new a.LatLng(t,e,i)},function(){var i=navigator.userAgent.toLowerCase(),n=e.documentElement,o="ActiveXObject"in t,r=i.indexOf("webkit")!==-1,s=i.indexOf("phantom")!==-1,l=i.search("android [23]")!==-1,h=i.indexOf("chrome")!==-1,u=i.indexOf("gecko")!==-1&&!r&&!t.opera&&!o,g="undefined"!=typeof orientation||i.indexOf("mobile")!==-1,c=navigator.msPointerEnabled&&navigator.msMaxTouchPoints&&!t.PointerEvent,d=t.PointerEvent&&navigator.pointerEnabled&&navigator.maxTouchPoints||c,f=o&&"transition"in n.style,p="WebKitCSSMatrix"in t&&"m11"in new t.WebKitCSSMatrix&&!l,m="MozPerspective"in n.style,y="OTransition"in n.style,v=!t.L_NO_TOUCH&&!s&&(d||"ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch);a.Browser={ie:o,ielt9:o&&!e.addEventListener,webkit:r,gecko:u,android:i.indexOf("android")!==-1,android23:l,chrome:h,safari:!h&&i.indexOf("safari")!==-1,ie3d:f,webkit3d:p,gecko3d:m,opera12:y,any3d:!t.L_DISABLE_3D&&(f||p||m)&&!y&&!s,mobile:g,mobileWebkit:g&&r,mobileWebkit3d:g&&p,mobileOpera:g&&t.opera,mobileGecko:g&&u,touch:!!v,msPointer:!!c,pointer:!!d,retina:(t.devicePixelRatio||t.screen.deviceXDPI/t.screen.logicalXDPI)>1}}(),a.Class=function(){},a.Class.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,n=a.Util.create(i);n.constructor=e,e.prototype=n;for(var o in this)this.hasOwnProperty(o)&&"prototype"!==o&&(e[o]=this[o]);return t.statics&&(a.extend(e,t.statics),delete t.statics),t.includes&&(a.Util.extend.apply(null,[n].concat(t.includes)),delete t.includes),n.options&&(t.options=a.Util.extend(a.Util.create(n.options),t.options)),a.extend(n,t),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=n._initHooks.length;t<e;t++)n._initHooks[t].call(this)}},e},a.Class.include=function(t){a.extend(this.prototype,t)},a.Class.mergeOptions=function(t){a.extend(this.prototype.options,t)},a.Class.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i)},a.PolygonUtil={clip:function(t,e){var n,o,r,a,s=function(t){return(o[0]-n[0])*(t[1]-n[1])>(o[1]-n[1])*(t[0]-n[0])},l=function(){var t=[n[0]-o[0],n[1]-o[1]],e=[r[0]-a[0],r[1]-a[1]],i=n[0]*o[1]-n[1]*o[0],s=r[0]*a[1]-r[1]*a[0],l=1/(t[0]*e[1]-t[1]*e[0]);return[(i*e[0]-s*t[0])*l,(i*e[1]-s*t[1])*l]},h=t,n=e[e.length-1];for(j in e){var o=e[j],u=h;h=[],r=u[u.length-1];for(i in u){var a=u[i];s(a)?(s(r)||h.push(l()),h.push(a)):s(r)&&h.push(l()),r=a}n=o}return h},isCollinear:function(t,e,i){if(t.x==i.x&&t.y==i.y)return!1;if(t.x==e.x&&e.x==i.x)return!0;if(t.y==e.y&&e.y==i.y)return!0;var n=t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y);return n<a.config.defaultPolygonLayerOptions.tolerance&&n>-a.config.defaultPolygonLayerOptions.tolerance&&t.x!=i.x&&t.y!=i.y},scale:function(t,e){return a.point(t.x*e,t.y*e)},subtract:function(t,e,i){return a.point(t.x-e,t.y-i)},divide:function(t,e){return a.point(t.x/e,t.y/e)},roundPoint:function(t){return t.x=Math.round(t.x),t.y=Math.round(t.y),t},buildPath:function(t,e){return[e,Math.round(t.x),Math.round(t.y)]},getEuclidianDistance:function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},getSvgFrame:function(t,e){return[["M",0,0],["L",t,0],["L",t,e],["L",0,e],["z"]]},extendBounds:function(t,e,i){var n=Math.ceil(e),o=Math.ceil(i);return t.max.x+=n,t.min.x-=n,t.max.y+=o,t.min.y-=o,t},addPolygonToMultiPolygon:function(t,e){var i=a.filter(t,function(t){return t.getTravelTime()==e.travelTime});if(i.length>0)i[0].addPolygon(e);else{var n=new a.multiPolygon;n.setTravelTime(e.travelTime),n.addPolygon(e),n.setColor(e.getColor()),n.setOpacity(e.getOpacity()),t.push(n)}}},a.SvgUtil={getGElement:function(t,e){var i=a.Util.generateId(),n=e.opacity;return"<g id="+i+" style='opacity:"+n+"'><path style='stroke: "+e.color+"; fill: "+e.color+" ; stroke-opacity: 1; stroke-width: "+e.strokeWidth+"; fill-opacity:1'd='"+t.toString().replace(/\,/g," ")+"'/></g>"},getInverseSvgElement:function(t,e){var i=a.PolygonUtil.getSvgFrame(e.svgWidth,e.svgHeight),n="<div id=svg_"+e.id+" style='"+a.Util.getTranslation(e.offset)+";''><svg height="+e.svgHeight+" width="+e.svgWidth+" style='fill:"+e.backgroundColor+" ; opacity: "+e.backgroundOpacity+"; stroke-width: "+e.strokeWidth+"; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd' xmlns='http://www.w3.org/2000/svg'>",o="</svg></div>",r="<defs><mask id='mask_"+e.id+"'><path style='fill-opacity:1;stroke: white; fill:white;' d='"+i.toString().replace(/\,/g," ")+"'/>"+t.join("")+"</mask></defs>",s="<path style='mask: url(#mask_"+e.id+")' d='"+i.toString().replace(/\,/g," ")+"'/>";return n+s+r+o},getNormalSvgElement:function(t,e){var i="<div id=svg_"+e.id+" style='"+a.Util.getTranslation(e.offset)+";''><svg height="+e.svgHeight+" width="+e.svgWidth+" style='fill:"+e.backgroundColor+" ; opacity: "+e.opacity+"; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd' xmlns='http://www.w3.org/2000/svg'>",n="</svg></div>";return i+t.join("")+n},createSvgData:function(t,e){var i=[],n=a.PolygonUtil.scale(t.getTopRightDecimal(),e.scale),o=a.PolygonUtil.scale(t.getBottomLeftDecimal(),e.scale);o.x>e.bounds.max.x||n.x<e.bounds.min.x||n.y>e.bounds.max.y||o.y<e.bounds.min.y||a.SvgUtil.buildSVGPolygon(i,t.getOuterBoundary().getCoordinates(),e);for(var r=t.getInnerBoundary(),s=0;s<r.length;s++){var l=a.PolygonUtil.scale(r[s].getTopRightDecimal(),e.scale),h=a.PolygonUtil.scale(r[s].getBottomLeftDecimal(),e.scale);h.x>e.bounds.max.x||l.x<e.bounds.min.x||l.y>e.bounds.max.y||h.y<e.bounds.min.y||a.SvgUtil.buildSVGPolygon(i,r[s].getCoordinates(),e)}return i},buildSVGPolygon:function(t,e,i){for(var n,o,r,s,l,h=0,u=[[i.bounds.min.x,i.bounds.min.y],[i.bounds.max.x,i.bounds.min.y],[i.bounds.max.x,i.bounds.max.y],[i.bounds.min.x,i.bounds.max.y]],g=[],c=0;c<e.length;c++)n=a.PolygonUtil.scale(a.point(e[c].x,e[c].y),i.scale),l=c>0?a.PolygonUtil.getEuclidianDistance(r,n):i.tolerance,l>=i.tolerance&&(s=!1,h>2&&(s=a.PolygonUtil.isCollinear(o,r,n)),s?(g[g.length-1][0]=n.x,g[g.length-1][1]=n.y):(g.push([n.x,n.y]),o=r,r=n,h++));for(var d,f=a.PolygonUtil.clip(g,u),c=0;c<f.length;c++)n=a.PolygonUtil.subtract(a.point(f[c][0],f[c][1]),i.pixelOrigin.x+i.offset.x,i.pixelOrigin.y+i.offset.y),t.push(c>0?a.PolygonUtil.buildPath(n,"L"):a.PolygonUtil.buildPath(n,"M")),d=n;return t.length>0&&t.push(["z"]),t}},a.Util={getTimeInSeconds:function(){var t=new Date;return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()},getHoursAndMinutesInSeconds:function(){var t=new Date;return 3600*t.getHours()+60*t.getMinutes()},getCurrentDate:function(){var t=new Date,e=t.getFullYear(),i=t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,n=t.getDate()<10?"0"+t.getDate():t.getDate();return e+""+i+n},getTimeFormat:function(t){var e=a.config.i18n;return"en"==e.language&&t>=43200?"p.m.":e.get("timeFormat")},secondsToHoursAndMinutes:function(t){var e=(t/60).toFixed(0),i=Math.floor(e/60);e-=60*i;var n="";return 0!=i&&(n+=i+"h "),n+=e+"min"},secondsToTimeOfDay:function(t){var e=Math.floor(t/3600),i=Math.floor(t/60)-60*e;return t=t-3600*e-60*i,e+":"+("0"+i).slice(-2)+":"+("0"+t).slice(-2)},generateId:function(t){for(var e="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<(t?t:10);n++)e+=i.charAt(Math.floor(Math.random()*i.length));return e},parseLatLonArray:function(t){for(var e=new Array,i=0;i<t.length;i++)e.push(new a.Point(t[i][0],t[i][1]));return e},getAddressByCoordinates:function(t,e,i){$.getJSON(a.config.nominatimUrl+"reverse.php?&format=json&lat="+t.lat+"&accept-language="+e+"&lon="+t.lng+"&json_callback=?",i)},formatReverseGeocoding:function(t){var e=[];a.has(t.address,"road")&&e.push(t.address.road),a.has(t.address,"house_number")&&e.push(t.address.house_number);var i=[];a.has(t.address,"postcode")&&i.push(t.address.postcode),a.has(t.address,"city")&&i.push(t.address.city);var n=[];return e.length>0&&n.push(e.join(" ")),i.length>0&&n.push(i.join(", ")),0==e.length&&0==i.length&&n.push(t.display_name),n.join(", ")},formatPhotonReverseGeocoding:function(t){var e=[];a.has(t,"name")&&e.push(t.name),a.has(t,"street")&&e.push(t.street),a.has(t,"housenumber")&&e.push(t.housenumber);var i=[];a.has(t,"postcode")&&i.push(t.postcode),a.has(t,"city")&&i.push(t.city);var n=[];return e.length>0&&n.push(e.join(" ")),i.length>0&&n.push(i.join(", ")),0==e.length&&0==i.length&&n.push("Reverse geocoding not possible."),n.join(", ")},parsePolygons:function(t){for(var e=[],i=0;i<t.length;i++)for(var n=t[i],o=0;o<n.polygons.length;o++){var r=n.polygons[o],s=a.polygon(r.travelTime,r.area,a.lineString(a.Util.parseLatLonArray(r.outerBoundary))),l=a.findWhere(a.config.defaultTravelTimeControlOptions.travelTimes,{time:s.getTravelTime()});s.setColor(a.isUndefined(l)?"#000000":l.color);var h=a.findWhere(a.config.defaultTravelTimeControlOptions.travelTimes,{time:s.getTravelTime()});if(s.setOpacity(a.isUndefined(h)?1:h.opacity),"undefined"!=typeof r.innerBoundary)for(var u=0;u<r.innerBoundary.length;u++)s.addInnerBoundary(a.lineString(a.Util.parseLatLonArray(r.innerBoundary[u])));a.PolygonUtil.addPolygonToMultiPolygon(e,s)}return e.sort(function(t,e){return e.getTravelTime()-t.getTravelTime()}),e},parseRoutes:function(t){for(var e=new Array,i=0;i<t.routes.length;i++){var n=t.routes[i];e.push(a.route(t.routes[i].travelTime,t.routes[i].segments,n))}return e},webMercatorToLeaflet:function(t){return a.CRS.EPSG3857.transformation._transform(a.point(t.x/6378137,t.y/6378137))},webMercatorToLatLng:function(t,e){var i=a.CRS.EPSG3857.projection.unproject(new a.Point(t.x,t.y));return"undefined"!=typeof e?a.latLng([i.lat,i.lng,e]):i},latLngToWebMercator:function(t){var e=a.Projection.SphericalMercator.project(t);return e.x*=6378137,e.y*=6378137,e},getUserAgent:function(){var t,e=navigator.userAgent,i=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(i[1])?(t=/\brv[ :]+(\d+)/g.exec(e)||[],"IE "+(t[1]||"")):"Chrome"===i[1]&&(t=e.match(/\bOPR\/(\d+)/),null!=t)?"Opera "+t[1]:(i=i[2]?[i[1],i[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(t=e.match(/version\/(\d+)/i))&&i.splice(1,1,t[1]),i.join(" "))},isAnimated:function(){var t=getUserAgent();return t.indexOf("IE")==-1&&(t.indexOf("Safari")==-1&&(t.indexOf("Firefox")==-1&&!!a.config.defaultPolygonLayerOptions.animate))},getTranslation:function(t){var e=a.Util.getUserAgent();return e.indexOf("IE 9")!=-1?"transform:translate("+t.x+"px,"+t.y+"px)":e.indexOf("Safari")!=-1?"-webkit-transform:translate3d("+t.x+"px,"+t.y+"px,0px)":e.indexOf("Firefox")!=-1?"-moz-transform:translate3d("+t.x+"px,"+t.y+"px,0px)":"transform:translate3d("+t.x+"px,"+t.y+"px,0px)"},formatNum:function(t,e){var i=Math.pow(10,e||5);return Math.round(t*i)/i},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},extend:function(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++){o=arguments[i];for(e in o)t[e]=o[e]}return t},degreeInMeters:function(t){var e=t*(Math.PI/180),i=111132.92-559.82*Math.cos(2*e)+1.175*Math.cos(4*e),n=111415.13*Math.cos(e)-94.55*Math.cos(3*e);return{lat:i,lng:n}},metersInDegrees:function(t,e){var i=this.degreeInMeters(e);return{lat:t/i.lat,lng:t/i.lng}}},a.extend=a.Util.extend,a.DomUtil={setPosition:function(t,e){a.Browser.any3d?a.DomUtil.setTransform(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")},setTransform:function(t,e,i){var n=e||new a.Point(0,0);t.style[a.DomUtil.TRANSFORM]="translate3d("+n.x+"px,"+n.y+"px,0)"+(i?" scale("+i+")":"")},testProp:function(t){for(var i=e.documentElement.style,n=0;n<t.length;n++)if(t[n]in i)return t[n];return!1}},function(){a.DomUtil.TRANSFORM=a.DomUtil.testProp(["transform","WebkitTransform","OTransform","MozTransform","msTransform"])}(),a.TravelOptions=function(){this.sources=[],this.targets=[],this.bikeSpeed=n,this.bikeUphill=n,this.bikeDownhill=n,this.walkSpeed=n,this.walkUphill=n,this.walkDownhill=n,this.travelTimes=n,this.travelType=n,this.elevationEnabled=n,this.rushHour=n,this.minPolygonHoleSize=n,this.buffer=n,this.simplify=n,this.srid=n,this.quadrantSegments=n,this.time=n,this.date=n,this.frameDuration=n,this.reverse=n,this.recommendations=n,this.intersectionMode=n,this.pathSerializer="compact",this.polygonSerializer="json",this.pointReduction=!0,this.maxRoutingTime=n,this.maxRoutingLength=n,this.maxEdgeWeight=n,this.edgeWeight="time",this.serviceUrl=n,this.serviceKey=n,this.travelTimeFactors=n,this.maxTransfers=n,this.getReverse=function(){return this.reverse},this.setReverse=function(t){this.reverse=t},this.getFrameDuration=function(){return this.frameDuration},this.setFrameDuration=function(t){this.frameDuration=t},this.getBuffer=function(){return this.buffer},this.setBuffer=function(t){this.buffer=t},this.getSimplifyMeter=function(){return this.simplify},this.setSimplifyMeter=function(t){this.simplify=t},this.getSrid=function(){return this.srid},this.setSrid=function(t){this.srid=t},this.getQuadrantSegments=function(){return this.quadrantSegments},this.setQuadrantSegments=function(t){this.quadrantSegments=t},this.getSources=function(){return this.sources},this.addSource=function(t){this.sources.push(t)},this.addTarget=function(t){this.targets.push(t)},this.getTargets=function(){return this.targets},this.getBikeSpeed=function(){return this.bikeSpeed},this.getBikeUphill=function(){return this.bikeUphill},this.getBikeDownhill=function(){return this.bikeDownhill},this.getWalkSpeed=function(){return this.walkSpeed},this.getWalkUphill=function(){return this.walkUphill},this.getWalkDownhill=function(){return this.walkDownhill},this.getTravelTimes=function(){return this.travelTimes},this.getTravelType=function(){return this.travelType},this.getTime=function(){return this.time},this.getDate=function(){return this.date},this.getPathSerializer=function(){return this.pathSerializer},this.getPolygonSerializer=function(){return this.polygonSerializer},this.getMaxRoutingTime=function(){return console.warn("getMaxRoutingTime is deprecated. use getMaxEdgeWeight instead"),this.maxRoutingTime},this.getMaxRoutingLength=function(){return console.warn("getMaxRoutingLength is deprecated. use getMaxEdgeWeight instead"),this.maxRoutingLength},this.getMaxEdgeWeight=function(){return this.maxEdgeWeight},this.getIntersectionMode=function(){return this.intersectionMode},this.getRecommendations=function(){return this.recommendations},this.getServiceUrl=function(){return this.serviceUrl},this.getServiceKey=function(){return this.serviceKey},this.setServiceKey=function(t){this.serviceKey=t},this.setServiceUrl=function(t){this.serviceUrl=t},this.setRecommendations=function(t){this.recommendations=t},this.setIntersectionMode=function(t){this.intersectionMode=t},this.setMaxRoutingTime=function(t){console.warn("setMaxRoutingTime is deprecated. use setMaxEdgeWeight instead"),this.maxRoutingTime=t},this.setMaxRoutingLength=function(t){console.warn("setMaxRoutingLength is deprecated. use setMaxEdgeWeight instead"),this.maxRoutingLength=t},this.setMaxEdgeWeight=function(t){this.maxEdgeWeight=t},this.setPathSerializer=function(t){this.pathSerializer=t},this.setPolygonSerializer=function(t){this.polygonSerializer=t},this.setMinPolygonHoleSize=function(t){this.minPolygonHoleSize=t},this.getMinPolygonHoleSize=function(){return this.minPolygonHoleSize},this.setSources=function(t){this.sources=t},this.setTargets=function(t){this.targets=t},this.setBikeSpeed=function(t){this.bikeSpeed=t},this.setBikeUphill=function(t){this.bikeUphill=t},this.setBikeDownhill=function(t){this.bikeDownhill=t},this.setWalkSpeed=function(t){this.walkSpeed=t},this.setWalkUphill=function(t){this.walkUphill=t},this.setWalkDownhill=function(t){this.walkDownhill=t},this.setTravelTimes=function(t){this.travelTimes=t},this.setTravelType=function(t){this.travelType=t},this.setTime=function(t){this.time=t},this.setDate=function(t){this.date=t},this.isElevationEnabled=function(){return this.elevationEnabled},this.setElevationEnabled=function(t){this.elevationEnabled=t},this.isRushHour=function(){return this.rushHour},this.setRushHour=function(t){this.rushHour=t},this.isCongestionEnabled=function(){return console.warn('Calling deprecated function "isCongestionEnabled()". Use "isRushHour()" instead.'),this.rushHour},this.setCongestionEnabled=function(t){console.warn('Calling deprecated function "setCongestionEnabled()". Use "setRushHour()" instead.'),this.rushHour=t},this.disablePointReduction=function(){this.pointReduction=!1},this.enablePointReduction=function(){this.pointReduction=!0},this.isPointReductionEnabled=function(){return this.pointReduction},this.getEdgeWeight=function(){return this.edgeWeight},this.setEdgeWeight=function(t){this.edgeWeight=t},this.getTravelTimeFactors=function(){return this.travelTimeFactors},this.setTravelTimeFactors=function(t){this.travelTimeFactors=t},this.getMaxTransfers=function(){return this.maxTransfers},this.setMaxTransfers=function(t){this.maxTransfers=t}},a.travelOptions=function(){return new a.TravelOptions},a.PolygonService={cache:{},getCfg:function(t){var e={};return e.sources=[],a.isUndefined(t.isElevationEnabled())||(e.elevation=t.isElevationEnabled()),a.isUndefined(t.getReverse())||(e.reverse=t.getReverse()),a.isUndefined(t.getEdgeWeight())||(e.edgeWeight=t.getEdgeWeight()),a.isUndefined(t.getTravelTimeFactors())||(e.travelTimeFactors=t.getTravelTimeFactors()),e.polygon={},a.isUndefined(t.getTravelTimes())||(e.polygon.values=t.getTravelTimes()),a.isUndefined(t.getIntersectionMode())||(e.polygon.intersectionMode=t.getIntersectionMode()),a.isUndefined(t.getPolygonSerializer())||(e.polygon.serializer=t.getPolygonSerializer()),a.isUndefined(t.isPointReductionEnabled())||(e.polygon.pointReduction=t.isPointReductionEnabled()),a.isUndefined(t.getMinPolygonHoleSize())||(e.polygon.minPolygonHoleSize=t.getMinPolygonHoleSize()),a.isUndefined(t.getSrid())||(e.polygon.srid=t.getSrid()),a.isUndefined(t.getSimplifyMeter())||(e.polygon.simplify=t.getSimplifyMeter()),a.isUndefined(t.getBuffer())||(e.polygon.buffer=t.getBuffer()),a.isUndefined(t.getQuadrantSegments())||(e.polygon.quadrantSegments=t.getQuadrantSegments()),t.getSources().forEach(function(i){var n={lat:a.has(i,"lat")?i.lat:i.getLatLng().lat,lng:a.has(i,"lon")?i.lon:a.has(i,"lng")?i.lng:i.getLatLng().lng,id:a.has(i,"id")?i.id:"",tm:{}},o=a.has(i,"travelType")?i.travelType:t.getTravelType();n.tm[o]={},"transit"!=o&&"biketransit"!=o||(n.tm[o].frame={},a.isUndefined(t.getTime())||(n.tm[o].frame.time=t.getTime()),a.isUndefined(t.getDate())||(n.tm[o].frame.date=t.getDate()),a.isUndefined(t.getFrameDuration())||(n.tm[o].frame.duration=t.getFrameDuration()),a.isUndefined(t.getMaxTransfers())||(n.tm[o].maxTransfers=t.getMaxTransfers())),"bike"==o&&(n.tm.bike={},a.isUndefined(t.getBikeSpeed())||(n.tm.bike.speed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.bike.uphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.bike.downhill=t.getBikeDownhill())),"walk"==o&&(n.tm.walk={},a.isUndefined(t.getWalkSpeed())||(n.tm.walk.speed=t.getWalkSpeed()),a.isUndefined(t.getWalkUphill())||(n.tm.walk.uphill=t.getWalkUphill()),a.isUndefined(t.getWalkDownhill())||(n.tm.walk.downhill=t.getWalkDownhill())),"car"==o&&(n.tm[o].rushHour=!1,a.isUndefined(t.isRushHour())||(n.tm[o].rushHour=t.isRushHour())),e.sources.push(n)}),e},getTravelTimePolygons:function(t,e,i,n){var o=a.PolygonService.getCfg(t);if(a.has(a.PolygonService.cache,JSON.stringify(o)))e("geojson"==t.getPolygonSerializer()?a.PolygonService.cache[JSON.stringify(o)]:a.Util.parsePolygons(a.PolygonService.cache[JSON.stringify(o)]));else{var r=a.PolygonService.getAjaxOptions(t,o,e,i,"undefined"==typeof n?"GET":n);$.ajax(r)}},getAjaxOptions:function(t,e,i,n,o){var r="undefined"!=typeof t.getServiceUrl()?t.getServiceUrl():a.config.serviceUrl,s={url:r+a.config.serviceVersion+"/polygon?cfg="+encodeURIComponent(JSON.stringify(e))+"&cb=?&key="+t.getServiceKey(),timeout:a.config.requestTimeout,dataType:"json",type:o,success:function(o){a.has(o,"data")?"ok"==o.code?(a.PolygonService.cache[JSON.stringify(e)]=o.data,i("geojson"==t.getPolygonSerializer()?o.data:a.Util.parsePolygons(o.data))):a.isFunction(n)&&n(o.code,o.message):(a.PolygonService.cache[JSON.stringify(e)]=o,i("geojson"==t.getPolygonSerializer()?o.data:a.Util.parsePolygons(o)))},error:function(t){a.isFunction(n)&&(403==t.status?n("not-authorized",t.responseText):n("service-not-available","The travel time polygon service is currently not available, please try again later."))}};return"POST"==o&&(s.url=r+a.config.serviceVersion+"/polygon?key="+t.getServiceKey(),s.data=JSON.stringify(e),s.contentType="application/json",s.async=!1),s}},a.RouteService={cache:{},getCfg:function(t){var e={sources:[],targets:[],pathSerializer:t.getPathSerializer()};return a.isUndefined(t.isElevationEnabled())||(e.elevation=t.isElevationEnabled()),a.isUndefined(t.getReverse())||(e.reverse=t.getReverse()),a.isUndefined(t.getTravelTimeFactors())||(e.travelTimeFactors=t.getTravelTimeFactors()),t.getSources().forEach(function(i){var n={lat:a.has(i,"lat")?i.lat:i.getLatLng().lat,lng:a.has(i,"lon")?i.lon:a.has(i,"lng")?i.lng:i.getLatLng().lng,
id:a.has(i,"id")?i.id:"",tm:{}},o=a.has(i,"travelType")?i.travelType:t.getTravelType();n.tm[o]={},"transit"!=o&&"biketransit"!=o||(n.tm[o].frame={},a.isUndefined(t.getTime())||(n.tm[o].frame.time=t.getTime()),a.isUndefined(t.getDate())||(n.tm[o].frame.date=t.getDate()),a.isUndefined(t.getRecommendations())||(n.tm[o].recommendations=t.getRecommendations()),a.isUndefined(t.getFrameDuration())||(n.tm[o].frame.duration=t.getFrameDuration()),a.isUndefined(t.getMaxTransfers())||(n.tm[o].maxTransfers=t.getMaxTransfers())),"bike"==o&&(n.tm.bike={},a.isUndefined(t.getBikeSpeed())||(n.tm.bike.speed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.bike.uphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.bike.downhill=t.getBikeDownhill())),"walk"==o&&(n.tm.walk={},a.isUndefined(t.getWalkSpeed())||(n.tm.walk.speed=t.getWalkSpeed()),a.isUndefined(t.getWalkUphill())||(n.tm.walk.uphill=t.getWalkUphill()),a.isUndefined(t.getWalkDownhill())||(n.tm.walk.downhill=t.getWalkDownhill())),"car"==o&&(n.tm[o].rushHour=!1,a.isUndefined(t.isRushHour())||(n.tm[o].rushHour=t.isRushHour())),e.sources.push(n)}),e.targets=[],t.getTargets().forEach(function(t){e.targets.push({lat:a.has(t,"lat")?t.lat:t.getLatLng().lat,lng:a.has(t,"lon")?t.lon:a.has(t,"lng")?t.lng:t.getLatLng().lng,id:a.has(t,"id")?t.id:""})}),e},getRoutes:function(t,e,i){var n=a.RouteService.getCfg(t);a.has(a.RouteService.cache,JSON.stringify(n))?e(a.Util.parseRoutes(JSON.parse(JSON.stringify(a.RouteService.cache[JSON.stringify(n)])))):$.ajax({url:t.getServiceUrl()+a.config.serviceVersion+"/route?cfg="+encodeURIComponent(JSON.stringify(n))+"&cb=?&key="+t.getServiceKey(),timeout:a.config.requestTimeout,dataType:"json",success:function(t){a.has(t,"data")?"ok"==t.code?(a.RouteService.cache[JSON.stringify(n)]=JSON.parse(JSON.stringify(t.data)),e(a.Util.parseRoutes(t.data))):a.isFunction(i)&&i(t.code,t.message):(a.RouteService.cache[JSON.stringify(n)]=JSON.parse(JSON.stringify(t)),e(a.Util.parseRoutes(t)))},error:function(t){a.isFunction(i)&&(403==t.status?i("not-authorized",t.responseText):i("service-not-available","The routing service is currently not available, please try again later."))}})}},a.TimeService={cache:{},getCfg:function(t){var e={sources:[],targets:[],pathSerializer:t.getPathSerializer(),maxRoutingTime:t.getMaxRoutingTime(),maxRoutingLength:t.getMaxRoutingLength()};return a.isUndefined(t.isElevationEnabled())||(e.elevation=t.isElevationEnabled()),a.isUndefined(t.getTravelTimeFactors())||(e.travelTimeFactors=t.getTravelTimeFactors()),a.isUndefined(t.getTravelTimes())&&a.isUndefined(t.getIntersectionMode())||(e.polygon={},a.isUndefined(t.getTravelTimes())||(e.polygon.values=t.getTravelTimes()),a.isUndefined(t.getIntersectionMode())||(e.polygon.intersectionMode=t.getIntersectionMode()),a.isUndefined(t.getMinPolygonHoleSize())||(e.polygon.minPolygonHoleSize=t.getMinPolygonHoleSize())),t.getSources().forEach(function(i){var n={lat:a.has(i,"lat")?i.lat:i.getLatLng().lat,lng:a.has(i,"lon")?i.lon:a.has(i,"lng")?i.lng:i.getLatLng().lng,id:a.has(i,"id")?i.id:"",tm:{}};""==n.id&&(n.id=n.lat+";"+n.lng);var o=a.has(i,"travelType")?i.travelType:t.getTravelType();n.tm[o]={},"transit"!=o&&"biketransit"!=o||(n.tm[o].frame={},a.isUndefined(t.getTime())||(n.tm[o].frame.time=t.getTime()),a.isUndefined(t.getDate())||(n.tm[o].frame.date=t.getDate()),a.isUndefined(t.getFrameDuration())||(n.tm[o].frame.duration=t.getFrameDuration()),a.isUndefined(t.getMaxTransfers())||(n.tm[o].maxTransfers=t.getMaxTransfers())),"ebike"==o&&(n.tm.ebike={},a.isUndefined(t.getBikeSpeed())||(n.tm.ebike.speed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.ebike.uphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.ebike.downhill=t.getBikeDownhill())),"rentbike"==o&&(n.tm.rentbike={},a.isUndefined(t.getBikeSpeed())||(n.tm.rentbike.bikespeed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.rentbike.bikeuphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.rentbike.bikedownhill=t.getBikeDownhill()),a.isUndefined(t.getWalkSpeed())||(n.tm.rentbike.walkspeed=t.getWalkSpeed()),a.isUndefined(t.getWalkUphill())||(n.tm.rentbike.walkuphill=t.getWalkUphill()),a.isUndefined(t.getWalkDownhill())||(n.tm.rentbike.walkdownhill=t.getWalkDownhill())),"rentandreturnbike"==o&&(n.tm.rentandreturnbike={},a.isUndefined(t.getBikeSpeed())||(n.tm.rentandreturnbike.bikespeed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.rentandreturnbike.bikeuphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.rentandreturnbike.bikedownhill=t.getBikeDownhill()),a.isUndefined(t.getWalkSpeed())||(n.tm.rentandreturnbike.walkspeed=t.getWalkSpeed()),a.isUndefined(t.getWalkUphill())||(n.tm.rentandreturnbike.walkuphill=t.getWalkUphill()),a.isUndefined(t.getWalkDownhill())||(n.tm.rentandreturnbike.walkdownhill=t.getWalkDownhill())),"bike"==o&&(n.tm.bike={},a.isUndefined(t.getBikeSpeed())||(n.tm.bike.speed=t.getBikeSpeed()),a.isUndefined(t.getBikeUphill())||(n.tm.bike.uphill=t.getBikeUphill()),a.isUndefined(t.getBikeDownhill())||(n.tm.bike.downhill=t.getBikeDownhill())),"walk"==o&&(n.tm.walk={},a.isUndefined(t.getWalkSpeed())||(n.tm.walk.speed=t.getWalkSpeed()),a.isUndefined(t.getWalkUphill())||(n.tm.walk.uphill=t.getWalkUphill()),a.isUndefined(t.getWalkDownhill())||(n.tm.walk.downhill=t.getWalkDownhill())),"car"==o&&(n.tm.car.rushHour=!1,a.isUndefined(t.isRushHour())||(n.tm.car.rushHour=t.isRushHour())),e.sources.push(n)}),t.getTargets().forEach(function(t){var t={lat:a.has(t,"lat")?t.lat:t.getLatLng().lat,lng:a.has(t,"lon")?t.lon:a.has(t,"lng")?t.lng:t.getLatLng().lng,id:a.has(t,"id")?t.id:""};""==t.id&&(t.id=t.lat+";"+t.lng),e.targets.push(t)}),e},getRouteTime:function(t,e,i){var n=a.TimeService.getCfg(t);a.has(a.TimeService.cache,JSON.stringify(n))?e(a.TimeService.cache[JSON.stringify(n)]):$.ajax({url:t.getServiceUrl()+a.config.serviceVersion+"/time?key="+t.getServiceKey(),type:"POST",data:JSON.stringify(n),contentType:"application/json",timeout:a.config.requestTimeout,dataType:"json",success:function(t){a.has(t,"data")?"ok"==t.code?(a.TimeService.cache[JSON.stringify(n)]=t.data,e(t.data)):a.isFunction(i)&&i(t.code,t.message):(a.TimeService.cache[JSON.stringify(n)]=t,e(t))},error:function(t){a.isFunction(i)&&(403==t.status?i("not-authorized",t.responseText):i("service-not-available","The time service is currently not available, please try again later."))}})}},a.Projection={},a.Projection.SphericalMercator={R:6378137,project:function(t){var e=Math.PI/180,i=1-1e-15,n=Math.max(Math.min(Math.sin(t.lat*e),i),-i);return new a.Point(this.R*t.lng*e,this.R*Math.log((1+n)/(1-n))/2)},unproject:function(t){var e=180/Math.PI;return new a.LatLng((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=6378137*Math.PI;return a.bounds([-t,-t],[t,t])}()},a.Transformation=function(t,e,i,n){this._a=t,this._b=e,this._c=i,this._d=n},a.Transformation.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new a.Point((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}},a.CRS={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t),n=this.transformation.transform(e.min,i),o=this.transformation.transform(e.max,i);return a.bounds(n,o)},wrapLatLng:function(t){var e=this.wrapLng?a.Util.wrapNum(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?a.Util.wrapNum(t.lat,this.wrapLat,!0):t.lat,n=t.alt;return a.latLng(i,e,n)}},a.CRS.Earth=a.extend({},a.CRS,{wrapLng:[-180,180],R:6378137,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,r=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((e.lng-t.lng)*i);return this.R*Math.acos(Math.min(r,1))}}),a.CRS.EPSG3857=a.extend({},a.CRS.Earth,{code:"EPSG:3857",projection:a.Projection.SphericalMercator,transformation:function(){var t=.5/Math.PI;return new a.Transformation(t,.5,-t,.5)}()}),a.CRS.EPSG900913=a.extend({},a.CRS.EPSG3857,{code:"EPSG:900913"}),a.polygon=function(t,e,i){return new a.Polygon(t,e,i)},a.Polygon=function(t,e,i){this.travelTime=t,this.area=e,this.color="black",this.opacity=.5,this.lineStrings=[i],this.bounds=n,this.setTravelTime=function(t){this.travelTime=t},this.getTravelTime=function(){return this.travelTime},this.getColor=function(){return this.color},this.setColor=function(t){this.color=t},this.setOpacity=function(t){this.opacity=t},this.getOpacity=function(){return this.opacity},this.getArea=function(){return this.area},this.setArea=function(t){this.area=t},this.getOuterBoundary=function(){return this.lineStrings[0]},this.getInnerBoundary=function(){return this.lineStrings.slice(1)},this.getTopRight4326=function(){return this.getOuterBoundary().getTopRight4326()},this.getTopRight3857=function(){return this.getOuterBoundary().getTopRight3857()},this.getTopRightDecimal=function(){return this.getOuterBoundary().getTopRightDecimal()},this.getBottomLeft4326=function(){return this.getOuterBoundary().getBottomLeft4326()},this.getBottomLeft3857=function(){return this.getOuterBoundary().getBottomLeft3857()},this.getBottomLeftDecimal=function(){return this.getOuterBoundary().getBottomLeftDecimal()},this.addInnerBoundary=function(t){this.lineStrings.push(t)}},a.MultiPolygon=function(){this.travelTime,this.color,this.polygons=new Array,this.topRight_3857=new a.Point(-20026377,-20048967),this.bottomLeft_3857=new a.Point(20026377,20048967),this.addPolygon=function(t){this.polygons.push(t),t.getOuterBoundary().getTopRight3857().x>this.topRight_3857.x&&(this.topRight_3857.x=t.getOuterBoundary().getTopRight3857().x),t.getOuterBoundary().getTopRight3857().y>this.topRight_3857.y&&(this.topRight_3857.y=t.getOuterBoundary().getTopRight3857().y),t.getOuterBoundary().getBottomLeft3857().x<this.bottomLeft_3857.x&&(this.bottomLeft_3857.x=t.getOuterBoundary().getBottomLeft3857().x),t.getOuterBoundary().getBottomLeft3857().y<this.bottomLeft_3857.y&&(this.bottomLeft_3857.y=t.getOuterBoundary().getBottomLeft3857().y)},this.getBoundingBox3857=function(){return a.bounds(this.bottomLeft_3857,this.topRight_3857)},this.getBoundingBox4326=function(){return a.latLngBounds(a.Util.webMercatorToLatLng(this.bottomLeft_3857),a.Util.webMercatorToLatLng(this.topRight_3857))},this.setOpacity=function(t){this.opacity=t},this.getOpacity=function(){return this.opacity},this.getArea=function(){var t=0;return this.polygons.forEach(function(e){t+=e.getArea()}),t},this.getPolygons=function(){return this.polygons},this.setColor=function(t){this.color=t},this.getColor=function(){return this.color},this.getTravelTime=function(){return this.travelTime},this.setTravelTime=function(t){this.travelTime=t}},a.multiPolygon=function(){return new a.MultiPolygon},a.lineString=function(t){return new a.LineString(t)},a.LineString=function(t){this.topRight_3857=new a.Point(-20026377,-20048967),this.bottomLeft_3857=new a.Point(20026377,20048967),this.coordinates=[];for(var e=t.length-1;e>=0;e--)t[e].x>this.topRight_3857.x&&(this.topRight_3857.x=t[e].x),t[e].y>this.topRight_3857.y&&(this.topRight_3857.y=t[e].y),t[e].x<this.bottomLeft_3857.x&&(this.bottomLeft_3857.x=t[e].x),t[e].y<this.bottomLeft_3857.y&&(this.bottomLeft_3857.y=t[e].y);for(var e=0;e<t.length;e++)this.coordinates.push(a.Util.webMercatorToLeaflet(t[e]));this.getTopRight4326=function(){return a.Util.webMercatorToLatLng(new a.Point(this.topRight_3857.x,this.topRight_3857.y))},this.getTopRight3857=function(){return this.topRight_3857},this.getTopRightDecimal=function(){return a.Util.webMercatorToLeaflet(this.topRight_3857)},this.getBottomLeft4326=function(){return a.Util.webMercatorToLatLng(new a.Point(this.bottomLeft_3857.x,this.bottomLeft_3857.y))},this.getBottomLeft3857=function(){return this.bottomLeft_3857},this.getBottomLeftDecimal=function(){return a.Util.webMercatorToLeaflet(this.bottomLeft_3857)},this.getCoordinates=function(){return this.coordinates},this.getCoordinate=function(t){return this.coordinates[t]}},a.RouteSegment=function(t){var e=this;if(e.points=[],e.type=t.type,e.travelTime=t.travelTime,e.distance=t.length/1e3,e.warning=t.warning,e.elevationGain=t.elevationGain,e.errorMessage,e.transitSegment=!1,e.startname=t.startname,e.endname=t.endname,t.points.forEach(function(t){e.points.push(a.Util.webMercatorToLatLng(new a.Point(t[1],t[0]),t[2]))}),t.isTransit){var i=a.findWhere(a.config.routeTypes,{routeType:t.routeType});e.color="undefined"!=typeof i&&a.has(i,"color")?i.color:"RED",e.haloColor="undefined"!=typeof i&&a.has(i,"haloColor")?i.haloColor:"WHITE",e.transitSegment=!0,e.routeType=t.routeType,e.routeShortName=t.routeShortName,e.startname=t.startname,e.endname=t.endname,e.departureTime=t.departureTime,e.arrivalTime=t.arrivalTime,e.tripHeadSign=t.tripHeadSign}else{var i=a.findWhere(a.config.routeTypes,{routeType:t.type});e.color="undefined"!=typeof i&&a.has(i,"color")?i.color:"RED",e.haloColor="undefined"!=typeof i&&a.has(i,"haloColor")?i.haloColor:"WHITE"}e.getPoints=function(){return e.points},e.getType=function(){return e.type},e.getHaloColor=function(){return e.haloColor},e.getColor=function(){return e.color},e.getTravelTime=function(){return e.travelTime},e.getDistance=function(){return e.distance},e.getRouteType=function(){return e.routeType},e.getRouteShortName=function(){return e.routeShortName},e.getStartName=function(){return e.startname},e.getEndName=function(){return e.endname},e.getDepartureTime=function(){return e.departureTime},e.getArrivalTime=function(){return e.arrivalTime},e.getTripHeadSign=function(){return e.tripHeadSign},e.getWarning=function(){return e.warning},e.getElevationGain=function(){return e.elevationGain},e.isTransit=function(){return e.transitSegment}},a.routeSegment=function(t){return new a.RouteSegment(t)},a.Route=function(t,e,i){var o=this;o.travelTime=t,o.routeSegments=[],o.points=[],o.uphillMeter=0,o.downhillMeter=0,o.targetHeight=n,o.sourceHeight=n,o.sourceId=n,o.targetId=n,o.length=n,o.transfers=0,e.reverse().forEach(function(t){var e=a.routeSegment(t);o.routeSegments.push(e),"TRANSFER"===e.type&&o.transfers++,o.points=o.points.concat(e.getPoints().reverse())}),"undefined"!=typeof i&&(o.sourceId=i.source_id,o.targetId=i.target_id,o.length=i.length),o.equals=function(t){return o.getKey()===t.getKey()},o.getKey=function(){var e=t,i="";return o.getSegments().forEach(function(t){e+=" "+t.getRouteShortName()+" "+t.getDepartureTime()+" "+t.getArrivalTime(),t.getPoints().forEach(function(t){i+=" "+t.lat+t.lng})}),e+i},o.addRouteSegment=function(t){o.routeSegments.push(t)},o.setTravelTime=function(t){o.travelTime=t},o.getDistance=function(){for(var t=0,e=0;e<o.routeSegments.length;e++)t+=o.routeSegments[e].getDistance();return t},o.getElevationGain=function(){for(var t=0,e=0;e<o.routeSegments.length;e++)t+=o.routeSegments[e].getElevationGain();return t},o.getElevations=function(){for(var t={x:[],y:[]},e=0;e<1e3*o.getDistance();e+=100)t.x.push(e/1e3+" km"),t.y.push(o.getElevationAt(e));return t},o.getElevationAt=function(t){for(var e=0,i=1;i<o.points.length;i++){var n=o.points[i-1],r=o.points[i],a=n.distanceTo(r);if(e+=a,e>t)return r.alt}},o.getSegments=function(){return o.routeSegments},o.getUphillElevation=function(){return o.uphillMeter},o.getDownhillElevation=function(){return o.downhillMeter},o.getTotalElevationDifference=function(){return Math.abs(o.sourceHeight-o.targetHeight)},o.setElevationDifferences=function(){for(var t=n,e=o.points.length-1;e>=0;e--)0==e&&(o.targetHeight=o.points[e].alt),e==o.points.length-1&&(o.sourceHeight=o.points[e].alt),"undefined"!=typeof t&&(t>o.points[e].alt?o.uphillMeter+=t-o.points[e].alt:t<o.points[e].alt&&(o.downhillMeter+=o.points[e].alt-t)),t=o.points[e].alt}(),o.getTravelTime=function(){return o.travelTime}},a.route=function(t,e,i){return new a.Route(t,e,i)},a.basemapsLookup={bright:"osm-bright-gl-style",light:"positron-gl-style",dark:"dark-matter-gl-style",blues:"fiord-color-gl-style",basic:"klokantech-basic-gl-style"},a.getBasemapList=function(){return Object.keys(a.basemapsLookup)},a.getGLStyle=function(t,e){if(!t&&!a.basemapsLookup[t])throw new Error("valid style name required to access Route360 basemap");if(!e)throw new Error("apikey required to access Route360 basemaps");return"https://maps.route360.net/styles/"+a.basemapsLookup[t]+".json?key="+e},"object"==typeof L&&(a.LeafletPolygonLayer=L.Class.extend({initialize:function(t){this.opacity=.4,this.strokeWidth=30,this.tolerance=15,this.extendWidthX=this.strokeWidth/2,this.extendWidthY=this.strokeWidth/2,this.backgroundColor="#000000",this.backgroundOpacity=.5,this.colors=[{time:300,color:"#006837",opacity:.1},{time:600,color:"#39B54A",opacity:.2},{time:900,color:"#8CC63F",opacity:.3},{time:1200,color:"#F7931E",opacity:.4},{time:1500,color:"#F15A24",opacity:.5},{time:1800,color:"#C1272D",opacity:1}],"undefined"!=typeof t&&("undefined"!=typeof t.colors&&(this.colors=t.colors),"undefined"!=typeof t.opacity&&(this.opacity=t.opacity),"undefined"!=typeof t.strokeWidth&&(this.strokeWidth=t.strokeWidth),"undefined"!=typeof t.inverse&&(this.inverse=t.inverse),"undefined"!=typeof t.tolerance&&(this.tolerance=t.tolerance),"undefined"!=typeof t.extendWidthX&&(this.extendWidthX=t.extendWidthX),"undefined"!=typeof t.extendWidthY&&(this.extendWidthY=t.extendWidthY))},s