@targomo/core
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -5,3 +5,3 @@ { | ||
"author": "Targomo", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "repository": "github:targomo/targomo-js", |
/** | ||
* @targomo/core "0.1.4" http://targomo.com | ||
* @targomo/core "0.1.5" http://targomo.com | ||
* The JavaScript (& TypeScript) API for Targomo's time-based access mapping services. | ||
* (c) 2018 Targomo | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.tgm={})}(this,function(t){"use strict";function e(t,e){function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(s,a)}u((i=i.apply(t,e||[])).next())})}function i(t,e){function n(n){return function(s){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(o=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(o=o.call(r,n[1])).done)return o;switch(r=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],r=0}finally{i=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}var i,r,o,s,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s}function r(t,e){return new S}function o(t,e){var n=M*t.lat,i=M*t.lng,r=M*e.lat,o=M*e.lng;return Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(i-o))*x}function s(t,e){e*=1e3;var n=t.lat,i=t.lng,r=n*M,o=e/1e3/110.574235,s=e/1e3/(110.572833*Math.cos(r));return{northEast:{lat:n+o,lng:i+s},southWest:{lat:n-o,lng:i-s}}}function a(t){switch(t.travelType){case"walk":return 10;case"bike":return 25;case"transit":return 150;default:return 120}}function u(t,e,n){return e instanceof Array?c(t,e,n).filter(function(t){return!e.some(function(e){return e==t})}):c(t,e,n).filter(function(t){return e!=t})}function c(t,e,n){return e instanceof Array?t.filter(function(t){return e.some(function(e){return o(t,e)<=n})}):t.filter(function(t){return o(t,e)<=n})}function l(t,e){var n=_.unproject(t);return void 0!=e?{lat:n.lat,lng:n.lng,elevation:e}:n}function h(t){var e=t.lat,n=t.lon;return void 0===e&&t.center&&(e=t.center.lat,n=t.center.lon),new q(t.id,n,e,t.tags)}!function(t){function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=String(t)),t}function i(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return p.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function s(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function a(t){var e=new FileReader,n=s(e);return e.readAsArrayBuffer(t),n}function u(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(p.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(p.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(p.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(p.arrayBuffer&&p.blob&&g(t))this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!p.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!m(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=u(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):p.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},p.blob&&(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(a)}),this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=s(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t,e){var n=(e=e||{}).body;if(t instanceof l){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=function(t){var e=t.toUpperCase();return y.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function f(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var p={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(p.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=function(t){return t&&DataView.prototype.isPrototypeOf(t)},m=ArrayBuffer.isView||function(t){return t&&d.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,i){t=e(t),i=n(i);var r=this.map[t];this.map[t]=r?r+","+i:i},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,i){this.map[e(t)]=n(i)},r.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),i(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),i(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),i(t)},p.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this,{body:this._bodyInit})},c.call(l.prototype),c.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},f.error=function(){var t=new f(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];f.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new f(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=l,t.Response=f,t.fetch=function(t,e){return new Promise(function(n,i){var o=new l(t,e),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new r;return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new f(e,t))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.open(o.method,o.url,!0),"include"===o.credentials&&(s.withCredentials=!0),"responseType"in s&&p.blob&&(s.responseType="blob"),o.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:window);var f=function(){return function(t){this.serverUrl="https://api.targomo.com",this.statisticsUrl="https://api.targomo.com/statistics",this.tilesUrl="https://api.targomo.com/vector-statistics",this.poiUrl="https://api.targomo.com/pointofinterest",this.mapTilesUrl="https://maps.targomo.com",this.photonGeocoderUrl="https://api.targomo.com/geocode",this.overpassUrl="https://api.targomo.com/overpass",Object.assign(this,t)}}(),p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},d=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g=function(){return function(t,e,n,i){this.value=t,this.key=e,this.previous=n,this.next=i}}(),m=function(){function t(t){void 0===t&&(t=0),this.capacity=t,this.map={},this.size=0}return t.prototype.get=function(t,e){return n(this,void 0,void 0,function(){var n,r,o,s,a;return i(this,function(i){switch(i.label){case 0:return void 0===(n=this.map[t])?[3,2]:(this.oldest==n&&n.next&&(this.oldest=n.next),n.next&&(n.next.previous=n.previous),n.previous&&(n.previous.next=n.next),n.previous=this.newest,n.next=null,this.newest=n,[4,n.value]);case 1:return[2,i.sent()];case 2:return e?(r=e(),o=this.map[t]=new g(r,t,this.newest,null),[4,r]):[3,4];case 3:return s=i.sent(),this.newest&&(this.newest.next=o),this.newest=o,this.capacity&&(this.size>=this.capacity?(a=this.oldest)&&(this.oldest=a.next,delete this.map[a.key]):this.size++),this.oldest||(this.oldest=this.newest),[2,s];case 4:return[2,void 0]}})})},t}(),y=function(){function t(){this.map={}}return t.prototype.get=function(t,e){return n(this,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:return n="string"==typeof t?t:JSON.stringify(t),void 0==this.map[n]?[3,1]:[2,this.map[n]];case 1:return[4,e()];case 2:return r=i.sent(),this.map[n]=r,[2,r]}})})},t}(),v=new y,S=function(){function t(){}return t.prototype.fetch=function(t,e,r,o){return void 0===e&&(e="GET"),void 0===o&&(o={}),n(this,void 0,void 0,function(){var n,s,a,u,c,l,h,f,p,d;return i(this,function(i){switch(i.label){case 0:return n=e,"JSONP"!==e?o.Accept=o.Accept?o.Accept:"application/json":n="GET","POST-RAW"===e&&(n="POST"),"PUT"!==n&&"POST"!==n||(o["Content-Type"]="application/json"),s={method:n,headers:new Headers(o)},"POST-RAW"===e?s.body=r:"GET"!==e&&"JSONP"!==e&&(s.body=JSON.stringify(r)),[4,fetch(t,s)];case 1:return(a=i.sent()).status>=400?"application/json"!==a.headers.get("content-type")?[3,3]:(h=(l=JSON).stringify,[4,a.text()]):[3,6];case 2:return c=h.apply(l,[i.sent(),null,2]),[3,5];case 3:return[4,a.text()];case 4:c=i.sent(),i.label=5;case 5:throw u=c,new Error("[ERROR] in service request\n status = "+a.status+" "+a.statusText+"\n url = "+t+"\n body = "+u);case 6:return"JSONP"!==e?[3,8]:[4,a.text()];case 7:return f=i.sent(),p=f.indexOf("("),d=f.lastIndexOf(")"),p>-1&&d>-1?[2,JSON.parse(f.substring(p+1,d))]:[2,JSON.parse(f)];case 8:return[2,a.json()];case 9:return[2]}})})},t.prototype.fetchData=function(t,e,r,o){return void 0===e&&(e="GET"),n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.fetch(t,e,r,o)];case 1:return(n=i.sent()).data?[2,n.data]:(console.warn("No data object was transmitted by "+t+" \nReturning raw response"),[2,n])}})})},t.prototype.fetchCached=function(t,e,n,i,r){var o=this;if(void 0===n&&(n="GET"),!1!==t){!0!==t&&t||(t=v);var s=JSON.stringify({url:e,method:n,payload:i});return t.get(s,function(){return o.fetch(e,n,i,r)})}return this.fetch(e,n,i)},t.prototype.fetchCachedData=function(t,e,n,i,r){var o=this;if(void 0===n&&(n="GET"),!1!==t){!0!==t&&t||(t=v);var s=JSON.stringify({url:e,method:n,payload:i});return t.get(s,function(){return o.fetchData(e,n,i,r)})}return this.fetchData(e,n,i,r)},t}(),b=function(){function t(t){this.client=t}return t.prototype.fetch=function(t,e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n={west:o.southWest.lng,south:o.southWest.lat,east:o.northEast.lng,north:o.northEast.lat},s={bounds:n,benchmarks:e.map(function(t){return{source:t.source,minEnd:t.minEnd,minStart:t.minStart,factor:t.factor}})},a=this.client.config.tilesUrl+"/benchmarks/scores_cumulative/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(a,"POST",s)];case 1:return[2,i.sent()]}})})},t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return e=this.client.config.tilesUrl+"/benchmarks/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,n.sent()]}})})},t}();!function(t){t.queryToString=function(t){var e=[];for(var n in t){var i=t[n];void 0!==i&&e.push(n+"="+encodeURIComponent(i))}return e.join("&")},t.buildTargomoUrl=function(t,e,n,i){return void 0===i&&(i=!0),"/"!==t[t.length-1]&&(t+="/"),t+(i?"v1/":"")+e+"?key="+n}}(t.UrlUtil||(t.UrlUtil={}));var T=function(){function e(){}return e.prototype.geocode=function(e,o,s,a,u){return n(this,void 0,void 0,function(){var n,s,c,l;return i(this,function(i){switch(i.label){case 0:return n={singleLine:e,f:"json",countryCode:a,maxLocations:5},o&&(n.location=o.lng+","+o.lat),u&&(n.magicKey=u),s="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?"+t.UrlUtil.queryToString(n),[4,r().fetch(s)];case 1:return c=i.sent(),l=c.candidates.map(function(t){return{lat:t.location.y,lng:t.location.x,description:t.address}}),[2,l]}})})},e.prototype.suggest=function(e,o,s,a,u){return void 0===u&&(u=5),n(this,void 0,void 0,function(){var n,s;return i(this,function(i){switch(i.label){case 0:return n={text:e,f:"json",countryCode:a,maxSuggestions:u},o&&(n.location=o.lng+","+o.lat),[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?"+t.UrlUtil.queryToString(n))];case 1:return s=i.sent(),[2,s.suggestions]}})})},e.prototype.reverseGeocode=function(e,o){return n(this,void 0,void 0,function(){var n,o,s;return i(this,function(i){switch(i.label){case 0:return n={f:"json"},n.location=e.lng+","+e.lat,[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?"+t.UrlUtil.queryToString(n))];case 1:return(o=i.sent())&&o.address?(s={address:o.address.Match_addr,city:o.address.City,countryCode:o.address.CountryCode,location:o.address.Loc_name,region:o.address.Region,subregion:o.address.Subregion,zip:o.address.Postal},[2,s]):[2,{}]}})})},e}(),w=function(){function t(t){this.client=t}return t.prototype.geocode=function(t,e,o){return n(this,void 0,void 0,function(){var n,s,a,u,c=this;return i(this,function(i){switch(i.label){case 0:return n=this.client.config.photonGeocoderUrl,s=n+"/api/?q="+encodeURIComponent(t)+"&limit=5",e&&(s+="&lat="+e.lat+"&lon="+e.lng),o&&(s+="&lang="+encodeURIComponent(o)),[4,r().fetch(s)];case 1:return(a=i.sent()).features.forEach(function(t,e,n){"boundary"==t.properties.osm_key&&n.splice(e,1)}),u=a.features.map(function(t){return t.value=t.properties.osm_id,t.description=c.buildPlaceDescription(t.properties),t}),[2,u]}})})},t.prototype.buildPlaceDescription=function(t){var e=function(t,e){return void 0===e&&(e=" "),t.filter(function(t){return!!t}).join(e).trim()},n=function(n,i){return e(n.map(function(e){return t[e]}),i)},i=n(["street","housenumber"]," "),r=e([n(["postcode","city"]," "),t.country],", "),o={title:"",meta1:"",meta2:"",full:""};return void 0!==t.name?(o.title=t.name,o.meta1=i,o.meta2=r):(o.title=i,o.meta1=r),t.name!==i&&(o.full=o.title),o.meta1&&t.name!==i&&(o.full+=", "+o.meta1),o.meta1&&t.name===i&&(o.full+=o.meta1),o.full=e([o.full,o.meta2],", "),o},t}(),E=function(){function t(t){this.closestSources=!1,this.requestTimeout=null,this.walkSpeed={},this.bikeSpeed={},this.sources=[],this.targets=[],this.rushHour=!1,this.reverse=!1,this.recommendations=!1,this.pathSerializer="compact",this.polygonSerializer="json",this.pointReduction=!0,this.maxEdgeWeight=1800,this.travelType="bike",this.travelSpeed="medium",this.edgeWeight="time",this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.date=this.transitFrameDate,this.time=this.transitFrameTime,this.elevation=!0,this.useCache=!0,this.travelEdgeWeights=null,Object.assign(this,t)}return t.prototype.buildTargetsCfg=function(t){return t.map(function(t){return{lat:t.lat,lng:t.lng,id:t.id}})},t.prototype.buildSourcesCfg=function(t){var e=this;return t.map(function(t){var n={lat:t.lat,lng:t.lng,id:t.id,tm:t.tm};if(!n.tm)switch(e.travelType){case"car":n.tm={car:e.rushHour?{rushHour:e.rushHour}:{}};break;case"walk":n.tm={walk:e.walkSpeed};break;case"bike":n.tm={bike:e.bikeSpeed};break;case"transit":n.tm={transit:{date:e.transitFrameDate,time:e.transitFrameTime,duration:e.transitFrameDuration}}}return n})},t}(),U=(function(t){function n(e){var n=t.call(this,e)||this;return n.maxSolutions=1,n.name="",n.description="",n.email="",n.callbackUrl=null,n.useCache=!0,n}e(n,t)}(E),function(){return function(t,e,n){this.inactiveSources=[],this.sources=[],this.getClosestSources=!1,this.intersectionMode="union",this.appendTravelTimes=!1,this.date=n.transitFrameDate||20170801,this.time=n.transitFrameTime||39600,this.edgeWeight=void 0==n.edgeWeight?"time":n.edgeWeight,this.useCache=void 0==n.useCache||n.useCache,this.travelType=n.travelType,this.intersectionMode=n.intersectionMode||"union",this.sources=e.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}),n.inactiveSources&&(this.inactiveSources=n.inactiveSources.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}));var i=[];n.statistics&&(i=n.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id})),this.statisticGroupId=+n.statisticsGroup,this.statisticIds=i,this.maxEdgeWeight=n.maxEdgeWeight,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,n.closestSources&&(this.getClosestSources=!0),n.walkSpeed&&(this.walkDownhill=n.walkSpeed.downhill,this.walkSpeed=n.walkSpeed.speed,this.walkUphill=n.walkSpeed.uphill),n.bikeSpeed&&(this.bikeDownhill=n.bikeSpeed.downhill,this.bikeSpeed=n.bikeSpeed.speed,this.bikeUphill=n.bikeSpeed.uphill)}}()),A=function(){return function(){}}(),C=function(){return function(){}}();!function(t){t[t.GERMANY_ZENSUS_100M_STATISTICS=9]="GERMANY_ZENSUS_100M_STATISTICS",t[t.GERMANY_ZENSUS_200M_STATISTICS=2]="GERMANY_ZENSUS_200M_STATISTICS",t[t.GERMANY_ZENSUS_500M_STATISTICS=11]="GERMANY_ZENSUS_500M_STATISTICS",t[t.GERMANY_ZENSUS_1000M_STATISTICS=3]="GERMANY_ZENSUS_1000M_STATISTICS",t[t.GERMANY_ZENSUS_2000M_STATISTICS=10]="GERMANY_ZENSUS_2000M_STATISTICS",t[t.NORWAY_STATISTICS=4]="NORWAY_STATISTICS",t[t.CENSUS_BRANDENBURG_POPULATION=12]="CENSUS_BRANDENBURG_POPULATION",t[t.CANADA_BLOCK_STATISTICS=8]="CANADA_BLOCK_STATISTICS",t[t.CANADA_AREA_STATISTICS=5]="CANADA_AREA_STATISTICS",t[t.BERLIN_STATISTICS=6]="BERLIN_STATISTICS"}(t.StatisticsSet||(t.StatisticsSet={}));var R=function(){return function(){}}(),I=function(){return function(t){this.values=t,this.total=0;for(var e in this.values)this.total+=this.values[e]}}();!function(t){t[t.SRID_3857=3857]="SRID_3857",t[t.SRID_4326=4326]="SRID_4326"}(t.SRID||(t.SRID={})),function(t){t.NONE="none",t.SUM="sum",t.MAX="max",t.MIN="min",t.MEAN="mean",t.MEDIAN="median",t.NEAREST="nearest"}(t.MultigraphRequestAggregation||(t.MultigraphRequestAggregation={}));var _=new(function(){function t(){this.R=6378137}return t.prototype.project=function(t){var e=Math.PI/180,n=Math.max(Math.min(Math.sin(t.lat*e),1-1e-15),-(1-1e-15));return{x:this.R*t.lng*e,y:this.R*Math.log((1+n)/(1-n))/2}},t.prototype.unproject=function(t){var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,lng:t.x*e/this.R}},t}()),x=6371.01,M=Math.PI/180,O=Object.freeze({contains:function(t,e){return e.lat>=t.southWest.lat&&e.lat<=t.northEast.lat&&e.lng>=t.southWest.lng&&e.lng<=t.northEast.lng},calculateDistance:o,boundingBox:s,locationsWithinTravelOptions:function(t,e,n){var i,r=n.maxEdgeWeight;switch(n.travelType){case"walk":i=10;break;case"bike":i=25;break;case"transit":i=150;break;default:i=120}return u(t,e,"distance"===n.edgeWeight?Math.round(r/1e3):i*r/3600)},boundingBoxWithinTravelOptions:function(t,e){var n=e.maxEdgeWeight,i=a(e);return s(t,"distance"===e.edgeWeight?Math.round(n/1e3):i*n/3600)},boundingBoxFromLocationArray:function(t){return t.reduce(function(t,e){return t.northEast.lat=e.lat>t.northEast.lat?e.lat:t.northEast.lat,t.northEast.lng=e.lng>t.northEast.lng?e.lng:t.northEast.lng,t.southWest.lat=e.lat<t.southWest.lat?e.lat:t.southWest.lat,t.southWest.lng=e.lng<t.southWest.lng?e.lng:t.southWest.lng,t},{northEast:{lat:t[0].lat,lng:t[0].lng},southWest:{lat:t[0].lat,lng:t[0].lng}})},boundingBoxListWithinTravelOptions:function(t,e){var n=e.maxEdgeWeight,i=a(e),r="distance"===e.edgeWeight?Math.round(n/1e3):i*n/3600,o={northEast:{lat:-1/0,lng:-1/0},southWest:{lat:1/0,lng:1/0}};return t.forEach(function(t){var e=s(t,r);o.northEast.lat=Math.max(o.northEast.lat,e.northEast.lat),o.northEast.lng=Math.max(o.northEast.lng,e.northEast.lng),o.southWest.lat=Math.min(o.southWest.lat,e.southWest.lat),o.southWest.lng=Math.min(o.southWest.lng,e.southWest.lng)}),o},locationsWithinDistance:u,locationsWithinDistanceInclusive:c,webMercatorToLatLng:l,latLngToWebMercator:function(t){var e=_.project(t);return e.x*=6378137,e.y*=6378137,e}}),N=function(){function t(t,e){var n=this;this.points=[],this.type=e.type,this.travelTime=e.travelTime,this.distance=e.length/1e3,this.warning=e.warning,this.elevationGain=e.elevationGain,this.transitSegment=!1,this.startname=e.startname,this.endname=e.endname,e.points.forEach(function(t){n.points.push(l({x:t[1],y:t[0]},t[2]))}),e.isTransit&&(this.transitSegment=!0,this.routeType=e.routeType,this.routeShortName=e.routeShortName,this.startname=e.startname,this.endname=e.endname,this.departureTime=e.departureTime,this.arrivalTime=e.arrivalTime,this.tripHeadSign=e.tripHeadSign)}return t.prototype.getPoints=function(){return this.points},t.prototype.getType=function(){return this.type},t.prototype.getHaloColor=function(){return this.haloColor},t.prototype.getColor=function(){return this.color},t.prototype.getTravelTime=function(){return this.travelTime},t.prototype.getDistance=function(){return this.distance},t.prototype.getRouteType=function(){return this.routeType},t.prototype.getRouteShortName=function(){return this.routeShortName},t.prototype.getStartName=function(){return this.startname},t.prototype.getEndName=function(){return this.endname},t.prototype.getDepartureTime=function(){return this.departureTime},t.prototype.getArrivalTime=function(){return this.arrivalTime},t.prototype.getTripHeadSign=function(){return this.tripHeadSign},t.prototype.getWarning=function(){return this.warning},t.prototype.getElevationGain=function(){return this.elevationGain},t.prototype.isTransit=function(){return this.transitSegment},t}(),P=function(){function t(t,e,n,i){var r=this;this.travelTime=e,this.routeSegments=[],this.points=[],this.uphillMeter=0,this.downhillMeter=0,this.targetHeight=void 0,this.sourceHeight=void 0,this.sourceId=void 0,this.targetId=void 0,this.length=void 0,this.transfers=0,n.reverse().forEach(function(e){var n=new N(t,e);r.routeSegments.push(n),"TRANSFER"===n.type&&r.transfers++,r.points=r.points.concat(n.getPoints().reverse())}),void 0!==i&&(this.sourceId=i.source_id,this.targetId=i.target_id,this.length=i.length),this.setElevationDifferences()}return t.prototype.equals=function(t){return this.getKey()===t.getKey()},t.prototype.getKey=function(){var t=""+this.travelTime,e="";return this.getSegments().forEach(function(n){t+=" "+n.getRouteShortName()+" "+n.getDepartureTime()+" "+n.getArrivalTime(),n.getPoints().forEach(function(t){e+=" "+t.lat+t.lng})}),t+e},t.prototype.addRouteSegment=function(t){this.routeSegments.push(t)},t.prototype.setTravelTime=function(t){this.travelTime=t},t.prototype.getDistance=function(){for(var t=0,e=0;e<this.routeSegments.length;e++)t+=this.routeSegments[e].getDistance();return t},t.prototype.getElevationGain=function(){for(var t=0,e=0;e<this.routeSegments.length;e++)t+=this.routeSegments[e].getElevationGain();return t},t.prototype.getElevations=function(){for(var t={x:[],y:[]},e=0;e<1e3*this.getDistance();e+=100)t.x.push(e/1e3+" km"),t.y.push(this.getElevationAt(e));return t},t.prototype.getElevationAt=function(t){for(var e=0,n=1;n<this.points.length;n++){var i=this.points[n-1],r=this.points[n];if((e+=o(i,r))>t)return r.elevation}},t.prototype.getSegments=function(){return this.routeSegments},t.prototype.getUphillElevation=function(){return this.uphillMeter},t.prototype.getDownhillElevation=function(){return this.downhillMeter},t.prototype.getTotalElevationDifference=function(){return Math.abs(this.sourceHeight-this.targetHeight)},t.prototype.setElevationDifferences=function(){for(var t=void 0,e=this.points.length-1;e>=0;e--)0==e&&(this.targetHeight=this.points[e].elevation),e==this.points.length-1&&(this.sourceHeight=this.points[e].elevation),void 0!==t&&(t>this.points[e].elevation?this.uphillMeter+=t-this.points[e].elevation:t<this.points[e].elevation&&(this.downhillMeter+=this.points[e].elevation-t)),t=this.points[e].elevation},t.prototype.getTravelTime=function(){return this.travelTime},t}(),D=function(){return function(t,e){function n(t){for(var n={},i=0,r=e;i<r.length;i++){var o=r[i];n[o.name]=new I(t[o.id])}return n}var i={};if(t.individualStatistics)for(var r in t.individualStatistics)t.individualStatistics[r]&&t.individualStatistics[r].statistics&&(i[r]=n(t.individualStatistics[r].statistics));this.statistics=n(t.statistics),this.individualStatistics=i,this.raw=t}}();!function(t){t.CREATED="CREATED",t.ROUTING="ROUTING",t.MERGING="MERGING",t.AGGREGATING="AGGREGATING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"}(t.MultigraphStatus||(t.MultigraphStatus={}));var G=function(){return function(){this.minPolygonHoleSize=1e7,this.buffer=50,this.simplify=50,this.srid=t.SRID.SRID_4326,this.quadrantSegments=2,this.intersectionMode="union",this.decimalPrecision=6}}(),B=function(t){function n(e,n,i){var r=t.call(this,i)||this;return r.polygon=new G,r.sources=r.buildSourcesCfg(n),r.polygon.values=i.travelEdgeWeights,r.polygon.serializer=i.serializer,r.polygon.simplify=i.simplifyMeters,r.polygon.srid=i.srid,r.polygon.buffer=i.buffer,r.polygon.minPolygonHoleSize=i.minPolygonHoleSize,r.polygon.quadrantSegments=i.quadrantSegments,r.polygon.intersectionMode=i.intersectionMode,r}return e(n,t),n}(E),W=function(t){function n(e,n,i){var r=t.call(this,i)||this;return r.osmTypes=[],r.sources=r.buildSourcesCfg([n]),r.osmTypes=i.osmTypes,r.serviceKey=e.serviceKey,r.serviceUrl=e.serviceUrl,r}return e(n,t),n}(E),k=function(t){function n(e,n,i,r){var o=t.call(this,r)||this;return o.sources=o.buildSourcesCfg(n),o.targets=o.buildTargetsCfg(i),null!=r.intersectionMode&&(o.polygon={intersectionMode:r.intersectionMode}),o}return e(n,t),n}(E),j=function(t){function n(e,n,i){var r=t.call(this,e,n,i)||this;return delete r.inactiveSources,delete r.statisticGroupId,delete r.statisticIds,delete r.getClosestSources,delete r.useCache,i&&(r.multiGraphSerializationType=i.serialization&&i.serialization.type,r.multiGraphSerializationDecimalPrecision=i.serialization&&i.serialization.decimalPrecision,i.aggregation&&(r.multiGraphAggregationType=i.aggregation.type||null,r.multiGraphAggregationIgnoreOutlier=i.aggregation.ignoreOutliers||null,r.multiGraphAggregationMinSourcesRatio=i.aggregation.minSourcesRatio||null,r.multiGraphAggregationMinSourcesCount=i.aggregation.minSourceCount||null,r.multiGraphAggregationMaxResultValueRatio=i.aggregation.maxResultValueRatio||null,r.multiGraphAggregationMaxResultValue=i.aggregation.maxResultValue||null)),r}return e(n,t),n}(U),L=function(){function e(t){this.client=t}return e.prototype.create=function(e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph",this.client.serviceKey,!1),s=new j(this.client,e,o),[4,r(this.client).fetchCachedData(o.useClientCache,n,"POST",s,{Accept:"text/plain"})];case 1:return a=i.sent(),[2,a]}})})},e.prototype.info=function(e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e,this.client.serviceKey,!1),[4,r(this.client).fetch(n,"GET")];case 1:return(o=i.sent()).boundingBoxNorthEast&&o.boundingBoxSouthWest&&(o.boundingBox={northEast:{lat:o.boundingBoxNorthEast.y,lng:o.boundingBoxNorthEast.x},southWest:{lat:o.boundingBoxSouthWest.y,lng:o.boundingBoxSouthWest.x}},delete o.boundingBoxNorthEast,delete o.boundingBoxSouthWest),[2,o]}})})},e.prototype.redo=function(e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e+"/update",this.client.serviceKey,!1),[4,r(this.client).fetch(n,"PATCH")];case 1:return o=i.sent(),[2,o]}})})},e}(),F=function(){function t(t){this.client=t}return t.prototype.create=function(t,e){return n(this,void 0,void 0,function(){return i(this,function(e){if(!t.length)return[2,null];throw new Error("not implemented yet")})})},t.prototype.ready=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){return t instanceof Array||(t=[t]),e=this.client.config.statisticsUrl+"/simulation/ready?"+t.map(function(t){return"simulationId="+encodeURIComponent(""+ +t)}).join("&")+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),[2,r(this.client).fetch(e)]})})},t.prototype.fetch=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){return e=this.client.config.statisticsUrl+"/simulation/"+encodeURIComponent(""+ +t)+"?serviceUrl="+encodeURIComponent(this.client.serviceUrl),console.log("URL",e),[2,r(this.client).fetch(e)]})})},t}(),q=function(){function t(t,e,n,i){this.id=t,this.lng=e,this.lat=n,this.properties=i,this.properties&&(this.properties["marker-size"]=1)}return t.prototype.toString=function(){return this.properties?this.properties.name:""},t.prototype.copy=function(){var e=new t(this.id,this.lat,this.lng,d({},this.properties));for(var n in this)"properties"!=n&&(e[n]=this[n]);return e},t}(),H=function(){function t(t){this.client=t}return t.prototype.queryRaw=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(this.client.config.overpassUrl+"/api/interpreter","POST-RAW",t)];case 1:return e=n.sent(),[2,e.elements.filter(function(t){return!!t.tags}).map(function(t){return h(t)})]}})})},t.prototype.query=function(t,e){function n(t){if("*"===t.tag||null==t.tag)return'"'+t.type+'"';if(t.type&&t.tag)return'"'+t.type+'"="'+t.tag+'"';throw new Error("invalid query"+JSON.stringify(t))}var i=[];t.forEach(function(t){e.forEach(function(e){i.push("\n way["+n(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n node["+n(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n ")})});var r="\n [out:json];\n (\n "+i.join("")+"\n );\n out center;\n ";return this.queryRaw(r)},t.prototype.queryGetCustom=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(t)];case 1:return e=n.sent(),[2,e.elements.map(function(t){return h(t)})]}})})},t.prototype.reachable=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return n=this.client.config.poiUrl+"/reachability",[4,r(this.client).fetch(n,"POST",new W(this.client,t,e))];case 1:return[2,i.sent()]}})})},t}(),z=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"polygon",this.client.serviceKey),s=new B(this.client,e,o),[4,r(this.client).fetchCachedData(o.useClientCache,n,"POST",s)];case 1:if(a=i.sent(),"geojson"==o.serializer)return a.metadata=o,[2,a];throw new Error("TODO: svg parsing")}})})},e}(),K=function(){function e(t){this.client=t}return e.prototype.individual=function(e,o,s){return n(this,void 0,void 0,function(){var n,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"time",this.client.serviceKey),a=new k(this.client,e,o,s),[4,r(this.client).fetchCachedData(s.useClientCache,n,"POST",a)];case 1:return[2,i.sent()]}})})},e.prototype.combined=function(e,o,s){return n(this,void 0,void 0,function(){var n,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"reachability",this.client.serviceKey),a=new k(this.client,e,o,s),[4,r(this.client).fetchCachedData(s.useClientCache,n,"POST",a)];case 1:return[2,i.sent()]}})})},e.prototype.count=function(t,e,r){return n(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,this.locations(t,e,r)];case 1:return[2,n.sent().length]}})})},e.prototype.locations=function(t,e,r){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n={},e.forEach(function(t){return n[String(t.id)]=-1}),[4,this.combined(t,e,r)];case 1:return(o=i.sent()).forEach(function(t){var e=String(t.id);n[e]?t.travelTime>-1&&(n[e]>-1?n[e]=Math.min(n[e],t.travelTime):n[e]=t.travelTime):console.warn("NOT FOUND",String(t.id))}),[2,e.filter(function(t){var e=String(t.id);return t.travelTime=n[e],n[e]>-1})]}})})},e}(),J=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,o,s){return n(this,void 0,void 0,function(){var n,a,u,c=this;return i(this,function(i){switch(i.label){case 0:return n=new k(this.client,e,o,s),a=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"route",this.client.serviceKey)+"&cb=cb&cfg="+encodeURIComponent(JSON.stringify(n)),[4,r(this.client).fetchCachedData(s.useClientCache,a,"JSONP")];case 1:return u=i.sent(),[2,u.routes.map(function(t){return new P(c.client,t.travelTime,t.segments,t)})]}})})},e}(),Y=function(){function t(t){this.client=t}return t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return e=this.client.config.tilesUrl+"/similarity/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,n.sent()]}})})},t.prototype.fetch=function(t,e,o,s,a){return n(this,void 0,void 0,function(){var n,u,c,l;return i(this,function(i){switch(i.label){case 0:return n={west:s.southWest.lng,south:s.southWest.lat,east:s.northEast.lng,north:s.northEast.lat},u={bounds:n,refCellId:e,scores:o.map(function(t){return{source:t.source,minutes:t.minutes,factor:t.factor||1}})},c=a?"?normalizeOnViewport="+!!a:"",l=this.client.config.tilesUrl+"/similarity/scores_cumulative/v1/"+encodeURIComponent(""+t)+c,[4,r(this.client).fetch(l,"POST",u)];case 1:return[2,i.sent()]}})})},t}(),Z=function(){function t(t){this.client=t,this.statisticsMetadataCache=new m(200)}return t.prototype.combined=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.dependent(t,e)];case 1:return n=i.sent(),[2,n&&n.statistics]}})})},t.prototype.individual=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.dependent(t,e)];case 1:return n=i.sent(),[2,n&&n.individualStatistics]}})})},t.prototype.travelTimes=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return t.length?(n=this.client.config.statisticsUrl+"/traveltimes?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(n,"POST",new U(this.client,t,e))]):[2,null];case 1:return[2,i.sent()]}})})},t.prototype.dependent=function(t,e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return t.length?(n=this.client.config.statisticsUrl+"/charts/dependent?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(n,"POST",new U(this.client,t,e))]):[2,null];case 1:return o=i.sent(),[2,new D(o,e.statistics)]}})})},t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e,o,s,a=this;return i(this,function(u){switch(u.label){case 0:return e=this.client.config.tilesUrl,o="number"==typeof t?t:t.id,s=e+"-"+o,[4,this.statisticsMetadataCache.get(s,function(){return n(a,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(e+"/statistics/meta/v1/"+o)];case 1:return!(t=n.sent()).name&&t.names&&t.names.en&&(t.name=t.names.en),t.stats&&t.stats.length&&t.stats.forEach(function(t){!t.name&&t.names&&t.names.en&&(t.name=t.names.en)}),[2,t]}})})})];case 1:return[2,u.sent()]}})})},t.prototype.metadataKey=function(t,e){return n(this,void 0,void 0,function(){var n,r,o,s;return i(this,function(i){switch(i.label){case 0:return[4,this.metadata(t)];case 1:for(n=i.sent(),r=0,o=n.stats;r<o.length;r++)if(s=o[r],e.id==s.statistic_id||s.names&&s.names.en==e.name)return[2,s];return[2,null]}})})},t.prototype.tileRoute=function(t,e){return this.client.config.tilesUrl+"/statistics/tiles/v1/"+("number"==typeof t?t:t.id)+"/{z}/{x}/{y}.mvt?columns="+encodeURIComponent(e.map(function(t){return'"'+t.id+'"'}).join(","))+"&key="+encodeURIComponent(this.client.serviceKey)},t}(),V=function(){return function(t,e){this.esri=t,this.photon=e}}(),X=function(){function t(t,e,n){if(this.serviceKey=e,!t)throw new TypeError("Region parameter is missing");this.config=new f(n),t.includes("http")||t.includes("localhost")||t.includes("/")?this.serviceUrl=t:this.serviceUrl="https://api.targomo.com/"+t+"/",this.pois=new H(this),this.statistics=new Z(this),this.reachability=new K(this),this.optimizations=new F(this),this.geocoding=new V(new T,new w(this)),this.polygons=new z(this),this.routes=new J(this),this.similarity=new Y(this),this.benchmarks=new b(this),this.multigraph=new L(this)}return Object.defineProperty(t.prototype,"endpoint",{get:function(){var t=this.serviceUrl.split("/").filter(function(t){return!!t});return t[t.length-1]},enumerable:!0,configurable:!0}),t.prototype.metadata=function(){return n(this,void 0,void 0,function(){var t,e,n;return i(this,function(i){switch(i.label){case 0:return t=this.endpoint,e=this.serviceKey,n=this.config.serverUrl+"/"+t+"/v1/metadata/network?key="+encodeURIComponent(e),[4,r().fetch(n)];case 1:return[2,i.sent()]}})})},t}(),$=O;t.geometry=$,t.PointsOfInterestClient=H,t.ClientConfig=f,t.BenchmarksClient=b,t.GeocodeEsriClient=T,t.GeocodePhotonClient=w,t.MultigraphClient=L,t.OptimizationsClient=F,t.PolygonsClient=z,t.ReachabilityClient=K,t.RoutesClient=J,t.SimilarityClient=Y,t.StatisticsClient=Z,t.GeocodingClients=V,t.TargomoClient=X,t.LatLng=A,t.BoundingBox=C,t.TravelSpeedValues=R,t.Statistics=I,t.Route=P,t.RouteSegment=N,t.StatisticsResult=D,t.RequestsUtil=S,t.requests=r,t.SimpleLRU=m,t.SimpleCache=y,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.tgm={})}(this,function(t){"use strict";function e(t,e){function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function n(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(s,a)}u((i=i.apply(t,e||[])).next())})}function i(t,e){function n(n){return function(s){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(o=r[2&n[0]?"return":n[0]?"throw":"next"])&&!(o=o.call(r,n[1])).done)return o;switch(r=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],r=0}finally{i=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}var i,r,o,s,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s}function r(t,e){return new b}function o(t,e){var n=M*t.lat,i=M*t.lng,r=M*e.lat,o=M*e.lng;return Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(i-o))*x}function s(t,e){e*=1e3;var n=t.lat,i=t.lng,r=n*M,o=e/1e3/110.574235,s=e/1e3/(110.572833*Math.cos(r));return{northEast:{lat:n+o,lng:i+s},southWest:{lat:n-o,lng:i-s}}}function a(t){switch(t.travelType){case"walk":return 10;case"bike":return 25;case"transit":return 150;default:return 120}}function u(t,e,n){return e instanceof Array?c(t,e,n).filter(function(t){return!e.some(function(e){return e==t})}):c(t,e,n).filter(function(t){return e!=t})}function c(t,e,n){return e instanceof Array?t.filter(function(t){return e.some(function(e){return o(t,e)<=n})}):t.filter(function(t){return o(t,e)<=n})}function l(t,e){var n=_.unproject(t);return void 0!=e?{lat:n.lat,lng:n.lng,elevation:e}:n}function h(t){var e=t.lat,n=t.lon;return void 0===e&&t.center&&(e=t.center.lat,n=t.center.lon),new H(t.id,n,e,t.tags)}!function(t){function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=String(t)),t}function i(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return d.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function s(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function a(t){var e=new FileReader,n=s(e);return e.readAsArrayBuffer(t),n}function u(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(d.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(d.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(d.arrayBuffer&&d.blob&&m(t))this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!d.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!g(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=u(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):d.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d.blob&&(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(a)}),this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=s(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function l(t,e){var n=(e=e||{}).body;if(t instanceof l){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=function(t){var e=t.toUpperCase();return v.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function f(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var d={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(d.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},g=ArrayBuffer.isView||function(t){return t&&p.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,i){t=e(t),i=n(i);var r=this.map[t];this.map[t]=r?r+","+i:i},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,i){this.map[e(t)]=n(i)},r.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),i(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),i(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),i(t)},d.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this,{body:this._bodyInit})},c.call(l.prototype),c.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},f.error=function(){var t=new f(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];f.redirect=function(t,e){if(-1===y.indexOf(e))throw new RangeError("Invalid status code");return new f(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=l,t.Response=f,t.fetch=function(t,e){return new Promise(function(n,i){var o=new l(t,e),s=new XMLHttpRequest;s.onload=function(){var t={status:s.status,statusText:s.statusText,headers:function(t){var e=new r;return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}}),e}(s.getAllResponseHeaders()||"")};t.url="responseURL"in s?s.responseURL:t.headers.get("X-Request-URL");var e="response"in s?s.response:s.responseText;n(new f(e,t))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.open(o.method,o.url,!0),"include"===o.credentials&&(s.withCredentials=!0),"responseType"in s&&d.blob&&(s.responseType="blob"),o.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),s.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:window);var f=function(){return function(t){this.serverUrl="https://api.targomo.com",this.statisticsUrl="https://api.targomo.com/statistics",this.tilesUrl="https://api.targomo.com/vector-statistics",this.poiUrl="https://api.targomo.com/pointofinterest",this.mapTilesUrl="https://maps.targomo.com",this.photonGeocoderUrl="https://api.targomo.com/geocode",this.overpassUrl="https://api.targomo.com/overpass",Object.assign(this,t)}}(),d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},p=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},m=function(){return function(t,e,n,i){this.value=t,this.key=e,this.previous=n,this.next=i}}(),g=function(){function t(t){void 0===t&&(t=0),this.capacity=t,this.map={},this.size=0}return t.prototype.get=function(t,e){return n(this,void 0,void 0,function(){var n,r,o,s,a;return i(this,function(i){switch(i.label){case 0:return void 0===(n=this.map[t])?[3,2]:(this.oldest==n&&n.next&&(this.oldest=n.next),n.next&&(n.next.previous=n.previous),n.previous&&(n.previous.next=n.next),n.previous=this.newest,n.next=null,this.newest=n,[4,n.value]);case 1:return[2,i.sent()];case 2:return e?(r=e(),o=this.map[t]=new m(r,t,this.newest,null),[4,r]):[3,4];case 3:return s=i.sent(),this.newest&&(this.newest.next=o),this.newest=o,this.capacity&&(this.size>=this.capacity?(a=this.oldest)&&(this.oldest=a.next,delete this.map[a.key]):this.size++),this.oldest||(this.oldest=this.newest),[2,s];case 4:return[2,void 0]}})})},t}(),v=function(){function t(){this.map={}}return t.prototype.get=function(t,e){return n(this,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:return n="string"==typeof t?t:JSON.stringify(t),void 0==this.map[n]?[3,1]:[2,this.map[n]];case 1:return[4,e()];case 2:return r=i.sent(),this.map[n]=r,[2,r]}})})},t}(),y=new v,b=function(){function t(){}return t.prototype.fetch=function(t,e,r,o){return void 0===e&&(e="GET"),void 0===o&&(o={}),n(this,void 0,void 0,function(){var n,s,a,u,c,l,h,f,d,p;return i(this,function(i){switch(i.label){case 0:return n=e,"JSONP"!==e?o.Accept=o.Accept?o.Accept:"application/json":n="GET","POST-RAW"===e&&(n="POST"),"PUT"!==n&&"POST"!==n||(o["Content-Type"]="application/json"),s={method:n,headers:new Headers(o)},"POST-RAW"===e?s.body=r:"GET"!==e&&"JSONP"!==e&&(s.body=JSON.stringify(r)),[4,fetch(t,s)];case 1:return(a=i.sent()).status>=400?"application/json"!==a.headers.get("content-type")?[3,3]:(h=(l=JSON).stringify,[4,a.text()]):[3,6];case 2:return c=h.apply(l,[i.sent(),null,2]),[3,5];case 3:return[4,a.text()];case 4:c=i.sent(),i.label=5;case 5:throw u=c,new Error("[ERROR] in service request\n status = "+a.status+" "+a.statusText+"\n url = "+t+"\n body = "+u);case 6:return"JSONP"!==e?[3,8]:[4,a.text()];case 7:return f=i.sent(),d=f.indexOf("("),p=f.lastIndexOf(")"),d>-1&&p>-1?[2,JSON.parse(f.substring(d+1,p))]:[2,JSON.parse(f)];case 8:return[2,a.json()];case 9:return[2]}})})},t.prototype.fetchData=function(t,e,r,o){return void 0===e&&(e="GET"),n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.fetch(t,e,r,o)];case 1:return(n=i.sent()).data?[2,n.data]:(console.warn("No data object was transmitted by "+t+" \nReturning raw response"),[2,n])}})})},t.prototype.fetchCached=function(t,e,n,i,r){var o=this;if(void 0===n&&(n="GET"),!1!==t){!0!==t&&t||(t=y);var s=JSON.stringify({url:e,method:n,payload:i});return t.get(s,function(){return o.fetch(e,n,i,r)})}return this.fetch(e,n,i)},t.prototype.fetchCachedData=function(t,e,n,i,r){var o=this;if(void 0===n&&(n="GET"),!1!==t){!0!==t&&t||(t=y);var s=JSON.stringify({url:e,method:n,payload:i});return t.get(s,function(){return o.fetchData(e,n,i,r)})}return this.fetchData(e,n,i,r)},t}(),S=function(){function t(t){this.client=t}return t.prototype.fetch=function(t,e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n={west:o.southWest.lng,south:o.southWest.lat,east:o.northEast.lng,north:o.northEast.lat},s={bounds:n,benchmarks:e.map(function(t){return{source:t.source,minEnd:t.minEnd,minStart:t.minStart,factor:t.factor}})},a=this.client.config.tilesUrl+"/benchmarks/scores_cumulative/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(a,"POST",s)];case 1:return[2,i.sent()]}})})},t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return e=this.client.config.tilesUrl+"/benchmarks/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,n.sent()]}})})},t}();!function(t){t.queryToString=function(t){var e=[];for(var n in t){var i=t[n];void 0!==i&&e.push(n+"="+encodeURIComponent(i))}return e.join("&")},t.buildTargomoUrl=function(t,e,n,i){return void 0===i&&(i=!0),"/"!==t[t.length-1]&&(t+="/"),t+(i?"v1/":"")+e+"?key="+n}}(t.UrlUtil||(t.UrlUtil={}));var T=function(){function e(){}return e.prototype.geocode=function(e,o,s,a,u){return n(this,void 0,void 0,function(){var n,s,c,l;return i(this,function(i){switch(i.label){case 0:return n={singleLine:e,f:"json",countryCode:a,maxLocations:5},o&&(n.location=o.lng+","+o.lat),u&&(n.magicKey=u),s="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?"+t.UrlUtil.queryToString(n),[4,r().fetch(s)];case 1:return c=i.sent(),l=c.candidates.map(function(t){return{lat:t.location.y,lng:t.location.x,description:t.address}}),[2,l]}})})},e.prototype.suggest=function(e,o,s,a,u){return void 0===u&&(u=5),n(this,void 0,void 0,function(){var n,s;return i(this,function(i){switch(i.label){case 0:return n={text:e,f:"json",countryCode:a,maxSuggestions:u},o&&(n.location=o.lng+","+o.lat),[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?"+t.UrlUtil.queryToString(n))];case 1:return s=i.sent(),[2,s.suggestions]}})})},e.prototype.reverseGeocode=function(e,o){return n(this,void 0,void 0,function(){var n,o,s;return i(this,function(i){switch(i.label){case 0:return n={f:"json"},n.location=e.lng+","+e.lat,[4,r().fetch("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?"+t.UrlUtil.queryToString(n))];case 1:return(o=i.sent())&&o.address?(s={address:o.address.Match_addr,city:o.address.City,countryCode:o.address.CountryCode,location:o.address.Loc_name,region:o.address.Region,subregion:o.address.Subregion,zip:o.address.Postal},[2,s]):[2,{}]}})})},e}(),w=function(){function t(t){this.client=t}return t.prototype.geocode=function(t,e,o){return n(this,void 0,void 0,function(){var n,s,a,u,c=this;return i(this,function(i){switch(i.label){case 0:return n=this.client.config.photonGeocoderUrl,s=n+"/api/?q="+encodeURIComponent(t)+"&limit=5",e&&(s+="&lat="+e.lat+"&lon="+e.lng),o&&(s+="&lang="+encodeURIComponent(o)),[4,r().fetch(s)];case 1:return(a=i.sent()).features.forEach(function(t,e,n){"boundary"==t.properties.osm_key&&n.splice(e,1)}),u=a.features.map(function(t){return t.value=t.properties.osm_id,t.description=c.buildPlaceDescription(t.properties),t}),[2,u]}})})},t.prototype.buildPlaceDescription=function(t){var e=function(t,e){return void 0===e&&(e=" "),t.filter(function(t){return!!t}).join(e).trim()},n=function(n,i){return e(n.map(function(e){return t[e]}),i)},i=n(["street","housenumber"]," "),r=e([n(["postcode","city"]," "),t.country],", "),o={title:"",meta1:"",meta2:"",full:""};return void 0!==t.name?(o.title=t.name,o.meta1=i,o.meta2=r):(o.title=i,o.meta1=r),t.name!==i&&(o.full=o.title),o.meta1&&t.name!==i&&(o.full+=", "+o.meta1),o.meta1&&t.name===i&&(o.full+=o.meta1),o.full=e([o.full,o.meta2],", "),o},t}(),E=function(){function t(t){if(this.closestSources=!1,this.requestTimeout=null,this.walkSpeed={},this.bikeSpeed={},this.sources=[],this.targets=[],this.rushHour=!1,this.reverse=!1,this.recommendations=!1,this.pathSerializer="compact",this.polygonSerializer="json",this.pointReduction=!0,this.maxEdgeWeight=1800,this.travelType="bike",this.travelSpeed="medium",this.edgeWeight="time",this.transitFrameDuration=void 0,this.transitFrameDate=20170801,this.transitFrameTime=39600,this.date=this.transitFrameDate,this.time=this.transitFrameTime,this.elevation=!0,this.useCache=!0,this.travelEdgeWeights=null,Object.assign(this,t),null!=t.transitFrameDateTime){var e=new Date(t.transitFrameDateTime),n=e?1e4*e.getFullYear()+100*(e.getMonth()+1)+e.getDate():void 0,i=e?3600*e.getHours()+60*e.getMinutes():void 0;this.date=this.transitFrameDate=n||this.transitFrameDate,this.time=this.transitFrameTime=i||this.transitFrameTime}}return t.prototype.buildTargetsCfg=function(t){return t.map(function(t){return{lat:t.lat,lng:t.lng,id:t.id}})},t.prototype.buildSourcesCfg=function(t){var e=this;return t.map(function(t){var n={lat:t.lat,lng:t.lng,id:t.id,tm:t.tm};if(!n.tm)switch(e.travelType){case"car":n.tm={car:e.rushHour?{rushHour:e.rushHour}:{}};break;case"walk":n.tm={walk:e.walkSpeed};break;case"bike":n.tm={bike:e.bikeSpeed};break;case"transit":n.tm={transit:{frame:{date:e.transitFrameDate,time:e.transitFrameTime},duration:e.transitFrameDuration}}}return n})},t}(),U=(function(t){function n(e){var n=t.call(this,e)||this;return n.maxSolutions=1,n.name="",n.description="",n.email="",n.callbackUrl=null,n.useCache=!0,n}e(n,t)}(E),function(){return function(t,e,n){if(this.inactiveSources=[],this.sources=[],this.getClosestSources=!1,this.intersectionMode="union",this.appendTravelTimes=!1,this.date=n.transitFrameDate||20170801,this.time=n.transitFrameTime||39600,null!=n.transitFrameDateTime){var i=new Date(n.transitFrameDateTime),r=i?1e4*i.getFullYear()+100*(i.getMonth()+1)+i.getDate():void 0,o=i?3600*i.getHours()+60*i.getMinutes():void 0;this.date=this.date=r||this.date,this.time=this.time=o||this.time}this.edgeWeight=void 0==n.edgeWeight?"time":n.edgeWeight,this.useCache=void 0==n.useCache||n.useCache,this.travelType=n.travelType,this.intersectionMode=n.intersectionMode||"union",this.sources=e.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}),n.inactiveSources&&(this.inactiveSources=n.inactiveSources.map(function(t){return{id:t.id,y:t.lat,x:t.lng}}));var s=[];n.statistics&&(s=n.statistics.map(function(t){return t instanceof Number||"number"==typeof t?+t:t.id})),this.statisticGroupId=+n.statisticsGroup,this.statisticIds=s,this.maxEdgeWeight=n.maxEdgeWeight,this.serviceKey=t.serviceKey,this.serviceUrl=t.serviceUrl,n.closestSources&&(this.getClosestSources=!0),n.walkSpeed&&(this.walkDownhill=n.walkSpeed.downhill,this.walkSpeed=n.walkSpeed.speed,this.walkUphill=n.walkSpeed.uphill),n.bikeSpeed&&(this.bikeDownhill=n.bikeSpeed.downhill,this.bikeSpeed=n.bikeSpeed.speed,this.bikeUphill=n.bikeSpeed.uphill)}}()),A=function(){return function(){}}(),C=function(){return function(){}}();!function(t){t[t.GERMANY_ZENSUS_100M_STATISTICS=9]="GERMANY_ZENSUS_100M_STATISTICS",t[t.GERMANY_ZENSUS_200M_STATISTICS=2]="GERMANY_ZENSUS_200M_STATISTICS",t[t.GERMANY_ZENSUS_500M_STATISTICS=11]="GERMANY_ZENSUS_500M_STATISTICS",t[t.GERMANY_ZENSUS_1000M_STATISTICS=3]="GERMANY_ZENSUS_1000M_STATISTICS",t[t.GERMANY_ZENSUS_2000M_STATISTICS=10]="GERMANY_ZENSUS_2000M_STATISTICS",t[t.NORWAY_STATISTICS=4]="NORWAY_STATISTICS",t[t.CENSUS_BRANDENBURG_POPULATION=12]="CENSUS_BRANDENBURG_POPULATION",t[t.CANADA_BLOCK_STATISTICS=8]="CANADA_BLOCK_STATISTICS",t[t.CANADA_AREA_STATISTICS=5]="CANADA_AREA_STATISTICS",t[t.BERLIN_STATISTICS=6]="BERLIN_STATISTICS"}(t.StatisticsSet||(t.StatisticsSet={}));var I=function(){return function(){}}(),R=function(){return function(t){this.values=t,this.total=0;for(var e in this.values)this.total+=this.values[e]}}();!function(t){t[t.SRID_3857=3857]="SRID_3857",t[t.SRID_4326=4326]="SRID_4326"}(t.SRID||(t.SRID={})),function(t){t.NONE="none",t.SUM="sum",t.MAX="max",t.MIN="min",t.MEAN="mean",t.MEDIAN="median",t.NEAREST="nearest"}(t.MultigraphRequestAggregation||(t.MultigraphRequestAggregation={}));var _=new(function(){function t(){this.R=6378137}return t.prototype.project=function(t){var e=Math.PI/180,n=Math.max(Math.min(Math.sin(t.lat*e),1-1e-15),-(1-1e-15));return{x:this.R*t.lng*e,y:this.R*Math.log((1+n)/(1-n))/2}},t.prototype.unproject=function(t){var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,lng:t.x*e/this.R}},t}()),x=6371.01,M=Math.PI/180,O=Object.freeze({contains:function(t,e){return e.lat>=t.southWest.lat&&e.lat<=t.northEast.lat&&e.lng>=t.southWest.lng&&e.lng<=t.northEast.lng},calculateDistance:o,boundingBox:s,locationsWithinTravelOptions:function(t,e,n){var i,r=n.maxEdgeWeight;switch(n.travelType){case"walk":i=10;break;case"bike":i=25;break;case"transit":i=150;break;default:i=120}return u(t,e,"distance"===n.edgeWeight?Math.round(r/1e3):i*r/3600)},boundingBoxWithinTravelOptions:function(t,e){var n=e.maxEdgeWeight,i=a(e);return s(t,"distance"===e.edgeWeight?Math.round(n/1e3):i*n/3600)},boundingBoxFromLocationArray:function(t){return t.reduce(function(t,e){return t.northEast.lat=e.lat>t.northEast.lat?e.lat:t.northEast.lat,t.northEast.lng=e.lng>t.northEast.lng?e.lng:t.northEast.lng,t.southWest.lat=e.lat<t.southWest.lat?e.lat:t.southWest.lat,t.southWest.lng=e.lng<t.southWest.lng?e.lng:t.southWest.lng,t},{northEast:{lat:t[0].lat,lng:t[0].lng},southWest:{lat:t[0].lat,lng:t[0].lng}})},boundingBoxListWithinTravelOptions:function(t,e){var n=e.maxEdgeWeight,i=a(e),r="distance"===e.edgeWeight?Math.round(n/1e3):i*n/3600,o={northEast:{lat:-1/0,lng:-1/0},southWest:{lat:1/0,lng:1/0}};return t.forEach(function(t){var e=s(t,r);o.northEast.lat=Math.max(o.northEast.lat,e.northEast.lat),o.northEast.lng=Math.max(o.northEast.lng,e.northEast.lng),o.southWest.lat=Math.min(o.southWest.lat,e.southWest.lat),o.southWest.lng=Math.min(o.southWest.lng,e.southWest.lng)}),o},locationsWithinDistance:u,locationsWithinDistanceInclusive:c,webMercatorToLatLng:l,latLngToWebMercator:function(t){var e=_.project(t);return e.x*=6378137,e.y*=6378137,e}}),N=function(){return function(t,e){var n=this;this.points=[],this.type=e.type,this.travelTime=e.travelTime,this.distance=e.length/1e3,this.warning=e.warning,this.elevationGain=e.elevationGain,this.transitSegment=!1,this.startName=e.startname,this.endName=e.endname,e.points.forEach(function(t){n.points.push(l({x:t[1],y:t[0]},t[2]))}),e.isTransit&&(this.transitSegment=!0,this.routeType=e.routeType,this.routeShortName=e.routeShortName,this.startName=e.startname,this.endName=e.endname,this.departureTime=e.departureTime,this.arrivalTime=e.arrivalTime,this.tripHeadSign=e.tripHeadSign)}}(),D=function(){function t(t,e,n,i){var r=this;this.travelTime=e,this.routeSegments=[],this.targetHeight=void 0,this.sourceHeight=void 0,this.sourceId=void 0,this.targetId=void 0,this.length=void 0;var o=0,s=[];n.reverse().forEach(function(e){var n=new N(t,e);r.routeSegments.push(n),"TRANSFER"===n.type&&o++,s=s.concat(n.points.reverse())}),this.points=s,this.transfers=o,void 0!==i&&(this.sourceId=i.source_id,this.targetId=i.target_id,this.length=i.length);var a=this.calculateElevationDifferences(this.points);this.targetHeight=a.targetHeight,this.sourceHeight=a.sourceHeight,this.uphillMeter=a.uphillMeter,this.downhillMeter=a.downhillMeter,this.totalElevationDifference=Math.abs(this.sourceHeight-this.targetHeight),this.departureTime=this.calculateDepartureTime(),this.arrivalTime=this.calculateArrivalTime(),this.distance=this.calculateDistance(),this.elevationGain=this.calculateElevationGain()}return t.prototype.calculateDistance=function(){for(var t=0,e=0;e<this.routeSegments.length;e++)t+=this.routeSegments[e].distance;return t},t.prototype.calculateElevationGain=function(){for(var t=void 0,e=0;e<this.routeSegments.length;e++)isFinite(this.routeSegments[e].elevationGain)&&(t=(t||0)+this.routeSegments[e].elevationGain);return t},t.prototype.calculateElevationDifferences=function(t){for(var e=void 0,n=void 0,i=void 0,r=0,o=0,s=this.points.length-1;s>=0;s--)0==s&&(n=this.points[s].elevation),s==this.points.length-1&&(i=this.points[s].elevation),void 0!==e&&(e>this.points[s].elevation?r+=e-this.points[s].elevation:e<this.points[s].elevation&&(o+=this.points[s].elevation-e)),e=this.points[s].elevation;return{targetHeight:n,sourceHeight:i,uphillMeter:r,downhillMeter:o}},t.prototype.calculateDepartureTime=function(){for(var t=0,e=0;e<this.routeSegments.length;e++){var n=this.routeSegments[e];if(null!=n.departureTime)return n.departureTime-t;t+=n.travelTime||0}},t.prototype.calculateArrivalTime=function(){for(var t=0,e=this.routeSegments.length-1;e>=0;e--){var n=this.routeSegments[e];if(null!=n.arrivalTime)return n.arrivalTime-t;t+=n.travelTime||0}},t}(),P=function(){return function(t,e){function n(t){for(var n={},i=0,r=e;i<r.length;i++){var o=r[i];n[o.name]=new R(t[o.id])}return n}var i={};if(t.individualStatistics)for(var r in t.individualStatistics)t.individualStatistics[r]&&t.individualStatistics[r].statistics&&(i[r]=n(t.individualStatistics[r].statistics));this.statistics=n(t.statistics),this.individualStatistics=i,this.raw=t}}();!function(t){t.CREATED="CREATED",t.ROUTING="ROUTING",t.MERGING="MERGING",t.AGGREGATING="AGGREGATING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"}(t.MultigraphStatus||(t.MultigraphStatus={}));var G=function(){return function(){this.minPolygonHoleSize=1e7,this.buffer=50,this.simplify=50,this.srid=t.SRID.SRID_4326,this.quadrantSegments=2,this.intersectionMode="union",this.decimalPrecision=6}}(),B=function(t){function n(e,n,i){var r=t.call(this,i)||this;return r.polygon=new G,r.sources=r.buildSourcesCfg(n),r.polygon.values=i.travelEdgeWeights,r.polygon.serializer=i.serializer,r.polygon.simplify=i.simplifyMeters,r.polygon.srid=i.srid,r.polygon.buffer=i.buffer,r.polygon.minPolygonHoleSize=i.minPolygonHoleSize,r.polygon.quadrantSegments=i.quadrantSegments,r.polygon.intersectionMode=i.intersectionMode,r}return e(n,t),n}(E),W=function(t){function n(e,n,i){var r=t.call(this,i)||this;return r.osmTypes=[],r.sources=r.buildSourcesCfg([n]),r.osmTypes=i.osmTypes,r.serviceKey=e.serviceKey,r.serviceUrl=e.serviceUrl,r}return e(n,t),n}(E),k=function(t){function n(e,n,i,r){var o=t.call(this,r)||this;return o.sources=o.buildSourcesCfg(n),o.targets=o.buildTargetsCfg(i),null!=r.intersectionMode&&(o.polygon={intersectionMode:r.intersectionMode}),o}return e(n,t),n}(E),j=function(t){function n(e,n,i){var r=t.call(this,e,n,i)||this;return delete r.inactiveSources,delete r.statisticGroupId,delete r.statisticIds,delete r.getClosestSources,delete r.useCache,i&&(r.multiGraphSerializationType=i.serialization&&i.serialization.type,r.multiGraphSerializationDecimalPrecision=i.serialization&&i.serialization.decimalPrecision,i.aggregation&&(r.multiGraphAggregationType=i.aggregation.type||null,r.multiGraphAggregationIgnoreOutlier=i.aggregation.ignoreOutliers||null,r.multiGraphAggregationMinSourcesRatio=i.aggregation.minSourcesRatio||null,r.multiGraphAggregationMinSourcesCount=i.aggregation.minSourceCount||null,r.multiGraphAggregationMaxResultValueRatio=i.aggregation.maxResultValueRatio||null,r.multiGraphAggregationMaxResultValue=i.aggregation.maxResultValue||null)),r}return e(n,t),n}(U),F=function(){function e(t){this.client=t}return e.prototype.create=function(e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph",this.client.serviceKey,!1),s=new j(this.client,e,o),[4,r(this.client).fetchCachedData(o.useClientCache,n,"POST",s,{Accept:"text/plain"})];case 1:return a=i.sent(),[2,a]}})})},e.prototype.info=function(e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e,this.client.serviceKey,!1),[4,r(this.client).fetch(n,"GET")];case 1:return(o=i.sent()).boundingBoxNorthEast&&o.boundingBoxSouthWest&&(o.boundingBox={northEast:{lat:o.boundingBoxNorthEast.y,lng:o.boundingBoxNorthEast.x},southWest:{lat:o.boundingBoxSouthWest.y,lng:o.boundingBoxSouthWest.x}},delete o.boundingBoxNorthEast,delete o.boundingBoxSouthWest),[2,o]}})})},e.prototype.redo=function(e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.config.statisticsUrl,"multigraph/"+e+"/update",this.client.serviceKey,!1),[4,r(this.client).fetch(n,"PATCH")];case 1:return o=i.sent(),[2,o]}})})},e}(),L=function(){function t(t){this.client=t}return t.prototype.create=function(t,e){return n(this,void 0,void 0,function(){return i(this,function(e){if(!t.length)return[2,null];throw new Error("not implemented yet")})})},t.prototype.ready=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){return t instanceof Array||(t=[t]),e=this.client.config.statisticsUrl+"/simulation/ready?"+t.map(function(t){return"simulationId="+encodeURIComponent(""+ +t)}).join("&")+"&serviceUrl="+encodeURIComponent(this.client.serviceUrl),[2,r(this.client).fetch(e)]})})},t.prototype.fetch=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){return e=this.client.config.statisticsUrl+"/simulation/"+encodeURIComponent(""+ +t)+"?serviceUrl="+encodeURIComponent(this.client.serviceUrl),console.log("URL",e),[2,r(this.client).fetch(e)]})})},t}(),H=function(){function t(t,e,n,i){this.id=t,this.lng=e,this.lat=n,this.properties=i,this.properties&&(this.properties["marker-size"]=1)}return t.prototype.toString=function(){return this.properties?this.properties.name:""},t.prototype.copy=function(){var e=new t(this.id,this.lat,this.lng,p({},this.properties));for(var n in this)"properties"!=n&&(e[n]=this[n]);return e},t}(),q=function(){function t(t){this.client=t}return t.prototype.queryRaw=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(this.client.config.overpassUrl+"/api/interpreter","POST-RAW",t)];case 1:return e=n.sent(),[2,e.elements.filter(function(t){return!!t.tags}).map(function(t){return h(t)})]}})})},t.prototype.query=function(t,e){function n(t){if("*"===t.tag||null==t.tag)return'"'+t.type+'"';if(t.type&&t.tag)return'"'+t.type+'"="'+t.tag+'"';throw new Error("invalid query"+JSON.stringify(t))}var i=[];t.forEach(function(t){e.forEach(function(e){i.push("\n way["+n(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n node["+n(t)+"]\n ("+e.southWest.lat+","+e.southWest.lng+","+e.northEast.lat+","+e.northEast.lng+");\n ")})});var r="\n [out:json];\n (\n "+i.join("")+"\n );\n out center;\n ";return this.queryRaw(r)},t.prototype.queryGetCustom=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(t)];case 1:return e=n.sent(),[2,e.elements.map(function(t){return h(t)})]}})})},t.prototype.reachable=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return n=this.client.config.poiUrl+"/reachability",[4,r(this.client).fetch(n,"POST",new W(this.client,t,e))];case 1:return[2,i.sent()]}})})},t}(),z=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,o){return n(this,void 0,void 0,function(){var n,s,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"polygon",this.client.serviceKey),s=new B(this.client,e,o),[4,r(this.client).fetchCachedData(o.useClientCache,n,"POST",s)];case 1:if(a=i.sent(),"geojson"==o.serializer)return a.metadata=o,[2,a];throw new Error("TODO: svg parsing")}})})},e}(),K=function(){function e(t){this.client=t}return e.prototype.individual=function(e,o,s){return n(this,void 0,void 0,function(){var n,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"time",this.client.serviceKey),a=new k(this.client,e,o,s),[4,r(this.client).fetchCachedData(s.useClientCache,n,"POST",a)];case 1:return[2,i.sent()]}})})},e.prototype.combined=function(e,o,s){return n(this,void 0,void 0,function(){var n,a;return i(this,function(i){switch(i.label){case 0:return n=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"reachability",this.client.serviceKey),a=new k(this.client,e,o,s),[4,r(this.client).fetchCachedData(s.useClientCache,n,"POST",a)];case 1:return[2,i.sent()]}})})},e.prototype.count=function(t,e,r){return n(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:return[4,this.locations(t,e,r)];case 1:return[2,n.sent().length]}})})},e.prototype.locations=function(t,e,r){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return n={},e.forEach(function(t){return n[String(t.id)]=-1}),[4,this.combined(t,e,r)];case 1:return(o=i.sent()).forEach(function(t){var e=String(t.id);n[e]?t.travelTime>-1&&(n[e]>-1?n[e]=Math.min(n[e],t.travelTime):n[e]=t.travelTime):console.warn("NOT FOUND",String(t.id))}),[2,e.filter(function(t){var e=String(t.id);return t.travelTime=n[e],n[e]>-1})]}})})},e}(),J=function(t){function n(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return r.recommendations&&o.sources&&o.sources.forEach(function(t){if(null!=t.tm)for(var e in t.tm)t.tm[e].recommendations=1}),o}return e(n,t),n}(k),Y=function(){function e(t){this.client=t}return e.prototype.fetch=function(e,o,s){return n(this,void 0,void 0,function(){var n,a,u,c=this;return i(this,function(i){switch(i.label){case 0:return n=new J(this.client,e,o,s),a=t.UrlUtil.buildTargomoUrl(this.client.serviceUrl,"route",this.client.serviceKey)+"&cb=cb&cfg="+encodeURIComponent(JSON.stringify(n)),[4,r(this.client).fetchCachedData(s.useClientCache,a,"JSONP")];case 1:return u=i.sent(),[2,u.routes.map(function(t){return new D(c.client,t.travelTime,t.segments,t)})]}})})},e}(),Z=function(){function t(t){this.client=t}return t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n.label){case 0:return e=this.client.config.tilesUrl+"/similarity/meta/v1/"+encodeURIComponent(""+t),[4,r(this.client).fetch(e)];case 1:return[2,n.sent()]}})})},t.prototype.fetch=function(t,e,o,s,a){return n(this,void 0,void 0,function(){var n,u,c,l;return i(this,function(i){switch(i.label){case 0:return n={west:s.southWest.lng,south:s.southWest.lat,east:s.northEast.lng,north:s.northEast.lat},u={bounds:n,refCellId:e,scores:o.map(function(t){return{source:t.source,minutes:t.minutes,factor:t.factor||1}})},c=a?"?normalizeOnViewport="+!!a:"",l=this.client.config.tilesUrl+"/similarity/scores_cumulative/v1/"+encodeURIComponent(""+t)+c,[4,r(this.client).fetch(l,"POST",u)];case 1:return[2,i.sent()]}})})},t}(),V=function(){function t(t){this.client=t,this.statisticsMetadataCache=new g(200)}return t.prototype.combined=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.dependent(t,e)];case 1:return n=i.sent(),[2,n&&n.statistics]}})})},t.prototype.individual=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return[4,this.dependent(t,e)];case 1:return n=i.sent(),[2,n&&n.individualStatistics]}})})},t.prototype.travelTimes=function(t,e){return n(this,void 0,void 0,function(){var n;return i(this,function(i){switch(i.label){case 0:return t.length?(n=this.client.config.statisticsUrl+"/traveltimes?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(n,"POST",new U(this.client,t,e))]):[2,null];case 1:return[2,i.sent()]}})})},t.prototype.dependent=function(t,e){return n(this,void 0,void 0,function(){var n,o;return i(this,function(i){switch(i.label){case 0:return t.length?(n=this.client.config.statisticsUrl+"/charts/dependent?serviceUrl="+encodeURIComponent(this.client.serviceUrl),[4,r(this.client).fetch(n,"POST",new U(this.client,t,e))]):[2,null];case 1:return o=i.sent(),[2,new P(o,e.statistics)]}})})},t.prototype.metadata=function(t){return n(this,void 0,void 0,function(){var e,o,s,a=this;return i(this,function(u){switch(u.label){case 0:return e=this.client.config.tilesUrl,o="number"==typeof t?t:t.id,s=e+"-"+o,[4,this.statisticsMetadataCache.get(s,function(){return n(a,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return[4,r(this.client).fetch(e+"/statistics/meta/v1/"+o)];case 1:return!(t=n.sent()).name&&t.names&&t.names.en&&(t.name=t.names.en),t.stats&&t.stats.length&&t.stats.forEach(function(t){!t.name&&t.names&&t.names.en&&(t.name=t.names.en)}),[2,t]}})})})];case 1:return[2,u.sent()]}})})},t.prototype.metadataKey=function(t,e){return n(this,void 0,void 0,function(){var n,r,o,s;return i(this,function(i){switch(i.label){case 0:return[4,this.metadata(t)];case 1:for(n=i.sent(),r=0,o=n.stats;r<o.length;r++)if(s=o[r],e.id==s.statistic_id||s.names&&s.names.en==e.name)return[2,s];return[2,null]}})})},t.prototype.tileRoute=function(t,e){return this.client.config.tilesUrl+"/statistics/tiles/v1/"+("number"==typeof t?t:t.id)+"/{z}/{x}/{y}.mvt?columns="+encodeURIComponent(e.map(function(t){return'"'+t.id+'"'}).join(","))+"&key="+encodeURIComponent(this.client.serviceKey)},t}(),X=function(){return function(t,e){this.esri=t,this.photon=e}}(),$=function(){function t(t,e,n){if(this.serviceKey=e,!t)throw new TypeError("Region parameter is missing");this.config=new f(n),t.includes("http")||t.includes("localhost")||t.includes("/")?this.serviceUrl=t:this.serviceUrl="https://api.targomo.com/"+t+"/",this.pois=new q(this),this.statistics=new V(this),this.reachability=new K(this),this.optimizations=new L(this),this.geocoding=new X(new T,new w(this)),this.polygons=new z(this),this.routes=new Y(this),this.similarity=new Z(this),this.benchmarks=new S(this),this.multigraph=new F(this)}return Object.defineProperty(t.prototype,"endpoint",{get:function(){var t=this.serviceUrl.split("/").filter(function(t){return!!t});return t[t.length-1]},enumerable:!0,configurable:!0}),t.prototype.metadata=function(){return n(this,void 0,void 0,function(){var t,e,n;return i(this,function(i){switch(i.label){case 0:return t=this.endpoint,e=this.serviceKey,n=this.config.serverUrl+"/"+t+"/v1/metadata/network?key="+encodeURIComponent(e),[4,r().fetch(n)];case 1:return[2,i.sent()]}})})},t}(),Q=O;t.geometry=Q,t.PointsOfInterestClient=q,t.ClientConfig=f,t.BenchmarksClient=S,t.GeocodeEsriClient=T,t.GeocodePhotonClient=w,t.MultigraphClient=F,t.OptimizationsClient=L,t.PolygonsClient=z,t.ReachabilityClient=K,t.RoutesClient=Y,t.SimilarityClient=Z,t.StatisticsClient=V,t.GeocodingClients=X,t.TargomoClient=$,t.LatLng=A,t.BoundingBox=C,t.TravelSpeedValues=I,t.Statistics=R,t.Route=D,t.RouteSegment=N,t.StatisticsResult=P,t.RequestsUtil=b,t.requests=r,t.SimpleLRU=g,t.SimpleCache=v,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=targomo-core.umd.min.js.map |
import { TravelRequestOptions, TravelOptionsClientCache } from '../index'; | ||
export interface RouteRequestOptions extends TravelRequestOptions, TravelOptionsClientCache { | ||
recommendations?: boolean; | ||
} |
import { RouteSegment } from './routeSegment'; | ||
import { LatLng } from '../index'; | ||
import { TargomoClient } from '../../api/targomoClient'; | ||
/** | ||
* | ||
*/ | ||
export declare class Route { | ||
travelTime: number; | ||
routeSegments: RouteSegment[]; | ||
points: LatLng[]; | ||
uphillMeter: number; | ||
downhillMeter: number; | ||
targetHeight: number; | ||
sourceHeight: number; | ||
sourceId: any; | ||
targetId: any; | ||
length: number; | ||
transfers: any; | ||
readonly travelTime: number; | ||
readonly routeSegments: RouteSegment[]; | ||
readonly points: LatLng[]; | ||
readonly uphillMeter: number; | ||
readonly downhillMeter: number; | ||
readonly targetHeight: number; | ||
readonly sourceHeight: number; | ||
readonly sourceId: any; | ||
readonly targetId: any; | ||
readonly length: number; | ||
readonly transfers: any; | ||
readonly departureTime: number; | ||
readonly arrivalTime: number; | ||
readonly totalElevationDifference: number; | ||
readonly distance: number; | ||
readonly elevationGain: number; | ||
constructor(client: TargomoClient, travelTime: number, segments: any[], meta: any); | ||
equals(route: Route): boolean; | ||
getKey(): string; | ||
addRouteSegment(routeSegment: RouteSegment): void; | ||
setTravelTime(travelTime: number): void; | ||
getDistance(): number; | ||
/** | ||
* [getElevationGain description] | ||
* @return {type} [description] | ||
*/ | ||
getElevationGain(): number; | ||
/** | ||
* [getElevations description] | ||
* @return {type} [description] | ||
*/ | ||
getElevations(): any; | ||
/** | ||
* [getElevationAt description] | ||
* @param {type} meter [description] | ||
* @return {type} [description] | ||
*/ | ||
getElevationAt(meter: number): number; | ||
getSegments(): RouteSegment[]; | ||
getUphillElevation(): number; | ||
getDownhillElevation(): number; | ||
getTotalElevationDifference(): number; | ||
setElevationDifferences(): void; | ||
getTravelTime(): number; | ||
private calculateDistance(); | ||
private calculateElevationGain(); | ||
private calculateElevationDifferences(points); | ||
private calculateDepartureTime(); | ||
private calculateArrivalTime(); | ||
} |
import { TargomoClient } from '../../api/targomoClient'; | ||
import { LatLng } from '../types'; | ||
/** | ||
* Represents a continuous segment of a route using one travel mode | ||
*/ | ||
export declare class RouteSegment { | ||
type: string; | ||
private points; | ||
private travelTime; | ||
private distance; | ||
private warning; | ||
private elevationGain; | ||
private transitSegment; | ||
private startname; | ||
private endname; | ||
private color; | ||
private haloColor; | ||
private routeType; | ||
private routeShortName; | ||
private departureTime; | ||
private arrivalTime; | ||
private tripHeadSign; | ||
readonly type: string; | ||
readonly points: LatLng[]; | ||
readonly travelTime: number; | ||
readonly distance: number; | ||
readonly warning: string; | ||
readonly elevationGain: number; | ||
readonly transitSegment: boolean; | ||
readonly startName: string; | ||
readonly endName: string; | ||
readonly routeType: any; | ||
readonly routeShortName: string; | ||
readonly departureTime: number; | ||
readonly arrivalTime: number; | ||
readonly tripHeadSign: string; | ||
constructor(client: TargomoClient, segment: any); | ||
getPoints(): any[]; | ||
getType(): string; | ||
getHaloColor(): string; | ||
getColor(): string; | ||
getTravelTime(): number; | ||
getDistance(): number; | ||
getRouteType(): any; | ||
getRouteShortName(): string; | ||
getStartName(): string; | ||
getEndName(): string; | ||
getDepartureTime(): any; | ||
getArrivalTime(): any; | ||
getTripHeadSign(): any; | ||
getWarning(): string; | ||
getElevationGain(): number; | ||
isTransit(): boolean; | ||
} |
@@ -23,2 +23,6 @@ import { TravelSpeedValues, TravelSpeed, TravelType } from './types'; | ||
transitFrameTime?: number; | ||
/** | ||
* Accepts either a javascript date object or a timestamp number | ||
*/ | ||
transitFrameDateTime?: Date | number; | ||
elevation?: boolean; | ||
@@ -25,0 +29,0 @@ useCache?: boolean; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58
725568
6315